From 84341f4b2014810b2964230384fe76338be1d78e Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Fri, 19 Mar 2010 15:32:57 -0700 Subject: Make sure that symbols aren't multiply defined in the same scope. The assembly parser is already checking this, but we're relying on the symbol table handling it in glsl2. --- src/mesa/shader/symbol_table.c | 52 +++++++++++++++++++++++++++++++++++++++++- src/mesa/shader/symbol_table.h | 3 +++ 2 files changed, 54 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/shader/symbol_table.c b/src/mesa/shader/symbol_table.c index 6a5d686897..3fea5ee1f1 100644 --- a/src/mesa/shader/symbol_table.c +++ b/src/mesa/shader/symbol_table.c @@ -58,7 +58,9 @@ struct symbol { */ int name_space; - + /** Scope depth where this symbol was defined. */ + unsigned depth; + /** * Arbitrary user supplied data. */ @@ -104,6 +106,9 @@ struct _mesa_symbol_table { /** List of all symbol headers in the table. */ struct symbol_header *hdr; + + /** Current scope depth. */ + unsigned depth; }; @@ -157,6 +162,7 @@ _mesa_symbol_table_pop_scope(struct _mesa_symbol_table *table) struct symbol *sym = scope->symbols; table->current_scope = scope->next; + table->depth--; free(scope); @@ -184,6 +190,7 @@ _mesa_symbol_table_push_scope(struct _mesa_symbol_table *table) scope->next = table->current_scope; table->current_scope = scope; + table->depth++; } @@ -261,6 +268,36 @@ _mesa_symbol_table_iterator_next(struct _mesa_symbol_table_iterator *iter) } +/** + * 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) @@ -309,12 +346,25 @@ _mesa_symbol_table_add_symbol(struct _mesa_symbol_table *table, 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); diff --git a/src/mesa/shader/symbol_table.h b/src/mesa/shader/symbol_table.h index 0c054ef139..1d570fc1a0 100644 --- a/src/mesa/shader/symbol_table.h +++ b/src/mesa/shader/symbol_table.h @@ -33,6 +33,9 @@ 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); -- cgit v1.2.3 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. --- .dir-locals.el | 3 - .gitignore | 25 - Makefile.am | 79 - TODO | 84 - ast.h | 651 --- ast_expr.cpp | 96 - ast_function.cpp | 751 --- ast_to_hir.cpp | 2453 ---------- ast_type.cpp | 110 - autogen.sh | 12 - builtin_function.cpp | 5080 -------------------- builtin_types.h | 268 -- builtin_variables.h | 93 - builtins/110/abs | 21 - builtins/110/all | 16 - builtins/110/any | 16 - builtins/110/asin | 112 - builtins/110/atan | 154 - builtins/110/ceil | 21 - builtins/110/clamp | 62 - builtins/110/cos | 21 - builtins/110/cross | 17 - builtins/110/degrees | 21 - builtins/110/distance | 33 - builtins/110/dot | 25 - builtins/110/equal | 61 - builtins/110/exp | 21 - builtins/110/exp2 | 21 - builtins/110/faceforward | 37 - builtins/110/floor | 21 - builtins/110/fract | 34 - builtins/110/greaterThan | 61 - builtins/110/greaterThanEqual | 61 - builtins/110/inversesqrt | 21 - builtins/110/length | 21 - builtins/110/lessThan | 61 - builtins/110/lessThanEqual | 61 - builtins/110/log | 21 - builtins/110/log2 | 21 - builtins/110/matrixCompMult | 32 - builtins/110/max | 64 - builtins/110/min | 64 - builtins/110/mix | 50 - builtins/110/mod | 64 - builtins/110/noise_fake | 76 - builtins/110/normalize | 21 - builtins/110/not | 16 - builtins/110/notEqual | 61 - builtins/110/pow | 25 - builtins/110/radians | 21 - builtins/110/reflect | 58 - builtins/110/refract | 102 - builtins/110/sign | 34 - builtins/110/sin | 21 - builtins/110/smoothstep | 224 - builtins/110/sqrt | 21 - builtins/110/step | 68 - builtins/110/tan | 21 - builtins/110/textures | 213 - builtins/110_fs/derivatives | 73 - builtins/110_fs/textures | 113 - builtins/110_vs/ftransform | 7 - builtins/120/matrixCompMult | 61 - builtins/120/outerProduct | 92 - builtins/120/transpose | 139 - builtins/130/clamp | 123 - builtins/130/cosh | 30 - builtins/130/equal | 31 - builtins/130/greaterThan | 31 - builtins/130/greaterThanEqual | 31 - builtins/130/lessThan | 31 - builtins/130/lessThanEqual | 31 - builtins/130/max | 127 - builtins/130/min | 127 - builtins/130/notEqual | 31 - builtins/130/sign | 34 - builtins/130/sinh | 30 - builtins/130/tanh | 42 - builtins/130/texelFetch | 107 - builtins/130/texture | 110 - builtins/130/textureGrad | 147 - builtins/130/textureLod | 128 - builtins/130/textureProj | 92 - builtins/130/textureProjGrad | 122 - builtins/130/textureProjLod | 107 - builtins/130_fs/texture | 128 - builtins/130_fs/textureProj | 107 - builtins/ARB_texture_rectangle/textures | 16 - builtins/EXT_texture_array/textures | 59 - builtins/EXT_texture_array_fs/textures | 27 - builtins/tools/generate_builtins.pl | 123 - builtins/tools/generate_matrixCompMultGLSL.py | 28 - builtins/tools/generate_outerProductGLSL.py | 23 - builtins/tools/generate_transposeGLSL.py | 28 - builtins/tools/texture_builtins.py | 298 -- configure.ac | 69 - glcpp/.gitignore | 11 - glcpp/Makefile.am | 46 - glcpp/README | 30 - glcpp/glcpp-lex.l | 257 - glcpp/glcpp-parse.y | 1611 ------- glcpp/glcpp.c | 88 - glcpp/glcpp.h | 224 - glcpp/hash_table.c | 159 - glcpp/hash_table.h | 125 - glcpp/main/imports.h | 6 - glcpp/main/simple_list.h | 235 - glcpp/pp.c | 155 - glcpp/tests/000-content-with-spaces.c | 1 - glcpp/tests/000-content-with-spaces.c.expected | 2 - glcpp/tests/001-define.c | 2 - glcpp/tests/001-define.c.expected | 3 - glcpp/tests/002-define-chain.c | 3 - glcpp/tests/002-define-chain.c.expected | 4 - glcpp/tests/003-define-chain-reverse.c | 3 - glcpp/tests/003-define-chain-reverse.c.expected | 4 - glcpp/tests/004-define-recursive.c | 6 - glcpp/tests/004-define-recursive.c.expected | 7 - glcpp/tests/005-define-composite-chain.c | 3 - glcpp/tests/005-define-composite-chain.c.expected | 4 - glcpp/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 - glcpp/tests/008-define-empty.c | 2 - glcpp/tests/008-define-empty.c.expected | 3 - glcpp/tests/009-undef.c | 4 - glcpp/tests/009-undef.c.expected | 5 - glcpp/tests/010-undef-re-define.c | 6 - glcpp/tests/010-undef-re-define.c.expected | 7 - glcpp/tests/011-define-func-empty.c | 2 - glcpp/tests/011-define-func-empty.c.expected | 3 - 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 - glcpp/tests/016-define-func-1-arg.c | 2 - glcpp/tests/016-define-func-1-arg.c.expected | 3 - glcpp/tests/017-define-func-2-args.c | 2 - glcpp/tests/017-define-func-2-args.c.expected | 3 - glcpp/tests/018-define-func-macro-as-parameter.c | 3 - .../018-define-func-macro-as-parameter.c.expected | 4 - glcpp/tests/019-define-func-1-arg-multi.c | 2 - glcpp/tests/019-define-func-1-arg-multi.c.expected | 3 - glcpp/tests/020-define-func-2-arg-multi.c | 2 - glcpp/tests/020-define-func-2-arg-multi.c.expected | 3 - 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 - glcpp/tests/023-define-extra-whitespace.c | 8 - glcpp/tests/023-define-extra-whitespace.c.expected | 9 - glcpp/tests/024-define-chain-to-self-recursion.c | 3 - .../024-define-chain-to-self-recursion.c.expected | 4 - glcpp/tests/025-func-macro-as-non-macro.c | 2 - glcpp/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 - glcpp/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 - glcpp/tests/038-func-arg-with-commas.c | 2 - glcpp/tests/038-func-arg-with-commas.c.expected | 3 - glcpp/tests/039-func-arg-obj-macro-with-comma.c | 3 - .../039-func-arg-obj-macro-with-comma.c.expected | 4 - glcpp/tests/040-token-pasting.c | 2 - glcpp/tests/040-token-pasting.c.expected | 3 - glcpp/tests/041-if-0.c | 5 - glcpp/tests/041-if-0.c.expected | 6 - glcpp/tests/042-if-1.c | 5 - glcpp/tests/042-if-1.c.expected | 6 - glcpp/tests/043-if-0-else.c | 7 - glcpp/tests/043-if-0-else.c.expected | 8 - glcpp/tests/044-if-1-else.c | 7 - glcpp/tests/044-if-1-else.c.expected | 8 - glcpp/tests/045-if-0-elif.c | 11 - glcpp/tests/045-if-0-elif.c.expected | 12 - glcpp/tests/046-if-1-elsif.c | 11 - glcpp/tests/046-if-1-elsif.c.expected | 12 - glcpp/tests/047-if-elif-else.c | 11 - glcpp/tests/047-if-elif-else.c.expected | 12 - glcpp/tests/048-if-nested.c | 11 - glcpp/tests/048-if-nested.c.expected | 12 - glcpp/tests/049-if-expression-precedence.c | 5 - .../tests/049-if-expression-precedence.c.expected | 6 - glcpp/tests/050-if-defined.c | 17 - glcpp/tests/050-if-defined.c.expected | 18 - glcpp/tests/051-if-relational.c | 35 - glcpp/tests/051-if-relational.c.expected | 36 - glcpp/tests/052-if-bitwise.c | 20 - glcpp/tests/052-if-bitwise.c.expected | 21 - glcpp/tests/053-if-divide-and-shift.c | 15 - glcpp/tests/053-if-divide-and-shift.c.expected | 16 - glcpp/tests/054-if-with-macros.c | 34 - 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 - glcpp/tests/057-empty-arguments.c | 6 - glcpp/tests/057-empty-arguments.c.expected | 7 - glcpp/tests/058-token-pasting-empty-arguments.c | 5 - .../058-token-pasting-empty-arguments.c.expected | 6 - glcpp/tests/059-token-pasting-integer.c | 4 - glcpp/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 - glcpp/tests/061-define-chain-obj-to-func-multi.c | 5 - .../061-define-chain-obj-to-func-multi.c.expected | 6 - glcpp/tests/062-if-0-skips-garbage.c | 5 - glcpp/tests/062-if-0-skips-garbage.c.expected | 6 - glcpp/tests/063-comments.c | 20 - glcpp/tests/063-comments.c.expected | 14 - glcpp/tests/064-version.c | 2 - glcpp/tests/064-version.c.expected | 3 - glcpp/tests/065-if-defined-parens.c | 17 - glcpp/tests/065-if-defined-parens.c.expected | 18 - glcpp/tests/071-punctuator.c | 1 - glcpp/tests/071-punctuator.c.expected | 2 - glcpp/tests/072-token-pasting-same-line.c | 2 - glcpp/tests/072-token-pasting-same-line.c.expected | 3 - glcpp/tests/099-c99-example.c | 17 - glcpp/tests/099-c99-example.c.expected | 17 - glcpp/tests/glcpp-test | 7 - glcpp/xtalloc.c | 99 - glsl_lexer.lpp | 336 -- glsl_parser.ypp | 1444 ------ glsl_parser_extras.cpp | 621 --- glsl_parser_extras.h | 139 - glsl_symbol_table.h | 163 - glsl_types.cpp | 773 --- glsl_types.h | 445 -- hash_table.c | 159 - hash_table.h | 125 - hir_field_selection.cpp | 81 - ir.cpp | 818 ---- ir.h | 1178 ----- ir_basic_block.cpp | 144 - ir_basic_block.h | 28 - ir_clone.cpp | 287 -- ir_constant_expression.cpp | 671 --- ir_constant_folding.cpp | 229 - ir_constant_variable.cpp | 156 - ir_copy_propagation.cpp | 256 - ir_dead_code.cpp | 219 - ir_dead_code_local.cpp | 223 - ir_expression_flattening.cpp | 172 - ir_expression_flattening.h | 38 - ir_function.cpp | 225 - ir_function_can_inline.cpp | 71 - ir_function_inlining.cpp | 272 -- ir_function_inlining.h | 30 - ir_hierarchical_visitor.cpp | 284 -- ir_hierarchical_visitor.h | 162 - ir_hv_accept.cpp | 348 -- ir_if_simplification.cpp | 84 - ir_optimization.h | 41 - ir_print_visitor.cpp | 373 -- ir_print_visitor.h | 81 - ir_reader.cpp | 1053 ---- ir_reader.h | 34 - ir_swizzle_swizzle.cpp | 93 - ir_to_mesa.cpp | 1211 ----- ir_validate.cpp | 104 - ir_variable.cpp | 345 -- ir_vec_index_to_swizzle.cpp | 158 - ir_visitor.h | 66 - linker.cpp | 871 ---- list.h | 403 -- main.cpp | 256 - main/imports.h | 6 - main/mtypes.h | 270 -- main/simple_list.h | 235 - mesa/shader/prog_instruction.c | 363 -- mesa/shader/prog_instruction.h | 437 -- mesa/shader/prog_print.c | 1089 ----- mesa/shader/prog_print.h | 98 - program.h | 155 - s_expression.cpp | 131 - s_expression.h | 142 - 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 + symbol_table.c | 413 -- symbol_table.h | 66 - tests/array-01.glsl | 3 - tests/array-02.glsl | 3 - tests/array-03.glsl | 3 - tests/array-04.glsl | 2 - tests/array-05.glsl | 2 - tests/array-06.glsl | 2 - tests/array-07.glsl | 2 - tests/array-08.glsl | 2 - tests/array-09.glsl | 9 - tests/array-10.glsl | 11 - tests/array-11.glsl | 9 - tests/array-12.glsl | 11 - tests/array-13.glsl | 11 - tests/attribute-01.glsl | 7 - tests/attribute-02.glsl | 7 - tests/attribute-03.glsl | 7 - tests/attribute-04.glsl | 7 - tests/attribute-05.glsl | 7 - tests/attribute-06.glsl | 7 - tests/attribute-07.glsl | 7 - tests/attribute-08.glsl | 7 - tests/attribute-09.glsl | 7 - tests/attribute-10.glsl | 8 - tests/attribute-11.glsl | 8 - tests/condition-01.glsl | 8 - tests/condition-02.glsl | 8 - tests/condition-03.glsl | 8 - tests/condition-04.glsl | 8 - tests/condition-05.glsl | 13 - tests/constructor-01.glsl | 6 - tests/constructor-02.glsl | 7 - tests/constructor-03.glsl | 12 - tests/constructor-04.glsl | 14 - tests/constructor-05.glsl | 13 - tests/constructor-06.glsl | 13 - tests/constructor-07.glsl | 13 - tests/constructor-08.glsl | 13 - tests/constructor-09.glsl | 26 - tests/function-01.glsl | 16 - tests/function-02.glsl | 16 - tests/function-03.glsl | 16 - tests/function-04.glsl | 15 - tests/function-05.glsl | 26 - tests/if-01.glsl | 11 - tests/if-02.glsl | 11 - tests/if-03.glsl | 11 - tests/if-04.glsl | 11 - tests/matrix-01.glsl | 6 - tests/matrix-02.glsl | 6 - tests/matrix-03.glsl | 6 - tests/matrix-04.glsl | 6 - tests/matrix-05.glsl | 6 - tests/matrix-06.glsl | 6 - tests/matrix-07.glsl | 27 - tests/matrix-08.glsl | 19 - tests/matrix-09.glsl | 11 - tests/matrix-10.glsl | 12 - tests/parameters-01.glsl | 11 - tests/parameters-02.glsl | 11 - tests/parameters-03.glsl | 9 - tests/qualifier-01.glsl | 3 - tests/qualifier-02.glsl | 2 - tests/qualifier-03.glsl | 2 - tests/qualifier-04.glsl | 3 - tests/qualifier-05.glsl | 3 - tests/qualifier-06.glsl | 7 - tests/qualifier-07.glsl | 7 - tests/swiz-01.glsl | 11 - tests/swiz-02.glsl | 11 - tests/void-01.glsl | 2 - 750 files changed, 38147 insertions(+), 38147 deletions(-) delete mode 100644 .dir-locals.el delete mode 100644 .gitignore delete mode 100644 Makefile.am delete mode 100644 TODO delete mode 100644 ast.h delete mode 100644 ast_expr.cpp delete mode 100644 ast_function.cpp delete mode 100644 ast_to_hir.cpp delete mode 100644 ast_type.cpp delete mode 100755 autogen.sh delete mode 100644 builtin_function.cpp delete mode 100644 builtin_types.h delete mode 100644 builtin_variables.h delete mode 100644 builtins/110/abs delete mode 100644 builtins/110/all delete mode 100644 builtins/110/any delete mode 100644 builtins/110/asin delete mode 100644 builtins/110/atan delete mode 100644 builtins/110/ceil delete mode 100644 builtins/110/clamp delete mode 100644 builtins/110/cos delete mode 100644 builtins/110/cross delete mode 100644 builtins/110/degrees delete mode 100644 builtins/110/distance delete mode 100644 builtins/110/dot delete mode 100644 builtins/110/equal delete mode 100644 builtins/110/exp delete mode 100644 builtins/110/exp2 delete mode 100644 builtins/110/faceforward delete mode 100644 builtins/110/floor delete mode 100644 builtins/110/fract delete mode 100644 builtins/110/greaterThan delete mode 100644 builtins/110/greaterThanEqual delete mode 100644 builtins/110/inversesqrt delete mode 100644 builtins/110/length delete mode 100644 builtins/110/lessThan delete mode 100644 builtins/110/lessThanEqual delete mode 100644 builtins/110/log delete mode 100644 builtins/110/log2 delete mode 100644 builtins/110/matrixCompMult delete mode 100644 builtins/110/max delete mode 100644 builtins/110/min delete mode 100644 builtins/110/mix delete mode 100644 builtins/110/mod delete mode 100644 builtins/110/noise_fake delete mode 100644 builtins/110/normalize delete mode 100644 builtins/110/not delete mode 100644 builtins/110/notEqual delete mode 100644 builtins/110/pow delete mode 100644 builtins/110/radians delete mode 100644 builtins/110/reflect delete mode 100644 builtins/110/refract delete mode 100644 builtins/110/sign delete mode 100644 builtins/110/sin delete mode 100644 builtins/110/smoothstep delete mode 100644 builtins/110/sqrt delete mode 100644 builtins/110/step delete mode 100644 builtins/110/tan delete mode 100644 builtins/110/textures delete mode 100644 builtins/110_fs/derivatives delete mode 100644 builtins/110_fs/textures delete mode 100644 builtins/110_vs/ftransform delete mode 100644 builtins/120/matrixCompMult delete mode 100644 builtins/120/outerProduct delete mode 100644 builtins/120/transpose delete mode 100644 builtins/130/clamp delete mode 100644 builtins/130/cosh delete mode 100644 builtins/130/equal delete mode 100644 builtins/130/greaterThan delete mode 100644 builtins/130/greaterThanEqual delete mode 100644 builtins/130/lessThan delete mode 100644 builtins/130/lessThanEqual delete mode 100644 builtins/130/max delete mode 100644 builtins/130/min delete mode 100644 builtins/130/notEqual delete mode 100644 builtins/130/sign delete mode 100644 builtins/130/sinh delete mode 100644 builtins/130/tanh delete mode 100644 builtins/130/texelFetch delete mode 100644 builtins/130/texture delete mode 100644 builtins/130/textureGrad delete mode 100644 builtins/130/textureLod delete mode 100644 builtins/130/textureProj delete mode 100644 builtins/130/textureProjGrad delete mode 100644 builtins/130/textureProjLod delete mode 100644 builtins/130_fs/texture delete mode 100644 builtins/130_fs/textureProj delete mode 100644 builtins/ARB_texture_rectangle/textures delete mode 100644 builtins/EXT_texture_array/textures delete mode 100644 builtins/EXT_texture_array_fs/textures delete mode 100755 builtins/tools/generate_builtins.pl delete mode 100755 builtins/tools/generate_matrixCompMultGLSL.py delete mode 100755 builtins/tools/generate_outerProductGLSL.py delete mode 100755 builtins/tools/generate_transposeGLSL.py delete mode 100755 builtins/tools/texture_builtins.py delete mode 100644 configure.ac delete mode 100644 glcpp/.gitignore delete mode 100644 glcpp/Makefile.am delete mode 100644 glcpp/README delete mode 100644 glcpp/glcpp-lex.l delete mode 100644 glcpp/glcpp-parse.y delete mode 100644 glcpp/glcpp.c delete mode 100644 glcpp/glcpp.h delete mode 100644 glcpp/hash_table.c delete mode 100644 glcpp/hash_table.h delete mode 100644 glcpp/main/imports.h delete mode 100644 glcpp/main/simple_list.h delete mode 100644 glcpp/pp.c delete mode 100644 glcpp/tests/000-content-with-spaces.c delete mode 100644 glcpp/tests/000-content-with-spaces.c.expected delete mode 100644 glcpp/tests/001-define.c delete mode 100644 glcpp/tests/001-define.c.expected delete mode 100644 glcpp/tests/002-define-chain.c delete mode 100644 glcpp/tests/002-define-chain.c.expected delete mode 100644 glcpp/tests/003-define-chain-reverse.c delete mode 100644 glcpp/tests/003-define-chain-reverse.c.expected delete mode 100644 glcpp/tests/004-define-recursive.c delete mode 100644 glcpp/tests/004-define-recursive.c.expected delete mode 100644 glcpp/tests/005-define-composite-chain.c delete mode 100644 glcpp/tests/005-define-composite-chain.c.expected delete mode 100644 glcpp/tests/006-define-composite-chain-reverse.c delete mode 100644 glcpp/tests/006-define-composite-chain-reverse.c.expected delete mode 100644 glcpp/tests/007-define-composite-recursive.c delete mode 100644 glcpp/tests/007-define-composite-recursive.c.expected delete mode 100644 glcpp/tests/008-define-empty.c delete mode 100644 glcpp/tests/008-define-empty.c.expected delete mode 100644 glcpp/tests/009-undef.c delete mode 100644 glcpp/tests/009-undef.c.expected delete mode 100644 glcpp/tests/010-undef-re-define.c delete mode 100644 glcpp/tests/010-undef-re-define.c.expected delete mode 100644 glcpp/tests/011-define-func-empty.c delete mode 100644 glcpp/tests/011-define-func-empty.c.expected delete mode 100644 glcpp/tests/012-define-func-no-args.c delete mode 100644 glcpp/tests/012-define-func-no-args.c.expected delete mode 100644 glcpp/tests/013-define-func-1-arg-unused.c delete mode 100644 glcpp/tests/013-define-func-1-arg-unused.c.expected delete mode 100644 glcpp/tests/014-define-func-2-arg-unused.c delete mode 100644 glcpp/tests/014-define-func-2-arg-unused.c.expected delete mode 100644 glcpp/tests/015-define-object-with-parens.c delete mode 100644 glcpp/tests/015-define-object-with-parens.c.expected delete mode 100644 glcpp/tests/016-define-func-1-arg.c delete mode 100644 glcpp/tests/016-define-func-1-arg.c.expected delete mode 100644 glcpp/tests/017-define-func-2-args.c delete mode 100644 glcpp/tests/017-define-func-2-args.c.expected delete mode 100644 glcpp/tests/018-define-func-macro-as-parameter.c delete mode 100644 glcpp/tests/018-define-func-macro-as-parameter.c.expected delete mode 100644 glcpp/tests/019-define-func-1-arg-multi.c delete mode 100644 glcpp/tests/019-define-func-1-arg-multi.c.expected delete mode 100644 glcpp/tests/020-define-func-2-arg-multi.c delete mode 100644 glcpp/tests/020-define-func-2-arg-multi.c.expected delete mode 100644 glcpp/tests/021-define-func-compose.c delete mode 100644 glcpp/tests/021-define-func-compose.c.expected delete mode 100644 glcpp/tests/022-define-func-arg-with-parens.c delete mode 100644 glcpp/tests/022-define-func-arg-with-parens.c.expected delete mode 100644 glcpp/tests/023-define-extra-whitespace.c delete mode 100644 glcpp/tests/023-define-extra-whitespace.c.expected delete mode 100644 glcpp/tests/024-define-chain-to-self-recursion.c delete mode 100644 glcpp/tests/024-define-chain-to-self-recursion.c.expected delete mode 100644 glcpp/tests/025-func-macro-as-non-macro.c delete mode 100644 glcpp/tests/025-func-macro-as-non-macro.c.expected delete mode 100644 glcpp/tests/026-define-func-extra-newlines.c delete mode 100644 glcpp/tests/026-define-func-extra-newlines.c.expected delete mode 100644 glcpp/tests/027-define-chain-obj-to-func.c delete mode 100644 glcpp/tests/027-define-chain-obj-to-func.c.expected delete mode 100644 glcpp/tests/028-define-chain-obj-to-non-func.c delete mode 100644 glcpp/tests/028-define-chain-obj-to-non-func.c.expected delete mode 100644 glcpp/tests/029-define-chain-obj-to-func-with-args.c delete mode 100644 glcpp/tests/029-define-chain-obj-to-func-with-args.c.expected delete mode 100644 glcpp/tests/030-define-chain-obj-to-func-compose.c delete mode 100644 glcpp/tests/030-define-chain-obj-to-func-compose.c.expected delete mode 100644 glcpp/tests/031-define-chain-func-to-func-compose.c delete mode 100644 glcpp/tests/031-define-chain-func-to-func-compose.c.expected delete mode 100644 glcpp/tests/032-define-func-self-recurse.c delete mode 100644 glcpp/tests/032-define-func-self-recurse.c.expected delete mode 100644 glcpp/tests/033-define-func-self-compose.c delete mode 100644 glcpp/tests/033-define-func-self-compose.c.expected delete mode 100644 glcpp/tests/034-define-func-self-compose-non-func.c delete mode 100644 glcpp/tests/034-define-func-self-compose-non-func.c.expected delete mode 100644 glcpp/tests/035-define-func-self-compose-non-func-multi-token-argument.c delete mode 100644 glcpp/tests/035-define-func-self-compose-non-func-multi-token-argument.c.expected delete mode 100644 glcpp/tests/036-define-func-non-macro-multi-token-argument.c delete mode 100644 glcpp/tests/036-define-func-non-macro-multi-token-argument.c.expected delete mode 100644 glcpp/tests/037-finalize-unexpanded-macro.c delete mode 100644 glcpp/tests/037-finalize-unexpanded-macro.c.expected delete mode 100644 glcpp/tests/038-func-arg-with-commas.c delete mode 100644 glcpp/tests/038-func-arg-with-commas.c.expected delete mode 100644 glcpp/tests/039-func-arg-obj-macro-with-comma.c delete mode 100644 glcpp/tests/039-func-arg-obj-macro-with-comma.c.expected delete mode 100644 glcpp/tests/040-token-pasting.c delete mode 100644 glcpp/tests/040-token-pasting.c.expected delete mode 100644 glcpp/tests/041-if-0.c delete mode 100644 glcpp/tests/041-if-0.c.expected delete mode 100644 glcpp/tests/042-if-1.c delete mode 100644 glcpp/tests/042-if-1.c.expected delete mode 100644 glcpp/tests/043-if-0-else.c delete mode 100644 glcpp/tests/043-if-0-else.c.expected delete mode 100644 glcpp/tests/044-if-1-else.c delete mode 100644 glcpp/tests/044-if-1-else.c.expected delete mode 100644 glcpp/tests/045-if-0-elif.c delete mode 100644 glcpp/tests/045-if-0-elif.c.expected delete mode 100644 glcpp/tests/046-if-1-elsif.c delete mode 100644 glcpp/tests/046-if-1-elsif.c.expected delete mode 100644 glcpp/tests/047-if-elif-else.c delete mode 100644 glcpp/tests/047-if-elif-else.c.expected delete mode 100644 glcpp/tests/048-if-nested.c delete mode 100644 glcpp/tests/048-if-nested.c.expected delete mode 100644 glcpp/tests/049-if-expression-precedence.c delete mode 100644 glcpp/tests/049-if-expression-precedence.c.expected delete mode 100644 glcpp/tests/050-if-defined.c delete mode 100644 glcpp/tests/050-if-defined.c.expected delete mode 100644 glcpp/tests/051-if-relational.c delete mode 100644 glcpp/tests/051-if-relational.c.expected delete mode 100644 glcpp/tests/052-if-bitwise.c delete mode 100644 glcpp/tests/052-if-bitwise.c.expected delete mode 100644 glcpp/tests/053-if-divide-and-shift.c delete mode 100644 glcpp/tests/053-if-divide-and-shift.c.expected delete mode 100644 glcpp/tests/054-if-with-macros.c delete mode 100644 glcpp/tests/054-if-with-macros.c.expected delete mode 100644 glcpp/tests/055-define-chain-obj-to-func-parens-in-text.c delete mode 100644 glcpp/tests/055-define-chain-obj-to-func-parens-in-text.c.expected delete mode 100644 glcpp/tests/056-macro-argument-with-comma.c delete mode 100644 glcpp/tests/056-macro-argument-with-comma.c.expected delete mode 100644 glcpp/tests/057-empty-arguments.c delete mode 100644 glcpp/tests/057-empty-arguments.c.expected delete mode 100644 glcpp/tests/058-token-pasting-empty-arguments.c delete mode 100644 glcpp/tests/058-token-pasting-empty-arguments.c.expected delete mode 100644 glcpp/tests/059-token-pasting-integer.c delete mode 100644 glcpp/tests/059-token-pasting-integer.c.expected delete mode 100644 glcpp/tests/060-left-paren-in-macro-right-paren-in-text.c delete mode 100644 glcpp/tests/060-left-paren-in-macro-right-paren-in-text.c.expected delete mode 100644 glcpp/tests/061-define-chain-obj-to-func-multi.c delete mode 100644 glcpp/tests/061-define-chain-obj-to-func-multi.c.expected delete mode 100644 glcpp/tests/062-if-0-skips-garbage.c delete mode 100644 glcpp/tests/062-if-0-skips-garbage.c.expected delete mode 100644 glcpp/tests/063-comments.c delete mode 100644 glcpp/tests/063-comments.c.expected delete mode 100644 glcpp/tests/064-version.c delete mode 100644 glcpp/tests/064-version.c.expected delete mode 100644 glcpp/tests/065-if-defined-parens.c delete mode 100644 glcpp/tests/065-if-defined-parens.c.expected delete mode 100644 glcpp/tests/071-punctuator.c delete mode 100644 glcpp/tests/071-punctuator.c.expected delete mode 100644 glcpp/tests/072-token-pasting-same-line.c delete mode 100644 glcpp/tests/072-token-pasting-same-line.c.expected delete mode 100644 glcpp/tests/099-c99-example.c delete mode 100644 glcpp/tests/099-c99-example.c.expected delete mode 100755 glcpp/tests/glcpp-test delete mode 100644 glcpp/xtalloc.c delete mode 100644 glsl_lexer.lpp delete mode 100644 glsl_parser.ypp delete mode 100644 glsl_parser_extras.cpp delete mode 100644 glsl_parser_extras.h delete mode 100644 glsl_symbol_table.h delete mode 100644 glsl_types.cpp delete mode 100644 glsl_types.h delete mode 100644 hash_table.c delete mode 100644 hash_table.h delete mode 100644 hir_field_selection.cpp delete mode 100644 ir.cpp delete mode 100644 ir.h delete mode 100644 ir_basic_block.cpp delete mode 100644 ir_basic_block.h delete mode 100644 ir_clone.cpp delete mode 100644 ir_constant_expression.cpp delete mode 100644 ir_constant_folding.cpp delete mode 100644 ir_constant_variable.cpp delete mode 100644 ir_copy_propagation.cpp delete mode 100644 ir_dead_code.cpp delete mode 100644 ir_dead_code_local.cpp delete mode 100644 ir_expression_flattening.cpp delete mode 100644 ir_expression_flattening.h delete mode 100644 ir_function.cpp delete mode 100644 ir_function_can_inline.cpp delete mode 100644 ir_function_inlining.cpp delete mode 100644 ir_function_inlining.h delete mode 100644 ir_hierarchical_visitor.cpp delete mode 100644 ir_hierarchical_visitor.h delete mode 100644 ir_hv_accept.cpp delete mode 100644 ir_if_simplification.cpp delete mode 100644 ir_optimization.h delete mode 100644 ir_print_visitor.cpp delete mode 100644 ir_print_visitor.h delete mode 100644 ir_reader.cpp delete mode 100644 ir_reader.h delete mode 100644 ir_swizzle_swizzle.cpp delete mode 100644 ir_to_mesa.cpp delete mode 100644 ir_validate.cpp delete mode 100644 ir_variable.cpp delete mode 100644 ir_vec_index_to_swizzle.cpp delete mode 100644 ir_visitor.h delete mode 100644 linker.cpp delete mode 100644 list.h delete mode 100644 main.cpp delete mode 100644 main/imports.h delete mode 100644 main/mtypes.h delete mode 100644 main/simple_list.h delete mode 100644 mesa/shader/prog_instruction.c delete mode 100644 mesa/shader/prog_instruction.h delete mode 100644 mesa/shader/prog_print.c delete mode 100644 mesa/shader/prog_print.h delete mode 100644 program.h delete mode 100644 s_expression.cpp delete mode 100644 s_expression.h 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 delete mode 100644 symbol_table.c delete mode 100644 symbol_table.h delete mode 100644 tests/array-01.glsl delete mode 100644 tests/array-02.glsl delete mode 100644 tests/array-03.glsl delete mode 100644 tests/array-04.glsl delete mode 100644 tests/array-05.glsl delete mode 100644 tests/array-06.glsl delete mode 100644 tests/array-07.glsl delete mode 100644 tests/array-08.glsl delete mode 100644 tests/array-09.glsl delete mode 100644 tests/array-10.glsl delete mode 100644 tests/array-11.glsl delete mode 100644 tests/array-12.glsl delete mode 100644 tests/array-13.glsl delete mode 100644 tests/attribute-01.glsl delete mode 100644 tests/attribute-02.glsl delete mode 100644 tests/attribute-03.glsl delete mode 100644 tests/attribute-04.glsl delete mode 100644 tests/attribute-05.glsl delete mode 100644 tests/attribute-06.glsl delete mode 100644 tests/attribute-07.glsl delete mode 100644 tests/attribute-08.glsl delete mode 100644 tests/attribute-09.glsl delete mode 100644 tests/attribute-10.glsl delete mode 100644 tests/attribute-11.glsl delete mode 100644 tests/condition-01.glsl delete mode 100644 tests/condition-02.glsl delete mode 100644 tests/condition-03.glsl delete mode 100644 tests/condition-04.glsl delete mode 100644 tests/condition-05.glsl delete mode 100644 tests/constructor-01.glsl delete mode 100644 tests/constructor-02.glsl delete mode 100644 tests/constructor-03.glsl delete mode 100644 tests/constructor-04.glsl delete mode 100644 tests/constructor-05.glsl delete mode 100644 tests/constructor-06.glsl delete mode 100644 tests/constructor-07.glsl delete mode 100644 tests/constructor-08.glsl delete mode 100644 tests/constructor-09.glsl delete mode 100644 tests/function-01.glsl delete mode 100644 tests/function-02.glsl delete mode 100644 tests/function-03.glsl delete mode 100644 tests/function-04.glsl delete mode 100644 tests/function-05.glsl delete mode 100644 tests/if-01.glsl delete mode 100644 tests/if-02.glsl delete mode 100644 tests/if-03.glsl delete mode 100644 tests/if-04.glsl delete mode 100644 tests/matrix-01.glsl delete mode 100644 tests/matrix-02.glsl delete mode 100644 tests/matrix-03.glsl delete mode 100644 tests/matrix-04.glsl delete mode 100644 tests/matrix-05.glsl delete mode 100644 tests/matrix-06.glsl delete mode 100644 tests/matrix-07.glsl delete mode 100644 tests/matrix-08.glsl delete mode 100644 tests/matrix-09.glsl delete mode 100644 tests/matrix-10.glsl delete mode 100644 tests/parameters-01.glsl delete mode 100644 tests/parameters-02.glsl delete mode 100644 tests/parameters-03.glsl delete mode 100644 tests/qualifier-01.glsl delete mode 100644 tests/qualifier-02.glsl delete mode 100644 tests/qualifier-03.glsl delete mode 100644 tests/qualifier-04.glsl delete mode 100644 tests/qualifier-05.glsl delete mode 100644 tests/qualifier-06.glsl delete mode 100644 tests/qualifier-07.glsl delete mode 100644 tests/swiz-01.glsl delete mode 100644 tests/swiz-02.glsl delete mode 100644 tests/void-01.glsl (limited to 'src') diff --git a/.dir-locals.el b/.dir-locals.el deleted file mode 100644 index be19e29a5a..0000000000 --- a/.dir-locals.el +++ /dev/null @@ -1,3 +0,0 @@ -((c-mode . ((c-basic-offset . 3))) - (c++-mode . ((c-basic-offset . 3))) -) diff --git a/.gitignore b/.gitignore deleted file mode 100644 index 376aaeda13..0000000000 --- a/.gitignore +++ /dev/null @@ -1,25 +0,0 @@ -.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/Makefile.am b/Makefile.am deleted file mode 100644 index c34f7d8abf..0000000000 --- a/Makefile.am +++ /dev/null @@ -1,79 +0,0 @@ -# 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/TODO b/TODO deleted file mode 100644 index 193cfc767d..0000000000 --- a/TODO +++ /dev/null @@ -1,84 +0,0 @@ -- 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/ast.h b/ast.h deleted file mode 100644 index de300e719c..0000000000 --- a/ast.h +++ /dev/null @@ -1,651 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright © 2009 Intel Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - */ - -#pragma once -#ifndef AST_H -#define AST_H - -#include "list.h" -#include "glsl_parser_extras.h" - -struct 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/ast_expr.cpp b/ast_expr.cpp deleted file mode 100644 index 4e83decb92..0000000000 --- a/ast_expr.cpp +++ /dev/null @@ -1,96 +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 -#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/ast_function.cpp b/ast_function.cpp deleted file mode 100644 index 761af00b95..0000000000 --- a/ast_function.cpp +++ /dev/null @@ -1,751 +0,0 @@ -/* - * Copyright © 2010 Intel Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - */ - -#include "glsl_symbol_table.h" -#include "ast.h" -#include "glsl_types.h" -#include "ir.h" - -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/ast_to_hir.cpp b/ast_to_hir.cpp deleted file mode 100644 index 33eb27533f..0000000000 --- a/ast_to_hir.cpp +++ /dev/null @@ -1,2453 +0,0 @@ -/* - * Copyright © 2010 Intel Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - */ - -/** - * \file ast_to_hir.c - * Convert abstract syntax to to high-level intermediate reprensentation (HIR). - * - * During the conversion to HIR, the majority of the symantic checking is - * preformed on the program. This includes: - * - * * Symbol table management - * * Type checking - * * Function binding - * - * The majority of this work could be done during parsing, and the parser could - * probably generate HIR directly. However, this results in frequent changes - * to the parser code. Since we do not assume that every system this complier - * is built on will have Flex and Bison installed, we have to store the code - * generated by these tools in our version control system. In other parts of - * the system we've seen problems where a parser was changed but the generated - * code was not committed, merge conflicts where created because two developers - * had slightly different versions of Bison installed, etc. - * - * I have also noticed that running Bison generated parsers in GDB is very - * irritating. When you get a segfault on '$$ = $1->foo', you can't very - * well 'print $1' in GDB. - * - * As a result, my preference is to put as little C code as possible in the - * parser (and lexer) sources. - */ - -#include "main/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/ast_type.cpp b/ast_type.cpp deleted file mode 100644 index cb0852bb77..0000000000 --- a/ast_type.cpp +++ /dev/null @@ -1,110 +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 -#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/autogen.sh b/autogen.sh deleted file mode 100755 index 904cd6746c..0000000000 --- a/autogen.sh +++ /dev/null @@ -1,12 +0,0 @@ -#! /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/builtin_function.cpp b/builtin_function.cpp deleted file mode 100644 index d248388a1a..0000000000 --- a/builtin_function.cpp +++ /dev/null @@ -1,5080 +0,0 @@ -/* 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/builtin_types.h b/builtin_types.h deleted file mode 100644 index 48202f5645..0000000000 --- a/builtin_types.h +++ /dev/null @@ -1,268 +0,0 @@ -/* - * 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/builtin_variables.h b/builtin_variables.h deleted file mode 100644 index 77f2fe5502..0000000000 --- a/builtin_variables.h +++ /dev/null @@ -1,93 +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 "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/builtins/110/abs b/builtins/110/abs deleted file mode 100644 index 904845307c..0000000000 --- a/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/builtins/110/all b/builtins/110/all deleted file mode 100644 index 2cac0dfb68..0000000000 --- a/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/builtins/110/any b/builtins/110/any deleted file mode 100644 index f10e8a7b47..0000000000 --- a/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/builtins/110/asin b/builtins/110/asin deleted file mode 100644 index fe93337bff..0000000000 --- a/builtins/110/asin +++ /dev/null @@ -1,112 +0,0 @@ -((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/builtins/110/atan b/builtins/110/atan deleted file mode 100644 index e5542350b5..0000000000 --- a/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) - (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/builtins/110/ceil b/builtins/110/ceil deleted file mode 100644 index a26a775049..0000000000 --- a/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/builtins/110/clamp b/builtins/110/clamp deleted file mode 100644 index 94c8e5ed16..0000000000 --- a/builtins/110/clamp +++ /dev/null @@ -1,62 +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)) - ((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/builtins/110/cos b/builtins/110/cos deleted file mode 100644 index 88f266eccb..0000000000 --- a/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/builtins/110/cross b/builtins/110/cross deleted file mode 100644 index deb2f952bf..0000000000 --- a/builtins/110/cross +++ /dev/null @@ -1,17 +0,0 @@ -((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/builtins/110/degrees b/builtins/110/degrees deleted file mode 100644 index dc0d7b9e20..0000000000 --- a/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/builtins/110/distance b/builtins/110/distance deleted file mode 100644 index a2309c484f..0000000000 --- a/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/builtins/110/dot b/builtins/110/dot deleted file mode 100644 index a91a6d2c56..0000000000 --- a/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/builtins/110/equal b/builtins/110/equal deleted file mode 100644 index ae7ddc53bd..0000000000 --- a/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/builtins/110/exp b/builtins/110/exp deleted file mode 100644 index a73bd6a7f8..0000000000 --- a/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/builtins/110/exp2 b/builtins/110/exp2 deleted file mode 100644 index a842d3fe65..0000000000 --- a/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/builtins/110/faceforward b/builtins/110/faceforward deleted file mode 100644 index d170397238..0000000000 --- a/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/builtins/110/floor b/builtins/110/floor deleted file mode 100644 index 8dd8052799..0000000000 --- a/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/builtins/110/fract b/builtins/110/fract deleted file mode 100644 index 3995bfaf3f..0000000000 --- a/builtins/110/fract +++ /dev/null @@ -1,34 +0,0 @@ -((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/builtins/110/greaterThan b/builtins/110/greaterThan deleted file mode 100644 index ae03030e49..0000000000 --- a/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/builtins/110/greaterThanEqual b/builtins/110/greaterThanEqual deleted file mode 100644 index 204d5fd143..0000000000 --- a/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/builtins/110/inversesqrt b/builtins/110/inversesqrt deleted file mode 100644 index 5b66d2b369..0000000000 --- a/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/builtins/110/length b/builtins/110/length deleted file mode 100644 index 89ff7f3ef1..0000000000 --- a/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/builtins/110/lessThan b/builtins/110/lessThan deleted file mode 100644 index 5c4254165c..0000000000 --- a/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/builtins/110/lessThanEqual b/builtins/110/lessThanEqual deleted file mode 100644 index ccb955b8a7..0000000000 --- a/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/builtins/110/log b/builtins/110/log deleted file mode 100644 index d168abb5a7..0000000000 --- a/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/builtins/110/log2 b/builtins/110/log2 deleted file mode 100644 index b96c6276f0..0000000000 --- a/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/builtins/110/matrixCompMult b/builtins/110/matrixCompMult deleted file mode 100644 index cb5a2cb1f7..0000000000 --- a/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/builtins/110/max b/builtins/110/max deleted file mode 100644 index c05545f3d9..0000000000 --- a/builtins/110/max +++ /dev/null @@ -1,64 +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)) - ((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/builtins/110/min b/builtins/110/min deleted file mode 100644 index 31e7948940..0000000000 --- a/builtins/110/min +++ /dev/null @@ -1,64 +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)) - ((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/builtins/110/mix b/builtins/110/mix deleted file mode 100644 index 032f29e5fa..0000000000 --- a/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 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/builtins/110/mod b/builtins/110/mod deleted file mode 100644 index 9e08bbc7ef..0000000000 --- a/builtins/110/mod +++ /dev/null @@ -1,64 +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)) - ((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/builtins/110/noise_fake b/builtins/110/noise_fake deleted file mode 100644 index bcfb17b04b..0000000000 --- a/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/builtins/110/normalize b/builtins/110/normalize deleted file mode 100644 index be88a9830d..0000000000 --- a/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/builtins/110/not b/builtins/110/not deleted file mode 100644 index b696b06557..0000000000 --- a/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/builtins/110/notEqual b/builtins/110/notEqual deleted file mode 100644 index c87efa317f..0000000000 --- a/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 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/builtins/110/pow b/builtins/110/pow deleted file mode 100644 index a61bc4418e..0000000000 --- a/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/builtins/110/radians b/builtins/110/radians deleted file mode 100644 index 6a0f5d2e21..0000000000 --- a/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/builtins/110/reflect b/builtins/110/reflect deleted file mode 100644 index 8238fdc93f..0000000000 --- a/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/builtins/110/refract b/builtins/110/refract deleted file mode 100644 index e9b1475294..0000000000 --- a/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)))) - ((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/builtins/110/sign b/builtins/110/sign deleted file mode 100644 index 7d540de405..0000000000 --- a/builtins/110/sign +++ /dev/null @@ -1,34 +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)) - ((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/builtins/110/sin b/builtins/110/sin deleted file mode 100644 index e6009d8ef1..0000000000 --- a/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/builtins/110/smoothstep b/builtins/110/smoothstep deleted file mode 100644 index b4255ba78f..0000000000 --- a/builtins/110/smoothstep +++ /dev/null @@ -1,224 +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)) - ((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/builtins/110/sqrt b/builtins/110/sqrt deleted file mode 100644 index 0302d164ae..0000000000 --- a/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/builtins/110/step b/builtins/110/step deleted file mode 100644 index 1cc2b51f8f..0000000000 --- a/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/builtins/110/tan b/builtins/110/tan deleted file mode 100644 index 3e04892a76..0000000000 --- a/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 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/builtins/110/textures b/builtins/110/textures deleted file mode 100644 index c81b7e8ad4..0000000000 --- a/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/builtins/110_fs/derivatives b/builtins/110_fs/derivatives deleted file mode 100644 index b79852ee1f..0000000000 --- a/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/builtins/110_fs/textures b/builtins/110_fs/textures deleted file mode 100644 index 38f3787e9e..0000000000 --- a/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/builtins/110_vs/ftransform b/builtins/110_vs/ftransform deleted file mode 100644 index 3a5e8ccecf..0000000000 --- a/builtins/110_vs/ftransform +++ /dev/null @@ -1,7 +0,0 @@ -((function ftransform - (signature vec4 - (parameters) - ((return (expression vec4 * - (var_ref gl_ModelViewProjectionMatrix) - (var_ref gl_Vertex))))) -)) diff --git a/builtins/120/matrixCompMult b/builtins/120/matrixCompMult deleted file mode 100644 index 69331e2652..0000000000 --- a/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/builtins/120/outerProduct b/builtins/120/outerProduct deleted file mode 100644 index b401ba0233..0000000000 --- a/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 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/builtins/120/transpose b/builtins/120/transpose deleted file mode 100644 index 416a0ee467..0000000000 --- a/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/builtins/130/clamp b/builtins/130/clamp deleted file mode 100644 index 3aed22c20d..0000000000 --- a/builtins/130/clamp +++ /dev/null @@ -1,123 +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)) - ((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/builtins/130/cosh b/builtins/130/cosh deleted file mode 100644 index 45e0ae427d..0000000000 --- a/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/builtins/130/equal b/builtins/130/equal deleted file mode 100644 index 079c3e97fb..0000000000 --- a/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/builtins/130/greaterThan b/builtins/130/greaterThan deleted file mode 100644 index a9fb7b3a43..0000000000 --- a/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/builtins/130/greaterThanEqual b/builtins/130/greaterThanEqual deleted file mode 100644 index 293c93c7cc..0000000000 --- a/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/builtins/130/lessThan b/builtins/130/lessThan deleted file mode 100644 index d9f693fd63..0000000000 --- a/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/builtins/130/lessThanEqual b/builtins/130/lessThanEqual deleted file mode 100644 index 494411b869..0000000000 --- a/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/builtins/130/max b/builtins/130/max deleted file mode 100644 index 45a6089c9f..0000000000 --- a/builtins/130/max +++ /dev/null @@ -1,127 +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)) - ((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/builtins/130/min b/builtins/130/min deleted file mode 100644 index d98ec1e79d..0000000000 --- a/builtins/130/min +++ /dev/null @@ -1,127 +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)) - ((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/builtins/130/notEqual b/builtins/130/notEqual deleted file mode 100644 index 81e6376bd9..0000000000 --- a/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/builtins/130/sign b/builtins/130/sign deleted file mode 100644 index 0bdc0e09d2..0000000000 --- a/builtins/130/sign +++ /dev/null @@ -1,34 +0,0 @@ -((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/builtins/130/sinh b/builtins/130/sinh deleted file mode 100644 index 7ad4f58e20..0000000000 --- a/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/builtins/130/tanh b/builtins/130/tanh deleted file mode 100644 index 3b7271bf77..0000000000 --- a/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/builtins/130/texelFetch b/builtins/130/texelFetch deleted file mode 100644 index d51ce65a89..0000000000 --- a/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/builtins/130/texture b/builtins/130/texture deleted file mode 100644 index b170b58309..0000000000 --- a/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/builtins/130/textureGrad b/builtins/130/textureGrad deleted file mode 100644 index 0ef428c224..0000000000 --- a/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/builtins/130/textureLod b/builtins/130/textureLod deleted file mode 100644 index 7d7059d848..0000000000 --- a/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/builtins/130/textureProj b/builtins/130/textureProj deleted file mode 100644 index 40ea1c2af6..0000000000 --- a/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/builtins/130/textureProjGrad b/builtins/130/textureProjGrad deleted file mode 100644 index a0142c5e68..0000000000 --- a/builtins/130/textureProjGrad +++ /dev/null @@ -1,122 +0,0 @@ -((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/builtins/130/textureProjLod b/builtins/130/textureProjLod deleted file mode 100644 index 9f4ce1b493..0000000000 --- a/builtins/130/textureProjLod +++ /dev/null @@ -1,107 +0,0 @@ -((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/builtins/130_fs/texture b/builtins/130_fs/texture deleted file mode 100644 index 0de981397f..0000000000 --- a/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/builtins/130_fs/textureProj b/builtins/130_fs/textureProj deleted file mode 100644 index b1d8f0a2f3..0000000000 --- a/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/builtins/ARB_texture_rectangle/textures b/builtins/ARB_texture_rectangle/textures deleted file mode 100644 index 161d8c4a54..0000000000 --- a/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/builtins/EXT_texture_array/textures b/builtins/EXT_texture_array/textures deleted file mode 100644 index 8a91f90140..0000000000 --- a/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/builtins/EXT_texture_array_fs/textures b/builtins/EXT_texture_array_fs/textures deleted file mode 100644 index 74e184387a..0000000000 --- a/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/builtins/tools/generate_builtins.pl b/builtins/tools/generate_builtins.pl deleted file mode 100755 index 8b640ab8ff..0000000000 --- a/builtins/tools/generate_builtins.pl +++ /dev/null @@ -1,123 +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 "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/builtins/tools/generate_matrixCompMultGLSL.py b/builtins/tools/generate_matrixCompMultGLSL.py deleted file mode 100755 index 391ad110d3..0000000000 --- a/builtins/tools/generate_matrixCompMultGLSL.py +++ /dev/null @@ -1,28 +0,0 @@ -#!/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/builtins/tools/generate_outerProductGLSL.py b/builtins/tools/generate_outerProductGLSL.py deleted file mode 100755 index 48fb72197c..0000000000 --- a/builtins/tools/generate_outerProductGLSL.py +++ /dev/null @@ -1,23 +0,0 @@ -#!/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/builtins/tools/generate_transposeGLSL.py b/builtins/tools/generate_transposeGLSL.py deleted file mode 100755 index 8f669ce983..0000000000 --- a/builtins/tools/generate_transposeGLSL.py +++ /dev/null @@ -1,28 +0,0 @@ -#!/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/builtins/tools/texture_builtins.py b/builtins/tools/texture_builtins.py deleted file mode 100755 index 23d5314916..0000000000 --- a/builtins/tools/texture_builtins.py +++ /dev/null @@ -1,298 +0,0 @@ -#!/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/configure.ac b/configure.ac deleted file mode 100644 index 73ce67de3d..0000000000 --- a/configure.ac +++ /dev/null @@ -1,69 +0,0 @@ -# -*- 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/glcpp/.gitignore b/glcpp/.gitignore deleted file mode 100644 index c158dc8b86..0000000000 --- a/glcpp/.gitignore +++ /dev/null @@ -1,11 +0,0 @@ -glcpp -glcpp-lex.c -glcpp-parse.c -glcpp-parse.h -glcpp-parse.output -*.o -*.lo -*.la -.libs -*~ -tests/*.out diff --git a/glcpp/Makefile.am b/glcpp/Makefile.am deleted file mode 100644 index a49fd615cd..0000000000 --- a/glcpp/Makefile.am +++ /dev/null @@ -1,46 +0,0 @@ -# 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/glcpp/README b/glcpp/README deleted file mode 100644 index ab42a3ffe1..0000000000 --- a/glcpp/README +++ /dev/null @@ -1,30 +0,0 @@ -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/glcpp/glcpp-lex.l b/glcpp/glcpp-lex.l deleted file mode 100644 index afddd7ddb3..0000000000 --- a/glcpp/glcpp-lex.l +++ /dev/null @@ -1,257 +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 -#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/glcpp/glcpp-parse.y b/glcpp/glcpp-parse.y deleted file mode 100644 index 6beac18c65..0000000000 --- a/glcpp/glcpp-parse.y +++ /dev/null @@ -1,1611 +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 -#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/glcpp/glcpp.c b/glcpp/glcpp.c deleted file mode 100644 index cc87e14950..0000000000 --- a/glcpp/glcpp.c +++ /dev/null @@ -1,88 +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 -#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/glcpp/glcpp.h b/glcpp/glcpp.h deleted file mode 100644 index 2cfa98d2b1..0000000000 --- a/glcpp/glcpp.h +++ /dev/null @@ -1,224 +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. - */ - -#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/glcpp/hash_table.c b/glcpp/hash_table.c deleted file mode 100644 index e89a2564d7..0000000000 --- a/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/glcpp/hash_table.h b/glcpp/hash_table.h deleted file mode 100644 index b9dd343dee..0000000000 --- a/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/glcpp/main/imports.h b/glcpp/main/imports.h deleted file mode 100644 index d2197342c0..0000000000 --- a/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/glcpp/main/simple_list.h b/glcpp/main/simple_list.h deleted file mode 100644 index 5ef39e14cc..0000000000 --- a/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 diff --git a/glcpp/pp.c b/glcpp/pp.c deleted file mode 100644 index a25b7b72a6..0000000000 --- a/glcpp/pp.c +++ /dev/null @@ -1,155 +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 -#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/glcpp/tests/000-content-with-spaces.c b/glcpp/tests/000-content-with-spaces.c deleted file mode 100644 index 696cb3a74f..0000000000 --- a/glcpp/tests/000-content-with-spaces.c +++ /dev/null @@ -1 +0,0 @@ -this is four tokens diff --git a/glcpp/tests/000-content-with-spaces.c.expected b/glcpp/tests/000-content-with-spaces.c.expected deleted file mode 100644 index 83f7834d54..0000000000 --- a/glcpp/tests/000-content-with-spaces.c.expected +++ /dev/null @@ -1,2 +0,0 @@ -this is four tokens - diff --git a/glcpp/tests/001-define.c b/glcpp/tests/001-define.c deleted file mode 100644 index cbf2fee0e7..0000000000 --- a/glcpp/tests/001-define.c +++ /dev/null @@ -1,2 +0,0 @@ -#define foo 1 -foo diff --git a/glcpp/tests/001-define.c.expected b/glcpp/tests/001-define.c.expected deleted file mode 100644 index 878fd15d6f..0000000000 --- a/glcpp/tests/001-define.c.expected +++ /dev/null @@ -1,3 +0,0 @@ - -1 - diff --git a/glcpp/tests/002-define-chain.c b/glcpp/tests/002-define-chain.c deleted file mode 100644 index 87d75c6875..0000000000 --- a/glcpp/tests/002-define-chain.c +++ /dev/null @@ -1,3 +0,0 @@ -#define foo 1 -#define bar foo -bar diff --git a/glcpp/tests/002-define-chain.c.expected b/glcpp/tests/002-define-chain.c.expected deleted file mode 100644 index 43d484d713..0000000000 --- a/glcpp/tests/002-define-chain.c.expected +++ /dev/null @@ -1,4 +0,0 @@ - - -1 - diff --git a/glcpp/tests/003-define-chain-reverse.c b/glcpp/tests/003-define-chain-reverse.c deleted file mode 100644 index a18b724eca..0000000000 --- a/glcpp/tests/003-define-chain-reverse.c +++ /dev/null @@ -1,3 +0,0 @@ -#define bar foo -#define foo 1 -bar diff --git a/glcpp/tests/003-define-chain-reverse.c.expected b/glcpp/tests/003-define-chain-reverse.c.expected deleted file mode 100644 index 43d484d713..0000000000 --- a/glcpp/tests/003-define-chain-reverse.c.expected +++ /dev/null @@ -1,4 +0,0 @@ - - -1 - diff --git a/glcpp/tests/004-define-recursive.c b/glcpp/tests/004-define-recursive.c deleted file mode 100644 index 2ac56ea3dc..0000000000 --- a/glcpp/tests/004-define-recursive.c +++ /dev/null @@ -1,6 +0,0 @@ -#define foo bar -#define bar baz -#define baz foo -foo -bar -baz diff --git a/glcpp/tests/004-define-recursive.c.expected b/glcpp/tests/004-define-recursive.c.expected deleted file mode 100644 index 4d2698b7a7..0000000000 --- a/glcpp/tests/004-define-recursive.c.expected +++ /dev/null @@ -1,7 +0,0 @@ - - - -foo -bar -baz - diff --git a/glcpp/tests/005-define-composite-chain.c b/glcpp/tests/005-define-composite-chain.c deleted file mode 100644 index f5521df968..0000000000 --- a/glcpp/tests/005-define-composite-chain.c +++ /dev/null @@ -1,3 +0,0 @@ -#define foo 1 -#define bar a foo -bar diff --git a/glcpp/tests/005-define-composite-chain.c.expected b/glcpp/tests/005-define-composite-chain.c.expected deleted file mode 100644 index c67358f4f6..0000000000 --- a/glcpp/tests/005-define-composite-chain.c.expected +++ /dev/null @@ -1,4 +0,0 @@ - - -a 1 - diff --git a/glcpp/tests/006-define-composite-chain-reverse.c b/glcpp/tests/006-define-composite-chain-reverse.c deleted file mode 100644 index 4bb91a1221..0000000000 --- a/glcpp/tests/006-define-composite-chain-reverse.c +++ /dev/null @@ -1,3 +0,0 @@ -#define bar a foo -#define foo 1 -bar diff --git a/glcpp/tests/006-define-composite-chain-reverse.c.expected b/glcpp/tests/006-define-composite-chain-reverse.c.expected deleted file mode 100644 index c67358f4f6..0000000000 --- a/glcpp/tests/006-define-composite-chain-reverse.c.expected +++ /dev/null @@ -1,4 +0,0 @@ - - -a 1 - diff --git a/glcpp/tests/007-define-composite-recursive.c b/glcpp/tests/007-define-composite-recursive.c deleted file mode 100644 index 5784565bdf..0000000000 --- a/glcpp/tests/007-define-composite-recursive.c +++ /dev/null @@ -1,6 +0,0 @@ -#define foo a bar -#define bar b baz -#define baz c foo -foo -bar -baz diff --git a/glcpp/tests/007-define-composite-recursive.c.expected b/glcpp/tests/007-define-composite-recursive.c.expected deleted file mode 100644 index 30fe4dc1f6..0000000000 --- a/glcpp/tests/007-define-composite-recursive.c.expected +++ /dev/null @@ -1,7 +0,0 @@ - - - -a b c foo -b c a bar -c a b baz - diff --git a/glcpp/tests/008-define-empty.c b/glcpp/tests/008-define-empty.c deleted file mode 100644 index b1bd17ec21..0000000000 --- a/glcpp/tests/008-define-empty.c +++ /dev/null @@ -1,2 +0,0 @@ -#define foo -foo diff --git a/glcpp/tests/008-define-empty.c.expected b/glcpp/tests/008-define-empty.c.expected deleted file mode 100644 index b28b04f643..0000000000 --- a/glcpp/tests/008-define-empty.c.expected +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/glcpp/tests/009-undef.c b/glcpp/tests/009-undef.c deleted file mode 100644 index 3fc1fb4424..0000000000 --- a/glcpp/tests/009-undef.c +++ /dev/null @@ -1,4 +0,0 @@ -#define foo 1 -foo -#undef foo -foo diff --git a/glcpp/tests/009-undef.c.expected b/glcpp/tests/009-undef.c.expected deleted file mode 100644 index 03a7061af0..0000000000 --- a/glcpp/tests/009-undef.c.expected +++ /dev/null @@ -1,5 +0,0 @@ - -1 - -foo - diff --git a/glcpp/tests/010-undef-re-define.c b/glcpp/tests/010-undef-re-define.c deleted file mode 100644 index 32ff73798b..0000000000 --- a/glcpp/tests/010-undef-re-define.c +++ /dev/null @@ -1,6 +0,0 @@ -#define foo 1 -foo -#undef foo -foo -#define foo 2 -foo diff --git a/glcpp/tests/010-undef-re-define.c.expected b/glcpp/tests/010-undef-re-define.c.expected deleted file mode 100644 index f4f7efdc2b..0000000000 --- a/glcpp/tests/010-undef-re-define.c.expected +++ /dev/null @@ -1,7 +0,0 @@ - -1 - -foo - -2 - diff --git a/glcpp/tests/011-define-func-empty.c b/glcpp/tests/011-define-func-empty.c deleted file mode 100644 index d9ce13c228..0000000000 --- a/glcpp/tests/011-define-func-empty.c +++ /dev/null @@ -1,2 +0,0 @@ -#define foo() -foo() diff --git a/glcpp/tests/011-define-func-empty.c.expected b/glcpp/tests/011-define-func-empty.c.expected deleted file mode 100644 index b28b04f643..0000000000 --- a/glcpp/tests/011-define-func-empty.c.expected +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/glcpp/tests/012-define-func-no-args.c b/glcpp/tests/012-define-func-no-args.c deleted file mode 100644 index c2bb730b11..0000000000 --- a/glcpp/tests/012-define-func-no-args.c +++ /dev/null @@ -1,2 +0,0 @@ -#define foo() bar -foo() diff --git a/glcpp/tests/012-define-func-no-args.c.expected b/glcpp/tests/012-define-func-no-args.c.expected deleted file mode 100644 index 0353767297..0000000000 --- a/glcpp/tests/012-define-func-no-args.c.expected +++ /dev/null @@ -1,3 +0,0 @@ - -bar - diff --git a/glcpp/tests/013-define-func-1-arg-unused.c b/glcpp/tests/013-define-func-1-arg-unused.c deleted file mode 100644 index f78fb8b118..0000000000 --- a/glcpp/tests/013-define-func-1-arg-unused.c +++ /dev/null @@ -1,2 +0,0 @@ -#define foo(x) 1 -foo(bar) diff --git a/glcpp/tests/013-define-func-1-arg-unused.c.expected b/glcpp/tests/013-define-func-1-arg-unused.c.expected deleted file mode 100644 index 878fd15d6f..0000000000 --- a/glcpp/tests/013-define-func-1-arg-unused.c.expected +++ /dev/null @@ -1,3 +0,0 @@ - -1 - diff --git a/glcpp/tests/014-define-func-2-arg-unused.c b/glcpp/tests/014-define-func-2-arg-unused.c deleted file mode 100644 index 11feb2624b..0000000000 --- a/glcpp/tests/014-define-func-2-arg-unused.c +++ /dev/null @@ -1,2 +0,0 @@ -#define foo(x,y) 1 -foo(bar,baz) diff --git a/glcpp/tests/014-define-func-2-arg-unused.c.expected b/glcpp/tests/014-define-func-2-arg-unused.c.expected deleted file mode 100644 index 878fd15d6f..0000000000 --- a/glcpp/tests/014-define-func-2-arg-unused.c.expected +++ /dev/null @@ -1,3 +0,0 @@ - -1 - diff --git a/glcpp/tests/015-define-object-with-parens.c b/glcpp/tests/015-define-object-with-parens.c deleted file mode 100644 index 558da9c617..0000000000 --- a/glcpp/tests/015-define-object-with-parens.c +++ /dev/null @@ -1,4 +0,0 @@ -#define foo ()1 -foo() -#define bar ()2 -bar() diff --git a/glcpp/tests/015-define-object-with-parens.c.expected b/glcpp/tests/015-define-object-with-parens.c.expected deleted file mode 100644 index d6f8cb9dc6..0000000000 --- a/glcpp/tests/015-define-object-with-parens.c.expected +++ /dev/null @@ -1,5 +0,0 @@ - -()1() - -()2() - diff --git a/glcpp/tests/016-define-func-1-arg.c b/glcpp/tests/016-define-func-1-arg.c deleted file mode 100644 index a2e2404c7c..0000000000 --- a/glcpp/tests/016-define-func-1-arg.c +++ /dev/null @@ -1,2 +0,0 @@ -#define foo(x) ((x)+1) -foo(bar) diff --git a/glcpp/tests/016-define-func-1-arg.c.expected b/glcpp/tests/016-define-func-1-arg.c.expected deleted file mode 100644 index 7f1828a3c6..0000000000 --- a/glcpp/tests/016-define-func-1-arg.c.expected +++ /dev/null @@ -1,3 +0,0 @@ - -((bar)+1) - diff --git a/glcpp/tests/017-define-func-2-args.c b/glcpp/tests/017-define-func-2-args.c deleted file mode 100644 index c725383527..0000000000 --- a/glcpp/tests/017-define-func-2-args.c +++ /dev/null @@ -1,2 +0,0 @@ -#define foo(x,y) ((x)*(y)) -foo(bar,baz) diff --git a/glcpp/tests/017-define-func-2-args.c.expected b/glcpp/tests/017-define-func-2-args.c.expected deleted file mode 100644 index 9f341dac00..0000000000 --- a/glcpp/tests/017-define-func-2-args.c.expected +++ /dev/null @@ -1,3 +0,0 @@ - -((bar)*(baz)) - diff --git a/glcpp/tests/018-define-func-macro-as-parameter.c b/glcpp/tests/018-define-func-macro-as-parameter.c deleted file mode 100644 index 668130b8f9..0000000000 --- a/glcpp/tests/018-define-func-macro-as-parameter.c +++ /dev/null @@ -1,3 +0,0 @@ -#define x 0 -#define foo(x) x -foo(1) diff --git a/glcpp/tests/018-define-func-macro-as-parameter.c.expected b/glcpp/tests/018-define-func-macro-as-parameter.c.expected deleted file mode 100644 index 43d484d713..0000000000 --- a/glcpp/tests/018-define-func-macro-as-parameter.c.expected +++ /dev/null @@ -1,4 +0,0 @@ - - -1 - diff --git a/glcpp/tests/019-define-func-1-arg-multi.c b/glcpp/tests/019-define-func-1-arg-multi.c deleted file mode 100644 index c4e62b2550..0000000000 --- a/glcpp/tests/019-define-func-1-arg-multi.c +++ /dev/null @@ -1,2 +0,0 @@ -#define foo(x) (x) -foo(this is more than one word) diff --git a/glcpp/tests/019-define-func-1-arg-multi.c.expected b/glcpp/tests/019-define-func-1-arg-multi.c.expected deleted file mode 100644 index 4314fc88d8..0000000000 --- a/glcpp/tests/019-define-func-1-arg-multi.c.expected +++ /dev/null @@ -1,3 +0,0 @@ - -(this is more than one word) - diff --git a/glcpp/tests/020-define-func-2-arg-multi.c b/glcpp/tests/020-define-func-2-arg-multi.c deleted file mode 100644 index 3049ad1546..0000000000 --- a/glcpp/tests/020-define-func-2-arg-multi.c +++ /dev/null @@ -1,2 +0,0 @@ -#define foo(x,y) x,two fish,red fish,y -foo(one fish, blue fish) diff --git a/glcpp/tests/020-define-func-2-arg-multi.c.expected b/glcpp/tests/020-define-func-2-arg-multi.c.expected deleted file mode 100644 index 5648e4fb9d..0000000000 --- a/glcpp/tests/020-define-func-2-arg-multi.c.expected +++ /dev/null @@ -1,3 +0,0 @@ - -one fish,two fish,red fish,blue fish - diff --git a/glcpp/tests/021-define-func-compose.c b/glcpp/tests/021-define-func-compose.c deleted file mode 100644 index 21ddd0e65f..0000000000 --- a/glcpp/tests/021-define-func-compose.c +++ /dev/null @@ -1,3 +0,0 @@ -#define bar(x) (1+(x)) -#define foo(y) (2*(y)) -foo(bar(3)) diff --git a/glcpp/tests/021-define-func-compose.c.expected b/glcpp/tests/021-define-func-compose.c.expected deleted file mode 100644 index 1d62105de4..0000000000 --- a/glcpp/tests/021-define-func-compose.c.expected +++ /dev/null @@ -1,4 +0,0 @@ - - -(2*((1+(3)))) - diff --git a/glcpp/tests/022-define-func-arg-with-parens.c b/glcpp/tests/022-define-func-arg-with-parens.c deleted file mode 100644 index c20d73a4a2..0000000000 --- a/glcpp/tests/022-define-func-arg-with-parens.c +++ /dev/null @@ -1,2 +0,0 @@ -#define foo(x) (x) -foo(argument(including parens)for the win) diff --git a/glcpp/tests/022-define-func-arg-with-parens.c.expected b/glcpp/tests/022-define-func-arg-with-parens.c.expected deleted file mode 100644 index 66c1658175..0000000000 --- a/glcpp/tests/022-define-func-arg-with-parens.c.expected +++ /dev/null @@ -1,3 +0,0 @@ - -(argument(including parens)for the win) - diff --git a/glcpp/tests/023-define-extra-whitespace.c b/glcpp/tests/023-define-extra-whitespace.c deleted file mode 100644 index 7ebfed6516..0000000000 --- a/glcpp/tests/023-define-extra-whitespace.c +++ /dev/null @@ -1,8 +0,0 @@ -#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/glcpp/tests/023-define-extra-whitespace.c.expected b/glcpp/tests/023-define-extra-whitespace.c.expected deleted file mode 100644 index 573829c2d6..0000000000 --- a/glcpp/tests/023-define-extra-whitespace.c.expected +++ /dev/null @@ -1,9 +0,0 @@ - - - - -1 -2 -3 4 -5 6 7 - diff --git a/glcpp/tests/024-define-chain-to-self-recursion.c b/glcpp/tests/024-define-chain-to-self-recursion.c deleted file mode 100644 index e788adce30..0000000000 --- a/glcpp/tests/024-define-chain-to-self-recursion.c +++ /dev/null @@ -1,3 +0,0 @@ -#define foo foo -#define bar foo -bar diff --git a/glcpp/tests/024-define-chain-to-self-recursion.c.expected b/glcpp/tests/024-define-chain-to-self-recursion.c.expected deleted file mode 100644 index ad955fce6e..0000000000 --- a/glcpp/tests/024-define-chain-to-self-recursion.c.expected +++ /dev/null @@ -1,4 +0,0 @@ - - -foo - diff --git a/glcpp/tests/025-func-macro-as-non-macro.c b/glcpp/tests/025-func-macro-as-non-macro.c deleted file mode 100644 index b433671d1b..0000000000 --- a/glcpp/tests/025-func-macro-as-non-macro.c +++ /dev/null @@ -1,2 +0,0 @@ -#define foo(bar) bar -foo bar diff --git a/glcpp/tests/025-func-macro-as-non-macro.c.expected b/glcpp/tests/025-func-macro-as-non-macro.c.expected deleted file mode 100644 index 960f44511a..0000000000 --- a/glcpp/tests/025-func-macro-as-non-macro.c.expected +++ /dev/null @@ -1,3 +0,0 @@ - -foo bar - diff --git a/glcpp/tests/026-define-func-extra-newlines.c b/glcpp/tests/026-define-func-extra-newlines.c deleted file mode 100644 index 0d83740530..0000000000 --- a/glcpp/tests/026-define-func-extra-newlines.c +++ /dev/null @@ -1,6 +0,0 @@ -#define foo(a) bar - -foo -( -1 -) diff --git a/glcpp/tests/026-define-func-extra-newlines.c.expected b/glcpp/tests/026-define-func-extra-newlines.c.expected deleted file mode 100644 index f0888f21b9..0000000000 --- a/glcpp/tests/026-define-func-extra-newlines.c.expected +++ /dev/null @@ -1,4 +0,0 @@ - - -bar - diff --git a/glcpp/tests/027-define-chain-obj-to-func.c b/glcpp/tests/027-define-chain-obj-to-func.c deleted file mode 100644 index 5ccb52caba..0000000000 --- a/glcpp/tests/027-define-chain-obj-to-func.c +++ /dev/null @@ -1,3 +0,0 @@ -#define failure() success -#define foo failure() -foo diff --git a/glcpp/tests/027-define-chain-obj-to-func.c.expected b/glcpp/tests/027-define-chain-obj-to-func.c.expected deleted file mode 100644 index aef762e1e6..0000000000 --- a/glcpp/tests/027-define-chain-obj-to-func.c.expected +++ /dev/null @@ -1,4 +0,0 @@ - - -success - diff --git a/glcpp/tests/028-define-chain-obj-to-non-func.c b/glcpp/tests/028-define-chain-obj-to-non-func.c deleted file mode 100644 index 44962a7187..0000000000 --- a/glcpp/tests/028-define-chain-obj-to-non-func.c +++ /dev/null @@ -1,3 +0,0 @@ -#define success() failure -#define foo success -foo diff --git a/glcpp/tests/028-define-chain-obj-to-non-func.c.expected b/glcpp/tests/028-define-chain-obj-to-non-func.c.expected deleted file mode 100644 index aef762e1e6..0000000000 --- a/glcpp/tests/028-define-chain-obj-to-non-func.c.expected +++ /dev/null @@ -1,4 +0,0 @@ - - -success - diff --git a/glcpp/tests/029-define-chain-obj-to-func-with-args.c b/glcpp/tests/029-define-chain-obj-to-func-with-args.c deleted file mode 100644 index 261f7d28fc..0000000000 --- a/glcpp/tests/029-define-chain-obj-to-func-with-args.c +++ /dev/null @@ -1,3 +0,0 @@ -#define bar(failure) failure -#define foo bar(success) -foo diff --git a/glcpp/tests/029-define-chain-obj-to-func-with-args.c.expected b/glcpp/tests/029-define-chain-obj-to-func-with-args.c.expected deleted file mode 100644 index aef762e1e6..0000000000 --- a/glcpp/tests/029-define-chain-obj-to-func-with-args.c.expected +++ /dev/null @@ -1,4 +0,0 @@ - - -success - diff --git a/glcpp/tests/030-define-chain-obj-to-func-compose.c b/glcpp/tests/030-define-chain-obj-to-func-compose.c deleted file mode 100644 index e56fbefd62..0000000000 --- a/glcpp/tests/030-define-chain-obj-to-func-compose.c +++ /dev/null @@ -1,4 +0,0 @@ -#define baz(failure) failure -#define bar(failure) failure -#define foo bar(baz(success)) -foo diff --git a/glcpp/tests/030-define-chain-obj-to-func-compose.c.expected b/glcpp/tests/030-define-chain-obj-to-func-compose.c.expected deleted file mode 100644 index 729bdd15f8..0000000000 --- a/glcpp/tests/030-define-chain-obj-to-func-compose.c.expected +++ /dev/null @@ -1,5 +0,0 @@ - - - -success - diff --git a/glcpp/tests/031-define-chain-func-to-func-compose.c b/glcpp/tests/031-define-chain-func-to-func-compose.c deleted file mode 100644 index 3f4c8744df..0000000000 --- a/glcpp/tests/031-define-chain-func-to-func-compose.c +++ /dev/null @@ -1,4 +0,0 @@ -#define baz(failure) failure -#define bar(failure) failure -#define foo() bar(baz(success)) -foo() diff --git a/glcpp/tests/031-define-chain-func-to-func-compose.c.expected b/glcpp/tests/031-define-chain-func-to-func-compose.c.expected deleted file mode 100644 index 729bdd15f8..0000000000 --- a/glcpp/tests/031-define-chain-func-to-func-compose.c.expected +++ /dev/null @@ -1,5 +0,0 @@ - - - -success - diff --git a/glcpp/tests/032-define-func-self-recurse.c b/glcpp/tests/032-define-func-self-recurse.c deleted file mode 100644 index b3ac70f499..0000000000 --- a/glcpp/tests/032-define-func-self-recurse.c +++ /dev/null @@ -1,2 +0,0 @@ -#define foo(a) foo(2*(a)) -foo(3) diff --git a/glcpp/tests/032-define-func-self-recurse.c.expected b/glcpp/tests/032-define-func-self-recurse.c.expected deleted file mode 100644 index 541d44db7a..0000000000 --- a/glcpp/tests/032-define-func-self-recurse.c.expected +++ /dev/null @@ -1,3 +0,0 @@ - -foo(2*(3)) - diff --git a/glcpp/tests/033-define-func-self-compose.c b/glcpp/tests/033-define-func-self-compose.c deleted file mode 100644 index f65e48286c..0000000000 --- a/glcpp/tests/033-define-func-self-compose.c +++ /dev/null @@ -1,2 +0,0 @@ -#define foo(a) foo(2*(a)) -foo(foo(3)) diff --git a/glcpp/tests/033-define-func-self-compose.c.expected b/glcpp/tests/033-define-func-self-compose.c.expected deleted file mode 100644 index 6ea6905d80..0000000000 --- a/glcpp/tests/033-define-func-self-compose.c.expected +++ /dev/null @@ -1,3 +0,0 @@ - -foo(2*(foo(2*(3)))) - diff --git a/glcpp/tests/034-define-func-self-compose-non-func.c b/glcpp/tests/034-define-func-self-compose-non-func.c deleted file mode 100644 index 209a5f7e07..0000000000 --- a/glcpp/tests/034-define-func-self-compose-non-func.c +++ /dev/null @@ -1,2 +0,0 @@ -#define foo(bar) bar -foo(foo) diff --git a/glcpp/tests/034-define-func-self-compose-non-func.c.expected b/glcpp/tests/034-define-func-self-compose-non-func.c.expected deleted file mode 100644 index 24823b1b67..0000000000 --- a/glcpp/tests/034-define-func-self-compose-non-func.c.expected +++ /dev/null @@ -1,3 +0,0 @@ - -foo - diff --git a/glcpp/tests/035-define-func-self-compose-non-func-multi-token-argument.c b/glcpp/tests/035-define-func-self-compose-non-func-multi-token-argument.c deleted file mode 100644 index c307fbe830..0000000000 --- a/glcpp/tests/035-define-func-self-compose-non-func-multi-token-argument.c +++ /dev/null @@ -1,2 +0,0 @@ -#define foo(bar) bar -foo(1+foo) diff --git a/glcpp/tests/035-define-func-self-compose-non-func-multi-token-argument.c.expected b/glcpp/tests/035-define-func-self-compose-non-func-multi-token-argument.c.expected deleted file mode 100644 index 137a9ea2db..0000000000 --- a/glcpp/tests/035-define-func-self-compose-non-func-multi-token-argument.c.expected +++ /dev/null @@ -1,3 +0,0 @@ - -1+foo - diff --git a/glcpp/tests/036-define-func-non-macro-multi-token-argument.c b/glcpp/tests/036-define-func-non-macro-multi-token-argument.c deleted file mode 100644 index b21ff33673..0000000000 --- a/glcpp/tests/036-define-func-non-macro-multi-token-argument.c +++ /dev/null @@ -1,3 +0,0 @@ -#define bar success -#define foo(x) x -foo(more bar) diff --git a/glcpp/tests/036-define-func-non-macro-multi-token-argument.c.expected b/glcpp/tests/036-define-func-non-macro-multi-token-argument.c.expected deleted file mode 100644 index ff6360bfe4..0000000000 --- a/glcpp/tests/036-define-func-non-macro-multi-token-argument.c.expected +++ /dev/null @@ -1,4 +0,0 @@ - - -more success - diff --git a/glcpp/tests/037-finalize-unexpanded-macro.c b/glcpp/tests/037-finalize-unexpanded-macro.c deleted file mode 100644 index b3a2f37f1b..0000000000 --- a/glcpp/tests/037-finalize-unexpanded-macro.c +++ /dev/null @@ -1,3 +0,0 @@ -#define expand(x) expand(x once) -#define foo(x) x -foo(expand(just)) diff --git a/glcpp/tests/037-finalize-unexpanded-macro.c.expected b/glcpp/tests/037-finalize-unexpanded-macro.c.expected deleted file mode 100644 index cbadee848a..0000000000 --- a/glcpp/tests/037-finalize-unexpanded-macro.c.expected +++ /dev/null @@ -1,4 +0,0 @@ - - -expand(just once) - diff --git a/glcpp/tests/038-func-arg-with-commas.c b/glcpp/tests/038-func-arg-with-commas.c deleted file mode 100644 index 1407c7d6e3..0000000000 --- a/glcpp/tests/038-func-arg-with-commas.c +++ /dev/null @@ -1,2 +0,0 @@ -#define foo(x) success -foo(argument (with,embedded , commas) -- tricky) diff --git a/glcpp/tests/038-func-arg-with-commas.c.expected b/glcpp/tests/038-func-arg-with-commas.c.expected deleted file mode 100644 index 5a28fb3b66..0000000000 --- a/glcpp/tests/038-func-arg-with-commas.c.expected +++ /dev/null @@ -1,3 +0,0 @@ - -success - diff --git a/glcpp/tests/039-func-arg-obj-macro-with-comma.c b/glcpp/tests/039-func-arg-obj-macro-with-comma.c deleted file mode 100644 index 0f7fe632b5..0000000000 --- a/glcpp/tests/039-func-arg-obj-macro-with-comma.c +++ /dev/null @@ -1,3 +0,0 @@ -#define foo(a) (a) -#define bar two,words -foo(bar) diff --git a/glcpp/tests/039-func-arg-obj-macro-with-comma.c.expected b/glcpp/tests/039-func-arg-obj-macro-with-comma.c.expected deleted file mode 100644 index b73869d023..0000000000 --- a/glcpp/tests/039-func-arg-obj-macro-with-comma.c.expected +++ /dev/null @@ -1,4 +0,0 @@ - - -(two,words) - diff --git a/glcpp/tests/040-token-pasting.c b/glcpp/tests/040-token-pasting.c deleted file mode 100644 index caab3ba736..0000000000 --- a/glcpp/tests/040-token-pasting.c +++ /dev/null @@ -1,2 +0,0 @@ -#define paste(a,b) a ## b -paste(one , token) diff --git a/glcpp/tests/040-token-pasting.c.expected b/glcpp/tests/040-token-pasting.c.expected deleted file mode 100644 index 36f6699253..0000000000 --- a/glcpp/tests/040-token-pasting.c.expected +++ /dev/null @@ -1,3 +0,0 @@ - -onetoken - diff --git a/glcpp/tests/041-if-0.c b/glcpp/tests/041-if-0.c deleted file mode 100644 index 2cab677d3e..0000000000 --- a/glcpp/tests/041-if-0.c +++ /dev/null @@ -1,5 +0,0 @@ -success_1 -#if 0 -failure -#endif -success_2 diff --git a/glcpp/tests/041-if-0.c.expected b/glcpp/tests/041-if-0.c.expected deleted file mode 100644 index 3800024c6f..0000000000 --- a/glcpp/tests/041-if-0.c.expected +++ /dev/null @@ -1,6 +0,0 @@ -success_1 - - - -success_2 - diff --git a/glcpp/tests/042-if-1.c b/glcpp/tests/042-if-1.c deleted file mode 100644 index 874a25cf41..0000000000 --- a/glcpp/tests/042-if-1.c +++ /dev/null @@ -1,5 +0,0 @@ -success_1 -#if 1 -success_2 -#endif -success_3 diff --git a/glcpp/tests/042-if-1.c.expected b/glcpp/tests/042-if-1.c.expected deleted file mode 100644 index e591044adb..0000000000 --- a/glcpp/tests/042-if-1.c.expected +++ /dev/null @@ -1,6 +0,0 @@ -success_1 - -success_2 - -success_3 - diff --git a/glcpp/tests/043-if-0-else.c b/glcpp/tests/043-if-0-else.c deleted file mode 100644 index 323351f9db..0000000000 --- a/glcpp/tests/043-if-0-else.c +++ /dev/null @@ -1,7 +0,0 @@ -success_1 -#if 0 -failure -#else -success_2 -#endif -success_3 diff --git a/glcpp/tests/043-if-0-else.c.expected b/glcpp/tests/043-if-0-else.c.expected deleted file mode 100644 index ee9e677096..0000000000 --- a/glcpp/tests/043-if-0-else.c.expected +++ /dev/null @@ -1,8 +0,0 @@ -success_1 - - - -success_2 - -success_3 - diff --git a/glcpp/tests/044-if-1-else.c b/glcpp/tests/044-if-1-else.c deleted file mode 100644 index 28dfc25c6f..0000000000 --- a/glcpp/tests/044-if-1-else.c +++ /dev/null @@ -1,7 +0,0 @@ -success_1 -#if 1 -success_2 -#else -failure -#endif -success_3 diff --git a/glcpp/tests/044-if-1-else.c.expected b/glcpp/tests/044-if-1-else.c.expected deleted file mode 100644 index 129f5c8542..0000000000 --- a/glcpp/tests/044-if-1-else.c.expected +++ /dev/null @@ -1,8 +0,0 @@ -success_1 - -success_2 - - - -success_3 - diff --git a/glcpp/tests/045-if-0-elif.c b/glcpp/tests/045-if-0-elif.c deleted file mode 100644 index e50f686d46..0000000000 --- a/glcpp/tests/045-if-0-elif.c +++ /dev/null @@ -1,11 +0,0 @@ -success_1 -#if 0 -failure_1 -#elif 0 -failure_2 -#elif 1 -success_3 -#elif 1 -failure_3 -#endif -success_4 diff --git a/glcpp/tests/045-if-0-elif.c.expected b/glcpp/tests/045-if-0-elif.c.expected deleted file mode 100644 index 97a11b4472..0000000000 --- a/glcpp/tests/045-if-0-elif.c.expected +++ /dev/null @@ -1,12 +0,0 @@ -success_1 - - - - - -success_3 - - - -success_4 - diff --git a/glcpp/tests/046-if-1-elsif.c b/glcpp/tests/046-if-1-elsif.c deleted file mode 100644 index 130515a01e..0000000000 --- a/glcpp/tests/046-if-1-elsif.c +++ /dev/null @@ -1,11 +0,0 @@ -success_1 -#if 1 -success_2 -#elif 0 -failure_1 -#elif 1 -failure_2 -#elif 0 -failure_3 -#endif -success_3 diff --git a/glcpp/tests/046-if-1-elsif.c.expected b/glcpp/tests/046-if-1-elsif.c.expected deleted file mode 100644 index b928b917e3..0000000000 --- a/glcpp/tests/046-if-1-elsif.c.expected +++ /dev/null @@ -1,12 +0,0 @@ -success_1 - -success_2 - - - - - - - -success_3 - diff --git a/glcpp/tests/047-if-elif-else.c b/glcpp/tests/047-if-elif-else.c deleted file mode 100644 index e8f0838a9e..0000000000 --- a/glcpp/tests/047-if-elif-else.c +++ /dev/null @@ -1,11 +0,0 @@ -success_1 -#if 0 -failure_1 -#elif 0 -failure_2 -#elif 0 -failure_3 -#else -success_2 -#endif -success_3 diff --git a/glcpp/tests/047-if-elif-else.c.expected b/glcpp/tests/047-if-elif-else.c.expected deleted file mode 100644 index e5b53a3fa5..0000000000 --- a/glcpp/tests/047-if-elif-else.c.expected +++ /dev/null @@ -1,12 +0,0 @@ -success_1 - - - - - - - -success_2 - -success_3 - diff --git a/glcpp/tests/048-if-nested.c b/glcpp/tests/048-if-nested.c deleted file mode 100644 index fc4679c3be..0000000000 --- a/glcpp/tests/048-if-nested.c +++ /dev/null @@ -1,11 +0,0 @@ -success_1 -#if 0 -failure_1 -#if 1 -failure_2 -#else -failure_3 -#endif -failure_4 -#endif -success_2 diff --git a/glcpp/tests/048-if-nested.c.expected b/glcpp/tests/048-if-nested.c.expected deleted file mode 100644 index c61fd0b315..0000000000 --- a/glcpp/tests/048-if-nested.c.expected +++ /dev/null @@ -1,12 +0,0 @@ -success_1 - - - - - - - - - -success_2 - diff --git a/glcpp/tests/049-if-expression-precedence.c b/glcpp/tests/049-if-expression-precedence.c deleted file mode 100644 index 833ea03882..0000000000 --- a/glcpp/tests/049-if-expression-precedence.c +++ /dev/null @@ -1,5 +0,0 @@ -#if 1 + 2 * 3 + - (25 % 17 - + 1) -failure with operator precedence -#else -success -#endif diff --git a/glcpp/tests/049-if-expression-precedence.c.expected b/glcpp/tests/049-if-expression-precedence.c.expected deleted file mode 100644 index 569debb0bb..0000000000 --- a/glcpp/tests/049-if-expression-precedence.c.expected +++ /dev/null @@ -1,6 +0,0 @@ - - - -success - - diff --git a/glcpp/tests/050-if-defined.c b/glcpp/tests/050-if-defined.c deleted file mode 100644 index 34f0f95140..0000000000 --- a/glcpp/tests/050-if-defined.c +++ /dev/null @@ -1,17 +0,0 @@ -#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/glcpp/tests/050-if-defined.c.expected b/glcpp/tests/050-if-defined.c.expected deleted file mode 100644 index 3f01955ee4..0000000000 --- a/glcpp/tests/050-if-defined.c.expected +++ /dev/null @@ -1,18 +0,0 @@ - - - -success_1 - - - -success_2 - - - - - - - -success_3 - - diff --git a/glcpp/tests/051-if-relational.c b/glcpp/tests/051-if-relational.c deleted file mode 100644 index c3db488e0d..0000000000 --- a/glcpp/tests/051-if-relational.c +++ /dev/null @@ -1,35 +0,0 @@ -#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/glcpp/tests/051-if-relational.c.expected b/glcpp/tests/051-if-relational.c.expected deleted file mode 100644 index d2b76f1457..0000000000 --- a/glcpp/tests/051-if-relational.c.expected +++ /dev/null @@ -1,36 +0,0 @@ - - - -success_1 - - - -success_2 - - - - - -success_3 - - - - - -success_3 - - - - - - - -success_4 - - - -success_5 - - - - diff --git a/glcpp/tests/052-if-bitwise.c b/glcpp/tests/052-if-bitwise.c deleted file mode 100644 index 2d8e45eb61..0000000000 --- a/glcpp/tests/052-if-bitwise.c +++ /dev/null @@ -1,20 +0,0 @@ -#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/glcpp/tests/052-if-bitwise.c.expected b/glcpp/tests/052-if-bitwise.c.expected deleted file mode 100644 index bb5d92e8d9..0000000000 --- a/glcpp/tests/052-if-bitwise.c.expected +++ /dev/null @@ -1,21 +0,0 @@ - - - -success_1 - - -success_2 - - - - - - -success_3 - - -success_4 - - - - diff --git a/glcpp/tests/053-if-divide-and-shift.c b/glcpp/tests/053-if-divide-and-shift.c deleted file mode 100644 index d24c54a88d..0000000000 --- a/glcpp/tests/053-if-divide-and-shift.c +++ /dev/null @@ -1,15 +0,0 @@ -#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/glcpp/tests/053-if-divide-and-shift.c.expected b/glcpp/tests/053-if-divide-and-shift.c.expected deleted file mode 100644 index f97e93673c..0000000000 --- a/glcpp/tests/053-if-divide-and-shift.c.expected +++ /dev/null @@ -1,16 +0,0 @@ - - - -success_1 - - -success_2 - - - - - - -success_3 - - diff --git a/glcpp/tests/054-if-with-macros.c b/glcpp/tests/054-if-with-macros.c deleted file mode 100644 index 3da79a0d96..0000000000 --- a/glcpp/tests/054-if-with-macros.c +++ /dev/null @@ -1,34 +0,0 @@ -#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/glcpp/tests/054-if-with-macros.c.expected b/glcpp/tests/054-if-with-macros.c.expected deleted file mode 100644 index 27ea496962..0000000000 --- a/glcpp/tests/054-if-with-macros.c.expected +++ /dev/null @@ -1,35 +0,0 @@ - - - - - - - -success_1 - - -success_2 - - - - -success_3 - - - - -success_4 - - - - - - -success_5 - - -success_6 - - - - diff --git a/glcpp/tests/055-define-chain-obj-to-func-parens-in-text.c b/glcpp/tests/055-define-chain-obj-to-func-parens-in-text.c deleted file mode 100644 index 00f2c2346d..0000000000 --- a/glcpp/tests/055-define-chain-obj-to-func-parens-in-text.c +++ /dev/null @@ -1,3 +0,0 @@ -#define failure() success -#define foo failure -foo() diff --git a/glcpp/tests/055-define-chain-obj-to-func-parens-in-text.c.expected b/glcpp/tests/055-define-chain-obj-to-func-parens-in-text.c.expected deleted file mode 100644 index aef762e1e6..0000000000 --- a/glcpp/tests/055-define-chain-obj-to-func-parens-in-text.c.expected +++ /dev/null @@ -1,4 +0,0 @@ - - -success - diff --git a/glcpp/tests/056-macro-argument-with-comma.c b/glcpp/tests/056-macro-argument-with-comma.c deleted file mode 100644 index 58701d1f25..0000000000 --- a/glcpp/tests/056-macro-argument-with-comma.c +++ /dev/null @@ -1,4 +0,0 @@ -#define bar with,embedded,commas -#define function(x) success -#define foo function -foo(bar) diff --git a/glcpp/tests/056-macro-argument-with-comma.c.expected b/glcpp/tests/056-macro-argument-with-comma.c.expected deleted file mode 100644 index 729bdd15f8..0000000000 --- a/glcpp/tests/056-macro-argument-with-comma.c.expected +++ /dev/null @@ -1,5 +0,0 @@ - - - -success - diff --git a/glcpp/tests/057-empty-arguments.c b/glcpp/tests/057-empty-arguments.c deleted file mode 100644 index 6140232865..0000000000 --- a/glcpp/tests/057-empty-arguments.c +++ /dev/null @@ -1,6 +0,0 @@ -#define zero() success -zero() -#define one(x) success -one() -#define two(x,y) success -two(,) diff --git a/glcpp/tests/057-empty-arguments.c.expected b/glcpp/tests/057-empty-arguments.c.expected deleted file mode 100644 index 4e3aad5217..0000000000 --- a/glcpp/tests/057-empty-arguments.c.expected +++ /dev/null @@ -1,7 +0,0 @@ - -success - -success - -success - diff --git a/glcpp/tests/058-token-pasting-empty-arguments.c b/glcpp/tests/058-token-pasting-empty-arguments.c deleted file mode 100644 index 8ac260c76b..0000000000 --- a/glcpp/tests/058-token-pasting-empty-arguments.c +++ /dev/null @@ -1,5 +0,0 @@ -#define paste(x,y) x ## y -paste(a,b) -paste(a,) -paste(,b) -paste(,) diff --git a/glcpp/tests/058-token-pasting-empty-arguments.c.expected b/glcpp/tests/058-token-pasting-empty-arguments.c.expected deleted file mode 100644 index a1c34e5c1f..0000000000 --- a/glcpp/tests/058-token-pasting-empty-arguments.c.expected +++ /dev/null @@ -1,6 +0,0 @@ - -ab -a -b - - diff --git a/glcpp/tests/059-token-pasting-integer.c b/glcpp/tests/059-token-pasting-integer.c deleted file mode 100644 index 37b895a423..0000000000 --- a/glcpp/tests/059-token-pasting-integer.c +++ /dev/null @@ -1,4 +0,0 @@ -#define paste(x,y) x ## y -paste(1,2) -paste(1,000) -paste(identifier,2) diff --git a/glcpp/tests/059-token-pasting-integer.c.expected b/glcpp/tests/059-token-pasting-integer.c.expected deleted file mode 100644 index f1a2cd21c1..0000000000 --- a/glcpp/tests/059-token-pasting-integer.c.expected +++ /dev/null @@ -1,5 +0,0 @@ - -12 -1000 -identifier2 - diff --git a/glcpp/tests/060-left-paren-in-macro-right-paren-in-text.c b/glcpp/tests/060-left-paren-in-macro-right-paren-in-text.c deleted file mode 100644 index ed80ea879c..0000000000 --- a/glcpp/tests/060-left-paren-in-macro-right-paren-in-text.c +++ /dev/null @@ -1,3 +0,0 @@ -#define double(a) a*2 -#define foo double( -foo 5) diff --git a/glcpp/tests/060-left-paren-in-macro-right-paren-in-text.c.expected b/glcpp/tests/060-left-paren-in-macro-right-paren-in-text.c.expected deleted file mode 100644 index c1f0d24a14..0000000000 --- a/glcpp/tests/060-left-paren-in-macro-right-paren-in-text.c.expected +++ /dev/null @@ -1,4 +0,0 @@ - - -5*2 - diff --git a/glcpp/tests/061-define-chain-obj-to-func-multi.c b/glcpp/tests/061-define-chain-obj-to-func-multi.c deleted file mode 100644 index 6dbfd1f62d..0000000000 --- a/glcpp/tests/061-define-chain-obj-to-func-multi.c +++ /dev/null @@ -1,5 +0,0 @@ -#define foo(x) success -#define bar foo -#define baz bar -#define joe baz -joe (failure) diff --git a/glcpp/tests/061-define-chain-obj-to-func-multi.c.expected b/glcpp/tests/061-define-chain-obj-to-func-multi.c.expected deleted file mode 100644 index 111f7d1063..0000000000 --- a/glcpp/tests/061-define-chain-obj-to-func-multi.c.expected +++ /dev/null @@ -1,6 +0,0 @@ - - - - -success - diff --git a/glcpp/tests/062-if-0-skips-garbage.c b/glcpp/tests/062-if-0-skips-garbage.c deleted file mode 100644 index d9e439bb89..0000000000 --- a/glcpp/tests/062-if-0-skips-garbage.c +++ /dev/null @@ -1,5 +0,0 @@ -#define foo(a,b) -#if 0 -foo(bar) -foo( -#endif diff --git a/glcpp/tests/062-if-0-skips-garbage.c.expected b/glcpp/tests/062-if-0-skips-garbage.c.expected deleted file mode 100644 index 6fb66a5e2f..0000000000 --- a/glcpp/tests/062-if-0-skips-garbage.c.expected +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/glcpp/tests/063-comments.c b/glcpp/tests/063-comments.c deleted file mode 100644 index e641d2f0f9..0000000000 --- a/glcpp/tests/063-comments.c +++ /dev/null @@ -1,20 +0,0 @@ -/* 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/glcpp/tests/063-comments.c.expected b/glcpp/tests/063-comments.c.expected deleted file mode 100644 index ed4feedd45..0000000000 --- a/glcpp/tests/063-comments.c.expected +++ /dev/null @@ -1,14 +0,0 @@ - - - -f = g /h; - l(); -m = n -+ p; - -more code here - -are not treated like comments. - - - diff --git a/glcpp/tests/064-version.c b/glcpp/tests/064-version.c deleted file mode 100644 index 21326481b8..0000000000 --- a/glcpp/tests/064-version.c +++ /dev/null @@ -1,2 +0,0 @@ -#version 130 -#define FOO diff --git a/glcpp/tests/064-version.c.expected b/glcpp/tests/064-version.c.expected deleted file mode 100644 index 3af71113c8..0000000000 --- a/glcpp/tests/064-version.c.expected +++ /dev/null @@ -1,3 +0,0 @@ -#version 130 - - diff --git a/glcpp/tests/065-if-defined-parens.c b/glcpp/tests/065-if-defined-parens.c deleted file mode 100644 index 48aa0f8c3e..0000000000 --- a/glcpp/tests/065-if-defined-parens.c +++ /dev/null @@ -1,17 +0,0 @@ -#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/glcpp/tests/065-if-defined-parens.c.expected b/glcpp/tests/065-if-defined-parens.c.expected deleted file mode 100644 index 3f01955ee4..0000000000 --- a/glcpp/tests/065-if-defined-parens.c.expected +++ /dev/null @@ -1,18 +0,0 @@ - - - -success_1 - - - -success_2 - - - - - - - -success_3 - - diff --git a/glcpp/tests/071-punctuator.c b/glcpp/tests/071-punctuator.c deleted file mode 100644 index 959d682598..0000000000 --- a/glcpp/tests/071-punctuator.c +++ /dev/null @@ -1 +0,0 @@ -a = b diff --git a/glcpp/tests/071-punctuator.c.expected b/glcpp/tests/071-punctuator.c.expected deleted file mode 100644 index fee253b745..0000000000 --- a/glcpp/tests/071-punctuator.c.expected +++ /dev/null @@ -1,2 +0,0 @@ -a = b - diff --git a/glcpp/tests/072-token-pasting-same-line.c b/glcpp/tests/072-token-pasting-same-line.c deleted file mode 100644 index e421e9d5e2..0000000000 --- a/glcpp/tests/072-token-pasting-same-line.c +++ /dev/null @@ -1,2 +0,0 @@ -#define paste(x) success_ ## x -paste(1) paste(2) paste(3) diff --git a/glcpp/tests/072-token-pasting-same-line.c.expected b/glcpp/tests/072-token-pasting-same-line.c.expected deleted file mode 100644 index c780b43d70..0000000000 --- a/glcpp/tests/072-token-pasting-same-line.c.expected +++ /dev/null @@ -1,3 +0,0 @@ - -success_1 success_2 success_3 - diff --git a/glcpp/tests/099-c99-example.c b/glcpp/tests/099-c99-example.c deleted file mode 100644 index d1976b1f26..0000000000 --- a/glcpp/tests/099-c99-example.c +++ /dev/null @@ -1,17 +0,0 @@ -#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/glcpp/tests/099-c99-example.c.expected b/glcpp/tests/099-c99-example.c.expected deleted file mode 100644 index 19be750555..0000000000 --- a/glcpp/tests/099-c99-example.c.expected +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - - - - - -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/glcpp/tests/glcpp-test b/glcpp/tests/glcpp-test deleted file mode 100755 index 396f6e175e..0000000000 --- a/glcpp/tests/glcpp-test +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/sh - -for test in *.c; do - echo "Testing $test" - ../glcpp < $test > $test.out - diff -u $test.expected $test.out -done diff --git a/glcpp/xtalloc.c b/glcpp/xtalloc.c deleted file mode 100644 index 656ac2d6cb..0000000000 --- a/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 - -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/glsl_lexer.lpp b/glsl_lexer.lpp deleted file mode 100644 index fa439f1278..0000000000 --- a/glsl_lexer.lpp +++ /dev/null @@ -1,336 +0,0 @@ -%{ -/* - * 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/glsl_parser.ypp b/glsl_parser.ypp deleted file mode 100644 index 4132495f40..0000000000 --- a/glsl_parser.ypp +++ /dev/null @@ -1,1444 +0,0 @@ -%{ -/* - * 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/glsl_parser_extras.cpp b/glsl_parser_extras.cpp deleted file mode 100644 index 1d16ef55f5..0000000000 --- a/glsl_parser_extras.cpp +++ /dev/null @@ -1,621 +0,0 @@ -/* - * 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/glsl_parser_extras.h b/glsl_parser_extras.h deleted file mode 100644 index cfe02e3b0c..0000000000 --- a/glsl_parser_extras.h +++ /dev/null @@ -1,139 +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. - */ - -#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/glsl_symbol_table.h b/glsl_symbol_table.h deleted file mode 100644 index ae2fd3f4f1..0000000000 --- a/glsl_symbol_table.h +++ /dev/null @@ -1,163 +0,0 @@ -/* -*- 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/glsl_types.cpp b/glsl_types.cpp deleted file mode 100644 index bef267fa6b..0000000000 --- a/glsl_types.cpp +++ /dev/null @@ -1,773 +0,0 @@ -/* - * 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/glsl_types.h b/glsl_types.h deleted file mode 100644 index 39e6ac970a..0000000000 --- a/glsl_types.h +++ /dev/null @@ -1,445 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright © 2009 Intel Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - */ - -#pragma once -#ifndef 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/hash_table.c b/hash_table.c deleted file mode 100644 index e89a2564d7..0000000000 --- a/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/hash_table.h b/hash_table.h deleted file mode 100644 index b9dd343dee..0000000000 --- a/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/hir_field_selection.cpp b/hir_field_selection.cpp deleted file mode 100644 index e2efff60d3..0000000000 --- a/hir_field_selection.cpp +++ /dev/null @@ -1,81 +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 "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/ir.cpp b/ir.cpp deleted file mode 100644 index 2756752ba4..0000000000 --- a/ir.cpp +++ /dev/null @@ -1,818 +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 -#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/ir.h b/ir.h deleted file mode 100644 index 3d2c7ff5cf..0000000000 --- a/ir.h +++ /dev/null @@ -1,1178 +0,0 @@ -/* -*- 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/ir_basic_block.cpp b/ir_basic_block.cpp deleted file mode 100644 index f9953ea42d..0000000000 --- a/ir_basic_block.cpp +++ /dev/null @@ -1,144 +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_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/ir_basic_block.h b/ir_basic_block.h deleted file mode 100644 index dbd678b5c4..0000000000 --- a/ir_basic_block.h +++ /dev/null @@ -1,28 +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. - */ - -void call_for_basic_blocks(exec_list *instructions, - void (*callback)(ir_instruction *first, - ir_instruction *last, - void *data), - void *data); diff --git a/ir_clone.cpp b/ir_clone.cpp deleted file mode 100644 index 84176383fc..0000000000 --- a/ir_clone.cpp +++ /dev/null @@ -1,287 +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 -#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/ir_constant_expression.cpp b/ir_constant_expression.cpp deleted file mode 100644 index 3408f5256a..0000000000 --- a/ir_constant_expression.cpp +++ /dev/null @@ -1,671 +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_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/ir_constant_folding.cpp b/ir_constant_folding.cpp deleted file mode 100644 index 342d027bbe..0000000000 --- a/ir_constant_folding.cpp +++ /dev/null @@ -1,229 +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_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/ir_constant_variable.cpp b/ir_constant_variable.cpp deleted file mode 100644 index ef5e1e418e..0000000000 --- a/ir_constant_variable.cpp +++ /dev/null @@ -1,156 +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_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/ir_copy_propagation.cpp b/ir_copy_propagation.cpp deleted file mode 100644 index 46ef6679d9..0000000000 --- a/ir_copy_propagation.cpp +++ /dev/null @@ -1,256 +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_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/ir_dead_code.cpp b/ir_dead_code.cpp deleted file mode 100644 index 8821304682..0000000000 --- a/ir_dead_code.cpp +++ /dev/null @@ -1,219 +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_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/ir_dead_code_local.cpp b/ir_dead_code_local.cpp deleted file mode 100644 index e01877077c..0000000000 --- a/ir_dead_code_local.cpp +++ /dev/null @@ -1,223 +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_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/ir_expression_flattening.cpp b/ir_expression_flattening.cpp deleted file mode 100644 index 5ba24e390b..0000000000 --- a/ir_expression_flattening.cpp +++ /dev/null @@ -1,172 +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_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/ir_expression_flattening.h b/ir_expression_flattening.h deleted file mode 100644 index 2eda159000..0000000000 --- a/ir_expression_flattening.h +++ /dev/null @@ -1,38 +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_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/ir_function.cpp b/ir_function.cpp deleted file mode 100644 index 5db93f67fb..0000000000 --- a/ir_function.cpp +++ /dev/null @@ -1,225 +0,0 @@ -/* - * Copyright © 2010 Intel Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - */ - -#include "glsl_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/ir_function_can_inline.cpp b/ir_function_can_inline.cpp deleted file mode 100644 index 8bb8e0d9ed..0000000000 --- a/ir_function_can_inline.cpp +++ /dev/null @@ -1,71 +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_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/ir_function_inlining.cpp b/ir_function_inlining.cpp deleted file mode 100644 index e55780c940..0000000000 --- a/ir_function_inlining.cpp +++ /dev/null @@ -1,272 +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_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/ir_function_inlining.h b/ir_function_inlining.h deleted file mode 100644 index 6db011bbca..0000000000 --- a/ir_function_inlining.h +++ /dev/null @@ -1,30 +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_function_inlining.h - * - * Replaces calls to functions with the body of the function. - */ - -bool can_inline(ir_call *call); diff --git a/ir_hierarchical_visitor.cpp b/ir_hierarchical_visitor.cpp deleted file mode 100644 index 0d520b127f..0000000000 --- a/ir_hierarchical_visitor.cpp +++ /dev/null @@ -1,284 +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 "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/ir_hierarchical_visitor.h b/ir_hierarchical_visitor.h deleted file mode 100644 index 8b9e49dab1..0000000000 --- a/ir_hierarchical_visitor.h +++ /dev/null @@ -1,162 +0,0 @@ -/* -*- 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/ir_hv_accept.cpp b/ir_hv_accept.cpp deleted file mode 100644 index f936b3500e..0000000000 --- a/ir_hv_accept.cpp +++ /dev/null @@ -1,348 +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 "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/ir_if_simplification.cpp b/ir_if_simplification.cpp deleted file mode 100644 index 6882ef72b9..0000000000 --- a/ir_if_simplification.cpp +++ /dev/null @@ -1,84 +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_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/ir_optimization.h b/ir_optimization.h deleted file mode 100644 index 432a33458c..0000000000 --- a/ir_optimization.h +++ /dev/null @@ -1,41 +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_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/ir_print_visitor.cpp b/ir_print_visitor.cpp deleted file mode 100644 index be5a843f67..0000000000 --- a/ir_print_visitor.cpp +++ /dev/null @@ -1,373 +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 "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/ir_print_visitor.h b/ir_print_visitor.h deleted file mode 100644 index e97b823522..0000000000 --- a/ir_print_visitor.h +++ /dev/null @@ -1,81 +0,0 @@ -/* -*- 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/ir_reader.cpp b/ir_reader.cpp deleted file mode 100644 index 7383c42cbc..0000000000 --- a/ir_reader.cpp +++ /dev/null @@ -1,1053 +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 - -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/ir_reader.h b/ir_reader.h deleted file mode 100644 index b6afdc81ab..0000000000 --- a/ir_reader.h +++ /dev/null @@ -1,34 +0,0 @@ -/* -*- 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/ir_swizzle_swizzle.cpp b/ir_swizzle_swizzle.cpp deleted file mode 100644 index 0ffb4fa313..0000000000 --- a/ir_swizzle_swizzle.cpp +++ /dev/null @@ -1,93 +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_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/ir_to_mesa.cpp b/ir_to_mesa.cpp deleted file mode 100644 index 26449c5a5c..0000000000 --- a/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/ir_validate.cpp b/ir_validate.cpp deleted file mode 100644 index 507e88993f..0000000000 --- a/ir_validate.cpp +++ /dev/null @@ -1,104 +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_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/ir_variable.cpp b/ir_variable.cpp deleted file mode 100644 index 15a4a92f62..0000000000 --- a/ir_variable.cpp +++ /dev/null @@ -1,345 +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 "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/ir_vec_index_to_swizzle.cpp b/ir_vec_index_to_swizzle.cpp deleted file mode 100644 index abeb43cd68..0000000000 --- a/ir_vec_index_to_swizzle.cpp +++ /dev/null @@ -1,158 +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_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/ir_visitor.h b/ir_visitor.h deleted file mode 100644 index a6f9d2b7ee..0000000000 --- a/ir_visitor.h +++ /dev/null @@ -1,66 +0,0 @@ -/* -*- 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/linker.cpp b/linker.cpp deleted file mode 100644 index ba382fe881..0000000000 --- a/linker.cpp +++ /dev/null @@ -1,871 +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 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/list.h b/list.h deleted file mode 100644 index 7732d66d7a..0000000000 --- a/list.h +++ /dev/null @@ -1,403 +0,0 @@ -/* - * 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/main.cpp b/main.cpp deleted file mode 100644 index dcd9bd69c0..0000000000 --- a/main.cpp +++ /dev/null @@ -1,256 +0,0 @@ -/* - * 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/main/imports.h b/main/imports.h deleted file mode 100644 index d2197342c0..0000000000 --- a/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/main/mtypes.h b/main/mtypes.h deleted file mode 100644 index 06e2dd4b54..0000000000 --- a/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/main/simple_list.h b/main/simple_list.h deleted file mode 100644 index 5ef39e14cc..0000000000 --- a/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/mesa/shader/prog_instruction.c b/mesa/shader/prog_instruction.c deleted file mode 100644 index fbcf868f50..0000000000 --- a/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/mesa/shader/prog_instruction.h b/mesa/shader/prog_instruction.h deleted file mode 100644 index 2c95d274ca..0000000000 --- a/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/mesa/shader/prog_print.c b/mesa/shader/prog_print.c deleted file mode 100644 index 3f1cb48e4b..0000000000 --- a/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/mesa/shader/prog_print.h b/mesa/shader/prog_print.h deleted file mode 100644 index f0df77b512..0000000000 --- a/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/program.h b/program.h deleted file mode 100644 index d21b04344c..0000000000 --- a/program.h +++ /dev/null @@ -1,155 +0,0 @@ -/* - * 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/s_expression.cpp b/s_expression.cpp deleted file mode 100644 index 26be23ea8f..0000000000 --- a/s_expression.cpp +++ /dev/null @@ -1,131 +0,0 @@ -/* -*- 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/s_expression.h b/s_expression.h deleted file mode 100644 index 1a0c03c218..0000000000 --- a/s_expression.h +++ /dev/null @@ -1,142 +0,0 @@ -/* -*- 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/.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; diff --git a/symbol_table.c b/symbol_table.c deleted file mode 100644 index 0f0df7a261..0000000000 --- a/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/symbol_table.h b/symbol_table.h deleted file mode 100644 index 3a9994c1ac..0000000000 --- a/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 */ diff --git a/tests/array-01.glsl b/tests/array-01.glsl deleted file mode 100644 index d14135fb3a..0000000000 --- a/tests/array-01.glsl +++ /dev/null @@ -1,3 +0,0 @@ -#version 120 -/* FAIL - array size type must be int */ -uniform vec4 [3.2] a; diff --git a/tests/array-02.glsl b/tests/array-02.glsl deleted file mode 100644 index d743617158..0000000000 --- a/tests/array-02.glsl +++ /dev/null @@ -1,3 +0,0 @@ -#version 120 -/* FAIL - array size type must be scalar */ -uniform vec4 [ivec4(3)] a; diff --git a/tests/array-03.glsl b/tests/array-03.glsl deleted file mode 100644 index 0026913f01..0000000000 --- a/tests/array-03.glsl +++ /dev/null @@ -1,3 +0,0 @@ -#version 120 -/* PASS */ -uniform vec4 [3] a; diff --git a/tests/array-04.glsl b/tests/array-04.glsl deleted file mode 100644 index 70f434d8ab..0000000000 --- a/tests/array-04.glsl +++ /dev/null @@ -1,2 +0,0 @@ -/* FAIL - array size type must be int */ -uniform vec4 a[3.2]; diff --git a/tests/array-05.glsl b/tests/array-05.glsl deleted file mode 100644 index 168704096b..0000000000 --- a/tests/array-05.glsl +++ /dev/null @@ -1,2 +0,0 @@ -/* FAIL - array size type must be scalar */ -uniform vec4 a[ivec4(3)]; diff --git a/tests/array-06.glsl b/tests/array-06.glsl deleted file mode 100644 index 46b43795be..0000000000 --- a/tests/array-06.glsl +++ /dev/null @@ -1,2 +0,0 @@ -/* PASS */ -uniform vec4 a[3]; diff --git a/tests/array-07.glsl b/tests/array-07.glsl deleted file mode 100644 index 161ffbf2f2..0000000000 --- a/tests/array-07.glsl +++ /dev/null @@ -1,2 +0,0 @@ -/* FAIL - array size must be > 0 */ -uniform vec4 a[0]; diff --git a/tests/array-08.glsl b/tests/array-08.glsl deleted file mode 100644 index 4bf0c6bd51..0000000000 --- a/tests/array-08.glsl +++ /dev/null @@ -1,2 +0,0 @@ -/* FAIL - array size must be > 0 */ -uniform vec4 a[-1]; diff --git a/tests/array-09.glsl b/tests/array-09.glsl deleted file mode 100644 index cad6d0e54e..0000000000 --- a/tests/array-09.glsl +++ /dev/null @@ -1,9 +0,0 @@ -#version 120 -/* PASS */ - -void main() -{ - vec4 a[2] = vec4 [2] (vec4(1.0), vec4(2.0)); - - gl_Position = gl_Vertex; -} diff --git a/tests/array-10.glsl b/tests/array-10.glsl deleted file mode 100644 index 019aa21150..0000000000 --- a/tests/array-10.glsl +++ /dev/null @@ -1,11 +0,0 @@ -/* 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/tests/array-11.glsl b/tests/array-11.glsl deleted file mode 100644 index 51d94e9477..0000000000 --- a/tests/array-11.glsl +++ /dev/null @@ -1,9 +0,0 @@ -#version 120 -/* PASS */ - -void main() -{ - vec4 a[] = vec4 [] (vec4(1.0), vec4(2.0)); - - gl_Position = gl_Vertex; -} diff --git a/tests/array-12.glsl b/tests/array-12.glsl deleted file mode 100644 index 7fc9579452..0000000000 --- a/tests/array-12.glsl +++ /dev/null @@ -1,11 +0,0 @@ -#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/tests/array-13.glsl b/tests/array-13.glsl deleted file mode 100644 index cc7e29a5f7..0000000000 --- a/tests/array-13.glsl +++ /dev/null @@ -1,11 +0,0 @@ -#version 120 -/* PASS */ - -void main() -{ - vec4 a[2]; - - a = vec4 [] (vec4(1.0), vec4(2.0)); - - gl_Position = gl_Vertex; -} diff --git a/tests/attribute-01.glsl b/tests/attribute-01.glsl deleted file mode 100644 index 18e9e4468a..0000000000 --- a/tests/attribute-01.glsl +++ /dev/null @@ -1,7 +0,0 @@ -/* FAIL - attribute cannot have type int */ -attribute int i; - -void main() -{ - gl_Position = vec4(1.0); -} diff --git a/tests/attribute-02.glsl b/tests/attribute-02.glsl deleted file mode 100644 index 6b6df74d25..0000000000 --- a/tests/attribute-02.glsl +++ /dev/null @@ -1,7 +0,0 @@ -/* FAIL - attribute cannot have type ivec2 */ -attribute ivec2 i; - -void main() -{ - gl_Position = vec4(1.0); -} diff --git a/tests/attribute-03.glsl b/tests/attribute-03.glsl deleted file mode 100644 index 870de9e814..0000000000 --- a/tests/attribute-03.glsl +++ /dev/null @@ -1,7 +0,0 @@ -/* FAIL - attribute cannot have type ivec3 */ -attribute ivec3 i; - -void main() -{ - gl_Position = vec4(1.0); -} diff --git a/tests/attribute-04.glsl b/tests/attribute-04.glsl deleted file mode 100644 index 14af2fcaad..0000000000 --- a/tests/attribute-04.glsl +++ /dev/null @@ -1,7 +0,0 @@ -/* FAIL - attribute cannot have type ivec4 */ -attribute ivec4 i; - -void main() -{ - gl_Position = vec4(1.0); -} diff --git a/tests/attribute-05.glsl b/tests/attribute-05.glsl deleted file mode 100644 index 18822c7854..0000000000 --- a/tests/attribute-05.glsl +++ /dev/null @@ -1,7 +0,0 @@ -/* FAIL - attribute cannot have type bool */ -attribute bool i; - -void main() -{ - gl_Position = vec4(1.0); -} diff --git a/tests/attribute-06.glsl b/tests/attribute-06.glsl deleted file mode 100644 index f18027b81a..0000000000 --- a/tests/attribute-06.glsl +++ /dev/null @@ -1,7 +0,0 @@ -/* FAIL - attribute cannot have type bvec2 */ -attribute bvec2 i; - -void main() -{ - gl_Position = vec4(1.0); -} diff --git a/tests/attribute-07.glsl b/tests/attribute-07.glsl deleted file mode 100644 index 0af13ba84b..0000000000 --- a/tests/attribute-07.glsl +++ /dev/null @@ -1,7 +0,0 @@ -/* FAIL - attribute cannot have type bvec3 */ -attribute bvec3 i; - -void main() -{ - gl_Position = vec4(1.0); -} diff --git a/tests/attribute-08.glsl b/tests/attribute-08.glsl deleted file mode 100644 index b069c04d1b..0000000000 --- a/tests/attribute-08.glsl +++ /dev/null @@ -1,7 +0,0 @@ -/* FAIL - attribute cannot have type bvec4 */ -attribute bvec4 i; - -void main() -{ - gl_Position = vec4(1.0); -} diff --git a/tests/attribute-09.glsl b/tests/attribute-09.glsl deleted file mode 100644 index 6a607244b9..0000000000 --- a/tests/attribute-09.glsl +++ /dev/null @@ -1,7 +0,0 @@ -/* FAIL - attribute cannot have array type in GLSL 1.10 */ -attribute vec4 i[10]; - -void main() -{ - gl_Position = vec4(1.0); -} diff --git a/tests/attribute-10.glsl b/tests/attribute-10.glsl deleted file mode 100644 index 6f5ef63a01..0000000000 --- a/tests/attribute-10.glsl +++ /dev/null @@ -1,8 +0,0 @@ -#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/tests/attribute-11.glsl b/tests/attribute-11.glsl deleted file mode 100644 index 47cb5a0583..0000000000 --- a/tests/attribute-11.glsl +++ /dev/null @@ -1,8 +0,0 @@ -#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/tests/condition-01.glsl b/tests/condition-01.glsl deleted file mode 100644 index d89c313117..0000000000 --- a/tests/condition-01.glsl +++ /dev/null @@ -1,8 +0,0 @@ -/* 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/tests/condition-02.glsl b/tests/condition-02.glsl deleted file mode 100644 index cbd0e18d9a..0000000000 --- a/tests/condition-02.glsl +++ /dev/null @@ -1,8 +0,0 @@ -/* 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/tests/condition-03.glsl b/tests/condition-03.glsl deleted file mode 100644 index 9af5d7aa47..0000000000 --- a/tests/condition-03.glsl +++ /dev/null @@ -1,8 +0,0 @@ -/* 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/tests/condition-04.glsl b/tests/condition-04.glsl deleted file mode 100644 index f440b7e995..0000000000 --- a/tests/condition-04.glsl +++ /dev/null @@ -1,8 +0,0 @@ -/* 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/tests/condition-05.glsl b/tests/condition-05.glsl deleted file mode 100644 index 3dff18f519..0000000000 --- a/tests/condition-05.glsl +++ /dev/null @@ -1,13 +0,0 @@ -#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/tests/constructor-01.glsl b/tests/constructor-01.glsl deleted file mode 100644 index fdfaf89866..0000000000 --- a/tests/constructor-01.glsl +++ /dev/null @@ -1,6 +0,0 @@ -/* PASS */ - -void main() -{ - gl_Position = vec4(1.0, 1.0, 1.0, 0.0);; -} diff --git a/tests/constructor-02.glsl b/tests/constructor-02.glsl deleted file mode 100644 index 47acbe9db1..0000000000 --- a/tests/constructor-02.glsl +++ /dev/null @@ -1,7 +0,0 @@ -/* FAIL - cannot construct samplers */ -void main() -{ - int i; - - i = sampler2D(0); -} diff --git a/tests/constructor-03.glsl b/tests/constructor-03.glsl deleted file mode 100644 index 07ec225633..0000000000 --- a/tests/constructor-03.glsl +++ /dev/null @@ -1,12 +0,0 @@ -/* 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/tests/constructor-04.glsl b/tests/constructor-04.glsl deleted file mode 100644 index 19d5e011de..0000000000 --- a/tests/constructor-04.glsl +++ /dev/null @@ -1,14 +0,0 @@ -#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/tests/constructor-05.glsl b/tests/constructor-05.glsl deleted file mode 100644 index 9c74f75a40..0000000000 --- a/tests/constructor-05.glsl +++ /dev/null @@ -1,13 +0,0 @@ -/* 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/tests/constructor-06.glsl b/tests/constructor-06.glsl deleted file mode 100644 index d77a5f9e89..0000000000 --- a/tests/constructor-06.glsl +++ /dev/null @@ -1,13 +0,0 @@ -#version 120 -/* PASS */ - -uniform mat2 a; - -void main() -{ - mat2 b; - - b = mat2(a); - - gl_Position = gl_Vertex; -} diff --git a/tests/constructor-07.glsl b/tests/constructor-07.glsl deleted file mode 100644 index 92322506ed..0000000000 --- a/tests/constructor-07.glsl +++ /dev/null @@ -1,13 +0,0 @@ -/* PASS */ - -uniform ivec2 a; -uniform ivec2 b; - -void main() -{ - mat2 c; - - c = mat2(a, b); - - gl_Position = gl_Vertex; -} diff --git a/tests/constructor-08.glsl b/tests/constructor-08.glsl deleted file mode 100644 index 27153f0cda..0000000000 --- a/tests/constructor-08.glsl +++ /dev/null @@ -1,13 +0,0 @@ -/* PASS */ - -uniform float a; -uniform float b; - -void main() -{ - ivec2 c; - - c = ivec2(a, b); - - gl_Position = gl_Vertex; -} diff --git a/tests/constructor-09.glsl b/tests/constructor-09.glsl deleted file mode 100644 index 1985699b30..0000000000 --- a/tests/constructor-09.glsl +++ /dev/null @@ -1,26 +0,0 @@ -/* 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/tests/function-01.glsl b/tests/function-01.glsl deleted file mode 100644 index 0eaa2397ab..0000000000 --- a/tests/function-01.glsl +++ /dev/null @@ -1,16 +0,0 @@ -/* 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/tests/function-02.glsl b/tests/function-02.glsl deleted file mode 100644 index 941fcc1ef7..0000000000 --- a/tests/function-02.glsl +++ /dev/null @@ -1,16 +0,0 @@ -/* 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/tests/function-03.glsl b/tests/function-03.glsl deleted file mode 100644 index b0da42f8e9..0000000000 --- a/tests/function-03.glsl +++ /dev/null @@ -1,16 +0,0 @@ -/* 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/tests/function-04.glsl b/tests/function-04.glsl deleted file mode 100644 index dfc0d2b7a6..0000000000 --- a/tests/function-04.glsl +++ /dev/null @@ -1,15 +0,0 @@ -/* 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/tests/function-05.glsl b/tests/function-05.glsl deleted file mode 100644 index 43365bf606..0000000000 --- a/tests/function-05.glsl +++ /dev/null @@ -1,26 +0,0 @@ -/* 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/tests/if-01.glsl b/tests/if-01.glsl deleted file mode 100644 index ca9abd54f7..0000000000 --- a/tests/if-01.glsl +++ /dev/null @@ -1,11 +0,0 @@ -/* 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/tests/if-02.glsl b/tests/if-02.glsl deleted file mode 100644 index 7adccea043..0000000000 --- a/tests/if-02.glsl +++ /dev/null @@ -1,11 +0,0 @@ -/* 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/tests/if-03.glsl b/tests/if-03.glsl deleted file mode 100644 index 179618c716..0000000000 --- a/tests/if-03.glsl +++ /dev/null @@ -1,11 +0,0 @@ -/* 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/tests/if-04.glsl b/tests/if-04.glsl deleted file mode 100644 index 7b711fb7ed..0000000000 --- a/tests/if-04.glsl +++ /dev/null @@ -1,11 +0,0 @@ -/* 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/tests/matrix-01.glsl b/tests/matrix-01.glsl deleted file mode 100644 index f46416c8f6..0000000000 --- a/tests/matrix-01.glsl +++ /dev/null @@ -1,6 +0,0 @@ -/* FAIL - non-square matrices are not available in GLSL 1.10 */ - -void main() -{ - mat2x3 m; -} diff --git a/tests/matrix-02.glsl b/tests/matrix-02.glsl deleted file mode 100644 index 0630722b79..0000000000 --- a/tests/matrix-02.glsl +++ /dev/null @@ -1,6 +0,0 @@ -/* FAIL - non-square matrices are not available in GLSL 1.10 */ - -void main() -{ - mat2x4 m; -} diff --git a/tests/matrix-03.glsl b/tests/matrix-03.glsl deleted file mode 100644 index 925dc80625..0000000000 --- a/tests/matrix-03.glsl +++ /dev/null @@ -1,6 +0,0 @@ -/* FAIL - non-square matrices are not available in GLSL 1.10 */ - -void main() -{ - mat3x2 m; -} diff --git a/tests/matrix-04.glsl b/tests/matrix-04.glsl deleted file mode 100644 index 5275619b31..0000000000 --- a/tests/matrix-04.glsl +++ /dev/null @@ -1,6 +0,0 @@ -/* FAIL - non-square matrices are not available in GLSL 1.10 */ - -void main() -{ - mat3x4 m; -} diff --git a/tests/matrix-05.glsl b/tests/matrix-05.glsl deleted file mode 100644 index 74e1fd2514..0000000000 --- a/tests/matrix-05.glsl +++ /dev/null @@ -1,6 +0,0 @@ -/* FAIL - non-square matrices are not available in GLSL 1.10 */ - -void main() -{ - mat4x2 m; -} diff --git a/tests/matrix-06.glsl b/tests/matrix-06.glsl deleted file mode 100644 index 0a512b8523..0000000000 --- a/tests/matrix-06.glsl +++ /dev/null @@ -1,6 +0,0 @@ -/* FAIL - non-square matrices are not available in GLSL 1.10 */ - -void main() -{ - mat4x3 m; -} diff --git a/tests/matrix-07.glsl b/tests/matrix-07.glsl deleted file mode 100644 index 0b59aa69d5..0000000000 --- a/tests/matrix-07.glsl +++ /dev/null @@ -1,27 +0,0 @@ -/* 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/tests/matrix-08.glsl b/tests/matrix-08.glsl deleted file mode 100644 index 38138d22de..0000000000 --- a/tests/matrix-08.glsl +++ /dev/null @@ -1,19 +0,0 @@ -#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/tests/matrix-09.glsl b/tests/matrix-09.glsl deleted file mode 100644 index 18afbcacea..0000000000 --- a/tests/matrix-09.glsl +++ /dev/null @@ -1,11 +0,0 @@ -/* 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/tests/matrix-10.glsl b/tests/matrix-10.glsl deleted file mode 100644 index 20b55180cb..0000000000 --- a/tests/matrix-10.glsl +++ /dev/null @@ -1,12 +0,0 @@ -#version 120 -/* PASS */ - -uniform mat3 a; - -void main() -{ - mat2 m; - - m = mat2(a); - gl_Position = gl_Vertex; -} diff --git a/tests/parameters-01.glsl b/tests/parameters-01.glsl deleted file mode 100644 index b485106e9d..0000000000 --- a/tests/parameters-01.glsl +++ /dev/null @@ -1,11 +0,0 @@ -/* FAIL: redefinition of a() */ - -void a() -{ - ; -} - -void a() -{ - ; -} diff --git a/tests/parameters-02.glsl b/tests/parameters-02.glsl deleted file mode 100644 index 7ff5f59ab7..0000000000 --- a/tests/parameters-02.glsl +++ /dev/null @@ -1,11 +0,0 @@ -/* PASS */ - -void a() -{ - ; -} - -void a(float x) -{ - ; -} diff --git a/tests/parameters-03.glsl b/tests/parameters-03.glsl deleted file mode 100644 index 7ec30f80cc..0000000000 --- a/tests/parameters-03.glsl +++ /dev/null @@ -1,9 +0,0 @@ -/* 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/tests/qualifier-01.glsl b/tests/qualifier-01.glsl deleted file mode 100644 index 54ec3572a2..0000000000 --- a/tests/qualifier-01.glsl +++ /dev/null @@ -1,3 +0,0 @@ -#version 130 -/* FAIL - inout only allowed in parameter list */ -inout vec4 foo; diff --git a/tests/qualifier-02.glsl b/tests/qualifier-02.glsl deleted file mode 100644 index b635d52aa2..0000000000 --- a/tests/qualifier-02.glsl +++ /dev/null @@ -1,2 +0,0 @@ -/* FAIL - in only allowed in parameter list in GLSL 1.10 */ -in foo; diff --git a/tests/qualifier-03.glsl b/tests/qualifier-03.glsl deleted file mode 100644 index 7e448034a7..0000000000 --- a/tests/qualifier-03.glsl +++ /dev/null @@ -1,2 +0,0 @@ -/* FAIL - out only allowed in parameter list in GLSL 1.10 */ -out vec4 foo; diff --git a/tests/qualifier-04.glsl b/tests/qualifier-04.glsl deleted file mode 100644 index d03cafc1db..0000000000 --- a/tests/qualifier-04.glsl +++ /dev/null @@ -1,3 +0,0 @@ -#version 130 -/* PASS */ -in vec4 foo; diff --git a/tests/qualifier-05.glsl b/tests/qualifier-05.glsl deleted file mode 100644 index 15281f3384..0000000000 --- a/tests/qualifier-05.glsl +++ /dev/null @@ -1,3 +0,0 @@ -#version 130 -/* PASS */ -out vec4 foo; diff --git a/tests/qualifier-06.glsl b/tests/qualifier-06.glsl deleted file mode 100644 index 1907a087c8..0000000000 --- a/tests/qualifier-06.glsl +++ /dev/null @@ -1,7 +0,0 @@ -/* FAIL - in only allowed in parameter list in GLSL 1.10 */ -void main() -{ - in vec4 foo; - - gl_Position = gl_Vertex; -} diff --git a/tests/qualifier-07.glsl b/tests/qualifier-07.glsl deleted file mode 100644 index 12568a57db..0000000000 --- a/tests/qualifier-07.glsl +++ /dev/null @@ -1,7 +0,0 @@ -/* FAIL - out only allowed in parameter list in GLSL 1.10 */ -void main() -{ - out vec4 foo; - - gl_Position = gl_Vertex; -} diff --git a/tests/swiz-01.glsl b/tests/swiz-01.glsl deleted file mode 100644 index 3268fa178c..0000000000 --- a/tests/swiz-01.glsl +++ /dev/null @@ -1,11 +0,0 @@ -/* PASS */ -#version 120 - -void main() -{ - float a; - vec4 b; - - b.x = 6.0; - a = b.x; -} diff --git a/tests/swiz-02.glsl b/tests/swiz-02.glsl deleted file mode 100644 index e3f043c47b..0000000000 --- a/tests/swiz-02.glsl +++ /dev/null @@ -1,11 +0,0 @@ -/* 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/tests/void-01.glsl b/tests/void-01.glsl deleted file mode 100644 index 5719edc0b6..0000000000 --- a/tests/void-01.glsl +++ /dev/null @@ -1,2 +0,0 @@ -/* 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') 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') 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') 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') 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') 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') 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') 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') 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') 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 ffc845a50a69b48446f5e25e7b4485089231bbe7 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Fri, 25 Jun 2010 12:52:01 -0700 Subject: glsl2: Set InputsRead and OutputsWritten on the generated programs. --- src/mesa/shader/ir_to_mesa.cpp | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) (limited to 'src') diff --git a/src/mesa/shader/ir_to_mesa.cpp b/src/mesa/shader/ir_to_mesa.cpp index 02d3f7e2ee..465d5529f8 100644 --- a/src/mesa/shader/ir_to_mesa.cpp +++ b/src/mesa/shader/ir_to_mesa.cpp @@ -1172,6 +1172,43 @@ print_program(struct prog_instruction *mesa_instructions, } } +static void +count_resources(struct gl_program *prog) +{ + prog->InputsRead = 0; + prog->OutputsWritten = 0; + unsigned int i; + + for (i = 0; i < prog->NumInstructions; i++) { + struct prog_instruction *inst = &prog->Instructions[i]; + unsigned int reg; + + switch (inst->DstReg.File) { + case PROGRAM_OUTPUT: + prog->OutputsWritten |= BITFIELD64_BIT(inst->DstReg.Index); + break; + case PROGRAM_INPUT: + prog->InputsRead |= BITFIELD64_BIT(inst->DstReg.Index); + break; + default: + break; + } + + for (reg = 0; reg < _mesa_num_inst_src_regs(inst->Opcode); reg++) { + switch (inst->SrcReg[reg].File) { + case PROGRAM_OUTPUT: + prog->OutputsWritten |= BITFIELD64_BIT(inst->DstReg.Index); + break; + case PROGRAM_INPUT: + prog->InputsRead |= BITFIELD64_BIT(inst->DstReg.Index); + break; + default: + break; + } + } + } +} + struct gl_program * get_mesa_program(GLcontext *ctx, void *mem_ctx, struct glsl_shader *shader) { @@ -1372,6 +1409,7 @@ _mesa_glsl_link_shader(GLcontext *ctx, struct gl_shader_program *prog) linked_prog = get_mesa_program(ctx, whole_program, whole_program->Shaders[i]); + count_resources(linked_prog); switch (whole_program->Shaders[i]->Type) { case GL_VERTEX_SHADER: -- cgit v1.2.3 From 582b73fe691ef7ea12a002cb2ae57505c3b1c21e Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Fri, 25 Jun 2010 12:59:10 -0700 Subject: glsl2: Hook up constant parameters in ir_to_mesa. --- src/mesa/shader/ir_to_mesa.cpp | 36 ++++++++++++++++-------------------- 1 file changed, 16 insertions(+), 20 deletions(-) (limited to 'src') diff --git a/src/mesa/shader/ir_to_mesa.cpp b/src/mesa/shader/ir_to_mesa.cpp index 465d5529f8..accd151576 100644 --- a/src/mesa/shader/ir_to_mesa.cpp +++ b/src/mesa/shader/ir_to_mesa.cpp @@ -56,7 +56,7 @@ extern "C" { 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. */ + GLuint 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; @@ -319,14 +319,14 @@ ir_to_mesa_visitor::ir_to_mesa_emit_scalar_op1(ir_instruction *ir, * dst channels. */ for (i = 0; i < 4; i++) { - int this_mask = (1 << i); + GLuint 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); + GLuint 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); @@ -348,15 +348,9 @@ 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.index = _mesa_add_unnamed_constant(this->prog->Parameters, + &val, 1, &src_reg.swizzle); src_reg.swizzle = SWIZZLE_NOOP; return src_reg; @@ -985,15 +979,17 @@ ir_to_mesa_visitor::visit(ir_constant *ir) 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; + if (ir->type->base_type == GLSL_TYPE_FLOAT && + !ir->type->is_matrix() && !ir->type->is_array()) { + src_reg.file = PROGRAM_CONSTANT; + src_reg.index = + _mesa_add_unnamed_constant(this->prog->Parameters, + &ir->value.f[0], ir->type->vector_elements, + &src_reg.swizzle); + src_reg.swizzle = SWIZZLE_NOOP; + } else { + assert(!"FINISHME: non-float constants"); + } src_reg.reladdr = false; src_reg.negate = 0; -- cgit v1.2.3 From abc4e52992c53ee6b6895480b47e6a6e27ef9bd0 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Fri, 25 Jun 2010 13:00:38 -0700 Subject: glsl2: Emit OPCODE_END at the end of the Mesa program. The 965 driver can now run a glsl2-generated shader! --- src/mesa/shader/ir_to_mesa.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/mesa/shader/ir_to_mesa.cpp b/src/mesa/shader/ir_to_mesa.cpp index accd151576..f58af0f65f 100644 --- a/src/mesa/shader/ir_to_mesa.cpp +++ b/src/mesa/shader/ir_to_mesa.cpp @@ -1233,6 +1233,8 @@ get_mesa_program(GLcontext *ctx, void *mem_ctx, struct glsl_shader *shader) v.mem_ctx = talloc_new(NULL); visit_exec_list(instructions, &v); + v.ir_to_mesa_emit_op1(NULL, OPCODE_END, + ir_to_mesa_undef_dst, ir_to_mesa_undef); prog->NumTemporaries = v.next_temp; -- 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') 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') 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 85c978f38c819003b6447e8e4feb8b90bb352eea Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Fri, 25 Jun 2010 14:35:48 -0700 Subject: glsl2: Start trying to hook up uniforms. This should be resolved with linker.cpp's location assignment, as currently we drop that location assignment on the ground. However, this gets basic programs using uniforms working for now. --- src/mesa/shader/ir_to_mesa.cpp | 52 +++++++++++++++++++++++++++++++++--------- 1 file changed, 41 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/mesa/shader/ir_to_mesa.cpp b/src/mesa/shader/ir_to_mesa.cpp index 0425e7d91e..a46286e82b 100644 --- a/src/mesa/shader/ir_to_mesa.cpp +++ b/src/mesa/shader/ir_to_mesa.cpp @@ -99,8 +99,6 @@ public: struct gl_program *prog; int next_temp; - int next_constant; - int next_uniform; temp_entry *find_variable_storage(ir_variable *var); @@ -768,17 +766,27 @@ 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; + unsigned int i, loc; bool var_in; if (!entry) { switch (ir->var->mode) { case ir_var_uniform: - entry = new(mem_ctx) temp_entry(ir->var, PROGRAM_UNIFORM, - this->next_uniform); - this->variable_storage.push_tail(entry); + /* FINISHME: Fix up uniform name for arrays and things */ + assert(ir->var->type->gl_type != 0 && + ir->var->type->gl_type != GL_INVALID_ENUM); + loc = _mesa_add_uniform(this->prog->Parameters, + ir->var->name, + 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. + */ + this->prog->Parameters->Parameters[loc].Used = GL_TRUE; - this->next_uniform += type_size(ir->var->type); + entry = new(mem_ctx) temp_entry(ir->var, PROGRAM_UNIFORM, loc); + this->variable_storage.push_tail(entry); break; case ir_var_in: case ir_var_out: @@ -993,8 +1001,6 @@ ir_to_mesa_visitor::visit(ir_constant *ir) src_reg.reladdr = false; src_reg.negate = 0; - this->next_constant += type_size(ir->type); - this->result = src_reg; } @@ -1055,8 +1061,6 @@ 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 @@ -1205,6 +1209,29 @@ count_resources(struct gl_program *prog) } } +/* Each stage has some uniforms in its Parameters list. The Uniforms + * list for the linked shader program has a pointer to these uniforms + * in each of the stage's Parameters list, so that their values can be + * updated when a uniform is set. + */ +static void +link_uniforms_to_shared_uniform_list(struct gl_uniform_list *uniforms, + struct gl_program *prog) +{ + unsigned int i; + + for (i = 0; i < prog->Parameters->NumParameters; i++) { + const struct gl_program_parameter *p = prog->Parameters->Parameters + i; + + if (p->Type == PROGRAM_UNIFORM || p->Type == PROGRAM_SAMPLER) { + struct gl_uniform *uniform = + _mesa_append_uniform(uniforms, p->Name, prog->Target, i); + if (uniform) + uniform->Initialized = p->Initialized; + } + } +} + struct gl_program * get_mesa_program(GLcontext *ctx, void *mem_ctx, struct glsl_shader *shader) { @@ -1409,6 +1436,8 @@ _mesa_glsl_link_shader(GLcontext *ctx, struct gl_shader_program *prog) whole_program->Shaders[i]); count_resources(linked_prog); + link_uniforms_to_shared_uniform_list(prog->Uniforms, linked_prog); + switch (whole_program->Shaders[i]->Type) { case GL_VERTEX_SHADER: _mesa_reference_vertprog(ctx, &prog->VertexProgram, @@ -1421,6 +1450,7 @@ _mesa_glsl_link_shader(GLcontext *ctx, struct gl_shader_program *prog) } } } + ctx->Shader.Flags |= GLSL_UNIFORMS; talloc_free(whole_program); } -- 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') 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 b2d7ed2aba916a995af9037c955930524977d310 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Fri, 25 Jun 2010 17:20:46 -0700 Subject: glsl2: Don't clear swizzles for Mesa IR constants after fetching them. Missed this while hacking in constants support. Fixes: glsl-algebraic-mul-* glsl-algebraic-rcp-* glsl-vs-swizzle-swizzle-lhs glsl-vs-vec4-indexing-6 --- src/mesa/shader/ir_to_mesa.cpp | 2 -- 1 file changed, 2 deletions(-) (limited to 'src') diff --git a/src/mesa/shader/ir_to_mesa.cpp b/src/mesa/shader/ir_to_mesa.cpp index a46286e82b..456f69cd36 100644 --- a/src/mesa/shader/ir_to_mesa.cpp +++ b/src/mesa/shader/ir_to_mesa.cpp @@ -349,7 +349,6 @@ ir_to_mesa_visitor::src_reg_for_float(float val) src_reg.file = PROGRAM_CONSTANT; src_reg.index = _mesa_add_unnamed_constant(this->prog->Parameters, &val, 1, &src_reg.swizzle); - src_reg.swizzle = SWIZZLE_NOOP; return src_reg; } @@ -994,7 +993,6 @@ ir_to_mesa_visitor::visit(ir_constant *ir) _mesa_add_unnamed_constant(this->prog->Parameters, &ir->value.f[0], ir->type->vector_elements, &src_reg.swizzle); - src_reg.swizzle = SWIZZLE_NOOP; } else { assert(!"FINISHME: non-float constants"); } -- cgit v1.2.3 From 6152fa16a16c876497ab1791212dc79b15e91c1a Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Fri, 25 Jun 2010 17:23:31 -0700 Subject: glsl2: Take out the spamming of debug flags I'd added. --- src/mesa/shader/ir_to_mesa.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'src') diff --git a/src/mesa/shader/ir_to_mesa.cpp b/src/mesa/shader/ir_to_mesa.cpp index 456f69cd36..f28f5fcbfc 100644 --- a/src/mesa/shader/ir_to_mesa.cpp +++ b/src/mesa/shader/ir_to_mesa.cpp @@ -1448,7 +1448,6 @@ _mesa_glsl_link_shader(GLcontext *ctx, struct gl_shader_program *prog) } } } - ctx->Shader.Flags |= GLSL_UNIFORMS; talloc_free(whole_program); } -- cgit v1.2.3 From 0bef5b97a9eccebc4b59dff42b2863770da770fe Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Fri, 25 Jun 2010 17:50:25 -0700 Subject: glsl2: Add support for non-float constants in Mesa IR. Fixes glsl-vs-vec4-indexing-4. --- src/mesa/shader/ir_to_mesa.cpp | 47 +++++++++++++++++++++++++++++------------- 1 file changed, 33 insertions(+), 14 deletions(-) (limited to 'src') diff --git a/src/mesa/shader/ir_to_mesa.cpp b/src/mesa/shader/ir_to_mesa.cpp index f28f5fcbfc..99ec55a0d8 100644 --- a/src/mesa/shader/ir_to_mesa.cpp +++ b/src/mesa/shader/ir_to_mesa.cpp @@ -980,22 +980,41 @@ void ir_to_mesa_visitor::visit(ir_constant *ir) { ir_to_mesa_src_reg src_reg; + GLfloat stack_vals[4]; + GLfloat *values = stack_vals; + unsigned int i; - 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); - - if (ir->type->base_type == GLSL_TYPE_FLOAT && - !ir->type->is_matrix() && !ir->type->is_array()) { - src_reg.file = PROGRAM_CONSTANT; - src_reg.index = - _mesa_add_unnamed_constant(this->prog->Parameters, - &ir->value.f[0], ir->type->vector_elements, - &src_reg.swizzle); - } else { - assert(!"FINISHME: non-float constants"); + if (ir->type->is_matrix() || ir->type->is_array()) { + assert(!"FINISHME: array/matrix constants"); } + + src_reg.file = PROGRAM_CONSTANT; + switch (ir->type->base_type) { + case GLSL_TYPE_FLOAT: + values = &ir->value.f[0]; + break; + case GLSL_TYPE_UINT: + for (i = 0; i < ir->type->vector_elements; i++) { + values[i] = ir->value.u[i]; + } + break; + case GLSL_TYPE_INT: + for (i = 0; i < ir->type->vector_elements; i++) { + values[i] = ir->value.i[i]; + } + break; + case GLSL_TYPE_BOOL: + for (i = 0; i < ir->type->vector_elements; i++) { + values[i] = ir->value.b[i]; + } + break; + default: + assert(!"Non-float/uint/int/bool constant"); + } + + src_reg.index = _mesa_add_unnamed_constant(this->prog->Parameters, + values, ir->type->vector_elements, + &src_reg.swizzle); src_reg.reladdr = false; src_reg.negate = 0; -- 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') 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') 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') 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') 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 81b7b79c472cbc15cb044656bd37b101a941f358 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Sun, 27 Jun 2010 20:43:09 -0700 Subject: ir_to_mesa: Fix copy and wasted InputsRead/OutputsWritten setup. --- src/mesa/shader/ir_to_mesa.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/mesa/shader/ir_to_mesa.cpp b/src/mesa/shader/ir_to_mesa.cpp index 99ec55a0d8..af5237f697 100644 --- a/src/mesa/shader/ir_to_mesa.cpp +++ b/src/mesa/shader/ir_to_mesa.cpp @@ -1214,10 +1214,10 @@ count_resources(struct gl_program *prog) for (reg = 0; reg < _mesa_num_inst_src_regs(inst->Opcode); reg++) { switch (inst->SrcReg[reg].File) { case PROGRAM_OUTPUT: - prog->OutputsWritten |= BITFIELD64_BIT(inst->DstReg.Index); + prog->OutputsWritten |= BITFIELD64_BIT(inst->SrcReg[reg].Index); break; case PROGRAM_INPUT: - prog->InputsRead |= BITFIELD64_BIT(inst->DstReg.Index); + prog->InputsRead |= BITFIELD64_BIT(inst->SrcReg[reg].Index); break; default: break; -- cgit v1.2.3 From bd3b835e7c32e093f91f636330fd93b3dedd8362 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Sun, 27 Jun 2010 20:36:41 -0700 Subject: glsl2: Add support for some builtin matrices. --- src/mesa/shader/ir_to_mesa.cpp | 86 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 86 insertions(+) (limited to 'src') diff --git a/src/mesa/shader/ir_to_mesa.cpp b/src/mesa/shader/ir_to_mesa.cpp index af5237f697..a0217bf8d9 100644 --- a/src/mesa/shader/ir_to_mesa.cpp +++ b/src/mesa/shader/ir_to_mesa.cpp @@ -1,4 +1,6 @@ /* + * Copyright (C) 2005-2007 Brian Paul All Rights Reserved. + * Copyright (C) 2008 VMware, Inc. All Rights Reserved. * Copyright © 2010 Intel Corporation * * Permission is hereby granted, free of charge, to any person obtaining a @@ -760,6 +762,86 @@ ir_to_mesa_visitor::visit(ir_swizzle *ir) this->result = src_reg; } +static temp_entry * +get_builtin_matrix_ref(void *mem_ctx, struct gl_program *prog, ir_variable *var) +{ + /* + * NOTE: The ARB_vertex_program extension specified that matrices get + * loaded in registers in row-major order. With GLSL, we want column- + * major order. So, we need to transpose all matrices here... + */ + static const struct { + const char *name; + int matrix; + int modifier; + } matrices[] = { + { "gl_ModelViewMatrix", STATE_MODELVIEW_MATRIX, STATE_MATRIX_TRANSPOSE }, + { "gl_ModelViewMatrixInverse", STATE_MODELVIEW_MATRIX, STATE_MATRIX_INVTRANS }, + { "gl_ModelViewMatrixTranspose", STATE_MODELVIEW_MATRIX, 0 }, + { "gl_ModelViewMatrixInverseTranspose", STATE_MODELVIEW_MATRIX, STATE_MATRIX_INVERSE }, + + { "gl_ProjectionMatrix", STATE_PROJECTION_MATRIX, STATE_MATRIX_TRANSPOSE }, + { "gl_ProjectionMatrixInverse", STATE_PROJECTION_MATRIX, STATE_MATRIX_INVTRANS }, + { "gl_ProjectionMatrixTranspose", STATE_PROJECTION_MATRIX, 0 }, + { "gl_ProjectionMatrixInverseTranspose", STATE_PROJECTION_MATRIX, STATE_MATRIX_INVERSE }, + + { "gl_ModelViewProjectionMatrix", STATE_MVP_MATRIX, STATE_MATRIX_TRANSPOSE }, + { "gl_ModelViewProjectionMatrixInverse", STATE_MVP_MATRIX, STATE_MATRIX_INVTRANS }, + { "gl_ModelViewProjectionMatrixTranspose", STATE_MVP_MATRIX, 0 }, + { "gl_ModelViewProjectionMatrixInverseTranspose", STATE_MVP_MATRIX, STATE_MATRIX_INVERSE }, + + { "gl_TextureMatrix", STATE_TEXTURE_MATRIX, STATE_MATRIX_TRANSPOSE }, + { "gl_TextureMatrixInverse", STATE_TEXTURE_MATRIX, STATE_MATRIX_INVTRANS }, + { "gl_TextureMatrixTranspose", STATE_TEXTURE_MATRIX, 0 }, + { "gl_TextureMatrixInverseTranspose", STATE_TEXTURE_MATRIX, STATE_MATRIX_INVERSE }, + + { "gl_NormalMatrix", STATE_MODELVIEW_MATRIX, STATE_MATRIX_INVERSE }, + + }; + unsigned int i; + temp_entry *entry; + + /* C++ gets angry when we try to use an int as a gl_state_index, so we use + * ints for gl_state_index. Make sure they're compatible. + */ + assert(sizeof(gl_state_index) == sizeof(int)); + + for (i = 0; i < Elements(matrices); i++) { + if (strcmp(var->name, matrices[i].name) == 0) { + int j; + int last_pos = -1, base_pos = -1; + int tokens[STATE_LENGTH]; + + tokens[0] = matrices[i].matrix; + tokens[1] = 0; /* array index! */ + tokens[4] = matrices[i].modifier; + + /* Add a ref for each column. It looks like the reason we do + * it this way is that _mesa_add_state_reference doesn't work + * for things that aren't vec4s, so the tokens[2]/tokens[3] + * range has to be equal. + */ + for (j = 0; j < 4; j++) { + tokens[2] = j; + tokens[3] = j; + int pos = _mesa_add_state_reference(prog->Parameters, + (gl_state_index *)tokens); + assert(last_pos == -1 || last_pos == base_pos + j); + if (base_pos == -1) + base_pos = pos; + } + + entry = new(mem_ctx) temp_entry(var, + PROGRAM_STATE_VAR, + base_pos); + + return entry; + } + } + + return NULL; +} + void ir_to_mesa_visitor::visit(ir_dereference_variable *ir) { @@ -771,6 +853,10 @@ ir_to_mesa_visitor::visit(ir_dereference_variable *ir) if (!entry) { switch (ir->var->mode) { case ir_var_uniform: + entry = get_builtin_matrix_ref(this->mem_ctx, this->prog, ir->var); + if (entry) + break; + /* FINISHME: Fix up uniform name for arrays and things */ assert(ir->var->type->gl_type != 0 && ir->var->type->gl_type != GL_INVALID_ENUM); -- cgit v1.2.3 From ad2dc740b95f91f66d57dffe2840dffdefce1c1a Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Sun, 27 Jun 2010 21:07:21 -0700 Subject: ir_to_mesa: Check the right element for matrix * scalar multiplication. --- src/mesa/shader/ir_to_mesa.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/shader/ir_to_mesa.cpp b/src/mesa/shader/ir_to_mesa.cpp index a0217bf8d9..8541906ca6 100644 --- a/src/mesa/shader/ir_to_mesa.cpp +++ b/src/mesa/shader/ir_to_mesa.cpp @@ -579,7 +579,7 @@ ir_to_mesa_visitor::visit(ir_expression *ir) case ir_binop_mul: if (ir->operands[0]->type->is_matrix() && !ir->operands[1]->type->is_matrix()) { - if (ir->operands[0]->type->is_scalar()) { + if (ir->operands[1]->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++) { -- cgit v1.2.3 From 3f3f41357d33893d01213b37c6d92bcb435b0eeb Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 28 Jun 2010 19:56:53 -0700 Subject: ir_to_mesa: Fix matrix * scalar multiplication. We're accessing in terms of columns, so we need to do MUL/MAD/MAD/MAD instead of DP4s. Fixes: glsl-fs-exp2 glsl-fs-log2 glsl-fs-mix-constant glsl-fs-sqrt-zero glsl-vs-sqrt-zero --- src/mesa/shader/ir_to_mesa.cpp | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/mesa/shader/ir_to_mesa.cpp b/src/mesa/shader/ir_to_mesa.cpp index 8541906ca6..b8113dab2b 100644 --- a/src/mesa/shader/ir_to_mesa.cpp +++ b/src/mesa/shader/ir_to_mesa.cpp @@ -589,15 +589,21 @@ ir_to_mesa_visitor::visit(ir_expression *ir) 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++; + assert(!ir->operands[1]->type->is_matrix() || + !"FINISHME: matrix * matrix"); + for (int i = 0; i < ir->operands[0]->type->matrix_columns; i++) { + src_chan.swizzle = MAKE_SWIZZLE4(i, i, i, i); + if (i == 0) { + ir_to_mesa_emit_op2(ir, OPCODE_MUL, + result_dst, src_column, src_chan); + } else { + ir_to_mesa_emit_op3(ir, OPCODE_MAD, + result_dst, src_column, src_chan, + result_src); + } + src_column.index++; } } } else { -- cgit v1.2.3 From 0a52e8b691cecfeec27717c3289763226d5f1bda Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 28 Jun 2010 11:44:30 -0700 Subject: ir_to_mesa: Traverse the "else" instrs after "else", instead of "then" again. --- src/mesa/shader/ir_to_mesa.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/shader/ir_to_mesa.cpp b/src/mesa/shader/ir_to_mesa.cpp index b8113dab2b..a825bf9e67 100644 --- a/src/mesa/shader/ir_to_mesa.cpp +++ b/src/mesa/shader/ir_to_mesa.cpp @@ -1159,7 +1159,7 @@ ir_to_mesa_visitor::visit(ir_if *ir) 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); + visit_exec_list(&ir->else_instructions, this); } if_inst = ir_to_mesa_emit_op1(ir->condition, OPCODE_ENDIF, -- cgit v1.2.3 From 854fd66cbb569cb3d4768196f4c680eff489733e Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 28 Jun 2010 11:59:13 -0700 Subject: ir_to_mesa: Respect EmitCondCodes for IF statements. Fixes glsl-vs-if-* for the 965 driver. --- src/mesa/shader/ir_to_mesa.cpp | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/mesa/shader/ir_to_mesa.cpp b/src/mesa/shader/ir_to_mesa.cpp index a825bf9e67..3141a53f5d 100644 --- a/src/mesa/shader/ir_to_mesa.cpp +++ b/src/mesa/shader/ir_to_mesa.cpp @@ -67,6 +67,7 @@ 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] */ + GLuint cond_mask:4; } ir_to_mesa_dst_reg; extern ir_to_mesa_src_reg ir_to_mesa_undef; @@ -78,6 +79,7 @@ public: ir_to_mesa_src_reg src_reg[3]; /** Pointer to the ir source this tree came from for debugging */ ir_instruction *ir; + GLboolean cond_update; }; class temp_entry : public exec_node { @@ -293,6 +295,7 @@ ir_to_mesa_dst_reg_from_src(ir_to_mesa_src_reg reg) dst_reg.file = reg.file; dst_reg.index = reg.index; dst_reg.writemask = WRITEMASK_XYZW; + dst_reg.cond_mask = COND_TR; return dst_reg; } @@ -1142,14 +1145,24 @@ ir_to_mesa_visitor::visit(ir_return *ir) void ir_to_mesa_visitor::visit(ir_if *ir) { - ir_to_mesa_instruction *if_inst, *else_inst = NULL; + ir_to_mesa_instruction *cond_inst, *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); + if (ctx->Shader.EmitCondCodes) { + cond_inst = (ir_to_mesa_instruction *)this->instructions.get_tail(); + cond_inst->cond_update = GL_TRUE; + + if_inst = ir_to_mesa_emit_op1(ir->condition, + OPCODE_IF, ir_to_mesa_undef_dst, + ir_to_mesa_undef); + if_inst->dst_reg.cond_mask = COND_NE; + } else { + if_inst = ir_to_mesa_emit_op1(ir->condition, + OPCODE_IF, ir_to_mesa_undef_dst, + this->result); + } this->instructions.push_tail(if_inst); @@ -1391,9 +1404,10 @@ get_mesa_program(GLcontext *ctx, void *mem_ctx, struct glsl_shader *shader) ir_to_mesa_instruction *inst = (ir_to_mesa_instruction *)iter.get(); mesa_inst->Opcode = inst->op; + mesa_inst->CondUpdate = inst->cond_update; 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.CondMask = inst->dst_reg.cond_mask; 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]); -- cgit v1.2.3 From cbe52c8012659abe5d81cf1180659820e704d290 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 28 Jun 2010 12:16:03 -0700 Subject: ir_to_mesa: Fix EmitCondCodes for boolean vars as condition. Fixes glsl-vs-if-bool. --- src/mesa/shader/ir_to_mesa.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src') diff --git a/src/mesa/shader/ir_to_mesa.cpp b/src/mesa/shader/ir_to_mesa.cpp index 3141a53f5d..85aedd6967 100644 --- a/src/mesa/shader/ir_to_mesa.cpp +++ b/src/mesa/shader/ir_to_mesa.cpp @@ -1146,12 +1146,26 @@ void ir_to_mesa_visitor::visit(ir_if *ir) { ir_to_mesa_instruction *cond_inst, *if_inst, *else_inst = NULL; + ir_to_mesa_instruction *prev_inst; + + prev_inst = (ir_to_mesa_instruction *)this->instructions.get_tail(); ir->condition->accept(this); assert(this->result.file != PROGRAM_UNDEFINED); if (ctx->Shader.EmitCondCodes) { cond_inst = (ir_to_mesa_instruction *)this->instructions.get_tail(); + + /* See if we actually generated any instruction for generating + * the condition. If not, then cook up a move to a temp so we + * have something to set cond_update on. + */ + if (cond_inst == prev_inst) { + ir_to_mesa_src_reg temp = get_temp(glsl_type::bool_type); + cond_inst = ir_to_mesa_emit_op1(ir->condition, OPCODE_MOV, + ir_to_mesa_dst_reg_from_src(temp), + result); + } cond_inst->cond_update = GL_TRUE; if_inst = ir_to_mesa_emit_op1(ir->condition, -- cgit v1.2.3 From 904b5bfe9986a297dc71fe081ce0f2661d43b00b Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 28 Jun 2010 12:26:19 -0700 Subject: ir_to_mesa: Add support for the pow expression. Fixes glsl-algebraic-pow-two. --- src/mesa/shader/ir_to_mesa.cpp | 48 ++++++++++++++++++++++++++++++++++-------- 1 file changed, 39 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/mesa/shader/ir_to_mesa.cpp b/src/mesa/shader/ir_to_mesa.cpp index 85aedd6967..30d05c39ef 100644 --- a/src/mesa/shader/ir_to_mesa.cpp +++ b/src/mesa/shader/ir_to_mesa.cpp @@ -167,6 +167,12 @@ public: ir_to_mesa_dst_reg dst, ir_to_mesa_src_reg src0); + void ir_to_mesa_emit_scalar_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); + void *mem_ctx; }; @@ -309,10 +315,11 @@ ir_to_mesa_dst_reg_from_src(ir_to_mesa_src_reg reg) * to produce dest channels. */ void -ir_to_mesa_visitor::ir_to_mesa_emit_scalar_op1(ir_instruction *ir, +ir_to_mesa_visitor::ir_to_mesa_emit_scalar_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 orig_src0, + ir_to_mesa_src_reg orig_src1) { int i, j; int done_mask = ~dst.writemask; @@ -324,28 +331,48 @@ ir_to_mesa_visitor::ir_to_mesa_emit_scalar_op1(ir_instruction *ir, for (i = 0; i < 4; i++) { GLuint this_mask = (1 << i); ir_to_mesa_instruction *inst; - ir_to_mesa_src_reg src = src0; + ir_to_mesa_src_reg src0 = orig_src0; + ir_to_mesa_src_reg src1 = orig_src1; if (done_mask & this_mask) continue; - GLuint src_swiz = GET_SWZ(src.swizzle, i); + GLuint src0_swiz = GET_SWZ(src0.swizzle, i); + GLuint src1_swiz = GET_SWZ(src1.swizzle, i); for (j = i + 1; j < 4; j++) { - if (!(done_mask & (1 << j)) && GET_SWZ(src.swizzle, j) == src_swiz) { + if (!(done_mask & (1 << j)) && + GET_SWZ(src0.swizzle, j) == src0_swiz && + GET_SWZ(src1.swizzle, j) == src1_swiz) { this_mask |= (1 << j); } } - src.swizzle = MAKE_SWIZZLE4(src_swiz, src_swiz, - src_swiz, src_swiz); + src0.swizzle = MAKE_SWIZZLE4(src0_swiz, src0_swiz, + src0_swiz, src0_swiz); + src1.swizzle = MAKE_SWIZZLE4(src1_swiz, src1_swiz, + src1_swiz, src1_swiz); - inst = ir_to_mesa_emit_op1(ir, op, + inst = ir_to_mesa_emit_op2(ir, op, dst, - src); + src0, + src1); inst->dst_reg.writemask = this_mask; done_mask |= this_mask; } } +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) +{ + ir_to_mesa_src_reg undef; + + undef.swizzle = SWIZZLE_XXXX; + + ir_to_mesa_emit_scalar_op2(ir, op, dst, src0, undef); +} + struct ir_to_mesa_src_reg ir_to_mesa_visitor::src_reg_for_float(float val) { @@ -711,6 +738,9 @@ ir_to_mesa_visitor::visit(ir_expression *ir) case ir_binop_max: ir_to_mesa_emit_op2(ir, OPCODE_MAX, result_dst, op[0], op[1]); break; + case ir_binop_pow: + ir_to_mesa_emit_scalar_op2(ir, OPCODE_POW, result_dst, op[0], op[1]); + break; default: ir_print_visitor v; printf("Failed to get tree for expression:\n"); -- cgit v1.2.3 From 7dc1e0b3267f0bf4dc0ef015b972f7fa6c4c317a Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 28 Jun 2010 12:35:54 -0700 Subject: ir_to_mesa: Notify the driver when we generate new Mesa programs for GLSL. Fixes glsl-fs-if-*. --- src/mesa/shader/ir_to_mesa.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src') diff --git a/src/mesa/shader/ir_to_mesa.cpp b/src/mesa/shader/ir_to_mesa.cpp index 30d05c39ef..90684ad555 100644 --- a/src/mesa/shader/ir_to_mesa.cpp +++ b/src/mesa/shader/ir_to_mesa.cpp @@ -1609,10 +1609,14 @@ _mesa_glsl_link_shader(GLcontext *ctx, struct gl_shader_program *prog) case GL_VERTEX_SHADER: _mesa_reference_vertprog(ctx, &prog->VertexProgram, (struct gl_vertex_program *)linked_prog); + ctx->Driver.ProgramStringNotify(ctx, GL_VERTEX_PROGRAM_ARB, + linked_prog); break; case GL_FRAGMENT_SHADER: _mesa_reference_fragprog(ctx, &prog->FragmentProgram, (struct gl_fragment_program *)linked_prog); + ctx->Driver.ProgramStringNotify(ctx, GL_FRAGMENT_PROGRAM_ARB, + linked_prog); break; } } -- cgit v1.2.3 From d5a5df45a4af93bb845483bdeeae7c8e042b03d8 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 28 Jun 2010 12:48:47 -0700 Subject: ir_to_mesa: Fix indexes of temps used in expressions. It looks like I managed to horribly mangle this in some rebase of the branch. Fixes: glsl-fs-fragcoord glsl-fs-mix --- src/mesa/shader/ir_to_mesa.cpp | 59 +++++++++++++++++++++--------------------- 1 file changed, 30 insertions(+), 29 deletions(-) (limited to 'src') diff --git a/src/mesa/shader/ir_to_mesa.cpp b/src/mesa/shader/ir_to_mesa.cpp index 90684ad555..9cf7839148 100644 --- a/src/mesa/shader/ir_to_mesa.cpp +++ b/src/mesa/shader/ir_to_mesa.cpp @@ -385,35 +385,6 @@ ir_to_mesa_visitor::src_reg_for_float(float val) 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) { @@ -448,6 +419,36 @@ type_size(const struct glsl_type *type) } } +/** + * 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 = next_temp; + src_reg.reladdr = false; + next_temp += type_size(type); + + 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; +} + temp_entry * ir_to_mesa_visitor::find_variable_storage(ir_variable *var) { -- cgit v1.2.3 From 8f62ad6d0ff3c11808739c74441f82f6f12485d6 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 28 Jun 2010 13:01:49 -0700 Subject: ir_to_mesa: Fix binop_sqrt for multi-channel and negative source channels. Fixes glsl-fs-sqrt-branch. --- src/mesa/shader/ir_to_mesa.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/shader/ir_to_mesa.cpp b/src/mesa/shader/ir_to_mesa.cpp index 9cf7839148..d371e35f9c 100644 --- a/src/mesa/shader/ir_to_mesa.cpp +++ b/src/mesa/shader/ir_to_mesa.cpp @@ -706,7 +706,10 @@ ir_to_mesa_visitor::visit(ir_expression *ir) 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); + ir_to_mesa_emit_scalar_op1(ir, OPCODE_RCP, result_dst, result_src); + /* For incoming channels < 0, set the result to 0. */ + ir_to_mesa_emit_op3(ir, OPCODE_CMP, result_dst, + op[0], src_reg_for_float(0.0), result_src); break; case ir_unop_rsq: ir_to_mesa_emit_scalar_op1(ir, OPCODE_RSQ, result_dst, op[0]); -- cgit v1.2.3 From ad8ad338f45c43fe9039d0069d3f3405ede756aa Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 28 Jun 2010 13:45:43 -0700 Subject: ir_to_mesa: Actually add the header file for the interface. --- src/mesa/shader/ir_to_mesa.h | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 src/mesa/shader/ir_to_mesa.h (limited to 'src') diff --git a/src/mesa/shader/ir_to_mesa.h b/src/mesa/shader/ir_to_mesa.h new file mode 100644 index 0000000000..e832f84e75 --- /dev/null +++ b/src/mesa/shader/ir_to_mesa.h @@ -0,0 +1,36 @@ +/* + * 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. + */ + +#ifdef __cplusplus +extern "C" { +#endif + +#include "main/config.h" +#include "main/mtypes.h" + +void _mesa_glsl_compile_shader(GLcontext *ctx, struct gl_shader *sh); +void _mesa_glsl_link_shader(GLcontext *ctx, struct gl_shader_program *prog); + +#ifdef __cplusplus +} +#endif -- cgit v1.2.3 From f9ffccb06bcc90c862f20f8849b824022fbeebbf Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 28 Jun 2010 14:47:43 -0700 Subject: ir_to_mesa: Support user-defined varyings using the linker's locations. Fixes glsl-reload-source. --- src/mesa/shader/ir_to_mesa.cpp | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/mesa/shader/ir_to_mesa.cpp b/src/mesa/shader/ir_to_mesa.cpp index d371e35f9c..0f035b9e0e 100644 --- a/src/mesa/shader/ir_to_mesa.cpp +++ b/src/mesa/shader/ir_to_mesa.cpp @@ -929,15 +929,29 @@ ir_to_mesa_visitor::visit(ir_dereference_variable *ir) !(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(); + if (i != ARRAY_SIZE(builtin_var_to_mesa_reg)) { + entry = new(mem_ctx) temp_entry(ir->var, + builtin_var_to_mesa_reg[i].file, + builtin_var_to_mesa_reg[i].index); + break; } - entry = new(mem_ctx) temp_entry(ir->var, - builtin_var_to_mesa_reg[i].file, - builtin_var_to_mesa_reg[i].index); + + /* If no builtin, then it's a user-generated varying + * (FINISHME: or a function argument!) + */ + /* The linker-assigned location is VERT_RESULT_* or FRAG_ATTRIB* + */ + assert(ir->var->location != -1); + if (var_in) { + entry = new(mem_ctx) temp_entry(ir->var, + PROGRAM_INPUT, + ir->var->location); + } else { + entry = new(mem_ctx) temp_entry(ir->var, + PROGRAM_OUTPUT, + ir->var->location); + } + break; case ir_var_auto: entry = new(mem_ctx) temp_entry(ir->var, PROGRAM_TEMPORARY, -- cgit v1.2.3 From 59a23d7fb93603b2449db4c5d786934a07aebfcb Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 28 Jun 2010 15:02:51 -0700 Subject: ir_to_mesa: Actually initialize the undef register for scalar_op1. Fixes glsl-sin, glsl-cos on 965, where we rely on unused src arguments in the VS having a file of PROGRAM_UNDEFINED. --- src/mesa/shader/ir_to_mesa.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/shader/ir_to_mesa.cpp b/src/mesa/shader/ir_to_mesa.cpp index 0f035b9e0e..24b03e1be1 100644 --- a/src/mesa/shader/ir_to_mesa.cpp +++ b/src/mesa/shader/ir_to_mesa.cpp @@ -366,7 +366,7 @@ ir_to_mesa_visitor::ir_to_mesa_emit_scalar_op1(ir_instruction *ir, ir_to_mesa_dst_reg dst, ir_to_mesa_src_reg src0) { - ir_to_mesa_src_reg undef; + ir_to_mesa_src_reg undef = ir_to_mesa_undef; undef.swizzle = SWIZZLE_XXXX; -- cgit v1.2.3 From 153eca98064252be4daad9cc27746f37c245b627 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Tue, 29 Jun 2010 10:02:36 -0700 Subject: glsl2: Invoke preprocessor before calling the compiler proper --- src/mesa/shader/ir_to_mesa.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/mesa/shader/ir_to_mesa.cpp b/src/mesa/shader/ir_to_mesa.cpp index 24b03e1be1..1232bada27 100644 --- a/src/mesa/shader/ir_to_mesa.cpp +++ b/src/mesa/shader/ir_to_mesa.cpp @@ -1526,9 +1526,17 @@ _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; - _mesa_glsl_lexer_ctor(state, shader->Source); - _mesa_glsl_parse(state); - _mesa_glsl_lexer_dtor(state); + /* 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); + } shader->ir.make_empty(); if (!state->error && !state->translation_unit.is_empty()) -- 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') 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') 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') 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') 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') 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') 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') 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') 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') 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') 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') 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') 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') 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') 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') 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') 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') 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') 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') 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') 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') 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') 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') 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 ba9bd708cb3480817e18cc47e57d83a4e4c305bb Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 29 Jun 2010 16:36:42 -0700 Subject: ir_to_mesa: Add support for dFdx, dFdy. --- src/mesa/shader/ir_to_mesa.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src') diff --git a/src/mesa/shader/ir_to_mesa.cpp b/src/mesa/shader/ir_to_mesa.cpp index f04518175d..152cb1d9e5 100644 --- a/src/mesa/shader/ir_to_mesa.cpp +++ b/src/mesa/shader/ir_to_mesa.cpp @@ -628,6 +628,14 @@ ir_to_mesa_visitor::visit(ir_expression *ir) case ir_unop_cos: ir_to_mesa_emit_scalar_op1(ir, OPCODE_COS, result_dst, op[0]); break; + + case ir_unop_dFdx: + ir_to_mesa_emit_op1(ir, OPCODE_DDX, result_dst, op[0]); + break; + case ir_unop_dFdy: + ir_to_mesa_emit_op1(ir, OPCODE_DDY, result_dst, op[0]); + break; + case ir_binop_add: ir_to_mesa_emit_op2(ir, OPCODE_ADD, result_dst, op[0], op[1]); break; -- cgit v1.2.3 From 524745bc55dd23c612aebdb545125727bfb16e4d Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 29 Jun 2010 16:39:38 -0700 Subject: ir_to_mesa: Add support for ir_unop_abs. --- src/mesa/shader/ir_to_mesa.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src') diff --git a/src/mesa/shader/ir_to_mesa.cpp b/src/mesa/shader/ir_to_mesa.cpp index 152cb1d9e5..85ede3e328 100644 --- a/src/mesa/shader/ir_to_mesa.cpp +++ b/src/mesa/shader/ir_to_mesa.cpp @@ -610,6 +610,10 @@ ir_to_mesa_visitor::visit(ir_expression *ir) op[0].negate = ~op[0].negate; result_src = op[0]; break; + case ir_unop_abs: + ir_to_mesa_emit_op1(ir, OPCODE_ABS, result_dst, op[0]); + break; + case ir_unop_exp: ir_to_mesa_emit_scalar_op1(ir, OPCODE_EXP, result_dst, op[0]); break; -- 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') 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') 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') 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') 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 edcb9c2b062693a5974aa74725f6259023fff794 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 29 Jun 2010 18:23:05 -0700 Subject: ir_to_mesa: Tell Mesa about our choices for vertex attribute locations. --- src/mesa/shader/ir_to_mesa.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src') diff --git a/src/mesa/shader/ir_to_mesa.cpp b/src/mesa/shader/ir_to_mesa.cpp index f0eb46a3ee..75021a70fd 100644 --- a/src/mesa/shader/ir_to_mesa.cpp +++ b/src/mesa/shader/ir_to_mesa.cpp @@ -1001,6 +1001,15 @@ ir_to_mesa_visitor::visit(ir_dereference_variable *ir) entry = new(mem_ctx) temp_entry(ir->var, PROGRAM_INPUT, ir->var->location); + + if (this->prog->Target == GL_VERTEX_PROGRAM_ARB && + ir->var->location >= VERT_ATTRIB_GENERIC0) { + _mesa_add_attribute(prog->Attributes, + ir->var->name, + type_size(ir->var->type) * 4, + ir->var->type->gl_type, + ir->var->location); + } } else { entry = new(mem_ctx) temp_entry(ir->var, PROGRAM_OUTPUT, -- 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') 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') 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') 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') 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') 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') 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 c64da87611823b4b53e93188f861f748a69936a3 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 30 Jun 2010 14:01:43 -0700 Subject: ir_to_mesa: Fix the indexing of attributes in the program's Attributes. This fixes GetAttribLocation returning VERT_ATTRIB_GENERIC1 instead of 1, caught by glsl-dlist-getattriblocation. --- src/mesa/shader/ir_to_mesa.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/shader/ir_to_mesa.cpp b/src/mesa/shader/ir_to_mesa.cpp index 4eac810679..c39621bf79 100644 --- a/src/mesa/shader/ir_to_mesa.cpp +++ b/src/mesa/shader/ir_to_mesa.cpp @@ -1008,7 +1008,7 @@ ir_to_mesa_visitor::visit(ir_dereference_variable *ir) ir->var->name, type_size(ir->var->type) * 4, ir->var->type->gl_type, - ir->var->location); + ir->var->location - VERT_ATTRIB_GENERIC0); } } else { entry = new(mem_ctx) temp_entry(ir->var, -- cgit v1.2.3 From 3e2127b9dea6fd0628c4d7cb9e338d83583d2729 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 30 Jun 2010 14:28:38 -0700 Subject: mesa: Don't look in unallocatd param slots for parameter values. glsl-derivs would add 40.0, 0.0, and 1.0 in order. When we went looking for 0.0, we'd find it in the second slot of the param, and use it, but param->Size would still be 1. When we went to add 1.0 and didn't find it, we'd put allocate it to that second slot and the 0.0 would actualy end up being 1.0. Fixes glsl-derivs, glsl-deriv-varyings. --- src/mesa/shader/prog_parameter.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/shader/prog_parameter.c b/src/mesa/shader/prog_parameter.c index aac488c79a..ddbfe95c15 100644 --- a/src/mesa/shader/prog_parameter.c +++ b/src/mesa/shader/prog_parameter.c @@ -591,7 +591,7 @@ _mesa_lookup_parameter_constant(const struct gl_program_parameter_list *list, if (vSize == 1) { /* look for v[0] anywhere within float[4] value */ GLuint j; - for (j = 0; j < 4; j++) { + for (j = 0; j < list->Parameters[i].Size; j++) { if (list->ParameterValues[i][j] == v[0]) { /* found it */ *posOut = i; -- 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') 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 88c20c46b8f708e89adef28f341c51ea7883b6a0 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 30 Jun 2010 14:55:45 -0700 Subject: ir_to_mesa: Support gl_FragDepth. Fixes glsl-bug-22603. --- src/mesa/shader/ir_to_mesa.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/shader/ir_to_mesa.cpp b/src/mesa/shader/ir_to_mesa.cpp index c39621bf79..ef9a96e2f5 100644 --- a/src/mesa/shader/ir_to_mesa.cpp +++ b/src/mesa/shader/ir_to_mesa.cpp @@ -222,7 +222,7 @@ static const struct { {"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 */ + {"gl_FragDepth", PROGRAM_OUTPUT, FRAG_RESULT_DEPTH}, /* 110_deprecated_fs */ {"gl_Color", PROGRAM_INPUT, FRAG_ATTRIB_COL0}, -- 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') 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') 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 698b84444343189357ad252856d3c5493e47e4fa Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 30 Jun 2010 15:26:41 -0700 Subject: ir_to_mesa: When generating a swizzle, respect the reg's current swizzle. Fixes depth-tex-modes-glsl. --- src/mesa/shader/ir_to_mesa.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/mesa/shader/ir_to_mesa.cpp b/src/mesa/shader/ir_to_mesa.cpp index 8c074a8bd9..61a1f306c8 100644 --- a/src/mesa/shader/ir_to_mesa.cpp +++ b/src/mesa/shader/ir_to_mesa.cpp @@ -817,23 +817,23 @@ ir_to_mesa_visitor::visit(ir_swizzle *ir) if (i < ir->type->vector_elements) { switch (i) { case 0: - swizzle[i] = ir->mask.x; + swizzle[i] = GET_SWZ(src_reg.swizzle, ir->mask.x); break; case 1: - swizzle[i] = ir->mask.y; + swizzle[i] = GET_SWZ(src_reg.swizzle, ir->mask.y); break; case 2: - swizzle[i] = ir->mask.z; + swizzle[i] = GET_SWZ(src_reg.swizzle, ir->mask.z); break; case 3: - swizzle[i] = ir->mask.w; + swizzle[i] = GET_SWZ(src_reg.swizzle, 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; + swizzle[i] = swizzle[ir->type->vector_elements - 1]; } } -- cgit v1.2.3 From ea6b34cce4471d6239201101a3b24db17eaae870 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 30 Jun 2010 15:44:01 -0700 Subject: ir_to_mesa: Send the negate field on to Mesa IR. Fixes glsl-fs-neg. --- src/mesa/shader/ir_to_mesa.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/mesa/shader/ir_to_mesa.cpp b/src/mesa/shader/ir_to_mesa.cpp index 61a1f306c8..8bfa4687a3 100644 --- a/src/mesa/shader/ir_to_mesa.cpp +++ b/src/mesa/shader/ir_to_mesa.cpp @@ -473,6 +473,7 @@ ir_to_mesa_visitor::get_temp(const glsl_type *type) swizzle[i] = type->vector_elements - 1; src_reg.swizzle = MAKE_SWIZZLE4(swizzle[0], swizzle[1], swizzle[2], swizzle[3]); + src_reg.negate = 0; return src_reg; } @@ -1399,6 +1400,7 @@ mesa_src_reg_from_ir_src_reg(ir_to_mesa_src_reg reg) mesa_reg.Index = reg.index; mesa_reg.Swizzle = reg.swizzle; mesa_reg.RelAddr = reg.reladdr; + mesa_reg.Negate = reg.negate; return mesa_reg; } -- cgit v1.2.3 From 285ff93819724b9a858984dc8c30858784a5ee5b Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 30 Jun 2010 15:49:04 -0700 Subject: ir_to_mesa: Initialize the (we never use it) abs field of Mesa src regs. --- src/mesa/shader/ir_to_mesa.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/mesa/shader/ir_to_mesa.cpp b/src/mesa/shader/ir_to_mesa.cpp index 8bfa4687a3..ed1373b6d9 100644 --- a/src/mesa/shader/ir_to_mesa.cpp +++ b/src/mesa/shader/ir_to_mesa.cpp @@ -1401,6 +1401,7 @@ mesa_src_reg_from_ir_src_reg(ir_to_mesa_src_reg reg) mesa_reg.Swizzle = reg.swizzle; mesa_reg.RelAddr = reg.reladdr; mesa_reg.Negate = reg.negate; + mesa_reg.Abs = 0; return mesa_reg; } -- 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') 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 e64a4aaacbc682f24180dff3627b84861844476d Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 30 Jun 2010 16:18:06 -0700 Subject: ir_to_mesa: Note which of our expr ops are unsupported 1.30 features. --- src/mesa/shader/ir_to_mesa.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src') diff --git a/src/mesa/shader/ir_to_mesa.cpp b/src/mesa/shader/ir_to_mesa.cpp index ed1373b6d9..6542441a8c 100644 --- a/src/mesa/shader/ir_to_mesa.cpp +++ b/src/mesa/shader/ir_to_mesa.cpp @@ -786,6 +786,17 @@ ir_to_mesa_visitor::visit(ir_expression *ir) case ir_binop_pow: ir_to_mesa_emit_scalar_op2(ir, OPCODE_POW, result_dst, op[0], op[1]); break; + + case ir_unop_bit_not: + case ir_unop_u2f: + case ir_binop_lshift: + case ir_binop_rshift: + case ir_binop_bit_and: + case ir_binop_bit_xor: + case ir_binop_bit_or: + assert(!"GLSL 1.30 features unsupported"); + break; + default: ir_print_visitor v; printf("Failed to get tree for expression:\n"); -- 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') 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 d6ebe9b16b25f25ba763baf3738addc50676d5d0 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 30 Jun 2010 16:23:32 -0700 Subject: ir_to_mesa: Add missing no-op type conversions. Fixes glsl-fs-step. --- src/mesa/shader/ir_to_mesa.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/mesa/shader/ir_to_mesa.cpp b/src/mesa/shader/ir_to_mesa.cpp index 6542441a8c..af9bdb5482 100644 --- a/src/mesa/shader/ir_to_mesa.cpp +++ b/src/mesa/shader/ir_to_mesa.cpp @@ -756,6 +756,8 @@ ir_to_mesa_visitor::visit(ir_expression *ir) ir_to_mesa_emit_scalar_op1(ir, OPCODE_RSQ, result_dst, op[0]); break; case ir_unop_i2f: + case ir_unop_b2f: + case ir_unop_b2i: /* Mesa IR lacks types, ints are stored as truncated floats. */ result_src = op[0]; break; -- cgit v1.2.3 From e558786a3ed52222c07f916e213b63dcba1890a2 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 30 Jun 2010 17:05:11 -0700 Subject: i965: Add support for OPCODE_SSG. The old compiler didn't use SSG, and instead emitted SGT/SGT/SUB. We can do a little better for SSG than we do for the SGT series. --- src/mesa/drivers/dri/i965/brw_vs_emit.c | 20 ++++++++++++++++++++ src/mesa/drivers/dri/i965/brw_wm.h | 4 ++++ src/mesa/drivers/dri/i965/brw_wm_emit.c | 26 ++++++++++++++++++++++++++ src/mesa/drivers/dri/i965/brw_wm_glsl.c | 3 +++ src/mesa/drivers/dri/i965/brw_wm_pass1.c | 1 + 5 files changed, 54 insertions(+) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_vs_emit.c b/src/mesa/drivers/dri/i965/brw_vs_emit.c index 0b44deeb63..128987d78a 100644 --- a/src/mesa/drivers/dri/i965/brw_vs_emit.c +++ b/src/mesa/drivers/dri/i965/brw_vs_emit.c @@ -485,6 +485,23 @@ static void emit_cmp( struct brw_compile *p, brw_set_predicate_control(p, BRW_PREDICATE_NONE); } +static void emit_sign(struct brw_vs_compile *c, + struct brw_reg dst, + struct brw_reg arg0) +{ + struct brw_compile *p = &c->func; + + brw_MOV(p, dst, brw_imm_f(0)); + + brw_CMP(p, brw_null_reg(), BRW_CONDITIONAL_L, arg0, brw_imm_f(0)); + brw_MOV(p, dst, brw_imm_f(-1.0)); + brw_set_predicate_control(p, BRW_PREDICATE_NONE); + + brw_CMP(p, brw_null_reg(), BRW_CONDITIONAL_G, arg0, brw_imm_f(0)); + brw_MOV(p, dst, brw_imm_f(1.0)); + brw_set_predicate_control(p, BRW_PREDICATE_NONE); +} + static void emit_max( struct brw_compile *p, struct brw_reg dst, struct brw_reg arg0, @@ -1719,6 +1736,9 @@ void brw_vs_emit(struct brw_vs_compile *c ) case OPCODE_SLE: unalias2(c, dst, args[0], args[1], emit_sle); break; + case OPCODE_SSG: + unalias1(c, dst, args[0], emit_sign); + break; case OPCODE_SUB: brw_ADD(p, dst, args[0], negate(args[1])); break; diff --git a/src/mesa/drivers/dri/i965/brw_wm.h b/src/mesa/drivers/dri/i965/brw_wm.h index 277b6de442..938557ff36 100644 --- a/src/mesa/drivers/dri/i965/brw_wm.h +++ b/src/mesa/drivers/dri/i965/brw_wm.h @@ -425,6 +425,10 @@ void emit_sop(struct brw_compile *p, GLuint cond, const struct brw_reg *arg0, const struct brw_reg *arg1); +void emit_sign(struct brw_compile *p, + const struct brw_reg *dst, + GLuint mask, + const struct brw_reg *arg0); void emit_tex(struct brw_wm_compile *c, struct brw_reg *dst, GLuint dst_flags, diff --git a/src/mesa/drivers/dri/i965/brw_wm_emit.c b/src/mesa/drivers/dri/i965/brw_wm_emit.c index 323cfac8fa..11f482bddf 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_emit.c +++ b/src/mesa/drivers/dri/i965/brw_wm_emit.c @@ -668,6 +668,28 @@ void emit_cmp(struct brw_compile *p, } } +void emit_sign(struct brw_compile *p, + const struct brw_reg *dst, + GLuint mask, + const struct brw_reg *arg0) +{ + GLuint i; + + for (i = 0; i < 4; i++) { + if (mask & (1< Date: Wed, 30 Jun 2010 17:06:06 -0700 Subject: ir_to_mesa: Add support for ir_unop_sign. Fixes glsl-fs-sign, glsl-vs-sign. --- src/mesa/shader/ir_to_mesa.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src') diff --git a/src/mesa/shader/ir_to_mesa.cpp b/src/mesa/shader/ir_to_mesa.cpp index af9bdb5482..b140d96851 100644 --- a/src/mesa/shader/ir_to_mesa.cpp +++ b/src/mesa/shader/ir_to_mesa.cpp @@ -615,6 +615,9 @@ ir_to_mesa_visitor::visit(ir_expression *ir) case ir_unop_abs: ir_to_mesa_emit_op1(ir, OPCODE_ABS, result_dst, op[0]); break; + case ir_unop_sign: + ir_to_mesa_emit_op1(ir, OPCODE_SSG, result_dst, op[0]); + break; case ir_unop_exp: ir_to_mesa_emit_scalar_op1(ir, OPCODE_EXP, result_dst, op[0]); -- 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') 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 5e4dd061d17563828bcce5525400a0ce363aa15d Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 30 Jun 2010 17:31:06 -0700 Subject: ir_to_mesa: Add support for discard instructions. Fixes glsl-fs-discard-01. --- src/mesa/shader/ir_to_mesa.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/mesa/shader/ir_to_mesa.cpp b/src/mesa/shader/ir_to_mesa.cpp index b140d96851..b270e2da41 100644 --- a/src/mesa/shader/ir_to_mesa.cpp +++ b/src/mesa/shader/ir_to_mesa.cpp @@ -1342,9 +1342,10 @@ ir_to_mesa_visitor::visit(ir_return *ir) void ir_to_mesa_visitor::visit(ir_discard *ir) { - assert(0); + assert(ir->condition == NULL); /* FINISHME */ - ir->condition->accept(this); + ir_to_mesa_emit_op1(ir, OPCODE_KIL_NV, + ir_to_mesa_undef_dst, ir_to_mesa_undef); } void -- 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') 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') 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') 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') 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 8761fcc2bf964d26c70229c712ce446dbe504ab7 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 1 Jul 2010 11:23:02 -0700 Subject: ir_to_mesa: Add support for ir_unop_rcp. This isn't used at the moment, but will be soon. --- src/mesa/shader/ir_to_mesa.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src') diff --git a/src/mesa/shader/ir_to_mesa.cpp b/src/mesa/shader/ir_to_mesa.cpp index 25267d79b5..dca2b10f23 100644 --- a/src/mesa/shader/ir_to_mesa.cpp +++ b/src/mesa/shader/ir_to_mesa.cpp @@ -618,6 +618,9 @@ ir_to_mesa_visitor::visit(ir_expression *ir) case ir_unop_sign: ir_to_mesa_emit_op1(ir, OPCODE_SSG, result_dst, op[0]); break; + case ir_unop_rcp: + ir_to_mesa_emit_scalar_op1(ir, OPCODE_RCP, result_dst, op[0]); + break; case ir_unop_exp: ir_to_mesa_emit_scalar_op1(ir, OPCODE_EXP, result_dst, op[0]); -- cgit v1.2.3 From 411fb36b7cee223e090b4b9ef9bc14e058201a68 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 1 Jul 2010 11:24:38 -0700 Subject: ir_to_mesa: Fill in remaining ops, remove default case for expression types. We should now have support for all the expression types we need for GLSL 1.20. --- src/mesa/shader/ir_to_mesa.cpp | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/mesa/shader/ir_to_mesa.cpp b/src/mesa/shader/ir_to_mesa.cpp index dca2b10f23..1e186354c5 100644 --- a/src/mesa/shader/ir_to_mesa.cpp +++ b/src/mesa/shader/ir_to_mesa.cpp @@ -694,6 +694,9 @@ ir_to_mesa_visitor::visit(ir_expression *ir) 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_mod: + assert(!"ir_binop_mod should have been converted to b * fract(a/b)"); + break; case ir_binop_less: ir_to_mesa_emit_op2(ir, OPCODE_SLT, result_dst, op[0], op[1]); @@ -771,6 +774,7 @@ ir_to_mesa_visitor::visit(ir_expression *ir) ir_to_mesa_emit_op1(ir, OPCODE_TRUNC, result_dst, op[0]); break; case ir_unop_f2b: + case ir_unop_i2b: ir_to_mesa_emit_op2(ir, OPCODE_SNE, result_dst, result_src, src_reg_for_float(0.0)); break; @@ -808,13 +812,6 @@ ir_to_mesa_visitor::visit(ir_expression *ir) case ir_binop_bit_or: assert(!"GLSL 1.30 features unsupported"); break; - - default: - ir_print_visitor v; - printf("Failed to get tree for expression:\n"); - ir->accept(&v); - exit(1); - break; } this->result = result_src; -- 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') 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') 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') 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') 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') 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') 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') 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') 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') 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') 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') 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 28faa12dc2413d93c7f4778327a5e7c4c8f57c85 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Fri, 2 Jul 2010 11:37:39 -0700 Subject: ir_to_mesa: Don't forget to run the Mesa IR optimization passes. With how we generate assignments, the trivial copy propagation in it is really important, and some drivers will really want the register allocation, too. --- src/mesa/shader/ir_to_mesa.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src') diff --git a/src/mesa/shader/ir_to_mesa.cpp b/src/mesa/shader/ir_to_mesa.cpp index d5664e7b91..11fb7b9f16 100644 --- a/src/mesa/shader/ir_to_mesa.cpp +++ b/src/mesa/shader/ir_to_mesa.cpp @@ -44,6 +44,7 @@ extern "C" { #include "main/mtypes.h" #include "shader/prog_instruction.h" +#include "shader/prog_optimize.h" #include "shader/prog_print.h" #include "shader/program.h" #include "shader/prog_uniform.h" @@ -1675,6 +1676,10 @@ get_mesa_program(GLcontext *ctx, void *mem_ctx, struct gl_shader *shader) _mesa_reference_program(ctx, &shader->Program, prog); + if ((ctx->Shader.Flags & GLSL_NO_OPT) == 0) { + _mesa_optimize_program(ctx, prog); + } + return prog; } -- cgit v1.2.3 From cab95c228b12f0fc568164d57475c561c8d6053e Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Fri, 2 Jul 2010 14:06:34 -0700 Subject: ir_to_mesa: Fix sparse swizzling of src regs when a writemask is present. Fixes glsl-fs-texture2d-masked. --- src/mesa/shader/ir_to_mesa.cpp | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'src') diff --git a/src/mesa/shader/ir_to_mesa.cpp b/src/mesa/shader/ir_to_mesa.cpp index 11fb7b9f16..59268e6d17 100644 --- a/src/mesa/shader/ir_to_mesa.cpp +++ b/src/mesa/shader/ir_to_mesa.cpp @@ -1175,6 +1175,29 @@ get_assignment_lhs(ir_instruction *ir, ir_to_mesa_visitor *v) return dst_reg; } +static GLuint +reswizzle_for_writemask(GLuint writemask, GLuint swizzle) +{ + int new_swizzle[4], pos = 0; + int i; + + /* reswizzle the rhs so the components are in place for the + * components we'll assign to the lhs. + */ + for (i = 0; i < 4; i++) { + if (writemask & (1 << i)) { + new_swizzle[i] = GET_SWZ(swizzle, pos++); + } else { + new_swizzle[i] = GET_SWZ(swizzle, 0); + } + } + + return MAKE_SWIZZLE4(new_swizzle[0], + new_swizzle[1], + new_swizzle[2], + new_swizzle[3]); +} + void ir_to_mesa_visitor::visit(ir_assignment *ir) { @@ -1189,6 +1212,9 @@ ir_to_mesa_visitor::visit(ir_assignment *ir) ir->rhs->accept(this); r = this->result; + + r.swizzle = reswizzle_for_writemask(l.writemask, r.swizzle); + assert(l.file != PROGRAM_UNDEFINED); assert(r.file != PROGRAM_UNDEFINED); -- cgit v1.2.3 From de75dfac4ea2cad64dc91f6ac16fe205b5015af6 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Fri, 2 Jul 2010 14:49:29 -0700 Subject: ir_to_mesa: Add support for projected non-shadow/bias/lod texturing. Fixes: glsl-fs-texture2dproj glsl-fs-texture2dproj-2 --- src/mesa/shader/ir_to_mesa.cpp | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/mesa/shader/ir_to_mesa.cpp b/src/mesa/shader/ir_to_mesa.cpp index 59268e6d17..96f3cd7e4d 100644 --- a/src/mesa/shader/ir_to_mesa.cpp +++ b/src/mesa/shader/ir_to_mesa.cpp @@ -1287,13 +1287,18 @@ ir_to_mesa_visitor::visit(ir_call *ir) void ir_to_mesa_visitor::visit(ir_texture *ir) { - ir_to_mesa_src_reg result_src, coord; + ir_to_mesa_src_reg result_src, coord, projector; ir_to_mesa_dst_reg result_dst, lod_info; ir_to_mesa_instruction *inst = NULL; ir->coordinate->accept(this); coord = this->result; + if (ir->projector) { + ir->projector->accept(this); + projector = this->result; + } + /* Storage for our result. Ideally for an assignment we'd be using * the actual storage for the result here, instead. */ @@ -1302,7 +1307,16 @@ ir_to_mesa_visitor::visit(ir_texture *ir) switch (ir->op) { case ir_tex: - inst = ir_to_mesa_emit_op1(ir, OPCODE_TEX, result_dst, coord); + if (ir->projector) { + /* Compute new coord as vec4(texcoord.xyz, projector) */ + ir_to_mesa_emit_op1(ir, OPCODE_MOV, result_dst, coord); + result_dst.writemask = WRITEMASK_W; + ir_to_mesa_emit_op1(ir, OPCODE_MOV, result_dst, projector); + result_dst.writemask = WRITEMASK_XYZW; + inst = ir_to_mesa_emit_op1(ir, OPCODE_TXP, result_dst, result_src); + } else { + 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. */ @@ -1312,6 +1326,7 @@ ir_to_mesa_visitor::visit(ir_texture *ir) ir_to_mesa_emit_op1(ir, OPCODE_MOV, lod_info, this->result); inst = ir_to_mesa_emit_op1(ir, OPCODE_TXB, result_dst, coord); + assert(!ir->projector); /* FINISHME */ break; case ir_txl: /* Mesa IR stores lod in the last channel of the coords. */ @@ -1321,6 +1336,7 @@ ir_to_mesa_visitor::visit(ir_texture *ir) ir_to_mesa_emit_op1(ir, OPCODE_MOV, lod_info, this->result); inst = ir_to_mesa_emit_op1(ir, OPCODE_TXL, result_dst, coord); + assert(!ir->projector); /* FINISHME */ break; case ir_txd: case ir_txf: @@ -1354,7 +1370,6 @@ ir_to_mesa_visitor::visit(ir_texture *ir) assert(!"FINISHME: other texture targets"); } - assert(!ir->projector); /* FINISHME */ assert(!ir->shadow_comparitor); /* FINISHME */ this->result = result_src; -- 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') 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 d3983ca03248092d92b5240fbc6a30c24f80d313 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Fri, 2 Jul 2010 15:37:24 -0700 Subject: ir_to_mesa: Move projection handling out of ir_tex so txb and txl get it. Fixes: glsl-fs-texture2dproj-bias glsl-fs-texture2dproj-bias-2 --- src/mesa/shader/ir_to_mesa.cpp | 80 ++++++++++++++++++++++++++++-------------- 1 file changed, 53 insertions(+), 27 deletions(-) (limited to 'src') diff --git a/src/mesa/shader/ir_to_mesa.cpp b/src/mesa/shader/ir_to_mesa.cpp index 96f3cd7e4d..53e5242b10 100644 --- a/src/mesa/shader/ir_to_mesa.cpp +++ b/src/mesa/shader/ir_to_mesa.cpp @@ -1287,12 +1287,22 @@ ir_to_mesa_visitor::visit(ir_call *ir) void ir_to_mesa_visitor::visit(ir_texture *ir) { - ir_to_mesa_src_reg result_src, coord, projector; - ir_to_mesa_dst_reg result_dst, lod_info; + ir_to_mesa_src_reg result_src, coord, lod_info, projector; + ir_to_mesa_dst_reg result_dst, coord_dst; ir_to_mesa_instruction *inst = NULL; + prog_opcode opcode = OPCODE_NOP; ir->coordinate->accept(this); - coord = this->result; + + /* Put our coords in a temp. We'll need to modify them for shadow, + * projection, or LOD, so the only case we'd use it as is is if + * we're doing plain old texturing. Mesa IR optimization should + * handle cleaning up our mess in that case. + */ + coord = get_temp(glsl_type::vec4_type); + coord_dst = ir_to_mesa_dst_reg_from_src(coord); + ir_to_mesa_emit_op1(ir, OPCODE_MOV, coord_dst, + this->result); if (ir->projector) { ir->projector->accept(this); @@ -1307,36 +1317,17 @@ ir_to_mesa_visitor::visit(ir_texture *ir) switch (ir->op) { case ir_tex: - if (ir->projector) { - /* Compute new coord as vec4(texcoord.xyz, projector) */ - ir_to_mesa_emit_op1(ir, OPCODE_MOV, result_dst, coord); - result_dst.writemask = WRITEMASK_W; - ir_to_mesa_emit_op1(ir, OPCODE_MOV, result_dst, projector); - result_dst.writemask = WRITEMASK_XYZW; - inst = ir_to_mesa_emit_op1(ir, OPCODE_TXP, result_dst, result_src); - } else { - inst = ir_to_mesa_emit_op1(ir, OPCODE_TEX, result_dst, coord); - } + opcode = OPCODE_TEX; 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; + opcode = OPCODE_TXB; 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); - assert(!ir->projector); /* FINISHME */ + lod_info = this->result; 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; + opcode = OPCODE_TXL; 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); - assert(!ir->projector); /* FINISHME */ + lod_info = this->result; break; case ir_txd: case ir_txf: @@ -1344,6 +1335,41 @@ ir_to_mesa_visitor::visit(ir_texture *ir) break; } + if (ir->projector) { + if (opcode == OPCODE_TEX) { + /* Slot the projector in as the last component of the coord. */ + coord_dst.writemask = WRITEMASK_W; + ir_to_mesa_emit_op1(ir, OPCODE_MOV, coord_dst, projector); + coord_dst.writemask = WRITEMASK_XYZW; + opcode = OPCODE_TXP; + } else { + ir_to_mesa_src_reg coord_w = coord; + coord_w.swizzle = SWIZZLE_WWWW; + + /* For the other TEX opcodes there's no projective version + * since the last slot is taken up by lod info. Do the + * projective divide now. + */ + coord_dst.writemask = WRITEMASK_W; + ir_to_mesa_emit_op1(ir, OPCODE_RCP, coord_dst, projector); + + coord_dst.writemask = WRITEMASK_XYZ; + ir_to_mesa_emit_op2(ir, OPCODE_MUL, coord_dst, coord, coord_w); + + coord_dst.writemask = WRITEMASK_XYZW; + coord.swizzle = SWIZZLE_XYZW; + } + } + + if (opcode == OPCODE_TXL || opcode == OPCODE_TXB) { + /* Mesa IR stores lod or lod bias in the last channel of the coords. */ + coord_dst.writemask = WRITEMASK_W; + ir_to_mesa_emit_op1(ir, OPCODE_MOV, coord_dst, lod_info); + coord_dst.writemask = WRITEMASK_XYZW; + } + + inst = ir_to_mesa_emit_op1(ir, opcode, result_dst, coord); + ir_dereference_variable *sampler = ir->sampler->as_dereference_variable(); assert(sampler); /* FINISHME: sampler arrays */ /* generate the mapping, remove when we generate storage at -- cgit v1.2.3 From b61f4241f314144d3290085cda5db1959d8960a2 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Fri, 2 Jul 2010 16:09:44 -0700 Subject: ir_to_mesa: Add support for shadow comparison to texture instructions. piglit lacks tests for this currently. --- src/mesa/shader/ir_to_mesa.cpp | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/mesa/shader/ir_to_mesa.cpp b/src/mesa/shader/ir_to_mesa.cpp index 53e5242b10..c467825492 100644 --- a/src/mesa/shader/ir_to_mesa.cpp +++ b/src/mesa/shader/ir_to_mesa.cpp @@ -83,6 +83,7 @@ public: GLboolean cond_update; int sampler; /**< sampler index */ int tex_target; /**< One of TEXTURE_*_INDEX */ + GLboolean tex_shadow; }; class temp_entry : public exec_node { @@ -1361,6 +1362,16 @@ ir_to_mesa_visitor::visit(ir_texture *ir) } } + if (ir->shadow_comparitor) { + /* Slot the shadow value in as the second to last component of the + * coord. + */ + ir->shadow_comparitor->accept(this); + coord_dst.writemask = WRITEMASK_Z; + ir_to_mesa_emit_op1(ir, OPCODE_MOV, coord_dst, this->result); + coord_dst.writemask = WRITEMASK_XYZW; + } + if (opcode == OPCODE_TXL || opcode == OPCODE_TXB) { /* Mesa IR stores lod or lod bias in the last channel of the coords. */ coord_dst.writemask = WRITEMASK_W; @@ -1370,6 +1381,9 @@ ir_to_mesa_visitor::visit(ir_texture *ir) inst = ir_to_mesa_emit_op1(ir, opcode, result_dst, coord); + if (ir->shadow_comparitor) + inst->tex_shadow = GL_TRUE; + ir_dereference_variable *sampler = ir->sampler->as_dereference_variable(); assert(sampler); /* FINISHME: sampler arrays */ /* generate the mapping, remove when we generate storage at @@ -1396,8 +1410,6 @@ ir_to_mesa_visitor::visit(ir_texture *ir) assert(!"FINISHME: other texture targets"); } - assert(!ir->shadow_comparitor); /* FINISHME */ - this->result = result_src; } @@ -1726,6 +1738,7 @@ get_mesa_program(GLcontext *ctx, void *mem_ctx, struct gl_shader *shader) 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_inst->TexShadow = inst->tex_shadow; mesa_instruction_annotation[i] = inst->ir; mesa_inst++; -- cgit v1.2.3 From 8f25d198e54a117b36e68582977a644d085a4a94 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Fri, 2 Jul 2010 16:10:31 -0700 Subject: ir_to_mesa: Add support for scalar * mat, vec * mat. This is not tested by piglit currently. --- src/mesa/shader/ir_to_mesa.cpp | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) (limited to 'src') diff --git a/src/mesa/shader/ir_to_mesa.cpp b/src/mesa/shader/ir_to_mesa.cpp index c467825492..f8858af26d 100644 --- a/src/mesa/shader/ir_to_mesa.cpp +++ b/src/mesa/shader/ir_to_mesa.cpp @@ -686,6 +686,42 @@ ir_to_mesa_visitor::visit(ir_expression *ir) src_column.index++; } } + } else if (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[1]; + for (int i = 0; i < ir->operands[1]->type->matrix_columns; i++) { + ir_to_mesa_emit_op2(ir, OPCODE_MUL, + dst_column, src_column, op[0]); + dst_column.index++; + src_column.index++; + } + } else { + ir_to_mesa_src_reg src_column = op[1]; + ir_to_mesa_dst_reg dst_chan = result_dst; + + /* FINISHME here and above: non-square matrices */ + assert(ir->operands[1]->type->vector_elements == + ir->operands[1]->type->matrix_columns); + + for (int i = 0; i < ir->operands[0]->type->vector_elements; i++) { + dst_chan.writemask = (1 << i); + switch (ir->operands[0]->type->vector_elements) { + case 2: + ir_to_mesa_emit_op2(ir, OPCODE_DP2, dst_chan, op[0], src_column); + break; + case 3: + ir_to_mesa_emit_op2(ir, OPCODE_DP3, dst_chan, op[0], src_column); + break; + case 4: + ir_to_mesa_emit_op2(ir, OPCODE_DP4, dst_chan, op[0], src_column); + break; + default: + assert(0); + } + src_column.index++; + } + } } else { assert(!ir->operands[0]->type->is_matrix()); assert(!ir->operands[1]->type->is_matrix()); -- cgit v1.2.3 From 4e7d5d0e74c26cac182cea1be0f6b79bb664ad8c Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Fri, 2 Jul 2010 16:17:50 -0700 Subject: i965: Add support for the DP2 opcode, which we use for dot(vec2, vec2). The original glsl compiler would generate a.x * b.x + a.y * b.y, which we would do mul+mul+add for instead of this mul+mac. Fixes glsl-fs-dot-vec2. --- src/mesa/drivers/dri/i965/brw_wm.h | 5 +++++ src/mesa/drivers/dri/i965/brw_wm_emit.c | 25 +++++++++++++++++++++++++ src/mesa/drivers/dri/i965/brw_wm_glsl.c | 3 +++ src/mesa/drivers/dri/i965/brw_wm_pass1.c | 5 +++++ 4 files changed, 38 insertions(+) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_wm.h b/src/mesa/drivers/dri/i965/brw_wm.h index 938557ff36..197b875434 100644 --- a/src/mesa/drivers/dri/i965/brw_wm.h +++ b/src/mesa/drivers/dri/i965/brw_wm.h @@ -343,6 +343,11 @@ void emit_delta_xy(struct brw_compile *p, const struct brw_reg *dst, GLuint mask, const struct brw_reg *arg0); +void emit_dp2(struct brw_compile *p, + const struct brw_reg *dst, + GLuint mask, + const struct brw_reg *arg0, + const struct brw_reg *arg1); void emit_dp3(struct brw_compile *p, const struct brw_reg *dst, GLuint mask, diff --git a/src/mesa/drivers/dri/i965/brw_wm_emit.c b/src/mesa/drivers/dri/i965/brw_wm_emit.c index 11f482bddf..a90a2d3cf2 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_emit.c +++ b/src/mesa/drivers/dri/i965/brw_wm_emit.c @@ -731,6 +731,27 @@ void emit_min(struct brw_compile *p, } +void emit_dp2(struct brw_compile *p, + const struct brw_reg *dst, + GLuint mask, + const struct brw_reg *arg0, + const struct brw_reg *arg1) +{ + int dst_chan = _mesa_ffs(mask & WRITEMASK_XYZW) - 1; + + if (!(mask & WRITEMASK_XYZW)) + return; /* Do not emit dead code */ + + assert(is_power_of_two(mask & WRITEMASK_XYZW)); + + brw_MUL(p, brw_null_reg(), arg0[0], arg1[0]); + + brw_set_saturate(p, (mask & SATURATE) ? 1 : 0); + brw_MAC(p, dst[dst_chan], arg0[1], arg1[1]); + brw_set_saturate(p, 0); +} + + void emit_dp3(struct brw_compile *p, const struct brw_reg *dst, GLuint mask, @@ -1584,6 +1605,10 @@ void brw_wm_emit( struct brw_wm_compile *c ) emit_ddxy(p, dst, dst_flags, GL_FALSE, args[0]); break; + case OPCODE_DP2: + emit_dp2(p, dst, dst_flags, args[0], args[1]); + break; + case OPCODE_DP3: emit_dp3(p, dst, dst_flags, args[0], args[1]); break; diff --git a/src/mesa/drivers/dri/i965/brw_wm_glsl.c b/src/mesa/drivers/dri/i965/brw_wm_glsl.c index e23ce7ad7a..57be08a8d1 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_glsl.c +++ b/src/mesa/drivers/dri/i965/brw_wm_glsl.c @@ -1903,6 +1903,9 @@ static void brw_wm_emit_glsl(struct brw_context *brw, struct brw_wm_compile *c) case OPCODE_SWZ: emit_alu1(p, brw_MOV, dst, dst_flags, args[0]); break; + case OPCODE_DP2: + emit_dp2(p, dst, dst_flags, args[0], args[1]); + break; case OPCODE_DP3: emit_dp3(p, dst, dst_flags, args[0], args[1]); break; diff --git a/src/mesa/drivers/dri/i965/brw_wm_pass1.c b/src/mesa/drivers/dri/i965/brw_wm_pass1.c index 8ee1f153b1..962515a99e 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_pass1.c +++ b/src/mesa/drivers/dri/i965/brw_wm_pass1.c @@ -255,6 +255,11 @@ void brw_wm_pass1( struct brw_wm_compile *c ) read2 = WRITEMASK_W; /* pixel w */ break; + case OPCODE_DP2: + read0 = WRITEMASK_XY; + read1 = WRITEMASK_XY; + break; + case OPCODE_DP3: read0 = WRITEMASK_XYZ; read1 = WRITEMASK_XYZ; -- cgit v1.2.3 From b0ac07e3de8d9609fb0b1b7ec85b4149c4ee2c70 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Fri, 2 Jul 2010 17:02:42 -0700 Subject: ir_to_mesa: Fix up implementation of ir_unop_exp. OPCODE_EXP is not to ir_unop_exp what OPCODE_EX2 is to ir_unop_exp2. It's the weird VP approximation helper opcode. Just implement it with OPCODE_POW instead. Fixes glsl-fs-exp. --- src/mesa/shader/ir_to_mesa.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/shader/ir_to_mesa.cpp b/src/mesa/shader/ir_to_mesa.cpp index f8858af26d..87d6f8452a 100644 --- a/src/mesa/shader/ir_to_mesa.cpp +++ b/src/mesa/shader/ir_to_mesa.cpp @@ -625,7 +625,8 @@ ir_to_mesa_visitor::visit(ir_expression *ir) break; case ir_unop_exp: - ir_to_mesa_emit_scalar_op1(ir, OPCODE_EXP, result_dst, op[0]); + 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]); -- 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') 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') 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 e2a358348b143a163c065d82c7375e6a94e98f2a Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Fri, 2 Jul 2010 02:50:40 -0700 Subject: ir_to_mesa: Fix uninitalized value. --- src/mesa/shader/ir_to_mesa.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/shader/ir_to_mesa.cpp b/src/mesa/shader/ir_to_mesa.cpp index 87d6f8452a..547b18402f 100644 --- a/src/mesa/shader/ir_to_mesa.cpp +++ b/src/mesa/shader/ir_to_mesa.cpp @@ -1546,7 +1546,7 @@ static void set_branchtargets(struct prog_instruction *mesa_instructions, int num_instructions) { - int if_count = 0, loop_count; + int if_count = 0, loop_count = 0; int *if_stack, *loop_stack; int if_stack_pos = 0, loop_stack_pos = 0; int i, j; -- 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') 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') 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') 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 a0b3b9302978ab6d4db62f0c9b2b313ebc7ed0b4 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 6 Jul 2010 12:28:12 -0700 Subject: ir_to_mesa: Use the compiler-assigned locations for builtin attrs/varyings. The previous table didn't distinguish gl_Color for the VS and FS, so we would use the FS's attribute index for the VS and read undefined. This partially fixes glsl-routing to match its behavior on master. --- src/mesa/shader/ir_to_mesa.cpp | 83 +++++------------------------------------- 1 file changed, 9 insertions(+), 74 deletions(-) (limited to 'src') diff --git a/src/mesa/shader/ir_to_mesa.cpp b/src/mesa/shader/ir_to_mesa.cpp index 547b18402f..e1b0397dde 100644 --- a/src/mesa/shader/ir_to_mesa.cpp +++ b/src/mesa/shader/ir_to_mesa.cpp @@ -211,56 +211,6 @@ static int swizzle_for_size(int size) 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_OUTPUT, FRAG_RESULT_DEPTH}, - - /* 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, @@ -988,8 +938,7 @@ 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, loc; - bool var_in; + unsigned int loc; if (!entry) { switch (ir->var->mode) { @@ -1033,30 +982,16 @@ ir_to_mesa_visitor::visit(ir_dereference_variable *ir) 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)) { - entry = new(mem_ctx) temp_entry(ir->var, - builtin_var_to_mesa_reg[i].file, - builtin_var_to_mesa_reg[i].index); - break; - } - - /* If no builtin, then it's a user-generated varying - * (FINISHME: or a function argument!) - */ - /* The linker-assigned location is VERT_RESULT_* or FRAG_ATTRIB* + /* The linker assigns locations for varyings and attributes, + * including deprecated builtins (like gl_Color), user-assign + * generic attributes (glBindVertexLocation), and + * user-defined varyings. + * + * FINISHME: We would hit this path for function arguments. Fix! */ assert(ir->var->location != -1); - if (var_in) { + if (ir->var->mode == ir_var_in || + ir->var->mode == ir_var_inout) { entry = new(mem_ctx) temp_entry(ir->var, PROGRAM_INPUT, ir->var->location); -- cgit v1.2.3 From e45a982313e02dbc186b51cf0935e0bec18dc61a Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Tue, 6 Jul 2010 14:36:54 -0700 Subject: Make hashtable.h be C++ friendly --- src/mesa/shader/hash_table.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src') diff --git a/src/mesa/shader/hash_table.h b/src/mesa/shader/hash_table.h index 7b302f5dbe..881e756f08 100644 --- a/src/mesa/shader/hash_table.h +++ b/src/mesa/shader/hash_table.h @@ -38,6 +38,10 @@ struct hash_table; typedef unsigned (*hash_func_t)(const void *key); typedef int (*hash_compare_func_t)(const void *key1, const void *key2); +#ifdef __cplusplus +extern "C" { +#endif + /** * Hash table constructor * @@ -114,4 +118,7 @@ extern unsigned hash_table_string_hash(const void *key); */ #define hash_table_string_compare ((hash_compare_func_t) strcmp) +#ifdef __cplusplus +}; +#endif #endif /* HASH_TABLE_H */ -- 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') 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') 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') 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') 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') 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') 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') 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') 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') 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') 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') 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') 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') 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 2d1789e667c4180777829f96856daf91326721b9 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 6 Jul 2010 17:11:03 -0700 Subject: ir_to_mesa: Add support for conditional moves. Nothing generates conditional moves yet. --- src/mesa/shader/ir_to_mesa.cpp | 32 +++++++++++++++++++++++++++----- 1 file changed, 27 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/mesa/shader/ir_to_mesa.cpp b/src/mesa/shader/ir_to_mesa.cpp index e1b0397dde..021e270f18 100644 --- a/src/mesa/shader/ir_to_mesa.cpp +++ b/src/mesa/shader/ir_to_mesa.cpp @@ -286,6 +286,20 @@ ir_to_mesa_dst_reg_from_src(ir_to_mesa_src_reg reg) return dst_reg; } +inline ir_to_mesa_src_reg +ir_to_mesa_src_reg_from_dst(ir_to_mesa_dst_reg reg) +{ + ir_to_mesa_src_reg src_reg; + + src_reg.file = reg.file; + src_reg.index = reg.index; + src_reg.swizzle = SWIZZLE_XYZW; + src_reg.negate = 0; + src_reg.reladdr = 0; + + return src_reg; +} + /** * Emits Mesa scalar opcodes to produce unique answers across channels. * @@ -1192,14 +1206,22 @@ ir_to_mesa_visitor::visit(ir_assignment *ir) assert(r.file != PROGRAM_UNDEFINED); if (ir->condition) { - ir_constant *condition_constant; + ir_to_mesa_src_reg condition; - condition_constant = ir->condition->constant_expression_value(); + ir->condition->accept(this); + condition = this->result; - assert(condition_constant && condition_constant->value.b[0]); + /* We use the OPCODE_CMP (a < 0 ? b : c) for conditional moves, + * and the condition we produced is 0.0 or 1.0. By flipping the + * sign, we can choose which value OPCODE_CMP produces without + * an extra computing the condition. + */ + condition.negate = ~condition.negate; + ir_to_mesa_emit_op3(ir, OPCODE_CMP, l, + condition, r, ir_to_mesa_src_reg_from_dst(l)); + } else { + ir_to_mesa_emit_op1(ir, OPCODE_MOV, l, r); } - - ir_to_mesa_emit_op1(ir, OPCODE_MOV, l, r); } -- 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') 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') 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') 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') 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') 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') 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 8bb15c1ed55eb71533d2af94a6afbf01e3d23610 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 7 Jul 2010 11:38:55 -0700 Subject: ir_to_mesa: Fill in some uninitialized fields that sometimes contained junk. --- src/mesa/shader/ir_to_mesa.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/mesa/shader/ir_to_mesa.cpp b/src/mesa/shader/ir_to_mesa.cpp index 2ffff60065..d179692072 100644 --- a/src/mesa/shader/ir_to_mesa.cpp +++ b/src/mesa/shader/ir_to_mesa.cpp @@ -192,11 +192,11 @@ ir_to_mesa_src_reg ir_to_mesa_undef = { }; ir_to_mesa_dst_reg ir_to_mesa_undef_dst = { - PROGRAM_UNDEFINED, 0, SWIZZLE_NOOP + PROGRAM_UNDEFINED, 0, SWIZZLE_NOOP, COND_TR }; ir_to_mesa_dst_reg ir_to_mesa_address_reg = { - PROGRAM_ADDRESS, 0, WRITEMASK_X + PROGRAM_ADDRESS, 0, WRITEMASK_X, COND_TR }; static int swizzle_for_size(int size) @@ -375,6 +375,8 @@ ir_to_mesa_visitor::src_reg_for_float(float val) src_reg.file = PROGRAM_CONSTANT; src_reg.index = _mesa_add_unnamed_constant(this->prog->Parameters, &val, 1, &src_reg.swizzle); + src_reg.reladdr = GL_FALSE; + src_reg.negate = 0; return src_reg; } -- cgit v1.2.3 From 76101f7c0468c7f346b1a8d6b824fc8914a17bd1 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 7 Jul 2010 11:39:48 -0700 Subject: ir_to_mesa: Add support for gl_TextureMatrix access. Fixes glsl-vs-texturematrix-1, and glsl-vs-texturematrix-2 on swrast. --- src/mesa/shader/ir_to_mesa.cpp | 103 +++++++++++++++++++++++++++++++++-------- 1 file changed, 84 insertions(+), 19 deletions(-) (limited to 'src') diff --git a/src/mesa/shader/ir_to_mesa.cpp b/src/mesa/shader/ir_to_mesa.cpp index d179692072..21b01edefd 100644 --- a/src/mesa/shader/ir_to_mesa.cpp +++ b/src/mesa/shader/ir_to_mesa.cpp @@ -869,8 +869,34 @@ ir_to_mesa_visitor::visit(ir_swizzle *ir) this->result = src_reg; } +static int +add_matrix_ref(struct gl_program *prog, int *tokens) +{ + int base_pos = -1; + int i; + + /* Add a ref for each column. It looks like the reason we do + * it this way is that _mesa_add_state_reference doesn't work + * for things that aren't vec4s, so the tokens[2]/tokens[3] + * range has to be equal. + */ + for (i = 0; i < 4; i++) { + tokens[2] = i; + tokens[3] = i; + int pos = _mesa_add_state_reference(prog->Parameters, + (gl_state_index *)tokens); + if (base_pos == -1) + base_pos = pos; + else + assert(base_pos + i == pos); + } + + return base_pos; +} + static temp_entry * -get_builtin_matrix_ref(void *mem_ctx, struct gl_program *prog, ir_variable *var) +get_builtin_matrix_ref(void *mem_ctx, struct gl_program *prog, ir_variable *var, + ir_rvalue *array_index) { /* * NOTE: The ARB_vertex_program extension specified that matrices get @@ -915,28 +941,31 @@ get_builtin_matrix_ref(void *mem_ctx, struct gl_program *prog, ir_variable *var) for (i = 0; i < Elements(matrices); i++) { if (strcmp(var->name, matrices[i].name) == 0) { - int j; - int last_pos = -1, base_pos = -1; int tokens[STATE_LENGTH]; + int base_pos = -1; tokens[0] = matrices[i].matrix; - tokens[1] = 0; /* array index! */ tokens[4] = matrices[i].modifier; - - /* Add a ref for each column. It looks like the reason we do - * it this way is that _mesa_add_state_reference doesn't work - * for things that aren't vec4s, so the tokens[2]/tokens[3] - * range has to be equal. - */ - for (j = 0; j < 4; j++) { - tokens[2] = j; - tokens[3] = j; - int pos = _mesa_add_state_reference(prog->Parameters, - (gl_state_index *)tokens); - assert(last_pos == -1 || last_pos == base_pos + j); - if (base_pos == -1) - base_pos = pos; + if (matrices[i].matrix == STATE_TEXTURE_MATRIX) { + ir_constant *index = array_index->constant_expression_value(); + if (index) { + tokens[1] = index->value.i[0]; + base_pos = add_matrix_ref(prog, tokens); + } else { + for (i = 0; i < var->type->length; i++) { + tokens[1] = i; + int pos = add_matrix_ref(prog, tokens); + if (base_pos == -1) + base_pos = pos; + else + assert(base_pos + (int)i * 4 == pos); + } + } + } else { + tokens[1] = 0; /* unused array index */ + base_pos = add_matrix_ref(prog, tokens); } + tokens[4] = matrices[i].modifier; entry = new(mem_ctx) temp_entry(var, PROGRAM_STATE_VAR, @@ -959,7 +988,8 @@ ir_to_mesa_visitor::visit(ir_dereference_variable *ir) if (!entry) { switch (ir->var->mode) { case ir_var_uniform: - entry = get_builtin_matrix_ref(this->mem_ctx, this->prog, ir->var); + entry = get_builtin_matrix_ref(this->mem_ctx, this->prog, ir->var, + NULL); if (entry) break; @@ -1057,9 +1087,44 @@ ir_to_mesa_visitor::visit(ir_dereference_array *ir) { ir_constant *index; ir_to_mesa_src_reg src_reg; + ir_dereference_variable *deref_var = ir->array->as_dereference_variable(); index = ir->array_index->constant_expression_value(); + if (deref_var && strncmp(deref_var->var->name, + "gl_TextureMatrix", + strlen("gl_TextureMatrix")) == 0) { + ir_to_mesa_src_reg src_reg; + struct temp_entry *entry; + + entry = get_builtin_matrix_ref(this->mem_ctx, this->prog, deref_var->var, + ir->array_index); + assert(entry); + + src_reg.file = entry->file; + src_reg.index = entry->index; + src_reg.swizzle = swizzle_for_size(ir->type->vector_elements); + src_reg.negate = 0; + + if (index) { + src_reg.reladdr = GL_FALSE; + } else { + ir_to_mesa_src_reg index_reg = get_temp(glsl_type::float_type); + + ir->array_index->accept(this); + ir_to_mesa_emit_op2(ir, OPCODE_MUL, + ir_to_mesa_dst_reg_from_src(index_reg), + this->result, src_reg_for_float(4.0)); + + src_reg.reladdr = true; + ir_to_mesa_emit_op1(ir, OPCODE_ARL, ir_to_mesa_address_reg, + index_reg); + } + + this->result = src_reg; + return; + } + /* By the time we make it to this stage, matrices should be broken down * to vectors. */ -- 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') 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') 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') 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') 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') 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') 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') 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') 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') 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') 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 9b68b88e43c424439d425534ef280ee7a9406a1b Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 7 Jul 2010 15:55:47 -0700 Subject: ir_to_mesa: Add support for matrix * matrix. --- src/mesa/shader/ir_to_mesa.cpp | 43 ++++++++++++++++++++++++++---------------- 1 file changed, 27 insertions(+), 16 deletions(-) (limited to 'src') diff --git a/src/mesa/shader/ir_to_mesa.cpp b/src/mesa/shader/ir_to_mesa.cpp index 21b01edefd..00fa2cccfe 100644 --- a/src/mesa/shader/ir_to_mesa.cpp +++ b/src/mesa/shader/ir_to_mesa.cpp @@ -623,9 +623,9 @@ ir_to_mesa_visitor::visit(ir_expression *ir) 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_matrix()) { if (ir->operands[1]->type->is_scalar()) { ir_to_mesa_dst_reg dst_column = result_dst; ir_to_mesa_src_reg src_column = op[0]; @@ -636,21 +636,32 @@ ir_to_mesa_visitor::visit(ir_expression *ir) src_column.index++; } } else { - ir_to_mesa_src_reg src_column = op[0]; + /* matrix * vec or matrix * matrix */ + int op1_col; + ir_to_mesa_dst_reg dst_column = result_dst; + ir_to_mesa_src_reg dst_column_src; ir_to_mesa_src_reg src_chan = op[1]; - assert(!ir->operands[1]->type->is_matrix() || - !"FINISHME: matrix * matrix"); - for (int i = 0; i < ir->operands[0]->type->matrix_columns; i++) { - src_chan.swizzle = MAKE_SWIZZLE4(i, i, i, i); - if (i == 0) { - ir_to_mesa_emit_op2(ir, OPCODE_MUL, - result_dst, src_column, src_chan); - } else { - ir_to_mesa_emit_op3(ir, OPCODE_MAD, - result_dst, src_column, src_chan, - result_src); - } - src_column.index++; + + dst_column_src = ir_to_mesa_src_reg_from_dst(result_dst); + for (op1_col = 0; op1_col < ir->operands[1]->type->matrix_columns; + op1_col++) { + ir_to_mesa_src_reg src_column = op[0]; + + for (int i = 0; i < ir->operands[0]->type->matrix_columns; i++) { + src_chan.swizzle = MAKE_SWIZZLE4(i, i, i, i); + if (i == 0) { + ir_to_mesa_emit_op2(ir, OPCODE_MUL, + dst_column, src_column, src_chan); + } else { + ir_to_mesa_emit_op3(ir, OPCODE_MAD, + dst_column, src_column, src_chan, + dst_column_src); + } + src_column.index++; + } + src_chan.index++; + dst_column.index++; + dst_column_src.index++; } } } else if (ir->operands[1]->type->is_matrix()) { -- cgit v1.2.3 From 7d8091f7cca0314dd66599bdce5bfcf09fe8b578 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 7 Jul 2010 16:10:04 -0700 Subject: ir_to_mesa: Add support for assignment of aggregates. --- src/mesa/shader/ir_to_mesa.cpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/mesa/shader/ir_to_mesa.cpp b/src/mesa/shader/ir_to_mesa.cpp index 00fa2cccfe..9497b17a2a 100644 --- a/src/mesa/shader/ir_to_mesa.cpp +++ b/src/mesa/shader/ir_to_mesa.cpp @@ -1268,6 +1268,7 @@ ir_to_mesa_visitor::visit(ir_assignment *ir) { struct ir_to_mesa_dst_reg l; struct ir_to_mesa_src_reg r; + int i; assert(!ir->lhs->type->is_matrix()); assert(!ir->lhs->type->is_array()); @@ -1295,10 +1296,18 @@ ir_to_mesa_visitor::visit(ir_assignment *ir) * an extra computing the condition. */ condition.negate = ~condition.negate; - ir_to_mesa_emit_op3(ir, OPCODE_CMP, l, - condition, r, ir_to_mesa_src_reg_from_dst(l)); + for (i = 0; i < type_size(ir->lhs->type); i++) { + ir_to_mesa_emit_op3(ir, OPCODE_CMP, l, + condition, r, ir_to_mesa_src_reg_from_dst(l)); + l.index++; + r.index++; + } } else { - ir_to_mesa_emit_op1(ir, OPCODE_MOV, l, r); + for (i = 0; i < type_size(ir->lhs->type); i++) { + ir_to_mesa_emit_op1(ir, OPCODE_MOV, l, r); + l.index++; + r.index++; + } } } -- cgit v1.2.3 From 9968f1b23c475c99139f0209c7a049ed00df01af Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 7 Jul 2010 16:16:09 -0700 Subject: ir_to_mesa: Only allocate a vector per column of a matrix. --- src/mesa/shader/ir_to_mesa.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/shader/ir_to_mesa.cpp b/src/mesa/shader/ir_to_mesa.cpp index 9497b17a2a..5cb5564d50 100644 --- a/src/mesa/shader/ir_to_mesa.cpp +++ b/src/mesa/shader/ir_to_mesa.cpp @@ -393,7 +393,7 @@ type_size(const struct glsl_type *type) case GLSL_TYPE_FLOAT: case GLSL_TYPE_BOOL: if (type->is_matrix()) { - return 4; /* FINISHME: Not all matrices are 4x4. */ + return type->matrix_columns; } else { /* Regardless of size of vector, it gets a vec4. This is bad * packing for things like floats, but otherwise arrays become a -- cgit v1.2.3 From 69676fc6a3ffbc2c99af541b954427c2e4966d68 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 7 Jul 2010 17:24:00 -0700 Subject: ir_to_mesa: Don't assert that we can't assign matrices. It should work now. --- src/mesa/shader/ir_to_mesa.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'src') diff --git a/src/mesa/shader/ir_to_mesa.cpp b/src/mesa/shader/ir_to_mesa.cpp index 5cb5564d50..e1c0fca7bd 100644 --- a/src/mesa/shader/ir_to_mesa.cpp +++ b/src/mesa/shader/ir_to_mesa.cpp @@ -1270,7 +1270,6 @@ ir_to_mesa_visitor::visit(ir_assignment *ir) struct ir_to_mesa_src_reg r; int i; - assert(!ir->lhs->type->is_matrix()); assert(!ir->lhs->type->is_array()); assert(ir->lhs->type->base_type != GLSL_TYPE_STRUCT); -- cgit v1.2.3 From b4d0c0e0ee983ee614b047799c3e01221a353c98 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 7 Jul 2010 17:08:58 -0700 Subject: ir_to_mesa: Add support for adding/subtracting matrices. This isn't really tested, but didn't break normal vector add/sub. --- src/mesa/shader/ir_to_mesa.cpp | 42 +++++++++++++++++++++++++++++++++++++++--- 1 file changed, 39 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/mesa/shader/ir_to_mesa.cpp b/src/mesa/shader/ir_to_mesa.cpp index e1c0fca7bd..b42ac84842 100644 --- a/src/mesa/shader/ir_to_mesa.cpp +++ b/src/mesa/shader/ir_to_mesa.cpp @@ -178,6 +178,13 @@ public: ir_to_mesa_src_reg src0, ir_to_mesa_src_reg src1); + void ir_to_mesa_emit_addsub(ir_expression *ir, + enum prog_opcode opcode, + struct ir_to_mesa_src_reg result_src, + struct ir_to_mesa_dst_reg result_dst, + struct ir_to_mesa_src_reg op0, + struct ir_to_mesa_src_reg op1); + int *sampler_map; int sampler_map_size; @@ -530,6 +537,32 @@ ir_to_mesa_visitor::visit(ir_function *ir) } } +void +ir_to_mesa_visitor::ir_to_mesa_emit_addsub(ir_expression *ir, + enum prog_opcode opcode, + struct ir_to_mesa_src_reg result_src, + struct ir_to_mesa_dst_reg result_dst, + struct ir_to_mesa_src_reg op0, + struct ir_to_mesa_src_reg op1) +{ + ir_to_mesa_dst_reg dst_column = result_dst; + int matrix_columns; + + if (ir->operands[0]->type->is_matrix()) + matrix_columns = ir->operands[0]->type->matrix_columns; + else + matrix_columns = ir->operands[1]->type->matrix_columns; + + for (int i = 0; i < matrix_columns; i++) { + ir_to_mesa_emit_op2(ir, opcode, dst_column, op0, op1); + dst_column.index++; + if (ir->operands[0]->type->is_matrix()) + op0.index++; + if (ir->operands[1]->type->is_matrix()) + op1.index++; + } +} + void ir_to_mesa_visitor::visit(ir_expression *ir) { @@ -554,7 +587,8 @@ ir_to_mesa_visitor::visit(ir_expression *ir) /* Only expression implemented for matrices yet */ assert(!ir->operands[operand]->type->is_matrix() || - ir->operation == ir_binop_mul); + ir->operation == ir_binop_mul || + ir->operation == ir_binop_add); } this->result.file = PROGRAM_UNDEFINED; @@ -618,10 +652,12 @@ ir_to_mesa_visitor::visit(ir_expression *ir) break; case ir_binop_add: - ir_to_mesa_emit_op2(ir, OPCODE_ADD, result_dst, op[0], op[1]); + ir_to_mesa_emit_addsub(ir, OPCODE_ADD, + result_src, 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]); + ir_to_mesa_emit_addsub(ir, OPCODE_SUB, + result_src, result_dst, op[0], op[1]); break; case ir_binop_mul: -- cgit v1.2.3 From ffd24b0a6844871eed0c78608431e2f82d5615e1 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 7 Jul 2010 17:49:05 -0700 Subject: ir_to_mesa: Add support for constant matrices (untested). --- src/mesa/shader/ir_to_mesa.cpp | 35 +++++++++++++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/mesa/shader/ir_to_mesa.cpp b/src/mesa/shader/ir_to_mesa.cpp index b42ac84842..727a815753 100644 --- a/src/mesa/shader/ir_to_mesa.cpp +++ b/src/mesa/shader/ir_to_mesa.cpp @@ -1355,8 +1355,39 @@ ir_to_mesa_visitor::visit(ir_constant *ir) GLfloat *values = stack_vals; unsigned int i; - if (ir->type->is_matrix() || ir->type->is_array()) { - assert(!"FINISHME: array/matrix constants"); + if (ir->type->is_array()) { + ir->print(); + printf("\n"); + assert(!"FINISHME: array constants"); + } + + if (ir->type->is_matrix()) { + /* Unfortunately, 4 floats is all we can get into + * _mesa_add_unnamed_constant. So, make a temp to store the + * matrix and move each constant value into it. If we get + * lucky, copy propagation will eliminate the extra moves. + */ + ir_to_mesa_src_reg mat = get_temp(glsl_type::vec4_type); + ir_to_mesa_dst_reg mat_column = ir_to_mesa_dst_reg_from_src(mat); + + for (i = 0; i < ir->type->matrix_columns; i++) { + src_reg.file = PROGRAM_CONSTANT; + + assert(ir->type->base_type == GLSL_TYPE_FLOAT); + values = &ir->value.f[i * ir->type->vector_elements]; + + src_reg.index = _mesa_add_unnamed_constant(this->prog->Parameters, + values, + ir->type->vector_elements, + &src_reg.swizzle); + src_reg.reladdr = false; + src_reg.negate = 0; + ir_to_mesa_emit_op1(ir, OPCODE_MOV, mat_column, src_reg); + + mat_column.index++; + } + + this->result = mat; } src_reg.file = PROGRAM_CONSTANT; -- cgit v1.2.3 From ea2a03f0a5b8b58ea88ecb607664ea50c9d6e96e Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 7 Jul 2010 17:59:50 -0700 Subject: ir_to_mesa: Fix the assertion on LHS array derefs to DWIM. This allows array derefs of matrices now, which makes idr's GLSL demo happy. --- src/mesa/shader/ir_to_mesa.cpp | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/mesa/shader/ir_to_mesa.cpp b/src/mesa/shader/ir_to_mesa.cpp index 727a815753..4496daf2a5 100644 --- a/src/mesa/shader/ir_to_mesa.cpp +++ b/src/mesa/shader/ir_to_mesa.cpp @@ -1247,21 +1247,24 @@ 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; + 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()); + + /* We don't handle relative addressing on the LHS yet. */ + assert(deref_array->array_index->constant_expression_value() != NULL); + } + /* 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())) { + if ((swiz = ir->as_swizzle())) { dst_reg.writemask = 0; if (swiz->mask.num_components >= 1) dst_reg.writemask |= (1 << swiz->mask.x); -- 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') 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 f632a330eccb26c28a3b94216c55994e94988751 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 7 Jul 2010 21:00:32 -0700 Subject: mesa: Fix documentation of BranchTarget for BRK. It was changed in 2009 and the comment wasn't updated. --- src/mesa/shader/prog_instruction.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/shader/prog_instruction.h b/src/mesa/shader/prog_instruction.h index 28c797a4ba..c1e3a1e80d 100644 --- a/src/mesa/shader/prog_instruction.h +++ b/src/mesa/shader/prog_instruction.h @@ -384,7 +384,7 @@ struct prog_instruction /** * 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 BRK, points to ENDLOOP * For IF, points to ELSE or ENDIF. * For ELSE, points to ENDIF. */ -- cgit v1.2.3 From 25cda5039df0da6c2c65f1cac1bfc750c0c16e82 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 7 Jul 2010 21:28:28 -0700 Subject: mesa: Extend register lifetimes to the end of the largest loop required. Previously, a register defined at main scope and used in a loop in a loop could end up getting marked as needed only from the definition outside of the loops to the end of the inner loop, and we would cleverly slot in something else in its register in the end of the outer loop. Fixes glsl-vs-loop-nested and glsl-fs-loop-nested on glsl2. This doesn't happen much on master because the original compiler does its own register allocation, so we find little we can do with linear scan register (re)allocation. --- src/mesa/shader/prog_optimize.c | 40 +++++++++++++++++++++++----------------- 1 file changed, 23 insertions(+), 17 deletions(-) (limited to 'src') diff --git a/src/mesa/shader/prog_optimize.c b/src/mesa/shader/prog_optimize.c index 2941a17da3..bd120b8643 100644 --- a/src/mesa/shader/prog_optimize.c +++ b/src/mesa/shader/prog_optimize.c @@ -728,14 +728,32 @@ sort_interval_list_by_start(struct interval_list *list) #endif } +struct loop_info +{ + GLuint Start, End; /**< Start, end instructions of loop */ +}; /** * Update the intermediate interval info for register 'index' and * instruction 'ic'. */ static void -update_interval(GLint intBegin[], GLint intEnd[], GLuint index, GLuint ic) +update_interval(GLint intBegin[], GLint intEnd[], + struct loop_info *loopStack, GLuint loopStackDepth, + GLuint index, GLuint ic) { + int i; + + /* If the register is used in a loop, extend its lifetime through the end + * of the outermost loop that doesn't contain its definition. + */ + for (i = 0; i < loopStackDepth; i++) { + if (intBegin[index] < loopStack[i].Start) { + ic = loopStack[i].End; + break; + } + } + ASSERT(index < MAX_PROGRAM_TEMPS); if (intBegin[index] == -1) { ASSERT(intEnd[index] == -1); @@ -756,10 +774,6 @@ _mesa_find_temp_intervals(const struct prog_instruction *instructions, GLint intBegin[MAX_PROGRAM_TEMPS], GLint intEnd[MAX_PROGRAM_TEMPS]) { - struct loop_info - { - GLuint Start, End; /**< Start, end instructions of loop */ - }; struct loop_info loopStack[MAX_LOOP_NESTING]; GLuint loopStackDepth = 0; GLuint i; @@ -790,24 +804,16 @@ _mesa_find_temp_intervals(const struct prog_instruction *instructions, const GLuint index = inst->SrcReg[j].Index; if (inst->SrcReg[j].RelAddr) return GL_FALSE; - update_interval(intBegin, intEnd, index, i); - if (loopStackDepth > 0) { - /* extend temp register's interval to end of loop */ - GLuint loopEnd = loopStack[loopStackDepth - 1].End; - update_interval(intBegin, intEnd, index, loopEnd); - } + update_interval(intBegin, intEnd, loopStack, loopStackDepth, + index, i); } } if (inst->DstReg.File == PROGRAM_TEMPORARY) { const GLuint index = inst->DstReg.Index; if (inst->DstReg.RelAddr) return GL_FALSE; - update_interval(intBegin, intEnd, index, i); - if (loopStackDepth > 0) { - /* extend temp register's interval to end of loop */ - GLuint loopEnd = loopStack[loopStackDepth - 1].End; - update_interval(intBegin, intEnd, index, loopEnd); - } + update_interval(intBegin, intEnd, loopStack, loopStackDepth, + index, i); } } } -- 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') 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') 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') 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') 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') 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') 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') 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') 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') 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 7b48843ecd6690902e4f3bd709a041133b7fb540 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 12 Jul 2010 12:03:33 -0700 Subject: Revert "ir_to_mesa: Add support for adding/subtracting matrices." This reverts commit b4d0c0e0ee983ee614b047799c3e01221a353c98. Now that ir_mat_op_to_vec is landed, this change is no longer needed. --- src/mesa/shader/ir_to_mesa.cpp | 42 +++--------------------------------------- 1 file changed, 3 insertions(+), 39 deletions(-) (limited to 'src') diff --git a/src/mesa/shader/ir_to_mesa.cpp b/src/mesa/shader/ir_to_mesa.cpp index 81b91918cb..c636d69aba 100644 --- a/src/mesa/shader/ir_to_mesa.cpp +++ b/src/mesa/shader/ir_to_mesa.cpp @@ -178,13 +178,6 @@ public: ir_to_mesa_src_reg src0, ir_to_mesa_src_reg src1); - void ir_to_mesa_emit_addsub(ir_expression *ir, - enum prog_opcode opcode, - struct ir_to_mesa_src_reg result_src, - struct ir_to_mesa_dst_reg result_dst, - struct ir_to_mesa_src_reg op0, - struct ir_to_mesa_src_reg op1); - int *sampler_map; int sampler_map_size; @@ -537,32 +530,6 @@ ir_to_mesa_visitor::visit(ir_function *ir) } } -void -ir_to_mesa_visitor::ir_to_mesa_emit_addsub(ir_expression *ir, - enum prog_opcode opcode, - struct ir_to_mesa_src_reg result_src, - struct ir_to_mesa_dst_reg result_dst, - struct ir_to_mesa_src_reg op0, - struct ir_to_mesa_src_reg op1) -{ - ir_to_mesa_dst_reg dst_column = result_dst; - int matrix_columns; - - if (ir->operands[0]->type->is_matrix()) - matrix_columns = ir->operands[0]->type->matrix_columns; - else - matrix_columns = ir->operands[1]->type->matrix_columns; - - for (int i = 0; i < matrix_columns; i++) { - ir_to_mesa_emit_op2(ir, opcode, dst_column, op0, op1); - dst_column.index++; - if (ir->operands[0]->type->is_matrix()) - op0.index++; - if (ir->operands[1]->type->is_matrix()) - op1.index++; - } -} - void ir_to_mesa_visitor::visit(ir_expression *ir) { @@ -587,8 +554,7 @@ ir_to_mesa_visitor::visit(ir_expression *ir) /* Only expression implemented for matrices yet */ assert(!ir->operands[operand]->type->is_matrix() || - ir->operation == ir_binop_mul || - ir->operation == ir_binop_add); + ir->operation == ir_binop_mul); } this->result.file = PROGRAM_UNDEFINED; @@ -652,12 +618,10 @@ ir_to_mesa_visitor::visit(ir_expression *ir) break; case ir_binop_add: - ir_to_mesa_emit_addsub(ir, OPCODE_ADD, - result_src, result_dst, op[0], op[1]); + ir_to_mesa_emit_op2(ir, OPCODE_ADD, result_dst, op[0], op[1]); break; case ir_binop_sub: - ir_to_mesa_emit_addsub(ir, OPCODE_SUB, - result_src, result_dst, op[0], op[1]); + ir_to_mesa_emit_op2(ir, OPCODE_SUB, result_dst, op[0], op[1]); break; case ir_binop_mul: -- 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') 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') 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') 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') 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') 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') 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') 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') 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') 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 ffd7bb031e67f0d4e1eb36aa27261e8744e7b133 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Wed, 7 Jul 2010 11:03:21 -0700 Subject: Make shader_api.h be C++ friendly --- src/mesa/shader/shader_api.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src') diff --git a/src/mesa/shader/shader_api.h b/src/mesa/shader/shader_api.h index 557e910595..22f582a6a1 100644 --- a/src/mesa/shader/shader_api.h +++ b/src/mesa/shader/shader_api.h @@ -32,6 +32,9 @@ #include "main/mtypes.h" #include "ir_to_mesa.h" +#ifdef __cplusplus +extern "C" { +#endif /** * Internal functions */ @@ -109,5 +112,8 @@ _mesa_validate_shader_program(GLcontext *ctx, extern void _mesa_init_glsl_driver_functions(struct dd_function_table *driver); +#ifdef __cplusplus +}; +#endif #endif /* SHADER_API_H */ -- 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') 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') 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') 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 8258a6a2c36c9769428f4525415d6c0d565e588c Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 12 Jul 2010 14:14:53 -0700 Subject: ir_to_mesa: Add support for dereferencing matrices from arrays. --- src/mesa/shader/ir_to_mesa.cpp | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/mesa/shader/ir_to_mesa.cpp b/src/mesa/shader/ir_to_mesa.cpp index 8945e9b3b4..467e335fc4 100644 --- a/src/mesa/shader/ir_to_mesa.cpp +++ b/src/mesa/shader/ir_to_mesa.cpp @@ -1099,6 +1099,7 @@ ir_to_mesa_visitor::visit(ir_dereference_array *ir) ir_constant *index; ir_to_mesa_src_reg src_reg; ir_dereference_variable *deref_var = ir->array->as_dereference_variable(); + int element_size = type_size(ir->type); index = ir->array_index->constant_expression_value(); @@ -1125,7 +1126,7 @@ ir_to_mesa_visitor::visit(ir_dereference_array *ir) ir->array_index->accept(this); ir_to_mesa_emit_op2(ir, OPCODE_MUL, ir_to_mesa_dst_reg_from_src(index_reg), - this->result, src_reg_for_float(4.0)); + this->result, src_reg_for_float(element_size)); src_reg.reladdr = true; ir_to_mesa_emit_op1(ir, OPCODE_ARL, ir_to_mesa_address_reg, @@ -1136,11 +1137,6 @@ ir_to_mesa_visitor::visit(ir_dereference_array *ir) return; } - /* 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; @@ -1151,7 +1147,7 @@ ir_to_mesa_visitor::visit(ir_dereference_array *ir) src_reg.index += index->value.i[0]; } else { if (index) { - src_reg.index += index->value.i[0]; + src_reg.index += index->value.i[0] * element_size; } else { ir_to_mesa_src_reg array_base = this->result; /* Variable index array dereference. It eats the "vec4" of the @@ -1160,12 +1156,24 @@ ir_to_mesa_visitor::visit(ir_dereference_array *ir) */ ir->array_index->accept(this); + ir_to_mesa_src_reg index_reg; + + if (element_size == 1) { + index_reg = this->result; + } else { + index_reg = get_temp(glsl_type::float_type); + + ir_to_mesa_emit_op2(ir, OPCODE_MUL, + ir_to_mesa_dst_reg_from_src(index_reg), + this->result, src_reg_for_float(element_size)); + } + /* 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); + index_reg); this->result = get_temp(ir->type); ir_to_mesa_emit_op1(ir, OPCODE_MOV, -- 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') 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') 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') 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') 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') 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') 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') 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') 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') 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') 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 3f08989267d9cdd944787fcf7a300c6f1f84462c Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 12 Jul 2010 19:28:07 -0700 Subject: ir_to_mesa: Emit OPCODE_MAD when we find an ADD of a MUL. Bug #27914. --- src/mesa/shader/ir_to_mesa.cpp | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) (limited to 'src') diff --git a/src/mesa/shader/ir_to_mesa.cpp b/src/mesa/shader/ir_to_mesa.cpp index 467e335fc4..fc50d26a61 100644 --- a/src/mesa/shader/ir_to_mesa.cpp +++ b/src/mesa/shader/ir_to_mesa.cpp @@ -178,6 +178,9 @@ public: ir_to_mesa_src_reg src0, ir_to_mesa_src_reg src1); + GLboolean try_emit_mad(ir_expression *ir, + int mul_operand); + int *sampler_map; int sampler_map_size; @@ -530,6 +533,30 @@ ir_to_mesa_visitor::visit(ir_function *ir) } } +GLboolean +ir_to_mesa_visitor::try_emit_mad(ir_expression *ir, int mul_operand) +{ + int nonmul_operand = 1 - mul_operand; + ir_to_mesa_src_reg a, b, c; + + ir_expression *expr = ir->operands[mul_operand]->as_expression(); + if (!expr || expr->operation != ir_binop_mul) + return false; + + expr->operands[0]->accept(this); + a = this->result; + expr->operands[1]->accept(this); + b = this->result; + ir->operands[nonmul_operand]->accept(this); + c = this->result; + + this->result = get_temp(ir->type); + ir_to_mesa_emit_op3(ir, OPCODE_MAD, + ir_to_mesa_dst_reg_from_src(this->result), a, b, c); + + return true; +} + void ir_to_mesa_visitor::visit(ir_expression *ir) { @@ -541,6 +568,15 @@ ir_to_mesa_visitor::visit(ir_expression *ir) 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); + /* Quick peephole: Emit OPCODE_MAD(a, b, c) instead of ADD(MUL(a, b), c) + */ + if (ir->operation == ir_binop_add) { + if (try_emit_mad(ir, 1)) + return; + if (try_emit_mad(ir, 0)) + return; + } + for (operand = 0; operand < ir->get_num_operands(); operand++) { this->result.file = PROGRAM_UNDEFINED; ir->operands[operand]->accept(this); -- 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') 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 4ca07882afad656bf0a0f56b68038ce556bceec4 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 12 Jul 2010 17:57:46 -0700 Subject: ir_to_mesa: Rely on ir_mat_op_to_vec for matrix multiplication support. --- src/mesa/shader/ir_to_mesa.cpp | 88 +++--------------------------------------- 1 file changed, 5 insertions(+), 83 deletions(-) (limited to 'src') diff --git a/src/mesa/shader/ir_to_mesa.cpp b/src/mesa/shader/ir_to_mesa.cpp index fc50d26a61..110fc100db 100644 --- a/src/mesa/shader/ir_to_mesa.cpp +++ b/src/mesa/shader/ir_to_mesa.cpp @@ -588,9 +588,10 @@ ir_to_mesa_visitor::visit(ir_expression *ir) } op[operand] = this->result; - /* Only expression implemented for matrices yet */ - assert(!ir->operands[operand]->type->is_matrix() || - ir->operation == ir_binop_mul); + /* Matrix expression operands should have been broken down to vector + * operations already. + */ + assert(!ir->operands[operand]->type->is_matrix()); } this->result.file = PROGRAM_UNDEFINED; @@ -661,86 +662,7 @@ ir_to_mesa_visitor::visit(ir_expression *ir) break; case ir_binop_mul: - if (ir->operands[0]->type->is_matrix()) { - if (ir->operands[1]->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 { - /* matrix * vec or matrix * matrix */ - int op1_col; - ir_to_mesa_dst_reg dst_column = result_dst; - ir_to_mesa_src_reg dst_column_src; - ir_to_mesa_src_reg src_chan = op[1]; - - dst_column_src = ir_to_mesa_src_reg_from_dst(result_dst); - for (op1_col = 0; op1_col < ir->operands[1]->type->matrix_columns; - op1_col++) { - ir_to_mesa_src_reg src_column = op[0]; - - for (int i = 0; i < ir->operands[0]->type->matrix_columns; i++) { - src_chan.swizzle = MAKE_SWIZZLE4(i, i, i, i); - if (i == 0) { - ir_to_mesa_emit_op2(ir, OPCODE_MUL, - dst_column, src_column, src_chan); - } else { - ir_to_mesa_emit_op3(ir, OPCODE_MAD, - dst_column, src_column, src_chan, - dst_column_src); - } - src_column.index++; - } - src_chan.index++; - dst_column.index++; - dst_column_src.index++; - } - } - } else if (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[1]; - for (int i = 0; i < ir->operands[1]->type->matrix_columns; i++) { - ir_to_mesa_emit_op2(ir, OPCODE_MUL, - dst_column, src_column, op[0]); - dst_column.index++; - src_column.index++; - } - } else { - ir_to_mesa_src_reg src_column = op[1]; - ir_to_mesa_dst_reg dst_chan = result_dst; - - /* FINISHME here and above: non-square matrices */ - assert(ir->operands[1]->type->vector_elements == - ir->operands[1]->type->matrix_columns); - - for (int i = 0; i < ir->operands[0]->type->vector_elements; i++) { - dst_chan.writemask = (1 << i); - switch (ir->operands[0]->type->vector_elements) { - case 2: - ir_to_mesa_emit_op2(ir, OPCODE_DP2, dst_chan, op[0], src_column); - break; - case 3: - ir_to_mesa_emit_op2(ir, OPCODE_DP3, dst_chan, op[0], src_column); - break; - case 4: - ir_to_mesa_emit_op2(ir, OPCODE_DP4, dst_chan, op[0], src_column); - break; - default: - assert(0); - } - 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]); - } + ir_to_mesa_emit_op2(ir, OPCODE_MUL, result_dst, op[0], op[1]); break; case ir_binop_div: assert(!"not reached: should be handled by ir_div_to_mul_rcp"); -- 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') 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 f8a2b65bc9bf3dfb4a4aa6fe1c0ea65f78a01922 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 13 Jul 2010 09:05:28 -0700 Subject: ir_to_mesa: Add support for array dereferences on the LHS of assignments. The big change is to delay address reg setup until the instruction that needs the deref. It was hard to use the deref chain support for the LHS because it does the copy of the dereffed value to a temporary (to avoid problems when two src regs are array derefs), so we wouldn't haev a pointer to actual storage in the end. Fixes glsl-vs-arrays on swrast. --- src/mesa/shader/ir_to_mesa.cpp | 96 +++++++++++++++++++++++++++++------------- 1 file changed, 67 insertions(+), 29 deletions(-) (limited to 'src') diff --git a/src/mesa/shader/ir_to_mesa.cpp b/src/mesa/shader/ir_to_mesa.cpp index 110fc100db..f4a8ceb09e 100644 --- a/src/mesa/shader/ir_to_mesa.cpp +++ b/src/mesa/shader/ir_to_mesa.cpp @@ -61,7 +61,8 @@ typedef struct ir_to_mesa_src_reg { int index; /**< temporary index, VERT_ATTRIB_*, FRAG_ATTRIB_*, etc. */ GLuint swizzle; /**< SWIZZLE_XYZWONEZERO swizzles from Mesa. */ int negate; /**< NEGATE_XYZW mask from mesa */ - bool reladdr; /**< Register index should be offset by address reg. */ + /** Register index should be offset by the integer in this reg. */ + ir_to_mesa_src_reg *reladdr; } ir_to_mesa_src_reg; typedef struct ir_to_mesa_dst_reg { @@ -69,6 +70,8 @@ typedef struct ir_to_mesa_dst_reg { int index; /**< temporary index, VERT_ATTRIB_*, FRAG_ATTRIB_*, etc. */ int writemask; /**< Bitfield of WRITEMASK_[XYZW] */ GLuint cond_mask:4; + /** Register index should be offset by the integer in this reg. */ + ir_to_mesa_src_reg *reladdr; } ir_to_mesa_dst_reg; extern ir_to_mesa_src_reg ir_to_mesa_undef; @@ -111,6 +114,8 @@ public: temp_entry *find_variable_storage(ir_variable *var); ir_to_mesa_src_reg get_temp(const glsl_type *type); + void reladdr_to_temp(ir_instruction *ir, + ir_to_mesa_src_reg *reg, int *num_reladdr); struct ir_to_mesa_src_reg src_reg_for_float(float val); @@ -191,15 +196,15 @@ public: }; ir_to_mesa_src_reg ir_to_mesa_undef = { - PROGRAM_UNDEFINED, 0, SWIZZLE_NOOP, NEGATE_NONE, false, + PROGRAM_UNDEFINED, 0, SWIZZLE_NOOP, NEGATE_NONE, NULL, }; ir_to_mesa_dst_reg ir_to_mesa_undef_dst = { - PROGRAM_UNDEFINED, 0, SWIZZLE_NOOP, COND_TR + PROGRAM_UNDEFINED, 0, SWIZZLE_NOOP, COND_TR, NULL, }; ir_to_mesa_dst_reg ir_to_mesa_address_reg = { - PROGRAM_ADDRESS, 0, WRITEMASK_X, COND_TR + PROGRAM_ADDRESS, 0, WRITEMASK_X, COND_TR, NULL }; static int swizzle_for_size(int size) @@ -223,6 +228,28 @@ ir_to_mesa_visitor::ir_to_mesa_emit_op3(ir_instruction *ir, ir_to_mesa_src_reg src2) { ir_to_mesa_instruction *inst = new(mem_ctx) ir_to_mesa_instruction(); + int num_reladdr = 0; + + /* If we have to do relative addressing, we want to load the ARL + * reg directly for one of the regs, and preload the other reladdr + * sources into temps. + */ + num_reladdr += dst.reladdr != NULL; + num_reladdr += src0.reladdr != NULL; + num_reladdr += src1.reladdr != NULL; + num_reladdr += src2.reladdr != NULL; + + reladdr_to_temp(ir, &src2, &num_reladdr); + reladdr_to_temp(ir, &src1, &num_reladdr); + reladdr_to_temp(ir, &src0, &num_reladdr); + + if (dst.reladdr) { + ir_to_mesa_emit_op1(ir, OPCODE_ARL, ir_to_mesa_address_reg, + *dst.reladdr); + + num_reladdr--; + } + assert(num_reladdr == 0); inst->op = op; inst->dst_reg = dst; @@ -285,6 +312,7 @@ ir_to_mesa_dst_reg_from_src(ir_to_mesa_src_reg reg) dst_reg.index = reg.index; dst_reg.writemask = WRITEMASK_XYZW; dst_reg.cond_mask = COND_TR; + dst_reg.reladdr = reg.reladdr; return dst_reg; } @@ -298,7 +326,7 @@ ir_to_mesa_src_reg_from_dst(ir_to_mesa_dst_reg reg) src_reg.index = reg.index; src_reg.swizzle = SWIZZLE_XYZW; src_reg.negate = 0; - src_reg.reladdr = 0; + src_reg.reladdr = reg.reladdr; return src_reg; } @@ -378,7 +406,7 @@ ir_to_mesa_visitor::src_reg_for_float(float val) src_reg.file = PROGRAM_CONSTANT; src_reg.index = _mesa_add_unnamed_constant(this->prog->Parameters, &val, 1, &src_reg.swizzle); - src_reg.reladdr = GL_FALSE; + src_reg.reladdr = NULL; src_reg.negate = 0; return src_reg; @@ -435,7 +463,7 @@ ir_to_mesa_visitor::get_temp(const glsl_type *type) src_reg.file = PROGRAM_TEMPORARY; src_reg.index = next_temp; - src_reg.reladdr = false; + src_reg.reladdr = NULL; next_temp += type_size(type); for (i = 0; i < type->vector_elements; i++) @@ -557,6 +585,26 @@ ir_to_mesa_visitor::try_emit_mad(ir_expression *ir, int mul_operand) return true; } +void +ir_to_mesa_visitor::reladdr_to_temp(ir_instruction *ir, + ir_to_mesa_src_reg *reg, int *num_reladdr) +{ + if (!reg->reladdr) + return; + + ir_to_mesa_emit_op1(ir, OPCODE_ARL, ir_to_mesa_address_reg, *reg->reladdr); + + if (*num_reladdr != 1) { + ir_to_mesa_src_reg temp = get_temp(glsl_type::vec4_type); + + ir_to_mesa_emit_op1(ir, OPCODE_MOV, + ir_to_mesa_dst_reg_from_src(temp), *reg); + *reg = temp; + } + + (*num_reladdr)--; +} + void ir_to_mesa_visitor::visit(ir_expression *ir) { @@ -1045,7 +1093,7 @@ ir_to_mesa_visitor::visit(ir_dereference_variable *ir) 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.reladdr = NULL; src_reg.negate = 0; this->result = src_reg; @@ -1077,7 +1125,7 @@ ir_to_mesa_visitor::visit(ir_dereference_array *ir) src_reg.negate = 0; if (index) { - src_reg.reladdr = GL_FALSE; + src_reg.reladdr = NULL; } else { ir_to_mesa_src_reg index_reg = get_temp(glsl_type::float_type); @@ -1086,9 +1134,8 @@ ir_to_mesa_visitor::visit(ir_dereference_array *ir) ir_to_mesa_dst_reg_from_src(index_reg), this->result, src_reg_for_float(element_size)); - src_reg.reladdr = true; - ir_to_mesa_emit_op1(ir, OPCODE_ARL, ir_to_mesa_address_reg, - index_reg); + src_reg.reladdr = talloc(mem_ctx, ir_to_mesa_src_reg); + memcpy(src_reg.reladdr, &index_reg, sizeof(index_reg)); } this->result = src_reg; @@ -1126,17 +1173,10 @@ ir_to_mesa_visitor::visit(ir_dereference_array *ir) this->result, src_reg_for_float(element_size)); } - /* 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, - index_reg); - - 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); + src_reg.reladdr = talloc(mem_ctx, ir_to_mesa_src_reg); + memcpy(src_reg.reladdr, &index_reg, sizeof(index_reg)); + + this->result = src_reg; } } @@ -1183,9 +1223,6 @@ get_assignment_lhs(ir_instruction *ir, ir_to_mesa_visitor *v) /* This should have been handled by ir_vec_index_to_cond_assign */ if (deref_array) { assert(!deref_array->array->type->is_vector()); - - /* We don't handle relative addressing on the LHS yet. */ - assert(deref_array->array_index->constant_expression_value() != NULL); } /* Use the rvalue deref handler for the most part. We'll ignore @@ -1313,7 +1350,7 @@ ir_to_mesa_visitor::visit(ir_constant *ir) values, ir->type->vector_elements, &src_reg.swizzle); - src_reg.reladdr = false; + src_reg.reladdr = NULL; src_reg.negate = 0; ir_to_mesa_emit_op1(ir, OPCODE_MOV, mat_column, src_reg); @@ -1350,7 +1387,7 @@ ir_to_mesa_visitor::visit(ir_constant *ir) src_reg.index = _mesa_add_unnamed_constant(this->prog->Parameters, values, ir->type->vector_elements, &src_reg.swizzle); - src_reg.reladdr = false; + src_reg.reladdr = NULL; src_reg.negate = 0; this->result = src_reg; @@ -1578,7 +1615,7 @@ mesa_src_reg_from_ir_src_reg(ir_to_mesa_src_reg reg) assert(reg.index < (1 << INST_INDEX_BITS) - 1); mesa_reg.Index = reg.index; mesa_reg.Swizzle = reg.swizzle; - mesa_reg.RelAddr = reg.reladdr; + mesa_reg.RelAddr = reg.reladdr != NULL; mesa_reg.Negate = reg.negate; mesa_reg.Abs = 0; @@ -1813,6 +1850,7 @@ get_mesa_program(GLcontext *ctx, void *mem_ctx, struct gl_shader *shader) mesa_inst->DstReg.Index = inst->dst_reg.index; mesa_inst->DstReg.CondMask = inst->dst_reg.cond_mask; mesa_inst->DstReg.WriteMask = inst->dst_reg.writemask; + mesa_inst->DstReg.RelAddr = inst->dst_reg.reladdr != NULL; 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]); -- cgit v1.2.3 From 4d5da50b94115d055ba8d0ff8717054582665384 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 13 Jul 2010 09:46:26 -0700 Subject: ir_to_mesa: Add support for variable array indexing of builtin varyings. That is to say, gl_TexCoord[i] now works, fixing glsl-texcoord-array on swrast. --- src/mesa/shader/ir_to_mesa.cpp | 94 ++++++++++++++++++++++++++++-------------- 1 file changed, 62 insertions(+), 32 deletions(-) (limited to 'src') diff --git a/src/mesa/shader/ir_to_mesa.cpp b/src/mesa/shader/ir_to_mesa.cpp index f4a8ceb09e..fee9454723 100644 --- a/src/mesa/shader/ir_to_mesa.cpp +++ b/src/mesa/shader/ir_to_mesa.cpp @@ -1145,39 +1145,30 @@ ir_to_mesa_visitor::visit(ir_dereference_array *ir) 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]; + if (index) { + src_reg.index += index->value.i[0] * element_size; } else { - if (index) { - src_reg.index += index->value.i[0] * element_size; - } 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); - - ir_to_mesa_src_reg index_reg; - - if (element_size == 1) { - index_reg = this->result; - } else { - index_reg = get_temp(glsl_type::float_type); + 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); - ir_to_mesa_emit_op2(ir, OPCODE_MUL, - ir_to_mesa_dst_reg_from_src(index_reg), - this->result, src_reg_for_float(element_size)); - } + ir_to_mesa_src_reg index_reg; - src_reg.reladdr = talloc(mem_ctx, ir_to_mesa_src_reg); - memcpy(src_reg.reladdr, &index_reg, sizeof(index_reg)); + if (element_size == 1) { + index_reg = this->result; + } else { + index_reg = get_temp(glsl_type::float_type); - this->result = src_reg; + ir_to_mesa_emit_op2(ir, OPCODE_MUL, + ir_to_mesa_dst_reg_from_src(index_reg), + this->result, src_reg_for_float(element_size)); } + + src_reg.reladdr = talloc(mem_ctx, ir_to_mesa_src_reg); + memcpy(src_reg.reladdr, &index_reg, sizeof(index_reg)); } /* If the type is smaller than a vec4, replicate the last channel out. */ @@ -1717,6 +1708,44 @@ 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) { @@ -1732,10 +1761,10 @@ count_resources(struct gl_program *prog) switch (inst->DstReg.File) { case PROGRAM_OUTPUT: - prog->OutputsWritten |= BITFIELD64_BIT(inst->DstReg.Index); + mark_output(prog, inst->DstReg.Index, inst->DstReg.RelAddr); break; case PROGRAM_INPUT: - prog->InputsRead |= BITFIELD64_BIT(inst->DstReg.Index); + mark_input(prog, inst->DstReg.Index, inst->DstReg.RelAddr); break; default: break; @@ -1744,10 +1773,11 @@ count_resources(struct gl_program *prog) for (reg = 0; reg < _mesa_num_inst_src_regs(inst->Opcode); reg++) { switch (inst->SrcReg[reg].File) { case PROGRAM_OUTPUT: - prog->OutputsWritten |= BITFIELD64_BIT(inst->SrcReg[reg].Index); + mark_output(prog, inst->SrcReg[reg].Index, + inst->SrcReg[reg].RelAddr); break; case PROGRAM_INPUT: - prog->InputsRead |= BITFIELD64_BIT(inst->SrcReg[reg].Index); + mark_input(prog, inst->SrcReg[reg].Index, inst->SrcReg[reg].RelAddr); break; default: break; -- 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') 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 021222c6a872ca2eef770ebadb8754f659775204 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 13 Jul 2010 12:24:39 -0700 Subject: ir_to_mesa: Add convenience function for opcodes with no src/dst reg. Most of flow control is like this. --- src/mesa/shader/ir_to_mesa.cpp | 41 +++++++++++++++++++++-------------------- 1 file changed, 21 insertions(+), 20 deletions(-) (limited to 'src') diff --git a/src/mesa/shader/ir_to_mesa.cpp b/src/mesa/shader/ir_to_mesa.cpp index fee9454723..6ecc6d317c 100644 --- a/src/mesa/shader/ir_to_mesa.cpp +++ b/src/mesa/shader/ir_to_mesa.cpp @@ -154,6 +154,9 @@ public: /** List of ir_to_mesa_instruction */ exec_list instructions; + ir_to_mesa_instruction *ir_to_mesa_emit_op0(ir_instruction *ir, + enum prog_opcode op); + ir_to_mesa_instruction *ir_to_mesa_emit_op1(ir_instruction *ir, enum prog_opcode op, ir_to_mesa_dst_reg dst, @@ -284,6 +287,16 @@ ir_to_mesa_visitor::ir_to_mesa_emit_op1(ir_instruction *ir, src0, ir_to_mesa_undef, ir_to_mesa_undef); } +ir_to_mesa_instruction * +ir_to_mesa_visitor::ir_to_mesa_emit_op0(ir_instruction *ir, + enum prog_opcode op) +{ + return ir_to_mesa_emit_op3(ir, op, ir_to_mesa_undef_dst, + ir_to_mesa_undef, + ir_to_mesa_undef, + ir_to_mesa_undef); +} + void ir_to_mesa_visitor::map_sampler(int location, int sampler) { @@ -507,13 +520,9 @@ ir_to_mesa_visitor::visit(ir_loop *ir) assert(!ir->increment); assert(!ir->counter); - ir_to_mesa_emit_op1(NULL, OPCODE_BGNLOOP, - ir_to_mesa_undef_dst, ir_to_mesa_undef); - + ir_to_mesa_emit_op0(NULL, OPCODE_BGNLOOP); visit_exec_list(&ir->body_instructions, this); - - ir_to_mesa_emit_op1(NULL, OPCODE_ENDLOOP, - ir_to_mesa_undef_dst, ir_to_mesa_undef); + ir_to_mesa_emit_op0(NULL, OPCODE_ENDLOOP); } void @@ -521,12 +530,10 @@ 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); + ir_to_mesa_emit_op0(NULL, OPCODE_BRK); break; case ir_loop_jump::jump_continue: - ir_to_mesa_emit_op1(NULL, OPCODE_CONT, - ir_to_mesa_undef_dst, ir_to_mesa_undef); + ir_to_mesa_emit_op0(NULL, OPCODE_CONT); break; } } @@ -1534,8 +1541,7 @@ ir_to_mesa_visitor::visit(ir_discard *ir) { assert(ir->condition == NULL); /* FINISHME */ - ir_to_mesa_emit_op1(ir, OPCODE_KIL_NV, - ir_to_mesa_undef_dst, ir_to_mesa_undef); + ir_to_mesa_emit_op0(ir, OPCODE_KIL_NV); } void @@ -1564,9 +1570,7 @@ ir_to_mesa_visitor::visit(ir_if *ir) } cond_inst->cond_update = GL_TRUE; - if_inst = ir_to_mesa_emit_op1(ir->condition, - OPCODE_IF, ir_to_mesa_undef_dst, - ir_to_mesa_undef); + if_inst = ir_to_mesa_emit_op0(ir->condition, OPCODE_IF); if_inst->dst_reg.cond_mask = COND_NE; } else { if_inst = ir_to_mesa_emit_op1(ir->condition, @@ -1579,9 +1583,7 @@ ir_to_mesa_visitor::visit(ir_if *ir) 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); + else_inst = ir_to_mesa_emit_op0(ir->condition, OPCODE_ELSE); visit_exec_list(&ir->else_instructions, this); } @@ -1853,8 +1855,7 @@ get_mesa_program(GLcontext *ctx, void *mem_ctx, struct gl_shader *shader) v.mem_ctx = talloc_new(NULL); visit_exec_list(shader->ir, &v); - v.ir_to_mesa_emit_op1(NULL, OPCODE_END, - ir_to_mesa_undef_dst, ir_to_mesa_undef); + v.ir_to_mesa_emit_op0(NULL, OPCODE_END); prog->NumTemporaries = v.next_temp; -- 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') 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') 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') 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') 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') 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') 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') 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') 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') 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') 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') 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') 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') 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') 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') 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') 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') 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') 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') 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') 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') 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 7b130149427019ac9ae6d39b6871c14fb6ba2dad Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 13 Jul 2010 12:22:05 -0700 Subject: ir_to_mesa: Add support for function calls. Unlike the previous compiler, in this case we emit only one copy of the function regardless of how many times it's called. --- src/mesa/shader/ir_to_mesa.cpp | 233 +++++++++++++++++++++++++++++++++++++++-- 1 file changed, 227 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/mesa/shader/ir_to_mesa.cpp b/src/mesa/shader/ir_to_mesa.cpp index f99a1fc450..6d1837f59e 100644 --- a/src/mesa/shader/ir_to_mesa.cpp +++ b/src/mesa/shader/ir_to_mesa.cpp @@ -87,6 +87,8 @@ public: int sampler; /**< sampler index */ int tex_target; /**< One of TEXTURE_*_INDEX */ GLboolean tex_shadow; + + class function_entry *function; /* Set on OPCODE_CAL or OPCODE_BGNSUB */ }; class temp_entry : public exec_node { @@ -102,10 +104,45 @@ public: ir_variable *var; /* variable that maps to this, if any */ }; +class function_entry : public exec_node { +public: + ir_function_signature *sig; + + /** + * identifier of this function signature used by the program. + * + * At the point that Mesa instructions for function calls are + * generated, we don't know the address of the first instruction of + * the function body. So we make the BranchTarget that is called a + * small integer and rewrite them during set_branchtargets(). + */ + int sig_id; + + /** + * Pointer to first instruction of the function body. + * + * Set during function body emits after main() is processed. + */ + ir_to_mesa_instruction *bgn_inst; + + /** + * Index of the first instruction of the function body in actual + * Mesa IR. + * + * Set after convertion from ir_to_mesa_instruction to prog_instruction. + */ + int inst; + + /** Storage for the return value. */ + ir_to_mesa_src_reg return_reg; +}; + class ir_to_mesa_visitor : public ir_visitor { public: ir_to_mesa_visitor(); + function_entry *current_function; + GLcontext *ctx; struct gl_program *prog; @@ -113,6 +150,8 @@ public: temp_entry *find_variable_storage(ir_variable *var); + function_entry *get_function_signature(ir_function_signature *sig); + ir_to_mesa_src_reg get_temp(const glsl_type *type); void reladdr_to_temp(ir_instruction *ir, ir_to_mesa_src_reg *reg, int *num_reladdr); @@ -151,6 +190,10 @@ public: /** List of temp_entry */ exec_list variable_storage; + /** List of function_entry */ + exec_list function_signatures; + int next_signature_id; + /** List of ir_to_mesa_instruction */ exec_list instructions; @@ -261,6 +304,8 @@ ir_to_mesa_visitor::ir_to_mesa_emit_op3(ir_instruction *ir, inst->src_reg[2] = src2; inst->ir = ir; + inst->function = NULL; + this->instructions.push_tail(inst); return inst; @@ -1396,12 +1441,128 @@ ir_to_mesa_visitor::visit(ir_constant *ir) this->result = src_reg; } +function_entry * +ir_to_mesa_visitor::get_function_signature(ir_function_signature *sig) +{ + function_entry *entry; + + foreach_iter(exec_list_iterator, iter, this->function_signatures) { + entry = (function_entry *)iter.get(); + + if (entry->sig == sig) + return entry; + } + + entry = talloc(mem_ctx, function_entry); + entry->sig = sig; + entry->sig_id = this->next_signature_id++; + entry->bgn_inst = NULL; + + /* Allocate storage for all the parameters. */ + foreach_iter(exec_list_iterator, iter, sig->parameters) { + ir_variable *param = (ir_variable *)iter.get(); + temp_entry *storage; + + storage = find_variable_storage(param); + assert(!storage); + + storage = new(mem_ctx) temp_entry(param, PROGRAM_TEMPORARY, + this->next_temp); + this->variable_storage.push_tail(storage); + + this->next_temp += type_size(param->type); + break; + } + + if (sig->return_type) { + entry->return_reg = get_temp(sig->return_type); + } else { + entry->return_reg = ir_to_mesa_undef; + } + + this->function_signatures.push_tail(entry); + return entry; +} void ir_to_mesa_visitor::visit(ir_call *ir) { - printf("Can't support call to %s\n", ir->callee_name()); - exit(1); + ir_to_mesa_instruction *call_inst; + ir_function_signature *sig = ir->get_callee(); + function_entry *entry = get_function_signature(sig); + int i; + + /* Process in parameters. */ + exec_list_iterator sig_iter = sig->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_in || + param->mode == ir_var_inout) { + temp_entry *storage = find_variable_storage(param); + assert(storage); + + param_rval->accept(this); + ir_to_mesa_src_reg r = this->result; + + ir_to_mesa_dst_reg l; + l.file = storage->file; + l.index = storage->index; + l.reladdr = NULL; + l.writemask = WRITEMASK_XYZW; + l.cond_mask = COND_TR; + + for (i = 0; i < type_size(param->type); i++) { + ir_to_mesa_emit_op1(ir, OPCODE_MOV, l, r); + l.index++; + r.index++; + } + } + + sig_iter.next(); + } + assert(!sig_iter.has_next()); + + /* Emit call instruction */ + call_inst = ir_to_mesa_emit_op1(ir, OPCODE_CAL, + ir_to_mesa_undef_dst, ir_to_mesa_undef); + call_inst->function = entry; + + /* Process out parameters. */ + sig_iter = sig->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) { + temp_entry *storage = find_variable_storage(param); + assert(storage); + + ir_to_mesa_src_reg r; + r.file = storage->file; + r.index = storage->index; + r.reladdr = NULL; + r.swizzle = SWIZZLE_NOOP; + r.negate = 0; + + param_rval->accept(this); + ir_to_mesa_dst_reg l = ir_to_mesa_dst_reg_from_src(this->result); + + for (i = 0; i < type_size(param->type); i++) { + ir_to_mesa_emit_op1(ir, OPCODE_MOV, l, r); + l.index++; + r.index++; + } + } + + sig_iter.next(); + } + assert(!sig_iter.has_next()); + + /* Process return value. */ + this->result = entry->return_reg; } @@ -1536,9 +1697,25 @@ ir_to_mesa_visitor::visit(ir_texture *ir) void ir_to_mesa_visitor::visit(ir_return *ir) { - assert(0); + assert(current_function); + + if (ir->get_value()) { + ir_to_mesa_dst_reg l; + int i; + + ir->get_value()->accept(this); + ir_to_mesa_src_reg r = this->result; - ir->get_value()->accept(this); + l = ir_to_mesa_dst_reg_from_src(current_function->return_reg); + + for (i = 0; i < type_size(current_function->sig->return_type); i++) { + ir_to_mesa_emit_op1(ir, OPCODE_MOV, l, r); + l.index++; + r.index++; + } + } + + ir_to_mesa_emit_op0(ir, OPCODE_RET); } void @@ -1600,8 +1777,10 @@ ir_to_mesa_visitor::ir_to_mesa_visitor() { result.file = PROGRAM_UNDEFINED; next_temp = 1; + next_signature_id = 1; sampler_map = NULL; sampler_map_size = 0; + current_function = NULL; } static struct prog_src_register @@ -1621,7 +1800,8 @@ mesa_src_reg_from_ir_src_reg(ir_to_mesa_src_reg reg) } static void -set_branchtargets(struct prog_instruction *mesa_instructions, +set_branchtargets(ir_to_mesa_visitor *v, + struct prog_instruction *mesa_instructions, int num_instructions) { int if_count = 0, loop_count = 0; @@ -1684,6 +1864,17 @@ set_branchtargets(struct prog_instruction *mesa_instructions, /* 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; + break; + case OPCODE_CAL: + foreach_iter(exec_list_iterator, iter, v->function_signatures) { + function_entry *entry = (function_entry *)iter.get(); + + if (entry->sig_id == mesa_instructions[i].BranchTarget) { + mesa_instructions[i].BranchTarget = entry->inst; + break; + } + } + break; default: break; } @@ -1842,6 +2033,7 @@ get_mesa_program(GLcontext *ctx, void *mem_ctx, struct gl_shader *shader) int i; struct gl_program *prog; GLenum target; + GLboolean progress; switch (shader->Type) { case GL_VERTEX_SHADER: target = GL_VERTEX_PROGRAM_ARB; break; @@ -1859,9 +2051,33 @@ get_mesa_program(GLcontext *ctx, void *mem_ctx, struct gl_shader *shader) v.prog = prog; v.mem_ctx = talloc_new(NULL); + + /* Emit Mesa IR for main(). */ visit_exec_list(shader->ir, &v); v.ir_to_mesa_emit_op0(NULL, OPCODE_END); + /* Now emit bodies for any functions that were used. */ + do { + progress = GL_FALSE; + + foreach_iter(exec_list_iterator, iter, v.function_signatures) { + function_entry *entry = (function_entry *)iter.get(); + + if (!entry->bgn_inst) { + v.current_function = entry; + + entry->bgn_inst = v.ir_to_mesa_emit_op0(NULL, OPCODE_BGNSUB); + entry->bgn_inst->function = entry; + + visit_exec_list(&entry->sig->body, &v); + + entry->bgn_inst = v.ir_to_mesa_emit_op0(NULL, OPCODE_RET); + entry->bgn_inst = v.ir_to_mesa_emit_op0(NULL, OPCODE_ENDSUB); + progress = GL_TRUE; + } + } + } while (progress); + prog->NumTemporaries = v.next_temp; int num_instructions = 0; @@ -1895,11 +2111,16 @@ get_mesa_program(GLcontext *ctx, void *mem_ctx, struct gl_shader *shader) mesa_inst->TexShadow = inst->tex_shadow; mesa_instruction_annotation[i] = inst->ir; + if (mesa_inst->Opcode == OPCODE_BGNSUB) + inst->function->inst = i; + else if (mesa_inst->Opcode == OPCODE_CAL) + mesa_inst->BranchTarget = inst->function->sig_id; /* rewritten later */ + mesa_inst++; i++; } - set_branchtargets(mesa_instructions, num_instructions); + set_branchtargets(&v, mesa_instructions, num_instructions); if (0) { print_program(mesa_instructions, mesa_instruction_annotation, num_instructions); -- cgit v1.2.3 From b29d31cd67a423995b5673fdeedea82dfa12ec3c Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Sun, 18 Jul 2010 17:57:19 -0700 Subject: ir_to_mesa: Rename struct temp_entry, which is used for all variables now. --- src/mesa/shader/ir_to_mesa.cpp | 71 +++++++++++++++++++++--------------------- 1 file changed, 36 insertions(+), 35 deletions(-) (limited to 'src') diff --git a/src/mesa/shader/ir_to_mesa.cpp b/src/mesa/shader/ir_to_mesa.cpp index 6d1837f59e..c75a13d06e 100644 --- a/src/mesa/shader/ir_to_mesa.cpp +++ b/src/mesa/shader/ir_to_mesa.cpp @@ -91,9 +91,9 @@ public: class function_entry *function; /* Set on OPCODE_CAL or OPCODE_BGNSUB */ }; -class temp_entry : public exec_node { +class variable_storage : public exec_node { public: - temp_entry(ir_variable *var, int file, int index) + variable_storage(ir_variable *var, int file, int index) : file(file), index(index), var(var) { /* empty */ @@ -148,7 +148,7 @@ public: int next_temp; - temp_entry *find_variable_storage(ir_variable *var); + variable_storage *find_variable_storage(ir_variable *var); function_entry *get_function_signature(ir_function_signature *sig); @@ -187,8 +187,8 @@ public: struct ir_to_mesa_src_reg result; - /** List of temp_entry */ - exec_list variable_storage; + /** List of variable_storage */ + exec_list variables; /** List of function_entry */ exec_list function_signatures; @@ -535,14 +535,14 @@ ir_to_mesa_visitor::get_temp(const glsl_type *type) return src_reg; } -temp_entry * +variable_storage * ir_to_mesa_visitor::find_variable_storage(ir_variable *var) { - temp_entry *entry; + variable_storage *entry; - foreach_iter(exec_list_iterator, iter, this->variable_storage) { - entry = (temp_entry *)iter.get(); + foreach_iter(exec_list_iterator, iter, this->variables) { + entry = (variable_storage *)iter.get(); if (entry->var == var) return entry; @@ -968,7 +968,7 @@ add_matrix_ref(struct gl_program *prog, int *tokens) return base_pos; } -static temp_entry * +static variable_storage * get_builtin_matrix_ref(void *mem_ctx, struct gl_program *prog, ir_variable *var, ir_rvalue *array_index) { @@ -1006,7 +1006,7 @@ get_builtin_matrix_ref(void *mem_ctx, struct gl_program *prog, ir_variable *var, }; unsigned int i; - temp_entry *entry; + variable_storage *entry; /* C++ gets angry when we try to use an int as a gl_state_index, so we use * ints for gl_state_index. Make sure they're compatible. @@ -1041,9 +1041,9 @@ get_builtin_matrix_ref(void *mem_ctx, struct gl_program *prog, ir_variable *var, } tokens[4] = matrices[i].modifier; - entry = new(mem_ctx) temp_entry(var, - PROGRAM_STATE_VAR, - base_pos); + entry = new(mem_ctx) variable_storage(var, + PROGRAM_STATE_VAR, + base_pos); return entry; } @@ -1056,7 +1056,7 @@ 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); + variable_storage *entry = find_variable_storage(ir->var); unsigned int loc; if (!entry) { @@ -1078,8 +1078,9 @@ ir_to_mesa_visitor::visit(ir_dereference_variable *ir) 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); + entry = new(mem_ctx) variable_storage(ir->var, PROGRAM_SAMPLER, + sampler); + this->variables.push_tail(entry); break; } @@ -1096,8 +1097,8 @@ ir_to_mesa_visitor::visit(ir_dereference_variable *ir) */ this->prog->Parameters->Parameters[loc].Used = GL_TRUE; - entry = new(mem_ctx) temp_entry(ir->var, PROGRAM_UNIFORM, loc); - this->variable_storage.push_tail(entry); + entry = new(mem_ctx) variable_storage(ir->var, PROGRAM_UNIFORM, loc); + this->variables.push_tail(entry); break; case ir_var_in: case ir_var_out: @@ -1112,9 +1113,9 @@ ir_to_mesa_visitor::visit(ir_dereference_variable *ir) assert(ir->var->location != -1); if (ir->var->mode == ir_var_in || ir->var->mode == ir_var_inout) { - entry = new(mem_ctx) temp_entry(ir->var, - PROGRAM_INPUT, - ir->var->location); + entry = new(mem_ctx) variable_storage(ir->var, + PROGRAM_INPUT, + ir->var->location); if (this->prog->Target == GL_VERTEX_PROGRAM_ARB && ir->var->location >= VERT_ATTRIB_GENERIC0) { @@ -1125,16 +1126,16 @@ ir_to_mesa_visitor::visit(ir_dereference_variable *ir) ir->var->location - VERT_ATTRIB_GENERIC0); } } else { - entry = new(mem_ctx) temp_entry(ir->var, - PROGRAM_OUTPUT, - ir->var->location); + entry = new(mem_ctx) variable_storage(ir->var, + PROGRAM_OUTPUT, + ir->var->location); } break; case ir_var_auto: - entry = new(mem_ctx) temp_entry(ir->var, PROGRAM_TEMPORARY, - this->next_temp); - this->variable_storage.push_tail(entry); + entry = new(mem_ctx) variable_storage(ir->var, PROGRAM_TEMPORARY, + this->next_temp); + this->variables.push_tail(entry); next_temp += type_size(ir->var->type); break; @@ -1170,7 +1171,7 @@ ir_to_mesa_visitor::visit(ir_dereference_array *ir) "gl_TextureMatrix", strlen("gl_TextureMatrix")) == 0) { ir_to_mesa_src_reg src_reg; - struct temp_entry *entry; + struct variable_storage *entry; entry = get_builtin_matrix_ref(this->mem_ctx, this->prog, deref_var->var, ir->array_index); @@ -1461,14 +1462,14 @@ ir_to_mesa_visitor::get_function_signature(ir_function_signature *sig) /* Allocate storage for all the parameters. */ foreach_iter(exec_list_iterator, iter, sig->parameters) { ir_variable *param = (ir_variable *)iter.get(); - temp_entry *storage; + variable_storage *storage; storage = find_variable_storage(param); assert(!storage); - storage = new(mem_ctx) temp_entry(param, PROGRAM_TEMPORARY, - this->next_temp); - this->variable_storage.push_tail(storage); + storage = new(mem_ctx) variable_storage(param, PROGRAM_TEMPORARY, + this->next_temp); + this->variables.push_tail(storage); this->next_temp += type_size(param->type); break; @@ -1500,7 +1501,7 @@ ir_to_mesa_visitor::visit(ir_call *ir) if (param->mode == ir_var_in || param->mode == ir_var_inout) { - temp_entry *storage = find_variable_storage(param); + variable_storage *storage = find_variable_storage(param); assert(storage); param_rval->accept(this); @@ -1537,7 +1538,7 @@ ir_to_mesa_visitor::visit(ir_call *ir) if (param->mode == ir_var_out || param->mode == ir_var_inout) { - temp_entry *storage = find_variable_storage(param); + variable_storage *storage = find_variable_storage(param); assert(storage); ir_to_mesa_src_reg r; -- cgit v1.2.3 From 4802fd905ae7c1a1122ec71c0556c2b19214a7fd Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 19 Jul 2010 09:44:30 -0700 Subject: ir_to_mesa: Don't do lowering passes on an errored-out shader. --- src/mesa/shader/ir_to_mesa.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/mesa/shader/ir_to_mesa.cpp b/src/mesa/shader/ir_to_mesa.cpp index c75a13d06e..a7799cc01d 100644 --- a/src/mesa/shader/ir_to_mesa.cpp +++ b/src/mesa/shader/ir_to_mesa.cpp @@ -2185,13 +2185,13 @@ _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_mat_op_to_vec(shader->ir); - do_mod_to_fract(shader->ir); - do_div_to_mul_rcp(shader->ir); - - /* Optimization passes */ if (!state->error && !shader->ir->is_empty()) { + /* Lowering */ + do_mat_op_to_vec(shader->ir); + do_mod_to_fract(shader->ir); + do_div_to_mul_rcp(shader->ir); + + /* Optimization passes */ bool progress; do { progress = false; -- cgit v1.2.3 From ee7b2b3f44d09c2311887d3524e197b9738580a9 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 19 Jul 2010 08:55:54 -0700 Subject: ir_to_mesa: Do validation on the IR tree. --- src/mesa/shader/ir_to_mesa.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src') diff --git a/src/mesa/shader/ir_to_mesa.cpp b/src/mesa/shader/ir_to_mesa.cpp index a7799cc01d..84cfff4010 100644 --- a/src/mesa/shader/ir_to_mesa.cpp +++ b/src/mesa/shader/ir_to_mesa.cpp @@ -2186,6 +2186,8 @@ _mesa_glsl_compile_shader(GLcontext *ctx, struct gl_shader *shader) _mesa_ast_to_hir(shader->ir, state); 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); @@ -2213,6 +2215,8 @@ _mesa_glsl_compile_shader(GLcontext *ctx, struct gl_shader *shader) progress = do_swizzle_swizzle(shader->ir) || progress; } while (progress); + + validate_ir_tree(shader->ir); } shader->symbols = state->symbols; -- 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') 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') 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 95c08920ea3d040360e5cc51d8a852d21a0329ee Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 19 Jul 2010 10:21:58 -0700 Subject: i915: Ask the compiler to flatten out all the if statements that it can. --- src/mesa/drivers/dri/i915/i915_context.c | 2 ++ src/mesa/main/mtypes.h | 5 +++++ src/mesa/shader/ir_to_mesa.cpp | 13 ++++++++++++- src/mesa/shader/shader_api.c | 1 + 4 files changed, 20 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i915/i915_context.c b/src/mesa/drivers/dri/i915/i915_context.c index b3fe1c05d6..d8715cf026 100644 --- a/src/mesa/drivers/dri/i915/i915_context.c +++ b/src/mesa/drivers/dri/i915/i915_context.c @@ -174,6 +174,8 @@ i915CreateContext(int api, ctx->FragmentProgram._MaintainTexEnvProgram = GL_TRUE; + ctx->Shader.EmitNoIfs = GL_TRUE; + ctx->Const.MaxDrawBuffers = 1; _tnl_init_vertices(ctx, ctx->Const.MaxArrayLockSize + 12, diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 9a36740c41..be9eaaa875 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -2038,6 +2038,11 @@ struct gl_shader_state GLboolean EmitCondCodes; /**< Use condition codes? */ GLboolean EmitComments; /**< Annotated instructions */ GLboolean EmitNVTempInitialization; /**< 0-fill NV temp registers */ + /** + * Attempts to flatten all ir_if (OPCODE_IF) for GPUs that can't + * support control flow. + */ + GLboolean EmitNoIfs; void *MemPool; GLbitfield Flags; /**< Mask of GLSL_x flags */ struct gl_sl_pragmas DefaultPragmas; /**< Default #pragma settings */ diff --git a/src/mesa/shader/ir_to_mesa.cpp b/src/mesa/shader/ir_to_mesa.cpp index 84cfff4010..58320c9217 100644 --- a/src/mesa/shader/ir_to_mesa.cpp +++ b/src/mesa/shader/ir_to_mesa.cpp @@ -2026,8 +2026,10 @@ link_uniforms_to_shared_uniform_list(struct gl_uniform_list *uniforms, } struct gl_program * -get_mesa_program(GLcontext *ctx, void *mem_ctx, struct gl_shader *shader) +get_mesa_program(GLcontext *ctx, struct gl_shader_program *shader_program, + struct gl_shader *shader) { + void *mem_ctx = shader_program; ir_to_mesa_visitor v; struct prog_instruction *mesa_instructions, *mesa_inst; ir_instruction **mesa_instruction_annotation; @@ -2112,6 +2114,13 @@ get_mesa_program(GLcontext *ctx, void *mem_ctx, struct gl_shader *shader) mesa_inst->TexShadow = inst->tex_shadow; mesa_instruction_annotation[i] = inst->ir; + if (ctx->Shader.EmitNoIfs && mesa_inst->Opcode == OPCODE_IF) { + shader_program->InfoLog = + talloc_asprintf_append(shader_program->InfoLog, + "Couldn't flatten if statement\n"); + shader_program->LinkStatus = false; + } + if (mesa_inst->Opcode == OPCODE_BGNSUB) inst->function->inst = i; else if (mesa_inst->Opcode == OPCODE_CAL) @@ -2206,6 +2215,8 @@ _mesa_glsl_compile_shader(GLcontext *ctx, struct gl_shader *shader) progress = do_constant_variable_unlinked(shader->ir) || progress; progress = do_constant_folding(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 diff --git a/src/mesa/shader/shader_api.c b/src/mesa/shader/shader_api.c index f05ebc9fcb..cd02d7d830 100644 --- a/src/mesa/shader/shader_api.c +++ b/src/mesa/shader/shader_api.c @@ -431,6 +431,7 @@ _mesa_init_shader_state(GLcontext * ctx) ctx->Shader.EmitContReturn = GL_TRUE; ctx->Shader.EmitCondCodes = GL_FALSE; ctx->Shader.EmitComments = GL_FALSE; + ctx->Shader.EmitNoIfs = GL_FALSE; ctx->Shader.Flags = get_shader_flags(); /* Default pragma settings */ -- 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') 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') 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') 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') 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') 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') 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') 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') 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') 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') 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') 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') 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') 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') 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') 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') 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') 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 18ab797d3aff776833fac1bd0ea01a2750f377b1 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 20 Jul 2010 11:14:33 -0700 Subject: ir_to_mesa: Fix swizzled writemasks with swapped component ordering. I hadn't noticed you could do this, but glsl1 tests caught it. Fixes: glsl1-Swizzled writemask glsl1-Swizzled writemask (2) glsl1-Swizzled writemask (rgba) glsl1-Swizzled writemask (stpq) --- src/mesa/shader/ir_to_mesa.cpp | 61 +++++++++++++++++++----------------------- 1 file changed, 27 insertions(+), 34 deletions(-) (limited to 'src') diff --git a/src/mesa/shader/ir_to_mesa.cpp b/src/mesa/shader/ir_to_mesa.cpp index 557f5d319d..848fb0fb6c 100644 --- a/src/mesa/shader/ir_to_mesa.cpp +++ b/src/mesa/shader/ir_to_mesa.cpp @@ -1263,7 +1263,8 @@ ir_to_mesa_visitor::visit(ir_dereference_record *ir) * 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_instruction *ir, ir_to_mesa_visitor *v, + ir_to_mesa_src_reg *r) { struct ir_to_mesa_dst_reg dst_reg; ir_swizzle *swiz; @@ -1281,41 +1282,35 @@ get_assignment_lhs(ir_instruction *ir, ir_to_mesa_visitor *v) dst_reg = ir_to_mesa_dst_reg_from_src(v->result); 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; -} + 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; -static GLuint -reswizzle_for_writemask(GLuint writemask, GLuint swizzle) -{ - int new_swizzle[4], pos = 0; - int i; + for (i = 0; i < 4; i++) { + new_r_swizzle[i] = GET_SWZ(orig_r_swizzle, 0); + } - /* reswizzle the rhs so the components are in place for the - * components we'll assign to the lhs. - */ - for (i = 0; i < 4; i++) { - if (writemask & (1 << i)) { - new_swizzle[i] = GET_SWZ(swizzle, pos++); - } else { - new_swizzle[i] = GET_SWZ(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 MAKE_SWIZZLE4(new_swizzle[0], - new_swizzle[1], - new_swizzle[2], - new_swizzle[3]); + return dst_reg; } void @@ -1328,12 +1323,10 @@ ir_to_mesa_visitor::visit(ir_assignment *ir) 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; - r.swizzle = reswizzle_for_writemask(l.writemask, r.swizzle); + l = get_assignment_lhs(ir->lhs, this, &r); assert(l.file != PROGRAM_UNDEFINED); assert(r.file != PROGRAM_UNDEFINED); -- 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') 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') 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') 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') 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') 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') 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') 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') 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') 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') 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') 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') 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 d4f239de6e988a59d4ba3783ea325aa1552c3f5a Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Mon, 19 Jul 2010 18:01:43 -0700 Subject: hash_table: Add new hash_table_remove function. To allow for the removal of a single element from a hash table. --- src/mesa/shader/hash_table.c | 17 +++++++++++++++++ src/mesa/shader/hash_table.h | 4 ++++ 2 files changed, 21 insertions(+) (limited to 'src') diff --git a/src/mesa/shader/hash_table.c b/src/mesa/shader/hash_table.c index 933e300abd..f7ef366c1a 100644 --- a/src/mesa/shader/hash_table.c +++ b/src/mesa/shader/hash_table.c @@ -142,6 +142,23 @@ hash_table_insert(struct hash_table *ht, void *data, const void *key) insert_at_head(& ht->buckets[bucket], & node->link); } +void +hash_table_remove(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) { + remove_from_list(node); + free(node); + return; + } + } +} unsigned hash_table_string_hash(const void *key) diff --git a/src/mesa/shader/hash_table.h b/src/mesa/shader/hash_table.h index 0552691464..228ab948ff 100644 --- a/src/mesa/shader/hash_table.h +++ b/src/mesa/shader/hash_table.h @@ -94,6 +94,10 @@ extern void *hash_table_find(struct hash_table *ht, const void *key); extern void hash_table_insert(struct hash_table *ht, void *data, const void *key); +/** + * Remove a specific element from a hash table. + */ +extern void hash_table_remove(struct hash_table *ht, const void *key); /** * Compute hash value of a string -- 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') 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') 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') 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') 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') 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') 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') 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') 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') 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') 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') 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') 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') 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') 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') 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') 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') 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') 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') 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 1124e5a3cbba839ffd968742bfa3295c8de5498c Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 20 Jul 2010 17:19:57 -0700 Subject: ir_to_mesa: Validate the linked shaders as well. This caught the failure in cloning of ir_dereference_record. --- src/mesa/shader/ir_to_mesa.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/mesa/shader/ir_to_mesa.cpp b/src/mesa/shader/ir_to_mesa.cpp index 5803960d44..352b496625 100644 --- a/src/mesa/shader/ir_to_mesa.cpp +++ b/src/mesa/shader/ir_to_mesa.cpp @@ -2037,6 +2037,8 @@ get_mesa_program(GLcontext *ctx, struct gl_shader_program *shader_program, default: assert(!"should not be reached"); break; } + validate_ir_tree(shader->ir); + prog = ctx->Driver.NewProgram(ctx, target, 1); if (!prog) return NULL; -- 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') 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') 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') 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') 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') 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') 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') 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 56d33f8e2be1695c951a811fac1800117c2ca406 Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Wed, 21 Jul 2010 13:50:38 -0700 Subject: ir_to_mesa: Add missing initializion of lod_info variable. To quiet a compiler warning. --- src/mesa/shader/ir_to_mesa.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/shader/ir_to_mesa.cpp b/src/mesa/shader/ir_to_mesa.cpp index d1c09febd6..a2b2eb95c8 100644 --- a/src/mesa/shader/ir_to_mesa.cpp +++ b/src/mesa/shader/ir_to_mesa.cpp @@ -1564,7 +1564,7 @@ ir_to_mesa_visitor::visit(ir_call *ir) void ir_to_mesa_visitor::visit(ir_texture *ir) { - ir_to_mesa_src_reg result_src, coord, lod_info, projector; + ir_to_mesa_src_reg result_src, coord, lod_info = { 0 }, projector; ir_to_mesa_dst_reg result_dst, coord_dst; ir_to_mesa_instruction *inst = NULL; prog_opcode opcode = OPCODE_NOP; -- 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') 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') 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') 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') 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') 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') 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') 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') 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') 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') 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') 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') 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') 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') 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') 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 7095e2f860b91288c89c57add438e912e10df38e Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 21 Jul 2010 23:21:23 -0700 Subject: glsl2: Use talloc on InfoLog handling in ValidateProgram Fixes a segfault in Regnum Online. --- src/mesa/shader/shader_api.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/mesa/shader/shader_api.c b/src/mesa/shader/shader_api.c index cd02d7d830..1c1665308e 100644 --- a/src/mesa/shader/shader_api.c +++ b/src/mesa/shader/shader_api.c @@ -1380,9 +1380,9 @@ _mesa_validate_program(GLcontext *ctx, GLuint program) if (!shProg->Validated) { /* update info log */ if (shProg->InfoLog) { - free(shProg->InfoLog); + talloc_free(shProg->InfoLog); } - shProg->InfoLog = _mesa_strdup(errMsg); + shProg->InfoLog = talloc_strdup(shProg, errMsg); } } -- cgit v1.2.3 From c8d0a9f0065c321308be635529c95735f3beb68f Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 22 Jul 2010 12:11:36 -0700 Subject: ir_to_mesa: Add support for MESA_GLSL=dump environment var. --- src/mesa/shader/ir_to_mesa.cpp | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/mesa/shader/ir_to_mesa.cpp b/src/mesa/shader/ir_to_mesa.cpp index bfb8e3201a..c92fe49a20 100644 --- a/src/mesa/shader/ir_to_mesa.cpp +++ b/src/mesa/shader/ir_to_mesa.cpp @@ -2030,12 +2030,21 @@ get_mesa_program(GLcontext *ctx, struct gl_shader_program *shader_program, int i; struct gl_program *prog; GLenum target; + const char *target_string; GLboolean progress; 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; + case GL_VERTEX_SHADER: + target = GL_VERTEX_PROGRAM_ARB; + target_string = "vertex"; + break; + case GL_FRAGMENT_SHADER: + target = GL_FRAGMENT_PROGRAM_ARB; + target_string = "fragment"; + break; + default: + assert(!"should not be reached"); + break; } validate_ir_tree(shader->ir); @@ -2127,7 +2136,8 @@ get_mesa_program(GLcontext *ctx, struct gl_shader_program *shader_program, } set_branchtargets(&v, mesa_instructions, num_instructions); - if (0) { + if (ctx->Shader.Flags & GLSL_DUMP) { + printf("Mesa %s program:\n", target_string); print_program(mesa_instructions, mesa_instruction_annotation, num_instructions); } -- cgit v1.2.3 From cc15ef07e03e465d93df7062a516f9b4bfbaeda0 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 22 Jul 2010 12:16:11 -0700 Subject: mesa: Only complain about an infinite loop in a swrast program once. Chances are, if one fragment looped badly, others will too, and debugging output gets overwhelmed by the looping complaints. --- src/mesa/shader/prog_execute.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/shader/prog_execute.c b/src/mesa/shader/prog_execute.c index f85c6513f3..b6da3449b2 100644 --- a/src/mesa/shader/prog_execute.c +++ b/src/mesa/shader/prog_execute.c @@ -1788,7 +1788,11 @@ _mesa_execute_program(GLcontext * ctx, numExec++; if (numExec > maxExec) { - _mesa_problem(ctx, "Infinite loop detected in fragment program"); + static GLboolean reported = GL_FALSE; + if (!reported) { + _mesa_problem(ctx, "Infinite loop detected in fragment program"); + reported = GL_TRUE; + } return GL_TRUE; } -- cgit v1.2.3 From 748c343f8bdbbc8c5f00403b790ad7130424c35f Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 22 Jul 2010 12:25:39 -0700 Subject: ir_to_mesa: Pretty up the printing of MESA_GLSL=dump --- src/mesa/shader/ir_to_mesa.cpp | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/mesa/shader/ir_to_mesa.cpp b/src/mesa/shader/ir_to_mesa.cpp index c92fe49a20..ba45c87e59 100644 --- a/src/mesa/shader/ir_to_mesa.cpp +++ b/src/mesa/shader/ir_to_mesa.cpp @@ -1885,19 +1885,29 @@ print_program(struct prog_instruction *mesa_instructions, { ir_instruction *last_ir = NULL; int i; + int indent = 0; for (i = 0; i < num_instructions; i++) { struct prog_instruction *mesa_inst = mesa_instructions + i; ir_instruction *ir = mesa_instruction_annotation[i]; + fprintf(stdout, "%3d: ", i); + if (last_ir != ir && ir) { - ir_print_visitor print; - ir->accept(&print); + int j; + + for (j = 0; j < indent; j++) { + fprintf(stdout, " "); + } + ir->print(); printf("\n"); last_ir = ir; + + fprintf(stdout, " "); /* line number spacing. */ } - _mesa_print_instruction(mesa_inst); + indent = _mesa_fprint_instruction_opt(stdout, mesa_inst, indent, + PROG_PRINT_DEBUG, NULL); } } -- 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') 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') 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') 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') 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') 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') 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') 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') 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 85e93da18ca2c967ca12870b62ab1aac2f0b880c Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 22 Jul 2010 16:11:08 -0700 Subject: ir_to_mesa: Fix the swizzles on record and array dereferences. Fixes: glsl1-struct (1) glsl1-struct (2) glsl1-struct (3) glsl1-struct (4) --- src/mesa/shader/ir_to_mesa.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/mesa/shader/ir_to_mesa.cpp b/src/mesa/shader/ir_to_mesa.cpp index ba45c87e59..c397838e25 100644 --- a/src/mesa/shader/ir_to_mesa.cpp +++ b/src/mesa/shader/ir_to_mesa.cpp @@ -1151,7 +1151,10 @@ ir_to_mesa_visitor::visit(ir_dereference_variable *ir) 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); + if (ir->type->is_scalar() || ir->type->is_vector()) + src_reg.swizzle = swizzle_for_size(ir->var->type->vector_elements); + else + src_reg.swizzle = SWIZZLE_NOOP; src_reg.reladdr = NULL; src_reg.negate = 0; @@ -1231,7 +1234,10 @@ ir_to_mesa_visitor::visit(ir_dereference_array *ir) } /* If the type is smaller than a vec4, replicate the last channel out. */ - src_reg.swizzle = swizzle_for_size(ir->type->vector_elements); + if (ir->type->is_scalar() || ir->type->is_vector()) + src_reg.swizzle = swizzle_for_size(ir->type->vector_elements); + else + src_reg.swizzle = SWIZZLE_NOOP; this->result = src_reg; } @@ -1250,6 +1256,7 @@ ir_to_mesa_visitor::visit(ir_dereference_record *ir) break; offset += type_size(struct_type->fields.structure[i].type); } + this->result.swizzle = swizzle_for_size(ir->type->vector_elements); this->result.index += offset; } @@ -1322,7 +1329,6 @@ ir_to_mesa_visitor::visit(ir_assignment *ir) int i; assert(!ir->lhs->type->is_array()); - assert(ir->lhs->type->base_type != GLSL_TYPE_STRUCT); ir->rhs->accept(this); r = this->result; -- 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') 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') 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') 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') 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') 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') 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') 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') 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') 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') 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') 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') 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 d64343f1ae84979bd154475badf11af8a9bfc2eb Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 26 Jul 2010 17:30:35 -0700 Subject: ir_to_mesa: Flag when we use the address reg. Hardware backends will get angry otherwise. --- src/mesa/shader/ir_to_mesa.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/mesa/shader/ir_to_mesa.cpp b/src/mesa/shader/ir_to_mesa.cpp index c397838e25..89cad8a8b0 100644 --- a/src/mesa/shader/ir_to_mesa.cpp +++ b/src/mesa/shader/ir_to_mesa.cpp @@ -2146,6 +2146,8 @@ get_mesa_program(GLcontext *ctx, struct gl_shader_program *shader_program, inst->function->inst = i; else if (mesa_inst->Opcode == OPCODE_CAL) mesa_inst->BranchTarget = inst->function->sig_id; /* rewritten later */ + else if (mesa_inst->Opcode == OPCODE_ARL) + prog->NumAddressRegs = 1; mesa_inst++; i++; -- 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') 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') 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') 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 5b6890a388d554f06880e88d61c73dcd62c5f141 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 26 Jul 2010 19:08:44 -0700 Subject: ir_to_mesa: Add support for structure constants. Fixes: TPPStreamCompiler::assignOperands --- src/mesa/program/ir_to_mesa.cpp | 35 ++++++++++++++++++++++++++++++----- 1 file changed, 30 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp index 1903b8fcf8..20228e0428 100644 --- a/src/mesa/program/ir_to_mesa.cpp +++ b/src/mesa/program/ir_to_mesa.cpp @@ -1381,12 +1381,37 @@ ir_to_mesa_visitor::visit(ir_constant *ir) assert(!"FINISHME: array constants"); } + /* Unfortunately, 4 floats is all we can get into + * _mesa_add_unnamed_constant. So, make a temp to store an + * aggregate constant and move each constant value into it. If we + * get lucky, copy propagation will eliminate the extra moves. + */ + + if (ir->type->base_type == GLSL_TYPE_STRUCT) { + ir_to_mesa_src_reg temp_base = get_temp(ir->type); + ir_to_mesa_dst_reg temp = ir_to_mesa_dst_reg_from_src(temp_base); + + foreach_iter(exec_list_iterator, iter, ir->components) { + ir_constant *field_value = (ir_constant *)iter.get(); + int size = type_size(field_value->type); + + assert(size > 0); + + field_value->accept(this); + src_reg = this->result; + + for (i = 0; i < (unsigned int)size; i++) { + ir_to_mesa_emit_op1(ir, OPCODE_MOV, temp, src_reg); + + src_reg.index++; + temp.index++; + } + } + this->result = temp_base; + return; + } + if (ir->type->is_matrix()) { - /* Unfortunately, 4 floats is all we can get into - * _mesa_add_unnamed_constant. So, make a temp to store the - * matrix and move each constant value into it. If we get - * lucky, copy propagation will eliminate the extra moves. - */ ir_to_mesa_src_reg mat = get_temp(glsl_type::vec4_type); ir_to_mesa_dst_reg mat_column = ir_to_mesa_dst_reg_from_src(mat); -- cgit v1.2.3 From c91809e1e4a4fa8884e6588159368ea32431ee0e Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 26 Jul 2010 19:41:23 -0700 Subject: ir_to_mesa: Actually allocate the right size for constant matrix temps. --- src/mesa/program/ir_to_mesa.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp index 20228e0428..6eceddfb81 100644 --- a/src/mesa/program/ir_to_mesa.cpp +++ b/src/mesa/program/ir_to_mesa.cpp @@ -1412,7 +1412,7 @@ ir_to_mesa_visitor::visit(ir_constant *ir) } if (ir->type->is_matrix()) { - ir_to_mesa_src_reg mat = get_temp(glsl_type::vec4_type); + ir_to_mesa_src_reg mat = get_temp(ir->type); ir_to_mesa_dst_reg mat_column = ir_to_mesa_dst_reg_from_src(mat); for (i = 0; i < ir->type->matrix_columns; i++) { -- cgit v1.2.3 From 576d01ad8c8b8aa57b4711c98d8e004d4f20fc0b Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 26 Jul 2010 19:36:53 -0700 Subject: ir_to_mesa: Fix up handling of void function returns. void functions have a type of glsl_type::void_type, not a null type. --- src/mesa/program/ir_to_mesa.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp index 6eceddfb81..d06b83261c 100644 --- a/src/mesa/program/ir_to_mesa.cpp +++ b/src/mesa/program/ir_to_mesa.cpp @@ -1501,7 +1501,7 @@ ir_to_mesa_visitor::get_function_signature(ir_function_signature *sig) break; } - if (sig->return_type) { + if (!sig->return_type->is_void()) { entry->return_reg = get_temp(sig->return_type); } else { entry->return_reg = ir_to_mesa_undef; -- 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') 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') 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') 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 fdbaca931a504a70d6fec54e2f85caac6281377d Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 27 Jul 2010 10:08:38 -0700 Subject: ir_to_mesa: Fix stray "break" that broke functions of >1 argument. --- src/mesa/program/ir_to_mesa.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'src') diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp index 2fd0507c2f..defacc7fdc 100644 --- a/src/mesa/program/ir_to_mesa.cpp +++ b/src/mesa/program/ir_to_mesa.cpp @@ -1498,7 +1498,6 @@ ir_to_mesa_visitor::get_function_signature(ir_function_signature *sig) this->variables.push_tail(storage); this->next_temp += type_size(param->type); - break; } if (!sig->return_type->is_void()) { -- cgit v1.2.3 From 9a770ee49f8cb82653bb5c1976f7751d9a6b801e Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 27 Jul 2010 10:39:40 -0700 Subject: ir_to_mesa: Set the swizzle on constant struct src regs. MESA_GLSL=nopt now produces believable output for glsl-fs-raytrace. --- src/mesa/program/ir_to_mesa.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp index defacc7fdc..5cc999c2e3 100644 --- a/src/mesa/program/ir_to_mesa.cpp +++ b/src/mesa/program/ir_to_mesa.cpp @@ -1389,6 +1389,7 @@ ir_to_mesa_visitor::visit(ir_constant *ir) if (ir->type->base_type == GLSL_TYPE_STRUCT) { ir_to_mesa_src_reg temp_base = get_temp(ir->type); + temp_base.swizzle = SWIZZLE_NOOP; ir_to_mesa_dst_reg temp = ir_to_mesa_dst_reg_from_src(temp_base); foreach_iter(exec_list_iterator, iter, ir->components) { -- 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') 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 8bbdf6e7cdfc3265439761a06eea79627f4ee2fa Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 27 Jul 2010 11:45:27 -0700 Subject: mesa: Allow large temporary indices coming into the temporary reg allocator. This gets glsl-vs-raytrace, glsl-fs-raytrace running on the new compiler. --- src/mesa/program/prog_optimize.c | 48 ++++++++++++++++++++++------------------ 1 file changed, 27 insertions(+), 21 deletions(-) (limited to 'src') diff --git a/src/mesa/program/prog_optimize.c b/src/mesa/program/prog_optimize.c index bd120b8643..457ace14c6 100644 --- a/src/mesa/program/prog_optimize.c +++ b/src/mesa/program/prog_optimize.c @@ -34,7 +34,12 @@ #define MAX_LOOP_NESTING 50 - +/* MAX_PROGRAM_TEMPS is a low number (256), and we want to be able to + * register allocate many temporary values into that small number of + * temps. So allow large temporary indices coming into the register + * allocator. + */ +#define REG_ALLOCATE_MAX_PROGRAM_TEMPS ((1 << INST_INDEX_BITS) - 1) static GLboolean dbg = GL_FALSE; @@ -154,8 +159,8 @@ replace_regs(struct gl_program *prog, gl_register_file file, const GLint map[]) static void _mesa_consolidate_registers(struct gl_program *prog) { - GLboolean tempUsed[MAX_PROGRAM_TEMPS]; - GLint tempMap[MAX_PROGRAM_TEMPS]; + GLboolean tempUsed[REG_ALLOCATE_MAX_PROGRAM_TEMPS]; + GLint tempMap[REG_ALLOCATE_MAX_PROGRAM_TEMPS]; GLuint tempMax = 0, i; if (dbg) { @@ -164,7 +169,7 @@ _mesa_consolidate_registers(struct gl_program *prog) memset(tempUsed, 0, sizeof(tempUsed)); - for (i = 0; i < MAX_PROGRAM_TEMPS; i++) { + for (i = 0; i < REG_ALLOCATE_MAX_PROGRAM_TEMPS; i++) { tempMap[i] = -1; } @@ -176,7 +181,7 @@ _mesa_consolidate_registers(struct gl_program *prog) for (j = 0; j < numSrc; j++) { if (inst->SrcReg[j].File == PROGRAM_TEMPORARY) { const GLuint index = inst->SrcReg[j].Index; - ASSERT(index < MAX_PROGRAM_TEMPS); + ASSERT(index < REG_ALLOCATE_MAX_PROGRAM_TEMPS); tempUsed[index] = GL_TRUE; tempMax = MAX2(tempMax, index); break; @@ -184,7 +189,7 @@ _mesa_consolidate_registers(struct gl_program *prog) } if (inst->DstReg.File == PROGRAM_TEMPORARY) { const GLuint index = inst->DstReg.Index; - ASSERT(index < MAX_PROGRAM_TEMPS); + ASSERT(index < REG_ALLOCATE_MAX_PROGRAM_TEMPS); tempUsed[index] = GL_TRUE; tempMax = MAX2(tempMax, index); } @@ -225,7 +230,7 @@ _mesa_consolidate_registers(struct gl_program *prog) static void _mesa_remove_dead_code(struct gl_program *prog) { - GLboolean tempRead[MAX_PROGRAM_TEMPS][4]; + GLboolean tempRead[REG_ALLOCATE_MAX_PROGRAM_TEMPS][4]; GLboolean *removeInst; /* per-instruction removal flag */ GLuint i, rem = 0, comp; @@ -250,7 +255,7 @@ _mesa_remove_dead_code(struct gl_program *prog) if (inst->SrcReg[j].File == PROGRAM_TEMPORARY) { const GLuint index = inst->SrcReg[j].Index; GLuint read_mask; - ASSERT(index < MAX_PROGRAM_TEMPS); + ASSERT(index < REG_ALLOCATE_MAX_PROGRAM_TEMPS); read_mask = get_src_arg_mask(inst, j); if (inst->SrcReg[j].RelAddr) { @@ -286,7 +291,7 @@ _mesa_remove_dead_code(struct gl_program *prog) /* check dst reg */ if (inst->DstReg.File == PROGRAM_TEMPORARY) { const GLuint index = inst->DstReg.Index; - ASSERT(index < MAX_PROGRAM_TEMPS); + ASSERT(index < REG_ALLOCATE_MAX_PROGRAM_TEMPS); if (inst->DstReg.RelAddr) { if (dbg) @@ -642,7 +647,7 @@ struct interval struct interval_list { GLuint Num; - struct interval Intervals[MAX_PROGRAM_TEMPS]; + struct interval Intervals[REG_ALLOCATE_MAX_PROGRAM_TEMPS]; }; @@ -754,7 +759,7 @@ update_interval(GLint intBegin[], GLint intEnd[], } } - ASSERT(index < MAX_PROGRAM_TEMPS); + ASSERT(index < REG_ALLOCATE_MAX_PROGRAM_TEMPS); if (intBegin[index] == -1) { ASSERT(intEnd[index] == -1); intBegin[index] = intEnd[index] = ic; @@ -771,14 +776,14 @@ update_interval(GLint intBegin[], GLint intEnd[], GLboolean _mesa_find_temp_intervals(const struct prog_instruction *instructions, GLuint numInstructions, - GLint intBegin[MAX_PROGRAM_TEMPS], - GLint intEnd[MAX_PROGRAM_TEMPS]) + GLint intBegin[REG_ALLOCATE_MAX_PROGRAM_TEMPS], + GLint intEnd[REG_ALLOCATE_MAX_PROGRAM_TEMPS]) { struct loop_info loopStack[MAX_LOOP_NESTING]; GLuint loopStackDepth = 0; GLuint i; - for (i = 0; i < MAX_PROGRAM_TEMPS; i++){ + for (i = 0; i < REG_ALLOCATE_MAX_PROGRAM_TEMPS; i++){ intBegin[i] = intEnd[i] = -1; } @@ -833,7 +838,8 @@ static GLboolean find_live_intervals(struct gl_program *prog, struct interval_list *liveIntervals) { - GLint intBegin[MAX_PROGRAM_TEMPS], intEnd[MAX_PROGRAM_TEMPS]; + GLint intBegin[REG_ALLOCATE_MAX_PROGRAM_TEMPS]; + GLint intEnd[REG_ALLOCATE_MAX_PROGRAM_TEMPS]; GLuint i; /* @@ -853,7 +859,7 @@ find_live_intervals(struct gl_program *prog, /* Build live intervals list from intermediate arrays */ liveIntervals->Num = 0; - for (i = 0; i < MAX_PROGRAM_TEMPS; i++) { + for (i = 0; i < REG_ALLOCATE_MAX_PROGRAM_TEMPS; i++) { if (intBegin[i] >= 0) { struct interval inv; inv.Reg = i; @@ -889,10 +895,10 @@ find_live_intervals(struct gl_program *prog, /** Scan the array of used register flags to find free entry */ static GLint -alloc_register(GLboolean usedRegs[MAX_PROGRAM_TEMPS]) +alloc_register(GLboolean usedRegs[REG_ALLOCATE_MAX_PROGRAM_TEMPS]) { GLuint k; - for (k = 0; k < MAX_PROGRAM_TEMPS; k++) { + for (k = 0; k < REG_ALLOCATE_MAX_PROGRAM_TEMPS; k++) { if (!usedRegs[k]) { usedRegs[k] = GL_TRUE; return k; @@ -914,8 +920,8 @@ static void _mesa_reallocate_registers(struct gl_program *prog) { struct interval_list liveIntervals; - GLint registerMap[MAX_PROGRAM_TEMPS]; - GLboolean usedRegs[MAX_PROGRAM_TEMPS]; + GLint registerMap[REG_ALLOCATE_MAX_PROGRAM_TEMPS]; + GLboolean usedRegs[REG_ALLOCATE_MAX_PROGRAM_TEMPS]; GLuint i; GLint maxTemp = -1; @@ -924,7 +930,7 @@ _mesa_reallocate_registers(struct gl_program *prog) _mesa_print_program(prog); } - for (i = 0; i < MAX_PROGRAM_TEMPS; i++){ + for (i = 0; i < REG_ALLOCATE_MAX_PROGRAM_TEMPS; i++){ registerMap[i] = -1; usedRegs[i] = GL_FALSE; } -- 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') 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') 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') 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 20c074ae28b310348a6a1920ad0ddf1e5cbb7a46 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 27 Jul 2010 11:58:32 -0700 Subject: ir_to_mesa: Add support for array constants. Fixes: glsl1-GLSL 1.20 array constructor 1 glsl1-GLSL 1.20 array constructor 2 glsl1-GLSL 1.20 array.length() glsl1-GLSL 1.20 const array constructor 1 glsl1-GLSL 1.20 const array constructor 2 --- src/mesa/program/ir_to_mesa.cpp | 48 ++++++++++++++++++++++++++--------------- 1 file changed, 31 insertions(+), 17 deletions(-) (limited to 'src') diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp index 409b6d7288..bd79913dcf 100644 --- a/src/mesa/program/ir_to_mesa.cpp +++ b/src/mesa/program/ir_to_mesa.cpp @@ -518,19 +518,21 @@ ir_to_mesa_visitor::get_temp(const glsl_type *type) int swizzle[4]; int i; - assert(!type->is_array()); - src_reg.file = PROGRAM_TEMPORARY; src_reg.index = next_temp; src_reg.reladdr = NULL; next_temp += type_size(type); - 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]); + if (type->is_array() || type->is_record()) { + src_reg.swizzle = SWIZZLE_NOOP; + } else { + 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]); + } src_reg.negate = 0; return src_reg; @@ -1329,8 +1331,6 @@ ir_to_mesa_visitor::visit(ir_assignment *ir) struct ir_to_mesa_src_reg r; int i; - assert(!ir->lhs->type->is_array()); - ir->rhs->accept(this); r = this->result; @@ -1375,12 +1375,6 @@ ir_to_mesa_visitor::visit(ir_constant *ir) GLfloat *values = stack_vals; unsigned int i; - if (ir->type->is_array()) { - ir->print(); - printf("\n"); - assert(!"FINISHME: array constants"); - } - /* Unfortunately, 4 floats is all we can get into * _mesa_add_unnamed_constant. So, make a temp to store an * aggregate constant and move each constant value into it. If we @@ -1389,7 +1383,6 @@ ir_to_mesa_visitor::visit(ir_constant *ir) if (ir->type->base_type == GLSL_TYPE_STRUCT) { ir_to_mesa_src_reg temp_base = get_temp(ir->type); - temp_base.swizzle = SWIZZLE_NOOP; ir_to_mesa_dst_reg temp = ir_to_mesa_dst_reg_from_src(temp_base); foreach_iter(exec_list_iterator, iter, ir->components) { @@ -1412,6 +1405,27 @@ ir_to_mesa_visitor::visit(ir_constant *ir) return; } + if (ir->type->is_array()) { + ir_to_mesa_src_reg temp_base = get_temp(ir->type); + ir_to_mesa_dst_reg temp = ir_to_mesa_dst_reg_from_src(temp_base); + int size = type_size(ir->type->fields.array); + + assert(size > 0); + + for (i = 0; i < ir->type->length; i++) { + ir->array_elements[i]->accept(this); + src_reg = this->result; + for (int j = 0; j < size; j++) { + ir_to_mesa_emit_op1(ir, OPCODE_MOV, temp, src_reg); + + src_reg.index++; + temp.index++; + } + } + this->result = temp_base; + return; + } + if (ir->type->is_matrix()) { ir_to_mesa_src_reg mat = get_temp(ir->type); ir_to_mesa_dst_reg mat_column = ir_to_mesa_dst_reg_from_src(mat); -- 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') 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') 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 9a670c2e9b7e07ba43d175f3bfb23951296794c4 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 27 Jul 2010 15:10:38 -0700 Subject: ir_to_mesa: Provide a restricted type size to _mesa_add_uniform. Fixes: glsl-uniform-out-of-bounds. --- src/mesa/program/ir_to_mesa.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp index bd79913dcf..fe0c19acea 100644 --- a/src/mesa/program/ir_to_mesa.cpp +++ b/src/mesa/program/ir_to_mesa.cpp @@ -1061,6 +1061,7 @@ ir_to_mesa_visitor::visit(ir_dereference_variable *ir) ir_to_mesa_src_reg src_reg; variable_storage *entry = find_variable_storage(ir->var); unsigned int loc; + int len; if (!entry) { switch (ir->var->mode) { @@ -1089,9 +1090,17 @@ ir_to_mesa_visitor::visit(ir_dereference_variable *ir) assert(ir->var->type->gl_type != 0 && ir->var->type->gl_type != GL_INVALID_ENUM); + + if (ir->var->type->is_vector() || + ir->var->type->is_scalar()) { + len = ir->var->type->vector_elements; + } else { + len = type_size(ir->var->type) * 4; + } + loc = _mesa_add_uniform(this->prog->Parameters, ir->var->name, - type_size(ir->var->type) * 4, + len, ir->var->type->gl_type, NULL); -- 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') 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') 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') 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') 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') 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 dc27e7356952984d023e05fef90d0f8c4bb07a09 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 28 Jul 2010 08:13:53 -0700 Subject: ir_to_mesa: Add remaining state variable (builtin uniforms) support. Fixes: glsl1-GL state variable reference (diffuse product) glsl1-GL state variable reference (gl_FrontMaterial.ambient) glsl1-GL state variable reference (gl_LightSource[0].diffuse) glsl1-GL state variable reference (point attenuation) glsl1-GL state variable reference (point size) glsl1-linear fog --- src/mesa/program/ir_to_mesa.cpp | 201 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 201 insertions(+) (limited to 'src') diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp index fe0c19acea..c53381e29d 100644 --- a/src/mesa/program/ir_to_mesa.cpp +++ b/src/mesa/program/ir_to_mesa.cpp @@ -946,6 +946,181 @@ ir_to_mesa_visitor::visit(ir_swizzle *ir) this->result = src_reg; } +static const struct { + const char *name; + const char *field; + int tokens[STATE_LENGTH]; + int swizzle; + bool array_indexed; +} statevars[] = { + {"gl_DepthRange", "near", + {STATE_DEPTH_RANGE, 0, 0}, SWIZZLE_XXXX}, + {"gl_DepthRange", "far", + {STATE_DEPTH_RANGE, 0, 0}, SWIZZLE_YYYY}, + {"gl_DepthRange", "diff", + {STATE_DEPTH_RANGE, 0, 0}, SWIZZLE_ZZZZ}, + + {"gl_ClipPlane", NULL, + {STATE_CLIPPLANE, 0, 0}, SWIZZLE_XYZW, true} +, + {"gl_Point", "size", + {STATE_POINT_SIZE}, SWIZZLE_XXXX}, + {"gl_Point", "sizeMin", + {STATE_POINT_SIZE}, SWIZZLE_YYYY}, + {"gl_Point", "sizeMax", + {STATE_POINT_SIZE}, SWIZZLE_ZZZZ}, + {"gl_Point", "fadeThresholdSize", + {STATE_POINT_SIZE}, SWIZZLE_WWWW}, + {"gl_Point", "distanceConstantAttenuation", + {STATE_POINT_ATTENUATION}, SWIZZLE_XXXX}, + {"gl_Point", "distanceLinearAttenuation", + {STATE_POINT_ATTENUATION}, SWIZZLE_YYYY}, + {"gl_Point", "distanceQuadraticAttenuation", + {STATE_POINT_ATTENUATION}, SWIZZLE_ZZZZ}, + + {"gl_FrontMaterial", "emission", + {STATE_MATERIAL, 0, STATE_EMISSION}, SWIZZLE_XYZW}, + {"gl_FrontMaterial", "ambient", + {STATE_MATERIAL, 0, STATE_AMBIENT}, SWIZZLE_XYZW}, + {"gl_FrontMaterial", "diffuse", + {STATE_MATERIAL, 0, STATE_DIFFUSE}, SWIZZLE_XYZW}, + {"gl_FrontMaterial", "specular", + {STATE_MATERIAL, 0, STATE_SPECULAR}, SWIZZLE_XYZW}, + {"gl_FrontMaterial", "shininess", + {STATE_MATERIAL, 0, STATE_SHININESS}, SWIZZLE_XXXX}, + + {"gl_BackMaterial", "emission", + {STATE_MATERIAL, 1, STATE_EMISSION}, SWIZZLE_XYZW}, + {"gl_BackMaterial", "ambient", + {STATE_MATERIAL, 1, STATE_AMBIENT}, SWIZZLE_XYZW}, + {"gl_BackMaterial", "diffuse", + {STATE_MATERIAL, 1, STATE_DIFFUSE}, SWIZZLE_XYZW}, + {"gl_BackMaterial", "specular", + {STATE_MATERIAL, 1, STATE_SPECULAR}, SWIZZLE_XYZW}, + {"gl_BackMaterial", "shininess", + {STATE_MATERIAL, 1, STATE_SHININESS}, SWIZZLE_XXXX}, + + {"gl_LightSource", "ambient", + {STATE_LIGHT, 0, STATE_AMBIENT}, SWIZZLE_XYZW, true}, + {"gl_LightSource", "diffuse", + {STATE_LIGHT, 0, STATE_DIFFUSE}, SWIZZLE_XYZW, true}, + {"gl_LightSource", "specular", + {STATE_LIGHT, 0, STATE_SPECULAR}, SWIZZLE_XYZW, true}, + {"gl_LightSource", "position", + {STATE_LIGHT, 0, STATE_POSITION}, SWIZZLE_XYZW, true}, + {"gl_LightSource", "halfVector", + {STATE_LIGHT, 0, STATE_HALF_VECTOR}, SWIZZLE_XYZW, true}, + {"gl_LightSource", "spotDirection", + {STATE_LIGHT, 0, STATE_SPOT_DIRECTION}, SWIZZLE_XYZW, true}, + {"gl_LightSource", "spotCosCutoff", + {STATE_LIGHT, 0, STATE_SPOT_DIRECTION}, SWIZZLE_WWWW, true}, + {"gl_LightSource", "spotCutoff", + {STATE_LIGHT, 0, STATE_SPOT_CUTOFF}, SWIZZLE_XXXX, true}, + {"gl_LightSource", "spotExponent", + {STATE_LIGHT, 0, STATE_ATTENUATION}, SWIZZLE_WWWW, true}, + {"gl_LightSource", "constantAttenuation", + {STATE_LIGHT, 0, STATE_ATTENUATION}, SWIZZLE_XXXX, true}, + {"gl_LightSource", "linearAttenuation", + {STATE_LIGHT, 0, STATE_ATTENUATION}, SWIZZLE_YYYY, true}, + {"gl_LightSource", "quadraticAttenuation", + {STATE_LIGHT, 0, STATE_ATTENUATION}, SWIZZLE_ZZZZ, true}, + + {"gl_LightModel", NULL, + {STATE_LIGHTMODEL_AMBIENT, 0}, SWIZZLE_XYZW}, + + {"gl_FrontLightModelProduct", NULL, + {STATE_LIGHTMODEL_SCENECOLOR, 0}, SWIZZLE_XYZW}, + {"gl_BackLightModelProduct", NULL, + {STATE_LIGHTMODEL_SCENECOLOR, 1}, SWIZZLE_XYZW}, + + {"gl_FrontLightProduct", "ambient", + {STATE_LIGHTPROD, 0, 0, STATE_AMBIENT}, SWIZZLE_XYZW, true}, + {"gl_FrontLightProduct", "diffuse", + {STATE_LIGHTPROD, 0, 0, STATE_DIFFUSE}, SWIZZLE_XYZW, true}, + {"gl_FrontLightProduct", "specular", + {STATE_LIGHTPROD, 0, 0, STATE_SPECULAR}, SWIZZLE_XYZW, true}, + + {"gl_BackLightProduct", "ambient", + {STATE_LIGHTPROD, 0, 1, STATE_AMBIENT}, SWIZZLE_XYZW, true}, + {"gl_BackLightProduct", "diffuse", + {STATE_LIGHTPROD, 0, 1, STATE_DIFFUSE}, SWIZZLE_XYZW, true}, + {"gl_BackLightProduct", "specular", + {STATE_LIGHTPROD, 0, 1, STATE_SPECULAR}, SWIZZLE_XYZW, true}, + + {"gl_TextureEnvColor", "ambient", + {STATE_TEXENV_COLOR, 0}, SWIZZLE_XYZW, true}, + + {"gl_EyePlaneS", NULL, + {STATE_TEXGEN, 0, STATE_TEXGEN_EYE_S}, SWIZZLE_XYZW, true}, + {"gl_EyePlaneT", NULL, + {STATE_TEXGEN, 0, STATE_TEXGEN_EYE_T}, SWIZZLE_XYZW, true}, + {"gl_EyePlaneR", NULL, + {STATE_TEXGEN, 0, STATE_TEXGEN_EYE_R}, SWIZZLE_XYZW, true}, + {"gl_EyePlaneQ", NULL, + {STATE_TEXGEN, 0, STATE_TEXGEN_EYE_Q}, SWIZZLE_XYZW, true}, + + {"gl_ObjectPlaneS", NULL, + {STATE_TEXGEN, 0, STATE_TEXGEN_OBJECT_S}, SWIZZLE_XYZW, true}, + {"gl_ObjectPlaneT", NULL, + {STATE_TEXGEN, 0, STATE_TEXGEN_OBJECT_T}, SWIZZLE_XYZW, true}, + {"gl_ObjectPlaneR", NULL, + {STATE_TEXGEN, 0, STATE_TEXGEN_OBJECT_R}, SWIZZLE_XYZW, true}, + {"gl_ObjectPlaneQ", NULL, + {STATE_TEXGEN, 0, STATE_TEXGEN_OBJECT_Q}, SWIZZLE_XYZW, true}, + + {"gl_Fog", "color", + {STATE_FOG_COLOR}, SWIZZLE_XYZW}, + {"gl_Fog", "density", + {STATE_FOG_PARAMS}, SWIZZLE_XXXX}, + {"gl_Fog", "start", + {STATE_FOG_PARAMS}, SWIZZLE_YYYY}, + {"gl_Fog", "end", + {STATE_FOG_PARAMS}, SWIZZLE_ZZZZ}, + {"gl_Fog", "scale", + {STATE_FOG_PARAMS}, SWIZZLE_WWWW}, +}; + +static ir_to_mesa_src_reg +get_builtin_uniform_reg(struct gl_program *prog, + const char *name, int array_index, const char *field) +{ + unsigned int i; + ir_to_mesa_src_reg src_reg; + int tokens[STATE_LENGTH]; + + for (i = 0; i < Elements(statevars); i++) { + if (strcmp(statevars[i].name, name) != 0) + continue; + if (!field && statevars[i].field) { + assert(!"FINISHME: whole-structure state var dereference"); + } + if (field && strcmp(statevars[i].field, field) != 0) + continue; + break; + } + + if (i == Elements(statevars)) { + printf("builtin uniform %s%s%s not found\n", + name, + field ? "." : "", + field ? field : ""); + abort(); + } + + memcpy(&tokens, statevars[i].tokens, sizeof(tokens)); + if (statevars[i].array_indexed) + tokens[1] = array_index; + + src_reg.file = PROGRAM_STATE_VAR; + src_reg.index = _mesa_add_state_reference(prog->Parameters, + (gl_state_index *)tokens); + src_reg.swizzle = statevars[i].swizzle; + src_reg.negate = 0; + src_reg.reladdr = false; + + return src_reg; +} + static int add_matrix_ref(struct gl_program *prog, int *tokens) { @@ -1176,6 +1351,7 @@ ir_to_mesa_visitor::visit(ir_dereference_variable *ir) void ir_to_mesa_visitor::visit(ir_dereference_array *ir) { + ir_variable *var = ir->variable_referenced(); ir_constant *index; ir_to_mesa_src_reg src_reg; ir_dereference_variable *deref_var = ir->array->as_dereference_variable(); @@ -1216,6 +1392,20 @@ ir_to_mesa_visitor::visit(ir_dereference_array *ir) return; } + if (strncmp(var->name, "gl_", 3) == 0 && var->mode == ir_var_uniform && + !var->type->is_matrix()) { + ir_dereference_record *record = NULL; + if (ir->array->ir_type == ir_type_dereference_record) + record = (ir_dereference_record *)ir->array; + + assert(index || !"FINISHME: variable-indexed builtin uniform access"); + + this->result = get_builtin_uniform_reg(prog, + var->name, + index->value.i[0], + record ? record->field : NULL); + } + ir->array->accept(this); src_reg = this->result; @@ -1260,6 +1450,17 @@ ir_to_mesa_visitor::visit(ir_dereference_record *ir) unsigned int i; const glsl_type *struct_type = ir->record->type; int offset = 0; + ir_variable *var = ir->record->variable_referenced(); + + if (strncmp(var->name, "gl_", 3) == 0 && var->mode == ir_var_uniform) { + assert(var); + + this->result = get_builtin_uniform_reg(prog, + var->name, + 0, + ir->field); + return; + } ir->record->accept(this); -- 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') 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') 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') 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') 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') 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') 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') 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') 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') 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') 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') 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') 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') 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') 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') 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') 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') 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') 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') 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') 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') 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') 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') 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') 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') 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') 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') 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') 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') 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') 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') 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') 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') 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') 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') 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') 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') 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') 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') 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') 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') 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') 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') 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') 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') 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') 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') 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') 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') 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') 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') 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 859fd56245c1d725cacab17a34793d41ea14e867 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 28 Jul 2010 15:42:35 -0700 Subject: ir_to_mesa: Respect the driver if it rejects a shader. --- src/mesa/drivers/dri/i965/brw_program.c | 6 ++---- src/mesa/program/ir_to_mesa.cpp | 14 +++++++++----- 2 files changed, 11 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_program.c b/src/mesa/drivers/dri/i965/brw_program.c index 4b08d2599b..c6d11fed06 100644 --- a/src/mesa/drivers/dri/i965/brw_program.c +++ b/src/mesa/drivers/dri/i965/brw_program.c @@ -36,6 +36,7 @@ #include "program/program.h" #include "program/programopt.h" #include "tnl/tnl.h" +#include "talloc.h" #include "brw_context.h" #include "brw_wm.h" @@ -114,10 +115,7 @@ shader_error(GLcontext *ctx, struct gl_program *prog, const char *msg) shader = _mesa_lookup_shader_program(ctx, prog->Id); if (shader) { - if (shader->InfoLog) { - free(shader->InfoLog); - } - shader->InfoLog = _mesa_strdup(msg); + shader->InfoLog = talloc_strdup_append(shader->InfoLog, msg); shader->LinkStatus = GL_FALSE; } } diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp index a3019cc650..3a28c566d4 100644 --- a/src/mesa/program/ir_to_mesa.cpp +++ b/src/mesa/program/ir_to_mesa.cpp @@ -2320,7 +2320,7 @@ get_mesa_program(GLcontext *ctx, struct gl_shader_program *shader_program, validate_ir_tree(shader->ir); - prog = ctx->Driver.NewProgram(ctx, target, 1); + prog = ctx->Driver.NewProgram(ctx, target, shader_program->Name); if (!prog) return NULL; prog->Parameters = _mesa_new_parameter_list(); @@ -2536,6 +2536,7 @@ _mesa_glsl_link_shader(GLcontext *ctx, struct gl_shader_program *prog) if (prog->LinkStatus) { for (i = 0; i < prog->_NumLinkedShaders; i++) { struct gl_program *linked_prog; + bool ok = true; linked_prog = get_mesa_program(ctx, prog, prog->_LinkedShaders[i]); @@ -2547,16 +2548,19 @@ _mesa_glsl_link_shader(GLcontext *ctx, struct gl_shader_program *prog) case GL_VERTEX_SHADER: _mesa_reference_vertprog(ctx, &prog->VertexProgram, (struct gl_vertex_program *)linked_prog); - ctx->Driver.ProgramStringNotify(ctx, GL_VERTEX_PROGRAM_ARB, - linked_prog); + ok = ctx->Driver.ProgramStringNotify(ctx, GL_VERTEX_PROGRAM_ARB, + linked_prog); break; case GL_FRAGMENT_SHADER: _mesa_reference_fragprog(ctx, &prog->FragmentProgram, (struct gl_fragment_program *)linked_prog); - ctx->Driver.ProgramStringNotify(ctx, GL_FRAGMENT_PROGRAM_ARB, - linked_prog); + ok = ctx->Driver.ProgramStringNotify(ctx, GL_FRAGMENT_PROGRAM_ARB, + linked_prog); break; } + if (!ok) { + prog->LinkStatus = GL_FALSE; + } } } } -- 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') 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') 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') 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') 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') 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') 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') 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') 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') 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') 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') 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') 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 806cb9f9528e3c55c157d7e8bbb751b769b6fcb7 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 29 Jul 2010 15:17:23 -0700 Subject: ir_to_mesa: Don't emit a duplicate return at the end of a function. It was harmless, but ugly. --- src/mesa/program/ir_to_mesa.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp index 3a28c566d4..b6dfde3783 100644 --- a/src/mesa/program/ir_to_mesa.cpp +++ b/src/mesa/program/ir_to_mesa.cpp @@ -2350,8 +2350,12 @@ get_mesa_program(GLcontext *ctx, struct gl_shader_program *shader_program, visit_exec_list(&entry->sig->body, &v); - entry->bgn_inst = v.ir_to_mesa_emit_op0(NULL, OPCODE_RET); - entry->bgn_inst = v.ir_to_mesa_emit_op0(NULL, OPCODE_ENDSUB); + ir_to_mesa_instruction *last; + last = (ir_to_mesa_instruction *)v.instructions.get_tail(); + if (last->op != OPCODE_RET) + v.ir_to_mesa_emit_op0(NULL, OPCODE_RET); + + v.ir_to_mesa_emit_op0(NULL, OPCODE_ENDSUB); progress = GL_TRUE; } } -- 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') 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') 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') 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') 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') 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') 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') 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 40f57c2becbb2cee7cfb6d6ed49dc1db57987e9a Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Fri, 30 Jul 2010 14:44:09 -0700 Subject: ir_to_mesa: Add the function name as a comment to BGNSUB and ENDSUB. --- src/mesa/program/ir_to_mesa.cpp | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp index b6dfde3783..e62395a3b9 100644 --- a/src/mesa/program/ir_to_mesa.cpp +++ b/src/mesa/program/ir_to_mesa.cpp @@ -2355,7 +2355,10 @@ get_mesa_program(GLcontext *ctx, struct gl_shader_program *shader_program, if (last->op != OPCODE_RET) v.ir_to_mesa_emit_op0(NULL, OPCODE_RET); - v.ir_to_mesa_emit_op0(NULL, OPCODE_ENDSUB); + ir_to_mesa_instruction *end; + end = v.ir_to_mesa_emit_op0(NULL, OPCODE_ENDSUB); + end->function = entry; + progress = GL_TRUE; } } @@ -2401,12 +2404,23 @@ get_mesa_program(GLcontext *ctx, struct gl_shader_program *shader_program, shader_program->LinkStatus = false; } - if (mesa_inst->Opcode == OPCODE_BGNSUB) + switch (mesa_inst->Opcode) { + case OPCODE_BGNSUB: inst->function->inst = i; - else if (mesa_inst->Opcode == OPCODE_CAL) + mesa_inst->Comment = strdup(inst->function->sig->function_name()); + break; + case OPCODE_ENDSUB: + mesa_inst->Comment = strdup(inst->function->sig->function_name()); + break; + case OPCODE_CAL: mesa_inst->BranchTarget = inst->function->sig_id; /* rewritten later */ - else if (mesa_inst->Opcode == OPCODE_ARL) + break; + case OPCODE_ARL: prog->NumAddressRegs = 1; + break; + default: + break; + } mesa_inst++; i++; -- 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') 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') 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') 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') 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') 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') 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') 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 b42519108dc7ab104cf9ade65a508f54a0294406 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Sun, 1 Aug 2010 11:40:41 -0700 Subject: ir_to_mesa: Add support for MESA_GLSL=log. This is the option that dumps shader source to files in the current directory. --- src/mesa/program/ir_to_mesa.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src') diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp index 9274723eb7..8f790af09a 100644 --- a/src/mesa/program/ir_to_mesa.cpp +++ b/src/mesa/program/ir_to_mesa.cpp @@ -2514,6 +2514,10 @@ _mesa_glsl_compile_shader(GLcontext *ctx, struct gl_shader *shader) sizeof(shader->builtins_to_link[0]) * state->num_builtins_to_link); shader->num_builtins_to_link = state->num_builtins_to_link; + if (ctx->Shader.Flags & GLSL_LOG) { + _mesa_write_shader_to_file(shader); + } + /* Retain any live IR, but trash the rest. */ reparent_ir(shader->ir, shader); -- 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') 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') 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') 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') 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') 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') 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') 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') 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') 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') 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') 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') 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') 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 955ceef47f2bb8b5005abf11d4a8580c71f19e1b Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Mon, 2 Aug 2010 12:49:20 -0700 Subject: Keep a local copy of the symbol name in the symbol table The symbol_header structure that tracks symbols with a particular name may have a different (longer) life time than the symbols it tracks. Not keeping a local copy of the name can lead to use-after-free errors. For example, the following sequence would trigger such an error: char *copy = strdup(name); _mesa_symbol_table_push_scope(st); _mesa_symbol_table_add_symbol(st, 0, name, NULL); _mesa_symbol_table_pop_scope(st); free(name); _mesa_symbol_table_find_symbol(st, 0, copy); With this change, the symbol table keeps a local copy of the name that has the same life time as the symbol_header for that name. This resolves some use-after-free errors with built-in functions in the GLSL compiler. --- src/mesa/program/symbol_table.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/mesa/program/symbol_table.c b/src/mesa/program/symbol_table.c index 3fea5ee1f1..09e7cb44ef 100644 --- a/src/mesa/program/symbol_table.c +++ b/src/mesa/program/symbol_table.c @@ -75,7 +75,7 @@ struct symbol_header { struct symbol_header *next; /** Symbol name. */ - const char *name; + char *name; /** Linked list of symbols with the same name. */ struct symbol *symbols; @@ -337,9 +337,9 @@ _mesa_symbol_table_add_symbol(struct _mesa_symbol_table *table, if (hdr == NULL) { hdr = calloc(1, sizeof(*hdr)); - hdr->name = name; + hdr->name = strdup(name); - hash_table_insert(table->ht, hdr, name); + hash_table_insert(table->ht, hdr, hdr->name); hdr->next = table->hdr; table->hdr = hdr; } @@ -404,6 +404,7 @@ _mesa_symbol_table_dtor(struct _mesa_symbol_table *table) for (hdr = table->hdr; hdr != NULL; hdr = next) { next = hdr->next; + free(hdr->name); free(hdr); } -- 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') 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') 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 9c02412cdc0270f2b0dc64afe709721e049fd5b0 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 2 Aug 2010 14:47:10 -0700 Subject: ir_to_mesa: Add a constructor for ir_to_mesa_src_reg. This helps makes sure we don't miss any new fields, and makes totally uninitialized src_regs be PROGRAM_UNDEFINED. --- src/mesa/program/ir_to_mesa.cpp | 82 +++++++++++++++++------------------------ 1 file changed, 34 insertions(+), 48 deletions(-) (limited to 'src') diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp index 8f790af09a..5510440475 100644 --- a/src/mesa/program/ir_to_mesa.cpp +++ b/src/mesa/program/ir_to_mesa.cpp @@ -53,11 +53,30 @@ extern "C" { #include "program/prog_parameter.h" } +static int swizzle_for_size(int size); + /** * This struct is a corresponding struct to Mesa prog_src_register, with * wider fields. */ typedef struct ir_to_mesa_src_reg { + ir_to_mesa_src_reg(int file, int index, const glsl_type *type) + { + this->file = file; + this->index = index; + if (type && (type->is_scalar() || type->is_vector() || type->is_matrix())) + this->swizzle = swizzle_for_size(type->vector_elements); + else + this->swizzle = SWIZZLE_XYZW; + this->negate = 0; + this->reladdr = NULL; + } + + ir_to_mesa_src_reg() + { + this->file = PROGRAM_UNDEFINED; + } + int file; /**< PROGRAM_* from Mesa */ int index; /**< temporary index, VERT_ATTRIB_*, FRAG_ATTRIB_*, etc. */ GLuint swizzle; /**< SWIZZLE_XYZWONEZERO swizzles from Mesa. */ @@ -242,9 +261,7 @@ public: void *mem_ctx; }; -ir_to_mesa_src_reg ir_to_mesa_undef = { - PROGRAM_UNDEFINED, 0, SWIZZLE_NOOP, NEGATE_NONE, NULL, -}; +ir_to_mesa_src_reg ir_to_mesa_undef = ir_to_mesa_src_reg(PROGRAM_UNDEFINED, 0, NULL); ir_to_mesa_dst_reg ir_to_mesa_undef_dst = { PROGRAM_UNDEFINED, 0, SWIZZLE_NOOP, COND_TR, NULL, @@ -379,15 +396,7 @@ ir_to_mesa_dst_reg_from_src(ir_to_mesa_src_reg reg) inline ir_to_mesa_src_reg ir_to_mesa_src_reg_from_dst(ir_to_mesa_dst_reg reg) { - ir_to_mesa_src_reg src_reg; - - src_reg.file = reg.file; - src_reg.index = reg.index; - src_reg.swizzle = SWIZZLE_XYZW; - src_reg.negate = 0; - src_reg.reladdr = reg.reladdr; - - return src_reg; + return ir_to_mesa_src_reg(reg.file, reg.index, NULL); } /** @@ -460,13 +469,10 @@ ir_to_mesa_visitor::ir_to_mesa_emit_scalar_op1(ir_instruction *ir, struct ir_to_mesa_src_reg ir_to_mesa_visitor::src_reg_for_float(float val) { - ir_to_mesa_src_reg src_reg; + ir_to_mesa_src_reg src_reg(PROGRAM_CONSTANT, -1, NULL); - src_reg.file = PROGRAM_CONSTANT; src_reg.index = _mesa_add_unnamed_constant(this->prog->Parameters, &val, 1, &src_reg.swizzle); - src_reg.reladdr = NULL; - src_reg.negate = 0; return src_reg; } @@ -1238,7 +1244,6 @@ get_builtin_matrix_ref(void *mem_ctx, struct gl_program *prog, ir_variable *var, void ir_to_mesa_visitor::visit(ir_dereference_variable *ir) { - ir_to_mesa_src_reg src_reg; variable_storage *entry = find_variable_storage(ir->var); unsigned int loc; int len; @@ -1340,17 +1345,7 @@ ir_to_mesa_visitor::visit(ir_dereference_variable *ir) } } - src_reg.file = entry->file; - src_reg.index = entry->index; - /* If the type is smaller than a vec4, replicate the last channel out. */ - if (ir->type->is_scalar() || ir->type->is_vector()) - src_reg.swizzle = swizzle_for_size(ir->var->type->vector_elements); - else - src_reg.swizzle = SWIZZLE_NOOP; - src_reg.reladdr = NULL; - src_reg.negate = 0; - - this->result = src_reg; + this->result = ir_to_mesa_src_reg(entry->file, entry->index, ir->var->type); } void @@ -1367,17 +1362,13 @@ ir_to_mesa_visitor::visit(ir_dereference_array *ir) if (deref_var && strncmp(deref_var->var->name, "gl_TextureMatrix", strlen("gl_TextureMatrix")) == 0) { - ir_to_mesa_src_reg src_reg; struct variable_storage *entry; entry = get_builtin_matrix_ref(this->mem_ctx, this->prog, deref_var->var, ir->array_index); assert(entry); - src_reg.file = entry->file; - src_reg.index = entry->index; - src_reg.swizzle = swizzle_for_size(ir->type->vector_elements); - src_reg.negate = 0; + ir_to_mesa_src_reg src_reg(entry->file, entry->index, ir->type); if (index) { src_reg.reladdr = NULL; @@ -1646,17 +1637,14 @@ ir_to_mesa_visitor::visit(ir_constant *ir) ir_to_mesa_dst_reg mat_column = ir_to_mesa_dst_reg_from_src(mat); for (i = 0; i < ir->type->matrix_columns; i++) { - src_reg.file = PROGRAM_CONSTANT; - assert(ir->type->base_type == GLSL_TYPE_FLOAT); values = &ir->value.f[i * ir->type->vector_elements]; + src_reg = ir_to_mesa_src_reg(PROGRAM_CONSTANT, -1, NULL); src_reg.index = _mesa_add_unnamed_constant(this->prog->Parameters, - values, - ir->type->vector_elements, - &src_reg.swizzle); - src_reg.reladdr = NULL; - src_reg.negate = 0; + values, + ir->type->vector_elements, + &src_reg.swizzle); ir_to_mesa_emit_op1(ir, OPCODE_MOV, mat_column, src_reg); mat_column.index++; @@ -1689,13 +1677,11 @@ ir_to_mesa_visitor::visit(ir_constant *ir) assert(!"Non-float/uint/int/bool constant"); } - src_reg.index = _mesa_add_unnamed_constant(this->prog->Parameters, - values, ir->type->vector_elements, - &src_reg.swizzle); - src_reg.reladdr = NULL; - src_reg.negate = 0; - - this->result = src_reg; + this->result = ir_to_mesa_src_reg(PROGRAM_CONSTANT, -1, ir->type); + this->result.index = _mesa_add_unnamed_constant(this->prog->Parameters, + values, + ir->type->vector_elements, + &this->result.swizzle); } function_entry * @@ -1825,7 +1811,7 @@ ir_to_mesa_visitor::visit(ir_call *ir) void ir_to_mesa_visitor::visit(ir_texture *ir) { - ir_to_mesa_src_reg result_src, coord, lod_info = { 0 }, projector; + ir_to_mesa_src_reg result_src, coord, lod_info, projector; ir_to_mesa_dst_reg result_dst, coord_dst; ir_to_mesa_instruction *inst = NULL; prog_opcode opcode = OPCODE_NOP; -- cgit v1.2.3 From 26675e37bc5a086c6df77946d2dada34dc9129f0 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 2 Aug 2010 14:32:52 -0700 Subject: ir_to_mesa: Support for struct uniforms. Fixes glsl-uniform-struct. --- src/mesa/program/ir_to_mesa.cpp | 78 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) (limited to 'src') diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp index 5510440475..7d5761f699 100644 --- a/src/mesa/program/ir_to_mesa.cpp +++ b/src/mesa/program/ir_to_mesa.cpp @@ -252,6 +252,11 @@ public: GLboolean try_emit_mad(ir_expression *ir, int mul_operand); + void add_aggregate_uniform(ir_instruction *ir, + const char *name, + const struct glsl_type *type, + struct ir_to_mesa_dst_reg temp); + int *sampler_map; int sampler_map_size; @@ -1241,6 +1246,62 @@ get_builtin_matrix_ref(void *mem_ctx, struct gl_program *prog, ir_variable *var, return NULL; } +/* Recursively add all the members of the aggregate uniform as uniform names + * to Mesa, moving those uniforms to our structured temporary. + */ +void +ir_to_mesa_visitor::add_aggregate_uniform(ir_instruction *ir, + const char *name, + const struct glsl_type *type, + struct ir_to_mesa_dst_reg temp) +{ + int loc; + + if (type->is_record()) { + void *mem_ctx = talloc_new(NULL); + + for (unsigned int i = 0; i < type->length; i++) { + const glsl_type *field_type = type->fields.structure[i].type; + add_aggregate_uniform(ir, + talloc_asprintf(mem_ctx, "%s.%s", name, + type->fields.structure[i].name), + field_type, temp); + temp.index += type_size(field_type); + } + + talloc_free(mem_ctx); + + return; + } + + assert(type->is_vector() || type->is_scalar() || !"FINISHME: other types"); + + int len; + + if (type->is_vector() || + type->is_scalar()) { + len = type->vector_elements; + } else { + len = type_size(type) * 4; + } + + loc = _mesa_add_uniform(this->prog->Parameters, + name, + len, + type->gl_type, + NULL); + + + ir_to_mesa_src_reg uniform(PROGRAM_UNIFORM, loc, type); + + for (int i = 0; i < type_size(type); i++) { + ir_to_mesa_emit_op1(ir, OPCODE_MOV, temp, uniform); + temp.index++; + uniform.index++; + } +} + + void ir_to_mesa_visitor::visit(ir_dereference_variable *ir) { @@ -1276,6 +1337,23 @@ ir_to_mesa_visitor::visit(ir_dereference_variable *ir) assert(ir->var->type->gl_type != 0 && ir->var->type->gl_type != GL_INVALID_ENUM); + /* Oh, the joy of aggregate types in Mesa. Like constants, + * we can only really do vec4s. So, make a temp, chop the + * aggregate up into vec4s, and move those vec4s to the temp. + */ + if (ir->var->type->is_record()) { + ir_to_mesa_src_reg temp = get_temp(ir->var->type); + + entry = new(mem_ctx) variable_storage(ir->var, + temp.file, + temp.index); + this->variables.push_tail(entry); + + add_aggregate_uniform(ir->var, ir->var->name, ir->var->type, + ir_to_mesa_dst_reg_from_src(temp)); + break; + } + if (ir->var->type->is_vector() || ir->var->type->is_scalar()) { len = ir->var->type->vector_elements; -- cgit v1.2.3 From b10bb527eaf39378da25dd4ad21b1c68ceaa1e2d Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 2 Aug 2010 16:59:20 -0700 Subject: Initialize a couple of HasIndex2 fields on Mesa IR src regs. --- src/mesa/drivers/dri/i965/brw_wm_fp.c | 1 + src/mesa/program/ir_to_mesa.cpp | 1 + 2 files changed, 2 insertions(+) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_wm_fp.c b/src/mesa/drivers/dri/i965/brw_wm_fp.c index 0bef874b88..df9e54c6b4 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_fp.c +++ b/src/mesa/drivers/dri/i965/brw_wm_fp.c @@ -88,6 +88,7 @@ static struct prog_src_register src_reg(GLuint file, GLuint idx) reg.RelAddr = 0; reg.Negate = NEGATE_NONE; reg.Abs = 0; + reg.HasIndex2 = 0; return reg; } diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp index 7d5761f699..af306f05d8 100644 --- a/src/mesa/program/ir_to_mesa.cpp +++ b/src/mesa/program/ir_to_mesa.cpp @@ -2115,6 +2115,7 @@ mesa_src_reg_from_ir_src_reg(ir_to_mesa_src_reg reg) mesa_reg.RelAddr = reg.reladdr != NULL; mesa_reg.Negate = reg.negate; mesa_reg.Abs = 0; + mesa_reg.HasIndex2 = GL_FALSE; return mesa_reg; } -- 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') 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 47f305a4fcd23f859d097c6cc25a739547462939 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 2 Aug 2010 17:05:48 -0700 Subject: ir_to_mesa: Add support for 1.20 uniform initializers. Fixes: glsl-uniform-initializer-1 glsl-uniform-initializer-2 glsl-uniform-initializer-3 glsl-uniform-initializer-4 glsl1-GLSL 1.20 uniform array constructor --- src/mesa/program/ir_to_mesa.cpp | 127 ++++++++++++++++++++++++++++++---------- 1 file changed, 97 insertions(+), 30 deletions(-) (limited to 'src') diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp index af306f05d8..ba0934c446 100644 --- a/src/mesa/program/ir_to_mesa.cpp +++ b/src/mesa/program/ir_to_mesa.cpp @@ -252,9 +252,13 @@ public: GLboolean try_emit_mad(ir_expression *ir, int mul_operand); + int add_uniform(const char *name, + const glsl_type *type, + ir_constant *constant); void add_aggregate_uniform(ir_instruction *ir, const char *name, const struct glsl_type *type, + ir_constant *constant, struct ir_to_mesa_dst_reg temp); int *sampler_map; @@ -1246,6 +1250,83 @@ get_builtin_matrix_ref(void *mem_ctx, struct gl_program *prog, ir_variable *var, return NULL; } +int +ir_to_mesa_visitor::add_uniform(const char *name, + const glsl_type *type, + ir_constant *constant) +{ + int len; + + if (type->is_vector() || + type->is_scalar()) { + len = type->vector_elements; + } else { + len = type_size(type) * 4; + } + + float *values = NULL; + if (constant && type->is_array()) { + values = (float *)malloc(type->length * 4 * sizeof(float)); + + assert(type->fields.array->is_scalar() || + type->fields.array->is_vector() || + !"FINISHME: uniform array initializers for non-vector"); + + for (unsigned int i = 0; i < type->length; i++) { + ir_constant *element = constant->array_elements[i]; + unsigned int c; + + for (c = 0; c < type->fields.array->vector_elements; c++) { + switch (type->fields.array->base_type) { + case GLSL_TYPE_FLOAT: + values[4 * i + c] = element->value.f[c]; + break; + case GLSL_TYPE_INT: + values[4 * i + c] = element->value.i[c]; + break; + case GLSL_TYPE_UINT: + values[4 * i + c] = element->value.u[c]; + break; + case GLSL_TYPE_BOOL: + values[4 * i + c] = element->value.b[c]; + break; + default: + assert(!"not reached"); + } + } + } + } else if (constant) { + values = (float *)malloc(16 * sizeof(float)); + for (unsigned int i = 0; i < type->components(); i++) { + switch (type->base_type) { + case GLSL_TYPE_FLOAT: + values[i] = constant->value.f[i]; + break; + case GLSL_TYPE_INT: + values[i] = constant->value.i[i]; + break; + case GLSL_TYPE_UINT: + values[i] = constant->value.u[i]; + break; + case GLSL_TYPE_BOOL: + values[i] = constant->value.b[i]; + break; + default: + assert(!"not reached"); + } + } + } + + int loc = _mesa_add_uniform(this->prog->Parameters, + name, + len, + type->gl_type, + values); + free(values); + + return loc; +} + /* Recursively add all the members of the aggregate uniform as uniform names * to Mesa, moving those uniforms to our structured temporary. */ @@ -1253,20 +1334,29 @@ void ir_to_mesa_visitor::add_aggregate_uniform(ir_instruction *ir, const char *name, const struct glsl_type *type, + ir_constant *constant, struct ir_to_mesa_dst_reg temp) { int loc; if (type->is_record()) { void *mem_ctx = talloc_new(NULL); + ir_constant *field_constant = NULL; + + if (constant) + field_constant = (ir_constant *)constant->components.get_head(); for (unsigned int i = 0; i < type->length; i++) { const glsl_type *field_type = type->fields.structure[i].type; + add_aggregate_uniform(ir, talloc_asprintf(mem_ctx, "%s.%s", name, type->fields.structure[i].name), - field_type, temp); + field_type, field_constant, temp); temp.index += type_size(field_type); + + if (constant) + field_constant = (ir_constant *)field_constant->next; } talloc_free(mem_ctx); @@ -1276,21 +1366,7 @@ ir_to_mesa_visitor::add_aggregate_uniform(ir_instruction *ir, assert(type->is_vector() || type->is_scalar() || !"FINISHME: other types"); - int len; - - if (type->is_vector() || - type->is_scalar()) { - len = type->vector_elements; - } else { - len = type_size(type) * 4; - } - - loc = _mesa_add_uniform(this->prog->Parameters, - name, - len, - type->gl_type, - NULL); - + loc = add_uniform(name, type, constant); ir_to_mesa_src_reg uniform(PROGRAM_UNIFORM, loc, type); @@ -1307,7 +1383,6 @@ ir_to_mesa_visitor::visit(ir_dereference_variable *ir) { variable_storage *entry = find_variable_storage(ir->var); unsigned int loc; - int len; if (!entry) { switch (ir->var->mode) { @@ -1350,22 +1425,14 @@ ir_to_mesa_visitor::visit(ir_dereference_variable *ir) this->variables.push_tail(entry); add_aggregate_uniform(ir->var, ir->var->name, ir->var->type, - ir_to_mesa_dst_reg_from_src(temp)); + ir->var->constant_value, + ir_to_mesa_dst_reg_from_src(temp)); break; } - if (ir->var->type->is_vector() || - ir->var->type->is_scalar()) { - len = ir->var->type->vector_elements; - } else { - len = type_size(ir->var->type) * 4; - } - - loc = _mesa_add_uniform(this->prog->Parameters, - ir->var->name, - len, - ir->var->type->gl_type, - NULL); + loc = add_uniform(ir->var->name, + ir->var->type, + ir->var->constant_value); /* Always mark the uniform used at this point. If it isn't * used, dead code elimination should have nuked the decl already. -- 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') 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') 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') 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') 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') 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') 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 8e181b629f97ada65cc1b8a17ba42edc2ea77254 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 4 Aug 2010 14:13:08 -0700 Subject: mesa: Don't null deref looking for Mesa IR code at compile time. The new compiler doesn't generate Mesa IR at compile time, and that compile time code previously wouldn't have reflected the link time code that actually got used. But do dump the info log of the compile regardless. --- src/mesa/program/prog_print.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/mesa/program/prog_print.c b/src/mesa/program/prog_print.c index 6ab199aa02..b66d709d50 100644 --- a/src/mesa/program/prog_print.c +++ b/src/mesa/program/prog_print.c @@ -1031,11 +1031,9 @@ _mesa_write_shader_to_file(const struct gl_shader *shader) 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, "/* Log Info: */\n"); + fputs(shader->InfoLog, f); + if (shader->CompileStatus && shader->Program) { fprintf(f, "/* GPU code */\n"); fprintf(f, "/*\n"); _mesa_fprint_program_opt(f, shader->Program, PROG_PRINT_DEBUG, GL_TRUE); -- cgit v1.2.3 From fe1918c71c3e387939cef9359d4b31ebc5c11a17 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 4 Aug 2010 14:21:01 -0700 Subject: ir_to_mesa: Clean up the mapping of samplers to Mesa's sampler uniforms. Instead of using a linker-assigned location (since samplers don't actually take up uniform space, being a link-time choice), use the sampler's varaible pointer as a hash key. --- src/mesa/program/ir_to_mesa.cpp | 42 +++++++++++++++++++++-------------------- 1 file changed, 22 insertions(+), 20 deletions(-) (limited to 'src') diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp index dcf8c497c6..777b4d91f4 100644 --- a/src/mesa/program/ir_to_mesa.cpp +++ b/src/mesa/program/ir_to_mesa.cpp @@ -45,6 +45,7 @@ extern "C" { #include "main/mtypes.h" #include "main/shaderobj.h" #include "main/uniforms.h" +#include "program/hash_table.h" #include "program/prog_instruction.h" #include "program/prog_optimize.h" #include "program/prog_print.h" @@ -160,6 +161,7 @@ public: class ir_to_mesa_visitor : public ir_visitor { public: ir_to_mesa_visitor(); + ~ir_to_mesa_visitor(); function_entry *current_function; @@ -261,11 +263,10 @@ public: ir_constant *constant, struct ir_to_mesa_dst_reg temp); - int *sampler_map; - int sampler_map_size; + struct hash_table *sampler_map; - void map_sampler(int location, int sampler); - int get_sampler_number(int location); + void set_sampler_location(ir_variable *sampler, int location); + int get_sampler_location(ir_variable *sampler); void *mem_ctx; }; @@ -370,22 +371,22 @@ ir_to_mesa_visitor::ir_to_mesa_emit_op0(ir_instruction *ir, } void -ir_to_mesa_visitor::map_sampler(int location, int sampler) +ir_to_mesa_visitor::set_sampler_location(ir_variable *sampler, int location) { - 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; + if (this->sampler_map == NULL) { + this->sampler_map = hash_table_ctor(0, hash_table_pointer_hash, + hash_table_pointer_compare); } - this->sampler_map[location] = sampler; + hash_table_insert(this->sampler_map, (void *)(uintptr_t)location, sampler); } int -ir_to_mesa_visitor::get_sampler_number(int location) +ir_to_mesa_visitor::get_sampler_location(ir_variable *sampler) { - assert(location < this->sampler_map_size); - return this->sampler_map[location]; + void *result = hash_table_find(this->sampler_map, sampler); + + return (int)(uintptr_t)result; } inline ir_to_mesa_dst_reg @@ -1394,14 +1395,10 @@ ir_to_mesa_visitor::visit(ir_dereference_variable *ir) /* 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); + set_sampler_location(ir->var, sampler); entry = new(mem_ctx) variable_storage(ir->var, PROGRAM_SAMPLER, sampler); @@ -2059,7 +2056,7 @@ ir_to_mesa_visitor::visit(ir_texture *ir) */ sampler->accept(this); - inst->sampler = get_sampler_number(sampler->var->location); + inst->sampler = get_sampler_location(sampler->var); switch (sampler->type->sampler_dimensionality) { case GLSL_SAMPLER_DIM_1D: @@ -2166,10 +2163,15 @@ ir_to_mesa_visitor::ir_to_mesa_visitor() next_temp = 1; next_signature_id = 1; sampler_map = NULL; - sampler_map_size = 0; current_function = NULL; } +ir_to_mesa_visitor::~ir_to_mesa_visitor() +{ + if (this->sampler_map) + hash_table_dtor(this->sampler_map); +} + static struct prog_src_register mesa_src_reg_from_ir_src_reg(ir_to_mesa_src_reg reg) { -- 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') 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') 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') 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') 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') 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') 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') 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') 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') 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') 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') 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') 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') 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') 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') 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 455290e4281bf53ce2fe248a2adf5163563c44c8 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 4 Aug 2010 19:43:41 -0700 Subject: ir_to_mesa: Print shader source and compiled IR under MESA_GLSL=dump. While the Mesa IR dumping includes some corresponding GLSL IR for correlating Mesa IR to GLSL IR, it doesn't completely express it. This printing includes things like variable declarations and control flow structure that is hard to read otherwise. --- src/mesa/program/ir_to_mesa.cpp | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp index 1cec4aa621..2fd07ca611 100644 --- a/src/mesa/program/ir_to_mesa.cpp +++ b/src/mesa/program/ir_to_mesa.cpp @@ -2545,7 +2545,14 @@ 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("Mesa %s program:\n", target_string); + printf("\n"); + printf("GLSL IR for linked %s program %d:\n", target_string, + shader_program->Name); + _mesa_print_ir(shader->ir, NULL); + printf("\n"); + printf("\n"); + printf("Mesa IR for linked %s program %d:\n", target_string, + shader_program->Name); print_program(mesa_instructions, mesa_instruction_annotation, num_instructions); } @@ -2635,6 +2642,15 @@ _mesa_glsl_compile_shader(GLcontext *ctx, struct gl_shader *shader) _mesa_write_shader_to_file(shader); } + if (ctx->Shader.Flags & GLSL_DUMP) { + printf("GLSL source for shader %d:\n", shader->Name); + printf("%s\n", shader->Source); + + printf("GLSL IR for shader %d:\n", shader->Name); + _mesa_print_ir(shader->ir, NULL); + printf("\n\n"); + } + /* Retain any live IR, but trash the rest. */ reparent_ir(shader->ir, shader); -- cgit v1.2.3 From 72fd0568db0ce5f25a1eee0266ec1e7cb3dafab0 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 4 Aug 2010 19:55:52 -0700 Subject: i965: Settle on printing our program debug to stdout. Mixing stderr (_mesa_print_program, _mesa_print_instruction, _mesa_print_alu) with stdout means that when writing both to a file, there isn't a consistent ordering between the two. --- src/mesa/drivers/dri/i965/brw_vs.c | 8 ++++---- src/mesa/drivers/dri/i965/brw_vs_emit.c | 3 ++- src/mesa/drivers/dri/i965/brw_wm_fp.c | 10 +++++----- src/mesa/program/prog_print.c | 32 ++++++++++++++++---------------- src/mesa/program/prog_print.h | 7 +++++++ 5 files changed, 34 insertions(+), 26 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_vs.c b/src/mesa/drivers/dri/i965/brw_vs.c index 9a832af9a9..9f90e1e5e5 100644 --- a/src/mesa/drivers/dri/i965/brw_vs.c +++ b/src/mesa/drivers/dri/i965/brw_vs.c @@ -75,10 +75,10 @@ static void do_vs_prog( struct brw_context *brw, c.prog_data.outputs_written |= BITFIELD64_BIT(VERT_RESULT_TEX0 + i); } - if (0) - _mesa_print_program(&c.vp->program.Base); - - + if (0) { + _mesa_fprint_program_opt(stdout, &c.vp->program.Base, PROG_PRINT_DEBUG, + GL_TRUE); + } /* Emit GEN4 code. */ diff --git a/src/mesa/drivers/dri/i965/brw_vs_emit.c b/src/mesa/drivers/dri/i965/brw_vs_emit.c index c1d6525e9b..d2bd2c7f79 100644 --- a/src/mesa/drivers/dri/i965/brw_vs_emit.c +++ b/src/mesa/drivers/dri/i965/brw_vs_emit.c @@ -1564,7 +1564,8 @@ void brw_vs_emit(struct brw_vs_compile *c ) if (INTEL_DEBUG & DEBUG_VS) { printf("vs-mesa:\n"); - _mesa_print_program(&c->vp->program.Base); + _mesa_fprint_program_opt(stdout, &c->vp->program.Base, PROG_PRINT_DEBUG, + GL_TRUE); printf("\n"); } diff --git a/src/mesa/drivers/dri/i965/brw_wm_fp.c b/src/mesa/drivers/dri/i965/brw_wm_fp.c index df9e54c6b4..3870bf10fc 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_fp.c +++ b/src/mesa/drivers/dri/i965/brw_wm_fp.c @@ -1037,13 +1037,12 @@ static void print_insns( const struct prog_instruction *insn, for (i = 0; i < nr; i++, insn++) { printf("%3d: ", i); if (insn->Opcode < MAX_OPCODE) - _mesa_print_instruction(insn); + _mesa_fprint_instruction_opt(stdout, insn, 0, PROG_PRINT_DEBUG, NULL); else if (insn->Opcode < MAX_WM_OPCODE) { GLuint idx = insn->Opcode - MAX_OPCODE; - _mesa_print_alu_instruction(insn, - wm_opcode_strings[idx], - 3); + _mesa_fprint_alu_instruction(stdout, insn, wm_opcode_strings[idx], + 3, PROG_PRINT_DEBUG, NULL); } else printf("965 Opcode %d\n", insn->Opcode); @@ -1062,7 +1061,8 @@ void brw_wm_pass_fp( struct brw_wm_compile *c ) if (INTEL_DEBUG & DEBUG_WM) { printf("pre-fp:\n"); - _mesa_print_program(&fp->program.Base); + _mesa_fprint_program_opt(stdout, &fp->program.Base, PROG_PRINT_DEBUG, + GL_TRUE); printf("\n"); } diff --git a/src/mesa/program/prog_print.c b/src/mesa/program/prog_print.c index b66d709d50..1ce1bf2f4e 100644 --- a/src/mesa/program/prog_print.c +++ b/src/mesa/program/prog_print.c @@ -540,12 +540,12 @@ fprint_comment(FILE *f, const struct prog_instruction *inst) } -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) +void +_mesa_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; @@ -582,8 +582,8 @@ 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); + _mesa_fprint_alu_instruction(stderr, inst, opcode_string, + numRegs, PROG_PRINT_DEBUG, NULL); } @@ -791,16 +791,16 @@ _mesa_fprint_instruction_opt(FILE *f, 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); + _mesa_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); + _mesa_fprint_alu_instruction(f, inst, + _mesa_opcode_string(inst->Opcode), + 3/*_mesa_num_inst_src_regs(inst->Opcode)*/, + mode, prog); } break; } diff --git a/src/mesa/program/prog_print.h b/src/mesa/program/prog_print.h index 9ab7456016..4ffd5ab96c 100644 --- a/src/mesa/program/prog_print.h +++ b/src/mesa/program/prog_print.h @@ -55,6 +55,13 @@ _mesa_writemask_string(GLuint writeMask); extern void _mesa_print_swizzle(GLuint swizzle); +extern void +_mesa_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); + extern void _mesa_print_alu_instruction(const struct prog_instruction *inst, const char *opcode_string, GLuint numRegs); -- 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') 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') 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') 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') 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') 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') 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 9de2c4fc8e620ffe7faecd499c82d9d38ec538a6 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 4 Aug 2010 22:35:32 -0700 Subject: ir_to_mesa: Remove debug force-enablement of EmitNoIfs. --- src/mesa/program/ir_to_mesa.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp index 2fd07ca611..f0e013369a 100644 --- a/src/mesa/program/ir_to_mesa.cpp +++ b/src/mesa/program/ir_to_mesa.cpp @@ -2614,7 +2614,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 (1 || ctx->Shader.EmitNoIfs) + if (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 8f6a0c9ed985267c2d202cf85d17ac04bddfb9d2 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 4 Aug 2010 22:57:08 -0700 Subject: glsl2: Don't try to dump GLSL IR for a shader that didn't compile. --- src/mesa/program/ir_to_mesa.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp index f0e013369a..74996ae480 100644 --- a/src/mesa/program/ir_to_mesa.cpp +++ b/src/mesa/program/ir_to_mesa.cpp @@ -2646,9 +2646,11 @@ _mesa_glsl_compile_shader(GLcontext *ctx, struct gl_shader *shader) printf("GLSL source for shader %d:\n", shader->Name); printf("%s\n", shader->Source); - printf("GLSL IR for shader %d:\n", shader->Name); - _mesa_print_ir(shader->ir, NULL); - printf("\n\n"); + if (shader->CompileStatus) { + printf("GLSL IR for shader %d:\n", shader->Name); + _mesa_print_ir(shader->ir, NULL); + printf("\n\n"); + } } /* Retain any live IR, but trash the rest. */ -- 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') 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') 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 e995f0e10c9ee51f7c8f8fa2193ff99e1b49e40d Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 5 Aug 2010 10:13:10 -0700 Subject: ir_to_mesa: Don't do function inlining until linking. Optimizations at compile time should generally be done with the goal of reducing instruction count so that other work, particularly linking, is less time-consuming if the shader is used multiple times. However, function inlining increases instruction count for the inlined function bodies without removing the original function body, since we don't know if it will be used at link time or not. Reduces the runtime of linking and executing a Yo Frankie fragment shader from 0.9 seconds to 0.5 seconds (-45.9%, +/- 2.2%, n=5). --- src/mesa/program/ir_to_mesa.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'src') diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp index 74996ae480..299b11d274 100644 --- a/src/mesa/program/ir_to_mesa.cpp +++ b/src/mesa/program/ir_to_mesa.cpp @@ -2604,7 +2604,6 @@ _mesa_glsl_compile_shader(GLcontext *ctx, struct gl_shader *shader) 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; -- 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') 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') 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') 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') 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') 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') 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') 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') 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') 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') 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') 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') 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 0a86d766ef0d98abd3373609a637bf137203e994 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Thu, 5 Aug 2010 17:57:48 -0700 Subject: ir_to_mesa: Handle texture-array samplers Fixes piglit test array_texture. --- src/mesa/program/ir_to_mesa.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp index 26fbc4349a..f5e5f7d7b8 100644 --- a/src/mesa/program/ir_to_mesa.cpp +++ b/src/mesa/program/ir_to_mesa.cpp @@ -2040,10 +2040,12 @@ ir_to_mesa_visitor::visit(ir_texture *ir) switch (sampler->type->sampler_dimensionality) { case GLSL_SAMPLER_DIM_1D: - inst->tex_target = TEXTURE_1D_INDEX; + inst->tex_target = (sampler->type->sampler_array) + ? TEXTURE_1D_ARRAY_INDEX : TEXTURE_1D_INDEX; break; case GLSL_SAMPLER_DIM_2D: - inst->tex_target = TEXTURE_2D_INDEX; + inst->tex_target = (sampler->type->sampler_array) + ? TEXTURE_2D_ARRAY_INDEX : TEXTURE_2D_INDEX; break; case GLSL_SAMPLER_DIM_3D: inst->tex_target = TEXTURE_3D_INDEX; -- cgit v1.2.3 From 658e25987fbec3b826f500baa6d4d936b9552b13 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 5 Aug 2010 15:54:56 -0700 Subject: ir_to_mesa: Give the expected size for _mesa_add_attribute(). Fixes a failure in glean shaderAPI. --- src/mesa/program/ir_to_mesa.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp index f5e5f7d7b8..9979e6e3e0 100644 --- a/src/mesa/program/ir_to_mesa.cpp +++ b/src/mesa/program/ir_to_mesa.cpp @@ -43,6 +43,7 @@ extern "C" { #include "main/mtypes.h" +#include "main/shaderapi.h" #include "main/shaderobj.h" #include "main/uniforms.h" #include "program/hash_table.h" @@ -1458,7 +1459,7 @@ ir_to_mesa_visitor::visit(ir_dereference_variable *ir) ir->var->location >= VERT_ATTRIB_GENERIC0) { _mesa_add_attribute(prog->Attributes, ir->var->name, - type_size(ir->var->type) * 4, + _mesa_sizeof_glsl_type(ir->var->type->gl_type), ir->var->type->gl_type, ir->var->location - VERT_ATTRIB_GENERIC0); } -- 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') 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') 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 c234d0b25f622a7bdd3c40bc72fdbd59d8494c7c Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 5 Aug 2010 17:00:12 -0700 Subject: ir_to_mesa: Add support for sampler arrays. Support for samplers in general is still incomplete -- anything in a uniform struct will still be broken. But that doesn't appear to be any different from master. Fixes: glsl-fs-uniform-sampler-array.shader_test --- src/mesa/program/ir_to_mesa.cpp | 47 +++++++++++++++++++++++++++++++-------- src/mesa/program/prog_parameter.c | 7 +++--- src/mesa/program/prog_parameter.h | 2 +- 3 files changed, 43 insertions(+), 13 deletions(-) (limited to 'src') diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp index 66b1a2f9d9..d8a13220ae 100644 --- a/src/mesa/program/ir_to_mesa.cpp +++ b/src/mesa/program/ir_to_mesa.cpp @@ -1398,10 +1398,19 @@ 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) { + if (ir->var->type->base_type == GLSL_TYPE_SAMPLER || + (ir->var->type->base_type == GLSL_TYPE_ARRAY && + ir->var->type->fields.array->base_type == GLSL_TYPE_SAMPLER)) { + int array_length; + + if (ir->var->type->base_type == GLSL_TYPE_ARRAY) + array_length = ir->var->type->length; + else + array_length = 1; int sampler = _mesa_add_sampler(this->prog->Parameters, ir->var->name, - ir->var->type->gl_type); + ir->var->type->gl_type, + array_length); set_sampler_location(ir->var, sampler); entry = new(mem_ctx) variable_storage(ir->var, PROGRAM_SAMPLER, @@ -2035,22 +2044,42 @@ ir_to_mesa_visitor::visit(ir_texture *ir) if (ir->shadow_comparitor) inst->tex_shadow = GL_TRUE; - ir_dereference_variable *sampler = ir->sampler->as_dereference_variable(); - assert(sampler); /* FINISHME: sampler arrays */ + ir_variable *sampler = ir->sampler->variable_referenced(); + /* generate the mapping, remove when we generate storage at * declaration time */ - sampler->accept(this); + ir->sampler->accept(this); + + inst->sampler = get_sampler_location(sampler); + + ir_dereference_array *sampler_array = ir->sampler->as_dereference_array(); + if (sampler_array) { + ir_constant *array_index = + sampler_array->array_index->constant_expression_value(); + + /* GLSL 1.10 and 1.20 allowed variable sampler array indices, + * while GLSL 1.30 requires that the array indices be constant + * integer expressions. We don't expect any driver to actually + * work with a really variable array index, and in 1.20 all that + * would work would be an unrolled loop counter, so assert that + * we ended up with a constant at least.. + */ + assert(array_index); + inst->sampler += array_index->value.i[0]; + } - inst->sampler = get_sampler_location(sampler->var); + const glsl_type *sampler_type = sampler->type; + while (sampler_type->base_type == GLSL_TYPE_ARRAY) + sampler_type = sampler_type->fields.array; - switch (sampler->type->sampler_dimensionality) { + switch (sampler_type->sampler_dimensionality) { case GLSL_SAMPLER_DIM_1D: - inst->tex_target = (sampler->type->sampler_array) + inst->tex_target = (sampler_type->sampler_array) ? TEXTURE_1D_ARRAY_INDEX : TEXTURE_1D_INDEX; break; case GLSL_SAMPLER_DIM_2D: - inst->tex_target = (sampler->type->sampler_array) + inst->tex_target = (sampler_type->sampler_array) ? TEXTURE_2D_ARRAY_INDEX : TEXTURE_2D_INDEX; break; case GLSL_SAMPLER_DIM_3D: diff --git a/src/mesa/program/prog_parameter.c b/src/mesa/program/prog_parameter.c index ddbfe95c15..fa5deaf127 100644 --- a/src/mesa/program/prog_parameter.c +++ b/src/mesa/program/prog_parameter.c @@ -344,18 +344,19 @@ _mesa_use_uniform(struct gl_program_parameter_list *paramList, */ GLint _mesa_add_sampler(struct gl_program_parameter_list *paramList, - const char *name, GLenum datatype) + const char *name, GLenum datatype, int array_length) { GLint i = _mesa_lookup_parameter_index(paramList, -1, name); if (i >= 0 && paramList->Parameters[i].Type == PROGRAM_SAMPLER) { - ASSERT(paramList->Parameters[i].Size == 1); + ASSERT(paramList->Parameters[i].Size == 4 * array_length); ASSERT(paramList->Parameters[i].DataType == datatype); /* already in list */ return (GLint) paramList->ParameterValues[i][0]; } else { GLuint i; - const GLint size = 1; /* a sampler is basically a texture unit number */ + /* One integer texture unit number goes in each parameter location. */ + const GLint size = 4 * array_length; GLfloat value[4]; GLint numSamplers = 0; for (i = 0; i < paramList->NumParameters; i++) { diff --git a/src/mesa/program/prog_parameter.h b/src/mesa/program/prog_parameter.h index cc3378ae20..1860f31287 100644 --- a/src/mesa/program/prog_parameter.h +++ b/src/mesa/program/prog_parameter.h @@ -142,7 +142,7 @@ _mesa_use_uniform(struct gl_program_parameter_list *paramList, extern GLint _mesa_add_sampler(struct gl_program_parameter_list *paramList, - const char *name, GLenum datatype); + const char *name, GLenum datatype, int array_length); extern GLint _mesa_add_varying(struct gl_program_parameter_list *paramList, -- 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') 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') 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') 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') 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') 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') 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') 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') 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') 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') 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') 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') 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') 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 81996ae8618759cf7fdd033042a96f3014659f6c Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 9 Aug 2010 18:23:58 -0700 Subject: i965: More s/stderr/stdout/ for program debug. --- src/mesa/drivers/dri/i965/brw_vs_emit.c | 2 +- src/mesa/drivers/dri/i965/brw_wm_emit.c | 2 +- src/mesa/drivers/dri/i965/brw_wm_glsl.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_vs_emit.c b/src/mesa/drivers/dri/i965/brw_vs_emit.c index d2bd2c7f79..fab6b4f3d5 100644 --- a/src/mesa/drivers/dri/i965/brw_vs_emit.c +++ b/src/mesa/drivers/dri/i965/brw_vs_emit.c @@ -1924,7 +1924,7 @@ void brw_vs_emit(struct brw_vs_compile *c ) printf("vs-native:\n"); for (i = 0; i < p->nr_insn; i++) - brw_disasm(stderr, &p->store[i], intel->gen); + brw_disasm(stdout, &p->store[i], intel->gen); printf("\n"); } } diff --git a/src/mesa/drivers/dri/i965/brw_wm_emit.c b/src/mesa/drivers/dri/i965/brw_wm_emit.c index 0c625a4cd0..053cf13a01 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_emit.c +++ b/src/mesa/drivers/dri/i965/brw_wm_emit.c @@ -1775,7 +1775,7 @@ void brw_wm_emit( struct brw_wm_compile *c ) printf("wm-native:\n"); for (i = 0; i < p->nr_insn; i++) - brw_disasm(stderr, &p->store[i], p->brw->intel.gen); + brw_disasm(stdout, &p->store[i], p->brw->intel.gen); printf("\n"); } } diff --git a/src/mesa/drivers/dri/i965/brw_wm_glsl.c b/src/mesa/drivers/dri/i965/brw_wm_glsl.c index 2dd346d6dd..f13b0aaf95 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_glsl.c +++ b/src/mesa/drivers/dri/i965/brw_wm_glsl.c @@ -2117,7 +2117,7 @@ static void brw_wm_emit_glsl(struct brw_context *brw, struct brw_wm_compile *c) if (INTEL_DEBUG & DEBUG_WM) { printf("wm-native:\n"); for (i = 0; i < p->nr_insn; i++) - brw_disasm(stderr, &p->store[i], intel->gen); + brw_disasm(stdout, &p->store[i], intel->gen); printf("\n"); } } -- 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') 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') 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') 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') 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') 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') 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') 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') 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') 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') 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') 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') 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') 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') 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') 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') 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 30d083903f28965122800cc6ba3dc1ad08aff47f Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 11 Aug 2010 14:00:02 -0600 Subject: glsl2: remove stray semicolon --- src/mesa/program/hash_table.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/program/hash_table.h b/src/mesa/program/hash_table.h index 228ab948ff..ec088c7dde 100644 --- a/src/mesa/program/hash_table.h +++ b/src/mesa/program/hash_table.h @@ -147,6 +147,6 @@ int hash_table_pointer_compare(const void *key1, const void *key2); #ifdef __cplusplus -}; +} #endif #endif /* HASH_TABLE_H */ -- 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') 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') 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 4415a846457622061cd93be2fdce2448b2eeb00b Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 11 Aug 2010 14:04:32 -0600 Subject: glsl2: remove stray semicolon --- src/mesa/main/shaderobj.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/main/shaderobj.h b/src/mesa/main/shaderobj.h index b48244dc0d..1b96316b67 100644 --- a/src/mesa/main/shaderobj.h +++ b/src/mesa/main/shaderobj.h @@ -92,7 +92,7 @@ extern void _mesa_free_shader_state(GLcontext *ctx); #ifdef __cplusplus -}; +} #endif #endif /* SHADEROBJ_H */ -- 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') 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 9b2d3c3285596a14a399c8243b1f426d887dc9d7 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 11 Aug 2010 14:27:56 -0600 Subject: osmesa: link with new libglsl.a lib --- src/mesa/drivers/osmesa/Makefile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/osmesa/Makefile b/src/mesa/drivers/osmesa/Makefile index c6b4a04085..091e6f66d9 100644 --- a/src/mesa/drivers/osmesa/Makefile +++ b/src/mesa/drivers/osmesa/Makefile @@ -23,8 +23,7 @@ INCLUDE_DIRS = \ CORE_MESA = \ $(TOP)/src/mesa/libmesa.a \ $(TOP)/src/mapi/glapi/libglapi.a \ - $(TOP)/src/glsl/cl/libglslcl.a \ - $(TOP)/src/glsl/pp/libglslpp.a + $(TOP)/src/glsl/libglsl.a .c.o: $(CC) -c $(INCLUDE_DIRS) $(CFLAGS) $< -o $@ -- 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') 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') 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') 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') 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') 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') 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') 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') 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') 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') 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') 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') 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') 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') 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 4f51762b070854901b48e461b76f614da414868d Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Thu, 12 Aug 2010 13:51:39 +0100 Subject: gallium: Link DRI drivers with g++ and test with CXX New shader compiler need libc++ runtime. This works already if we are using llvm so this just covers the !llvm case. --- src/gallium/targets/Makefile.dri | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/gallium/targets/Makefile.dri b/src/gallium/targets/Makefile.dri index de05f96d23..59961e982a 100644 --- a/src/gallium/targets/Makefile.dri +++ b/src/gallium/targets/Makefile.dri @@ -1,11 +1,12 @@ # -*-makefile-*- + ifeq ($(MESA_LLVM),1) PIPE_DRIVERS += $(TOP)/src/gallium/drivers/llvmpipe/libllvmpipe.a LDFLAGS += $(LLVM_LDFLAGS) -LD = g++ DRIVER_EXTRAS = $(LLVM_LIBS) -USE_CXX=1 +else +LDFLAGS += -lstdc++ endif MESA_MODULES = \ @@ -75,15 +76,11 @@ default: depend symlinks $(TOP)/$(LIB_DIR)/gallium $(LIBNAME) $(LIBNAME_STAGING) $(LIBNAME): $(OBJECTS) $(MESA_MODULES) $(PIPE_DRIVERS) 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) $(PIPE_DRIVERS) \ -Wl,--start-group $(MESA_MODULES) -Wl,--end-group \ $(DRI_LIB_DEPS) $(DRIVER_EXTRAS) - if [ "x${USE_CXX}" == "x" ]; then \ - $(CC) $(CFLAGS) -o $@.test $(TOP)/src/mesa/drivers/dri/common/dri_test.o $@.tmp $(DRI_LIB_DEPS); \ - else \ - $(CXX) $(CFLAGS) -o $@.test $(TOP)/src/mesa/drivers/dri/common/dri_test.o $@.tmp $(DRI_LIB_DEPS); \ - fi + $(CXX) $(CFLAGS) -o $@.test $(TOP)/src/mesa/drivers/dri/common/dri_test.o $@.tmp $(DRI_LIB_DEPS); @rm -f $@.test mv -f $@.tmp $@ -- 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') 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') 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 2d83e3fa0de6e0b39307cdc67725ca88855d68d2 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 12 Aug 2010 15:57:54 -0600 Subject: mesa: check for null shader->InfoLog before printing --- src/mesa/program/prog_print.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/program/prog_print.c b/src/mesa/program/prog_print.c index 1ce1bf2f4e..95db9b0eb3 100644 --- a/src/mesa/program/prog_print.c +++ b/src/mesa/program/prog_print.c @@ -1032,7 +1032,9 @@ _mesa_write_shader_to_file(const struct gl_shader *shader) fprintf(f, "/* Compile status: %s */\n", shader->CompileStatus ? "ok" : "fail"); fprintf(f, "/* Log Info: */\n"); - fputs(shader->InfoLog, f); + if (shader->InfoLog) { + fputs(shader->InfoLog, f); + } if (shader->CompileStatus && shader->Program) { fprintf(f, "/* GPU code */\n"); fprintf(f, "/*\n"); -- 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') 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') 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 e6032b1d961715f6dd848058023252e92c36fcde Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Fri, 13 Aug 2010 12:31:10 +0100 Subject: talloc: Import 2.0.1 code. --- src/talloc/gpl-3.0.txt | 674 +++++++++++++++ src/talloc/lgpl-3.0.txt | 165 ++++ src/talloc/talloc.c | 1994 +++++++++++++++++++++++++++++++++++++++++++ src/talloc/talloc.h | 202 +++++ src/talloc/talloc_guide.txt | 757 ++++++++++++++++ 5 files changed, 3792 insertions(+) create mode 100644 src/talloc/gpl-3.0.txt create mode 100644 src/talloc/lgpl-3.0.txt create mode 100644 src/talloc/talloc.c create mode 100644 src/talloc/talloc.h create mode 100644 src/talloc/talloc_guide.txt (limited to 'src') diff --git a/src/talloc/gpl-3.0.txt b/src/talloc/gpl-3.0.txt new file mode 100644 index 0000000000..94a9ed024d --- /dev/null +++ b/src/talloc/gpl-3.0.txt @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + 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 . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. diff --git a/src/talloc/lgpl-3.0.txt b/src/talloc/lgpl-3.0.txt new file mode 100644 index 0000000000..65c5ca88a6 --- /dev/null +++ b/src/talloc/lgpl-3.0.txt @@ -0,0 +1,165 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + + This version of the GNU Lesser General Public License incorporates +the terms and conditions of version 3 of the GNU General Public +License, supplemented by the additional permissions listed below. + + 0. Additional Definitions. + + As used herein, "this License" refers to version 3 of the GNU Lesser +General Public License, and the "GNU GPL" refers to version 3 of the GNU +General Public License. + + "The Library" refers to a covered work governed by this License, +other than an Application or a Combined Work as defined below. + + An "Application" is any work that makes use of an interface provided +by the Library, but which is not otherwise based on the Library. +Defining a subclass of a class defined by the Library is deemed a mode +of using an interface provided by the Library. + + A "Combined Work" is a work produced by combining or linking an +Application with the Library. The particular version of the Library +with which the Combined Work was made is also called the "Linked +Version". + + The "Minimal Corresponding Source" for a Combined Work means the +Corresponding Source for the Combined Work, excluding any source code +for portions of the Combined Work that, considered in isolation, are +based on the Application, and not on the Linked Version. + + The "Corresponding Application Code" for a Combined Work means the +object code and/or source code for the Application, including any data +and utility programs needed for reproducing the Combined Work from the +Application, but excluding the System Libraries of the Combined Work. + + 1. Exception to Section 3 of the GNU GPL. + + You may convey a covered work under sections 3 and 4 of this License +without being bound by section 3 of the GNU GPL. + + 2. Conveying Modified Versions. + + If you modify a copy of the Library, and, in your modifications, a +facility refers to a function or data to be supplied by an Application +that uses the facility (other than as an argument passed when the +facility is invoked), then you may convey a copy of the modified +version: + + a) under this License, provided that you make a good faith effort to + ensure that, in the event an Application does not supply the + function or data, the facility still operates, and performs + whatever part of its purpose remains meaningful, or + + b) under the GNU GPL, with none of the additional permissions of + this License applicable to that copy. + + 3. Object Code Incorporating Material from Library Header Files. + + The object code form of an Application may incorporate material from +a header file that is part of the Library. You may convey such object +code under terms of your choice, provided that, if the incorporated +material is not limited to numerical parameters, data structure +layouts and accessors, or small macros, inline functions and templates +(ten or fewer lines in length), you do both of the following: + + a) Give prominent notice with each copy of the object code that the + Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the object code with a copy of the GNU GPL and this license + document. + + 4. Combined Works. + + You may convey a Combined Work under terms of your choice that, +taken together, effectively do not restrict modification of the +portions of the Library contained in the Combined Work and reverse +engineering for debugging such modifications, if you also do each of +the following: + + a) Give prominent notice with each copy of the Combined Work that + the Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the Combined Work with a copy of the GNU GPL and this license + document. + + c) For a Combined Work that displays copyright notices during + execution, include the copyright notice for the Library among + these notices, as well as a reference directing the user to the + copies of the GNU GPL and this license document. + + d) Do one of the following: + + 0) Convey the Minimal Corresponding Source under the terms of this + License, and the Corresponding Application Code in a form + suitable for, and under terms that permit, the user to + recombine or relink the Application with a modified version of + the Linked Version to produce a modified Combined Work, in the + manner specified by section 6 of the GNU GPL for conveying + Corresponding Source. + + 1) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (a) uses at run time + a copy of the Library already present on the user's computer + system, and (b) will operate properly with a modified version + of the Library that is interface-compatible with the Linked + Version. + + e) Provide Installation Information, but only if you would otherwise + be required to provide such information under section 6 of the + GNU GPL, and only to the extent that such information is + necessary to install and execute a modified version of the + Combined Work produced by recombining or relinking the + Application with a modified version of the Linked Version. (If + you use option 4d0, the Installation Information must accompany + the Minimal Corresponding Source and Corresponding Application + Code. If you use option 4d1, you must provide the Installation + Information in the manner specified by section 6 of the GNU GPL + for conveying Corresponding Source.) + + 5. Combined Libraries. + + You may place library facilities that are a work based on the +Library side by side in a single library together with other library +facilities that are not Applications and are not covered by this +License, and convey such a combined library under terms of your +choice, if you do both of the following: + + a) Accompany the combined library with a copy of the same work based + on the Library, uncombined with any other library facilities, + conveyed under the terms of this License. + + b) Give prominent notice with the combined library that part of it + is a work based on the Library, and explaining where to find the + accompanying uncombined form of the same work. + + 6. Revised Versions of the GNU Lesser General Public License. + + The Free Software Foundation may publish revised and/or new versions +of the GNU Lesser General Public License from time to time. Such new +versions will be similar in spirit to the present version, but may +differ in detail to address new problems or concerns. + + Each version is given a distinguishing version number. If the +Library as you received it specifies that a certain numbered version +of the GNU Lesser General Public License "or any later version" +applies to it, you have the option of following the terms and +conditions either of that published version or of any later version +published by the Free Software Foundation. If the Library as you +received it does not specify a version number of the GNU Lesser +General Public License, you may choose any version of the GNU Lesser +General Public License ever published by the Free Software Foundation. + + If the Library as you received it specifies that a proxy can decide +whether future versions of the GNU Lesser General Public License shall +apply, that proxy's public statement of acceptance of any version is +permanent authorization for you to choose that version for the +Library. diff --git a/src/talloc/talloc.c b/src/talloc/talloc.c new file mode 100644 index 0000000000..7beda4b0f5 --- /dev/null +++ b/src/talloc/talloc.c @@ -0,0 +1,1994 @@ +/* + Samba Unix SMB/CIFS implementation. + + Samba trivial allocation library - new interface + + NOTE: Please read talloc_guide.txt for full documentation + + Copyright (C) Andrew Tridgell 2004 + Copyright (C) Stefan Metzmacher 2006 + + ** NOTE! The following LGPL license applies to the talloc + ** library. This does NOT imply that all of Samba is released + ** under the LGPL + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 3 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, see . +*/ + +/* + inspired by http://swapped.cc/halloc/ +*/ + +#include "replace.h" +#include "talloc.h" + +#ifdef TALLOC_BUILD_VERSION_MAJOR +#if (TALLOC_VERSION_MAJOR != TALLOC_BUILD_VERSION_MAJOR) +#error "TALLOC_VERSION_MAJOR != TALLOC_BUILD_VERSION_MAJOR" +#endif +#endif + +#ifdef TALLOC_BUILD_VERSION_MINOR +#if (TALLOC_VERSION_MINOR != TALLOC_BUILD_VERSION_MINOR) +#error "TALLOC_VERSION_MINOR != TALLOC_BUILD_VERSION_MINOR" +#endif +#endif + +/* use this to force every realloc to change the pointer, to stress test + code that might not cope */ +#define ALWAYS_REALLOC 0 + + +#define MAX_TALLOC_SIZE 0x10000000 +#define TALLOC_MAGIC_BASE 0xe814ec70 +#define TALLOC_MAGIC ( \ + TALLOC_MAGIC_BASE + \ + (TALLOC_VERSION_MAJOR << 12) + \ + (TALLOC_VERSION_MINOR << 4) \ +) + +#define TALLOC_FLAG_FREE 0x01 +#define TALLOC_FLAG_LOOP 0x02 +#define TALLOC_FLAG_POOL 0x04 /* This is a talloc pool */ +#define TALLOC_FLAG_POOLMEM 0x08 /* This is allocated in a pool */ +#define TALLOC_MAGIC_REFERENCE ((const char *)1) + +/* by default we abort when given a bad pointer (such as when talloc_free() is called + on a pointer that came from malloc() */ +#ifndef TALLOC_ABORT +#define TALLOC_ABORT(reason) abort() +#endif + +#ifndef discard_const_p +#if defined(__intptr_t_defined) || defined(HAVE_INTPTR_T) +# define discard_const_p(type, ptr) ((type *)((intptr_t)(ptr))) +#else +# define discard_const_p(type, ptr) ((type *)(ptr)) +#endif +#endif + +/* these macros gain us a few percent of speed on gcc */ +#if (__GNUC__ >= 3) +/* the strange !! is to ensure that __builtin_expect() takes either 0 or 1 + as its first argument */ +#ifndef likely +#define likely(x) __builtin_expect(!!(x), 1) +#endif +#ifndef unlikely +#define unlikely(x) __builtin_expect(!!(x), 0) +#endif +#else +#ifndef likely +#define likely(x) (x) +#endif +#ifndef unlikely +#define unlikely(x) (x) +#endif +#endif + +/* this null_context is only used if talloc_enable_leak_report() or + talloc_enable_leak_report_full() is called, otherwise it remains + NULL +*/ +static void *null_context; +static void *autofree_context; + +struct talloc_reference_handle { + struct talloc_reference_handle *next, *prev; + void *ptr; + const char *location; +}; + +typedef int (*talloc_destructor_t)(void *); + +struct talloc_chunk { + struct talloc_chunk *next, *prev; + struct talloc_chunk *parent, *child; + struct talloc_reference_handle *refs; + talloc_destructor_t destructor; + const char *name; + size_t size; + unsigned flags; + + /* + * "pool" has dual use: + * + * For the talloc pool itself (i.e. TALLOC_FLAG_POOL is set), "pool" + * marks the end of the currently allocated area. + * + * For members of the pool (i.e. TALLOC_FLAG_POOLMEM is set), "pool" + * is a pointer to the struct talloc_chunk of the pool that it was + * allocated from. This way children can quickly find the pool to chew + * from. + */ + void *pool; +}; + +/* 16 byte alignment seems to keep everyone happy */ +#define TC_HDR_SIZE ((sizeof(struct talloc_chunk)+15)&~15) +#define TC_PTR_FROM_CHUNK(tc) ((void *)(TC_HDR_SIZE + (char*)tc)) + +int talloc_version_major(void) +{ + return TALLOC_VERSION_MAJOR; +} + +int talloc_version_minor(void) +{ + return TALLOC_VERSION_MINOR; +} + +static void (*talloc_log_fn)(const char *message); + +void talloc_set_log_fn(void (*log_fn)(const char *message)) +{ + talloc_log_fn = log_fn; +} + +static void talloc_log(const char *fmt, ...) PRINTF_ATTRIBUTE(1,2); +static void talloc_log(const char *fmt, ...) +{ + va_list ap; + char *message; + + if (!talloc_log_fn) { + return; + } + + va_start(ap, fmt); + message = talloc_vasprintf(NULL, fmt, ap); + va_end(ap); + + talloc_log_fn(message); + talloc_free(message); +} + +static void talloc_log_stderr(const char *message) +{ + fprintf(stderr, "%s", message); +} + +void talloc_set_log_stderr(void) +{ + talloc_set_log_fn(talloc_log_stderr); +} + +static void (*talloc_abort_fn)(const char *reason); + +void talloc_set_abort_fn(void (*abort_fn)(const char *reason)) +{ + talloc_abort_fn = abort_fn; +} + +static void talloc_abort(const char *reason) +{ + talloc_log("%s\n", reason); + + if (!talloc_abort_fn) { + TALLOC_ABORT(reason); + } + + talloc_abort_fn(reason); +} + +static void talloc_abort_magic(unsigned magic) +{ + unsigned striped = magic - TALLOC_MAGIC_BASE; + unsigned major = (striped & 0xFFFFF000) >> 12; + unsigned minor = (striped & 0x00000FF0) >> 4; + talloc_log("Bad talloc magic[0x%08X/%u/%u] expected[0x%08X/%u/%u]\n", + magic, major, minor, + TALLOC_MAGIC, TALLOC_VERSION_MAJOR, TALLOC_VERSION_MINOR); + talloc_abort("Bad talloc magic value - wrong talloc version used/mixed"); +} + +static void talloc_abort_double_free(void) +{ + talloc_abort("Bad talloc magic value - double free"); +} + +static void talloc_abort_unknown_value(void) +{ + talloc_abort("Bad talloc magic value - unknown value"); +} + +/* panic if we get a bad magic value */ +static inline struct talloc_chunk *talloc_chunk_from_ptr(const void *ptr) +{ + const char *pp = (const char *)ptr; + struct talloc_chunk *tc = discard_const_p(struct talloc_chunk, pp - TC_HDR_SIZE); + if (unlikely((tc->flags & (TALLOC_FLAG_FREE | ~0xF)) != TALLOC_MAGIC)) { + if ((tc->flags & (~0xFFF)) == TALLOC_MAGIC_BASE) { + talloc_abort_magic(tc->flags & (~0xF)); + return NULL; + } + + if (tc->flags & TALLOC_FLAG_FREE) { + talloc_log("talloc: double free error - first free may be at %s\n", tc->name); + talloc_abort_double_free(); + return NULL; + } else { + talloc_abort_unknown_value(); + return NULL; + } + } + return tc; +} + +/* hook into the front of the list */ +#define _TLIST_ADD(list, p) \ +do { \ + if (!(list)) { \ + (list) = (p); \ + (p)->next = (p)->prev = NULL; \ + } else { \ + (list)->prev = (p); \ + (p)->next = (list); \ + (p)->prev = NULL; \ + (list) = (p); \ + }\ +} while (0) + +/* remove an element from a list - element doesn't have to be in list. */ +#define _TLIST_REMOVE(list, p) \ +do { \ + if ((p) == (list)) { \ + (list) = (p)->next; \ + if (list) (list)->prev = NULL; \ + } else { \ + if ((p)->prev) (p)->prev->next = (p)->next; \ + if ((p)->next) (p)->next->prev = (p)->prev; \ + } \ + if ((p) && ((p) != (list))) (p)->next = (p)->prev = NULL; \ +} while (0) + + +/* + return the parent chunk of a pointer +*/ +static inline struct talloc_chunk *talloc_parent_chunk(const void *ptr) +{ + struct talloc_chunk *tc; + + if (unlikely(ptr == NULL)) { + return NULL; + } + + tc = talloc_chunk_from_ptr(ptr); + while (tc->prev) tc=tc->prev; + + return tc->parent; +} + +void *talloc_parent(const void *ptr) +{ + struct talloc_chunk *tc = talloc_parent_chunk(ptr); + return tc? TC_PTR_FROM_CHUNK(tc) : NULL; +} + +/* + find parents name +*/ +const char *talloc_parent_name(const void *ptr) +{ + struct talloc_chunk *tc = talloc_parent_chunk(ptr); + return tc? tc->name : NULL; +} + +/* + A pool carries an in-pool object count count in the first 16 bytes. + bytes. This is done to support talloc_steal() to a parent outside of the + pool. The count includes the pool itself, so a talloc_free() on a pool will + only destroy the pool if the count has dropped to zero. A talloc_free() of a + pool member will reduce the count, and eventually also call free(3) on the + pool memory. + + The object count is not put into "struct talloc_chunk" because it is only + relevant for talloc pools and the alignment to 16 bytes would increase the + memory footprint of each talloc chunk by those 16 bytes. +*/ + +#define TALLOC_POOL_HDR_SIZE 16 + +static unsigned int *talloc_pool_objectcount(struct talloc_chunk *tc) +{ + return (unsigned int *)((char *)tc + sizeof(struct talloc_chunk)); +} + +/* + Allocate from a pool +*/ + +static struct talloc_chunk *talloc_alloc_pool(struct talloc_chunk *parent, + size_t size) +{ + struct talloc_chunk *pool_ctx = NULL; + size_t space_left; + struct talloc_chunk *result; + size_t chunk_size; + + if (parent == NULL) { + return NULL; + } + + if (parent->flags & TALLOC_FLAG_POOL) { + pool_ctx = parent; + } + else if (parent->flags & TALLOC_FLAG_POOLMEM) { + pool_ctx = (struct talloc_chunk *)parent->pool; + } + + if (pool_ctx == NULL) { + return NULL; + } + + space_left = ((char *)pool_ctx + TC_HDR_SIZE + pool_ctx->size) + - ((char *)pool_ctx->pool); + + /* + * Align size to 16 bytes + */ + chunk_size = ((size + 15) & ~15); + + if (space_left < chunk_size) { + return NULL; + } + + result = (struct talloc_chunk *)pool_ctx->pool; + +#if defined(DEVELOPER) && defined(VALGRIND_MAKE_MEM_UNDEFINED) + VALGRIND_MAKE_MEM_UNDEFINED(result, size); +#endif + + pool_ctx->pool = (void *)((char *)result + chunk_size); + + result->flags = TALLOC_MAGIC | TALLOC_FLAG_POOLMEM; + result->pool = pool_ctx; + + *talloc_pool_objectcount(pool_ctx) += 1; + + return result; +} + +/* + Allocate a bit of memory as a child of an existing pointer +*/ +static inline void *__talloc(const void *context, size_t size) +{ + struct talloc_chunk *tc = NULL; + + if (unlikely(context == NULL)) { + context = null_context; + } + + if (unlikely(size >= MAX_TALLOC_SIZE)) { + return NULL; + } + + if (context != NULL) { + tc = talloc_alloc_pool(talloc_chunk_from_ptr(context), + TC_HDR_SIZE+size); + } + + if (tc == NULL) { + tc = (struct talloc_chunk *)malloc(TC_HDR_SIZE+size); + if (unlikely(tc == NULL)) return NULL; + tc->flags = TALLOC_MAGIC; + tc->pool = NULL; + } + + tc->size = size; + tc->destructor = NULL; + tc->child = NULL; + tc->name = NULL; + tc->refs = NULL; + + if (likely(context)) { + struct talloc_chunk *parent = talloc_chunk_from_ptr(context); + + if (parent->child) { + parent->child->parent = NULL; + tc->next = parent->child; + tc->next->prev = tc; + } else { + tc->next = NULL; + } + tc->parent = parent; + tc->prev = NULL; + parent->child = tc; + } else { + tc->next = tc->prev = tc->parent = NULL; + } + + return TC_PTR_FROM_CHUNK(tc); +} + +/* + * Create a talloc pool + */ + +void *talloc_pool(const void *context, size_t size) +{ + void *result = __talloc(context, size + TALLOC_POOL_HDR_SIZE); + struct talloc_chunk *tc; + + if (unlikely(result == NULL)) { + return NULL; + } + + tc = talloc_chunk_from_ptr(result); + + tc->flags |= TALLOC_FLAG_POOL; + tc->pool = (char *)result + TALLOC_POOL_HDR_SIZE; + + *talloc_pool_objectcount(tc) = 1; + +#if defined(DEVELOPER) && defined(VALGRIND_MAKE_MEM_NOACCESS) + VALGRIND_MAKE_MEM_NOACCESS(tc->pool, size); +#endif + + return result; +} + +/* + setup a destructor to be called on free of a pointer + the destructor should return 0 on success, or -1 on failure. + if the destructor fails then the free is failed, and the memory can + be continued to be used +*/ +void _talloc_set_destructor(const void *ptr, int (*destructor)(void *)) +{ + struct talloc_chunk *tc = talloc_chunk_from_ptr(ptr); + tc->destructor = destructor; +} + +/* + increase the reference count on a piece of memory. +*/ +int talloc_increase_ref_count(const void *ptr) +{ + if (unlikely(!talloc_reference(null_context, ptr))) { + return -1; + } + return 0; +} + +/* + helper for talloc_reference() + + this is referenced by a function pointer and should not be inline +*/ +static int talloc_reference_destructor(struct talloc_reference_handle *handle) +{ + struct talloc_chunk *ptr_tc = talloc_chunk_from_ptr(handle->ptr); + _TLIST_REMOVE(ptr_tc->refs, handle); + return 0; +} + +/* + more efficient way to add a name to a pointer - the name must point to a + true string constant +*/ +static inline void _talloc_set_name_const(const void *ptr, const char *name) +{ + struct talloc_chunk *tc = talloc_chunk_from_ptr(ptr); + tc->name = name; +} + +/* + internal talloc_named_const() +*/ +static inline void *_talloc_named_const(const void *context, size_t size, const char *name) +{ + void *ptr; + + ptr = __talloc(context, size); + if (unlikely(ptr == NULL)) { + return NULL; + } + + _talloc_set_name_const(ptr, name); + + return ptr; +} + +/* + make a secondary reference to a pointer, hanging off the given context. + the pointer remains valid until both the original caller and this given + context are freed. + + the major use for this is when two different structures need to reference the + same underlying data, and you want to be able to free the two instances separately, + and in either order +*/ +void *_talloc_reference_loc(const void *context, const void *ptr, const char *location) +{ + struct talloc_chunk *tc; + struct talloc_reference_handle *handle; + if (unlikely(ptr == NULL)) return NULL; + + tc = talloc_chunk_from_ptr(ptr); + handle = (struct talloc_reference_handle *)_talloc_named_const(context, + sizeof(struct talloc_reference_handle), + TALLOC_MAGIC_REFERENCE); + if (unlikely(handle == NULL)) return NULL; + + /* note that we hang the destructor off the handle, not the + main context as that allows the caller to still setup their + own destructor on the context if they want to */ + talloc_set_destructor(handle, talloc_reference_destructor); + handle->ptr = discard_const_p(void, ptr); + handle->location = location; + _TLIST_ADD(tc->refs, handle); + return handle->ptr; +} + +static void *_talloc_steal_internal(const void *new_ctx, const void *ptr); + +/* + internal talloc_free call +*/ +static inline int _talloc_free_internal(void *ptr, const char *location) +{ + struct talloc_chunk *tc; + + if (unlikely(ptr == NULL)) { + return -1; + } + + tc = talloc_chunk_from_ptr(ptr); + + if (unlikely(tc->refs)) { + int is_child; + /* check this is a reference from a child or grantchild + * back to it's parent or grantparent + * + * in that case we need to remove the reference and + * call another instance of talloc_free() on the current + * pointer. + */ + is_child = talloc_is_parent(tc->refs, ptr); + _talloc_free_internal(tc->refs, location); + if (is_child) { + return _talloc_free_internal(ptr, location); + } + return -1; + } + + if (unlikely(tc->flags & TALLOC_FLAG_LOOP)) { + /* we have a free loop - stop looping */ + return 0; + } + + if (unlikely(tc->destructor)) { + talloc_destructor_t d = tc->destructor; + if (d == (talloc_destructor_t)-1) { + return -1; + } + tc->destructor = (talloc_destructor_t)-1; + if (d(ptr) == -1) { + tc->destructor = d; + return -1; + } + tc->destructor = NULL; + } + + if (tc->parent) { + _TLIST_REMOVE(tc->parent->child, tc); + if (tc->parent->child) { + tc->parent->child->parent = tc->parent; + } + } else { + if (tc->prev) tc->prev->next = tc->next; + if (tc->next) tc->next->prev = tc->prev; + } + + tc->flags |= TALLOC_FLAG_LOOP; + + while (tc->child) { + /* we need to work out who will own an abandoned child + if it cannot be freed. In priority order, the first + choice is owner of any remaining reference to this + pointer, the second choice is our parent, and the + final choice is the null context. */ + void *child = TC_PTR_FROM_CHUNK(tc->child); + const void *new_parent = null_context; + if (unlikely(tc->child->refs)) { + struct talloc_chunk *p = talloc_parent_chunk(tc->child->refs); + if (p) new_parent = TC_PTR_FROM_CHUNK(p); + } + if (unlikely(_talloc_free_internal(child, location) == -1)) { + if (new_parent == null_context) { + struct talloc_chunk *p = talloc_parent_chunk(ptr); + if (p) new_parent = TC_PTR_FROM_CHUNK(p); + } + _talloc_steal_internal(new_parent, child); + } + } + + tc->flags |= TALLOC_FLAG_FREE; + + /* we mark the freed memory with where we called the free + * from. This means on a double free error we can report where + * the first free came from + */ + tc->name = location; + + if (tc->flags & (TALLOC_FLAG_POOL|TALLOC_FLAG_POOLMEM)) { + struct talloc_chunk *pool; + unsigned int *pool_object_count; + + pool = (tc->flags & TALLOC_FLAG_POOL) + ? tc : (struct talloc_chunk *)tc->pool; + + pool_object_count = talloc_pool_objectcount(pool); + + if (*pool_object_count == 0) { + talloc_abort("Pool object count zero!"); + return 0; + } + + *pool_object_count -= 1; + + if (*pool_object_count == 0) { + free(pool); + } + } + else { + free(tc); + } + return 0; +} + +/* + move a lump of memory from one talloc context to another return the + ptr on success, or NULL if it could not be transferred. + passing NULL as ptr will always return NULL with no side effects. +*/ +static void *_talloc_steal_internal(const void *new_ctx, const void *ptr) +{ + struct talloc_chunk *tc, *new_tc; + + if (unlikely(!ptr)) { + return NULL; + } + + if (unlikely(new_ctx == NULL)) { + new_ctx = null_context; + } + + tc = talloc_chunk_from_ptr(ptr); + + if (unlikely(new_ctx == NULL)) { + if (tc->parent) { + _TLIST_REMOVE(tc->parent->child, tc); + if (tc->parent->child) { + tc->parent->child->parent = tc->parent; + } + } else { + if (tc->prev) tc->prev->next = tc->next; + if (tc->next) tc->next->prev = tc->prev; + } + + tc->parent = tc->next = tc->prev = NULL; + return discard_const_p(void, ptr); + } + + new_tc = talloc_chunk_from_ptr(new_ctx); + + if (unlikely(tc == new_tc || tc->parent == new_tc)) { + return discard_const_p(void, ptr); + } + + if (tc->parent) { + _TLIST_REMOVE(tc->parent->child, tc); + if (tc->parent->child) { + tc->parent->child->parent = tc->parent; + } + } else { + if (tc->prev) tc->prev->next = tc->next; + if (tc->next) tc->next->prev = tc->prev; + } + + tc->parent = new_tc; + if (new_tc->child) new_tc->child->parent = NULL; + _TLIST_ADD(new_tc->child, tc); + + return discard_const_p(void, ptr); +} + +/* + move a lump of memory from one talloc context to another return the + ptr on success, or NULL if it could not be transferred. + passing NULL as ptr will always return NULL with no side effects. +*/ +void *_talloc_steal_loc(const void *new_ctx, const void *ptr, const char *location) +{ + struct talloc_chunk *tc; + + if (unlikely(ptr == NULL)) { + return NULL; + } + + tc = talloc_chunk_from_ptr(ptr); + + if (unlikely(tc->refs != NULL) && talloc_parent(ptr) != new_ctx) { + struct talloc_reference_handle *h; + + talloc_log("WARNING: talloc_steal with references at %s\n", + location); + + for (h=tc->refs; h; h=h->next) { + talloc_log("\treference at %s\n", + h->location); + } + } + + return _talloc_steal_internal(new_ctx, ptr); +} + +/* + this is like a talloc_steal(), but you must supply the old + parent. This resolves the ambiguity in a talloc_steal() which is + called on a context that has more than one parent (via references) + + The old parent can be either a reference or a parent +*/ +void *talloc_reparent(const void *old_parent, const void *new_parent, const void *ptr) +{ + struct talloc_chunk *tc; + struct talloc_reference_handle *h; + + if (unlikely(ptr == NULL)) { + return NULL; + } + + if (old_parent == talloc_parent(ptr)) { + return _talloc_steal_internal(new_parent, ptr); + } + + tc = talloc_chunk_from_ptr(ptr); + for (h=tc->refs;h;h=h->next) { + if (talloc_parent(h) == old_parent) { + if (_talloc_steal_internal(new_parent, h) != h) { + return NULL; + } + return discard_const_p(void, ptr); + } + } + + /* it wasn't a parent */ + return NULL; +} + +/* + remove a secondary reference to a pointer. This undo's what + talloc_reference() has done. The context and pointer arguments + must match those given to a talloc_reference() +*/ +static inline int talloc_unreference(const void *context, const void *ptr) +{ + struct talloc_chunk *tc = talloc_chunk_from_ptr(ptr); + struct talloc_reference_handle *h; + + if (unlikely(context == NULL)) { + context = null_context; + } + + for (h=tc->refs;h;h=h->next) { + struct talloc_chunk *p = talloc_parent_chunk(h); + if (p == NULL) { + if (context == NULL) break; + } else if (TC_PTR_FROM_CHUNK(p) == context) { + break; + } + } + if (h == NULL) { + return -1; + } + + return _talloc_free_internal(h, __location__); +} + +/* + remove a specific parent context from a pointer. This is a more + controlled varient of talloc_free() +*/ +int talloc_unlink(const void *context, void *ptr) +{ + struct talloc_chunk *tc_p, *new_p; + void *new_parent; + + if (ptr == NULL) { + return -1; + } + + if (context == NULL) { + context = null_context; + } + + if (talloc_unreference(context, ptr) == 0) { + return 0; + } + + if (context == NULL) { + if (talloc_parent_chunk(ptr) != NULL) { + return -1; + } + } else { + if (talloc_chunk_from_ptr(context) != talloc_parent_chunk(ptr)) { + return -1; + } + } + + tc_p = talloc_chunk_from_ptr(ptr); + + if (tc_p->refs == NULL) { + return _talloc_free_internal(ptr, __location__); + } + + new_p = talloc_parent_chunk(tc_p->refs); + if (new_p) { + new_parent = TC_PTR_FROM_CHUNK(new_p); + } else { + new_parent = NULL; + } + + if (talloc_unreference(new_parent, ptr) != 0) { + return -1; + } + + _talloc_steal_internal(new_parent, ptr); + + return 0; +} + +/* + add a name to an existing pointer - va_list version +*/ +static inline const char *talloc_set_name_v(const void *ptr, const char *fmt, va_list ap) PRINTF_ATTRIBUTE(2,0); + +static inline const char *talloc_set_name_v(const void *ptr, const char *fmt, va_list ap) +{ + struct talloc_chunk *tc = talloc_chunk_from_ptr(ptr); + tc->name = talloc_vasprintf(ptr, fmt, ap); + if (likely(tc->name)) { + _talloc_set_name_const(tc->name, ".name"); + } + return tc->name; +} + +/* + add a name to an existing pointer +*/ +const char *talloc_set_name(const void *ptr, const char *fmt, ...) +{ + const char *name; + va_list ap; + va_start(ap, fmt); + name = talloc_set_name_v(ptr, fmt, ap); + va_end(ap); + return name; +} + + +/* + create a named talloc pointer. Any talloc pointer can be named, and + talloc_named() operates just like talloc() except that it allows you + to name the pointer. +*/ +void *talloc_named(const void *context, size_t size, const char *fmt, ...) +{ + va_list ap; + void *ptr; + const char *name; + + ptr = __talloc(context, size); + if (unlikely(ptr == NULL)) return NULL; + + va_start(ap, fmt); + name = talloc_set_name_v(ptr, fmt, ap); + va_end(ap); + + if (unlikely(name == NULL)) { + _talloc_free_internal(ptr, __location__); + return NULL; + } + + return ptr; +} + +/* + return the name of a talloc ptr, or "UNNAMED" +*/ +const char *talloc_get_name(const void *ptr) +{ + struct talloc_chunk *tc = talloc_chunk_from_ptr(ptr); + if (unlikely(tc->name == TALLOC_MAGIC_REFERENCE)) { + return ".reference"; + } + if (likely(tc->name)) { + return tc->name; + } + return "UNNAMED"; +} + + +/* + check if a pointer has the given name. If it does, return the pointer, + otherwise return NULL +*/ +void *talloc_check_name(const void *ptr, const char *name) +{ + const char *pname; + if (unlikely(ptr == NULL)) return NULL; + pname = talloc_get_name(ptr); + if (likely(pname == name || strcmp(pname, name) == 0)) { + return discard_const_p(void, ptr); + } + return NULL; +} + +static void talloc_abort_type_missmatch(const char *location, + const char *name, + const char *expected) +{ + const char *reason; + + reason = talloc_asprintf(NULL, + "%s: Type mismatch: name[%s] expected[%s]", + location, + name?name:"NULL", + expected); + if (!reason) { + reason = "Type mismatch"; + } + + talloc_abort(reason); +} + +void *_talloc_get_type_abort(const void *ptr, const char *name, const char *location) +{ + const char *pname; + + if (unlikely(ptr == NULL)) { + talloc_abort_type_missmatch(location, NULL, name); + return NULL; + } + + pname = talloc_get_name(ptr); + if (likely(pname == name || strcmp(pname, name) == 0)) { + return discard_const_p(void, ptr); + } + + talloc_abort_type_missmatch(location, pname, name); + return NULL; +} + +/* + this is for compatibility with older versions of talloc +*/ +void *talloc_init(const char *fmt, ...) +{ + va_list ap; + void *ptr; + const char *name; + + /* + * samba3 expects talloc_report_depth_cb(NULL, ...) + * reports all talloc'ed memory, so we need to enable + * null_tracking + */ + talloc_enable_null_tracking(); + + ptr = __talloc(NULL, 0); + if (unlikely(ptr == NULL)) return NULL; + + va_start(ap, fmt); + name = talloc_set_name_v(ptr, fmt, ap); + va_end(ap); + + if (unlikely(name == NULL)) { + _talloc_free_internal(ptr, __location__); + return NULL; + } + + return ptr; +} + +/* + this is a replacement for the Samba3 talloc_destroy_pool functionality. It + should probably not be used in new code. It's in here to keep the talloc + code consistent across Samba 3 and 4. +*/ +void talloc_free_children(void *ptr) +{ + struct talloc_chunk *tc; + + if (unlikely(ptr == NULL)) { + return; + } + + tc = talloc_chunk_from_ptr(ptr); + + while (tc->child) { + /* we need to work out who will own an abandoned child + if it cannot be freed. In priority order, the first + choice is owner of any remaining reference to this + pointer, the second choice is our parent, and the + final choice is the null context. */ + void *child = TC_PTR_FROM_CHUNK(tc->child); + const void *new_parent = null_context; + if (unlikely(tc->child->refs)) { + struct talloc_chunk *p = talloc_parent_chunk(tc->child->refs); + if (p) new_parent = TC_PTR_FROM_CHUNK(p); + } + if (unlikely(talloc_free(child) == -1)) { + if (new_parent == null_context) { + struct talloc_chunk *p = talloc_parent_chunk(ptr); + if (p) new_parent = TC_PTR_FROM_CHUNK(p); + } + _talloc_steal_internal(new_parent, child); + } + } + + if ((tc->flags & TALLOC_FLAG_POOL) + && (*talloc_pool_objectcount(tc) == 1)) { + tc->pool = ((char *)tc + TC_HDR_SIZE + TALLOC_POOL_HDR_SIZE); +#if defined(DEVELOPER) && defined(VALGRIND_MAKE_MEM_NOACCESS) + VALGRIND_MAKE_MEM_NOACCESS( + tc->pool, tc->size - TALLOC_POOL_HDR_SIZE); +#endif + } +} + +/* + Allocate a bit of memory as a child of an existing pointer +*/ +void *_talloc(const void *context, size_t size) +{ + return __talloc(context, size); +} + +/* + externally callable talloc_set_name_const() +*/ +void talloc_set_name_const(const void *ptr, const char *name) +{ + _talloc_set_name_const(ptr, name); +} + +/* + create a named talloc pointer. Any talloc pointer can be named, and + talloc_named() operates just like talloc() except that it allows you + to name the pointer. +*/ +void *talloc_named_const(const void *context, size_t size, const char *name) +{ + return _talloc_named_const(context, size, name); +} + +/* + free a talloc pointer. This also frees all child pointers of this + pointer recursively + + return 0 if the memory is actually freed, otherwise -1. The memory + will not be freed if the ref_count is > 1 or the destructor (if + any) returns non-zero +*/ +int _talloc_free(void *ptr, const char *location) +{ + struct talloc_chunk *tc; + + if (unlikely(ptr == NULL)) { + return -1; + } + + tc = talloc_chunk_from_ptr(ptr); + + if (unlikely(tc->refs != NULL)) { + struct talloc_reference_handle *h; + + talloc_log("ERROR: talloc_free with references at %s\n", + location); + + for (h=tc->refs; h; h=h->next) { + talloc_log("\treference at %s\n", + h->location); + } + return -1; + } + + return _talloc_free_internal(ptr, location); +} + + + +/* + A talloc version of realloc. The context argument is only used if + ptr is NULL +*/ +void *_talloc_realloc(const void *context, void *ptr, size_t size, const char *name) +{ + struct talloc_chunk *tc; + void *new_ptr; + bool malloced = false; + + /* size zero is equivalent to free() */ + if (unlikely(size == 0)) { + talloc_unlink(context, ptr); + return NULL; + } + + if (unlikely(size >= MAX_TALLOC_SIZE)) { + return NULL; + } + + /* realloc(NULL) is equivalent to malloc() */ + if (ptr == NULL) { + return _talloc_named_const(context, size, name); + } + + tc = talloc_chunk_from_ptr(ptr); + + /* don't allow realloc on referenced pointers */ + if (unlikely(tc->refs)) { + return NULL; + } + + /* don't let anybody try to realloc a talloc_pool */ + if (unlikely(tc->flags & TALLOC_FLAG_POOL)) { + return NULL; + } + + /* don't shrink if we have less than 1k to gain */ + if ((size < tc->size) && ((tc->size - size) < 1024)) { + tc->size = size; + return ptr; + } + + /* by resetting magic we catch users of the old memory */ + tc->flags |= TALLOC_FLAG_FREE; + +#if ALWAYS_REALLOC + new_ptr = malloc(size + TC_HDR_SIZE); + if (new_ptr) { + memcpy(new_ptr, tc, tc->size + TC_HDR_SIZE); + free(tc); + } +#else + if (tc->flags & TALLOC_FLAG_POOLMEM) { + + new_ptr = talloc_alloc_pool(tc, size + TC_HDR_SIZE); + *talloc_pool_objectcount((struct talloc_chunk *) + (tc->pool)) -= 1; + + if (new_ptr == NULL) { + new_ptr = malloc(TC_HDR_SIZE+size); + malloced = true; + } + + if (new_ptr) { + memcpy(new_ptr, tc, MIN(tc->size,size) + TC_HDR_SIZE); + } + } + else { + new_ptr = realloc(tc, size + TC_HDR_SIZE); + } +#endif + if (unlikely(!new_ptr)) { + tc->flags &= ~TALLOC_FLAG_FREE; + return NULL; + } + + tc = (struct talloc_chunk *)new_ptr; + tc->flags &= ~TALLOC_FLAG_FREE; + if (malloced) { + tc->flags &= ~TALLOC_FLAG_POOLMEM; + } + if (tc->parent) { + tc->parent->child = tc; + } + if (tc->child) { + tc->child->parent = tc; + } + + if (tc->prev) { + tc->prev->next = tc; + } + if (tc->next) { + tc->next->prev = tc; + } + + tc->size = size; + _talloc_set_name_const(TC_PTR_FROM_CHUNK(tc), name); + + return TC_PTR_FROM_CHUNK(tc); +} + +/* + a wrapper around talloc_steal() for situations where you are moving a pointer + between two structures, and want the old pointer to be set to NULL +*/ +void *_talloc_move(const void *new_ctx, const void *_pptr) +{ + const void **pptr = discard_const_p(const void *,_pptr); + void *ret = talloc_steal(new_ctx, discard_const_p(void, *pptr)); + (*pptr) = NULL; + return ret; +} + +/* + return the total size of a talloc pool (subtree) +*/ +size_t talloc_total_size(const void *ptr) +{ + size_t total = 0; + struct talloc_chunk *c, *tc; + + if (ptr == NULL) { + ptr = null_context; + } + if (ptr == NULL) { + return 0; + } + + tc = talloc_chunk_from_ptr(ptr); + + if (tc->flags & TALLOC_FLAG_LOOP) { + return 0; + } + + tc->flags |= TALLOC_FLAG_LOOP; + + if (likely(tc->name != TALLOC_MAGIC_REFERENCE)) { + total = tc->size; + } + for (c=tc->child;c;c=c->next) { + total += talloc_total_size(TC_PTR_FROM_CHUNK(c)); + } + + tc->flags &= ~TALLOC_FLAG_LOOP; + + return total; +} + +/* + return the total number of blocks in a talloc pool (subtree) +*/ +size_t talloc_total_blocks(const void *ptr) +{ + size_t total = 0; + struct talloc_chunk *c, *tc; + + if (ptr == NULL) { + ptr = null_context; + } + if (ptr == NULL) { + return 0; + } + + tc = talloc_chunk_from_ptr(ptr); + + if (tc->flags & TALLOC_FLAG_LOOP) { + return 0; + } + + tc->flags |= TALLOC_FLAG_LOOP; + + total++; + for (c=tc->child;c;c=c->next) { + total += talloc_total_blocks(TC_PTR_FROM_CHUNK(c)); + } + + tc->flags &= ~TALLOC_FLAG_LOOP; + + return total; +} + +/* + return the number of external references to a pointer +*/ +size_t talloc_reference_count(const void *ptr) +{ + struct talloc_chunk *tc = talloc_chunk_from_ptr(ptr); + struct talloc_reference_handle *h; + size_t ret = 0; + + for (h=tc->refs;h;h=h->next) { + ret++; + } + return ret; +} + +/* + report on memory usage by all children of a pointer, giving a full tree view +*/ +void talloc_report_depth_cb(const void *ptr, int depth, int max_depth, + void (*callback)(const void *ptr, + int depth, int max_depth, + int is_ref, + void *private_data), + void *private_data) +{ + struct talloc_chunk *c, *tc; + + if (ptr == NULL) { + ptr = null_context; + } + if (ptr == NULL) return; + + tc = talloc_chunk_from_ptr(ptr); + + if (tc->flags & TALLOC_FLAG_LOOP) { + return; + } + + callback(ptr, depth, max_depth, 0, private_data); + + if (max_depth >= 0 && depth >= max_depth) { + return; + } + + tc->flags |= TALLOC_FLAG_LOOP; + for (c=tc->child;c;c=c->next) { + if (c->name == TALLOC_MAGIC_REFERENCE) { + struct talloc_reference_handle *h = (struct talloc_reference_handle *)TC_PTR_FROM_CHUNK(c); + callback(h->ptr, depth + 1, max_depth, 1, private_data); + } else { + talloc_report_depth_cb(TC_PTR_FROM_CHUNK(c), depth + 1, max_depth, callback, private_data); + } + } + tc->flags &= ~TALLOC_FLAG_LOOP; +} + +static void talloc_report_depth_FILE_helper(const void *ptr, int depth, int max_depth, int is_ref, void *_f) +{ + const char *name = talloc_get_name(ptr); + FILE *f = (FILE *)_f; + + if (is_ref) { + fprintf(f, "%*sreference to: %s\n", depth*4, "", name); + return; + } + + if (depth == 0) { + fprintf(f,"%stalloc report on '%s' (total %6lu bytes in %3lu blocks)\n", + (max_depth < 0 ? "full " :""), name, + (unsigned long)talloc_total_size(ptr), + (unsigned long)talloc_total_blocks(ptr)); + return; + } + + fprintf(f, "%*s%-30s contains %6lu bytes in %3lu blocks (ref %d) %p\n", + depth*4, "", + name, + (unsigned long)talloc_total_size(ptr), + (unsigned long)talloc_total_blocks(ptr), + (int)talloc_reference_count(ptr), ptr); + +#if 0 + fprintf(f, "content: "); + if (talloc_total_size(ptr)) { + int tot = talloc_total_size(ptr); + int i; + + for (i = 0; i < tot; i++) { + if ((((char *)ptr)[i] > 31) && (((char *)ptr)[i] < 126)) { + fprintf(f, "%c", ((char *)ptr)[i]); + } else { + fprintf(f, "~%02x", ((char *)ptr)[i]); + } + } + } + fprintf(f, "\n"); +#endif +} + +/* + report on memory usage by all children of a pointer, giving a full tree view +*/ +void talloc_report_depth_file(const void *ptr, int depth, int max_depth, FILE *f) +{ + if (f) { + talloc_report_depth_cb(ptr, depth, max_depth, talloc_report_depth_FILE_helper, f); + fflush(f); + } +} + +/* + report on memory usage by all children of a pointer, giving a full tree view +*/ +void talloc_report_full(const void *ptr, FILE *f) +{ + talloc_report_depth_file(ptr, 0, -1, f); +} + +/* + report on memory usage by all children of a pointer +*/ +void talloc_report(const void *ptr, FILE *f) +{ + talloc_report_depth_file(ptr, 0, 1, f); +} + +/* + report on any memory hanging off the null context +*/ +static void talloc_report_null(void) +{ + if (talloc_total_size(null_context) != 0) { + talloc_report(null_context, stderr); + } +} + +/* + report on any memory hanging off the null context +*/ +static void talloc_report_null_full(void) +{ + if (talloc_total_size(null_context) != 0) { + talloc_report_full(null_context, stderr); + } +} + +/* + enable tracking of the NULL context +*/ +void talloc_enable_null_tracking(void) +{ + if (null_context == NULL) { + null_context = _talloc_named_const(NULL, 0, "null_context"); + if (autofree_context != NULL) { + talloc_reparent(NULL, null_context, autofree_context); + } + } +} + +/* + enable tracking of the NULL context, not moving the autofree context + into the NULL context. This is needed for the talloc testsuite +*/ +void talloc_enable_null_tracking_no_autofree(void) +{ + if (null_context == NULL) { + null_context = _talloc_named_const(NULL, 0, "null_context"); + } +} + +/* + disable tracking of the NULL context +*/ +void talloc_disable_null_tracking(void) +{ + if (null_context != NULL) { + /* we have to move any children onto the real NULL + context */ + struct talloc_chunk *tc, *tc2; + tc = talloc_chunk_from_ptr(null_context); + for (tc2 = tc->child; tc2; tc2=tc2->next) { + if (tc2->parent == tc) tc2->parent = NULL; + if (tc2->prev == tc) tc2->prev = NULL; + } + for (tc2 = tc->next; tc2; tc2=tc2->next) { + if (tc2->parent == tc) tc2->parent = NULL; + if (tc2->prev == tc) tc2->prev = NULL; + } + tc->child = NULL; + tc->next = NULL; + } + talloc_free(null_context); + null_context = NULL; +} + +/* + enable leak reporting on exit +*/ +void talloc_enable_leak_report(void) +{ + talloc_enable_null_tracking(); + atexit(talloc_report_null); +} + +/* + enable full leak reporting on exit +*/ +void talloc_enable_leak_report_full(void) +{ + talloc_enable_null_tracking(); + atexit(talloc_report_null_full); +} + +/* + talloc and zero memory. +*/ +void *_talloc_zero(const void *ctx, size_t size, const char *name) +{ + void *p = _talloc_named_const(ctx, size, name); + + if (p) { + memset(p, '\0', size); + } + + return p; +} + +/* + memdup with a talloc. +*/ +void *_talloc_memdup(const void *t, const void *p, size_t size, const char *name) +{ + void *newp = _talloc_named_const(t, size, name); + + if (likely(newp)) { + memcpy(newp, p, size); + } + + return newp; +} + +static inline char *__talloc_strlendup(const void *t, const char *p, size_t len) +{ + char *ret; + + ret = (char *)__talloc(t, len + 1); + if (unlikely(!ret)) return NULL; + + memcpy(ret, p, len); + ret[len] = 0; + + _talloc_set_name_const(ret, ret); + return ret; +} + +/* + strdup with a talloc +*/ +char *talloc_strdup(const void *t, const char *p) +{ + if (unlikely(!p)) return NULL; + return __talloc_strlendup(t, p, strlen(p)); +} + +/* + strndup with a talloc +*/ +char *talloc_strndup(const void *t, const char *p, size_t n) +{ + if (unlikely(!p)) return NULL; + return __talloc_strlendup(t, p, strnlen(p, n)); +} + +static inline char *__talloc_strlendup_append(char *s, size_t slen, + const char *a, size_t alen) +{ + char *ret; + + ret = talloc_realloc(NULL, s, char, slen + alen + 1); + if (unlikely(!ret)) return NULL; + + /* append the string and the trailing \0 */ + memcpy(&ret[slen], a, alen); + ret[slen+alen] = 0; + + _talloc_set_name_const(ret, ret); + return ret; +} + +/* + * Appends at the end of the string. + */ +char *talloc_strdup_append(char *s, const char *a) +{ + if (unlikely(!s)) { + return talloc_strdup(NULL, a); + } + + if (unlikely(!a)) { + return s; + } + + return __talloc_strlendup_append(s, strlen(s), a, strlen(a)); +} + +/* + * Appends at the end of the talloc'ed buffer, + * not the end of the string. + */ +char *talloc_strdup_append_buffer(char *s, const char *a) +{ + size_t slen; + + if (unlikely(!s)) { + return talloc_strdup(NULL, a); + } + + if (unlikely(!a)) { + return s; + } + + slen = talloc_get_size(s); + if (likely(slen > 0)) { + slen--; + } + + return __talloc_strlendup_append(s, slen, a, strlen(a)); +} + +/* + * Appends at the end of the string. + */ +char *talloc_strndup_append(char *s, const char *a, size_t n) +{ + if (unlikely(!s)) { + return talloc_strdup(NULL, a); + } + + if (unlikely(!a)) { + return s; + } + + return __talloc_strlendup_append(s, strlen(s), a, strnlen(a, n)); +} + +/* + * Appends at the end of the talloc'ed buffer, + * not the end of the string. + */ +char *talloc_strndup_append_buffer(char *s, const char *a, size_t n) +{ + size_t slen; + + if (unlikely(!s)) { + return talloc_strdup(NULL, a); + } + + if (unlikely(!a)) { + return s; + } + + slen = talloc_get_size(s); + if (likely(slen > 0)) { + slen--; + } + + return __talloc_strlendup_append(s, slen, a, strnlen(a, n)); +} + +#ifndef HAVE_VA_COPY +#ifdef HAVE___VA_COPY +#define va_copy(dest, src) __va_copy(dest, src) +#else +#define va_copy(dest, src) (dest) = (src) +#endif +#endif + +char *talloc_vasprintf(const void *t, const char *fmt, va_list ap) +{ + int len; + char *ret; + va_list ap2; + char c; + + /* this call looks strange, but it makes it work on older solaris boxes */ + va_copy(ap2, ap); + len = vsnprintf(&c, 1, fmt, ap2); + va_end(ap2); + if (unlikely(len < 0)) { + return NULL; + } + + ret = (char *)__talloc(t, len+1); + if (unlikely(!ret)) return NULL; + + va_copy(ap2, ap); + vsnprintf(ret, len+1, fmt, ap2); + va_end(ap2); + + _talloc_set_name_const(ret, ret); + return ret; +} + + +/* + Perform string formatting, and return a pointer to newly allocated + memory holding the result, inside a memory pool. + */ +char *talloc_asprintf(const void *t, const char *fmt, ...) +{ + va_list ap; + char *ret; + + va_start(ap, fmt); + ret = talloc_vasprintf(t, fmt, ap); + va_end(ap); + return ret; +} + +static inline char *__talloc_vaslenprintf_append(char *s, size_t slen, + const char *fmt, va_list ap) + PRINTF_ATTRIBUTE(3,0); + +static inline char *__talloc_vaslenprintf_append(char *s, size_t slen, + const char *fmt, va_list ap) +{ + ssize_t alen; + va_list ap2; + char c; + + va_copy(ap2, ap); + alen = vsnprintf(&c, 1, fmt, ap2); + va_end(ap2); + + if (alen <= 0) { + /* Either the vsnprintf failed or the format resulted in + * no characters being formatted. In the former case, we + * ought to return NULL, in the latter we ought to return + * the original string. Most current callers of this + * function expect it to never return NULL. + */ + return s; + } + + s = talloc_realloc(NULL, s, char, slen + alen + 1); + if (!s) return NULL; + + va_copy(ap2, ap); + vsnprintf(s + slen, alen + 1, fmt, ap2); + va_end(ap2); + + _talloc_set_name_const(s, s); + return s; +} + +/** + * Realloc @p s to append the formatted result of @p fmt and @p ap, + * and return @p s, which may have moved. Good for gradually + * accumulating output into a string buffer. Appends at the end + * of the string. + **/ +char *talloc_vasprintf_append(char *s, const char *fmt, va_list ap) +{ + if (unlikely(!s)) { + return talloc_vasprintf(NULL, fmt, ap); + } + + return __talloc_vaslenprintf_append(s, strlen(s), fmt, ap); +} + +/** + * Realloc @p s to append the formatted result of @p fmt and @p ap, + * and return @p s, which may have moved. Always appends at the + * end of the talloc'ed buffer, not the end of the string. + **/ +char *talloc_vasprintf_append_buffer(char *s, const char *fmt, va_list ap) +{ + size_t slen; + + if (unlikely(!s)) { + return talloc_vasprintf(NULL, fmt, ap); + } + + slen = talloc_get_size(s); + if (likely(slen > 0)) { + slen--; + } + + return __talloc_vaslenprintf_append(s, slen, fmt, ap); +} + +/* + Realloc @p s to append the formatted result of @p fmt and return @p + s, which may have moved. Good for gradually accumulating output + into a string buffer. + */ +char *talloc_asprintf_append(char *s, const char *fmt, ...) +{ + va_list ap; + + va_start(ap, fmt); + s = talloc_vasprintf_append(s, fmt, ap); + va_end(ap); + return s; +} + +/* + Realloc @p s to append the formatted result of @p fmt and return @p + s, which may have moved. Good for gradually accumulating output + into a buffer. + */ +char *talloc_asprintf_append_buffer(char *s, const char *fmt, ...) +{ + va_list ap; + + va_start(ap, fmt); + s = talloc_vasprintf_append_buffer(s, fmt, ap); + va_end(ap); + return s; +} + +/* + alloc an array, checking for integer overflow in the array size +*/ +void *_talloc_array(const void *ctx, size_t el_size, unsigned count, const char *name) +{ + if (count >= MAX_TALLOC_SIZE/el_size) { + return NULL; + } + return _talloc_named_const(ctx, el_size * count, name); +} + +/* + alloc an zero array, checking for integer overflow in the array size +*/ +void *_talloc_zero_array(const void *ctx, size_t el_size, unsigned count, const char *name) +{ + if (count >= MAX_TALLOC_SIZE/el_size) { + return NULL; + } + return _talloc_zero(ctx, el_size * count, name); +} + +/* + realloc an array, checking for integer overflow in the array size +*/ +void *_talloc_realloc_array(const void *ctx, void *ptr, size_t el_size, unsigned count, const char *name) +{ + if (count >= MAX_TALLOC_SIZE/el_size) { + return NULL; + } + return _talloc_realloc(ctx, ptr, el_size * count, name); +} + +/* + a function version of talloc_realloc(), so it can be passed as a function pointer + to libraries that want a realloc function (a realloc function encapsulates + all the basic capabilities of an allocation library, which is why this is useful) +*/ +void *talloc_realloc_fn(const void *context, void *ptr, size_t size) +{ + return _talloc_realloc(context, ptr, size, NULL); +} + + +static int talloc_autofree_destructor(void *ptr) +{ + autofree_context = NULL; + return 0; +} + +static void talloc_autofree(void) +{ + talloc_free(autofree_context); +} + +/* + return a context which will be auto-freed on exit + this is useful for reducing the noise in leak reports +*/ +void *talloc_autofree_context(void) +{ + if (autofree_context == NULL) { + autofree_context = _talloc_named_const(NULL, 0, "autofree_context"); + talloc_set_destructor(autofree_context, talloc_autofree_destructor); + atexit(talloc_autofree); + } + return autofree_context; +} + +size_t talloc_get_size(const void *context) +{ + struct talloc_chunk *tc; + + if (context == NULL) { + context = null_context; + } + if (context == NULL) { + return 0; + } + + tc = talloc_chunk_from_ptr(context); + + return tc->size; +} + +/* + find a parent of this context that has the given name, if any +*/ +void *talloc_find_parent_byname(const void *context, const char *name) +{ + struct talloc_chunk *tc; + + if (context == NULL) { + return NULL; + } + + tc = talloc_chunk_from_ptr(context); + while (tc) { + if (tc->name && strcmp(tc->name, name) == 0) { + return TC_PTR_FROM_CHUNK(tc); + } + while (tc && tc->prev) tc = tc->prev; + if (tc) { + tc = tc->parent; + } + } + return NULL; +} + +/* + show the parentage of a context +*/ +void talloc_show_parents(const void *context, FILE *file) +{ + struct talloc_chunk *tc; + + if (context == NULL) { + fprintf(file, "talloc no parents for NULL\n"); + return; + } + + tc = talloc_chunk_from_ptr(context); + fprintf(file, "talloc parents of '%s'\n", talloc_get_name(context)); + while (tc) { + fprintf(file, "\t'%s'\n", talloc_get_name(TC_PTR_FROM_CHUNK(tc))); + while (tc && tc->prev) tc = tc->prev; + if (tc) { + tc = tc->parent; + } + } + fflush(file); +} + +/* + return 1 if ptr is a parent of context +*/ +int talloc_is_parent(const void *context, const void *ptr) +{ + struct talloc_chunk *tc; + + if (context == NULL) { + return 0; + } + + tc = talloc_chunk_from_ptr(context); + while (tc) { + if (TC_PTR_FROM_CHUNK(tc) == ptr) return 1; + while (tc && tc->prev) tc = tc->prev; + if (tc) { + tc = tc->parent; + } + } + return 0; +} diff --git a/src/talloc/talloc.h b/src/talloc/talloc.h new file mode 100644 index 0000000000..f549a17fba --- /dev/null +++ b/src/talloc/talloc.h @@ -0,0 +1,202 @@ +#ifndef _TALLOC_H_ +#define _TALLOC_H_ +/* + Unix SMB/CIFS implementation. + Samba temporary memory allocation functions + + Copyright (C) Andrew Tridgell 2004-2005 + Copyright (C) Stefan Metzmacher 2006 + + ** NOTE! The following LGPL license applies to the talloc + ** library. This does NOT imply that all of Samba is released + ** under the LGPL + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 3 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, see . +*/ + +#include +#include +#include + +#define TALLOC_VERSION_MAJOR 2 +#define TALLOC_VERSION_MINOR 0 + +int talloc_version_major(void); +int talloc_version_minor(void); + +/* this is only needed for compatibility with the old talloc */ +typedef void TALLOC_CTX; + +/* + this uses a little trick to allow __LINE__ to be stringified +*/ +#ifndef __location__ +#define __TALLOC_STRING_LINE1__(s) #s +#define __TALLOC_STRING_LINE2__(s) __TALLOC_STRING_LINE1__(s) +#define __TALLOC_STRING_LINE3__ __TALLOC_STRING_LINE2__(__LINE__) +#define __location__ __FILE__ ":" __TALLOC_STRING_LINE3__ +#endif + +#ifndef TALLOC_DEPRECATED +#define TALLOC_DEPRECATED 0 +#endif + +#ifndef PRINTF_ATTRIBUTE +#if (__GNUC__ >= 3) +/** Use gcc attribute to check printf fns. a1 is the 1-based index of + * the parameter containing the format, and a2 the index of the first + * argument. Note that some gcc 2.x versions don't handle this + * properly **/ +#define PRINTF_ATTRIBUTE(a1, a2) __attribute__ ((format (__printf__, a1, a2))) +#else +#define PRINTF_ATTRIBUTE(a1, a2) +#endif +#endif + +/* try to make talloc_set_destructor() and talloc_steal() type safe, + if we have a recent gcc */ +#if (__GNUC__ >= 3) +#define _TALLOC_TYPEOF(ptr) __typeof__(ptr) +#define talloc_set_destructor(ptr, function) \ + do { \ + int (*_talloc_destructor_fn)(_TALLOC_TYPEOF(ptr)) = (function); \ + _talloc_set_destructor((ptr), (int (*)(void *))_talloc_destructor_fn); \ + } while(0) +/* this extremely strange macro is to avoid some braindamaged warning + stupidity in gcc 4.1.x */ +#define talloc_steal(ctx, ptr) ({ _TALLOC_TYPEOF(ptr) __talloc_steal_ret = (_TALLOC_TYPEOF(ptr))_talloc_steal_loc((ctx),(ptr), __location__); __talloc_steal_ret; }) +#else +#define talloc_set_destructor(ptr, function) \ + _talloc_set_destructor((ptr), (int (*)(void *))(function)) +#define _TALLOC_TYPEOF(ptr) void * +#define talloc_steal(ctx, ptr) (_TALLOC_TYPEOF(ptr))_talloc_steal_loc((ctx),(ptr), __location__) +#endif + +#define talloc_reference(ctx, ptr) (_TALLOC_TYPEOF(ptr))_talloc_reference_loc((ctx),(ptr), __location__) +#define talloc_move(ctx, ptr) (_TALLOC_TYPEOF(*(ptr)))_talloc_move((ctx),(void *)(ptr)) + +/* useful macros for creating type checked pointers */ +#define talloc(ctx, type) (type *)talloc_named_const(ctx, sizeof(type), #type) +#define talloc_size(ctx, size) talloc_named_const(ctx, size, __location__) +#define talloc_ptrtype(ctx, ptr) (_TALLOC_TYPEOF(ptr))talloc_size(ctx, sizeof(*(ptr))) + +#define talloc_new(ctx) talloc_named_const(ctx, 0, "talloc_new: " __location__) + +#define talloc_zero(ctx, type) (type *)_talloc_zero(ctx, sizeof(type), #type) +#define talloc_zero_size(ctx, size) _talloc_zero(ctx, size, __location__) + +#define talloc_zero_array(ctx, type, count) (type *)_talloc_zero_array(ctx, sizeof(type), count, #type) +#define talloc_array(ctx, type, count) (type *)_talloc_array(ctx, sizeof(type), count, #type) +#define talloc_array_size(ctx, size, count) _talloc_array(ctx, size, count, __location__) +#define talloc_array_ptrtype(ctx, ptr, count) (_TALLOC_TYPEOF(ptr))talloc_array_size(ctx, sizeof(*(ptr)), count) +#define talloc_array_length(ctx) (talloc_get_size(ctx)/sizeof(*ctx)) + +#define talloc_realloc(ctx, p, type, count) (type *)_talloc_realloc_array(ctx, p, sizeof(type), count, #type) +#define talloc_realloc_size(ctx, ptr, size) _talloc_realloc(ctx, ptr, size, __location__) + +#define talloc_memdup(t, p, size) _talloc_memdup(t, p, size, __location__) + +#define talloc_set_type(ptr, type) talloc_set_name_const(ptr, #type) +#define talloc_get_type(ptr, type) (type *)talloc_check_name(ptr, #type) +#define talloc_get_type_abort(ptr, type) (type *)_talloc_get_type_abort(ptr, #type, __location__) + +#define talloc_find_parent_bytype(ptr, type) (type *)talloc_find_parent_byname(ptr, #type) +#define talloc_free(ctx) _talloc_free(ctx, __location__) + + +#if TALLOC_DEPRECATED +#define talloc_zero_p(ctx, type) talloc_zero(ctx, type) +#define talloc_p(ctx, type) talloc(ctx, type) +#define talloc_array_p(ctx, type, count) talloc_array(ctx, type, count) +#define talloc_realloc_p(ctx, p, type, count) talloc_realloc(ctx, p, type, count) +#define talloc_destroy(ctx) talloc_free(ctx) +#define talloc_append_string(c, s, a) (s?talloc_strdup_append(s,a):talloc_strdup(c, a)) +#endif + +#define TALLOC_FREE(ctx) do { talloc_free(ctx); ctx=NULL; } while(0) + +/* The following definitions come from talloc.c */ +void *_talloc(const void *context, size_t size); +void *talloc_pool(const void *context, size_t size); +void _talloc_set_destructor(const void *ptr, int (*_destructor)(void *)); +int talloc_increase_ref_count(const void *ptr); +size_t talloc_reference_count(const void *ptr); +void *_talloc_reference_loc(const void *context, const void *ptr, const char *location); +int talloc_unlink(const void *context, void *ptr); +const char *talloc_set_name(const void *ptr, const char *fmt, ...) PRINTF_ATTRIBUTE(2,3); +void talloc_set_name_const(const void *ptr, const char *name); +void *talloc_named(const void *context, size_t size, + const char *fmt, ...) PRINTF_ATTRIBUTE(3,4); +void *talloc_named_const(const void *context, size_t size, const char *name); +const char *talloc_get_name(const void *ptr); +void *talloc_check_name(const void *ptr, const char *name); +void *_talloc_get_type_abort(const void *ptr, const char *name, const char *location); +void *talloc_parent(const void *ptr); +const char *talloc_parent_name(const void *ptr); +void *talloc_init(const char *fmt, ...) PRINTF_ATTRIBUTE(1,2); +int _talloc_free(void *ptr, const char *location); +void talloc_free_children(void *ptr); +void *_talloc_realloc(const void *context, void *ptr, size_t size, const char *name); +void *_talloc_steal_loc(const void *new_ctx, const void *ptr, const char *location); +void *talloc_reparent(const void *old_parent, const void *new_parent, const void *ptr); +void *_talloc_move(const void *new_ctx, const void *pptr); +size_t talloc_total_size(const void *ptr); +size_t talloc_total_blocks(const void *ptr); +void talloc_report_depth_cb(const void *ptr, int depth, int max_depth, + void (*callback)(const void *ptr, + int depth, int max_depth, + int is_ref, + void *private_data), + void *private_data); +void talloc_report_depth_file(const void *ptr, int depth, int max_depth, FILE *f); +void talloc_report_full(const void *ptr, FILE *f); +void talloc_report(const void *ptr, FILE *f); +void talloc_enable_null_tracking(void); +void talloc_enable_null_tracking_no_autofree(void); +void talloc_disable_null_tracking(void); +void talloc_enable_leak_report(void); +void talloc_enable_leak_report_full(void); +void *_talloc_zero(const void *ctx, size_t size, const char *name); +void *_talloc_memdup(const void *t, const void *p, size_t size, const char *name); +void *_talloc_array(const void *ctx, size_t el_size, unsigned count, const char *name); +void *_talloc_zero_array(const void *ctx, size_t el_size, unsigned count, const char *name); +void *_talloc_realloc_array(const void *ctx, void *ptr, size_t el_size, unsigned count, const char *name); +void *talloc_realloc_fn(const void *context, void *ptr, size_t size); +void *talloc_autofree_context(void); +size_t talloc_get_size(const void *ctx); +void *talloc_find_parent_byname(const void *ctx, const char *name); +void talloc_show_parents(const void *context, FILE *file); +int talloc_is_parent(const void *context, const void *ptr); + +char *talloc_strdup(const void *t, const char *p); +char *talloc_strdup_append(char *s, const char *a); +char *talloc_strdup_append_buffer(char *s, const char *a); + +char *talloc_strndup(const void *t, const char *p, size_t n); +char *talloc_strndup_append(char *s, const char *a, size_t n); +char *talloc_strndup_append_buffer(char *s, const char *a, size_t n); + +char *talloc_vasprintf(const void *t, const char *fmt, va_list ap) PRINTF_ATTRIBUTE(2,0); +char *talloc_vasprintf_append(char *s, const char *fmt, va_list ap) PRINTF_ATTRIBUTE(2,0); +char *talloc_vasprintf_append_buffer(char *s, const char *fmt, va_list ap) PRINTF_ATTRIBUTE(2,0); + +char *talloc_asprintf(const void *t, const char *fmt, ...) PRINTF_ATTRIBUTE(2,3); +char *talloc_asprintf_append(char *s, const char *fmt, ...) PRINTF_ATTRIBUTE(2,3); +char *talloc_asprintf_append_buffer(char *s, const char *fmt, ...) PRINTF_ATTRIBUTE(2,3); + +void talloc_set_abort_fn(void (*abort_fn)(const char *reason)); +void talloc_set_log_fn(void (*log_fn)(const char *message)); +void talloc_set_log_stderr(void); + +#endif diff --git a/src/talloc/talloc_guide.txt b/src/talloc/talloc_guide.txt new file mode 100644 index 0000000000..01de806662 --- /dev/null +++ b/src/talloc/talloc_guide.txt @@ -0,0 +1,757 @@ +Using talloc in Samba4 +====================== + +.. contents:: + +Andrew Tridgell +August 2009 + +The most current version of this document is available at + http://samba.org/ftp/unpacked/talloc/talloc_guide.txt + +If you are used to the "old" talloc from Samba3 before 3.0.20 then please read +this carefully, as talloc has changed a lot. With 3.0.20 (or 3.0.14?) the +Samba4 talloc has been ported back to Samba3, so this guide applies to both. + +The new talloc is a hierarchical, reference counted memory pool system +with destructors. Quite a mouthful really, but not too bad once you +get used to it. + +Perhaps the biggest change from Samba3 is that there is no distinction +between a "talloc context" and a "talloc pointer". Any pointer +returned from talloc() is itself a valid talloc context. This means +you can do this:: + + struct foo *X = talloc(mem_ctx, struct foo); + X->name = talloc_strdup(X, "foo"); + +and the pointer X->name would be a "child" of the talloc context "X" +which is itself a child of mem_ctx. So if you do talloc_free(mem_ctx) +then it is all destroyed, whereas if you do talloc_free(X) then just X +and X->name are destroyed, and if you do talloc_free(X->name) then +just the name element of X is destroyed. + +If you think about this, then what this effectively gives you is an +n-ary tree, where you can free any part of the tree with +talloc_free(). + +If you find this confusing, then I suggest you run the testsuite to +watch talloc in action. You may also like to add your own tests to +testsuite.c to clarify how some particular situation is handled. + + +Performance +----------- + +All the additional features of talloc() over malloc() do come at a +price. We have a simple performance test in Samba4 that measures +talloc() versus malloc() performance, and it seems that talloc() is +about 4% slower than malloc() on my x86 Debian Linux box. For Samba, +the great reduction in code complexity that we get by using talloc +makes this worthwhile, especially as the total overhead of +talloc/malloc in Samba is already quite small. + + +talloc API +---------- + +The following is a complete guide to the talloc API. Read it all at +least twice. + +Multi-threading +--------------- + +talloc itself does not deal with threads. It is thread-safe (assuming +the underlying "malloc" is), as long as each thread uses different +memory contexts. +If two threads uses the same context then they need to synchronize in +order to be safe. In particular: +- when using talloc_enable_leak_report(), giving directly NULL as a +parent context implicitly refers to a hidden "null context" global +variable, so this should not be used in a multi-threaded environment +without proper synchronization ; +- the context returned by talloc_autofree_context() is also global so +shouldn't be used by several threads simultaneously without +synchronization. + + +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- +(type *)talloc(const void *context, type); + +The talloc() macro is the core of the talloc library. It takes a +memory context and a type, and returns a pointer to a new area of +memory of the given type. + +The returned pointer is itself a talloc context, so you can use it as +the context argument to more calls to talloc if you wish. + +The returned pointer is a "child" of the supplied context. This means +that if you talloc_free() the context then the new child disappears as +well. Alternatively you can free just the child. + +The context argument to talloc() can be NULL, in which case a new top +level context is created. + + +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- +void *talloc_size(const void *context, size_t size); + +The function talloc_size() should be used when you don't have a +convenient type to pass to talloc(). Unlike talloc(), it is not type +safe (as it returns a void *), so you are on your own for type checking. + +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- +(typeof(ptr)) talloc_ptrtype(const void *ctx, ptr); + +The talloc_ptrtype() macro should be used when you have a pointer and +want to allocate memory to point at with this pointer. When compiling +with gcc >= 3 it is typesafe. Note this is a wrapper of talloc_size() +and talloc_get_name() will return the current location in the source file. +and not the type. + +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- +int talloc_free(void *ptr); + +The talloc_free() function frees a piece of talloc memory, and all its +children. You can call talloc_free() on any pointer returned by +talloc(). + +The return value of talloc_free() indicates success or failure, with 0 +returned for success and -1 for failure. The only possible failure +condition is if the pointer had a destructor attached to it and the +destructor returned -1. See talloc_set_destructor() for details on +destructors. + +If this pointer has an additional parent when talloc_free() is called +then the memory is not actually released, but instead the most +recently established parent is destroyed. See talloc_reference() for +details on establishing additional parents. + +For more control on which parent is removed, see talloc_unlink() + +talloc_free() operates recursively on its children. + +From the 2.0 version of talloc, as a special case, talloc_free() is +refused on pointers that have more than one parent, as talloc would +have no way of knowing which parent should be removed. To free a +pointer that has more than one parent please use talloc_unlink(). + +To help you find problems in your code caused by this behaviour, if +you do try and free a pointer with more than one parent then the +talloc logging function will be called to give output like this: + + ERROR: talloc_free with references at some_dir/source/foo.c:123 + reference at some_dir/source/other.c:325 + reference at some_dir/source/third.c:121 + +Please see the documentation for talloc_set_log_fn() and +talloc_set_log_stderr() for more information on talloc logging +functions. + +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- +int talloc_free_children(void *ptr); + +The talloc_free_children() walks along the list of all children of a +talloc context and talloc_free()s only the children, not the context +itself. + + +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- +void *talloc_reference(const void *context, const void *ptr); + +The talloc_reference() function makes "context" an additional parent +of "ptr". + +The return value of talloc_reference() is always the original pointer +"ptr", unless talloc ran out of memory in creating the reference in +which case it will return NULL (each additional reference consumes +around 48 bytes of memory on intel x86 platforms). + +If "ptr" is NULL, then the function is a no-op, and simply returns NULL. + +After creating a reference you can free it in one of the following +ways: + + - you can talloc_free() any parent of the original pointer. That + will reduce the number of parents of this pointer by 1, and will + cause this pointer to be freed if it runs out of parents. + + - you can talloc_free() the pointer itself. That will destroy the + most recently established parent to the pointer and leave the + pointer as a child of its current parent. + +For more control on which parent to remove, see talloc_unlink() + + +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- +int talloc_unlink(const void *context, const void *ptr); + +The talloc_unlink() function removes a specific parent from ptr. The +context passed must either be a context used in talloc_reference() +with this pointer, or must be a direct parent of ptr. + +Note that if the parent has already been removed using talloc_free() +then this function will fail and will return -1. Likewise, if "ptr" +is NULL, then the function will make no modifications and return -1. + +Usually you can just use talloc_free() instead of talloc_unlink(), but +sometimes it is useful to have the additional control on which parent +is removed. + + +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- +void talloc_set_destructor(const void *ptr, int (*destructor)(void *)); + +The function talloc_set_destructor() sets the "destructor" for the +pointer "ptr". A destructor is a function that is called when the +memory used by a pointer is about to be released. The destructor +receives the pointer as an argument, and should return 0 for success +and -1 for failure. + +The destructor can do anything it wants to, including freeing other +pieces of memory. A common use for destructors is to clean up +operating system resources (such as open file descriptors) contained +in the structure the destructor is placed on. + +You can only place one destructor on a pointer. If you need more than +one destructor then you can create a zero-length child of the pointer +and place an additional destructor on that. + +To remove a destructor call talloc_set_destructor() with NULL for the +destructor. + +If your destructor attempts to talloc_free() the pointer that it is +the destructor for then talloc_free() will return -1 and the free will +be ignored. This would be a pointless operation anyway, as the +destructor is only called when the memory is just about to go away. + + +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- +int talloc_increase_ref_count(const void *ptr); + +The talloc_increase_ref_count(ptr) function is exactly equivalent to: + + talloc_reference(NULL, ptr); + +You can use either syntax, depending on which you think is clearer in +your code. + +It returns 0 on success and -1 on failure. + +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- +size_t talloc_reference_count(const void *ptr); + +Return the number of references to the pointer. + +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- +void talloc_set_name(const void *ptr, const char *fmt, ...); + +Each talloc pointer has a "name". The name is used principally for +debugging purposes, although it is also possible to set and get the +name on a pointer in as a way of "marking" pointers in your code. + +The main use for names on pointer is for "talloc reports". See +talloc_report() and talloc_report_full() for details. Also see +talloc_enable_leak_report() and talloc_enable_leak_report_full(). + +The talloc_set_name() function allocates memory as a child of the +pointer. It is logically equivalent to: + talloc_set_name_const(ptr, talloc_asprintf(ptr, fmt, ...)); + +Note that multiple calls to talloc_set_name() will allocate more +memory without releasing the name. All of the memory is released when +the ptr is freed using talloc_free(). + + +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- +void talloc_set_name_const(const void *ptr, const char *name); + +The function talloc_set_name_const() is just like talloc_set_name(), +but it takes a string constant, and is much faster. It is extensively +used by the "auto naming" macros, such as talloc_p(). + +This function does not allocate any memory. It just copies the +supplied pointer into the internal representation of the talloc +ptr. This means you must not pass a name pointer to memory that will +disappear before the ptr is freed with talloc_free(). + + +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- +void *talloc_named(const void *context, size_t size, const char *fmt, ...); + +The talloc_named() function creates a named talloc pointer. It is +equivalent to: + + ptr = talloc_size(context, size); + talloc_set_name(ptr, fmt, ....); + + +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- +void *talloc_named_const(const void *context, size_t size, const char *name); + +This is equivalent to:: + + ptr = talloc_size(context, size); + talloc_set_name_const(ptr, name); + + +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- +const char *talloc_get_name(const void *ptr); + +This returns the current name for the given talloc pointer. See +talloc_set_name() for details. + + +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- +void *talloc_init(const char *fmt, ...); + +This function creates a zero length named talloc context as a top +level context. It is equivalent to:: + + talloc_named(NULL, 0, fmt, ...); + + +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- +void *talloc_new(void *ctx); + +This is a utility macro that creates a new memory context hanging +off an exiting context, automatically naming it "talloc_new: __location__" +where __location__ is the source line it is called from. It is +particularly useful for creating a new temporary working context. + + +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- +(type *)talloc_realloc(const void *context, void *ptr, type, count); + +The talloc_realloc() macro changes the size of a talloc +pointer. The "count" argument is the number of elements of type "type" +that you want the resulting pointer to hold. + +talloc_realloc() has the following equivalences:: + + talloc_realloc(context, NULL, type, 1) ==> talloc(context, type); + talloc_realloc(context, NULL, type, N) ==> talloc_array(context, type, N); + talloc_realloc(context, ptr, type, 0) ==> talloc_free(ptr); + +The "context" argument is only used if "ptr" is NULL, otherwise it is +ignored. + +talloc_realloc() returns the new pointer, or NULL on failure. The call +will fail either due to a lack of memory, or because the pointer has +more than one parent (see talloc_reference()). + + +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- +void *talloc_realloc_size(const void *context, void *ptr, size_t size); + +the talloc_realloc_size() function is useful when the type is not +known so the typesafe talloc_realloc() cannot be used. + + +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- +void *talloc_steal(const void *new_ctx, const void *ptr); + +The talloc_steal() function changes the parent context of a talloc +pointer. It is typically used when the context that the pointer is +currently a child of is going to be freed and you wish to keep the +memory for a longer time. + +The talloc_steal() function returns the pointer that you pass it. It +does not have any failure modes. + +NOTE: It is possible to produce loops in the parent/child relationship +if you are not careful with talloc_steal(). No guarantees are provided +as to your sanity or the safety of your data if you do this. + +talloc_steal (new_ctx, NULL) will return NULL with no sideeffects. + +Note that if you try and call talloc_steal() on a pointer that has +more than one parent then the result is ambiguous. Talloc will choose +to remove the parent that is currently indicated by talloc_parent() +and replace it with the chosen parent. You will also get a message +like this via the talloc logging functions: + + WARNING: talloc_steal with references at some_dir/source/foo.c:123 + reference at some_dir/source/other.c:325 + reference at some_dir/source/third.c:121 + +To unambiguously change the parent of a pointer please see the +function talloc_reparent(). See the talloc_set_log_fn() documentation +for more information on talloc logging. + +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- +void *talloc_reparent(const void *old_parent, const void *new_parent, const void *ptr); + +The talloc_reparent() function changes the parent context of a talloc +pointer. It is typically used when the context that the pointer is +currently a child of is going to be freed and you wish to keep the +memory for a longer time. + +The talloc_reparent() function returns the pointer that you pass it. It +does not have any failure modes. + +The difference between talloc_reparent() and talloc_steal() is that +talloc_reparent() can specify which parent you wish to change. This is +useful when a pointer has multiple parents via references. + +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- +void *talloc_parent(const void *ptr); + +The talloc_parent() function returns the current talloc parent. This +is usually the pointer under which this memory was originally created, +but it may have changed due to a talloc_steal() or talloc_reparent() + +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- +size_t talloc_total_size(const void *ptr); + +The talloc_total_size() function returns the total size in bytes used +by this pointer and all child pointers. Mostly useful for debugging. + +Passing NULL is allowed, but it will only give a meaningful result if +talloc_enable_leak_report() or talloc_enable_leak_report_full() has +been called. + + +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- +size_t talloc_total_blocks(const void *ptr); + +The talloc_total_blocks() function returns the total memory block +count used by this pointer and all child pointers. Mostly useful for +debugging. + +Passing NULL is allowed, but it will only give a meaningful result if +talloc_enable_leak_report() or talloc_enable_leak_report_full() has +been called. + +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- +void talloc_report_depth_cb(const void *ptr, int depth, int max_depth, + void (*callback)(const void *ptr, + int depth, int max_depth, + int is_ref, + void *priv), + void *priv); + +This provides a more flexible reports than talloc_report(). It +will recursively call the callback for the entire tree of memory +referenced by the pointer. References in the tree are passed with +is_ref = 1 and the pointer that is referenced. + +You can pass NULL for the pointer, in which case a report is +printed for the top level memory context, but only if +talloc_enable_leak_report() or talloc_enable_leak_report_full() +has been called. + +The recursion is stopped when depth >= max_depth. +max_depth = -1 means only stop at leaf nodes. + + +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- +void talloc_report_depth_file(const void *ptr, int depth, int max_depth, FILE *f); + +This provides a more flexible reports than talloc_report(). It +will let you specify the depth and max_depth. + + +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- +void talloc_report(const void *ptr, FILE *f); + +The talloc_report() function prints a summary report of all memory +used by ptr. One line of report is printed for each immediate child of +ptr, showing the total memory and number of blocks used by that child. + +You can pass NULL for the pointer, in which case a report is printed +for the top level memory context, but only if +talloc_enable_leak_report() or talloc_enable_leak_report_full() has +been called. + + +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- +void talloc_report_full(const void *ptr, FILE *f); + +This provides a more detailed report than talloc_report(). It will +recursively print the ensire tree of memory referenced by the +pointer. References in the tree are shown by giving the name of the +pointer that is referenced. + +You can pass NULL for the pointer, in which case a report is printed +for the top level memory context, but only if +talloc_enable_leak_report() or talloc_enable_leak_report_full() has +been called. + + +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- +void talloc_enable_leak_report(void); + +This enables calling of talloc_report(NULL, stderr) when the program +exits. In Samba4 this is enabled by using the --leak-report command +line option. + +For it to be useful, this function must be called before any other +talloc function as it establishes a "null context" that acts as the +top of the tree. If you don't call this function first then passing +NULL to talloc_report() or talloc_report_full() won't give you the +full tree printout. + +Here is a typical talloc report: + +talloc report on 'null_context' (total 267 bytes in 15 blocks) + libcli/auth/spnego_parse.c:55 contains 31 bytes in 2 blocks + libcli/auth/spnego_parse.c:55 contains 31 bytes in 2 blocks + iconv(UTF8,CP850) contains 42 bytes in 2 blocks + libcli/auth/spnego_parse.c:55 contains 31 bytes in 2 blocks + iconv(CP850,UTF8) contains 42 bytes in 2 blocks + iconv(UTF8,UTF-16LE) contains 45 bytes in 2 blocks + iconv(UTF-16LE,UTF8) contains 45 bytes in 2 blocks + + +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- +void talloc_enable_leak_report_full(void); + +This enables calling of talloc_report_full(NULL, stderr) when the +program exits. In Samba4 this is enabled by using the +--leak-report-full command line option. + +For it to be useful, this function must be called before any other +talloc function as it establishes a "null context" that acts as the +top of the tree. If you don't call this function first then passing +NULL to talloc_report() or talloc_report_full() won't give you the +full tree printout. + +Here is a typical full report: + +full talloc report on 'root' (total 18 bytes in 8 blocks) + p1 contains 18 bytes in 7 blocks (ref 0) + r1 contains 13 bytes in 2 blocks (ref 0) + reference to: p2 + p2 contains 1 bytes in 1 blocks (ref 1) + x3 contains 1 bytes in 1 blocks (ref 0) + x2 contains 1 bytes in 1 blocks (ref 0) + x1 contains 1 bytes in 1 blocks (ref 0) + + +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- +void talloc_enable_null_tracking(void); + +This enables tracking of the NULL memory context without enabling leak +reporting on exit. Useful for when you want to do your own leak +reporting call via talloc_report_null_full(); + +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- +void talloc_disable_null_tracking(void); + +This disables tracking of the NULL memory context. + +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- +(type *)talloc_zero(const void *ctx, type); + +The talloc_zero() macro is equivalent to:: + + ptr = talloc(ctx, type); + if (ptr) memset(ptr, 0, sizeof(type)); + + +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- +void *talloc_zero_size(const void *ctx, size_t size) + +The talloc_zero_size() function is useful when you don't have a known type + + +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- +void *talloc_memdup(const void *ctx, const void *p, size_t size); + +The talloc_memdup() function is equivalent to:: + + ptr = talloc_size(ctx, size); + if (ptr) memcpy(ptr, p, size); + + +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- +char *talloc_strdup(const void *ctx, const char *p); + +The talloc_strdup() function is equivalent to:: + + ptr = talloc_size(ctx, strlen(p)+1); + if (ptr) memcpy(ptr, p, strlen(p)+1); + +This functions sets the name of the new pointer to the passed +string. This is equivalent to:: + + talloc_set_name_const(ptr, ptr) + +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- +char *talloc_strndup(const void *t, const char *p, size_t n); + +The talloc_strndup() function is the talloc equivalent of the C +library function strndup() + +This functions sets the name of the new pointer to the passed +string. This is equivalent to: + talloc_set_name_const(ptr, ptr) + +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- +char *talloc_append_string(const void *t, char *orig, const char *append); + +The talloc_append_string() function appends the given formatted +string to the given string. + +This function sets the name of the new pointer to the new +string. This is equivalent to:: + + talloc_set_name_const(ptr, ptr) + +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- +char *talloc_vasprintf(const void *t, const char *fmt, va_list ap); + +The talloc_vasprintf() function is the talloc equivalent of the C +library function vasprintf() + +This functions sets the name of the new pointer to the new +string. This is equivalent to:: + + talloc_set_name_const(ptr, ptr) + + +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- +char *talloc_asprintf(const void *t, const char *fmt, ...); + +The talloc_asprintf() function is the talloc equivalent of the C +library function asprintf() + +This functions sets the name of the new pointer to the new +string. This is equivalent to:: + + talloc_set_name_const(ptr, ptr) + + +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- +char *talloc_asprintf_append(char *s, const char *fmt, ...); + +The talloc_asprintf_append() function appends the given formatted +string to the given string. +Use this varient when the string in the current talloc buffer may +have been truncated in length. + +This functions sets the name of the new pointer to the new +string. This is equivalent to:: + + talloc_set_name_const(ptr, ptr) + + +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- +char *talloc_asprintf_append_buffer(char *s, const char *fmt, ...); + +The talloc_asprintf_append() function appends the given formatted +string to the end of the currently allocated talloc buffer. +Use this varient when the string in the current talloc buffer has +not been changed. + +This functions sets the name of the new pointer to the new +string. This is equivalent to:: + + talloc_set_name_const(ptr, ptr) + + +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- +((type *)talloc_array(const void *ctx, type, uint_t count); + +The talloc_array() macro is equivalent to:: + + (type *)talloc_size(ctx, sizeof(type) * count); + +except that it provides integer overflow protection for the multiply, +returning NULL if the multiply overflows. + + +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- +void *talloc_array_size(const void *ctx, size_t size, uint_t count); + +The talloc_array_size() function is useful when the type is not +known. It operates in the same way as talloc_array(), but takes a size +instead of a type. + +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- +(typeof(ptr)) talloc_array_ptrtype(const void *ctx, ptr, uint_t count); + +The talloc_ptrtype() macro should be used when you have a pointer to an array +and want to allocate memory of an array to point at with this pointer. When compiling +with gcc >= 3 it is typesafe. Note this is a wrapper of talloc_array_size() +and talloc_get_name() will return the current location in the source file. +and not the type. + +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- +void *talloc_realloc_fn(const void *ctx, void *ptr, size_t size); + +This is a non-macro version of talloc_realloc(), which is useful +as libraries sometimes want a ralloc function pointer. A realloc() +implementation encapsulates the functionality of malloc(), free() and +realloc() in one call, which is why it is useful to be able to pass +around a single function pointer. + + +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- +void *talloc_autofree_context(void); + +This is a handy utility function that returns a talloc context +which will be automatically freed on program exit. This can be used +to reduce the noise in memory leak reports. + + +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- +void *talloc_check_name(const void *ptr, const char *name); + +This function checks if a pointer has the specified name. If it does +then the pointer is returned. It it doesn't then NULL is returned. + + +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- +(type *)talloc_get_type(const void *ptr, type); + +This macro allows you to do type checking on talloc pointers. It is +particularly useful for void* private pointers. It is equivalent to +this:: + + (type *)talloc_check_name(ptr, #type) + + +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- +talloc_set_type(const void *ptr, type); + +This macro allows you to force the name of a pointer to be a +particular type. This can be used in conjunction with +talloc_get_type() to do type checking on void* pointers. + +It is equivalent to this:: + + talloc_set_name_const(ptr, #type) + +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- +talloc_get_size(const void *ctx); + +This function lets you know the amount of memory alloced so far by +this context. It does NOT account for subcontext memory. +This can be used to calculate the size of an array. + +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- +void *talloc_find_parent_byname(const void *ctx, const char *name); + +Find a parent memory context of the current context that has the given +name. This can be very useful in complex programs where it may be +difficult to pass all information down to the level you need, but you +know the structure you want is a parent of another context. + +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- +(type *)talloc_find_parent_bytype(ctx, type); + +Like talloc_find_parent_byname() but takes a type, making it typesafe. + +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- +void talloc_set_log_fn(void (*log_fn)(const char *message)); + +This function sets a logging function that talloc will use for +warnings and errors. By default talloc will not print any warnings or +errors. + +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- +void talloc_set_log_stderr(void) + +This sets the talloc log function to write log messages to stderr -- cgit v1.2.3 From 1ca2945f84e9cb298a7d4ad4ec9a0578097c146d Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Fri, 13 Aug 2010 13:53:04 +0100 Subject: talloc: Make it compile with MSVC, MinGW, and Xcode/gcc4.0. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Based on Aras Pranckevičius' patch. --- src/SConscript | 3 +++ src/talloc/SConscript | 20 ++++++++++++++++ src/talloc/talloc.c | 46 ++++++++++++++++++++++++++++++++++--- src/talloc/talloc.def | 63 +++++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 129 insertions(+), 3 deletions(-) create mode 100644 src/talloc/SConscript create mode 100644 src/talloc/talloc.def (limited to 'src') diff --git a/src/SConscript b/src/SConscript index 2b46186f98..c3e34be6f7 100644 --- a/src/SConscript +++ b/src/SConscript @@ -5,6 +5,9 @@ if 'egl' in env['statetrackers']: SConscript('egl/main/SConscript') if 'mesa' in env['statetrackers']: + if platform == 'windows': + SConscript('talloc/SConscript') + SConscript('glsl/SConscript') SConscript('mapi/glapi/SConscript') SConscript('mesa/SConscript') diff --git a/src/talloc/SConscript b/src/talloc/SConscript new file mode 100644 index 0000000000..a4861a932e --- /dev/null +++ b/src/talloc/SConscript @@ -0,0 +1,20 @@ +Import('*') + +if env['platform'] != 'windows': + Return() + +env = env.Clone() + +talloc = env.SharedLibrary( + target = 'talloc', + source = ['talloc.c', 'talloc.def'], +) + +env.InstallSharedLibrary(talloc) + +if env['platform'] != 'windows': + talloc = env.FindIxes(talloc, 'LIBPREFIX', 'LIBSUFFIX') +else: + talloc = env.FindIxes(talloc, 'SHLIBPREFIX', 'SHLIBSUFFIX') + +Export('talloc') diff --git a/src/talloc/talloc.c b/src/talloc/talloc.c index 7beda4b0f5..cc01346a7f 100644 --- a/src/talloc/talloc.c +++ b/src/talloc/talloc.c @@ -30,8 +30,38 @@ inspired by http://swapped.cc/halloc/ */ -#include "replace.h" #include "talloc.h" +#include + +#define TALLOC_MIN(a,b) ((a)<(b)?(a):(b)) + +/* Visual C++ 2008 compatibility */ +#if defined(_MSC_VER) && !defined(_cplusplus) +typedef size_t ssize_t; +#define inline __inline +#endif + +/* Xcode/gcc4.0 compatibility */ +#if defined(__APPLE__) || defined(__MINGW32__) +static size_t strnlen (const char* s, size_t n) +{ + size_t i; + for (i = 0; i < n; ++i) + { + if (s[i] == '\0') + break; + } + return i; +} +#endif + +/* Visual C++ 2008 & Xcode/gcc4.0 compatibility */ +#if !defined(_cplusplus) && (defined(WIN32) || defined(__APPLE__)) +typedef int bool; +#define false 0 +#define true 1 +#endif + #ifdef TALLOC_BUILD_VERSION_MAJOR #if (TALLOC_VERSION_MAJOR != TALLOC_BUILD_VERSION_MAJOR) @@ -1200,7 +1230,7 @@ void *_talloc_realloc(const void *context, void *ptr, size_t size, const char *n } if (new_ptr) { - memcpy(new_ptr, tc, MIN(tc->size,size) + TC_HDR_SIZE); + memcpy(new_ptr, tc, TALLOC_MIN(tc->size,size) + TC_HDR_SIZE); } } else { @@ -1686,7 +1716,7 @@ char *talloc_strndup_append_buffer(char *s, const char *a, size_t n) return __talloc_strlendup_append(s, slen, a, strnlen(a, n)); } -#ifndef HAVE_VA_COPY +#ifndef va_copy #ifdef HAVE___VA_COPY #define va_copy(dest, src) __va_copy(dest, src) #else @@ -1703,7 +1733,12 @@ char *talloc_vasprintf(const void *t, const char *fmt, va_list ap) /* this call looks strange, but it makes it work on older solaris boxes */ va_copy(ap2, ap); + #ifdef _MSC_VER + /* MSVC runtime needs to use _vcsprintf to return buffer size; vsnprintf would return -1 */ + len = _vscprintf(fmt, ap2); + #else len = vsnprintf(&c, 1, fmt, ap2); + #endif va_end(ap2); if (unlikely(len < 0)) { return NULL; @@ -1748,7 +1783,12 @@ static inline char *__talloc_vaslenprintf_append(char *s, size_t slen, char c; va_copy(ap2, ap); + #ifdef _MSC_VER + /* MSVC runtime needs to use _vcsprintf to return buffer size; vsnprintf would return -1 */ + alen = _vscprintf(fmt, ap2); + #else alen = vsnprintf(&c, 1, fmt, ap2); + #endif va_end(ap2); if (alen <= 0) { diff --git a/src/talloc/talloc.def b/src/talloc/talloc.def new file mode 100644 index 0000000000..13d7a159ce --- /dev/null +++ b/src/talloc/talloc.def @@ -0,0 +1,63 @@ +EXPORTS + _talloc + _talloc_array + _talloc_free + _talloc_get_type_abort + _talloc_memdup + _talloc_move + _talloc_realloc + _talloc_realloc_array + _talloc_reference_loc + _talloc_set_destructor + _talloc_steal_loc + _talloc_zero + _talloc_zero_array + talloc_asprintf + talloc_asprintf_append + talloc_asprintf_append_buffer + talloc_autofree_context + talloc_check_name + talloc_disable_null_tracking + talloc_enable_leak_report + talloc_enable_leak_report_full + talloc_enable_null_tracking + talloc_enable_null_tracking_no_autofree + talloc_find_parent_byname + talloc_free_children + talloc_get_name + talloc_get_size + talloc_increase_ref_count + talloc_init + talloc_is_parent + talloc_named + talloc_named_const + talloc_parent + talloc_parent_name + talloc_pool + talloc_realloc_fn + talloc_reference_count + talloc_reparent + talloc_report + talloc_report_depth_cb + talloc_report_depth_file + talloc_report_full + talloc_set_abort_fn + talloc_set_log_fn + talloc_set_log_stderr + talloc_set_name + talloc_set_name_const + talloc_show_parents + talloc_strdup + talloc_strdup_append + talloc_strdup_append_buffer + talloc_strndup + talloc_strndup_append + talloc_strndup_append_buffer + talloc_total_blocks + talloc_total_size + talloc_unlink + talloc_vasprintf + talloc_vasprintf_append + talloc_vasprintf_append_buffer + talloc_version_major + talloc_version_minor -- 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') 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') 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') 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') 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') 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') 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') 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') 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') 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') 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') 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') 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') 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') 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 d19eecef54384c163af27a470496ed885a5a271b Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 10 Aug 2010 20:11:44 -0700 Subject: glsl2: Move ir_to_mesa handling to driver CompileShader and LinkShader hooks. This lets drivers override ir_to_mesa with their own codegen, or at least have a native alternative. --- src/mesa/main/dd.h | 21 +++++++ src/mesa/main/shaderobj.c | 2 + src/mesa/program/ir_to_mesa.cpp | 126 +++++++++++++++++++++++----------------- src/mesa/program/ir_to_mesa.h | 2 + 4 files changed, 99 insertions(+), 52 deletions(-) (limited to 'src') diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h index 825073ca88..71d0f570e4 100644 --- a/src/mesa/main/dd.h +++ b/src/mesa/main/dd.h @@ -595,6 +595,27 @@ struct dd_function_table { /*@}*/ + /** + * \name GLSL shader/program functions. + */ + /*@{*/ + /** + * Called when a shader is compiled. + * + * Note that not all shader objects get ShaderCompile called on + * them. Notably, the shaders containing builtin functions do not + * have CompileShader() called, so if lowering passes are done they + * need to also be performed in LinkShader(). + */ + GLboolean (*CompileShader)(GLcontext *ctx, struct gl_shader *shader); + /** + * Called when a shader program is linked. + * + * This gives drivers an opportunity to clone the IR and make their + * own transformations on it for the purposes of code generation. + */ + GLboolean (*LinkShader)(GLcontext *ctx, struct gl_shader_program *shader); + /*@}*/ /** * \name State-changing functions. diff --git a/src/mesa/main/shaderobj.c b/src/mesa/main/shaderobj.c index 129d974224..863d50fbe5 100644 --- a/src/mesa/main/shaderobj.c +++ b/src/mesa/main/shaderobj.c @@ -387,4 +387,6 @@ _mesa_init_shader_object_functions(struct dd_function_table *driver) driver->DeleteShader = __mesa_delete_shader; driver->NewShaderProgram = _mesa_new_shader_program; driver->DeleteShaderProgram = __mesa_delete_shader_program; + driver->CompileShader = _mesa_ir_compile_shader; + driver->LinkShader = _mesa_ir_link_shader; } diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp index c8c655b296..7490ffa4fe 100644 --- a/src/mesa/program/ir_to_mesa.cpp +++ b/src/mesa/program/ir_to_mesa.cpp @@ -2543,6 +2543,72 @@ get_mesa_program(GLcontext *ctx, struct gl_shader_program *shader_program, } extern "C" { +GLboolean +_mesa_ir_compile_shader(GLcontext *ctx, struct gl_shader *shader) +{ + assert(shader->CompileStatus); + + return GL_TRUE; +} + +GLboolean +_mesa_ir_link_shader(GLcontext *ctx, struct gl_shader_program *prog) +{ + assert(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); + + validate_ir_tree(ir); + } + + for (unsigned i = 0; i < prog->_NumLinkedShaders; i++) { + struct gl_program *linked_prog; + bool ok = true; + + linked_prog = get_mesa_program(ctx, prog, prog->_LinkedShaders[i]); + + link_uniforms_to_shared_uniform_list(prog->Uniforms, linked_prog); + + switch (prog->_LinkedShaders[i]->Type) { + case GL_VERTEX_SHADER: + _mesa_reference_vertprog(ctx, &prog->VertexProgram, + (struct gl_vertex_program *)linked_prog); + ok = ctx->Driver.ProgramStringNotify(ctx, GL_VERTEX_PROGRAM_ARB, + linked_prog); + break; + case GL_FRAGMENT_SHADER: + _mesa_reference_fragprog(ctx, &prog->FragmentProgram, + (struct gl_fragment_program *)linked_prog); + ok = ctx->Driver.ProgramStringNotify(ctx, GL_FRAGMENT_PROGRAM_ARB, + linked_prog); + break; + } + if (!ok) { + return GL_FALSE; + } + } + + return GL_TRUE; +} void _mesa_glsl_compile_shader(GLcontext *ctx, struct gl_shader *shader) @@ -2604,7 +2670,12 @@ _mesa_glsl_compile_shader(GLcontext *ctx, struct gl_shader *shader) reparent_ir(shader->ir, shader); talloc_free(state); - } + + if (shader->CompileStatus) { + if (!ctx->Driver.CompileShader(ctx, shader)) + shader->CompileStatus = GL_FALSE; + } +} void _mesa_glsl_link_shader(GLcontext *ctx, struct gl_shader_program *prog) @@ -2639,57 +2710,8 @@ _mesa_glsl_link_shader(GLcontext *ctx, struct gl_shader_program *prog) } 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; - bool ok = true; - - linked_prog = get_mesa_program(ctx, prog, - prog->_LinkedShaders[i]); - - link_uniforms_to_shared_uniform_list(prog->Uniforms, linked_prog); - - switch (prog->_LinkedShaders[i]->Type) { - case GL_VERTEX_SHADER: - _mesa_reference_vertprog(ctx, &prog->VertexProgram, - (struct gl_vertex_program *)linked_prog); - ok = ctx->Driver.ProgramStringNotify(ctx, GL_VERTEX_PROGRAM_ARB, - linked_prog); - break; - case GL_FRAGMENT_SHADER: - _mesa_reference_fragprog(ctx, &prog->FragmentProgram, - (struct gl_fragment_program *)linked_prog); - ok = ctx->Driver.ProgramStringNotify(ctx, GL_FRAGMENT_PROGRAM_ARB, - linked_prog); - break; - } - if (!ok) { - prog->LinkStatus = GL_FALSE; - } - } + if (!ctx->Driver.LinkShader(ctx, prog)) + prog->LinkStatus = GL_FALSE; } } diff --git a/src/mesa/program/ir_to_mesa.h b/src/mesa/program/ir_to_mesa.h index e832f84e75..ecaacde4bb 100644 --- a/src/mesa/program/ir_to_mesa.h +++ b/src/mesa/program/ir_to_mesa.h @@ -30,6 +30,8 @@ extern "C" { void _mesa_glsl_compile_shader(GLcontext *ctx, struct gl_shader *sh); void _mesa_glsl_link_shader(GLcontext *ctx, struct gl_shader_program *prog); +GLboolean _mesa_ir_compile_shader(GLcontext *ctx, struct gl_shader *shader); +GLboolean _mesa_ir_link_shader(GLcontext *ctx, struct gl_shader_program *prog); #ifdef __cplusplus } -- cgit v1.2.3 From c374487a54aca2dd1053645092367c1cf0414ef7 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 10 Aug 2010 22:21:59 -0700 Subject: intel: Remove include of texmem.h, since we haven't used it in ages. --- src/mesa/drivers/dri/i965/brw_wm.c | 2 +- src/mesa/drivers/dri/intel/intel_context.h | 1 - src/mesa/drivers/dri/intel/intel_mipmap_tree.c | 1 + src/mesa/drivers/dri/intel/intel_tex.h | 2 -- 4 files changed, 2 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_wm.c b/src/mesa/drivers/dri/i965/brw_wm.c index e182fc3202..34cefeea32 100644 --- a/src/mesa/drivers/dri/i965/brw_wm.c +++ b/src/mesa/drivers/dri/i965/brw_wm.c @@ -32,7 +32,7 @@ #include "brw_context.h" #include "brw_wm.h" #include "brw_state.h" - +#include "main/formats.h" /** Return number of src args for given instruction */ GLuint brw_wm_nr_args( GLuint opcode ) diff --git a/src/mesa/drivers/dri/intel/intel_context.h b/src/mesa/drivers/dri/intel/intel_context.h index c7ac2de01e..f245ba843b 100644 --- a/src/mesa/drivers/dri/intel/intel_context.h +++ b/src/mesa/drivers/dri/intel/intel_context.h @@ -32,7 +32,6 @@ #include "main/mtypes.h" #include "main/mm.h" -#include "texmem.h" #include "dri_metaops.h" #include "drm.h" #include "intel_bufmgr.h" diff --git a/src/mesa/drivers/dri/intel/intel_mipmap_tree.c b/src/mesa/drivers/dri/intel/intel_mipmap_tree.c index 39ac0205fa..42adb4cb4a 100644 --- a/src/mesa/drivers/dri/intel/intel_mipmap_tree.c +++ b/src/mesa/drivers/dri/intel/intel_mipmap_tree.c @@ -30,6 +30,7 @@ #include "intel_regions.h" #include "intel_tex_layout.h" #include "main/enums.h" +#include "main/formats.h" #define FILE_DEBUG_FLAG DEBUG_MIPTREE diff --git a/src/mesa/drivers/dri/intel/intel_tex.h b/src/mesa/drivers/dri/intel/intel_tex.h index 4bb012dc65..cd77dd5b8e 100644 --- a/src/mesa/drivers/dri/intel/intel_tex.h +++ b/src/mesa/drivers/dri/intel/intel_tex.h @@ -31,8 +31,6 @@ #include "main/mtypes.h" #include "main/formats.h" #include "intel_context.h" -#include "texmem.h" - void intelInitTextureFuncs(struct dd_function_table *functions); -- cgit v1.2.3 From 9c3acce68001fdf7f5c77d1819d576b4cf92410a Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 10 Aug 2010 22:33:39 -0700 Subject: mesa: Avoid using c++ keyword in dri_util.h when compiled with c++. --- src/mesa/drivers/dri/common/dri_util.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src') diff --git a/src/mesa/drivers/dri/common/dri_util.h b/src/mesa/drivers/dri/common/dri_util.h index bc647ff813..e2fcdaa638 100644 --- a/src/mesa/drivers/dri/common/dri_util.h +++ b/src/mesa/drivers/dri/common/dri_util.h @@ -513,7 +513,11 @@ struct __DRIscreenRec { * * This pointer is never touched by the DRI layer. */ +#ifdef __cplusplus + void *priv; +#else void *private; +#endif /* Extensions provided by the loader. */ const __DRIgetDrawableInfoExtension *getDrawableInfo; -- 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') 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') 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') 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') 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') 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') 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') 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 2f8ee757ab324d599fcb8287789eb5f1a7890d74 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Fri, 13 Aug 2010 20:18:08 -0700 Subject: mesa: Work-arounds for platforms that lack C99 math functions --- src/mesa/main/imports.h | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'src') diff --git a/src/mesa/main/imports.h b/src/mesa/main/imports.h index 9c2ffd66d6..846a9a0faf 100644 --- a/src/mesa/main/imports.h +++ b/src/mesa/main/imports.h @@ -116,6 +116,34 @@ typedef union { GLfloat f; GLint i; } fi_type; #endif +/** + * \name Work-arounds for platforms that lack C99 math functions + */ +/*@{*/ +#if (_XOPEN_SOURCE < 600) && !defined(_ISOC99_SOURCE) \ + && (!defined(__STDC_VERSION__) || (__STDC_VERSION__ < 199901L)) +#define acosf(f) ((float) acos(f)) +#define asinf(f) ((float) asin(f)) +#define atan2f(f) ((float) atan2(f)) +#define atanf(f) ((float) atan(f)) +#define cielf(f) ((float) ciel(f)) +#define cosf(f) ((float) cos(f)) +#define coshf(f) ((float) cosh(f)) +#define expf(f) ((float) exp(f)) +#define exp2f(f) ((float) exp2(f)) +#define floorf(f) ((float) floor(f)) +#define logf(f) ((float) log(f)) +#define log2f(f) ((float) log2(f)) +#define powf(f) ((float) pow(f)) +#define sinf(f) ((float) sin(f)) +#define sinhf(f) ((float) sinh(f)) +#define sqrtf(f) ((float) sqrt(f)) +#define tanf(f) ((float) tan(f)) +#define tanhf(f) ((float) tanh(f)) +#define truncf(f) ((float) trunc(f)) +#endif +/*@}*/ + /*** *** LOG2: Log base 2 of float ***/ -- cgit v1.2.3 From 68f602afb1423eecf6d56bc91fc8ac7419969990 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Sat, 14 Aug 2010 12:43:56 +0100 Subject: mesa: atan2f and powf need two args. --- src/mesa/main/imports.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/mesa/main/imports.h b/src/mesa/main/imports.h index 846a9a0faf..42eba33d25 100644 --- a/src/mesa/main/imports.h +++ b/src/mesa/main/imports.h @@ -124,7 +124,7 @@ typedef union { GLfloat f; GLint i; } fi_type; && (!defined(__STDC_VERSION__) || (__STDC_VERSION__ < 199901L)) #define acosf(f) ((float) acos(f)) #define asinf(f) ((float) asin(f)) -#define atan2f(f) ((float) atan2(f)) +#define atan2f(x,y) ((float) atan2(x,y)) #define atanf(f) ((float) atan(f)) #define cielf(f) ((float) ciel(f)) #define cosf(f) ((float) cos(f)) @@ -134,7 +134,7 @@ typedef union { GLfloat f; GLint i; } fi_type; #define floorf(f) ((float) floor(f)) #define logf(f) ((float) log(f)) #define log2f(f) ((float) log2(f)) -#define powf(f) ((float) pow(f)) +#define powf(x,y) ((float) pow(x,y)) #define sinf(f) ((float) sin(f)) #define sinhf(f) ((float) sinh(f)) #define sqrtf(f) ((float) sqrt(f)) -- 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') 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 8881b0fe43540c44c1b6ba95d51651fc6b612ffb Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Sat, 14 Aug 2010 13:10:24 +0100 Subject: mesa: Recent versions of MSVC define the single precision functions already. --- src/mesa/main/imports.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/main/imports.h b/src/mesa/main/imports.h index 42eba33d25..a439370bc4 100644 --- a/src/mesa/main/imports.h +++ b/src/mesa/main/imports.h @@ -121,7 +121,8 @@ typedef union { GLfloat f; GLint i; } fi_type; */ /*@{*/ #if (_XOPEN_SOURCE < 600) && !defined(_ISOC99_SOURCE) \ - && (!defined(__STDC_VERSION__) || (__STDC_VERSION__ < 199901L)) + && (!defined(__STDC_VERSION__) || (__STDC_VERSION__ < 199901L)) \ + && (!defined(_MSC_VER) || (_MSC_VER < 1400)) #define acosf(f) ((float) acos(f)) #define asinf(f) ((float) asin(f)) #define atan2f(x,y) ((float) atan2(x,y)) -- cgit v1.2.3 From 325aa1b3cd3fa2dcfc936d2024a4493c06f3b3f4 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Sat, 14 Aug 2010 14:38:09 +0100 Subject: mesa: Silence gcc warning "missing initializer for member". --- src/mesa/program/ir_to_mesa.cpp | 56 ++++++++++++++++++++--------------------- 1 file changed, 28 insertions(+), 28 deletions(-) (limited to 'src') diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp index 7490ffa4fe..cf1fb91a70 100644 --- a/src/mesa/program/ir_to_mesa.cpp +++ b/src/mesa/program/ir_to_mesa.cpp @@ -980,51 +980,51 @@ static const struct { bool array_indexed; } statevars[] = { {"gl_DepthRange", "near", - {STATE_DEPTH_RANGE, 0, 0}, SWIZZLE_XXXX}, + {STATE_DEPTH_RANGE, 0, 0}, SWIZZLE_XXXX, false}, {"gl_DepthRange", "far", - {STATE_DEPTH_RANGE, 0, 0}, SWIZZLE_YYYY}, + {STATE_DEPTH_RANGE, 0, 0}, SWIZZLE_YYYY, false}, {"gl_DepthRange", "diff", - {STATE_DEPTH_RANGE, 0, 0}, SWIZZLE_ZZZZ}, + {STATE_DEPTH_RANGE, 0, 0}, SWIZZLE_ZZZZ, false}, {"gl_ClipPlane", NULL, {STATE_CLIPPLANE, 0, 0}, SWIZZLE_XYZW, true} , {"gl_Point", "size", - {STATE_POINT_SIZE}, SWIZZLE_XXXX}, + {STATE_POINT_SIZE}, SWIZZLE_XXXX, false}, {"gl_Point", "sizeMin", - {STATE_POINT_SIZE}, SWIZZLE_YYYY}, + {STATE_POINT_SIZE}, SWIZZLE_YYYY, false}, {"gl_Point", "sizeMax", - {STATE_POINT_SIZE}, SWIZZLE_ZZZZ}, + {STATE_POINT_SIZE}, SWIZZLE_ZZZZ, false}, {"gl_Point", "fadeThresholdSize", - {STATE_POINT_SIZE}, SWIZZLE_WWWW}, + {STATE_POINT_SIZE}, SWIZZLE_WWWW, false}, {"gl_Point", "distanceConstantAttenuation", - {STATE_POINT_ATTENUATION}, SWIZZLE_XXXX}, + {STATE_POINT_ATTENUATION}, SWIZZLE_XXXX, false}, {"gl_Point", "distanceLinearAttenuation", - {STATE_POINT_ATTENUATION}, SWIZZLE_YYYY}, + {STATE_POINT_ATTENUATION}, SWIZZLE_YYYY, false}, {"gl_Point", "distanceQuadraticAttenuation", - {STATE_POINT_ATTENUATION}, SWIZZLE_ZZZZ}, + {STATE_POINT_ATTENUATION}, SWIZZLE_ZZZZ, false}, {"gl_FrontMaterial", "emission", - {STATE_MATERIAL, 0, STATE_EMISSION}, SWIZZLE_XYZW}, + {STATE_MATERIAL, 0, STATE_EMISSION}, SWIZZLE_XYZW, false}, {"gl_FrontMaterial", "ambient", - {STATE_MATERIAL, 0, STATE_AMBIENT}, SWIZZLE_XYZW}, + {STATE_MATERIAL, 0, STATE_AMBIENT}, SWIZZLE_XYZW, false}, {"gl_FrontMaterial", "diffuse", - {STATE_MATERIAL, 0, STATE_DIFFUSE}, SWIZZLE_XYZW}, + {STATE_MATERIAL, 0, STATE_DIFFUSE}, SWIZZLE_XYZW, false}, {"gl_FrontMaterial", "specular", - {STATE_MATERIAL, 0, STATE_SPECULAR}, SWIZZLE_XYZW}, + {STATE_MATERIAL, 0, STATE_SPECULAR}, SWIZZLE_XYZW, false}, {"gl_FrontMaterial", "shininess", - {STATE_MATERIAL, 0, STATE_SHININESS}, SWIZZLE_XXXX}, + {STATE_MATERIAL, 0, STATE_SHININESS}, SWIZZLE_XXXX, false}, {"gl_BackMaterial", "emission", - {STATE_MATERIAL, 1, STATE_EMISSION}, SWIZZLE_XYZW}, + {STATE_MATERIAL, 1, STATE_EMISSION}, SWIZZLE_XYZW, false}, {"gl_BackMaterial", "ambient", - {STATE_MATERIAL, 1, STATE_AMBIENT}, SWIZZLE_XYZW}, + {STATE_MATERIAL, 1, STATE_AMBIENT}, SWIZZLE_XYZW, false}, {"gl_BackMaterial", "diffuse", - {STATE_MATERIAL, 1, STATE_DIFFUSE}, SWIZZLE_XYZW}, + {STATE_MATERIAL, 1, STATE_DIFFUSE}, SWIZZLE_XYZW, false}, {"gl_BackMaterial", "specular", - {STATE_MATERIAL, 1, STATE_SPECULAR}, SWIZZLE_XYZW}, + {STATE_MATERIAL, 1, STATE_SPECULAR}, SWIZZLE_XYZW, false}, {"gl_BackMaterial", "shininess", - {STATE_MATERIAL, 1, STATE_SHININESS}, SWIZZLE_XXXX}, + {STATE_MATERIAL, 1, STATE_SHININESS}, SWIZZLE_XXXX, false}, {"gl_LightSource", "ambient", {STATE_LIGHT, 0, STATE_AMBIENT}, SWIZZLE_XYZW, true}, @@ -1052,12 +1052,12 @@ static const struct { {STATE_LIGHT, 0, STATE_ATTENUATION}, SWIZZLE_ZZZZ, true}, {"gl_LightModel", NULL, - {STATE_LIGHTMODEL_AMBIENT, 0}, SWIZZLE_XYZW}, + {STATE_LIGHTMODEL_AMBIENT, 0}, SWIZZLE_XYZW, false}, {"gl_FrontLightModelProduct", NULL, - {STATE_LIGHTMODEL_SCENECOLOR, 0}, SWIZZLE_XYZW}, + {STATE_LIGHTMODEL_SCENECOLOR, 0}, SWIZZLE_XYZW, false}, {"gl_BackLightModelProduct", NULL, - {STATE_LIGHTMODEL_SCENECOLOR, 1}, SWIZZLE_XYZW}, + {STATE_LIGHTMODEL_SCENECOLOR, 1}, SWIZZLE_XYZW, false}, {"gl_FrontLightProduct", "ambient", {STATE_LIGHTPROD, 0, 0, STATE_AMBIENT}, SWIZZLE_XYZW, true}, @@ -1095,15 +1095,15 @@ static const struct { {STATE_TEXGEN, 0, STATE_TEXGEN_OBJECT_Q}, SWIZZLE_XYZW, true}, {"gl_Fog", "color", - {STATE_FOG_COLOR}, SWIZZLE_XYZW}, + {STATE_FOG_COLOR}, SWIZZLE_XYZW, false}, {"gl_Fog", "density", - {STATE_FOG_PARAMS}, SWIZZLE_XXXX}, + {STATE_FOG_PARAMS}, SWIZZLE_XXXX, false}, {"gl_Fog", "start", - {STATE_FOG_PARAMS}, SWIZZLE_YYYY}, + {STATE_FOG_PARAMS}, SWIZZLE_YYYY, false}, {"gl_Fog", "end", - {STATE_FOG_PARAMS}, SWIZZLE_ZZZZ}, + {STATE_FOG_PARAMS}, SWIZZLE_ZZZZ, false}, {"gl_Fog", "scale", - {STATE_FOG_PARAMS}, SWIZZLE_WWWW}, + {STATE_FOG_PARAMS}, SWIZZLE_WWWW, false}, }; static ir_to_mesa_src_reg -- cgit v1.2.3 From 19acfa42ed47edb63f5ec3de8051a3102e62e96b Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Sat, 14 Aug 2010 14:40:06 +0100 Subject: mesa: Silence gcc warning "control reaches end of non-void function". --- src/mesa/program/ir_to_mesa.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp index cf1fb91a70..2208bc1ce8 100644 --- a/src/mesa/program/ir_to_mesa.cpp +++ b/src/mesa/program/ir_to_mesa.cpp @@ -526,6 +526,7 @@ type_size(const struct glsl_type *type) return 0; default: assert(0); + return 0; } } -- 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') 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 1d22923fae7f4c749b3820844110e3d8ee4d26c0 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Sat, 14 Aug 2010 15:29:15 +0100 Subject: scons: Link talloc. --- src/gallium/targets/libgl-xlib/SConscript | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/gallium/targets/libgl-xlib/SConscript b/src/gallium/targets/libgl-xlib/SConscript index 78703fd096..88e216a65b 100644 --- a/src/gallium/targets/libgl-xlib/SConscript +++ b/src/gallium/targets/libgl-xlib/SConscript @@ -35,6 +35,7 @@ env.Prepend(LIBS = [ mesa, glsl, gallium, + 'talloc' ]) sources = [ -- 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') 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') 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 a0b0afc6944b00df27145a96ad2727a36752e1d6 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Sun, 15 Aug 2010 13:08:15 -0700 Subject: mesa: Check that _XOPEN_SOURCE is defined before using it. --- src/mesa/main/imports.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/main/imports.h b/src/mesa/main/imports.h index a439370bc4..e967b14731 100644 --- a/src/mesa/main/imports.h +++ b/src/mesa/main/imports.h @@ -120,7 +120,7 @@ typedef union { GLfloat f; GLint i; } fi_type; * \name Work-arounds for platforms that lack C99 math functions */ /*@{*/ -#if (_XOPEN_SOURCE < 600) && !defined(_ISOC99_SOURCE) \ +#if (defined(_XOPEN_SOURCE) && (_XOPEN_SOURCE < 600)) && !defined(_ISOC99_SOURCE) \ && (!defined(__STDC_VERSION__) || (__STDC_VERSION__ < 199901L)) \ && (!defined(_MSC_VER) || (_MSC_VER < 1400)) #define acosf(f) ((float) acos(f)) -- cgit v1.2.3 From c9b7bece0569d9e193591ebff329acd1d9bd9e3c Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Sun, 15 Aug 2010 22:58:26 +0100 Subject: llvmpipe: special case triangles which fall in a single 16x16 block Check for these and route them to a dedicated handler with one fewer levels of recursive rasterization. --- src/gallium/drivers/llvmpipe/lp_rast.h | 4 ++ src/gallium/drivers/llvmpipe/lp_rast_tri.c | 82 +++++++++++++++++++++++++++++ src/gallium/drivers/llvmpipe/lp_setup_tri.c | 20 +++++++ 3 files changed, 106 insertions(+) (limited to 'src') diff --git a/src/gallium/drivers/llvmpipe/lp_rast.h b/src/gallium/drivers/llvmpipe/lp_rast.h index 44319a0ad6..102e902d02 100644 --- a/src/gallium/drivers/llvmpipe/lp_rast.h +++ b/src/gallium/drivers/llvmpipe/lp_rast.h @@ -256,5 +256,9 @@ void lp_rast_begin_query(struct lp_rasterizer_task *, void lp_rast_end_query(struct lp_rasterizer_task *, const union lp_rast_cmd_arg ); +void +lp_rast_triangle_3_16(struct lp_rasterizer_task *task, + const union lp_rast_cmd_arg arg); + #endif diff --git a/src/gallium/drivers/llvmpipe/lp_rast_tri.c b/src/gallium/drivers/llvmpipe/lp_rast_tri.c index 980c18c024..673f67386b 100644 --- a/src/gallium/drivers/llvmpipe/lp_rast_tri.c +++ b/src/gallium/drivers/llvmpipe/lp_rast_tri.c @@ -157,3 +157,85 @@ build_mask_linear(int c, int dcdx, int dcdy) #define NR_PLANES 7 #include "lp_rast_tri_tmp.h" + +/* Special case for 3 plane triangle which is contained entirely + * within a 16x16 block. + */ +void +lp_rast_triangle_3_16(struct lp_rasterizer_task *task, + const union lp_rast_cmd_arg arg) +{ + const struct lp_rast_triangle *tri = arg.triangle.tri; + const struct lp_rast_plane *plane = tri->plane; + unsigned mask = arg.triangle.plane_mask; + const int x = task->x + (mask & 0xf) * 16; + const int y = task->y + (mask >> 4) * 16; + unsigned outmask, inmask, partmask, partial_mask; + unsigned j; + int c[3]; + + outmask = 0; /* outside one or more trivial reject planes */ + partmask = 0; /* outside one or more trivial accept planes */ + + for (j = 0; j < 3; j++) { + c[j] = plane[j].c + plane[j].dcdy * y - plane[j].dcdx * x; + + { + const int dcdx = -plane[j].dcdx * 4; + const int dcdy = plane[j].dcdy * 4; + const int cox = c[j] + plane[j].eo * 4; + const int cio = c[j] + plane[j].ei * 4 - 1; + + outmask |= build_mask_linear(cox, dcdx, dcdy); + partmask |= build_mask_linear(cio, dcdx, dcdy); + } + } + + if (outmask == 0xffff) + return; + + /* Mask of sub-blocks which are inside all trivial accept planes: + */ + inmask = ~partmask & 0xffff; + + /* Mask of sub-blocks which are inside all trivial reject planes, + * but outside at least one trivial accept plane: + */ + partial_mask = partmask & ~outmask; + + assert((partial_mask & inmask) == 0); + + /* Iterate over partials: + */ + while (partial_mask) { + int i = ffs(partial_mask) - 1; + int ix = (i & 3) * 4; + int iy = (i >> 2) * 4; + int px = x + ix; + int py = y + iy; + int cx[3]; + + partial_mask &= ~(1 << i); + + for (j = 0; j < 3; j++) + cx[j] = (c[j] + - plane[j].dcdx * ix + + plane[j].dcdy * iy); + + do_block_4_3(task, tri, plane, px, py, cx); + } + + /* Iterate over fulls: + */ + while (inmask) { + int i = ffs(inmask) - 1; + int ix = (i & 3) * 4; + int iy = (i >> 2) * 4; + int px = x + ix; + int py = y + iy; + + inmask &= ~(1 << i); + + block_full_4(task, tri, px, py); + } +} diff --git a/src/gallium/drivers/llvmpipe/lp_setup_tri.c b/src/gallium/drivers/llvmpipe/lp_setup_tri.c index 393533ebee..614a6372b4 100644 --- a/src/gallium/drivers/llvmpipe/lp_setup_tri.c +++ b/src/gallium/drivers/llvmpipe/lp_setup_tri.c @@ -643,6 +643,26 @@ do_triangle_ccw(struct lp_setup_context *setup, /* Convert to tile coordinates, and inclusive ranges: */ + if (nr_planes == 3) { + int ix0 = minx / 16; + int iy0 = miny / 16; + int ix1 = (maxx-1) / 16; + int iy1 = (maxy-1) / 16; + + if (iy0 == iy1 && ix0 == ix1) + { + + /* Triangle is contained in a single 16x16 block: + */ + int mask = (ix0 & 3) | ((iy0 & 3) << 4); + + lp_scene_bin_command( scene, ix0/4, iy0/4, + lp_rast_triangle_3_16, + lp_rast_arg_triangle(tri, mask) ); + return; + } + } + ix0 = minx / TILE_SIZE; iy0 = miny / TILE_SIZE; ix1 = (maxx-1) / TILE_SIZE; -- cgit v1.2.3 From b97ab20f29c4afa708e9176331d6a20551a308ac Mon Sep 17 00:00:00 2001 From: Marek Olšák Date: Sun, 15 Aug 2010 22:52:07 +0200 Subject: r300/compiler: fix allocation of temporaries in radeonTransformTEX --- src/mesa/drivers/dri/r300/compiler/radeon_program_tex.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_program_tex.c b/src/mesa/drivers/dri/r300/compiler/radeon_program_tex.c index 9c4b65f4c0..ddce590ee6 100644 --- a/src/mesa/drivers/dri/r300/compiler/radeon_program_tex.c +++ b/src/mesa/drivers/dri/r300/compiler/radeon_program_tex.c @@ -117,8 +117,8 @@ int radeonTransformTEX( struct rc_instruction * inst_rcp = NULL; struct rc_instruction * inst_mad; struct rc_instruction * inst_cmp; - unsigned tmp_texsample = rc_find_free_temporary(c); - unsigned tmp_sum = rc_find_free_temporary(c); + unsigned tmp_texsample; + unsigned tmp_sum; unsigned tmp_recip_w = 0; int pass, fail, tex; @@ -126,6 +126,7 @@ int radeonTransformTEX( struct rc_dst_register output_reg = inst->U.I.DstReg; /* Redirect TEX to a new temp. */ + tmp_texsample = rc_find_free_temporary(c); inst->U.I.DstReg.File = RC_FILE_TEMPORARY; inst->U.I.DstReg.Index = tmp_texsample; inst->U.I.DstReg.WriteMask = RC_MASK_XYZW; @@ -144,6 +145,7 @@ int radeonTransformTEX( } /* Perspective-divide r by W (if it's TXP) and add the texture sample (see below). */ + tmp_sum = rc_find_free_temporary(c); inst_mad = rc_insert_new_instruction(c, inst_rcp ? inst_rcp : inst); inst_mad->U.I.DstReg.File = RC_FILE_TEMPORARY; inst_mad->U.I.DstReg.Index = tmp_sum; @@ -199,6 +201,8 @@ int radeonTransformTEX( inst_cmp->U.I.SrcReg[pass].File = RC_FILE_NONE; inst_cmp->U.I.SrcReg[pass].Swizzle = RC_SWIZZLE_1111; inst_cmp->U.I.SrcReg[fail] = shadow_ambient(compiler, inst->U.I.TexSrcUnit); + + assert(tmp_texsample != tmp_sum && tmp_sum != tmp_recip_w); } } -- cgit v1.2.3 From b217167056970a9b7d09b7ffe863f013c2083395 Mon Sep 17 00:00:00 2001 From: Marek Olšák Date: Sun, 15 Aug 2010 22:53:17 +0200 Subject: r300/compiler: implement SSG opcode --- src/gallium/drivers/r300/r300_tgsi_to_rc.c | 2 +- .../drivers/dri/r300/compiler/radeon_opcodes.c | 7 ++ .../drivers/dri/r300/compiler/radeon_opcodes.h | 3 + .../drivers/dri/r300/compiler/radeon_program_alu.c | 74 ++++++++++++++++++++++ 4 files changed, 85 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_tgsi_to_rc.c b/src/gallium/drivers/r300/r300_tgsi_to_rc.c index dd697b9c37..53f07c1f02 100644 --- a/src/gallium/drivers/r300/r300_tgsi_to_rc.c +++ b/src/gallium/drivers/r300/r300_tgsi_to_rc.c @@ -97,7 +97,7 @@ static unsigned translate_opcode(unsigned opcode) /* case TGSI_OPCODE_BRA: return RC_OPCODE_BRA; */ /* case TGSI_OPCODE_CAL: return RC_OPCODE_CAL; */ /* case TGSI_OPCODE_RET: return RC_OPCODE_RET; */ - /* case TGSI_OPCODE_SSG: return RC_OPCODE_SSG; */ + case TGSI_OPCODE_SSG: return RC_OPCODE_SSG; case TGSI_OPCODE_CMP: return RC_OPCODE_CMP; case TGSI_OPCODE_SCS: return RC_OPCODE_SCS; case TGSI_OPCODE_TXB: return RC_OPCODE_TXB; diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_opcodes.c b/src/mesa/drivers/dri/r300/compiler/radeon_opcodes.c index 2ea830be7f..0602e02a98 100644 --- a/src/mesa/drivers/dri/r300/compiler/radeon_opcodes.c +++ b/src/mesa/drivers/dri/r300/compiler/radeon_opcodes.c @@ -294,6 +294,13 @@ struct rc_opcode_info rc_opcodes[MAX_RC_OPCODE] = { .HasDstReg = 1, .IsComponentwise = 1 }, + { + .Opcode = RC_OPCODE_SSG, + .Name = "SSG", + .NumSrcRegs = 1, + .HasDstReg = 1, + .IsComponentwise = 1 + }, { .Opcode = RC_OPCODE_SUB, .Name = "SUB", diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_opcodes.h b/src/mesa/drivers/dri/r300/compiler/radeon_opcodes.h index 6e18d6eb3f..0a9fceef38 100644 --- a/src/mesa/drivers/dri/r300/compiler/radeon_opcodes.h +++ b/src/mesa/drivers/dri/r300/compiler/radeon_opcodes.h @@ -154,6 +154,9 @@ typedef enum { /** vec4 instruction: dst.c = (src0.c != src1.c) ? 1.0 : 0.0 */ RC_OPCODE_SNE, + /** vec4 instruction: dst.c = (src0.c < 0 ?) -1 : ((src0.c > 0) : 1 : 0) */ + RC_OPCODE_SSG, + /** vec4 instruction: dst.c = src0.c - src1.c */ RC_OPCODE_SUB, diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_program_alu.c b/src/mesa/drivers/dri/r300/compiler/radeon_program_alu.c index 857aae5514..c988e0c67e 100644 --- a/src/mesa/drivers/dri/r300/compiler/radeon_program_alu.c +++ b/src/mesa/drivers/dri/r300/compiler/radeon_program_alu.c @@ -464,6 +464,43 @@ static void transform_SNE(struct radeon_compiler* c, rc_remove_instruction(inst); } +static void transform_SSG(struct radeon_compiler* c, + struct rc_instruction* inst) +{ + /* result = sign(x) + * + * CMP tmp0, -x, 1, 0 + * CMP tmp1, x, 1, 0 + * ADD result, tmp0, -tmp1; + */ + unsigned tmp0, tmp1; + + /* 0 < x */ + tmp0 = rc_find_free_temporary(c); + emit3(c, inst->Prev, RC_OPCODE_CMP, 0, + dstregtmpmask(tmp0, inst->U.I.DstReg.WriteMask), + negate(inst->U.I.SrcReg[0]), + builtin_one, + builtin_zero); + + /* x < 0 */ + tmp1 = rc_find_free_temporary(c); + emit3(c, inst->Prev, RC_OPCODE_CMP, 0, + dstregtmpmask(tmp1, inst->U.I.DstReg.WriteMask), + inst->U.I.SrcReg[0], + builtin_one, + builtin_zero); + + /* Either both are zero, or one of them is one and the other is zero. */ + /* result = tmp0 - tmp1 */ + emit2(c, inst->Prev, RC_OPCODE_ADD, 0, + inst->U.I.DstReg, + srcreg(RC_FILE_TEMPORARY, tmp0), + negate(srcreg(RC_FILE_TEMPORARY, tmp1))); + + rc_remove_instruction(inst); +} + static void transform_SUB(struct radeon_compiler* c, struct rc_instruction* inst) { @@ -530,6 +567,7 @@ int radeonTransformALU( case RC_OPCODE_SLE: transform_SLE(c, inst); return 1; case RC_OPCODE_SLT: transform_SLT(c, inst); return 1; case RC_OPCODE_SNE: transform_SNE(c, inst); return 1; + case RC_OPCODE_SSG: transform_SSG(c, inst); return 1; case RC_OPCODE_SUB: transform_SUB(c, inst); return 1; case RC_OPCODE_SWZ: transform_SWZ(c, inst); return 1; case RC_OPCODE_XPD: transform_XPD(c, inst); return 1; @@ -672,6 +710,41 @@ static void transform_r300_vertex_SLE(struct radeon_compiler* c, inst->U.I.SrcReg[1].Negate ^= RC_MASK_XYZW; } +static void transform_r300_vertex_SSG(struct radeon_compiler* c, + struct rc_instruction* inst) +{ + /* result = sign(x) + * + * SLT tmp0, 0, x; + * SLT tmp1, x, 0; + * ADD result, tmp0, -tmp1; + */ + unsigned tmp0, tmp1; + + /* 0 < x */ + tmp0 = rc_find_free_temporary(c); + emit2(c, inst->Prev, RC_OPCODE_SLT, 0, + dstregtmpmask(tmp0, inst->U.I.DstReg.WriteMask), + builtin_zero, + inst->U.I.SrcReg[0]); + + /* x < 0 */ + tmp1 = rc_find_free_temporary(c); + emit2(c, inst->Prev, RC_OPCODE_SLT, 0, + dstregtmpmask(tmp1, inst->U.I.DstReg.WriteMask), + inst->U.I.SrcReg[0], + builtin_zero); + + /* Either both are zero, or one of them is one and the other is zero. */ + /* result = tmp0 - tmp1 */ + emit2(c, inst->Prev, RC_OPCODE_ADD, 0, + inst->U.I.DstReg, + srcreg(RC_FILE_TEMPORARY, tmp0), + negate(srcreg(RC_FILE_TEMPORARY, tmp1))); + + rc_remove_instruction(inst); +} + /** * For use with radeonLocalTransform, this transforms non-native ALU * instructions of the r300 up to r500 vertex engine. @@ -705,6 +778,7 @@ int r300_transform_vertex_alu( return 1; } return 0; + case RC_OPCODE_SSG: transform_r300_vertex_SSG(c, inst); return 1; case RC_OPCODE_SUB: transform_SUB(c, inst); return 1; case RC_OPCODE_SWZ: transform_SWZ(c, inst); return 1; case RC_OPCODE_XPD: transform_XPD(c, inst); return 1; -- cgit v1.2.3 From 27eb2e275544d78a229eaded9bafc0db60172675 Mon Sep 17 00:00:00 2001 From: Marek Olšák Date: Sun, 15 Aug 2010 23:44:16 +0200 Subject: r300/compiler: implement DP2 opcode --- src/gallium/drivers/r300/r300_tgsi_to_rc.c | 2 +- .../drivers/dri/r300/compiler/radeon_opcodes.c | 10 +++++ .../drivers/dri/r300/compiler/radeon_opcodes.h | 3 ++ .../drivers/dri/r300/compiler/radeon_program_alu.c | 43 +++++++++++++++++----- 4 files changed, 48 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_tgsi_to_rc.c b/src/gallium/drivers/r300/r300_tgsi_to_rc.c index 53f07c1f02..a4911b9a2a 100644 --- a/src/gallium/drivers/r300/r300_tgsi_to_rc.c +++ b/src/gallium/drivers/r300/r300_tgsi_to_rc.c @@ -103,7 +103,7 @@ static unsigned translate_opcode(unsigned opcode) case TGSI_OPCODE_TXB: return RC_OPCODE_TXB; /* case TGSI_OPCODE_NRM: return RC_OPCODE_NRM; */ /* case TGSI_OPCODE_DIV: return RC_OPCODE_DIV; */ - /* case TGSI_OPCODE_DP2: return RC_OPCODE_DP2; */ + case TGSI_OPCODE_DP2: return RC_OPCODE_DP2; case TGSI_OPCODE_TXL: return RC_OPCODE_TXL; case TGSI_OPCODE_BRK: return RC_OPCODE_BRK; case TGSI_OPCODE_IF: return RC_OPCODE_IF; diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_opcodes.c b/src/mesa/drivers/dri/r300/compiler/radeon_opcodes.c index 0602e02a98..da495a3afa 100644 --- a/src/mesa/drivers/dri/r300/compiler/radeon_opcodes.c +++ b/src/mesa/drivers/dri/r300/compiler/radeon_opcodes.c @@ -94,6 +94,12 @@ struct rc_opcode_info rc_opcodes[MAX_RC_OPCODE] = { .HasDstReg = 1, .IsComponentwise = 1 }, + { + .Opcode = RC_OPCODE_DP2, + .Name = "DP2", + .NumSrcRegs = 2, + .HasDstReg = 1 + }, { .Opcode = RC_OPCODE_DP3, .Name = "DP3", @@ -442,6 +448,10 @@ void rc_compute_sources_for_writemask( case RC_OPCODE_ARL: srcmasks[0] |= RC_MASK_X; break; + case RC_OPCODE_DP2: + srcmasks[0] |= RC_MASK_XY; + srcmasks[1] |= RC_MASK_XY; + break; case RC_OPCODE_DP3: srcmasks[0] |= RC_MASK_XYZ; srcmasks[1] |= RC_MASK_XYZ; diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_opcodes.h b/src/mesa/drivers/dri/r300/compiler/radeon_opcodes.h index 0a9fceef38..d3f639c870 100644 --- a/src/mesa/drivers/dri/r300/compiler/radeon_opcodes.h +++ b/src/mesa/drivers/dri/r300/compiler/radeon_opcodes.h @@ -64,6 +64,9 @@ typedef enum { * dst.c = d src0.c / dy */ RC_OPCODE_DDY, + /** scalar instruction: dst = src0.x*src1.x + src0.y*src1.y */ + RC_OPCODE_DP2, + /** scalar instruction: dst = src0.x*src1.x + src0.y*src1.y + src0.z*src1.z */ RC_OPCODE_DP3, diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_program_alu.c b/src/mesa/drivers/dri/r300/compiler/radeon_program_alu.c index c988e0c67e..704a7bb2d2 100644 --- a/src/mesa/drivers/dri/r300/compiler/radeon_program_alu.c +++ b/src/mesa/drivers/dri/r300/compiler/radeon_program_alu.c @@ -216,18 +216,18 @@ static void transform_CEIL(struct radeon_compiler* c, rc_remove_instruction(inst); } -static void transform_DP3(struct radeon_compiler* c, +static void transform_DP2(struct radeon_compiler* c, struct rc_instruction* inst) { struct rc_src_register src0 = inst->U.I.SrcReg[0]; struct rc_src_register src1 = inst->U.I.SrcReg[1]; - src0.Negate &= ~RC_MASK_W; - src0.Swizzle &= ~(7 << (3 * 3)); - src0.Swizzle |= RC_SWIZZLE_ZERO << (3 * 3); - src1.Negate &= ~RC_MASK_W; - src1.Swizzle &= ~(7 << (3 * 3)); - src1.Swizzle |= RC_SWIZZLE_ZERO << (3 * 3); - emit2(c, inst->Prev, RC_OPCODE_DP4, inst->U.I.SaturateMode, inst->U.I.DstReg, src0, src1); + src0.Negate &= ~(RC_MASK_Z | RC_MASK_W); + src0.Swizzle &= ~(63 << (3 * 2)); + src0.Swizzle |= (RC_SWIZZLE_ZERO << (3 * 2)) | (RC_SWIZZLE_ZERO << (3 * 3)); + src1.Negate &= ~(RC_MASK_Z | RC_MASK_W); + src1.Swizzle &= ~(63 << (3 * 2)); + src1.Swizzle |= (RC_SWIZZLE_ZERO << (3 * 2)) | (RC_SWIZZLE_ZERO << (3 * 3)); + emit2(c, inst->Prev, RC_OPCODE_DP3, inst->U.I.SaturateMode, inst->U.I.DstReg, src0, src1); rc_remove_instruction(inst); } @@ -553,6 +553,7 @@ int radeonTransformALU( switch(inst->U.I.Opcode) { case RC_OPCODE_ABS: transform_ABS(c, inst); return 1; case RC_OPCODE_CEIL: transform_CEIL(c, inst); return 1; + case RC_OPCODE_DP2: transform_DP2(c, inst); return 1; case RC_OPCODE_DPH: transform_DPH(c, inst); return 1; case RC_OPCODE_DST: transform_DST(c, inst); return 1; case RC_OPCODE_FLR: transform_FLR(c, inst); return 1; @@ -615,6 +616,29 @@ static void transform_r300_vertex_CMP(struct radeon_compiler* c, rc_remove_instruction(inst); } +static void transform_r300_vertex_DP2(struct radeon_compiler* c, + struct rc_instruction* inst) +{ + struct rc_instruction *next_inst = inst->Next; + transform_DP2(c, inst); + next_inst->Prev->U.I.Opcode = RC_OPCODE_DP4; +} + +static void transform_r300_vertex_DP3(struct radeon_compiler* c, + struct rc_instruction* inst) +{ + struct rc_src_register src0 = inst->U.I.SrcReg[0]; + struct rc_src_register src1 = inst->U.I.SrcReg[1]; + src0.Negate &= ~RC_MASK_W; + src0.Swizzle &= ~(7 << (3 * 3)); + src0.Swizzle |= RC_SWIZZLE_ZERO << (3 * 3); + src1.Negate &= ~RC_MASK_W; + src1.Swizzle &= ~(7 << (3 * 3)); + src1.Swizzle |= RC_SWIZZLE_ZERO << (3 * 3); + emit2(c, inst->Prev, RC_OPCODE_DP4, inst->U.I.SaturateMode, inst->U.I.DstReg, src0, src1); + rc_remove_instruction(inst); +} + static void transform_r300_vertex_fix_LIT(struct radeon_compiler* c, struct rc_instruction* inst) { @@ -758,7 +782,8 @@ int r300_transform_vertex_alu( case RC_OPCODE_ABS: transform_r300_vertex_ABS(c, inst); return 1; case RC_OPCODE_CEIL: transform_CEIL(c, inst); return 1; case RC_OPCODE_CMP: transform_r300_vertex_CMP(c, inst); return 1; - case RC_OPCODE_DP3: transform_DP3(c, inst); return 1; + case RC_OPCODE_DP2: transform_r300_vertex_DP2(c, inst); return 1; + case RC_OPCODE_DP3: transform_r300_vertex_DP3(c, inst); return 1; case RC_OPCODE_DPH: transform_DPH(c, inst); return 1; case RC_OPCODE_FLR: transform_FLR(c, inst); return 1; case RC_OPCODE_LIT: transform_r300_vertex_fix_LIT(c, inst); return 1; -- cgit v1.2.3 From 83baa8a6c5541829003bbffe1d2b8cee5a0263fd Mon Sep 17 00:00:00 2001 From: Marek Olšák Date: Mon, 16 Aug 2010 01:53:30 +0200 Subject: st/mesa: remove output register reads inside shaders This is a GLSL2 regression fix. --- src/mesa/state_tracker/st_program.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src') diff --git a/src/mesa/state_tracker/st_program.c b/src/mesa/state_tracker/st_program.c index 91528c227b..8c2d8b6154 100644 --- a/src/mesa/state_tracker/st_program.c +++ b/src/mesa/state_tracker/st_program.c @@ -207,6 +207,9 @@ st_translate_vertex_program(struct st_context *st, enum pipe_error error; unsigned num_outputs; + _mesa_remove_output_reads(&stvp->Base.Base, PROGRAM_OUTPUT); + _mesa_remove_output_reads(&stvp->Base.Base, PROGRAM_VARYING); + ureg = ureg_create( TGSI_PROCESSOR_VERTEX ); if (ureg == NULL) { FREE(vpv); @@ -298,6 +301,8 @@ st_translate_fragment_program(struct st_context *st, ubyte fs_output_semantic_index[PIPE_MAX_SHADER_OUTPUTS]; uint fs_num_outputs = 0; + _mesa_remove_output_reads(&stfp->Base.Base, PROGRAM_OUTPUT); + /* * Convert Mesa program inputs to TGSI input register semantics. */ @@ -485,6 +490,9 @@ st_translate_geometry_program(struct st_context *st, GLuint maxSlot = 0; struct ureg_program *ureg; + _mesa_remove_output_reads(&stgp->Base.Base, PROGRAM_OUTPUT); + _mesa_remove_output_reads(&stgp->Base.Base, PROGRAM_VARYING); + ureg = ureg_create( TGSI_PROCESSOR_GEOMETRY ); if (ureg == NULL) { return; -- cgit v1.2.3 From b0e1565b5f24c3f624745890170cce0700e620ff Mon Sep 17 00:00:00 2001 From: nobled Date: Sun, 15 Aug 2010 02:50:04 +0000 Subject: r300g: Fix macro MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This fixes a potential bug if (has_hyperz) is false (it would still init the atom as if has_hyperz were true). Signed-off-by: Marek Olšák --- src/gallium/drivers/r300/r300_context.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_context.c b/src/gallium/drivers/r300/r300_context.c index e8b6c4f7af..23b654e0c8 100644 --- a/src/gallium/drivers/r300/r300_context.c +++ b/src/gallium/drivers/r300/r300_context.c @@ -158,12 +158,14 @@ void r300_flush_cb(void *data) } #define R300_INIT_ATOM(atomname, atomsize) \ + do { \ r300->atomname.name = #atomname; \ r300->atomname.state = NULL; \ r300->atomname.size = atomsize; \ r300->atomname.emit = r300_emit_##atomname; \ r300->atomname.dirty = FALSE; \ - insert_at_tail(&r300->atom_list, &r300->atomname); + insert_at_tail(&r300->atom_list, &r300->atomname); \ + } while (0) static void r300_setup_atoms(struct r300_context* r300) { -- cgit v1.2.3 From 1e2cd02eae9d27e48273f4a548dc51f4f838eb96 Mon Sep 17 00:00:00 2001 From: nobled Date: Sun, 15 Aug 2010 03:59:15 +0000 Subject: r300g: Fix leaks in failed context creation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This changes r300_destroy_context() so it can be called on a partially-initialized context, and uses it when r300_create_context() hits a fatal error. This makes sure r300_create_context() doesn't leak memory or neglect to call r300_update_num_contexts() when it fails. Signed-off-by: Marek Olšák --- src/gallium/drivers/r300/r300_context.c | 82 +++++++++++++++++++-------------- 1 file changed, 48 insertions(+), 34 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_context.c b/src/gallium/drivers/r300/r300_context.c index 23b654e0c8..25b39c566c 100644 --- a/src/gallium/drivers/r300/r300_context.c +++ b/src/gallium/drivers/r300/r300_context.c @@ -99,8 +99,10 @@ static void r300_destroy_context(struct pipe_context* context) struct r300_context* r300 = r300_context(context); struct r300_atom *atom; - util_blitter_destroy(r300->blitter); - draw_destroy(r300->draw); + if (r300->blitter) + util_blitter_destroy(r300->blitter); + if (r300->draw) + draw_destroy(r300->draw); /* Print stats, if enabled. */ if (SCREEN_DBG_ON(r300->screen, DBG_STATS)) { @@ -112,40 +114,48 @@ static void r300_destroy_context(struct pipe_context* context) } } - u_upload_destroy(r300->upload_vb); - u_upload_destroy(r300->upload_ib); + if (r300->upload_vb) + u_upload_destroy(r300->upload_vb); + if (r300->upload_ib) + u_upload_destroy(r300->upload_ib); - /* setup hyper-z mm */ - if (r300->rws->get_value(r300->rws, R300_CAN_HYPERZ)) + if (r300->zmask_mm) r300_hyperz_destroy_mm(r300); - translate_cache_destroy(r300->tran.translate_cache); + if (r300->tran.translate_cache) + translate_cache_destroy(r300->tran.translate_cache); + /* XXX: This function assumes r300->query_list was initialized */ r300_release_referenced_objects(r300); - r300->rws->cs_destroy(r300->cs); + if (r300->cs) + r300->rws->cs_destroy(r300->cs); + /* XXX: No way to tell if this was initialized or not? */ util_mempool_destroy(&r300->pool_transfers); r300_update_num_contexts(r300->screen, -1); - FREE(r300->aa_state.state); - FREE(r300->blend_color_state.state); - FREE(r300->clip_state.state); - FREE(r300->fb_state.state); - FREE(r300->gpu_flush.state); - FREE(r300->hyperz_state.state); - FREE(r300->invariant_state.state); - FREE(r300->rs_block_state.state); - FREE(r300->scissor_state.state); - FREE(r300->textures_state.state); - FREE(r300->vap_invariant_state.state); - FREE(r300->viewport_state.state); - FREE(r300->ztop_state.state); - FREE(r300->fs_constants.state); - FREE(r300->vs_constants.state); - if (!r300->screen->caps.has_tcl) { - FREE(r300->vertex_stream_state.state); + /* Free the structs allocated in r300_setup_atoms() */ + if (r300->aa_state.state) { + FREE(r300->aa_state.state); + FREE(r300->blend_color_state.state); + FREE(r300->clip_state.state); + FREE(r300->fb_state.state); + FREE(r300->gpu_flush.state); + FREE(r300->hyperz_state.state); + FREE(r300->invariant_state.state); + FREE(r300->rs_block_state.state); + FREE(r300->scissor_state.state); + FREE(r300->textures_state.state); + FREE(r300->vap_invariant_state.state); + FREE(r300->viewport_state.state); + FREE(r300->ztop_state.state); + FREE(r300->fs_constants.state); + FREE(r300->vs_constants.state); + if (r300->vertex_stream_state.state) { + FREE(r300->vertex_stream_state.state); + } } FREE(r300); } @@ -406,12 +416,16 @@ struct pipe_context* r300_create_context(struct pipe_screen* screen, r300->context.destroy = r300_destroy_context; - r300->cs = rws->cs_create(rws); + make_empty_list(&r300->query_list); util_mempool_create(&r300->pool_transfers, sizeof(struct pipe_transfer), 64, UTIL_MEMPOOL_SINGLETHREADED); + r300->cs = rws->cs_create(rws); + if (r300->cs == NULL) + goto fail; + if (!r300screen->caps.has_tcl) { /* Create a Draw. This is used for SW TCL. */ r300->draw = draw_create(&r300->context); @@ -426,8 +440,6 @@ struct pipe_context* r300_create_context(struct pipe_screen* screen, r300_setup_atoms(r300); - make_empty_list(&r300->query_list); - r300_init_blit_functions(r300); r300_init_flush_functions(r300); r300_init_query_functions(r300); @@ -435,6 +447,8 @@ struct pipe_context* r300_create_context(struct pipe_screen* screen, r300_init_resource_functions(r300); r300->blitter = util_blitter_create(&r300->context); + if (r300->blitter == NULL) + goto fail; /* Render functions must be initialized after blitter. */ r300_init_render_functions(r300); @@ -450,15 +464,17 @@ struct pipe_context* r300_create_context(struct pipe_screen* screen, PIPE_BIND_INDEX_BUFFER); if (r300->upload_ib == NULL) - goto no_upload_ib; + goto fail; r300->upload_vb = u_upload_create(&r300->context, 128 * 1024, 16, PIPE_BIND_VERTEX_BUFFER); if (r300->upload_vb == NULL) - goto no_upload_vb; + goto fail; r300->tran.translate_cache = translate_cache_create(); + if (r300->tran.translate_cache == NULL) + goto fail; r300_init_states(&r300->context); @@ -488,10 +504,8 @@ struct pipe_context* r300_create_context(struct pipe_screen* screen, return &r300->context; - no_upload_ib: - u_upload_destroy(r300->upload_ib); - no_upload_vb: - FREE(r300); + fail: + r300_destroy_context(&r300->context); return NULL; } -- cgit v1.2.3 From e897bf524beae417252a1bf1b6bbd354902a57d7 Mon Sep 17 00:00:00 2001 From: nobled Date: Sun, 15 Aug 2010 03:53:18 +0000 Subject: r300g: Let hyperz init fail MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Marek Olšák --- src/gallium/drivers/r300/r300_context.c | 3 ++- src/gallium/drivers/r300/r300_hyperz.c | 21 +++++++++++++++++---- src/gallium/drivers/r300/r300_hyperz.h | 2 +- 3 files changed, 20 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_context.c b/src/gallium/drivers/r300/r300_context.c index 25b39c566c..d783f21f5f 100644 --- a/src/gallium/drivers/r300/r300_context.c +++ b/src/gallium/drivers/r300/r300_context.c @@ -457,7 +457,8 @@ struct pipe_context* r300_create_context(struct pipe_screen* screen, /* setup hyper-z mm */ if (r300->rws->get_value(r300->rws, R300_CAN_HYPERZ)) - r300_hyperz_init_mm(r300); + if (!r300_hyperz_init_mm(r300)) + goto fail; r300->upload_ib = u_upload_create(&r300->context, 32 * 1024, 16, diff --git a/src/gallium/drivers/r300/r300_hyperz.c b/src/gallium/drivers/r300/r300_hyperz.c index 811b5646e1..a471b7353b 100644 --- a/src/gallium/drivers/r300/r300_hyperz.c +++ b/src/gallium/drivers/r300/r300_hyperz.c @@ -373,23 +373,36 @@ void r300_zmask_alloc_block(struct r300_context *r300, struct r300_surface *surf return; } -void r300_hyperz_init_mm(struct r300_context *r300) +boolean r300_hyperz_init_mm(struct r300_context *r300) { struct r300_screen* r300screen = r300->screen; int frag_pipes = r300screen->caps.num_frag_pipes; - if (r300screen->caps.hiz_ram) + r300->zmask_mm = u_mmInit(0, r300screen->caps.zmask_ram * frag_pipes); + if (!r300->zmask_mm) + return FALSE; + + if (r300screen->caps.hiz_ram) { r300->hiz_mm = u_mmInit(0, r300screen->caps.hiz_ram * frag_pipes); + if (!r300->hiz_mm) { + u_mmDestroy(r300->zmask_mm); + r300->zmask_mm = NULL; + return FALSE; + } + } - r300->zmask_mm = u_mmInit(0, r300screen->caps.zmask_ram * frag_pipes); + return TRUE; } void r300_hyperz_destroy_mm(struct r300_context *r300) { struct r300_screen* r300screen = r300->screen; - if (r300screen->caps.hiz_ram) + if (r300screen->caps.hiz_ram) { u_mmDestroy(r300->hiz_mm); + r300->hiz_mm = NULL; + } u_mmDestroy(r300->zmask_mm); + r300->zmask_mm = NULL; } diff --git a/src/gallium/drivers/r300/r300_hyperz.h b/src/gallium/drivers/r300/r300_hyperz.h index 09e1ff6625..30a23ec649 100644 --- a/src/gallium/drivers/r300/r300_hyperz.h +++ b/src/gallium/drivers/r300/r300_hyperz.h @@ -30,6 +30,6 @@ void r300_update_hyperz_state(struct r300_context* r300); void r300_hiz_alloc_block(struct r300_context *r300, struct r300_surface *surf); void r300_zmask_alloc_block(struct r300_context *r300, struct r300_surface *surf, int compress); -void r300_hyperz_init_mm(struct r300_context *r300); +boolean r300_hyperz_init_mm(struct r300_context *r300); void r300_hyperz_destroy_mm(struct r300_context *r300); #endif -- cgit v1.2.3 From ecae1fca6f93eafb1916aa8621be04edd9228041 Mon Sep 17 00:00:00 2001 From: Marek Olšák Date: Mon, 16 Aug 2010 05:05:43 +0200 Subject: r300g: fix an invalid pointer in free --- src/gallium/drivers/r300/r300_context.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_context.c b/src/gallium/drivers/r300/r300_context.c index d783f21f5f..a83ad892ea 100644 --- a/src/gallium/drivers/r300/r300_context.c +++ b/src/gallium/drivers/r300/r300_context.c @@ -153,7 +153,7 @@ static void r300_destroy_context(struct pipe_context* context) FREE(r300->ztop_state.state); FREE(r300->fs_constants.state); FREE(r300->vs_constants.state); - if (r300->vertex_stream_state.state) { + if (!r300->screen->caps.has_tcl) { FREE(r300->vertex_stream_state.state); } } -- cgit v1.2.3 From 43ba1f63c796923d2a85fd551b9065ee0c6e0eea Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Sun, 15 Aug 2010 21:10:16 -0700 Subject: glsl: Include missing headers in slang_builtin.c. Include slang_typeinfo.h for slang_type_specifier symbol. Include slang_compiler_struct.h for slang_struct_ symbol. --- src/mesa/slang/slang_builtin.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/slang/slang_builtin.c b/src/mesa/slang/slang_builtin.c index a7e0efcb7b..179571fab4 100644 --- a/src/mesa/slang/slang_builtin.c +++ b/src/mesa/slang/slang_builtin.c @@ -35,8 +35,10 @@ #include "program/prog_instruction.h" #include "program/prog_parameter.h" #include "program/prog_statevars.h" -#include "slang/slang_ir.h" #include "slang/slang_builtin.h" +#include "slang/slang_compile_struct.h" +#include "slang/slang_ir.h" +#include "slang/slang_typeinfo.h" /** special state token (see below) */ -- cgit v1.2.3 From 44ad729aa34f0cb343b3ed1d3e932231371d345f Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Sun, 15 Aug 2010 21:13:32 -0700 Subject: glsl: Include missing header in slang_link.c. Include slang_compile.h for _slang_compile function. --- src/mesa/slang/slang_link.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/mesa/slang/slang_link.c b/src/mesa/slang/slang_link.c index c21f67256a..28ad0b74e8 100644 --- a/src/mesa/slang/slang_link.c +++ b/src/mesa/slang/slang_link.c @@ -42,6 +42,7 @@ #include "program/prog_statevars.h" #include "program/prog_uniform.h" #include "slang_builtin.h" +#include "slang_compile.h" #include "slang_link.h" -- cgit v1.2.3 From 5d2d5bf0c7efff46050340f65dba30fd63806963 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Sun, 15 Aug 2010 21:17:50 -0700 Subject: glsl: Clean up header file inclusion in slang_ir.h. Remove imports.h and slang_compile.h. Include glheader.h for GL symbols. Include slang_compile_variable.h for slang_variable symbol. --- src/mesa/slang/slang_ir.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/mesa/slang/slang_ir.h b/src/mesa/slang/slang_ir.h index ce9a6c5a48..a010efcb34 100644 --- a/src/mesa/slang/slang_ir.h +++ b/src/mesa/slang/slang_ir.h @@ -33,11 +33,11 @@ #define SLANG_IR_H -#include "main/imports.h" -#include "slang_compile.h" -#include "slang_label.h" +#include "main/glheader.h" #include "main/mtypes.h" #include "program/prog_instruction.h" +#include "slang_compile_variable.h" +#include "slang_label.h" /** -- cgit v1.2.3 From 97590ebeb0800bd1cd41e2f8f64a4984208251c9 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Sun, 15 Aug 2010 22:07:04 -0700 Subject: glsl: Clean up header file inclusion in slang_mem.h. slang_mem.h Remove imports.h. Include glheader.h for GL symbols. slang_label.c Include imports.h now that slang_mem.c does not include it. --- src/mesa/slang/slang_label.c | 1 + src/mesa/slang/slang_mem.h | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/slang/slang_label.c b/src/mesa/slang/slang_label.c index 24881d5b6e..a161139800 100644 --- a/src/mesa/slang/slang_label.c +++ b/src/mesa/slang/slang_label.c @@ -7,6 +7,7 @@ */ +#include "main/imports.h" #include "main/mtypes.h" #include "program/prog_instruction.h" #include "slang_label.h" diff --git a/src/mesa/slang/slang_mem.h b/src/mesa/slang/slang_mem.h index b5bfae2479..0f06df3c0c 100644 --- a/src/mesa/slang/slang_mem.h +++ b/src/mesa/slang/slang_mem.h @@ -27,7 +27,7 @@ #define SLANG_MEM_H -#include "main/imports.h" +#include "main/glheader.h" typedef struct slang_mempool_ slang_mempool; -- cgit v1.2.3 From 35a27f6fce0d8632c764127bb88f4537ccb9e54f Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Sun, 15 Aug 2010 22:26:27 -0700 Subject: glsl: Clean up header file inclusion in slang_storage.h. Remove slang_compile.h. Include glheader.h for GL symbols. Include slang_compile_function.h for slang_function_scope symbol. Include slang_compile_struct.h for slang_struct_scope symbol. Include slang_compile_variable.h for slang_variable_scope symbol. Include slang_typeinfo.h for slang_type_specifier symbol. Include slang_utility.h for slang_atom_pool symbol. --- src/mesa/slang/slang_storage.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/slang/slang_storage.h b/src/mesa/slang/slang_storage.h index 1876a36dd6..de1f1841a3 100644 --- a/src/mesa/slang/slang_storage.h +++ b/src/mesa/slang/slang_storage.h @@ -25,7 +25,12 @@ #ifndef SLANG_STORAGE_H #define SLANG_STORAGE_H -#include "slang_compile.h" +#include "main/glheader.h" +#include "slang_compile_function.h" +#include "slang_compile_struct.h" +#include "slang_compile_variable.h" +#include "slang_typeinfo.h" +#include "slang_utility.h" /* -- cgit v1.2.3 From 640139f80ccbde71c137c6a1979fdb3e0e70ae0a Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Sun, 15 Aug 2010 22:38:23 -0700 Subject: glsl: Include missing header in slang_compile_operation.h. Include compiler.h for INLINE symbol. --- src/mesa/slang/slang_compile_operation.h | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/mesa/slang/slang_compile_operation.h b/src/mesa/slang/slang_compile_operation.h index b8c5f214cf..b32573e022 100644 --- a/src/mesa/slang/slang_compile_operation.h +++ b/src/mesa/slang/slang_compile_operation.h @@ -26,6 +26,7 @@ #define SLANG_COMPILE_OPERATION_H +#include "main/compiler.h" #include "main/glheader.h" #include "slang_compile_variable.h" #include "slang_utility.h" -- cgit v1.2.3 From 9965ee55717770ff8a7e25c43aa0fb8d16c6701a Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Sun, 15 Aug 2010 22:39:51 -0700 Subject: glsl: Include missing header in slang_codegen.h. Include slang_vartable.h for slang_var_table symbol. --- src/mesa/slang/slang_codegen.h | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/mesa/slang/slang_codegen.h b/src/mesa/slang/slang_codegen.h index ff0279bbfe..376a8cc264 100644 --- a/src/mesa/slang/slang_codegen.h +++ b/src/mesa/slang/slang_codegen.h @@ -32,6 +32,7 @@ #include "slang_compile_variable.h" #include "slang_typeinfo.h" #include "slang_utility.h" +#include "slang_vartable.h" struct slang_function_; -- cgit v1.2.3 From 15c7ce867caffead82b36421fd0c4d579dc0fa68 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Sun, 15 Aug 2010 22:44:29 -0700 Subject: glsl: Clean up header file inclusion in slang_typeinfo.h. Remove imports.h, mtypes.h, and slang_vartable.h. Include glheader.h for GL symbols. --- src/mesa/slang/slang_typeinfo.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'src') diff --git a/src/mesa/slang/slang_typeinfo.h b/src/mesa/slang/slang_typeinfo.h index 2251b06325..5ddfe9612c 100644 --- a/src/mesa/slang/slang_typeinfo.h +++ b/src/mesa/slang/slang_typeinfo.h @@ -25,11 +25,9 @@ #ifndef SLANG_TYPEINFO_H #define SLANG_TYPEINFO_H 1 -#include "main/imports.h" -#include "main/mtypes.h" +#include "main/glheader.h" #include "slang_log.h" #include "slang_utility.h" -#include "slang_vartable.h" struct slang_operation_; -- cgit v1.2.3 From 51f979c347a86dfe322f276d4931c89f1682a445 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Sun, 15 Aug 2010 23:10:42 -0700 Subject: x86: Remove unnecessary header from 3dnow.h. --- src/mesa/x86/3dnow.h | 2 -- 1 file changed, 2 deletions(-) (limited to 'src') diff --git a/src/mesa/x86/3dnow.h b/src/mesa/x86/3dnow.h index df9f2638d7..1c1fedcd4f 100644 --- a/src/mesa/x86/3dnow.h +++ b/src/mesa/x86/3dnow.h @@ -31,8 +31,6 @@ #ifndef __3DNOW_H__ #define __3DNOW_H__ -#include "math/m_xform.h" - void _mesa_init_3dnow_transform_asm( void ); #endif -- cgit v1.2.3 From 2144f8e95e67cb4743ce7eaf490c9983c888fea4 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Sun, 15 Aug 2010 23:29:09 -0700 Subject: x86: Include missing headers in mmx.h. Include compiler.h for _ASMAPI symbol. Include mtypes.h for GLcontext symbol. --- src/mesa/x86/mmx.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src') diff --git a/src/mesa/x86/mmx.h b/src/mesa/x86/mmx.h index 5641936bdb..47a0d4b54d 100644 --- a/src/mesa/x86/mmx.h +++ b/src/mesa/x86/mmx.h @@ -26,6 +26,9 @@ #ifndef ASM_MMX_H #define ASM_MMX_H +#include "main/compiler.h" +#include "main/mtypes.h" + extern void _ASMAPI _mesa_mmx_blend_transparency( GLcontext *ctx, GLuint n, const GLubyte mask[], GLvoid *rgba, const GLvoid *dest, -- cgit v1.2.3 From 3261c6c41edeed31fb6f667a7ba21b225b12323a Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Mon, 16 Aug 2010 00:26:10 -0700 Subject: x86: Remove unnecessary header from sse.h. --- src/mesa/x86/sse.h | 2 -- 1 file changed, 2 deletions(-) (limited to 'src') diff --git a/src/mesa/x86/sse.h b/src/mesa/x86/sse.h index 521f91e411..e92ddc1394 100644 --- a/src/mesa/x86/sse.h +++ b/src/mesa/x86/sse.h @@ -31,8 +31,6 @@ #ifndef __SSE_H__ #define __SSE_H__ -#include "math/m_xform.h" - void _mesa_init_sse_transform_asm( void ); #endif -- cgit v1.2.3 From 234a06517185efd972ec162bf9536183c5bc04c3 Mon Sep 17 00:00:00 2001 From: nobled Date: Mon, 12 Jul 2010 21:22:08 -0400 Subject: dri/radeon: test for FEATURE defines 'struct dd_function_table' only conditionally contains the function pointer NewFramebuffer and friends based on FEATURE_EXT_framebuffer_* defines. (See src/mesa/main/dd.h) Fixes the build when the features are disabled and the vfuncs don't exist. --- src/mesa/drivers/dri/radeon/radeon_fbo.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src') diff --git a/src/mesa/drivers/dri/radeon/radeon_fbo.c b/src/mesa/drivers/dri/radeon/radeon_fbo.c index 517485091a..0597d4250d 100644 --- a/src/mesa/drivers/dri/radeon/radeon_fbo.c +++ b/src/mesa/drivers/dri/radeon/radeon_fbo.c @@ -609,6 +609,7 @@ radeon_validate_framebuffer(GLcontext *ctx, struct gl_framebuffer *fb) void radeon_fbo_init(struct radeon_context *radeon) { +#if FEATURE_EXT_framebuffer_object radeon->glCtx->Driver.NewFramebuffer = radeon_new_framebuffer; radeon->glCtx->Driver.NewRenderbuffer = radeon_new_renderbuffer; radeon->glCtx->Driver.BindFramebuffer = radeon_bind_framebuffer; @@ -617,7 +618,10 @@ void radeon_fbo_init(struct radeon_context *radeon) radeon->glCtx->Driver.FinishRenderTexture = radeon_finish_render_texture; radeon->glCtx->Driver.ResizeBuffers = radeon_resize_buffers; radeon->glCtx->Driver.ValidateFramebuffer = radeon_validate_framebuffer; +#endif +#if FEATURE_EXT_framebuffer_blit radeon->glCtx->Driver.BlitFramebuffer = _mesa_meta_BlitFramebuffer; +#endif } -- cgit v1.2.3 From 70f9f5f7d4f1daadfcddc0fb0fea324c38353004 Mon Sep 17 00:00:00 2001 From: nobled Date: Mon, 12 Jul 2010 22:53:32 -0400 Subject: dri/nouveau: test for FEATURE defines 'struct dd_function_table' only conditionally contains the function pointer NewFramebuffer and friends based on FEATURE_EXT_framebuffer_* defines. (See src/mesa/main/dd.h) Fixes the build when the features are disabled and the vfuncs don't exist. --- src/mesa/drivers/dri/nouveau/nouveau_driver.c | 2 ++ src/mesa/drivers/dri/nouveau/nouveau_fbo.c | 2 ++ 2 files changed, 4 insertions(+) (limited to 'src') diff --git a/src/mesa/drivers/dri/nouveau/nouveau_driver.c b/src/mesa/drivers/dri/nouveau/nouveau_driver.c index 4ec864c181..6452fe218e 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_driver.c +++ b/src/mesa/drivers/dri/nouveau/nouveau_driver.c @@ -138,5 +138,7 @@ nouveau_driver_functions_init(struct dd_function_table *functions) functions->DrawPixels = _mesa_meta_DrawPixels; functions->CopyPixels = _mesa_meta_CopyPixels; functions->Bitmap = _mesa_meta_Bitmap; +#if FEATURE_EXT_framebuffer_blit functions->BlitFramebuffer = _mesa_meta_BlitFramebuffer; +#endif } diff --git a/src/mesa/drivers/dri/nouveau/nouveau_fbo.c b/src/mesa/drivers/dri/nouveau/nouveau_fbo.c index bd1273beea..32d8f2d0f9 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_fbo.c +++ b/src/mesa/drivers/dri/nouveau/nouveau_fbo.c @@ -262,10 +262,12 @@ nouveau_finish_render_texture(GLcontext *ctx, void nouveau_fbo_functions_init(struct dd_function_table *functions) { +#if FEATURE_EXT_framebuffer_object functions->NewFramebuffer = nouveau_framebuffer_new; functions->NewRenderbuffer = nouveau_renderbuffer_new; functions->BindFramebuffer = nouveau_bind_framebuffer; functions->FramebufferRenderbuffer = nouveau_framebuffer_renderbuffer; functions->RenderTexture = nouveau_render_texture; functions->FinishRenderTexture = nouveau_finish_render_texture; +#endif } -- cgit v1.2.3 From 9d4a0d7d4df3934cdefe4fe1118603e618d59831 Mon Sep 17 00:00:00 2001 From: nobled Date: Fri, 13 Aug 2010 20:23:11 +0000 Subject: st/mesa: test for FEATURE defines 'struct dd_function_table' only conditionally contains the function pointer NewFramebuffer and friends based on FEATURE_EXT_framebuffer_* defines. (See src/mesa/main/dd.h) Fixes the build when the features are disabled and the vfuncs don't exist. --- src/mesa/state_tracker/st_cb_fbo.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/mesa/state_tracker/st_cb_fbo.c b/src/mesa/state_tracker/st_cb_fbo.c index 13119ce203..86bb788903 100644 --- a/src/mesa/state_tracker/st_cb_fbo.c +++ b/src/mesa/state_tracker/st_cb_fbo.c @@ -543,6 +543,7 @@ st_ReadBuffer(GLcontext *ctx, GLenum buffer) void st_init_fbo_functions(struct dd_function_table *functions) { +#if FEATURE_EXT_framebuffer_object functions->NewFramebuffer = st_new_framebuffer; functions->NewRenderbuffer = st_new_renderbuffer; functions->BindFramebuffer = st_bind_framebuffer; @@ -550,6 +551,7 @@ void st_init_fbo_functions(struct dd_function_table *functions) functions->RenderTexture = st_render_texture; functions->FinishRenderTexture = st_finish_render_texture; functions->ValidateFramebuffer = st_validate_framebuffer; +#endif /* no longer needed by core Mesa, drivers handle resizes... functions->ResizeBuffers = st_resize_buffers; */ -- cgit v1.2.3 From f141abdc8fdbff41e16b0ce53fa3fa8fba32a7f9 Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Sun, 8 Aug 2010 01:13:26 +0800 Subject: draw: Add flags to draw_prim_info. A primitive may be splitted in frontends. The splitted primitives should convey certain flag bits so that the decomposer can correctly decide the stipple or edge flags. This commit adds flags to draw_prim_info and updates the decomposer to honor the flags. Frontends and middle ends will be updated later. --- src/gallium/auxiliary/draw/draw_decompose_tmp.h | 26 +++++++++++++--------- src/gallium/auxiliary/draw/draw_gs.c | 1 + src/gallium/auxiliary/draw/draw_gs_tmp.h | 1 + src/gallium/auxiliary/draw/draw_pipe.c | 4 ++++ src/gallium/auxiliary/draw/draw_private.h | 5 +++++ .../auxiliary/draw/draw_pt_fetch_shade_pipeline.c | 3 +++ .../draw/draw_pt_fetch_shade_pipeline_llvm.c | 3 +++ src/gallium/auxiliary/draw/draw_pt_vcache_tmp.h | 3 ++- src/gallium/auxiliary/draw/draw_so_emit_tmp.h | 1 + 9 files changed, 36 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/gallium/auxiliary/draw/draw_decompose_tmp.h b/src/gallium/auxiliary/draw/draw_decompose_tmp.h index a52d2b5058..be3a997c3d 100644 --- a/src/gallium/auxiliary/draw/draw_decompose_tmp.h +++ b/src/gallium/auxiliary/draw/draw_decompose_tmp.h @@ -54,10 +54,10 @@ FUNC(FUNC_VARS) FUNC_ENTER; - /* prim, count, and last_vertex_last should have been defined */ + /* prim, prim_flags, count, and last_vertex_last should have been defined */ if (0) { - debug_printf("%s: prim 0x%x, count %d, last_vertex_last %d\n", - __FUNCTION__, prim, count, last_vertex_last); + debug_printf("%s: prim 0x%x, prim_flags 0x%x, count %d, last_vertex_last %d\n", + __FUNCTION__, prim, prim_flags, count, last_vertex_last); } switch (prim) { @@ -80,7 +80,7 @@ FUNC(FUNC_VARS) case PIPE_PRIM_LINE_LOOP: case PIPE_PRIM_LINE_STRIP: if (count >= 2) { - flags = DRAW_PIPE_RESET_STIPPLE; + flags = (prim_flags & DRAW_SPLIT_BEFORE) ? 0 : DRAW_PIPE_RESET_STIPPLE; idx[1] = GET_ELT(0); idx[2] = idx[1]; @@ -90,7 +90,7 @@ FUNC(FUNC_VARS) LINE(flags, idx[0], idx[1]); } /* close the loop */ - if (prim == PIPE_PRIM_LINE_LOOP) + if (prim == PIPE_PRIM_LINE_LOOP && !prim_flags) LINE(flags, idx[1], idx[2]); } break; @@ -255,17 +255,23 @@ FUNC(FUNC_VARS) if (last_vertex_last) { flags = (DRAW_PIPE_RESET_STIPPLE | - DRAW_PIPE_EDGE_FLAG_2 | DRAW_PIPE_EDGE_FLAG_0); + if (!(prim_flags & DRAW_SPLIT_BEFORE)) + flags |= DRAW_PIPE_EDGE_FLAG_1; + edge_next = DRAW_PIPE_EDGE_FLAG_0; - edge_finish = DRAW_PIPE_EDGE_FLAG_1; + edge_finish = + (prim_flags & DRAW_SPLIT_AFTER) ? 0 : DRAW_PIPE_EDGE_FLAG_1; } else { flags = (DRAW_PIPE_RESET_STIPPLE | - DRAW_PIPE_EDGE_FLAG_0 | DRAW_PIPE_EDGE_FLAG_1); + if (!(prim_flags & DRAW_SPLIT_BEFORE)) + flags |= DRAW_PIPE_EDGE_FLAG_0; + edge_next = DRAW_PIPE_EDGE_FLAG_1; - edge_finish = DRAW_PIPE_EDGE_FLAG_2; + edge_finish = + (prim_flags & DRAW_SPLIT_AFTER) ? 0 : DRAW_PIPE_EDGE_FLAG_2; } idx[0] = GET_ELT(0); @@ -300,7 +306,7 @@ FUNC(FUNC_VARS) case PIPE_PRIM_LINE_STRIP_ADJACENCY: if (count >= 4) { - flags = DRAW_PIPE_RESET_STIPPLE; + flags = (prim_flags & DRAW_SPLIT_BEFORE) ? 0 : DRAW_PIPE_RESET_STIPPLE; idx[1] = GET_ELT(0); idx[2] = GET_ELT(1); idx[3] = GET_ELT(2); diff --git a/src/gallium/auxiliary/draw/draw_gs.c b/src/gallium/auxiliary/draw/draw_gs.c index 4a1013e79a..592f71bfbe 100644 --- a/src/gallium/auxiliary/draw/draw_gs.c +++ b/src/gallium/auxiliary/draw/draw_gs.c @@ -457,6 +457,7 @@ int draw_geometry_shader_run(struct draw_geometry_shader *shader, output_prims->start = 0; output_prims->count = shader->emitted_vertices; output_prims->prim = shader->output_primitive; + output_prims->flags = 0x0; output_prims->primitive_lengths = shader->primitive_lengths; output_prims->primitive_count = shader->emitted_primitives; output_verts->count = shader->emitted_vertices; diff --git a/src/gallium/auxiliary/draw/draw_gs_tmp.h b/src/gallium/auxiliary/draw/draw_gs_tmp.h index 4a17af0dea..7c8a9f9cfc 100644 --- a/src/gallium/auxiliary/draw/draw_gs_tmp.h +++ b/src/gallium/auxiliary/draw/draw_gs_tmp.h @@ -12,6 +12,7 @@ const boolean last_vertex_last = \ !(draw->rasterizer->flatshade && \ draw->rasterizer->flatshade_first); \ + const unsigned prim_flags = input_prims->flags; \ do { \ debug_assert(input_prims->primitive_count == 1); \ switch (prim) { \ diff --git a/src/gallium/auxiliary/draw/draw_pipe.c b/src/gallium/auxiliary/draw/draw_pipe.c index 58995e0724..6a9e4d5e90 100644 --- a/src/gallium/auxiliary/draw/draw_pipe.c +++ b/src/gallium/auxiliary/draw/draw_pipe.c @@ -207,6 +207,7 @@ static void do_triangle( struct draw_context *draw, #define FUNC_VARS \ struct draw_context *draw, \ unsigned prim, \ + unsigned prim_flags, \ struct vertex_header *vertices, \ unsigned stride, \ const ushort *elts, \ @@ -261,6 +262,7 @@ void draw_pipeline_run( struct draw_context *draw, pipe_run_elts(draw, prim_info->prim, + prim_info->flags, vert_info->verts, vert_info->stride, prim_info->elts + start, @@ -298,6 +300,7 @@ void draw_pipeline_run( struct draw_context *draw, #define FUNC_VARS \ struct draw_context *draw, \ unsigned prim, \ + unsigned prim_flags, \ struct vertex_header *vertices, \ unsigned stride, \ unsigned count @@ -330,6 +333,7 @@ void draw_pipeline_run_linear( struct draw_context *draw, pipe_run_linear(draw, prim_info->prim, + prim_info->flags, (struct vertex_header*)verts, vert_info->stride, count); diff --git a/src/gallium/auxiliary/draw/draw_private.h b/src/gallium/auxiliary/draw/draw_private.h index 397d4bf653..826f5dc98c 100644 --- a/src/gallium/auxiliary/draw/draw_private.h +++ b/src/gallium/auxiliary/draw/draw_private.h @@ -296,6 +296,10 @@ struct draw_vertex_info { unsigned count; }; +/* these flags are set if the primitive is a segment of a larger one */ +#define DRAW_SPLIT_BEFORE 0x1 +#define DRAW_SPLIT_AFTER 0x2 + struct draw_prim_info { boolean linear; unsigned start; @@ -304,6 +308,7 @@ struct draw_prim_info { unsigned count; unsigned prim; + unsigned flags; unsigned *primitive_lengths; unsigned primitive_count; }; diff --git a/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline.c b/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline.c index 5b16c3788e..92588cd7f8 100644 --- a/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline.c +++ b/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline.c @@ -311,6 +311,7 @@ static void fetch_pipeline_run( struct draw_pt_middle_end *middle, prim_info.count = draw_count; prim_info.elts = draw_elts; prim_info.prim = fpme->input_prim; + prim_info.flags = 0x0; prim_info.primitive_count = 1; prim_info.primitive_lengths = &draw_count; @@ -336,6 +337,7 @@ static void fetch_pipeline_linear_run( struct draw_pt_middle_end *middle, prim_info.count = count; prim_info.elts = NULL; prim_info.prim = fpme->input_prim; + prim_info.flags = 0x0; prim_info.primitive_count = 1; prim_info.primitive_lengths = &count; @@ -364,6 +366,7 @@ static boolean fetch_pipeline_linear_run_elts( struct draw_pt_middle_end *middle prim_info.count = draw_count; prim_info.elts = draw_elts; prim_info.prim = fpme->input_prim; + prim_info.flags = 0x0; prim_info.primitive_count = 1; prim_info.primitive_lengths = &draw_count; diff --git a/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline_llvm.c b/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline_llvm.c index 4b99bee86a..46701f11b5 100644 --- a/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline_llvm.c +++ b/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline_llvm.c @@ -310,6 +310,7 @@ static void llvm_middle_end_run( struct draw_pt_middle_end *middle, prim_info.count = draw_count; prim_info.elts = draw_elts; prim_info.prim = fpme->input_prim; + prim_info.flags = 0x0; prim_info.primitive_count = 1; prim_info.primitive_lengths = &draw_count; @@ -335,6 +336,7 @@ static void llvm_middle_end_linear_run( struct draw_pt_middle_end *middle, prim_info.count = count; prim_info.elts = NULL; prim_info.prim = fpme->input_prim; + prim_info.flags = 0x0; prim_info.primitive_count = 1; prim_info.primitive_lengths = &count; @@ -364,6 +366,7 @@ llvm_middle_end_linear_run_elts( struct draw_pt_middle_end *middle, prim_info.count = draw_count; prim_info.elts = draw_elts; prim_info.prim = fpme->input_prim; + prim_info.flags = 0x0; prim_info.primitive_count = 1; prim_info.primitive_lengths = &draw_count; diff --git a/src/gallium/auxiliary/draw/draw_pt_vcache_tmp.h b/src/gallium/auxiliary/draw/draw_pt_vcache_tmp.h index 1a3748d5f0..8a841e83f2 100644 --- a/src/gallium/auxiliary/draw/draw_pt_vcache_tmp.h +++ b/src/gallium/auxiliary/draw/draw_pt_vcache_tmp.h @@ -10,7 +10,8 @@ struct draw_context *draw = vcache->draw; \ const unsigned prim = vcache->input_prim; \ const boolean last_vertex_last = !(draw->rasterizer->flatshade && \ - draw->rasterizer->flatshade_first); + draw->rasterizer->flatshade_first); \ + const unsigned prim_flags = 0x0; #define GET_ELT(idx) (get_elt(elts, idx) + elt_bias) diff --git a/src/gallium/auxiliary/draw/draw_so_emit_tmp.h b/src/gallium/auxiliary/draw/draw_so_emit_tmp.h index 6d8937a0b4..1446e81bba 100644 --- a/src/gallium/auxiliary/draw/draw_so_emit_tmp.h +++ b/src/gallium/auxiliary/draw/draw_so_emit_tmp.h @@ -12,6 +12,7 @@ const boolean last_vertex_last = \ !(draw->rasterizer->flatshade && \ draw->rasterizer->flatshade_first); \ + const unsigned prim_flags = input_prims->flags; \ do { \ debug_assert(input_prims->primitive_count == 1); \ switch (prim) { \ -- cgit v1.2.3 From f132498347c41294042db0cc6830abe928d827de Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Sun, 8 Aug 2010 00:53:02 +0800 Subject: draw: Add prim flags to middle ends. Update the middle end interface to pass the primitive flags from the frontends to the pipeline. No frontend sets the flags yet. --- src/gallium/auxiliary/draw/draw_pt.h | 11 ++++++++--- src/gallium/auxiliary/draw/draw_pt_fetch_emit.c | 9 ++++++--- src/gallium/auxiliary/draw/draw_pt_fetch_shade_emit.c | 9 ++++++--- src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline.c | 15 +++++++++------ .../auxiliary/draw/draw_pt_fetch_shade_pipeline_llvm.c | 15 +++++++++------ src/gallium/auxiliary/draw/draw_pt_varray.c | 8 +++++--- src/gallium/auxiliary/draw/draw_pt_vcache.c | 5 +++-- 7 files changed, 46 insertions(+), 26 deletions(-) (limited to 'src') diff --git a/src/gallium/auxiliary/draw/draw_pt.h b/src/gallium/auxiliary/draw/draw_pt.h index 44356fba4c..8d69b8c8c8 100644 --- a/src/gallium/auxiliary/draw/draw_pt.h +++ b/src/gallium/auxiliary/draw/draw_pt.h @@ -80,6 +80,8 @@ struct draw_pt_front_end { /* The "middle end" - prepares actual hardware vertices for the * hardware backend. * + * prim_flags is as defined by pipe_draw_info::flags. + * * Currently two versions of this: * - fetch, vertex shade, cliptest, prim-pipeline * - fetch, emit (ie passthrough) @@ -94,11 +96,13 @@ struct draw_pt_middle_end { const unsigned *fetch_elts, unsigned fetch_count, const ushort *draw_elts, - unsigned draw_count ); + unsigned draw_count, + unsigned prim_flags ); void (*run_linear)(struct draw_pt_middle_end *, unsigned start, - unsigned count); + unsigned count, + unsigned prim_flags ); /* Transform all vertices in a linear range and then draw them with * the supplied element list. May fail and return FALSE. @@ -107,7 +111,8 @@ struct draw_pt_middle_end { unsigned fetch_start, unsigned fetch_count, const ushort *draw_elts, - unsigned draw_count ); + unsigned draw_count, + unsigned prim_flags ); int (*get_max_vertex_count)( struct draw_pt_middle_end * ); diff --git a/src/gallium/auxiliary/draw/draw_pt_fetch_emit.c b/src/gallium/auxiliary/draw/draw_pt_fetch_emit.c index 5c8af17c8e..d826e79dbf 100644 --- a/src/gallium/auxiliary/draw/draw_pt_fetch_emit.c +++ b/src/gallium/auxiliary/draw/draw_pt_fetch_emit.c @@ -210,7 +210,8 @@ static void fetch_emit_run( struct draw_pt_middle_end *middle, const unsigned *fetch_elts, unsigned fetch_count, const ushort *draw_elts, - unsigned draw_count ) + unsigned draw_count, + unsigned prim_flags ) { struct fetch_emit_middle_end *feme = (struct fetch_emit_middle_end *)middle; struct draw_context *draw = feme->draw; @@ -273,7 +274,8 @@ static void fetch_emit_run( struct draw_pt_middle_end *middle, static void fetch_emit_run_linear( struct draw_pt_middle_end *middle, unsigned start, - unsigned count ) + unsigned count, + unsigned prim_flags ) { struct fetch_emit_middle_end *feme = (struct fetch_emit_middle_end *)middle; struct draw_context *draw = feme->draw; @@ -334,7 +336,8 @@ static boolean fetch_emit_run_linear_elts( struct draw_pt_middle_end *middle, unsigned start, unsigned count, const ushort *draw_elts, - unsigned draw_count ) + unsigned draw_count, + unsigned prim_flags ) { struct fetch_emit_middle_end *feme = (struct fetch_emit_middle_end *)middle; struct draw_context *draw = feme->draw; diff --git a/src/gallium/auxiliary/draw/draw_pt_fetch_shade_emit.c b/src/gallium/auxiliary/draw/draw_pt_fetch_shade_emit.c index b8270280b6..c64104dda5 100644 --- a/src/gallium/auxiliary/draw/draw_pt_fetch_shade_emit.c +++ b/src/gallium/auxiliary/draw/draw_pt_fetch_shade_emit.c @@ -197,7 +197,8 @@ static void fse_prepare( struct draw_pt_middle_end *middle, static void fse_run_linear( struct draw_pt_middle_end *middle, unsigned start, - unsigned count ) + unsigned count, + unsigned prim_flags ) { struct fetch_shade_emit *fse = (struct fetch_shade_emit *)middle; struct draw_context *draw = fse->draw; @@ -265,7 +266,8 @@ fse_run(struct draw_pt_middle_end *middle, const unsigned *fetch_elts, unsigned fetch_count, const ushort *draw_elts, - unsigned draw_count ) + unsigned draw_count, + unsigned prim_flags ) { struct fetch_shade_emit *fse = (struct fetch_shade_emit *)middle; struct draw_context *draw = fse->draw; @@ -327,7 +329,8 @@ static boolean fse_run_linear_elts( struct draw_pt_middle_end *middle, unsigned start, unsigned count, const ushort *draw_elts, - unsigned draw_count ) + unsigned draw_count, + unsigned prim_flags ) { struct fetch_shade_emit *fse = (struct fetch_shade_emit *)middle; struct draw_context *draw = fse->draw; diff --git a/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline.c b/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline.c index 92588cd7f8..1ac20d27f3 100644 --- a/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline.c +++ b/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline.c @@ -295,7 +295,8 @@ static void fetch_pipeline_run( struct draw_pt_middle_end *middle, const unsigned *fetch_elts, unsigned fetch_count, const ushort *draw_elts, - unsigned draw_count ) + unsigned draw_count, + unsigned prim_flags ) { struct fetch_pipeline_middle_end *fpme = (struct fetch_pipeline_middle_end *)middle; struct draw_fetch_info fetch_info; @@ -311,7 +312,7 @@ static void fetch_pipeline_run( struct draw_pt_middle_end *middle, prim_info.count = draw_count; prim_info.elts = draw_elts; prim_info.prim = fpme->input_prim; - prim_info.flags = 0x0; + prim_info.flags = prim_flags; prim_info.primitive_count = 1; prim_info.primitive_lengths = &draw_count; @@ -321,7 +322,8 @@ static void fetch_pipeline_run( struct draw_pt_middle_end *middle, static void fetch_pipeline_linear_run( struct draw_pt_middle_end *middle, unsigned start, - unsigned count) + unsigned count, + unsigned prim_flags) { struct fetch_pipeline_middle_end *fpme = (struct fetch_pipeline_middle_end *)middle; struct draw_fetch_info fetch_info; @@ -337,7 +339,7 @@ static void fetch_pipeline_linear_run( struct draw_pt_middle_end *middle, prim_info.count = count; prim_info.elts = NULL; prim_info.prim = fpme->input_prim; - prim_info.flags = 0x0; + prim_info.flags = prim_flags; prim_info.primitive_count = 1; prim_info.primitive_lengths = &count; @@ -350,7 +352,8 @@ static boolean fetch_pipeline_linear_run_elts( struct draw_pt_middle_end *middle unsigned start, unsigned count, const ushort *draw_elts, - unsigned draw_count ) + unsigned draw_count, + unsigned prim_flags ) { struct fetch_pipeline_middle_end *fpme = (struct fetch_pipeline_middle_end *)middle; struct draw_fetch_info fetch_info; @@ -366,7 +369,7 @@ static boolean fetch_pipeline_linear_run_elts( struct draw_pt_middle_end *middle prim_info.count = draw_count; prim_info.elts = draw_elts; prim_info.prim = fpme->input_prim; - prim_info.flags = 0x0; + prim_info.flags = prim_flags; prim_info.primitive_count = 1; prim_info.primitive_lengths = &draw_count; diff --git a/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline_llvm.c b/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline_llvm.c index 46701f11b5..8f2847ffa0 100644 --- a/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline_llvm.c +++ b/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline_llvm.c @@ -294,7 +294,8 @@ static void llvm_middle_end_run( struct draw_pt_middle_end *middle, const unsigned *fetch_elts, unsigned fetch_count, const ushort *draw_elts, - unsigned draw_count ) + unsigned draw_count, + unsigned prim_flags ) { struct llvm_middle_end *fpme = (struct llvm_middle_end *)middle; struct draw_fetch_info fetch_info; @@ -310,7 +311,7 @@ static void llvm_middle_end_run( struct draw_pt_middle_end *middle, prim_info.count = draw_count; prim_info.elts = draw_elts; prim_info.prim = fpme->input_prim; - prim_info.flags = 0x0; + prim_info.flags = prim_flags; prim_info.primitive_count = 1; prim_info.primitive_lengths = &draw_count; @@ -320,7 +321,8 @@ static void llvm_middle_end_run( struct draw_pt_middle_end *middle, static void llvm_middle_end_linear_run( struct draw_pt_middle_end *middle, unsigned start, - unsigned count) + unsigned count, + unsigned prim_flags) { struct llvm_middle_end *fpme = (struct llvm_middle_end *)middle; struct draw_fetch_info fetch_info; @@ -336,7 +338,7 @@ static void llvm_middle_end_linear_run( struct draw_pt_middle_end *middle, prim_info.count = count; prim_info.elts = NULL; prim_info.prim = fpme->input_prim; - prim_info.flags = 0x0; + prim_info.flags = prim_flags; prim_info.primitive_count = 1; prim_info.primitive_lengths = &count; @@ -350,7 +352,8 @@ llvm_middle_end_linear_run_elts( struct draw_pt_middle_end *middle, unsigned start, unsigned count, const ushort *draw_elts, - unsigned draw_count ) + unsigned draw_count, + unsigned prim_flags ) { struct llvm_middle_end *fpme = (struct llvm_middle_end *)middle; struct draw_fetch_info fetch_info; @@ -366,7 +369,7 @@ llvm_middle_end_linear_run_elts( struct draw_pt_middle_end *middle, prim_info.count = draw_count; prim_info.elts = draw_elts; prim_info.prim = fpme->input_prim; - prim_info.flags = 0x0; + prim_info.flags = prim_flags; prim_info.primitive_count = 1; prim_info.primitive_lengths = &draw_count; diff --git a/src/gallium/auxiliary/draw/draw_pt_varray.c b/src/gallium/auxiliary/draw/draw_pt_varray.c index cd7bb7bf25..2cda4f018d 100644 --- a/src/gallium/auxiliary/draw/draw_pt_varray.c +++ b/src/gallium/auxiliary/draw/draw_pt_varray.c @@ -57,7 +57,7 @@ static void varray_flush_linear(struct varray_frontend *varray, { if (count) { assert(varray->middle->run_linear); - varray->middle->run_linear(varray->middle, start, count); + varray->middle->run_linear(varray->middle, start, count, 0x0); } } @@ -83,7 +83,8 @@ static void varray_line_loop_segment(struct varray_frontend *varray, varray->fetch_elts, nr, varray->draw_elts, /* ie. linear */ - nr); + nr, + 0x0); } } @@ -110,7 +111,8 @@ static void varray_fan_segment(struct varray_frontend *varray, varray->fetch_elts, nr, varray->draw_elts, /* ie. linear */ - nr); + nr, + 0x0); } } diff --git a/src/gallium/auxiliary/draw/draw_pt_vcache.c b/src/gallium/auxiliary/draw/draw_pt_vcache.c index a848b54f7d..0a9ec7ce6c 100644 --- a/src/gallium/auxiliary/draw/draw_pt_vcache.c +++ b/src/gallium/auxiliary/draw/draw_pt_vcache.c @@ -82,7 +82,8 @@ vcache_flush( struct vcache_frontend *vcache ) vcache->fetch_elts, vcache->fetch_count, vcache->draw_elts, - vcache->draw_count ); + vcache->draw_count, + 0x0 ); } memset(vcache->in, ~0, sizeof(vcache->in)); @@ -509,7 +510,7 @@ vcache_check_run( struct draw_pt_front_end *frontend, min_index + elt_bias, /* start */ fetch_count, transformed_elts, - draw_count ); + draw_count, 0x0 ); FREE(storage); -- cgit v1.2.3 From 9d2be38fad109d9a10942fddde0b9dc3824c329c Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Sun, 18 Jul 2010 16:53:57 +0800 Subject: draw: Simplify frontend interface a little. The run method is simplified to take the start vertex and the vertex count. --- src/gallium/auxiliary/draw/draw_pt.c | 6 +----- src/gallium/auxiliary/draw/draw_pt.h | 4 +--- src/gallium/auxiliary/draw/draw_pt_varray_tmp_linear.h | 7 +------ src/gallium/auxiliary/draw/draw_pt_vcache.c | 8 ++++---- src/gallium/auxiliary/draw/draw_pt_vcache_tmp.h | 7 ++++--- 5 files changed, 11 insertions(+), 21 deletions(-) (limited to 'src') diff --git a/src/gallium/auxiliary/draw/draw_pt.c b/src/gallium/auxiliary/draw/draw_pt.c index 248927505d..ded94bb575 100644 --- a/src/gallium/auxiliary/draw/draw_pt.c +++ b/src/gallium/auxiliary/draw/draw_pt.c @@ -126,11 +126,7 @@ draw_pt_arrays(struct draw_context *draw, frontend->prepare( frontend, prim, middle, opt ); - frontend->run(frontend, - draw_pt_elt_func(draw), - draw_pt_elt_ptr(draw, start), - draw->pt.user.eltBias, - count); + frontend->run(frontend, start, count); frontend->finish( frontend ); diff --git a/src/gallium/auxiliary/draw/draw_pt.h b/src/gallium/auxiliary/draw/draw_pt.h index 8d69b8c8c8..42c4f83272 100644 --- a/src/gallium/auxiliary/draw/draw_pt.h +++ b/src/gallium/auxiliary/draw/draw_pt.h @@ -67,9 +67,7 @@ struct draw_pt_front_end { unsigned opt ); void (*run)( struct draw_pt_front_end *, - pt_elt_func elt_func, - const void *elt_ptr, - int elt_bias, + unsigned start, unsigned count ); void (*finish)( struct draw_pt_front_end * ); diff --git a/src/gallium/auxiliary/draw/draw_pt_varray_tmp_linear.h b/src/gallium/auxiliary/draw/draw_pt_varray_tmp_linear.h index 55e43b2a71..fc54476488 100644 --- a/src/gallium/auxiliary/draw/draw_pt_varray_tmp_linear.h +++ b/src/gallium/auxiliary/draw/draw_pt_varray_tmp_linear.h @@ -9,19 +9,14 @@ static unsigned trim( unsigned count, unsigned first, unsigned incr ) } static void FUNC(struct draw_pt_front_end *frontend, - pt_elt_func get_elt, - const void *elts, - int elt_bias, + unsigned start, unsigned count) { struct varray_frontend *varray = (struct varray_frontend *)frontend; - unsigned start = (unsigned) ((char *) elts - (char *) NULL); unsigned j; unsigned first, incr; - assert(elt_bias == 0); - draw_pt_split_prim(varray->input_prim, &first, &incr); /* Sanitize primitive length: diff --git a/src/gallium/auxiliary/draw/draw_pt_vcache.c b/src/gallium/auxiliary/draw/draw_pt_vcache.c index 0a9ec7ce6c..993f388dc3 100644 --- a/src/gallium/auxiliary/draw/draw_pt_vcache.c +++ b/src/gallium/auxiliary/draw/draw_pt_vcache.c @@ -369,9 +369,7 @@ any_instance_divisors(const struct draw_context *draw) static INLINE void vcache_check_run( struct draw_pt_front_end *frontend, - pt_elt_func get_elt, - const void *elts, - int elt_bias, + unsigned draw_start, unsigned draw_count ) { struct vcache_frontend *vcache = (struct vcache_frontend *)frontend; @@ -379,10 +377,12 @@ vcache_check_run( struct draw_pt_front_end *frontend, const unsigned min_index = draw->pt.user.min_index; const unsigned max_index = draw->pt.user.max_index; const unsigned index_size = draw->pt.user.eltSize; + const int elt_bias = draw->pt.user.eltBias; unsigned fetch_count; const ushort *transformed_elts; ushort *storage = NULL; boolean ok = FALSE; + const void *elts = draw_pt_elt_ptr(draw, draw_start); /* debug: verify indexes are in range [min_index, max_index] */ if (0) { @@ -521,7 +521,7 @@ vcache_check_run( struct draw_pt_front_end *frontend, fetch_count, draw_count); fail: - vcache_run( frontend, get_elt, elts, elt_bias, draw_count ); + vcache_run( frontend, draw_start, draw_count ); } diff --git a/src/gallium/auxiliary/draw/draw_pt_vcache_tmp.h b/src/gallium/auxiliary/draw/draw_pt_vcache_tmp.h index 8a841e83f2..e80a9c7f15 100644 --- a/src/gallium/auxiliary/draw/draw_pt_vcache_tmp.h +++ b/src/gallium/auxiliary/draw/draw_pt_vcache_tmp.h @@ -1,14 +1,15 @@ #define FUNC_VARS \ struct draw_pt_front_end *frontend, \ - pt_elt_func get_elt, \ - const void *elts, \ - int elt_bias, \ + unsigned start, \ unsigned count #define LOCAL_VARS \ struct vcache_frontend *vcache = (struct vcache_frontend *) frontend; \ struct draw_context *draw = vcache->draw; \ const unsigned prim = vcache->input_prim; \ + const void *elts = draw_pt_elt_ptr(draw, start); \ + pt_elt_func get_elt = draw_pt_elt_func(draw); \ + const int elt_bias = draw->pt.user.eltBias; \ const boolean last_vertex_last = !(draw->rasterizer->flatshade && \ draw->rasterizer->flatshade_first); \ const unsigned prim_flags = 0x0; -- cgit v1.2.3 From 56213a64fe9e4270fd7886675b1e8224b2d88794 Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Sat, 7 Aug 2010 14:37:26 +0800 Subject: draw: Add new util function draw_pt_trim_count. draw_pt_trim_count is renamed from trim in draw_pt.c. --- src/gallium/auxiliary/draw/draw_pt.c | 11 +---------- src/gallium/auxiliary/draw/draw_pt.h | 1 + src/gallium/auxiliary/draw/draw_pt_util.c | 7 +++++++ 3 files changed, 9 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/gallium/auxiliary/draw/draw_pt.c b/src/gallium/auxiliary/draw/draw_pt.c index ded94bb575..2b400eda0f 100644 --- a/src/gallium/auxiliary/draw/draw_pt.c +++ b/src/gallium/auxiliary/draw/draw_pt.c @@ -47,15 +47,6 @@ DEBUG_GET_ONCE_BOOL_OPTION(draw_no_fse, "DRAW_NO_FSE", FALSE) DEBUG_GET_ONCE_BOOL_OPTION(draw_use_llvm, "DRAW_USE_LLVM", TRUE) #endif -static unsigned trim( unsigned count, unsigned first, unsigned incr ) -{ - if (count < first) - return 0; - return count - (count - first) % incr; -} - - - /* Overall we split things into: * - frontend -- prepare fetch_elts, draw_elts - eg vcache * - middle -- fetch, shade, cliptest, viewport @@ -77,7 +68,7 @@ draw_pt_arrays(struct draw_context *draw, { unsigned first, incr; draw_pt_split_prim(prim, &first, &incr); - count = trim(count, first, incr); + count = draw_pt_trim_count(count, first, incr); if (count < first) return TRUE; } diff --git a/src/gallium/auxiliary/draw/draw_pt.h b/src/gallium/auxiliary/draw/draw_pt.h index 42c4f83272..688b15c4fa 100644 --- a/src/gallium/auxiliary/draw/draw_pt.h +++ b/src/gallium/auxiliary/draw/draw_pt.h @@ -240,6 +240,7 @@ void draw_pt_post_vs_destroy( struct pt_post_vs *pvs ); * Utils: */ void draw_pt_split_prim(unsigned prim, unsigned *first, unsigned *incr); +unsigned draw_pt_trim_count(unsigned count, unsigned first, unsigned incr); #endif diff --git a/src/gallium/auxiliary/draw/draw_pt_util.c b/src/gallium/auxiliary/draw/draw_pt_util.c index 182a597cca..513bbbed21 100644 --- a/src/gallium/auxiliary/draw/draw_pt_util.c +++ b/src/gallium/auxiliary/draw/draw_pt_util.c @@ -92,3 +92,10 @@ void draw_pt_split_prim(unsigned prim, unsigned *first, unsigned *incr) break; } } + +unsigned draw_pt_trim_count(unsigned count, unsigned first, unsigned incr) +{ + if (count < first) + return 0; + return count - (count - first) % incr; +} -- cgit v1.2.3 From 04bc530dbdbe5d004219c9100e35f5d56cfedd80 Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Sat, 7 Aug 2010 03:36:18 +0800 Subject: draw: Add vsplit frontend. vsplit is based on varray. It sets the split flags when a primitive is splitted. It also has support for indexed primitives. For indexed primitives, unlike vcache, vsplit splits the primitives instead of decomposes them. --- src/gallium/auxiliary/Makefile | 1 + src/gallium/auxiliary/SConscript | 1 + src/gallium/auxiliary/draw/draw_pt.h | 14 +- src/gallium/auxiliary/draw/draw_pt_vsplit.c | 208 ++++++++++++++++ src/gallium/auxiliary/draw/draw_pt_vsplit_tmp.h | 301 ++++++++++++++++++++++++ src/gallium/auxiliary/draw/draw_split_tmp.h | 171 ++++++++++++++ 6 files changed, 695 insertions(+), 1 deletion(-) create mode 100644 src/gallium/auxiliary/draw/draw_pt_vsplit.c create mode 100644 src/gallium/auxiliary/draw/draw_pt_vsplit_tmp.h create mode 100644 src/gallium/auxiliary/draw/draw_split_tmp.h (limited to 'src') diff --git a/src/gallium/auxiliary/Makefile b/src/gallium/auxiliary/Makefile index 9544e90a96..ac3828c513 100644 --- a/src/gallium/auxiliary/Makefile +++ b/src/gallium/auxiliary/Makefile @@ -37,6 +37,7 @@ C_SOURCES = \ draw/draw_pt_util.c \ draw/draw_pt_varray.c \ draw/draw_pt_vcache.c \ + draw/draw_pt_vsplit.c \ draw/draw_vertex.c \ draw/draw_vs.c \ draw/draw_vs_varient.c \ diff --git a/src/gallium/auxiliary/SConscript b/src/gallium/auxiliary/SConscript index 3124e20ce8..89d1caf116 100644 --- a/src/gallium/auxiliary/SConscript +++ b/src/gallium/auxiliary/SConscript @@ -82,6 +82,7 @@ source = [ 'draw/draw_pt_util.c', 'draw/draw_pt_varray.c', 'draw/draw_pt_vcache.c', + 'draw/draw_pt_vsplit.c', 'draw/draw_vertex.c', 'draw/draw_vs.c', 'draw/draw_vs_aos.c', diff --git a/src/gallium/auxiliary/draw/draw_pt.h b/src/gallium/auxiliary/draw/draw_pt.h index 688b15c4fa..de3f638db5 100644 --- a/src/gallium/auxiliary/draw/draw_pt.h +++ b/src/gallium/auxiliary/draw/draw_pt.h @@ -52,8 +52,19 @@ struct draw_vertex_info; /* The "front end" - prepare sets of fetch, draw elements for the * middle end. * - * Currenly one version of this: + * The fetch elements are indices to the vertices. The draw elements are + * indices to the fetched vertices. When both arrays of elements are both + * linear, middle->run_linear is called; When only the fetch elements are + * linear, middle->run_linear_elts is called; Otherwise, middle->run is + * called. + * + * When the number of the draw elements exceeds max_vertex of the middle end, + * the draw elements (as well as the fetch elements) are splitted and the + * middle end is called multiple times. + * + * Currenly there are: * - vcache - catchall implementation, decomposes to TRI/LINE/POINT prims + * - vsplit - catchall implementation, splits big prims * Later: * - varray, varray_split * - velement, velement_split @@ -138,6 +149,7 @@ const void *draw_pt_elt_ptr( struct draw_context *draw, */ struct draw_pt_front_end *draw_pt_vcache( struct draw_context *draw ); struct draw_pt_front_end *draw_pt_varray(struct draw_context *draw); +struct draw_pt_front_end *draw_pt_vsplit(struct draw_context *draw); /* Middle-ends: diff --git a/src/gallium/auxiliary/draw/draw_pt_vsplit.c b/src/gallium/auxiliary/draw/draw_pt_vsplit.c new file mode 100644 index 0000000000..a687525309 --- /dev/null +++ b/src/gallium/auxiliary/draw/draw_pt_vsplit.c @@ -0,0 +1,208 @@ +/* + * Mesa 3-D graphics library + * Version: 7.9 + * + * Copyright 2007-2008 Tungsten Graphics, Inc., Cedar Park, Texas. + * Copyright (C) 2010 LunarG Inc. + * + * 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 + * 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 "util/u_math.h" +#include "util/u_memory.h" + +#include "draw/draw_context.h" +#include "draw/draw_private.h" +#include "draw/draw_pt.h" + +#define SEGMENT_SIZE 1024 +#define MAP_SIZE 256 + +struct vsplit_frontend { + struct draw_pt_front_end base; + struct draw_context *draw; + + unsigned prim; + + struct draw_pt_middle_end *middle; + + unsigned max_vertices; + ushort segment_size; + + /* buffers for splitting */ + unsigned fetch_elts[SEGMENT_SIZE]; + ushort draw_elts[SEGMENT_SIZE]; + ushort identity_draw_elts[SEGMENT_SIZE]; + + struct { + /* map a fetch element to a draw element */ + unsigned fetches[MAP_SIZE]; + ushort draws[MAP_SIZE]; + boolean has_max_fetch; + + ushort num_fetch_elts; + ushort num_draw_elts; + } cache; +}; + + +static void +vsplit_clear_cache(struct vsplit_frontend *vsplit) +{ + memset(vsplit->cache.fetches, 0xff, sizeof(vsplit->cache.fetches)); + vsplit->cache.has_max_fetch = FALSE; + vsplit->cache.num_fetch_elts = 0; + vsplit->cache.num_draw_elts = 0; +} + +static void +vsplit_flush_cache(struct vsplit_frontend *vsplit, unsigned flags) +{ + vsplit->middle->run(vsplit->middle, + vsplit->fetch_elts, vsplit->cache.num_fetch_elts, + vsplit->draw_elts, vsplit->cache.num_draw_elts, flags); +} + +/** + * Add a fetch element and add it to the draw elements. + */ +static INLINE void +vsplit_add_cache(struct vsplit_frontend *vsplit, unsigned fetch) +{ + unsigned hash = fetch % MAP_SIZE; + + if (vsplit->cache.fetches[hash] != fetch) { + /* update cache */ + vsplit->cache.fetches[hash] = fetch; + vsplit->cache.draws[hash] = vsplit->cache.num_fetch_elts; + + /* add fetch */ + assert(vsplit->cache.num_fetch_elts < vsplit->segment_size); + vsplit->fetch_elts[vsplit->cache.num_fetch_elts++] = fetch; + } + + vsplit->draw_elts[vsplit->cache.num_draw_elts++] = vsplit->cache.draws[hash]; +} + + +/** + * Add a fetch element and add it to the draw elements. The fetch element is + * in full range (uint). + */ +static INLINE void +vsplit_add_cache_uint(struct vsplit_frontend *vsplit, unsigned fetch) +{ + /* special care for 0xffffffff */ + if (fetch == 0xffffffff && !vsplit->cache.has_max_fetch) { + unsigned hash = fetch % MAP_SIZE; + vsplit->cache.fetches[hash] = fetch - 1; /* force update */ + vsplit->cache.has_max_fetch = TRUE; + } + + vsplit_add_cache(vsplit, fetch); +} + + +#define FUNC vsplit_run_linear +#include "draw_pt_vsplit_tmp.h" + +#define FUNC vsplit_run_ubyte +#define ELT_TYPE ubyte +#define ADD_CACHE(vsplit, fetch) vsplit_add_cache(vsplit, fetch) +#include "draw_pt_vsplit_tmp.h" + +#define FUNC vsplit_run_ushort +#define ELT_TYPE ushort +#define ADD_CACHE(vsplit, fetch) vsplit_add_cache(vsplit, fetch) +#include "draw_pt_vsplit_tmp.h" + +#define FUNC vsplit_run_uint +#define ELT_TYPE uint +#define ADD_CACHE(vsplit, fetch) vsplit_add_cache_uint(vsplit, fetch) +#include "draw_pt_vsplit_tmp.h" + + +static void vsplit_prepare(struct draw_pt_front_end *frontend, + unsigned in_prim, + struct draw_pt_middle_end *middle, + unsigned opt) +{ + struct vsplit_frontend *vsplit = (struct vsplit_frontend *) frontend; + + switch (vsplit->draw->pt.user.eltSize) { + case 0: + vsplit->base.run = vsplit_run_linear; + break; + case 1: + vsplit->base.run = vsplit_run_ubyte; + break; + case 2: + vsplit->base.run = vsplit_run_ushort; + break; + case 4: + vsplit->base.run = vsplit_run_uint; + break; + default: + assert(0); + break; + } + + /* split only */ + vsplit->prim = in_prim; + + vsplit->middle = middle; + middle->prepare(middle, vsplit->prim, opt, &vsplit->max_vertices); + + vsplit->segment_size = MIN2(SEGMENT_SIZE, vsplit->max_vertices); +} + + +static void vsplit_finish(struct draw_pt_front_end *frontend) +{ + struct vsplit_frontend *vsplit = (struct vsplit_frontend *) frontend; + vsplit->middle->finish(vsplit->middle); + vsplit->middle = NULL; +} + + +static void vsplit_destroy(struct draw_pt_front_end *frontend) +{ + FREE(frontend); +} + + +struct draw_pt_front_end *draw_pt_vsplit(struct draw_context *draw) +{ + struct vsplit_frontend *vsplit = CALLOC_STRUCT(vsplit_frontend); + ushort i; + + if (!vsplit) + return NULL; + + vsplit->base.prepare = vsplit_prepare; + vsplit->base.run = NULL; + vsplit->base.finish = vsplit_finish; + vsplit->base.destroy = vsplit_destroy; + vsplit->draw = draw; + + for (i = 0; i < SEGMENT_SIZE; i++) + vsplit->identity_draw_elts[i] = i; + + return &vsplit->base; +} diff --git a/src/gallium/auxiliary/draw/draw_pt_vsplit_tmp.h b/src/gallium/auxiliary/draw/draw_pt_vsplit_tmp.h new file mode 100644 index 0000000000..efeaa56711 --- /dev/null +++ b/src/gallium/auxiliary/draw/draw_pt_vsplit_tmp.h @@ -0,0 +1,301 @@ +/* + * Mesa 3-D graphics library + * Version: 7.9 + * + * Copyright 2007-2008 Tungsten Graphics, Inc., Cedar Park, Texas. + * Copyright (C) 2010 LunarG Inc. + * + * 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 + * 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. + */ + +#define CONCAT2(name, elt_type) name ## elt_type +#define CONCAT(name, elt_type) CONCAT2(name, elt_type) + +#ifdef ELT_TYPE + +/** + * Fetch all elements in [min_index, max_index] with bias, and use the + * (rebased) index buffer as the draw elements. + */ +static boolean +CONCAT(vsplit_segment_fast_, ELT_TYPE)(struct vsplit_frontend *vsplit, + unsigned flags, + unsigned istart, unsigned icount) +{ + struct draw_context *draw = vsplit->draw; + const ELT_TYPE *ib = (const ELT_TYPE *) draw->pt.user.elts; + const unsigned min_index = draw->pt.user.min_index; + const unsigned max_index = draw->pt.user.max_index; + const int elt_bias = draw->pt.user.eltBias; + unsigned fetch_start, fetch_count; + const ushort *draw_elts; + unsigned i; + + assert(icount <= vsplit->segment_size); + + /* this is faster only when we fetch less elements than the normal path */ + if (max_index - min_index > icount - 1) + return FALSE; + + if (elt_bias < 0 && min_index < -elt_bias) + return FALSE; + + /* why this check? */ + for (i = 0; i < draw->pt.nr_vertex_elements; i++) { + if (draw->pt.vertex_element[i].instance_divisor) + return FALSE; + } + + fetch_start = min_index + elt_bias; + fetch_count = max_index - min_index + 1; + + if (min_index == 0 && sizeof(ib[0]) == sizeof(draw_elts[0])) { + for (i = 0; i < icount; i++) { + ELT_TYPE idx = ib[istart + i]; + assert(idx >= min_index && idx <= max_index); + } + draw_elts = (const ushort *) ib; + } + else { + if (min_index == 0) { + for (i = 0; i < icount; i++) { + ELT_TYPE idx = ib[istart + i]; + + assert(idx >= min_index && idx <= max_index); + vsplit->draw_elts[i] = (ushort) idx; + } + } + else { + for (i = 0; i < icount; i++) { + ELT_TYPE idx = ib[istart + i]; + + assert(idx >= min_index && idx <= max_index); + vsplit->draw_elts[i] = (ushort) (idx - min_index); + } + } + + draw_elts = vsplit->draw_elts; + } + + return vsplit->middle->run_linear_elts(vsplit->middle, + fetch_start, fetch_count, + draw_elts, icount, flags); +} + +/** + * Use the cache to prepare the fetch and draw elements, and flush. + * + * When spoken is TRUE, ispoken replaces istart; When close is TRUE, iclose is + * appended. + */ +static INLINE void +CONCAT(vsplit_segment_cache_, ELT_TYPE)(struct vsplit_frontend *vsplit, + unsigned flags, + unsigned istart, unsigned icount, + boolean spoken, unsigned ispoken, + boolean close, unsigned iclose) +{ + struct draw_context *draw = vsplit->draw; + const ELT_TYPE *ib = (const ELT_TYPE *) draw->pt.user.elts; + const int ibias = draw->pt.user.eltBias; + unsigned i; + + assert(icount + !!close <= vsplit->segment_size); + + vsplit_clear_cache(vsplit); + + spoken = !!spoken; + if (ibias == 0) { + if (spoken) + ADD_CACHE(vsplit, ib[ispoken]); + + for (i = spoken; i < icount; i++) + ADD_CACHE(vsplit, ib[istart + i]); + + if (close) + ADD_CACHE(vsplit, ib[iclose]); + } + else if (ibias > 0) { + if (spoken) + ADD_CACHE(vsplit, (uint) ib[ispoken] + ibias); + + for (i = spoken; i < icount; i++) + ADD_CACHE(vsplit, (uint) ib[istart + i] + ibias); + + if (close) + ADD_CACHE(vsplit, (uint) ib[iclose] + ibias); + } + else { + if (spoken) { + if (ib[ispoken] < -ibias) + return; + ADD_CACHE(vsplit, ib[ispoken] + ibias); + } + + for (i = spoken; i < icount; i++) { + if (ib[istart + i] < -ibias) + return; + ADD_CACHE(vsplit, ib[istart + i] + ibias); + } + + if (close) { + if (ib[iclose] < -ibias) + return; + ADD_CACHE(vsplit, ib[iclose] + ibias); + } + } + + vsplit_flush_cache(vsplit, flags); +} + +static void +CONCAT(vsplit_segment_simple_, ELT_TYPE)(struct vsplit_frontend *vsplit, + unsigned flags, + unsigned istart, + unsigned icount) +{ + /* the primitive is not splitted */ + if (!(flags)) { + if (CONCAT(vsplit_segment_fast_, ELT_TYPE)(vsplit, + flags, istart, icount)) + return; + } + CONCAT(vsplit_segment_cache_, ELT_TYPE)(vsplit, + flags, istart, icount, FALSE, 0, FALSE, 0); +} + +static void +CONCAT(vsplit_segment_loop_, ELT_TYPE)(struct vsplit_frontend *vsplit, + unsigned flags, + unsigned istart, + unsigned icount, + unsigned i0) +{ + const boolean close_loop = ((flags) == DRAW_SPLIT_BEFORE); + + CONCAT(vsplit_segment_cache_, ELT_TYPE)(vsplit, + flags, istart, icount, FALSE, 0, close_loop, i0); +} + +static void +CONCAT(vsplit_segment_fan_, ELT_TYPE)(struct vsplit_frontend *vsplit, + unsigned flags, + unsigned istart, + unsigned icount, + unsigned i0) +{ + const boolean use_spoken = (((flags) & DRAW_SPLIT_BEFORE) != 0); + + CONCAT(vsplit_segment_cache_, ELT_TYPE)(vsplit, + flags, istart, icount, use_spoken, i0, FALSE, 0); +} + +#define LOCAL_VARS \ + struct vsplit_frontend *vsplit = (struct vsplit_frontend *) frontend; \ + const unsigned prim = vsplit->prim; \ + const unsigned max_count_simple = vsplit->segment_size; \ + const unsigned max_count_loop = vsplit->segment_size - 1; \ + const unsigned max_count_fan = vsplit->segment_size; + +#else /* ELT_TYPE */ + +static void +vsplit_segment_simple_linear(struct vsplit_frontend *vsplit, unsigned flags, + unsigned istart, unsigned icount) +{ + assert(icount <= vsplit->max_vertices); + vsplit->middle->run_linear(vsplit->middle, istart, icount, flags); +} + +static void +vsplit_segment_loop_linear(struct vsplit_frontend *vsplit, unsigned flags, + unsigned istart, unsigned icount, unsigned i0) +{ + boolean close_loop = (flags == DRAW_SPLIT_BEFORE); + unsigned nr; + + assert(icount + !!close_loop <= vsplit->segment_size); + + if (close_loop) { + for (nr = 0; nr < icount; nr++) + vsplit->fetch_elts[nr] = istart + nr; + vsplit->fetch_elts[nr++] = i0; + + vsplit->middle->run(vsplit->middle, vsplit->fetch_elts, nr, + vsplit->identity_draw_elts, nr, flags); + } + else { + vsplit->middle->run_linear(vsplit->middle, istart, icount, flags); + } +} + +static void +vsplit_segment_fan_linear(struct vsplit_frontend *vsplit, unsigned flags, + unsigned istart, unsigned icount, unsigned i0) +{ + boolean use_spoken = ((flags & DRAW_SPLIT_BEFORE) != 0); + unsigned nr = 0, i; + + assert(icount + !!use_spoken <= vsplit->segment_size); + + if (use_spoken) { + vsplit->fetch_elts[nr++] = i0; + for (i = 1 ; i < icount; i++) + vsplit->fetch_elts[nr++] = istart + i; + + vsplit->middle->run(vsplit->middle, vsplit->fetch_elts, nr, + vsplit->identity_draw_elts, nr, flags); + } + else { + vsplit->middle->run_linear(vsplit->middle, istart, icount, flags); + } +} + +#define LOCAL_VARS \ + struct vsplit_frontend *vsplit = (struct vsplit_frontend *) frontend; \ + const unsigned prim = vsplit->prim; \ + const unsigned max_count_simple = vsplit->max_vertices; \ + const unsigned max_count_loop = vsplit->segment_size - 1; \ + const unsigned max_count_fan = vsplit->segment_size; + +#define ELT_TYPE linear + +#endif /* ELT_TYPE */ + +#define FUNC_VARS \ + struct draw_pt_front_end *frontend, \ + unsigned start, \ + unsigned count + +#define SEGMENT_SIMPLE(flags, istart, icount) \ + CONCAT(vsplit_segment_simple_, ELT_TYPE)(vsplit, flags, istart, icount) + +#define SEGMENT_LOOP(flags, istart, icount, i0) \ + CONCAT(vsplit_segment_loop_, ELT_TYPE)(vsplit, flags, istart, icount, i0) + +#define SEGMENT_FAN(flags, istart, icount, i0) \ + CONCAT(vsplit_segment_fan_, ELT_TYPE)(vsplit, flags, istart, icount, i0) + +#include "draw_split_tmp.h" + +#undef CONCAT2 +#undef CONCAT + +#undef ELT_TYPE +#undef ADD_CACHE diff --git a/src/gallium/auxiliary/draw/draw_split_tmp.h b/src/gallium/auxiliary/draw/draw_split_tmp.h new file mode 100644 index 0000000000..40ab0b71f1 --- /dev/null +++ b/src/gallium/auxiliary/draw/draw_split_tmp.h @@ -0,0 +1,171 @@ +/* + * Mesa 3-D graphics library + * Version: 7.9 + * + * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas. + * Copyright (C) 2010 LunarG Inc. + * + * 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 + * 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. + */ + +static void +FUNC(FUNC_VARS) +{ + unsigned first, incr; + LOCAL_VARS + + /* + * prim, start, count, and max_count_{simple,loop,fan} should have been + * defined + */ + if (0) { + debug_printf("%s: prim 0x%x, start %d, count %d, max_count_simple %d, " + "max_count_loop %d, max_count_fan %d\n", + __FUNCTION__, prim, start, count, max_count_simple, + max_count_loop, max_count_fan); + } + + draw_pt_split_prim(prim, &first, &incr); + /* sanitize primitive length */ + count = draw_pt_trim_count(count, first, incr); + if (count < first) + return; + + /* must be able to at least flush two complete primitives */ + assert(max_count_simple >= first + incr && + max_count_loop >= first + incr && + max_count_fan >= first + incr); + + /* no splitting required */ + if (count <= max_count_simple) { + SEGMENT_SIMPLE(0x0, start, count); + } + else { + const unsigned rollback = first - incr; + unsigned flags = DRAW_SPLIT_AFTER, seg_start = 0, seg_max; + + /* + * Both count and seg_max below are explicitly trimmed. Because + * + * seg_start = N * (seg_max - rollback) = N' * incr, + * + * we have + * + * remaining = count - seg_start = first + N'' * incr. + * + * That is, remaining is implicitly trimmed. + */ + switch (prim) { + case PIPE_PRIM_POINTS: + case PIPE_PRIM_LINES: + case PIPE_PRIM_LINE_STRIP: + case PIPE_PRIM_TRIANGLES: + case PIPE_PRIM_TRIANGLE_STRIP: + case PIPE_PRIM_QUADS: + case PIPE_PRIM_QUAD_STRIP: + case PIPE_PRIM_LINES_ADJACENCY: + case PIPE_PRIM_LINE_STRIP_ADJACENCY: + case PIPE_PRIM_TRIANGLES_ADJACENCY: + case PIPE_PRIM_TRIANGLE_STRIP_ADJACENCY: + seg_max = + draw_pt_trim_count(MIN2(max_count_simple, count), first, incr); + if (prim == PIPE_PRIM_TRIANGLE_STRIP || + prim == PIPE_PRIM_TRIANGLE_STRIP_ADJACENCY) { + /* make sure we flush even number of triangles at a time */ + if (seg_max < count && !(((seg_max - first) / incr) & 1)) + seg_max -= incr; + } + + do { + const unsigned remaining = count - seg_start; + + if (remaining > seg_max) { + SEGMENT_SIMPLE(flags, start + seg_start, seg_max); + seg_start += seg_max - rollback; + + flags |= DRAW_SPLIT_BEFORE; + } + else { + flags &= ~DRAW_SPLIT_AFTER; + + SEGMENT_SIMPLE(flags, start + seg_start, remaining); + seg_start += remaining; + } + } while (seg_start < count); + break; + + case PIPE_PRIM_LINE_LOOP: + seg_max = + draw_pt_trim_count(MIN2(max_count_loop, count), first, incr); + + do { + const unsigned remaining = count - seg_start; + + if (remaining > seg_max) { + SEGMENT_LOOP(flags, start + seg_start, seg_max, start); + seg_start += seg_max - rollback; + + flags |= DRAW_SPLIT_BEFORE; + } + else { + flags &= ~DRAW_SPLIT_AFTER; + + SEGMENT_LOOP(flags, start + seg_start, remaining, start); + seg_start += remaining; + } + } while (seg_start < count); + break; + + case PIPE_PRIM_TRIANGLE_FAN: + case PIPE_PRIM_POLYGON: + seg_max = + draw_pt_trim_count(MIN2(max_count_fan, count), first, incr); + + do { + const unsigned remaining = count - seg_start; + + if (remaining > seg_max) { + SEGMENT_FAN(flags, start + seg_start, seg_max, start); + seg_start += seg_max - rollback; + + flags |= DRAW_SPLIT_BEFORE; + } + else { + flags &= ~DRAW_SPLIT_AFTER; + + SEGMENT_FAN(flags, start + seg_start, remaining, start); + seg_start += remaining; + } + } while (seg_start < count); + break; + + default: + assert(0); + break; + } + } +} + +#undef FUNC +#undef FUNC_VARS +#undef LOCAL_VARS + +#undef SEGMENT_SIMPLE +#undef SEGMENT_LOOP +#undef SEGMENT_FAN -- cgit v1.2.3 From 5b6bf799e637e9020af3a4bebe514b53d7c38eca Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Sat, 7 Aug 2010 15:12:14 +0800 Subject: draw: Replace varray by vsplit. vsplit is a superset of varray. It sets the split flags comparing to varray. --- src/gallium/auxiliary/draw/draw_private.h | 2 +- src/gallium/auxiliary/draw/draw_pt.c | 15 ++++++++------- 2 files changed, 9 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/gallium/auxiliary/draw/draw_private.h b/src/gallium/auxiliary/draw/draw_private.h index 826f5dc98c..18b632e3d9 100644 --- a/src/gallium/auxiliary/draw/draw_private.h +++ b/src/gallium/auxiliary/draw/draw_private.h @@ -141,7 +141,7 @@ struct draw_context struct { struct draw_pt_front_end *vcache; - struct draw_pt_front_end *varray; + struct draw_pt_front_end *vsplit; } front; struct pipe_vertex_buffer vertex_buffer[PIPE_MAX_ATTRIBS]; diff --git a/src/gallium/auxiliary/draw/draw_pt.c b/src/gallium/auxiliary/draw/draw_pt.c index 2b400eda0f..b6debbecf5 100644 --- a/src/gallium/auxiliary/draw/draw_pt.c +++ b/src/gallium/auxiliary/draw/draw_pt.c @@ -111,8 +111,9 @@ draw_pt_arrays(struct draw_context *draw, */ if (draw->pt.user.elts || (opt & PT_PIPELINE)) { frontend = draw->pt.front.vcache; - } else { - frontend = draw->pt.front.varray; + } + else { + frontend = draw->pt.front.vsplit; } frontend->prepare( frontend, prim, middle, opt ); @@ -134,8 +135,8 @@ boolean draw_pt_init( struct draw_context *draw ) if (!draw->pt.front.vcache) return FALSE; - draw->pt.front.varray = draw_pt_varray(draw); - if (!draw->pt.front.varray) + draw->pt.front.vsplit = draw_pt_vsplit(draw); + if (!draw->pt.front.vsplit) return FALSE; draw->pt.middle.fetch_emit = draw_pt_fetch_emit( draw ); @@ -186,9 +187,9 @@ void draw_pt_destroy( struct draw_context *draw ) draw->pt.front.vcache = NULL; } - if (draw->pt.front.varray) { - draw->pt.front.varray->destroy( draw->pt.front.varray ); - draw->pt.front.varray = NULL; + if (draw->pt.front.vsplit) { + draw->pt.front.vsplit->destroy( draw->pt.front.vsplit ); + draw->pt.front.vsplit = NULL; } } -- cgit v1.2.3 From 5a085c623faebf957be3fae2f82dc89ef6214585 Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Sat, 7 Aug 2010 20:44:02 +0800 Subject: draw: Replace vcache by vsplit. vcache decomposes primitives while vsplit splits primitives. Splitting is generally easier to do and is faster. More importantly, vcache depends on flatshade_first to decompose. The outputs may have incorrect vertex order which is significant to GS. --- src/gallium/auxiliary/draw/draw_pipe.c | 8 ++------ src/gallium/auxiliary/draw/draw_private.h | 1 - src/gallium/auxiliary/draw/draw_pt.c | 21 ++------------------- 3 files changed, 4 insertions(+), 26 deletions(-) (limited to 'src') diff --git a/src/gallium/auxiliary/draw/draw_pipe.c b/src/gallium/auxiliary/draw/draw_pipe.c index 6a9e4d5e90..43c25167a9 100644 --- a/src/gallium/auxiliary/draw/draw_pipe.c +++ b/src/gallium/auxiliary/draw/draw_pipe.c @@ -169,10 +169,6 @@ static void do_triangle( struct draw_context *draw, /* * Set up macros for draw_pt_decompose.h template code. * This code uses vertex indexes / elements. - * - * Flags are needed by the stipple and unfilled stages. When the two stages - * are active, vcache_run_extras is called and the flags are stored in the - * higher bits of i0. Otherwise, flags do not matter. */ #define TRIANGLE(flags,i0,i1,i2) \ @@ -180,7 +176,7 @@ static void do_triangle( struct draw_context *draw, assert(!((i1) & DRAW_PIPE_FLAG_MASK)); \ assert(!((i2) & DRAW_PIPE_FLAG_MASK)); \ do_triangle( draw, \ - i0, /* flags */ \ + flags, \ verts + stride * (i0 & ~DRAW_PIPE_FLAG_MASK), \ verts + stride * (i1), \ verts + stride * (i2) ); \ @@ -190,7 +186,7 @@ static void do_triangle( struct draw_context *draw, do { \ assert(!((i1) & DRAW_PIPE_FLAG_MASK)); \ do_line( draw, \ - i0, /* flags */ \ + flags, \ verts + stride * (i0 & ~DRAW_PIPE_FLAG_MASK), \ verts + stride * (i1) ); \ } while (0) diff --git a/src/gallium/auxiliary/draw/draw_private.h b/src/gallium/auxiliary/draw/draw_private.h index 18b632e3d9..94b688f891 100644 --- a/src/gallium/auxiliary/draw/draw_private.h +++ b/src/gallium/auxiliary/draw/draw_private.h @@ -140,7 +140,6 @@ struct draw_context } middle; struct { - struct draw_pt_front_end *vcache; struct draw_pt_front_end *vsplit; } front; diff --git a/src/gallium/auxiliary/draw/draw_pt.c b/src/gallium/auxiliary/draw/draw_pt.c index b6debbecf5..b80fc8f552 100644 --- a/src/gallium/auxiliary/draw/draw_pt.c +++ b/src/gallium/auxiliary/draw/draw_pt.c @@ -48,7 +48,7 @@ DEBUG_GET_ONCE_BOOL_OPTION(draw_use_llvm, "DRAW_USE_LLVM", TRUE) #endif /* Overall we split things into: - * - frontend -- prepare fetch_elts, draw_elts - eg vcache + * - frontend -- prepare fetch_elts, draw_elts - eg vsplit * - middle -- fetch, shade, cliptest, viewport * - pipeline -- the prim pipeline: clipping, wide lines, etc * - backend -- the vbuf_render provided by the driver. @@ -106,15 +106,7 @@ draw_pt_arrays(struct draw_context *draw, middle = draw->pt.middle.general; } - - /* Pick the right frontend - */ - if (draw->pt.user.elts || (opt & PT_PIPELINE)) { - frontend = draw->pt.front.vcache; - } - else { - frontend = draw->pt.front.vsplit; - } + frontend = draw->pt.front.vsplit; frontend->prepare( frontend, prim, middle, opt ); @@ -131,10 +123,6 @@ boolean draw_pt_init( struct draw_context *draw ) draw->pt.test_fse = debug_get_option_draw_fse(); draw->pt.no_fse = debug_get_option_draw_no_fse(); - draw->pt.front.vcache = draw_pt_vcache( draw ); - if (!draw->pt.front.vcache) - return FALSE; - draw->pt.front.vsplit = draw_pt_vsplit(draw); if (!draw->pt.front.vsplit) return FALSE; @@ -182,11 +170,6 @@ void draw_pt_destroy( struct draw_context *draw ) draw->pt.middle.fetch_shade_emit = NULL; } - if (draw->pt.front.vcache) { - draw->pt.front.vcache->destroy( draw->pt.front.vcache ); - draw->pt.front.vcache = NULL; - } - if (draw->pt.front.vsplit) { draw->pt.front.vsplit->destroy( draw->pt.front.vsplit ); draw->pt.front.vsplit = NULL; -- cgit v1.2.3 From a97419a3ba86fd112a22b5786c4f34f8d8a54f2d Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Sat, 7 Aug 2010 15:18:24 +0800 Subject: draw: Remove varray and vcache. They have been deprecated by vsplit. --- src/gallium/auxiliary/Makefile | 3 - src/gallium/auxiliary/SConscript | 3 - src/gallium/auxiliary/draw/draw_pt.h | 21 +- src/gallium/auxiliary/draw/draw_pt_elts.c | 89 --- src/gallium/auxiliary/draw/draw_pt_varray.c | 202 ------- src/gallium/auxiliary/draw/draw_pt_varray_tmp.h | 238 -------- .../auxiliary/draw/draw_pt_varray_tmp_linear.h | 98 ---- src/gallium/auxiliary/draw/draw_pt_vcache.c | 611 --------------------- src/gallium/auxiliary/draw/draw_pt_vcache_tmp.h | 21 - 9 files changed, 2 insertions(+), 1284 deletions(-) delete mode 100644 src/gallium/auxiliary/draw/draw_pt_elts.c delete mode 100644 src/gallium/auxiliary/draw/draw_pt_varray.c delete mode 100644 src/gallium/auxiliary/draw/draw_pt_varray_tmp.h delete mode 100644 src/gallium/auxiliary/draw/draw_pt_varray_tmp_linear.h delete mode 100644 src/gallium/auxiliary/draw/draw_pt_vcache.c delete mode 100644 src/gallium/auxiliary/draw/draw_pt_vcache_tmp.h (limited to 'src') diff --git a/src/gallium/auxiliary/Makefile b/src/gallium/auxiliary/Makefile index ac3828c513..eb2a40cbaa 100644 --- a/src/gallium/auxiliary/Makefile +++ b/src/gallium/auxiliary/Makefile @@ -26,7 +26,6 @@ C_SOURCES = \ draw/draw_pipe_wide_line.c \ draw/draw_pipe_wide_point.c \ draw/draw_pt.c \ - draw/draw_pt_elts.c \ draw/draw_pt_emit.c \ draw/draw_pt_fetch.c \ draw/draw_pt_fetch_emit.c \ @@ -35,8 +34,6 @@ C_SOURCES = \ draw/draw_pt_post_vs.c \ draw/draw_pt_so_emit.c \ draw/draw_pt_util.c \ - draw/draw_pt_varray.c \ - draw/draw_pt_vcache.c \ draw/draw_pt_vsplit.c \ draw/draw_vertex.c \ draw/draw_vs.c \ diff --git a/src/gallium/auxiliary/SConscript b/src/gallium/auxiliary/SConscript index 89d1caf116..30e5d02c9b 100644 --- a/src/gallium/auxiliary/SConscript +++ b/src/gallium/auxiliary/SConscript @@ -71,7 +71,6 @@ source = [ 'draw/draw_pipe_wide_line.c', 'draw/draw_pipe_wide_point.c', 'draw/draw_pt.c', - 'draw/draw_pt_elts.c', 'draw/draw_pt_emit.c', 'draw/draw_pt_fetch.c', 'draw/draw_pt_fetch_emit.c', @@ -80,8 +79,6 @@ source = [ 'draw/draw_pt_post_vs.c', 'draw/draw_pt_so_emit.c', 'draw/draw_pt_util.c', - 'draw/draw_pt_varray.c', - 'draw/draw_pt_vcache.c', 'draw/draw_pt_vsplit.c', 'draw/draw_vertex.c', 'draw/draw_vs.c', diff --git a/src/gallium/auxiliary/draw/draw_pt.h b/src/gallium/auxiliary/draw/draw_pt.h index de3f638db5..0db5666529 100644 --- a/src/gallium/auxiliary/draw/draw_pt.h +++ b/src/gallium/auxiliary/draw/draw_pt.h @@ -35,8 +35,6 @@ #include "pipe/p_compiler.h" -typedef unsigned (*pt_elt_func)( const void *elts, unsigned idx ); - struct draw_pt_middle_end; struct draw_context; struct draw_prim_info; @@ -62,14 +60,8 @@ struct draw_vertex_info; * the draw elements (as well as the fetch elements) are splitted and the * middle end is called multiple times. * - * Currenly there are: - * - vcache - catchall implementation, decomposes to TRI/LINE/POINT prims + * Currenly there is: * - vsplit - catchall implementation, splits big prims - * Later: - * - varray, varray_split - * - velement, velement_split - * - * Currenly only using the vcache version. */ struct draw_pt_front_end { void (*prepare)( struct draw_pt_front_end *, @@ -136,19 +128,10 @@ struct vbuf_render; struct vertex_header; -/* Helper functions. - */ -pt_elt_func draw_pt_elt_func( struct draw_context *draw ); -const void *draw_pt_elt_ptr( struct draw_context *draw, - unsigned start ); - /* Frontends: * - * Currently only the general-purpose vcache implementation, could add - * a special case for tiny vertex buffers. + * Currently only the general-purpose vsplit implementation. */ -struct draw_pt_front_end *draw_pt_vcache( struct draw_context *draw ); -struct draw_pt_front_end *draw_pt_varray(struct draw_context *draw); struct draw_pt_front_end *draw_pt_vsplit(struct draw_context *draw); diff --git a/src/gallium/auxiliary/draw/draw_pt_elts.c b/src/gallium/auxiliary/draw/draw_pt_elts.c deleted file mode 100644 index 88f4d9f495..0000000000 --- a/src/gallium/auxiliary/draw/draw_pt_elts.c +++ /dev/null @@ -1,89 +0,0 @@ -/************************************************************************** - * - * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas. - * 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, 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 TUNGSTEN GRAPHICS AND/OR ITS 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. - * - **************************************************************************/ - - /* - * Authors: - * Keith Whitwell - */ - -#include "draw/draw_pt.h" -#include "draw/draw_private.h" - -/* Neat get_elt func that also works for varrays drawing by encoding - * the start value into a pointer. - */ - -static unsigned elt_uint( const void *elts, unsigned idx ) -{ - return *(((const uint *)elts) + idx); -} - -static unsigned elt_ushort( const void *elts, unsigned idx ) -{ - return *(((const ushort *)elts) + idx); -} - -static unsigned elt_ubyte( const void *elts, unsigned idx ) -{ - return *(((const ubyte *)elts) + idx); -} - -static unsigned elt_vert( const void *elts, unsigned idx ) -{ - /* unsigned index is packed in the pointer */ - return (unsigned)(uintptr_t)elts + idx; -} - -pt_elt_func draw_pt_elt_func( struct draw_context *draw ) -{ - switch (draw->pt.user.eltSize) { - case 0: return &elt_vert; - case 1: return &elt_ubyte; - case 2: return &elt_ushort; - case 4: return &elt_uint; - default: return NULL; - } -} - -const void *draw_pt_elt_ptr( struct draw_context *draw, - unsigned start ) -{ - const char *elts = draw->pt.user.elts; - - switch (draw->pt.user.eltSize) { - case 0: - return (const void *)(((const ubyte *)NULL) + start); - case 1: - return (const void *)(((const ubyte *)elts) + start); - case 2: - return (const void *)(((const ushort *)elts) + start); - case 4: - return (const void *)(((const uint *)elts) + start); - default: - return NULL; - } -} diff --git a/src/gallium/auxiliary/draw/draw_pt_varray.c b/src/gallium/auxiliary/draw/draw_pt_varray.c deleted file mode 100644 index 2cda4f018d..0000000000 --- a/src/gallium/auxiliary/draw/draw_pt_varray.c +++ /dev/null @@ -1,202 +0,0 @@ -/************************************************************************** - * - * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas. - * 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, 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 TUNGSTEN GRAPHICS AND/OR ITS 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. - * - **************************************************************************/ - -#include "util/u_math.h" -#include "util/u_memory.h" - -#include "draw/draw_context.h" -#include "draw/draw_private.h" -#include "draw/draw_pt.h" - -#define FETCH_MAX 256 -#define DRAW_MAX (FETCH_MAX+8) - -struct varray_frontend { - struct draw_pt_front_end base; - struct draw_context *draw; - - ushort draw_elts[DRAW_MAX]; - unsigned fetch_elts[FETCH_MAX]; - - unsigned driver_fetch_max; - unsigned fetch_max; - - struct draw_pt_middle_end *middle; - - unsigned input_prim; - unsigned output_prim; -}; - - -static void varray_flush_linear(struct varray_frontend *varray, - unsigned start, unsigned count) -{ - if (count) { - assert(varray->middle->run_linear); - varray->middle->run_linear(varray->middle, start, count, 0x0); - } -} - -static void varray_line_loop_segment(struct varray_frontend *varray, - unsigned start, - unsigned segment_start, - unsigned segment_count, - boolean end ) -{ - assert(segment_count < varray->fetch_max); - if (segment_count >= 1) { - unsigned nr = 0, i; - - for (i = 0; i < segment_count; i++) - varray->fetch_elts[nr++] = start + segment_start + i; - - if (end) - varray->fetch_elts[nr++] = start; - - assert(nr <= FETCH_MAX); - - varray->middle->run(varray->middle, - varray->fetch_elts, - nr, - varray->draw_elts, /* ie. linear */ - nr, - 0x0); - } -} - - - -static void varray_fan_segment(struct varray_frontend *varray, - unsigned start, - unsigned segment_start, - unsigned segment_count ) -{ - assert(segment_count < varray->fetch_max); - if (segment_count >= 2) { - unsigned nr = 0, i; - - if (segment_start != 0) - varray->fetch_elts[nr++] = start; - - for (i = 0 ; i < segment_count; i++) - varray->fetch_elts[nr++] = start + segment_start + i; - - assert(nr <= FETCH_MAX); - - varray->middle->run(varray->middle, - varray->fetch_elts, - nr, - varray->draw_elts, /* ie. linear */ - nr, - 0x0); - } -} - - - - -#define FUNC varray_run -#include "draw_pt_varray_tmp_linear.h" - -static unsigned decompose_prim[PIPE_PRIM_TRIANGLE_STRIP_ADJACENCY + 1] = { - PIPE_PRIM_POINTS, - PIPE_PRIM_LINES, - PIPE_PRIM_LINE_STRIP, /* decomposed LINELOOP */ - PIPE_PRIM_LINE_STRIP, - PIPE_PRIM_TRIANGLES, - PIPE_PRIM_TRIANGLE_STRIP, - PIPE_PRIM_TRIANGLE_FAN, - PIPE_PRIM_QUADS, - PIPE_PRIM_QUAD_STRIP, - PIPE_PRIM_POLYGON, - PIPE_PRIM_LINES_ADJACENCY, - PIPE_PRIM_LINE_STRIP_ADJACENCY, - PIPE_PRIM_TRIANGLES_ADJACENCY, - PIPE_PRIM_TRIANGLE_STRIP_ADJACENCY -}; - - - -static void varray_prepare(struct draw_pt_front_end *frontend, - unsigned in_prim, - struct draw_pt_middle_end *middle, - unsigned opt) -{ - struct varray_frontend *varray = (struct varray_frontend *)frontend; - - varray->base.run = varray_run; - - varray->input_prim = in_prim; - assert(in_prim < Elements(decompose_prim)); - varray->output_prim = decompose_prim[in_prim]; - - varray->middle = middle; - middle->prepare(middle, - varray->output_prim, - opt, &varray->driver_fetch_max ); - - /* check that the max is even */ - assert((varray->driver_fetch_max & 1) == 0); - - varray->fetch_max = MIN2(FETCH_MAX, varray->driver_fetch_max); -} - - - - -static void varray_finish(struct draw_pt_front_end *frontend) -{ - struct varray_frontend *varray = (struct varray_frontend *)frontend; - varray->middle->finish(varray->middle); - varray->middle = NULL; -} - -static void varray_destroy(struct draw_pt_front_end *frontend) -{ - FREE(frontend); -} - - -struct draw_pt_front_end *draw_pt_varray(struct draw_context *draw) -{ - ushort i; - struct varray_frontend *varray = CALLOC_STRUCT(varray_frontend); - if (varray == NULL) - return NULL; - - varray->base.prepare = varray_prepare; - varray->base.run = NULL; - varray->base.finish = varray_finish; - varray->base.destroy = varray_destroy; - varray->draw = draw; - - for (i = 0; i < DRAW_MAX; i++) { - varray->draw_elts[i] = i; - } - - return &varray->base; -} diff --git a/src/gallium/auxiliary/draw/draw_pt_varray_tmp.h b/src/gallium/auxiliary/draw/draw_pt_varray_tmp.h deleted file mode 100644 index 7c722457c3..0000000000 --- a/src/gallium/auxiliary/draw/draw_pt_varray_tmp.h +++ /dev/null @@ -1,238 +0,0 @@ - -static void FUNC(struct draw_pt_front_end *frontend, - pt_elt_func get_elt, - const void *elts, - unsigned count) -{ - struct varray_frontend *varray = (struct varray_frontend *)frontend; - struct draw_context *draw = varray->draw; - unsigned start = (unsigned)elts; - - boolean flatfirst = (draw->rasterizer->flatshade && - draw->rasterizer->flatshade_first); - unsigned i, j; - ushort flags; - unsigned first, incr; - - varray->fetch_start = start; - - draw_pt_split_prim(varray->input_prim, &first, &incr); - -#if 0 - debug_printf("%s (%d) %d/%d\n", __FUNCTION__, - varray->input_prim, - start, count); -#endif - - switch (varray->input_prim) { - case PIPE_PRIM_POINTS: - for (j = 0; j + first <= count; j += i) { - unsigned end = MIN2(FETCH_MAX, count - j); - end -= (end % incr); - for (i = 0; i < end; i++) { - POINT(varray, i + 0); - } - i = end; - fetch_init(varray, end); - varray_flush(varray); - } - break; - - case PIPE_PRIM_LINES: - for (j = 0; j + first <= count; j += i) { - unsigned end = MIN2(FETCH_MAX, count - j); - end -= (end % incr); - for (i = 0; i+1 < end; i += 2) { - LINE(varray, DRAW_PIPE_RESET_STIPPLE, - i + 0, i + 1); - } - i = end; - fetch_init(varray, end); - varray_flush(varray); - } - break; - - case PIPE_PRIM_LINE_LOOP: - if (count >= 2) { - flags = DRAW_PIPE_RESET_STIPPLE; - - for (j = 0; j + first <= count; j += i) { - unsigned end = MIN2(FETCH_MAX, count - j); - end -= (end % incr); - for (i = 1; i < end; i++, flags = 0) { - LINE(varray, flags, i - 1, i); - } - LINE(varray, flags, i - 1, 0); - i = end; - fetch_init(varray, end); - varray_flush(varray); - } - } - break; - - case PIPE_PRIM_LINE_STRIP: - flags = DRAW_PIPE_RESET_STIPPLE; - for (j = 0; j + first <= count; j += i) { - unsigned end = MIN2(FETCH_MAX, count - j); - end -= (end % incr); - for (i = 1; i < end; i++, flags = 0) { - LINE(varray, flags, i - 1, i); - } - i = end; - fetch_init(varray, end); - varray_flush(varray); - } - break; - - case PIPE_PRIM_TRIANGLES: - for (j = 0; j + first <= count; j += i) { - unsigned end = MIN2(FETCH_MAX, count - j); - end -= (end % incr); - for (i = 0; i+2 < end; i += 3) { - TRIANGLE(varray, DRAW_PIPE_RESET_STIPPLE | DRAW_PIPE_EDGE_FLAG_ALL, - i + 0, i + 1, i + 2); - } - i = end; - fetch_init(varray, end); - varray_flush(varray); - } - break; - - case PIPE_PRIM_TRIANGLE_STRIP: - if (flatfirst) { - for (j = 0; j + first <= count; j += i) { - unsigned end = MIN2(FETCH_MAX, count - j); - end -= (end % incr); - for (i = 0; i+2 < end; i++) { - TRIANGLE(varray, DRAW_PIPE_RESET_STIPPLE | DRAW_PIPE_EDGE_FLAG_ALL, - i + 0, i + 1 + (i&1), i + 2 - (i&1)); - } - i = end; - fetch_init(varray, end); - varray_flush(varray); - if (j + first + i <= count) { - varray->fetch_start -= 2; - i -= 2; - } - } - } - else { - for (j = 0; j + first <= count; j += i) { - unsigned end = MIN2(FETCH_MAX, count - j); - end -= (end % incr); - for (i = 0; i + 2 < end; i++) { - TRIANGLE(varray, DRAW_PIPE_RESET_STIPPLE | DRAW_PIPE_EDGE_FLAG_ALL, - i + 0 + (i&1), i + 1 - (i&1), i + 2); - } - i = end; - fetch_init(varray, end); - varray_flush(varray); - if (j + first + i <= count) { - varray->fetch_start -= 2; - i -= 2; - } - } - } - break; - - case PIPE_PRIM_TRIANGLE_FAN: - if (count >= 3) { - if (flatfirst) { - flags = DRAW_PIPE_RESET_STIPPLE | DRAW_PIPE_EDGE_FLAG_ALL; - for (j = 0; j + first <= count; j += i) { - unsigned end = MIN2(FETCH_MAX, count - j); - end -= (end % incr); - for (i = 0; i+2 < end; i++) { - TRIANGLE(varray, flags, i + 1, i + 2, 0); - } - i = end; - fetch_init(varray, end); - varray_flush(varray); - } - } - else { - flags = DRAW_PIPE_RESET_STIPPLE | DRAW_PIPE_EDGE_FLAG_ALL; - for (j = 0; j + first <= count; j += i) { - unsigned end = MIN2(FETCH_MAX, count - j); - end -= (end % incr); - for (i = 0; i+2 < end; i++) { - TRIANGLE(varray, flags, 0, i + 1, i + 2); - } - i = end; - fetch_init(varray, end); - varray_flush(varray); - } - } - } - break; - - case PIPE_PRIM_QUADS: - for (j = 0; j + first <= count; j += i) { - unsigned end = MIN2(FETCH_MAX, count - j); - end -= (end % incr); - for (i = 0; i+3 < end; i += 4) { - QUAD(varray, i + 0, i + 1, i + 2, i + 3); - } - i = end; - fetch_init(varray, end); - varray_flush(varray); - } - break; - - case PIPE_PRIM_QUAD_STRIP: - for (j = 0; j + first <= count; j += i) { - unsigned end = MIN2(FETCH_MAX, count - j); - end -= (end % incr); - for (i = 0; i+3 < end; i += 2) { - QUAD(varray, i + 2, i + 0, i + 1, i + 3); - } - i = end; - fetch_init(varray, end); - varray_flush(varray); - if (j + first + i <= count) { - varray->fetch_start -= 2; - i -= 2; - } - } - break; - - case PIPE_PRIM_POLYGON: - { - /* These bitflags look a little odd because we submit the - * vertices as (1,2,0) to satisfy flatshade requirements. - */ - const ushort edge_first = DRAW_PIPE_EDGE_FLAG_2; - const ushort edge_middle = DRAW_PIPE_EDGE_FLAG_0; - const ushort edge_last = DRAW_PIPE_EDGE_FLAG_1; - - flags = DRAW_PIPE_RESET_STIPPLE | edge_first | edge_middle; - for (j = 0; j + first <= count; j += i) { - unsigned end = MIN2(FETCH_MAX, count - j); - end -= (end % incr); - for (i = 0; i+2 < end; i++, flags = edge_middle) { - - if (i + 3 == count) - flags |= edge_last; - - TRIANGLE(varray, flags, i + 1, i + 2, 0); - } - i = end; - fetch_init(varray, end); - varray_flush(varray); - } - } - break; - - default: - assert(0); - break; - } - - varray_flush(varray); -} - -#undef TRIANGLE -#undef QUAD -#undef POINT -#undef LINE -#undef FUNC diff --git a/src/gallium/auxiliary/draw/draw_pt_varray_tmp_linear.h b/src/gallium/auxiliary/draw/draw_pt_varray_tmp_linear.h deleted file mode 100644 index fc54476488..0000000000 --- a/src/gallium/auxiliary/draw/draw_pt_varray_tmp_linear.h +++ /dev/null @@ -1,98 +0,0 @@ -static unsigned trim( unsigned count, unsigned first, unsigned incr ) -{ - /* - * count either has been trimmed in draw_pt_arrays or is set to - * (driver)_fetch_max which is hopefully always larger than first. - */ - assert(count >= first); - return count - (count - first) % incr; -} - -static void FUNC(struct draw_pt_front_end *frontend, - unsigned start, - unsigned count) -{ - struct varray_frontend *varray = (struct varray_frontend *)frontend; - - unsigned j; - unsigned first, incr; - - draw_pt_split_prim(varray->input_prim, &first, &incr); - - /* Sanitize primitive length: - */ - count = trim(count, first, incr); - if (count < first) - return; - -#if 0 - debug_printf("%s (%d) %d/%d\n", __FUNCTION__, - varray->input_prim, - start, count); -#endif - - switch (varray->input_prim) { - case PIPE_PRIM_POINTS: - case PIPE_PRIM_LINES: - case PIPE_PRIM_TRIANGLES: - case PIPE_PRIM_LINE_STRIP: - case PIPE_PRIM_TRIANGLE_STRIP: - case PIPE_PRIM_QUADS: - case PIPE_PRIM_QUAD_STRIP: - case PIPE_PRIM_LINES_ADJACENCY: - case PIPE_PRIM_LINE_STRIP_ADJACENCY: - case PIPE_PRIM_TRIANGLES_ADJACENCY: - case PIPE_PRIM_TRIANGLE_STRIP_ADJACENCY: - for (j = 0; j < count;) { - unsigned remaining = count - j; - unsigned nr = trim( MIN2(varray->driver_fetch_max, remaining), first, incr ); - varray_flush_linear(varray, start + j, nr); - j += nr; - if (nr != remaining) - j -= (first - incr); - } - break; - - case PIPE_PRIM_LINE_LOOP: - /* Always have to decompose as we've stated that this will be - * emitted as a line-strip. - */ - for (j = 0; j < count;) { - unsigned remaining = count - j; - unsigned nr = trim( MIN2(varray->fetch_max-1, remaining), first, incr ); - varray_line_loop_segment(varray, start, j, nr, nr == remaining); - j += nr; - if (nr != remaining) - j -= (first - incr); - } - break; - - - case PIPE_PRIM_POLYGON: - case PIPE_PRIM_TRIANGLE_FAN: - if (count < varray->driver_fetch_max) { - varray_flush_linear(varray, start, count); - } - else { - for ( j = 0; j < count;) { - unsigned remaining = count - j; - unsigned nr = trim( MIN2(varray->fetch_max-1, remaining), first, incr ); - varray_fan_segment(varray, start, j, nr); - j += nr; - if (nr != remaining) - j -= (first - incr); - } - } - break; - - default: - assert(0); - break; - } -} - -#undef TRIANGLE -#undef QUAD -#undef POINT -#undef LINE -#undef FUNC diff --git a/src/gallium/auxiliary/draw/draw_pt_vcache.c b/src/gallium/auxiliary/draw/draw_pt_vcache.c deleted file mode 100644 index 993f388dc3..0000000000 --- a/src/gallium/auxiliary/draw/draw_pt_vcache.c +++ /dev/null @@ -1,611 +0,0 @@ -/************************************************************************** - * - * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas. - * 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, 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 TUNGSTEN GRAPHICS AND/OR ITS 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. - * - **************************************************************************/ - - /* - * Authors: - * Keith Whitwell - */ - -#include "util/u_memory.h" -#include "util/u_prim.h" -#include "draw/draw_context.h" -#include "draw/draw_private.h" -#include "draw/draw_pt.h" - - -#define CACHE_MAX 256 -#define FETCH_MAX 256 -#define DRAW_MAX (16*1024) - - -struct vcache_frontend { - struct draw_pt_front_end base; - struct draw_context *draw; - - unsigned in[CACHE_MAX]; - ushort out[CACHE_MAX]; - - ushort draw_elts[DRAW_MAX]; - unsigned fetch_elts[FETCH_MAX]; - - unsigned draw_count; - unsigned fetch_count; - unsigned fetch_max; - - struct draw_pt_middle_end *middle; - - unsigned input_prim; - unsigned output_prim; - - unsigned middle_prim; - unsigned opt; -}; - - -static INLINE void -vcache_flush( struct vcache_frontend *vcache ) -{ - if (vcache->middle_prim != vcache->output_prim) { - vcache->middle_prim = vcache->output_prim; - vcache->middle->prepare( vcache->middle, - vcache->middle_prim, - vcache->opt, - &vcache->fetch_max ); - } - - if (vcache->draw_count) { - vcache->middle->run( vcache->middle, - vcache->fetch_elts, - vcache->fetch_count, - vcache->draw_elts, - vcache->draw_count, - 0x0 ); - } - - memset(vcache->in, ~0, sizeof(vcache->in)); - vcache->fetch_count = 0; - vcache->draw_count = 0; -} - - -static INLINE void -vcache_check_flush( struct vcache_frontend *vcache ) -{ - if (vcache->draw_count + 6 >= DRAW_MAX || - vcache->fetch_count + 6 >= FETCH_MAX) { - vcache_flush( vcache ); - } -} - - -static INLINE void -vcache_elt( struct vcache_frontend *vcache, - unsigned felt, - ushort flags ) -{ - unsigned idx = felt % CACHE_MAX; - - if (vcache->in[idx] != felt) { - assert(vcache->fetch_count < FETCH_MAX); - - vcache->in[idx] = felt; - vcache->out[idx] = (ushort)vcache->fetch_count; - vcache->fetch_elts[vcache->fetch_count++] = felt; - } - - vcache->draw_elts[vcache->draw_count++] = vcache->out[idx] | flags; -} - - - -static INLINE void -vcache_triangle( struct vcache_frontend *vcache, - unsigned i0, - unsigned i1, - unsigned i2 ) -{ - vcache_elt(vcache, i0, 0); - vcache_elt(vcache, i1, 0); - vcache_elt(vcache, i2, 0); - vcache_check_flush(vcache); -} - - -static INLINE void -vcache_triangle_flags( struct vcache_frontend *vcache, - ushort flags, - unsigned i0, - unsigned i1, - unsigned i2 ) -{ - vcache_elt(vcache, i0, flags); - vcache_elt(vcache, i1, 0); - vcache_elt(vcache, i2, 0); - vcache_check_flush(vcache); -} - - -static INLINE void -vcache_line( struct vcache_frontend *vcache, - unsigned i0, - unsigned i1 ) -{ - vcache_elt(vcache, i0, 0); - vcache_elt(vcache, i1, 0); - vcache_check_flush(vcache); -} - - -static INLINE void -vcache_line_flags( struct vcache_frontend *vcache, - ushort flags, - unsigned i0, - unsigned i1 ) -{ - vcache_elt(vcache, i0, flags); - vcache_elt(vcache, i1, 0); - vcache_check_flush(vcache); -} - - -static INLINE void -vcache_point( struct vcache_frontend *vcache, - unsigned i0 ) -{ - vcache_elt(vcache, i0, 0); - vcache_check_flush(vcache); -} - - -static INLINE void -vcache_line_adj_flags( struct vcache_frontend *vcache, - unsigned flags, - unsigned a0, unsigned i0, unsigned i1, unsigned a1 ) -{ - vcache_elt(vcache, a0, 0); - vcache_elt(vcache, i0, flags); - vcache_elt(vcache, i1, 0); - vcache_elt(vcache, a1, 0); - vcache_check_flush(vcache); -} - - -static INLINE void -vcache_line_adj( struct vcache_frontend *vcache, - unsigned a0, unsigned i0, unsigned i1, unsigned a1 ) -{ - vcache_elt(vcache, a0, 0); - vcache_elt(vcache, i0, 0); - vcache_elt(vcache, i1, 0); - vcache_elt(vcache, a1, 0); - vcache_check_flush(vcache); -} - - -static INLINE void -vcache_triangle_adj_flags( struct vcache_frontend *vcache, - unsigned flags, - unsigned i0, unsigned a0, - unsigned i1, unsigned a1, - unsigned i2, unsigned a2 ) -{ - vcache_elt(vcache, i0, flags); - vcache_elt(vcache, a0, 0); - vcache_elt(vcache, i1, 0); - vcache_elt(vcache, a1, 0); - vcache_elt(vcache, i2, 0); - vcache_elt(vcache, a2, 0); - vcache_check_flush(vcache); -} - - -static INLINE void -vcache_triangle_adj( struct vcache_frontend *vcache, - unsigned i0, unsigned a0, - unsigned i1, unsigned a1, - unsigned i2, unsigned a2 ) -{ - vcache_elt(vcache, i0, 0); - vcache_elt(vcache, a0, 0); - vcache_elt(vcache, i1, 0); - vcache_elt(vcache, a1, 0); - vcache_elt(vcache, i2, 0); - vcache_elt(vcache, a2, 0); - vcache_check_flush(vcache); -} - - -/* At least for now, we're back to using a template include file for - * this. The two paths aren't too different though - it may be - * possible to reunify them. - */ -#define TRIANGLE(flags,i0,i1,i2) vcache_triangle_flags(vcache,flags,i0,i1,i2) -#define LINE(flags,i0,i1) vcache_line_flags(vcache,flags,i0,i1) -#define POINT(i0) vcache_point(vcache,i0) -#define LINE_ADJ(flags,a0,i0,i1,a1) \ - vcache_line_adj_flags(vcache,flags,a0,i0,i1,a1) -#define TRIANGLE_ADJ(flags,i0,a0,i1,a1,i2,a2) \ - vcache_triangle_adj_flags(vcache,flags,i0,a0,i1,a1,i2,a2) -#define FUNC vcache_run_extras -#include "draw_pt_vcache_tmp.h" - -#define TRIANGLE(flags,i0,i1,i2) vcache_triangle(vcache,i0,i1,i2) -#define LINE(flags,i0,i1) vcache_line(vcache,i0,i1) -#define POINT(i0) vcache_point(vcache,i0) -#define LINE_ADJ(flags,a0,i0,i1,a1) \ - vcache_line_adj(vcache,a0,i0,i1,a1) -#define TRIANGLE_ADJ(flags,i0,a0,i1,a1,i2,a2) \ - vcache_triangle_adj(vcache,i0,a0,i1,a1,i2,a2) -#define FUNC vcache_run -#include "draw_pt_vcache_tmp.h" - -static INLINE void -rebase_uint_elts( const unsigned *src, - unsigned count, - int delta, - ushort *dest ) -{ - unsigned i; - for (i = 0; i < count; i++) - dest[i] = (ushort)(src[i] + delta); -} - - -static INLINE void -rebase_ushort_elts( const ushort *src, - unsigned count, - int delta, - ushort *dest ) -{ - unsigned i; - for (i = 0; i < count; i++) - dest[i] = (ushort)(src[i] + delta); -} - - -static INLINE void -rebase_ubyte_elts( const ubyte *src, - unsigned count, - int delta, - ushort *dest ) -{ - unsigned i; - for (i = 0; i < count; i++) - dest[i] = (ushort)(src[i] + delta); -} - - -static INLINE void -translate_uint_elts( const unsigned *src, - unsigned count, - ushort *dest ) -{ - unsigned i; - for (i = 0; i < count; i++) - dest[i] = (ushort)(src[i]); -} - - -static INLINE void -translate_ushort_elts( const ushort *src, - unsigned count, - ushort *dest ) -{ - unsigned i; - for (i = 0; i < count; i++) - dest[i] = (ushort)(src[i]); -} - - -static INLINE void -translate_ubyte_elts( const ubyte *src, - unsigned count, - ushort *dest ) -{ - unsigned i; - for (i = 0; i < count; i++) - dest[i] = (ushort)(src[i]); -} - - - - -#if 0 -static INLINE enum pipe_format -format_from_get_elt( pt_elt_func get_elt ) -{ - switch (draw->pt.user.eltSize) { - case 1: return PIPE_FORMAT_R8_UNORM; - case 2: return PIPE_FORMAT_R16_UNORM; - case 4: return PIPE_FORMAT_R32_UNORM; - default: return PIPE_FORMAT_NONE; - } -} -#endif - - -/** - * Check if any vertex attributes use instance divisors. - * Note that instance divisors complicate vertex fetching so we need - * to take the vcache path when they're in use. - */ -static boolean -any_instance_divisors(const struct draw_context *draw) -{ - uint i; - - for (i = 0; i < draw->pt.nr_vertex_elements; i++) { - uint div = draw->pt.vertex_element[i].instance_divisor; - if (div) - return TRUE; - } - return FALSE; -} - - -static INLINE void -vcache_check_run( struct draw_pt_front_end *frontend, - unsigned draw_start, - unsigned draw_count ) -{ - struct vcache_frontend *vcache = (struct vcache_frontend *)frontend; - struct draw_context *draw = vcache->draw; - const unsigned min_index = draw->pt.user.min_index; - const unsigned max_index = draw->pt.user.max_index; - const unsigned index_size = draw->pt.user.eltSize; - const int elt_bias = draw->pt.user.eltBias; - unsigned fetch_count; - const ushort *transformed_elts; - ushort *storage = NULL; - boolean ok = FALSE; - const void *elts = draw_pt_elt_ptr(draw, draw_start); - - /* debug: verify indexes are in range [min_index, max_index] */ - if (0) { - unsigned i; - for (i = 0; i < draw_count; i++) { - if (index_size == 1) { - assert( ((const ubyte *) elts)[i] >= min_index); - assert( ((const ubyte *) elts)[i] <= max_index); - } - else if (index_size == 2) { - assert( ((const ushort *) elts)[i] >= min_index); - assert( ((const ushort *) elts)[i] <= max_index); - } - else { - assert(index_size == 4); - assert( ((const uint *) elts)[i] >= min_index); - assert( ((const uint *) elts)[i] <= max_index); - } - } - } - - /* Note: max_index is frequently 0xffffffff so we have to be sure - * that any arithmetic involving max_index doesn't overflow! - */ - if (max_index >= (unsigned) DRAW_PIPE_MAX_VERTICES) - goto fail; - - if (any_instance_divisors(draw)) - goto fail; - - fetch_count = max_index + 1 - min_index; - - if (0) - debug_printf("fetch_count %d fetch_max %d draw_count %d\n", fetch_count, - vcache->fetch_max, - draw_count); - - if (elt_bias + max_index >= DRAW_PIPE_MAX_VERTICES || - fetch_count >= UNDEFINED_VERTEX_ID || - fetch_count > draw_count) { - if (0) debug_printf("fail\n"); - goto fail; - } - - if (vcache->middle_prim != vcache->input_prim) { - vcache->middle_prim = vcache->input_prim; - vcache->middle->prepare( vcache->middle, - vcache->middle_prim, - vcache->opt, - &vcache->fetch_max ); - } - - assert((elt_bias >= 0 && min_index + elt_bias >= min_index) || - (elt_bias < 0 && min_index + elt_bias < min_index)); - - if (min_index == 0 && - index_size == 2) { - transformed_elts = (const ushort *)elts; - } - else { - storage = MALLOC( draw_count * sizeof(ushort) ); - if (!storage) - goto fail; - - if (min_index == 0) { - switch(index_size) { - case 1: - translate_ubyte_elts( (const ubyte *)elts, - draw_count, - storage ); - break; - - case 2: - translate_ushort_elts( (const ushort *)elts, - draw_count, - storage ); - break; - - case 4: - translate_uint_elts( (const uint *)elts, - draw_count, - storage ); - break; - - default: - assert(0); - FREE(storage); - return; - } - } - else { - switch(index_size) { - case 1: - rebase_ubyte_elts( (const ubyte *)elts, - draw_count, - 0 - (int)min_index, - storage ); - break; - - case 2: - rebase_ushort_elts( (const ushort *)elts, - draw_count, - 0 - (int)min_index, - storage ); - break; - - case 4: - rebase_uint_elts( (const uint *)elts, - draw_count, - 0 - (int)min_index, - storage ); - break; - - default: - assert(0); - FREE(storage); - return; - } - } - transformed_elts = storage; - } - - if (fetch_count < UNDEFINED_VERTEX_ID) - ok = vcache->middle->run_linear_elts( vcache->middle, - min_index + elt_bias, /* start */ - fetch_count, - transformed_elts, - draw_count, 0x0 ); - - FREE(storage); - - if (ok) - return; - - debug_printf("failed to execute atomic draw elts for %d/%d, splitting up\n", - fetch_count, draw_count); - -fail: - vcache_run( frontend, draw_start, draw_count ); -} - - - - -static void -vcache_prepare( struct draw_pt_front_end *frontend, - unsigned in_prim, - struct draw_pt_middle_end *middle, - unsigned opt ) -{ - struct vcache_frontend *vcache = (struct vcache_frontend *)frontend; - - if (opt & PT_PIPELINE) { - vcache->base.run = vcache_run_extras; - } - else { - vcache->base.run = vcache_check_run; - } - - /* VCache will always emit the reduced version of its input - * primitive, ie STRIP/FANS become TRIS, etc. - * - * This is not to be confused with what the GS might be up to, - * which is a separate issue. - */ - vcache->input_prim = in_prim; - switch (in_prim) { - case PIPE_PRIM_LINES_ADJACENCY: - case PIPE_PRIM_LINE_STRIP_ADJACENCY: - vcache->output_prim = PIPE_PRIM_LINES_ADJACENCY; - break; - case PIPE_PRIM_TRIANGLES_ADJACENCY: - case PIPE_PRIM_TRIANGLE_STRIP_ADJACENCY: - vcache->output_prim = PIPE_PRIM_TRIANGLES_ADJACENCY; - break; - default: - vcache->output_prim = u_reduced_prim(in_prim); - } - - vcache->middle = middle; - vcache->opt = opt; - - /* Have to run prepare here, but try and guess a good prim for - * doing so: - */ - vcache->middle_prim = (opt & PT_PIPELINE) - ? vcache->output_prim : vcache->input_prim; - - middle->prepare( middle, - vcache->middle_prim, - opt, &vcache->fetch_max ); -} - - -static void -vcache_finish( struct draw_pt_front_end *frontend ) -{ - struct vcache_frontend *vcache = (struct vcache_frontend *)frontend; - vcache->middle->finish( vcache->middle ); - vcache->middle = NULL; -} - - -static void -vcache_destroy( struct draw_pt_front_end *frontend ) -{ - FREE(frontend); -} - - -struct draw_pt_front_end *draw_pt_vcache( struct draw_context *draw ) -{ - struct vcache_frontend *vcache = CALLOC_STRUCT( vcache_frontend ); - if (vcache == NULL) - return NULL; - - vcache->base.prepare = vcache_prepare; - vcache->base.run = NULL; - vcache->base.finish = vcache_finish; - vcache->base.destroy = vcache_destroy; - vcache->draw = draw; - - memset(vcache->in, ~0, sizeof(vcache->in)); - - return &vcache->base; -} diff --git a/src/gallium/auxiliary/draw/draw_pt_vcache_tmp.h b/src/gallium/auxiliary/draw/draw_pt_vcache_tmp.h deleted file mode 100644 index e80a9c7f15..0000000000 --- a/src/gallium/auxiliary/draw/draw_pt_vcache_tmp.h +++ /dev/null @@ -1,21 +0,0 @@ -#define FUNC_VARS \ - struct draw_pt_front_end *frontend, \ - unsigned start, \ - unsigned count - -#define LOCAL_VARS \ - struct vcache_frontend *vcache = (struct vcache_frontend *) frontend; \ - struct draw_context *draw = vcache->draw; \ - const unsigned prim = vcache->input_prim; \ - const void *elts = draw_pt_elt_ptr(draw, start); \ - pt_elt_func get_elt = draw_pt_elt_func(draw); \ - const int elt_bias = draw->pt.user.eltBias; \ - const boolean last_vertex_last = !(draw->rasterizer->flatshade && \ - draw->rasterizer->flatshade_first); \ - const unsigned prim_flags = 0x0; - -#define GET_ELT(idx) (get_elt(elts, idx) + elt_bias) - -#define FUNC_EXIT do { vcache_flush(vcache); } while (0) - -#include "draw_decompose_tmp.h" -- cgit v1.2.3 From 7b3beb22405ee2de0cf02951b6547964a2989ee5 Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Tue, 10 Aug 2010 00:39:23 +0800 Subject: draw: last_vertex_last is always true for GS and SO. That is, OpenGL decomposition rule is assumed. There should be a pipe_context state to specify the rules. --- src/gallium/auxiliary/draw/draw_gs_tmp.h | 7 ++----- src/gallium/auxiliary/draw/draw_so_emit_tmp.h | 5 +---- 2 files changed, 3 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/gallium/auxiliary/draw/draw_gs_tmp.h b/src/gallium/auxiliary/draw/draw_gs_tmp.h index 7c8a9f9cfc..de7b02655a 100644 --- a/src/gallium/auxiliary/draw/draw_gs_tmp.h +++ b/src/gallium/auxiliary/draw/draw_gs_tmp.h @@ -6,13 +6,10 @@ #define FUNC_ENTER \ /* declare more local vars */ \ - struct draw_context *draw = gs->draw; \ const unsigned prim = input_prims->prim; \ - const unsigned count = input_prims->count; \ - const boolean last_vertex_last = \ - !(draw->rasterizer->flatshade && \ - draw->rasterizer->flatshade_first); \ const unsigned prim_flags = input_prims->flags; \ + const unsigned count = input_prims->count; \ + const boolean last_vertex_last = TRUE; \ do { \ debug_assert(input_prims->primitive_count == 1); \ switch (prim) { \ diff --git a/src/gallium/auxiliary/draw/draw_so_emit_tmp.h b/src/gallium/auxiliary/draw/draw_so_emit_tmp.h index 1446e81bba..7fafde9d5e 100644 --- a/src/gallium/auxiliary/draw/draw_so_emit_tmp.h +++ b/src/gallium/auxiliary/draw/draw_so_emit_tmp.h @@ -7,12 +7,9 @@ #define FUNC_ENTER \ /* declare more local vars */ \ - struct draw_context *draw = so->draw; \ const unsigned prim = input_prims->prim; \ - const boolean last_vertex_last = \ - !(draw->rasterizer->flatshade && \ - draw->rasterizer->flatshade_first); \ const unsigned prim_flags = input_prims->flags; \ + const boolean last_vertex_last = TRUE; \ do { \ debug_assert(input_prims->primitive_count == 1); \ switch (prim) { \ -- cgit v1.2.3 From a072f0e186522f9de2848989422ad0244f65c961 Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Sat, 14 Aug 2010 00:05:28 +0800 Subject: drwa: Add PRIMITIVE macro to vsplit. PRIMITIVE is used by the indexed path to flush the entire primitive with custom vertex count checks. It replaces the existing fast path. --- src/gallium/auxiliary/draw/draw_pt_vsplit_tmp.h | 46 ++++++++++++++----------- src/gallium/auxiliary/draw/draw_split_tmp.h | 5 +++ 2 files changed, 31 insertions(+), 20 deletions(-) (limited to 'src') diff --git a/src/gallium/auxiliary/draw/draw_pt_vsplit_tmp.h b/src/gallium/auxiliary/draw/draw_pt_vsplit_tmp.h index efeaa56711..4bb57b1493 100644 --- a/src/gallium/auxiliary/draw/draw_pt_vsplit_tmp.h +++ b/src/gallium/auxiliary/draw/draw_pt_vsplit_tmp.h @@ -34,9 +34,8 @@ * (rebased) index buffer as the draw elements. */ static boolean -CONCAT(vsplit_segment_fast_, ELT_TYPE)(struct vsplit_frontend *vsplit, - unsigned flags, - unsigned istart, unsigned icount) +CONCAT(vsplit_primitive_, ELT_TYPE)(struct vsplit_frontend *vsplit, + unsigned istart, unsigned icount) { struct draw_context *draw = vsplit->draw; const ELT_TYPE *ib = (const ELT_TYPE *) draw->pt.user.elts; @@ -44,10 +43,25 @@ CONCAT(vsplit_segment_fast_, ELT_TYPE)(struct vsplit_frontend *vsplit, const unsigned max_index = draw->pt.user.max_index; const int elt_bias = draw->pt.user.eltBias; unsigned fetch_start, fetch_count; - const ushort *draw_elts; + const ushort *draw_elts = NULL; unsigned i; - assert(icount <= vsplit->segment_size); + /* use the ib directly */ + if (min_index == 0 && sizeof(ib[0]) == sizeof(draw_elts[0])) { + if (icount > vsplit->max_vertices) + return FALSE; + + for (i = 0; i < icount; i++) { + ELT_TYPE idx = ib[istart + i]; + assert(idx >= min_index && idx <= max_index); + } + draw_elts = (const ushort *) ib; + } + else { + /* have to go through vsplit->draw_elts */ + if (icount > vsplit->segment_size) + return FALSE; + } /* this is faster only when we fetch less elements than the normal path */ if (max_index - min_index > icount - 1) @@ -65,14 +79,7 @@ CONCAT(vsplit_segment_fast_, ELT_TYPE)(struct vsplit_frontend *vsplit, fetch_start = min_index + elt_bias; fetch_count = max_index - min_index + 1; - if (min_index == 0 && sizeof(ib[0]) == sizeof(draw_elts[0])) { - for (i = 0; i < icount; i++) { - ELT_TYPE idx = ib[istart + i]; - assert(idx >= min_index && idx <= max_index); - } - draw_elts = (const ushort *) ib; - } - else { + if (!draw_elts) { if (min_index == 0) { for (i = 0; i < icount; i++) { ELT_TYPE idx = ib[istart + i]; @@ -95,7 +102,7 @@ CONCAT(vsplit_segment_fast_, ELT_TYPE)(struct vsplit_frontend *vsplit, return vsplit->middle->run_linear_elts(vsplit->middle, fetch_start, fetch_count, - draw_elts, icount, flags); + draw_elts, icount, 0x0); } /** @@ -170,12 +177,6 @@ CONCAT(vsplit_segment_simple_, ELT_TYPE)(struct vsplit_frontend *vsplit, unsigned istart, unsigned icount) { - /* the primitive is not splitted */ - if (!(flags)) { - if (CONCAT(vsplit_segment_fast_, ELT_TYPE)(vsplit, - flags, istart, icount)) - return; - } CONCAT(vsplit_segment_cache_, ELT_TYPE)(vsplit, flags, istart, icount, FALSE, 0, FALSE, 0); } @@ -213,6 +214,9 @@ CONCAT(vsplit_segment_fan_, ELT_TYPE)(struct vsplit_frontend *vsplit, const unsigned max_count_loop = vsplit->segment_size - 1; \ const unsigned max_count_fan = vsplit->segment_size; +#define PRIMITIVE(istart, icount) \ + CONCAT(vsplit_primitive_, ELT_TYPE)(vsplit, istart, icount) + #else /* ELT_TYPE */ static void @@ -274,6 +278,8 @@ vsplit_segment_fan_linear(struct vsplit_frontend *vsplit, unsigned flags, const unsigned max_count_loop = vsplit->segment_size - 1; \ const unsigned max_count_fan = vsplit->segment_size; +#define PRIMITIVE(istart, icount) FALSE + #define ELT_TYPE linear #endif /* ELT_TYPE */ diff --git a/src/gallium/auxiliary/draw/draw_split_tmp.h b/src/gallium/auxiliary/draw/draw_split_tmp.h index 40ab0b71f1..47defc62b9 100644 --- a/src/gallium/auxiliary/draw/draw_split_tmp.h +++ b/src/gallium/auxiliary/draw/draw_split_tmp.h @@ -47,6 +47,10 @@ FUNC(FUNC_VARS) if (count < first) return; + /* try flushing the entire primitive */ + if (PRIMITIVE(start, count)) + return; + /* must be able to at least flush two complete primitives */ assert(max_count_simple >= first + incr && max_count_loop >= first + incr && @@ -166,6 +170,7 @@ FUNC(FUNC_VARS) #undef FUNC_VARS #undef LOCAL_VARS +#undef PRIMITIVE #undef SEGMENT_SIMPLE #undef SEGMENT_LOOP #undef SEGMENT_FAN -- cgit v1.2.3 From c3fee80f2b35f6a7e48d6015bfc759c66b7e1a2c Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Sat, 7 Aug 2010 21:02:13 +0800 Subject: draw: Remove DRAW_PIPE_MAX_VERTICES and DRAW_PIPE_FLAG_MASK. The higher bits of draw elements are no longer used for the stipple or edge flags. --- src/gallium/auxiliary/draw/draw_gs.c | 2 +- src/gallium/auxiliary/draw/draw_pipe.c | 11 +++-------- src/gallium/auxiliary/draw/draw_private.h | 22 ++++++++-------------- .../auxiliary/draw/draw_pt_fetch_shade_pipeline.c | 6 +++--- .../draw/draw_pt_fetch_shade_pipeline_llvm.c | 6 +++--- src/gallium/auxiliary/draw/draw_pt_so_emit.c | 2 +- 6 files changed, 19 insertions(+), 30 deletions(-) (limited to 'src') diff --git a/src/gallium/auxiliary/draw/draw_gs.c b/src/gallium/auxiliary/draw/draw_gs.c index 592f71bfbe..50a03ac95a 100644 --- a/src/gallium/auxiliary/draw/draw_gs.c +++ b/src/gallium/auxiliary/draw/draw_gs.c @@ -380,7 +380,7 @@ static void gs_tri_adj(struct draw_geometry_shader *shader, #define FUNC gs_run_elts #define LOCAL_VARS const ushort *elts = input_prims->elts; -#define GET_ELT(idx) (elts[idx] & ~DRAW_PIPE_FLAG_MASK) +#define GET_ELT(idx) (elts[idx]) #include "draw_gs_tmp.h" diff --git a/src/gallium/auxiliary/draw/draw_pipe.c b/src/gallium/auxiliary/draw/draw_pipe.c index 43c25167a9..b75262a357 100644 --- a/src/gallium/auxiliary/draw/draw_pipe.c +++ b/src/gallium/auxiliary/draw/draw_pipe.c @@ -173,27 +173,23 @@ static void do_triangle( struct draw_context *draw, #define TRIANGLE(flags,i0,i1,i2) \ do { \ - assert(!((i1) & DRAW_PIPE_FLAG_MASK)); \ - assert(!((i2) & DRAW_PIPE_FLAG_MASK)); \ do_triangle( draw, \ flags, \ - verts + stride * (i0 & ~DRAW_PIPE_FLAG_MASK), \ + verts + stride * (i0), \ verts + stride * (i1), \ verts + stride * (i2) ); \ } while (0) #define LINE(flags,i0,i1) \ do { \ - assert(!((i1) & DRAW_PIPE_FLAG_MASK)); \ do_line( draw, \ flags, \ - verts + stride * (i0 & ~DRAW_PIPE_FLAG_MASK), \ + verts + stride * (i0), \ verts + stride * (i1) ); \ } while (0) #define POINT(i0) \ do { \ - assert(!((i0) & DRAW_PIPE_FLAG_MASK)); \ do_point( draw, verts + stride * (i0) ); \ } while (0) @@ -247,8 +243,7 @@ void draw_pipeline_run( struct draw_context *draw, unsigned max_index = 0x0, i; /* find the largest element index */ for (i = 0; i < count; i++) { - unsigned int index = (prim_info->elts[start + i] - & ~DRAW_PIPE_FLAG_MASK); + unsigned int index = prim_info->elts[start + i]; if (index > max_index) max_index = index; } diff --git a/src/gallium/auxiliary/draw/draw_private.h b/src/gallium/auxiliary/draw/draw_private.h index 94b688f891..854c45f060 100644 --- a/src/gallium/auxiliary/draw/draw_private.h +++ b/src/gallium/auxiliary/draw/draw_private.h @@ -373,21 +373,15 @@ void draw_pipeline_destroy( struct draw_context *draw ); -/* We use the top few bits in the elts[] parameter to convey a little - * API information. This limits the number of vertices we can address - * to only 4096 -- if that becomes a problem, we can switch to 32-bit - * draw indices. - * - * These flags expected at first vertex of lines & triangles when - * unfilled and/or line stipple modes are operational. +/* + * These flags are used by the pipeline when unfilled and/or line stipple modes + * are operational. */ -#define DRAW_PIPE_MAX_VERTICES (0x1<<12) -#define DRAW_PIPE_EDGE_FLAG_0 (0x1<<12) -#define DRAW_PIPE_EDGE_FLAG_1 (0x2<<12) -#define DRAW_PIPE_EDGE_FLAG_2 (0x4<<12) -#define DRAW_PIPE_EDGE_FLAG_ALL (0x7<<12) -#define DRAW_PIPE_RESET_STIPPLE (0x8<<12) -#define DRAW_PIPE_FLAG_MASK (0xf<<12) +#define DRAW_PIPE_EDGE_FLAG_0 0x1 +#define DRAW_PIPE_EDGE_FLAG_1 0x2 +#define DRAW_PIPE_EDGE_FLAG_2 0x4 +#define DRAW_PIPE_EDGE_FLAG_ALL 0x7 +#define DRAW_PIPE_RESET_STIPPLE 0x8 void draw_pipeline_run( struct draw_context *draw, const struct draw_vertex_info *vert, diff --git a/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline.c b/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline.c index 1ac20d27f3..4d2d24d2df 100644 --- a/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline.c +++ b/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline.c @@ -112,11 +112,11 @@ static void fetch_pipeline_prepare( struct draw_pt_middle_end *middle, gs_out_prim, max_vertices ); - *max_vertices = MAX2( *max_vertices, - DRAW_PIPE_MAX_VERTICES ); + *max_vertices = MAX2( *max_vertices, 4096 ); } else { - *max_vertices = DRAW_PIPE_MAX_VERTICES; + /* limit max fetches by limiting max_vertices */ + *max_vertices = 4096; } /* return even number */ diff --git a/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline_llvm.c b/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline_llvm.c index 8f2847ffa0..572aa67e60 100644 --- a/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline_llvm.c +++ b/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline_llvm.c @@ -118,11 +118,11 @@ llvm_middle_end_prepare( struct draw_pt_middle_end *middle, out_prim, max_vertices ); - *max_vertices = MAX2( *max_vertices, - DRAW_PIPE_MAX_VERTICES ); + *max_vertices = MAX2( *max_vertices, 4096 ); } else { - *max_vertices = DRAW_PIPE_MAX_VERTICES; + /* limit max fetches by limiting max_vertices */ + *max_vertices = 4096; } /* return even number */ diff --git a/src/gallium/auxiliary/draw/draw_pt_so_emit.c b/src/gallium/auxiliary/draw/draw_pt_so_emit.c index f7f4f24d35..c86bdd99a3 100644 --- a/src/gallium/auxiliary/draw/draw_pt_so_emit.c +++ b/src/gallium/auxiliary/draw/draw_pt_so_emit.c @@ -225,7 +225,7 @@ static void so_tri(struct pt_so_emit *so, int i0, int i1, int i2) #define FUNC so_run_elts #define LOCAL_VARS const ushort *elts = input_prims->elts; -#define GET_ELT(idx) (elts[start + (idx)] & ~DRAW_PIPE_FLAG_MASK) +#define GET_ELT(idx) (elts[start + (idx)]) #include "draw_so_emit_tmp.h" -- cgit v1.2.3 From aaf51ed7c24a5d9488f8225972e5d5d108c6c197 Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Tue, 10 Aug 2010 01:05:25 +0800 Subject: draw: No need to make max_vertices even. Triangle strip alternates the front/back orientation of its triangles. max_vertices was made even so that varray never splitted a triangle strip at the wrong positions. It did not work with triangle strips with adjacencies. And it is no longer relevant with vsplit. --- src/gallium/auxiliary/draw/draw_pipe_vbuf.c | 3 --- src/gallium/auxiliary/draw/draw_pt_emit.c | 3 --- src/gallium/auxiliary/draw/draw_pt_fetch_emit.c | 9 --------- src/gallium/auxiliary/draw/draw_pt_fetch_shade_emit.c | 9 --------- src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline.c | 3 --- src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline_llvm.c | 3 --- 6 files changed, 30 deletions(-) (limited to 'src') diff --git a/src/gallium/auxiliary/draw/draw_pipe_vbuf.c b/src/gallium/auxiliary/draw/draw_pipe_vbuf.c index 3c93c9014a..58c5858734 100644 --- a/src/gallium/auxiliary/draw/draw_pipe_vbuf.c +++ b/src/gallium/auxiliary/draw/draw_pipe_vbuf.c @@ -353,9 +353,6 @@ vbuf_alloc_vertices( struct vbuf_stage *vbuf ) /* Allocate a new vertex buffer */ vbuf->max_vertices = vbuf->render->max_vertex_buffer_bytes / vbuf->vertex_size; - /* even number */ - vbuf->max_vertices = vbuf->max_vertices & ~1; - if(vbuf->max_vertices >= UNDEFINED_VERTEX_ID) vbuf->max_vertices = UNDEFINED_VERTEX_ID - 1; diff --git a/src/gallium/auxiliary/draw/draw_pt_emit.c b/src/gallium/auxiliary/draw/draw_pt_emit.c index 5568fbb9f8..89d96c4235 100644 --- a/src/gallium/auxiliary/draw/draw_pt_emit.c +++ b/src/gallium/auxiliary/draw/draw_pt_emit.c @@ -120,9 +120,6 @@ void draw_pt_emit_prepare( struct pt_emit *emit, *max_vertices = (draw->render->max_vertex_buffer_bytes / (vinfo->size * 4)); - - /* even number */ - *max_vertices = *max_vertices & ~1; } diff --git a/src/gallium/auxiliary/draw/draw_pt_fetch_emit.c b/src/gallium/auxiliary/draw/draw_pt_fetch_emit.c index d826e79dbf..80a89428b6 100644 --- a/src/gallium/auxiliary/draw/draw_pt_fetch_emit.c +++ b/src/gallium/auxiliary/draw/draw_pt_fetch_emit.c @@ -191,15 +191,6 @@ static void fetch_emit_prepare( struct draw_pt_middle_end *middle, *max_vertices = (draw->render->max_vertex_buffer_bytes / (vinfo->size * 4)); - - /* Return an even number of verts. - * This prevents "parity" errors when splitting long triangle strips which - * can lead to front/back culling mix-ups. - * Every other triangle in a strip has an alternate front/back orientation - * so splitting at an odd position can cause the orientation of subsequent - * triangles to get reversed. - */ - *max_vertices = *max_vertices & ~1; } diff --git a/src/gallium/auxiliary/draw/draw_pt_fetch_shade_emit.c b/src/gallium/auxiliary/draw/draw_pt_fetch_shade_emit.c index c64104dda5..a31d3feb16 100644 --- a/src/gallium/auxiliary/draw/draw_pt_fetch_shade_emit.c +++ b/src/gallium/auxiliary/draw/draw_pt_fetch_shade_emit.c @@ -175,15 +175,6 @@ static void fse_prepare( struct draw_pt_middle_end *middle, *max_vertices = (draw->render->max_vertex_buffer_bytes / (vinfo->size * 4)); - /* Return an even number of verts. - * This prevents "parity" errors when splitting long triangle strips which - * can lead to front/back culling mix-ups. - * Every other triangle in a strip has an alternate front/back orientation - * so splitting at an odd position can cause the orientation of subsequent - * triangles to get reversed. - */ - *max_vertices = *max_vertices & ~1; - /* Probably need to do this somewhere (or fix exec shader not to * need it): */ diff --git a/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline.c b/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline.c index 4d2d24d2df..96b40fb363 100644 --- a/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline.c +++ b/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline.c @@ -119,9 +119,6 @@ static void fetch_pipeline_prepare( struct draw_pt_middle_end *middle, *max_vertices = 4096; } - /* return even number */ - *max_vertices = *max_vertices & ~1; - /* No need to prepare the shader. */ vs->prepare(vs, draw); diff --git a/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline_llvm.c b/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline_llvm.c index 572aa67e60..78b1bf988c 100644 --- a/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline_llvm.c +++ b/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline_llvm.c @@ -125,9 +125,6 @@ llvm_middle_end_prepare( struct draw_pt_middle_end *middle, *max_vertices = 4096; } - /* return even number */ - *max_vertices = *max_vertices & ~1; - draw_llvm_make_variant_key(fpme->llvm, &key); li = first_elem(&shader->variants); -- cgit v1.2.3 From 9271059b361128070c68b3d1a7982b4f9f151546 Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Mon, 16 Aug 2010 22:00:45 +0800 Subject: drwa: Fix polygon edge flags. Fix a copy-and-paste error introduced by f141abdc8fdbff41e16b0ce53fa3fa8fba32a7f9. --- src/gallium/auxiliary/draw/draw_decompose_tmp.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/auxiliary/draw/draw_decompose_tmp.h b/src/gallium/auxiliary/draw/draw_decompose_tmp.h index be3a997c3d..a142563af9 100644 --- a/src/gallium/auxiliary/draw/draw_decompose_tmp.h +++ b/src/gallium/auxiliary/draw/draw_decompose_tmp.h @@ -257,7 +257,7 @@ FUNC(FUNC_VARS) flags = (DRAW_PIPE_RESET_STIPPLE | DRAW_PIPE_EDGE_FLAG_0); if (!(prim_flags & DRAW_SPLIT_BEFORE)) - flags |= DRAW_PIPE_EDGE_FLAG_1; + flags |= DRAW_PIPE_EDGE_FLAG_2; edge_next = DRAW_PIPE_EDGE_FLAG_0; edge_finish = -- cgit v1.2.3 From ddcf028aa0a1bd6f79381164c8b1c3b816792e47 Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Tue, 10 Aug 2010 09:51:20 +0200 Subject: translate_generic: use memcpy if possible (v3) Changes in v3: - If we can do a copy, don't try to get an emit func, as that can assert(0) Changes in v2: - Add comment regarding copy_size When used in GPU drivers, translate can be used to simultaneously perform a gather operation, and convert away from unsupported formats. In this use case, input and output formats will often be identical: clearly it would make sense to use a memcpy in this case. Instead, translate will insist to convert to and from 32-bit floating point numbers. This is not only extremely expensive, but it also loses precision for 32/64-bit integers and 64-bit floating point numbers. This patch changes translate_generic to just use memcpy if the formats are identical, non-blocked, and with an integral number of bytes per pixel (note that all sensible vertex formats are like this). --- .../auxiliary/translate/translate_generic.c | 108 ++++++++++++++------- 1 file changed, 75 insertions(+), 33 deletions(-) (limited to 'src') diff --git a/src/gallium/auxiliary/translate/translate_generic.c b/src/gallium/auxiliary/translate/translate_generic.c index 42cfd763e9..9d2653920d 100644 --- a/src/gallium/auxiliary/translate/translate_generic.c +++ b/src/gallium/auxiliary/translate/translate_generic.c @@ -64,6 +64,14 @@ struct translate_generic { unsigned input_stride; unsigned max_index; + /* this value is set to -1 if this is a normal element with output_format != input_format: + * in this case, u_format is used to do a full conversion + * + * this value is set to the format size in bytes if output_format == input_format or for 32-bit instance ids: + * in this case, memcpy is used to copy this amount of bytes + */ + int copy_size; + } attrib[PIPE_MAX_ATTRIBS]; unsigned nr_attrib; @@ -354,8 +362,6 @@ static emit_func get_emit_func( enum pipe_format format ) } } - - /** * Fetch vertex attributes for 'count' vertices. */ @@ -380,9 +386,10 @@ static void PIPE_CDECL generic_run_elts( struct translate *translate, float data[4]; char *dst = vert + tg->attrib[attr].output_offset; - if (tg->attrib[attr].type == TRANSLATE_ELEMENT_NORMAL) { + if (tg->attrib[attr].type == TRANSLATE_ELEMENT_NORMAL) { const uint8_t *src; unsigned index; + int copy_size; if (tg->attrib[attr].instance_divisor) { index = instance_id / tg->attrib[attr].instance_divisor; @@ -396,27 +403,34 @@ static void PIPE_CDECL generic_run_elts( struct translate *translate, src = tg->attrib[attr].input_ptr + tg->attrib[attr].input_stride * index; - tg->attrib[attr].fetch( data, src, 0, 0 ); - - if (0) - debug_printf("Fetch elt attr %d from %p stride %d div %u max %u index %d: " - " %f, %f, %f, %f \n", - attr, - tg->attrib[attr].input_ptr, - tg->attrib[attr].input_stride, - tg->attrib[attr].instance_divisor, - tg->attrib[attr].max_index, - index, - data[0], data[1],data[2], data[3]); + copy_size = tg->attrib[attr].copy_size; + if(likely(copy_size >= 0)) + memcpy(dst, src, copy_size); + else + { + tg->attrib[attr].fetch( data, src, 0, 0 ); + + if (0) + debug_printf("Fetch elt attr %d from %p stride %d div %u max %u index %d: " + " %f, %f, %f, %f \n", + attr, + tg->attrib[attr].input_ptr, + tg->attrib[attr].input_stride, + tg->attrib[attr].instance_divisor, + tg->attrib[attr].max_index, + index, + data[0], data[1],data[2], data[3]); + tg->attrib[attr].emit( data, dst ); + } } else { - data[0] = (float)instance_id; + if(likely(tg->attrib[attr].copy_size >= 0)) + memcpy(data, &instance_id, 4); + else + { + data[0] = (float)instance_id; + tg->attrib[attr].emit( data, dst ); + } } - - if (0) - debug_printf("vert %d/%d attr %d: %f %f %f %f\n", - i, elt, attr, data[0], data[1], data[2], data[3]); - - tg->attrib[attr].emit( data, dst ); } vert += tg->translate.key.output_stride; } @@ -448,6 +462,7 @@ static void PIPE_CDECL generic_run( struct translate *translate, if (tg->attrib[attr].type == TRANSLATE_ELEMENT_NORMAL) { const uint8_t *src; unsigned index; + int copy_size; if (tg->attrib[attr].instance_divisor) { index = instance_id / tg->attrib[attr].instance_divisor; @@ -462,25 +477,33 @@ static void PIPE_CDECL generic_run( struct translate *translate, src = tg->attrib[attr].input_ptr + tg->attrib[attr].input_stride * index; - tg->attrib[attr].fetch( data, src, 0, 0 ); + copy_size = tg->attrib[attr].copy_size; + if(likely(copy_size >= 0)) + memcpy(dst, src, copy_size); + else + { + tg->attrib[attr].fetch( data, src, 0, 0 ); - if (0) - debug_printf("Fetch linear attr %d from %p stride %d index %d: " + if (0) + debug_printf("Fetch linear attr %d from %p stride %d index %d: " " %f, %f, %f, %f \n", attr, tg->attrib[attr].input_ptr, tg->attrib[attr].input_stride, index, data[0], data[1],data[2], data[3]); + + tg->attrib[attr].emit( data, dst ); + } } else { - data[0] = (float)instance_id; + if(likely(tg->attrib[attr].copy_size >= 0)) + memcpy(data, &instance_id, 4); + else + { + data[0] = (float)instance_id; + tg->attrib[attr].emit( data, dst ); + } } - - if (0) - debug_printf("vert %d attr %d: %f %f %f %f\n", - i, attr, data[0], data[1], data[2], data[3]); - - tg->attrib[attr].emit( data, dst ); } vert += tg->translate.key.output_stride; @@ -544,9 +567,28 @@ struct translate *translate_generic_create( const struct translate_key *key ) tg->attrib[i].input_offset = key->element[i].input_offset; tg->attrib[i].instance_divisor = key->element[i].instance_divisor; - tg->attrib[i].emit = get_emit_func(key->element[i].output_format); tg->attrib[i].output_offset = key->element[i].output_offset; + tg->attrib[i].copy_size = -1; + if (tg->attrib[i].type == TRANSLATE_ELEMENT_INSTANCE_ID) + { + if(key->element[i].output_format == PIPE_FORMAT_R32_USCALED + || key->element[i].output_format == PIPE_FORMAT_R32_SSCALED) + tg->attrib[i].copy_size = 4; + } + else + { + if(key->element[i].input_format == key->element[i].output_format + && format_desc->block.width == 1 + && format_desc->block.height == 1 + && !(format_desc->block.bits & 7)) + tg->attrib[i].copy_size = format_desc->block.bits >> 3; + } + + if(tg->attrib[i].copy_size < 0) + tg->attrib[i].emit = get_emit_func(key->element[i].output_format); + else + tg->attrib[i].emit = NULL; } tg->nr_attrib = key->nr_elements; -- cgit v1.2.3 From 1cb92fb92e69b5b138293398a98665c2a3c63a5b Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Tue, 10 Aug 2010 10:27:14 +0200 Subject: translate_generic: factor out common code between linear and indexed This moves the common code into a separate ALWAYS_INLINE function. --- .../auxiliary/translate/translate_generic.c | 177 ++++++++------------- 1 file changed, 62 insertions(+), 115 deletions(-) (limited to 'src') diff --git a/src/gallium/auxiliary/translate/translate_generic.c b/src/gallium/auxiliary/translate/translate_generic.c index 9d2653920d..828b76dc77 100644 --- a/src/gallium/auxiliary/translate/translate_generic.c +++ b/src/gallium/auxiliary/translate/translate_generic.c @@ -362,6 +362,66 @@ static emit_func get_emit_func( enum pipe_format format ) } } +static ALWAYS_INLINE void PIPE_CDECL generic_run_one( struct translate_generic *tg, + unsigned elt, + unsigned instance_id, + void *vert ) +{ + unsigned nr_attrs = tg->nr_attrib; + unsigned attr; + + for (attr = 0; attr < nr_attrs; attr++) { + float data[4]; + char *dst = vert + tg->attrib[attr].output_offset; + + if (tg->attrib[attr].type == TRANSLATE_ELEMENT_NORMAL) { + const uint8_t *src; + unsigned index; + int copy_size; + + if (tg->attrib[attr].instance_divisor) { + index = instance_id / tg->attrib[attr].instance_divisor; + } + else { + index = elt; + } + + /* clamp to void going out of bounds */ + index = MIN2(index, tg->attrib[attr].max_index); + + src = tg->attrib[attr].input_ptr + + tg->attrib[attr].input_stride * index; + + copy_size = tg->attrib[attr].copy_size; + if(likely(copy_size >= 0)) + memcpy(dst, src, copy_size); + else + { + tg->attrib[attr].fetch( data, src, 0, 0 ); + + if (0) + debug_printf("Fetch linear attr %d from %p stride %d index %d: " + " %f, %f, %f, %f \n", + attr, + tg->attrib[attr].input_ptr, + tg->attrib[attr].input_stride, + index, + data[0], data[1],data[2], data[3]); + + tg->attrib[attr].emit( data, dst ); + } + } else { + if(likely(tg->attrib[attr].copy_size >= 0)) + memcpy(data, &instance_id, 4); + else + { + data[0] = (float)instance_id; + tg->attrib[attr].emit( data, dst ); + } + } + } +} + /** * Fetch vertex attributes for 'count' vertices. */ @@ -373,71 +433,14 @@ static void PIPE_CDECL generic_run_elts( struct translate *translate, { struct translate_generic *tg = translate_generic(translate); char *vert = output_buffer; - unsigned nr_attrs = tg->nr_attrib; - unsigned attr; unsigned i; - /* loop over vertex attributes (vertex shader inputs) - */ for (i = 0; i < count; i++) { - const unsigned elt = *elts++; - - for (attr = 0; attr < nr_attrs; attr++) { - float data[4]; - char *dst = vert + tg->attrib[attr].output_offset; - - if (tg->attrib[attr].type == TRANSLATE_ELEMENT_NORMAL) { - const uint8_t *src; - unsigned index; - int copy_size; - - if (tg->attrib[attr].instance_divisor) { - index = instance_id / tg->attrib[attr].instance_divisor; - } else { - index = elt; - } - - /* clamp to void going out of bounds */ - index = MIN2(index, tg->attrib[attr].max_index); - - src = tg->attrib[attr].input_ptr + - tg->attrib[attr].input_stride * index; - - copy_size = tg->attrib[attr].copy_size; - if(likely(copy_size >= 0)) - memcpy(dst, src, copy_size); - else - { - tg->attrib[attr].fetch( data, src, 0, 0 ); - - if (0) - debug_printf("Fetch elt attr %d from %p stride %d div %u max %u index %d: " - " %f, %f, %f, %f \n", - attr, - tg->attrib[attr].input_ptr, - tg->attrib[attr].input_stride, - tg->attrib[attr].instance_divisor, - tg->attrib[attr].max_index, - index, - data[0], data[1],data[2], data[3]); - tg->attrib[attr].emit( data, dst ); - } - } else { - if(likely(tg->attrib[attr].copy_size >= 0)) - memcpy(data, &instance_id, 4); - else - { - data[0] = (float)instance_id; - tg->attrib[attr].emit( data, dst ); - } - } - } + generic_run_one(tg, *elts++, instance_id, vert); vert += tg->translate.key.output_stride; } } - - static void PIPE_CDECL generic_run( struct translate *translate, unsigned start, unsigned count, @@ -446,66 +449,10 @@ static void PIPE_CDECL generic_run( struct translate *translate, { struct translate_generic *tg = translate_generic(translate); char *vert = output_buffer; - unsigned nr_attrs = tg->nr_attrib; - unsigned attr; unsigned i; - /* loop over vertex attributes (vertex shader inputs) - */ for (i = 0; i < count; i++) { - unsigned elt = start + i; - - for (attr = 0; attr < nr_attrs; attr++) { - float data[4]; - char *dst = vert + tg->attrib[attr].output_offset; - - if (tg->attrib[attr].type == TRANSLATE_ELEMENT_NORMAL) { - const uint8_t *src; - unsigned index; - int copy_size; - - if (tg->attrib[attr].instance_divisor) { - index = instance_id / tg->attrib[attr].instance_divisor; - } - else { - index = elt; - } - - /* clamp to void going out of bounds */ - index = MIN2(index, tg->attrib[attr].max_index); - - src = tg->attrib[attr].input_ptr + - tg->attrib[attr].input_stride * index; - - copy_size = tg->attrib[attr].copy_size; - if(likely(copy_size >= 0)) - memcpy(dst, src, copy_size); - else - { - tg->attrib[attr].fetch( data, src, 0, 0 ); - - if (0) - debug_printf("Fetch linear attr %d from %p stride %d index %d: " - " %f, %f, %f, %f \n", - attr, - tg->attrib[attr].input_ptr, - tg->attrib[attr].input_stride, - index, - data[0], data[1],data[2], data[3]); - - tg->attrib[attr].emit( data, dst ); - } - } else { - if(likely(tg->attrib[attr].copy_size >= 0)) - memcpy(data, &instance_id, 4); - else - { - data[0] = (float)instance_id; - tg->attrib[attr].emit( data, dst ); - } - } - } - + generic_run_one(tg, start + i, instance_id, vert); vert += tg->translate.key.output_stride; } } -- cgit v1.2.3 From 68e74f1b0110348a44f589739c6edf3fe8e2b368 Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Tue, 10 Aug 2010 10:31:48 +0200 Subject: translate_sse: remove useless generated function wrappers Currently translate_sse puts two trivial wrappers in the translate vtable. These slow it down and enlarge the source code for no gain, except perhaps the ability to set a breakpoint there, so remove them. Breakpoints can be set on the caller of the translate functions, with no loss of functionality. --- src/gallium/auxiliary/translate/translate_sse.c | 55 ++----------------------- 1 file changed, 4 insertions(+), 51 deletions(-) (limited to 'src') diff --git a/src/gallium/auxiliary/translate/translate_sse.c b/src/gallium/auxiliary/translate/translate_sse.c index ef3aa674a3..68c71f4251 100644 --- a/src/gallium/auxiliary/translate/translate_sse.c +++ b/src/gallium/auxiliary/translate/translate_sse.c @@ -46,18 +46,6 @@ #define W 3 -typedef void (PIPE_CDECL *run_func)( struct translate *translate, - unsigned start, - unsigned count, - unsigned instance_id, - void *output_buffer); - -typedef void (PIPE_CDECL *run_elts_func)( struct translate *translate, - const unsigned *elts, - unsigned count, - unsigned instance_id, - void *output_buffer); - struct translate_buffer { const void *base_ptr; unsigned stride; @@ -102,9 +90,6 @@ struct translate_sse { boolean use_instancing; unsigned instance_id; - run_func gen_run; - run_elts_func gen_run_elts; - /* these are actually known values, but putting them in a struct * like this is helpful to keep them in sync across the file. */ @@ -700,36 +685,6 @@ static void translate_sse_release( struct translate *translate ) FREE(p); } -static void PIPE_CDECL translate_sse_run_elts( struct translate *translate, - const unsigned *elts, - unsigned count, - unsigned instance_id, - void *output_buffer ) -{ - struct translate_sse *p = (struct translate_sse *)translate; - - p->gen_run_elts( translate, - elts, - count, - instance_id, - output_buffer); -} - -static void PIPE_CDECL translate_sse_run( struct translate *translate, - unsigned start, - unsigned count, - unsigned instance_id, - void *output_buffer ) -{ - struct translate_sse *p = (struct translate_sse *)translate; - - p->gen_run( translate, - start, - count, - instance_id, - output_buffer); -} - struct translate *translate_sse2_create( const struct translate_key *key ) { @@ -746,8 +701,6 @@ struct translate *translate_sse2_create( const struct translate_key *key ) p->translate.key = *key; p->translate.release = translate_sse_release; p->translate.set_buffer = translate_sse_set_buffer; - p->translate.run_elts = translate_sse_run_elts; - p->translate.run = translate_sse_run; for (i = 0; i < key->nr_elements; i++) { if (key->element[i].type == TRANSLATE_ELEMENT_NORMAL) { @@ -789,12 +742,12 @@ struct translate *translate_sse2_create( const struct translate_key *key ) if (!build_vertex_emit(p, &p->elt_func, FALSE)) goto fail; - p->gen_run = (run_func)x86_get_func(&p->linear_func); - if (p->gen_run == NULL) + p->translate.run = (void*)x86_get_func(&p->linear_func); + if (p->translate.run == NULL) goto fail; - p->gen_run_elts = (run_elts_func)x86_get_func(&p->elt_func); - if (p->gen_run_elts == NULL) + p->translate.run_elts = (void*)x86_get_func(&p->elt_func); + if (p->translate.run_elts == NULL) goto fail; return &p->translate; -- cgit v1.2.3 From 4a4e29a9ab96d44fca9bb25064e12715aac85cbd Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Tue, 10 Aug 2010 10:47:23 +0200 Subject: translate: add support for 8/16-bit indices Currently, only 32-bit indices are supported, but some use cases translate needs support for all types. --- src/gallium/auxiliary/rtasm/rtasm_x86sse.c | 14 +++++ src/gallium/auxiliary/rtasm/rtasm_x86sse.h | 2 + src/gallium/auxiliary/translate/translate.h | 12 ++++ .../auxiliary/translate/translate_generic.c | 34 +++++++++++ src/gallium/auxiliary/translate/translate_sse.c | 65 +++++++++++++++------- 5 files changed, 108 insertions(+), 19 deletions(-) (limited to 'src') diff --git a/src/gallium/auxiliary/rtasm/rtasm_x86sse.c b/src/gallium/auxiliary/rtasm/rtasm_x86sse.c index 9f70b73698..63007c1feb 100644 --- a/src/gallium/auxiliary/rtasm/rtasm_x86sse.c +++ b/src/gallium/auxiliary/rtasm/rtasm_x86sse.c @@ -586,6 +586,20 @@ void x86_mov( struct x86_function *p, emit_op_modrm( p, 0x8b, 0x89, dst, src ); } +void x86_movzx8(struct x86_function *p, struct x86_reg dst, struct x86_reg src ) +{ + DUMP_RR( dst, src ); + emit_2ub(p, 0x0f, 0xb6); + emit_modrm(p, dst, src); +} + +void x86_movzx16(struct x86_function *p, struct x86_reg dst, struct x86_reg src ) +{ + DUMP_RR( dst, src ); + emit_2ub(p, 0x0f, 0xb7); + emit_modrm(p, dst, src); +} + void x86_xor( struct x86_function *p, struct x86_reg dst, struct x86_reg src ) diff --git a/src/gallium/auxiliary/rtasm/rtasm_x86sse.h b/src/gallium/auxiliary/rtasm/rtasm_x86sse.h index 6208e8f707..365dec109e 100644 --- a/src/gallium/auxiliary/rtasm/rtasm_x86sse.h +++ b/src/gallium/auxiliary/rtasm/rtasm_x86sse.h @@ -237,6 +237,8 @@ void x86_dec( struct x86_function *p, struct x86_reg reg ); void x86_inc( struct x86_function *p, struct x86_reg reg ); void x86_lea( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); void x86_mov( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); +void x86_movzx8( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); +void x86_movzx16( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); void x86_mul( struct x86_function *p, struct x86_reg src ); void x86_imul( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); void x86_or( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); diff --git a/src/gallium/auxiliary/translate/translate.h b/src/gallium/auxiliary/translate/translate.h index eb6f2cc486..a75380228b 100644 --- a/src/gallium/auxiliary/translate/translate.h +++ b/src/gallium/auxiliary/translate/translate.h @@ -85,6 +85,18 @@ struct translate { unsigned instance_id, void *output_buffer); + void (PIPE_CDECL *run_elts16)( struct translate *, + const uint16_t *elts, + unsigned count, + unsigned instance_id, + void *output_buffer); + + void (PIPE_CDECL *run_elts8)( struct translate *, + const uint8_t *elts, + unsigned count, + unsigned instance_id, + void *output_buffer); + void (PIPE_CDECL *run)( struct translate *, unsigned start, unsigned count, diff --git a/src/gallium/auxiliary/translate/translate_generic.c b/src/gallium/auxiliary/translate/translate_generic.c index 828b76dc77..975f23a6f4 100644 --- a/src/gallium/auxiliary/translate/translate_generic.c +++ b/src/gallium/auxiliary/translate/translate_generic.c @@ -441,6 +441,38 @@ static void PIPE_CDECL generic_run_elts( struct translate *translate, } } +static void PIPE_CDECL generic_run_elts16( struct translate *translate, + const uint16_t *elts, + unsigned count, + unsigned instance_id, + void *output_buffer ) +{ + struct translate_generic *tg = translate_generic(translate); + char *vert = output_buffer; + unsigned i; + + for (i = 0; i < count; i++) { + generic_run_one(tg, *elts++, instance_id, vert); + vert += tg->translate.key.output_stride; + } +} + +static void PIPE_CDECL generic_run_elts8( struct translate *translate, + const uint8_t *elts, + unsigned count, + unsigned instance_id, + void *output_buffer ) +{ + struct translate_generic *tg = translate_generic(translate); + char *vert = output_buffer; + unsigned i; + + for (i = 0; i < count; i++) { + generic_run_one(tg, *elts++, instance_id, vert); + vert += tg->translate.key.output_stride; + } +} + static void PIPE_CDECL generic_run( struct translate *translate, unsigned start, unsigned count, @@ -498,6 +530,8 @@ struct translate *translate_generic_create( const struct translate_key *key ) tg->translate.release = generic_release; tg->translate.set_buffer = generic_set_buffer; tg->translate.run_elts = generic_run_elts; + tg->translate.run_elts16 = generic_run_elts16; + tg->translate.run_elts8 = generic_run_elts8; tg->translate.run = generic_run; for (i = 0; i < key->nr_elements; i++) { diff --git a/src/gallium/auxiliary/translate/translate_sse.c b/src/gallium/auxiliary/translate/translate_sse.c index 68c71f4251..f9aab9232c 100644 --- a/src/gallium/auxiliary/translate/translate_sse.c +++ b/src/gallium/auxiliary/translate/translate_sse.c @@ -67,6 +67,8 @@ struct translate_sse { struct x86_function linear_func; struct x86_function elt_func; + struct x86_function elt16_func; + struct x86_function elt8_func; struct x86_function *func; boolean loaded_identity; @@ -362,7 +364,7 @@ static boolean translate_attr( struct translate_sse *p, static boolean init_inputs( struct translate_sse *p, - boolean linear ) + unsigned index_size ) { unsigned i; struct x86_reg instance_id = x86_make_disp(p->machine_EDX, @@ -372,7 +374,7 @@ static boolean init_inputs( struct translate_sse *p, struct translate_buffer_varient *varient = &p->buffer_varient[i]; struct translate_buffer *buffer = &p->buffer[varient->buffer_index]; - if (linear || varient->instance_divisor) { + if (!index_size || varient->instance_divisor) { struct x86_reg buf_stride = x86_make_disp(p->machine_EDX, get_offset(p, &buffer->stride)); struct x86_reg buf_ptr = x86_make_disp(p->machine_EDX, @@ -421,7 +423,7 @@ static boolean init_inputs( struct translate_sse *p, /* In the linear case, keep the buffer pointer instead of the * index number. */ - if (linear && p->nr_buffer_varients == 1) + if (!index_size && p->nr_buffer_varients == 1) x86_mov(p->func, elt, tmp_EAX); else x86_mov(p->func, buf_ptr, tmp_EAX); @@ -433,7 +435,7 @@ static boolean init_inputs( struct translate_sse *p, static struct x86_reg get_buffer_ptr( struct translate_sse *p, - boolean linear, + unsigned index_size, unsigned var_idx, struct x86_reg elt ) { @@ -441,10 +443,10 @@ static struct x86_reg get_buffer_ptr( struct translate_sse *p, return x86_make_disp(p->machine_EDX, get_offset(p, &p->instance_id)); } - if (linear && p->nr_buffer_varients == 1) { + if (!index_size && p->nr_buffer_varients == 1) { return p->idx_EBX; } - else if (linear || p->buffer_varient[var_idx].instance_divisor) { + else if (!index_size || p->buffer_varient[var_idx].instance_divisor) { struct x86_reg ptr = p->tmp_EAX; struct x86_reg buf_ptr = x86_make_disp(p->machine_EDX, @@ -469,8 +471,19 @@ static struct x86_reg get_buffer_ptr( struct translate_sse *p, /* Calculate pointer to current attrib: */ - x86_mov(p->func, ptr, buf_stride); - x86_imul(p->func, ptr, elt); + switch(index_size) + { + case 1: + x86_movzx8(p->func, ptr, elt); + break; + case 2: + x86_movzx16(p->func, ptr, elt); + break; + case 4: + x86_mov(p->func, ptr, elt); + break; + } + x86_imul(p->func, ptr, buf_stride); x86_add(p->func, ptr, buf_base_ptr); return ptr; } @@ -479,9 +492,9 @@ static struct x86_reg get_buffer_ptr( struct translate_sse *p, static boolean incr_inputs( struct translate_sse *p, - boolean linear ) + unsigned index_size ) { - if (linear && p->nr_buffer_varients == 1) { + if (!index_size && p->nr_buffer_varients == 1) { struct x86_reg stride = x86_make_disp(p->machine_EDX, get_offset(p, &p->buffer[0].stride)); @@ -490,7 +503,7 @@ static boolean incr_inputs( struct translate_sse *p, sse_prefetchnta(p->func, x86_make_disp(p->idx_EBX, 192)); } } - else if (linear) { + else if (!index_size) { unsigned i; /* Is this worthwhile?? @@ -511,7 +524,7 @@ static boolean incr_inputs( struct translate_sse *p, } } else { - x86_lea(p->func, p->idx_EBX, x86_make_disp(p->idx_EBX, 4)); + x86_lea(p->func, p->idx_EBX, x86_make_disp(p->idx_EBX, index_size)); } return TRUE; @@ -536,7 +549,7 @@ static boolean incr_inputs( struct translate_sse *p, */ static boolean build_vertex_emit( struct translate_sse *p, struct x86_function *func, - boolean linear ) + unsigned index_size ) { int fixup, label; unsigned j; @@ -585,13 +598,13 @@ static boolean build_vertex_emit( struct translate_sse *p, /* always load, needed or not: */ - init_inputs(p, linear); + init_inputs(p, index_size); /* Note address for loop jump */ label = x86_get_label(p->func); { - struct x86_reg elt = linear ? p->idx_EBX : x86_deref(p->idx_EBX); + struct x86_reg elt = !index_size ? p->idx_EBX : x86_deref(p->idx_EBX); int last_varient = -1; struct x86_reg vb; @@ -603,7 +616,7 @@ static boolean build_vertex_emit( struct translate_sse *p, */ if (varient != last_varient) { last_varient = varient; - vb = get_buffer_ptr(p, linear, varient, elt); + vb = get_buffer_ptr(p, index_size, varient, elt); } if (!translate_attr( p, a, @@ -621,7 +634,7 @@ static boolean build_vertex_emit( struct translate_sse *p, /* Incr index */ - incr_inputs( p, linear ); + incr_inputs( p, index_size ); } /* decr count, loop if not zero @@ -736,10 +749,16 @@ struct translate *translate_sse2_create( const struct translate_key *key ) if (0) debug_printf("nr_buffers: %d\n", p->nr_buffers); - if (!build_vertex_emit(p, &p->linear_func, TRUE)) + if (!build_vertex_emit(p, &p->linear_func, 0)) + goto fail; + + if (!build_vertex_emit(p, &p->elt_func, 4)) + goto fail; + + if (!build_vertex_emit(p, &p->elt16_func, 2)) goto fail; - if (!build_vertex_emit(p, &p->elt_func, FALSE)) + if (!build_vertex_emit(p, &p->elt8_func, 1)) goto fail; p->translate.run = (void*)x86_get_func(&p->linear_func); @@ -750,6 +769,14 @@ struct translate *translate_sse2_create( const struct translate_key *key ) if (p->translate.run_elts == NULL) goto fail; + p->translate.run_elts16 = (void*)x86_get_func(&p->elt16_func); + if (p->translate.run_elts16 == NULL) + goto fail; + + p->translate.run_elts8 = (void*)x86_get_func(&p->elt8_func); + if (p->translate.run_elts8 == NULL) + goto fail; + return &p->translate; fail: -- cgit v1.2.3 From a3e6e50544de74558ceb7cd4b618c350cdef36c6 Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Thu, 12 Aug 2010 18:27:02 +0200 Subject: rtasm: add minimal x86-64 support and new instructions (v5) Changes in v5: - Add sse2_movdqa Changes in v4: - Use _WIN64 instead of WIN64 Changes in v3: - Add target and target caps functions, so that they could be different in principle from the current CPU and they don't need #ifs to check Changes in v2: - Win64 support (untested) - Use u_cpu_detect.h constants instead of #ifs This commit adds minimal x86-64 support: only movs between registers are supported for r8-r15, and x64_rexw() must be used to ask for 64-bit operations. It also adds several new instructions for the new translate_sse code. movdqa --- src/gallium/auxiliary/rtasm/rtasm_cpu.c | 6 +- src/gallium/auxiliary/rtasm/rtasm_x86sse.c | 484 +++++++++++++++++++++++++++-- src/gallium/auxiliary/rtasm/rtasm_x86sse.h | 101 +++++- 3 files changed, 551 insertions(+), 40 deletions(-) (limited to 'src') diff --git a/src/gallium/auxiliary/rtasm/rtasm_cpu.c b/src/gallium/auxiliary/rtasm/rtasm_cpu.c index 2e15751e50..0461c81550 100644 --- a/src/gallium/auxiliary/rtasm/rtasm_cpu.c +++ b/src/gallium/auxiliary/rtasm/rtasm_cpu.c @@ -30,7 +30,7 @@ #include "rtasm_cpu.h" -#if defined(PIPE_ARCH_X86) +#if defined(PIPE_ARCH_X86) || defined(PIPE_ARCH_X86_64) static boolean rtasm_sse_enabled(void) { static boolean firsttime = 1; @@ -49,7 +49,7 @@ static boolean rtasm_sse_enabled(void) int rtasm_cpu_has_sse(void) { /* FIXME: actually detect this at run-time */ -#if defined(PIPE_ARCH_X86) +#if defined(PIPE_ARCH_X86) || defined(PIPE_ARCH_X86_64) return rtasm_sse_enabled(); #else return 0; @@ -59,7 +59,7 @@ int rtasm_cpu_has_sse(void) int rtasm_cpu_has_sse2(void) { /* FIXME: actually detect this at run-time */ -#if defined(PIPE_ARCH_X86) +#if defined(PIPE_ARCH_X86) || defined(PIPE_ARCH_X86_64) return rtasm_sse_enabled(); #else return 0; diff --git a/src/gallium/auxiliary/rtasm/rtasm_x86sse.c b/src/gallium/auxiliary/rtasm/rtasm_x86sse.c index 63007c1feb..0fe6ebfcb4 100644 --- a/src/gallium/auxiliary/rtasm/rtasm_x86sse.c +++ b/src/gallium/auxiliary/rtasm/rtasm_x86sse.c @@ -22,8 +22,9 @@ **************************************************************************/ #include "pipe/p_config.h" +#include "util/u_cpu_detect.h" -#if defined(PIPE_ARCH_X86) +#if defined(PIPE_ARCH_X86) || defined(PIPE_ARCH_X86_64) #include "pipe/p_compiler.h" #include "util/u_debug.h" @@ -231,6 +232,10 @@ static void emit_modrm( struct x86_function *p, assert(reg.mod == mod_REG); + /* TODO: support extended x86-64 registers */ + assert(reg.idx < 8); + assert(regmem.idx < 8); + val |= regmem.mod << 6; /* mod field */ val |= reg.idx << 3; /* reg field */ val |= regmem.idx; /* r/m field */ @@ -363,6 +368,12 @@ int x86_get_label( struct x86_function *p ) */ +void x64_rexw(struct x86_function *p) +{ + if(x86_target(p) != X86_32) + emit_1ub(p, 0x48); +} + void x86_jcc( struct x86_function *p, enum x86_cc cc, int label ) @@ -449,6 +460,52 @@ void x86_mov_reg_imm( struct x86_function *p, struct x86_reg dst, int imm ) emit_1i(p, imm); } +void x86_mov_imm( struct x86_function *p, struct x86_reg dst, int imm ) +{ + DUMP_RI( dst, imm ); + if(dst.mod == mod_REG) + x86_mov_reg_imm(p, dst, imm); + else + { + emit_1ub(p, 0xc7); + emit_modrm_noreg(p, 0, dst); + emit_1i(p, imm); + } +} + +void x86_mov16_imm( struct x86_function *p, struct x86_reg dst, uint16_t imm ) +{ + DUMP_RI( dst, imm ); + emit_1ub(p, 0x66); + if(dst.mod == mod_REG) + { + emit_1ub(p, 0xb8 + dst.idx); + emit_2ub(p, imm & 0xff, imm >> 8); + } + else + { + emit_1ub(p, 0xc7); + emit_modrm_noreg(p, 0, dst); + emit_2ub(p, imm & 0xff, imm >> 8); + } +} + +void x86_mov8_imm( struct x86_function *p, struct x86_reg dst, uint8_t imm ) +{ + DUMP_RI( dst, imm ); + if(dst.mod == mod_REG) + { + emit_1ub(p, 0xb0 + dst.idx); + emit_1ub(p, imm); + } + else + { + emit_1ub(p, 0xc6); + emit_modrm_noreg(p, 0, dst); + emit_1ub(p, imm); + } +} + /** * Immediate group 1 instructions. */ @@ -520,7 +577,7 @@ void x86_push( struct x86_function *p, } - p->stack_offset += 4; + p->stack_offset += sizeof(void*); } void x86_push_imm32( struct x86_function *p, @@ -530,7 +587,7 @@ void x86_push_imm32( struct x86_function *p, emit_1ub(p, 0x68); emit_1i(p, imm32); - p->stack_offset += 4; + p->stack_offset += sizeof(void*); } @@ -540,23 +597,33 @@ void x86_pop( struct x86_function *p, DUMP_R( reg ); assert(reg.mod == mod_REG); emit_1ub(p, 0x58 + reg.idx); - p->stack_offset -= 4; + p->stack_offset -= sizeof(void*); } void x86_inc( struct x86_function *p, struct x86_reg reg ) { DUMP_R( reg ); - assert(reg.mod == mod_REG); - emit_1ub(p, 0x40 + reg.idx); + if(x86_target(p) == X86_32 && reg.mod == mod_REG) + { + emit_1ub(p, 0x40 + reg.idx); + return; + } + emit_1ub(p, 0xff); + emit_modrm_noreg(p, 0, reg); } void x86_dec( struct x86_function *p, struct x86_reg reg ) { DUMP_R( reg ); - assert(reg.mod == mod_REG); - emit_1ub(p, 0x48 + reg.idx); + if(x86_target(p) == X86_32 && reg.mod == mod_REG) + { + emit_1ub(p, 0x48 + reg.idx); + return; + } + emit_1ub(p, 0xff); + emit_modrm_noreg(p, 1, reg); } void x86_ret( struct x86_function *p ) @@ -583,6 +650,65 @@ void x86_mov( struct x86_function *p, struct x86_reg src ) { DUMP_RR( dst, src ); + /* special hack for reading arguments until we support x86-64 registers everywhere */ + if(src.mod == mod_REG && dst.mod == mod_REG && (src.idx >= 8 || dst.idx >= 8)) + { + uint8_t rex = 0x40; + if(dst.idx >= 8) + { + rex |= 4; + dst.idx -= 8; + } + if(src.idx >= 8) + { + rex |= 1; + src.idx -= 8; + } + emit_1ub(p, rex); + } + emit_op_modrm( p, 0x8b, 0x89, dst, src ); +} + +void x86_mov16( struct x86_function *p, + struct x86_reg dst, + struct x86_reg src ) +{ + DUMP_RR( dst, src ); + emit_1ub(p, 0x66); + emit_op_modrm( p, 0x8b, 0x89, dst, src ); +} + +void x86_mov8( struct x86_function *p, + struct x86_reg dst, + struct x86_reg src ) +{ + DUMP_RR( dst, src ); + emit_op_modrm( p, 0x8a, 0x88, dst, src ); +} + +void x64_mov64( struct x86_function *p, + struct x86_reg dst, + struct x86_reg src ) +{ + uint8_t rex = 0x48; + DUMP_RR( dst, src ); + assert(x86_target(p) != X86_32); + + /* special hack for reading arguments until we support x86-64 registers everywhere */ + if(src.mod == mod_REG && dst.mod == mod_REG && (src.idx >= 8 || dst.idx >= 8)) + { + if(dst.idx >= 8) + { + rex |= 4; + dst.idx -= 8; + } + if(src.idx >= 8) + { + rex |= 1; + src.idx -= 8; + } + } + emit_1ub(p, rex); emit_op_modrm( p, 0x8b, 0x89, dst, src ); } @@ -694,6 +820,61 @@ void x86_div( struct x86_function *p, emit_op_modrm(p, 0xf7, 0, x86_make_reg(file_REG32, 6), src); } +void x86_bswap( struct x86_function *p, struct x86_reg reg ) +{ + DUMP_R(reg); + assert(reg.file == file_REG32); + assert(reg.mod == mod_REG); + emit_2ub(p, 0x0f, 0xc8 + reg.idx); +} + +void x86_shr_imm( struct x86_function *p, struct x86_reg reg, unsigned imm ) +{ + DUMP_RI(reg, imm); + if(imm == 1) + { + emit_1ub(p, 0xd1); + emit_modrm_noreg(p, 5, reg); + } + else + { + emit_1ub(p, 0xc1); + emit_modrm_noreg(p, 5, reg); + emit_1ub(p, imm); + } +} + +void x86_sar_imm( struct x86_function *p, struct x86_reg reg, unsigned imm ) +{ + DUMP_RI(reg, imm); + if(imm == 1) + { + emit_1ub(p, 0xd1); + emit_modrm_noreg(p, 7, reg); + } + else + { + emit_1ub(p, 0xc1); + emit_modrm_noreg(p, 7, reg); + emit_1ub(p, imm); + } +} + +void x86_shl_imm( struct x86_function *p, struct x86_reg reg, unsigned imm ) +{ + DUMP_RI(reg, imm); + if(imm == 1) + { + emit_1ub(p, 0xd1); + emit_modrm_noreg(p, 4, reg); + } + else + { + emit_1ub(p, 0xc1); + emit_modrm_noreg(p, 4, reg); + emit_1ub(p, imm); + } +} /*********************************************************************** @@ -1027,6 +1208,77 @@ void sse_movmskps( struct x86_function *p, * SSE2 instructions */ +void sse2_movd( struct x86_function *p, struct x86_reg dst, struct x86_reg src ) +{ + DUMP_RR(dst, src); + emit_2ub(p, 0x66, 0x0f); + if(dst.mod == mod_REG && dst.file == file_REG32) + { + emit_1ub(p, 0x7e); + emit_modrm(p, src, dst); + } + else + { + emit_op_modrm(p, 0x6e, 0x7e, dst, src); + } +} + +void sse2_movq( struct x86_function *p, struct x86_reg dst, struct x86_reg src ) +{ + DUMP_RR(dst, src); + switch (dst.mod) { + case mod_REG: + emit_3ub(p, 0xf3, 0x0f, 0x7e); + emit_modrm(p, dst, src); + break; + case mod_INDIRECT: + case mod_DISP32: + case mod_DISP8: + assert(src.mod == mod_REG); + emit_3ub(p, 0x66, 0x0f, 0xd6); + emit_modrm(p, src, dst); + break; + default: + assert(0); + break; + } +} + +void sse2_movdqu( struct x86_function *p, struct x86_reg dst, struct x86_reg src ) +{ + DUMP_RR(dst, src); + emit_2ub(p, 0xf3, 0x0f); + emit_op_modrm(p, 0x6f, 0x7f, dst, src); +} + +void sse2_movdqa( struct x86_function *p, struct x86_reg dst, struct x86_reg src ) +{ + DUMP_RR(dst, src); + emit_2ub(p, 0x66, 0x0f); + emit_op_modrm(p, 0x6f, 0x7f, dst, src); +} + +void sse2_movsd( struct x86_function *p, struct x86_reg dst, struct x86_reg src ) +{ + DUMP_RR(dst, src); + emit_2ub(p, 0xf2, 0x0f); + emit_op_modrm(p, 0x10, 0x11, dst, src); +} + +void sse2_movupd( struct x86_function *p, struct x86_reg dst, struct x86_reg src ) +{ + DUMP_RR(dst, src); + emit_2ub(p, 0x66, 0x0f); + emit_op_modrm(p, 0x10, 0x11, dst, src); +} + +void sse2_movapd( struct x86_function *p, struct x86_reg dst, struct x86_reg src ) +{ + DUMP_RR(dst, src); + emit_2ub(p, 0x66, 0x0f); + emit_op_modrm(p, 0x28, 0x29, dst, src); +} + /** * Perform a reduced swizzle: */ @@ -1041,6 +1293,28 @@ void sse2_pshufd( struct x86_function *p, emit_1ub(p, shuf); } +void sse2_pshuflw( struct x86_function *p, + struct x86_reg dst, + struct x86_reg src, + unsigned char shuf) +{ + DUMP_RRI( dst, src, shuf ); + emit_3ub(p, 0xf2, X86_TWOB, 0x70); + emit_modrm(p, dst, src); + emit_1ub(p, shuf); +} + +void sse2_pshufhw( struct x86_function *p, + struct x86_reg dst, + struct x86_reg src, + unsigned char shuf) +{ + DUMP_RRI( dst, src, shuf ); + emit_3ub(p, 0xf3, X86_TWOB, 0x70); + emit_modrm(p, dst, src); + emit_1ub(p, shuf); +} + void sse2_cvttps2dq( struct x86_function *p, struct x86_reg dst, struct x86_reg src ) @@ -1059,6 +1333,24 @@ void sse2_cvtps2dq( struct x86_function *p, emit_modrm( p, dst, src ); } +void sse2_cvtsd2ss( struct x86_function *p, + struct x86_reg dst, + struct x86_reg src ) +{ + DUMP_RR( dst, src ); + emit_3ub(p, 0xf2, 0x0f, 0x5a); + emit_modrm( p, dst, src ); +} + +void sse2_cvtpd2ps( struct x86_function *p, + struct x86_reg dst, + struct x86_reg src ) +{ + DUMP_RR( dst, src ); + emit_3ub(p, 0x66, 0x0f, 0x5a); + emit_modrm( p, dst, src ); +} + void sse2_packssdw( struct x86_function *p, struct x86_reg dst, struct x86_reg src ) @@ -1095,6 +1387,97 @@ void sse2_punpcklbw( struct x86_function *p, emit_modrm( p, dst, src ); } +void sse2_punpcklwd( struct x86_function *p, struct x86_reg dst, struct x86_reg src ) +{ + DUMP_RR( dst, src ); + emit_3ub(p, 0x66, 0x0f, 0x61); + emit_modrm( p, dst, src ); +} + +void sse2_punpckldq( struct x86_function *p, struct x86_reg dst, struct x86_reg src ) +{ + DUMP_RR( dst, src ); + emit_3ub(p, 0x66, 0x0f, 0x62); + emit_modrm( p, dst, src ); +} + +void sse2_punpcklqdq( struct x86_function *p, struct x86_reg dst, struct x86_reg src ) +{ + DUMP_RR( dst, src ); + emit_3ub(p, 0x66, 0x0f, 0x6c); + emit_modrm( p, dst, src ); +} + +void sse2_psllw_imm( struct x86_function *p, struct x86_reg dst, unsigned imm ) +{ + DUMP_RI(dst, imm); + emit_3ub(p, 0x66, 0x0f, 0x71); + emit_modrm_noreg(p, 6, dst); + emit_1ub(p, imm); +} + +void sse2_pslld_imm( struct x86_function *p, struct x86_reg dst, unsigned imm ) +{ + DUMP_RI(dst, imm); + emit_3ub(p, 0x66, 0x0f, 0x72); + emit_modrm_noreg(p, 6, dst); + emit_1ub(p, imm); +} + +void sse2_psllq_imm( struct x86_function *p, struct x86_reg dst, unsigned imm ) +{ + DUMP_RI(dst, imm); + emit_3ub(p, 0x66, 0x0f, 0x73); + emit_modrm_noreg(p, 6, dst); + emit_1ub(p, imm); +} + +void sse2_psrlw_imm( struct x86_function *p, struct x86_reg dst, unsigned imm ) +{ + DUMP_RI(dst, imm); + emit_3ub(p, 0x66, 0x0f, 0x71); + emit_modrm_noreg(p, 2, dst); + emit_1ub(p, imm); +} + +void sse2_psrld_imm( struct x86_function *p, struct x86_reg dst, unsigned imm ) +{ + DUMP_RI(dst, imm); + emit_3ub(p, 0x66, 0x0f, 0x72); + emit_modrm_noreg(p, 2, dst); + emit_1ub(p, imm); +} + +void sse2_psrlq_imm( struct x86_function *p, struct x86_reg dst, unsigned imm ) +{ + DUMP_RI(dst, imm); + emit_3ub(p, 0x66, 0x0f, 0x73); + emit_modrm_noreg(p, 2, dst); + emit_1ub(p, imm); +} + +void sse2_psraw_imm( struct x86_function *p, struct x86_reg dst, unsigned imm ) +{ + DUMP_RI(dst, imm); + emit_3ub(p, 0x66, 0x0f, 0x71); + emit_modrm_noreg(p, 4, dst); + emit_1ub(p, imm); +} + +void sse2_psrad_imm( struct x86_function *p, struct x86_reg dst, unsigned imm ) +{ + DUMP_RI(dst, imm); + emit_3ub(p, 0x66, 0x0f, 0x72); + emit_modrm_noreg(p, 4, dst); + emit_1ub(p, imm); +} + +void sse2_por( struct x86_function *p, struct x86_reg dst, struct x86_reg src ) +{ + DUMP_RR(dst, src); + emit_3ub(p, 0x66, 0x0f, 0xeb); + emit_modrm(p, dst, src); +} void sse2_rcpps( struct x86_function *p, struct x86_reg dst, @@ -1114,18 +1497,6 @@ void sse2_rcpss( struct x86_function *p, emit_modrm( p, dst, src ); } -void sse2_movd( struct x86_function *p, - struct x86_reg dst, - struct x86_reg src ) -{ - DUMP_RR( dst, src ); - emit_2ub(p, 0x66, X86_TWOB); - emit_op_modrm( p, 0x6e, 0x7e, dst, src ); -} - - - - /*********************************************************************** * x87 instructions */ @@ -1716,23 +2087,79 @@ void x86_cdecl_caller_pop_regs( struct x86_function *p ) } -/* Retreive a reference to one of the function arguments, taking into - * account any push/pop activity: - */ struct x86_reg x86_fn_arg( struct x86_function *p, - unsigned arg ) + unsigned arg ) { - return x86_make_disp(x86_make_reg(file_REG32, reg_SP), + switch(x86_target(p)) + { + case X86_64_WIN64_ABI: + /* Microsoft uses a different calling convention than the rest of the world */ + switch(arg) + { + case 1: + return x86_make_reg(file_REG32, reg_CX); + case 2: + return x86_make_reg(file_REG32, reg_DX); + case 3: + return x86_make_reg(file_REG32, reg_R8); + case 4: + return x86_make_reg(file_REG32, reg_R9); + default: + return x86_make_disp(x86_make_reg(file_REG32, reg_SP), + p->stack_offset + (arg - 4) * 8); /* ??? */ + } + case X86_64_STD_ABI: + switch(arg) + { + case 1: + return x86_make_reg(file_REG32, reg_DI); + case 2: + return x86_make_reg(file_REG32, reg_SI); + case 3: + return x86_make_reg(file_REG32, reg_DX); + case 4: + return x86_make_reg(file_REG32, reg_CX); + case 5: + return x86_make_reg(file_REG32, reg_R8); + case 6: + return x86_make_reg(file_REG32, reg_R9); + default: + return x86_make_disp(x86_make_reg(file_REG32, reg_SP), + p->stack_offset + (arg - 6) * 8); /* ??? */ + } + case X86_32: + return x86_make_disp(x86_make_reg(file_REG32, reg_SP), p->stack_offset + arg * 4); /* ??? */ + default: + abort(); + } } +static void x86_init_func_common( struct x86_function *p ) +{ + util_cpu_detect(); + p->caps = 0; + if(util_cpu_caps.has_mmx) + p->caps |= X86_MMX; + if(util_cpu_caps.has_mmx2) + p->caps |= X86_MMX2; + if(util_cpu_caps.has_sse) + p->caps |= X86_SSE; + if(util_cpu_caps.has_sse2) + p->caps |= X86_SSE2; + if(util_cpu_caps.has_sse3) + p->caps |= X86_SSE3; + if(util_cpu_caps.has_sse4_1) + p->caps |= X86_SSE4_1; + p->csr = p->store; + DUMP_START(); +} void x86_init_func( struct x86_function *p ) { p->size = 0; p->store = NULL; - p->csr = p->store; - DUMP_START(); + x86_init_func_common(p); } void x86_init_func_size( struct x86_function *p, unsigned code_size ) @@ -1742,8 +2169,7 @@ void x86_init_func_size( struct x86_function *p, unsigned code_size ) if (p->store == NULL) { p->store = p->error_overflow; } - p->csr = p->store; - DUMP_START(); + x86_init_func_common(p); } void x86_release_func( struct x86_function *p ) diff --git a/src/gallium/auxiliary/rtasm/rtasm_x86sse.h b/src/gallium/auxiliary/rtasm/rtasm_x86sse.h index 365dec109e..aa77892b2d 100644 --- a/src/gallium/auxiliary/rtasm/rtasm_x86sse.h +++ b/src/gallium/auxiliary/rtasm/rtasm_x86sse.h @@ -26,20 +26,28 @@ #include "pipe/p_config.h" -#if defined(PIPE_ARCH_X86) +#if defined(PIPE_ARCH_X86) || defined(PIPE_ARCH_X86_64) /* It is up to the caller to ensure that instructions issued are * suitable for the host cpu. There are no checks made in this module * for mmx/sse/sse2 support on the cpu. */ struct x86_reg { - unsigned file:3; - unsigned idx:3; + unsigned file:2; + unsigned idx:4; unsigned mod:2; /* mod_REG if this is just a register */ int disp:24; /* only +/- 23bits of offset - should be enough... */ }; +#define X86_MMX 1 +#define X86_MMX2 2 +#define X86_SSE 4 +#define X86_SSE2 8 +#define X86_SSE3 0x10 +#define X86_SSE4_1 0x20 + struct x86_function { + unsigned caps; unsigned size; unsigned char *store; unsigned char *csr; @@ -75,7 +83,15 @@ enum x86_reg_name { reg_SP, reg_BP, reg_SI, - reg_DI + reg_DI, + reg_R8, + reg_R9, + reg_R10, + reg_R11, + reg_R12, + reg_R13, + reg_R14, + reg_R15 }; @@ -110,6 +126,29 @@ typedef void (*x86_func)(void); /* Begin/end/retrieve function creation: */ +enum x86_target +{ + X86_32, + X86_64_STD_ABI, + X86_64_WIN64_ABI +}; + +/* make this read a member of x86_function if target != host is desired */ +static INLINE enum x86_target x86_target( struct x86_function* p ) +{ +#ifdef PIPE_ARCH_X86 + return X86_32; +#elif defined(_WIN64) + return X86_64_WIN64_ABI; +#elif defined(PIPE_ARCH_X86_64) + return X86_64_STD_ABI; +#endif +} + +static INLINE unsigned x86_target_caps( struct x86_function* p ) +{ + return p->caps; +} void x86_init_func( struct x86_function *p ); void x86_init_func_size( struct x86_function *p, unsigned code_size ); @@ -138,6 +177,8 @@ struct x86_reg x86_get_base_reg( struct x86_reg reg ); */ int x86_get_label( struct x86_function *p ); +void x64_rexw(struct x86_function *p); + void x86_jcc( struct x86_function *p, enum x86_cc cc, int label ); @@ -178,18 +219,54 @@ void mmx_movq( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); void mmx_packssdw( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); void mmx_packuswb( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); +void sse2_movd( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); +void sse2_movq( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); +void sse2_movdqu( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); +void sse2_movdqa( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); +void sse2_movsd( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); +void sse2_movupd( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); +void sse2_movapd( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); + void sse2_cvtps2dq( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); void sse2_cvttps2dq( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); void sse2_cvtdq2ps( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); +void sse2_cvtsd2ss( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); +void sse2_cvtpd2ps( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); + void sse2_movd( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); void sse2_packssdw( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); void sse2_packsswb( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); void sse2_packuswb( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); void sse2_pshufd( struct x86_function *p, struct x86_reg dest, struct x86_reg arg0, unsigned char shuf ); +void sse2_pshuflw( struct x86_function *p, struct x86_reg dest, struct x86_reg arg0, + unsigned char shuf ); +void sse2_pshufhw( struct x86_function *p, struct x86_reg dest, struct x86_reg arg0, + unsigned char shuf ); void sse2_rcpps( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); void sse2_rcpss( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); +void sse2_punpcklbw( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); +void sse2_punpcklwd( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); +void sse2_punpckldq( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); +void sse2_punpcklqdq( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); + +void sse2_psllw_imm( struct x86_function *p, struct x86_reg dst, unsigned imm ); +void sse2_pslld_imm( struct x86_function *p, struct x86_reg dst, unsigned imm ); +void sse2_psllq_imm( struct x86_function *p, struct x86_reg dst, unsigned imm ); + +void sse2_psrlw_imm( struct x86_function *p, struct x86_reg dst, unsigned imm ); +void sse2_psrld_imm( struct x86_function *p, struct x86_reg dst, unsigned imm ); +void sse2_psrlq_imm( struct x86_function *p, struct x86_reg dst, unsigned imm ); + +void sse2_psraw_imm( struct x86_function *p, struct x86_reg dst, unsigned imm ); +void sse2_psrad_imm( struct x86_function *p, struct x86_reg dst, unsigned imm ); + +void sse2_por( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); + +void sse2_pshuflw( struct x86_function *p, struct x86_reg dst, struct x86_reg src, uint8_t imm ); +void sse2_pshufhw( struct x86_function *p, struct x86_reg dst, struct x86_reg src, uint8_t imm ); +void sse2_pshufd( struct x86_function *p, struct x86_reg dst, struct x86_reg src, uint8_t imm ); void sse_prefetchnta( struct x86_function *p, struct x86_reg ptr); void sse_prefetch0( struct x86_function *p, struct x86_reg ptr); @@ -227,7 +304,6 @@ void sse_shufps( struct x86_function *p, struct x86_reg dest, struct x86_reg arg void sse_unpckhps( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); void sse_unpcklps( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); void sse_pmovmskb( struct x86_function *p, struct x86_reg dest, struct x86_reg src ); -void sse2_punpcklbw( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); void sse_movmskps( struct x86_function *p, struct x86_reg dst, struct x86_reg src); void x86_add( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); @@ -237,8 +313,14 @@ void x86_dec( struct x86_function *p, struct x86_reg reg ); void x86_inc( struct x86_function *p, struct x86_reg reg ); void x86_lea( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); void x86_mov( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); -void x86_movzx8( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); -void x86_movzx16( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); +void x64_mov64( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); +void x86_mov8( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); +void x86_mov16( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); +void x86_movzx8(struct x86_function *p, struct x86_reg dst, struct x86_reg src ); +void x86_movzx16(struct x86_function *p, struct x86_reg dst, struct x86_reg src ); +void x86_mov_imm(struct x86_function *p, struct x86_reg dst, int imm ); +void x86_mov8_imm(struct x86_function *p, struct x86_reg dst, uint8_t imm ); +void x86_mov16_imm(struct x86_function *p, struct x86_reg dst, uint16_t imm ); void x86_mul( struct x86_function *p, struct x86_reg src ); void x86_imul( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); void x86_or( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); @@ -252,7 +334,10 @@ void x86_test( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); void x86_xor( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); void x86_sahf( struct x86_function *p ); void x86_div( struct x86_function *p, struct x86_reg src ); - +void x86_bswap( struct x86_function *p, struct x86_reg src ); +void x86_shr_imm( struct x86_function *p, struct x86_reg reg, unsigned imm ); +void x86_sar_imm( struct x86_function *p, struct x86_reg reg, unsigned imm ); +void x86_shl_imm( struct x86_function *p, struct x86_reg reg, unsigned imm ); void x86_cdecl_caller_push_regs( struct x86_function *p ); void x86_cdecl_caller_pop_regs( struct x86_function *p ); -- cgit v1.2.3 From c2da8e77023325f46dde2009def2947b1a687c7b Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Tue, 10 Aug 2010 02:14:04 +0200 Subject: translate_sse: major rewrite (v5) NOTE: Win64 is untested, and is thus currently disabled. If you have such a system, please enable it and report whether it works. To enable it, change src/gallium/auxiliary/translate/translate.c Changes in v5: - On Win64, preserve %xmm6 and %xmm7 as required by the ABI - Use _WIN64 instead of WIN64 Changes in v4: - Use x86_target() and x86_target_caps() - Enable translate_sse in x86-64, but not in Win64 Changes in v3: - Win64 support (untested) - Use u_cpu_detect.h constants instead of #ifs Changes in v2: - Minimize #ifs - Give a name to magic number CHANNELS_0001 - Add support for CPUs without SSE (only memcpy and swizzles, like non SSE2) - Fixed comments translate_sse is currently very limited to the point of being useless in essentially all cases. In particular, it only support some float32 and unorm8 formats and doesn't work on x86-64. This commit rewrites it to support: 1. Dumb memory copy for any pair of identical formats 2. All formats that are swizzles of each other 3. Converting 32/64-bit floats and all 8/16/32-bit integers to 32-bit float 4. Converting unorm8/snorm8 to snorm16 and uscaled8/sscaled8 to sscaled16 5. Support for x86-64 (doesn't take advantage of it in any way though) This new translate can even be useful to translate index buffers for cards that lack 8-bit index support. It passes the testsuite I wrote, but note that this is a major change, and more testing would be great. --- src/gallium/auxiliary/translate/translate.c | 3 +- src/gallium/auxiliary/translate/translate_sse.c | 1172 ++++++++++++++++++----- 2 files changed, 936 insertions(+), 239 deletions(-) (limited to 'src') diff --git a/src/gallium/auxiliary/translate/translate.c b/src/gallium/auxiliary/translate/translate.c index fe638e211f..03a7f050aa 100644 --- a/src/gallium/auxiliary/translate/translate.c +++ b/src/gallium/auxiliary/translate/translate.c @@ -38,7 +38,8 @@ struct translate *translate_create( const struct translate_key *key ) { struct translate *translate = NULL; -#if defined(PIPE_ARCH_X86) +/* TODO: enable Win64 once it has actually been tested */ +#if defined(PIPE_ARCH_X86) || (defined(PIPE_ARCH_X86_64) && !defined(_WIN64)) translate = translate_sse2_create( key ); if (translate) return translate; diff --git a/src/gallium/auxiliary/translate/translate_sse.c b/src/gallium/auxiliary/translate/translate_sse.c index f9aab9232c..c06197c5d6 100644 --- a/src/gallium/auxiliary/translate/translate_sse.c +++ b/src/gallium/auxiliary/translate/translate_sse.c @@ -30,11 +30,12 @@ #include "pipe/p_compiler.h" #include "util/u_memory.h" #include "util/u_math.h" +#include "util/u_format.h" #include "translate.h" -#if defined(PIPE_ARCH_X86) +#if defined(PIPE_ARCH_X86) || defined(PIPE_ARCH_X86_64) #include "rtasm/rtasm_cpu.h" #include "rtasm/rtasm_x86sse.h" @@ -48,7 +49,7 @@ struct translate_buffer { const void *base_ptr; - unsigned stride; + uintptr_t stride; unsigned max_index; }; @@ -72,12 +73,10 @@ struct translate_sse { struct x86_function *func; boolean loaded_identity; - boolean loaded_255; - boolean loaded_inv_255; + boolean loaded_const[5]; float identity[4]; - float float_255[4]; - float inv_255[4]; + float const_value[5][4]; struct translate_buffer buffer[PIPE_MAX_ATTRIBS]; unsigned nr_buffers; @@ -96,10 +95,12 @@ struct translate_sse { * like this is helpful to keep them in sync across the file. */ struct x86_reg tmp_EAX; - struct x86_reg idx_EBX; /* either start+i or &elt[i] */ - struct x86_reg outbuf_ECX; - struct x86_reg machine_EDX; - struct x86_reg count_ESI; /* decrements to zero */ + struct x86_reg tmp2_EDX; + struct x86_reg tmp3_ECX; + struct x86_reg idx_ESI; /* either start+i or &elt[i] */ + struct x86_reg machine_EDI; + struct x86_reg outbuf_EBX; + struct x86_reg count_EBP; /* decrements to zero */ }; static int get_offset( const void *a, const void *b ) @@ -111,7 +112,7 @@ static int get_offset( const void *a, const void *b ) static struct x86_reg get_identity( struct translate_sse *p ) { - struct x86_reg reg = x86_make_reg(file_XMM, 6); + struct x86_reg reg = x86_make_reg(file_XMM, 7); if (!p->loaded_identity) { p->loaded_identity = TRUE; @@ -121,253 +122,910 @@ static struct x86_reg get_identity( struct translate_sse *p ) p->identity[3] = 1; sse_movups(p->func, reg, - x86_make_disp(p->machine_EDX, + x86_make_disp(p->machine_EDI, get_offset(p, &p->identity[0]))); } return reg; } -static struct x86_reg get_255( struct translate_sse *p ) +static struct x86_reg get_const( struct translate_sse *p, unsigned i, float v) { - struct x86_reg reg = x86_make_reg(file_XMM, 7); - - if (!p->loaded_255) { - p->loaded_255 = TRUE; - p->float_255[0] = - p->float_255[1] = - p->float_255[2] = - p->float_255[3] = 255.0f; - - sse_movups(p->func, reg, - x86_make_disp(p->machine_EDX, - get_offset(p, &p->float_255[0]))); + struct x86_reg reg = x86_make_reg(file_XMM, 2 + i); + + if (!p->loaded_const[i]) { + p->loaded_const[i] = TRUE; + p->const_value[i][0] = + p->const_value[i][1] = + p->const_value[i][2] = + p->const_value[i][3] = v; + + sse_movups(p->func, reg, + x86_make_disp(p->machine_EDI, + get_offset(p, &p->const_value[i][0]))); } return reg; } -static struct x86_reg get_inv_255( struct translate_sse *p ) +static struct x86_reg get_inv_127( struct translate_sse *p ) { - struct x86_reg reg = x86_make_reg(file_XMM, 5); - - if (!p->loaded_inv_255) { - p->loaded_inv_255 = TRUE; - p->inv_255[0] = - p->inv_255[1] = - p->inv_255[2] = - p->inv_255[3] = 1.0f / 255.0f; - - sse_movups(p->func, reg, - x86_make_disp(p->machine_EDX, - get_offset(p, &p->inv_255[0]))); - } - - return reg; + return get_const(p, 0, 1.0f / 127.0f); } - -static void emit_load_R32G32B32A32( struct translate_sse *p, - struct x86_reg data, - struct x86_reg arg0 ) +static struct x86_reg get_inv_255( struct translate_sse *p ) { - sse_movups(p->func, data, arg0); + return get_const(p, 1, 1.0f / 255.0f); } -static void emit_load_R32G32B32( struct translate_sse *p, - struct x86_reg data, - struct x86_reg arg0 ) +static struct x86_reg get_inv_32767( struct translate_sse *p ) { - /* Have to jump through some hoops: - * - * c 0 0 0 - * c 0 0 1 - * 0 0 c 1 - * a b c 1 - */ - sse_movss(p->func, data, x86_make_disp(arg0, 8)); - sse_shufps(p->func, data, get_identity(p), SHUF(X,Y,Z,W) ); - sse_shufps(p->func, data, data, SHUF(Y,Z,X,W) ); - sse_movlps(p->func, data, arg0); + return get_const(p, 2, 1.0f / 32767.0f); } -static void emit_load_R32G32( struct translate_sse *p, - struct x86_reg data, - struct x86_reg arg0 ) +static struct x86_reg get_inv_65535( struct translate_sse *p ) { - /* 0 0 0 1 - * a b 0 1 - */ - sse_movups(p->func, data, get_identity(p) ); - sse_movlps(p->func, data, arg0); + return get_const(p, 3, 1.0f / 65535.0f); } - -static void emit_load_R32( struct translate_sse *p, - struct x86_reg data, - struct x86_reg arg0 ) +static struct x86_reg get_inv_2147483647( struct translate_sse *p ) { - /* a 0 0 0 - * a 0 0 1 - */ - sse_movss(p->func, data, arg0); - sse_orps(p->func, data, get_identity(p) ); + return get_const(p, 4, 1.0f / 2147483647.0f); } - -static void emit_load_R8G8B8A8_UNORM( struct translate_sse *p, +/* load the data in a SSE2 register, padding with zeros */ +static boolean emit_load_sse2( struct translate_sse *p, struct x86_reg data, - struct x86_reg src ) + struct x86_reg src, + unsigned size) { - - /* Load and unpack twice: - */ - sse_movss(p->func, data, src); - sse2_punpcklbw(p->func, data, get_identity(p)); - sse2_punpcklbw(p->func, data, get_identity(p)); - - /* Convert to float: - */ - sse2_cvtdq2ps(p->func, data, data); - - - /* Scale by 1/255.0 - */ - sse_mulps(p->func, data, get_inv_255(p)); + struct x86_reg tmpXMM = x86_make_reg(file_XMM, 1); + struct x86_reg tmp = p->tmp_EAX; + switch(size) + { + case 1: + x86_movzx8(p->func, tmp, src); + sse2_movd(p->func, data, tmp); + break; + case 2: + x86_movzx16(p->func, tmp, src); + sse2_movd(p->func, data, tmp); + case 3: + x86_movzx8(p->func, tmp, x86_make_disp(src, 2)); + x86_shl_imm(p->func, tmp, 16); + x86_mov16(p->func, tmp, src); + sse2_movd(p->func, data, tmp); + case 4: + sse2_movd(p->func, data, src); + break; + case 6: + sse2_movd(p->func, data, src); + x86_movzx16(p->func, tmp, x86_make_disp(src, 4)); + sse2_movd(p->func, tmpXMM, tmp); + sse2_punpckldq(p->func, data, tmpXMM); + break; + case 8: + sse2_movq(p->func, data, src); + break; + case 12: + sse2_movq(p->func, data, src); + sse2_movd(p->func, tmpXMM, x86_make_disp(src, 8)); + sse2_punpcklqdq(p->func, data, tmpXMM); + break; + case 16: + sse2_movdqu(p->func, data, src); + break; + default: + return FALSE; + } + return TRUE; } +/* this value can be passed for the out_chans argument */ +#define CHANNELS_0001 5 +/* this function will load #chans float values, and will + * pad the register with zeroes at least up to out_chans. + * + * If out_chans is set to CHANNELS_0001, then the fourth + * value will be padded with 1. Only pass this value if + * chans < 4 or results are undefined. + */ +static void emit_load_float32( struct translate_sse *p, + struct x86_reg data, + struct x86_reg arg0, + unsigned out_chans, + unsigned chans) +{ + switch(chans) + { + case 1: + /* a 0 0 0 + * a 0 0 1 + */ + sse_movss(p->func, data, arg0); + if(out_chans == CHANNELS_0001) + sse_orps(p->func, data, get_identity(p) ); + break; + case 2: + /* 0 0 0 1 + * a b 0 1 + */ + if(out_chans == CHANNELS_0001) + sse_shufps(p->func, data, get_identity(p), SHUF(X, Y, Z, W) ); + else if(out_chans > 2) + sse_movlhps(p->func, data, get_identity(p) ); + sse_movlps(p->func, data, arg0); + break; + case 3: + /* Have to jump through some hoops: + * + * c 0 0 0 + * c 0 0 1 if out_chans == CHANNELS_0001 + * 0 0 c 0/1 + * a b c 0/1 + */ + sse_movss(p->func, data, x86_make_disp(arg0, 8)); + if(out_chans == CHANNELS_0001) + sse_shufps(p->func, data, get_identity(p), SHUF(X,Y,Z,W) ); + sse_shufps(p->func, data, data, SHUF(Y,Z,X,W) ); + sse_movlps(p->func, data, arg0); + break; + case 4: + sse_movups(p->func, data, arg0); + break; + } +} +/* this function behaves like emit_load_float32, but loads + 64-bit floating point numbers, converting them to 32-bit + ones */ +static void emit_load_float64to32( struct translate_sse *p, + struct x86_reg data, + struct x86_reg arg0, + unsigned out_chans, + unsigned chans) +{ + struct x86_reg tmpXMM = x86_make_reg(file_XMM, 1); + switch(chans) + { + case 1: + sse2_movsd(p->func, data, arg0); + if(out_chans > 1) + sse2_cvtpd2ps(p->func, data, data); + else + sse2_cvtsd2ss(p->func, data, data); + if(out_chans == CHANNELS_0001) + sse_shufps(p->func, data, get_identity(p), SHUF(X, Y, Z, W) ); + break; + case 2: + sse2_movupd(p->func, data, arg0); + sse2_cvtpd2ps(p->func, data, data); + if(out_chans == CHANNELS_0001) + sse_shufps(p->func, data, get_identity(p), SHUF(X, Y, Z, W) ); + else if(out_chans > 2) + sse_movlhps(p->func, data, get_identity(p) ); + break; + case 3: + sse2_movupd(p->func, data, arg0); + sse2_cvtpd2ps(p->func, data, data); + sse2_movsd(p->func, tmpXMM, x86_make_disp(arg0, 16)); + if(out_chans > 3) + sse2_cvtpd2ps(p->func, tmpXMM, tmpXMM); + else + sse2_cvtsd2ss(p->func, tmpXMM, tmpXMM); + sse_movlhps(p->func, data, tmpXMM); + if(out_chans == CHANNELS_0001) + sse_orps(p->func, data, get_identity(p) ); + break; + case 4: + sse2_movupd(p->func, data, arg0); + sse2_cvtpd2ps(p->func, data, data); + sse2_movupd(p->func, tmpXMM, x86_make_disp(arg0, 16)); + sse2_cvtpd2ps(p->func, tmpXMM, tmpXMM); + sse_movlhps(p->func, data, tmpXMM); + break; + } +} -static void emit_store_R32G32B32A32( struct translate_sse *p, - struct x86_reg dest, - struct x86_reg dataXMM ) +static void emit_mov64(struct translate_sse *p, struct x86_reg dst_gpr, struct x86_reg dst_xmm, struct x86_reg src_gpr, struct x86_reg src_xmm) { - sse_movups(p->func, dest, dataXMM); + if(x86_target(p->func) != X86_32) + x64_mov64(p->func, dst_gpr, src_gpr); + else + { + /* TODO: when/on which CPUs is SSE2 actually better than SSE? */ + if(x86_target_caps(p->func) & X86_SSE2) + sse2_movq(p->func, dst_xmm, src_xmm); + else + sse_movlps(p->func, dst_xmm, src_xmm); + } } -static void emit_store_R32G32B32( struct translate_sse *p, - struct x86_reg dest, - struct x86_reg dataXMM ) +static void emit_load64(struct translate_sse *p, struct x86_reg dst_gpr, struct x86_reg dst_xmm, struct x86_reg src) { - /* Emit two, shuffle, emit one. - */ - sse_movlps(p->func, dest, dataXMM); - sse_shufps(p->func, dataXMM, dataXMM, SHUF(Z,Z,Z,Z) ); /* NOTE! destructive */ - sse_movss(p->func, x86_make_disp(dest,8), dataXMM); + emit_mov64(p, dst_gpr, dst_xmm, src, src); } -static void emit_store_R32G32( struct translate_sse *p, - struct x86_reg dest, - struct x86_reg dataXMM ) +static void emit_store64(struct translate_sse *p, struct x86_reg dst, struct x86_reg src_gpr, struct x86_reg src_xmm) { - sse_movlps(p->func, dest, dataXMM); + emit_mov64(p, dst, dst, src_gpr, src_xmm); } -static void emit_store_R32( struct translate_sse *p, - struct x86_reg dest, - struct x86_reg dataXMM ) +static void emit_mov128(struct translate_sse *p, struct x86_reg dst, struct x86_reg src) { - sse_movss(p->func, dest, dataXMM); + if(x86_target_caps(p->func) & X86_SSE2) + sse2_movdqu(p->func, dst, src); + else + sse_movups(p->func, dst, src); } +/* TODO: this uses unaligned accesses liberally, which is great on Nehalem, + * but may or may not be good on older processors + * TODO: may perhaps want to use non-temporal stores here if possible + */ +static void emit_memcpy(struct translate_sse *p, struct x86_reg dst, struct x86_reg src, unsigned size) +{ + struct x86_reg dataXMM = x86_make_reg(file_XMM, 0); + struct x86_reg dataXMM2 = x86_make_reg(file_XMM, 1); + struct x86_reg dataGPR = p->tmp_EAX; + struct x86_reg dataGPR2 = p->tmp2_EDX; + if(size < 8) + { + switch (size) + { + case 1: + x86_mov8(p->func, dataGPR, src); + x86_mov8(p->func, dst, dataGPR); + break; + case 2: + x86_mov16(p->func, dataGPR, src); + x86_mov16(p->func, dst, dataGPR); + break; + case 3: + x86_mov16(p->func, dataGPR, src); + x86_mov8(p->func, dataGPR2, x86_make_disp(src, 2)); + x86_mov16(p->func, dst, dataGPR); + x86_mov8(p->func, x86_make_disp(dst, 2), dataGPR2); + break; + case 4: + x86_mov(p->func, dataGPR, src); + x86_mov(p->func, dst, dataGPR); + break; + case 6: + x86_mov(p->func, dataGPR, src); + x86_mov16(p->func, dataGPR2, x86_make_disp(src, 4)); + x86_mov(p->func, dst, dataGPR); + x86_mov16(p->func, x86_make_disp(dst, 4), dataGPR2); + break; + } + } + else if(!(x86_target_caps(p->func) & X86_SSE)) + { + unsigned i = 0; + assert((size & 3) == 0); + for(i = 0; i < size; i += 4) + { + x86_mov(p->func, dataGPR, x86_make_disp(src, i)); + x86_mov(p->func, x86_make_disp(dst, i), dataGPR); + } + } + else + { + switch(size) + { + case 8: + emit_load64(p, dataGPR, dataXMM, src); + emit_store64(p, dst, dataGPR, dataXMM); + break; + case 12: + emit_load64(p, dataGPR2, dataXMM, src); + x86_mov(p->func, dataGPR, x86_make_disp(src, 8)); + emit_store64(p, dst, dataGPR2, dataXMM); + x86_mov(p->func, x86_make_disp(dst, 8), dataGPR); + break; + case 16: + emit_mov128(p, dataXMM, src); + emit_mov128(p, dst, dataXMM); + break; + case 24: + emit_mov128(p, dataXMM, src); + emit_load64(p, dataGPR, dataXMM2, x86_make_disp(src, 16)); + emit_mov128(p, dst, dataXMM); + emit_store64(p, x86_make_disp(dst, 16), dataGPR, dataXMM2); + break; + case 32: + emit_mov128(p, dataXMM, src); + emit_mov128(p, dataXMM2, x86_make_disp(src, 16)); + emit_mov128(p, dst, dataXMM); + emit_mov128(p, x86_make_disp(dst, 16), dataXMM2); + break; + default: + assert(0); + } + } +} + +static boolean translate_attr_convert( struct translate_sse *p, + const struct translate_element *a, + struct x86_reg src, + struct x86_reg dst) -static void emit_store_R8G8B8A8_UNORM( struct translate_sse *p, - struct x86_reg dest, - struct x86_reg dataXMM ) { - /* Scale by 255.0 - */ - sse_mulps(p->func, dataXMM, get_255(p)); + const struct util_format_description* input_desc = util_format_description(a->input_format); + const struct util_format_description* output_desc = util_format_description(a->output_format); + unsigned i; + boolean id_swizzle = TRUE; + unsigned swizzle[4] = {UTIL_FORMAT_SWIZZLE_NONE, UTIL_FORMAT_SWIZZLE_NONE, UTIL_FORMAT_SWIZZLE_NONE, UTIL_FORMAT_SWIZZLE_NONE}; + unsigned needed_chans = 0; + unsigned imms[2] = {0, 0x3f800000}; - /* Pack and emit: - */ - sse2_cvtps2dq(p->func, dataXMM, dataXMM); - sse2_packssdw(p->func, dataXMM, dataXMM); - sse2_packuswb(p->func, dataXMM, dataXMM); - sse_movss(p->func, dest, dataXMM); -} + if(a->output_format == PIPE_FORMAT_NONE || a->input_format == PIPE_FORMAT_NONE) + return FALSE; + if(input_desc->channel[0].size & 7) + return FALSE; + if(input_desc->colorspace != output_desc->colorspace) + return FALSE; + for(i = 1; i < input_desc->nr_channels; ++i) + { + if(memcmp(&input_desc->channel[i], &input_desc->channel[0], sizeof(input_desc->channel[0]))) + return FALSE; + } + for(i = 1; i < output_desc->nr_channels; ++i) + { + if(memcmp(&output_desc->channel[i], &output_desc->channel[0], sizeof(output_desc->channel[0]))) + return FALSE; + } -/* Extended swizzles? Maybe later. - */ -static void emit_swizzle( struct translate_sse *p, - struct x86_reg dest, - struct x86_reg src, - unsigned char shuffle ) -{ - sse_shufps(p->func, dest, src, shuffle); -} + for(i = 0; i < output_desc->nr_channels; ++i) + { + if(output_desc->swizzle[i] < 4) + swizzle[output_desc->swizzle[i]] = input_desc->swizzle[i]; + } + if((x86_target_caps(p->func) & X86_SSE) && (0 + || a->output_format == PIPE_FORMAT_R32_FLOAT + || a->output_format == PIPE_FORMAT_R32G32_FLOAT + || a->output_format == PIPE_FORMAT_R32G32B32_FLOAT + || a->output_format == PIPE_FORMAT_R32G32B32A32_FLOAT)) + { + struct x86_reg dataXMM = x86_make_reg(file_XMM, 0); + struct x86_reg tmpXMM = x86_make_reg(file_XMM, 1); -static boolean translate_attr( struct translate_sse *p, - const struct translate_element *a, - struct x86_reg srcECX, - struct x86_reg dstEAX) -{ - struct x86_reg dataXMM = x86_make_reg(file_XMM, 0); + for(i = 0; i < output_desc->nr_channels; ++i) + { + if(swizzle[i] == UTIL_FORMAT_SWIZZLE_0 && i >= input_desc->nr_channels) + swizzle[i] = i; + } - switch (a->input_format) { - case PIPE_FORMAT_R32_FLOAT: - emit_load_R32(p, dataXMM, srcECX); - break; - case PIPE_FORMAT_R32G32_FLOAT: - emit_load_R32G32(p, dataXMM, srcECX); - break; - case PIPE_FORMAT_R32G32B32_FLOAT: - emit_load_R32G32B32(p, dataXMM, srcECX); - break; - case PIPE_FORMAT_R32G32B32A32_FLOAT: - emit_load_R32G32B32A32(p, dataXMM, srcECX); - break; - case PIPE_FORMAT_B8G8R8A8_UNORM: - emit_load_R8G8B8A8_UNORM(p, dataXMM, srcECX); - emit_swizzle(p, dataXMM, dataXMM, SHUF(Z,Y,X,W)); - break; - case PIPE_FORMAT_R8G8B8A8_UNORM: - emit_load_R8G8B8A8_UNORM(p, dataXMM, srcECX); - break; - default: - return FALSE; + for(i = 0; i < output_desc->nr_channels; ++i) + { + if(swizzle[i] < 4) + needed_chans = MAX2(needed_chans, swizzle[i] + 1); + if(swizzle[i] < UTIL_FORMAT_SWIZZLE_0 && swizzle[i] != i) + id_swizzle = FALSE; + } + + if(needed_chans > 0) + { + switch(input_desc->channel[0].type) + { + case UTIL_FORMAT_TYPE_UNSIGNED: + if(!(x86_target_caps(p->func) & X86_SSE2)) + return FALSE; + emit_load_sse2(p, dataXMM, src, input_desc->channel[0].size * input_desc->nr_channels >> 3); + + /* TODO: add support for SSE4.1 pmovzx */ + switch(input_desc->channel[0].size) + { + case 8: + /* TODO: this may be inefficient due to get_identity() being used both as a float and integer register */ + sse2_punpcklbw(p->func, dataXMM, get_identity(p)); + sse2_punpcklbw(p->func, dataXMM, get_identity(p)); + break; + case 16: + sse2_punpcklwd(p->func, dataXMM, get_identity(p)); + break; + case 32: /* we lose precision here */ + sse2_psrld_imm(p->func, dataXMM, 1); + break; + default: + return FALSE; + } + sse2_cvtdq2ps(p->func, dataXMM, dataXMM); + if(input_desc->channel[0].normalized) + { + struct x86_reg factor; + switch(input_desc->channel[0].size) + { + case 8: + factor = get_inv_255(p); + break; + case 16: + factor = get_inv_65535(p); + break; + case 32: + factor = get_inv_2147483647(p); + break; + } + sse_mulps(p->func, dataXMM, factor); + } + else if(input_desc->channel[0].size == 32) + sse_addps(p->func, dataXMM, dataXMM); /* compensate for the bit we threw away to fit u32 into s32 */ + break; + case UTIL_FORMAT_TYPE_SIGNED: + if(!(x86_target_caps(p->func) & X86_SSE2)) + return FALSE; + emit_load_sse2(p, dataXMM, src, input_desc->channel[0].size * input_desc->nr_channels >> 3); + + /* TODO: add support for SSE4.1 pmovsx */ + switch(input_desc->channel[0].size) + { + case 8: + sse2_punpcklbw(p->func, dataXMM, dataXMM); + sse2_punpcklbw(p->func, dataXMM, dataXMM); + sse2_psrad_imm(p->func, dataXMM, 24); + break; + case 16: + sse2_punpcklwd(p->func, dataXMM, dataXMM); + sse2_psrad_imm(p->func, dataXMM, 16); + break; + case 32: /* we lose precision here */ + break; + default: + return FALSE; + } + sse2_cvtdq2ps(p->func, dataXMM, dataXMM); + if(input_desc->channel[0].normalized) + { + struct x86_reg factor; + switch(input_desc->channel[0].size) + { + case 8: + factor = get_inv_127(p); + break; + case 16: + factor = get_inv_32767(p); + break; + case 32: + factor = get_inv_2147483647(p); + break; + } + sse_mulps(p->func, dataXMM, factor); + } + break; + + break; + case UTIL_FORMAT_TYPE_FLOAT: + if(input_desc->channel[0].size != 32 && input_desc->channel[0].size != 64) + return FALSE; + if(swizzle[3] == UTIL_FORMAT_SWIZZLE_1 && input_desc->nr_channels <= 3) + { + swizzle[3] = UTIL_FORMAT_SWIZZLE_W; + needed_chans = CHANNELS_0001; + } + switch(input_desc->channel[0].size) + { + case 32: + emit_load_float32(p, dataXMM, src, needed_chans, input_desc->nr_channels); + break; + case 64: /* we lose precision here */ + if(!(x86_target_caps(p->func) & X86_SSE2)) + return FALSE; + emit_load_float64to32(p, dataXMM, src, needed_chans, input_desc->nr_channels); + break; + default: + return FALSE; + } + break; + default: + return FALSE; + } + + if(!id_swizzle) + sse_shufps(p->func, dataXMM, dataXMM, SHUF(swizzle[0], swizzle[1], swizzle[2], swizzle[3]) ); + } + + if(output_desc->nr_channels >= 4 + && swizzle[0] < UTIL_FORMAT_SWIZZLE_0 + && swizzle[1] < UTIL_FORMAT_SWIZZLE_0 + && swizzle[2] < UTIL_FORMAT_SWIZZLE_0 + && swizzle[3] < UTIL_FORMAT_SWIZZLE_0 + ) + sse_movups(p->func, dst, dataXMM); + else + { + if(output_desc->nr_channels >= 2 + && swizzle[0] < UTIL_FORMAT_SWIZZLE_0 + && swizzle[1] < UTIL_FORMAT_SWIZZLE_0) + sse_movlps(p->func, dst, dataXMM); + else + { + if(swizzle[0] < UTIL_FORMAT_SWIZZLE_0) + sse_movss(p->func, dst, dataXMM); + else + x86_mov_imm(p->func, dst, imms[swizzle[0] - UTIL_FORMAT_SWIZZLE_0]); + + if(output_desc->nr_channels >= 2) + { + if(swizzle[1] < UTIL_FORMAT_SWIZZLE_0) + { + sse_shufps(p->func, dataXMM, dataXMM, SHUF(1, 1, 2, 3)); + sse_movss(p->func, x86_make_disp(dst, 4), dataXMM); + } + else + x86_mov_imm(p->func, x86_make_disp(dst, 4), imms[swizzle[1] - UTIL_FORMAT_SWIZZLE_0]); + } + } + + if(output_desc->nr_channels >= 3) + { + if(output_desc->nr_channels >= 4 + && swizzle[2] < UTIL_FORMAT_SWIZZLE_0 + && swizzle[3] < UTIL_FORMAT_SWIZZLE_0) + sse_movhps(p->func, x86_make_disp(dst, 8), dataXMM); + else + { + if(swizzle[2] < UTIL_FORMAT_SWIZZLE_0) + { + sse_shufps(p->func, dataXMM, dataXMM, SHUF(2, 2, 2, 3)); + sse_movss(p->func, x86_make_disp(dst, 8), dataXMM); + } + else + x86_mov_imm(p->func, x86_make_disp(dst, 8), imms[swizzle[2] - UTIL_FORMAT_SWIZZLE_0]); + + if(output_desc->nr_channels >= 4) + { + if(swizzle[3] < UTIL_FORMAT_SWIZZLE_0) + { + sse_shufps(p->func, dataXMM, dataXMM, SHUF(3, 3, 3, 3)); + sse_movss(p->func, x86_make_disp(dst, 12), dataXMM); + } + else + x86_mov_imm(p->func, x86_make_disp(dst, 12), imms[swizzle[3] - UTIL_FORMAT_SWIZZLE_0]); + } + } + } + } + return TRUE; } + else if((x86_target_caps(p->func) & X86_SSE2) && input_desc->channel[0].size == 8 && output_desc->channel[0].size == 16 + && output_desc->channel[0].normalized == input_desc->channel[0].normalized + && (0 + || (input_desc->channel[0].type == UTIL_FORMAT_TYPE_UNSIGNED && output_desc->channel[0].type == UTIL_FORMAT_TYPE_UNSIGNED) + || (input_desc->channel[0].type == UTIL_FORMAT_TYPE_UNSIGNED && output_desc->channel[0].type == UTIL_FORMAT_TYPE_SIGNED) + || (input_desc->channel[0].type == UTIL_FORMAT_TYPE_SIGNED && output_desc->channel[0].type == UTIL_FORMAT_TYPE_SIGNED) + )) + { + struct x86_reg dataXMM = x86_make_reg(file_XMM, 0); + struct x86_reg tmpXMM = x86_make_reg(file_XMM, 1); + struct x86_reg tmp = p->tmp_EAX; + unsigned imms[2] = {0, 1}; - switch (a->output_format) { - case PIPE_FORMAT_R32_FLOAT: - emit_store_R32(p, dstEAX, dataXMM); - break; - case PIPE_FORMAT_R32G32_FLOAT: - emit_store_R32G32(p, dstEAX, dataXMM); - break; - case PIPE_FORMAT_R32G32B32_FLOAT: - emit_store_R32G32B32(p, dstEAX, dataXMM); - break; - case PIPE_FORMAT_R32G32B32A32_FLOAT: - emit_store_R32G32B32A32(p, dstEAX, dataXMM); - break; - case PIPE_FORMAT_B8G8R8A8_UNORM: - emit_swizzle(p, dataXMM, dataXMM, SHUF(Z,Y,X,W)); - emit_store_R8G8B8A8_UNORM(p, dstEAX, dataXMM); - break; - case PIPE_FORMAT_R8G8B8A8_UNORM: - emit_store_R8G8B8A8_UNORM(p, dstEAX, dataXMM); - break; - default: - return FALSE; + for(i = 0; i < output_desc->nr_channels; ++i) + { + if(swizzle[i] == UTIL_FORMAT_SWIZZLE_0 && i >= input_desc->nr_channels) + swizzle[i] = i; + } + + for(i = 0; i < output_desc->nr_channels; ++i) + { + if(swizzle[i] < 4) + needed_chans = MAX2(needed_chans, swizzle[i] + 1); + if(swizzle[i] < UTIL_FORMAT_SWIZZLE_0 && swizzle[i] != i) + id_swizzle = FALSE; + } + + if(needed_chans > 0) + { + emit_load_sse2(p, dataXMM, src, input_desc->channel[0].size * input_desc->nr_channels >> 3); + + switch(input_desc->channel[0].type) + { + case UTIL_FORMAT_TYPE_UNSIGNED: + if(input_desc->channel[0].normalized) + { + sse2_punpcklbw(p->func, dataXMM, dataXMM); + if(output_desc->channel[0].type == UTIL_FORMAT_TYPE_SIGNED) + sse2_psrlw_imm(p->func, dataXMM, 1); + } + else + sse2_punpcklbw(p->func, dataXMM, get_identity(p)); + break; + case UTIL_FORMAT_TYPE_SIGNED: + if(input_desc->channel[0].normalized) + { + sse2_movq(p->func, tmpXMM, get_identity(p)); + sse2_punpcklbw(p->func, tmpXMM, dataXMM); + sse2_psllw_imm(p->func, dataXMM, 9); + sse2_psrlw_imm(p->func, dataXMM, 8); + sse2_por(p->func, tmpXMM, dataXMM); + sse2_psrlw_imm(p->func, dataXMM, 7); + sse2_por(p->func, tmpXMM, dataXMM); + { + struct x86_reg t = dataXMM; + dataXMM = tmpXMM; + tmpXMM = t; + } + } + else + { + sse2_punpcklbw(p->func, dataXMM, dataXMM); + sse2_psraw_imm(p->func, dataXMM, 8); + } + break; + default: + assert(0); + } + + if(output_desc->channel[0].normalized) + imms[1] = (output_desc->channel[0].type == UTIL_FORMAT_TYPE_UNSIGNED) ? 0xffff : 0x7ffff; + + if(!id_swizzle) + sse2_pshuflw(p->func, dataXMM, dataXMM, (swizzle[0] & 3) | ((swizzle[1] & 3) << 2) | ((swizzle[2] & 3) << 4) | ((swizzle[3] & 3) << 6)); + } + + if(output_desc->nr_channels >= 4 + && swizzle[0] < UTIL_FORMAT_SWIZZLE_0 + && swizzle[1] < UTIL_FORMAT_SWIZZLE_0 + && swizzle[2] < UTIL_FORMAT_SWIZZLE_0 + && swizzle[3] < UTIL_FORMAT_SWIZZLE_0 + ) + sse2_movq(p->func, dst, dataXMM); + else + { + if(swizzle[0] < UTIL_FORMAT_SWIZZLE_0) + { + if(output_desc->nr_channels >= 2 && swizzle[1] < UTIL_FORMAT_SWIZZLE_0) + sse2_movd(p->func, dst, dataXMM); + else + { + sse2_movd(p->func, tmp, dataXMM); + x86_mov16(p->func, dst, tmp); + if(output_desc->nr_channels >= 2) + x86_mov16_imm(p->func, x86_make_disp(dst, 2), imms[swizzle[1] - UTIL_FORMAT_SWIZZLE_0]); + } + } + else + { + if(output_desc->nr_channels >= 2 && swizzle[1] >= UTIL_FORMAT_SWIZZLE_0) + x86_mov_imm(p->func, dst, (imms[swizzle[1] - UTIL_FORMAT_SWIZZLE_0] << 16) | imms[swizzle[0] - UTIL_FORMAT_SWIZZLE_0]); + else + { + x86_mov16_imm(p->func, dst, imms[swizzle[0] - UTIL_FORMAT_SWIZZLE_0]); + if(output_desc->nr_channels >= 2) + { + sse2_movd(p->func, tmp, dataXMM); + x86_shr_imm(p->func, tmp, 16); + x86_mov16(p->func, x86_make_disp(dst, 2), tmp); + } + } + } + + if(output_desc->nr_channels >= 3) + { + if(swizzle[2] < UTIL_FORMAT_SWIZZLE_0) + { + if(output_desc->nr_channels >= 4 && swizzle[3] < UTIL_FORMAT_SWIZZLE_0) + { + sse2_psrlq_imm(p->func, dataXMM, 32); + sse2_movd(p->func, x86_make_disp(dst, 4), dataXMM); + } + else + { + sse2_psrlq_imm(p->func, dataXMM, 32); + sse2_movd(p->func, tmp, dataXMM); + x86_mov16(p->func, x86_make_disp(dst, 4), tmp); + if(output_desc->nr_channels >= 4) + { + x86_mov16_imm(p->func, x86_make_disp(dst, 6), imms[swizzle[3] - UTIL_FORMAT_SWIZZLE_0]); + } + } + } + else + { + if(output_desc->nr_channels >= 4 && swizzle[3] >= UTIL_FORMAT_SWIZZLE_0) + x86_mov_imm(p->func, x86_make_disp(dst, 4), (imms[swizzle[3] - UTIL_FORMAT_SWIZZLE_0] << 16) | imms[swizzle[2] - UTIL_FORMAT_SWIZZLE_0]); + else + { + x86_mov16_imm(p->func, x86_make_disp(dst, 4), imms[swizzle[2] - UTIL_FORMAT_SWIZZLE_0]); + + if(output_desc->nr_channels >= 4) + { + sse2_psrlq_imm(p->func, dataXMM, 48); + sse2_movd(p->func, tmp, dataXMM); + x86_mov16(p->func, x86_make_disp(dst, 6), tmp); + } + } + } + } + } + return TRUE; } + else if(!memcmp(&output_desc->channel[0], &input_desc->channel[0], sizeof(output_desc->channel[0]))) + { + struct x86_reg tmp = p->tmp_EAX; + if(input_desc->channel[0].size == 8 && input_desc->nr_channels == 4 && output_desc->nr_channels == 4 + && swizzle[0] == UTIL_FORMAT_SWIZZLE_W + && swizzle[1] == UTIL_FORMAT_SWIZZLE_Z + && swizzle[2] == UTIL_FORMAT_SWIZZLE_Y + && swizzle[3] == UTIL_FORMAT_SWIZZLE_X) + { + /* TODO: support movbe */ + x86_mov(p->func, tmp, src); + x86_bswap(p->func, tmp); + x86_mov(p->func, dst, tmp); + return TRUE; + } - return TRUE; + for(unsigned i = 0; i < output_desc->nr_channels; ++i) + { + switch(output_desc->channel[0].size) + { + case 8: + if(swizzle[i] >= UTIL_FORMAT_SWIZZLE_0) + { + unsigned v = 0; + if(swizzle[i] == UTIL_FORMAT_SWIZZLE_1) + { + switch(output_desc->channel[0].type) + { + case UTIL_FORMAT_TYPE_UNSIGNED: + v = output_desc->channel[0].normalized ? 0xff : 1; + break; + case UTIL_FORMAT_TYPE_SIGNED: + v = output_desc->channel[0].normalized ? 0x7f : 1; + break; + default: + return FALSE; + } + } + x86_mov8_imm(p->func, x86_make_disp(dst, i * 1), v); + } + else + { + x86_mov8(p->func, tmp, x86_make_disp(src, swizzle[i] * 1)); + x86_mov8(p->func, x86_make_disp(dst, i * 1), tmp); + } + break; + case 16: + if(swizzle[i] >= UTIL_FORMAT_SWIZZLE_0) + { + unsigned v = 0; + if(swizzle[i] == UTIL_FORMAT_SWIZZLE_1) + { + switch(output_desc->channel[1].type) + { + case UTIL_FORMAT_TYPE_UNSIGNED: + v = output_desc->channel[1].normalized ? 0xffff : 1; + break; + case UTIL_FORMAT_TYPE_SIGNED: + v = output_desc->channel[1].normalized ? 0x7fff : 1; + break; + case UTIL_FORMAT_TYPE_FLOAT: + v = 0x3c00; + break; + default: + return FALSE; + } + } + x86_mov16_imm(p->func, x86_make_disp(dst, i * 2), v); + } + else if(swizzle[i] == UTIL_FORMAT_SWIZZLE_0) + x86_mov16_imm(p->func, x86_make_disp(dst, i * 2), 0); + else + { + x86_mov16(p->func, tmp, x86_make_disp(src, swizzle[i] * 2)); + x86_mov16(p->func, x86_make_disp(dst, i * 2), tmp); + } + break; + case 32: + if(swizzle[i] >= UTIL_FORMAT_SWIZZLE_0) + { + unsigned v = 0; + if(swizzle[i] == UTIL_FORMAT_SWIZZLE_1) + { + switch(output_desc->channel[1].type) + { + case UTIL_FORMAT_TYPE_UNSIGNED: + v = output_desc->channel[1].normalized ? 0xffffffff : 1; + break; + case UTIL_FORMAT_TYPE_SIGNED: + v = output_desc->channel[1].normalized ? 0x7fffffff : 1; + break; + case UTIL_FORMAT_TYPE_FLOAT: + v = 0x3f800000; + break; + default: + return FALSE; + } + } + x86_mov_imm(p->func, x86_make_disp(dst, i * 4), v); + } + else + { + x86_mov(p->func, tmp, x86_make_disp(src, swizzle[i] * 4)); + x86_mov(p->func, x86_make_disp(dst, i * 4), tmp); + } + break; + case 64: + if(swizzle[i] >= UTIL_FORMAT_SWIZZLE_0) + { + unsigned l = 0; + unsigned h = 0; + if(swizzle[i] == UTIL_FORMAT_SWIZZLE_1) + { + switch(output_desc->channel[1].type) + { + case UTIL_FORMAT_TYPE_UNSIGNED: + h = output_desc->channel[1].normalized ? 0xffffffff : 0; + l = output_desc->channel[1].normalized ? 0xffffffff : 1; + break; + case UTIL_FORMAT_TYPE_SIGNED: + h = output_desc->channel[1].normalized ? 0x7fffffff : 0; + l = output_desc->channel[1].normalized ? 0xffffffff : 1; + break; + case UTIL_FORMAT_TYPE_FLOAT: + h = 0x3ff00000; + l = 0; + break; + default: + return FALSE; + } + } + x86_mov_imm(p->func, x86_make_disp(dst, i * 8), l); + x86_mov_imm(p->func, x86_make_disp(dst, i * 8 + 4), h); + } + else + { + if(x86_target_caps(p->func) & X86_SSE) + { + struct x86_reg tmpXMM = x86_make_reg(file_XMM, 0); + emit_load64(p, tmp, tmpXMM, x86_make_disp(src, swizzle[i] * 8)); + emit_store64(p, x86_make_disp(dst, i * 8), tmp, tmpXMM); + } + else + { + x86_mov(p->func, tmp, x86_make_disp(src, swizzle[i] * 8)); + x86_mov(p->func, x86_make_disp(dst, i * 8), tmp); + x86_mov(p->func, tmp, x86_make_disp(src, swizzle[i] * 8 + 4)); + x86_mov(p->func, x86_make_disp(dst, i * 8 + 4), tmp); + } + } + break; + default: + return FALSE; + } + } + return TRUE; + } + return FALSE; } +static boolean translate_attr( struct translate_sse *p, + const struct translate_element *a, + struct x86_reg src, + struct x86_reg dst) +{ + if(a->input_format == a->output_format) + { + emit_memcpy(p, dst, src, util_format_get_stride(a->input_format, 1)); + return TRUE; + } + + return translate_attr_convert(p, a, src, dst); +} static boolean init_inputs( struct translate_sse *p, unsigned index_size ) { unsigned i; - struct x86_reg instance_id = x86_make_disp(p->machine_EDX, + struct x86_reg instance_id = x86_make_disp(p->machine_EDI, get_offset(p, &p->instance_id)); for (i = 0; i < p->nr_buffer_varients; i++) { @@ -375,13 +1033,13 @@ static boolean init_inputs( struct translate_sse *p, struct translate_buffer *buffer = &p->buffer[varient->buffer_index]; if (!index_size || varient->instance_divisor) { - struct x86_reg buf_stride = x86_make_disp(p->machine_EDX, + struct x86_reg buf_stride = x86_make_disp(p->machine_EDI, get_offset(p, &buffer->stride)); - struct x86_reg buf_ptr = x86_make_disp(p->machine_EDX, + struct x86_reg buf_ptr = x86_make_disp(p->machine_EDI, get_offset(p, &varient->ptr)); - struct x86_reg buf_base_ptr = x86_make_disp(p->machine_EDX, + struct x86_reg buf_base_ptr = x86_make_disp(p->machine_EDI, get_offset(p, &buffer->base_ptr)); - struct x86_reg elt = p->idx_EBX; + struct x86_reg elt = p->idx_ESI; struct x86_reg tmp_EAX = p->tmp_EAX; /* Calculate pointer to first attrib: @@ -393,20 +1051,16 @@ static boolean init_inputs( struct translate_sse *p, x86_mov(p->func, tmp_EAX, instance_id); if (varient->instance_divisor != 1) { - struct x86_reg tmp_EDX = p->machine_EDX; - struct x86_reg tmp_ECX = p->outbuf_ECX; + struct x86_reg tmp_EDX = p->tmp2_EDX; + struct x86_reg tmp_ECX = p->tmp3_ECX; /* TODO: Add x86_shr() to rtasm and use it whenever * instance divisor is power of two. */ - x86_push(p->func, tmp_EDX); - x86_push(p->func, tmp_ECX); x86_xor(p->func, tmp_EDX, tmp_EDX); x86_mov_reg_imm(p->func, tmp_ECX, varient->instance_divisor); x86_div(p->func, tmp_ECX); /* EAX = EDX:EAX / ECX */ - x86_pop(p->func, tmp_ECX); - x86_pop(p->func, tmp_EDX); } } else { x86_mov(p->func, tmp_EAX, elt); @@ -417,6 +1071,7 @@ static boolean init_inputs( struct translate_sse *p, */ x86_imul(p->func, tmp_EAX, buf_stride); + x64_rexw(p->func); x86_add(p->func, tmp_EAX, buf_base_ptr); @@ -424,9 +1079,15 @@ static boolean init_inputs( struct translate_sse *p, * index number. */ if (!index_size && p->nr_buffer_varients == 1) + { + x64_rexw(p->func); x86_mov(p->func, elt, tmp_EAX); + } else + { + x64_rexw(p->func); x86_mov(p->func, buf_ptr, tmp_EAX); + } } } @@ -440,18 +1101,19 @@ static struct x86_reg get_buffer_ptr( struct translate_sse *p, struct x86_reg elt ) { if (var_idx == ELEMENT_BUFFER_INSTANCE_ID) { - return x86_make_disp(p->machine_EDX, + return x86_make_disp(p->machine_EDI, get_offset(p, &p->instance_id)); } if (!index_size && p->nr_buffer_varients == 1) { - return p->idx_EBX; + return p->idx_ESI; } else if (!index_size || p->buffer_varient[var_idx].instance_divisor) { struct x86_reg ptr = p->tmp_EAX; struct x86_reg buf_ptr = - x86_make_disp(p->machine_EDX, + x86_make_disp(p->machine_EDI, get_offset(p, &p->buffer_varient[var_idx].ptr)); + x64_rexw(p->func); x86_mov(p->func, ptr, buf_ptr); return ptr; } @@ -460,11 +1122,11 @@ static struct x86_reg get_buffer_ptr( struct translate_sse *p, const struct translate_buffer_varient *varient = &p->buffer_varient[var_idx]; struct x86_reg buf_stride = - x86_make_disp(p->machine_EDX, + x86_make_disp(p->machine_EDI, get_offset(p, &p->buffer[varient->buffer_index].stride)); struct x86_reg buf_base_ptr = - x86_make_disp(p->machine_EDX, + x86_make_disp(p->machine_EDI, get_offset(p, &p->buffer[varient->buffer_index].base_ptr)); @@ -484,6 +1146,7 @@ static struct x86_reg get_buffer_ptr( struct translate_sse *p, break; } x86_imul(p->func, ptr, buf_stride); + x64_rexw(p->func); x86_add(p->func, ptr, buf_base_ptr); return ptr; } @@ -495,12 +1158,13 @@ static boolean incr_inputs( struct translate_sse *p, unsigned index_size ) { if (!index_size && p->nr_buffer_varients == 1) { - struct x86_reg stride = x86_make_disp(p->machine_EDX, + struct x86_reg stride = x86_make_disp(p->machine_EDI, get_offset(p, &p->buffer[0].stride)); if (p->buffer_varient[0].instance_divisor == 0) { - x86_add(p->func, p->idx_EBX, stride); - sse_prefetchnta(p->func, x86_make_disp(p->idx_EBX, 192)); + x64_rexw(p->func); + x86_add(p->func, p->idx_ESI, stride); + sse_prefetchnta(p->func, x86_make_disp(p->idx_ESI, 192)); } } else if (!index_size) { @@ -510,21 +1174,23 @@ static boolean incr_inputs( struct translate_sse *p, */ for (i = 0; i < p->nr_buffer_varients; i++) { struct translate_buffer_varient *varient = &p->buffer_varient[i]; - struct x86_reg buf_ptr = x86_make_disp(p->machine_EDX, + struct x86_reg buf_ptr = x86_make_disp(p->machine_EDI, get_offset(p, &varient->ptr)); - struct x86_reg buf_stride = x86_make_disp(p->machine_EDX, + struct x86_reg buf_stride = x86_make_disp(p->machine_EDI, get_offset(p, &p->buffer[varient->buffer_index].stride)); if (varient->instance_divisor == 0) { - x86_mov(p->func, p->tmp_EAX, buf_ptr); - x86_add(p->func, p->tmp_EAX, buf_stride); + x86_mov(p->func, p->tmp_EAX, buf_stride); + x64_rexw(p->func); + x86_add(p->func, p->tmp_EAX, buf_ptr); if (i == 0) sse_prefetchnta(p->func, x86_make_disp(p->tmp_EAX, 192)); + x64_rexw(p->func); x86_mov(p->func, buf_ptr, p->tmp_EAX); } } } else { - x86_lea(p->func, p->idx_EBX, x86_make_disp(p->idx_EBX, index_size)); + x86_lea(p->func, p->idx_ESI, x86_make_disp(p->idx_ESI, index_size)); } return TRUE; @@ -555,29 +1221,45 @@ static boolean build_vertex_emit( struct translate_sse *p, unsigned j; p->tmp_EAX = x86_make_reg(file_REG32, reg_AX); - p->idx_EBX = x86_make_reg(file_REG32, reg_BX); - p->outbuf_ECX = x86_make_reg(file_REG32, reg_CX); - p->machine_EDX = x86_make_reg(file_REG32, reg_DX); - p->count_ESI = x86_make_reg(file_REG32, reg_SI); + p->idx_ESI = x86_make_reg(file_REG32, reg_SI); + p->outbuf_EBX = x86_make_reg(file_REG32, reg_BX); + p->machine_EDI = x86_make_reg(file_REG32, reg_DI); + p->count_EBP = x86_make_reg(file_REG32, reg_BP); + p->tmp2_EDX = x86_make_reg(file_REG32, reg_DX); + p->tmp3_ECX = x86_make_reg(file_REG32, reg_CX); p->func = func; - p->loaded_inv_255 = FALSE; - p->loaded_255 = FALSE; + memset(&p->loaded_const, 0, sizeof(p->loaded_const)); p->loaded_identity = FALSE; x86_init_func(p->func); - /* Push a few regs? - */ - x86_push(p->func, p->idx_EBX); - x86_push(p->func, p->count_ESI); + if(x86_target(p->func) == X86_64_WIN64_ABI) + { + /* the ABI guarantees a 16-byte aligned 32-byte "shadow space" above the return address */ + sse2_movdqa(p->func, x86_make_disp(x86_make_reg(file_REG32, reg_SP), 8), x86_make_reg(file_XMM, 6)); + sse2_movdqa(p->func, x86_make_disp(x86_make_reg(file_REG32, reg_SP), 24), x86_make_reg(file_XMM, 7)); + } - /* Load arguments into regs: - */ - x86_mov(p->func, p->machine_EDX, x86_fn_arg(p->func, 1)); - x86_mov(p->func, p->idx_EBX, x86_fn_arg(p->func, 2)); - x86_mov(p->func, p->count_ESI, x86_fn_arg(p->func, 3)); - x86_mov(p->func, p->outbuf_ECX, x86_fn_arg(p->func, 5)); + x86_push(p->func, p->outbuf_EBX); + x86_push(p->func, p->count_EBP); + +/* on non-Win64 x86-64, these are already in the right registers */ + if(x86_target(p->func) != X86_64_STD_ABI) + { + x86_push(p->func, p->machine_EDI); + x86_push(p->func, p->idx_ESI); + + x86_mov(p->func, p->machine_EDI, x86_fn_arg(p->func, 1)); + x86_mov(p->func, p->idx_ESI, x86_fn_arg(p->func, 2)); + } + + x86_mov(p->func, p->count_EBP, x86_fn_arg(p->func, 3)); + + if(x86_target(p->func) != X86_32) + x64_mov64(p->func, p->outbuf_EBX, x86_fn_arg(p->func, 5)); + else + x86_mov(p->func, p->outbuf_EBX, x86_fn_arg(p->func, 5)); /* Load instance ID. */ @@ -586,14 +1268,14 @@ static boolean build_vertex_emit( struct translate_sse *p, p->tmp_EAX, x86_fn_arg(p->func, 4)); x86_mov(p->func, - x86_make_disp(p->machine_EDX, get_offset(p, &p->instance_id)), + x86_make_disp(p->machine_EDI, get_offset(p, &p->instance_id)), p->tmp_EAX); } /* Get vertex count, compare to zero */ x86_xor(p->func, p->tmp_EAX, p->tmp_EAX); - x86_cmp(p->func, p->count_ESI, p->tmp_EAX); + x86_cmp(p->func, p->count_EBP, p->tmp_EAX); fixup = x86_jcc_forward(p->func, cc_E); /* always load, needed or not: @@ -604,7 +1286,7 @@ static boolean build_vertex_emit( struct translate_sse *p, */ label = x86_get_label(p->func); { - struct x86_reg elt = !index_size ? p->idx_EBX : x86_deref(p->idx_EBX); + struct x86_reg elt = !index_size ? p->idx_ESI : x86_deref(p->idx_ESI); int last_varient = -1; struct x86_reg vb; @@ -621,15 +1303,16 @@ static boolean build_vertex_emit( struct translate_sse *p, if (!translate_attr( p, a, x86_make_disp(vb, a->input_offset), - x86_make_disp(p->outbuf_ECX, a->output_offset))) + x86_make_disp(p->outbuf_EBX, a->output_offset))) return FALSE; } /* Next output vertex: */ + x64_rexw(p->func); x86_lea(p->func, - p->outbuf_ECX, - x86_make_disp(p->outbuf_ECX, + p->outbuf_EBX, + x86_make_disp(p->outbuf_EBX, p->translate.key.output_stride)); /* Incr index @@ -639,7 +1322,7 @@ static boolean build_vertex_emit( struct translate_sse *p, /* decr count, loop if not zero */ - x86_dec(p->func, p->count_ESI); + x86_dec(p->func, p->count_EBP); x86_jcc(p->func, cc_NZ, label); /* Exit mmx state? @@ -654,8 +1337,20 @@ static boolean build_vertex_emit( struct translate_sse *p, /* Pop regs and return */ - x86_pop(p->func, p->count_ESI); - x86_pop(p->func, p->idx_EBX); + if(x86_target(p->func) != X86_64_STD_ABI) + { + x86_pop(p->func, p->idx_ESI); + x86_pop(p->func, p->machine_EDI); + } + + x86_pop(p->func, p->count_EBP); + x86_pop(p->func, p->outbuf_EBX); + + if(x86_target(p->func) == X86_64_WIN64_ABI) + { + sse2_movdqa(p->func, x86_make_reg(file_XMM, 6), x86_make_disp(x86_make_reg(file_REG32, reg_SP), 8)); + sse2_movdqa(p->func, x86_make_reg(file_XMM, 7), x86_make_disp(x86_make_reg(file_REG32, reg_SP), 24)); + } x86_ret(p->func); return TRUE; @@ -704,7 +1399,8 @@ struct translate *translate_sse2_create( const struct translate_key *key ) struct translate_sse *p = NULL; unsigned i; - if (!rtasm_cpu_has_sse() || !rtasm_cpu_has_sse2()) + /* this is misnamed, it actually refers to whether rtasm is enabled or not */ + if (!rtasm_cpu_has_sse()) goto fail; p = CALLOC_STRUCT( translate_sse ); -- cgit v1.2.3 From f201217c1d87919572a3b1cf7de94f580f20e5f0 Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Sun, 15 Aug 2010 07:37:31 +0200 Subject: draw_llvm: fix segfaults on non-SSE2 CPUs where it is disabled (v2) Changes in v2: - Change function name Currently draw_llvm refuses to create itself on non-SSE2 CPUs due to an alleged LLVM bug. However, this is implemented improperly, because other parts of draw still attempt to access draw->llvm, resulting in segfaults. Instead, put the check in debug_get_option_draw_use_llvm, check that before calling draw_llvm_create, and then check whether draw->llvm is non-null everywhere else. --- src/gallium/auxiliary/draw/draw_context.c | 37 ++++++++++++++++++++++++++----- src/gallium/auxiliary/draw/draw_llvm.c | 7 ------ src/gallium/auxiliary/draw/draw_pt.c | 5 +---- 3 files changed, 32 insertions(+), 17 deletions(-) (limited to 'src') diff --git a/src/gallium/auxiliary/draw/draw_context.c b/src/gallium/auxiliary/draw/draw_context.c index 995b675b9a..d118a8db52 100644 --- a/src/gallium/auxiliary/draw/draw_context.c +++ b/src/gallium/auxiliary/draw/draw_context.c @@ -34,6 +34,7 @@ #include "pipe/p_context.h" #include "util/u_memory.h" #include "util/u_math.h" +#include "util/u_cpu_detect.h" #include "draw_context.h" #include "draw_vs.h" #include "draw_gs.h" @@ -41,6 +42,25 @@ #if HAVE_LLVM #include "gallivm/lp_bld_init.h" #include "draw_llvm.h" + +static boolean +draw_get_option_use_llvm(void) +{ + static boolean first = TRUE; + static boolean value; + if (first) { + first = FALSE; + value = debug_get_bool_option("DRAW_USE_LLVM", TRUE); + +#ifdef PIPE_ARCH_X86 + util_cpu_detect(); + /* require SSE2 due to LLVM PR6960. */ + if (!util_cpu_caps.has_sse2) + value = FALSE; +#endif + } + return value; +} #endif struct draw_context *draw_create( struct pipe_context *pipe ) @@ -50,10 +70,13 @@ struct draw_context *draw_create( struct pipe_context *pipe ) goto fail; #if HAVE_LLVM - lp_build_init(); - assert(lp_build_engine); - draw->engine = lp_build_engine; - draw->llvm = draw_llvm_create(draw); + if(draw_get_option_use_llvm()) + { + lp_build_init(); + assert(lp_build_engine); + draw->engine = lp_build_engine; + draw->llvm = draw_llvm_create(draw); + } #endif if (!draw_init(draw)) @@ -135,7 +158,8 @@ void draw_destroy( struct draw_context *draw ) draw_vs_destroy( draw ); draw_gs_destroy( draw ); #ifdef HAVE_LLVM - draw_llvm_destroy( draw->llvm ); + if(draw->llvm) + draw_llvm_destroy( draw->llvm ); #endif FREE( draw ); @@ -659,7 +683,8 @@ draw_set_mapped_texture(struct draw_context *draw, const void *data[DRAW_MAX_TEXTURE_LEVELS]) { #ifdef HAVE_LLVM - draw_llvm_set_mapped_texture(draw, + if(draw->llvm) + draw_llvm_set_mapped_texture(draw, sampler_idx, width, height, depth, last_level, row_stride, img_stride, data); diff --git a/src/gallium/auxiliary/draw/draw_llvm.c b/src/gallium/auxiliary/draw/draw_llvm.c index 8d53601d19..58d3e345e5 100644 --- a/src/gallium/auxiliary/draw/draw_llvm.c +++ b/src/gallium/auxiliary/draw/draw_llvm.c @@ -210,13 +210,6 @@ draw_llvm_create(struct draw_context *draw) { struct draw_llvm *llvm; -#ifdef PIPE_ARCH_X86 - util_cpu_detect(); - /* require SSE2 due to LLVM PR6960. */ - if (!util_cpu_caps.has_sse2) - return NULL; -#endif - llvm = CALLOC_STRUCT( draw_llvm ); if (!llvm) return NULL; diff --git a/src/gallium/auxiliary/draw/draw_pt.c b/src/gallium/auxiliary/draw/draw_pt.c index b80fc8f552..feacd8258b 100644 --- a/src/gallium/auxiliary/draw/draw_pt.c +++ b/src/gallium/auxiliary/draw/draw_pt.c @@ -43,9 +43,6 @@ DEBUG_GET_ONCE_BOOL_OPTION(draw_fse, "DRAW_FSE", FALSE) DEBUG_GET_ONCE_BOOL_OPTION(draw_no_fse, "DRAW_NO_FSE", FALSE) -#ifdef HAVE_LLVM -DEBUG_GET_ONCE_BOOL_OPTION(draw_use_llvm, "DRAW_USE_LLVM", TRUE) -#endif /* Overall we split things into: * - frontend -- prepare fetch_elts, draw_elts - eg vsplit @@ -140,7 +137,7 @@ boolean draw_pt_init( struct draw_context *draw ) return FALSE; #if HAVE_LLVM - if (debug_get_option_draw_use_llvm()) + if (draw->llvm) draw->pt.middle.llvm = draw_pt_fetch_pipeline_or_emit_llvm( draw ); #endif -- cgit v1.2.3 From 5ff769b21d39c8f78c309351aca5869eda0ccba3 Mon Sep 17 00:00:00 2001 From: Alex Deucher Date: Mon, 16 Aug 2010 11:34:17 -0400 Subject: r600c: blit emit updates - set VGT_MAX_VTX_INDX to a larger value - emit PA_SC_AA_CONFIG. The command checker in 2.6.36+ requires this reg. --- src/mesa/drivers/dri/r600/r600_blit.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r600/r600_blit.c b/src/mesa/drivers/dri/r600/r600_blit.c index 27acff9c16..4fd425b809 100644 --- a/src/mesa/drivers/dri/r600/r600_blit.c +++ b/src/mesa/drivers/dri/r600/r600_blit.c @@ -1499,9 +1499,10 @@ set_default_state(context_t *context) R600_OUT_BATCH_REGVAL(PA_SU_VTX_CNTL, (PIX_CENTER_bit) | (X_ROUND_TO_EVEN << PA_SU_VTX_CNTL__ROUND_MODE_shift) | (X_1_256TH << QUANT_MODE_shift)); + R600_OUT_BATCH_REGVAL(PA_SC_AA_CONFIG, 0); R600_OUT_BATCH_REGSEQ(VGT_MAX_VTX_INDX, 4); - R600_OUT_BATCH(2048); + R600_OUT_BATCH(0xffffff); R600_OUT_BATCH(0); R600_OUT_BATCH(0); R600_OUT_BATCH(0); @@ -1614,7 +1615,7 @@ unsigned r600_blit(GLcontext *ctx, /* Flush is needed to make sure that source buffer has correct data */ radeonFlush(ctx); - rcommonEnsureCmdBufSpace(&context->radeon, 308, __FUNCTION__); + rcommonEnsureCmdBufSpace(&context->radeon, 311, __FUNCTION__); /* load shaders */ load_shaders(context->radeon.glCtx); @@ -1623,7 +1624,7 @@ unsigned r600_blit(GLcontext *ctx, return GL_FALSE; /* set clear state */ - /* 117 */ + /* 120 */ set_default_state(context); /* shaders */ -- cgit v1.2.3 From 4eebea74a81ec5fbacf2347ea88cac137ddd4d69 Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Sat, 14 Aug 2010 23:09:12 +0800 Subject: egl: Add support for EGL_KHR_reusable_sync. Individual drivers still need to support and enable the extension. --- src/egl/main/Makefile | 6 ++- src/egl/main/eglapi.c | 107 +++++++++++++++++++++++++++++++++++++++ src/egl/main/eglapi.h | 18 +++++++ src/egl/main/egldisplay.h | 6 +++ src/egl/main/egldriver.c | 9 ++++ src/egl/main/eglmisc.c | 2 + src/egl/main/eglsync.c | 121 +++++++++++++++++++++++++++++++++++++++++++++ src/egl/main/eglsync.h | 119 ++++++++++++++++++++++++++++++++++++++++++++ src/egl/main/egltypedefs.h | 2 + 9 files changed, 388 insertions(+), 2 deletions(-) create mode 100644 src/egl/main/eglsync.c create mode 100644 src/egl/main/eglsync.h (limited to 'src') diff --git a/src/egl/main/Makefile b/src/egl/main/Makefile index 41d301fc14..d92fbf6d9a 100644 --- a/src/egl/main/Makefile +++ b/src/egl/main/Makefile @@ -26,7 +26,8 @@ HEADERS = \ eglmutex.h \ eglscreen.h \ eglstring.h \ - eglsurface.h + eglsurface.h \ + eglsync.h SOURCES = \ eglapi.c \ @@ -44,7 +45,8 @@ SOURCES = \ eglmode.c \ eglscreen.c \ eglstring.c \ - eglsurface.c + eglsurface.c \ + eglsync.c OBJECTS = $(SOURCES:.c=.o) diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c index 4dc8707cfb..53a5f6ed22 100644 --- a/src/egl/main/eglapi.c +++ b/src/egl/main/eglapi.c @@ -68,6 +68,7 @@ #include "eglscreen.h" #include "eglmode.h" #include "eglimage.h" +#include "eglsync.h" /** @@ -126,6 +127,8 @@ #define _EGL_CHECK_MODE(disp, m, ret, drv) \ _EGL_CHECK_OBJECT(disp, Mode, m, ret, drv) +#define _EGL_CHECK_SYNC(disp, s, ret, drv) \ + _EGL_CHECK_OBJECT(disp, Sync, s, ret, drv) static INLINE _EGLDriver * @@ -185,6 +188,26 @@ _eglCheckConfig(_EGLDisplay *disp, _EGLConfig *conf, const char *msg) } +#ifdef EGL_KHR_reusable_sync + + +static INLINE _EGLDriver * +_eglCheckSync(_EGLDisplay *disp, _EGLSync *s, const char *msg) +{ + _EGLDriver *drv = _eglCheckDisplay(disp, msg); + if (!drv) + return NULL; + if (!s) { + _eglError(EGL_BAD_PARAMETER, msg); + return NULL; + } + return drv; +} + + +#endif /* EGL_KHR_reusable_sync */ + + #ifdef EGL_MESA_screen_surface @@ -1245,6 +1268,90 @@ eglDestroyImageKHR(EGLDisplay dpy, EGLImageKHR image) #endif /* EGL_KHR_image_base */ +#ifdef EGL_KHR_reusable_sync + + +EGLSyncKHR EGLAPIENTRY +eglCreateSyncKHR(EGLDisplay dpy, EGLenum type, const EGLint *attrib_list) +{ + _EGLDisplay *disp = _eglLockDisplay(dpy); + _EGLDriver *drv; + _EGLSync *sync; + EGLSyncKHR ret; + + _EGL_CHECK_DISPLAY(disp, EGL_NO_SYNC_KHR, drv); + + sync = drv->API.CreateSyncKHR(drv, disp, type, attrib_list); + ret = (sync) ? _eglLinkSync(sync, disp) : EGL_NO_SYNC_KHR; + + RETURN_EGL_EVAL(disp, ret); +} + + +EGLBoolean EGLAPIENTRY +eglDestroySyncKHR(EGLDisplay dpy, EGLSyncKHR sync) +{ + _EGLDisplay *disp = _eglLockDisplay(dpy); + _EGLSync *s = _eglLookupSync(sync, disp); + _EGLDriver *drv; + EGLBoolean ret; + + _EGL_CHECK_SYNC(disp, s, EGL_FALSE, drv); + _eglUnlinkSync(s); + ret = drv->API.DestroySyncKHR(drv, disp, s); + + RETURN_EGL_EVAL(disp, ret); +} + + +EGLint EGLAPIENTRY +eglClientWaitSyncKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLint flags, EGLTimeKHR timeout) +{ + _EGLDisplay *disp = _eglLockDisplay(dpy); + _EGLSync *s = _eglLookupSync(sync, disp); + _EGLDriver *drv; + EGLint ret; + + _EGL_CHECK_SYNC(disp, s, EGL_FALSE, drv); + ret = drv->API.ClientWaitSyncKHR(drv, disp, s, flags, timeout); + + RETURN_EGL_EVAL(disp, ret); +} + + +EGLBoolean EGLAPIENTRY +eglSignalSyncKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLenum mode) +{ + _EGLDisplay *disp = _eglLockDisplay(dpy); + _EGLSync *s = _eglLookupSync(sync, disp); + _EGLDriver *drv; + EGLBoolean ret; + + _EGL_CHECK_SYNC(disp, s, EGL_FALSE, drv); + ret = drv->API.SignalSyncKHR(drv, disp, s, mode); + + RETURN_EGL_EVAL(disp, ret); +} + + +EGLBoolean EGLAPIENTRY +eglGetSyncAttribKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLint attribute, EGLint *value) +{ + _EGLDisplay *disp = _eglLockDisplay(dpy); + _EGLSync *s = _eglLookupSync(sync, disp); + _EGLDriver *drv; + EGLBoolean ret; + + _EGL_CHECK_SYNC(disp, s, EGL_FALSE, drv); + ret = drv->API.GetSyncAttribKHR(drv, disp, s, attribute, value); + + RETURN_EGL_EVAL(disp, ret); +} + + +#endif /* EGL_KHR_reusable_sync */ + + #ifdef EGL_NOK_swap_region EGLBoolean EGLAPIENTRY diff --git a/src/egl/main/eglapi.h b/src/egl/main/eglapi.h index d8c8b49a49..5045a9a272 100644 --- a/src/egl/main/eglapi.h +++ b/src/egl/main/eglapi.h @@ -76,6 +76,16 @@ typedef _EGLImage *(*CreateImageKHR_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLCo typedef EGLBoolean (*DestroyImageKHR_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLImage *image); #endif /* EGL_KHR_image_base */ + +#ifdef EGL_KHR_reusable_sync +typedef _EGLSync *(*CreateSyncKHR_t)(_EGLDriver *drv, _EGLDisplay *dpy, EGLenum type, const EGLint *attrib_list); +typedef EGLBoolean (*DestroySyncKHR_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSync *sync); +typedef EGLint (*ClientWaitSyncKHR_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSync *sync, EGLint flags, EGLTimeKHR timeout); +typedef EGLBoolean (*SignalSyncKHR_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSync *sync, EGLenum mode); +typedef EGLBoolean (*GetSyncAttribKHR_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSync *sync, EGLint attribute, EGLint *value); +#endif /* EGL_KHR_reusable_sync */ + + #ifdef EGL_NOK_swap_region typedef EGLBoolean (*SwapBuffersRegionNOK_t)(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *surf, EGLint numRects, const EGLint *rects); #endif @@ -138,6 +148,14 @@ struct _egl_api DestroyImageKHR_t DestroyImageKHR; #endif /* EGL_KHR_image_base */ +#ifdef EGL_KHR_reusable_sync + CreateSyncKHR_t CreateSyncKHR; + DestroySyncKHR_t DestroySyncKHR; + ClientWaitSyncKHR_t ClientWaitSyncKHR; + SignalSyncKHR_t SignalSyncKHR; + GetSyncAttribKHR_t GetSyncAttribKHR; +#endif /* EGL_KHR_reusable_sync */ + #ifdef EGL_NOK_swap_region SwapBuffersRegionNOK_t SwapBuffersRegionNOK; #endif diff --git a/src/egl/main/egldisplay.h b/src/egl/main/egldisplay.h index a2cee08bf6..a5c1453067 100644 --- a/src/egl/main/egldisplay.h +++ b/src/egl/main/egldisplay.h @@ -24,6 +24,7 @@ enum _egl_resource_type { _EGL_RESOURCE_CONTEXT, _EGL_RESOURCE_SURFACE, _EGL_RESOURCE_IMAGE, + _EGL_RESOURCE_SYNC, _EGL_NUM_RESOURCES }; @@ -53,6 +54,7 @@ struct _egl_extensions EGLBoolean MESA_screen_surface; EGLBoolean MESA_copy_context; EGLBoolean MESA_drm_display; + EGLBoolean KHR_image_base; EGLBoolean KHR_image_pixmap; EGLBoolean KHR_vg_parent_image; @@ -60,9 +62,13 @@ struct _egl_extensions EGLBoolean KHR_gl_texture_cubemap_image; EGLBoolean KHR_gl_texture_3D_image; EGLBoolean KHR_gl_renderbuffer_image; + + EGLBoolean KHR_reusable_sync; + EGLBoolean KHR_surfaceless_gles1; EGLBoolean KHR_surfaceless_gles2; EGLBoolean KHR_surfaceless_opengl; + EGLBoolean NOK_swap_region; EGLBoolean NOK_texture_from_pixmap; diff --git a/src/egl/main/egldriver.c b/src/egl/main/egldriver.c index 8fc9e792b0..67f1d3dbaa 100644 --- a/src/egl/main/egldriver.c +++ b/src/egl/main/egldriver.c @@ -21,6 +21,7 @@ #include "eglstring.h" #include "eglsurface.h" #include "eglimage.h" +#include "eglsync.h" #include "eglmutex.h" #if defined(_EGL_OS_UNIX) @@ -722,6 +723,14 @@ _eglInitDriverFallbacks(_EGLDriver *drv) drv->API.CreateImageKHR = _eglCreateImageKHR; drv->API.DestroyImageKHR = _eglDestroyImageKHR; #endif /* EGL_KHR_image_base */ + +#ifdef EGL_KHR_reusable_sync + drv->API.CreateSyncKHR = _eglCreateSyncKHR; + drv->API.DestroySyncKHR = _eglDestroySyncKHR; + drv->API.ClientWaitSyncKHR = _eglClientWaitSyncKHR; + drv->API.SignalSyncKHR = _eglSignalSyncKHR; + drv->API.GetSyncAttribKHR = _eglGetSyncAttribKHR; +#endif /* EGL_KHR_reusable_sync */ } diff --git a/src/egl/main/eglmisc.c b/src/egl/main/eglmisc.c index 985d1e0069..2ef6ba59e3 100644 --- a/src/egl/main/eglmisc.c +++ b/src/egl/main/eglmisc.c @@ -97,6 +97,8 @@ _eglUpdateExtensionsString(_EGLDisplay *dpy) _EGL_CHECK_EXTENSION(KHR_gl_texture_3D_image); _EGL_CHECK_EXTENSION(KHR_gl_renderbuffer_image); + _EGL_CHECK_EXTENSION(KHR_reusable_sync); + _EGL_CHECK_EXTENSION(KHR_surfaceless_gles1); _EGL_CHECK_EXTENSION(KHR_surfaceless_gles2); _EGL_CHECK_EXTENSION(KHR_surfaceless_opengl); diff --git a/src/egl/main/eglsync.c b/src/egl/main/eglsync.c new file mode 100644 index 0000000000..3f51e89acd --- /dev/null +++ b/src/egl/main/eglsync.c @@ -0,0 +1,121 @@ +#include + +#include "eglsync.h" +#include "eglcurrent.h" +#include "egllog.h" + + +#ifdef EGL_KHR_reusable_sync + + +/** + * Parse the list of sync attributes and return the proper error code. + */ +static EGLint +_eglParseSyncAttribList(_EGLSync *sync, const EGLint *attrib_list) +{ + EGLint i, err = EGL_SUCCESS; + + if (!attrib_list) + return EGL_SUCCESS; + + for (i = 0; attrib_list[i] != EGL_NONE; i++) { + EGLint attr = attrib_list[i++]; + EGLint val = attrib_list[i]; + + switch (attr) { + default: + (void) val; + err = EGL_BAD_ATTRIBUTE; + break; + } + + if (err != EGL_SUCCESS) { + _eglLog(_EGL_DEBUG, "bad sync attribute 0x%04x", attr); + break; + } + } + + return err; +} + + +EGLBoolean +_eglInitSync(_EGLSync *sync, _EGLDisplay *dpy, EGLenum type, + const EGLint *attrib_list) +{ + EGLint err; + + if (!(type == EGL_SYNC_REUSABLE_KHR && dpy->Extensions.KHR_reusable_sync)) + return _eglError(EGL_BAD_ATTRIBUTE, "eglCreateSyncKHR"); + + memset(sync, 0, sizeof(*sync)); + + sync->Resource.Display = dpy; + + sync->Type = type; + sync->SyncStatus = EGL_UNSIGNALED_KHR; + + err = _eglParseSyncAttribList(sync, attrib_list); + if (err != EGL_SUCCESS) + return _eglError(err, "eglCreateSyncKHR"); + + return EGL_TRUE; +} + + +_EGLSync * +_eglCreateSyncKHR(_EGLDriver *drv, _EGLDisplay *dpy, + EGLenum type, const EGLint *attrib_list) +{ + return NULL; +} + + +EGLBoolean +_eglDestroySyncKHR(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSync *sync) +{ + return EGL_TRUE; +} + + +EGLint +_eglClientWaitSyncKHR(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSync *sync, + EGLint flags, EGLTimeKHR timeout) +{ + return EGL_FALSE; +} + + +EGLBoolean +_eglSignalSyncKHR(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSync *sync, + EGLenum mode) +{ + return EGL_FALSE; +} + + +EGLBoolean +_eglGetSyncAttribKHR(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSync *sync, + EGLint attribute, EGLint *value) +{ + if (!value) + return _eglError(EGL_BAD_PARAMETER, "eglGetConfigs"); + + switch (attribute) { + case EGL_SYNC_TYPE_KHR: + *value = sync->Type; + break; + case EGL_SYNC_STATUS_KHR: + *value = sync->SyncStatus; + break; + default: + return _eglError(EGL_BAD_ATTRIBUTE, "eglGetSyncAttribKHR"); + break; + } + + return EGL_TRUE; +} + + +#endif /* EGL_KHR_reusable_sync */ diff --git a/src/egl/main/eglsync.h b/src/egl/main/eglsync.h new file mode 100644 index 0000000000..a0134784aa --- /dev/null +++ b/src/egl/main/eglsync.h @@ -0,0 +1,119 @@ +#ifndef EGLSYNC_INCLUDED +#define EGLSYNC_INCLUDED + + +#include "egltypedefs.h" +#include "egldisplay.h" + + +#ifdef EGL_KHR_reusable_sync + + +/** + * "Base" class for device driver syncs. + */ +struct _egl_sync +{ + /* A sync is a display resource */ + _EGLResource Resource; + + EGLenum Type; + EGLenum SyncStatus; +}; + + +PUBLIC EGLBoolean +_eglInitSync(_EGLSync *sync, _EGLDisplay *dpy, EGLenum type, + const EGLint *attrib_list); + + +extern _EGLSync * +_eglCreateSyncKHR(_EGLDriver *drv, _EGLDisplay *dpy, + EGLenum type, const EGLint *attrib_list); + + +extern EGLBoolean +_eglDestroySyncKHR(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSync *sync); + + +extern EGLint +_eglClientWaitSyncKHR(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSync *sync, + EGLint flags, EGLTimeKHR timeout); + + +extern EGLBoolean +_eglSignalSyncKHR(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSync *sync, + EGLenum mode); + + +extern EGLBoolean +_eglGetSyncAttribKHR(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSync *sync, + EGLint attribute, EGLint *value); + + +/** + * Link a sync to a display and return the handle of the link. + * The handle can be passed to client directly. + */ +static INLINE EGLSyncKHR +_eglLinkSync(_EGLSync *sync, _EGLDisplay *dpy) +{ + _eglLinkResource(&sync->Resource, _EGL_RESOURCE_SYNC, dpy); + return (EGLSyncKHR) sync; +} + + +/** + * Unlink a linked sync from its display. + */ +static INLINE void +_eglUnlinkSync(_EGLSync *sync) +{ + _eglUnlinkResource(&sync->Resource, _EGL_RESOURCE_SYNC); +} + + +/** + * Lookup a handle to find the linked sync. + * Return NULL if the handle has no corresponding linked sync. + */ +static INLINE _EGLSync * +_eglLookupSync(EGLSyncKHR handle, _EGLDisplay *dpy) +{ + _EGLSync *sync = (_EGLSync *) handle; + if (!dpy || !_eglCheckResource((void *) sync, _EGL_RESOURCE_SYNC, dpy)) + sync = NULL; + return sync; +} + + +/** + * Return the handle of a linked sync, or EGL_NO_SYNC_KHR. + */ +static INLINE EGLSyncKHR +_eglGetSyncHandle(_EGLSync *sync) +{ + _EGLResource *res = (_EGLResource *) sync; + return (res && _eglIsResourceLinked(res)) ? + (EGLSyncKHR) sync : EGL_NO_SYNC_KHR; +} + + +/** + * Return true if the sync is linked to a display. + * + * The link is considered a reference to the sync (the display is owning the + * sync). Drivers should not destroy a sync when it is linked. + */ +static INLINE EGLBoolean +_eglIsSyncLinked(_EGLSync *sync) +{ + _EGLResource *res = (_EGLResource *) sync; + return (res && _eglIsResourceLinked(res)); +} + + +#endif /* EGL_KHR_reusable_sync */ + + +#endif /* EGLSYNC_INCLUDED */ diff --git a/src/egl/main/egltypedefs.h b/src/egl/main/egltypedefs.h index 0e29e9aa47..b65f3b72ae 100644 --- a/src/egl/main/egltypedefs.h +++ b/src/egl/main/egltypedefs.h @@ -32,6 +32,8 @@ typedef struct _egl_screen _EGLScreen; typedef struct _egl_surface _EGLSurface; +typedef struct _egl_sync _EGLSync; + typedef struct _egl_thread_info _EGLThreadInfo; #endif /* EGLTYPEDEFS_INCLUDED */ -- cgit v1.2.3 From 4b2495661f3a5ac8ed07b68c5d5bf90adee2c37d Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Sat, 14 Aug 2010 23:56:46 +0800 Subject: st/egl: Add support for EGL_KHR_reusable_sync. The extension is implemented by pipe_condvar. --- src/gallium/state_trackers/egl/common/egl_g3d.c | 2 + src/gallium/state_trackers/egl/common/egl_g3d.h | 17 ++ .../state_trackers/egl/common/egl_g3d_api.c | 8 + .../state_trackers/egl/common/egl_g3d_sync.c | 217 +++++++++++++++++++++ .../state_trackers/egl/common/egl_g3d_sync.h | 53 +++++ 5 files changed, 297 insertions(+) create mode 100644 src/gallium/state_trackers/egl/common/egl_g3d_sync.c create mode 100644 src/gallium/state_trackers/egl/common/egl_g3d_sync.h (limited to 'src') diff --git a/src/gallium/state_trackers/egl/common/egl_g3d.c b/src/gallium/state_trackers/egl/common/egl_g3d.c index 56d575ffe0..10e2170729 100644 --- a/src/gallium/state_trackers/egl/common/egl_g3d.c +++ b/src/gallium/state_trackers/egl/common/egl_g3d.c @@ -530,6 +530,8 @@ egl_g3d_initialize(_EGLDriver *drv, _EGLDisplay *dpy, if (gdpy->native->get_param(gdpy->native, NATIVE_PARAM_USE_NATIVE_BUFFER)) dpy->Extensions.KHR_image_pixmap = EGL_TRUE; + dpy->Extensions.KHR_reusable_sync = EGL_TRUE; + if (egl_g3d_add_configs(drv, dpy, 1) == 1) { _eglError(EGL_NOT_INITIALIZED, "eglInitialize(unable to add configs)"); goto fail; diff --git a/src/gallium/state_trackers/egl/common/egl_g3d.h b/src/gallium/state_trackers/egl/common/egl_g3d.h index f33dc91cf9..dabcf841e2 100644 --- a/src/gallium/state_trackers/egl/common/egl_g3d.h +++ b/src/gallium/state_trackers/egl/common/egl_g3d.h @@ -30,12 +30,14 @@ #include "pipe/p_screen.h" #include "pipe/p_context.h" #include "pipe/p_format.h" +#include "os/os_thread.h" #include "egldriver.h" #include "egldisplay.h" #include "eglcontext.h" #include "eglsurface.h" #include "eglconfig.h" #include "eglimage.h" +#include "eglsync.h" #include "eglscreen.h" #include "eglmode.h" @@ -99,6 +101,21 @@ struct egl_g3d_image { _EGL_DRIVER_STANDARD_TYPECASTS(egl_g3d) _EGL_DRIVER_TYPECAST(egl_g3d_image, _EGLImage, obj) +#ifdef EGL_KHR_reusable_sync + +struct egl_g3d_sync { + _EGLSync base; + + int refs; + + /* the mutex protects only the condvar, not the struct */ + pipe_mutex mutex; + pipe_condvar condvar; +}; +_EGL_DRIVER_TYPECAST(egl_g3d_sync, _EGLSync, obj) + +#endif /* EGL_KHR_reusable_sync */ + #ifdef EGL_MESA_screen_surface struct egl_g3d_screen { diff --git a/src/gallium/state_trackers/egl/common/egl_g3d_api.c b/src/gallium/state_trackers/egl/common/egl_g3d_api.c index edac72a822..1120945edc 100644 --- a/src/gallium/state_trackers/egl/common/egl_g3d_api.c +++ b/src/gallium/state_trackers/egl/common/egl_g3d_api.c @@ -34,6 +34,7 @@ #include "egl_g3d.h" #include "egl_g3d_api.h" #include "egl_g3d_image.h" +#include "egl_g3d_sync.h" #include "egl_g3d_st.h" #include "egl_g3d_loader.h" #include "native.h" @@ -806,6 +807,13 @@ egl_g3d_init_driver_api(_EGLDriver *drv) drv->API.CreateImageKHR = egl_g3d_create_image; drv->API.DestroyImageKHR = egl_g3d_destroy_image; +#ifdef EGL_KHR_reusable_sync + drv->API.CreateSyncKHR = egl_g3d_create_sync; + drv->API.DestroySyncKHR = egl_g3d_destroy_sync; + drv->API.ClientWaitSyncKHR = egl_g3d_client_wait_sync; + drv->API.SignalSyncKHR = egl_g3d_signal_sync; +#endif + #ifdef EGL_MESA_screen_surface drv->API.CreateScreenSurfaceMESA = egl_g3d_create_screen_surface; drv->API.ShowScreenSurfaceMESA = egl_g3d_show_screen_surface; diff --git a/src/gallium/state_trackers/egl/common/egl_g3d_sync.c b/src/gallium/state_trackers/egl/common/egl_g3d_sync.c new file mode 100644 index 0000000000..3351973d83 --- /dev/null +++ b/src/gallium/state_trackers/egl/common/egl_g3d_sync.c @@ -0,0 +1,217 @@ +/* + * Mesa 3-D graphics library + * Version: 7.9 + * + * Copyright (C) 2010 LunarG Inc. + * + * 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 + * 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. + * + * Authors: + * Chia-I Wu + */ + +#include "util/u_memory.h" +#include "util/u_atomic.h" +#include "os/os_thread.h" +#include "eglsync.h" +#include "eglcurrent.h" + +#include "egl_g3d.h" +#include "egl_g3d_sync.h" + +#ifdef EGL_KHR_reusable_sync + +/** + * Wait for the conditional variable. + */ +static EGLint +egl_g3d_wait_sync_condvar(struct egl_g3d_sync *gsync, EGLTimeKHR timeout) +{ + _EGLDisplay *dpy = gsync->base.Resource.Display; + + pipe_mutex_lock(gsync->mutex); + + /* unlock display lock just before waiting */ + _eglUnlockMutex(&dpy->Mutex); + + /* No timed wait. Always treat timeout as EGL_FOREVER_KHR */ + pipe_condvar_wait(gsync->condvar, gsync->mutex); + + _eglLockMutex(&dpy->Mutex); + + pipe_mutex_unlock(gsync->mutex); + + return EGL_CONDITION_SATISFIED_KHR; +} + +/** + * Signal the conditional variable. + */ +static void +egl_g3d_signal_sync_condvar(struct egl_g3d_sync *gsync) +{ + pipe_mutex_lock(gsync->mutex); + pipe_condvar_broadcast(gsync->condvar); + pipe_mutex_unlock(gsync->mutex); +} + +static INLINE void +egl_g3d_ref_sync(struct egl_g3d_sync *gsync) +{ + p_atomic_inc(&gsync->refs); +} + +static INLINE void +egl_g3d_unref_sync(struct egl_g3d_sync *gsync) +{ + if (p_atomic_dec_zero(&gsync->refs)) { + pipe_condvar_destroy(gsync->condvar); + pipe_mutex_destroy(gsync->mutex); + + FREE(gsync); + } +} + +_EGLSync * +egl_g3d_create_sync(_EGLDriver *drv, _EGLDisplay *dpy, + EGLenum type, const EGLint *attrib_list) +{ + _EGLContext *ctx = _eglGetCurrentContext(); + struct egl_g3d_sync *gsync; + EGLint err; + + if (!ctx || ctx->Resource.Display != dpy) { + _eglError(EGL_BAD_MATCH, "eglCreateSyncKHR"); + return NULL; + } + + gsync = CALLOC_STRUCT(egl_g3d_sync); + if (!gsync) { + _eglError(EGL_BAD_ALLOC, "eglCreateSyncKHR"); + return NULL; + } + + if (!_eglInitSync(&gsync->base, dpy, type, attrib_list)) { + FREE(gsync); + return NULL; + } + + switch (type) { + case EGL_SYNC_REUSABLE_KHR: + err = EGL_SUCCESS; + break; + default: + err = EGL_BAD_ATTRIBUTE; + break; + } + + if (err != EGL_SUCCESS) { + _eglError(err, "eglCreateSyncKHR"); + FREE(gsync); + return NULL; + } + + pipe_mutex_init(gsync->mutex); + pipe_condvar_init(gsync->condvar); + p_atomic_set(&gsync->refs, 1); + + return &gsync->base; +} + +EGLBoolean +egl_g3d_destroy_sync(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSync *sync) +{ + struct egl_g3d_sync *gsync = egl_g3d_sync(sync); + + switch (gsync->base.Type) { + case EGL_SYNC_REUSABLE_KHR: + /* signal the waiters */ + if (gsync->base.SyncStatus != EGL_SIGNALED_KHR) { + gsync->base.SyncStatus = EGL_SIGNALED_KHR; + egl_g3d_signal_sync_condvar(gsync); + } + break; + default: + break; + } + + egl_g3d_unref_sync(gsync); + + return EGL_TRUE; +} + +EGLint +egl_g3d_client_wait_sync(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSync *sync, + EGLint flags, EGLTimeKHR timeout) +{ + struct egl_g3d_sync *gsync = egl_g3d_sync(sync); + EGLint ret = EGL_CONDITION_SATISFIED_KHR; + + if (gsync->base.SyncStatus != EGL_SIGNALED_KHR) { + /* flush if there is a current context */ + if (flags & EGL_SYNC_FLUSH_COMMANDS_BIT_KHR) { + _EGLContext *ctx = _eglGetCurrentContext(); + struct egl_g3d_context *gctx = egl_g3d_context(ctx); + + if (gctx) + gctx->stctxi->flush(gctx->stctxi, PIPE_FLUSH_RENDER_CACHE , NULL); + } + + if (timeout) { + /* reference the sync object in case it is destroyed while waiting */ + egl_g3d_ref_sync(gsync); + + switch (gsync->base.Type) { + case EGL_SYNC_REUSABLE_KHR: + ret = egl_g3d_wait_sync_condvar(gsync, timeout); + break; + default: + break; + } + + egl_g3d_unref_sync(gsync); + } + else { + ret = EGL_TIMEOUT_EXPIRED_KHR; + } + } + + return ret; +} + +EGLBoolean +egl_g3d_signal_sync(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSync *sync, + EGLenum mode) +{ + struct egl_g3d_sync *gsync = egl_g3d_sync(sync); + + /* only for reusable sync */ + if (sync->Type != EGL_SYNC_REUSABLE_KHR) + return _eglError(EGL_BAD_MATCH, "eglSignalSyncKHR"); + + if (gsync->base.SyncStatus != mode) { + gsync->base.SyncStatus = mode; + if (mode == EGL_SIGNALED_KHR) + egl_g3d_signal_sync_condvar(gsync); + } + + return EGL_TRUE; +} + +#endif /* EGL_KHR_reusable_sync */ diff --git a/src/gallium/state_trackers/egl/common/egl_g3d_sync.h b/src/gallium/state_trackers/egl/common/egl_g3d_sync.h new file mode 100644 index 0000000000..3179ca04e1 --- /dev/null +++ b/src/gallium/state_trackers/egl/common/egl_g3d_sync.h @@ -0,0 +1,53 @@ +/* + * Mesa 3-D graphics library + * Version: 7.9 + * + * Copyright (C) 2010 LunarG Inc. + * + * 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 + * 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. + * + * Authors: + * Chia-I Wu + */ + +#ifndef _EGL_G3D_SYNC_H_ +#define _EGL_G3D_SYNC_H_ + +#include "egl_g3d.h" + +#ifdef EGL_KHR_reusable_sync + +_EGLSync * +egl_g3d_create_sync(_EGLDriver *drv, _EGLDisplay *dpy, + EGLenum type, const EGLint *attrib_list); + +EGLBoolean +egl_g3d_destroy_sync(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSync *sync); + +EGLint +egl_g3d_client_wait_sync(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSync *sync, + EGLint flags, EGLTimeKHR timeout); + +EGLBoolean +egl_g3d_signal_sync(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSync *sync, + EGLenum mode); + +#endif /* EGL_KHR_reusable_sync */ + +#endif /* _EGL_G3D_SYNC_H_ */ -- cgit v1.2.3 From 2b2c5c4f5cb4620044eeaa7cc308e696209c7046 Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Sun, 15 Aug 2010 17:09:48 +0800 Subject: egl: Add support for EGL_KHR_fence_sync. Individual drivers still need to support and enable the extension. --- src/egl/main/egldisplay.h | 1 + src/egl/main/eglmisc.c | 1 + src/egl/main/eglsync.c | 9 ++++++++- src/egl/main/eglsync.h | 1 + 4 files changed, 11 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/egl/main/egldisplay.h b/src/egl/main/egldisplay.h index a5c1453067..97c9d196ec 100644 --- a/src/egl/main/egldisplay.h +++ b/src/egl/main/egldisplay.h @@ -64,6 +64,7 @@ struct _egl_extensions EGLBoolean KHR_gl_renderbuffer_image; EGLBoolean KHR_reusable_sync; + EGLBoolean KHR_fence_sync; EGLBoolean KHR_surfaceless_gles1; EGLBoolean KHR_surfaceless_gles2; diff --git a/src/egl/main/eglmisc.c b/src/egl/main/eglmisc.c index 2ef6ba59e3..b10783bcb9 100644 --- a/src/egl/main/eglmisc.c +++ b/src/egl/main/eglmisc.c @@ -98,6 +98,7 @@ _eglUpdateExtensionsString(_EGLDisplay *dpy) _EGL_CHECK_EXTENSION(KHR_gl_renderbuffer_image); _EGL_CHECK_EXTENSION(KHR_reusable_sync); + _EGL_CHECK_EXTENSION(KHR_fence_sync); _EGL_CHECK_EXTENSION(KHR_surfaceless_gles1); _EGL_CHECK_EXTENSION(KHR_surfaceless_gles2); diff --git a/src/egl/main/eglsync.c b/src/egl/main/eglsync.c index 3f51e89acd..b6c62d0087 100644 --- a/src/egl/main/eglsync.c +++ b/src/egl/main/eglsync.c @@ -46,7 +46,8 @@ _eglInitSync(_EGLSync *sync, _EGLDisplay *dpy, EGLenum type, { EGLint err; - if (!(type == EGL_SYNC_REUSABLE_KHR && dpy->Extensions.KHR_reusable_sync)) + if (!(type == EGL_SYNC_REUSABLE_KHR && dpy->Extensions.KHR_reusable_sync) && + !(type == EGL_SYNC_FENCE_KHR && dpy->Extensions.KHR_fence_sync)) return _eglError(EGL_BAD_ATTRIBUTE, "eglCreateSyncKHR"); memset(sync, 0, sizeof(*sync)); @@ -55,6 +56,7 @@ _eglInitSync(_EGLSync *sync, _EGLDisplay *dpy, EGLenum type, sync->Type = type; sync->SyncStatus = EGL_UNSIGNALED_KHR; + sync->SyncCondition = EGL_SYNC_PRIOR_COMMANDS_COMPLETE_KHR; err = _eglParseSyncAttribList(sync, attrib_list); if (err != EGL_SUCCESS) @@ -109,6 +111,11 @@ _eglGetSyncAttribKHR(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSync *sync, case EGL_SYNC_STATUS_KHR: *value = sync->SyncStatus; break; + case EGL_SYNC_CONDITION_KHR: + if (sync->Type != EGL_SYNC_FENCE_KHR) + return _eglError(EGL_BAD_ATTRIBUTE, "eglGetSyncAttribKHR"); + *value = sync->SyncCondition; + break; default: return _eglError(EGL_BAD_ATTRIBUTE, "eglGetSyncAttribKHR"); break; diff --git a/src/egl/main/eglsync.h b/src/egl/main/eglsync.h index a0134784aa..25c467175e 100644 --- a/src/egl/main/eglsync.h +++ b/src/egl/main/eglsync.h @@ -19,6 +19,7 @@ struct _egl_sync EGLenum Type; EGLenum SyncStatus; + EGLenum SyncCondition; }; -- cgit v1.2.3 From f945cb651518025159499999527ff5d4536acaf8 Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Sun, 15 Aug 2010 17:24:14 +0800 Subject: st/egl: Add support for EGL_KHR_fence_sync. The extension is implemented by pipe_fence_handle. --- src/gallium/state_trackers/egl/common/egl_g3d.c | 1 + src/gallium/state_trackers/egl/common/egl_g3d.h | 3 + .../state_trackers/egl/common/egl_g3d_sync.c | 67 ++++++++++++++++++++++ 3 files changed, 71 insertions(+) (limited to 'src') diff --git a/src/gallium/state_trackers/egl/common/egl_g3d.c b/src/gallium/state_trackers/egl/common/egl_g3d.c index 10e2170729..02b9f6aec4 100644 --- a/src/gallium/state_trackers/egl/common/egl_g3d.c +++ b/src/gallium/state_trackers/egl/common/egl_g3d.c @@ -531,6 +531,7 @@ egl_g3d_initialize(_EGLDriver *drv, _EGLDisplay *dpy, dpy->Extensions.KHR_image_pixmap = EGL_TRUE; dpy->Extensions.KHR_reusable_sync = EGL_TRUE; + dpy->Extensions.KHR_fence_sync = EGL_TRUE; if (egl_g3d_add_configs(drv, dpy, 1) == 1) { _eglError(EGL_NOT_INITIALIZED, "eglInitialize(unable to add configs)"); diff --git a/src/gallium/state_trackers/egl/common/egl_g3d.h b/src/gallium/state_trackers/egl/common/egl_g3d.h index dabcf841e2..be450bbede 100644 --- a/src/gallium/state_trackers/egl/common/egl_g3d.h +++ b/src/gallium/state_trackers/egl/common/egl_g3d.h @@ -111,6 +111,9 @@ struct egl_g3d_sync { /* the mutex protects only the condvar, not the struct */ pipe_mutex mutex; pipe_condvar condvar; + + /* for fence sync */ + struct pipe_fence_handle *fence; }; _EGL_DRIVER_TYPECAST(egl_g3d_sync, _EGLSync, obj) diff --git a/src/gallium/state_trackers/egl/common/egl_g3d_sync.c b/src/gallium/state_trackers/egl/common/egl_g3d_sync.c index 3351973d83..ec74e9eb94 100644 --- a/src/gallium/state_trackers/egl/common/egl_g3d_sync.c +++ b/src/gallium/state_trackers/egl/common/egl_g3d_sync.c @@ -71,6 +71,60 @@ egl_g3d_signal_sync_condvar(struct egl_g3d_sync *gsync) pipe_mutex_unlock(gsync->mutex); } +/** + * Insert a fence command to the command stream of the current context. + */ +static EGLint +egl_g3d_insert_fence_sync(struct egl_g3d_sync *gsync) +{ + _EGLContext *ctx = _eglGetCurrentContext(); + struct egl_g3d_context *gctx = egl_g3d_context(ctx); + + /* already checked in egl_g3d_create_sync */ + assert(gctx); + + /* insert the fence command */ + gctx->stctxi->flush(gctx->stctxi, 0x0, &gsync->fence); + if (!gsync->fence) + gsync->base.SyncStatus = EGL_SIGNALED_KHR; + + return EGL_SUCCESS; +} + +/** + * Wait for the fence sync to be signaled. + */ +static EGLint +egl_g3d_wait_fence_sync(struct egl_g3d_sync *gsync, EGLTimeKHR timeout) +{ + EGLint ret; + + if (gsync->fence) { + _EGLDisplay *dpy = gsync->base.Resource.Display; + struct egl_g3d_display *gdpy = egl_g3d_display(dpy); + struct pipe_screen *screen = gdpy->native->screen; + struct pipe_fence_handle *fence = gsync->fence; + + gsync->fence = NULL; + + _eglUnlockMutex(&dpy->Mutex); + /* no timed finish? */ + screen->fence_finish(screen, fence, 0x0); + ret = EGL_CONDITION_SATISFIED_KHR; + _eglLockMutex(&dpy->Mutex); + + gsync->base.SyncStatus = EGL_SIGNALED_KHR; + + screen->fence_reference(screen, &fence, NULL); + egl_g3d_signal_sync_condvar(gsync); + } + else { + ret = egl_g3d_wait_sync_condvar(gsync, timeout); + } + + return ret; +} + static INLINE void egl_g3d_ref_sync(struct egl_g3d_sync *gsync) { @@ -84,6 +138,14 @@ egl_g3d_unref_sync(struct egl_g3d_sync *gsync) pipe_condvar_destroy(gsync->condvar); pipe_mutex_destroy(gsync->mutex); + if (gsync->fence) { + struct egl_g3d_display *gdpy = + egl_g3d_display(gsync->base.Resource.Display); + struct pipe_screen *screen = gdpy->native->screen; + + screen->fence_reference(screen, &gsync->fence, NULL); + } + FREE(gsync); } } @@ -116,6 +178,9 @@ egl_g3d_create_sync(_EGLDriver *drv, _EGLDisplay *dpy, case EGL_SYNC_REUSABLE_KHR: err = EGL_SUCCESS; break; + case EGL_SYNC_FENCE_KHR: + err = egl_g3d_insert_fence_sync(gsync); + break; default: err = EGL_BAD_ATTRIBUTE; break; @@ -181,6 +246,8 @@ egl_g3d_client_wait_sync(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSync *sync, case EGL_SYNC_REUSABLE_KHR: ret = egl_g3d_wait_sync_condvar(gsync, timeout); break; + case EGL_SYNC_FENCE_KHR: + ret = egl_g3d_wait_fence_sync(gsync, timeout); default: break; } -- cgit v1.2.3 From ded92e5dd8eb39bf2a486a6ce95cbef595149582 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Mon, 16 Aug 2010 17:18:14 +0100 Subject: translate: Eliminate void pointer arithmetic. Non-portable. --- src/gallium/auxiliary/translate/translate_generic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/auxiliary/translate/translate_generic.c b/src/gallium/auxiliary/translate/translate_generic.c index 975f23a6f4..ad809db720 100644 --- a/src/gallium/auxiliary/translate/translate_generic.c +++ b/src/gallium/auxiliary/translate/translate_generic.c @@ -372,7 +372,7 @@ static ALWAYS_INLINE void PIPE_CDECL generic_run_one( struct translate_generic * for (attr = 0; attr < nr_attrs; attr++) { float data[4]; - char *dst = vert + tg->attrib[attr].output_offset; + uint8_t *dst = (uint8_t *)vert + tg->attrib[attr].output_offset; if (tg->attrib[attr].type == TRANSLATE_ELEMENT_NORMAL) { const uint8_t *src; -- cgit v1.2.3 From b421cb954673e487074c806d6f98722e46abd4f0 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Mon, 16 Aug 2010 17:20:54 +0100 Subject: translate: Remove unused temporary register. Assuming the side-effect of x86_make_reg is also unnecessary. --- src/gallium/auxiliary/translate/translate_sse.c | 1 - 1 file changed, 1 deletion(-) (limited to 'src') diff --git a/src/gallium/auxiliary/translate/translate_sse.c b/src/gallium/auxiliary/translate/translate_sse.c index c06197c5d6..035ba531c6 100644 --- a/src/gallium/auxiliary/translate/translate_sse.c +++ b/src/gallium/auxiliary/translate/translate_sse.c @@ -495,7 +495,6 @@ static boolean translate_attr_convert( struct translate_sse *p, || a->output_format == PIPE_FORMAT_R32G32B32A32_FLOAT)) { struct x86_reg dataXMM = x86_make_reg(file_XMM, 0); - struct x86_reg tmpXMM = x86_make_reg(file_XMM, 1); for(i = 0; i < output_desc->nr_channels; ++i) { -- cgit v1.2.3 From 0bf63733e54b47daf9f50c32a1fca4039c82def2 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Mon, 16 Aug 2010 09:39:58 -0700 Subject: ir_to_mesa: Support texture rectangle targets --- src/mesa/program/ir_to_mesa.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src') diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp index 2208bc1ce8..b8a35ce162 100644 --- a/src/mesa/program/ir_to_mesa.cpp +++ b/src/mesa/program/ir_to_mesa.cpp @@ -2090,6 +2090,9 @@ ir_to_mesa_visitor::visit(ir_texture *ir) case GLSL_SAMPLER_DIM_CUBE: inst->tex_target = TEXTURE_CUBE_INDEX; break; + case GLSL_SAMPLER_DIM_RECT: + inst->tex_target = TEXTURE_RECT_INDEX; + break; default: assert(!"FINISHME: other texture targets"); } -- cgit v1.2.3 From 68772031e6242aa78864dc9c7c1a607aec5ee7b9 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Mon, 16 Aug 2010 09:43:00 -0700 Subject: ir_to_mesa: Clean up assertions in ir_to_mesa_visitor::visit(ir_texture *) --- src/mesa/program/ir_to_mesa.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp index b8a35ce162..06a6bc3320 100644 --- a/src/mesa/program/ir_to_mesa.cpp +++ b/src/mesa/program/ir_to_mesa.cpp @@ -2093,8 +2093,11 @@ ir_to_mesa_visitor::visit(ir_texture *ir) case GLSL_SAMPLER_DIM_RECT: inst->tex_target = TEXTURE_RECT_INDEX; break; + case GLSL_SAMPLER_DIM_BUF: + assert(!"FINISHME: Implement ARB_texture_buffer_object"); + break; default: - assert(!"FINISHME: other texture targets"); + assert(!"Should not get here."); } this->result = result_src; -- cgit v1.2.3 From fc63e37b971b641dfdff000ba353c4810414c20e Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Mon, 16 Aug 2010 09:45:01 -0700 Subject: ir_to_mesa: Silence unused variable warnings --- src/mesa/program/ir_to_mesa.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp index 06a6bc3320..1fb578516c 100644 --- a/src/mesa/program/ir_to_mesa.cpp +++ b/src/mesa/program/ir_to_mesa.cpp @@ -1632,8 +1632,7 @@ ir_to_mesa_visitor::visit(ir_dereference_record *ir) * ir_dereference handler. */ static struct ir_to_mesa_dst_reg -get_assignment_lhs(ir_dereference *ir, ir_to_mesa_visitor *v, - ir_to_mesa_src_reg *r) +get_assignment_lhs(ir_dereference *ir, ir_to_mesa_visitor *v) { /* 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 @@ -1662,7 +1661,7 @@ ir_to_mesa_visitor::visit(ir_assignment *ir) ir->rhs->accept(this); r = this->result; - l = get_assignment_lhs(ir->lhs, this, &r); + l = get_assignment_lhs(ir->lhs, this); /* FINISHME: This should really set to the correct maximal writemask for each * FINISHME: component written (in the loops below). This case can only @@ -2554,6 +2553,7 @@ GLboolean _mesa_ir_compile_shader(GLcontext *ctx, struct gl_shader *shader) { assert(shader->CompileStatus); + (void) ctx; return GL_TRUE; } -- cgit v1.2.3 From ecec6df9cfe74dbd16f072bc4bbcd90374f8d2c8 Mon Sep 17 00:00:00 2001 From: Marek Olšák Date: Mon, 16 Aug 2010 19:17:02 +0200 Subject: r300g: fix assert in the rasterizer block for r3xx-r4xx Reported-by: Niels Ole Salscheider --- src/gallium/drivers/r300/r300_state_derived.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_state_derived.c b/src/gallium/drivers/r300/r300_state_derived.c index 4a63ed7fc1..c8de3e1c52 100644 --- a/src/gallium/drivers/r300/r300_state_derived.c +++ b/src/gallium/drivers/r300/r300_state_derived.c @@ -211,7 +211,7 @@ static void r300_rs_col(struct r300_rs_block* rs, int id, int ptr, static void r300_rs_col_write(struct r300_rs_block* rs, int id, int fp_offset, enum r300_rs_col_write_type type) { - assert(type != WRITE_COLOR); + assert(type == WRITE_COLOR); rs->inst[id] |= R300_RS_INST_COL_CN_WRITE | R300_RS_INST_COL_ADDR(fp_offset); } -- 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') 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') 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 f437ee85f4a6789d7c3be0d68fd26aa257557b83 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Mon, 16 Aug 2010 13:52:57 -0700 Subject: translate: Move loop variable declaration outside for loop. Fixes MSVC build. --- src/gallium/auxiliary/translate/translate_sse.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/auxiliary/translate/translate_sse.c b/src/gallium/auxiliary/translate/translate_sse.c index 035ba531c6..56c5b36ce2 100644 --- a/src/gallium/auxiliary/translate/translate_sse.c +++ b/src/gallium/auxiliary/translate/translate_sse.c @@ -849,6 +849,7 @@ static boolean translate_attr_convert( struct translate_sse *p, else if(!memcmp(&output_desc->channel[0], &input_desc->channel[0], sizeof(output_desc->channel[0]))) { struct x86_reg tmp = p->tmp_EAX; + unsigned i; if(input_desc->channel[0].size == 8 && input_desc->nr_channels == 4 && output_desc->nr_channels == 4 && swizzle[0] == UTIL_FORMAT_SWIZZLE_W && swizzle[1] == UTIL_FORMAT_SWIZZLE_Z @@ -862,7 +863,7 @@ static boolean translate_attr_convert( struct translate_sse *p, return TRUE; } - for(unsigned i = 0; i < output_desc->nr_channels; ++i) + for(i = 0; i < output_desc->nr_channels; ++i) { switch(output_desc->channel[0].size) { -- 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') 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') 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') 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') 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 From f50df65fcc99f22f912ca9be1a71a4e41a6a6e2e Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Fri, 13 Aug 2010 13:54:25 +1000 Subject: r600g: drop libdrm_radeon link --- src/gallium/targets/dri-r600/Makefile | 2 +- src/gallium/winsys/r600/drm/radeon_bo_pb.c | 186 +++++++++++++++++++++++++++++ 2 files changed, 187 insertions(+), 1 deletion(-) create mode 100644 src/gallium/winsys/r600/drm/radeon_bo_pb.c (limited to 'src') diff --git a/src/gallium/targets/dri-r600/Makefile b/src/gallium/targets/dri-r600/Makefile index 932303d194..ff886b37f2 100644 --- a/src/gallium/targets/dri-r600/Makefile +++ b/src/gallium/targets/dri-r600/Makefile @@ -21,6 +21,6 @@ DRIVER_DEFINES = \ include ../Makefile.dri -DRI_LIB_DEPS += -ldrm_radeon +DRI_LIB_DEPS += symlinks: diff --git a/src/gallium/winsys/r600/drm/radeon_bo_pb.c b/src/gallium/winsys/r600/drm/radeon_bo_pb.c new file mode 100644 index 0000000000..e8e53a971f --- /dev/null +++ b/src/gallium/winsys/r600/drm/radeon_bo_pb.c @@ -0,0 +1,186 @@ +#include "radeon_priv.h" + +#include "util/u_inlines.h" +#include "util/u_memory.h" +#include "util/u_double_list.h" +#include "pipebuffer/pb_buffer.h" +#include "pipebuffer/pb_bufmgr.h" + +struct radeon_bo_pb { + struct pb_buffer b; + struct radeon_bo *bo; + + struct radeon_bo_pbmgr *mgr; + struct list_head maplist; +}; + +extern const struct pb_vtbl radeon_bo_pb_vtbl; + +static INLINE struct radeon_bo_pb *radeon_bo_pb(struct pb_buffer *buf) +{ + assert(buf); + assert(buf->vtbl == &radeon_bo_pb_vtbl); + return (struct radeon_bo_pb *)buf; +} + +struct radeon_bo_pbmgr { + struct pb_manager b; + struct radeon *radeon; + struct list_head buffer_map_list; +}; + +static INLINE struct radeon_bo_pbmgr *radeon_bo_pbmgr(struct pb_manager *mgr) +{ + assert(mgr); + return (struct radeon_bo_pbmgr *)mgr; +} + +static void radeon_bo_pb_destroy(struct pb_buffer *_buf) +{ + struct radeon_bo_pb *buf = radeon_bo_pb(_buf); + + if (buf->bo->data != NULL) { + LIST_DEL(&buf->maplist); + radeon_bo_unmap(buf->mgr->radeon, buf->bo); + } + radeon_bo_decref(buf->mgr->radeon, buf->bo); + FREE(buf); +} + +static void * +radeon_bo_pb_map_internal(struct pb_buffer *_buf, + unsigned flags) +{ + struct radeon_bo_pb *buf = radeon_bo_pb(_buf); + + if (buf->bo->data != NULL) + return buf->bo->data; + + if (flags & PB_USAGE_DONTBLOCK) { + uint32_t domain; + if (radeon_bo_busy(buf->mgr->radeon, buf->bo, &domain)) + return NULL; + } + + if (radeon_bo_map(buf->mgr->radeon, buf->bo)) { + return NULL; + } + LIST_ADDTAIL(&buf->maplist, &buf->mgr->buffer_map_list); + return buf->bo->data; +} + +static void radeon_bo_pb_unmap_internal(struct pb_buffer *_buf) +{ + (void)_buf; +} + +static void +radeon_bo_pb_get_base_buffer(struct pb_buffer *buf, + struct pb_buffer **base_buf, + unsigned *offset) +{ + *base_buf = buf; + *offset = 0; +} + +static enum pipe_error +radeon_bo_pb_validate(struct pb_buffer *_buf, + struct pb_validate *vl, + unsigned flags) +{ + /* Always pinned */ + return PIPE_OK; +} + +static void +radeon_bo_pb_fence(struct pb_buffer *buf, + struct pipe_fence_handle *fence) +{ +} + +const struct pb_vtbl radeon_bo_pb_vtbl = { + radeon_bo_pb_destroy, + radeon_bo_pb_map_internal, + radeon_bo_pb_unmap_internal, + radeon_bo_pb_validate, + radeon_bo_pb_fence, + radeon_bo_pb_get_base_buffer, +}; + +static struct pb_buffer * +radeon_bo_pb_create_buffer(struct pb_manager *_mgr, + pb_size size, + const struct pb_desc *desc) +{ + struct radeon_bo_pbmgr *mgr = radeon_bo_pbmgr(_mgr); + struct radeon *radeon = mgr->radeon; + struct radeon_bo_pb *bo; + uint32_t domain; + + bo = CALLOC_STRUCT(radeon_bo_pb); + if (!bo) + goto error1; + + pipe_reference_init(&bo->b.base.reference, 1); + bo->b.base.alignment = desc->alignment; + bo->b.base.usage = desc->usage; + bo->b.base.size = size; + bo->b.vtbl = &radeon_bo_pb_vtbl; + bo->mgr = mgr; + + LIST_INITHEAD(&bo->maplist); + + bo->bo = radeon_bo(radeon, 0, size, + desc->alignment, NULL); + if (bo->bo == NULL) + goto error2; + return &bo->b; + +error2: + FREE(bo); +error1: + return NULL; +} + +static void +radeon_bo_pbmgr_flush(struct pb_manager *mgr) +{ + /* NOP */ +} + +static void +radeon_bo_pbmgr_destroy(struct pb_manager *_mgr) +{ + struct radeon_bo_pbmgr *mgr = radeon_bo_pbmgr(_mgr); + FREE(mgr); +} + +struct pb_manager *radeon_bo_pbmgr_create(struct radeon *radeon) +{ + struct radeon_bo_pbmgr *mgr; + + mgr = CALLOC_STRUCT(radeon_bo_pbmgr); + if (!mgr) + return NULL; + + mgr->b.destroy = radeon_bo_pbmgr_destroy; + mgr->b.create_buffer = radeon_bo_pb_create_buffer; + mgr->b.flush = radeon_bo_pbmgr_flush; + + mgr->radeon = radeon; + LIST_INITHEAD(&mgr->buffer_map_list); + return &mgr->b; +} + +void radeon_bo_pbmgr_flush_maps(struct pb_manager *_mgr) +{ + struct radeon_bo_pbmgr *mgr = radeon_bo_pbmgr(_mgr); + struct radeon_bo_pb *rpb, *t_rpb; + + LIST_FOR_EACH_ENTRY_SAFE(rpb, t_rpb, &mgr->buffer_map_list, maplist) { + radeon_bo_unmap(mgr->radeon, rpb->bo); + LIST_DEL(&rpb->maplist); + } + + LIST_INITHEAD(&mgr->buffer_map_list); +} -- cgit v1.2.3 From 15a3b42e135a3a2cb463ec3cff80a55dd8528051 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Mon, 16 Aug 2010 18:52:37 -0700 Subject: util: Remove check_os_katmai_support. check_os_katmai_support checks that the operating system running on a SSE-capable processor supports SSE. This is necessary for unpatched 2.2.x and earlier kernels. 2.4.x and later kernels support SSE. check_os_katmai_support will disable SSE capabilities for 32-bit x86 operating systems for which there is no code path. Currently, this function handles Linux, Windows, and several BSDs. Mac OS, Cygwin, and Solaris are several operating systems with no code paths. Rather than add code for the unhandled operating systems, remove this function altogether. This will fix SSE detection on all recent 32-bit x86 operating systems. This completely breaks functionality on unpatched 2.2.x and earlier kernels, although there are likely no Gallium3D users on such operating systems. --- src/gallium/auxiliary/util/u_cpu_detect.c | 120 +----------------------------- 1 file changed, 1 insertion(+), 119 deletions(-) (limited to 'src') diff --git a/src/gallium/auxiliary/util/u_cpu_detect.c b/src/gallium/auxiliary/util/u_cpu_detect.c index 5056351307..b9b9f9257a 100644 --- a/src/gallium/auxiliary/util/u_cpu_detect.c +++ b/src/gallium/auxiliary/util/u_cpu_detect.c @@ -194,123 +194,8 @@ check_os_altivec_support(void) } #endif /* PIPE_ARCH_PPC */ -/* If we're running on a processor that can do SSE, let's see if we - * are allowed to or not. This will catch 2.4.0 or later kernels that - * haven't been configured for a Pentium III but are running on one, - * and RedHat patched 2.2 kernels that have broken exception handling - * support for user space apps that do SSE. - */ -#if defined(PIPE_ARCH_X86) || defined (PIPE_ARCH_X86_64) -static void -check_os_katmai_support(void) -{ -#if defined(PIPE_ARCH_X86) -#if defined(PIPE_OS_FREEBSD) - int has_sse=0, ret; - int len = sizeof (has_sse); - - ret = sysctlbyname("hw.instruction_sse", &has_sse, &len, NULL, 0); - if (ret || !has_sse) - util_cpu_caps.has_sse=0; - -#elif defined(PIPE_OS_NETBSD) || defined(PIPE_OS_OPENBSD) - int has_sse, has_sse2, ret, mib[2]; - int varlen; - - mib[0] = CTL_MACHDEP; - mib[1] = CPU_SSE; - varlen = sizeof (has_sse); - - ret = sysctl(mib, 2, &has_sse, &varlen, NULL, 0); - if (ret < 0 || !has_sse) { - util_cpu_caps.has_sse = 0; - } else { - util_cpu_caps.has_sse = 1; - } - - mib[1] = CPU_SSE2; - varlen = sizeof (has_sse2); - ret = sysctl(mib, 2, &has_sse2, &varlen, NULL, 0); - if (ret < 0 || !has_sse2) { - util_cpu_caps.has_sse2 = 0; - } else { - util_cpu_caps.has_sse2 = 1; - } - util_cpu_caps.has_sse = 0; /* FIXME ?!?!? */ - -#elif defined(PIPE_OS_WINDOWS) - LPTOP_LEVEL_EXCEPTION_FILTER exc_fil; - if (util_cpu_caps.has_sse) { - exc_fil = SetUnhandledExceptionFilter(win32_sig_handler_sse); -#if defined(PIPE_CC_GCC) - __asm __volatile ("xorps %xmm0, %xmm0"); -#elif defined(PIPE_CC_MSVC) - __asm { - xorps xmm0, xmm0 /* executing SSE instruction */ - } -#else -#error Unsupported compiler -#endif - SetUnhandledExceptionFilter(exc_fil); - } -#elif defined(PIPE_OS_LINUX) - struct sigaction saved_sigill; - struct sigaction saved_sigfpe; - - /* Save the original signal handlers. - */ - sigaction(SIGILL, NULL, &saved_sigill); - sigaction(SIGFPE, NULL, &saved_sigfpe); - - signal(SIGILL, (void (*)(int))sigill_handler_sse); - signal(SIGFPE, (void (*)(int))sigfpe_handler_sse); - - /* Emulate test for OSFXSR in CR4. The OS will set this bit if it - * supports the extended FPU save and restore required for SSE. If - * we execute an SSE instruction on a PIII and get a SIGILL, the OS - * doesn't support Streaming SIMD Exceptions, even if the processor - * does. - */ - if (util_cpu_caps.has_sse) { - __asm __volatile ("xorps %xmm1, %xmm0"); - } - - /* Emulate test for OSXMMEXCPT in CR4. The OS will set this bit if - * it supports unmasked SIMD FPU exceptions. If we unmask the - * exceptions, do a SIMD divide-by-zero and get a SIGILL, the OS - * doesn't support unmasked SIMD FPU exceptions. If we get a SIGFPE - * as expected, we're okay but we need to clean up after it. - * - * Are we being too stringent in our requirement that the OS support - * unmasked exceptions? Certain RedHat 2.2 kernels enable SSE by - * setting CR4.OSFXSR but don't support unmasked exceptions. Win98 - * doesn't even support them. We at least know the user-space SSE - * support is good in kernels that do support unmasked exceptions, - * and therefore to be safe I'm going to leave this test in here. - */ - if (util_cpu_caps.has_sse) { - /* test_os_katmai_exception_support(); */ - } - - /* Restore the original signal handlers. - */ - sigaction(SIGILL, &saved_sigill, NULL); - sigaction(SIGFPE, &saved_sigfpe, NULL); - -#else - /* We can't use POSIX signal handling to test the availability of - * SSE, so we disable it by default. - */ - util_cpu_caps.has_sse = 0; -#endif /* __linux__ */ -#endif - -#if defined(PIPE_ARCH_X86_64) - util_cpu_caps.has_sse = 1; -#endif -} - +#if defined(PIPE_ARCH_X86) || defined (PIPE_ARCH_X86_64) static int has_cpuid(void) { #if defined(PIPE_ARCH_X86) @@ -469,9 +354,6 @@ util_cpu_detect(void) util_cpu_caps.cacheline = regs2[2] & 0xFF; } - if (util_cpu_caps.has_sse) - check_os_katmai_support(); - if (!util_cpu_caps.has_sse) { util_cpu_caps.has_sse2 = 0; util_cpu_caps.has_sse3 = 0; -- cgit v1.2.3 From 62383ae6fe5d2ca092e8f9d8dae2ba9562e03d95 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 8 Jul 2010 17:05:42 -0700 Subject: i965: Add disasm for Compr4 instruction compression. --- src/mesa/drivers/dri/i965/brw_disasm.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_disasm.c b/src/mesa/drivers/dri/i965/brw_disasm.c index d230714536..c148dbc087 100644 --- a/src/mesa/drivers/dri/i965/brw_disasm.c +++ b/src/mesa/drivers/dri/i965/brw_disasm.c @@ -206,6 +206,7 @@ char *compr_ctrl[4] = { [0] = "", [1] = "sechalf", [2] = "compr", + [3] = "compr4", }; char *dep_ctrl[4] = { @@ -423,6 +424,11 @@ static int print_opcode (FILE *file, int id) static int reg (FILE *file, GLuint _reg_file, GLuint _reg_nr) { int err = 0; + + /* Clear the Compr4 instruction compression bit. */ + if (_reg_file == BRW_MESSAGE_REGISTER_FILE) + _reg_nr &= ~(1 << 7); + if (_reg_file == BRW_ARCHITECTURE_REGISTER_FILE) { switch (_reg_nr & 0xf0) { case BRW_ARF_NULL: @@ -957,7 +963,16 @@ int brw_disasm (FILE *file, struct brw_instruction *inst, int gen) err |= control(file, "access mode", access_mode, inst->header.access_mode, &space); err |= control (file, "mask control", mask_ctrl, inst->header.mask_control, &space); err |= control (file, "dependency control", dep_ctrl, inst->header.dependency_control, &space); - err |= control (file, "compression control", compr_ctrl, inst->header.compression_control, &space); + + if (inst->header.compression_control == BRW_COMPRESSION_COMPRESSED && + opcode[inst->header.opcode].ndst > 0 && + inst->bits1.da1.dest_reg_file == BRW_MESSAGE_REGISTER_FILE && + inst->bits1.da1.dest_reg_nr & (1 << 7)) { + format (file, " compr4"); + } else { + err |= control (file, "compression control", compr_ctrl, + inst->header.compression_control, &space); + } err |= control (file, "thread control", thread_ctrl, inst->header.thread_control, &space); if (inst->header.opcode == BRW_OPCODE_SEND) err |= control (file, "end of thread", end_of_thread, -- cgit v1.2.3 From 00ce188eb8d6f5c3f345ad674f1aa49ee5940db5 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 16 Aug 2010 19:18:11 -0700 Subject: i965: Use the implied move available in most brw_wm_emit brw_math() calls. This saves an extra message reg move in the program, though I'm not clear on whether it will have any performance impact other than cache footprint. It will also fix those math calls on Sandybridge, where the brw_eu_emit.c brw_math() support relies on the implied move being used. --- src/mesa/drivers/dri/i965/brw_wm_emit.c | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_wm_emit.c b/src/mesa/drivers/dri/i965/brw_wm_emit.c index 053cf13a01..f01fffbd5c 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_emit.c +++ b/src/mesa/drivers/dri/i965/brw_wm_emit.c @@ -862,11 +862,6 @@ void emit_math1(struct brw_wm_compile *c, assert(is_power_of_two(mask & WRITEMASK_XYZW)); - /* If compressed, this will write message reg 2,3 from arg0.x's 16 - * channels. - */ - brw_MOV(p, brw_message_reg(2), arg0[0]); - /* Send two messages to perform all 16 operations: */ brw_push_insn_state(p); @@ -876,7 +871,7 @@ void emit_math1(struct brw_wm_compile *c, function, saturate, 2, - brw_null_reg(), + arg0[0], BRW_MATH_DATA_VECTOR, BRW_MATH_PRECISION_FULL); @@ -887,7 +882,7 @@ void emit_math1(struct brw_wm_compile *c, function, saturate, 3, - brw_null_reg(), + sechalf(arg0[0]), BRW_MATH_DATA_VECTOR, BRW_MATH_PRECISION_FULL); } @@ -915,13 +910,6 @@ void emit_math2(struct brw_wm_compile *c, brw_push_insn_state(p); - brw_set_compression_control(p, BRW_COMPRESSION_NONE); - brw_MOV(p, brw_message_reg(2), arg0[0]); - if (c->dispatch_width == 16) { - brw_set_compression_control(p, BRW_COMPRESSION_2NDHALF); - brw_MOV(p, brw_message_reg(4), sechalf(arg0[0])); - } - brw_set_compression_control(p, BRW_COMPRESSION_NONE); brw_MOV(p, brw_message_reg(3), arg1[0]); if (c->dispatch_width == 16) { @@ -935,7 +923,7 @@ void emit_math2(struct brw_wm_compile *c, function, saturate, 2, - brw_null_reg(), + arg0[0], BRW_MATH_DATA_VECTOR, BRW_MATH_PRECISION_FULL); @@ -948,7 +936,7 @@ void emit_math2(struct brw_wm_compile *c, function, saturate, 4, - brw_null_reg(), + sechalf(arg0[0]), BRW_MATH_DATA_VECTOR, BRW_MATH_PRECISION_FULL); } -- cgit v1.2.3 From 3e58007892cb2e89cb979ab172b7160adc84a44d Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Tue, 17 Aug 2010 13:40:15 +1000 Subject: r600g: add user clip plane support. Apart from the fact that the radeon.h/r600_states.h editing is a nightmare, this wasn't so bad. passes piglit user-clip test now also trivial tests. Signed-off-by: Dave Airlie --- src/gallium/drivers/r600/r600_blit.c | 4 ++- src/gallium/drivers/r600/r600_context.h | 1 + src/gallium/drivers/r600/r600_state.c | 56 ++++++++++++++++++++++++++++++- src/gallium/drivers/r600/radeon.h | 23 +++++++++---- src/gallium/winsys/r600/drm/r600_states.h | 18 +++++++--- 5 files changed, 89 insertions(+), 13 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/r600_blit.c b/src/gallium/drivers/r600/r600_blit.c index f4eedfe4cb..db7aef7ebd 100644 --- a/src/gallium/drivers/r600/r600_blit.c +++ b/src/gallium/drivers/r600/r600_blit.c @@ -47,12 +47,14 @@ static void r600_blitter_save_states(struct r600_context *rctx) if (rctx->viewport) { util_blitter_save_viewport(rctx->blitter, &rctx->viewport->state.viewport); } - /* XXX util_blitter_save_clip(rctx->blitter, &rctx->clip); */ + if (rctx->clip) + util_blitter_save_clip(rctx->blitter, &rctx->clip->state.clip); util_blitter_save_vertex_buffers(rctx->blitter, rctx->nvertex_buffer, rctx->vertex_buffer); /* remove ptr so they don't get deleted */ rctx->blend = NULL; + rctx->clip = NULL; rctx->vs_shader = NULL; rctx->ps_shader = NULL; rctx->rasterizer = NULL; diff --git a/src/gallium/drivers/r600/r600_context.h b/src/gallium/drivers/r600/r600_context.h index 76d5de8653..2ce29720d9 100644 --- a/src/gallium/drivers/r600/r600_context.h +++ b/src/gallium/drivers/r600/r600_context.h @@ -98,6 +98,7 @@ struct r600_context_hw_states { struct radeon_state *config; struct radeon_state *cb_cntl; struct radeon_state *db; + struct radeon_state *ucp[6]; unsigned ps_nresource; unsigned ps_nsampler; struct radeon_state *ps_resource[160]; diff --git a/src/gallium/drivers/r600/r600_state.c b/src/gallium/drivers/r600/r600_state.c index 3efd409ae0..cbbc93c04a 100644 --- a/src/gallium/drivers/r600/r600_state.c +++ b/src/gallium/drivers/r600/r600_state.c @@ -268,6 +268,14 @@ static void r600_set_blend_color(struct pipe_context *ctx, static void r600_set_clip_state(struct pipe_context *ctx, const struct pipe_clip_state *state) { + struct r600_screen *rscreen = r600_screen(ctx->screen); + struct r600_context *rctx = r600_context(ctx); + struct r600_context_state *rstate; + + rstate = r600_context_state(rctx, pipe_clip_type, state); + r600_bind_state(ctx, rstate); + /* refcount is taken care of this */ + r600_delete_state(ctx, rstate); } static void r600_set_constant_buffer(struct pipe_context *ctx, @@ -668,6 +676,29 @@ static struct radeon_state *r600_blend(struct r600_context *rctx) return rstate; } +static struct radeon_state *r600_ucp(struct r600_context *rctx, int clip) +{ + struct r600_screen *rscreen = rctx->screen; + struct radeon_state *rstate; + const struct pipe_clip_state *state = &rctx->clip->state.clip; + + rstate = radeon_state(rscreen->rw, R600_CLIP_TYPE, R600_CLIP + clip); + if (rstate == NULL) + return NULL; + + rstate->states[R600_CLIP__PA_CL_UCP_X_0] = fui(state->ucp[clip][0]); + rstate->states[R600_CLIP__PA_CL_UCP_Y_0] = fui(state->ucp[clip][1]); + rstate->states[R600_CLIP__PA_CL_UCP_Z_0] = fui(state->ucp[clip][2]); + rstate->states[R600_CLIP__PA_CL_UCP_W_0] = fui(state->ucp[clip][3]); + + if (radeon_state_pm4(rstate)) { + radeon_state_decref(rstate); + return NULL; + } + return rstate; + +} + static struct radeon_state *r600_cb(struct r600_context *rctx, int cb) { struct r600_screen *rscreen = rctx->screen; @@ -769,6 +800,7 @@ static struct radeon_state *r600_rasterizer(struct r600_context *rctx) { const struct pipe_rasterizer_state *state = &rctx->rasterizer->state.rasterizer; const struct pipe_framebuffer_state *fb = &rctx->framebuffer->state.framebuffer; + const struct pipe_clip_state *clip = NULL; struct r600_screen *rscreen = rctx->screen; struct radeon_state *rstate; float offset_units = 0, offset_scale = 0; @@ -776,6 +808,9 @@ static struct radeon_state *r600_rasterizer(struct r600_context *rctx) unsigned offset_db_fmt_cntl = 0; unsigned tmp; unsigned prov_vtx = 1; + + if (rctx->clip) + clip = &rctx->clip->state.clip; if (fb->zsbuf) { offset_units = state->offset_units; offset_scale = state->offset_scale * 12.0f; @@ -821,7 +856,11 @@ static struct radeon_state *r600_rasterizer(struct r600_context *rctx) S_0286D4_PNT_SPRITE_TOP_1(1); } } - rstate->states[R600_RASTERIZER__PA_CL_CLIP_CNTL] = 0x00000000; + rstate->states[R600_RASTERIZER__PA_CL_CLIP_CNTL] = 0; + if (clip && clip->nr) { + rstate->states[R600_RASTERIZER__PA_CL_CLIP_CNTL] = S_028810_PS_UCP_MODE(3) | ((1 << clip->nr) - 1); + rstate->states[R600_RASTERIZER__PA_CL_CLIP_CNTL] |= S_028810_CLIP_DISABLE(clip->depth_clamp); + } rstate->states[R600_RASTERIZER__PA_SU_SC_MODE_CNTL] = S_028814_PROVOKING_VTX_LAST(prov_vtx) | S_028814_CULL_FRONT((state->cull_face & PIPE_FACE_FRONT) ? 1 : 0) | @@ -1301,6 +1340,10 @@ int r600_context_hw_states(struct r600_context *rctx) unsigned i; int r; int nr_cbufs = rctx->framebuffer->state.framebuffer.nr_cbufs; + int ucp_nclip = 0; + + if (rctx->clip) + ucp_nclip = rctx->clip->state.clip.nr; /* free previous TODO determine what need to be updated, what * doesn't @@ -1316,6 +1359,9 @@ int r600_context_hw_states(struct r600_context *rctx) for (i = 0; i < 8; i++) { rctx->hw_states.cb[i] = radeon_state_decref(rctx->hw_states.cb[i]); } + for (i = 0; i < 6; i++) { + rctx->hw_states.ucp[i] = radeon_state_decref(rctx->hw_states.ucp[i]); + } for (i = 0; i < rctx->hw_states.ps_nresource; i++) { radeon_state_decref(rctx->hw_states.ps_resource[i]); rctx->hw_states.ps_resource[i] = NULL; @@ -1336,6 +1382,9 @@ int r600_context_hw_states(struct r600_context *rctx) for (i = 0; i < nr_cbufs; i++) { rctx->hw_states.cb[i] = r600_cb(rctx, i); } + for (i = 0; i < ucp_nclip; i++) { + rctx->hw_states.ucp[i] = r600_ucp(rctx, i); + } rctx->hw_states.db = r600_db(rctx); rctx->hw_states.cb_cntl = r600_cb_cntl(rctx); @@ -1357,6 +1406,11 @@ int r600_context_hw_states(struct r600_context *rctx) rctx->hw_states.ps_nresource = rctx->ps_nsampler_view; /* bind states */ + for (i = 0; i < ucp_nclip; i++) { + r = radeon_draw_set(rctx->draw, rctx->hw_states.ucp[i]); + if (r) + return r; + } r = radeon_draw_set(rctx->draw, rctx->hw_states.db); if (r) return r; diff --git a/src/gallium/drivers/r600/radeon.h b/src/gallium/drivers/r600/radeon.h index 8f00a4895a..d36c89d6a7 100644 --- a/src/gallium/drivers/r600/radeon.h +++ b/src/gallium/drivers/r600/radeon.h @@ -191,8 +191,8 @@ struct radeon_ctx { * R600/R700 */ -#define R600_NSTATE 1280 -#define R600_NTYPE 32 +#define R600_NSTATE 1286 +#define R600_NTYPE 33 #define R600_CONFIG 0 #define R600_CONFIG_TYPE 0 @@ -254,10 +254,13 @@ struct radeon_ctx { #define R600_CB7_TYPE 28 #define R600_DB 1277 #define R600_DB_TYPE 29 -#define R600_VGT 1278 -#define R600_VGT_TYPE 30 -#define R600_DRAW 1279 -#define R600_DRAW_TYPE 31 +#define R600_CLIP 1278 +#define R600_CLIP_TYPE 30 +#define R600_VGT 1284 +#define R600_VGT_TYPE 31 +#define R600_DRAW 1285 +#define R600_DRAW_TYPE 32 + /* R600_CONFIG */ #define R600_CONFIG__SQ_CONFIG 0 #define R600_CONFIG__SQ_GPR_RESOURCE_MGMT_1 1 @@ -643,5 +646,11 @@ struct radeon_ctx { #define R600_DRAW__VGT_DRAW_INITIATOR 3 #define R600_DRAW_SIZE 4 #define R600_DRAW_PM4 128 - +/* R600_CLIP */ +#define R600_CLIP__PA_CL_UCP_X_0 0 +#define R600_CLIP__PA_CL_UCP_Y_0 1 +#define R600_CLIP__PA_CL_UCP_Z_0 2 +#define R600_CLIP__PA_CL_UCP_W_0 3 +#define R600_CLIP_SIZE 4 +#define R600_CLIP_PM4 128 #endif diff --git a/src/gallium/winsys/r600/drm/r600_states.h b/src/gallium/winsys/r600/drm/r600_states.h index e40c77d8f6..2d7a1d31c8 100644 --- a/src/gallium/winsys/r600/drm/r600_states.h +++ b/src/gallium/winsys/r600/drm/r600_states.h @@ -283,6 +283,13 @@ static const struct radeon_register R600_VS_CONSTANT_names[] = { {0x0003100C, 0, 0, "SQ_ALU_CONSTANT3_256"}, }; +static const struct radeon_register R600_UCP_names[] = { + {0x00028e20, 0, 0, "PA_CL_UCP0_X"}, + {0x00028e24, 0, 0, "PA_CL_UCP0_Y"}, + {0x00028e28, 0, 0, "PA_CL_UCP0_Z"}, + {0x00028e2c, 0, 0, "PA_CL_UCP0_W"}, +}; + static const struct radeon_register R600_PS_RESOURCE_names[] = { {0x00038000, 0, 0, "RESOURCE0_WORD0"}, {0x00038004, 0, 0, "RESOURCE0_WORD1"}, @@ -503,8 +510,10 @@ static struct radeon_type R600_types[] = { { 128, 1275, 0x00000000, 0x00000000, 0x0000, 0, "R600_CB6", 7, r600_state_pm4_cb0, R600_CB6_names}, { 128, 1276, 0x00000000, 0x00000000, 0x0000, 0, "R600_CB7", 7, r600_state_pm4_cb0, R600_CB7_names}, { 128, 1277, 0x00000000, 0x00000000, 0x0000, 0, "R600_DB", 6, r600_state_pm4_db, R600_DB_names}, - { 128, 1278, 0x00000000, 0x00000000, 0x0000, 0, "R600_VGT", 11, r600_state_pm4_vgt, R600_VGT_names}, - { 128, 1279, 0x00000000, 0x00000000, 0x0000, 0, "R600_DRAW", 4, r600_state_pm4_draw, R600_DRAW_names}, + { 128, 1278, 0x00028e20, 0x00028e70, 0x0010, 0, "R600_UCP", 4, r600_state_pm4_generic, R600_UCP_names}, + { 128, 1284, 0x00000000, 0x00000000, 0x0000, 0, "R600_VGT", 11, r600_state_pm4_vgt, R600_VGT_names}, + { 128, 1285, 0x00000000, 0x00000000, 0x0000, 0, "R600_DRAW", 4, r600_state_pm4_draw, R600_DRAW_names}, + }; static struct radeon_type R700_types[] = { @@ -538,8 +547,9 @@ static struct radeon_type R700_types[] = { { 128, 1275, 0x00000000, 0x00000000, 0x0000, 0, "R600_CB6", 7, r600_state_pm4_cb0, R600_CB6_names}, { 128, 1276, 0x00000000, 0x00000000, 0x0000, 0, "R600_CB7", 7, r600_state_pm4_cb0, R600_CB7_names}, { 128, 1277, 0x00000000, 0x00000000, 0x0000, 0, "R600_DB", 6, r700_state_pm4_db, R600_DB_names}, - { 128, 1278, 0x00000000, 0x00000000, 0x0000, 0, "R600_VGT", 11, r600_state_pm4_vgt, R600_VGT_names}, - { 128, 1279, 0x00000000, 0x00000000, 0x0000, 0, "R600_DRAW", 4, r600_state_pm4_draw, R600_DRAW_names}, + { 128, 1278, 0x00028e20, 0x00028e70, 0x0010, 0, "R600_UCP", 4, r600_state_pm4_generic, R600_UCP_names}, + { 128, 1284, 0x00000000, 0x00000000, 0x0000, 0, "R600_VGT", 11, r600_state_pm4_vgt, R600_VGT_names}, + { 128, 1285, 0x00000000, 0x00000000, 0x0000, 0, "R600_DRAW", 4, r600_state_pm4_draw, R600_DRAW_names}, }; #endif -- cgit v1.2.3 From 6043ee6e62800f4f7d2c62756b4c91cbf2639061 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Tue, 17 Aug 2010 15:16:53 +1000 Subject: r600g: kill event type magic number in winsys these events have names, use them. --- src/gallium/winsys/r600/drm/r600_state.c | 6 +++--- src/gallium/winsys/r600/drm/r600d.h | 2 ++ 2 files changed, 5 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/gallium/winsys/r600/drm/r600_state.c b/src/gallium/winsys/r600/drm/r600_state.c index d17d6e7954..2facec75de 100644 --- a/src/gallium/winsys/r600/drm/r600_state.c +++ b/src/gallium/winsys/r600/drm/r600_state.c @@ -233,7 +233,7 @@ static int r600_state_pm4_config(struct radeon_state *state) state->pm4[state->cpm4++] = 0x80000000; state->pm4[state->cpm4++] = 0x80000000; state->pm4[state->cpm4++] = PKT3(PKT3_EVENT_WRITE, 0); - state->pm4[state->cpm4++] = 0x00000016; + state->pm4[state->cpm4++] = EVENT_TYPE_CACHE_FLUSH_AND_INV_EVENT; state->pm4[state->cpm4++] = PKT3(PKT3_SET_CONFIG_REG, 1); state->pm4[state->cpm4++] = 0x00000010; state->pm4[state->cpm4++] = 0x00028000; @@ -246,7 +246,7 @@ static int r700_state_pm4_config(struct radeon_state *state) state->pm4[state->cpm4++] = 0x80000000; state->pm4[state->cpm4++] = 0x80000000; state->pm4[state->cpm4++] = PKT3(PKT3_EVENT_WRITE, 0); - state->pm4[state->cpm4++] = 0x00000016; + state->pm4[state->cpm4++] = EVENT_TYPE_CACHE_FLUSH_AND_INV_EVENT; state->pm4[state->cpm4++] = PKT3(PKT3_SET_CONFIG_REG, 1); state->pm4[state->cpm4++] = 0x00000010; state->pm4[state->cpm4++] = 0x00028000; @@ -314,7 +314,7 @@ static int r600_state_pm4_draw(struct radeon_state *state) state->pm4[state->cpm4++] = state->states[R600_DRAW__VGT_DRAW_INITIATOR]; } state->pm4[state->cpm4++] = PKT3(PKT3_EVENT_WRITE, 0); - state->pm4[state->cpm4++] = 0x00000016; + state->pm4[state->cpm4++] = EVENT_TYPE_CACHE_FLUSH_AND_INV_EVENT; return 0; } diff --git a/src/gallium/winsys/r600/drm/r600d.h b/src/gallium/winsys/r600/drm/r600d.h index 5d13378627..235b2b3d97 100644 --- a/src/gallium/winsys/r600/drm/r600d.h +++ b/src/gallium/winsys/r600/drm/r600d.h @@ -82,6 +82,8 @@ #define PKT3_SET_CTL_CONST 0x6F #define PKT3_SURFACE_BASE_UPDATE 0x73 +#define EVENT_TYPE_CACHE_FLUSH_AND_INV_EVENT 0x16 + #define PKT_TYPE_S(x) (((x) & 0x3) << 30) #define PKT_TYPE_G(x) (((x) >> 30) & 0x3) #define PKT_TYPE_C 0x3FFFFFFF -- cgit v1.2.3 From 1c2a44e445fa4d3bd6f95d9c63041c222268724a Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Tue, 17 Aug 2010 19:01:18 +1000 Subject: r300g: fix context destroy under hyperz we were destroying the mm before unrefing all the objects, so segfault. Signed-off-by: Dave Airlie --- src/gallium/drivers/r300/r300_context.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_context.c b/src/gallium/drivers/r300/r300_context.c index a83ad892ea..852d88af54 100644 --- a/src/gallium/drivers/r300/r300_context.c +++ b/src/gallium/drivers/r300/r300_context.c @@ -119,15 +119,15 @@ static void r300_destroy_context(struct pipe_context* context) if (r300->upload_ib) u_upload_destroy(r300->upload_ib); - if (r300->zmask_mm) - r300_hyperz_destroy_mm(r300); - if (r300->tran.translate_cache) translate_cache_destroy(r300->tran.translate_cache); /* XXX: This function assumes r300->query_list was initialized */ r300_release_referenced_objects(r300); + if (r300->zmask_mm) + r300_hyperz_destroy_mm(r300); + if (r300->cs) r300->rws->cs_destroy(r300->cs); -- cgit v1.2.3 From 0aa41e1d9677bde9ed00751730acd23d636993eb Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Tue, 17 Aug 2010 20:54:45 +1000 Subject: mesa: fix es1/2 build hopefully needed to add cpp rules and includes properly for es1/es2 --- src/mesa/Makefile | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src') diff --git a/src/mesa/Makefile b/src/mesa/Makefile index f97720093c..ef31fd24f0 100644 --- a/src/mesa/Makefile +++ b/src/mesa/Makefile @@ -43,6 +43,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) +ES1_INCLUDES := -I$(TOP)/src/glsl $(ES1_INCLUDES) +ES2_INCLUDES := -I$(TOP)/src/glsl $(ES2_INCLUDES) # For symbol_table.h in glsl compiler headers. MESA_INCLUDES := -I$(TOP)/src/mesa/shader $(MESA_INCLUDES) @@ -68,12 +70,18 @@ $(MESA_OBJ_DIR)/%.o: %.S $(ES1_OBJ_DIR)/%.o: %.c $(call mesa-cc-c,ES1) +$(ES1_OBJ_DIR)/%.o: %.cpp + $(call mesa-cxx-c,ES1) + $(ES1_OBJ_DIR)/%.o: %.S $(call mesa-cc-c,ES1) $(ES2_OBJ_DIR)/%.o: %.c $(call mesa-cc-c,ES2) +$(ES2_OBJ_DIR)/%.o: %.cpp + $(call mesa-cxx-c,ES2) + $(ES2_OBJ_DIR)/%.o: %.S $(call mesa-cc-c,ES2) -- cgit v1.2.3 From 37e5f784220248753647801c455eb61e49e16292 Mon Sep 17 00:00:00 2001 From: nobled Date: Mon, 16 Aug 2010 16:46:14 +0000 Subject: gallivm: Fix and re-enable MMX-disabling code MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: José Fonseca --- src/gallium/auxiliary/gallivm/lp_bld_misc.cpp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'src') diff --git a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp index 6d5410d970..92f9adfc18 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp +++ b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp @@ -143,7 +143,6 @@ lp_set_target_options(void) llvm::UnsafeFPMath = true; #endif -#if 0 /* * LLVM will generate MMX instructions for vectors <= 64 bits, leading to * innefficient code, and in 32bit systems, to the corruption of the FPU @@ -152,10 +151,8 @@ lp_set_target_options(void) * See also: * - http://llvm.org/bugs/show_bug.cgi?id=3287 * - http://l4.me.uk/post/2009/06/07/llvm-wrinkle-3-configuration-what-configuration/ - * - * XXX: Unfortunately this is not working. */ - static boolean first = FALSE; + static boolean first = TRUE; if (first) { static const char* options[] = { "prog", @@ -164,7 +161,6 @@ lp_set_target_options(void) llvm::cl::ParseCommandLineOptions(2, const_cast(options)); first = FALSE; } -#endif } -- cgit v1.2.3 From 7f36b2980bcd91e45a3f7ec91b6dcc2067ccc8b1 Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Tue, 17 Aug 2010 19:24:18 +0800 Subject: targets/egl: Link with DRI_LIB_DEPS. Use DRI_LIB_DEPS when linking GL/GLES state trackers. This fixes missing talloc symbol errors, and is hopefully more future proof. --- src/gallium/targets/egl/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/gallium/targets/egl/Makefile b/src/gallium/targets/egl/Makefile index 1e4bb4d94c..1585e2dc20 100644 --- a/src/gallium/targets/egl/Makefile +++ b/src/gallium/targets/egl/Makefile @@ -119,17 +119,17 @@ endif # OpenGL state tracker GL_CPPFLAGS := -I$(TOP)/src/mesa $(API_DEFINES) -GL_SYS := -lpthread -lm -L$(TOP)/$(LIB_DIR) -l$(GL_LIB) +GL_SYS := $(DRI_LIB_DEPS) -L$(TOP)/$(LIB_DIR) -l$(GL_LIB) GL_LIBS := $(TOP)/src/mesa/libmesagallium.a # OpenGL ES 1.x state tracker GLESv1_CM_CPPFLAGS := -I$(TOP)/src/mesa -GLESv1_CM_SYS := -lpthread -lm -L$(TOP)/$(LIB_DIR) -l$(GLESv1_CM_LIB) +GLESv1_CM_SYS := $(DRI_LIB_DEPS) -L$(TOP)/$(LIB_DIR) -l$(GLESv1_CM_LIB) GLESv1_CM_LIBS := $(TOP)/src/mesa/libes1gallium.a # OpenGL ES 2.x state tracker GLESv2_CPPFLAGS := -I$(TOP)/src/mesa -GLESv2_SYS := -lpthread -lm -L$(TOP)/$(LIB_DIR) -l$(GLESv2_LIB) +GLESv2_SYS := $(DRI_LIB_DEPS) -L$(TOP)/$(LIB_DIR) -l$(GLESv2_LIB) GLESv2_LIBS := $(TOP)/src/mesa/libes2gallium.a # OpenVG state tracker -- cgit v1.2.3 From 6cee1d6adfba45508e181ad61377dfc95cf82674 Mon Sep 17 00:00:00 2001 From: Alex Deucher Date: Tue, 17 Aug 2010 10:42:06 -0400 Subject: r600c: fix dword miscount in blit emit code --- src/mesa/drivers/dri/r600/r600_blit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r600/r600_blit.c b/src/mesa/drivers/dri/r600/r600_blit.c index 4fd425b809..ef47ae1c05 100644 --- a/src/mesa/drivers/dri/r600/r600_blit.c +++ b/src/mesa/drivers/dri/r600/r600_blit.c @@ -1454,7 +1454,7 @@ set_default_state(context_t *context) SETbit(sq_dyn_gpr_cntl_ps_flush_req, VS_PC_LIMIT_ENABLE_bit); } - BEGIN_BATCH_NO_AUTOSTATE(117); + BEGIN_BATCH_NO_AUTOSTATE(120); R600_OUT_BATCH_REGSEQ(SQ_CONFIG, 6); R600_OUT_BATCH(sq_config); R600_OUT_BATCH(sq_gpr_resource_mgmt_1); -- cgit v1.2.3 From 1b708d8f4dd1a853de8537e81e6d5bf8c9f2aed1 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 17 Aug 2010 12:37:49 -0700 Subject: mesa: Dump shader source before validating the shader. This will make extracting source to produce minimal testcases for shader compile issues easier. --- src/mesa/program/ir_to_mesa.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp index 1fb578516c..7fff66c78b 100644 --- a/src/mesa/program/ir_to_mesa.cpp +++ b/src/mesa/program/ir_to_mesa.cpp @@ -2627,6 +2627,11 @@ _mesa_glsl_compile_shader(GLcontext *ctx, struct gl_shader *shader) state->error = preprocess(state, &source, &state->info_log, &ctx->Extensions); + if (ctx->Shader.Flags & GLSL_DUMP) { + printf("GLSL source for shader %d:\n", shader->Name); + printf("%s\n", shader->Source); + } + if (!state->error) { _mesa_glsl_lexer_ctor(state, source); _mesa_glsl_parse(state); @@ -2662,15 +2667,10 @@ _mesa_glsl_compile_shader(GLcontext *ctx, struct gl_shader *shader) _mesa_write_shader_to_file(shader); } - if (ctx->Shader.Flags & GLSL_DUMP) { - printf("GLSL source for shader %d:\n", shader->Name); - printf("%s\n", shader->Source); - - if (shader->CompileStatus) { - printf("GLSL IR for shader %d:\n", shader->Name); - _mesa_print_ir(shader->ir, NULL); - printf("\n\n"); - } + if ((ctx->Shader.Flags & GLSL_DUMP) && shader->CompileStatus) { + printf("GLSL IR for shader %d:\n", shader->Name); + _mesa_print_ir(shader->ir, NULL); + printf("\n\n"); } /* Retain any live IR, but trash the rest. */ -- cgit v1.2.3 From 664364052f362af2789e6b0fa88b6a5ba66ba936 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Tue, 17 Aug 2010 12:57:28 -0700 Subject: ir_constant: Don't assert on out-of-bounds array accesses Several optimization paths, including constant folding, can lead to accessing an ir_constant array with an out of bounds index. The GLSL spec lets us produce "undefined" results, but it does not let us crash. Fixes piglit test case glsl-array-bounds-01 and glsl-array-bounds-03. --- src/glsl/ir.cpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/glsl/ir.cpp b/src/glsl/ir.cpp index dd059e470d..ebb592792b 100644 --- a/src/glsl/ir.cpp +++ b/src/glsl/ir.cpp @@ -519,7 +519,21 @@ ir_constant * ir_constant::get_array_element(unsigned i) const { assert(this->type->is_array()); - assert(i < this->type->length); + + /* From page 35 (page 41 of the PDF) of the GLSL 1.20 spec: + * + * "Behavior is undefined if a shader subscripts an array with an index + * less than 0 or greater than or equal to the size the array was + * declared with." + * + * Most out-of-bounds accesses are removed before things could get this far. + * There are cases where non-constant array index values can get constant + * folded. + */ + if (int(i) < 0) + i = 0; + else if (i >= this->type->length) + i = this->type->length - 1; return array_elements[i]; } -- cgit v1.2.3 From f166d94fac8383b4c56f899ead0b7c06151e16d9 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 17 Aug 2010 13:27:44 -0700 Subject: glsl: Make ir_algebraic new expressions allocate out of the parent. This could reduce the amount of memory used by a shader tree after optimization, and increases consistency with other passes. --- src/glsl/ir_algebraic.cpp | 38 ++++++++++++++++++++++---------------- 1 file changed, 22 insertions(+), 16 deletions(-) (limited to 'src') diff --git a/src/glsl/ir_algebraic.cpp b/src/glsl/ir_algebraic.cpp index a66c820a27..0092eea036 100644 --- a/src/glsl/ir_algebraic.cpp +++ b/src/glsl/ir_algebraic.cpp @@ -43,6 +43,7 @@ public: ir_algebraic_visitor() { this->progress = false; + this->mem_ctx = NULL; } virtual ~ir_algebraic_visitor() @@ -59,6 +60,8 @@ public: int op1, ir_expression *ir2, int op2); + + void *mem_ctx; bool progress; }; @@ -231,6 +234,9 @@ ir_algebraic_visitor::handle_expression(ir_expression *ir) op_expr[i] = ir->operands[i]->as_expression(); } + if (this->mem_ctx == NULL) + this->mem_ctx = talloc_parent(ir); + switch (ir->operation) { case ir_unop_logic_not: { enum ir_expression_operation new_op = ir_unop_logic_not; @@ -254,10 +260,10 @@ ir_algebraic_visitor::handle_expression(ir_expression *ir) if (new_op != ir_unop_logic_not) { this->progress = true; - return new(ir) ir_expression(new_op, - ir->type, - op_expr[0]->operands[0], - op_expr[0]->operands[1]); + return new(mem_ctx) ir_expression(new_op, + ir->type, + op_expr[0]->operands[0], + op_expr[0]->operands[1]); } break; @@ -287,10 +293,10 @@ ir_algebraic_visitor::handle_expression(ir_expression *ir) 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); + return new(mem_ctx) ir_expression(ir_unop_neg, + ir->type, + ir->operands[1], + NULL); } if (is_vec_zero(op_const[1])) { this->progress = true; @@ -328,10 +334,10 @@ ir_algebraic_visitor::handle_expression(ir_expression *ir) 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); + return new(mem_ctx) ir_expression(ir_unop_rcp, + ir->type, + ir->operands[1], + NULL); } if (is_vec_one(op_const[1])) { this->progress = true; @@ -353,10 +359,10 @@ ir_algebraic_visitor::handle_expression(ir_expression *ir) /* 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); + return new(mem_ctx) ir_expression(ir_unop_rsq, + ir->type, + op_expr[0]->operands[0], + NULL); } break; -- cgit v1.2.3 From 0e6066df633f4594fd6fb8ceeb12b15561c57a48 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 17 Aug 2010 13:24:50 -0700 Subject: glsl: When doing algebraic simplification, make sure the type still matches. When simplifying (vec4(1.0) / (float(x))) to rcp(float(x)), we forgot to produce a vec4, angering ir_validate when starting alien-arena. Fixes: glsl-algebraic-add-zero-2 glsl-algebraic-div-one-2 glsl-algebraic-mul-one-2 glsl-algebraic-sub-zero-3 glsl-algebraic-rcp-sqrt-2 --- src/glsl/ir_algebraic.cpp | 46 ++++++++++++++++++++++++++++++++++------------ 1 file changed, 34 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/glsl/ir_algebraic.cpp b/src/glsl/ir_algebraic.cpp index 0092eea036..b731ba05be 100644 --- a/src/glsl/ir_algebraic.cpp +++ b/src/glsl/ir_algebraic.cpp @@ -60,8 +60,11 @@ public: int op1, ir_expression *ir2, int op2); + ir_rvalue *swizzle_if_required(ir_expression *expr, + ir_rvalue *operand); void *mem_ctx; + bool progress; }; @@ -219,11 +222,27 @@ ir_algebraic_visitor::reassociate_constant(ir_expression *ir1, int const_index, return false; } +/* When eliminating an expression and just returning one of its operands, + * we may need to swizzle that operand out to a vector if the expression was + * vector type. + */ +ir_rvalue * +ir_algebraic_visitor::swizzle_if_required(ir_expression *expr, + ir_rvalue *operand) +{ + if (expr->type->is_vector() && operand->type->is_scalar()) { + return new(mem_ctx) ir_swizzle(operand, 0, 0, 0, 0, + expr->type->vector_elements); + } else + return operand; +} + ir_rvalue * ir_algebraic_visitor::handle_expression(ir_expression *ir) { ir_constant *op_const[2] = {NULL, NULL}; ir_expression *op_expr[2] = {NULL, NULL}; + ir_expression *temp; unsigned int i; for (i = 0; i < ir->get_num_operands(); i++) { @@ -272,11 +291,11 @@ ir_algebraic_visitor::handle_expression(ir_expression *ir) case ir_binop_add: if (is_vec_zero(op_const[0])) { this->progress = true; - return ir->operands[1]; + return swizzle_if_required(ir, ir->operands[1]); } if (is_vec_zero(op_const[1])) { this->progress = true; - return ir->operands[0]; + return swizzle_if_required(ir, ir->operands[0]); } /* Reassociate addition of constants so that we can do constant @@ -293,25 +312,26 @@ ir_algebraic_visitor::handle_expression(ir_expression *ir) case ir_binop_sub: if (is_vec_zero(op_const[0])) { this->progress = true; - return new(mem_ctx) ir_expression(ir_unop_neg, - ir->type, + temp = new(mem_ctx) ir_expression(ir_unop_neg, + ir->operands[1]->type, ir->operands[1], NULL); + return swizzle_if_required(ir, temp); } if (is_vec_zero(op_const[1])) { this->progress = true; - return ir->operands[0]; + return swizzle_if_required(ir, ir->operands[0]); } break; case ir_binop_mul: if (is_vec_one(op_const[0])) { this->progress = true; - return ir->operands[1]; + return swizzle_if_required(ir, ir->operands[1]); } if (is_vec_one(op_const[1])) { this->progress = true; - return ir->operands[0]; + return swizzle_if_required(ir, ir->operands[0]); } if (is_vec_zero(op_const[0]) || is_vec_zero(op_const[1])) { @@ -334,14 +354,15 @@ ir_algebraic_visitor::handle_expression(ir_expression *ir) case ir_binop_div: if (is_vec_one(op_const[0]) && ir->type->base_type == GLSL_TYPE_FLOAT) { this->progress = true; - return new(mem_ctx) ir_expression(ir_unop_rcp, - ir->type, + temp = new(mem_ctx) ir_expression(ir_unop_rcp, + ir->operands[1]->type, ir->operands[1], NULL); + return swizzle_if_required(ir, temp); } if (is_vec_one(op_const[1])) { this->progress = true; - return ir->operands[0]; + return swizzle_if_required(ir, ir->operands[0]); } break; @@ -359,10 +380,11 @@ ir_algebraic_visitor::handle_expression(ir_expression *ir) /* 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(mem_ctx) ir_expression(ir_unop_rsq, - ir->type, + temp = new(mem_ctx) ir_expression(ir_unop_rsq, + op_expr[0]->operands[0]->type, op_expr[0]->operands[0], NULL); + return swizzle_if_required(ir, temp); } break; -- cgit v1.2.3 From 147ca9f3fc107b58bd6e1504c997af82a37de5ec Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 17 Aug 2010 13:59:08 -0700 Subject: i965: Add support for DP2 in the VS. Fixes glsl-vs-dot-vec2. --- src/mesa/drivers/dri/i965/brw_vs_emit.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_vs_emit.c b/src/mesa/drivers/dri/i965/brw_vs_emit.c index fab6b4f3d5..7b946eb0d8 100644 --- a/src/mesa/drivers/dri/i965/brw_vs_emit.c +++ b/src/mesa/drivers/dri/i965/brw_vs_emit.c @@ -47,6 +47,7 @@ brw_vs_arg_can_be_immediate(enum prog_opcode opcode, int arg) [OPCODE_MOV] = 1, [OPCODE_ADD] = 2, [OPCODE_CMP] = 3, + [OPCODE_DP2] = 2, [OPCODE_DP3] = 2, [OPCODE_DP4] = 2, [OPCODE_DPH] = 2, @@ -1654,6 +1655,9 @@ void brw_vs_emit(struct brw_vs_compile *c ) case OPCODE_COS: emit_math1(c, BRW_MATH_FUNCTION_COS, dst, args[0], BRW_MATH_PRECISION_FULL); break; + case OPCODE_DP2: + brw_DP2(p, dst, args[0], args[1]); + break; case OPCODE_DP3: brw_DP3(p, dst, args[0], args[1]); break; -- cgit v1.2.3 From 608f749ec3fc655d3e67e572fa2e256a42c16878 Mon Sep 17 00:00:00 2001 From: Jerome Glisse Date: Tue, 17 Aug 2010 17:23:20 -0400 Subject: r600g: fix fake pixel output Signed-off-by: Jerome Glisse --- src/gallium/drivers/r600/r600_shader.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/r600_shader.c b/src/gallium/drivers/r600/r600_shader.c index 956c7e7930..55247f159d 100644 --- a/src/gallium/drivers/r600/r600_shader.c +++ b/src/gallium/drivers/r600/r600_shader.c @@ -504,7 +504,7 @@ int r600_shader_from_tgsi(const struct tgsi_token *tokens, struct r600_shader *s output[0].swizzle_z = 7; output[0].swizzle_w = 7; output[0].barrier = 1; - output[0].type = V_SQ_CF_ALLOC_EXPORT_WORD0_SQ_EXPORT_PARAM; + output[0].type = V_SQ_CF_ALLOC_EXPORT_WORD0_SQ_EXPORT_PIXEL; output[0].array_base = 0; output[0].inst = V_SQ_CF_ALLOC_EXPORT_WORD1_SQ_CF_INST_EXPORT; noutput++; -- cgit v1.2.3 From 5a38e70d59eb54aa375fb0f19c824bb74b71486d Mon Sep 17 00:00:00 2001 From: Benjamin Segovia Date: Mon, 16 Aug 2010 20:40:09 -0700 Subject: prog_optimize: Only merge writes to temporary registers In one optimization pass, register files may have been messed therefore merging instructions which use the same index in two different register files. --- src/mesa/program/prog_optimize.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/program/prog_optimize.c b/src/mesa/program/prog_optimize.c index ab878755e2..0dc779073d 100644 --- a/src/mesa/program/prog_optimize.c +++ b/src/mesa/program/prog_optimize.c @@ -758,7 +758,11 @@ _mesa_remove_extra_moves(struct gl_program *prog) nesting--; break; case OPCODE_MOV: - if (i > 0 && can_downward_mov_be_modifed(mov) && nesting == 0) { + if (i > 0 && + can_downward_mov_be_modifed(mov) && + mov->SrcReg[0].File == PROGRAM_TEMPORARY && + nesting == 0) + { /* see if this MOV can be removed */ const GLuint id = mov->SrcReg[0].Index; -- cgit v1.2.3 From 40e114b5dc60c5e196a86e33c2436b099ed9f392 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Tue, 17 Aug 2010 14:55:50 -0700 Subject: linker: Demote user-defined varyings in the VS-only case Fixes piglit test case glsl-vs-ff-frag and bugzilla #29623. --- src/glsl/linker.cpp | 42 ++++++++++++++++++++++++++++-------------- 1 file changed, 28 insertions(+), 14 deletions(-) (limited to 'src') diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp index 22cdd76015..4172e41910 100644 --- a/src/glsl/linker.cpp +++ b/src/glsl/linker.cpp @@ -1104,6 +1104,28 @@ assign_attribute_locations(gl_shader_program *prog, unsigned max_attribute_index } +/** + * Demote shader outputs that are not read to being just plain global variables + */ +void +demote_unread_shader_outputs(gl_shader *sh) +{ + foreach_list(node, sh->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. + */ + if (var->location == -1) { + var->mode = ir_var_auto; + } + } +} + + void assign_varying_locations(struct gl_shader_program *prog, gl_shader *producer, gl_shader *consumer) @@ -1152,19 +1174,7 @@ assign_varying_locations(struct gl_shader_program *prog, 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. - */ - if (var->location == -1) { - var->mode = ir_var_auto; - } - } + demote_unread_shader_outputs(producer); foreach_list(node, consumer->ir) { ir_variable *const var = ((ir_instruction *) node)->as_variable(); @@ -1320,7 +1330,7 @@ link_shaders(struct gl_shader_program *prog) assign_uniform_locations(prog); - if (prog->_LinkedShaders[0]->Type == GL_VERTEX_SHADER) + 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 @@ -1329,6 +1339,10 @@ link_shaders(struct gl_shader_program *prog) if (!assign_attribute_locations(prog, 16)) goto done; + if (prog->_NumLinkedShaders == 1) + demote_unread_shader_outputs(prog->_LinkedShaders[0]); + } + for (unsigned i = 1; i < prog->_NumLinkedShaders; i++) assign_varying_locations(prog, prog->_LinkedShaders[i - 1], -- cgit v1.2.3 From 8f5f44c9c8fa59e36efdf1acf3543ad81cb865d5 Mon Sep 17 00:00:00 2001 From: Henri Verbeet Date: Tue, 17 Aug 2010 18:25:32 -0400 Subject: r600c: Handle reads from PROGRAM_OUTPUT with glsl2, reads from outputs are legal --- src/mesa/drivers/dri/r600/r700_assembler.c | 25 +++++++++++++++++++------ src/mesa/drivers/dri/r600/r700_assembler.h | 2 +- 2 files changed, 20 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r600/r700_assembler.c b/src/mesa/drivers/dri/r600/r700_assembler.c index 9c954cbf70..94bc26145d 100644 --- a/src/mesa/drivers/dri/r600/r700_assembler.c +++ b/src/mesa/drivers/dri/r600/r700_assembler.c @@ -1357,7 +1357,7 @@ GLboolean assemble_src(r700_AssemblerBase *pAsm, break; case PROGRAM_INPUT: setaddrmode_PVSSRC(&(pAsm->S[fld].src), ADDR_ABSOLUTE); - pAsm->S[fld].src.rtype = SRC_REG_INPUT; + pAsm->S[fld].src.rtype = SRC_REG_GPR; switch (pAsm->currentShaderType) { case SPT_FP: @@ -1368,6 +1368,19 @@ GLboolean assemble_src(r700_AssemblerBase *pAsm, break; } break; + case PROGRAM_OUTPUT: + setaddrmode_PVSSRC(&(pAsm->S[fld].src), ADDR_ABSOLUTE); + pAsm->S[fld].src.rtype = SRC_REG_GPR; + switch (pAsm->currentShaderType) + { + case SPT_FP: + pAsm->S[fld].src.reg = pAsm->uiFP_OutputMap[pILInst->SrcReg[src].Index]; + break; + case SPT_VP: + pAsm->S[fld].src.reg = pAsm->ucVP_OutputMap[pILInst->SrcReg[src].Index]; + break; + } + break; default: radeon_error("Invalid source argument type : %d \n", pILInst->SrcReg[src].File); return GL_FALSE; @@ -1521,7 +1534,7 @@ GLboolean tex_src(r700_AssemblerBase *pAsm) bValidTexCoord = GL_TRUE; pAsm->S[0].src.reg = pAsm->ucVP_AttributeMap[pILInst->SrcReg[0].Index]; - pAsm->S[0].src.rtype = SRC_REG_INPUT; + pAsm->S[0].src.rtype = SRC_REG_GPR; break; } } @@ -1544,7 +1557,7 @@ GLboolean tex_src(r700_AssemblerBase *pAsm) bValidTexCoord = GL_TRUE; pAsm->S[0].src.reg = pAsm->uiFP_AttributeMap[pILInst->SrcReg[0].Index]; - pAsm->S[0].src.rtype = SRC_REG_INPUT; + pAsm->S[0].src.rtype = SRC_REG_GPR; break; case FRAG_ATTRIB_FACE: fprintf(stderr, "FRAG_ATTRIB_FACE unsupported\n"); @@ -1560,7 +1573,7 @@ GLboolean tex_src(r700_AssemblerBase *pAsm) bValidTexCoord = GL_TRUE; pAsm->S[0].src.reg = pAsm->uiFP_AttributeMap[pILInst->SrcReg[0].Index]; - pAsm->S[0].src.rtype = SRC_REG_INPUT; + pAsm->S[0].src.rtype = SRC_REG_GPR; } } @@ -1745,7 +1758,7 @@ GLboolean assemble_alu_src(R700ALUInstruction* alu_instruction_ptr, else { if ( (pSource->rtype == SRC_REG_TEMPORARY) || - (pSource->rtype == SRC_REG_INPUT) + (pSource->rtype == SRC_REG_GPR) ) { src_sel = pSource->reg; @@ -2384,7 +2397,7 @@ GLboolean assemble_alu_instruction(r700_AssemblerBase *pAsm) default: channel_swizzle = SQ_SEL_MASK; break; } if ( ((pSource[j]->rtype == SRC_REG_TEMPORARY) || - (pSource[j]->rtype == SRC_REG_INPUT)) + (pSource[j]->rtype == SRC_REG_GPR)) && (channel_swizzle <= SQ_SEL_W) ) { chan_counter[channel_swizzle]++; diff --git a/src/mesa/drivers/dri/r600/r700_assembler.h b/src/mesa/drivers/dri/r600/r700_assembler.h index dbc6cdb190..ab954ec143 100644 --- a/src/mesa/drivers/dri/r600/r700_assembler.h +++ b/src/mesa/drivers/dri/r600/r700_assembler.h @@ -108,7 +108,7 @@ typedef enum AddressMode typedef enum SrcRegisterType { SRC_REG_TEMPORARY = 0, - SRC_REG_INPUT = 1, + SRC_REG_GPR = 1, SRC_REG_CONSTANT = 2, SRC_REG_ALT_TEMPORARY = 3, SRC_REC_LITERAL = 4, -- cgit v1.2.3 From bdc0e5285a3d7d29b953970e43ca548cbc4e7e30 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Tue, 17 Aug 2010 15:57:48 -0700 Subject: glsl2: Fix transpose of rows and cols This error led to an assertion failure for some constructors of non-square matrices. It only occured in matrices where the number of columns was greater than the number of rows. It didn't even always occur on those. Fixes piglit glslparsertest case constructor-16.vert. --- src/glsl/ast_function.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/glsl/ast_function.cpp b/src/glsl/ast_function.cpp index 6c36a04889..f85b308c1b 100644 --- a/src/glsl/ast_function.cpp +++ b/src/glsl/ast_function.cpp @@ -904,8 +904,8 @@ emit_inline_matrix_constructor(const glsl_type *type, instructions->push_tail(inst); } } else { - const unsigned rows = type->matrix_columns; - const unsigned cols = type->vector_elements; + const unsigned cols = type->matrix_columns; + const unsigned rows = type->vector_elements; unsigned col_idx = 0; unsigned row_idx = 0; -- cgit v1.2.3 From a58514cc9c5cc5867f9140700462c5ac5749550d Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 17 Aug 2010 15:07:22 -0700 Subject: i915: Enable ARB_fragment_shader by default. Now that we have glsl2 with if flattening in place, most shaders will just work. Remaining failing shaders will mostly be due to loop unrolling (in progress), some possible if flattening failures in inlining functions (planning on fixing), and the register/instruction count limits. While the GLSL and GLSL-ES specs say that shaders shouldn't fail to compile/link due to register/instruction limits, in practice we're not the first vendor to expose GLSL on hardware with these limitations. The benefit to application developers of providing a better language for GPU programming is greater than the pain of having to handle instruction limits (which they had to for ARB_fp on this hardware anyway) --- src/mesa/drivers/dri/intel/intel_screen.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/intel/intel_screen.c b/src/mesa/drivers/dri/intel/intel_screen.c index 15a465c640..8c41115ea4 100644 --- a/src/mesa/drivers/dri/intel/intel_screen.c +++ b/src/mesa/drivers/dri/intel/intel_screen.c @@ -70,7 +70,7 @@ PUBLIC const char __driConfigOptions[] = DRI_CONF_DESC(en, "Enable early Z in classic mode (unstable, 945-only).") DRI_CONF_OPT_END - DRI_CONF_OPT_BEGIN(fragment_shader, bool, false) + DRI_CONF_OPT_BEGIN(fragment_shader, bool, true) DRI_CONF_DESC(en, "Enable limited ARB_fragment_shader support on 915/945.") DRI_CONF_OPT_END -- cgit v1.2.3 From 66690864efb9ab1077f87744e1afec3231f244f6 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 17 Aug 2010 15:42:40 -0700 Subject: i915: Add support for OPCODE_DP2. Fixes glsl-fs-dot-vec2. --- src/mesa/drivers/dri/i915/i915_fragprog.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src') diff --git a/src/mesa/drivers/dri/i915/i915_fragprog.c b/src/mesa/drivers/dri/i915/i915_fragprog.c index f1505dc5e7..2ba0d2c591 100644 --- a/src/mesa/drivers/dri/i915/i915_fragprog.c +++ b/src/mesa/drivers/dri/i915/i915_fragprog.c @@ -472,6 +472,18 @@ upload_program(struct i915_fragment_program *p) swizzle(tmp, X, X, X, X)); break; + case OPCODE_DP2: + src0 = src_vector(p, &inst->SrcReg[0], program); + src1 = src_vector(p, &inst->SrcReg[1], program); + i915_emit_arith(p, + A0_DP3, + get_result_vector(p, inst), + get_result_flags(inst), 0, + swizzle(src0, X, Y, ZERO, ZERO), + swizzle(src1, X, Y, ZERO, ZERO), + 0); + break; + case OPCODE_DP3: EMIT_2ARG_ARITH(A0_DP3); break; -- cgit v1.2.3 From e43b250fc076aea9e4b5319fdf409e95b28ac8fc Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 17 Aug 2010 15:51:34 -0700 Subject: i915: Add support for reading output regs in the FS. Fixes glsl-unused-varying and many others, since we produce an output reg read any time gl_FragColor is written inside an if statement. --- src/mesa/drivers/dri/i915/i915_fragprog.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src') diff --git a/src/mesa/drivers/dri/i915/i915_fragprog.c b/src/mesa/drivers/dri/i915/i915_fragprog.c index 2ba0d2c591..3101bd1700 100644 --- a/src/mesa/drivers/dri/i915/i915_fragprog.c +++ b/src/mesa/drivers/dri/i915/i915_fragprog.c @@ -143,6 +143,20 @@ src_vector(struct i915_fragment_program *p, } break; + case PROGRAM_OUTPUT: + switch (source->Index) { + case FRAG_RESULT_COLOR: + src = UREG(REG_TYPE_OC, 0); + break; + case FRAG_RESULT_DEPTH: + src = UREG(REG_TYPE_OD, 0); + break; + default: + i915_program_error(p, "Bad source->Index: %d", source->Index); + return 0; + } + break; + /* Various paramters and env values. All emitted to * hardware as program constants. */ -- cgit v1.2.3 From 02e16398292825924d4c7ffb884961275dbadacd Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 17 Aug 2010 16:12:15 -0700 Subject: i915: Add support for SSG opcode. Fixes glsl-fs-sign and many of the tests of trig builtins. --- src/mesa/drivers/dri/i915/i915_fragprog.c | 35 +++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) (limited to 'src') diff --git a/src/mesa/drivers/dri/i915/i915_fragprog.c b/src/mesa/drivers/dri/i915/i915_fragprog.c index 3101bd1700..4a2e6209d0 100644 --- a/src/mesa/drivers/dri/i915/i915_fragprog.c +++ b/src/mesa/drivers/dri/i915/i915_fragprog.c @@ -983,6 +983,41 @@ upload_program(struct i915_fragment_program *p) 0); break; + case OPCODE_SSG: + dst = get_result_vector(p, inst); + flags = get_result_flags(inst); + src0 = src_vector(p, &inst->SrcReg[0], program); + tmp = i915_get_utemp(p); + + /* tmp = (src < 0.0) */ + i915_emit_arith(p, + A0_SLT, + tmp, + flags, 0, + src0, + swizzle(src0, ZERO, ZERO, ZERO, ZERO), + 0); + + /* dst = (0.0 < src) */ + i915_emit_arith(p, + A0_SLT, + dst, + flags, 0, + swizzle(src0, ZERO, ZERO, ZERO, ZERO), + src0, + 0); + + /* dst = (src > 0.0) - (src < 0.0) */ + i915_emit_arith(p, + A0_ADD, + dst, + flags, 0, + dst, + negate(tmp, 1, 1, 1, 1), + 0); + + break; + case OPCODE_SUB: src0 = src_vector(p, &inst->SrcReg[0], program); src1 = src_vector(p, &inst->SrcReg[1], program); -- cgit v1.2.3 From 6992c3c3739dad249e8c396057d5cbeedcdf91de Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 17 Aug 2010 17:24:42 -0700 Subject: ir_to_mesa: Fix implementation of ir_binop_equal, ir_binop_notequal. These binops are the vector-to-bool comparisons, not vec-to-bvec. We likely want both operations avilable as expression, since 915 and 965 FS naturally does the vector version, while 965 VS can also naturally do the scalar version. However, we can save that until later. Fixes: glsl-fs-vec4-operator-equal.shader_test glsl-fs-vec4-operator-notequal.shader_test glsl-vs-vec4-operator-equal.shader_test glsl-vs-vec4-operator-notequal.shader_test --- src/mesa/program/ir_to_mesa.cpp | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp index 7fff66c78b..7b65fa4203 100644 --- a/src/mesa/program/ir_to_mesa.cpp +++ b/src/mesa/program/ir_to_mesa.cpp @@ -813,10 +813,34 @@ ir_to_mesa_visitor::visit(ir_expression *ir) 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]); + /* "==" operator producing a scalar boolean. */ + if (ir->operands[0]->type->is_vector() || + ir->operands[1]->type->is_vector()) { + ir_to_mesa_src_reg temp = get_temp(glsl_type::vec4_type); + ir_to_mesa_emit_op2(ir, OPCODE_SNE, + ir_to_mesa_dst_reg_from_src(temp), op[0], op[1]); + ir_to_mesa_emit_op2(ir, OPCODE_DP4, result_dst, temp, temp); + ir_to_mesa_emit_op2(ir, OPCODE_SEQ, + result_dst, result_src, src_reg_for_float(0.0)); + } else { + ir_to_mesa_emit_op2(ir, OPCODE_SEQ, result_dst, op[0], op[1]); + } break; - case ir_binop_logic_xor: case ir_binop_nequal: + /* "!=" operator producing a scalar boolean. */ + if (ir->operands[0]->type->is_vector() || + ir->operands[1]->type->is_vector()) { + ir_to_mesa_src_reg temp = get_temp(glsl_type::vec4_type); + ir_to_mesa_emit_op2(ir, OPCODE_SNE, + ir_to_mesa_dst_reg_from_src(temp), op[0], op[1]); + ir_to_mesa_emit_op2(ir, OPCODE_DP4, result_dst, temp, temp); + ir_to_mesa_emit_op2(ir, OPCODE_SNE, + result_dst, result_src, src_reg_for_float(0.0)); + } else { + ir_to_mesa_emit_op2(ir, OPCODE_SNE, result_dst, op[0], op[1]); + } + break; + case ir_binop_logic_xor: ir_to_mesa_emit_op2(ir, OPCODE_SNE, result_dst, op[0], op[1]); break; -- cgit v1.2.3 From 1d18739290fa667dc81d6780d695a09f8c1cde99 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Wed, 18 Aug 2010 09:56:21 +1000 Subject: r600g: emit texture level offset in CB/DB setup. 8 more piglit tests pass, fbo-clearmipmap, fbo-copyteximage, fbo-generatemipmap, fbo-generatemipmap-nonsquare, fbo-generatemipmap-scissor, fbo-generatemipmap-viewport, gen-teximage, gen-texsubimage --- src/gallium/drivers/r600/r600_state.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/r600_state.c b/src/gallium/drivers/r600/r600_state.c index cbbc93c04a..0059952cef 100644 --- a/src/gallium/drivers/r600/r600_state.c +++ b/src/gallium/drivers/r600/r600_state.c @@ -741,7 +741,7 @@ static struct radeon_state *r600_cb(struct r600_context *rctx, int cb) S_0280A0_SOURCE_FORMAT(1) | S_0280A0_NUMBER_TYPE(ntype); - rstate->states[R600_CB0__CB_COLOR0_BASE] = 0x00000000; + rstate->states[R600_CB0__CB_COLOR0_BASE] = rtex->offset[level] >> 8; rstate->states[R600_CB0__CB_COLOR0_INFO] = color_info; rstate->states[R600_CB0__CB_COLOR0_SIZE] = S_028060_PITCH_TILE_MAX(pitch) | S_028060_SLICE_TILE_MAX(slice); @@ -782,7 +782,7 @@ static struct radeon_state *r600_db(struct r600_context *rctx) pitch = (rtex->pitch[level] / rtex->bpt) / 8 - 1; slice = (rtex->pitch[level] / rtex->bpt) * state->zsbuf->height / 64 - 1; format = r600_translate_dbformat(state->zsbuf->texture->format); - rstate->states[R600_DB__DB_DEPTH_BASE] = 0x00000000; + rstate->states[R600_DB__DB_DEPTH_BASE] = rtex->offset[level] >> 8; rstate->states[R600_DB__DB_DEPTH_INFO] = 0x00010000 | S_028010_FORMAT(format); rstate->states[R600_DB__DB_DEPTH_VIEW] = 0x00000000; -- cgit v1.2.3 From edb465e9bb1b45a6db5aca85a002c0f4958deff0 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Wed, 18 Aug 2010 10:50:19 +1000 Subject: r600g: fix height calcs for miptree h needs to be rounded up, this probably needs revisiting when we get to tiling etc. fixes fbo-generatemipmap-npot --- src/gallium/drivers/r600/r600_texture.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/gallium/drivers/r600/r600_texture.c b/src/gallium/drivers/r600/r600_texture.c index 30d79ebdd6..55cceb6935 100644 --- a/src/gallium/drivers/r600/r600_texture.c +++ b/src/gallium/drivers/r600/r600_texture.c @@ -65,6 +65,7 @@ static void r600_setup_miptree(struct r600_screen *rscreen, struct r600_resource for (i = 0, offset = 0; i <= ptex->last_level; i++) { w = u_minify(ptex->width0, i); h = u_minify(ptex->height0, i); + h = util_next_power_of_two(h); pitch = util_format_get_stride(ptex->format, align(w, 64)); layer_size = pitch * h; if (ptex->target == PIPE_TEXTURE_CUBE) -- cgit v1.2.3 From ede67e307142000a408e40b637132700a4dc2808 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 17 Aug 2010 17:50:05 -0700 Subject: glcpp: Add testcase for #if handling bug that breaks Savage2. --- src/glsl/glcpp/tests/087-if-comments.c | 5 +++++ src/glsl/glcpp/tests/087-if-comments.c.expected | 6 ++++++ 2 files changed, 11 insertions(+) create mode 100644 src/glsl/glcpp/tests/087-if-comments.c create mode 100644 src/glsl/glcpp/tests/087-if-comments.c.expected (limited to 'src') diff --git a/src/glsl/glcpp/tests/087-if-comments.c b/src/glsl/glcpp/tests/087-if-comments.c new file mode 100644 index 0000000000..ce8dc43057 --- /dev/null +++ b/src/glsl/glcpp/tests/087-if-comments.c @@ -0,0 +1,5 @@ +#if (1 == 0) // dangerous comment +fail +#else +win +#endif diff --git a/src/glsl/glcpp/tests/087-if-comments.c.expected b/src/glsl/glcpp/tests/087-if-comments.c.expected new file mode 100644 index 0000000000..827e548fe5 --- /dev/null +++ b/src/glsl/glcpp/tests/087-if-comments.c.expected @@ -0,0 +1,6 @@ + + + +win + + -- cgit v1.2.3 From 547e88e70de16a3d0451c2aa33f87014adc8bb7c Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Wed, 18 Aug 2010 04:14:43 +0200 Subject: translate_sse: don't overwrite source buffer pointer We were putting the source pointer in a register used as a temporary, breaking all paths that don't read the data in a single instruction. --- src/gallium/auxiliary/translate/translate_sse.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/gallium/auxiliary/translate/translate_sse.c b/src/gallium/auxiliary/translate/translate_sse.c index 56c5b36ce2..48e59590bc 100644 --- a/src/gallium/auxiliary/translate/translate_sse.c +++ b/src/gallium/auxiliary/translate/translate_sse.c @@ -96,7 +96,7 @@ struct translate_sse { */ struct x86_reg tmp_EAX; struct x86_reg tmp2_EDX; - struct x86_reg tmp3_ECX; + struct x86_reg src_ECX; struct x86_reg idx_ESI; /* either start+i or &elt[i] */ struct x86_reg machine_EDI; struct x86_reg outbuf_EBX; @@ -1052,7 +1052,7 @@ static boolean init_inputs( struct translate_sse *p, if (varient->instance_divisor != 1) { struct x86_reg tmp_EDX = p->tmp2_EDX; - struct x86_reg tmp_ECX = p->tmp3_ECX; + struct x86_reg tmp_ECX = p->src_ECX; /* TODO: Add x86_shr() to rtasm and use it whenever * instance divisor is power of two. @@ -1108,7 +1108,7 @@ static struct x86_reg get_buffer_ptr( struct translate_sse *p, return p->idx_ESI; } else if (!index_size || p->buffer_varient[var_idx].instance_divisor) { - struct x86_reg ptr = p->tmp_EAX; + struct x86_reg ptr = p->src_ECX; struct x86_reg buf_ptr = x86_make_disp(p->machine_EDI, get_offset(p, &p->buffer_varient[var_idx].ptr)); @@ -1118,7 +1118,7 @@ static struct x86_reg get_buffer_ptr( struct translate_sse *p, return ptr; } else { - struct x86_reg ptr = p->tmp_EAX; + struct x86_reg ptr = p->src_ECX; const struct translate_buffer_varient *varient = &p->buffer_varient[var_idx]; struct x86_reg buf_stride = @@ -1226,7 +1226,7 @@ static boolean build_vertex_emit( struct translate_sse *p, p->machine_EDI = x86_make_reg(file_REG32, reg_DI); p->count_EBP = x86_make_reg(file_REG32, reg_BP); p->tmp2_EDX = x86_make_reg(file_REG32, reg_DX); - p->tmp3_ECX = x86_make_reg(file_REG32, reg_CX); + p->src_ECX = x86_make_reg(file_REG32, reg_CX); p->func = func; memset(&p->loaded_const, 0, sizeof(p->loaded_const)); -- cgit v1.2.3 From 03c59e4ab16b0ee362f189b549bd13491dba71e4 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Wed, 18 Aug 2010 11:49:51 +1000 Subject: r600g: fixup pitch alignment like r600c. This still needs work, passes tex3d, fbo-scissor-bitmap, scissor-bitmap --- src/gallium/drivers/r600/r600_state.c | 9 ++++++--- src/gallium/drivers/r600/r600_texture.c | 1 + 2 files changed, 7 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/r600_state.c b/src/gallium/drivers/r600/r600_state.c index 0059952cef..260688a9a8 100644 --- a/src/gallium/drivers/r600/r600_state.c +++ b/src/gallium/drivers/r600/r600_state.c @@ -1217,7 +1217,7 @@ static struct radeon_state *r600_resource(struct r600_context *rctx, struct r600_resource *rbuffer; struct radeon_state *rstate; unsigned format; - uint32_t word4 = 0, yuv_format = 0; + uint32_t word4 = 0, yuv_format = 0, pitch = 0; unsigned char swizzle[4]; swizzle[0] = view->swizzle_r; @@ -1248,16 +1248,19 @@ static struct radeon_state *r600_resource(struct r600_context *rctx, rstate->placement[2] = RADEON_GEM_DOMAIN_GTT; rstate->placement[3] = RADEON_GEM_DOMAIN_GTT; + pitch = (tmp->pitch[0] / tmp->bpt); + pitch = (pitch + 0x7) & ~0x7; + /* FIXME properly handle first level != 0 */ rstate->states[R600_PS_RESOURCE__RESOURCE0_WORD0] = S_038000_DIM(r600_tex_dim(view->texture->target)) | - S_038000_PITCH(((tmp->pitch[0] / tmp->bpt) / 8) - 1) | + S_038000_PITCH((pitch / 8) - 1) | S_038000_TEX_WIDTH(view->texture->width0 - 1); rstate->states[R600_PS_RESOURCE__RESOURCE0_WORD1] = S_038004_TEX_HEIGHT(view->texture->height0 - 1) | S_038004_TEX_DEPTH(view->texture->depth0 - 1) | S_038004_DATA_FORMAT(format); - rstate->states[R600_PS_RESOURCE__RESOURCE0_WORD2] = 0; + rstate->states[R600_PS_RESOURCE__RESOURCE0_WORD2] = tmp->offset[0] >> 8; rstate->states[R600_PS_RESOURCE__RESOURCE0_WORD3] = tmp->offset[1] >> 8; rstate->states[R600_PS_RESOURCE__RESOURCE0_WORD4] = word4 | diff --git a/src/gallium/drivers/r600/r600_texture.c b/src/gallium/drivers/r600/r600_texture.c index 55cceb6935..eabd7f7705 100644 --- a/src/gallium/drivers/r600/r600_texture.c +++ b/src/gallium/drivers/r600/r600_texture.c @@ -67,6 +67,7 @@ static void r600_setup_miptree(struct r600_screen *rscreen, struct r600_resource h = u_minify(ptex->height0, i); h = util_next_power_of_two(h); pitch = util_format_get_stride(ptex->format, align(w, 64)); + pitch = align(pitch, 256); layer_size = pitch * h; if (ptex->target == PIPE_TEXTURE_CUBE) size = layer_size * 6; -- cgit v1.2.3 From 1cdef8e90a33d982d8ce5ae73eb224e078a2054b Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 17 Aug 2010 19:51:00 -0700 Subject: i965: Throw a link error when we see a "return" in main(). We'll need to use the HALT instruction to do this right, like returns from other functions. --- src/mesa/drivers/dri/i965/brw_program.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_program.c b/src/mesa/drivers/dri/i965/brw_program.c index c6d11fed06..1cdc8c6411 100644 --- a/src/mesa/drivers/dri/i965/brw_program.c +++ b/src/mesa/drivers/dri/i965/brw_program.c @@ -175,6 +175,14 @@ static GLboolean brwProgramStringNotify( GLcontext *ctx, "the end of the function to work around it.\n"); return GL_FALSE; } + + if (prog->Instructions[i].Opcode == OPCODE_RET) { + shader_error(ctx, prog, + "i965 driver doesn't yet support \"return\" " + "from main().\n"); + return GL_FALSE; + } + if (prog->Instructions[i].DstReg.RelAddr && prog->Instructions[i].DstReg.File == PROGRAM_INPUT) { shader_error(ctx, prog, -- cgit v1.2.3 From 35220fc5981045331b4f048f0fc2e1371a0673ed Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 17 Aug 2010 19:41:27 -0700 Subject: ir_to_mesa: Allow ir_return in main(). I didn't expect that this would really work, but it turns out there are shaders in the wild that do it. Fixes: (with swrast) glsl-fs-main-return glsl-vs-main-return --- src/mesa/program/ir_to_mesa.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp index 7b65fa4203..7de1939b63 100644 --- a/src/mesa/program/ir_to_mesa.cpp +++ b/src/mesa/program/ir_to_mesa.cpp @@ -2129,12 +2129,12 @@ ir_to_mesa_visitor::visit(ir_texture *ir) void ir_to_mesa_visitor::visit(ir_return *ir) { - assert(current_function); - if (ir->get_value()) { ir_to_mesa_dst_reg l; int i; + assert(current_function); + ir->get_value()->accept(this); ir_to_mesa_src_reg r = this->result; -- cgit v1.2.3 From 1147814365c78ed20ba71e3f4e0bfe22f9960234 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Wed, 18 Aug 2010 13:29:41 +1000 Subject: r600g: fix point size fixes piglit pointAtten and point-sprite tests --- src/gallium/drivers/r600/r600_state.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/r600_state.c b/src/gallium/drivers/r600/r600_state.c index 260688a9a8..f78d1671ba 100644 --- a/src/gallium/drivers/r600/r600_state.c +++ b/src/gallium/drivers/r600/r600_state.c @@ -874,7 +874,7 @@ static struct radeon_state *r600_rasterizer(struct r600_context *rctx) S_02881C_VS_OUT_MISC_VEC_ENA(state->point_size_per_vertex); rstate->states[R600_RASTERIZER__PA_CL_NANINF_CNTL] = 0x00000000; /* point size 12.4 fixed point */ - tmp = (unsigned)(state->point_size * 8.0 / 2.0); + tmp = (unsigned)(state->point_size * 8.0); rstate->states[R600_RASTERIZER__PA_SU_POINT_SIZE] = S_028A00_HEIGHT(tmp) | S_028A00_WIDTH(tmp); rstate->states[R600_RASTERIZER__PA_SU_POINT_MINMAX] = 0x80000000; rstate->states[R600_RASTERIZER__PA_SU_LINE_CNTL] = 0x00000008; -- cgit v1.2.3 From 4558b634556f42867449a6e60d4badc72099f10d Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Wed, 18 Aug 2010 13:48:04 +1000 Subject: r600g: add two simple tgsi opcodes. makes glsl-fs-log2 and glsl1-integer division with uniform var pass --- src/gallium/drivers/r600/r600_shader.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/r600_shader.c b/src/gallium/drivers/r600/r600_shader.c index 55247f159d..a45d63b34b 100644 --- a/src/gallium/drivers/r600/r600_shader.c +++ b/src/gallium/drivers/r600/r600_shader.c @@ -1237,7 +1237,7 @@ static struct r600_shader_tgsi_instruction r600_shader_tgsi_instruction[] = { {TGSI_OPCODE_FLR, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported}, {TGSI_OPCODE_ROUND, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported}, {TGSI_OPCODE_EX2, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_EXP_IEEE, tgsi_trans_srcx_replicate}, - {TGSI_OPCODE_LG2, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported}, + {TGSI_OPCODE_LG2, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_LOG_IEEE, tgsi_trans_srcx_replicate}, {TGSI_OPCODE_POW, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported}, {TGSI_OPCODE_XPD, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported}, /* gap */ @@ -1297,7 +1297,7 @@ static struct r600_shader_tgsi_instruction r600_shader_tgsi_instruction[] = { {TGSI_OPCODE_CEIL, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported}, {TGSI_OPCODE_I2F, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported}, {TGSI_OPCODE_NOT, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported}, - {TGSI_OPCODE_TRUNC, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported}, + {TGSI_OPCODE_TRUNC, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_TRUNC, tgsi_trans_srcx_replicate}, {TGSI_OPCODE_SHL, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported}, /* gap */ {88, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported}, -- cgit v1.2.3 From eb26f0d5b68f0218d4c79c1825d0d9e6a905e199 Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Tue, 17 Aug 2010 22:17:09 -0700 Subject: glcpp: Don't include the newline when discarding single-line comments Matching the newline here meant having to do some redundant work here, (incrementing line number, resetting column number, and returning a NEWLINE token), that could otherwise simply be left to the existing rule which matches a newline. Worse, when the comment rule matches the newline as well, the parser can lookahead and see a token for something that should actually be skipped. For example, in a case like this: #if 0 // comment here fail #else win #endif Both fail and win appear in the output, (not that the condition is being evaluated incorrectly---merely that one token after the comment's newline was being lexed/parse regardless of the condition). This commit fixes the above test case, (which is also remarkably similar to 087-if-comments which now passes). --- src/glsl/glcpp/glcpp-lex.l | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'src') diff --git a/src/glsl/glcpp/glcpp-lex.l b/src/glsl/glcpp/glcpp-lex.l index 9187926146..a14e580ab1 100644 --- a/src/glsl/glcpp/glcpp-lex.l +++ b/src/glsl/glcpp/glcpp-lex.l @@ -70,10 +70,7 @@ HEXADECIMAL_INTEGER 0[xX][0-9a-fA-F]+[uU]? %% /* Single-line comments */ -"//"[^\n]*\n { - yylineno++; - yycolumn = 0; - return NEWLINE; +"//"[^\n]* { } /* Multi-line comments */ -- cgit v1.2.3 From b9892f22d18400db2f20f20b05c301248209bf48 Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Tue, 17 Aug 2010 22:22:13 -0700 Subject: glcpp: Regenerated glcpp-lex.c from previous commit. The previous commit changed glcpp-lex.l so we commit the resulting generated file here. --- src/glsl/glcpp/glcpp-lex.c | 397 +++++++++++++++++++++++---------------------- 1 file changed, 203 insertions(+), 194 deletions(-) (limited to 'src') diff --git a/src/glsl/glcpp/glcpp-lex.c b/src/glsl/glcpp/glcpp-lex.c index de37c11be8..a0de91a634 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. @@ -365,10 +374,10 @@ static yyconst flex_int16_t yy_acclist[133] = 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, + 40, 41, 37, 16, 38, 30, 33, 31, 2, 1, + 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, 24, 37, 35, 37,16396, 24, 37, 35, 37, 16, 35, 37,16397,16398, 8204, 16, 8204, 35, 37, 8205, 16, @@ -377,25 +386,24 @@ static yyconst flex_int16_t yy_acclist[133] = 8, 8210 } ; -static yyconst flex_int16_t yy_accept[152] = +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, 132, 132, 132, 133, 133, - 133 + 59, 60, 61, 63, 65, 66, 68, 70, 71, 72, + 73, 74, 75, 77, 79, 80, 81, 82, 83, 83, + 83, 83, 83, 83, 83, 84, 85, 86, 87, 88, + 89, 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, 132, 132, 132, 133, 133, 133 } ; static yyconst flex_int32_t yy_ec[256] = @@ -438,7 +446,7 @@ static yyconst flex_int32_t yy_meta[40] = 1, 1, 1, 1, 1, 1, 1, 1, 1 } ; -static yyconst flex_int16_t yy_base[170] = +static yyconst flex_int16_t yy_base[169] = { 0, 0, 38, 0, 0, 38, 39, 427, 426, 428, 48, 43, 549, 424, 44, 63, 423, 59, 65, 87, 125, @@ -447,39 +455,39 @@ static yyconst flex_int16_t yy_base[170] = 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, 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 + 404, 162, 159, 227, 229, 230, 234, 199, 303, 232, + 235, 236, 262, 56, 243, 237, 247, 245, 252, 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[170] = +static yyconst flex_int16_t yy_def[169] = { 0, - 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 + 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, 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, 154, 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] = @@ -492,62 +500,62 @@ static yyconst flex_int16_t yy_nxt[589] = 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, + 57, 36, 50, 51, 52, 98, 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, + 35, 35, 68, 36, 47, 37, 36, 53, 73, 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, 36, 85, 143, 81, 68, 82, - 34, 34, 34, 34, 36, 150, 150, 84, 34, 36, + 35, 35, 35, 35, 35, 34, 34, 74, 35, 35, + 35, 83, 53, 79, 36, 84, 142, 80, 68, 81, + 34, 34, 34, 34, 36, 149, 149, 83, 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, 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, - 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, 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, 34, 82, 68, 35, 35, 35, + 34, 34, 34, 69, 70, 75, 54, 76, 34, 36, + 77, 36, 36, 90, 36, 78, 36, 36, 36, 36, + 36, 35, 58, 36, 34, 36, 39, 36, 142, 36, + 135, 85, 88, 95, 36, 86, 36, 96, 36, 36, + 110, 100, 87, 59, 60, 36, 89, 61, 97, 99, + 101, 102, 62, 34, 34, 34, 63, 64, 72, 72, + 72, 34, 103, 127, 72, 115, 34, 113, 72, 72, + 72, 72, 122, 36, 36, 36, 36, 34, 36, 36, + + 36, 36, 34, 91, 91, 92, 91, 91, 91, 91, + 91, 91, 91, 91, 104, 109, 112, 91, 91, 91, + 124, 111, 120, 123, 36, 93, 121, 36, 128, 53, + 36, 36, 94, 36, 36, 36, 139, 36, 36, 36, + 36, 91, 131, 53, 36, 135, 36, 131, 119, 126, + 125, 129, 117, 137, 108, 136, 106, 119, 117, 114, + 108, 106, 133, 138, 140, 144, 35, 139, 36, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 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, 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 + 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, 36, 66, 35, 35, + 36, 53, 36, 36, 36, 36, 36, 36, 36, 36, + 36, 36, 36, 36, 66, 36, 36, 149, 29, 29, + 149, 149, 149, 146, 35, 35, 36, 35, 35, 35, + 35, 35, 147, 35, 35, 137, 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, 105, 105, + 107, 107, 116, 116, 118, 118, 130, 130, 132, 132, + 134, 134, 141, 141, 143, 143, 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] = @@ -559,63 +567,63 @@ 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, 157, 21, 21, 18, 18, 27, 27, 26, 85, - 27, 148, 22, 23, 23, 85, 10, 19, 19, 19, + 23, 156, 21, 21, 18, 18, 27, 27, 26, 84, + 27, 147, 22, 23, 23, 84, 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, 145, 20, 37, 37, 54, 54, 32, + 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, 144, 74, 142, 62, 67, 63, - 44, 44, 44, 43, 64, 67, 67, 73, 44, 138, + 24, 72, 73, 61, 143, 73, 141, 62, 67, 63, + 44, 44, 44, 43, 64, 67, 67, 72, 44, 137, - 60, 79, 24, 25, 25, 25, 25, 25, 25, 25, + 60, 78, 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, 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, - 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, 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, 71, 65, 58, 57, - 55, 53, 52, 51, 50, 49, 48, 42, 147, 41, + 47, 47, 47, 69, 69, 60, 25, 60, 47, 74, + 60, 75, 76, 78, 80, 60, 77, 81, 82, 86, + 94, 25, 28, 28, 47, 85, 28, 88, 136, 87, + 134, 74, 76, 80, 89, 75, 97, 81, 99, 113, + 94, 86, 75, 28, 28, 104, 77, 28, 82, 85, + 87, 88, 28, 83, 83, 83, 28, 28, 45, 45, + 45, 83, 89, 113, 45, 99, 45, 97, 45, 45, + 45, 45, 104, 90, 93, 96, 103, 83, 95, 110, + + 102, 109, 45, 79, 79, 79, 79, 79, 79, 79, + 79, 79, 79, 79, 90, 93, 96, 79, 79, 79, + 110, 95, 102, 109, 111, 79, 103, 112, 114, 114, + 115, 122, 79, 124, 125, 127, 129, 129, 138, 132, + 133, 79, 130, 128, 126, 123, 121, 120, 118, 112, + 111, 115, 116, 125, 107, 124, 105, 101, 100, 98, + 92, 91, 122, 127, 133, 138, 139, 139, 139, 139, + 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, + 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, + 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, + + 139, 139, 139, 139, 139, 140, 71, 65, 58, 57, + 55, 53, 52, 51, 50, 49, 48, 42, 146, 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, 140, 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, 146, 149, 149, 149, 149, 149, 149, 149, - 149, 149, 149, 149, 0, 0, 0, 149, 149, 149, + 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, 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 + 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 @@ -682,7 +690,7 @@ void glcpp_set_column (int column_no , yyscan_t yyscanner); } while(0); #define YY_USER_INIT yylineno = 1; yycolumn = 1; -#line 686 "glcpp/glcpp-lex.c" +#line 694 "glcpp/glcpp-lex.c" #define INITIAL 0 #define DONE 1 @@ -829,7 +837,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. */ @@ -837,7 +850,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, @@ -848,7 +861,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; \ @@ -940,7 +953,7 @@ YY_DECL /* Single-line comments */ -#line 944 "glcpp/glcpp-lex.c" +#line 957 "glcpp/glcpp-lex.c" yylval = yylval_param; @@ -1003,14 +1016,14 @@ 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 >= 151 ) + 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_current_state != 150 ); + while ( yy_current_state != 149 ); yy_find_action: yy_current_state = *--yyg->yy_state_ptr; @@ -1061,46 +1074,42 @@ 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 73 "glcpp/glcpp-lex.l" { - yylineno++; - yycolumn = 0; - return NEWLINE; } YY_BREAK /* Multi-line comments */ case 2: YY_RULE_SETUP -#line 80 "glcpp/glcpp-lex.l" +#line 77 "glcpp/glcpp-lex.l" { yy_push_state(COMMENT, yyscanner); } YY_BREAK case 3: YY_RULE_SETUP -#line 81 "glcpp/glcpp-lex.l" +#line 78 "glcpp/glcpp-lex.l" YY_BREAK case 4: /* rule 4 can match eol */ YY_RULE_SETUP -#line 82 "glcpp/glcpp-lex.l" +#line 79 "glcpp/glcpp-lex.l" { yylineno++; yycolumn = 0; } YY_BREAK case 5: YY_RULE_SETUP -#line 83 "glcpp/glcpp-lex.l" +#line 80 "glcpp/glcpp-lex.l" YY_BREAK case 6: /* rule 6 can match eol */ YY_RULE_SETUP -#line 84 "glcpp/glcpp-lex.l" +#line 81 "glcpp/glcpp-lex.l" { yylineno++; yycolumn = 0; } YY_BREAK case 7: YY_RULE_SETUP -#line 85 "glcpp/glcpp-lex.l" +#line 82 "glcpp/glcpp-lex.l" { yy_pop_state(yyscanner); if (yyextra->space_tokens) @@ -1109,7 +1118,7 @@ YY_RULE_SETUP YY_BREAK case 8: YY_RULE_SETUP -#line 91 "glcpp/glcpp-lex.l" +#line 88 "glcpp/glcpp-lex.l" { yylval->str = talloc_strdup (yyextra, yytext); yyextra->space_tokens = 0; @@ -1120,7 +1129,7 @@ YY_RULE_SETUP * Simply pass them through to the main compiler's lexer/parser. */ case 9: YY_RULE_SETUP -#line 99 "glcpp/glcpp-lex.l" +#line 96 "glcpp/glcpp-lex.l" { yylval->str = talloc_strdup (yyextra, yytext); yylineno++; @@ -1131,7 +1140,7 @@ YY_RULE_SETUP case 10: /* rule 10 can match eol */ YY_RULE_SETUP -#line 106 "glcpp/glcpp-lex.l" +#line 103 "glcpp/glcpp-lex.l" { yyextra->lexing_if = 1; yyextra->space_tokens = 0; @@ -1141,7 +1150,7 @@ YY_RULE_SETUP case 11: /* rule 11 can match eol */ YY_RULE_SETUP -#line 112 "glcpp/glcpp-lex.l" +#line 109 "glcpp/glcpp-lex.l" { yyextra->lexing_if = 1; yyextra->space_tokens = 0; @@ -1151,7 +1160,7 @@ YY_RULE_SETUP case 12: /* rule 12 can match eol */ YY_RULE_SETUP -#line 118 "glcpp/glcpp-lex.l" +#line 115 "glcpp/glcpp-lex.l" { yyextra->lexing_if = 1; yyextra->space_tokens = 0; @@ -1161,7 +1170,7 @@ YY_RULE_SETUP case 13: /* rule 13 can match eol */ YY_RULE_SETUP -#line 124 "glcpp/glcpp-lex.l" +#line 121 "glcpp/glcpp-lex.l" { yyextra->lexing_if = 1; yyextra->space_tokens = 0; @@ -1171,7 +1180,7 @@ YY_RULE_SETUP case 14: /* rule 14 can match eol */ YY_RULE_SETUP -#line 130 "glcpp/glcpp-lex.l" +#line 127 "glcpp/glcpp-lex.l" { yyextra->space_tokens = 0; return HASH_ELSE; @@ -1180,7 +1189,7 @@ YY_RULE_SETUP case 15: /* rule 15 can match eol */ YY_RULE_SETUP -#line 135 "glcpp/glcpp-lex.l" +#line 132 "glcpp/glcpp-lex.l" { yyextra->space_tokens = 0; return HASH_ENDIF; @@ -1200,7 +1209,7 @@ case 16: yyg->yy_c_buf_p = yy_cp -= 1; YY_DO_BEFORE_ACTION; /* set up yytext again */ YY_RULE_SETUP -#line 148 "glcpp/glcpp-lex.l" +#line 145 "glcpp/glcpp-lex.l" { /* Since this rule always matches, YY_USER_ACTION gets called for it, * wrongly incrementing yycolumn. We undo that effect here. */ @@ -1215,7 +1224,7 @@ YY_RULE_SETUP YY_BREAK case 17: YY_RULE_SETUP -#line 160 "glcpp/glcpp-lex.l" +#line 157 "glcpp/glcpp-lex.l" { char *p; for (p = yytext; !isalpha(p[0]); p++); /* skip " # " */ @@ -1225,7 +1234,7 @@ YY_RULE_SETUP YY_BREAK case 18: YY_RULE_SETUP -#line 167 "glcpp/glcpp-lex.l" +#line 164 "glcpp/glcpp-lex.l" { yyextra->space_tokens = 0; return HASH_DEFINE_FUNC; @@ -1233,7 +1242,7 @@ YY_RULE_SETUP YY_BREAK case 19: YY_RULE_SETUP -#line 172 "glcpp/glcpp-lex.l" +#line 169 "glcpp/glcpp-lex.l" { yyextra->space_tokens = 0; return HASH_DEFINE_OBJ; @@ -1241,7 +1250,7 @@ YY_RULE_SETUP YY_BREAK case 20: YY_RULE_SETUP -#line 177 "glcpp/glcpp-lex.l" +#line 174 "glcpp/glcpp-lex.l" { yyextra->space_tokens = 0; return HASH_UNDEF; @@ -1249,7 +1258,7 @@ YY_RULE_SETUP YY_BREAK case 21: YY_RULE_SETUP -#line 182 "glcpp/glcpp-lex.l" +#line 179 "glcpp/glcpp-lex.l" { yyextra->space_tokens = 0; return HASH; @@ -1257,7 +1266,7 @@ YY_RULE_SETUP YY_BREAK case 22: YY_RULE_SETUP -#line 187 "glcpp/glcpp-lex.l" +#line 184 "glcpp/glcpp-lex.l" { yylval->str = talloc_strdup (yyextra, yytext); return INTEGER_STRING; @@ -1265,7 +1274,7 @@ YY_RULE_SETUP YY_BREAK case 23: YY_RULE_SETUP -#line 192 "glcpp/glcpp-lex.l" +#line 189 "glcpp/glcpp-lex.l" { yylval->str = talloc_strdup (yyextra, yytext); return INTEGER_STRING; @@ -1273,7 +1282,7 @@ YY_RULE_SETUP YY_BREAK case 24: YY_RULE_SETUP -#line 197 "glcpp/glcpp-lex.l" +#line 194 "glcpp/glcpp-lex.l" { yylval->str = talloc_strdup (yyextra, yytext); return INTEGER_STRING; @@ -1281,77 +1290,77 @@ YY_RULE_SETUP YY_BREAK case 25: YY_RULE_SETUP -#line 202 "glcpp/glcpp-lex.l" +#line 199 "glcpp/glcpp-lex.l" { return LEFT_SHIFT; } YY_BREAK case 26: YY_RULE_SETUP -#line 206 "glcpp/glcpp-lex.l" +#line 203 "glcpp/glcpp-lex.l" { return RIGHT_SHIFT; } YY_BREAK case 27: YY_RULE_SETUP -#line 210 "glcpp/glcpp-lex.l" +#line 207 "glcpp/glcpp-lex.l" { return LESS_OR_EQUAL; } YY_BREAK case 28: YY_RULE_SETUP -#line 214 "glcpp/glcpp-lex.l" +#line 211 "glcpp/glcpp-lex.l" { return GREATER_OR_EQUAL; } YY_BREAK case 29: YY_RULE_SETUP -#line 218 "glcpp/glcpp-lex.l" +#line 215 "glcpp/glcpp-lex.l" { return EQUAL; } YY_BREAK case 30: YY_RULE_SETUP -#line 222 "glcpp/glcpp-lex.l" +#line 219 "glcpp/glcpp-lex.l" { return NOT_EQUAL; } YY_BREAK case 31: YY_RULE_SETUP -#line 226 "glcpp/glcpp-lex.l" +#line 223 "glcpp/glcpp-lex.l" { return AND; } YY_BREAK case 32: YY_RULE_SETUP -#line 230 "glcpp/glcpp-lex.l" +#line 227 "glcpp/glcpp-lex.l" { return OR; } YY_BREAK case 33: YY_RULE_SETUP -#line 234 "glcpp/glcpp-lex.l" +#line 231 "glcpp/glcpp-lex.l" { return PASTE; } YY_BREAK case 34: YY_RULE_SETUP -#line 238 "glcpp/glcpp-lex.l" +#line 235 "glcpp/glcpp-lex.l" { return DEFINED; } YY_BREAK case 35: YY_RULE_SETUP -#line 242 "glcpp/glcpp-lex.l" +#line 239 "glcpp/glcpp-lex.l" { yylval->str = talloc_strdup (yyextra, yytext); return IDENTIFIER; @@ -1359,14 +1368,14 @@ YY_RULE_SETUP YY_BREAK case 36: YY_RULE_SETUP -#line 247 "glcpp/glcpp-lex.l" +#line 244 "glcpp/glcpp-lex.l" { return yytext[0]; } YY_BREAK case 37: YY_RULE_SETUP -#line 251 "glcpp/glcpp-lex.l" +#line 248 "glcpp/glcpp-lex.l" { yylval->str = talloc_strdup (yyextra, yytext); return OTHER; @@ -1374,7 +1383,7 @@ YY_RULE_SETUP YY_BREAK case 38: YY_RULE_SETUP -#line 256 "glcpp/glcpp-lex.l" +#line 253 "glcpp/glcpp-lex.l" { if (yyextra->space_tokens) { return SPACE; @@ -1384,7 +1393,7 @@ YY_RULE_SETUP case 39: /* rule 39 can match eol */ YY_RULE_SETUP -#line 262 "glcpp/glcpp-lex.l" +#line 259 "glcpp/glcpp-lex.l" { yyextra->lexing_if = 0; yylineno++; @@ -1394,7 +1403,7 @@ YY_RULE_SETUP YY_BREAK /* Handle missing newline at EOF. */ case YY_STATE_EOF(INITIAL): -#line 270 "glcpp/glcpp-lex.l" +#line 267 "glcpp/glcpp-lex.l" { BEGIN DONE; /* Don't keep matching this rule forever. */ yyextra->lexing_if = 0; @@ -1407,7 +1416,7 @@ case YY_STATE_EOF(INITIAL): warnings. */ case 40: YY_RULE_SETUP -#line 280 "glcpp/glcpp-lex.l" +#line 277 "glcpp/glcpp-lex.l" { unput('.'); yy_top_state(yyextra); @@ -1415,10 +1424,10 @@ YY_RULE_SETUP YY_BREAK case 41: YY_RULE_SETUP -#line 285 "glcpp/glcpp-lex.l" +#line 282 "glcpp/glcpp-lex.l" ECHO; YY_BREAK -#line 1422 "glcpp/glcpp-lex.c" +#line 1431 "glcpp/glcpp-lex.c" case YY_STATE_EOF(DONE): case YY_STATE_EOF(COMMENT): case YY_STATE_EOF(UNREACHABLE): @@ -1684,7 +1693,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 >= 151 ) + 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]; @@ -1708,11 +1717,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 >= 151 ) + 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 == 150); + yy_is_jam = (yy_current_state == 149); if ( ! yy_is_jam ) *yyg->yy_state_ptr++ = yy_current_state; @@ -2157,8 +2166,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. */ @@ -2612,7 +2621,7 @@ void glcpp_free (void * ptr , yyscan_t yyscanner) #define YYTABLES_NAME "yytables" -#line 285 "glcpp/glcpp-lex.l" +#line 282 "glcpp/glcpp-lex.l" -- cgit v1.2.3 From ce5d0a296c984a9b746f0b248f4cb10ed78bc647 Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Tue, 17 Aug 2010 22:23:43 -0700 Subject: glcpp: Fix 064-version.c expected result to track recent change. In commit 6be3a8b70af4ba4fa4d037d54ecf6d5f055edbc9, the #version directive was fixed to stop generating a spurious newline. Here we simply update the expected result for the single test which includes a #version directive. --- src/glsl/glcpp/tests/064-version.c.expected | 1 - 1 file changed, 1 deletion(-) (limited to 'src') diff --git a/src/glsl/glcpp/tests/064-version.c.expected b/src/glsl/glcpp/tests/064-version.c.expected index 1c53467270..3af71113c8 100644 --- a/src/glsl/glcpp/tests/064-version.c.expected +++ b/src/glsl/glcpp/tests/064-version.c.expected @@ -1,4 +1,3 @@ #version 130 - -- cgit v1.2.3 From b777db32541b360516203865a0fa41f4b8cebf7c Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Wed, 18 Aug 2010 15:05:34 +1000 Subject: r600g: fix TXP vs TEX in shader. Don't do perspective for TEX, and also copy input to a temporary for TEX also add tex opcode names --- src/gallium/drivers/r600/r600_shader.c | 125 ++++++++++++++++----------------- src/gallium/drivers/r600/r600d.h | 7 ++ 2 files changed, 67 insertions(+), 65 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/r600_shader.c b/src/gallium/drivers/r600/r600_shader.c index a45d63b34b..c45aa7772a 100644 --- a/src/gallium/drivers/r600/r600_shader.c +++ b/src/gallium/drivers/r600/r600_shader.c @@ -1035,73 +1035,68 @@ static int tgsi_tex(struct r600_shader_ctx *ctx) struct r600_bc_tex tex; struct r600_bc_alu alu; unsigned src_gpr; - int r; + int r, i; src_gpr = ctx->file_offset[inst->Src[0].Register.File] + inst->Src[0].Register.Index; - /* Add perspective divide */ - memset(&alu, 0, sizeof(struct r600_bc_alu)); - alu.inst = V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RECIP_IEEE; - alu.src[0].sel = src_gpr; - alu.src[0].chan = tgsi_chan(&inst->Src[0], 3); - alu.dst.sel = ctx->temp_reg; - alu.dst.chan = 3; - alu.last = 1; - alu.dst.write = 1; - r = r600_bc_add_alu(ctx->bc, &alu); - if (r) - return r; - - memset(&alu, 0, sizeof(struct r600_bc_alu)); - alu.inst = V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MUL; - alu.src[0].sel = ctx->temp_reg; - alu.src[0].chan = 3; - alu.src[1].sel = src_gpr; - alu.src[1].chan = tgsi_chan(&inst->Src[0], 0); - alu.dst.sel = ctx->temp_reg; - alu.dst.chan = 0; - alu.dst.write = 1; - r = r600_bc_add_alu(ctx->bc, &alu); - if (r) - return r; - memset(&alu, 0, sizeof(struct r600_bc_alu)); - alu.inst = V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MUL; - alu.src[0].sel = ctx->temp_reg; - alu.src[0].chan = 3; - alu.src[1].sel = src_gpr; - alu.src[1].chan = tgsi_chan(&inst->Src[0], 1); - alu.dst.sel = ctx->temp_reg; - alu.dst.chan = 1; - alu.dst.write = 1; - r = r600_bc_add_alu(ctx->bc, &alu); - if (r) - return r; - memset(&alu, 0, sizeof(struct r600_bc_alu)); - alu.inst = V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MUL; - alu.src[0].sel = ctx->temp_reg; - alu.src[0].chan = 3; - alu.src[1].sel = src_gpr; - alu.src[1].chan = tgsi_chan(&inst->Src[0], 2); - alu.dst.sel = ctx->temp_reg; - alu.dst.chan = 2; - alu.dst.write = 1; - r = r600_bc_add_alu(ctx->bc, &alu); - if (r) - return r; - memset(&alu, 0, sizeof(struct r600_bc_alu)); - alu.inst = V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV; - alu.src[0].sel = 249; - alu.src[0].chan = 0; - alu.dst.sel = ctx->temp_reg; - alu.dst.chan = 3; - alu.last = 1; - alu.dst.write = 1; - r = r600_bc_add_alu(ctx->bc, &alu); - if (r) - return r; - src_gpr = ctx->temp_reg; + if (inst->Instruction.Opcode == TGSI_OPCODE_TXP) { + /* Add perspective divide */ + memset(&alu, 0, sizeof(struct r600_bc_alu)); + alu.inst = V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RECIP_IEEE; + alu.src[0].sel = src_gpr; + alu.src[0].chan = tgsi_chan(&inst->Src[0], 3); + alu.dst.sel = ctx->temp_reg; + alu.dst.chan = 3; + alu.last = 1; + alu.dst.write = 1; + r = r600_bc_add_alu(ctx->bc, &alu); + if (r) + return r; + + for (i = 0; i < 3; i++) { + memset(&alu, 0, sizeof(struct r600_bc_alu)); + alu.inst = V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MUL; + alu.src[0].sel = ctx->temp_reg; + alu.src[0].chan = 3; + alu.src[1].sel = src_gpr; + alu.src[1].chan = tgsi_chan(&inst->Src[0], i); + alu.dst.sel = ctx->temp_reg; + alu.dst.chan = i; + alu.dst.write = 1; + r = r600_bc_add_alu(ctx->bc, &alu); + if (r) + return r; + } + memset(&alu, 0, sizeof(struct r600_bc_alu)); + alu.inst = V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV; + alu.src[0].sel = 249; + alu.src[0].chan = 0; + alu.dst.sel = ctx->temp_reg; + alu.dst.chan = 3; + alu.last = 1; + alu.dst.write = 1; + r = r600_bc_add_alu(ctx->bc, &alu); + if (r) + return r; + src_gpr = ctx->temp_reg; + } else if (inst->Src[0].Register.File != TGSI_FILE_TEMPORARY) { + for (i = 0; i < 4; i++) { + memset(&alu, 0, sizeof(struct r600_bc_alu)); + alu.inst = V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV; + alu.src[0].sel = src_gpr; + alu.src[0].chan = i; + alu.dst.sel = ctx->temp_reg; + alu.dst.chan = i; + if (i == 3) + alu.last = 1; + alu.dst.write = 1; + r = r600_bc_add_alu(ctx->bc, &alu); + if (r) + return r; + } + src_gpr = ctx->temp_reg; + } - /* TODO use temp if src_gpr is not a temporary reg (File != TEMPORARY) */ memset(&tex, 0, sizeof(struct r600_bc_tex)); tex.inst = ctx->inst_info->r600_opcode; tex.resource_id = ctx->file_offset[inst->Src[1].Register.File] + inst->Src[1].Register.Index; @@ -1261,9 +1256,9 @@ static struct r600_shader_tgsi_instruction r600_shader_tgsi_instruction[] = { {TGSI_OPCODE_SLE, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported}, {TGSI_OPCODE_SNE, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported}, {TGSI_OPCODE_STR, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported}, - {TGSI_OPCODE_TEX, 0, 0x10, tgsi_tex}, + {TGSI_OPCODE_TEX, 0, SQ_TEX_INST_SAMPLE, tgsi_tex}, {TGSI_OPCODE_TXD, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported}, - {TGSI_OPCODE_TXP, 0, 0x10, tgsi_tex}, + {TGSI_OPCODE_TXP, 0, SQ_TEX_INST_SAMPLE, tgsi_tex}, {TGSI_OPCODE_UP2H, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported}, {TGSI_OPCODE_UP2US, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported}, {TGSI_OPCODE_UP4B, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported}, diff --git a/src/gallium/drivers/r600/r600d.h b/src/gallium/drivers/r600/r600d.h index 53388f822e..9bdfe4f966 100644 --- a/src/gallium/drivers/r600/r600d.h +++ b/src/gallium/drivers/r600/r600d.h @@ -1316,4 +1316,11 @@ #define G_0286D4_PNT_SPRITE_TOP_1(x) (((x) >> 14) & 0x1) #define C_0286D4_PNT_SPRITE_TOP_1 0xFFFFBFFF +#define SQ_TEX_INST_LD 0x03 +#define SQ_TEX_INST_GET_GRADIENTS_H 0x7 +#define SQ_TEX_INST_GET_GRADIENTS_V 0x8 + +#define SQ_TEX_INST_SAMPLE 0x10 +#define SQ_TEX_INST_SAMPLE_L 0x11 +#define SQ_TEX_INST_SAMPLE_C 0x18 #endif -- cgit v1.2.3 From d01c0025e81e713d99f4de9ed7f4cdd12a1d08b5 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Wed, 18 Aug 2010 15:26:28 +1000 Subject: r600g: add TXB support fixes biased texturing tests --- src/gallium/drivers/r600/r600_shader.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/r600_shader.c b/src/gallium/drivers/r600/r600_shader.c index c45aa7772a..ea1dd1ebe2 100644 --- a/src/gallium/drivers/r600/r600_shader.c +++ b/src/gallium/drivers/r600/r600_shader.c @@ -1272,7 +1272,7 @@ static struct r600_shader_tgsi_instruction r600_shader_tgsi_instruction[] = { {TGSI_OPCODE_SSG, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported}, /* SGN */ {TGSI_OPCODE_CMP, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported}, {TGSI_OPCODE_SCS, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported}, - {TGSI_OPCODE_TXB, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported}, + {TGSI_OPCODE_TXB, 0, SQ_TEX_INST_SAMPLE_L, tgsi_tex}, {TGSI_OPCODE_NRM, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported}, {TGSI_OPCODE_DIV, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported}, {TGSI_OPCODE_DP2, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_DOT4, tgsi_dp}, -- cgit v1.2.3 From be288c3505429811adc2743c1be2c1971f4483a2 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Wed, 18 Aug 2010 15:53:29 +1000 Subject: r600g: add SGE and SLE opcodes fixes fp-set-01 and glsl-fs-step --- src/gallium/drivers/r600/r600_shader.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/r600_shader.c b/src/gallium/drivers/r600/r600_shader.c index ea1dd1ebe2..1487c4e8b7 100644 --- a/src/gallium/drivers/r600/r600_shader.c +++ b/src/gallium/drivers/r600/r600_shader.c @@ -1216,7 +1216,7 @@ static struct r600_shader_tgsi_instruction r600_shader_tgsi_instruction[] = { {TGSI_OPCODE_MIN, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MIN, tgsi_op2}, {TGSI_OPCODE_MAX, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MAX, tgsi_op2}, {TGSI_OPCODE_SLT, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETGT, tgsi_slt}, - {TGSI_OPCODE_SGE, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported}, + {TGSI_OPCODE_SGE, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETGE, tgsi_op2}, {TGSI_OPCODE_MAD, 1, V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_MULADD, tgsi_op3}, {TGSI_OPCODE_SUB, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_ADD, tgsi_op2}, {TGSI_OPCODE_LRP, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_lrp}, @@ -1253,7 +1253,7 @@ static struct r600_shader_tgsi_instruction r600_shader_tgsi_instruction[] = { {TGSI_OPCODE_SFL, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported}, {TGSI_OPCODE_SGT, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported}, {TGSI_OPCODE_SIN, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported}, - {TGSI_OPCODE_SLE, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported}, + {TGSI_OPCODE_SLE, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETGE, tgsi_slt}, {TGSI_OPCODE_SNE, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported}, {TGSI_OPCODE_STR, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported}, {TGSI_OPCODE_TEX, 0, SQ_TEX_INST_SAMPLE, tgsi_tex}, -- cgit v1.2.3 From 3af87162cd0d3107cb2af0812ce4e4680b177725 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Wed, 18 Aug 2010 16:10:16 +1000 Subject: r600g: add FRC, FLR, DDX and DDY the first two are straight op2's and the DDX/DDY are taken from r600c. --- src/gallium/drivers/r600/r600_shader.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/r600_shader.c b/src/gallium/drivers/r600/r600_shader.c index 1487c4e8b7..828082d10b 100644 --- a/src/gallium/drivers/r600/r600_shader.c +++ b/src/gallium/drivers/r600/r600_shader.c @@ -1227,9 +1227,9 @@ static struct r600_shader_tgsi_instruction r600_shader_tgsi_instruction[] = { /* gap */ {22, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported}, {23, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported}, - {TGSI_OPCODE_FRC, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported}, + {TGSI_OPCODE_FRC, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FRACT, tgsi_op2}, {TGSI_OPCODE_CLAMP, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported}, - {TGSI_OPCODE_FLR, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported}, + {TGSI_OPCODE_FLR, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FLOOR, tgsi_op2}, {TGSI_OPCODE_ROUND, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported}, {TGSI_OPCODE_EX2, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_EXP_IEEE, tgsi_trans_srcx_replicate}, {TGSI_OPCODE_LG2, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_LOG_IEEE, tgsi_trans_srcx_replicate}, @@ -1241,8 +1241,8 @@ static struct r600_shader_tgsi_instruction r600_shader_tgsi_instruction[] = { {TGSI_OPCODE_RCC, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported}, {TGSI_OPCODE_DPH, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported}, {TGSI_OPCODE_COS, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported}, - {TGSI_OPCODE_DDX, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported}, - {TGSI_OPCODE_DDY, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported}, + {TGSI_OPCODE_DDX, 0, SQ_TEX_INST_GET_GRADIENTS_H, tgsi_tex}, + {TGSI_OPCODE_DDY, 0, SQ_TEX_INST_GET_GRADIENTS_V, tgsi_tex}, {TGSI_OPCODE_KILP, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported}, /* predicated kill */ {TGSI_OPCODE_PK2H, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported}, {TGSI_OPCODE_PK2US, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported}, -- cgit v1.2.3 From 97638aa77c509cd37dea499202d31357926a0e2a Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Tue, 17 Aug 2010 23:13:56 -0700 Subject: glcpp: Allow standalone glcpp to accept a filename as first argument. This is useful for debugging the preprocessor. --- src/glsl/glcpp/glcpp.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/glsl/glcpp/glcpp.c b/src/glsl/glcpp/glcpp.c index a245cb5406..e49a1df79c 100644 --- a/src/glsl/glcpp/glcpp.c +++ b/src/glsl/glcpp/glcpp.c @@ -69,12 +69,20 @@ load_text_file(void *ctx, const char *file_name) } int -main (void) +main (int argc, char *argv[]) { + char *filename = NULL; 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, NULL); + const char *shader; + int ret; + + if (argc) { + filename = argv[1]; + } + + shader = load_text_file(ctx, filename); + ret = preprocess(ctx, &shader, &info_log, NULL); printf("%s", shader); fprintf(stderr, "%s", info_log); -- cgit v1.2.3 From 105e2137d67b98c24251be3586985fb61aeaf28a Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Tue, 17 Aug 2010 23:19:01 -0700 Subject: glcpp: Add two new tests for testing redefined macros. The specification says that redefining a macro is an error, unless the new definitions is identical to the old one, (identical replacement lists but ignoring differing amounts of whitespace). --- .../glcpp/tests/088-redefine-macro-legitimate.c | 5 ++++ .../tests/088-redefine-macro-legitimate.c.expected | 6 +++++ src/glsl/glcpp/tests/089-redefine-macro-error.c | 17 ++++++++++++ .../tests/089-redefine-macro-error.c.expected | 30 ++++++++++++++++++++++ 4 files changed, 58 insertions(+) create mode 100644 src/glsl/glcpp/tests/088-redefine-macro-legitimate.c create mode 100644 src/glsl/glcpp/tests/088-redefine-macro-legitimate.c.expected create mode 100644 src/glsl/glcpp/tests/089-redefine-macro-error.c create mode 100644 src/glsl/glcpp/tests/089-redefine-macro-error.c.expected (limited to 'src') diff --git a/src/glsl/glcpp/tests/088-redefine-macro-legitimate.c b/src/glsl/glcpp/tests/088-redefine-macro-legitimate.c new file mode 100644 index 0000000000..0e0666b8b3 --- /dev/null +++ b/src/glsl/glcpp/tests/088-redefine-macro-legitimate.c @@ -0,0 +1,5 @@ +#define abc 123 +#define abc 123 + +#define foo(x) (x)+23 +#define foo(x) ( x ) + 23 diff --git a/src/glsl/glcpp/tests/088-redefine-macro-legitimate.c.expected b/src/glsl/glcpp/tests/088-redefine-macro-legitimate.c.expected new file mode 100644 index 0000000000..6fb66a5e2f --- /dev/null +++ b/src/glsl/glcpp/tests/088-redefine-macro-legitimate.c.expected @@ -0,0 +1,6 @@ + + + + + + diff --git a/src/glsl/glcpp/tests/089-redefine-macro-error.c b/src/glsl/glcpp/tests/089-redefine-macro-error.c new file mode 100644 index 0000000000..b3d1391e16 --- /dev/null +++ b/src/glsl/glcpp/tests/089-redefine-macro-error.c @@ -0,0 +1,17 @@ +#define x y +#define x z + +#define abc 123 +#define abc() 123 + +#define foo() bar +#define foo(x) bar + +#define bar() baz +#define bar baz + +#define biff(a,b) a+b +#define biff(a,b,c) a+b + +#define oper(a,b) a+b +#define oper(a,b) a*b diff --git a/src/glsl/glcpp/tests/089-redefine-macro-error.c.expected b/src/glsl/glcpp/tests/089-redefine-macro-error.c.expected new file mode 100644 index 0000000000..6209ead559 --- /dev/null +++ b/src/glsl/glcpp/tests/089-redefine-macro-error.c.expected @@ -0,0 +1,30 @@ +0:2(9): preprocessor error: Redefinition of macro x + +0:5(9): preprocessor error: Redefinition of macro abc + +0:8(9): preprocessor error: Redefinition of macro foo + +0:11(9): preprocessor error: Redefinition of macro bar + +0:14(9): preprocessor error: Redefinition of macro biff + +0:17(9): preprocessor error: Redefinition of macro oper + + + + + + + + + + + + + + + + + + + -- cgit v1.2.3 From 3882cf21696d2576bd3d855dbc97c9354f72a15f Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Tue, 17 Aug 2010 23:20:58 -0700 Subject: glcpp: Add support for "redefined macro" error. Carefully avoiding printing any error when the new definition matches the existing definition. This fixes the recently-added 088-redefine-macro-legitimate.c and 089-redefine-macro-error.c tests as well as glsparsertest/preprocess1 in piglit. --- src/glsl/glcpp/glcpp-parse.y | 125 ++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 123 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/glsl/glcpp/glcpp-parse.y b/src/glsl/glcpp/glcpp-parse.y index c91da15519..3275496d99 100644 --- a/src/glsl/glcpp/glcpp-parse.y +++ b/src/glsl/glcpp/glcpp-parse.y @@ -63,6 +63,9 @@ _string_list_contains (string_list_t *list, const char *member, int *index); static int _string_list_length (string_list_t *list); +static int +_string_list_equal (string_list_t *a, string_list_t *b); + static argument_list_t * _argument_list_create (void *ctx); @@ -95,6 +98,9 @@ _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 int +_token_list_equal_ignoring_space (token_list_t *a, token_list_t *b); + static active_list_t * _active_list_push (active_list_t *list, const char *identifier, @@ -604,6 +610,31 @@ _string_list_length (string_list_t *list) return length; } +int +_string_list_equal (string_list_t *a, string_list_t *b) +{ + string_node_t *node_a, *node_b; + + if (a == NULL && b == NULL) + return 1; + + if (a == NULL || b == NULL) + return 0; + + for (node_a = a->head, node_b = b->head; + node_a && node_b; + node_a = node_a->next, node_b = node_b->next) + { + if (strcmp (node_a->str, node_b->str)) + return 0; + } + + /* Catch the case of lists being different lengths, (which + * would cause the loop above to terminate after the shorter + * list). */ + return node_a == node_b; +} + argument_list_t * _argument_list_create (void *ctx) { @@ -781,6 +812,61 @@ _token_list_trim_trailing_space (token_list_t *list) } } +int +_token_list_equal_ignoring_space (token_list_t *a, token_list_t *b) +{ + token_node_t *node_a, *node_b; + + node_a = a->head; + node_b = b->head; + + while (1) + { + if (node_a == NULL && node_b == NULL) + break; + + if (node_a == NULL || node_b == NULL) + return 0; + + if (node_a->token->type == SPACE) { + node_a = node_a->next; + continue; + } + + if (node_b->token->type == SPACE) { + node_b = node_b->next; + continue; + } + + if (node_a->token->type != node_b->token->type) + return 0; + + switch (node_a->token->type) { + case INTEGER: + if (node_a->token->value.ival != + node_b->token->value.ival) + { + return 0; + } + break; + case IDENTIFIER: + case INTEGER_STRING: + case OTHER: + if (strcmp (node_a->token->value.str, + node_b->token->value.str)) + { + return 0; + } + break; + } + + node_a = node_a->next; + node_b = node_b->next; + } + + return 1; +} + static void _token_print (char **out, token_t *token) { @@ -1522,13 +1608,28 @@ _check_for_reserved_macro_name (glcpp_parser_t *parser, YYLTYPE *loc, } } +static int +_macro_equal (macro_t *a, macro_t *b) +{ + if (a->is_function != b->is_function) + return 0; + + if (a->is_function) { + if (! _string_list_equal (a->parameters, b->parameters)) + return 0; + } + + return _token_list_equal_ignoring_space (a->replacements, + b->replacements); +} + void _define_object_macro (glcpp_parser_t *parser, YYLTYPE *loc, const char *identifier, token_list_t *replacements) { - macro_t *macro; + macro_t *macro, *previous; if (loc != NULL) _check_for_reserved_macro_name(parser, loc, identifier); @@ -1540,6 +1641,16 @@ _define_object_macro (glcpp_parser_t *parser, macro->identifier = talloc_strdup (macro, identifier); macro->replacements = talloc_steal (macro, replacements); + previous = hash_table_find (parser->defines, identifier); + if (previous) { + if (_macro_equal (macro, previous)) { + talloc_free (macro); + return; + } + glcpp_error (loc, parser, "Redefinition of macro %s\n", + identifier); + } + hash_table_insert (parser->defines, macro, identifier); } @@ -1550,7 +1661,7 @@ _define_function_macro (glcpp_parser_t *parser, string_list_t *parameters, token_list_t *replacements) { - macro_t *macro; + macro_t *macro, *previous; _check_for_reserved_macro_name(parser, loc, identifier); @@ -1561,6 +1672,16 @@ _define_function_macro (glcpp_parser_t *parser, macro->identifier = talloc_strdup (macro, identifier); macro->replacements = talloc_steal (macro, replacements); + previous = hash_table_find (parser->defines, identifier); + if (previous) { + if (_macro_equal (macro, previous)) { + talloc_free (macro); + return; + } + glcpp_error (loc, parser, "Redefinition of macro %s\n", + identifier); + } + hash_table_insert (parser->defines, macro, identifier); } -- cgit v1.2.3 From 9751b4ec60291a5fc48fe9ef27324350d148f36e Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Tue, 17 Aug 2010 23:22:42 -0700 Subject: glcpp: Refresh generated files. After a recent change to glcpp-parse.y (adding "redefined macro" error). --- src/glsl/glcpp/glcpp-parse.c | 565 ++++++++++++++++++++++++++----------------- src/glsl/glcpp/glcpp-parse.h | 7 +- 2 files changed, 343 insertions(+), 229 deletions(-) (limited to 'src') diff --git a/src/glsl/glcpp/glcpp-parse.c b/src/glsl/glcpp/glcpp-parse.c index a19a02a867..2c04d7d71b 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.3. */ + +/* 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, - 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.3" +#define YYBISON_VERSION "2.4.1" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" @@ -133,6 +134,9 @@ _string_list_contains (string_list_t *list, const char *member, int *index); static int _string_list_length (string_list_t *list); +static int +_string_list_equal (string_list_t *a, string_list_t *b); + static argument_list_t * _argument_list_create (void *ctx); @@ -165,6 +169,9 @@ _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 int +_token_list_equal_ignoring_space (token_list_t *a, token_list_t *b); + static active_list_t * _active_list_push (active_list_t *list, const char *identifier, @@ -212,7 +219,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 223 "glcpp/glcpp-parse.c" /* Enabling traces. */ #ifndef YYDEBUG @@ -300,7 +307,7 @@ typedef struct YYLTYPE /* Line 264 of yacc.c */ -#line 304 "glcpp/glcpp-parse.c" +#line 311 "glcpp/glcpp-parse.c" #ifdef short # undef short @@ -350,7 +357,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) @@ -625,17 +632,17 @@ static const yytype_int8 yyrhs[] = /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ static const yytype_uint16 yyrline[] = { - 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 + 0, 187, 187, 189, 193, 196, 201, 202, 206, 209, + 215, 218, 221, 224, 232, 251, 261, 266, 271, 290, + 305, 308, 311, 320, 324, 333, 338, 339, 342, 345, + 348, 351, 354, 357, 360, 363, 366, 369, 372, 375, + 378, 381, 384, 387, 390, 393, 396, 399, 402, 405, + 411, 416, 424, 425, 429, 435, 436, 439, 441, 448, + 452, 456, 461, 467, 475, 481, 489, 493, 497, 501, + 505, 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, 537, 538, 539, 540, + 541, 542 }; #endif @@ -938,18 +945,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) @@ -1006,7 +1004,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, \ @@ -1548,7 +1546,7 @@ YYLTYPE yylloc; YYLTYPE *yylsp; /* The locations where the error started and ended. */ - YYLTYPE yyerror_range[3]; + YYLTYPE yyerror_range[2]; YYSIZE_T yystacksize; @@ -1595,7 +1593,7 @@ 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; @@ -1603,8 +1601,8 @@ YYLTYPE yylloc; /* User initialization code. */ -/* Line 1251 of yacc.c */ -#line 148 "glcpp/glcpp-parse.y" +/* Line 1242 of yacc.c */ +#line 154 "glcpp/glcpp-parse.y" { yylloc.first_line = 1; yylloc.first_column = 1; @@ -1613,8 +1611,8 @@ YYLTYPE yylloc; yylloc.source = 0; } -/* Line 1251 of yacc.c */ -#line 1618 "glcpp/glcpp-parse.c" +/* Line 1242 of yacc.c */ +#line 1616 "glcpp/glcpp-parse.c" yylsp[0] = yylloc; goto yysetstate; @@ -1801,8 +1799,8 @@ yyreduce: { case 4: -/* Line 1464 of yacc.c */ -#line 187 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 193 "glcpp/glcpp-parse.y" { glcpp_print(parser->output, "\n"); ;} @@ -1810,8 +1808,8 @@ yyreduce: case 5: -/* Line 1464 of yacc.c */ -#line 190 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 196 "glcpp/glcpp-parse.y" { _glcpp_parser_print_expanded_token_list (parser, (yyvsp[(1) - (1)].token_list)); glcpp_print(parser->output, "\n"); @@ -1821,8 +1819,8 @@ yyreduce: case 8: -/* Line 1464 of yacc.c */ -#line 200 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 206 "glcpp/glcpp-parse.y" { _glcpp_parser_skip_stack_push_if (parser, & (yylsp[(1) - (3)]), (yyvsp[(2) - (3)].ival)); ;} @@ -1830,8 +1828,8 @@ yyreduce: case 9: -/* Line 1464 of yacc.c */ -#line 203 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 209 "glcpp/glcpp-parse.y" { _glcpp_parser_skip_stack_change_if (parser, & (yylsp[(1) - (3)]), "elif", (yyvsp[(2) - (3)].ival)); ;} @@ -1839,8 +1837,8 @@ yyreduce: case 10: -/* Line 1464 of yacc.c */ -#line 209 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 215 "glcpp/glcpp-parse.y" { _define_object_macro (parser, & (yylsp[(2) - (4)]), (yyvsp[(2) - (4)].str), (yyvsp[(3) - (4)].token_list)); ;} @@ -1848,8 +1846,8 @@ yyreduce: case 11: -/* Line 1464 of yacc.c */ -#line 212 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 218 "glcpp/glcpp-parse.y" { _define_function_macro (parser, & (yylsp[(2) - (6)]), (yyvsp[(2) - (6)].str), NULL, (yyvsp[(5) - (6)].token_list)); ;} @@ -1857,8 +1855,8 @@ yyreduce: case 12: -/* Line 1464 of yacc.c */ -#line 215 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 221 "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)); ;} @@ -1866,8 +1864,8 @@ yyreduce: case 13: -/* Line 1464 of yacc.c */ -#line 218 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 224 "glcpp/glcpp-parse.y" { macro_t *macro = hash_table_find (parser->defines, (yyvsp[(2) - (3)].str)); if (macro) { @@ -1880,8 +1878,8 @@ yyreduce: case 14: -/* Line 1464 of yacc.c */ -#line 226 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 232 "glcpp/glcpp-parse.y" { /* Be careful to only evaluate the 'if' expression if * we are not skipping. When we are skipping, we @@ -1905,8 +1903,8 @@ yyreduce: case 15: -/* Line 1464 of yacc.c */ -#line 245 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 251 "glcpp/glcpp-parse.y" { /* #if without an expression is only an error if we * are not skipping */ @@ -1921,8 +1919,8 @@ yyreduce: case 16: -/* Line 1464 of yacc.c */ -#line 255 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 261 "glcpp/glcpp-parse.y" { macro_t *macro = hash_table_find (parser->defines, (yyvsp[(2) - (4)].str)); talloc_free ((yyvsp[(2) - (4)].str)); @@ -1932,8 +1930,8 @@ yyreduce: case 17: -/* Line 1464 of yacc.c */ -#line 260 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 266 "glcpp/glcpp-parse.y" { macro_t *macro = hash_table_find (parser->defines, (yyvsp[(2) - (4)].str)); talloc_free ((yyvsp[(2) - (4)].str)); @@ -1943,8 +1941,8 @@ yyreduce: case 18: -/* Line 1464 of yacc.c */ -#line 265 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 271 "glcpp/glcpp-parse.y" { /* Be careful to only evaluate the 'elif' expression * if we are not skipping. When we are skipping, we @@ -1968,8 +1966,8 @@ yyreduce: case 19: -/* Line 1464 of yacc.c */ -#line 284 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 290 "glcpp/glcpp-parse.y" { /* #elif without an expression is an error unless we * are skipping. */ @@ -1989,8 +1987,8 @@ yyreduce: case 20: -/* Line 1464 of yacc.c */ -#line 299 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 305 "glcpp/glcpp-parse.y" { _glcpp_parser_skip_stack_change_if (parser, & (yylsp[(1) - (2)]), "else", 1); ;} @@ -1998,8 +1996,8 @@ yyreduce: case 21: -/* Line 1464 of yacc.c */ -#line 302 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 308 "glcpp/glcpp-parse.y" { _glcpp_parser_skip_stack_pop (parser, & (yylsp[(1) - (2)])); ;} @@ -2007,8 +2005,8 @@ yyreduce: case 22: -/* Line 1464 of yacc.c */ -#line 305 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 311 "glcpp/glcpp-parse.y" { macro_t *macro = hash_table_find (parser->defines, "__VERSION__"); if (macro) { @@ -2022,8 +2020,8 @@ yyreduce: case 24: -/* Line 1464 of yacc.c */ -#line 318 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 324 "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); @@ -2037,8 +2035,8 @@ yyreduce: case 25: -/* Line 1464 of yacc.c */ -#line 327 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 333 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (1)].ival); ;} @@ -2046,8 +2044,8 @@ yyreduce: case 27: -/* Line 1464 of yacc.c */ -#line 333 "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); ;} @@ -2055,8 +2053,8 @@ yyreduce: case 28: -/* Line 1464 of yacc.c */ -#line 336 "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); ;} @@ -2064,8 +2062,8 @@ yyreduce: case 29: -/* Line 1464 of yacc.c */ -#line 339 "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); ;} @@ -2073,8 +2071,8 @@ yyreduce: case 30: -/* Line 1464 of yacc.c */ -#line 342 "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); ;} @@ -2082,8 +2080,8 @@ yyreduce: case 31: -/* Line 1464 of yacc.c */ -#line 345 "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); ;} @@ -2091,8 +2089,8 @@ yyreduce: case 32: -/* Line 1464 of yacc.c */ -#line 348 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 354 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) != (yyvsp[(3) - (3)].ival); ;} @@ -2100,8 +2098,8 @@ yyreduce: case 33: -/* Line 1464 of yacc.c */ -#line 351 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 357 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) == (yyvsp[(3) - (3)].ival); ;} @@ -2109,8 +2107,8 @@ yyreduce: case 34: -/* Line 1464 of yacc.c */ -#line 354 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 360 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) >= (yyvsp[(3) - (3)].ival); ;} @@ -2118,8 +2116,8 @@ yyreduce: case 35: -/* Line 1464 of yacc.c */ -#line 357 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 363 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) <= (yyvsp[(3) - (3)].ival); ;} @@ -2127,8 +2125,8 @@ yyreduce: case 36: -/* Line 1464 of yacc.c */ -#line 360 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 366 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) > (yyvsp[(3) - (3)].ival); ;} @@ -2136,8 +2134,8 @@ yyreduce: case 37: -/* Line 1464 of yacc.c */ -#line 363 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 369 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) < (yyvsp[(3) - (3)].ival); ;} @@ -2145,8 +2143,8 @@ yyreduce: case 38: -/* Line 1464 of yacc.c */ -#line 366 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 372 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) >> (yyvsp[(3) - (3)].ival); ;} @@ -2154,8 +2152,8 @@ yyreduce: case 39: -/* Line 1464 of yacc.c */ -#line 369 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 375 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) << (yyvsp[(3) - (3)].ival); ;} @@ -2163,8 +2161,8 @@ yyreduce: case 40: -/* Line 1464 of yacc.c */ -#line 372 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 378 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) - (yyvsp[(3) - (3)].ival); ;} @@ -2172,8 +2170,8 @@ yyreduce: case 41: -/* Line 1464 of yacc.c */ -#line 375 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 381 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) + (yyvsp[(3) - (3)].ival); ;} @@ -2181,8 +2179,8 @@ yyreduce: case 42: -/* Line 1464 of yacc.c */ -#line 378 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 384 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) % (yyvsp[(3) - (3)].ival); ;} @@ -2190,8 +2188,8 @@ yyreduce: case 43: -/* Line 1464 of yacc.c */ -#line 381 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 387 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) / (yyvsp[(3) - (3)].ival); ;} @@ -2199,8 +2197,8 @@ yyreduce: case 44: -/* Line 1464 of yacc.c */ -#line 384 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 390 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) * (yyvsp[(3) - (3)].ival); ;} @@ -2208,8 +2206,8 @@ yyreduce: case 45: -/* Line 1464 of yacc.c */ -#line 387 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 393 "glcpp/glcpp-parse.y" { (yyval.ival) = ! (yyvsp[(2) - (2)].ival); ;} @@ -2217,8 +2215,8 @@ yyreduce: case 46: -/* Line 1464 of yacc.c */ -#line 390 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 396 "glcpp/glcpp-parse.y" { (yyval.ival) = ~ (yyvsp[(2) - (2)].ival); ;} @@ -2226,8 +2224,8 @@ yyreduce: case 47: -/* Line 1464 of yacc.c */ -#line 393 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 399 "glcpp/glcpp-parse.y" { (yyval.ival) = - (yyvsp[(2) - (2)].ival); ;} @@ -2235,8 +2233,8 @@ yyreduce: case 48: -/* Line 1464 of yacc.c */ -#line 396 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 402 "glcpp/glcpp-parse.y" { (yyval.ival) = + (yyvsp[(2) - (2)].ival); ;} @@ -2244,8 +2242,8 @@ yyreduce: case 49: -/* Line 1464 of yacc.c */ -#line 399 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 405 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(2) - (3)].ival); ;} @@ -2253,8 +2251,8 @@ yyreduce: case 50: -/* Line 1464 of yacc.c */ -#line 405 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 411 "glcpp/glcpp-parse.y" { (yyval.string_list) = _string_list_create (parser); _string_list_append_item ((yyval.string_list), (yyvsp[(1) - (1)].str)); @@ -2264,8 +2262,8 @@ yyreduce: case 51: -/* Line 1464 of yacc.c */ -#line 410 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 416 "glcpp/glcpp-parse.y" { (yyval.string_list) = (yyvsp[(1) - (3)].string_list); _string_list_append_item ((yyval.string_list), (yyvsp[(3) - (3)].str)); @@ -2275,15 +2273,15 @@ yyreduce: case 52: -/* Line 1464 of yacc.c */ -#line 418 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 424 "glcpp/glcpp-parse.y" { (yyval.token_list) = NULL; ;} break; case 54: -/* Line 1464 of yacc.c */ -#line 423 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 429 "glcpp/glcpp-parse.y" { yyerror (& (yylsp[(1) - (2)]), parser, "Invalid tokens after #"); ;} @@ -2291,15 +2289,15 @@ yyreduce: case 55: -/* Line 1464 of yacc.c */ -#line 429 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 435 "glcpp/glcpp-parse.y" { (yyval.token_list) = NULL; ;} break; case 58: -/* Line 1464 of yacc.c */ -#line 435 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 441 "glcpp/glcpp-parse.y" { glcpp_warning(&(yylsp[(1) - (1)]), parser, "extra tokens at end of directive"); ;} @@ -2307,8 +2305,8 @@ yyreduce: case 59: -/* Line 1464 of yacc.c */ -#line 442 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 448 "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); @@ -2317,8 +2315,8 @@ yyreduce: case 60: -/* Line 1464 of yacc.c */ -#line 446 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 452 "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); @@ -2327,8 +2325,8 @@ yyreduce: case 62: -/* Line 1464 of yacc.c */ -#line 455 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 461 "glcpp/glcpp-parse.y" { parser->space_tokens = 1; (yyval.token_list) = _token_list_create (parser); @@ -2339,8 +2337,8 @@ yyreduce: case 63: -/* Line 1464 of yacc.c */ -#line 461 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 467 "glcpp/glcpp-parse.y" { (yyval.token_list) = (yyvsp[(1) - (2)].token_list); _token_list_append ((yyval.token_list), (yyvsp[(2) - (2)].token)); @@ -2350,8 +2348,8 @@ yyreduce: case 64: -/* Line 1464 of yacc.c */ -#line 469 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 475 "glcpp/glcpp-parse.y" { parser->space_tokens = 1; (yyval.token_list) = _token_list_create (parser); @@ -2362,8 +2360,8 @@ yyreduce: case 65: -/* Line 1464 of yacc.c */ -#line 475 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 481 "glcpp/glcpp-parse.y" { (yyval.token_list) = (yyvsp[(1) - (2)].token_list); _token_list_append ((yyval.token_list), (yyvsp[(2) - (2)].token)); @@ -2373,8 +2371,8 @@ yyreduce: case 66: -/* Line 1464 of yacc.c */ -#line 483 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 489 "glcpp/glcpp-parse.y" { (yyval.token) = _token_create_str (parser, IDENTIFIER, (yyvsp[(1) - (1)].str)); (yyval.token)->location = yylloc; @@ -2383,8 +2381,8 @@ yyreduce: case 67: -/* Line 1464 of yacc.c */ -#line 487 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 493 "glcpp/glcpp-parse.y" { (yyval.token) = _token_create_str (parser, INTEGER_STRING, (yyvsp[(1) - (1)].str)); (yyval.token)->location = yylloc; @@ -2393,8 +2391,8 @@ yyreduce: case 68: -/* Line 1464 of yacc.c */ -#line 491 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 497 "glcpp/glcpp-parse.y" { (yyval.token) = _token_create_ival (parser, (yyvsp[(1) - (1)].ival), (yyvsp[(1) - (1)].ival)); (yyval.token)->location = yylloc; @@ -2403,8 +2401,8 @@ yyreduce: case 69: -/* Line 1464 of yacc.c */ -#line 495 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 501 "glcpp/glcpp-parse.y" { (yyval.token) = _token_create_str (parser, OTHER, (yyvsp[(1) - (1)].str)); (yyval.token)->location = yylloc; @@ -2413,8 +2411,8 @@ yyreduce: case 70: -/* Line 1464 of yacc.c */ -#line 499 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 505 "glcpp/glcpp-parse.y" { (yyval.token) = _token_create_ival (parser, SPACE, SPACE); (yyval.token)->location = yylloc; @@ -2423,225 +2421,225 @@ yyreduce: case 71: -/* Line 1464 of yacc.c */ -#line 506 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 512 "glcpp/glcpp-parse.y" { (yyval.ival) = '['; ;} break; case 72: -/* Line 1464 of yacc.c */ -#line 507 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 513 "glcpp/glcpp-parse.y" { (yyval.ival) = ']'; ;} break; case 73: -/* Line 1464 of yacc.c */ -#line 508 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 514 "glcpp/glcpp-parse.y" { (yyval.ival) = '('; ;} break; case 74: -/* Line 1464 of yacc.c */ -#line 509 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 515 "glcpp/glcpp-parse.y" { (yyval.ival) = ')'; ;} break; case 75: -/* Line 1464 of yacc.c */ -#line 510 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 516 "glcpp/glcpp-parse.y" { (yyval.ival) = '{'; ;} break; case 76: -/* Line 1464 of yacc.c */ -#line 511 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 517 "glcpp/glcpp-parse.y" { (yyval.ival) = '}'; ;} break; case 77: -/* Line 1464 of yacc.c */ -#line 512 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 518 "glcpp/glcpp-parse.y" { (yyval.ival) = '.'; ;} break; case 78: -/* Line 1464 of yacc.c */ -#line 513 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 519 "glcpp/glcpp-parse.y" { (yyval.ival) = '&'; ;} break; case 79: -/* Line 1464 of yacc.c */ -#line 514 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 520 "glcpp/glcpp-parse.y" { (yyval.ival) = '*'; ;} break; case 80: -/* Line 1464 of yacc.c */ -#line 515 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 521 "glcpp/glcpp-parse.y" { (yyval.ival) = '+'; ;} break; case 81: -/* Line 1464 of yacc.c */ -#line 516 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 522 "glcpp/glcpp-parse.y" { (yyval.ival) = '-'; ;} break; case 82: -/* Line 1464 of yacc.c */ -#line 517 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 523 "glcpp/glcpp-parse.y" { (yyval.ival) = '~'; ;} break; case 83: -/* Line 1464 of yacc.c */ -#line 518 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 524 "glcpp/glcpp-parse.y" { (yyval.ival) = '!'; ;} break; case 84: -/* Line 1464 of yacc.c */ -#line 519 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 525 "glcpp/glcpp-parse.y" { (yyval.ival) = '/'; ;} break; case 85: -/* Line 1464 of yacc.c */ -#line 520 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 526 "glcpp/glcpp-parse.y" { (yyval.ival) = '%'; ;} break; case 86: -/* Line 1464 of yacc.c */ -#line 521 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 527 "glcpp/glcpp-parse.y" { (yyval.ival) = LEFT_SHIFT; ;} break; case 87: -/* Line 1464 of yacc.c */ -#line 522 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 528 "glcpp/glcpp-parse.y" { (yyval.ival) = RIGHT_SHIFT; ;} break; case 88: -/* Line 1464 of yacc.c */ -#line 523 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 529 "glcpp/glcpp-parse.y" { (yyval.ival) = '<'; ;} break; case 89: -/* Line 1464 of yacc.c */ -#line 524 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 530 "glcpp/glcpp-parse.y" { (yyval.ival) = '>'; ;} break; case 90: -/* Line 1464 of yacc.c */ -#line 525 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 531 "glcpp/glcpp-parse.y" { (yyval.ival) = LESS_OR_EQUAL; ;} break; case 91: -/* Line 1464 of yacc.c */ -#line 526 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 532 "glcpp/glcpp-parse.y" { (yyval.ival) = GREATER_OR_EQUAL; ;} break; case 92: -/* Line 1464 of yacc.c */ -#line 527 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 533 "glcpp/glcpp-parse.y" { (yyval.ival) = EQUAL; ;} break; case 93: -/* Line 1464 of yacc.c */ -#line 528 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 534 "glcpp/glcpp-parse.y" { (yyval.ival) = NOT_EQUAL; ;} break; case 94: -/* Line 1464 of yacc.c */ -#line 529 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 535 "glcpp/glcpp-parse.y" { (yyval.ival) = '^'; ;} break; case 95: -/* Line 1464 of yacc.c */ -#line 530 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 536 "glcpp/glcpp-parse.y" { (yyval.ival) = '|'; ;} break; case 96: -/* Line 1464 of yacc.c */ -#line 531 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 537 "glcpp/glcpp-parse.y" { (yyval.ival) = AND; ;} break; case 97: -/* Line 1464 of yacc.c */ -#line 532 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 538 "glcpp/glcpp-parse.y" { (yyval.ival) = OR; ;} break; case 98: -/* Line 1464 of yacc.c */ -#line 533 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 539 "glcpp/glcpp-parse.y" { (yyval.ival) = ';'; ;} break; case 99: -/* Line 1464 of yacc.c */ -#line 534 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 540 "glcpp/glcpp-parse.y" { (yyval.ival) = ','; ;} break; case 100: -/* Line 1464 of yacc.c */ -#line 535 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 541 "glcpp/glcpp-parse.y" { (yyval.ival) = '='; ;} break; case 101: -/* Line 1464 of yacc.c */ -#line 536 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 542 "glcpp/glcpp-parse.y" { (yyval.ival) = PASTE; ;} break; -/* Line 1464 of yacc.c */ -#line 2645 "glcpp/glcpp-parse.c" +/* Line 1455 of yacc.c */ +#line 2643 "glcpp/glcpp-parse.c" default: break; } YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); @@ -2713,7 +2711,7 @@ yyerrlab: #endif } - yyerror_range[1] = yylloc; + yyerror_range[0] = yylloc; if (yyerrstatus == 3) { @@ -2750,7 +2748,7 @@ yyerrorlab: if (/*CONSTCOND*/ 0) goto yyerrorlab; - yyerror_range[1] = yylsp[1-yylen]; + yyerror_range[0] = yylsp[1-yylen]; /* Do not reclaim the symbols of the rule which action triggered this YYERROR. */ YYPOPSTACK (yylen); @@ -2784,7 +2782,7 @@ yyerrlab1: if (yyssp == yyss) YYABORT; - yyerror_range[1] = *yylsp; + yyerror_range[0] = *yylsp; yydestruct ("Error: popping", yystos[yystate], yyvsp, yylsp, parser); YYPOPSTACK (1); @@ -2794,10 +2792,10 @@ yyerrlab1: *++yyvsp = yylval; - yyerror_range[2] = yylloc; + 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, 2); + YYLLOC_DEFAULT (yyloc, (yyerror_range - 1), 2); *++yylsp = yyloc; /* Shift the error token. */ @@ -2859,8 +2857,8 @@ yyreturn: -/* Line 1684 of yacc.c */ -#line 539 "glcpp/glcpp-parse.y" +/* Line 1675 of yacc.c */ +#line 545 "glcpp/glcpp-parse.y" string_list_t * @@ -2929,6 +2927,31 @@ _string_list_length (string_list_t *list) return length; } +int +_string_list_equal (string_list_t *a, string_list_t *b) +{ + string_node_t *node_a, *node_b; + + if (a == NULL && b == NULL) + return 1; + + if (a == NULL || b == NULL) + return 0; + + for (node_a = a->head, node_b = b->head; + node_a && node_b; + node_a = node_a->next, node_b = node_b->next) + { + if (strcmp (node_a->str, node_b->str)) + return 0; + } + + /* Catch the case of lists being different lengths, (which + * would cause the loop above to terminate after the shorter + * list). */ + return node_a == node_b; +} + argument_list_t * _argument_list_create (void *ctx) { @@ -3106,6 +3129,61 @@ _token_list_trim_trailing_space (token_list_t *list) } } +int +_token_list_equal_ignoring_space (token_list_t *a, token_list_t *b) +{ + token_node_t *node_a, *node_b; + + node_a = a->head; + node_b = b->head; + + while (1) + { + if (node_a == NULL && node_b == NULL) + break; + + if (node_a == NULL || node_b == NULL) + return 0; + + if (node_a->token->type == SPACE) { + node_a = node_a->next; + continue; + } + + if (node_b->token->type == SPACE) { + node_b = node_b->next; + continue; + } + + if (node_a->token->type != node_b->token->type) + return 0; + + switch (node_a->token->type) { + case INTEGER: + if (node_a->token->value.ival != + node_b->token->value.ival) + { + return 0; + } + break; + case IDENTIFIER: + case INTEGER_STRING: + case OTHER: + if (strcmp (node_a->token->value.str, + node_b->token->value.str)) + { + return 0; + } + break; + } + + node_a = node_a->next; + node_b = node_b->next; + } + + return 1; +} + static void _token_print (char **out, token_t *token) { @@ -3847,13 +3925,28 @@ _check_for_reserved_macro_name (glcpp_parser_t *parser, YYLTYPE *loc, } } +static int +_macro_equal (macro_t *a, macro_t *b) +{ + if (a->is_function != b->is_function) + return 0; + + if (a->is_function) { + if (! _string_list_equal (a->parameters, b->parameters)) + return 0; + } + + return _token_list_equal_ignoring_space (a->replacements, + b->replacements); +} + void _define_object_macro (glcpp_parser_t *parser, YYLTYPE *loc, const char *identifier, token_list_t *replacements) { - macro_t *macro; + macro_t *macro, *previous; if (loc != NULL) _check_for_reserved_macro_name(parser, loc, identifier); @@ -3865,6 +3958,16 @@ _define_object_macro (glcpp_parser_t *parser, macro->identifier = talloc_strdup (macro, identifier); macro->replacements = talloc_steal (macro, replacements); + previous = hash_table_find (parser->defines, identifier); + if (previous) { + if (_macro_equal (macro, previous)) { + talloc_free (macro); + return; + } + glcpp_error (loc, parser, "Redefinition of macro %s\n", + identifier); + } + hash_table_insert (parser->defines, macro, identifier); } @@ -3875,7 +3978,7 @@ _define_function_macro (glcpp_parser_t *parser, string_list_t *parameters, token_list_t *replacements) { - macro_t *macro; + macro_t *macro, *previous; _check_for_reserved_macro_name(parser, loc, identifier); @@ -3886,6 +3989,16 @@ _define_function_macro (glcpp_parser_t *parser, macro->identifier = talloc_strdup (macro, identifier); macro->replacements = talloc_steal (macro, replacements); + previous = hash_table_find (parser->defines, identifier); + if (previous) { + if (_macro_equal (macro, previous)) { + talloc_free (macro); + return; + } + glcpp_error (loc, parser, "Redefinition of macro %s\n", + identifier); + } + hash_table_insert (parser->defines, macro, identifier); } diff --git a/src/glsl/glcpp/glcpp-parse.h b/src/glsl/glcpp/glcpp-parse.h index 40556854f3..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.3. */ + +/* 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, - 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 f70ce12529cf76b8eefae9599b35323d87d3dbaa Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Tue, 17 Aug 2010 23:47:11 -0700 Subject: glsl2: Fix cut and paste error in EXT_texture_array builtins. Fixes fd.o bug #29629. --- src/glsl/builtins/profiles/EXT_texture_array.frag | 4 ++-- src/glsl/builtins/profiles/EXT_texture_array.vert | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/glsl/builtins/profiles/EXT_texture_array.frag b/src/glsl/builtins/profiles/EXT_texture_array.frag index d133132191..d0ce981dd9 100644 --- a/src/glsl/builtins/profiles/EXT_texture_array.frag +++ b/src/glsl/builtins/profiles/EXT_texture_array.frag @@ -2,8 +2,8 @@ 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 texture2DArray(sampler2DArray sampler, vec3 coord); +vec4 texture2DArray(sampler2DArray sampler, vec3 coord, float bias); vec4 shadow1DArray(sampler1DArrayShadow sampler, vec3 coord); vec4 shadow1DArray(sampler1DArrayShadow sampler, vec3 coord, float bias); diff --git a/src/glsl/builtins/profiles/EXT_texture_array.vert b/src/glsl/builtins/profiles/EXT_texture_array.vert index 4f7b2b5f8b..6b1b7f2f16 100644 --- a/src/glsl/builtins/profiles/EXT_texture_array.vert +++ b/src/glsl/builtins/profiles/EXT_texture_array.vert @@ -2,8 +2,8 @@ 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 texture2DArray(sampler2DArray sampler, vec3 coord); +vec4 texture2DArrayLod(sampler2DArray sampler, vec3 coord, float lod); vec4 shadow1DArray(sampler1DArrayShadow sampler, vec3 coord); vec4 shadow1DArrayLod(sampler1DArrayShadow sampler, vec3 coord, float lod); -- cgit v1.2.3 From a57b1e579d1a76a813f48ae541a1edebb7f07607 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Tue, 17 Aug 2010 23:47:51 -0700 Subject: glsl2: Regenerate builtin_function.cpp. --- src/glsl/builtin_function.cpp | 8668 ++++++++++++++++++++--------------------- 1 file changed, 4334 insertions(+), 4334 deletions(-) (limited to 'src') diff --git a/src/glsl/builtin_function.cpp b/src/glsl/builtin_function.cpp index 652e4f61bb..8f375cf47d 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@0x13d20b0)\n" + " (declare (in ) float degrees@0x1db60b0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 degrees@0x13d2430)\n" + " (declare (in ) vec2 degrees@0x1db6430)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 degrees@0x13d2610)\n" + " (declare (in ) vec3 degrees@0x1db6610)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 degrees@0x13d27f0)\n" + " (declare (in ) vec4 degrees@0x1db67f0)\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@0x13d29d0)\n" + " (declare (in ) float radians@0x1db69d0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 radians@0x13d2d50)\n" + " (declare (in ) vec2 radians@0x1db6d50)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 radians@0x13d2f30)\n" + " (declare (in ) vec3 radians@0x1db6f30)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 radians@0x13d3110)\n" + " (declare (in ) vec4 radians@0x1db7110)\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@0x13d32f0)\n" + " (declare (in ) float angle@0x1db72f0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 angle@0x13d3670)\n" + " (declare (in ) vec2 angle@0x1db7670)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 angle@0x13d3850)\n" + " (declare (in ) vec3 angle@0x1db7850)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 angle@0x13d3a30)\n" + " (declare (in ) vec4 angle@0x1db7a30)\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@0x13d3c10)\n" + " (declare (in ) float angle@0x1db7c10)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 angle@0x13d3f90)\n" + " (declare (in ) vec2 angle@0x1db7f90)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 angle@0x13d4170)\n" + " (declare (in ) vec3 angle@0x1db8170)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 angle@0x13d4350)\n" + " (declare (in ) vec4 angle@0x1db8350)\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@0x13d4530)\n" + " (declare (in ) float angle@0x1db8530)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 angle@0x13d48b0)\n" + " (declare (in ) vec2 angle@0x1db88b0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 angle@0x13d4a90)\n" + " (declare (in ) vec3 angle@0x1db8a90)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 angle@0x13d4c70)\n" + " (declare (in ) vec4 angle@0x1db8c70)\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@0x13d4e50)\n" + " (declare (in ) float angle@0x1db8e50)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 angle@0x13d51d0)\n" + " (declare (in ) vec2 angle@0x1db91d0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 angle@0x13d53b0)\n" + " (declare (in ) vec3 angle@0x1db93b0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 angle@0x13d5590)\n" + " (declare (in ) vec4 angle@0x1db9590)\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@0x13d5770)\n" + " (declare (in ) float angle@0x1db9770)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 angle@0x13d5af0)\n" + " (declare (in ) vec2 angle@0x1db9af0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 angle@0x13d5cd0)\n" + " (declare (in ) vec3 angle@0x1db9cd0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 angle@0x13d5eb0)\n" + " (declare (in ) vec4 angle@0x1db9eb0)\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@0x13d6090)\n" - " (declare (in ) float x@0x13d61a0)\n" + " (declare (in ) float y@0x1dba090)\n" + " (declare (in ) float x@0x1dba1a0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 y@0x13d6520)\n" - " (declare (in ) vec2 x@0x13d6630)\n" + " (declare (in ) vec2 y@0x1dba520)\n" + " (declare (in ) vec2 x@0x1dba630)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 y@0x13d6810)\n" - " (declare (in ) vec3 x@0x13d6920)\n" + " (declare (in ) vec3 y@0x1dba810)\n" + " (declare (in ) vec3 x@0x1dba920)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 y@0x13d6b00)\n" - " (declare (in ) vec4 x@0x13d6c10)\n" + " (declare (in ) vec4 y@0x1dbab00)\n" + " (declare (in ) vec4 x@0x1dbac10)\n" " )\n" " (\n" " ))\n" "\n" " (signature float\n" " (parameters\n" - " (declare (in ) float y_over_x@0x13d6df0)\n" + " (declare (in ) float y_over_x@0x1dbadf0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 y_over_x@0x13d6fe0)\n" + " (declare (in ) vec2 y_over_x@0x1dbafe0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 y_over_x@0x13d71d0)\n" + " (declare (in ) vec3 y_over_x@0x1dbb1d0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 y_over_x@0x13d73c0)\n" + " (declare (in ) vec4 y_over_x@0x1dbb3c0)\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@0x13d75b0)\n" - " (declare (in ) float y@0x13d76c0)\n" + " (declare (in ) float x@0x1dbb5b0)\n" + " (declare (in ) float y@0x1dbb6c0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x13d7a40)\n" - " (declare (in ) vec2 y@0x13d7b50)\n" + " (declare (in ) vec2 x@0x1dbba40)\n" + " (declare (in ) vec2 y@0x1dbbb50)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x13d7d30)\n" - " (declare (in ) vec3 y@0x13d7e40)\n" + " (declare (in ) vec3 x@0x1dbbd30)\n" + " (declare (in ) vec3 y@0x1dbbe40)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x13d8020)\n" - " (declare (in ) vec4 y@0x13d8130)\n" + " (declare (in ) vec4 x@0x1dbc020)\n" + " (declare (in ) vec4 y@0x1dbc130)\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@0x13d8310)\n" + " (declare (in ) float x@0x1dbc310)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x13d8690)\n" + " (declare (in ) vec2 x@0x1dbc690)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x13d8870)\n" + " (declare (in ) vec3 x@0x1dbc870)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x13d8a50)\n" + " (declare (in ) vec4 x@0x1dbca50)\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@0x13d8c30)\n" + " (declare (in ) float x@0x1dbcc30)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x13d8fb0)\n" + " (declare (in ) vec2 x@0x1dbcfb0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x13d9190)\n" + " (declare (in ) vec3 x@0x1dbd190)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x13d9370)\n" + " (declare (in ) vec4 x@0x1dbd370)\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@0x13d9550)\n" + " (declare (in ) float x@0x1dbd550)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x13d98d0)\n" + " (declare (in ) vec2 x@0x1dbd8d0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x13d9ab0)\n" + " (declare (in ) vec3 x@0x1dbdab0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x13d9c90)\n" + " (declare (in ) vec4 x@0x1dbdc90)\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@0x13d9e70)\n" + " (declare (in ) float x@0x1dbde70)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x13da1f0)\n" + " (declare (in ) vec2 x@0x1dbe1f0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x13da3d0)\n" + " (declare (in ) vec3 x@0x1dbe3d0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x13da5b0)\n" + " (declare (in ) vec4 x@0x1dbe5b0)\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@0x13da790)\n" + " (declare (in ) float x@0x1dbe790)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x13dab10)\n" + " (declare (in ) vec2 x@0x1dbeb10)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x13dacf0)\n" + " (declare (in ) vec3 x@0x1dbecf0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x13daed0)\n" + " (declare (in ) vec4 x@0x1dbeed0)\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@0x13db0b0)\n" + " (declare (in ) float x@0x1dbf0b0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x13db440)\n" + " (declare (in ) vec2 x@0x1dbf440)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x13db620)\n" + " (declare (in ) vec3 x@0x1dbf620)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x13db800)\n" + " (declare (in ) vec4 x@0x1dbf800)\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@0x13db9e0)\n" + " (declare (in ) float x@0x1dbf9e0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x13dbd60)\n" + " (declare (in ) vec2 x@0x1dbfd60)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x13dbf40)\n" + " (declare (in ) vec3 x@0x1dbff40)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x13dc120)\n" + " (declare (in ) vec4 x@0x1dc0120)\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@0x13dc300)\n" + " (declare (in ) float x@0x1dc0300)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x13dc680)\n" + " (declare (in ) vec2 x@0x1dc0680)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x13dc860)\n" + " (declare (in ) vec3 x@0x1dc0860)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x13dca40)\n" + " (declare (in ) vec4 x@0x1dc0a40)\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@0x13dcc20)\n" + " (declare (in ) float x@0x1dc0c20)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x13dcfa0)\n" + " (declare (in ) vec2 x@0x1dc0fa0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x13dd180)\n" + " (declare (in ) vec3 x@0x1dc1180)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x13dd360)\n" + " (declare (in ) vec4 x@0x1dc1360)\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@0x13dd540)\n" + " (declare (in ) float x@0x1dc1540)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x13dd8c0)\n" + " (declare (in ) vec2 x@0x1dc18c0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x13ddaa0)\n" + " (declare (in ) vec3 x@0x1dc1aa0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x13ddc80)\n" + " (declare (in ) vec4 x@0x1dc1c80)\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@0x13dde60)\n" + " (declare (in ) float x@0x1dc1e60)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x13de1e0)\n" + " (declare (in ) vec2 x@0x1dc21e0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x13de3c0)\n" + " (declare (in ) vec3 x@0x1dc23c0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x13de5a0)\n" + " (declare (in ) vec4 x@0x1dc25a0)\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@0x13de780)\n" - " (declare (in ) float y@0x13de890)\n" + " (declare (in ) float x@0x1dc2780)\n" + " (declare (in ) float y@0x1dc2890)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x13dec10)\n" - " (declare (in ) float y@0x13ded20)\n" + " (declare (in ) vec2 x@0x1dc2c10)\n" + " (declare (in ) float y@0x1dc2d20)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x13def00)\n" - " (declare (in ) float y@0x13df010)\n" + " (declare (in ) vec3 x@0x1dc2f00)\n" + " (declare (in ) float y@0x1dc3010)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x13df1f0)\n" - " (declare (in ) float y@0x13df300)\n" + " (declare (in ) vec4 x@0x1dc31f0)\n" + " (declare (in ) float y@0x1dc3300)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x13df4e0)\n" - " (declare (in ) vec2 y@0x13df5f0)\n" + " (declare (in ) vec2 x@0x1dc34e0)\n" + " (declare (in ) vec2 y@0x1dc35f0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x13df7d0)\n" - " (declare (in ) vec3 y@0x13df8e0)\n" + " (declare (in ) vec3 x@0x1dc37d0)\n" + " (declare (in ) vec3 y@0x1dc38e0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x13dfac0)\n" - " (declare (in ) vec4 y@0x13dfbd0)\n" + " (declare (in ) vec4 x@0x1dc3ac0)\n" + " (declare (in ) vec4 y@0x1dc3bd0)\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@0x13dfdb0)\n" - " (declare (in ) float y@0x13dfec0)\n" + " (declare (in ) float x@0x1dc3db0)\n" + " (declare (in ) float y@0x1dc3ec0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x13e0240)\n" - " (declare (in ) vec2 y@0x13e0350)\n" + " (declare (in ) vec2 x@0x1dc4240)\n" + " (declare (in ) vec2 y@0x1dc4350)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x13e0530)\n" - " (declare (in ) vec3 y@0x13e0640)\n" + " (declare (in ) vec3 x@0x1dc4530)\n" + " (declare (in ) vec3 y@0x1dc4640)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x13e0820)\n" - " (declare (in ) vec4 y@0x13e0930)\n" + " (declare (in ) vec4 x@0x1dc4820)\n" + " (declare (in ) vec4 y@0x1dc4930)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x13e0b10)\n" - " (declare (in ) float y@0x13e0c20)\n" + " (declare (in ) vec2 x@0x1dc4b10)\n" + " (declare (in ) float y@0x1dc4c20)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x13e0e00)\n" - " (declare (in ) float y@0x13e0f10)\n" + " (declare (in ) vec3 x@0x1dc4e00)\n" + " (declare (in ) float y@0x1dc4f10)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x13e10f0)\n" - " (declare (in ) float y@0x13e1200)\n" + " (declare (in ) vec4 x@0x1dc50f0)\n" + " (declare (in ) float y@0x1dc5200)\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@0x13e13e0)\n" - " (declare (in ) float y@0x13e14f0)\n" + " (declare (in ) float x@0x1dc53e0)\n" + " (declare (in ) float y@0x1dc54f0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x13e1870)\n" - " (declare (in ) vec2 y@0x13e1980)\n" + " (declare (in ) vec2 x@0x1dc5870)\n" + " (declare (in ) vec2 y@0x1dc5980)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x13e1b60)\n" - " (declare (in ) vec3 y@0x13e1c70)\n" + " (declare (in ) vec3 x@0x1dc5b60)\n" + " (declare (in ) vec3 y@0x1dc5c70)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x13e1e50)\n" - " (declare (in ) vec4 y@0x13e1f60)\n" + " (declare (in ) vec4 x@0x1dc5e50)\n" + " (declare (in ) vec4 y@0x1dc5f60)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x13e2140)\n" - " (declare (in ) float y@0x13e2250)\n" + " (declare (in ) vec2 x@0x1dc6140)\n" + " (declare (in ) float y@0x1dc6250)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x13e2430)\n" - " (declare (in ) float y@0x13e2540)\n" + " (declare (in ) vec3 x@0x1dc6430)\n" + " (declare (in ) float y@0x1dc6540)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x13e2720)\n" - " (declare (in ) float y@0x13e2830)\n" + " (declare (in ) vec4 x@0x1dc6720)\n" + " (declare (in ) float y@0x1dc6830)\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@0x13e2a10)\n" - " (declare (in ) float minVal@0x13e2b20)\n" - " (declare (in ) float maxVal@0x13e2c30)\n" + " (declare (in ) float x@0x1dc6a10)\n" + " (declare (in ) float minVal@0x1dc6b20)\n" + " (declare (in ) float maxVal@0x1dc6c30)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x13e2fb0)\n" - " (declare (in ) vec2 minVal@0x13e30c0)\n" - " (declare (in ) vec2 maxVal@0x13e31d0)\n" + " (declare (in ) vec2 x@0x1dc6fb0)\n" + " (declare (in ) vec2 minVal@0x1dc70c0)\n" + " (declare (in ) vec2 maxVal@0x1dc71d0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x13e33b0)\n" - " (declare (in ) vec3 minVal@0x13e34c0)\n" - " (declare (in ) vec3 maxVal@0x13e35d0)\n" + " (declare (in ) vec3 x@0x1dc73b0)\n" + " (declare (in ) vec3 minVal@0x1dc74c0)\n" + " (declare (in ) vec3 maxVal@0x1dc75d0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x13e37b0)\n" - " (declare (in ) vec4 minVal@0x13e38c0)\n" - " (declare (in ) vec4 maxVal@0x13e39d0)\n" + " (declare (in ) vec4 x@0x1dc77b0)\n" + " (declare (in ) vec4 minVal@0x1dc78c0)\n" + " (declare (in ) vec4 maxVal@0x1dc79d0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x13e3bb0)\n" - " (declare (in ) float minVal@0x13e3cc0)\n" - " (declare (in ) float maxVal@0x13e3dd0)\n" + " (declare (in ) vec2 x@0x1dc7bb0)\n" + " (declare (in ) float minVal@0x1dc7cc0)\n" + " (declare (in ) float maxVal@0x1dc7dd0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x13e3fb0)\n" - " (declare (in ) float minVal@0x13e40c0)\n" - " (declare (in ) float maxVal@0x13e41d0)\n" + " (declare (in ) vec3 x@0x1dc7fb0)\n" + " (declare (in ) float minVal@0x1dc80c0)\n" + " (declare (in ) float maxVal@0x1dc81d0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x13e43b0)\n" - " (declare (in ) float minVal@0x13e44c0)\n" - " (declare (in ) float maxVal@0x13e45d0)\n" + " (declare (in ) vec4 x@0x1dc83b0)\n" + " (declare (in ) float minVal@0x1dc84c0)\n" + " (declare (in ) float maxVal@0x1dc85d0)\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@0x13e47b0)\n" - " (declare (in ) float y@0x13e48c0)\n" - " (declare (in ) float a@0x13e49d0)\n" + " (declare (in ) float x@0x1dc87b0)\n" + " (declare (in ) float y@0x1dc88c0)\n" + " (declare (in ) float a@0x1dc89d0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x13e4d50)\n" - " (declare (in ) vec2 y@0x13e4e60)\n" - " (declare (in ) vec2 a@0x13e4f70)\n" + " (declare (in ) vec2 x@0x1dc8d50)\n" + " (declare (in ) vec2 y@0x1dc8e60)\n" + " (declare (in ) vec2 a@0x1dc8f70)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x13e5150)\n" - " (declare (in ) vec3 y@0x13e5260)\n" - " (declare (in ) vec3 a@0x13e5370)\n" + " (declare (in ) vec3 x@0x1dc9150)\n" + " (declare (in ) vec3 y@0x1dc9260)\n" + " (declare (in ) vec3 a@0x1dc9370)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x13e5550)\n" - " (declare (in ) vec4 y@0x13e5660)\n" - " (declare (in ) vec4 a@0x13e5770)\n" + " (declare (in ) vec4 x@0x1dc9550)\n" + " (declare (in ) vec4 y@0x1dc9660)\n" + " (declare (in ) vec4 a@0x1dc9770)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x13e5950)\n" - " (declare (in ) vec2 y@0x13e5a60)\n" - " (declare (in ) float a@0x13e5b70)\n" + " (declare (in ) vec2 x@0x1dc9950)\n" + " (declare (in ) vec2 y@0x1dc9a60)\n" + " (declare (in ) float a@0x1dc9b70)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x13e5d50)\n" - " (declare (in ) vec3 y@0x13e5e60)\n" - " (declare (in ) float a@0x13e5f70)\n" + " (declare (in ) vec3 x@0x1dc9d50)\n" + " (declare (in ) vec3 y@0x1dc9e60)\n" + " (declare (in ) float a@0x1dc9f70)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x13e6150)\n" - " (declare (in ) vec4 y@0x13e6260)\n" - " (declare (in ) float a@0x13e6370)\n" + " (declare (in ) vec4 x@0x1dca150)\n" + " (declare (in ) vec4 y@0x1dca260)\n" + " (declare (in ) float a@0x1dca370)\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@0x13e6550)\n" - " (declare (in ) float x@0x13e6660)\n" + " (declare (in ) float edge@0x1dca550)\n" + " (declare (in ) float x@0x1dca660)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 edge@0x13e69e0)\n" - " (declare (in ) vec2 x@0x13e6af0)\n" + " (declare (in ) vec2 edge@0x1dca9e0)\n" + " (declare (in ) vec2 x@0x1dcaaf0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 edge@0x13e6cd0)\n" - " (declare (in ) vec3 x@0x13e6de0)\n" + " (declare (in ) vec3 edge@0x1dcacd0)\n" + " (declare (in ) vec3 x@0x1dcade0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 edge@0x13e6fc0)\n" - " (declare (in ) vec4 x@0x13e70d0)\n" + " (declare (in ) vec4 edge@0x1dcafc0)\n" + " (declare (in ) vec4 x@0x1dcb0d0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) float edge@0x13e72b0)\n" - " (declare (in ) vec2 x@0x13e73c0)\n" + " (declare (in ) float edge@0x1dcb2b0)\n" + " (declare (in ) vec2 x@0x1dcb3c0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) float edge@0x13e75a0)\n" - " (declare (in ) vec3 x@0x13e76b0)\n" + " (declare (in ) float edge@0x1dcb5a0)\n" + " (declare (in ) vec3 x@0x1dcb6b0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) float edge@0x13e7890)\n" - " (declare (in ) vec4 x@0x13e79a0)\n" + " (declare (in ) float edge@0x1dcb890)\n" + " (declare (in ) vec4 x@0x1dcb9a0)\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@0x13e7b80)\n" - " (declare (in ) float edge1@0x13e7c90)\n" - " (declare (in ) float x@0x13e7da0)\n" + " (declare (in ) float edge0@0x1dcbb80)\n" + " (declare (in ) float edge1@0x1dcbc90)\n" + " (declare (in ) float x@0x1dcbda0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 edge0@0x13e8130)\n" - " (declare (in ) vec2 edge1@0x13e8240)\n" - " (declare (in ) vec2 x@0x13e8350)\n" + " (declare (in ) vec2 edge0@0x1dcc130)\n" + " (declare (in ) vec2 edge1@0x1dcc240)\n" + " (declare (in ) vec2 x@0x1dcc350)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 edge0@0x13e8530)\n" - " (declare (in ) vec3 edge1@0x13e8640)\n" - " (declare (in ) vec3 x@0x13e8750)\n" + " (declare (in ) vec3 edge0@0x1dcc530)\n" + " (declare (in ) vec3 edge1@0x1dcc640)\n" + " (declare (in ) vec3 x@0x1dcc750)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 edge0@0x13e8930)\n" - " (declare (in ) vec4 edge1@0x13e8a40)\n" - " (declare (in ) vec4 x@0x13e8b50)\n" + " (declare (in ) vec4 edge0@0x1dcc930)\n" + " (declare (in ) vec4 edge1@0x1dcca40)\n" + " (declare (in ) vec4 x@0x1dccb50)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) float edge0@0x13e8d30)\n" - " (declare (in ) float edge1@0x13e8e40)\n" - " (declare (in ) vec2 x@0x13e8f50)\n" + " (declare (in ) float edge0@0x1dccd30)\n" + " (declare (in ) float edge1@0x1dcce40)\n" + " (declare (in ) vec2 x@0x1dccf50)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) float edge0@0x13e9130)\n" - " (declare (in ) float edge1@0x13e9240)\n" - " (declare (in ) vec3 x@0x13e9350)\n" + " (declare (in ) float edge0@0x1dcd130)\n" + " (declare (in ) float edge1@0x1dcd240)\n" + " (declare (in ) vec3 x@0x1dcd350)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) float edge0@0x13e9530)\n" - " (declare (in ) float edge1@0x13e9640)\n" - " (declare (in ) vec4 x@0x13e9750)\n" + " (declare (in ) float edge0@0x1dcd530)\n" + " (declare (in ) float edge1@0x1dcd640)\n" + " (declare (in ) vec4 x@0x1dcd750)\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@0x13e9930)\n" + " (declare (in ) float x@0x1dcd930)\n" " )\n" " (\n" " ))\n" "\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec2 x@0x13e9cb0)\n" + " (declare (in ) vec2 x@0x1dcdcb0)\n" " )\n" " (\n" " ))\n" "\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec3 x@0x13e9e90)\n" + " (declare (in ) vec3 x@0x1dcde90)\n" " )\n" " (\n" " ))\n" "\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec4 x@0x13ea070)\n" + " (declare (in ) vec4 x@0x1dce070)\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@0x13ea250)\n" - " (declare (in ) float p1@0x13ea360)\n" + " (declare (in ) float p0@0x1dce250)\n" + " (declare (in ) float p1@0x1dce360)\n" " )\n" " (\n" " ))\n" "\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec2 p0@0x13ea6f0)\n" - " (declare (in ) vec2 p1@0x13ea800)\n" + " (declare (in ) vec2 p0@0x1dce6f0)\n" + " (declare (in ) vec2 p1@0x1dce800)\n" " )\n" " (\n" " ))\n" "\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec3 p0@0x13ea9e0)\n" - " (declare (in ) vec3 p1@0x13eaaf0)\n" + " (declare (in ) vec3 p0@0x1dce9e0)\n" + " (declare (in ) vec3 p1@0x1dceaf0)\n" " )\n" " (\n" " ))\n" "\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec4 p0@0x13eacd0)\n" - " (declare (in ) vec4 p1@0x13eade0)\n" + " (declare (in ) vec4 p0@0x1dcecd0)\n" + " (declare (in ) vec4 p1@0x1dcede0)\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@0x13eafc0)\n" - " (declare (in ) float y@0x13eb0d0)\n" + " (declare (in ) float x@0x1dcefc0)\n" + " (declare (in ) float y@0x1dcf0d0)\n" " )\n" " (\n" " ))\n" "\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec2 x@0x13eb450)\n" - " (declare (in ) vec2 y@0x13eb560)\n" + " (declare (in ) vec2 x@0x1dcf450)\n" + " (declare (in ) vec2 y@0x1dcf560)\n" " )\n" " (\n" " ))\n" "\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec3 x@0x13eb740)\n" - " (declare (in ) vec3 y@0x13eb850)\n" + " (declare (in ) vec3 x@0x1dcf740)\n" + " (declare (in ) vec3 y@0x1dcf850)\n" " )\n" " (\n" " ))\n" "\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec4 x@0x13eba30)\n" - " (declare (in ) vec4 y@0x13ebb40)\n" + " (declare (in ) vec4 x@0x1dcfa30)\n" + " (declare (in ) vec4 y@0x1dcfb40)\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@0x13ebd20)\n" - " (declare (in ) vec3 y@0x13ebe30)\n" + " (declare (in ) vec3 x@0x1dcfd20)\n" + " (declare (in ) vec3 y@0x1dcfe30)\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@0x13ec1b0)\n" + " (declare (in ) float x@0x1dd01b0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x13ec540)\n" + " (declare (in ) vec2 x@0x1dd0540)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x13ec720)\n" + " (declare (in ) vec3 x@0x1dd0720)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x13ec900)\n" + " (declare (in ) vec4 x@0x1dd0900)\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@0x13ecd60)\n" - " (declare (in ) float I@0x13ece70)\n" - " (declare (in ) float Nref@0x13ecf80)\n" + " (declare (in ) float N@0x1dd0d60)\n" + " (declare (in ) float I@0x1dd0e70)\n" + " (declare (in ) float Nref@0x1dd0f80)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 N@0x13ed310)\n" - " (declare (in ) vec2 I@0x13ed420)\n" - " (declare (in ) vec2 Nref@0x13ed530)\n" + " (declare (in ) vec2 N@0x1dd1310)\n" + " (declare (in ) vec2 I@0x1dd1420)\n" + " (declare (in ) vec2 Nref@0x1dd1530)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 N@0x13ed710)\n" - " (declare (in ) vec3 I@0x13ed820)\n" - " (declare (in ) vec3 Nref@0x13ed930)\n" + " (declare (in ) vec3 N@0x1dd1710)\n" + " (declare (in ) vec3 I@0x1dd1820)\n" + " (declare (in ) vec3 Nref@0x1dd1930)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 N@0x13edb10)\n" - " (declare (in ) vec4 I@0x13edc20)\n" - " (declare (in ) vec4 Nref@0x13edd30)\n" + " (declare (in ) vec4 N@0x1dd1b10)\n" + " (declare (in ) vec4 I@0x1dd1c20)\n" + " (declare (in ) vec4 Nref@0x1dd1d30)\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@0x13edf10)\n" - " (declare (in ) float N@0x13ee020)\n" + " (declare (in ) float I@0x1dd1f10)\n" + " (declare (in ) float N@0x1dd2020)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 I@0x13ee3a0)\n" - " (declare (in ) vec2 N@0x13ee4b0)\n" + " (declare (in ) vec2 I@0x1dd23a0)\n" + " (declare (in ) vec2 N@0x1dd24b0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 I@0x13ee690)\n" - " (declare (in ) vec3 N@0x13ee7a0)\n" + " (declare (in ) vec3 I@0x1dd2690)\n" + " (declare (in ) vec3 N@0x1dd27a0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 I@0x13ee980)\n" - " (declare (in ) vec4 N@0x13eea90)\n" + " (declare (in ) vec4 I@0x1dd2980)\n" + " (declare (in ) vec4 N@0x1dd2a90)\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@0x13eec70)\n" - " (declare (in ) float N@0x13eed80)\n" - " (declare (in ) float eta@0x13eee90)\n" + " (declare (in ) float I@0x1dd2c70)\n" + " (declare (in ) float N@0x1dd2d80)\n" + " (declare (in ) float eta@0x1dd2e90)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 I@0x13ef210)\n" - " (declare (in ) vec2 N@0x13ef320)\n" - " (declare (in ) float eta@0x13ef430)\n" + " (declare (in ) vec2 I@0x1dd3210)\n" + " (declare (in ) vec2 N@0x1dd3320)\n" + " (declare (in ) float eta@0x1dd3430)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 I@0x13ef610)\n" - " (declare (in ) vec3 N@0x13ef720)\n" - " (declare (in ) float eta@0x13ef830)\n" + " (declare (in ) vec3 I@0x1dd3610)\n" + " (declare (in ) vec3 N@0x1dd3720)\n" + " (declare (in ) float eta@0x1dd3830)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 I@0x13efa10)\n" - " (declare (in ) vec4 N@0x13efb20)\n" - " (declare (in ) float eta@0x13efc30)\n" + " (declare (in ) vec4 I@0x1dd3a10)\n" + " (declare (in ) vec4 N@0x1dd3b20)\n" + " (declare (in ) float eta@0x1dd3c30)\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@0x13efe10)\n" - " (declare (in ) mat2 y@0x13eff20)\n" + " (declare (in ) mat2 x@0x1dd3e10)\n" + " (declare (in ) mat2 y@0x1dd3f20)\n" " )\n" " (\n" " ))\n" "\n" " (signature mat3\n" " (parameters\n" - " (declare (in ) mat3 x@0x13f02b0)\n" - " (declare (in ) mat3 y@0x13f03c0)\n" + " (declare (in ) mat3 x@0x1dd42b0)\n" + " (declare (in ) mat3 y@0x1dd43c0)\n" " )\n" " (\n" " ))\n" "\n" " (signature mat4\n" " (parameters\n" - " (declare (in ) mat4 x@0x13f05a0)\n" - " (declare (in ) mat4 y@0x13f06b0)\n" + " (declare (in ) mat4 x@0x1dd45a0)\n" + " (declare (in ) mat4 y@0x1dd46b0)\n" " )\n" " (\n" " ))\n" "\n" " (signature mat2x3\n" " (parameters\n" - " (declare (in ) mat2x3 x@0x13f0890)\n" - " (declare (in ) mat2x3 y@0x13f09a0)\n" + " (declare (in ) mat2x3 x@0x1dd4890)\n" + " (declare (in ) mat2x3 y@0x1dd49a0)\n" " )\n" " (\n" " ))\n" "\n" " (signature mat2x4\n" " (parameters\n" - " (declare (in ) mat2x4 x@0x13f0b80)\n" - " (declare (in ) mat2x4 y@0x13f0c90)\n" + " (declare (in ) mat2x4 x@0x1dd4b80)\n" + " (declare (in ) mat2x4 y@0x1dd4c90)\n" " )\n" " (\n" " ))\n" "\n" " (signature mat3x2\n" " (parameters\n" - " (declare (in ) mat3x2 x@0x13f0e70)\n" - " (declare (in ) mat3x2 y@0x13f0f80)\n" + " (declare (in ) mat3x2 x@0x1dd4e70)\n" + " (declare (in ) mat3x2 y@0x1dd4f80)\n" " )\n" " (\n" " ))\n" "\n" " (signature mat3x4\n" " (parameters\n" - " (declare (in ) mat3x4 x@0x13f1160)\n" - " (declare (in ) mat3x4 y@0x13f1270)\n" + " (declare (in ) mat3x4 x@0x1dd5160)\n" + " (declare (in ) mat3x4 y@0x1dd5270)\n" " )\n" " (\n" " ))\n" "\n" " (signature mat4x2\n" " (parameters\n" - " (declare (in ) mat4x2 x@0x13f1450)\n" - " (declare (in ) mat4x2 y@0x13f1560)\n" + " (declare (in ) mat4x2 x@0x1dd5450)\n" + " (declare (in ) mat4x2 y@0x1dd5560)\n" " )\n" " (\n" " ))\n" "\n" " (signature mat4x3\n" " (parameters\n" - " (declare (in ) mat4x3 x@0x13f1740)\n" - " (declare (in ) mat4x3 y@0x13f1850)\n" + " (declare (in ) mat4x3 x@0x1dd5740)\n" + " (declare (in ) mat4x3 y@0x1dd5850)\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@0x13f1a30)\n" - " (declare (in ) vec2 r@0x13f1b40)\n" + " (declare (in ) vec2 c@0x1dd5a30)\n" + " (declare (in ) vec2 r@0x1dd5b40)\n" " )\n" " (\n" " ))\n" "\n" " (signature mat3\n" " (parameters\n" - " (declare (in ) vec3 c@0x13f1ed0)\n" - " (declare (in ) vec3 r@0x13f1fe0)\n" + " (declare (in ) vec3 c@0x1dd5ed0)\n" + " (declare (in ) vec3 r@0x1dd5fe0)\n" " )\n" " (\n" " ))\n" "\n" " (signature mat4\n" " (parameters\n" - " (declare (in ) vec4 c@0x13f21c0)\n" - " (declare (in ) vec4 r@0x13f22d0)\n" + " (declare (in ) vec4 c@0x1dd61c0)\n" + " (declare (in ) vec4 r@0x1dd62d0)\n" " )\n" " (\n" " ))\n" "\n" " (signature mat2x3\n" " (parameters\n" - " (declare (in ) vec3 c@0x13f24b0)\n" - " (declare (in ) vec2 r@0x13f25c0)\n" + " (declare (in ) vec3 c@0x1dd64b0)\n" + " (declare (in ) vec2 r@0x1dd65c0)\n" " )\n" " (\n" " ))\n" "\n" " (signature mat3x2\n" " (parameters\n" - " (declare (in ) vec2 c@0x13f27a0)\n" - " (declare (in ) vec3 r@0x13f28b0)\n" + " (declare (in ) vec2 c@0x1dd67a0)\n" + " (declare (in ) vec3 r@0x1dd68b0)\n" " )\n" " (\n" " ))\n" "\n" " (signature mat2x4\n" " (parameters\n" - " (declare (in ) vec4 c@0x13f2a90)\n" - " (declare (in ) vec2 r@0x13f2ba0)\n" + " (declare (in ) vec4 c@0x1dd6a90)\n" + " (declare (in ) vec2 r@0x1dd6ba0)\n" " )\n" " (\n" " ))\n" "\n" " (signature mat4x2\n" " (parameters\n" - " (declare (in ) vec2 c@0x13f2d80)\n" - " (declare (in ) vec4 r@0x13f2e90)\n" + " (declare (in ) vec2 c@0x1dd6d80)\n" + " (declare (in ) vec4 r@0x1dd6e90)\n" " )\n" " (\n" " ))\n" "\n" " (signature mat3x4\n" " (parameters\n" - " (declare (in ) vec4 c@0x13f3070)\n" - " (declare (in ) vec3 r@0x13f3180)\n" + " (declare (in ) vec4 c@0x1dd7070)\n" + " (declare (in ) vec3 r@0x1dd7180)\n" " )\n" " (\n" " ))\n" "\n" " (signature mat4x3\n" " (parameters\n" - " (declare (in ) vec3 c@0x13f3360)\n" - " (declare (in ) vec4 r@0x13f3470)\n" + " (declare (in ) vec3 c@0x1dd7360)\n" + " (declare (in ) vec4 r@0x1dd7470)\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@0x13f3650)\n" + " (declare (in ) mat2 m@0x1dd7650)\n" " )\n" " (\n" " ))\n" "\n" " (signature mat3\n" " (parameters\n" - " (declare (in ) mat3 m@0x13f39e0)\n" + " (declare (in ) mat3 m@0x1dd79e0)\n" " )\n" " (\n" " ))\n" "\n" " (signature mat4\n" " (parameters\n" - " (declare (in ) mat4 m@0x13f3bc0)\n" + " (declare (in ) mat4 m@0x1dd7bc0)\n" " )\n" " (\n" " ))\n" "\n" " (signature mat2x3\n" " (parameters\n" - " (declare (in ) mat3x2 m@0x13f3da0)\n" + " (declare (in ) mat3x2 m@0x1dd7da0)\n" " )\n" " (\n" " ))\n" "\n" " (signature mat3x2\n" " (parameters\n" - " (declare (in ) mat2x3 m@0x13f3f80)\n" + " (declare (in ) mat2x3 m@0x1dd7f80)\n" " )\n" " (\n" " ))\n" "\n" " (signature mat2x4\n" " (parameters\n" - " (declare (in ) mat4x2 m@0x13f4160)\n" + " (declare (in ) mat4x2 m@0x1dd8160)\n" " )\n" " (\n" " ))\n" "\n" " (signature mat4x2\n" " (parameters\n" - " (declare (in ) mat2x4 m@0x13f4340)\n" + " (declare (in ) mat2x4 m@0x1dd8340)\n" " )\n" " (\n" " ))\n" "\n" " (signature mat3x4\n" " (parameters\n" - " (declare (in ) mat4x3 m@0x13f4520)\n" + " (declare (in ) mat4x3 m@0x1dd8520)\n" " )\n" " (\n" " ))\n" "\n" " (signature mat4x3\n" " (parameters\n" - " (declare (in ) mat3x4 m@0x13f4700)\n" + " (declare (in ) mat3x4 m@0x1dd8700)\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@0x13f48e0)\n" - " (declare (in ) vec2 y@0x13f49f0)\n" + " (declare (in ) vec2 x@0x1dd88e0)\n" + " (declare (in ) vec2 y@0x1dd89f0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x13f4d80)\n" - " (declare (in ) vec3 y@0x13f4e90)\n" + " (declare (in ) vec3 x@0x1dd8d80)\n" + " (declare (in ) vec3 y@0x1dd8e90)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x13f5070)\n" - " (declare (in ) vec4 y@0x13f5180)\n" + " (declare (in ) vec4 x@0x1dd9070)\n" + " (declare (in ) vec4 y@0x1dd9180)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) ivec2 x@0x13f5360)\n" - " (declare (in ) ivec2 y@0x13f5470)\n" + " (declare (in ) ivec2 x@0x1dd9360)\n" + " (declare (in ) ivec2 y@0x1dd9470)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) ivec3 x@0x13f5650)\n" - " (declare (in ) ivec3 y@0x13f5760)\n" + " (declare (in ) ivec3 x@0x1dd9650)\n" + " (declare (in ) ivec3 y@0x1dd9760)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) ivec4 x@0x13f5940)\n" - " (declare (in ) ivec4 y@0x13f5a50)\n" + " (declare (in ) ivec4 x@0x1dd9940)\n" + " (declare (in ) ivec4 y@0x1dd9a50)\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@0x13f5c30)\n" - " (declare (in ) vec2 y@0x13f5d40)\n" + " (declare (in ) vec2 x@0x1dd9c30)\n" + " (declare (in ) vec2 y@0x1dd9d40)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x13f60d0)\n" - " (declare (in ) vec3 y@0x13f61e0)\n" + " (declare (in ) vec3 x@0x1dda0d0)\n" + " (declare (in ) vec3 y@0x1dda1e0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x13f63c0)\n" - " (declare (in ) vec4 y@0x13f64d0)\n" + " (declare (in ) vec4 x@0x1dda3c0)\n" + " (declare (in ) vec4 y@0x1dda4d0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) ivec2 x@0x13f66b0)\n" - " (declare (in ) ivec2 y@0x13f67c0)\n" + " (declare (in ) ivec2 x@0x1dda6b0)\n" + " (declare (in ) ivec2 y@0x1dda7c0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) ivec3 x@0x13f69a0)\n" - " (declare (in ) ivec3 y@0x13f6ab0)\n" + " (declare (in ) ivec3 x@0x1dda9a0)\n" + " (declare (in ) ivec3 y@0x1ddaab0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) ivec4 x@0x13f6c90)\n" - " (declare (in ) ivec4 y@0x13f6da0)\n" + " (declare (in ) ivec4 x@0x1ddac90)\n" + " (declare (in ) ivec4 y@0x1ddada0)\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@0x13f6f80)\n" - " (declare (in ) vec2 y@0x13f7090)\n" + " (declare (in ) vec2 x@0x1ddaf80)\n" + " (declare (in ) vec2 y@0x1ddb090)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x13f7420)\n" - " (declare (in ) vec3 y@0x13f7530)\n" + " (declare (in ) vec3 x@0x1ddb420)\n" + " (declare (in ) vec3 y@0x1ddb530)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x13f7710)\n" - " (declare (in ) vec4 y@0x13f7820)\n" + " (declare (in ) vec4 x@0x1ddb710)\n" + " (declare (in ) vec4 y@0x1ddb820)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) ivec2 x@0x13f7a00)\n" - " (declare (in ) ivec2 y@0x13f7b10)\n" + " (declare (in ) ivec2 x@0x1ddba00)\n" + " (declare (in ) ivec2 y@0x1ddbb10)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) ivec3 x@0x13f7cf0)\n" - " (declare (in ) ivec3 y@0x13f7e00)\n" + " (declare (in ) ivec3 x@0x1ddbcf0)\n" + " (declare (in ) ivec3 y@0x1ddbe00)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) ivec4 x@0x13f7fe0)\n" - " (declare (in ) ivec4 y@0x13f80f0)\n" + " (declare (in ) ivec4 x@0x1ddbfe0)\n" + " (declare (in ) ivec4 y@0x1ddc0f0)\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@0x13f82d0)\n" - " (declare (in ) vec2 y@0x13f83e0)\n" + " (declare (in ) vec2 x@0x1ddc2d0)\n" + " (declare (in ) vec2 y@0x1ddc3e0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x13f8770)\n" - " (declare (in ) vec3 y@0x13f8880)\n" + " (declare (in ) vec3 x@0x1ddc770)\n" + " (declare (in ) vec3 y@0x1ddc880)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x13f8a60)\n" - " (declare (in ) vec4 y@0x13f8b70)\n" + " (declare (in ) vec4 x@0x1ddca60)\n" + " (declare (in ) vec4 y@0x1ddcb70)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) ivec2 x@0x13f8d50)\n" - " (declare (in ) ivec2 y@0x13f8e60)\n" + " (declare (in ) ivec2 x@0x1ddcd50)\n" + " (declare (in ) ivec2 y@0x1ddce60)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) ivec3 x@0x13f9040)\n" - " (declare (in ) ivec3 y@0x13f9150)\n" + " (declare (in ) ivec3 x@0x1ddd040)\n" + " (declare (in ) ivec3 y@0x1ddd150)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) ivec4 x@0x13f9330)\n" - " (declare (in ) ivec4 y@0x13f9440)\n" + " (declare (in ) ivec4 x@0x1ddd330)\n" + " (declare (in ) ivec4 y@0x1ddd440)\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@0x13f9620)\n" - " (declare (in ) vec2 y@0x13f9730)\n" + " (declare (in ) vec2 x@0x1ddd620)\n" + " (declare (in ) vec2 y@0x1ddd730)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x13f9ab0)\n" - " (declare (in ) vec3 y@0x13f9bc0)\n" + " (declare (in ) vec3 x@0x1dddab0)\n" + " (declare (in ) vec3 y@0x1dddbc0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x13f9da0)\n" - " (declare (in ) vec4 y@0x13f9eb0)\n" + " (declare (in ) vec4 x@0x1dddda0)\n" + " (declare (in ) vec4 y@0x1dddeb0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) ivec2 x@0x13fa090)\n" - " (declare (in ) ivec2 y@0x13fa1a0)\n" + " (declare (in ) ivec2 x@0x1dde090)\n" + " (declare (in ) ivec2 y@0x1dde1a0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) ivec3 x@0x13fa380)\n" - " (declare (in ) ivec3 y@0x13fa490)\n" + " (declare (in ) ivec3 x@0x1dde380)\n" + " (declare (in ) ivec3 y@0x1dde490)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) ivec4 x@0x13fa670)\n" - " (declare (in ) ivec4 y@0x13fa780)\n" + " (declare (in ) ivec4 x@0x1dde670)\n" + " (declare (in ) ivec4 y@0x1dde780)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) bvec2 x@0x13fa960)\n" - " (declare (in ) bvec2 y@0x13faa70)\n" + " (declare (in ) bvec2 x@0x1dde960)\n" + " (declare (in ) bvec2 y@0x1ddea70)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) bvec3 x@0x13fac50)\n" - " (declare (in ) bvec3 y@0x13fad60)\n" + " (declare (in ) bvec3 x@0x1ddec50)\n" + " (declare (in ) bvec3 y@0x1dded60)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) bvec4 x@0x13faf40)\n" - " (declare (in ) bvec4 y@0x13fb050)\n" + " (declare (in ) bvec4 x@0x1ddef40)\n" + " (declare (in ) bvec4 y@0x1ddf050)\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@0x13fb230)\n" - " (declare (in ) vec2 y@0x13fb340)\n" + " (declare (in ) vec2 x@0x1ddf230)\n" + " (declare (in ) vec2 y@0x1ddf340)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x13fb6d0)\n" - " (declare (in ) vec3 y@0x13fb7e0)\n" + " (declare (in ) vec3 x@0x1ddf6d0)\n" + " (declare (in ) vec3 y@0x1ddf7e0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x13fb9c0)\n" - " (declare (in ) vec4 y@0x13fbad0)\n" + " (declare (in ) vec4 x@0x1ddf9c0)\n" + " (declare (in ) vec4 y@0x1ddfad0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) ivec2 x@0x13fbcb0)\n" - " (declare (in ) ivec2 y@0x13fbdc0)\n" + " (declare (in ) ivec2 x@0x1ddfcb0)\n" + " (declare (in ) ivec2 y@0x1ddfdc0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) ivec3 x@0x13fbfa0)\n" - " (declare (in ) ivec3 y@0x13fc0b0)\n" + " (declare (in ) ivec3 x@0x1ddffa0)\n" + " (declare (in ) ivec3 y@0x1de00b0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) ivec4 x@0x13fc290)\n" - " (declare (in ) ivec4 y@0x13fc3a0)\n" + " (declare (in ) ivec4 x@0x1de0290)\n" + " (declare (in ) ivec4 y@0x1de03a0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) bvec2 x@0x13fc580)\n" - " (declare (in ) bvec2 y@0x13fc690)\n" + " (declare (in ) bvec2 x@0x1de0580)\n" + " (declare (in ) bvec2 y@0x1de0690)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) bvec3 x@0x13fc870)\n" - " (declare (in ) bvec3 y@0x13fc980)\n" + " (declare (in ) bvec3 x@0x1de0870)\n" + " (declare (in ) bvec3 y@0x1de0980)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) bvec4 x@0x13fcb60)\n" - " (declare (in ) bvec4 y@0x13fcc70)\n" + " (declare (in ) bvec4 x@0x1de0b60)\n" + " (declare (in ) bvec4 y@0x1de0c70)\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@0x13fce50)\n" + " (declare (in ) bvec2 x@0x1de0e50)\n" " )\n" " (\n" " ))\n" "\n" " (signature bool\n" " (parameters\n" - " (declare (in ) bvec3 x@0x13fd1d0)\n" + " (declare (in ) bvec3 x@0x1de11d0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bool\n" " (parameters\n" - " (declare (in ) bvec4 x@0x13fd3b0)\n" + " (declare (in ) bvec4 x@0x1de13b0)\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@0x13fd590)\n" + " (declare (in ) bvec2 x@0x1de1590)\n" " )\n" " (\n" " ))\n" "\n" " (signature bool\n" " (parameters\n" - " (declare (in ) bvec3 x@0x13fd910)\n" + " (declare (in ) bvec3 x@0x1de1910)\n" " )\n" " (\n" " ))\n" "\n" " (signature bool\n" " (parameters\n" - " (declare (in ) bvec4 x@0x13fdaf0)\n" + " (declare (in ) bvec4 x@0x1de1af0)\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@0x13fdcd0)\n" + " (declare (in ) bvec2 x@0x1de1cd0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) bvec3 x@0x13fe050)\n" + " (declare (in ) bvec3 x@0x1de2050)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) bvec4 x@0x13fe230)\n" + " (declare (in ) bvec4 x@0x1de2230)\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@0x13fe410)\n" - " (declare (in ) float coord@0x13fe520)\n" + " (declare (in ) sampler1D sampler@0x1de2410)\n" + " (declare (in ) float coord@0x1de2520)\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@0x13fe8b0)\n" - " (declare (in ) vec2 coord@0x13fe9c0)\n" + " (declare (in ) sampler1D sampler@0x1de28b0)\n" + " (declare (in ) vec2 coord@0x1de29c0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1D sampler@0x13fed50)\n" - " (declare (in ) vec4 coord@0x13fee60)\n" + " (declare (in ) sampler1D sampler@0x1de2d50)\n" + " (declare (in ) vec4 coord@0x1de2e60)\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@0x13ff040)\n" - " (declare (in ) float coord@0x13ff150)\n" - " (declare (in ) float lod@0x13ff260)\n" + " (declare (in ) sampler1D sampler@0x1de3040)\n" + " (declare (in ) float coord@0x1de3150)\n" + " (declare (in ) float lod@0x1de3260)\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@0x13ff5f0)\n" - " (declare (in ) vec2 coord@0x13ff700)\n" - " (declare (in ) float lod@0x13ff810)\n" + " (declare (in ) sampler1D sampler@0x1de35f0)\n" + " (declare (in ) vec2 coord@0x1de3700)\n" + " (declare (in ) float lod@0x1de3810)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1D sampler@0x13ffba0)\n" - " (declare (in ) vec4 coord@0x13ffcb0)\n" - " (declare (in ) float lod@0x13ffdc0)\n" + " (declare (in ) sampler1D sampler@0x1de3ba0)\n" + " (declare (in ) vec4 coord@0x1de3cb0)\n" + " (declare (in ) float lod@0x1de3dc0)\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@0x13fffa0)\n" - " (declare (in ) vec2 coord@0x14000b0)\n" + " (declare (in ) sampler2D sampler@0x1de3fa0)\n" + " (declare (in ) vec2 coord@0x1de40b0)\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@0x1400440)\n" - " (declare (in ) vec3 coord@0x1400550)\n" + " (declare (in ) sampler2D sampler@0x1de4440)\n" + " (declare (in ) vec3 coord@0x1de4550)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2D sampler@0x14008e0)\n" - " (declare (in ) vec4 coord@0x14009f0)\n" + " (declare (in ) sampler2D sampler@0x1de48e0)\n" + " (declare (in ) vec4 coord@0x1de49f0)\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@0x1400bd0)\n" - " (declare (in ) vec2 coord@0x1400ce0)\n" - " (declare (in ) float lod@0x1400df0)\n" + " (declare (in ) sampler2D sampler@0x1de4bd0)\n" + " (declare (in ) vec2 coord@0x1de4ce0)\n" + " (declare (in ) float lod@0x1de4df0)\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@0x1401180)\n" - " (declare (in ) vec3 coord@0x1401290)\n" - " (declare (in ) float lod@0x14013a0)\n" + " (declare (in ) sampler2D sampler@0x1de5180)\n" + " (declare (in ) vec3 coord@0x1de5290)\n" + " (declare (in ) float lod@0x1de53a0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2D sampler@0x1401730)\n" - " (declare (in ) vec4 coord@0x1401840)\n" - " (declare (in ) float lod@0x1401950)\n" + " (declare (in ) sampler2D sampler@0x1de5730)\n" + " (declare (in ) vec4 coord@0x1de5840)\n" + " (declare (in ) float lod@0x1de5950)\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@0x1401b30)\n" - " (declare (in ) vec3 coord@0x1401c40)\n" + " (declare (in ) sampler3D sampler@0x1de5b30)\n" + " (declare (in ) vec3 coord@0x1de5c40)\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@0x1401fd0)\n" - " (declare (in ) vec4 coord@0x14020e0)\n" + " (declare (in ) sampler3D sampler@0x1de5fd0)\n" + " (declare (in ) vec4 coord@0x1de60e0)\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@0x1402470)\n" - " (declare (in ) vec3 coord@0x1402580)\n" - " (declare (in ) float lod@0x1402690)\n" + " (declare (in ) sampler3D sampler@0x1de6470)\n" + " (declare (in ) vec3 coord@0x1de6580)\n" + " (declare (in ) float lod@0x1de6690)\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@0x1402a20)\n" - " (declare (in ) vec4 coord@0x1402b30)\n" - " (declare (in ) float lod@0x1402c40)\n" + " (declare (in ) sampler3D sampler@0x1de6a20)\n" + " (declare (in ) vec4 coord@0x1de6b30)\n" + " (declare (in ) float lod@0x1de6c40)\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@0x1402fd0)\n" - " (declare (in ) vec3 coord@0x14030e0)\n" + " (declare (in ) samplerCube sampler@0x1de6fd0)\n" + " (declare (in ) vec3 coord@0x1de70e0)\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@0x1403470)\n" - " (declare (in ) vec3 coord@0x1403580)\n" - " (declare (in ) float lod@0x1403690)\n" + " (declare (in ) samplerCube sampler@0x1de7470)\n" + " (declare (in ) vec3 coord@0x1de7580)\n" + " (declare (in ) float lod@0x1de7690)\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@0x1403a20)\n" - " (declare (in ) vec3 coord@0x1403b30)\n" + " (declare (in ) sampler1DShadow sampler@0x1de7a20)\n" + " (declare (in ) vec3 coord@0x1de7b30)\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@0x1403ec0)\n" - " (declare (in ) vec3 coord@0x1403fd0)\n" + " (declare (in ) sampler2DShadow sampler@0x1de7ec0)\n" + " (declare (in ) vec3 coord@0x1de7fd0)\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@0x1404360)\n" - " (declare (in ) vec4 coord@0x1404470)\n" + " (declare (in ) sampler1DShadow sampler@0x1de8360)\n" + " (declare (in ) vec4 coord@0x1de8470)\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@0x1404800)\n" - " (declare (in ) vec4 coord@0x1404910)\n" + " (declare (in ) sampler2DShadow sampler@0x1de8800)\n" + " (declare (in ) vec4 coord@0x1de8910)\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@0x1404ca0)\n" - " (declare (in ) vec3 coord@0x1404db0)\n" - " (declare (in ) float lod@0x1404ec0)\n" + " (declare (in ) sampler1DShadow sampler@0x1de8ca0)\n" + " (declare (in ) vec3 coord@0x1de8db0)\n" + " (declare (in ) float lod@0x1de8ec0)\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@0x1405250)\n" - " (declare (in ) vec3 coord@0x1405360)\n" - " (declare (in ) float lod@0x1405470)\n" + " (declare (in ) sampler2DShadow sampler@0x1de9250)\n" + " (declare (in ) vec3 coord@0x1de9360)\n" + " (declare (in ) float lod@0x1de9470)\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@0x1405800)\n" - " (declare (in ) vec4 coord@0x1405910)\n" - " (declare (in ) float lod@0x1405a20)\n" + " (declare (in ) sampler1DShadow sampler@0x1de9800)\n" + " (declare (in ) vec4 coord@0x1de9910)\n" + " (declare (in ) float lod@0x1de9a20)\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@0x1405db0)\n" - " (declare (in ) vec4 coord@0x1405ec0)\n" - " (declare (in ) float lod@0x1405fd0)\n" + " (declare (in ) sampler2DShadow sampler@0x1de9db0)\n" + " (declare (in ) vec4 coord@0x1de9ec0)\n" + " (declare (in ) float lod@0x1de9fd0)\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@0x1406360)\n" + " (declare (in ) float x@0x1dea360)\n" " )\n" " (\n" " ))\n" "\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec2 x@0x14066e0)\n" + " (declare (in ) vec2 x@0x1dea6e0)\n" " )\n" " (\n" " ))\n" "\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec3 x@0x14068c0)\n" + " (declare (in ) vec3 x@0x1dea8c0)\n" " )\n" " (\n" " ))\n" "\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec4 x@0x1406aa0)\n" + " (declare (in ) vec4 x@0x1deaaa0)\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@0x1406c80)\n" + " (declare (in ) float x@0x1deac80)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x1407000)\n" + " (declare (in ) vec2 x@0x1deb000)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec3 x@0x14071e0)\n" + " (declare (in ) vec3 x@0x1deb1e0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec4 x@0x14073c0)\n" + " (declare (in ) vec4 x@0x1deb3c0)\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@0x14075a0)\n" + " (declare (in ) float x@0x1deb5a0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec2 x@0x1407920)\n" + " (declare (in ) vec2 x@0x1deb920)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x1407b00)\n" + " (declare (in ) vec3 x@0x1debb00)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec4 x@0x1407ce0)\n" + " (declare (in ) vec4 x@0x1debce0)\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@0x1407ec0)\n" + " (declare (in ) float x@0x1debec0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec2 x@0x1408240)\n" + " (declare (in ) vec2 x@0x1dec240)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec3 x@0x1408420)\n" + " (declare (in ) vec3 x@0x1dec420)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x1408600)\n" + " (declare (in ) vec4 x@0x1dec600)\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@0xbe3bd0)\n" - " (declare (in ) vec2 coord@0xbe3ce0)\n" + " (declare (in ) sampler1DArray sampler@0xd79bd0)\n" + " (declare (in ) vec2 coord@0xd79ce0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1DArray sampler@0xbe4070)\n" - " (declare (in ) vec2 coord@0xbe4180)\n" - " (declare (in ) float bias@0xbe4290)\n" + " (declare (in ) sampler1DArray sampler@0xd7a070)\n" + " (declare (in ) vec2 coord@0xd7a180)\n" + " (declare (in ) float bias@0xd7a290)\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@0xbe4470)\n" - " (declare (in ) vec2 coord@0xbe4580)\n" + " (declare (in ) sampler2DArray sampler@0xd7a470)\n" + " (declare (in ) vec3 coord@0xd7a580)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1DArray sampler@0xbe4910)\n" - " (declare (in ) vec2 coord@0xbe4a20)\n" - " (declare (in ) float bias@0xbe4b30)\n" + " (declare (in ) sampler2DArray sampler@0xd7a910)\n" + " (declare (in ) vec3 coord@0xd7aa20)\n" + " (declare (in ) float bias@0xd7ab30)\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@0xbe4d10)\n" - " (declare (in ) vec3 coord@0xbe4e20)\n" + " (declare (in ) sampler1DArrayShadow sampler@0xd7ad10)\n" + " (declare (in ) vec3 coord@0xd7ae20)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1DArrayShadow sampler@0xbe51b0)\n" - " (declare (in ) vec3 coord@0xbe52c0)\n" - " (declare (in ) float bias@0xbe53d0)\n" + " (declare (in ) sampler1DArrayShadow sampler@0xd7b1b0)\n" + " (declare (in ) vec3 coord@0xd7b2c0)\n" + " (declare (in ) float bias@0xd7b3d0)\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@0xbe55b0)\n" - " (declare (in ) vec4 coord@0xbe56c0)\n" + " (declare (in ) sampler2DArrayShadow sampler@0xd7b5b0)\n" + " (declare (in ) vec4 coord@0xd7b6c0)\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@0x1aa51c0)\n" + " (declare (in ) float degrees@0x26861c0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 degrees@0x1aa5540)\n" + " (declare (in ) vec2 degrees@0x2686540)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 degrees@0x1aa5720)\n" + " (declare (in ) vec3 degrees@0x2686720)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 degrees@0x1aa5900)\n" + " (declare (in ) vec4 degrees@0x2686900)\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@0x1aa5ae0)\n" + " (declare (in ) float radians@0x2686ae0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 radians@0x1aa5e60)\n" + " (declare (in ) vec2 radians@0x2686e60)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 radians@0x1aa6040)\n" + " (declare (in ) vec3 radians@0x2687040)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 radians@0x1aa6220)\n" + " (declare (in ) vec4 radians@0x2687220)\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@0x1aa6400)\n" + " (declare (in ) float angle@0x2687400)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 angle@0x1aa6780)\n" + " (declare (in ) vec2 angle@0x2687780)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 angle@0x1aa6960)\n" + " (declare (in ) vec3 angle@0x2687960)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 angle@0x1aa6b40)\n" + " (declare (in ) vec4 angle@0x2687b40)\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@0x1aa6d20)\n" + " (declare (in ) float angle@0x2687d20)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 angle@0x1aa70a0)\n" + " (declare (in ) vec2 angle@0x26880a0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 angle@0x1aa7280)\n" + " (declare (in ) vec3 angle@0x2688280)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 angle@0x1aa7460)\n" + " (declare (in ) vec4 angle@0x2688460)\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@0x1aa7640)\n" + " (declare (in ) float angle@0x2688640)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 angle@0x1aa79c0)\n" + " (declare (in ) vec2 angle@0x26889c0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 angle@0x1aa7ba0)\n" + " (declare (in ) vec3 angle@0x2688ba0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 angle@0x1aa7d80)\n" + " (declare (in ) vec4 angle@0x2688d80)\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@0x1aa7f60)\n" + " (declare (in ) float angle@0x2688f60)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 angle@0x1aa82e0)\n" + " (declare (in ) vec2 angle@0x26892e0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 angle@0x1aa84c0)\n" + " (declare (in ) vec3 angle@0x26894c0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 angle@0x1aa86a0)\n" + " (declare (in ) vec4 angle@0x26896a0)\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@0x1aa8880)\n" + " (declare (in ) float angle@0x2689880)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 angle@0x1aa8c00)\n" + " (declare (in ) vec2 angle@0x2689c00)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 angle@0x1aa8de0)\n" + " (declare (in ) vec3 angle@0x2689de0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 angle@0x1aa8fc0)\n" + " (declare (in ) vec4 angle@0x2689fc0)\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@0x1aa91a0)\n" - " (declare (in ) float x@0x1aa92b0)\n" + " (declare (in ) float y@0x268a1a0)\n" + " (declare (in ) float x@0x268a2b0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 y@0x1aa9630)\n" - " (declare (in ) vec2 x@0x1aa9740)\n" + " (declare (in ) vec2 y@0x268a630)\n" + " (declare (in ) vec2 x@0x268a740)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 y@0x1aa9920)\n" - " (declare (in ) vec3 x@0x1aa9a30)\n" + " (declare (in ) vec3 y@0x268a920)\n" + " (declare (in ) vec3 x@0x268aa30)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 y@0x1aa9c10)\n" - " (declare (in ) vec4 x@0x1aa9d20)\n" + " (declare (in ) vec4 y@0x268ac10)\n" + " (declare (in ) vec4 x@0x268ad20)\n" " )\n" " (\n" " ))\n" "\n" " (signature float\n" " (parameters\n" - " (declare (in ) float y_over_x@0x1aa9f00)\n" + " (declare (in ) float y_over_x@0x268af00)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 y_over_x@0x1aaa0f0)\n" + " (declare (in ) vec2 y_over_x@0x268b0f0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 y_over_x@0x1aaa2e0)\n" + " (declare (in ) vec3 y_over_x@0x268b2e0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 y_over_x@0x1aaa4d0)\n" + " (declare (in ) vec4 y_over_x@0x268b4d0)\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@0x1aaa6c0)\n" - " (declare (in ) float y@0x1aaa7d0)\n" + " (declare (in ) float x@0x268b6c0)\n" + " (declare (in ) float y@0x268b7d0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x1aaab50)\n" - " (declare (in ) vec2 y@0x1aaac60)\n" + " (declare (in ) vec2 x@0x268bb50)\n" + " (declare (in ) vec2 y@0x268bc60)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x1aaae40)\n" - " (declare (in ) vec3 y@0x1aaaf50)\n" + " (declare (in ) vec3 x@0x268be40)\n" + " (declare (in ) vec3 y@0x268bf50)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x1aab130)\n" - " (declare (in ) vec4 y@0x1aab240)\n" + " (declare (in ) vec4 x@0x268c130)\n" + " (declare (in ) vec4 y@0x268c240)\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@0x1aab420)\n" + " (declare (in ) float x@0x268c420)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x1aab7a0)\n" + " (declare (in ) vec2 x@0x268c7a0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x1aab980)\n" + " (declare (in ) vec3 x@0x268c980)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x1aabb60)\n" + " (declare (in ) vec4 x@0x268cb60)\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@0x1aabd40)\n" + " (declare (in ) float x@0x268cd40)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x1aac0c0)\n" + " (declare (in ) vec2 x@0x268d0c0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x1aac2a0)\n" + " (declare (in ) vec3 x@0x268d2a0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x1aac480)\n" + " (declare (in ) vec4 x@0x268d480)\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@0x1aac660)\n" + " (declare (in ) float x@0x268d660)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x1aac9e0)\n" + " (declare (in ) vec2 x@0x268d9e0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x1aacbc0)\n" + " (declare (in ) vec3 x@0x268dbc0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x1aacda0)\n" + " (declare (in ) vec4 x@0x268dda0)\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@0x1aacf80)\n" + " (declare (in ) float x@0x268df80)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x1aad300)\n" + " (declare (in ) vec2 x@0x268e300)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x1aad4e0)\n" + " (declare (in ) vec3 x@0x268e4e0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x1aad6c0)\n" + " (declare (in ) vec4 x@0x268e6c0)\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@0x1aad8a0)\n" + " (declare (in ) float x@0x268e8a0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x1aadc20)\n" + " (declare (in ) vec2 x@0x268ec20)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x1aade00)\n" + " (declare (in ) vec3 x@0x268ee00)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x1aadfe0)\n" + " (declare (in ) vec4 x@0x268efe0)\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@0x1aae1c0)\n" + " (declare (in ) float x@0x268f1c0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x1aae550)\n" + " (declare (in ) vec2 x@0x268f550)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x1aae730)\n" + " (declare (in ) vec3 x@0x268f730)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x1aae910)\n" + " (declare (in ) vec4 x@0x268f910)\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@0x1aaeaf0)\n" + " (declare (in ) float x@0x268faf0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x1aaee70)\n" + " (declare (in ) vec2 x@0x268fe70)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x1aaf050)\n" + " (declare (in ) vec3 x@0x2690050)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x1aaf230)\n" + " (declare (in ) vec4 x@0x2690230)\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@0x1aaf410)\n" + " (declare (in ) float x@0x2690410)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x1aaf790)\n" + " (declare (in ) vec2 x@0x2690790)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x1aaf970)\n" + " (declare (in ) vec3 x@0x2690970)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x1aafb50)\n" + " (declare (in ) vec4 x@0x2690b50)\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@0x1aafd30)\n" + " (declare (in ) float x@0x2690d30)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x1ab00b0)\n" + " (declare (in ) vec2 x@0x26910b0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x1ab0290)\n" + " (declare (in ) vec3 x@0x2691290)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x1ab0470)\n" + " (declare (in ) vec4 x@0x2691470)\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@0x1ab0650)\n" + " (declare (in ) float x@0x2691650)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x1ab09d0)\n" + " (declare (in ) vec2 x@0x26919d0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x1ab0bb0)\n" + " (declare (in ) vec3 x@0x2691bb0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x1ab0d90)\n" + " (declare (in ) vec4 x@0x2691d90)\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@0x1ab0f70)\n" + " (declare (in ) float x@0x2691f70)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x1ab12f0)\n" + " (declare (in ) vec2 x@0x26922f0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x1ab14d0)\n" + " (declare (in ) vec3 x@0x26924d0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x1ab16b0)\n" + " (declare (in ) vec4 x@0x26926b0)\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@0x1ab1890)\n" - " (declare (in ) float y@0x1ab19a0)\n" + " (declare (in ) float x@0x2692890)\n" + " (declare (in ) float y@0x26929a0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x1ab1d20)\n" - " (declare (in ) float y@0x1ab1e30)\n" + " (declare (in ) vec2 x@0x2692d20)\n" + " (declare (in ) float y@0x2692e30)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x1ab2010)\n" - " (declare (in ) float y@0x1ab2120)\n" + " (declare (in ) vec3 x@0x2693010)\n" + " (declare (in ) float y@0x2693120)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x1ab2300)\n" - " (declare (in ) float y@0x1ab2410)\n" + " (declare (in ) vec4 x@0x2693300)\n" + " (declare (in ) float y@0x2693410)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x1ab25f0)\n" - " (declare (in ) vec2 y@0x1ab2700)\n" + " (declare (in ) vec2 x@0x26935f0)\n" + " (declare (in ) vec2 y@0x2693700)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x1ab28e0)\n" - " (declare (in ) vec3 y@0x1ab29f0)\n" + " (declare (in ) vec3 x@0x26938e0)\n" + " (declare (in ) vec3 y@0x26939f0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x1ab2bd0)\n" - " (declare (in ) vec4 y@0x1ab2ce0)\n" + " (declare (in ) vec4 x@0x2693bd0)\n" + " (declare (in ) vec4 y@0x2693ce0)\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@0x1ab2ec0)\n" - " (declare (in ) float y@0x1ab2fd0)\n" + " (declare (in ) float x@0x2693ec0)\n" + " (declare (in ) float y@0x2693fd0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x1ab3350)\n" - " (declare (in ) vec2 y@0x1ab3460)\n" + " (declare (in ) vec2 x@0x2694350)\n" + " (declare (in ) vec2 y@0x2694460)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x1ab3640)\n" - " (declare (in ) vec3 y@0x1ab3750)\n" + " (declare (in ) vec3 x@0x2694640)\n" + " (declare (in ) vec3 y@0x2694750)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x1ab3930)\n" - " (declare (in ) vec4 y@0x1ab3a40)\n" + " (declare (in ) vec4 x@0x2694930)\n" + " (declare (in ) vec4 y@0x2694a40)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x1ab3c20)\n" - " (declare (in ) float y@0x1ab3d30)\n" + " (declare (in ) vec2 x@0x2694c20)\n" + " (declare (in ) float y@0x2694d30)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x1ab3f10)\n" - " (declare (in ) float y@0x1ab4020)\n" + " (declare (in ) vec3 x@0x2694f10)\n" + " (declare (in ) float y@0x2695020)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x1ab4200)\n" - " (declare (in ) float y@0x1ab4310)\n" + " (declare (in ) vec4 x@0x2695200)\n" + " (declare (in ) float y@0x2695310)\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@0x1ab44f0)\n" - " (declare (in ) float y@0x1ab4600)\n" + " (declare (in ) float x@0x26954f0)\n" + " (declare (in ) float y@0x2695600)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x1ab4980)\n" - " (declare (in ) vec2 y@0x1ab4a90)\n" + " (declare (in ) vec2 x@0x2695980)\n" + " (declare (in ) vec2 y@0x2695a90)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x1ab4c70)\n" - " (declare (in ) vec3 y@0x1ab4d80)\n" + " (declare (in ) vec3 x@0x2695c70)\n" + " (declare (in ) vec3 y@0x2695d80)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x1ab4f60)\n" - " (declare (in ) vec4 y@0x1ab5070)\n" + " (declare (in ) vec4 x@0x2695f60)\n" + " (declare (in ) vec4 y@0x2696070)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x1ab5250)\n" - " (declare (in ) float y@0x1ab5360)\n" + " (declare (in ) vec2 x@0x2696250)\n" + " (declare (in ) float y@0x2696360)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x1ab5540)\n" - " (declare (in ) float y@0x1ab5650)\n" + " (declare (in ) vec3 x@0x2696540)\n" + " (declare (in ) float y@0x2696650)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x1ab5830)\n" - " (declare (in ) float y@0x1ab5940)\n" + " (declare (in ) vec4 x@0x2696830)\n" + " (declare (in ) float y@0x2696940)\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@0x1ab5b20)\n" - " (declare (in ) float minVal@0x1ab5c30)\n" - " (declare (in ) float maxVal@0x1ab5d40)\n" + " (declare (in ) float x@0x2696b20)\n" + " (declare (in ) float minVal@0x2696c30)\n" + " (declare (in ) float maxVal@0x2696d40)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x1ab60c0)\n" - " (declare (in ) vec2 minVal@0x1ab61d0)\n" - " (declare (in ) vec2 maxVal@0x1ab62e0)\n" + " (declare (in ) vec2 x@0x26970c0)\n" + " (declare (in ) vec2 minVal@0x26971d0)\n" + " (declare (in ) vec2 maxVal@0x26972e0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x1ab64c0)\n" - " (declare (in ) vec3 minVal@0x1ab65d0)\n" - " (declare (in ) vec3 maxVal@0x1ab66e0)\n" + " (declare (in ) vec3 x@0x26974c0)\n" + " (declare (in ) vec3 minVal@0x26975d0)\n" + " (declare (in ) vec3 maxVal@0x26976e0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x1ab68c0)\n" - " (declare (in ) vec4 minVal@0x1ab69d0)\n" - " (declare (in ) vec4 maxVal@0x1ab6ae0)\n" + " (declare (in ) vec4 x@0x26978c0)\n" + " (declare (in ) vec4 minVal@0x26979d0)\n" + " (declare (in ) vec4 maxVal@0x2697ae0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x1ab6cc0)\n" - " (declare (in ) float minVal@0x1ab6dd0)\n" - " (declare (in ) float maxVal@0x1ab6ee0)\n" + " (declare (in ) vec2 x@0x2697cc0)\n" + " (declare (in ) float minVal@0x2697dd0)\n" + " (declare (in ) float maxVal@0x2697ee0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x1ab70c0)\n" - " (declare (in ) float minVal@0x1ab71d0)\n" - " (declare (in ) float maxVal@0x1ab72e0)\n" + " (declare (in ) vec3 x@0x26980c0)\n" + " (declare (in ) float minVal@0x26981d0)\n" + " (declare (in ) float maxVal@0x26982e0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x1ab74c0)\n" - " (declare (in ) float minVal@0x1ab75d0)\n" - " (declare (in ) float maxVal@0x1ab76e0)\n" + " (declare (in ) vec4 x@0x26984c0)\n" + " (declare (in ) float minVal@0x26985d0)\n" + " (declare (in ) float maxVal@0x26986e0)\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@0x1ab78c0)\n" - " (declare (in ) float y@0x1ab79d0)\n" - " (declare (in ) float a@0x1ab7ae0)\n" + " (declare (in ) float x@0x26988c0)\n" + " (declare (in ) float y@0x26989d0)\n" + " (declare (in ) float a@0x2698ae0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x1ab7e60)\n" - " (declare (in ) vec2 y@0x1ab7f70)\n" - " (declare (in ) vec2 a@0x1ab8080)\n" + " (declare (in ) vec2 x@0x2698e60)\n" + " (declare (in ) vec2 y@0x2698f70)\n" + " (declare (in ) vec2 a@0x2699080)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x1ab8260)\n" - " (declare (in ) vec3 y@0x1ab8370)\n" - " (declare (in ) vec3 a@0x1ab8480)\n" + " (declare (in ) vec3 x@0x2699260)\n" + " (declare (in ) vec3 y@0x2699370)\n" + " (declare (in ) vec3 a@0x2699480)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x1ab8660)\n" - " (declare (in ) vec4 y@0x1ab8770)\n" - " (declare (in ) vec4 a@0x1ab8880)\n" + " (declare (in ) vec4 x@0x2699660)\n" + " (declare (in ) vec4 y@0x2699770)\n" + " (declare (in ) vec4 a@0x2699880)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x1ab8a60)\n" - " (declare (in ) vec2 y@0x1ab8b70)\n" - " (declare (in ) float a@0x1ab8c80)\n" + " (declare (in ) vec2 x@0x2699a60)\n" + " (declare (in ) vec2 y@0x2699b70)\n" + " (declare (in ) float a@0x2699c80)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x1ab8e60)\n" - " (declare (in ) vec3 y@0x1ab8f70)\n" - " (declare (in ) float a@0x1ab9080)\n" + " (declare (in ) vec3 x@0x2699e60)\n" + " (declare (in ) vec3 y@0x2699f70)\n" + " (declare (in ) float a@0x269a080)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x1ab9260)\n" - " (declare (in ) vec4 y@0x1ab9370)\n" - " (declare (in ) float a@0x1ab9480)\n" + " (declare (in ) vec4 x@0x269a260)\n" + " (declare (in ) vec4 y@0x269a370)\n" + " (declare (in ) float a@0x269a480)\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@0x1ab9660)\n" - " (declare (in ) float x@0x1ab9770)\n" + " (declare (in ) float edge@0x269a660)\n" + " (declare (in ) float x@0x269a770)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 edge@0x1ab9af0)\n" - " (declare (in ) vec2 x@0x1ab9c00)\n" + " (declare (in ) vec2 edge@0x269aaf0)\n" + " (declare (in ) vec2 x@0x269ac00)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 edge@0x1ab9de0)\n" - " (declare (in ) vec3 x@0x1ab9ef0)\n" + " (declare (in ) vec3 edge@0x269ade0)\n" + " (declare (in ) vec3 x@0x269aef0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 edge@0x1aba0d0)\n" - " (declare (in ) vec4 x@0x1aba1e0)\n" + " (declare (in ) vec4 edge@0x269b0d0)\n" + " (declare (in ) vec4 x@0x269b1e0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) float edge@0x1aba3c0)\n" - " (declare (in ) vec2 x@0x1aba4d0)\n" + " (declare (in ) float edge@0x269b3c0)\n" + " (declare (in ) vec2 x@0x269b4d0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) float edge@0x1aba6b0)\n" - " (declare (in ) vec3 x@0x1aba7c0)\n" + " (declare (in ) float edge@0x269b6b0)\n" + " (declare (in ) vec3 x@0x269b7c0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) float edge@0x1aba9a0)\n" - " (declare (in ) vec4 x@0x1abaab0)\n" + " (declare (in ) float edge@0x269b9a0)\n" + " (declare (in ) vec4 x@0x269bab0)\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@0x1abac90)\n" - " (declare (in ) float edge1@0x1abada0)\n" - " (declare (in ) float x@0x1abaeb0)\n" + " (declare (in ) float edge0@0x269bc90)\n" + " (declare (in ) float edge1@0x269bda0)\n" + " (declare (in ) float x@0x269beb0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 edge0@0x1abb240)\n" - " (declare (in ) vec2 edge1@0x1abb350)\n" - " (declare (in ) vec2 x@0x1abb460)\n" + " (declare (in ) vec2 edge0@0x269c240)\n" + " (declare (in ) vec2 edge1@0x269c350)\n" + " (declare (in ) vec2 x@0x269c460)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 edge0@0x1abb640)\n" - " (declare (in ) vec3 edge1@0x1abb750)\n" - " (declare (in ) vec3 x@0x1abb860)\n" + " (declare (in ) vec3 edge0@0x269c640)\n" + " (declare (in ) vec3 edge1@0x269c750)\n" + " (declare (in ) vec3 x@0x269c860)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 edge0@0x1abba40)\n" - " (declare (in ) vec4 edge1@0x1abbb50)\n" - " (declare (in ) vec4 x@0x1abbc60)\n" + " (declare (in ) vec4 edge0@0x269ca40)\n" + " (declare (in ) vec4 edge1@0x269cb50)\n" + " (declare (in ) vec4 x@0x269cc60)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) float edge0@0x1abbe40)\n" - " (declare (in ) float edge1@0x1abbf50)\n" - " (declare (in ) vec2 x@0x1abc060)\n" + " (declare (in ) float edge0@0x269ce40)\n" + " (declare (in ) float edge1@0x269cf50)\n" + " (declare (in ) vec2 x@0x269d060)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) float edge0@0x1abc240)\n" - " (declare (in ) float edge1@0x1abc350)\n" - " (declare (in ) vec3 x@0x1abc460)\n" + " (declare (in ) float edge0@0x269d240)\n" + " (declare (in ) float edge1@0x269d350)\n" + " (declare (in ) vec3 x@0x269d460)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) float edge0@0x1abc640)\n" - " (declare (in ) float edge1@0x1abc750)\n" - " (declare (in ) vec4 x@0x1abc860)\n" + " (declare (in ) float edge0@0x269d640)\n" + " (declare (in ) float edge1@0x269d750)\n" + " (declare (in ) vec4 x@0x269d860)\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@0x1abca40)\n" + " (declare (in ) float x@0x269da40)\n" " )\n" " (\n" " ))\n" "\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec2 x@0x1abcdc0)\n" + " (declare (in ) vec2 x@0x269ddc0)\n" " )\n" " (\n" " ))\n" "\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec3 x@0x1abcfa0)\n" + " (declare (in ) vec3 x@0x269dfa0)\n" " )\n" " (\n" " ))\n" "\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec4 x@0x1abd180)\n" + " (declare (in ) vec4 x@0x269e180)\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@0x1abd360)\n" - " (declare (in ) float p1@0x1abd470)\n" + " (declare (in ) float p0@0x269e360)\n" + " (declare (in ) float p1@0x269e470)\n" " )\n" " (\n" " ))\n" "\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec2 p0@0x1abd800)\n" - " (declare (in ) vec2 p1@0x1abd910)\n" + " (declare (in ) vec2 p0@0x269e800)\n" + " (declare (in ) vec2 p1@0x269e910)\n" " )\n" " (\n" " ))\n" "\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec3 p0@0x1abdaf0)\n" - " (declare (in ) vec3 p1@0x1abdc00)\n" + " (declare (in ) vec3 p0@0x269eaf0)\n" + " (declare (in ) vec3 p1@0x269ec00)\n" " )\n" " (\n" " ))\n" "\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec4 p0@0x1abdde0)\n" - " (declare (in ) vec4 p1@0x1abdef0)\n" + " (declare (in ) vec4 p0@0x269ede0)\n" + " (declare (in ) vec4 p1@0x269eef0)\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@0x1abe0d0)\n" - " (declare (in ) float y@0x1abe1e0)\n" + " (declare (in ) float x@0x269f0d0)\n" + " (declare (in ) float y@0x269f1e0)\n" " )\n" " (\n" " ))\n" "\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec2 x@0x1abe560)\n" - " (declare (in ) vec2 y@0x1abe670)\n" + " (declare (in ) vec2 x@0x269f560)\n" + " (declare (in ) vec2 y@0x269f670)\n" " )\n" " (\n" " ))\n" "\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec3 x@0x1abe850)\n" - " (declare (in ) vec3 y@0x1abe960)\n" + " (declare (in ) vec3 x@0x269f850)\n" + " (declare (in ) vec3 y@0x269f960)\n" " )\n" " (\n" " ))\n" "\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec4 x@0x1abeb40)\n" - " (declare (in ) vec4 y@0x1abec50)\n" + " (declare (in ) vec4 x@0x269fb40)\n" + " (declare (in ) vec4 y@0x269fc50)\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@0x1abee30)\n" - " (declare (in ) vec3 y@0x1abef40)\n" + " (declare (in ) vec3 x@0x269fe30)\n" + " (declare (in ) vec3 y@0x269ff40)\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@0x1abf2c0)\n" + " (declare (in ) float x@0x26a02c0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x1abf650)\n" + " (declare (in ) vec2 x@0x26a0650)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x1abf830)\n" + " (declare (in ) vec3 x@0x26a0830)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x1abfa10)\n" + " (declare (in ) vec4 x@0x26a0a10)\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@0x1abfe70)\n" - " (declare (in ) float I@0x1abff80)\n" - " (declare (in ) float Nref@0x1ac0090)\n" + " (declare (in ) float N@0x26a0e70)\n" + " (declare (in ) float I@0x26a0f80)\n" + " (declare (in ) float Nref@0x26a1090)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 N@0x1ac0420)\n" - " (declare (in ) vec2 I@0x1ac0530)\n" - " (declare (in ) vec2 Nref@0x1ac0640)\n" + " (declare (in ) vec2 N@0x26a1420)\n" + " (declare (in ) vec2 I@0x26a1530)\n" + " (declare (in ) vec2 Nref@0x26a1640)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 N@0x1ac0820)\n" - " (declare (in ) vec3 I@0x1ac0930)\n" - " (declare (in ) vec3 Nref@0x1ac0a40)\n" + " (declare (in ) vec3 N@0x26a1820)\n" + " (declare (in ) vec3 I@0x26a1930)\n" + " (declare (in ) vec3 Nref@0x26a1a40)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 N@0x1ac0c20)\n" - " (declare (in ) vec4 I@0x1ac0d30)\n" - " (declare (in ) vec4 Nref@0x1ac0e40)\n" + " (declare (in ) vec4 N@0x26a1c20)\n" + " (declare (in ) vec4 I@0x26a1d30)\n" + " (declare (in ) vec4 Nref@0x26a1e40)\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@0x1ac1020)\n" - " (declare (in ) float N@0x1ac1130)\n" + " (declare (in ) float I@0x26a2020)\n" + " (declare (in ) float N@0x26a2130)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 I@0x1ac14b0)\n" - " (declare (in ) vec2 N@0x1ac15c0)\n" + " (declare (in ) vec2 I@0x26a24b0)\n" + " (declare (in ) vec2 N@0x26a25c0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 I@0x1ac17a0)\n" - " (declare (in ) vec3 N@0x1ac18b0)\n" + " (declare (in ) vec3 I@0x26a27a0)\n" + " (declare (in ) vec3 N@0x26a28b0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 I@0x1ac1a90)\n" - " (declare (in ) vec4 N@0x1ac1ba0)\n" + " (declare (in ) vec4 I@0x26a2a90)\n" + " (declare (in ) vec4 N@0x26a2ba0)\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@0x1ac1d80)\n" - " (declare (in ) float N@0x1ac1e90)\n" - " (declare (in ) float eta@0x1ac1fa0)\n" + " (declare (in ) float I@0x26a2d80)\n" + " (declare (in ) float N@0x26a2e90)\n" + " (declare (in ) float eta@0x26a2fa0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 I@0x1ac2320)\n" - " (declare (in ) vec2 N@0x1ac2430)\n" - " (declare (in ) float eta@0x1ac2540)\n" + " (declare (in ) vec2 I@0x26a3320)\n" + " (declare (in ) vec2 N@0x26a3430)\n" + " (declare (in ) float eta@0x26a3540)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 I@0x1ac2720)\n" - " (declare (in ) vec3 N@0x1ac2830)\n" - " (declare (in ) float eta@0x1ac2940)\n" + " (declare (in ) vec3 I@0x26a3720)\n" + " (declare (in ) vec3 N@0x26a3830)\n" + " (declare (in ) float eta@0x26a3940)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 I@0x1ac2b20)\n" - " (declare (in ) vec4 N@0x1ac2c30)\n" - " (declare (in ) float eta@0x1ac2d40)\n" + " (declare (in ) vec4 I@0x26a3b20)\n" + " (declare (in ) vec4 N@0x26a3c30)\n" + " (declare (in ) float eta@0x26a3d40)\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@0x1ac2f20)\n" - " (declare (in ) mat2 y@0x1ac3030)\n" + " (declare (in ) mat2 x@0x26a3f20)\n" + " (declare (in ) mat2 y@0x26a4030)\n" " )\n" " (\n" " ))\n" "\n" " (signature mat3\n" " (parameters\n" - " (declare (in ) mat3 x@0x1ac33c0)\n" - " (declare (in ) mat3 y@0x1ac34d0)\n" + " (declare (in ) mat3 x@0x26a43c0)\n" + " (declare (in ) mat3 y@0x26a44d0)\n" " )\n" " (\n" " ))\n" "\n" " (signature mat4\n" " (parameters\n" - " (declare (in ) mat4 x@0x1ac36b0)\n" - " (declare (in ) mat4 y@0x1ac37c0)\n" + " (declare (in ) mat4 x@0x26a46b0)\n" + " (declare (in ) mat4 y@0x26a47c0)\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@0x1ac39a0)\n" - " (declare (in ) vec2 y@0x1ac3ab0)\n" + " (declare (in ) vec2 x@0x26a49a0)\n" + " (declare (in ) vec2 y@0x26a4ab0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x1ac3e40)\n" - " (declare (in ) vec3 y@0x1ac3f50)\n" + " (declare (in ) vec3 x@0x26a4e40)\n" + " (declare (in ) vec3 y@0x26a4f50)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x1ac4130)\n" - " (declare (in ) vec4 y@0x1ac4240)\n" + " (declare (in ) vec4 x@0x26a5130)\n" + " (declare (in ) vec4 y@0x26a5240)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) ivec2 x@0x1ac4420)\n" - " (declare (in ) ivec2 y@0x1ac4530)\n" + " (declare (in ) ivec2 x@0x26a5420)\n" + " (declare (in ) ivec2 y@0x26a5530)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) ivec3 x@0x1ac4710)\n" - " (declare (in ) ivec3 y@0x1ac4820)\n" + " (declare (in ) ivec3 x@0x26a5710)\n" + " (declare (in ) ivec3 y@0x26a5820)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) ivec4 x@0x1ac4a00)\n" - " (declare (in ) ivec4 y@0x1ac4b10)\n" + " (declare (in ) ivec4 x@0x26a5a00)\n" + " (declare (in ) ivec4 y@0x26a5b10)\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@0x1ac4cf0)\n" - " (declare (in ) vec2 y@0x1ac4e00)\n" + " (declare (in ) vec2 x@0x26a5cf0)\n" + " (declare (in ) vec2 y@0x26a5e00)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x1ac5190)\n" - " (declare (in ) vec3 y@0x1ac52a0)\n" + " (declare (in ) vec3 x@0x26a6190)\n" + " (declare (in ) vec3 y@0x26a62a0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x1ac5480)\n" - " (declare (in ) vec4 y@0x1ac5590)\n" + " (declare (in ) vec4 x@0x26a6480)\n" + " (declare (in ) vec4 y@0x26a6590)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) ivec2 x@0x1ac5770)\n" - " (declare (in ) ivec2 y@0x1ac5880)\n" + " (declare (in ) ivec2 x@0x26a6770)\n" + " (declare (in ) ivec2 y@0x26a6880)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) ivec3 x@0x1ac5a60)\n" - " (declare (in ) ivec3 y@0x1ac5b70)\n" + " (declare (in ) ivec3 x@0x26a6a60)\n" + " (declare (in ) ivec3 y@0x26a6b70)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) ivec4 x@0x1ac5d50)\n" - " (declare (in ) ivec4 y@0x1ac5e60)\n" + " (declare (in ) ivec4 x@0x26a6d50)\n" + " (declare (in ) ivec4 y@0x26a6e60)\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@0x1ac6040)\n" - " (declare (in ) vec2 y@0x1ac6150)\n" + " (declare (in ) vec2 x@0x26a7040)\n" + " (declare (in ) vec2 y@0x26a7150)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x1ac64e0)\n" - " (declare (in ) vec3 y@0x1ac65f0)\n" + " (declare (in ) vec3 x@0x26a74e0)\n" + " (declare (in ) vec3 y@0x26a75f0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x1ac67d0)\n" - " (declare (in ) vec4 y@0x1ac68e0)\n" + " (declare (in ) vec4 x@0x26a77d0)\n" + " (declare (in ) vec4 y@0x26a78e0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) ivec2 x@0x1ac6ac0)\n" - " (declare (in ) ivec2 y@0x1ac6bd0)\n" + " (declare (in ) ivec2 x@0x26a7ac0)\n" + " (declare (in ) ivec2 y@0x26a7bd0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) ivec3 x@0x1ac6db0)\n" - " (declare (in ) ivec3 y@0x1ac6ec0)\n" + " (declare (in ) ivec3 x@0x26a7db0)\n" + " (declare (in ) ivec3 y@0x26a7ec0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) ivec4 x@0x1ac70a0)\n" - " (declare (in ) ivec4 y@0x1ac71b0)\n" + " (declare (in ) ivec4 x@0x26a80a0)\n" + " (declare (in ) ivec4 y@0x26a81b0)\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@0x1ac7390)\n" - " (declare (in ) vec2 y@0x1ac74a0)\n" + " (declare (in ) vec2 x@0x26a8390)\n" + " (declare (in ) vec2 y@0x26a84a0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x1ac7830)\n" - " (declare (in ) vec3 y@0x1ac7940)\n" + " (declare (in ) vec3 x@0x26a8830)\n" + " (declare (in ) vec3 y@0x26a8940)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x1ac7b20)\n" - " (declare (in ) vec4 y@0x1ac7c30)\n" + " (declare (in ) vec4 x@0x26a8b20)\n" + " (declare (in ) vec4 y@0x26a8c30)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) ivec2 x@0x1ac7e10)\n" - " (declare (in ) ivec2 y@0x1ac7f20)\n" + " (declare (in ) ivec2 x@0x26a8e10)\n" + " (declare (in ) ivec2 y@0x26a8f20)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) ivec3 x@0x1ac8100)\n" - " (declare (in ) ivec3 y@0x1ac8210)\n" + " (declare (in ) ivec3 x@0x26a9100)\n" + " (declare (in ) ivec3 y@0x26a9210)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) ivec4 x@0x1ac83f0)\n" - " (declare (in ) ivec4 y@0x1ac8500)\n" + " (declare (in ) ivec4 x@0x26a93f0)\n" + " (declare (in ) ivec4 y@0x26a9500)\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@0x1ac86e0)\n" - " (declare (in ) vec2 y@0x1ac87f0)\n" + " (declare (in ) vec2 x@0x26a96e0)\n" + " (declare (in ) vec2 y@0x26a97f0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x1ac8b70)\n" - " (declare (in ) vec3 y@0x1ac8c80)\n" + " (declare (in ) vec3 x@0x26a9b70)\n" + " (declare (in ) vec3 y@0x26a9c80)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x1ac8e60)\n" - " (declare (in ) vec4 y@0x1ac8f70)\n" + " (declare (in ) vec4 x@0x26a9e60)\n" + " (declare (in ) vec4 y@0x26a9f70)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) ivec2 x@0x1ac9150)\n" - " (declare (in ) ivec2 y@0x1ac9260)\n" + " (declare (in ) ivec2 x@0x26aa150)\n" + " (declare (in ) ivec2 y@0x26aa260)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) ivec3 x@0x1ac9440)\n" - " (declare (in ) ivec3 y@0x1ac9550)\n" + " (declare (in ) ivec3 x@0x26aa440)\n" + " (declare (in ) ivec3 y@0x26aa550)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) ivec4 x@0x1ac9730)\n" - " (declare (in ) ivec4 y@0x1ac9840)\n" + " (declare (in ) ivec4 x@0x26aa730)\n" + " (declare (in ) ivec4 y@0x26aa840)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) bvec2 x@0x1ac9a20)\n" - " (declare (in ) bvec2 y@0x1ac9b30)\n" + " (declare (in ) bvec2 x@0x26aaa20)\n" + " (declare (in ) bvec2 y@0x26aab30)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) bvec3 x@0x1ac9d10)\n" - " (declare (in ) bvec3 y@0x1ac9e20)\n" + " (declare (in ) bvec3 x@0x26aad10)\n" + " (declare (in ) bvec3 y@0x26aae20)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) bvec4 x@0x1aca000)\n" - " (declare (in ) bvec4 y@0x1aca110)\n" + " (declare (in ) bvec4 x@0x26ab000)\n" + " (declare (in ) bvec4 y@0x26ab110)\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@0x1aca2f0)\n" - " (declare (in ) vec2 y@0x1aca400)\n" + " (declare (in ) vec2 x@0x26ab2f0)\n" + " (declare (in ) vec2 y@0x26ab400)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x1aca790)\n" - " (declare (in ) vec3 y@0x1aca8a0)\n" + " (declare (in ) vec3 x@0x26ab790)\n" + " (declare (in ) vec3 y@0x26ab8a0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x1acaa80)\n" - " (declare (in ) vec4 y@0x1acab90)\n" + " (declare (in ) vec4 x@0x26aba80)\n" + " (declare (in ) vec4 y@0x26abb90)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) ivec2 x@0x1acad70)\n" - " (declare (in ) ivec2 y@0x1acae80)\n" + " (declare (in ) ivec2 x@0x26abd70)\n" + " (declare (in ) ivec2 y@0x26abe80)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) ivec3 x@0x1acb060)\n" - " (declare (in ) ivec3 y@0x1acb170)\n" + " (declare (in ) ivec3 x@0x26ac060)\n" + " (declare (in ) ivec3 y@0x26ac170)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) ivec4 x@0x1acb350)\n" - " (declare (in ) ivec4 y@0x1acb460)\n" + " (declare (in ) ivec4 x@0x26ac350)\n" + " (declare (in ) ivec4 y@0x26ac460)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) bvec2 x@0x1acb640)\n" - " (declare (in ) bvec2 y@0x1acb750)\n" + " (declare (in ) bvec2 x@0x26ac640)\n" + " (declare (in ) bvec2 y@0x26ac750)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) bvec3 x@0x1acb930)\n" - " (declare (in ) bvec3 y@0x1acba40)\n" + " (declare (in ) bvec3 x@0x26ac930)\n" + " (declare (in ) bvec3 y@0x26aca40)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) bvec4 x@0x1acbc20)\n" - " (declare (in ) bvec4 y@0x1acbd30)\n" + " (declare (in ) bvec4 x@0x26acc20)\n" + " (declare (in ) bvec4 y@0x26acd30)\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@0x1acbf10)\n" + " (declare (in ) bvec2 x@0x26acf10)\n" " )\n" " (\n" " ))\n" "\n" " (signature bool\n" " (parameters\n" - " (declare (in ) bvec3 x@0x1acc290)\n" + " (declare (in ) bvec3 x@0x26ad290)\n" " )\n" " (\n" " ))\n" "\n" " (signature bool\n" " (parameters\n" - " (declare (in ) bvec4 x@0x1acc470)\n" + " (declare (in ) bvec4 x@0x26ad470)\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@0x1acc650)\n" + " (declare (in ) bvec2 x@0x26ad650)\n" " )\n" " (\n" " ))\n" "\n" " (signature bool\n" " (parameters\n" - " (declare (in ) bvec3 x@0x1acc9d0)\n" + " (declare (in ) bvec3 x@0x26ad9d0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bool\n" " (parameters\n" - " (declare (in ) bvec4 x@0x1accbb0)\n" + " (declare (in ) bvec4 x@0x26adbb0)\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@0x1accd90)\n" + " (declare (in ) bvec2 x@0x26add90)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) bvec3 x@0x1acd110)\n" + " (declare (in ) bvec3 x@0x26ae110)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) bvec4 x@0x1acd2f0)\n" + " (declare (in ) bvec4 x@0x26ae2f0)\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@0x1acd4d0)\n" - " (declare (in ) float coord@0x1acd5e0)\n" + " (declare (in ) sampler1D sampler@0x26ae4d0)\n" + " (declare (in ) float coord@0x26ae5e0)\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@0x1acd970)\n" - " (declare (in ) vec2 coord@0x1acda80)\n" + " (declare (in ) sampler1D sampler@0x26ae970)\n" + " (declare (in ) vec2 coord@0x26aea80)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1D sampler@0x1acde10)\n" - " (declare (in ) vec4 coord@0x1acdf20)\n" + " (declare (in ) sampler1D sampler@0x26aee10)\n" + " (declare (in ) vec4 coord@0x26aef20)\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@0x1ace100)\n" - " (declare (in ) float coord@0x1ace210)\n" - " (declare (in ) float lod@0x1ace320)\n" + " (declare (in ) sampler1D sampler@0x26af100)\n" + " (declare (in ) float coord@0x26af210)\n" + " (declare (in ) float lod@0x26af320)\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@0x1ace6b0)\n" - " (declare (in ) vec2 coord@0x1ace7c0)\n" - " (declare (in ) float lod@0x1ace8d0)\n" + " (declare (in ) sampler1D sampler@0x26af6b0)\n" + " (declare (in ) vec2 coord@0x26af7c0)\n" + " (declare (in ) float lod@0x26af8d0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1D sampler@0x1acec60)\n" - " (declare (in ) vec4 coord@0x1aced70)\n" - " (declare (in ) float lod@0x1acee80)\n" + " (declare (in ) sampler1D sampler@0x26afc60)\n" + " (declare (in ) vec4 coord@0x26afd70)\n" + " (declare (in ) float lod@0x26afe80)\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@0x1acf060)\n" - " (declare (in ) vec2 coord@0x1acf170)\n" + " (declare (in ) sampler2D sampler@0x26b0060)\n" + " (declare (in ) vec2 coord@0x26b0170)\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@0x1acf500)\n" - " (declare (in ) vec3 coord@0x1acf610)\n" + " (declare (in ) sampler2D sampler@0x26b0500)\n" + " (declare (in ) vec3 coord@0x26b0610)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2D sampler@0x1acf9a0)\n" - " (declare (in ) vec4 coord@0x1acfab0)\n" + " (declare (in ) sampler2D sampler@0x26b09a0)\n" + " (declare (in ) vec4 coord@0x26b0ab0)\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@0x1acfc90)\n" - " (declare (in ) vec2 coord@0x1acfda0)\n" - " (declare (in ) float lod@0x1acfeb0)\n" + " (declare (in ) sampler2D sampler@0x26b0c90)\n" + " (declare (in ) vec2 coord@0x26b0da0)\n" + " (declare (in ) float lod@0x26b0eb0)\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@0x1ad0240)\n" - " (declare (in ) vec3 coord@0x1ad0350)\n" - " (declare (in ) float lod@0x1ad0460)\n" + " (declare (in ) sampler2D sampler@0x26b1240)\n" + " (declare (in ) vec3 coord@0x26b1350)\n" + " (declare (in ) float lod@0x26b1460)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2D sampler@0x1ad07f0)\n" - " (declare (in ) vec4 coord@0x1ad0900)\n" - " (declare (in ) float lod@0x1ad0a10)\n" + " (declare (in ) sampler2D sampler@0x26b17f0)\n" + " (declare (in ) vec4 coord@0x26b1900)\n" + " (declare (in ) float lod@0x26b1a10)\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@0x1ad0bf0)\n" - " (declare (in ) vec3 coord@0x1ad0d00)\n" + " (declare (in ) sampler3D sampler@0x26b1bf0)\n" + " (declare (in ) vec3 coord@0x26b1d00)\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@0x1ad1090)\n" - " (declare (in ) vec4 coord@0x1ad11a0)\n" + " (declare (in ) sampler3D sampler@0x26b2090)\n" + " (declare (in ) vec4 coord@0x26b21a0)\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@0x1ad1530)\n" - " (declare (in ) vec3 coord@0x1ad1640)\n" - " (declare (in ) float lod@0x1ad1750)\n" + " (declare (in ) sampler3D sampler@0x26b2530)\n" + " (declare (in ) vec3 coord@0x26b2640)\n" + " (declare (in ) float lod@0x26b2750)\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@0x1ad1ae0)\n" - " (declare (in ) vec4 coord@0x1ad1bf0)\n" - " (declare (in ) float lod@0x1ad1d00)\n" + " (declare (in ) sampler3D sampler@0x26b2ae0)\n" + " (declare (in ) vec4 coord@0x26b2bf0)\n" + " (declare (in ) float lod@0x26b2d00)\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@0x1ad2090)\n" - " (declare (in ) vec3 coord@0x1ad21a0)\n" + " (declare (in ) samplerCube sampler@0x26b3090)\n" + " (declare (in ) vec3 coord@0x26b31a0)\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@0x1ad2530)\n" - " (declare (in ) vec3 coord@0x1ad2640)\n" - " (declare (in ) float lod@0x1ad2750)\n" + " (declare (in ) samplerCube sampler@0x26b3530)\n" + " (declare (in ) vec3 coord@0x26b3640)\n" + " (declare (in ) float lod@0x26b3750)\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@0x1ad2ae0)\n" - " (declare (in ) vec3 coord@0x1ad2bf0)\n" + " (declare (in ) sampler1DShadow sampler@0x26b3ae0)\n" + " (declare (in ) vec3 coord@0x26b3bf0)\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@0x1ad2f80)\n" - " (declare (in ) vec3 coord@0x1ad3090)\n" + " (declare (in ) sampler2DShadow sampler@0x26b3f80)\n" + " (declare (in ) vec3 coord@0x26b4090)\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@0x1ad3420)\n" - " (declare (in ) vec4 coord@0x1ad3530)\n" + " (declare (in ) sampler1DShadow sampler@0x26b4420)\n" + " (declare (in ) vec4 coord@0x26b4530)\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@0x1ad38c0)\n" - " (declare (in ) vec4 coord@0x1ad39d0)\n" + " (declare (in ) sampler2DShadow sampler@0x26b48c0)\n" + " (declare (in ) vec4 coord@0x26b49d0)\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@0x1ad3d60)\n" - " (declare (in ) vec3 coord@0x1ad3e70)\n" - " (declare (in ) float lod@0x1ad3f80)\n" + " (declare (in ) sampler1DShadow sampler@0x26b4d60)\n" + " (declare (in ) vec3 coord@0x26b4e70)\n" + " (declare (in ) float lod@0x26b4f80)\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@0x1ad4310)\n" - " (declare (in ) vec3 coord@0x1ad4420)\n" - " (declare (in ) float lod@0x1ad4530)\n" + " (declare (in ) sampler2DShadow sampler@0x26b5310)\n" + " (declare (in ) vec3 coord@0x26b5420)\n" + " (declare (in ) float lod@0x26b5530)\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@0x1ad48c0)\n" - " (declare (in ) vec4 coord@0x1ad49d0)\n" - " (declare (in ) float lod@0x1ad4ae0)\n" + " (declare (in ) sampler1DShadow sampler@0x26b58c0)\n" + " (declare (in ) vec4 coord@0x26b59d0)\n" + " (declare (in ) float lod@0x26b5ae0)\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@0x1ad4e70)\n" - " (declare (in ) vec4 coord@0x1ad4f80)\n" - " (declare (in ) float lod@0x1ad5090)\n" + " (declare (in ) sampler2DShadow sampler@0x26b5e70)\n" + " (declare (in ) vec4 coord@0x26b5f80)\n" + " (declare (in ) float lod@0x26b6090)\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@0x1ad5420)\n" + " (declare (in ) float x@0x26b6420)\n" " )\n" " (\n" " ))\n" "\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec2 x@0x1ad57a0)\n" + " (declare (in ) vec2 x@0x26b67a0)\n" " )\n" " (\n" " ))\n" "\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec3 x@0x1ad5980)\n" + " (declare (in ) vec3 x@0x26b6980)\n" " )\n" " (\n" " ))\n" "\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec4 x@0x1ad5b60)\n" + " (declare (in ) vec4 x@0x26b6b60)\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@0x1ad5d40)\n" + " (declare (in ) float x@0x26b6d40)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x1ad60c0)\n" + " (declare (in ) vec2 x@0x26b70c0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec3 x@0x1ad62a0)\n" + " (declare (in ) vec3 x@0x26b72a0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec4 x@0x1ad6480)\n" + " (declare (in ) vec4 x@0x26b7480)\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@0x1ad6660)\n" + " (declare (in ) float x@0x26b7660)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec2 x@0x1ad69e0)\n" + " (declare (in ) vec2 x@0x26b79e0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x1ad6bc0)\n" + " (declare (in ) vec3 x@0x26b7bc0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec4 x@0x1ad6da0)\n" + " (declare (in ) vec4 x@0x26b7da0)\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@0x1ad6f80)\n" + " (declare (in ) float x@0x26b7f80)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec2 x@0x1ad7300)\n" + " (declare (in ) vec2 x@0x26b8300)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec3 x@0x1ad74e0)\n" + " (declare (in ) vec3 x@0x26b84e0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x1ad76c0)\n" + " (declare (in ) vec4 x@0x26b86c0)\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@0x26c9280)\n" + " (declare (in ) float degrees@0x25c3280)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 degrees@0x26c9600)\n" + " (declare (in ) vec2 degrees@0x25c3600)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 degrees@0x26c97e0)\n" + " (declare (in ) vec3 degrees@0x25c37e0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 degrees@0x26c99c0)\n" + " (declare (in ) vec4 degrees@0x25c39c0)\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@0x26c9ba0)\n" + " (declare (in ) float radians@0x25c3ba0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 radians@0x26c9f20)\n" + " (declare (in ) vec2 radians@0x25c3f20)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 radians@0x26ca100)\n" + " (declare (in ) vec3 radians@0x25c4100)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 radians@0x26ca2e0)\n" + " (declare (in ) vec4 radians@0x25c42e0)\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@0x26ca4c0)\n" + " (declare (in ) float angle@0x25c44c0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 angle@0x26ca840)\n" + " (declare (in ) vec2 angle@0x25c4840)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 angle@0x26caa20)\n" + " (declare (in ) vec3 angle@0x25c4a20)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 angle@0x26cac00)\n" + " (declare (in ) vec4 angle@0x25c4c00)\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@0x26cade0)\n" + " (declare (in ) float angle@0x25c4de0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 angle@0x26cb160)\n" + " (declare (in ) vec2 angle@0x25c5160)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 angle@0x26cb340)\n" + " (declare (in ) vec3 angle@0x25c5340)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 angle@0x26cb520)\n" + " (declare (in ) vec4 angle@0x25c5520)\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@0x26cb700)\n" + " (declare (in ) float angle@0x25c5700)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 angle@0x26cba80)\n" + " (declare (in ) vec2 angle@0x25c5a80)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 angle@0x26cbc60)\n" + " (declare (in ) vec3 angle@0x25c5c60)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 angle@0x26cbe40)\n" + " (declare (in ) vec4 angle@0x25c5e40)\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@0x26cc020)\n" + " (declare (in ) float angle@0x25c6020)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 angle@0x26cc3a0)\n" + " (declare (in ) vec2 angle@0x25c63a0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 angle@0x26cc580)\n" + " (declare (in ) vec3 angle@0x25c6580)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 angle@0x26cc760)\n" + " (declare (in ) vec4 angle@0x25c6760)\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@0x26cc940)\n" + " (declare (in ) float angle@0x25c6940)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 angle@0x26cccc0)\n" + " (declare (in ) vec2 angle@0x25c6cc0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 angle@0x26ccea0)\n" + " (declare (in ) vec3 angle@0x25c6ea0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 angle@0x26cd080)\n" + " (declare (in ) vec4 angle@0x25c7080)\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@0x26cd260)\n" - " (declare (in ) float x@0x26cd370)\n" + " (declare (in ) float y@0x25c7260)\n" + " (declare (in ) float x@0x25c7370)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 y@0x26cd6f0)\n" - " (declare (in ) vec2 x@0x26cd800)\n" + " (declare (in ) vec2 y@0x25c76f0)\n" + " (declare (in ) vec2 x@0x25c7800)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 y@0x26cd9e0)\n" - " (declare (in ) vec3 x@0x26cdaf0)\n" + " (declare (in ) vec3 y@0x25c79e0)\n" + " (declare (in ) vec3 x@0x25c7af0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 y@0x26cdcd0)\n" - " (declare (in ) vec4 x@0x26cdde0)\n" + " (declare (in ) vec4 y@0x25c7cd0)\n" + " (declare (in ) vec4 x@0x25c7de0)\n" " )\n" " (\n" " ))\n" "\n" " (signature float\n" " (parameters\n" - " (declare (in ) float y_over_x@0x26cdfc0)\n" + " (declare (in ) float y_over_x@0x25c7fc0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 y_over_x@0x26ce1b0)\n" + " (declare (in ) vec2 y_over_x@0x25c81b0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 y_over_x@0x26ce3a0)\n" + " (declare (in ) vec3 y_over_x@0x25c83a0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 y_over_x@0x26ce590)\n" + " (declare (in ) vec4 y_over_x@0x25c8590)\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@0x26ce780)\n" - " (declare (in ) float y@0x26ce890)\n" + " (declare (in ) float x@0x25c8780)\n" + " (declare (in ) float y@0x25c8890)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x26cec10)\n" - " (declare (in ) vec2 y@0x26ced20)\n" + " (declare (in ) vec2 x@0x25c8c10)\n" + " (declare (in ) vec2 y@0x25c8d20)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x26cef00)\n" - " (declare (in ) vec3 y@0x26cf010)\n" + " (declare (in ) vec3 x@0x25c8f00)\n" + " (declare (in ) vec3 y@0x25c9010)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x26cf1f0)\n" - " (declare (in ) vec4 y@0x26cf300)\n" + " (declare (in ) vec4 x@0x25c91f0)\n" + " (declare (in ) vec4 y@0x25c9300)\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@0x26cf4e0)\n" + " (declare (in ) float x@0x25c94e0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x26cf860)\n" + " (declare (in ) vec2 x@0x25c9860)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x26cfa40)\n" + " (declare (in ) vec3 x@0x25c9a40)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x26cfc20)\n" + " (declare (in ) vec4 x@0x25c9c20)\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@0x26cfe00)\n" + " (declare (in ) float x@0x25c9e00)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x26d0180)\n" + " (declare (in ) vec2 x@0x25ca180)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x26d0360)\n" + " (declare (in ) vec3 x@0x25ca360)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x26d0540)\n" + " (declare (in ) vec4 x@0x25ca540)\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@0x26d0720)\n" + " (declare (in ) float x@0x25ca720)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x26d0aa0)\n" + " (declare (in ) vec2 x@0x25caaa0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x26d0c80)\n" + " (declare (in ) vec3 x@0x25cac80)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x26d0e60)\n" + " (declare (in ) vec4 x@0x25cae60)\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@0x26d1040)\n" + " (declare (in ) float x@0x25cb040)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x26d13c0)\n" + " (declare (in ) vec2 x@0x25cb3c0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x26d15a0)\n" + " (declare (in ) vec3 x@0x25cb5a0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x26d1780)\n" + " (declare (in ) vec4 x@0x25cb780)\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@0x26d1960)\n" + " (declare (in ) float x@0x25cb960)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x26d1ce0)\n" + " (declare (in ) vec2 x@0x25cbce0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x26d1ec0)\n" + " (declare (in ) vec3 x@0x25cbec0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x26d20a0)\n" + " (declare (in ) vec4 x@0x25cc0a0)\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@0x26d2280)\n" + " (declare (in ) float x@0x25cc280)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x26d2610)\n" + " (declare (in ) vec2 x@0x25cc610)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x26d27f0)\n" + " (declare (in ) vec3 x@0x25cc7f0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x26d29d0)\n" + " (declare (in ) vec4 x@0x25cc9d0)\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@0x26d2bb0)\n" + " (declare (in ) float x@0x25ccbb0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x26d2f30)\n" + " (declare (in ) vec2 x@0x25ccf30)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x26d3110)\n" + " (declare (in ) vec3 x@0x25cd110)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x26d32f0)\n" + " (declare (in ) vec4 x@0x25cd2f0)\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@0x26d34d0)\n" + " (declare (in ) float x@0x25cd4d0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x26d3850)\n" + " (declare (in ) vec2 x@0x25cd850)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x26d3a30)\n" + " (declare (in ) vec3 x@0x25cda30)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x26d3c10)\n" + " (declare (in ) vec4 x@0x25cdc10)\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@0x26d3df0)\n" + " (declare (in ) float x@0x25cddf0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x26d4170)\n" + " (declare (in ) vec2 x@0x25ce170)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x26d4350)\n" + " (declare (in ) vec3 x@0x25ce350)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x26d4530)\n" + " (declare (in ) vec4 x@0x25ce530)\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@0x26d4710)\n" + " (declare (in ) float x@0x25ce710)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x26d4a90)\n" + " (declare (in ) vec2 x@0x25cea90)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x26d4c70)\n" + " (declare (in ) vec3 x@0x25cec70)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x26d4e50)\n" + " (declare (in ) vec4 x@0x25cee50)\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@0x26d5030)\n" + " (declare (in ) float x@0x25cf030)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x26d53b0)\n" + " (declare (in ) vec2 x@0x25cf3b0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x26d5590)\n" + " (declare (in ) vec3 x@0x25cf590)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x26d5770)\n" + " (declare (in ) vec4 x@0x25cf770)\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@0x26d5950)\n" - " (declare (in ) float y@0x26d5a60)\n" + " (declare (in ) float x@0x25cf950)\n" + " (declare (in ) float y@0x25cfa60)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x26d5de0)\n" - " (declare (in ) float y@0x26d5ef0)\n" + " (declare (in ) vec2 x@0x25cfde0)\n" + " (declare (in ) float y@0x25cfef0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x26d60d0)\n" - " (declare (in ) float y@0x26d61e0)\n" + " (declare (in ) vec3 x@0x25d00d0)\n" + " (declare (in ) float y@0x25d01e0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x26d63c0)\n" - " (declare (in ) float y@0x26d64d0)\n" + " (declare (in ) vec4 x@0x25d03c0)\n" + " (declare (in ) float y@0x25d04d0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x26d66b0)\n" - " (declare (in ) vec2 y@0x26d67c0)\n" + " (declare (in ) vec2 x@0x25d06b0)\n" + " (declare (in ) vec2 y@0x25d07c0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x26d69a0)\n" - " (declare (in ) vec3 y@0x26d6ab0)\n" + " (declare (in ) vec3 x@0x25d09a0)\n" + " (declare (in ) vec3 y@0x25d0ab0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x26d6c90)\n" - " (declare (in ) vec4 y@0x26d6da0)\n" + " (declare (in ) vec4 x@0x25d0c90)\n" + " (declare (in ) vec4 y@0x25d0da0)\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@0x26d6f80)\n" - " (declare (in ) float y@0x26d7090)\n" + " (declare (in ) float x@0x25d0f80)\n" + " (declare (in ) float y@0x25d1090)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x26d7410)\n" - " (declare (in ) vec2 y@0x26d7520)\n" + " (declare (in ) vec2 x@0x25d1410)\n" + " (declare (in ) vec2 y@0x25d1520)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x26d7700)\n" - " (declare (in ) vec3 y@0x26d7810)\n" + " (declare (in ) vec3 x@0x25d1700)\n" + " (declare (in ) vec3 y@0x25d1810)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x26d79f0)\n" - " (declare (in ) vec4 y@0x26d7b00)\n" + " (declare (in ) vec4 x@0x25d19f0)\n" + " (declare (in ) vec4 y@0x25d1b00)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x26d7ce0)\n" - " (declare (in ) float y@0x26d7df0)\n" + " (declare (in ) vec2 x@0x25d1ce0)\n" + " (declare (in ) float y@0x25d1df0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x26d7fd0)\n" - " (declare (in ) float y@0x26d80e0)\n" + " (declare (in ) vec3 x@0x25d1fd0)\n" + " (declare (in ) float y@0x25d20e0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x26d82c0)\n" - " (declare (in ) float y@0x26d83d0)\n" + " (declare (in ) vec4 x@0x25d22c0)\n" + " (declare (in ) float y@0x25d23d0)\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@0x26d85b0)\n" - " (declare (in ) float y@0x26d86c0)\n" + " (declare (in ) float x@0x25d25b0)\n" + " (declare (in ) float y@0x25d26c0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x26d8a40)\n" - " (declare (in ) vec2 y@0x26d8b50)\n" + " (declare (in ) vec2 x@0x25d2a40)\n" + " (declare (in ) vec2 y@0x25d2b50)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x26d8d30)\n" - " (declare (in ) vec3 y@0x26d8e40)\n" + " (declare (in ) vec3 x@0x25d2d30)\n" + " (declare (in ) vec3 y@0x25d2e40)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x26d9020)\n" - " (declare (in ) vec4 y@0x26d9130)\n" + " (declare (in ) vec4 x@0x25d3020)\n" + " (declare (in ) vec4 y@0x25d3130)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x26d9310)\n" - " (declare (in ) float y@0x26d9420)\n" + " (declare (in ) vec2 x@0x25d3310)\n" + " (declare (in ) float y@0x25d3420)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x26d9600)\n" - " (declare (in ) float y@0x26d9710)\n" + " (declare (in ) vec3 x@0x25d3600)\n" + " (declare (in ) float y@0x25d3710)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x26d98f0)\n" - " (declare (in ) float y@0x26d9a00)\n" + " (declare (in ) vec4 x@0x25d38f0)\n" + " (declare (in ) float y@0x25d3a00)\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@0x26d9be0)\n" - " (declare (in ) float minVal@0x26d9cf0)\n" - " (declare (in ) float maxVal@0x26d9e00)\n" + " (declare (in ) float x@0x25d3be0)\n" + " (declare (in ) float minVal@0x25d3cf0)\n" + " (declare (in ) float maxVal@0x25d3e00)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x26da180)\n" - " (declare (in ) vec2 minVal@0x26da290)\n" - " (declare (in ) vec2 maxVal@0x26da3a0)\n" + " (declare (in ) vec2 x@0x25d4180)\n" + " (declare (in ) vec2 minVal@0x25d4290)\n" + " (declare (in ) vec2 maxVal@0x25d43a0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x26da580)\n" - " (declare (in ) vec3 minVal@0x26da690)\n" - " (declare (in ) vec3 maxVal@0x26da7a0)\n" + " (declare (in ) vec3 x@0x25d4580)\n" + " (declare (in ) vec3 minVal@0x25d4690)\n" + " (declare (in ) vec3 maxVal@0x25d47a0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x26da980)\n" - " (declare (in ) vec4 minVal@0x26daa90)\n" - " (declare (in ) vec4 maxVal@0x26daba0)\n" + " (declare (in ) vec4 x@0x25d4980)\n" + " (declare (in ) vec4 minVal@0x25d4a90)\n" + " (declare (in ) vec4 maxVal@0x25d4ba0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x26dad80)\n" - " (declare (in ) float minVal@0x26dae90)\n" - " (declare (in ) float maxVal@0x26dafa0)\n" + " (declare (in ) vec2 x@0x25d4d80)\n" + " (declare (in ) float minVal@0x25d4e90)\n" + " (declare (in ) float maxVal@0x25d4fa0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x26db180)\n" - " (declare (in ) float minVal@0x26db290)\n" - " (declare (in ) float maxVal@0x26db3a0)\n" + " (declare (in ) vec3 x@0x25d5180)\n" + " (declare (in ) float minVal@0x25d5290)\n" + " (declare (in ) float maxVal@0x25d53a0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x26db580)\n" - " (declare (in ) float minVal@0x26db690)\n" - " (declare (in ) float maxVal@0x26db7a0)\n" + " (declare (in ) vec4 x@0x25d5580)\n" + " (declare (in ) float minVal@0x25d5690)\n" + " (declare (in ) float maxVal@0x25d57a0)\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@0x26db980)\n" - " (declare (in ) float y@0x26dba90)\n" - " (declare (in ) float a@0x26dbba0)\n" + " (declare (in ) float x@0x25d5980)\n" + " (declare (in ) float y@0x25d5a90)\n" + " (declare (in ) float a@0x25d5ba0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x26dbf20)\n" - " (declare (in ) vec2 y@0x26dc030)\n" - " (declare (in ) vec2 a@0x26dc140)\n" + " (declare (in ) vec2 x@0x25d5f20)\n" + " (declare (in ) vec2 y@0x25d6030)\n" + " (declare (in ) vec2 a@0x25d6140)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x26dc320)\n" - " (declare (in ) vec3 y@0x26dc430)\n" - " (declare (in ) vec3 a@0x26dc540)\n" + " (declare (in ) vec3 x@0x25d6320)\n" + " (declare (in ) vec3 y@0x25d6430)\n" + " (declare (in ) vec3 a@0x25d6540)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x26dc720)\n" - " (declare (in ) vec4 y@0x26dc830)\n" - " (declare (in ) vec4 a@0x26dc940)\n" + " (declare (in ) vec4 x@0x25d6720)\n" + " (declare (in ) vec4 y@0x25d6830)\n" + " (declare (in ) vec4 a@0x25d6940)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x26dcb20)\n" - " (declare (in ) vec2 y@0x26dcc30)\n" - " (declare (in ) float a@0x26dcd40)\n" + " (declare (in ) vec2 x@0x25d6b20)\n" + " (declare (in ) vec2 y@0x25d6c30)\n" + " (declare (in ) float a@0x25d6d40)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x26dcf20)\n" - " (declare (in ) vec3 y@0x26dd030)\n" - " (declare (in ) float a@0x26dd140)\n" + " (declare (in ) vec3 x@0x25d6f20)\n" + " (declare (in ) vec3 y@0x25d7030)\n" + " (declare (in ) float a@0x25d7140)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x26dd320)\n" - " (declare (in ) vec4 y@0x26dd430)\n" - " (declare (in ) float a@0x26dd540)\n" + " (declare (in ) vec4 x@0x25d7320)\n" + " (declare (in ) vec4 y@0x25d7430)\n" + " (declare (in ) float a@0x25d7540)\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@0x26dd720)\n" - " (declare (in ) float x@0x26dd830)\n" + " (declare (in ) float edge@0x25d7720)\n" + " (declare (in ) float x@0x25d7830)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 edge@0x26ddbb0)\n" - " (declare (in ) vec2 x@0x26ddcc0)\n" + " (declare (in ) vec2 edge@0x25d7bb0)\n" + " (declare (in ) vec2 x@0x25d7cc0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 edge@0x26ddea0)\n" - " (declare (in ) vec3 x@0x26ddfb0)\n" + " (declare (in ) vec3 edge@0x25d7ea0)\n" + " (declare (in ) vec3 x@0x25d7fb0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 edge@0x26de190)\n" - " (declare (in ) vec4 x@0x26de2a0)\n" + " (declare (in ) vec4 edge@0x25d8190)\n" + " (declare (in ) vec4 x@0x25d82a0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) float edge@0x26de480)\n" - " (declare (in ) vec2 x@0x26de590)\n" + " (declare (in ) float edge@0x25d8480)\n" + " (declare (in ) vec2 x@0x25d8590)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) float edge@0x26de770)\n" - " (declare (in ) vec3 x@0x26de880)\n" + " (declare (in ) float edge@0x25d8770)\n" + " (declare (in ) vec3 x@0x25d8880)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) float edge@0x26dea60)\n" - " (declare (in ) vec4 x@0x26deb70)\n" + " (declare (in ) float edge@0x25d8a60)\n" + " (declare (in ) vec4 x@0x25d8b70)\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@0x26ded50)\n" - " (declare (in ) float edge1@0x26dee60)\n" - " (declare (in ) float x@0x26def70)\n" + " (declare (in ) float edge0@0x25d8d50)\n" + " (declare (in ) float edge1@0x25d8e60)\n" + " (declare (in ) float x@0x25d8f70)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 edge0@0x26df300)\n" - " (declare (in ) vec2 edge1@0x26df410)\n" - " (declare (in ) vec2 x@0x26df520)\n" + " (declare (in ) vec2 edge0@0x25d9300)\n" + " (declare (in ) vec2 edge1@0x25d9410)\n" + " (declare (in ) vec2 x@0x25d9520)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 edge0@0x26df700)\n" - " (declare (in ) vec3 edge1@0x26df810)\n" - " (declare (in ) vec3 x@0x26df920)\n" + " (declare (in ) vec3 edge0@0x25d9700)\n" + " (declare (in ) vec3 edge1@0x25d9810)\n" + " (declare (in ) vec3 x@0x25d9920)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 edge0@0x26dfb00)\n" - " (declare (in ) vec4 edge1@0x26dfc10)\n" - " (declare (in ) vec4 x@0x26dfd20)\n" + " (declare (in ) vec4 edge0@0x25d9b00)\n" + " (declare (in ) vec4 edge1@0x25d9c10)\n" + " (declare (in ) vec4 x@0x25d9d20)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) float edge0@0x26dff00)\n" - " (declare (in ) float edge1@0x26e0010)\n" - " (declare (in ) vec2 x@0x26e0120)\n" + " (declare (in ) float edge0@0x25d9f00)\n" + " (declare (in ) float edge1@0x25da010)\n" + " (declare (in ) vec2 x@0x25da120)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) float edge0@0x26e0300)\n" - " (declare (in ) float edge1@0x26e0410)\n" - " (declare (in ) vec3 x@0x26e0520)\n" + " (declare (in ) float edge0@0x25da300)\n" + " (declare (in ) float edge1@0x25da410)\n" + " (declare (in ) vec3 x@0x25da520)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) float edge0@0x26e0700)\n" - " (declare (in ) float edge1@0x26e0810)\n" - " (declare (in ) vec4 x@0x26e0920)\n" + " (declare (in ) float edge0@0x25da700)\n" + " (declare (in ) float edge1@0x25da810)\n" + " (declare (in ) vec4 x@0x25da920)\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@0x26e0b00)\n" + " (declare (in ) float x@0x25dab00)\n" " )\n" " (\n" " ))\n" "\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec2 x@0x26e0e80)\n" + " (declare (in ) vec2 x@0x25dae80)\n" " )\n" " (\n" " ))\n" "\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec3 x@0x26e1060)\n" + " (declare (in ) vec3 x@0x25db060)\n" " )\n" " (\n" " ))\n" "\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec4 x@0x26e1240)\n" + " (declare (in ) vec4 x@0x25db240)\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@0x26e1420)\n" - " (declare (in ) float p1@0x26e1530)\n" + " (declare (in ) float p0@0x25db420)\n" + " (declare (in ) float p1@0x25db530)\n" " )\n" " (\n" " ))\n" "\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec2 p0@0x26e18c0)\n" - " (declare (in ) vec2 p1@0x26e19d0)\n" + " (declare (in ) vec2 p0@0x25db8c0)\n" + " (declare (in ) vec2 p1@0x25db9d0)\n" " )\n" " (\n" " ))\n" "\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec3 p0@0x26e1bb0)\n" - " (declare (in ) vec3 p1@0x26e1cc0)\n" + " (declare (in ) vec3 p0@0x25dbbb0)\n" + " (declare (in ) vec3 p1@0x25dbcc0)\n" " )\n" " (\n" " ))\n" "\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec4 p0@0x26e1ea0)\n" - " (declare (in ) vec4 p1@0x26e1fb0)\n" + " (declare (in ) vec4 p0@0x25dbea0)\n" + " (declare (in ) vec4 p1@0x25dbfb0)\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@0x26e2190)\n" - " (declare (in ) float y@0x26e22a0)\n" + " (declare (in ) float x@0x25dc190)\n" + " (declare (in ) float y@0x25dc2a0)\n" " )\n" " (\n" " ))\n" "\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec2 x@0x26e2620)\n" - " (declare (in ) vec2 y@0x26e2730)\n" + " (declare (in ) vec2 x@0x25dc620)\n" + " (declare (in ) vec2 y@0x25dc730)\n" " )\n" " (\n" " ))\n" "\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec3 x@0x26e2910)\n" - " (declare (in ) vec3 y@0x26e2a20)\n" + " (declare (in ) vec3 x@0x25dc910)\n" + " (declare (in ) vec3 y@0x25dca20)\n" " )\n" " (\n" " ))\n" "\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec4 x@0x26e2c00)\n" - " (declare (in ) vec4 y@0x26e2d10)\n" + " (declare (in ) vec4 x@0x25dcc00)\n" + " (declare (in ) vec4 y@0x25dcd10)\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@0x26e2ef0)\n" - " (declare (in ) vec3 y@0x26e3000)\n" + " (declare (in ) vec3 x@0x25dcef0)\n" + " (declare (in ) vec3 y@0x25dd000)\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@0x26e3380)\n" + " (declare (in ) float x@0x25dd380)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x26e3710)\n" + " (declare (in ) vec2 x@0x25dd710)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x26e38f0)\n" + " (declare (in ) vec3 x@0x25dd8f0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x26e3ad0)\n" + " (declare (in ) vec4 x@0x25ddad0)\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@0x26e3cb0)\n" - " (declare (in ) float I@0x26e3dc0)\n" - " (declare (in ) float Nref@0x26e3ed0)\n" + " (declare (in ) float N@0x25ddcb0)\n" + " (declare (in ) float I@0x25dddc0)\n" + " (declare (in ) float Nref@0x25dded0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 N@0x26e4260)\n" - " (declare (in ) vec2 I@0x26e4370)\n" - " (declare (in ) vec2 Nref@0x26e4480)\n" + " (declare (in ) vec2 N@0x25de260)\n" + " (declare (in ) vec2 I@0x25de370)\n" + " (declare (in ) vec2 Nref@0x25de480)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 N@0x26e4660)\n" - " (declare (in ) vec3 I@0x26e4770)\n" - " (declare (in ) vec3 Nref@0x26e4880)\n" + " (declare (in ) vec3 N@0x25de660)\n" + " (declare (in ) vec3 I@0x25de770)\n" + " (declare (in ) vec3 Nref@0x25de880)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 N@0x26e4a60)\n" - " (declare (in ) vec4 I@0x26e4b70)\n" - " (declare (in ) vec4 Nref@0x26e4c80)\n" + " (declare (in ) vec4 N@0x25dea60)\n" + " (declare (in ) vec4 I@0x25deb70)\n" + " (declare (in ) vec4 Nref@0x25dec80)\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@0x26e4e60)\n" - " (declare (in ) float N@0x26e4f70)\n" + " (declare (in ) float I@0x25dee60)\n" + " (declare (in ) float N@0x25def70)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 I@0x26e52f0)\n" - " (declare (in ) vec2 N@0x26e5400)\n" + " (declare (in ) vec2 I@0x25df2f0)\n" + " (declare (in ) vec2 N@0x25df400)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 I@0x26e55e0)\n" - " (declare (in ) vec3 N@0x26e56f0)\n" + " (declare (in ) vec3 I@0x25df5e0)\n" + " (declare (in ) vec3 N@0x25df6f0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 I@0x26e58d0)\n" - " (declare (in ) vec4 N@0x26e59e0)\n" + " (declare (in ) vec4 I@0x25df8d0)\n" + " (declare (in ) vec4 N@0x25df9e0)\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@0x26e5bc0)\n" - " (declare (in ) float N@0x26e5cd0)\n" - " (declare (in ) float eta@0x26e5de0)\n" + " (declare (in ) float I@0x25dfbc0)\n" + " (declare (in ) float N@0x25dfcd0)\n" + " (declare (in ) float eta@0x25dfde0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 I@0x26e6160)\n" - " (declare (in ) vec2 N@0x26e6270)\n" - " (declare (in ) float eta@0x26e6380)\n" + " (declare (in ) vec2 I@0x25e0160)\n" + " (declare (in ) vec2 N@0x25e0270)\n" + " (declare (in ) float eta@0x25e0380)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 I@0x26e6560)\n" - " (declare (in ) vec3 N@0x26e6670)\n" - " (declare (in ) float eta@0x26e6780)\n" + " (declare (in ) vec3 I@0x25e0560)\n" + " (declare (in ) vec3 N@0x25e0670)\n" + " (declare (in ) float eta@0x25e0780)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 I@0x26e6960)\n" - " (declare (in ) vec4 N@0x26e6a70)\n" - " (declare (in ) float eta@0x26e6b80)\n" + " (declare (in ) vec4 I@0x25e0960)\n" + " (declare (in ) vec4 N@0x25e0a70)\n" + " (declare (in ) float eta@0x25e0b80)\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@0x26e6d60)\n" - " (declare (in ) mat2 y@0x26e6e70)\n" + " (declare (in ) mat2 x@0x25e0d60)\n" + " (declare (in ) mat2 y@0x25e0e70)\n" " )\n" " (\n" " ))\n" "\n" " (signature mat3\n" " (parameters\n" - " (declare (in ) mat3 x@0x26e7200)\n" - " (declare (in ) mat3 y@0x26e7310)\n" + " (declare (in ) mat3 x@0x25e1200)\n" + " (declare (in ) mat3 y@0x25e1310)\n" " )\n" " (\n" " ))\n" "\n" " (signature mat4\n" " (parameters\n" - " (declare (in ) mat4 x@0x26e74f0)\n" - " (declare (in ) mat4 y@0x26e7600)\n" + " (declare (in ) mat4 x@0x25e14f0)\n" + " (declare (in ) mat4 y@0x25e1600)\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@0x26e77e0)\n" - " (declare (in ) vec2 y@0x26e78f0)\n" + " (declare (in ) vec2 x@0x25e17e0)\n" + " (declare (in ) vec2 y@0x25e18f0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x26e7c80)\n" - " (declare (in ) vec3 y@0x26e7d90)\n" + " (declare (in ) vec3 x@0x25e1c80)\n" + " (declare (in ) vec3 y@0x25e1d90)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x26e7f70)\n" - " (declare (in ) vec4 y@0x26e8080)\n" + " (declare (in ) vec4 x@0x25e1f70)\n" + " (declare (in ) vec4 y@0x25e2080)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) ivec2 x@0x26e8260)\n" - " (declare (in ) ivec2 y@0x26e8370)\n" + " (declare (in ) ivec2 x@0x25e2260)\n" + " (declare (in ) ivec2 y@0x25e2370)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) ivec3 x@0x26e8550)\n" - " (declare (in ) ivec3 y@0x26e8660)\n" + " (declare (in ) ivec3 x@0x25e2550)\n" + " (declare (in ) ivec3 y@0x25e2660)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) ivec4 x@0x26e8840)\n" - " (declare (in ) ivec4 y@0x26e8950)\n" + " (declare (in ) ivec4 x@0x25e2840)\n" + " (declare (in ) ivec4 y@0x25e2950)\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@0x26e8b30)\n" - " (declare (in ) vec2 y@0x26e8c40)\n" + " (declare (in ) vec2 x@0x25e2b30)\n" + " (declare (in ) vec2 y@0x25e2c40)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x26e8fd0)\n" - " (declare (in ) vec3 y@0x26e90e0)\n" + " (declare (in ) vec3 x@0x25e2fd0)\n" + " (declare (in ) vec3 y@0x25e30e0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x26e92c0)\n" - " (declare (in ) vec4 y@0x26e93d0)\n" + " (declare (in ) vec4 x@0x25e32c0)\n" + " (declare (in ) vec4 y@0x25e33d0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) ivec2 x@0x26e95b0)\n" - " (declare (in ) ivec2 y@0x26e96c0)\n" + " (declare (in ) ivec2 x@0x25e35b0)\n" + " (declare (in ) ivec2 y@0x25e36c0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) ivec3 x@0x26e98a0)\n" - " (declare (in ) ivec3 y@0x26e99b0)\n" + " (declare (in ) ivec3 x@0x25e38a0)\n" + " (declare (in ) ivec3 y@0x25e39b0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) ivec4 x@0x26e9b90)\n" - " (declare (in ) ivec4 y@0x26e9ca0)\n" + " (declare (in ) ivec4 x@0x25e3b90)\n" + " (declare (in ) ivec4 y@0x25e3ca0)\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@0x26e9e80)\n" - " (declare (in ) vec2 y@0x26e9f90)\n" + " (declare (in ) vec2 x@0x25e3e80)\n" + " (declare (in ) vec2 y@0x25e3f90)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x26ea320)\n" - " (declare (in ) vec3 y@0x26ea430)\n" + " (declare (in ) vec3 x@0x25e4320)\n" + " (declare (in ) vec3 y@0x25e4430)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x26ea610)\n" - " (declare (in ) vec4 y@0x26ea720)\n" + " (declare (in ) vec4 x@0x25e4610)\n" + " (declare (in ) vec4 y@0x25e4720)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) ivec2 x@0x26ea900)\n" - " (declare (in ) ivec2 y@0x26eaa10)\n" + " (declare (in ) ivec2 x@0x25e4900)\n" + " (declare (in ) ivec2 y@0x25e4a10)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) ivec3 x@0x26eabf0)\n" - " (declare (in ) ivec3 y@0x26ead00)\n" + " (declare (in ) ivec3 x@0x25e4bf0)\n" + " (declare (in ) ivec3 y@0x25e4d00)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) ivec4 x@0x26eaee0)\n" - " (declare (in ) ivec4 y@0x26eaff0)\n" + " (declare (in ) ivec4 x@0x25e4ee0)\n" + " (declare (in ) ivec4 y@0x25e4ff0)\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@0x26eb1d0)\n" - " (declare (in ) vec2 y@0x26eb2e0)\n" + " (declare (in ) vec2 x@0x25e51d0)\n" + " (declare (in ) vec2 y@0x25e52e0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x26eb670)\n" - " (declare (in ) vec3 y@0x26eb780)\n" + " (declare (in ) vec3 x@0x25e5670)\n" + " (declare (in ) vec3 y@0x25e5780)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x26eb960)\n" - " (declare (in ) vec4 y@0x26eba70)\n" + " (declare (in ) vec4 x@0x25e5960)\n" + " (declare (in ) vec4 y@0x25e5a70)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) ivec2 x@0x26ebc50)\n" - " (declare (in ) ivec2 y@0x26ebd60)\n" + " (declare (in ) ivec2 x@0x25e5c50)\n" + " (declare (in ) ivec2 y@0x25e5d60)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) ivec3 x@0x26ebf40)\n" - " (declare (in ) ivec3 y@0x26ec050)\n" + " (declare (in ) ivec3 x@0x25e5f40)\n" + " (declare (in ) ivec3 y@0x25e6050)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) ivec4 x@0x26ec230)\n" - " (declare (in ) ivec4 y@0x26ec340)\n" + " (declare (in ) ivec4 x@0x25e6230)\n" + " (declare (in ) ivec4 y@0x25e6340)\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@0x26ec520)\n" - " (declare (in ) vec2 y@0x26ec630)\n" + " (declare (in ) vec2 x@0x25e6520)\n" + " (declare (in ) vec2 y@0x25e6630)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x26ec9b0)\n" - " (declare (in ) vec3 y@0x26ecac0)\n" + " (declare (in ) vec3 x@0x25e69b0)\n" + " (declare (in ) vec3 y@0x25e6ac0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x26ecca0)\n" - " (declare (in ) vec4 y@0x26ecdb0)\n" + " (declare (in ) vec4 x@0x25e6ca0)\n" + " (declare (in ) vec4 y@0x25e6db0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) ivec2 x@0x26ecf90)\n" - " (declare (in ) ivec2 y@0x26ed0a0)\n" + " (declare (in ) ivec2 x@0x25e6f90)\n" + " (declare (in ) ivec2 y@0x25e70a0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) ivec3 x@0x26ed280)\n" - " (declare (in ) ivec3 y@0x26ed390)\n" + " (declare (in ) ivec3 x@0x25e7280)\n" + " (declare (in ) ivec3 y@0x25e7390)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) ivec4 x@0x26ed570)\n" - " (declare (in ) ivec4 y@0x26ed680)\n" + " (declare (in ) ivec4 x@0x25e7570)\n" + " (declare (in ) ivec4 y@0x25e7680)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) bvec2 x@0x26ed860)\n" - " (declare (in ) bvec2 y@0x26ed970)\n" + " (declare (in ) bvec2 x@0x25e7860)\n" + " (declare (in ) bvec2 y@0x25e7970)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) bvec3 x@0x26edb50)\n" - " (declare (in ) bvec3 y@0x26edc60)\n" + " (declare (in ) bvec3 x@0x25e7b50)\n" + " (declare (in ) bvec3 y@0x25e7c60)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) bvec4 x@0x26ede40)\n" - " (declare (in ) bvec4 y@0x26edf50)\n" + " (declare (in ) bvec4 x@0x25e7e40)\n" + " (declare (in ) bvec4 y@0x25e7f50)\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@0x26ee130)\n" - " (declare (in ) vec2 y@0x26ee240)\n" + " (declare (in ) vec2 x@0x25e8130)\n" + " (declare (in ) vec2 y@0x25e8240)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x26ee5d0)\n" - " (declare (in ) vec3 y@0x26ee6e0)\n" + " (declare (in ) vec3 x@0x25e85d0)\n" + " (declare (in ) vec3 y@0x25e86e0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x26ee8c0)\n" - " (declare (in ) vec4 y@0x26ee9d0)\n" + " (declare (in ) vec4 x@0x25e88c0)\n" + " (declare (in ) vec4 y@0x25e89d0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) ivec2 x@0x26eebb0)\n" - " (declare (in ) ivec2 y@0x26eecc0)\n" + " (declare (in ) ivec2 x@0x25e8bb0)\n" + " (declare (in ) ivec2 y@0x25e8cc0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) ivec3 x@0x26eeea0)\n" - " (declare (in ) ivec3 y@0x26eefb0)\n" + " (declare (in ) ivec3 x@0x25e8ea0)\n" + " (declare (in ) ivec3 y@0x25e8fb0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) ivec4 x@0x26ef190)\n" - " (declare (in ) ivec4 y@0x26ef2a0)\n" + " (declare (in ) ivec4 x@0x25e9190)\n" + " (declare (in ) ivec4 y@0x25e92a0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) bvec2 x@0x26ef480)\n" - " (declare (in ) bvec2 y@0x26ef590)\n" + " (declare (in ) bvec2 x@0x25e9480)\n" + " (declare (in ) bvec2 y@0x25e9590)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) bvec3 x@0x26ef770)\n" - " (declare (in ) bvec3 y@0x26ef880)\n" + " (declare (in ) bvec3 x@0x25e9770)\n" + " (declare (in ) bvec3 y@0x25e9880)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) bvec4 x@0x26efa60)\n" - " (declare (in ) bvec4 y@0x26efb70)\n" + " (declare (in ) bvec4 x@0x25e9a60)\n" + " (declare (in ) bvec4 y@0x25e9b70)\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@0x26efd50)\n" + " (declare (in ) bvec2 x@0x25e9d50)\n" " )\n" " (\n" " ))\n" "\n" " (signature bool\n" " (parameters\n" - " (declare (in ) bvec3 x@0x26f00d0)\n" + " (declare (in ) bvec3 x@0x25ea0d0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bool\n" " (parameters\n" - " (declare (in ) bvec4 x@0x26f02b0)\n" + " (declare (in ) bvec4 x@0x25ea2b0)\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@0x26f0490)\n" + " (declare (in ) bvec2 x@0x25ea490)\n" " )\n" " (\n" " ))\n" "\n" " (signature bool\n" " (parameters\n" - " (declare (in ) bvec3 x@0x26f0810)\n" + " (declare (in ) bvec3 x@0x25ea810)\n" " )\n" " (\n" " ))\n" "\n" " (signature bool\n" " (parameters\n" - " (declare (in ) bvec4 x@0x26f09f0)\n" + " (declare (in ) bvec4 x@0x25ea9f0)\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@0x26f0bd0)\n" + " (declare (in ) bvec2 x@0x25eabd0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) bvec3 x@0x26f0f50)\n" + " (declare (in ) bvec3 x@0x25eaf50)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) bvec4 x@0x26f1130)\n" + " (declare (in ) bvec4 x@0x25eb130)\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@0x26f1310)\n" - " (declare (in ) float coord@0x26f1420)\n" + " (declare (in ) sampler1D sampler@0x25eb310)\n" + " (declare (in ) float coord@0x25eb420)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1D sampler@0x26f1f40)\n" - " (declare (in ) float coord@0x26f2050)\n" - " (declare (in ) float bias@0x26f2160)\n" + " (declare (in ) sampler1D sampler@0x25ebf40)\n" + " (declare (in ) float coord@0x25ec050)\n" + " (declare (in ) float bias@0x25ec160)\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@0x26f17b0)\n" - " (declare (in ) vec2 coord@0x26f18c0)\n" + " (declare (in ) sampler1D sampler@0x25eb7b0)\n" + " (declare (in ) vec2 coord@0x25eb8c0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1D sampler@0x26f1c50)\n" - " (declare (in ) vec4 coord@0x26f1d60)\n" + " (declare (in ) sampler1D sampler@0x25ebc50)\n" + " (declare (in ) vec4 coord@0x25ebd60)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1D sampler@0x26f2340)\n" - " (declare (in ) vec2 coord@0x26f2450)\n" - " (declare (in ) float bias@0x26f2560)\n" + " (declare (in ) sampler1D sampler@0x25ec340)\n" + " (declare (in ) vec2 coord@0x25ec450)\n" + " (declare (in ) float bias@0x25ec560)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1D sampler@0x26f2740)\n" - " (declare (in ) vec4 coord@0x26f2850)\n" - " (declare (in ) float bias@0x26f2960)\n" + " (declare (in ) sampler1D sampler@0x25ec740)\n" + " (declare (in ) vec4 coord@0x25ec850)\n" + " (declare (in ) float bias@0x25ec960)\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@0x26f2b40)\n" - " (declare (in ) vec2 coord@0x26f2c50)\n" + " (declare (in ) sampler2D sampler@0x25ecb40)\n" + " (declare (in ) vec2 coord@0x25ecc50)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2D sampler@0x26f3770)\n" - " (declare (in ) vec2 coord@0x26f3880)\n" - " (declare (in ) float bias@0x26f3990)\n" + " (declare (in ) sampler2D sampler@0x25ed770)\n" + " (declare (in ) vec2 coord@0x25ed880)\n" + " (declare (in ) float bias@0x25ed990)\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@0x26f2fe0)\n" - " (declare (in ) vec3 coord@0x26f30f0)\n" + " (declare (in ) sampler2D sampler@0x25ecfe0)\n" + " (declare (in ) vec3 coord@0x25ed0f0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2D sampler@0x26f3480)\n" - " (declare (in ) vec4 coord@0x26f3590)\n" + " (declare (in ) sampler2D sampler@0x25ed480)\n" + " (declare (in ) vec4 coord@0x25ed590)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2D sampler@0x26f3b70)\n" - " (declare (in ) vec3 coord@0x26f3c80)\n" - " (declare (in ) float bias@0x26f3d90)\n" + " (declare (in ) sampler2D sampler@0x25edb70)\n" + " (declare (in ) vec3 coord@0x25edc80)\n" + " (declare (in ) float bias@0x25edd90)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2D sampler@0x26f3f70)\n" - " (declare (in ) vec4 coord@0x26f4080)\n" - " (declare (in ) float bias@0x26f4190)\n" + " (declare (in ) sampler2D sampler@0x25edf70)\n" + " (declare (in ) vec4 coord@0x25ee080)\n" + " (declare (in ) float bias@0x25ee190)\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@0x26f4370)\n" - " (declare (in ) vec3 coord@0x26f4480)\n" + " (declare (in ) sampler3D sampler@0x25ee370)\n" + " (declare (in ) vec3 coord@0x25ee480)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler3D sampler@0x26f4cb0)\n" - " (declare (in ) vec3 coord@0x26f4dc0)\n" - " (declare (in ) float bias@0x26f4ed0)\n" + " (declare (in ) sampler3D sampler@0x25eecb0)\n" + " (declare (in ) vec3 coord@0x25eedc0)\n" + " (declare (in ) float bias@0x25eeed0)\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@0x26f4810)\n" - " (declare (in ) vec4 coord@0x26f4920)\n" + " (declare (in ) sampler3D sampler@0x25ee810)\n" + " (declare (in ) vec4 coord@0x25ee920)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler3D sampler@0x26f50b0)\n" - " (declare (in ) vec4 coord@0x26f51c0)\n" - " (declare (in ) float bias@0x26f52d0)\n" + " (declare (in ) sampler3D sampler@0x25ef0b0)\n" + " (declare (in ) vec4 coord@0x25ef1c0)\n" + " (declare (in ) float bias@0x25ef2d0)\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@0x26f54b0)\n" - " (declare (in ) vec3 coord@0x26f55c0)\n" + " (declare (in ) samplerCube sampler@0x25ef4b0)\n" + " (declare (in ) vec3 coord@0x25ef5c0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) samplerCube sampler@0x26f5950)\n" - " (declare (in ) vec3 coord@0x26f5a60)\n" - " (declare (in ) float bias@0x26f5b70)\n" + " (declare (in ) samplerCube sampler@0x25ef950)\n" + " (declare (in ) vec3 coord@0x25efa60)\n" + " (declare (in ) float bias@0x25efb70)\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@0x26f5d50)\n" - " (declare (in ) vec3 coord@0x26f5e60)\n" + " (declare (in ) sampler1DShadow sampler@0x25efd50)\n" + " (declare (in ) vec3 coord@0x25efe60)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1DShadow sampler@0x26f6fd0)\n" - " (declare (in ) vec3 coord@0x26f70e0)\n" - " (declare (in ) float bias@0x26f71f0)\n" + " (declare (in ) sampler1DShadow sampler@0x25f0fd0)\n" + " (declare (in ) vec3 coord@0x25f10e0)\n" + " (declare (in ) float bias@0x25f11f0)\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@0x26f61f0)\n" - " (declare (in ) vec3 coord@0x26f6300)\n" + " (declare (in ) sampler2DShadow sampler@0x25f01f0)\n" + " (declare (in ) vec3 coord@0x25f0300)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2DShadow sampler@0x26f73d0)\n" - " (declare (in ) vec3 coord@0x26f74e0)\n" - " (declare (in ) float bias@0x26f75f0)\n" + " (declare (in ) sampler2DShadow sampler@0x25f13d0)\n" + " (declare (in ) vec3 coord@0x25f14e0)\n" + " (declare (in ) float bias@0x25f15f0)\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@0x26f6690)\n" - " (declare (in ) vec4 coord@0x26f67a0)\n" + " (declare (in ) sampler1DShadow sampler@0x25f0690)\n" + " (declare (in ) vec4 coord@0x25f07a0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1DShadow sampler@0x26f77d0)\n" - " (declare (in ) vec4 coord@0x26f78e0)\n" - " (declare (in ) float bias@0x26f79f0)\n" + " (declare (in ) sampler1DShadow sampler@0x25f17d0)\n" + " (declare (in ) vec4 coord@0x25f18e0)\n" + " (declare (in ) float bias@0x25f19f0)\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@0x26f6b30)\n" - " (declare (in ) vec4 coord@0x26f6c40)\n" + " (declare (in ) sampler2DShadow sampler@0x25f0b30)\n" + " (declare (in ) vec4 coord@0x25f0c40)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2DShadow sampler@0x26f7bd0)\n" - " (declare (in ) vec4 coord@0x26f7ce0)\n" - " (declare (in ) float bias@0x26f7df0)\n" + " (declare (in ) sampler2DShadow sampler@0x25f1bd0)\n" + " (declare (in ) vec4 coord@0x25f1ce0)\n" + " (declare (in ) float bias@0x25f1df0)\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@0x26f7fd0)\n" + " (declare (in ) float p@0x25f1fd0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 p@0x26f8350)\n" + " (declare (in ) vec2 p@0x25f2350)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 p@0x26f8530)\n" + " (declare (in ) vec3 p@0x25f2530)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 p@0x26f8710)\n" + " (declare (in ) vec4 p@0x25f2710)\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@0x26f88f0)\n" + " (declare (in ) float p@0x25f28f0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 p@0x26f8c70)\n" + " (declare (in ) vec2 p@0x25f2c70)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 p@0x26f8e50)\n" + " (declare (in ) vec3 p@0x25f2e50)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 p@0x26f9030)\n" + " (declare (in ) vec4 p@0x25f3030)\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@0x26f9210)\n" + " (declare (in ) float p@0x25f3210)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 p@0x26f9590)\n" + " (declare (in ) vec2 p@0x25f3590)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 p@0x26f9770)\n" + " (declare (in ) vec3 p@0x25f3770)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 p@0x26f9950)\n" + " (declare (in ) vec4 p@0x25f3950)\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@0x26f9b30)\n" + " (declare (in ) float x@0x25f3b30)\n" " )\n" " (\n" " ))\n" "\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec2 x@0x26f9eb0)\n" + " (declare (in ) vec2 x@0x25f3eb0)\n" " )\n" " (\n" " ))\n" "\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec3 x@0x26fa090)\n" + " (declare (in ) vec3 x@0x25f4090)\n" " )\n" " (\n" " ))\n" "\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec4 x@0x26fa270)\n" + " (declare (in ) vec4 x@0x25f4270)\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@0x26fa450)\n" + " (declare (in ) float x@0x25f4450)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x26fa7d0)\n" + " (declare (in ) vec2 x@0x25f47d0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec3 x@0x26fa9b0)\n" + " (declare (in ) vec3 x@0x25f49b0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec4 x@0x26fab90)\n" + " (declare (in ) vec4 x@0x25f4b90)\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@0x26fad70)\n" + " (declare (in ) float x@0x25f4d70)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec2 x@0x26fb0f0)\n" + " (declare (in ) vec2 x@0x25f50f0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x26fb2d0)\n" + " (declare (in ) vec3 x@0x25f52d0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec4 x@0x26fb4b0)\n" + " (declare (in ) vec4 x@0x25f54b0)\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@0x26fb690)\n" + " (declare (in ) float x@0x25f5690)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec2 x@0x26fba10)\n" + " (declare (in ) vec2 x@0x25f5a10)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec3 x@0x26fbbf0)\n" + " (declare (in ) vec3 x@0x25f5bf0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x26fbdd0)\n" + " (declare (in ) vec4 x@0x25f5dd0)\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@0x2378290)\n" - " (declare (in ) vec2 coord@0x23783a0)\n" + " (declare (in ) sampler1DArray sampler@0x1bf6290)\n" + " (declare (in ) vec2 coord@0x1bf63a0)\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@0x2378730)\n" - " (declare (in ) vec2 coord@0x2378840)\n" - " (declare (in ) float lod@0x2378950)\n" + " (declare (in ) sampler1DArray sampler@0x1bf6730)\n" + " (declare (in ) vec2 coord@0x1bf6840)\n" + " (declare (in ) float lod@0x1bf6950)\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@0x2378ce0)\n" - " (declare (in ) vec2 coord@0x2378df0)\n" + " (declare (in ) sampler2DArray sampler@0x1bf6ce0)\n" + " (declare (in ) vec3 coord@0x1bf6df0)\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@0x2379180)\n" - " (declare (in ) vec2 coord@0x2379290)\n" - " (declare (in ) float lod@0x23793a0)\n" + " (declare (in ) sampler2DArray sampler@0x1bf7180)\n" + " (declare (in ) vec3 coord@0x1bf7290)\n" + " (declare (in ) float lod@0x1bf73a0)\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@0x2379730)\n" - " (declare (in ) vec3 coord@0x2379840)\n" + " (declare (in ) sampler1DArrayShadow sampler@0x1bf7730)\n" + " (declare (in ) vec3 coord@0x1bf7840)\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@0x2379bd0)\n" - " (declare (in ) vec3 coord@0x2379ce0)\n" - " (declare (in ) float lod@0x2379df0)\n" + " (declare (in ) sampler1DArrayShadow sampler@0x1bf7bd0)\n" + " (declare (in ) vec3 coord@0x1bf7ce0)\n" + " (declare (in ) float lod@0x1bf7df0)\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@0x237a180)\n" - " (declare (in ) vec4 coord@0x237a290)\n" + " (declare (in ) sampler2DArrayShadow sampler@0x1bf8180)\n" + " (declare (in ) vec4 coord@0x1bf8290)\n" " )\n" " (\n" " ))\n" @@ -12021,28 +12021,28 @@ static const char *prototypes_for_130_frag = "(function radians\n" " (signature float\n" " (parameters\n" - " (declare (in ) float degrees@0x141d070)\n" + " (declare (in ) float degrees@0x15ce070)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 degrees@0x141d3f0)\n" + " (declare (in ) vec2 degrees@0x15ce3f0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 degrees@0x141d5d0)\n" + " (declare (in ) vec3 degrees@0x15ce5d0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 degrees@0x141d7b0)\n" + " (declare (in ) vec4 degrees@0x15ce7b0)\n" " )\n" " (\n" " ))\n" @@ -12052,28 +12052,28 @@ static const char *prototypes_for_130_frag = "(function degrees\n" " (signature float\n" " (parameters\n" - " (declare (in ) float radians@0x141d990)\n" + " (declare (in ) float radians@0x15ce990)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 radians@0x141dd10)\n" + " (declare (in ) vec2 radians@0x15ced10)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 radians@0x141def0)\n" + " (declare (in ) vec3 radians@0x15ceef0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 radians@0x141e0d0)\n" + " (declare (in ) vec4 radians@0x15cf0d0)\n" " )\n" " (\n" " ))\n" @@ -12083,28 +12083,28 @@ static const char *prototypes_for_130_frag = "(function sin\n" " (signature float\n" " (parameters\n" - " (declare (in ) float angle@0x141e2b0)\n" + " (declare (in ) float angle@0x15cf2b0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 angle@0x141e630)\n" + " (declare (in ) vec2 angle@0x15cf630)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 angle@0x141e810)\n" + " (declare (in ) vec3 angle@0x15cf810)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 angle@0x141e9f0)\n" + " (declare (in ) vec4 angle@0x15cf9f0)\n" " )\n" " (\n" " ))\n" @@ -12114,28 +12114,28 @@ static const char *prototypes_for_130_frag = "(function cos\n" " (signature float\n" " (parameters\n" - " (declare (in ) float angle@0x141ebd0)\n" + " (declare (in ) float angle@0x15cfbd0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 angle@0x141ef50)\n" + " (declare (in ) vec2 angle@0x15cff50)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 angle@0x141f130)\n" + " (declare (in ) vec3 angle@0x15d0130)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 angle@0x141f310)\n" + " (declare (in ) vec4 angle@0x15d0310)\n" " )\n" " (\n" " ))\n" @@ -12145,28 +12145,28 @@ static const char *prototypes_for_130_frag = "(function tan\n" " (signature float\n" " (parameters\n" - " (declare (in ) float angle@0x141f4f0)\n" + " (declare (in ) float angle@0x15d04f0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 angle@0x141f870)\n" + " (declare (in ) vec2 angle@0x15d0870)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 angle@0x141fa50)\n" + " (declare (in ) vec3 angle@0x15d0a50)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 angle@0x141fc30)\n" + " (declare (in ) vec4 angle@0x15d0c30)\n" " )\n" " (\n" " ))\n" @@ -12176,28 +12176,28 @@ static const char *prototypes_for_130_frag = "(function asin\n" " (signature float\n" " (parameters\n" - " (declare (in ) float angle@0x141fe10)\n" + " (declare (in ) float angle@0x15d0e10)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 angle@0x1420190)\n" + " (declare (in ) vec2 angle@0x15d1190)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 angle@0x1420370)\n" + " (declare (in ) vec3 angle@0x15d1370)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 angle@0x1420550)\n" + " (declare (in ) vec4 angle@0x15d1550)\n" " )\n" " (\n" " ))\n" @@ -12207,28 +12207,28 @@ static const char *prototypes_for_130_frag = "(function acos\n" " (signature float\n" " (parameters\n" - " (declare (in ) float angle@0x1420730)\n" + " (declare (in ) float angle@0x15d1730)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 angle@0x1420ab0)\n" + " (declare (in ) vec2 angle@0x15d1ab0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 angle@0x1420c90)\n" + " (declare (in ) vec3 angle@0x15d1c90)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 angle@0x1420e70)\n" + " (declare (in ) vec4 angle@0x15d1e70)\n" " )\n" " (\n" " ))\n" @@ -12238,60 +12238,60 @@ static const char *prototypes_for_130_frag = "(function atan\n" " (signature float\n" " (parameters\n" - " (declare (in ) float y@0x1421050)\n" - " (declare (in ) float x@0x1421160)\n" + " (declare (in ) float y@0x15d2050)\n" + " (declare (in ) float x@0x15d2160)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 y@0x14214e0)\n" - " (declare (in ) vec2 x@0x14215f0)\n" + " (declare (in ) vec2 y@0x15d24e0)\n" + " (declare (in ) vec2 x@0x15d25f0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 y@0x14217d0)\n" - " (declare (in ) vec3 x@0x14218e0)\n" + " (declare (in ) vec3 y@0x15d27d0)\n" + " (declare (in ) vec3 x@0x15d28e0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 y@0x1421ac0)\n" - " (declare (in ) vec4 x@0x1421bd0)\n" + " (declare (in ) vec4 y@0x15d2ac0)\n" + " (declare (in ) vec4 x@0x15d2bd0)\n" " )\n" " (\n" " ))\n" "\n" " (signature float\n" " (parameters\n" - " (declare (in ) float y_over_x@0x1421db0)\n" + " (declare (in ) float y_over_x@0x15d2db0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 y_over_x@0x1421fa0)\n" + " (declare (in ) vec2 y_over_x@0x15d2fa0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 y_over_x@0x1422190)\n" + " (declare (in ) vec3 y_over_x@0x15d3190)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 y_over_x@0x1422380)\n" + " (declare (in ) vec4 y_over_x@0x15d3380)\n" " )\n" " (\n" " ))\n" @@ -12301,32 +12301,32 @@ static const char *prototypes_for_130_frag = "(function pow\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x1422570)\n" - " (declare (in ) float y@0x1422680)\n" + " (declare (in ) float x@0x15d3570)\n" + " (declare (in ) float y@0x15d3680)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x1422a00)\n" - " (declare (in ) vec2 y@0x1422b10)\n" + " (declare (in ) vec2 x@0x15d3a00)\n" + " (declare (in ) vec2 y@0x15d3b10)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x1422cf0)\n" - " (declare (in ) vec3 y@0x1422e00)\n" + " (declare (in ) vec3 x@0x15d3cf0)\n" + " (declare (in ) vec3 y@0x15d3e00)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x1422fe0)\n" - " (declare (in ) vec4 y@0x14230f0)\n" + " (declare (in ) vec4 x@0x15d3fe0)\n" + " (declare (in ) vec4 y@0x15d40f0)\n" " )\n" " (\n" " ))\n" @@ -12336,28 +12336,28 @@ static const char *prototypes_for_130_frag = "(function exp\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x14232d0)\n" + " (declare (in ) float x@0x15d42d0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x1423650)\n" + " (declare (in ) vec2 x@0x15d4650)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x1423830)\n" + " (declare (in ) vec3 x@0x15d4830)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x1423a10)\n" + " (declare (in ) vec4 x@0x15d4a10)\n" " )\n" " (\n" " ))\n" @@ -12367,28 +12367,28 @@ static const char *prototypes_for_130_frag = "(function log\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x1423bf0)\n" + " (declare (in ) float x@0x15d4bf0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x1423f70)\n" + " (declare (in ) vec2 x@0x15d4f70)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x1424150)\n" + " (declare (in ) vec3 x@0x15d5150)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x1424330)\n" + " (declare (in ) vec4 x@0x15d5330)\n" " )\n" " (\n" " ))\n" @@ -12398,28 +12398,28 @@ static const char *prototypes_for_130_frag = "(function exp2\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x1424510)\n" + " (declare (in ) float x@0x15d5510)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x1424890)\n" + " (declare (in ) vec2 x@0x15d5890)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x1424a70)\n" + " (declare (in ) vec3 x@0x15d5a70)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x1424c50)\n" + " (declare (in ) vec4 x@0x15d5c50)\n" " )\n" " (\n" " ))\n" @@ -12429,28 +12429,28 @@ static const char *prototypes_for_130_frag = "(function log2\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x1424e30)\n" + " (declare (in ) float x@0x15d5e30)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x14251b0)\n" + " (declare (in ) vec2 x@0x15d61b0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x1425390)\n" + " (declare (in ) vec3 x@0x15d6390)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x1425570)\n" + " (declare (in ) vec4 x@0x15d6570)\n" " )\n" " (\n" " ))\n" @@ -12460,28 +12460,28 @@ static const char *prototypes_for_130_frag = "(function sqrt\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x1425750)\n" + " (declare (in ) float x@0x15d6750)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x1425ad0)\n" + " (declare (in ) vec2 x@0x15d6ad0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x1425cb0)\n" + " (declare (in ) vec3 x@0x15d6cb0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x1425e90)\n" + " (declare (in ) vec4 x@0x15d6e90)\n" " )\n" " (\n" " ))\n" @@ -12491,28 +12491,28 @@ static const char *prototypes_for_130_frag = "(function inversesqrt\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x1426070)\n" + " (declare (in ) float x@0x15d7070)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x1426400)\n" + " (declare (in ) vec2 x@0x15d7400)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x14265e0)\n" + " (declare (in ) vec3 x@0x15d75e0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x14267c0)\n" + " (declare (in ) vec4 x@0x15d77c0)\n" " )\n" " (\n" " ))\n" @@ -12522,56 +12522,56 @@ static const char *prototypes_for_130_frag = "(function abs\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x14269a0)\n" + " (declare (in ) float x@0x15d79a0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x1426d20)\n" + " (declare (in ) vec2 x@0x15d7d20)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x1426f00)\n" + " (declare (in ) vec3 x@0x15d7f00)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x14270e0)\n" + " (declare (in ) vec4 x@0x15d80e0)\n" " )\n" " (\n" " ))\n" "\n" " (signature int\n" " (parameters\n" - " (declare (in ) int x@0x14272c0)\n" + " (declare (in ) int x@0x15d82c0)\n" " )\n" " (\n" " ))\n" "\n" " (signature ivec2\n" " (parameters\n" - " (declare (in ) ivec2 x@0x14274a0)\n" + " (declare (in ) ivec2 x@0x15d84a0)\n" " )\n" " (\n" " ))\n" "\n" " (signature ivec3\n" " (parameters\n" - " (declare (in ) ivec3 x@0x1427680)\n" + " (declare (in ) ivec3 x@0x15d8680)\n" " )\n" " (\n" " ))\n" "\n" " (signature ivec4\n" " (parameters\n" - " (declare (in ) ivec4 x@0x1427860)\n" + " (declare (in ) ivec4 x@0x15d8860)\n" " )\n" " (\n" " ))\n" @@ -12581,56 +12581,56 @@ static const char *prototypes_for_130_frag = "(function sign\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x1427a40)\n" + " (declare (in ) float x@0x15d8a40)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x1427dc0)\n" + " (declare (in ) vec2 x@0x15d8dc0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x1427fa0)\n" + " (declare (in ) vec3 x@0x15d8fa0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x1428180)\n" + " (declare (in ) vec4 x@0x15d9180)\n" " )\n" " (\n" " ))\n" "\n" " (signature int\n" " (parameters\n" - " (declare (in ) int x@0x1428360)\n" + " (declare (in ) int x@0x15d9360)\n" " )\n" " (\n" " ))\n" "\n" " (signature ivec2\n" " (parameters\n" - " (declare (in ) ivec2 x@0x1428540)\n" + " (declare (in ) ivec2 x@0x15d9540)\n" " )\n" " (\n" " ))\n" "\n" " (signature ivec3\n" " (parameters\n" - " (declare (in ) ivec3 x@0x1428720)\n" + " (declare (in ) ivec3 x@0x15d9720)\n" " )\n" " (\n" " ))\n" "\n" " (signature ivec4\n" " (parameters\n" - " (declare (in ) ivec4 x@0x1428900)\n" + " (declare (in ) ivec4 x@0x15d9900)\n" " )\n" " (\n" " ))\n" @@ -12640,28 +12640,28 @@ static const char *prototypes_for_130_frag = "(function floor\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x1428ae0)\n" + " (declare (in ) float x@0x15d9ae0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x1428e60)\n" + " (declare (in ) vec2 x@0x15d9e60)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x1429040)\n" + " (declare (in ) vec3 x@0x15da040)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x1429220)\n" + " (declare (in ) vec4 x@0x15da220)\n" " )\n" " (\n" " ))\n" @@ -12671,28 +12671,28 @@ static const char *prototypes_for_130_frag = "(function ceil\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x1429400)\n" + " (declare (in ) float x@0x15da400)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x1429780)\n" + " (declare (in ) vec2 x@0x15da780)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x1429960)\n" + " (declare (in ) vec3 x@0x15da960)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x1429b40)\n" + " (declare (in ) vec4 x@0x15dab40)\n" " )\n" " (\n" " ))\n" @@ -12702,28 +12702,28 @@ static const char *prototypes_for_130_frag = "(function fract\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x1429d20)\n" + " (declare (in ) float x@0x15dad20)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x142a0a0)\n" + " (declare (in ) vec2 x@0x15db0a0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x142a280)\n" + " (declare (in ) vec3 x@0x15db280)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x142a460)\n" + " (declare (in ) vec4 x@0x15db460)\n" " )\n" " (\n" " ))\n" @@ -12733,56 +12733,56 @@ static const char *prototypes_for_130_frag = "(function mod\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x142a640)\n" - " (declare (in ) float y@0x142a750)\n" + " (declare (in ) float x@0x15db640)\n" + " (declare (in ) float y@0x15db750)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x142aad0)\n" - " (declare (in ) float y@0x142abe0)\n" + " (declare (in ) vec2 x@0x15dbad0)\n" + " (declare (in ) float y@0x15dbbe0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x142adc0)\n" - " (declare (in ) float y@0x142aed0)\n" + " (declare (in ) vec3 x@0x15dbdc0)\n" + " (declare (in ) float y@0x15dbed0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x142b0b0)\n" - " (declare (in ) float y@0x142b1c0)\n" + " (declare (in ) vec4 x@0x15dc0b0)\n" + " (declare (in ) float y@0x15dc1c0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x142b3a0)\n" - " (declare (in ) vec2 y@0x142b4b0)\n" + " (declare (in ) vec2 x@0x15dc3a0)\n" + " (declare (in ) vec2 y@0x15dc4b0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x142b690)\n" - " (declare (in ) vec3 y@0x142b7a0)\n" + " (declare (in ) vec3 x@0x15dc690)\n" + " (declare (in ) vec3 y@0x15dc7a0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x142b980)\n" - " (declare (in ) vec4 y@0x142ba90)\n" + " (declare (in ) vec4 x@0x15dc980)\n" + " (declare (in ) vec4 y@0x15dca90)\n" " )\n" " (\n" " ))\n" @@ -12792,168 +12792,168 @@ static const char *prototypes_for_130_frag = "(function min\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x142bc70)\n" - " (declare (in ) float y@0x142bd80)\n" + " (declare (in ) float x@0x15dcc70)\n" + " (declare (in ) float y@0x15dcd80)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x142c100)\n" - " (declare (in ) vec2 y@0x142c210)\n" + " (declare (in ) vec2 x@0x15dd100)\n" + " (declare (in ) vec2 y@0x15dd210)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x142c3f0)\n" - " (declare (in ) vec3 y@0x142c500)\n" + " (declare (in ) vec3 x@0x15dd3f0)\n" + " (declare (in ) vec3 y@0x15dd500)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x142c6e0)\n" - " (declare (in ) vec4 y@0x142c7f0)\n" + " (declare (in ) vec4 x@0x15dd6e0)\n" + " (declare (in ) vec4 y@0x15dd7f0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x142c9d0)\n" - " (declare (in ) float y@0x142cae0)\n" + " (declare (in ) vec2 x@0x15dd9d0)\n" + " (declare (in ) float y@0x15ddae0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x142ccc0)\n" - " (declare (in ) float y@0x142cdd0)\n" + " (declare (in ) vec3 x@0x15ddcc0)\n" + " (declare (in ) float y@0x15dddd0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x142cfb0)\n" - " (declare (in ) float y@0x142d0c0)\n" + " (declare (in ) vec4 x@0x15ddfb0)\n" + " (declare (in ) float y@0x15de0c0)\n" " )\n" " (\n" " ))\n" "\n" " (signature int\n" " (parameters\n" - " (declare (in ) int x@0x142d2a0)\n" - " (declare (in ) int y@0x142d3b0)\n" + " (declare (in ) int x@0x15de2a0)\n" + " (declare (in ) int y@0x15de3b0)\n" " )\n" " (\n" " ))\n" "\n" " (signature ivec2\n" " (parameters\n" - " (declare (in ) ivec2 x@0x142d590)\n" - " (declare (in ) ivec2 y@0x142d6a0)\n" + " (declare (in ) ivec2 x@0x15de590)\n" + " (declare (in ) ivec2 y@0x15de6a0)\n" " )\n" " (\n" " ))\n" "\n" " (signature ivec3\n" " (parameters\n" - " (declare (in ) ivec3 x@0x142d880)\n" - " (declare (in ) ivec3 y@0x142d990)\n" + " (declare (in ) ivec3 x@0x15de880)\n" + " (declare (in ) ivec3 y@0x15de990)\n" " )\n" " (\n" " ))\n" "\n" " (signature ivec4\n" " (parameters\n" - " (declare (in ) ivec4 x@0x142db70)\n" - " (declare (in ) ivec4 y@0x142dc80)\n" + " (declare (in ) ivec4 x@0x15deb70)\n" + " (declare (in ) ivec4 y@0x15dec80)\n" " )\n" " (\n" " ))\n" "\n" " (signature ivec2\n" " (parameters\n" - " (declare (in ) ivec2 x@0x142de60)\n" - " (declare (in ) int y@0x142df70)\n" + " (declare (in ) ivec2 x@0x15dee60)\n" + " (declare (in ) int y@0x15def70)\n" " )\n" " (\n" " ))\n" "\n" " (signature ivec3\n" " (parameters\n" - " (declare (in ) ivec3 x@0x142e150)\n" - " (declare (in ) int y@0x142e260)\n" + " (declare (in ) ivec3 x@0x15df150)\n" + " (declare (in ) int y@0x15df260)\n" " )\n" " (\n" " ))\n" "\n" " (signature ivec4\n" " (parameters\n" - " (declare (in ) ivec4 x@0x142e440)\n" - " (declare (in ) int y@0x142e550)\n" + " (declare (in ) ivec4 x@0x15df440)\n" + " (declare (in ) int y@0x15df550)\n" " )\n" " (\n" " ))\n" "\n" " (signature uint\n" " (parameters\n" - " (declare (in ) uint x@0x142e730)\n" - " (declare (in ) uint y@0x142e840)\n" + " (declare (in ) uint x@0x15df730)\n" + " (declare (in ) uint y@0x15df840)\n" " )\n" " (\n" " ))\n" "\n" " (signature uvec2\n" " (parameters\n" - " (declare (in ) uvec2 x@0x142ea20)\n" - " (declare (in ) uvec2 y@0x142eb30)\n" + " (declare (in ) uvec2 x@0x15dfa20)\n" + " (declare (in ) uvec2 y@0x15dfb30)\n" " )\n" " (\n" " ))\n" "\n" " (signature uvec3\n" " (parameters\n" - " (declare (in ) uvec3 x@0x142ed10)\n" - " (declare (in ) uvec3 y@0x142ee20)\n" + " (declare (in ) uvec3 x@0x15dfd10)\n" + " (declare (in ) uvec3 y@0x15dfe20)\n" " )\n" " (\n" " ))\n" "\n" " (signature uvec4\n" " (parameters\n" - " (declare (in ) uvec4 x@0x142f000)\n" - " (declare (in ) uvec4 y@0x142f110)\n" + " (declare (in ) uvec4 x@0x15e0000)\n" + " (declare (in ) uvec4 y@0x15e0110)\n" " )\n" " (\n" " ))\n" "\n" " (signature uvec2\n" " (parameters\n" - " (declare (in ) uvec2 x@0x142f2f0)\n" - " (declare (in ) uint y@0x142f400)\n" + " (declare (in ) uvec2 x@0x15e02f0)\n" + " (declare (in ) uint y@0x15e0400)\n" " )\n" " (\n" " ))\n" "\n" " (signature uvec3\n" " (parameters\n" - " (declare (in ) uvec3 x@0x142f5e0)\n" - " (declare (in ) uint y@0x142f6f0)\n" + " (declare (in ) uvec3 x@0x15e05e0)\n" + " (declare (in ) uint y@0x15e06f0)\n" " )\n" " (\n" " ))\n" "\n" " (signature uvec4\n" " (parameters\n" - " (declare (in ) uvec4 x@0x142f8d0)\n" - " (declare (in ) uint y@0x142f9e0)\n" + " (declare (in ) uvec4 x@0x15e08d0)\n" + " (declare (in ) uint y@0x15e09e0)\n" " )\n" " (\n" " ))\n" @@ -12963,168 +12963,168 @@ static const char *prototypes_for_130_frag = "(function max\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x142fbc0)\n" - " (declare (in ) float y@0x142fcd0)\n" + " (declare (in ) float x@0x15e0bc0)\n" + " (declare (in ) float y@0x15e0cd0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x1430050)\n" - " (declare (in ) vec2 y@0x1430160)\n" + " (declare (in ) vec2 x@0x15e1050)\n" + " (declare (in ) vec2 y@0x15e1160)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x1430340)\n" - " (declare (in ) vec3 y@0x1430450)\n" + " (declare (in ) vec3 x@0x15e1340)\n" + " (declare (in ) vec3 y@0x15e1450)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x1430630)\n" - " (declare (in ) vec4 y@0x1430740)\n" + " (declare (in ) vec4 x@0x15e1630)\n" + " (declare (in ) vec4 y@0x15e1740)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x1430920)\n" - " (declare (in ) float y@0x1430a30)\n" + " (declare (in ) vec2 x@0x15e1920)\n" + " (declare (in ) float y@0x15e1a30)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x1430c10)\n" - " (declare (in ) float y@0x1430d20)\n" + " (declare (in ) vec3 x@0x15e1c10)\n" + " (declare (in ) float y@0x15e1d20)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x1430f00)\n" - " (declare (in ) float y@0x1431010)\n" + " (declare (in ) vec4 x@0x15e1f00)\n" + " (declare (in ) float y@0x15e2010)\n" " )\n" " (\n" " ))\n" "\n" " (signature int\n" " (parameters\n" - " (declare (in ) int x@0x14311f0)\n" - " (declare (in ) int y@0x1431300)\n" + " (declare (in ) int x@0x15e21f0)\n" + " (declare (in ) int y@0x15e2300)\n" " )\n" " (\n" " ))\n" "\n" " (signature ivec2\n" " (parameters\n" - " (declare (in ) ivec2 x@0x14314e0)\n" - " (declare (in ) ivec2 y@0x14315f0)\n" + " (declare (in ) ivec2 x@0x15e24e0)\n" + " (declare (in ) ivec2 y@0x15e25f0)\n" " )\n" " (\n" " ))\n" "\n" " (signature ivec3\n" " (parameters\n" - " (declare (in ) ivec3 x@0x14317d0)\n" - " (declare (in ) ivec3 y@0x14318e0)\n" + " (declare (in ) ivec3 x@0x15e27d0)\n" + " (declare (in ) ivec3 y@0x15e28e0)\n" " )\n" " (\n" " ))\n" "\n" " (signature ivec4\n" " (parameters\n" - " (declare (in ) ivec4 x@0x1431ac0)\n" - " (declare (in ) ivec4 y@0x1431bd0)\n" + " (declare (in ) ivec4 x@0x15e2ac0)\n" + " (declare (in ) ivec4 y@0x15e2bd0)\n" " )\n" " (\n" " ))\n" "\n" " (signature ivec2\n" " (parameters\n" - " (declare (in ) ivec2 x@0x1431db0)\n" - " (declare (in ) int y@0x1431ec0)\n" + " (declare (in ) ivec2 x@0x15e2db0)\n" + " (declare (in ) int y@0x15e2ec0)\n" " )\n" " (\n" " ))\n" "\n" " (signature ivec3\n" " (parameters\n" - " (declare (in ) ivec3 x@0x14320a0)\n" - " (declare (in ) int y@0x14321b0)\n" + " (declare (in ) ivec3 x@0x15e30a0)\n" + " (declare (in ) int y@0x15e31b0)\n" " )\n" " (\n" " ))\n" "\n" " (signature ivec4\n" " (parameters\n" - " (declare (in ) ivec4 x@0x1432390)\n" - " (declare (in ) int y@0x14324a0)\n" + " (declare (in ) ivec4 x@0x15e3390)\n" + " (declare (in ) int y@0x15e34a0)\n" " )\n" " (\n" " ))\n" "\n" " (signature uint\n" " (parameters\n" - " (declare (in ) uint x@0x1432680)\n" - " (declare (in ) uint y@0x1432790)\n" + " (declare (in ) uint x@0x15e3680)\n" + " (declare (in ) uint y@0x15e3790)\n" " )\n" " (\n" " ))\n" "\n" " (signature uvec2\n" " (parameters\n" - " (declare (in ) uvec2 x@0x1432970)\n" - " (declare (in ) uvec2 y@0x1432a80)\n" + " (declare (in ) uvec2 x@0x15e3970)\n" + " (declare (in ) uvec2 y@0x15e3a80)\n" " )\n" " (\n" " ))\n" "\n" " (signature uvec3\n" " (parameters\n" - " (declare (in ) uvec3 x@0x1432c60)\n" - " (declare (in ) uvec3 y@0x1432d70)\n" + " (declare (in ) uvec3 x@0x15e3c60)\n" + " (declare (in ) uvec3 y@0x15e3d70)\n" " )\n" " (\n" " ))\n" "\n" " (signature uvec4\n" " (parameters\n" - " (declare (in ) uvec4 x@0x1432f50)\n" - " (declare (in ) uvec4 y@0x1433060)\n" + " (declare (in ) uvec4 x@0x15e3f50)\n" + " (declare (in ) uvec4 y@0x15e4060)\n" " )\n" " (\n" " ))\n" "\n" " (signature uvec2\n" " (parameters\n" - " (declare (in ) uvec2 x@0x1433240)\n" - " (declare (in ) uint y@0x1433350)\n" + " (declare (in ) uvec2 x@0x15e4240)\n" + " (declare (in ) uint y@0x15e4350)\n" " )\n" " (\n" " ))\n" "\n" " (signature uvec3\n" " (parameters\n" - " (declare (in ) uvec3 x@0x1433530)\n" - " (declare (in ) uint y@0x1433640)\n" + " (declare (in ) uvec3 x@0x15e4530)\n" + " (declare (in ) uint y@0x15e4640)\n" " )\n" " (\n" " ))\n" "\n" " (signature uvec4\n" " (parameters\n" - " (declare (in ) uvec4 x@0x1433820)\n" - " (declare (in ) uint y@0x1433930)\n" + " (declare (in ) uvec4 x@0x15e4820)\n" + " (declare (in ) uint y@0x15e4930)\n" " )\n" " (\n" " ))\n" @@ -13134,189 +13134,189 @@ static const char *prototypes_for_130_frag = "(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" + " (declare (in ) float x@0x15e4b10)\n" + " (declare (in ) float minVal@0x15e4c20)\n" + " (declare (in ) float maxVal@0x15e4d30)\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" + " (declare (in ) vec2 x@0x15e50b0)\n" + " (declare (in ) vec2 minVal@0x15e51c0)\n" + " (declare (in ) vec2 maxVal@0x15e52d0)\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" + " (declare (in ) vec3 x@0x15e54b0)\n" + " (declare (in ) vec3 minVal@0x15e55c0)\n" + " (declare (in ) vec3 maxVal@0x15e56d0)\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" + " (declare (in ) vec4 x@0x15e58b0)\n" + " (declare (in ) vec4 minVal@0x15e59c0)\n" + " (declare (in ) vec4 maxVal@0x15e5ad0)\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" + " (declare (in ) vec2 x@0x15e5cb0)\n" + " (declare (in ) float minVal@0x15e5dc0)\n" + " (declare (in ) float maxVal@0x15e5ed0)\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" + " (declare (in ) vec3 x@0x15e60b0)\n" + " (declare (in ) float minVal@0x15e61c0)\n" + " (declare (in ) float maxVal@0x15e62d0)\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" + " (declare (in ) vec4 x@0x15e64b0)\n" + " (declare (in ) float minVal@0x15e65c0)\n" + " (declare (in ) float maxVal@0x15e66d0)\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" + " (declare (in ) int x@0x15e68b0)\n" + " (declare (in ) int minVal@0x15e69c0)\n" + " (declare (in ) int maxVal@0x15e6ad0)\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" + " (declare (in ) ivec2 x@0x15e6cb0)\n" + " (declare (in ) ivec2 minVal@0x15e6dc0)\n" + " (declare (in ) ivec2 maxVal@0x15e6ed0)\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" + " (declare (in ) ivec3 x@0x15e70b0)\n" + " (declare (in ) ivec3 minVal@0x15e71c0)\n" + " (declare (in ) ivec3 maxVal@0x15e72d0)\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" + " (declare (in ) ivec4 x@0x15e74b0)\n" + " (declare (in ) ivec4 minVal@0x15e75c0)\n" + " (declare (in ) ivec4 maxVal@0x15e76d0)\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" + " (declare (in ) ivec2 x@0x15e78b0)\n" + " (declare (in ) int minVal@0x15e79c0)\n" + " (declare (in ) int maxVal@0x15e7ad0)\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" + " (declare (in ) ivec3 x@0x15e7cb0)\n" + " (declare (in ) int minVal@0x15e7dc0)\n" + " (declare (in ) int maxVal@0x15e7ed0)\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" + " (declare (in ) ivec4 x@0x15e80b0)\n" + " (declare (in ) int minVal@0x15e81c0)\n" + " (declare (in ) int maxVal@0x15e82d0)\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" + " (declare (in ) uint x@0x15e84b0)\n" + " (declare (in ) uint minVal@0x15e85c0)\n" + " (declare (in ) uint maxVal@0x15e86d0)\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" + " (declare (in ) uvec2 x@0x15e88b0)\n" + " (declare (in ) uvec2 minVal@0x15e89c0)\n" + " (declare (in ) uvec2 maxVal@0x15e8ad0)\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" + " (declare (in ) uvec3 x@0x15e8cb0)\n" + " (declare (in ) uvec3 minVal@0x15e8dc0)\n" + " (declare (in ) uvec3 maxVal@0x15e8ed0)\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" + " (declare (in ) uvec4 x@0x15e90b0)\n" + " (declare (in ) uvec4 minVal@0x15e91c0)\n" + " (declare (in ) uvec4 maxVal@0x15e92d0)\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" + " (declare (in ) uvec2 x@0x15e94b0)\n" + " (declare (in ) uint minVal@0x15e95c0)\n" + " (declare (in ) uint maxVal@0x15e96d0)\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" + " (declare (in ) uvec3 x@0x15e98b0)\n" + " (declare (in ) uint minVal@0x15e99c0)\n" + " (declare (in ) uint maxVal@0x15e9ad0)\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" + " (declare (in ) uvec4 x@0x15e9cb0)\n" + " (declare (in ) uint minVal@0x15e9dc0)\n" + " (declare (in ) uint maxVal@0x15e9ed0)\n" " )\n" " (\n" " ))\n" @@ -13326,63 +13326,63 @@ static const char *prototypes_for_130_frag = "(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" + " (declare (in ) float x@0x15ea0b0)\n" + " (declare (in ) float y@0x15ea1c0)\n" + " (declare (in ) float a@0x15ea2d0)\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" + " (declare (in ) vec2 x@0x15ea650)\n" + " (declare (in ) vec2 y@0x15ea760)\n" + " (declare (in ) vec2 a@0x15ea870)\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" + " (declare (in ) vec3 x@0x15eaa50)\n" + " (declare (in ) vec3 y@0x15eab60)\n" + " (declare (in ) vec3 a@0x15eac70)\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" + " (declare (in ) vec4 x@0x15eae50)\n" + " (declare (in ) vec4 y@0x15eaf60)\n" + " (declare (in ) vec4 a@0x15eb070)\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" + " (declare (in ) vec2 x@0x15eb250)\n" + " (declare (in ) vec2 y@0x15eb360)\n" + " (declare (in ) float a@0x15eb470)\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" + " (declare (in ) vec3 x@0x15eb650)\n" + " (declare (in ) vec3 y@0x15eb760)\n" + " (declare (in ) float a@0x15eb870)\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" + " (declare (in ) vec4 x@0x15eba50)\n" + " (declare (in ) vec4 y@0x15ebb60)\n" + " (declare (in ) float a@0x15ebc70)\n" " )\n" " (\n" " ))\n" @@ -13392,56 +13392,56 @@ static const char *prototypes_for_130_frag = "(function step\n" " (signature float\n" " (parameters\n" - " (declare (in ) float edge@0x143ae50)\n" - " (declare (in ) float x@0x143af60)\n" + " (declare (in ) float edge@0x15ebe50)\n" + " (declare (in ) float x@0x15ebf60)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 edge@0x143b2e0)\n" - " (declare (in ) vec2 x@0x143b3f0)\n" + " (declare (in ) vec2 edge@0x15ec2e0)\n" + " (declare (in ) vec2 x@0x15ec3f0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 edge@0x143b5d0)\n" - " (declare (in ) vec3 x@0x143b6e0)\n" + " (declare (in ) vec3 edge@0x15ec5d0)\n" + " (declare (in ) vec3 x@0x15ec6e0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 edge@0x143b8c0)\n" - " (declare (in ) vec4 x@0x143b9d0)\n" + " (declare (in ) vec4 edge@0x15ec8c0)\n" + " (declare (in ) vec4 x@0x15ec9d0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) float edge@0x143bbb0)\n" - " (declare (in ) vec2 x@0x143bcc0)\n" + " (declare (in ) float edge@0x15ecbb0)\n" + " (declare (in ) vec2 x@0x15eccc0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) float edge@0x143bea0)\n" - " (declare (in ) vec3 x@0x143bfb0)\n" + " (declare (in ) float edge@0x15ecea0)\n" + " (declare (in ) vec3 x@0x15ecfb0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) float edge@0x143c190)\n" - " (declare (in ) vec4 x@0x143c2a0)\n" + " (declare (in ) float edge@0x15ed190)\n" + " (declare (in ) vec4 x@0x15ed2a0)\n" " )\n" " (\n" " ))\n" @@ -13451,63 +13451,63 @@ static const char *prototypes_for_130_frag = "(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" + " (declare (in ) float edge0@0x15ed480)\n" + " (declare (in ) float edge1@0x15ed590)\n" + " (declare (in ) float x@0x15ed6a0)\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" + " (declare (in ) vec2 edge0@0x15eda30)\n" + " (declare (in ) vec2 edge1@0x15edb40)\n" + " (declare (in ) vec2 x@0x15edc50)\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" + " (declare (in ) vec3 edge0@0x15ede30)\n" + " (declare (in ) vec3 edge1@0x15edf40)\n" + " (declare (in ) vec3 x@0x15ee050)\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" + " (declare (in ) vec4 edge0@0x15ee230)\n" + " (declare (in ) vec4 edge1@0x15ee340)\n" + " (declare (in ) vec4 x@0x15ee450)\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" + " (declare (in ) float edge0@0x15ee630)\n" + " (declare (in ) float edge1@0x15ee740)\n" + " (declare (in ) vec2 x@0x15ee850)\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" + " (declare (in ) float edge0@0x15eea30)\n" + " (declare (in ) float edge1@0x15eeb40)\n" + " (declare (in ) vec3 x@0x15eec50)\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" + " (declare (in ) float edge0@0x15eee30)\n" + " (declare (in ) float edge1@0x15eef40)\n" + " (declare (in ) vec4 x@0x15ef050)\n" " )\n" " (\n" " ))\n" @@ -13517,28 +13517,28 @@ static const char *prototypes_for_130_frag = "(function length\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x143e230)\n" + " (declare (in ) float x@0x15ef230)\n" " )\n" " (\n" " ))\n" "\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec2 x@0x143e5b0)\n" + " (declare (in ) vec2 x@0x15ef5b0)\n" " )\n" " (\n" " ))\n" "\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec3 x@0x143e790)\n" + " (declare (in ) vec3 x@0x15ef790)\n" " )\n" " (\n" " ))\n" "\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec4 x@0x143e970)\n" + " (declare (in ) vec4 x@0x15ef970)\n" " )\n" " (\n" " ))\n" @@ -13548,32 +13548,32 @@ static const char *prototypes_for_130_frag = "(function distance\n" " (signature float\n" " (parameters\n" - " (declare (in ) float p0@0x143eb50)\n" - " (declare (in ) float p1@0x143ec60)\n" + " (declare (in ) float p0@0x15efb50)\n" + " (declare (in ) float p1@0x15efc60)\n" " )\n" " (\n" " ))\n" "\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec2 p0@0x143eff0)\n" - " (declare (in ) vec2 p1@0x143f100)\n" + " (declare (in ) vec2 p0@0x15efff0)\n" + " (declare (in ) vec2 p1@0x15f0100)\n" " )\n" " (\n" " ))\n" "\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec3 p0@0x143f2e0)\n" - " (declare (in ) vec3 p1@0x143f3f0)\n" + " (declare (in ) vec3 p0@0x15f02e0)\n" + " (declare (in ) vec3 p1@0x15f03f0)\n" " )\n" " (\n" " ))\n" "\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec4 p0@0x143f5d0)\n" - " (declare (in ) vec4 p1@0x143f6e0)\n" + " (declare (in ) vec4 p0@0x15f05d0)\n" + " (declare (in ) vec4 p1@0x15f06e0)\n" " )\n" " (\n" " ))\n" @@ -13583,32 +13583,32 @@ static const char *prototypes_for_130_frag = "(function dot\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x143f8c0)\n" - " (declare (in ) float y@0x143f9d0)\n" + " (declare (in ) float x@0x15f08c0)\n" + " (declare (in ) float y@0x15f09d0)\n" " )\n" " (\n" " ))\n" "\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec2 x@0x143fd50)\n" - " (declare (in ) vec2 y@0x143fe60)\n" + " (declare (in ) vec2 x@0x15f0d50)\n" + " (declare (in ) vec2 y@0x15f0e60)\n" " )\n" " (\n" " ))\n" "\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec3 x@0x1440040)\n" - " (declare (in ) vec3 y@0x1440150)\n" + " (declare (in ) vec3 x@0x15f1040)\n" + " (declare (in ) vec3 y@0x15f1150)\n" " )\n" " (\n" " ))\n" "\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec4 x@0x1440330)\n" - " (declare (in ) vec4 y@0x1440440)\n" + " (declare (in ) vec4 x@0x15f1330)\n" + " (declare (in ) vec4 y@0x15f1440)\n" " )\n" " (\n" " ))\n" @@ -13618,8 +13618,8 @@ static const char *prototypes_for_130_frag = "(function cross\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x1440620)\n" - " (declare (in ) vec3 y@0x1440730)\n" + " (declare (in ) vec3 x@0x15f1620)\n" + " (declare (in ) vec3 y@0x15f1730)\n" " )\n" " (\n" " ))\n" @@ -13629,28 +13629,28 @@ static const char *prototypes_for_130_frag = "(function normalize\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x1440ab0)\n" + " (declare (in ) float x@0x15f1ab0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x1440e40)\n" + " (declare (in ) vec2 x@0x15f1e40)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x1441020)\n" + " (declare (in ) vec3 x@0x15f2020)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x1441200)\n" + " (declare (in ) vec4 x@0x15f2200)\n" " )\n" " (\n" " ))\n" @@ -13660,36 +13660,36 @@ static const char *prototypes_for_130_frag = "(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" + " (declare (in ) float N@0x15f23e0)\n" + " (declare (in ) float I@0x15f24f0)\n" + " (declare (in ) float Nref@0x15f2600)\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" + " (declare (in ) vec2 N@0x15f2990)\n" + " (declare (in ) vec2 I@0x15f2aa0)\n" + " (declare (in ) vec2 Nref@0x15f2bb0)\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" + " (declare (in ) vec3 N@0x15f2d90)\n" + " (declare (in ) vec3 I@0x15f2ea0)\n" + " (declare (in ) vec3 Nref@0x15f2fb0)\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" + " (declare (in ) vec4 N@0x15f3190)\n" + " (declare (in ) vec4 I@0x15f32a0)\n" + " (declare (in ) vec4 Nref@0x15f33b0)\n" " )\n" " (\n" " ))\n" @@ -13699,32 +13699,32 @@ static const char *prototypes_for_130_frag = "(function reflect\n" " (signature float\n" " (parameters\n" - " (declare (in ) float I@0x1442590)\n" - " (declare (in ) float N@0x14426a0)\n" + " (declare (in ) float I@0x15f3590)\n" + " (declare (in ) float N@0x15f36a0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 I@0x1442a20)\n" - " (declare (in ) vec2 N@0x1442b30)\n" + " (declare (in ) vec2 I@0x15f3a20)\n" + " (declare (in ) vec2 N@0x15f3b30)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 I@0x1442d10)\n" - " (declare (in ) vec3 N@0x1442e20)\n" + " (declare (in ) vec3 I@0x15f3d10)\n" + " (declare (in ) vec3 N@0x15f3e20)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 I@0x1443000)\n" - " (declare (in ) vec4 N@0x1443110)\n" + " (declare (in ) vec4 I@0x15f4000)\n" + " (declare (in ) vec4 N@0x15f4110)\n" " )\n" " (\n" " ))\n" @@ -13734,36 +13734,36 @@ static const char *prototypes_for_130_frag = "(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" + " (declare (in ) float I@0x15f42f0)\n" + " (declare (in ) float N@0x15f4400)\n" + " (declare (in ) float eta@0x15f4510)\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" + " (declare (in ) vec2 I@0x15f4890)\n" + " (declare (in ) vec2 N@0x15f49a0)\n" + " (declare (in ) float eta@0x15f4ab0)\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" + " (declare (in ) vec3 I@0x15f4c90)\n" + " (declare (in ) vec3 N@0x15f4da0)\n" + " (declare (in ) float eta@0x15f4eb0)\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" + " (declare (in ) vec4 I@0x15f5090)\n" + " (declare (in ) vec4 N@0x15f51a0)\n" + " (declare (in ) float eta@0x15f52b0)\n" " )\n" " (\n" " ))\n" @@ -13773,72 +13773,72 @@ static const char *prototypes_for_130_frag = "(function matrixCompMult\n" " (signature mat2\n" " (parameters\n" - " (declare (in ) mat2 x@0x1444490)\n" - " (declare (in ) mat2 y@0x14445a0)\n" + " (declare (in ) mat2 x@0x15f5490)\n" + " (declare (in ) mat2 y@0x15f55a0)\n" " )\n" " (\n" " ))\n" "\n" " (signature mat3\n" " (parameters\n" - " (declare (in ) mat3 x@0x1444930)\n" - " (declare (in ) mat3 y@0x1444a40)\n" + " (declare (in ) mat3 x@0x15f5930)\n" + " (declare (in ) mat3 y@0x15f5a40)\n" " )\n" " (\n" " ))\n" "\n" " (signature mat4\n" " (parameters\n" - " (declare (in ) mat4 x@0x1444c20)\n" - " (declare (in ) mat4 y@0x1444d30)\n" + " (declare (in ) mat4 x@0x15f5c20)\n" + " (declare (in ) mat4 y@0x15f5d30)\n" " )\n" " (\n" " ))\n" "\n" " (signature mat2x3\n" " (parameters\n" - " (declare (in ) mat2x3 x@0x1444f10)\n" - " (declare (in ) mat2x3 y@0x1445020)\n" + " (declare (in ) mat2x3 x@0x15f5f10)\n" + " (declare (in ) mat2x3 y@0x15f6020)\n" " )\n" " (\n" " ))\n" "\n" " (signature mat2x4\n" " (parameters\n" - " (declare (in ) mat2x4 x@0x1445200)\n" - " (declare (in ) mat2x4 y@0x1445310)\n" + " (declare (in ) mat2x4 x@0x15f6200)\n" + " (declare (in ) mat2x4 y@0x15f6310)\n" " )\n" " (\n" " ))\n" "\n" " (signature mat3x2\n" " (parameters\n" - " (declare (in ) mat3x2 x@0x14454f0)\n" - " (declare (in ) mat3x2 y@0x1445600)\n" + " (declare (in ) mat3x2 x@0x15f64f0)\n" + " (declare (in ) mat3x2 y@0x15f6600)\n" " )\n" " (\n" " ))\n" "\n" " (signature mat3x4\n" " (parameters\n" - " (declare (in ) mat3x4 x@0x14457e0)\n" - " (declare (in ) mat3x4 y@0x14458f0)\n" + " (declare (in ) mat3x4 x@0x15f67e0)\n" + " (declare (in ) mat3x4 y@0x15f68f0)\n" " )\n" " (\n" " ))\n" "\n" " (signature mat4x2\n" " (parameters\n" - " (declare (in ) mat4x2 x@0x1445ad0)\n" - " (declare (in ) mat4x2 y@0x1445be0)\n" + " (declare (in ) mat4x2 x@0x15f6ad0)\n" + " (declare (in ) mat4x2 y@0x15f6be0)\n" " )\n" " (\n" " ))\n" "\n" " (signature mat4x3\n" " (parameters\n" - " (declare (in ) mat4x3 x@0x1445dc0)\n" - " (declare (in ) mat4x3 y@0x1445ed0)\n" + " (declare (in ) mat4x3 x@0x15f6dc0)\n" + " (declare (in ) mat4x3 y@0x15f6ed0)\n" " )\n" " (\n" " ))\n" @@ -13848,72 +13848,72 @@ static const char *prototypes_for_130_frag = "(function outerProduct\n" " (signature mat2\n" " (parameters\n" - " (declare (in ) vec2 c@0x14460b0)\n" - " (declare (in ) vec2 r@0x14461c0)\n" + " (declare (in ) vec2 c@0x15f70b0)\n" + " (declare (in ) vec2 r@0x15f71c0)\n" " )\n" " (\n" " ))\n" "\n" " (signature mat3\n" " (parameters\n" - " (declare (in ) vec3 c@0x1446550)\n" - " (declare (in ) vec3 r@0x1446660)\n" + " (declare (in ) vec3 c@0x15f7550)\n" + " (declare (in ) vec3 r@0x15f7660)\n" " )\n" " (\n" " ))\n" "\n" " (signature mat4\n" " (parameters\n" - " (declare (in ) vec4 c@0x1446840)\n" - " (declare (in ) vec4 r@0x1446950)\n" + " (declare (in ) vec4 c@0x15f7840)\n" + " (declare (in ) vec4 r@0x15f7950)\n" " )\n" " (\n" " ))\n" "\n" " (signature mat2x3\n" " (parameters\n" - " (declare (in ) vec3 c@0x1446b30)\n" - " (declare (in ) vec2 r@0x1446c40)\n" + " (declare (in ) vec3 c@0x15f7b30)\n" + " (declare (in ) vec2 r@0x15f7c40)\n" " )\n" " (\n" " ))\n" "\n" " (signature mat3x2\n" " (parameters\n" - " (declare (in ) vec2 c@0x1446e20)\n" - " (declare (in ) vec3 r@0x1446f30)\n" + " (declare (in ) vec2 c@0x15f7e20)\n" + " (declare (in ) vec3 r@0x15f7f30)\n" " )\n" " (\n" " ))\n" "\n" " (signature mat2x4\n" " (parameters\n" - " (declare (in ) vec4 c@0x1447110)\n" - " (declare (in ) vec2 r@0x1447220)\n" + " (declare (in ) vec4 c@0x15f8110)\n" + " (declare (in ) vec2 r@0x15f8220)\n" " )\n" " (\n" " ))\n" "\n" " (signature mat4x2\n" " (parameters\n" - " (declare (in ) vec2 c@0x1447400)\n" - " (declare (in ) vec4 r@0x1447510)\n" + " (declare (in ) vec2 c@0x15f8400)\n" + " (declare (in ) vec4 r@0x15f8510)\n" " )\n" " (\n" " ))\n" "\n" " (signature mat3x4\n" " (parameters\n" - " (declare (in ) vec4 c@0x14476f0)\n" - " (declare (in ) vec3 r@0x1447800)\n" + " (declare (in ) vec4 c@0x15f86f0)\n" + " (declare (in ) vec3 r@0x15f8800)\n" " )\n" " (\n" " ))\n" "\n" " (signature mat4x3\n" " (parameters\n" - " (declare (in ) vec3 c@0x14479e0)\n" - " (declare (in ) vec4 r@0x1447af0)\n" + " (declare (in ) vec3 c@0x15f89e0)\n" + " (declare (in ) vec4 r@0x15f8af0)\n" " )\n" " (\n" " ))\n" @@ -13923,63 +13923,63 @@ static const char *prototypes_for_130_frag = "(function transpose\n" " (signature mat2\n" " (parameters\n" - " (declare (in ) mat2 m@0x1447cd0)\n" + " (declare (in ) mat2 m@0x15f8cd0)\n" " )\n" " (\n" " ))\n" "\n" " (signature mat3\n" " (parameters\n" - " (declare (in ) mat3 m@0x1448060)\n" + " (declare (in ) mat3 m@0x15f9060)\n" " )\n" " (\n" " ))\n" "\n" " (signature mat4\n" " (parameters\n" - " (declare (in ) mat4 m@0x1448240)\n" + " (declare (in ) mat4 m@0x15f9240)\n" " )\n" " (\n" " ))\n" "\n" " (signature mat2x3\n" " (parameters\n" - " (declare (in ) mat3x2 m@0x1448420)\n" + " (declare (in ) mat3x2 m@0x15f9420)\n" " )\n" " (\n" " ))\n" "\n" " (signature mat3x2\n" " (parameters\n" - " (declare (in ) mat2x3 m@0x1448600)\n" + " (declare (in ) mat2x3 m@0x15f9600)\n" " )\n" " (\n" " ))\n" "\n" " (signature mat2x4\n" " (parameters\n" - " (declare (in ) mat4x2 m@0x14487e0)\n" + " (declare (in ) mat4x2 m@0x15f97e0)\n" " )\n" " (\n" " ))\n" "\n" " (signature mat4x2\n" " (parameters\n" - " (declare (in ) mat2x4 m@0x14489c0)\n" + " (declare (in ) mat2x4 m@0x15f99c0)\n" " )\n" " (\n" " ))\n" "\n" " (signature mat3x4\n" " (parameters\n" - " (declare (in ) mat4x3 m@0x1448ba0)\n" + " (declare (in ) mat4x3 m@0x15f9ba0)\n" " )\n" " (\n" " ))\n" "\n" " (signature mat4x3\n" " (parameters\n" - " (declare (in ) mat3x4 m@0x1448d80)\n" + " (declare (in ) mat3x4 m@0x15f9d80)\n" " )\n" " (\n" " ))\n" @@ -13989,72 +13989,72 @@ static const char *prototypes_for_130_frag = "(function lessThan\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x1448f60)\n" - " (declare (in ) vec2 y@0x1449070)\n" + " (declare (in ) vec2 x@0x15f9f60)\n" + " (declare (in ) vec2 y@0x15fa070)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x1449400)\n" - " (declare (in ) vec3 y@0x1449510)\n" + " (declare (in ) vec3 x@0x15fa400)\n" + " (declare (in ) vec3 y@0x15fa510)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x14496f0)\n" - " (declare (in ) vec4 y@0x1449800)\n" + " (declare (in ) vec4 x@0x15fa6f0)\n" + " (declare (in ) vec4 y@0x15fa800)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) ivec2 x@0x14499e0)\n" - " (declare (in ) ivec2 y@0x1449af0)\n" + " (declare (in ) ivec2 x@0x15fa9e0)\n" + " (declare (in ) ivec2 y@0x15faaf0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) ivec3 x@0x1449cd0)\n" - " (declare (in ) ivec3 y@0x1449de0)\n" + " (declare (in ) ivec3 x@0x15facd0)\n" + " (declare (in ) ivec3 y@0x15fade0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) ivec4 x@0x1449fc0)\n" - " (declare (in ) ivec4 y@0x144a0d0)\n" + " (declare (in ) ivec4 x@0x15fafc0)\n" + " (declare (in ) ivec4 y@0x15fb0d0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) uvec2 x@0x144a2b0)\n" - " (declare (in ) uvec2 y@0x144a3c0)\n" + " (declare (in ) uvec2 x@0x15fb2b0)\n" + " (declare (in ) uvec2 y@0x15fb3c0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) uvec3 x@0x144a5a0)\n" - " (declare (in ) uvec3 y@0x144a6b0)\n" + " (declare (in ) uvec3 x@0x15fb5a0)\n" + " (declare (in ) uvec3 y@0x15fb6b0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) uvec4 x@0x144a890)\n" - " (declare (in ) uvec4 y@0x144a9a0)\n" + " (declare (in ) uvec4 x@0x15fb890)\n" + " (declare (in ) uvec4 y@0x15fb9a0)\n" " )\n" " (\n" " ))\n" @@ -14064,72 +14064,72 @@ static const char *prototypes_for_130_frag = "(function lessThanEqual\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x144ab80)\n" - " (declare (in ) vec2 y@0x144ac90)\n" + " (declare (in ) vec2 x@0x15fbb80)\n" + " (declare (in ) vec2 y@0x15fbc90)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x144b020)\n" - " (declare (in ) vec3 y@0x144b130)\n" + " (declare (in ) vec3 x@0x15fc020)\n" + " (declare (in ) vec3 y@0x15fc130)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x144b310)\n" - " (declare (in ) vec4 y@0x144b420)\n" + " (declare (in ) vec4 x@0x15fc310)\n" + " (declare (in ) vec4 y@0x15fc420)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) ivec2 x@0x144b600)\n" - " (declare (in ) ivec2 y@0x144b710)\n" + " (declare (in ) ivec2 x@0x15fc600)\n" + " (declare (in ) ivec2 y@0x15fc710)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) ivec3 x@0x144b8f0)\n" - " (declare (in ) ivec3 y@0x144ba00)\n" + " (declare (in ) ivec3 x@0x15fc8f0)\n" + " (declare (in ) ivec3 y@0x15fca00)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) ivec4 x@0x144bbe0)\n" - " (declare (in ) ivec4 y@0x144bcf0)\n" + " (declare (in ) ivec4 x@0x15fcbe0)\n" + " (declare (in ) ivec4 y@0x15fccf0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) uvec2 x@0x144bed0)\n" - " (declare (in ) uvec2 y@0x144bfe0)\n" + " (declare (in ) uvec2 x@0x15fced0)\n" + " (declare (in ) uvec2 y@0x15fcfe0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) uvec3 x@0x144c1c0)\n" - " (declare (in ) uvec3 y@0x144c2d0)\n" + " (declare (in ) uvec3 x@0x15fd1c0)\n" + " (declare (in ) uvec3 y@0x15fd2d0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) uvec4 x@0x144c4b0)\n" - " (declare (in ) uvec4 y@0x144c5c0)\n" + " (declare (in ) uvec4 x@0x15fd4b0)\n" + " (declare (in ) uvec4 y@0x15fd5c0)\n" " )\n" " (\n" " ))\n" @@ -14139,72 +14139,72 @@ static const char *prototypes_for_130_frag = "(function greaterThan\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x144c7a0)\n" - " (declare (in ) vec2 y@0x144c8b0)\n" + " (declare (in ) vec2 x@0x15fd7a0)\n" + " (declare (in ) vec2 y@0x15fd8b0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x144cc40)\n" - " (declare (in ) vec3 y@0x144cd50)\n" + " (declare (in ) vec3 x@0x15fdc40)\n" + " (declare (in ) vec3 y@0x15fdd50)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x144cf30)\n" - " (declare (in ) vec4 y@0x144d040)\n" + " (declare (in ) vec4 x@0x15fdf30)\n" + " (declare (in ) vec4 y@0x15fe040)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) ivec2 x@0x144d220)\n" - " (declare (in ) ivec2 y@0x144d330)\n" + " (declare (in ) ivec2 x@0x15fe220)\n" + " (declare (in ) ivec2 y@0x15fe330)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) ivec3 x@0x144d510)\n" - " (declare (in ) ivec3 y@0x144d620)\n" + " (declare (in ) ivec3 x@0x15fe510)\n" + " (declare (in ) ivec3 y@0x15fe620)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) ivec4 x@0x144d800)\n" - " (declare (in ) ivec4 y@0x144d910)\n" + " (declare (in ) ivec4 x@0x15fe800)\n" + " (declare (in ) ivec4 y@0x15fe910)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) uvec2 x@0x144daf0)\n" - " (declare (in ) uvec2 y@0x144dc00)\n" + " (declare (in ) uvec2 x@0x15feaf0)\n" + " (declare (in ) uvec2 y@0x15fec00)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) uvec3 x@0x144dde0)\n" - " (declare (in ) uvec3 y@0x144def0)\n" + " (declare (in ) uvec3 x@0x15fede0)\n" + " (declare (in ) uvec3 y@0x15feef0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) uvec4 x@0x144e0d0)\n" - " (declare (in ) uvec4 y@0x144e1e0)\n" + " (declare (in ) uvec4 x@0x15ff0d0)\n" + " (declare (in ) uvec4 y@0x15ff1e0)\n" " )\n" " (\n" " ))\n" @@ -14214,72 +14214,72 @@ static const char *prototypes_for_130_frag = "(function greaterThanEqual\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x144e3c0)\n" - " (declare (in ) vec2 y@0x144e4d0)\n" + " (declare (in ) vec2 x@0x15ff3c0)\n" + " (declare (in ) vec2 y@0x15ff4d0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x144e860)\n" - " (declare (in ) vec3 y@0x144e970)\n" + " (declare (in ) vec3 x@0x15ff860)\n" + " (declare (in ) vec3 y@0x15ff970)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x144eb50)\n" - " (declare (in ) vec4 y@0x144ec60)\n" + " (declare (in ) vec4 x@0x15ffb50)\n" + " (declare (in ) vec4 y@0x15ffc60)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) ivec2 x@0x144ee40)\n" - " (declare (in ) ivec2 y@0x144ef50)\n" + " (declare (in ) ivec2 x@0x15ffe40)\n" + " (declare (in ) ivec2 y@0x15fff50)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) ivec3 x@0x144f130)\n" - " (declare (in ) ivec3 y@0x144f240)\n" + " (declare (in ) ivec3 x@0x1600130)\n" + " (declare (in ) ivec3 y@0x1600240)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) ivec4 x@0x144f420)\n" - " (declare (in ) ivec4 y@0x144f530)\n" + " (declare (in ) ivec4 x@0x1600420)\n" + " (declare (in ) ivec4 y@0x1600530)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) uvec2 x@0x144f710)\n" - " (declare (in ) uvec2 y@0x144f820)\n" + " (declare (in ) uvec2 x@0x1600710)\n" + " (declare (in ) uvec2 y@0x1600820)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) uvec3 x@0x144fa00)\n" - " (declare (in ) uvec3 y@0x144fb10)\n" + " (declare (in ) uvec3 x@0x1600a00)\n" + " (declare (in ) uvec3 y@0x1600b10)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) uvec4 x@0x144fcf0)\n" - " (declare (in ) uvec4 y@0x144fe00)\n" + " (declare (in ) uvec4 x@0x1600cf0)\n" + " (declare (in ) uvec4 y@0x1600e00)\n" " )\n" " (\n" " ))\n" @@ -14289,96 +14289,96 @@ static const char *prototypes_for_130_frag = "(function equal\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x144ffe0)\n" - " (declare (in ) vec2 y@0x14500f0)\n" + " (declare (in ) vec2 x@0x1600fe0)\n" + " (declare (in ) vec2 y@0x16010f0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x1450470)\n" - " (declare (in ) vec3 y@0x1450580)\n" + " (declare (in ) vec3 x@0x1601470)\n" + " (declare (in ) vec3 y@0x1601580)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x1450760)\n" - " (declare (in ) vec4 y@0x1450870)\n" + " (declare (in ) vec4 x@0x1601760)\n" + " (declare (in ) vec4 y@0x1601870)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) ivec2 x@0x1450a50)\n" - " (declare (in ) ivec2 y@0x1450b60)\n" + " (declare (in ) ivec2 x@0x1601a50)\n" + " (declare (in ) ivec2 y@0x1601b60)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) ivec3 x@0x1450d40)\n" - " (declare (in ) ivec3 y@0x1450e50)\n" + " (declare (in ) ivec3 x@0x1601d40)\n" + " (declare (in ) ivec3 y@0x1601e50)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) ivec4 x@0x1451030)\n" - " (declare (in ) ivec4 y@0x1451140)\n" + " (declare (in ) ivec4 x@0x1602030)\n" + " (declare (in ) ivec4 y@0x1602140)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) uvec2 x@0x1451320)\n" - " (declare (in ) uvec2 y@0x1451430)\n" + " (declare (in ) uvec2 x@0x1602320)\n" + " (declare (in ) uvec2 y@0x1602430)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) uvec3 x@0x1451610)\n" - " (declare (in ) uvec3 y@0x1451720)\n" + " (declare (in ) uvec3 x@0x1602610)\n" + " (declare (in ) uvec3 y@0x1602720)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) uvec4 x@0x1451900)\n" - " (declare (in ) uvec4 y@0x1451a10)\n" + " (declare (in ) uvec4 x@0x1602900)\n" + " (declare (in ) uvec4 y@0x1602a10)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) bvec2 x@0x1451bf0)\n" - " (declare (in ) bvec2 y@0x1451d00)\n" + " (declare (in ) bvec2 x@0x1602bf0)\n" + " (declare (in ) bvec2 y@0x1602d00)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) bvec3 x@0x1451ee0)\n" - " (declare (in ) bvec3 y@0x1451ff0)\n" + " (declare (in ) bvec3 x@0x1602ee0)\n" + " (declare (in ) bvec3 y@0x1602ff0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) bvec4 x@0x14521d0)\n" - " (declare (in ) bvec4 y@0x14522e0)\n" + " (declare (in ) bvec4 x@0x16031d0)\n" + " (declare (in ) bvec4 y@0x16032e0)\n" " )\n" " (\n" " ))\n" @@ -14388,96 +14388,96 @@ static const char *prototypes_for_130_frag = "(function notEqual\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x14524c0)\n" - " (declare (in ) vec2 y@0x14525d0)\n" + " (declare (in ) vec2 x@0x16034c0)\n" + " (declare (in ) vec2 y@0x16035d0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x1452960)\n" - " (declare (in ) vec3 y@0x1452a70)\n" + " (declare (in ) vec3 x@0x1603960)\n" + " (declare (in ) vec3 y@0x1603a70)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x1452c50)\n" - " (declare (in ) vec4 y@0x1452d60)\n" + " (declare (in ) vec4 x@0x1603c50)\n" + " (declare (in ) vec4 y@0x1603d60)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) ivec2 x@0x1452f40)\n" - " (declare (in ) ivec2 y@0x1453050)\n" + " (declare (in ) ivec2 x@0x1603f40)\n" + " (declare (in ) ivec2 y@0x1604050)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) ivec3 x@0x1453230)\n" - " (declare (in ) ivec3 y@0x1453340)\n" + " (declare (in ) ivec3 x@0x1604230)\n" + " (declare (in ) ivec3 y@0x1604340)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) ivec4 x@0x1453520)\n" - " (declare (in ) ivec4 y@0x1453630)\n" + " (declare (in ) ivec4 x@0x1604520)\n" + " (declare (in ) ivec4 y@0x1604630)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) uvec2 x@0x1453810)\n" - " (declare (in ) uvec2 y@0x1453920)\n" + " (declare (in ) uvec2 x@0x1604810)\n" + " (declare (in ) uvec2 y@0x1604920)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) uvec3 x@0x1453b00)\n" - " (declare (in ) uvec3 y@0x1453c10)\n" + " (declare (in ) uvec3 x@0x1604b00)\n" + " (declare (in ) uvec3 y@0x1604c10)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) uvec4 x@0x1453df0)\n" - " (declare (in ) uvec4 y@0x1453f00)\n" + " (declare (in ) uvec4 x@0x1604df0)\n" + " (declare (in ) uvec4 y@0x1604f00)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) bvec2 x@0x14540e0)\n" - " (declare (in ) bvec2 y@0x14541f0)\n" + " (declare (in ) bvec2 x@0x16050e0)\n" + " (declare (in ) bvec2 y@0x16051f0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) bvec3 x@0x14543d0)\n" - " (declare (in ) bvec3 y@0x14544e0)\n" + " (declare (in ) bvec3 x@0x16053d0)\n" + " (declare (in ) bvec3 y@0x16054e0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) bvec4 x@0x14546c0)\n" - " (declare (in ) bvec4 y@0x14547d0)\n" + " (declare (in ) bvec4 x@0x16056c0)\n" + " (declare (in ) bvec4 y@0x16057d0)\n" " )\n" " (\n" " ))\n" @@ -14487,21 +14487,21 @@ static const char *prototypes_for_130_frag = "(function any\n" " (signature bool\n" " (parameters\n" - " (declare (in ) bvec2 x@0x14549b0)\n" + " (declare (in ) bvec2 x@0x16059b0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bool\n" " (parameters\n" - " (declare (in ) bvec3 x@0x1454d30)\n" + " (declare (in ) bvec3 x@0x1605d30)\n" " )\n" " (\n" " ))\n" "\n" " (signature bool\n" " (parameters\n" - " (declare (in ) bvec4 x@0x1454f10)\n" + " (declare (in ) bvec4 x@0x1605f10)\n" " )\n" " (\n" " ))\n" @@ -14511,21 +14511,21 @@ static const char *prototypes_for_130_frag = "(function all\n" " (signature bool\n" " (parameters\n" - " (declare (in ) bvec2 x@0x14550f0)\n" + " (declare (in ) bvec2 x@0x16060f0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bool\n" " (parameters\n" - " (declare (in ) bvec3 x@0x1455470)\n" + " (declare (in ) bvec3 x@0x1606470)\n" " )\n" " (\n" " ))\n" "\n" " (signature bool\n" " (parameters\n" - " (declare (in ) bvec4 x@0x1455650)\n" + " (declare (in ) bvec4 x@0x1606650)\n" " )\n" " (\n" " ))\n" @@ -14535,21 +14535,21 @@ static const char *prototypes_for_130_frag = "(function not\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) bvec2 x@0x1455830)\n" + " (declare (in ) bvec2 x@0x1606830)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) bvec3 x@0x1455bb0)\n" + " (declare (in ) bvec3 x@0x1606bb0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) bvec4 x@0x1455d90)\n" + " (declare (in ) bvec4 x@0x1606d90)\n" " )\n" " (\n" " ))\n" @@ -14559,382 +14559,382 @@ static const char *prototypes_for_130_frag = "(function texture\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1D sampler@0x1455f70)\n" - " (declare (in ) float P@0x1456080)\n" + " (declare (in ) sampler1D sampler@0x1606f70)\n" + " (declare (in ) float P@0x1607080)\n" " )\n" " (\n" " ))\n" "\n" " (signature ivec4\n" " (parameters\n" - " (declare (in ) isampler1D sampler@0x1456400)\n" - " (declare (in ) float P@0x1456510)\n" + " (declare (in ) isampler1D sampler@0x1607400)\n" + " (declare (in ) float P@0x1607510)\n" " )\n" " (\n" " ))\n" "\n" " (signature uvec4\n" " (parameters\n" - " (declare (in ) usampler1D sampler@0x14566f0)\n" - " (declare (in ) float P@0x1456800)\n" + " (declare (in ) usampler1D sampler@0x16076f0)\n" + " (declare (in ) float P@0x1607800)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2D sampler@0x14569e0)\n" - " (declare (in ) vec2 P@0x1456af0)\n" + " (declare (in ) sampler2D sampler@0x16079e0)\n" + " (declare (in ) vec2 P@0x1607af0)\n" " )\n" " (\n" " ))\n" "\n" " (signature ivec4\n" " (parameters\n" - " (declare (in ) isampler2D sampler@0x1456cd0)\n" - " (declare (in ) vec2 P@0x1456de0)\n" + " (declare (in ) isampler2D sampler@0x1607cd0)\n" + " (declare (in ) vec2 P@0x1607de0)\n" " )\n" " (\n" " ))\n" "\n" " (signature uvec4\n" " (parameters\n" - " (declare (in ) usampler2D sampler@0x1456fc0)\n" - " (declare (in ) vec2 P@0x14570d0)\n" + " (declare (in ) usampler2D sampler@0x1607fc0)\n" + " (declare (in ) vec2 P@0x16080d0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler3D sampler@0x14572b0)\n" - " (declare (in ) vec3 P@0x14573c0)\n" + " (declare (in ) sampler3D sampler@0x16082b0)\n" + " (declare (in ) vec3 P@0x16083c0)\n" " )\n" " (\n" " ))\n" "\n" " (signature ivec4\n" " (parameters\n" - " (declare (in ) isampler3D sampler@0x14575a0)\n" - " (declare (in ) vec3 P@0x14576b0)\n" + " (declare (in ) isampler3D sampler@0x16085a0)\n" + " (declare (in ) vec3 P@0x16086b0)\n" " )\n" " (\n" " ))\n" "\n" " (signature uvec4\n" " (parameters\n" - " (declare (in ) usampler3D sampler@0x1457890)\n" - " (declare (in ) vec3 P@0x14579a0)\n" + " (declare (in ) usampler3D sampler@0x1608890)\n" + " (declare (in ) vec3 P@0x16089a0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) samplerCube sampler@0x1457b80)\n" - " (declare (in ) vec3 P@0x1457c90)\n" + " (declare (in ) samplerCube sampler@0x1608b80)\n" + " (declare (in ) vec3 P@0x1608c90)\n" " )\n" " (\n" " ))\n" "\n" " (signature ivec4\n" " (parameters\n" - " (declare (in ) isamplerCube sampler@0x1457e70)\n" - " (declare (in ) vec3 P@0x1457f80)\n" + " (declare (in ) isamplerCube sampler@0x1608e70)\n" + " (declare (in ) vec3 P@0x1608f80)\n" " )\n" " (\n" " ))\n" "\n" " (signature uvec4\n" " (parameters\n" - " (declare (in ) usamplerCube sampler@0x1458160)\n" - " (declare (in ) vec3 P@0x1458270)\n" + " (declare (in ) usamplerCube sampler@0x1609160)\n" + " (declare (in ) vec3 P@0x1609270)\n" " )\n" " (\n" " ))\n" "\n" " (signature float\n" " (parameters\n" - " (declare (in ) sampler1DShadow sampler@0x1458450)\n" - " (declare (in ) vec3 P@0x1458560)\n" + " (declare (in ) sampler1DShadow sampler@0x1609450)\n" + " (declare (in ) vec3 P@0x1609560)\n" " )\n" " (\n" " ))\n" "\n" " (signature float\n" " (parameters\n" - " (declare (in ) sampler2DShadow sampler@0x1458740)\n" - " (declare (in ) vec3 P@0x1458850)\n" + " (declare (in ) sampler2DShadow sampler@0x1609740)\n" + " (declare (in ) vec3 P@0x1609850)\n" " )\n" " (\n" " ))\n" "\n" " (signature float\n" " (parameters\n" - " (declare (in ) samplerCubeShadow sampler@0x1458a30)\n" - " (declare (in ) vec4 P@0x1458b40)\n" + " (declare (in ) samplerCubeShadow sampler@0x1609a30)\n" + " (declare (in ) vec4 P@0x1609b40)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1DArray sampler@0x1458d20)\n" - " (declare (in ) vec2 P@0x1458e30)\n" + " (declare (in ) sampler1DArray sampler@0x1609d20)\n" + " (declare (in ) vec2 P@0x1609e30)\n" " )\n" " (\n" " ))\n" "\n" " (signature ivec4\n" " (parameters\n" - " (declare (in ) isampler1DArray sampler@0x1459010)\n" - " (declare (in ) vec2 P@0x1459120)\n" + " (declare (in ) isampler1DArray sampler@0x160a010)\n" + " (declare (in ) vec2 P@0x160a120)\n" " )\n" " (\n" " ))\n" "\n" " (signature uvec4\n" " (parameters\n" - " (declare (in ) usampler1DArray sampler@0x1459300)\n" - " (declare (in ) vec2 P@0x1459410)\n" + " (declare (in ) usampler1DArray sampler@0x160a300)\n" + " (declare (in ) vec2 P@0x160a410)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2DArray sampler@0x14595f0)\n" - " (declare (in ) vec3 P@0x1459700)\n" + " (declare (in ) sampler2DArray sampler@0x160a5f0)\n" + " (declare (in ) vec3 P@0x160a700)\n" " )\n" " (\n" " ))\n" "\n" " (signature ivec4\n" " (parameters\n" - " (declare (in ) isampler2DArray sampler@0x14598e0)\n" - " (declare (in ) vec3 P@0x14599f0)\n" + " (declare (in ) isampler2DArray sampler@0x160a8e0)\n" + " (declare (in ) vec3 P@0x160a9f0)\n" " )\n" " (\n" " ))\n" "\n" " (signature uvec4\n" " (parameters\n" - " (declare (in ) usampler2DArray sampler@0x1459bd0)\n" - " (declare (in ) vec3 P@0x1459ce0)\n" + " (declare (in ) usampler2DArray sampler@0x160abd0)\n" + " (declare (in ) vec3 P@0x160ace0)\n" " )\n" " (\n" " ))\n" "\n" " (signature float\n" " (parameters\n" - " (declare (in ) sampler1DArrayShadow sampler@0x1459ec0)\n" - " (declare (in ) vec3 P@0x1459fd0)\n" + " (declare (in ) sampler1DArrayShadow sampler@0x160aec0)\n" + " (declare (in ) vec3 P@0x160afd0)\n" " )\n" " (\n" " ))\n" "\n" " (signature float\n" " (parameters\n" - " (declare (in ) sampler2DArrayShadow sampler@0x145a1b0)\n" - " (declare (in ) vec4 P@0x145a2c0)\n" + " (declare (in ) sampler2DArrayShadow sampler@0x160b1b0)\n" + " (declare (in ) vec4 P@0x160b2c0)\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" + " (declare (in ) sampler1D sampler@0x160b4a0)\n" + " (declare (in ) float P@0x160b5b0)\n" + " (declare (in ) float bias@0x160b6c0)\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" + " (declare (in ) isampler1D sampler@0x160b8a0)\n" + " (declare (in ) float P@0x160b9b0)\n" + " (declare (in ) float bias@0x160bac0)\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" + " (declare (in ) usampler1D sampler@0x160bca0)\n" + " (declare (in ) float P@0x160bdb0)\n" + " (declare (in ) float bias@0x160bec0)\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" + " (declare (in ) sampler2D sampler@0x160c0a0)\n" + " (declare (in ) vec2 P@0x160c1b0)\n" + " (declare (in ) float bias@0x160c2c0)\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" + " (declare (in ) isampler2D sampler@0x160c4a0)\n" + " (declare (in ) vec2 P@0x160c5b0)\n" + " (declare (in ) float bias@0x160c6c0)\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" + " (declare (in ) usampler2D sampler@0x160c8a0)\n" + " (declare (in ) vec2 P@0x160c9b0)\n" + " (declare (in ) float bias@0x160cac0)\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" + " (declare (in ) sampler3D sampler@0x160cca0)\n" + " (declare (in ) vec3 P@0x160cdb0)\n" + " (declare (in ) float bias@0x160cec0)\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" + " (declare (in ) isampler3D sampler@0x160d0a0)\n" + " (declare (in ) vec3 P@0x160d1b0)\n" + " (declare (in ) float bias@0x160d2c0)\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" + " (declare (in ) usampler3D sampler@0x160d4a0)\n" + " (declare (in ) vec3 P@0x160d5b0)\n" + " (declare (in ) float bias@0x160d6c0)\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" + " (declare (in ) samplerCube sampler@0x160d8a0)\n" + " (declare (in ) vec3 P@0x160d9b0)\n" + " (declare (in ) float bias@0x160dac0)\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" + " (declare (in ) isamplerCube sampler@0x160dca0)\n" + " (declare (in ) vec3 P@0x160ddb0)\n" + " (declare (in ) float bias@0x160dec0)\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" + " (declare (in ) usamplerCube sampler@0x160e0a0)\n" + " (declare (in ) vec3 P@0x160e1b0)\n" + " (declare (in ) float bias@0x160e2c0)\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" + " (declare (in ) sampler1DShadow sampler@0x160e4a0)\n" + " (declare (in ) vec3 P@0x160e5b0)\n" + " (declare (in ) float bias@0x160e6c0)\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" + " (declare (in ) sampler2DShadow sampler@0x160e8a0)\n" + " (declare (in ) vec3 P@0x160e9b0)\n" + " (declare (in ) float bias@0x160eac0)\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" + " (declare (in ) samplerCubeShadow sampler@0x160eca0)\n" + " (declare (in ) vec4 P@0x160edb0)\n" + " (declare (in ) float bias@0x160eec0)\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" + " (declare (in ) sampler1DArray sampler@0x160f0a0)\n" + " (declare (in ) vec2 P@0x160f1b0)\n" + " (declare (in ) float bias@0x160f2c0)\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" + " (declare (in ) isampler1DArray sampler@0x160f4a0)\n" + " (declare (in ) vec2 P@0x160f5b0)\n" + " (declare (in ) float bias@0x160f6c0)\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" + " (declare (in ) usampler1DArray sampler@0x160f8a0)\n" + " (declare (in ) vec2 P@0x160f9b0)\n" + " (declare (in ) float bias@0x160fac0)\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" + " (declare (in ) sampler2DArray sampler@0x160fca0)\n" + " (declare (in ) vec3 P@0x160fdb0)\n" + " (declare (in ) float bias@0x160fec0)\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" + " (declare (in ) isampler2DArray sampler@0x16100a0)\n" + " (declare (in ) vec3 P@0x16101b0)\n" + " (declare (in ) float bias@0x16102c0)\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" + " (declare (in ) usampler2DArray sampler@0x16104a0)\n" + " (declare (in ) vec3 P@0x16105b0)\n" + " (declare (in ) float bias@0x16106c0)\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" + " (declare (in ) sampler1DArrayShadow sampler@0x16108a0)\n" + " (declare (in ) vec3 P@0x16109b0)\n" + " (declare (in ) float bias@0x1610ac0)\n" " )\n" " (\n" " ))\n" @@ -14944,289 +14944,289 @@ static const char *prototypes_for_130_frag = "(function textureProj\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1D sampler@0x145fca0)\n" - " (declare (in ) vec2 P@0x145fdb0)\n" + " (declare (in ) sampler1D sampler@0x1610ca0)\n" + " (declare (in ) vec2 P@0x1610db0)\n" " )\n" " (\n" " ))\n" "\n" " (signature ivec4\n" " (parameters\n" - " (declare (in ) isampler1D sampler@0x1460140)\n" - " (declare (in ) vec2 P@0x1460250)\n" + " (declare (in ) isampler1D sampler@0x1611140)\n" + " (declare (in ) vec2 P@0x1611250)\n" " )\n" " (\n" " ))\n" "\n" " (signature uvec4\n" " (parameters\n" - " (declare (in ) usampler1D sampler@0x1460430)\n" - " (declare (in ) vec2 P@0x1460540)\n" + " (declare (in ) usampler1D sampler@0x1611430)\n" + " (declare (in ) vec2 P@0x1611540)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1D sampler@0x1460720)\n" - " (declare (in ) vec4 P@0x1460830)\n" + " (declare (in ) sampler1D sampler@0x1611720)\n" + " (declare (in ) vec4 P@0x1611830)\n" " )\n" " (\n" " ))\n" "\n" " (signature ivec4\n" " (parameters\n" - " (declare (in ) isampler1D sampler@0x1460a10)\n" - " (declare (in ) vec4 P@0x1460b20)\n" + " (declare (in ) isampler1D sampler@0x1611a10)\n" + " (declare (in ) vec4 P@0x1611b20)\n" " )\n" " (\n" " ))\n" "\n" " (signature uvec4\n" " (parameters\n" - " (declare (in ) usampler1D sampler@0x1460d00)\n" - " (declare (in ) vec4 P@0x1460e10)\n" + " (declare (in ) usampler1D sampler@0x1611d00)\n" + " (declare (in ) vec4 P@0x1611e10)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2D sampler@0x1460ff0)\n" - " (declare (in ) vec3 P@0x1461100)\n" + " (declare (in ) sampler2D sampler@0x1611ff0)\n" + " (declare (in ) vec3 P@0x1612100)\n" " )\n" " (\n" " ))\n" "\n" " (signature ivec4\n" " (parameters\n" - " (declare (in ) isampler2D sampler@0x14612e0)\n" - " (declare (in ) vec3 P@0x14613f0)\n" + " (declare (in ) isampler2D sampler@0x16122e0)\n" + " (declare (in ) vec3 P@0x16123f0)\n" " )\n" " (\n" " ))\n" "\n" " (signature uvec4\n" " (parameters\n" - " (declare (in ) usampler2D sampler@0x14615d0)\n" - " (declare (in ) vec3 P@0x14616e0)\n" + " (declare (in ) usampler2D sampler@0x16125d0)\n" + " (declare (in ) vec3 P@0x16126e0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2D sampler@0x14618c0)\n" - " (declare (in ) vec4 P@0x14619d0)\n" + " (declare (in ) sampler2D sampler@0x16128c0)\n" + " (declare (in ) vec4 P@0x16129d0)\n" " )\n" " (\n" " ))\n" "\n" " (signature ivec4\n" " (parameters\n" - " (declare (in ) isampler2D sampler@0x1461bb0)\n" - " (declare (in ) vec4 P@0x1461cc0)\n" + " (declare (in ) isampler2D sampler@0x1612bb0)\n" + " (declare (in ) vec4 P@0x1612cc0)\n" " )\n" " (\n" " ))\n" "\n" " (signature uvec4\n" " (parameters\n" - " (declare (in ) usampler2D sampler@0x1461ea0)\n" - " (declare (in ) vec4 P@0x1461fb0)\n" + " (declare (in ) usampler2D sampler@0x1612ea0)\n" + " (declare (in ) vec4 P@0x1612fb0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler3D sampler@0x1462190)\n" - " (declare (in ) vec4 P@0x14622a0)\n" + " (declare (in ) sampler3D sampler@0x1613190)\n" + " (declare (in ) vec4 P@0x16132a0)\n" " )\n" " (\n" " ))\n" "\n" " (signature ivec4\n" " (parameters\n" - " (declare (in ) isampler3D sampler@0x1462480)\n" - " (declare (in ) vec4 P@0x1462590)\n" + " (declare (in ) isampler3D sampler@0x1613480)\n" + " (declare (in ) vec4 P@0x1613590)\n" " )\n" " (\n" " ))\n" "\n" " (signature uvec4\n" " (parameters\n" - " (declare (in ) usampler3D sampler@0x1462770)\n" - " (declare (in ) vec4 P@0x1462880)\n" + " (declare (in ) usampler3D sampler@0x1613770)\n" + " (declare (in ) vec4 P@0x1613880)\n" " )\n" " (\n" " ))\n" "\n" " (signature float\n" " (parameters\n" - " (declare (in ) sampler1DShadow sampler@0x1462a60)\n" - " (declare (in ) vec4 P@0x1462b70)\n" + " (declare (in ) sampler1DShadow sampler@0x1613a60)\n" + " (declare (in ) vec4 P@0x1613b70)\n" " )\n" " (\n" " ))\n" "\n" " (signature float\n" " (parameters\n" - " (declare (in ) sampler2DShadow sampler@0x1462d50)\n" - " (declare (in ) vec4 P@0x1462e60)\n" + " (declare (in ) sampler2DShadow sampler@0x1613d50)\n" + " (declare (in ) vec4 P@0x1613e60)\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" + " (declare (in ) sampler1D sampler@0x1614040)\n" + " (declare (in ) vec2 P@0x1614150)\n" + " (declare (in ) float bias@0x1614260)\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" + " (declare (in ) isampler1D sampler@0x1614440)\n" + " (declare (in ) vec2 P@0x1614550)\n" + " (declare (in ) float bias@0x1614660)\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" + " (declare (in ) usampler1D sampler@0x1614840)\n" + " (declare (in ) vec2 P@0x1614950)\n" + " (declare (in ) float bias@0x1614a60)\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" + " (declare (in ) sampler1D sampler@0x1614c40)\n" + " (declare (in ) vec4 P@0x1614d50)\n" + " (declare (in ) float bias@0x1614e60)\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" + " (declare (in ) isampler1D sampler@0x1615040)\n" + " (declare (in ) vec4 P@0x1615150)\n" + " (declare (in ) float bias@0x1615260)\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" + " (declare (in ) usampler1D sampler@0x1615440)\n" + " (declare (in ) vec4 P@0x1615550)\n" + " (declare (in ) float bias@0x1615660)\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" + " (declare (in ) sampler2D sampler@0x1615840)\n" + " (declare (in ) vec3 P@0x1615950)\n" + " (declare (in ) float bias@0x1615a60)\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" + " (declare (in ) isampler2D sampler@0x1615c40)\n" + " (declare (in ) vec3 P@0x1615d50)\n" + " (declare (in ) float bias@0x1615e60)\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" + " (declare (in ) usampler2D sampler@0x1616040)\n" + " (declare (in ) vec3 P@0x1616150)\n" + " (declare (in ) float bias@0x1616260)\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" + " (declare (in ) sampler2D sampler@0x1616440)\n" + " (declare (in ) vec4 P@0x1616550)\n" + " (declare (in ) float bias@0x1616660)\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" + " (declare (in ) isampler2D sampler@0x1616840)\n" + " (declare (in ) vec4 P@0x1616950)\n" + " (declare (in ) float bias@0x1616a60)\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" + " (declare (in ) usampler2D sampler@0x1616c40)\n" + " (declare (in ) vec4 P@0x1616d50)\n" + " (declare (in ) float bias@0x1616e60)\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" + " (declare (in ) sampler3D sampler@0x1617040)\n" + " (declare (in ) vec4 P@0x1617150)\n" + " (declare (in ) float bias@0x1617260)\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" + " (declare (in ) isampler3D sampler@0x1617440)\n" + " (declare (in ) vec4 P@0x1617550)\n" + " (declare (in ) float bias@0x1617660)\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" + " (declare (in ) usampler3D sampler@0x1617840)\n" + " (declare (in ) vec4 P@0x1617950)\n" + " (declare (in ) float bias@0x1617a60)\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" + " (declare (in ) sampler1DShadow sampler@0x1617c40)\n" + " (declare (in ) vec4 P@0x1617d50)\n" + " (declare (in ) float bias@0x1617e60)\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" + " (declare (in ) sampler2DShadow sampler@0x1618040)\n" + " (declare (in ) vec4 P@0x1618150)\n" + " (declare (in ) float bias@0x1618260)\n" " )\n" " (\n" " ))\n" @@ -15236,189 +15236,189 @@ static const char *prototypes_for_130_frag = "(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" + " (declare (in ) sampler1D sampler@0x1618440)\n" + " (declare (in ) float P@0x1618550)\n" + " (declare (in ) float lod@0x1618660)\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" + " (declare (in ) isampler1D sampler@0x16189f0)\n" + " (declare (in ) float P@0x1618b00)\n" + " (declare (in ) float lod@0x1618c10)\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" + " (declare (in ) usampler1D sampler@0x1618df0)\n" + " (declare (in ) float P@0x1618f00)\n" + " (declare (in ) float lod@0x1619010)\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" + " (declare (in ) sampler2D sampler@0x16191f0)\n" + " (declare (in ) vec2 P@0x1619300)\n" + " (declare (in ) float lod@0x1619410)\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" + " (declare (in ) isampler2D sampler@0x16195f0)\n" + " (declare (in ) vec2 P@0x1619700)\n" + " (declare (in ) float lod@0x1619810)\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" + " (declare (in ) usampler2D sampler@0x16199f0)\n" + " (declare (in ) vec2 P@0x1619b00)\n" + " (declare (in ) float lod@0x1619c10)\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" + " (declare (in ) sampler3D sampler@0x1619df0)\n" + " (declare (in ) vec3 P@0x1619f00)\n" + " (declare (in ) float lod@0x161a010)\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" + " (declare (in ) isampler3D sampler@0x161a1f0)\n" + " (declare (in ) vec3 P@0x161a300)\n" + " (declare (in ) float lod@0x161a410)\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" + " (declare (in ) usampler3D sampler@0x161a5f0)\n" + " (declare (in ) vec3 P@0x161a700)\n" + " (declare (in ) float lod@0x161a810)\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" + " (declare (in ) samplerCube sampler@0x161a9f0)\n" + " (declare (in ) vec3 P@0x161ab00)\n" + " (declare (in ) float lod@0x161ac10)\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" + " (declare (in ) isamplerCube sampler@0x161adf0)\n" + " (declare (in ) vec3 P@0x161af00)\n" + " (declare (in ) float lod@0x161b010)\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" + " (declare (in ) usamplerCube sampler@0x161b1f0)\n" + " (declare (in ) vec3 P@0x161b300)\n" + " (declare (in ) float lod@0x161b410)\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" + " (declare (in ) sampler1DShadow sampler@0x161b5f0)\n" + " (declare (in ) vec3 P@0x161b700)\n" + " (declare (in ) float lod@0x161b810)\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" + " (declare (in ) sampler2DShadow sampler@0x161b9f0)\n" + " (declare (in ) vec3 P@0x161bb00)\n" + " (declare (in ) float lod@0x161bc10)\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" + " (declare (in ) sampler1DArray sampler@0x161bdf0)\n" + " (declare (in ) vec2 P@0x161bf00)\n" + " (declare (in ) float lod@0x161c010)\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" + " (declare (in ) isampler1DArray sampler@0x161c1f0)\n" + " (declare (in ) vec2 P@0x161c300)\n" + " (declare (in ) float lod@0x161c410)\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" + " (declare (in ) usampler1DArray sampler@0x161c5f0)\n" + " (declare (in ) vec2 P@0x161c700)\n" + " (declare (in ) float lod@0x161c810)\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" + " (declare (in ) sampler2DArray sampler@0x161c9f0)\n" + " (declare (in ) vec3 P@0x161cb00)\n" + " (declare (in ) float lod@0x161cc10)\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" + " (declare (in ) isampler2DArray sampler@0x161cdf0)\n" + " (declare (in ) vec3 P@0x161cf00)\n" + " (declare (in ) float lod@0x161d010)\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" + " (declare (in ) usampler2DArray sampler@0x161d1f0)\n" + " (declare (in ) vec3 P@0x161d300)\n" + " (declare (in ) float lod@0x161d410)\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" + " (declare (in ) sampler1DArrayShadow sampler@0x161d5f0)\n" + " (declare (in ) vec3 P@0x161d700)\n" + " (declare (in ) float lod@0x161d810)\n" " )\n" " (\n" " ))\n" @@ -15428,135 +15428,135 @@ static const char *prototypes_for_130_frag = "(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" + " (declare (in ) sampler1D sampler@0x161d9f0)\n" + " (declare (in ) int P@0x161db00)\n" + " (declare (in ) int lod@0x161dc10)\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" + " (declare (in ) isampler1D sampler@0x161dfa0)\n" + " (declare (in ) int P@0x161e0b0)\n" + " (declare (in ) int lod@0x161e1c0)\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" + " (declare (in ) usampler1D sampler@0x161e3a0)\n" + " (declare (in ) int P@0x161e4b0)\n" + " (declare (in ) int lod@0x161e5c0)\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" + " (declare (in ) sampler2D sampler@0x161e7a0)\n" + " (declare (in ) ivec2 P@0x161e8b0)\n" + " (declare (in ) int lod@0x161e9c0)\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" + " (declare (in ) isampler2D sampler@0x161eba0)\n" + " (declare (in ) ivec2 P@0x161ecb0)\n" + " (declare (in ) int lod@0x161edc0)\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" + " (declare (in ) usampler2D sampler@0x161efa0)\n" + " (declare (in ) ivec2 P@0x161f0b0)\n" + " (declare (in ) int lod@0x161f1c0)\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" + " (declare (in ) sampler3D sampler@0x161f3a0)\n" + " (declare (in ) ivec3 P@0x161f4b0)\n" + " (declare (in ) int lod@0x161f5c0)\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" + " (declare (in ) isampler3D sampler@0x161f7a0)\n" + " (declare (in ) ivec3 P@0x161f8b0)\n" + " (declare (in ) int lod@0x161f9c0)\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" + " (declare (in ) usampler3D sampler@0x161fba0)\n" + " (declare (in ) ivec3 P@0x161fcb0)\n" + " (declare (in ) int lod@0x161fdc0)\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" + " (declare (in ) sampler1DArray sampler@0x161ffa0)\n" + " (declare (in ) ivec2 P@0x16200b0)\n" + " (declare (in ) int lod@0x16201c0)\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" + " (declare (in ) isampler1DArray sampler@0x16203a0)\n" + " (declare (in ) ivec2 P@0x16204b0)\n" + " (declare (in ) int lod@0x16205c0)\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" + " (declare (in ) usampler1DArray sampler@0x16207a0)\n" + " (declare (in ) ivec2 P@0x16208b0)\n" + " (declare (in ) int lod@0x16209c0)\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" + " (declare (in ) sampler2DArray sampler@0x1620ba0)\n" + " (declare (in ) ivec3 P@0x1620cb0)\n" + " (declare (in ) int lod@0x1620dc0)\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" + " (declare (in ) isampler2DArray sampler@0x1620fa0)\n" + " (declare (in ) ivec3 P@0x16210b0)\n" + " (declare (in ) int lod@0x16211c0)\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" + " (declare (in ) usampler2DArray sampler@0x16213a0)\n" + " (declare (in ) ivec3 P@0x16214b0)\n" + " (declare (in ) int lod@0x16215c0)\n" " )\n" " (\n" " ))\n" @@ -15566,153 +15566,153 @@ static const char *prototypes_for_130_frag = "(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" + " (declare (in ) sampler1D sampler@0x16217a0)\n" + " (declare (in ) vec2 P@0x16218b0)\n" + " (declare (in ) float lod@0x16219c0)\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" + " (declare (in ) isampler1D sampler@0x1621d50)\n" + " (declare (in ) vec2 P@0x1621e60)\n" + " (declare (in ) float lod@0x1621f70)\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" + " (declare (in ) usampler1D sampler@0x1622150)\n" + " (declare (in ) vec2 P@0x1622260)\n" + " (declare (in ) float lod@0x1622370)\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" + " (declare (in ) sampler1D sampler@0x1622550)\n" + " (declare (in ) vec4 P@0x1622660)\n" + " (declare (in ) float lod@0x1622770)\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" + " (declare (in ) isampler1D sampler@0x1622950)\n" + " (declare (in ) vec4 P@0x1622a60)\n" + " (declare (in ) float lod@0x1622b70)\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" + " (declare (in ) usampler1D sampler@0x1622d50)\n" + " (declare (in ) vec4 P@0x1622e60)\n" + " (declare (in ) float lod@0x1622f70)\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" + " (declare (in ) sampler2D sampler@0x1623150)\n" + " (declare (in ) vec3 P@0x1623260)\n" + " (declare (in ) float lod@0x1623370)\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" + " (declare (in ) isampler2D sampler@0x1623550)\n" + " (declare (in ) vec3 P@0x1623660)\n" + " (declare (in ) float lod@0x1623770)\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" + " (declare (in ) usampler2D sampler@0x1623950)\n" + " (declare (in ) vec3 P@0x1623a60)\n" + " (declare (in ) float lod@0x1623b70)\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" + " (declare (in ) sampler2D sampler@0x1623d50)\n" + " (declare (in ) vec4 P@0x1623e60)\n" + " (declare (in ) float lod@0x1623f70)\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" + " (declare (in ) isampler2D sampler@0x1624150)\n" + " (declare (in ) vec4 P@0x1624260)\n" + " (declare (in ) float lod@0x1624370)\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" + " (declare (in ) usampler2D sampler@0x1624550)\n" + " (declare (in ) vec4 P@0x1624660)\n" + " (declare (in ) float lod@0x1624770)\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" + " (declare (in ) sampler3D sampler@0x1624950)\n" + " (declare (in ) vec4 P@0x1624a60)\n" + " (declare (in ) float lod@0x1624b70)\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" + " (declare (in ) isampler3D sampler@0x1624d50)\n" + " (declare (in ) vec4 P@0x1624e60)\n" + " (declare (in ) float lod@0x1624f70)\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" + " (declare (in ) usampler3D sampler@0x1625150)\n" + " (declare (in ) vec4 P@0x1625260)\n" + " (declare (in ) float lod@0x1625370)\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" + " (declare (in ) sampler1DShadow sampler@0x1625550)\n" + " (declare (in ) vec4 P@0x1625660)\n" + " (declare (in ) float lod@0x1625770)\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" + " (declare (in ) sampler2DShadow sampler@0x1625950)\n" + " (declare (in ) vec4 P@0x1625a60)\n" + " (declare (in ) float lod@0x1625b70)\n" " )\n" " (\n" " ))\n" @@ -15722,230 +15722,230 @@ static const char *prototypes_for_130_frag = "(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" + " (declare (in ) sampler1D sampler@0x1625d50)\n" + " (declare (in ) float P@0x1625e60)\n" + " (declare (in ) float dPdx@0x1625f70)\n" + " (declare (in ) float dPdy@0x1626080)\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" + " (declare (in ) isampler1D sampler@0x1626410)\n" + " (declare (in ) float P@0x1626520)\n" + " (declare (in ) float dPdx@0x1626630)\n" + " (declare (in ) float dPdy@0x1626740)\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" + " (declare (in ) usampler1D sampler@0x1626920)\n" + " (declare (in ) float P@0x1626a30)\n" + " (declare (in ) float dPdx@0x1626b40)\n" + " (declare (in ) float dPdy@0x1626c50)\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" + " (declare (in ) sampler2D sampler@0x1626e30)\n" + " (declare (in ) vec2 P@0x1626f40)\n" + " (declare (in ) vec2 dPdx@0x1627050)\n" + " (declare (in ) vec2 dPdy@0x1627160)\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" + " (declare (in ) isampler2D sampler@0x1627340)\n" + " (declare (in ) vec2 P@0x1627450)\n" + " (declare (in ) vec2 dPdx@0x1627560)\n" + " (declare (in ) vec2 dPdy@0x1627670)\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" + " (declare (in ) usampler2D sampler@0x1627850)\n" + " (declare (in ) vec2 P@0x1627960)\n" + " (declare (in ) vec2 dPdx@0x1627a70)\n" + " (declare (in ) vec2 dPdy@0x1627b80)\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" + " (declare (in ) sampler3D sampler@0x1627d60)\n" + " (declare (in ) vec3 P@0x1627e70)\n" + " (declare (in ) vec3 dPdx@0x1627f80)\n" + " (declare (in ) vec3 dPdy@0x1628090)\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" + " (declare (in ) isampler3D sampler@0x1628270)\n" + " (declare (in ) vec3 P@0x1628380)\n" + " (declare (in ) vec3 dPdx@0x1628490)\n" + " (declare (in ) vec3 dPdy@0x16285a0)\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" + " (declare (in ) usampler3D sampler@0x1628780)\n" + " (declare (in ) vec3 P@0x1628890)\n" + " (declare (in ) vec3 dPdx@0x16289a0)\n" + " (declare (in ) vec3 dPdy@0x1628ab0)\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" + " (declare (in ) samplerCube sampler@0x1628c90)\n" + " (declare (in ) vec3 P@0x1628da0)\n" + " (declare (in ) vec3 dPdx@0x1628eb0)\n" + " (declare (in ) vec3 dPdy@0x1628fc0)\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" + " (declare (in ) isamplerCube sampler@0x16291a0)\n" + " (declare (in ) vec3 P@0x16292b0)\n" + " (declare (in ) vec3 dPdx@0x16293c0)\n" + " (declare (in ) vec3 dPdy@0x16294d0)\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" + " (declare (in ) usamplerCube sampler@0x16296b0)\n" + " (declare (in ) vec3 P@0x16297c0)\n" + " (declare (in ) vec3 dPdx@0x16298d0)\n" + " (declare (in ) vec3 dPdy@0x16299e0)\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" + " (declare (in ) sampler1DShadow sampler@0x1629bc0)\n" + " (declare (in ) vec3 P@0x1629cd0)\n" + " (declare (in ) float dPdx@0x1629de0)\n" + " (declare (in ) float dPdy@0x1629ef0)\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" + " (declare (in ) sampler2DShadow sampler@0x162a0d0)\n" + " (declare (in ) vec3 P@0x162a1e0)\n" + " (declare (in ) vec2 dPdx@0x162a2f0)\n" + " (declare (in ) vec2 dPdy@0x162a400)\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" + " (declare (in ) samplerCubeShadow sampler@0x162a5e0)\n" + " (declare (in ) vec4 P@0x162a6f0)\n" + " (declare (in ) vec3 dPdx@0x162a800)\n" + " (declare (in ) vec3 dPdy@0x162a910)\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" + " (declare (in ) sampler1DArray sampler@0x162aaf0)\n" + " (declare (in ) vec2 P@0x162ac00)\n" + " (declare (in ) float dPdx@0x162ad10)\n" + " (declare (in ) float dPdy@0x162ae20)\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" + " (declare (in ) isampler1DArray sampler@0x162b000)\n" + " (declare (in ) vec2 P@0x162b110)\n" + " (declare (in ) float dPdx@0x162b220)\n" + " (declare (in ) float dPdy@0x162b330)\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" + " (declare (in ) usampler1DArray sampler@0x162b510)\n" + " (declare (in ) vec2 P@0x162b620)\n" + " (declare (in ) float dPdx@0x162b730)\n" + " (declare (in ) float dPdy@0x162b840)\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" + " (declare (in ) sampler2DArray sampler@0x162ba20)\n" + " (declare (in ) vec3 P@0x162bb30)\n" + " (declare (in ) vec2 dPdx@0x162bc40)\n" + " (declare (in ) vec2 dPdy@0x162bd50)\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" + " (declare (in ) isampler2DArray sampler@0x162bf30)\n" + " (declare (in ) vec3 P@0x162c040)\n" + " (declare (in ) vec2 dPdx@0x162c150)\n" + " (declare (in ) vec2 dPdy@0x162c260)\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" + " (declare (in ) usampler2DArray sampler@0x162c440)\n" + " (declare (in ) vec3 P@0x162c550)\n" + " (declare (in ) vec2 dPdx@0x162c660)\n" + " (declare (in ) vec2 dPdy@0x162c770)\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" + " (declare (in ) sampler1DArrayShadow sampler@0x162c950)\n" + " (declare (in ) vec3 P@0x162ca60)\n" + " (declare (in ) float dPdx@0x162cb70)\n" + " (declare (in ) float dPdy@0x162cc80)\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" + " (declare (in ) sampler2DArrayShadow sampler@0x162ce60)\n" + " (declare (in ) vec4 P@0x162cf70)\n" + " (declare (in ) vec2 dPdx@0x162d080)\n" + " (declare (in ) vec2 dPdy@0x162d190)\n" " )\n" " (\n" " ))\n" @@ -15955,170 +15955,170 @@ static const char *prototypes_for_130_frag = "(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" + " (declare (in ) sampler1D sampler@0x162d370)\n" + " (declare (in ) vec2 P@0x162d480)\n" + " (declare (in ) float dPdx@0x162d590)\n" + " (declare (in ) float dPdy@0x162d6a0)\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" + " (declare (in ) isampler1D sampler@0x162da30)\n" + " (declare (in ) vec2 P@0x162db40)\n" + " (declare (in ) float dPdx@0x162dc50)\n" + " (declare (in ) float dPdy@0x162dd60)\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" + " (declare (in ) usampler1D sampler@0x162df40)\n" + " (declare (in ) vec2 P@0x162e050)\n" + " (declare (in ) float dPdx@0x162e160)\n" + " (declare (in ) float dPdy@0x162e270)\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" + " (declare (in ) sampler1D sampler@0x162e450)\n" + " (declare (in ) vec4 P@0x162e560)\n" + " (declare (in ) float dPdx@0x162e670)\n" + " (declare (in ) float dPdy@0x162e780)\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" + " (declare (in ) isampler1D sampler@0x162e960)\n" + " (declare (in ) vec4 P@0x162ea70)\n" + " (declare (in ) float dPdx@0x162eb80)\n" + " (declare (in ) float dPdy@0x162ec90)\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" + " (declare (in ) usampler1D sampler@0x162ee70)\n" + " (declare (in ) vec4 P@0x162ef80)\n" + " (declare (in ) float dPdx@0x162f090)\n" + " (declare (in ) float dPdy@0x162f1a0)\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" + " (declare (in ) sampler2D sampler@0x162f380)\n" + " (declare (in ) vec3 P@0x162f490)\n" + " (declare (in ) vec2 dPdx@0x162f5a0)\n" + " (declare (in ) vec2 dPdy@0x162f6b0)\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" + " (declare (in ) isampler2D sampler@0x162f890)\n" + " (declare (in ) vec3 P@0x162f9a0)\n" + " (declare (in ) vec2 dPdx@0x162fab0)\n" + " (declare (in ) vec2 dPdy@0x162fbc0)\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" + " (declare (in ) usampler2D sampler@0x162fda0)\n" + " (declare (in ) vec3 P@0x162feb0)\n" + " (declare (in ) vec2 dPdx@0x162ffc0)\n" + " (declare (in ) vec2 dPdy@0x16300d0)\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" + " (declare (in ) sampler2D sampler@0x16302b0)\n" + " (declare (in ) vec4 P@0x16303c0)\n" + " (declare (in ) vec2 dPdx@0x16304d0)\n" + " (declare (in ) vec2 dPdy@0x16305e0)\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" + " (declare (in ) isampler2D sampler@0x16307c0)\n" + " (declare (in ) vec4 P@0x16308d0)\n" + " (declare (in ) vec2 dPdx@0x16309e0)\n" + " (declare (in ) vec2 dPdy@0x1630af0)\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" + " (declare (in ) usampler2D sampler@0x1630cd0)\n" + " (declare (in ) vec4 P@0x1630de0)\n" + " (declare (in ) vec2 dPdx@0x1630ef0)\n" + " (declare (in ) vec2 dPdy@0x1631000)\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" + " (declare (in ) sampler3D sampler@0x16311e0)\n" + " (declare (in ) vec4 P@0x16312f0)\n" + " (declare (in ) vec3 dPdx@0x1631400)\n" + " (declare (in ) vec3 dPdy@0x1631510)\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" + " (declare (in ) isampler3D sampler@0x16316f0)\n" + " (declare (in ) vec4 P@0x1631800)\n" + " (declare (in ) vec3 dPdx@0x1631910)\n" + " (declare (in ) vec3 dPdy@0x1631a20)\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" + " (declare (in ) usampler3D sampler@0x1631c00)\n" + " (declare (in ) vec4 P@0x1631d10)\n" + " (declare (in ) vec3 dPdx@0x1631e20)\n" + " (declare (in ) vec3 dPdy@0x1631f30)\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" + " (declare (in ) sampler1DShadow sampler@0x1632110)\n" + " (declare (in ) vec4 P@0x1632220)\n" + " (declare (in ) float dPdx@0x1632330)\n" + " (declare (in ) float dPdy@0x1632440)\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" + " (declare (in ) sampler2DShadow sampler@0x1632620)\n" + " (declare (in ) vec4 P@0x1632730)\n" + " (declare (in ) vec2 dPdx@0x1632840)\n" + " (declare (in ) vec2 dPdy@0x1632950)\n" " )\n" " (\n" " ))\n" @@ -16128,17 +16128,17 @@ static const char *prototypes_for_130_frag = "(function texture1D\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1D sampler@0x1481b30)\n" - " (declare (in ) float coord@0x1481c40)\n" + " (declare (in ) sampler1D sampler@0x1632b30)\n" + " (declare (in ) float coord@0x1632c40)\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" + " (declare (in ) sampler1D sampler@0x1633760)\n" + " (declare (in ) float coord@0x1633870)\n" + " (declare (in ) float bias@0x1633980)\n" " )\n" " (\n" " ))\n" @@ -16148,34 +16148,34 @@ static const char *prototypes_for_130_frag = "(function texture1DProj\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1D sampler@0x1481fd0)\n" - " (declare (in ) vec2 coord@0x14820e0)\n" + " (declare (in ) sampler1D sampler@0x1632fd0)\n" + " (declare (in ) vec2 coord@0x16330e0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1D sampler@0x1482470)\n" - " (declare (in ) vec4 coord@0x1482580)\n" + " (declare (in ) sampler1D sampler@0x1633470)\n" + " (declare (in ) vec4 coord@0x1633580)\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" + " (declare (in ) sampler1D sampler@0x1633b60)\n" + " (declare (in ) vec2 coord@0x1633c70)\n" + " (declare (in ) float bias@0x1633d80)\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" + " (declare (in ) sampler1D sampler@0x1633f60)\n" + " (declare (in ) vec4 coord@0x1634070)\n" + " (declare (in ) float bias@0x1634180)\n" " )\n" " (\n" " ))\n" @@ -16185,9 +16185,9 @@ static const char *prototypes_for_130_frag = "(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" + " (declare (in ) sampler1D sampler@0x1634360)\n" + " (declare (in ) float coord@0x1634470)\n" + " (declare (in ) float lod@0x1634580)\n" " )\n" " (\n" " ))\n" @@ -16197,18 +16197,18 @@ static const char *prototypes_for_130_frag = "(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" + " (declare (in ) sampler1D sampler@0x1634910)\n" + " (declare (in ) vec2 coord@0x1634a20)\n" + " (declare (in ) float lod@0x1634b30)\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" + " (declare (in ) sampler1D sampler@0x1634ec0)\n" + " (declare (in ) vec4 coord@0x1634fd0)\n" + " (declare (in ) float lod@0x16350e0)\n" " )\n" " (\n" " ))\n" @@ -16218,17 +16218,17 @@ static const char *prototypes_for_130_frag = "(function texture2D\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2D sampler@0x14842c0)\n" - " (declare (in ) vec2 coord@0x14843d0)\n" + " (declare (in ) sampler2D sampler@0x16352c0)\n" + " (declare (in ) vec2 coord@0x16353d0)\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" + " (declare (in ) sampler2D sampler@0x1635ef0)\n" + " (declare (in ) vec2 coord@0x1636000)\n" + " (declare (in ) float bias@0x1636110)\n" " )\n" " (\n" " ))\n" @@ -16238,34 +16238,34 @@ static const char *prototypes_for_130_frag = "(function texture2DProj\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2D sampler@0x1484760)\n" - " (declare (in ) vec3 coord@0x1484870)\n" + " (declare (in ) sampler2D sampler@0x1635760)\n" + " (declare (in ) vec3 coord@0x1635870)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2D sampler@0x1484c00)\n" - " (declare (in ) vec4 coord@0x1484d10)\n" + " (declare (in ) sampler2D sampler@0x1635c00)\n" + " (declare (in ) vec4 coord@0x1635d10)\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" + " (declare (in ) sampler2D sampler@0x16362f0)\n" + " (declare (in ) vec3 coord@0x1636400)\n" + " (declare (in ) float bias@0x1636510)\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" + " (declare (in ) sampler2D sampler@0x16366f0)\n" + " (declare (in ) vec4 coord@0x1636800)\n" + " (declare (in ) float bias@0x1636910)\n" " )\n" " (\n" " ))\n" @@ -16275,9 +16275,9 @@ static const char *prototypes_for_130_frag = "(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" + " (declare (in ) sampler2D sampler@0x1636af0)\n" + " (declare (in ) vec2 coord@0x1636c00)\n" + " (declare (in ) float lod@0x1636d10)\n" " )\n" " (\n" " ))\n" @@ -16287,18 +16287,18 @@ static const char *prototypes_for_130_frag = "(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" + " (declare (in ) sampler2D sampler@0x16370a0)\n" + " (declare (in ) vec3 coord@0x16371b0)\n" + " (declare (in ) float lod@0x16372c0)\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" + " (declare (in ) sampler2D sampler@0x1637650)\n" + " (declare (in ) vec4 coord@0x1637760)\n" + " (declare (in ) float lod@0x1637870)\n" " )\n" " (\n" " ))\n" @@ -16308,17 +16308,17 @@ static const char *prototypes_for_130_frag = "(function texture3D\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler3D sampler@0x1486a50)\n" - " (declare (in ) vec3 coord@0x1486b60)\n" + " (declare (in ) sampler3D sampler@0x1637a50)\n" + " (declare (in ) vec3 coord@0x1637b60)\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" + " (declare (in ) sampler3D sampler@0x1638390)\n" + " (declare (in ) vec3 coord@0x16384a0)\n" + " (declare (in ) float bias@0x16385b0)\n" " )\n" " (\n" " ))\n" @@ -16328,17 +16328,17 @@ static const char *prototypes_for_130_frag = "(function texture3DProj\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler3D sampler@0x1486ef0)\n" - " (declare (in ) vec4 coord@0x1487000)\n" + " (declare (in ) sampler3D sampler@0x1637ef0)\n" + " (declare (in ) vec4 coord@0x1638000)\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" + " (declare (in ) sampler3D sampler@0x1638790)\n" + " (declare (in ) vec4 coord@0x16388a0)\n" + " (declare (in ) float bias@0x16389b0)\n" " )\n" " (\n" " ))\n" @@ -16348,9 +16348,9 @@ static const char *prototypes_for_130_frag = "(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" + " (declare (in ) sampler3D sampler@0x1638b90)\n" + " (declare (in ) vec3 coord@0x1638ca0)\n" + " (declare (in ) float lod@0x1638db0)\n" " )\n" " (\n" " ))\n" @@ -16360,9 +16360,9 @@ static const char *prototypes_for_130_frag = "(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" + " (declare (in ) sampler3D sampler@0x1639140)\n" + " (declare (in ) vec4 coord@0x1639250)\n" + " (declare (in ) float lod@0x1639360)\n" " )\n" " (\n" " ))\n" @@ -16372,17 +16372,17 @@ static const char *prototypes_for_130_frag = "(function textureCube\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) samplerCube sampler@0x14886f0)\n" - " (declare (in ) vec3 coord@0x1488800)\n" + " (declare (in ) samplerCube sampler@0x16396f0)\n" + " (declare (in ) vec3 coord@0x1639800)\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" + " (declare (in ) samplerCube sampler@0x1639b90)\n" + " (declare (in ) vec3 coord@0x1639ca0)\n" + " (declare (in ) float bias@0x1639db0)\n" " )\n" " (\n" " ))\n" @@ -16392,9 +16392,9 @@ static const char *prototypes_for_130_frag = "(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" + " (declare (in ) samplerCube sampler@0x1639f90)\n" + " (declare (in ) vec3 coord@0x163a0a0)\n" + " (declare (in ) float lod@0x163a1b0)\n" " )\n" " (\n" " ))\n" @@ -16404,17 +16404,17 @@ static const char *prototypes_for_130_frag = "(function shadow1D\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1DShadow sampler@0x1489540)\n" - " (declare (in ) vec3 coord@0x1489650)\n" + " (declare (in ) sampler1DShadow sampler@0x163a540)\n" + " (declare (in ) vec3 coord@0x163a650)\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" + " (declare (in ) sampler1DShadow sampler@0x163b7c0)\n" + " (declare (in ) vec3 coord@0x163b8d0)\n" + " (declare (in ) float bias@0x163b9e0)\n" " )\n" " (\n" " ))\n" @@ -16424,17 +16424,17 @@ static const char *prototypes_for_130_frag = "(function shadow2D\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2DShadow sampler@0x14899e0)\n" - " (declare (in ) vec3 coord@0x1489af0)\n" + " (declare (in ) sampler2DShadow sampler@0x163a9e0)\n" + " (declare (in ) vec3 coord@0x163aaf0)\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" + " (declare (in ) sampler2DShadow sampler@0x163bbc0)\n" + " (declare (in ) vec3 coord@0x163bcd0)\n" + " (declare (in ) float bias@0x163bde0)\n" " )\n" " (\n" " ))\n" @@ -16444,17 +16444,17 @@ static const char *prototypes_for_130_frag = "(function shadow1DProj\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1DShadow sampler@0x1489e80)\n" - " (declare (in ) vec4 coord@0x1489f90)\n" + " (declare (in ) sampler1DShadow sampler@0x163ae80)\n" + " (declare (in ) vec4 coord@0x163af90)\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" + " (declare (in ) sampler1DShadow sampler@0x163bfc0)\n" + " (declare (in ) vec4 coord@0x163c0d0)\n" + " (declare (in ) float bias@0x163c1e0)\n" " )\n" " (\n" " ))\n" @@ -16464,17 +16464,17 @@ static const char *prototypes_for_130_frag = "(function shadow2DProj\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2DShadow sampler@0x148a320)\n" - " (declare (in ) vec4 coord@0x148a430)\n" + " (declare (in ) sampler2DShadow sampler@0x163b320)\n" + " (declare (in ) vec4 coord@0x163b430)\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" + " (declare (in ) sampler2DShadow sampler@0x163c3c0)\n" + " (declare (in ) vec4 coord@0x163c4d0)\n" + " (declare (in ) float bias@0x163c5e0)\n" " )\n" " (\n" " ))\n" @@ -16484,9 +16484,9 @@ static const char *prototypes_for_130_frag = "(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" + " (declare (in ) sampler1DShadow sampler@0x163c7c0)\n" + " (declare (in ) vec3 coord@0x163c8d0)\n" + " (declare (in ) float lod@0x163c9e0)\n" " )\n" " (\n" " ))\n" @@ -16496,9 +16496,9 @@ static const char *prototypes_for_130_frag = "(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" + " (declare (in ) sampler2DShadow sampler@0x163cd70)\n" + " (declare (in ) vec3 coord@0x163ce80)\n" + " (declare (in ) float lod@0x163cf90)\n" " )\n" " (\n" " ))\n" @@ -16508,9 +16508,9 @@ static const char *prototypes_for_130_frag = "(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" + " (declare (in ) sampler1DShadow sampler@0x163d320)\n" + " (declare (in ) vec4 coord@0x163d430)\n" + " (declare (in ) float lod@0x163d540)\n" " )\n" " (\n" " ))\n" @@ -16520,9 +16520,9 @@ static const char *prototypes_for_130_frag = "(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" + " (declare (in ) sampler2DShadow sampler@0x163d8d0)\n" + " (declare (in ) vec4 coord@0x163d9e0)\n" + " (declare (in ) float lod@0x163daf0)\n" " )\n" " (\n" " ))\n" @@ -16532,28 +16532,28 @@ static const char *prototypes_for_130_frag = "(function dFdx\n" " (signature float\n" " (parameters\n" - " (declare (in ) float p@0x148ce80)\n" + " (declare (in ) float p@0x163de80)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 p@0x148d200)\n" + " (declare (in ) vec2 p@0x163e200)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 p@0x148d3e0)\n" + " (declare (in ) vec3 p@0x163e3e0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 p@0x148d5c0)\n" + " (declare (in ) vec4 p@0x163e5c0)\n" " )\n" " (\n" " ))\n" @@ -16563,28 +16563,28 @@ static const char *prototypes_for_130_frag = "(function dFdy\n" " (signature float\n" " (parameters\n" - " (declare (in ) float p@0x148d7a0)\n" + " (declare (in ) float p@0x163e7a0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 p@0x148db20)\n" + " (declare (in ) vec2 p@0x163eb20)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 p@0x148dd00)\n" + " (declare (in ) vec3 p@0x163ed00)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 p@0x148dee0)\n" + " (declare (in ) vec4 p@0x163eee0)\n" " )\n" " (\n" " ))\n" @@ -16594,28 +16594,28 @@ static const char *prototypes_for_130_frag = "(function fwidth\n" " (signature float\n" " (parameters\n" - " (declare (in ) float p@0x148e0c0)\n" + " (declare (in ) float p@0x163f0c0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 p@0x148e440)\n" + " (declare (in ) vec2 p@0x163f440)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 p@0x148e620)\n" + " (declare (in ) vec3 p@0x163f620)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 p@0x148e800)\n" + " (declare (in ) vec4 p@0x163f800)\n" " )\n" " (\n" " ))\n" @@ -16625,28 +16625,28 @@ static const char *prototypes_for_130_frag = "(function noise1\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x148e9e0)\n" + " (declare (in ) float x@0x163f9e0)\n" " )\n" " (\n" " ))\n" "\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec2 x@0x148ed60)\n" + " (declare (in ) vec2 x@0x163fd60)\n" " )\n" " (\n" " ))\n" "\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec3 x@0x148ef40)\n" + " (declare (in ) vec3 x@0x163ff40)\n" " )\n" " (\n" " ))\n" "\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec4 x@0x148f120)\n" + " (declare (in ) vec4 x@0x1640120)\n" " )\n" " (\n" " ))\n" @@ -16656,28 +16656,28 @@ static const char *prototypes_for_130_frag = "(function noise2\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) float x@0x148f300)\n" + " (declare (in ) float x@0x1640300)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x148f680)\n" + " (declare (in ) vec2 x@0x1640680)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec3 x@0x148f860)\n" + " (declare (in ) vec3 x@0x1640860)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec4 x@0x148fa40)\n" + " (declare (in ) vec4 x@0x1640a40)\n" " )\n" " (\n" " ))\n" @@ -16687,28 +16687,28 @@ static const char *prototypes_for_130_frag = "(function noise3\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) float x@0x148fc20)\n" + " (declare (in ) float x@0x1640c20)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec2 x@0x148ffa0)\n" + " (declare (in ) vec2 x@0x1640fa0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x1490180)\n" + " (declare (in ) vec3 x@0x1641180)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec4 x@0x1490360)\n" + " (declare (in ) vec4 x@0x1641360)\n" " )\n" " (\n" " ))\n" @@ -16718,28 +16718,28 @@ static const char *prototypes_for_130_frag = "(function noise4\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) float x@0x1490540)\n" + " (declare (in ) float x@0x1641540)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec2 x@0x14908c0)\n" + " (declare (in ) vec2 x@0x16418c0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec3 x@0x1490aa0)\n" + " (declare (in ) vec3 x@0x1641aa0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x1490c80)\n" + " (declare (in ) vec4 x@0x1641c80)\n" " )\n" " (\n" " ))\n" @@ -16839,8 +16839,8 @@ static const char *prototypes_for_ARB_texture_rectangle_vert = "(function texture2DRect\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2DRect sampler@0x9f07b0)\n" - " (declare (in ) vec2 coord@0x9f08c0)\n" + " (declare (in ) sampler2DRect sampler@0x7e97b0)\n" + " (declare (in ) vec2 coord@0x7e98c0)\n" " )\n" " (\n" " ))\n" @@ -16850,16 +16850,16 @@ static const char *prototypes_for_ARB_texture_rectangle_vert = "(function texture2DRectProj\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2DRect sampler@0x9f0c50)\n" - " (declare (in ) vec3 coord@0x9f0d60)\n" + " (declare (in ) sampler2DRect sampler@0x7e9c50)\n" + " (declare (in ) vec3 coord@0x7e9d60)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2DRect sampler@0x9f10f0)\n" - " (declare (in ) vec4 coord@0x9f1200)\n" + " (declare (in ) sampler2DRect sampler@0x7ea0f0)\n" + " (declare (in ) vec4 coord@0x7ea200)\n" " )\n" " (\n" " ))\n" @@ -16869,8 +16869,8 @@ static const char *prototypes_for_ARB_texture_rectangle_vert = "(function shadow2DRect\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2DRectShadow sampler@0x9f13e0)\n" - " (declare (in ) vec3 coord@0x9f14f0)\n" + " (declare (in ) sampler2DRectShadow sampler@0x7ea3e0)\n" + " (declare (in ) vec3 coord@0x7ea4f0)\n" " )\n" " (\n" " ))\n" @@ -16880,8 +16880,8 @@ static const char *prototypes_for_ARB_texture_rectangle_vert = "(function shadow2DRectProj\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2DRectShadow sampler@0x9f1880)\n" - " (declare (in ) vec4 coord@0x9f1990)\n" + " (declare (in ) sampler2DRectShadow sampler@0x7ea880)\n" + " (declare (in ) vec4 coord@0x7ea990)\n" " )\n" " (\n" " ))\n" @@ -16902,28 +16902,28 @@ static const char *prototypes_for_130_vert = "(function radians\n" " (signature float\n" " (parameters\n" - " (declare (in ) float degrees@0x16a1fa0)\n" + " (declare (in ) float degrees@0x1e1bfa0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 degrees@0x16a2320)\n" + " (declare (in ) vec2 degrees@0x1e1c320)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 degrees@0x16a2500)\n" + " (declare (in ) vec3 degrees@0x1e1c500)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 degrees@0x16a26e0)\n" + " (declare (in ) vec4 degrees@0x1e1c6e0)\n" " )\n" " (\n" " ))\n" @@ -16933,28 +16933,28 @@ static const char *prototypes_for_130_vert = "(function degrees\n" " (signature float\n" " (parameters\n" - " (declare (in ) float radians@0x16a28c0)\n" + " (declare (in ) float radians@0x1e1c8c0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 radians@0x16a2c40)\n" + " (declare (in ) vec2 radians@0x1e1cc40)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 radians@0x16a2e20)\n" + " (declare (in ) vec3 radians@0x1e1ce20)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 radians@0x16a3000)\n" + " (declare (in ) vec4 radians@0x1e1d000)\n" " )\n" " (\n" " ))\n" @@ -16964,28 +16964,28 @@ static const char *prototypes_for_130_vert = "(function sin\n" " (signature float\n" " (parameters\n" - " (declare (in ) float angle@0x16a31e0)\n" + " (declare (in ) float angle@0x1e1d1e0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 angle@0x16a3560)\n" + " (declare (in ) vec2 angle@0x1e1d560)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 angle@0x16a3740)\n" + " (declare (in ) vec3 angle@0x1e1d740)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 angle@0x16a3920)\n" + " (declare (in ) vec4 angle@0x1e1d920)\n" " )\n" " (\n" " ))\n" @@ -16995,28 +16995,28 @@ static const char *prototypes_for_130_vert = "(function cos\n" " (signature float\n" " (parameters\n" - " (declare (in ) float angle@0x16a3b00)\n" + " (declare (in ) float angle@0x1e1db00)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 angle@0x16a3e80)\n" + " (declare (in ) vec2 angle@0x1e1de80)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 angle@0x16a4060)\n" + " (declare (in ) vec3 angle@0x1e1e060)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 angle@0x16a4240)\n" + " (declare (in ) vec4 angle@0x1e1e240)\n" " )\n" " (\n" " ))\n" @@ -17026,28 +17026,28 @@ static const char *prototypes_for_130_vert = "(function tan\n" " (signature float\n" " (parameters\n" - " (declare (in ) float angle@0x16a4420)\n" + " (declare (in ) float angle@0x1e1e420)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 angle@0x16a47a0)\n" + " (declare (in ) vec2 angle@0x1e1e7a0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 angle@0x16a4980)\n" + " (declare (in ) vec3 angle@0x1e1e980)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 angle@0x16a4b60)\n" + " (declare (in ) vec4 angle@0x1e1eb60)\n" " )\n" " (\n" " ))\n" @@ -17057,28 +17057,28 @@ static const char *prototypes_for_130_vert = "(function asin\n" " (signature float\n" " (parameters\n" - " (declare (in ) float angle@0x16a4d40)\n" + " (declare (in ) float angle@0x1e1ed40)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 angle@0x16a50c0)\n" + " (declare (in ) vec2 angle@0x1e1f0c0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 angle@0x16a52a0)\n" + " (declare (in ) vec3 angle@0x1e1f2a0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 angle@0x16a5480)\n" + " (declare (in ) vec4 angle@0x1e1f480)\n" " )\n" " (\n" " ))\n" @@ -17088,28 +17088,28 @@ static const char *prototypes_for_130_vert = "(function acos\n" " (signature float\n" " (parameters\n" - " (declare (in ) float angle@0x16a5660)\n" + " (declare (in ) float angle@0x1e1f660)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 angle@0x16a59e0)\n" + " (declare (in ) vec2 angle@0x1e1f9e0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 angle@0x16a5bc0)\n" + " (declare (in ) vec3 angle@0x1e1fbc0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 angle@0x16a5da0)\n" + " (declare (in ) vec4 angle@0x1e1fda0)\n" " )\n" " (\n" " ))\n" @@ -17119,60 +17119,60 @@ static const char *prototypes_for_130_vert = "(function atan\n" " (signature float\n" " (parameters\n" - " (declare (in ) float y@0x16a5f80)\n" - " (declare (in ) float x@0x16a6090)\n" + " (declare (in ) float y@0x1e1ff80)\n" + " (declare (in ) float x@0x1e20090)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 y@0x16a6410)\n" - " (declare (in ) vec2 x@0x16a6520)\n" + " (declare (in ) vec2 y@0x1e20410)\n" + " (declare (in ) vec2 x@0x1e20520)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 y@0x16a6700)\n" - " (declare (in ) vec3 x@0x16a6810)\n" + " (declare (in ) vec3 y@0x1e20700)\n" + " (declare (in ) vec3 x@0x1e20810)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 y@0x16a69f0)\n" - " (declare (in ) vec4 x@0x16a6b00)\n" + " (declare (in ) vec4 y@0x1e209f0)\n" + " (declare (in ) vec4 x@0x1e20b00)\n" " )\n" " (\n" " ))\n" "\n" " (signature float\n" " (parameters\n" - " (declare (in ) float y_over_x@0x16a6ce0)\n" + " (declare (in ) float y_over_x@0x1e20ce0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 y_over_x@0x16a6ed0)\n" + " (declare (in ) vec2 y_over_x@0x1e20ed0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 y_over_x@0x16a70c0)\n" + " (declare (in ) vec3 y_over_x@0x1e210c0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 y_over_x@0x16a72b0)\n" + " (declare (in ) vec4 y_over_x@0x1e212b0)\n" " )\n" " (\n" " ))\n" @@ -17182,32 +17182,32 @@ static const char *prototypes_for_130_vert = "(function pow\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x16a74a0)\n" - " (declare (in ) float y@0x16a75b0)\n" + " (declare (in ) float x@0x1e214a0)\n" + " (declare (in ) float y@0x1e215b0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x16a7930)\n" - " (declare (in ) vec2 y@0x16a7a40)\n" + " (declare (in ) vec2 x@0x1e21930)\n" + " (declare (in ) vec2 y@0x1e21a40)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x16a7c20)\n" - " (declare (in ) vec3 y@0x16a7d30)\n" + " (declare (in ) vec3 x@0x1e21c20)\n" + " (declare (in ) vec3 y@0x1e21d30)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x16a7f10)\n" - " (declare (in ) vec4 y@0x16a8020)\n" + " (declare (in ) vec4 x@0x1e21f10)\n" + " (declare (in ) vec4 y@0x1e22020)\n" " )\n" " (\n" " ))\n" @@ -17217,28 +17217,28 @@ static const char *prototypes_for_130_vert = "(function exp\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x16a8200)\n" + " (declare (in ) float x@0x1e22200)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x16a8580)\n" + " (declare (in ) vec2 x@0x1e22580)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x16a8760)\n" + " (declare (in ) vec3 x@0x1e22760)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x16a8940)\n" + " (declare (in ) vec4 x@0x1e22940)\n" " )\n" " (\n" " ))\n" @@ -17248,28 +17248,28 @@ static const char *prototypes_for_130_vert = "(function log\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x16a8b20)\n" + " (declare (in ) float x@0x1e22b20)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x16a8ea0)\n" + " (declare (in ) vec2 x@0x1e22ea0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x16a9080)\n" + " (declare (in ) vec3 x@0x1e23080)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x16a9260)\n" + " (declare (in ) vec4 x@0x1e23260)\n" " )\n" " (\n" " ))\n" @@ -17279,28 +17279,28 @@ static const char *prototypes_for_130_vert = "(function exp2\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x16a9440)\n" + " (declare (in ) float x@0x1e23440)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x16a97c0)\n" + " (declare (in ) vec2 x@0x1e237c0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x16a99a0)\n" + " (declare (in ) vec3 x@0x1e239a0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x16a9b80)\n" + " (declare (in ) vec4 x@0x1e23b80)\n" " )\n" " (\n" " ))\n" @@ -17310,28 +17310,28 @@ static const char *prototypes_for_130_vert = "(function log2\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x16a9d60)\n" + " (declare (in ) float x@0x1e23d60)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x16aa0e0)\n" + " (declare (in ) vec2 x@0x1e240e0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x16aa2c0)\n" + " (declare (in ) vec3 x@0x1e242c0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x16aa4a0)\n" + " (declare (in ) vec4 x@0x1e244a0)\n" " )\n" " (\n" " ))\n" @@ -17341,28 +17341,28 @@ static const char *prototypes_for_130_vert = "(function sqrt\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x16aa680)\n" + " (declare (in ) float x@0x1e24680)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x16aaa00)\n" + " (declare (in ) vec2 x@0x1e24a00)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x16aabe0)\n" + " (declare (in ) vec3 x@0x1e24be0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x16aadc0)\n" + " (declare (in ) vec4 x@0x1e24dc0)\n" " )\n" " (\n" " ))\n" @@ -17372,28 +17372,28 @@ static const char *prototypes_for_130_vert = "(function inversesqrt\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x16aafa0)\n" + " (declare (in ) float x@0x1e24fa0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x16ab330)\n" + " (declare (in ) vec2 x@0x1e25330)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x16ab510)\n" + " (declare (in ) vec3 x@0x1e25510)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x16ab6f0)\n" + " (declare (in ) vec4 x@0x1e256f0)\n" " )\n" " (\n" " ))\n" @@ -17403,56 +17403,56 @@ static const char *prototypes_for_130_vert = "(function abs\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x16ab8d0)\n" + " (declare (in ) float x@0x1e258d0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x16abc50)\n" + " (declare (in ) vec2 x@0x1e25c50)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x16abe30)\n" + " (declare (in ) vec3 x@0x1e25e30)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x16ac010)\n" + " (declare (in ) vec4 x@0x1e26010)\n" " )\n" " (\n" " ))\n" "\n" " (signature int\n" " (parameters\n" - " (declare (in ) int x@0x16ac1f0)\n" + " (declare (in ) int x@0x1e261f0)\n" " )\n" " (\n" " ))\n" "\n" " (signature ivec2\n" " (parameters\n" - " (declare (in ) ivec2 x@0x16ac3d0)\n" + " (declare (in ) ivec2 x@0x1e263d0)\n" " )\n" " (\n" " ))\n" "\n" " (signature ivec3\n" " (parameters\n" - " (declare (in ) ivec3 x@0x16ac5b0)\n" + " (declare (in ) ivec3 x@0x1e265b0)\n" " )\n" " (\n" " ))\n" "\n" " (signature ivec4\n" " (parameters\n" - " (declare (in ) ivec4 x@0x16ac790)\n" + " (declare (in ) ivec4 x@0x1e26790)\n" " )\n" " (\n" " ))\n" @@ -17462,56 +17462,56 @@ static const char *prototypes_for_130_vert = "(function sign\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x16ac970)\n" + " (declare (in ) float x@0x1e26970)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x16accf0)\n" + " (declare (in ) vec2 x@0x1e26cf0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x16aced0)\n" + " (declare (in ) vec3 x@0x1e26ed0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x16ad0b0)\n" + " (declare (in ) vec4 x@0x1e270b0)\n" " )\n" " (\n" " ))\n" "\n" " (signature int\n" " (parameters\n" - " (declare (in ) int x@0x16ad290)\n" + " (declare (in ) int x@0x1e27290)\n" " )\n" " (\n" " ))\n" "\n" " (signature ivec2\n" " (parameters\n" - " (declare (in ) ivec2 x@0x16ad470)\n" + " (declare (in ) ivec2 x@0x1e27470)\n" " )\n" " (\n" " ))\n" "\n" " (signature ivec3\n" " (parameters\n" - " (declare (in ) ivec3 x@0x16ad650)\n" + " (declare (in ) ivec3 x@0x1e27650)\n" " )\n" " (\n" " ))\n" "\n" " (signature ivec4\n" " (parameters\n" - " (declare (in ) ivec4 x@0x16ad830)\n" + " (declare (in ) ivec4 x@0x1e27830)\n" " )\n" " (\n" " ))\n" @@ -17521,28 +17521,28 @@ static const char *prototypes_for_130_vert = "(function floor\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x16ada10)\n" + " (declare (in ) float x@0x1e27a10)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x16add90)\n" + " (declare (in ) vec2 x@0x1e27d90)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x16adf70)\n" + " (declare (in ) vec3 x@0x1e27f70)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x16ae150)\n" + " (declare (in ) vec4 x@0x1e28150)\n" " )\n" " (\n" " ))\n" @@ -17552,28 +17552,28 @@ static const char *prototypes_for_130_vert = "(function ceil\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x16ae330)\n" + " (declare (in ) float x@0x1e28330)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x16ae6b0)\n" + " (declare (in ) vec2 x@0x1e286b0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x16ae890)\n" + " (declare (in ) vec3 x@0x1e28890)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x16aea70)\n" + " (declare (in ) vec4 x@0x1e28a70)\n" " )\n" " (\n" " ))\n" @@ -17583,28 +17583,28 @@ static const char *prototypes_for_130_vert = "(function fract\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x16aec50)\n" + " (declare (in ) float x@0x1e28c50)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x16aefd0)\n" + " (declare (in ) vec2 x@0x1e28fd0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x16af1b0)\n" + " (declare (in ) vec3 x@0x1e291b0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x16af390)\n" + " (declare (in ) vec4 x@0x1e29390)\n" " )\n" " (\n" " ))\n" @@ -17614,56 +17614,56 @@ static const char *prototypes_for_130_vert = "(function mod\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x16af570)\n" - " (declare (in ) float y@0x16af680)\n" + " (declare (in ) float x@0x1e29570)\n" + " (declare (in ) float y@0x1e29680)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x16afa00)\n" - " (declare (in ) float y@0x16afb10)\n" + " (declare (in ) vec2 x@0x1e29a00)\n" + " (declare (in ) float y@0x1e29b10)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x16afcf0)\n" - " (declare (in ) float y@0x16afe00)\n" + " (declare (in ) vec3 x@0x1e29cf0)\n" + " (declare (in ) float y@0x1e29e00)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x16affe0)\n" - " (declare (in ) float y@0x16b00f0)\n" + " (declare (in ) vec4 x@0x1e29fe0)\n" + " (declare (in ) float y@0x1e2a0f0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x16b02d0)\n" - " (declare (in ) vec2 y@0x16b03e0)\n" + " (declare (in ) vec2 x@0x1e2a2d0)\n" + " (declare (in ) vec2 y@0x1e2a3e0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x16b05c0)\n" - " (declare (in ) vec3 y@0x16b06d0)\n" + " (declare (in ) vec3 x@0x1e2a5c0)\n" + " (declare (in ) vec3 y@0x1e2a6d0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x16b08b0)\n" - " (declare (in ) vec4 y@0x16b09c0)\n" + " (declare (in ) vec4 x@0x1e2a8b0)\n" + " (declare (in ) vec4 y@0x1e2a9c0)\n" " )\n" " (\n" " ))\n" @@ -17673,168 +17673,168 @@ static const char *prototypes_for_130_vert = "(function min\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x16b0ba0)\n" - " (declare (in ) float y@0x16b0cb0)\n" + " (declare (in ) float x@0x1e2aba0)\n" + " (declare (in ) float y@0x1e2acb0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x16b1030)\n" - " (declare (in ) vec2 y@0x16b1140)\n" + " (declare (in ) vec2 x@0x1e2b030)\n" + " (declare (in ) vec2 y@0x1e2b140)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x16b1320)\n" - " (declare (in ) vec3 y@0x16b1430)\n" + " (declare (in ) vec3 x@0x1e2b320)\n" + " (declare (in ) vec3 y@0x1e2b430)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x16b1610)\n" - " (declare (in ) vec4 y@0x16b1720)\n" + " (declare (in ) vec4 x@0x1e2b610)\n" + " (declare (in ) vec4 y@0x1e2b720)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x16b1900)\n" - " (declare (in ) float y@0x16b1a10)\n" + " (declare (in ) vec2 x@0x1e2b900)\n" + " (declare (in ) float y@0x1e2ba10)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x16b1bf0)\n" - " (declare (in ) float y@0x16b1d00)\n" + " (declare (in ) vec3 x@0x1e2bbf0)\n" + " (declare (in ) float y@0x1e2bd00)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x16b1ee0)\n" - " (declare (in ) float y@0x16b1ff0)\n" + " (declare (in ) vec4 x@0x1e2bee0)\n" + " (declare (in ) float y@0x1e2bff0)\n" " )\n" " (\n" " ))\n" "\n" " (signature int\n" " (parameters\n" - " (declare (in ) int x@0x16b21d0)\n" - " (declare (in ) int y@0x16b22e0)\n" + " (declare (in ) int x@0x1e2c1d0)\n" + " (declare (in ) int y@0x1e2c2e0)\n" " )\n" " (\n" " ))\n" "\n" " (signature ivec2\n" " (parameters\n" - " (declare (in ) ivec2 x@0x16b24c0)\n" - " (declare (in ) ivec2 y@0x16b25d0)\n" + " (declare (in ) ivec2 x@0x1e2c4c0)\n" + " (declare (in ) ivec2 y@0x1e2c5d0)\n" " )\n" " (\n" " ))\n" "\n" " (signature ivec3\n" " (parameters\n" - " (declare (in ) ivec3 x@0x16b27b0)\n" - " (declare (in ) ivec3 y@0x16b28c0)\n" + " (declare (in ) ivec3 x@0x1e2c7b0)\n" + " (declare (in ) ivec3 y@0x1e2c8c0)\n" " )\n" " (\n" " ))\n" "\n" " (signature ivec4\n" " (parameters\n" - " (declare (in ) ivec4 x@0x16b2aa0)\n" - " (declare (in ) ivec4 y@0x16b2bb0)\n" + " (declare (in ) ivec4 x@0x1e2caa0)\n" + " (declare (in ) ivec4 y@0x1e2cbb0)\n" " )\n" " (\n" " ))\n" "\n" " (signature ivec2\n" " (parameters\n" - " (declare (in ) ivec2 x@0x16b2d90)\n" - " (declare (in ) int y@0x16b2ea0)\n" + " (declare (in ) ivec2 x@0x1e2cd90)\n" + " (declare (in ) int y@0x1e2cea0)\n" " )\n" " (\n" " ))\n" "\n" " (signature ivec3\n" " (parameters\n" - " (declare (in ) ivec3 x@0x16b3080)\n" - " (declare (in ) int y@0x16b3190)\n" + " (declare (in ) ivec3 x@0x1e2d080)\n" + " (declare (in ) int y@0x1e2d190)\n" " )\n" " (\n" " ))\n" "\n" " (signature ivec4\n" " (parameters\n" - " (declare (in ) ivec4 x@0x16b3370)\n" - " (declare (in ) int y@0x16b3480)\n" + " (declare (in ) ivec4 x@0x1e2d370)\n" + " (declare (in ) int y@0x1e2d480)\n" " )\n" " (\n" " ))\n" "\n" " (signature uint\n" " (parameters\n" - " (declare (in ) uint x@0x16b3660)\n" - " (declare (in ) uint y@0x16b3770)\n" + " (declare (in ) uint x@0x1e2d660)\n" + " (declare (in ) uint y@0x1e2d770)\n" " )\n" " (\n" " ))\n" "\n" " (signature uvec2\n" " (parameters\n" - " (declare (in ) uvec2 x@0x16b3950)\n" - " (declare (in ) uvec2 y@0x16b3a60)\n" + " (declare (in ) uvec2 x@0x1e2d950)\n" + " (declare (in ) uvec2 y@0x1e2da60)\n" " )\n" " (\n" " ))\n" "\n" " (signature uvec3\n" " (parameters\n" - " (declare (in ) uvec3 x@0x16b3c40)\n" - " (declare (in ) uvec3 y@0x16b3d50)\n" + " (declare (in ) uvec3 x@0x1e2dc40)\n" + " (declare (in ) uvec3 y@0x1e2dd50)\n" " )\n" " (\n" " ))\n" "\n" " (signature uvec4\n" " (parameters\n" - " (declare (in ) uvec4 x@0x16b3f30)\n" - " (declare (in ) uvec4 y@0x16b4040)\n" + " (declare (in ) uvec4 x@0x1e2df30)\n" + " (declare (in ) uvec4 y@0x1e2e040)\n" " )\n" " (\n" " ))\n" "\n" " (signature uvec2\n" " (parameters\n" - " (declare (in ) uvec2 x@0x16b4220)\n" - " (declare (in ) uint y@0x16b4330)\n" + " (declare (in ) uvec2 x@0x1e2e220)\n" + " (declare (in ) uint y@0x1e2e330)\n" " )\n" " (\n" " ))\n" "\n" " (signature uvec3\n" " (parameters\n" - " (declare (in ) uvec3 x@0x16b4510)\n" - " (declare (in ) uint y@0x16b4620)\n" + " (declare (in ) uvec3 x@0x1e2e510)\n" + " (declare (in ) uint y@0x1e2e620)\n" " )\n" " (\n" " ))\n" "\n" " (signature uvec4\n" " (parameters\n" - " (declare (in ) uvec4 x@0x16b4800)\n" - " (declare (in ) uint y@0x16b4910)\n" + " (declare (in ) uvec4 x@0x1e2e800)\n" + " (declare (in ) uint y@0x1e2e910)\n" " )\n" " (\n" " ))\n" @@ -17844,168 +17844,168 @@ static const char *prototypes_for_130_vert = "(function max\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x16b4af0)\n" - " (declare (in ) float y@0x16b4c00)\n" + " (declare (in ) float x@0x1e2eaf0)\n" + " (declare (in ) float y@0x1e2ec00)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x16b4f80)\n" - " (declare (in ) vec2 y@0x16b5090)\n" + " (declare (in ) vec2 x@0x1e2ef80)\n" + " (declare (in ) vec2 y@0x1e2f090)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x16b5270)\n" - " (declare (in ) vec3 y@0x16b5380)\n" + " (declare (in ) vec3 x@0x1e2f270)\n" + " (declare (in ) vec3 y@0x1e2f380)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x16b5560)\n" - " (declare (in ) vec4 y@0x16b5670)\n" + " (declare (in ) vec4 x@0x1e2f560)\n" + " (declare (in ) vec4 y@0x1e2f670)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x16b5850)\n" - " (declare (in ) float y@0x16b5960)\n" + " (declare (in ) vec2 x@0x1e2f850)\n" + " (declare (in ) float y@0x1e2f960)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x16b5b40)\n" - " (declare (in ) float y@0x16b5c50)\n" + " (declare (in ) vec3 x@0x1e2fb40)\n" + " (declare (in ) float y@0x1e2fc50)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x16b5e30)\n" - " (declare (in ) float y@0x16b5f40)\n" + " (declare (in ) vec4 x@0x1e2fe30)\n" + " (declare (in ) float y@0x1e2ff40)\n" " )\n" " (\n" " ))\n" "\n" " (signature int\n" " (parameters\n" - " (declare (in ) int x@0x16b6120)\n" - " (declare (in ) int y@0x16b6230)\n" + " (declare (in ) int x@0x1e30120)\n" + " (declare (in ) int y@0x1e30230)\n" " )\n" " (\n" " ))\n" "\n" " (signature ivec2\n" " (parameters\n" - " (declare (in ) ivec2 x@0x16b6410)\n" - " (declare (in ) ivec2 y@0x16b6520)\n" + " (declare (in ) ivec2 x@0x1e30410)\n" + " (declare (in ) ivec2 y@0x1e30520)\n" " )\n" " (\n" " ))\n" "\n" " (signature ivec3\n" " (parameters\n" - " (declare (in ) ivec3 x@0x16b6700)\n" - " (declare (in ) ivec3 y@0x16b6810)\n" + " (declare (in ) ivec3 x@0x1e30700)\n" + " (declare (in ) ivec3 y@0x1e30810)\n" " )\n" " (\n" " ))\n" "\n" " (signature ivec4\n" " (parameters\n" - " (declare (in ) ivec4 x@0x16b69f0)\n" - " (declare (in ) ivec4 y@0x16b6b00)\n" + " (declare (in ) ivec4 x@0x1e309f0)\n" + " (declare (in ) ivec4 y@0x1e30b00)\n" " )\n" " (\n" " ))\n" "\n" " (signature ivec2\n" " (parameters\n" - " (declare (in ) ivec2 x@0x16b6ce0)\n" - " (declare (in ) int y@0x16b6df0)\n" + " (declare (in ) ivec2 x@0x1e30ce0)\n" + " (declare (in ) int y@0x1e30df0)\n" " )\n" " (\n" " ))\n" "\n" " (signature ivec3\n" " (parameters\n" - " (declare (in ) ivec3 x@0x16b6fd0)\n" - " (declare (in ) int y@0x16b70e0)\n" + " (declare (in ) ivec3 x@0x1e30fd0)\n" + " (declare (in ) int y@0x1e310e0)\n" " )\n" " (\n" " ))\n" "\n" " (signature ivec4\n" " (parameters\n" - " (declare (in ) ivec4 x@0x16b72c0)\n" - " (declare (in ) int y@0x16b73d0)\n" + " (declare (in ) ivec4 x@0x1e312c0)\n" + " (declare (in ) int y@0x1e313d0)\n" " )\n" " (\n" " ))\n" "\n" " (signature uint\n" " (parameters\n" - " (declare (in ) uint x@0x16b75b0)\n" - " (declare (in ) uint y@0x16b76c0)\n" + " (declare (in ) uint x@0x1e315b0)\n" + " (declare (in ) uint y@0x1e316c0)\n" " )\n" " (\n" " ))\n" "\n" " (signature uvec2\n" " (parameters\n" - " (declare (in ) uvec2 x@0x16b78a0)\n" - " (declare (in ) uvec2 y@0x16b79b0)\n" + " (declare (in ) uvec2 x@0x1e318a0)\n" + " (declare (in ) uvec2 y@0x1e319b0)\n" " )\n" " (\n" " ))\n" "\n" " (signature uvec3\n" " (parameters\n" - " (declare (in ) uvec3 x@0x16b7b90)\n" - " (declare (in ) uvec3 y@0x16b7ca0)\n" + " (declare (in ) uvec3 x@0x1e31b90)\n" + " (declare (in ) uvec3 y@0x1e31ca0)\n" " )\n" " (\n" " ))\n" "\n" " (signature uvec4\n" " (parameters\n" - " (declare (in ) uvec4 x@0x16b7e80)\n" - " (declare (in ) uvec4 y@0x16b7f90)\n" + " (declare (in ) uvec4 x@0x1e31e80)\n" + " (declare (in ) uvec4 y@0x1e31f90)\n" " )\n" " (\n" " ))\n" "\n" " (signature uvec2\n" " (parameters\n" - " (declare (in ) uvec2 x@0x16b8170)\n" - " (declare (in ) uint y@0x16b8280)\n" + " (declare (in ) uvec2 x@0x1e32170)\n" + " (declare (in ) uint y@0x1e32280)\n" " )\n" " (\n" " ))\n" "\n" " (signature uvec3\n" " (parameters\n" - " (declare (in ) uvec3 x@0x16b8460)\n" - " (declare (in ) uint y@0x16b8570)\n" + " (declare (in ) uvec3 x@0x1e32460)\n" + " (declare (in ) uint y@0x1e32570)\n" " )\n" " (\n" " ))\n" "\n" " (signature uvec4\n" " (parameters\n" - " (declare (in ) uvec4 x@0x16b8750)\n" - " (declare (in ) uint y@0x16b8860)\n" + " (declare (in ) uvec4 x@0x1e32750)\n" + " (declare (in ) uint y@0x1e32860)\n" " )\n" " (\n" " ))\n" @@ -18015,189 +18015,189 @@ static const char *prototypes_for_130_vert = "(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" + " (declare (in ) float x@0x1e32a40)\n" + " (declare (in ) float minVal@0x1e32b50)\n" + " (declare (in ) float maxVal@0x1e32c60)\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" + " (declare (in ) vec2 x@0x1e32fe0)\n" + " (declare (in ) vec2 minVal@0x1e330f0)\n" + " (declare (in ) vec2 maxVal@0x1e33200)\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" + " (declare (in ) vec3 x@0x1e333e0)\n" + " (declare (in ) vec3 minVal@0x1e334f0)\n" + " (declare (in ) vec3 maxVal@0x1e33600)\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" + " (declare (in ) vec4 x@0x1e337e0)\n" + " (declare (in ) vec4 minVal@0x1e338f0)\n" + " (declare (in ) vec4 maxVal@0x1e33a00)\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" + " (declare (in ) vec2 x@0x1e33be0)\n" + " (declare (in ) float minVal@0x1e33cf0)\n" + " (declare (in ) float maxVal@0x1e33e00)\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" + " (declare (in ) vec3 x@0x1e33fe0)\n" + " (declare (in ) float minVal@0x1e340f0)\n" + " (declare (in ) float maxVal@0x1e34200)\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" + " (declare (in ) vec4 x@0x1e343e0)\n" + " (declare (in ) float minVal@0x1e344f0)\n" + " (declare (in ) float maxVal@0x1e34600)\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" + " (declare (in ) int x@0x1e347e0)\n" + " (declare (in ) int minVal@0x1e348f0)\n" + " (declare (in ) int maxVal@0x1e34a00)\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" + " (declare (in ) ivec2 x@0x1e34be0)\n" + " (declare (in ) ivec2 minVal@0x1e34cf0)\n" + " (declare (in ) ivec2 maxVal@0x1e34e00)\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" + " (declare (in ) ivec3 x@0x1e34fe0)\n" + " (declare (in ) ivec3 minVal@0x1e350f0)\n" + " (declare (in ) ivec3 maxVal@0x1e35200)\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" + " (declare (in ) ivec4 x@0x1e353e0)\n" + " (declare (in ) ivec4 minVal@0x1e354f0)\n" + " (declare (in ) ivec4 maxVal@0x1e35600)\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" + " (declare (in ) ivec2 x@0x1e357e0)\n" + " (declare (in ) int minVal@0x1e358f0)\n" + " (declare (in ) int maxVal@0x1e35a00)\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" + " (declare (in ) ivec3 x@0x1e35be0)\n" + " (declare (in ) int minVal@0x1e35cf0)\n" + " (declare (in ) int maxVal@0x1e35e00)\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" + " (declare (in ) ivec4 x@0x1e35fe0)\n" + " (declare (in ) int minVal@0x1e360f0)\n" + " (declare (in ) int maxVal@0x1e36200)\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" + " (declare (in ) uint x@0x1e363e0)\n" + " (declare (in ) uint minVal@0x1e364f0)\n" + " (declare (in ) uint maxVal@0x1e36600)\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" + " (declare (in ) uvec2 x@0x1e367e0)\n" + " (declare (in ) uvec2 minVal@0x1e368f0)\n" + " (declare (in ) uvec2 maxVal@0x1e36a00)\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" + " (declare (in ) uvec3 x@0x1e36be0)\n" + " (declare (in ) uvec3 minVal@0x1e36cf0)\n" + " (declare (in ) uvec3 maxVal@0x1e36e00)\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" + " (declare (in ) uvec4 x@0x1e36fe0)\n" + " (declare (in ) uvec4 minVal@0x1e370f0)\n" + " (declare (in ) uvec4 maxVal@0x1e37200)\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" + " (declare (in ) uvec2 x@0x1e373e0)\n" + " (declare (in ) uint minVal@0x1e374f0)\n" + " (declare (in ) uint maxVal@0x1e37600)\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" + " (declare (in ) uvec3 x@0x1e377e0)\n" + " (declare (in ) uint minVal@0x1e378f0)\n" + " (declare (in ) uint maxVal@0x1e37a00)\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" + " (declare (in ) uvec4 x@0x1e37be0)\n" + " (declare (in ) uint minVal@0x1e37cf0)\n" + " (declare (in ) uint maxVal@0x1e37e00)\n" " )\n" " (\n" " ))\n" @@ -18207,63 +18207,63 @@ static const char *prototypes_for_130_vert = "(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" + " (declare (in ) float x@0x1e37fe0)\n" + " (declare (in ) float y@0x1e380f0)\n" + " (declare (in ) float a@0x1e38200)\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" + " (declare (in ) vec2 x@0x1e38580)\n" + " (declare (in ) vec2 y@0x1e38690)\n" + " (declare (in ) vec2 a@0x1e387a0)\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" + " (declare (in ) vec3 x@0x1e38980)\n" + " (declare (in ) vec3 y@0x1e38a90)\n" + " (declare (in ) vec3 a@0x1e38ba0)\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" + " (declare (in ) vec4 x@0x1e38d80)\n" + " (declare (in ) vec4 y@0x1e38e90)\n" + " (declare (in ) vec4 a@0x1e38fa0)\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" + " (declare (in ) vec2 x@0x1e39180)\n" + " (declare (in ) vec2 y@0x1e39290)\n" + " (declare (in ) float a@0x1e393a0)\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" + " (declare (in ) vec3 x@0x1e39580)\n" + " (declare (in ) vec3 y@0x1e39690)\n" + " (declare (in ) float a@0x1e397a0)\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" + " (declare (in ) vec4 x@0x1e39980)\n" + " (declare (in ) vec4 y@0x1e39a90)\n" + " (declare (in ) float a@0x1e39ba0)\n" " )\n" " (\n" " ))\n" @@ -18273,56 +18273,56 @@ static const char *prototypes_for_130_vert = "(function step\n" " (signature float\n" " (parameters\n" - " (declare (in ) float edge@0x16bfd80)\n" - " (declare (in ) float x@0x16bfe90)\n" + " (declare (in ) float edge@0x1e39d80)\n" + " (declare (in ) float x@0x1e39e90)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 edge@0x16c0210)\n" - " (declare (in ) vec2 x@0x16c0320)\n" + " (declare (in ) vec2 edge@0x1e3a210)\n" + " (declare (in ) vec2 x@0x1e3a320)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 edge@0x16c0500)\n" - " (declare (in ) vec3 x@0x16c0610)\n" + " (declare (in ) vec3 edge@0x1e3a500)\n" + " (declare (in ) vec3 x@0x1e3a610)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 edge@0x16c07f0)\n" - " (declare (in ) vec4 x@0x16c0900)\n" + " (declare (in ) vec4 edge@0x1e3a7f0)\n" + " (declare (in ) vec4 x@0x1e3a900)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) float edge@0x16c0ae0)\n" - " (declare (in ) vec2 x@0x16c0bf0)\n" + " (declare (in ) float edge@0x1e3aae0)\n" + " (declare (in ) vec2 x@0x1e3abf0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) float edge@0x16c0dd0)\n" - " (declare (in ) vec3 x@0x16c0ee0)\n" + " (declare (in ) float edge@0x1e3add0)\n" + " (declare (in ) vec3 x@0x1e3aee0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) float edge@0x16c10c0)\n" - " (declare (in ) vec4 x@0x16c11d0)\n" + " (declare (in ) float edge@0x1e3b0c0)\n" + " (declare (in ) vec4 x@0x1e3b1d0)\n" " )\n" " (\n" " ))\n" @@ -18332,63 +18332,63 @@ static const char *prototypes_for_130_vert = "(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" + " (declare (in ) float edge0@0x1e3b3b0)\n" + " (declare (in ) float edge1@0x1e3b4c0)\n" + " (declare (in ) float x@0x1e3b5d0)\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" + " (declare (in ) vec2 edge0@0x1e3b960)\n" + " (declare (in ) vec2 edge1@0x1e3ba70)\n" + " (declare (in ) vec2 x@0x1e3bb80)\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" + " (declare (in ) vec3 edge0@0x1e3bd60)\n" + " (declare (in ) vec3 edge1@0x1e3be70)\n" + " (declare (in ) vec3 x@0x1e3bf80)\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" + " (declare (in ) vec4 edge0@0x1e3c160)\n" + " (declare (in ) vec4 edge1@0x1e3c270)\n" + " (declare (in ) vec4 x@0x1e3c380)\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" + " (declare (in ) float edge0@0x1e3c560)\n" + " (declare (in ) float edge1@0x1e3c670)\n" + " (declare (in ) vec2 x@0x1e3c780)\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" + " (declare (in ) float edge0@0x1e3c960)\n" + " (declare (in ) float edge1@0x1e3ca70)\n" + " (declare (in ) vec3 x@0x1e3cb80)\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" + " (declare (in ) float edge0@0x1e3cd60)\n" + " (declare (in ) float edge1@0x1e3ce70)\n" + " (declare (in ) vec4 x@0x1e3cf80)\n" " )\n" " (\n" " ))\n" @@ -18398,28 +18398,28 @@ static const char *prototypes_for_130_vert = "(function length\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x16c3160)\n" + " (declare (in ) float x@0x1e3d160)\n" " )\n" " (\n" " ))\n" "\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec2 x@0x16c34e0)\n" + " (declare (in ) vec2 x@0x1e3d4e0)\n" " )\n" " (\n" " ))\n" "\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec3 x@0x16c36c0)\n" + " (declare (in ) vec3 x@0x1e3d6c0)\n" " )\n" " (\n" " ))\n" "\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec4 x@0x16c38a0)\n" + " (declare (in ) vec4 x@0x1e3d8a0)\n" " )\n" " (\n" " ))\n" @@ -18429,32 +18429,32 @@ static const char *prototypes_for_130_vert = "(function distance\n" " (signature float\n" " (parameters\n" - " (declare (in ) float p0@0x16c3a80)\n" - " (declare (in ) float p1@0x16c3b90)\n" + " (declare (in ) float p0@0x1e3da80)\n" + " (declare (in ) float p1@0x1e3db90)\n" " )\n" " (\n" " ))\n" "\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec2 p0@0x16c3f20)\n" - " (declare (in ) vec2 p1@0x16c4030)\n" + " (declare (in ) vec2 p0@0x1e3df20)\n" + " (declare (in ) vec2 p1@0x1e3e030)\n" " )\n" " (\n" " ))\n" "\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec3 p0@0x16c4210)\n" - " (declare (in ) vec3 p1@0x16c4320)\n" + " (declare (in ) vec3 p0@0x1e3e210)\n" + " (declare (in ) vec3 p1@0x1e3e320)\n" " )\n" " (\n" " ))\n" "\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec4 p0@0x16c4500)\n" - " (declare (in ) vec4 p1@0x16c4610)\n" + " (declare (in ) vec4 p0@0x1e3e500)\n" + " (declare (in ) vec4 p1@0x1e3e610)\n" " )\n" " (\n" " ))\n" @@ -18464,32 +18464,32 @@ static const char *prototypes_for_130_vert = "(function dot\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x16c47f0)\n" - " (declare (in ) float y@0x16c4900)\n" + " (declare (in ) float x@0x1e3e7f0)\n" + " (declare (in ) float y@0x1e3e900)\n" " )\n" " (\n" " ))\n" "\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec2 x@0x16c4c80)\n" - " (declare (in ) vec2 y@0x16c4d90)\n" + " (declare (in ) vec2 x@0x1e3ec80)\n" + " (declare (in ) vec2 y@0x1e3ed90)\n" " )\n" " (\n" " ))\n" "\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec3 x@0x16c4f70)\n" - " (declare (in ) vec3 y@0x16c5080)\n" + " (declare (in ) vec3 x@0x1e3ef70)\n" + " (declare (in ) vec3 y@0x1e3f080)\n" " )\n" " (\n" " ))\n" "\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec4 x@0x16c5260)\n" - " (declare (in ) vec4 y@0x16c5370)\n" + " (declare (in ) vec4 x@0x1e3f260)\n" + " (declare (in ) vec4 y@0x1e3f370)\n" " )\n" " (\n" " ))\n" @@ -18499,8 +18499,8 @@ static const char *prototypes_for_130_vert = "(function cross\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x16c5550)\n" - " (declare (in ) vec3 y@0x16c5660)\n" + " (declare (in ) vec3 x@0x1e3f550)\n" + " (declare (in ) vec3 y@0x1e3f660)\n" " )\n" " (\n" " ))\n" @@ -18510,28 +18510,28 @@ static const char *prototypes_for_130_vert = "(function normalize\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x16c59e0)\n" + " (declare (in ) float x@0x1e3f9e0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x16c5d70)\n" + " (declare (in ) vec2 x@0x1e3fd70)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x16c5f50)\n" + " (declare (in ) vec3 x@0x1e3ff50)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x16c6130)\n" + " (declare (in ) vec4 x@0x1e40130)\n" " )\n" " (\n" " ))\n" @@ -18550,36 +18550,36 @@ static const char *prototypes_for_130_vert = "(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" + " (declare (in ) float N@0x1e40590)\n" + " (declare (in ) float I@0x1e406a0)\n" + " (declare (in ) float Nref@0x1e407b0)\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" + " (declare (in ) vec2 N@0x1e40b40)\n" + " (declare (in ) vec2 I@0x1e40c50)\n" + " (declare (in ) vec2 Nref@0x1e40d60)\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" + " (declare (in ) vec3 N@0x1e40f40)\n" + " (declare (in ) vec3 I@0x1e41050)\n" + " (declare (in ) vec3 Nref@0x1e41160)\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" + " (declare (in ) vec4 N@0x1e41340)\n" + " (declare (in ) vec4 I@0x1e41450)\n" + " (declare (in ) vec4 Nref@0x1e41560)\n" " )\n" " (\n" " ))\n" @@ -18589,32 +18589,32 @@ static const char *prototypes_for_130_vert = "(function reflect\n" " (signature float\n" " (parameters\n" - " (declare (in ) float I@0x16c7740)\n" - " (declare (in ) float N@0x16c7850)\n" + " (declare (in ) float I@0x1e41740)\n" + " (declare (in ) float N@0x1e41850)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 I@0x16c7bd0)\n" - " (declare (in ) vec2 N@0x16c7ce0)\n" + " (declare (in ) vec2 I@0x1e41bd0)\n" + " (declare (in ) vec2 N@0x1e41ce0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 I@0x16c7ec0)\n" - " (declare (in ) vec3 N@0x16c7fd0)\n" + " (declare (in ) vec3 I@0x1e41ec0)\n" + " (declare (in ) vec3 N@0x1e41fd0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 I@0x16c81b0)\n" - " (declare (in ) vec4 N@0x16c82c0)\n" + " (declare (in ) vec4 I@0x1e421b0)\n" + " (declare (in ) vec4 N@0x1e422c0)\n" " )\n" " (\n" " ))\n" @@ -18624,36 +18624,36 @@ static const char *prototypes_for_130_vert = "(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" + " (declare (in ) float I@0x1e424a0)\n" + " (declare (in ) float N@0x1e425b0)\n" + " (declare (in ) float eta@0x1e426c0)\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" + " (declare (in ) vec2 I@0x1e42a40)\n" + " (declare (in ) vec2 N@0x1e42b50)\n" + " (declare (in ) float eta@0x1e42c60)\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" + " (declare (in ) vec3 I@0x1e42e40)\n" + " (declare (in ) vec3 N@0x1e42f50)\n" + " (declare (in ) float eta@0x1e43060)\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" + " (declare (in ) vec4 I@0x1e43240)\n" + " (declare (in ) vec4 N@0x1e43350)\n" + " (declare (in ) float eta@0x1e43460)\n" " )\n" " (\n" " ))\n" @@ -18663,72 +18663,72 @@ static const char *prototypes_for_130_vert = "(function matrixCompMult\n" " (signature mat2\n" " (parameters\n" - " (declare (in ) mat2 x@0x16c9640)\n" - " (declare (in ) mat2 y@0x16c9750)\n" + " (declare (in ) mat2 x@0x1e43640)\n" + " (declare (in ) mat2 y@0x1e43750)\n" " )\n" " (\n" " ))\n" "\n" " (signature mat3\n" " (parameters\n" - " (declare (in ) mat3 x@0x16c9ae0)\n" - " (declare (in ) mat3 y@0x16c9bf0)\n" + " (declare (in ) mat3 x@0x1e43ae0)\n" + " (declare (in ) mat3 y@0x1e43bf0)\n" " )\n" " (\n" " ))\n" "\n" " (signature mat4\n" " (parameters\n" - " (declare (in ) mat4 x@0x16c9dd0)\n" - " (declare (in ) mat4 y@0x16c9ee0)\n" + " (declare (in ) mat4 x@0x1e43dd0)\n" + " (declare (in ) mat4 y@0x1e43ee0)\n" " )\n" " (\n" " ))\n" "\n" " (signature mat2x3\n" " (parameters\n" - " (declare (in ) mat2x3 x@0x16ca0c0)\n" - " (declare (in ) mat2x3 y@0x16ca1d0)\n" + " (declare (in ) mat2x3 x@0x1e440c0)\n" + " (declare (in ) mat2x3 y@0x1e441d0)\n" " )\n" " (\n" " ))\n" "\n" " (signature mat2x4\n" " (parameters\n" - " (declare (in ) mat2x4 x@0x16ca3b0)\n" - " (declare (in ) mat2x4 y@0x16ca4c0)\n" + " (declare (in ) mat2x4 x@0x1e443b0)\n" + " (declare (in ) mat2x4 y@0x1e444c0)\n" " )\n" " (\n" " ))\n" "\n" " (signature mat3x2\n" " (parameters\n" - " (declare (in ) mat3x2 x@0x16ca6a0)\n" - " (declare (in ) mat3x2 y@0x16ca7b0)\n" + " (declare (in ) mat3x2 x@0x1e446a0)\n" + " (declare (in ) mat3x2 y@0x1e447b0)\n" " )\n" " (\n" " ))\n" "\n" " (signature mat3x4\n" " (parameters\n" - " (declare (in ) mat3x4 x@0x16ca990)\n" - " (declare (in ) mat3x4 y@0x16caaa0)\n" + " (declare (in ) mat3x4 x@0x1e44990)\n" + " (declare (in ) mat3x4 y@0x1e44aa0)\n" " )\n" " (\n" " ))\n" "\n" " (signature mat4x2\n" " (parameters\n" - " (declare (in ) mat4x2 x@0x16cac80)\n" - " (declare (in ) mat4x2 y@0x16cad90)\n" + " (declare (in ) mat4x2 x@0x1e44c80)\n" + " (declare (in ) mat4x2 y@0x1e44d90)\n" " )\n" " (\n" " ))\n" "\n" " (signature mat4x3\n" " (parameters\n" - " (declare (in ) mat4x3 x@0x16caf70)\n" - " (declare (in ) mat4x3 y@0x16cb080)\n" + " (declare (in ) mat4x3 x@0x1e44f70)\n" + " (declare (in ) mat4x3 y@0x1e45080)\n" " )\n" " (\n" " ))\n" @@ -18738,72 +18738,72 @@ static const char *prototypes_for_130_vert = "(function outerProduct\n" " (signature mat2\n" " (parameters\n" - " (declare (in ) vec2 c@0x16cb260)\n" - " (declare (in ) vec2 r@0x16cb370)\n" + " (declare (in ) vec2 c@0x1e45260)\n" + " (declare (in ) vec2 r@0x1e45370)\n" " )\n" " (\n" " ))\n" "\n" " (signature mat3\n" " (parameters\n" - " (declare (in ) vec3 c@0x16cb700)\n" - " (declare (in ) vec3 r@0x16cb810)\n" + " (declare (in ) vec3 c@0x1e45700)\n" + " (declare (in ) vec3 r@0x1e45810)\n" " )\n" " (\n" " ))\n" "\n" " (signature mat4\n" " (parameters\n" - " (declare (in ) vec4 c@0x16cb9f0)\n" - " (declare (in ) vec4 r@0x16cbb00)\n" + " (declare (in ) vec4 c@0x1e459f0)\n" + " (declare (in ) vec4 r@0x1e45b00)\n" " )\n" " (\n" " ))\n" "\n" " (signature mat2x3\n" " (parameters\n" - " (declare (in ) vec3 c@0x16cbce0)\n" - " (declare (in ) vec2 r@0x16cbdf0)\n" + " (declare (in ) vec3 c@0x1e45ce0)\n" + " (declare (in ) vec2 r@0x1e45df0)\n" " )\n" " (\n" " ))\n" "\n" " (signature mat3x2\n" " (parameters\n" - " (declare (in ) vec2 c@0x16cbfd0)\n" - " (declare (in ) vec3 r@0x16cc0e0)\n" + " (declare (in ) vec2 c@0x1e45fd0)\n" + " (declare (in ) vec3 r@0x1e460e0)\n" " )\n" " (\n" " ))\n" "\n" " (signature mat2x4\n" " (parameters\n" - " (declare (in ) vec4 c@0x16cc2c0)\n" - " (declare (in ) vec2 r@0x16cc3d0)\n" + " (declare (in ) vec4 c@0x1e462c0)\n" + " (declare (in ) vec2 r@0x1e463d0)\n" " )\n" " (\n" " ))\n" "\n" " (signature mat4x2\n" " (parameters\n" - " (declare (in ) vec2 c@0x16cc5b0)\n" - " (declare (in ) vec4 r@0x16cc6c0)\n" + " (declare (in ) vec2 c@0x1e465b0)\n" + " (declare (in ) vec4 r@0x1e466c0)\n" " )\n" " (\n" " ))\n" "\n" " (signature mat3x4\n" " (parameters\n" - " (declare (in ) vec4 c@0x16cc8a0)\n" - " (declare (in ) vec3 r@0x16cc9b0)\n" + " (declare (in ) vec4 c@0x1e468a0)\n" + " (declare (in ) vec3 r@0x1e469b0)\n" " )\n" " (\n" " ))\n" "\n" " (signature mat4x3\n" " (parameters\n" - " (declare (in ) vec3 c@0x16ccb90)\n" - " (declare (in ) vec4 r@0x16ccca0)\n" + " (declare (in ) vec3 c@0x1e46b90)\n" + " (declare (in ) vec4 r@0x1e46ca0)\n" " )\n" " (\n" " ))\n" @@ -18813,63 +18813,63 @@ static const char *prototypes_for_130_vert = "(function transpose\n" " (signature mat2\n" " (parameters\n" - " (declare (in ) mat2 m@0x16cce80)\n" + " (declare (in ) mat2 m@0x1e46e80)\n" " )\n" " (\n" " ))\n" "\n" " (signature mat3\n" " (parameters\n" - " (declare (in ) mat3 m@0x16cd210)\n" + " (declare (in ) mat3 m@0x1e47210)\n" " )\n" " (\n" " ))\n" "\n" " (signature mat4\n" " (parameters\n" - " (declare (in ) mat4 m@0x16cd3f0)\n" + " (declare (in ) mat4 m@0x1e473f0)\n" " )\n" " (\n" " ))\n" "\n" " (signature mat2x3\n" " (parameters\n" - " (declare (in ) mat3x2 m@0x16cd5d0)\n" + " (declare (in ) mat3x2 m@0x1e475d0)\n" " )\n" " (\n" " ))\n" "\n" " (signature mat3x2\n" " (parameters\n" - " (declare (in ) mat2x3 m@0x16cd7b0)\n" + " (declare (in ) mat2x3 m@0x1e477b0)\n" " )\n" " (\n" " ))\n" "\n" " (signature mat2x4\n" " (parameters\n" - " (declare (in ) mat4x2 m@0x16cd990)\n" + " (declare (in ) mat4x2 m@0x1e47990)\n" " )\n" " (\n" " ))\n" "\n" " (signature mat4x2\n" " (parameters\n" - " (declare (in ) mat2x4 m@0x16cdb70)\n" + " (declare (in ) mat2x4 m@0x1e47b70)\n" " )\n" " (\n" " ))\n" "\n" " (signature mat3x4\n" " (parameters\n" - " (declare (in ) mat4x3 m@0x16cdd50)\n" + " (declare (in ) mat4x3 m@0x1e47d50)\n" " )\n" " (\n" " ))\n" "\n" " (signature mat4x3\n" " (parameters\n" - " (declare (in ) mat3x4 m@0x16cdf30)\n" + " (declare (in ) mat3x4 m@0x1e47f30)\n" " )\n" " (\n" " ))\n" @@ -18879,72 +18879,72 @@ static const char *prototypes_for_130_vert = "(function lessThan\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x16ce110)\n" - " (declare (in ) vec2 y@0x16ce220)\n" + " (declare (in ) vec2 x@0x1e48110)\n" + " (declare (in ) vec2 y@0x1e48220)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x16ce5b0)\n" - " (declare (in ) vec3 y@0x16ce6c0)\n" + " (declare (in ) vec3 x@0x1e485b0)\n" + " (declare (in ) vec3 y@0x1e486c0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x16ce8a0)\n" - " (declare (in ) vec4 y@0x16ce9b0)\n" + " (declare (in ) vec4 x@0x1e488a0)\n" + " (declare (in ) vec4 y@0x1e489b0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) ivec2 x@0x16ceb90)\n" - " (declare (in ) ivec2 y@0x16ceca0)\n" + " (declare (in ) ivec2 x@0x1e48b90)\n" + " (declare (in ) ivec2 y@0x1e48ca0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) ivec3 x@0x16cee80)\n" - " (declare (in ) ivec3 y@0x16cef90)\n" + " (declare (in ) ivec3 x@0x1e48e80)\n" + " (declare (in ) ivec3 y@0x1e48f90)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) ivec4 x@0x16cf170)\n" - " (declare (in ) ivec4 y@0x16cf280)\n" + " (declare (in ) ivec4 x@0x1e49170)\n" + " (declare (in ) ivec4 y@0x1e49280)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) uvec2 x@0x16cf460)\n" - " (declare (in ) uvec2 y@0x16cf570)\n" + " (declare (in ) uvec2 x@0x1e49460)\n" + " (declare (in ) uvec2 y@0x1e49570)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) uvec3 x@0x16cf750)\n" - " (declare (in ) uvec3 y@0x16cf860)\n" + " (declare (in ) uvec3 x@0x1e49750)\n" + " (declare (in ) uvec3 y@0x1e49860)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) uvec4 x@0x16cfa40)\n" - " (declare (in ) uvec4 y@0x16cfb50)\n" + " (declare (in ) uvec4 x@0x1e49a40)\n" + " (declare (in ) uvec4 y@0x1e49b50)\n" " )\n" " (\n" " ))\n" @@ -18954,72 +18954,72 @@ static const char *prototypes_for_130_vert = "(function lessThanEqual\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x16cfd30)\n" - " (declare (in ) vec2 y@0x16cfe40)\n" + " (declare (in ) vec2 x@0x1e49d30)\n" + " (declare (in ) vec2 y@0x1e49e40)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x16d01d0)\n" - " (declare (in ) vec3 y@0x16d02e0)\n" + " (declare (in ) vec3 x@0x1e4a1d0)\n" + " (declare (in ) vec3 y@0x1e4a2e0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x16d04c0)\n" - " (declare (in ) vec4 y@0x16d05d0)\n" + " (declare (in ) vec4 x@0x1e4a4c0)\n" + " (declare (in ) vec4 y@0x1e4a5d0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) ivec2 x@0x16d07b0)\n" - " (declare (in ) ivec2 y@0x16d08c0)\n" + " (declare (in ) ivec2 x@0x1e4a7b0)\n" + " (declare (in ) ivec2 y@0x1e4a8c0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) ivec3 x@0x16d0aa0)\n" - " (declare (in ) ivec3 y@0x16d0bb0)\n" + " (declare (in ) ivec3 x@0x1e4aaa0)\n" + " (declare (in ) ivec3 y@0x1e4abb0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) ivec4 x@0x16d0d90)\n" - " (declare (in ) ivec4 y@0x16d0ea0)\n" + " (declare (in ) ivec4 x@0x1e4ad90)\n" + " (declare (in ) ivec4 y@0x1e4aea0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) uvec2 x@0x16d1080)\n" - " (declare (in ) uvec2 y@0x16d1190)\n" + " (declare (in ) uvec2 x@0x1e4b080)\n" + " (declare (in ) uvec2 y@0x1e4b190)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) uvec3 x@0x16d1370)\n" - " (declare (in ) uvec3 y@0x16d1480)\n" + " (declare (in ) uvec3 x@0x1e4b370)\n" + " (declare (in ) uvec3 y@0x1e4b480)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) uvec4 x@0x16d1660)\n" - " (declare (in ) uvec4 y@0x16d1770)\n" + " (declare (in ) uvec4 x@0x1e4b660)\n" + " (declare (in ) uvec4 y@0x1e4b770)\n" " )\n" " (\n" " ))\n" @@ -19029,72 +19029,72 @@ static const char *prototypes_for_130_vert = "(function greaterThan\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x16d1950)\n" - " (declare (in ) vec2 y@0x16d1a60)\n" + " (declare (in ) vec2 x@0x1e4b950)\n" + " (declare (in ) vec2 y@0x1e4ba60)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x16d1df0)\n" - " (declare (in ) vec3 y@0x16d1f00)\n" + " (declare (in ) vec3 x@0x1e4bdf0)\n" + " (declare (in ) vec3 y@0x1e4bf00)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x16d20e0)\n" - " (declare (in ) vec4 y@0x16d21f0)\n" + " (declare (in ) vec4 x@0x1e4c0e0)\n" + " (declare (in ) vec4 y@0x1e4c1f0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) ivec2 x@0x16d23d0)\n" - " (declare (in ) ivec2 y@0x16d24e0)\n" + " (declare (in ) ivec2 x@0x1e4c3d0)\n" + " (declare (in ) ivec2 y@0x1e4c4e0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) ivec3 x@0x16d26c0)\n" - " (declare (in ) ivec3 y@0x16d27d0)\n" + " (declare (in ) ivec3 x@0x1e4c6c0)\n" + " (declare (in ) ivec3 y@0x1e4c7d0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) ivec4 x@0x16d29b0)\n" - " (declare (in ) ivec4 y@0x16d2ac0)\n" + " (declare (in ) ivec4 x@0x1e4c9b0)\n" + " (declare (in ) ivec4 y@0x1e4cac0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) uvec2 x@0x16d2ca0)\n" - " (declare (in ) uvec2 y@0x16d2db0)\n" + " (declare (in ) uvec2 x@0x1e4cca0)\n" + " (declare (in ) uvec2 y@0x1e4cdb0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) uvec3 x@0x16d2f90)\n" - " (declare (in ) uvec3 y@0x16d30a0)\n" + " (declare (in ) uvec3 x@0x1e4cf90)\n" + " (declare (in ) uvec3 y@0x1e4d0a0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) uvec4 x@0x16d3280)\n" - " (declare (in ) uvec4 y@0x16d3390)\n" + " (declare (in ) uvec4 x@0x1e4d280)\n" + " (declare (in ) uvec4 y@0x1e4d390)\n" " )\n" " (\n" " ))\n" @@ -19104,72 +19104,72 @@ static const char *prototypes_for_130_vert = "(function greaterThanEqual\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x16d3570)\n" - " (declare (in ) vec2 y@0x16d3680)\n" + " (declare (in ) vec2 x@0x1e4d570)\n" + " (declare (in ) vec2 y@0x1e4d680)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x16d3a10)\n" - " (declare (in ) vec3 y@0x16d3b20)\n" + " (declare (in ) vec3 x@0x1e4da10)\n" + " (declare (in ) vec3 y@0x1e4db20)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x16d3d00)\n" - " (declare (in ) vec4 y@0x16d3e10)\n" + " (declare (in ) vec4 x@0x1e4dd00)\n" + " (declare (in ) vec4 y@0x1e4de10)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) ivec2 x@0x16d3ff0)\n" - " (declare (in ) ivec2 y@0x16d4100)\n" + " (declare (in ) ivec2 x@0x1e4dff0)\n" + " (declare (in ) ivec2 y@0x1e4e100)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) ivec3 x@0x16d42e0)\n" - " (declare (in ) ivec3 y@0x16d43f0)\n" + " (declare (in ) ivec3 x@0x1e4e2e0)\n" + " (declare (in ) ivec3 y@0x1e4e3f0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) ivec4 x@0x16d45d0)\n" - " (declare (in ) ivec4 y@0x16d46e0)\n" + " (declare (in ) ivec4 x@0x1e4e5d0)\n" + " (declare (in ) ivec4 y@0x1e4e6e0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) uvec2 x@0x16d48c0)\n" - " (declare (in ) uvec2 y@0x16d49d0)\n" + " (declare (in ) uvec2 x@0x1e4e8c0)\n" + " (declare (in ) uvec2 y@0x1e4e9d0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) uvec3 x@0x16d4bb0)\n" - " (declare (in ) uvec3 y@0x16d4cc0)\n" + " (declare (in ) uvec3 x@0x1e4ebb0)\n" + " (declare (in ) uvec3 y@0x1e4ecc0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) uvec4 x@0x16d4ea0)\n" - " (declare (in ) uvec4 y@0x16d4fb0)\n" + " (declare (in ) uvec4 x@0x1e4eea0)\n" + " (declare (in ) uvec4 y@0x1e4efb0)\n" " )\n" " (\n" " ))\n" @@ -19179,96 +19179,96 @@ static const char *prototypes_for_130_vert = "(function equal\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x16d5190)\n" - " (declare (in ) vec2 y@0x16d52a0)\n" + " (declare (in ) vec2 x@0x1e4f190)\n" + " (declare (in ) vec2 y@0x1e4f2a0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x16d5620)\n" - " (declare (in ) vec3 y@0x16d5730)\n" + " (declare (in ) vec3 x@0x1e4f620)\n" + " (declare (in ) vec3 y@0x1e4f730)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x16d5910)\n" - " (declare (in ) vec4 y@0x16d5a20)\n" + " (declare (in ) vec4 x@0x1e4f910)\n" + " (declare (in ) vec4 y@0x1e4fa20)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) ivec2 x@0x16d5c00)\n" - " (declare (in ) ivec2 y@0x16d5d10)\n" + " (declare (in ) ivec2 x@0x1e4fc00)\n" + " (declare (in ) ivec2 y@0x1e4fd10)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) ivec3 x@0x16d5ef0)\n" - " (declare (in ) ivec3 y@0x16d6000)\n" + " (declare (in ) ivec3 x@0x1e4fef0)\n" + " (declare (in ) ivec3 y@0x1e50000)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) ivec4 x@0x16d61e0)\n" - " (declare (in ) ivec4 y@0x16d62f0)\n" + " (declare (in ) ivec4 x@0x1e501e0)\n" + " (declare (in ) ivec4 y@0x1e502f0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) uvec2 x@0x16d64d0)\n" - " (declare (in ) uvec2 y@0x16d65e0)\n" + " (declare (in ) uvec2 x@0x1e504d0)\n" + " (declare (in ) uvec2 y@0x1e505e0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) uvec3 x@0x16d67c0)\n" - " (declare (in ) uvec3 y@0x16d68d0)\n" + " (declare (in ) uvec3 x@0x1e507c0)\n" + " (declare (in ) uvec3 y@0x1e508d0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) uvec4 x@0x16d6ab0)\n" - " (declare (in ) uvec4 y@0x16d6bc0)\n" + " (declare (in ) uvec4 x@0x1e50ab0)\n" + " (declare (in ) uvec4 y@0x1e50bc0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) bvec2 x@0x16d6da0)\n" - " (declare (in ) bvec2 y@0x16d6eb0)\n" + " (declare (in ) bvec2 x@0x1e50da0)\n" + " (declare (in ) bvec2 y@0x1e50eb0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) bvec3 x@0x16d7090)\n" - " (declare (in ) bvec3 y@0x16d71a0)\n" + " (declare (in ) bvec3 x@0x1e51090)\n" + " (declare (in ) bvec3 y@0x1e511a0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) bvec4 x@0x16d7380)\n" - " (declare (in ) bvec4 y@0x16d7490)\n" + " (declare (in ) bvec4 x@0x1e51380)\n" + " (declare (in ) bvec4 y@0x1e51490)\n" " )\n" " (\n" " ))\n" @@ -19278,96 +19278,96 @@ static const char *prototypes_for_130_vert = "(function notEqual\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x16d7670)\n" - " (declare (in ) vec2 y@0x16d7780)\n" + " (declare (in ) vec2 x@0x1e51670)\n" + " (declare (in ) vec2 y@0x1e51780)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x16d7b10)\n" - " (declare (in ) vec3 y@0x16d7c20)\n" + " (declare (in ) vec3 x@0x1e51b10)\n" + " (declare (in ) vec3 y@0x1e51c20)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x16d7e00)\n" - " (declare (in ) vec4 y@0x16d7f10)\n" + " (declare (in ) vec4 x@0x1e51e00)\n" + " (declare (in ) vec4 y@0x1e51f10)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) ivec2 x@0x16d80f0)\n" - " (declare (in ) ivec2 y@0x16d8200)\n" + " (declare (in ) ivec2 x@0x1e520f0)\n" + " (declare (in ) ivec2 y@0x1e52200)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) ivec3 x@0x16d83e0)\n" - " (declare (in ) ivec3 y@0x16d84f0)\n" + " (declare (in ) ivec3 x@0x1e523e0)\n" + " (declare (in ) ivec3 y@0x1e524f0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) ivec4 x@0x16d86d0)\n" - " (declare (in ) ivec4 y@0x16d87e0)\n" + " (declare (in ) ivec4 x@0x1e526d0)\n" + " (declare (in ) ivec4 y@0x1e527e0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) uvec2 x@0x16d89c0)\n" - " (declare (in ) uvec2 y@0x16d8ad0)\n" + " (declare (in ) uvec2 x@0x1e529c0)\n" + " (declare (in ) uvec2 y@0x1e52ad0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) uvec3 x@0x16d8cb0)\n" - " (declare (in ) uvec3 y@0x16d8dc0)\n" + " (declare (in ) uvec3 x@0x1e52cb0)\n" + " (declare (in ) uvec3 y@0x1e52dc0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) uvec4 x@0x16d8fa0)\n" - " (declare (in ) uvec4 y@0x16d90b0)\n" + " (declare (in ) uvec4 x@0x1e52fa0)\n" + " (declare (in ) uvec4 y@0x1e530b0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) bvec2 x@0x16d9290)\n" - " (declare (in ) bvec2 y@0x16d93a0)\n" + " (declare (in ) bvec2 x@0x1e53290)\n" + " (declare (in ) bvec2 y@0x1e533a0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) bvec3 x@0x16d9580)\n" - " (declare (in ) bvec3 y@0x16d9690)\n" + " (declare (in ) bvec3 x@0x1e53580)\n" + " (declare (in ) bvec3 y@0x1e53690)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) bvec4 x@0x16d9870)\n" - " (declare (in ) bvec4 y@0x16d9980)\n" + " (declare (in ) bvec4 x@0x1e53870)\n" + " (declare (in ) bvec4 y@0x1e53980)\n" " )\n" " (\n" " ))\n" @@ -19377,21 +19377,21 @@ static const char *prototypes_for_130_vert = "(function any\n" " (signature bool\n" " (parameters\n" - " (declare (in ) bvec2 x@0x16d9b60)\n" + " (declare (in ) bvec2 x@0x1e53b60)\n" " )\n" " (\n" " ))\n" "\n" " (signature bool\n" " (parameters\n" - " (declare (in ) bvec3 x@0x16d9ee0)\n" + " (declare (in ) bvec3 x@0x1e53ee0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bool\n" " (parameters\n" - " (declare (in ) bvec4 x@0x16da0c0)\n" + " (declare (in ) bvec4 x@0x1e540c0)\n" " )\n" " (\n" " ))\n" @@ -19401,21 +19401,21 @@ static const char *prototypes_for_130_vert = "(function all\n" " (signature bool\n" " (parameters\n" - " (declare (in ) bvec2 x@0x16da2a0)\n" + " (declare (in ) bvec2 x@0x1e542a0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bool\n" " (parameters\n" - " (declare (in ) bvec3 x@0x16da620)\n" + " (declare (in ) bvec3 x@0x1e54620)\n" " )\n" " (\n" " ))\n" "\n" " (signature bool\n" " (parameters\n" - " (declare (in ) bvec4 x@0x16da800)\n" + " (declare (in ) bvec4 x@0x1e54800)\n" " )\n" " (\n" " ))\n" @@ -19425,21 +19425,21 @@ static const char *prototypes_for_130_vert = "(function not\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) bvec2 x@0x16da9e0)\n" + " (declare (in ) bvec2 x@0x1e549e0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) bvec3 x@0x16dad60)\n" + " (declare (in ) bvec3 x@0x1e54d60)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) bvec4 x@0x16daf40)\n" + " (declare (in ) bvec4 x@0x1e54f40)\n" " )\n" " (\n" " ))\n" @@ -19449,382 +19449,382 @@ static const char *prototypes_for_130_vert = "(function texture\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1D sampler@0x16db120)\n" - " (declare (in ) float P@0x16db230)\n" + " (declare (in ) sampler1D sampler@0x1e55120)\n" + " (declare (in ) float P@0x1e55230)\n" " )\n" " (\n" " ))\n" "\n" " (signature ivec4\n" " (parameters\n" - " (declare (in ) isampler1D sampler@0x16db5b0)\n" - " (declare (in ) float P@0x16db6c0)\n" + " (declare (in ) isampler1D sampler@0x1e555b0)\n" + " (declare (in ) float P@0x1e556c0)\n" " )\n" " (\n" " ))\n" "\n" " (signature uvec4\n" " (parameters\n" - " (declare (in ) usampler1D sampler@0x16db8a0)\n" - " (declare (in ) float P@0x16db9b0)\n" + " (declare (in ) usampler1D sampler@0x1e558a0)\n" + " (declare (in ) float P@0x1e559b0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2D sampler@0x16dbb90)\n" - " (declare (in ) vec2 P@0x16dbca0)\n" + " (declare (in ) sampler2D sampler@0x1e55b90)\n" + " (declare (in ) vec2 P@0x1e55ca0)\n" " )\n" " (\n" " ))\n" "\n" " (signature ivec4\n" " (parameters\n" - " (declare (in ) isampler2D sampler@0x16dbe80)\n" - " (declare (in ) vec2 P@0x16dbf90)\n" + " (declare (in ) isampler2D sampler@0x1e55e80)\n" + " (declare (in ) vec2 P@0x1e55f90)\n" " )\n" " (\n" " ))\n" "\n" " (signature uvec4\n" " (parameters\n" - " (declare (in ) usampler2D sampler@0x16dc170)\n" - " (declare (in ) vec2 P@0x16dc280)\n" + " (declare (in ) usampler2D sampler@0x1e56170)\n" + " (declare (in ) vec2 P@0x1e56280)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler3D sampler@0x16dc460)\n" - " (declare (in ) vec3 P@0x16dc570)\n" + " (declare (in ) sampler3D sampler@0x1e56460)\n" + " (declare (in ) vec3 P@0x1e56570)\n" " )\n" " (\n" " ))\n" "\n" " (signature ivec4\n" " (parameters\n" - " (declare (in ) isampler3D sampler@0x16dc750)\n" - " (declare (in ) vec3 P@0x16dc860)\n" + " (declare (in ) isampler3D sampler@0x1e56750)\n" + " (declare (in ) vec3 P@0x1e56860)\n" " )\n" " (\n" " ))\n" "\n" " (signature uvec4\n" " (parameters\n" - " (declare (in ) usampler3D sampler@0x16dca40)\n" - " (declare (in ) vec3 P@0x16dcb50)\n" + " (declare (in ) usampler3D sampler@0x1e56a40)\n" + " (declare (in ) vec3 P@0x1e56b50)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) samplerCube sampler@0x16dcd30)\n" - " (declare (in ) vec3 P@0x16dce40)\n" + " (declare (in ) samplerCube sampler@0x1e56d30)\n" + " (declare (in ) vec3 P@0x1e56e40)\n" " )\n" " (\n" " ))\n" "\n" " (signature ivec4\n" " (parameters\n" - " (declare (in ) isamplerCube sampler@0x16dd020)\n" - " (declare (in ) vec3 P@0x16dd130)\n" + " (declare (in ) isamplerCube sampler@0x1e57020)\n" + " (declare (in ) vec3 P@0x1e57130)\n" " )\n" " (\n" " ))\n" "\n" " (signature uvec4\n" " (parameters\n" - " (declare (in ) usamplerCube sampler@0x16dd310)\n" - " (declare (in ) vec3 P@0x16dd420)\n" + " (declare (in ) usamplerCube sampler@0x1e57310)\n" + " (declare (in ) vec3 P@0x1e57420)\n" " )\n" " (\n" " ))\n" "\n" " (signature float\n" " (parameters\n" - " (declare (in ) sampler1DShadow sampler@0x16dd600)\n" - " (declare (in ) vec3 P@0x16dd710)\n" + " (declare (in ) sampler1DShadow sampler@0x1e57600)\n" + " (declare (in ) vec3 P@0x1e57710)\n" " )\n" " (\n" " ))\n" "\n" " (signature float\n" " (parameters\n" - " (declare (in ) sampler2DShadow sampler@0x16dd8f0)\n" - " (declare (in ) vec3 P@0x16dda00)\n" + " (declare (in ) sampler2DShadow sampler@0x1e578f0)\n" + " (declare (in ) vec3 P@0x1e57a00)\n" " )\n" " (\n" " ))\n" "\n" " (signature float\n" " (parameters\n" - " (declare (in ) samplerCubeShadow sampler@0x16ddbe0)\n" - " (declare (in ) vec4 P@0x16ddcf0)\n" + " (declare (in ) samplerCubeShadow sampler@0x1e57be0)\n" + " (declare (in ) vec4 P@0x1e57cf0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1DArray sampler@0x16dded0)\n" - " (declare (in ) vec2 P@0x16ddfe0)\n" + " (declare (in ) sampler1DArray sampler@0x1e57ed0)\n" + " (declare (in ) vec2 P@0x1e57fe0)\n" " )\n" " (\n" " ))\n" "\n" " (signature ivec4\n" " (parameters\n" - " (declare (in ) isampler1DArray sampler@0x16de1c0)\n" - " (declare (in ) vec2 P@0x16de2d0)\n" + " (declare (in ) isampler1DArray sampler@0x1e581c0)\n" + " (declare (in ) vec2 P@0x1e582d0)\n" " )\n" " (\n" " ))\n" "\n" " (signature uvec4\n" " (parameters\n" - " (declare (in ) usampler1DArray sampler@0x16de4b0)\n" - " (declare (in ) vec2 P@0x16de5c0)\n" + " (declare (in ) usampler1DArray sampler@0x1e584b0)\n" + " (declare (in ) vec2 P@0x1e585c0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2DArray sampler@0x16de7a0)\n" - " (declare (in ) vec3 P@0x16de8b0)\n" + " (declare (in ) sampler2DArray sampler@0x1e587a0)\n" + " (declare (in ) vec3 P@0x1e588b0)\n" " )\n" " (\n" " ))\n" "\n" " (signature ivec4\n" " (parameters\n" - " (declare (in ) isampler2DArray sampler@0x16dea90)\n" - " (declare (in ) vec3 P@0x16deba0)\n" + " (declare (in ) isampler2DArray sampler@0x1e58a90)\n" + " (declare (in ) vec3 P@0x1e58ba0)\n" " )\n" " (\n" " ))\n" "\n" " (signature uvec4\n" " (parameters\n" - " (declare (in ) usampler2DArray sampler@0x16ded80)\n" - " (declare (in ) vec3 P@0x16dee90)\n" + " (declare (in ) usampler2DArray sampler@0x1e58d80)\n" + " (declare (in ) vec3 P@0x1e58e90)\n" " )\n" " (\n" " ))\n" "\n" " (signature float\n" " (parameters\n" - " (declare (in ) sampler1DArrayShadow sampler@0x16df070)\n" - " (declare (in ) vec3 P@0x16df180)\n" + " (declare (in ) sampler1DArrayShadow sampler@0x1e59070)\n" + " (declare (in ) vec3 P@0x1e59180)\n" " )\n" " (\n" " ))\n" "\n" " (signature float\n" " (parameters\n" - " (declare (in ) sampler2DArrayShadow sampler@0x16df360)\n" - " (declare (in ) vec4 P@0x16df470)\n" + " (declare (in ) sampler2DArrayShadow sampler@0x1e59360)\n" + " (declare (in ) vec4 P@0x1e59470)\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" + " (declare (in ) sampler1D sampler@0x1e59650)\n" + " (declare (in ) float P@0x1e59760)\n" + " (declare (in ) float bias@0x1e59870)\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" + " (declare (in ) isampler1D sampler@0x1e59a50)\n" + " (declare (in ) float P@0x1e59b60)\n" + " (declare (in ) float bias@0x1e59c70)\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" + " (declare (in ) usampler1D sampler@0x1e59e50)\n" + " (declare (in ) float P@0x1e59f60)\n" + " (declare (in ) float bias@0x1e5a070)\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" + " (declare (in ) sampler2D sampler@0x1e5a250)\n" + " (declare (in ) vec2 P@0x1e5a360)\n" + " (declare (in ) float bias@0x1e5a470)\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" + " (declare (in ) isampler2D sampler@0x1e5a650)\n" + " (declare (in ) vec2 P@0x1e5a760)\n" + " (declare (in ) float bias@0x1e5a870)\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" + " (declare (in ) usampler2D sampler@0x1e5aa50)\n" + " (declare (in ) vec2 P@0x1e5ab60)\n" + " (declare (in ) float bias@0x1e5ac70)\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" + " (declare (in ) sampler3D sampler@0x1e5ae50)\n" + " (declare (in ) vec3 P@0x1e5af60)\n" + " (declare (in ) float bias@0x1e5b070)\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" + " (declare (in ) isampler3D sampler@0x1e5b250)\n" + " (declare (in ) vec3 P@0x1e5b360)\n" + " (declare (in ) float bias@0x1e5b470)\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" + " (declare (in ) usampler3D sampler@0x1e5b650)\n" + " (declare (in ) vec3 P@0x1e5b760)\n" + " (declare (in ) float bias@0x1e5b870)\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" + " (declare (in ) samplerCube sampler@0x1e5ba50)\n" + " (declare (in ) vec3 P@0x1e5bb60)\n" + " (declare (in ) float bias@0x1e5bc70)\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" + " (declare (in ) isamplerCube sampler@0x1e5be50)\n" + " (declare (in ) vec3 P@0x1e5bf60)\n" + " (declare (in ) float bias@0x1e5c070)\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" + " (declare (in ) usamplerCube sampler@0x1e5c250)\n" + " (declare (in ) vec3 P@0x1e5c360)\n" + " (declare (in ) float bias@0x1e5c470)\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" + " (declare (in ) sampler1DShadow sampler@0x1e5c650)\n" + " (declare (in ) vec3 P@0x1e5c760)\n" + " (declare (in ) float bias@0x1e5c870)\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" + " (declare (in ) sampler2DShadow sampler@0x1e5ca50)\n" + " (declare (in ) vec3 P@0x1e5cb60)\n" + " (declare (in ) float bias@0x1e5cc70)\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" + " (declare (in ) samplerCubeShadow sampler@0x1e5ce50)\n" + " (declare (in ) vec4 P@0x1e5cf60)\n" + " (declare (in ) float bias@0x1e5d070)\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" + " (declare (in ) sampler1DArray sampler@0x1e5d250)\n" + " (declare (in ) vec2 P@0x1e5d360)\n" + " (declare (in ) float bias@0x1e5d470)\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" + " (declare (in ) isampler1DArray sampler@0x1e5d650)\n" + " (declare (in ) vec2 P@0x1e5d760)\n" + " (declare (in ) float bias@0x1e5d870)\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" + " (declare (in ) usampler1DArray sampler@0x1e5da50)\n" + " (declare (in ) vec2 P@0x1e5db60)\n" + " (declare (in ) float bias@0x1e5dc70)\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" + " (declare (in ) sampler2DArray sampler@0x1e5de50)\n" + " (declare (in ) vec3 P@0x1e5df60)\n" + " (declare (in ) float bias@0x1e5e070)\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" + " (declare (in ) isampler2DArray sampler@0x1e5e250)\n" + " (declare (in ) vec3 P@0x1e5e360)\n" + " (declare (in ) float bias@0x1e5e470)\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" + " (declare (in ) usampler2DArray sampler@0x1e5e650)\n" + " (declare (in ) vec3 P@0x1e5e760)\n" + " (declare (in ) float bias@0x1e5e870)\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" + " (declare (in ) sampler1DArrayShadow sampler@0x1e5ea50)\n" + " (declare (in ) vec3 P@0x1e5eb60)\n" + " (declare (in ) float bias@0x1e5ec70)\n" " )\n" " (\n" " ))\n" @@ -19834,289 +19834,289 @@ static const char *prototypes_for_130_vert = "(function textureProj\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1D sampler@0x16e4e50)\n" - " (declare (in ) vec2 P@0x16e4f60)\n" + " (declare (in ) sampler1D sampler@0x1e5ee50)\n" + " (declare (in ) vec2 P@0x1e5ef60)\n" " )\n" " (\n" " ))\n" "\n" " (signature ivec4\n" " (parameters\n" - " (declare (in ) isampler1D sampler@0x16e52f0)\n" - " (declare (in ) vec2 P@0x16e5400)\n" + " (declare (in ) isampler1D sampler@0x1e5f2f0)\n" + " (declare (in ) vec2 P@0x1e5f400)\n" " )\n" " (\n" " ))\n" "\n" " (signature uvec4\n" " (parameters\n" - " (declare (in ) usampler1D sampler@0x16e55e0)\n" - " (declare (in ) vec2 P@0x16e56f0)\n" + " (declare (in ) usampler1D sampler@0x1e5f5e0)\n" + " (declare (in ) vec2 P@0x1e5f6f0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1D sampler@0x16e58d0)\n" - " (declare (in ) vec4 P@0x16e59e0)\n" + " (declare (in ) sampler1D sampler@0x1e5f8d0)\n" + " (declare (in ) vec4 P@0x1e5f9e0)\n" " )\n" " (\n" " ))\n" "\n" " (signature ivec4\n" " (parameters\n" - " (declare (in ) isampler1D sampler@0x16e5bc0)\n" - " (declare (in ) vec4 P@0x16e5cd0)\n" + " (declare (in ) isampler1D sampler@0x1e5fbc0)\n" + " (declare (in ) vec4 P@0x1e5fcd0)\n" " )\n" " (\n" " ))\n" "\n" " (signature uvec4\n" " (parameters\n" - " (declare (in ) usampler1D sampler@0x16e5eb0)\n" - " (declare (in ) vec4 P@0x16e5fc0)\n" + " (declare (in ) usampler1D sampler@0x1e5feb0)\n" + " (declare (in ) vec4 P@0x1e5ffc0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2D sampler@0x16e61a0)\n" - " (declare (in ) vec3 P@0x16e62b0)\n" + " (declare (in ) sampler2D sampler@0x1e601a0)\n" + " (declare (in ) vec3 P@0x1e602b0)\n" " )\n" " (\n" " ))\n" "\n" " (signature ivec4\n" " (parameters\n" - " (declare (in ) isampler2D sampler@0x16e6490)\n" - " (declare (in ) vec3 P@0x16e65a0)\n" + " (declare (in ) isampler2D sampler@0x1e60490)\n" + " (declare (in ) vec3 P@0x1e605a0)\n" " )\n" " (\n" " ))\n" "\n" " (signature uvec4\n" " (parameters\n" - " (declare (in ) usampler2D sampler@0x16e6780)\n" - " (declare (in ) vec3 P@0x16e6890)\n" + " (declare (in ) usampler2D sampler@0x1e60780)\n" + " (declare (in ) vec3 P@0x1e60890)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2D sampler@0x16e6a70)\n" - " (declare (in ) vec4 P@0x16e6b80)\n" + " (declare (in ) sampler2D sampler@0x1e60a70)\n" + " (declare (in ) vec4 P@0x1e60b80)\n" " )\n" " (\n" " ))\n" "\n" " (signature ivec4\n" " (parameters\n" - " (declare (in ) isampler2D sampler@0x16e6d60)\n" - " (declare (in ) vec4 P@0x16e6e70)\n" + " (declare (in ) isampler2D sampler@0x1e60d60)\n" + " (declare (in ) vec4 P@0x1e60e70)\n" " )\n" " (\n" " ))\n" "\n" " (signature uvec4\n" " (parameters\n" - " (declare (in ) usampler2D sampler@0x16e7050)\n" - " (declare (in ) vec4 P@0x16e7160)\n" + " (declare (in ) usampler2D sampler@0x1e61050)\n" + " (declare (in ) vec4 P@0x1e61160)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler3D sampler@0x16e7340)\n" - " (declare (in ) vec4 P@0x16e7450)\n" + " (declare (in ) sampler3D sampler@0x1e61340)\n" + " (declare (in ) vec4 P@0x1e61450)\n" " )\n" " (\n" " ))\n" "\n" " (signature ivec4\n" " (parameters\n" - " (declare (in ) isampler3D sampler@0x16e7630)\n" - " (declare (in ) vec4 P@0x16e7740)\n" + " (declare (in ) isampler3D sampler@0x1e61630)\n" + " (declare (in ) vec4 P@0x1e61740)\n" " )\n" " (\n" " ))\n" "\n" " (signature uvec4\n" " (parameters\n" - " (declare (in ) usampler3D sampler@0x16e7920)\n" - " (declare (in ) vec4 P@0x16e7a30)\n" + " (declare (in ) usampler3D sampler@0x1e61920)\n" + " (declare (in ) vec4 P@0x1e61a30)\n" " )\n" " (\n" " ))\n" "\n" " (signature float\n" " (parameters\n" - " (declare (in ) sampler1DShadow sampler@0x16e7c10)\n" - " (declare (in ) vec4 P@0x16e7d20)\n" + " (declare (in ) sampler1DShadow sampler@0x1e61c10)\n" + " (declare (in ) vec4 P@0x1e61d20)\n" " )\n" " (\n" " ))\n" "\n" " (signature float\n" " (parameters\n" - " (declare (in ) sampler2DShadow sampler@0x16e7f00)\n" - " (declare (in ) vec4 P@0x16e8010)\n" + " (declare (in ) sampler2DShadow sampler@0x1e61f00)\n" + " (declare (in ) vec4 P@0x1e62010)\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" + " (declare (in ) sampler1D sampler@0x1e621f0)\n" + " (declare (in ) vec2 P@0x1e62300)\n" + " (declare (in ) float bias@0x1e62410)\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" + " (declare (in ) isampler1D sampler@0x1e625f0)\n" + " (declare (in ) vec2 P@0x1e62700)\n" + " (declare (in ) float bias@0x1e62810)\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" + " (declare (in ) usampler1D sampler@0x1e629f0)\n" + " (declare (in ) vec2 P@0x1e62b00)\n" + " (declare (in ) float bias@0x1e62c10)\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" + " (declare (in ) sampler1D sampler@0x1e62df0)\n" + " (declare (in ) vec4 P@0x1e62f00)\n" + " (declare (in ) float bias@0x1e63010)\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" + " (declare (in ) isampler1D sampler@0x1e631f0)\n" + " (declare (in ) vec4 P@0x1e63300)\n" + " (declare (in ) float bias@0x1e63410)\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" + " (declare (in ) usampler1D sampler@0x1e635f0)\n" + " (declare (in ) vec4 P@0x1e63700)\n" + " (declare (in ) float bias@0x1e63810)\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" + " (declare (in ) sampler2D sampler@0x1e639f0)\n" + " (declare (in ) vec3 P@0x1e63b00)\n" + " (declare (in ) float bias@0x1e63c10)\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" + " (declare (in ) isampler2D sampler@0x1e63df0)\n" + " (declare (in ) vec3 P@0x1e63f00)\n" + " (declare (in ) float bias@0x1e64010)\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" + " (declare (in ) usampler2D sampler@0x1e641f0)\n" + " (declare (in ) vec3 P@0x1e64300)\n" + " (declare (in ) float bias@0x1e64410)\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" + " (declare (in ) sampler2D sampler@0x1e645f0)\n" + " (declare (in ) vec4 P@0x1e64700)\n" + " (declare (in ) float bias@0x1e64810)\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" + " (declare (in ) isampler2D sampler@0x1e649f0)\n" + " (declare (in ) vec4 P@0x1e64b00)\n" + " (declare (in ) float bias@0x1e64c10)\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" + " (declare (in ) usampler2D sampler@0x1e64df0)\n" + " (declare (in ) vec4 P@0x1e64f00)\n" + " (declare (in ) float bias@0x1e65010)\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" + " (declare (in ) sampler3D sampler@0x1e651f0)\n" + " (declare (in ) vec4 P@0x1e65300)\n" + " (declare (in ) float bias@0x1e65410)\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" + " (declare (in ) isampler3D sampler@0x1e655f0)\n" + " (declare (in ) vec4 P@0x1e65700)\n" + " (declare (in ) float bias@0x1e65810)\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" + " (declare (in ) usampler3D sampler@0x1e659f0)\n" + " (declare (in ) vec4 P@0x1e65b00)\n" + " (declare (in ) float bias@0x1e65c10)\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" + " (declare (in ) sampler1DShadow sampler@0x1e65df0)\n" + " (declare (in ) vec4 P@0x1e65f00)\n" + " (declare (in ) float bias@0x1e66010)\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" + " (declare (in ) sampler2DShadow sampler@0x1e661f0)\n" + " (declare (in ) vec4 P@0x1e66300)\n" + " (declare (in ) float bias@0x1e66410)\n" " )\n" " (\n" " ))\n" @@ -20126,189 +20126,189 @@ static const char *prototypes_for_130_vert = "(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" + " (declare (in ) sampler1D sampler@0x1e665f0)\n" + " (declare (in ) float P@0x1e66700)\n" + " (declare (in ) float lod@0x1e66810)\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" + " (declare (in ) isampler1D sampler@0x1e66ba0)\n" + " (declare (in ) float P@0x1e66cb0)\n" + " (declare (in ) float lod@0x1e66dc0)\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" + " (declare (in ) usampler1D sampler@0x1e66fa0)\n" + " (declare (in ) float P@0x1e670b0)\n" + " (declare (in ) float lod@0x1e671c0)\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" + " (declare (in ) sampler2D sampler@0x1e673a0)\n" + " (declare (in ) vec2 P@0x1e674b0)\n" + " (declare (in ) float lod@0x1e675c0)\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" + " (declare (in ) isampler2D sampler@0x1e677a0)\n" + " (declare (in ) vec2 P@0x1e678b0)\n" + " (declare (in ) float lod@0x1e679c0)\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" + " (declare (in ) usampler2D sampler@0x1e67ba0)\n" + " (declare (in ) vec2 P@0x1e67cb0)\n" + " (declare (in ) float lod@0x1e67dc0)\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" + " (declare (in ) sampler3D sampler@0x1e67fa0)\n" + " (declare (in ) vec3 P@0x1e680b0)\n" + " (declare (in ) float lod@0x1e681c0)\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" + " (declare (in ) isampler3D sampler@0x1e683a0)\n" + " (declare (in ) vec3 P@0x1e684b0)\n" + " (declare (in ) float lod@0x1e685c0)\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" + " (declare (in ) usampler3D sampler@0x1e687a0)\n" + " (declare (in ) vec3 P@0x1e688b0)\n" + " (declare (in ) float lod@0x1e689c0)\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" + " (declare (in ) samplerCube sampler@0x1e68ba0)\n" + " (declare (in ) vec3 P@0x1e68cb0)\n" + " (declare (in ) float lod@0x1e68dc0)\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" + " (declare (in ) isamplerCube sampler@0x1e68fa0)\n" + " (declare (in ) vec3 P@0x1e690b0)\n" + " (declare (in ) float lod@0x1e691c0)\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" + " (declare (in ) usamplerCube sampler@0x1e693a0)\n" + " (declare (in ) vec3 P@0x1e694b0)\n" + " (declare (in ) float lod@0x1e695c0)\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" + " (declare (in ) sampler1DShadow sampler@0x1e697a0)\n" + " (declare (in ) vec3 P@0x1e698b0)\n" + " (declare (in ) float lod@0x1e699c0)\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" + " (declare (in ) sampler2DShadow sampler@0x1e69ba0)\n" + " (declare (in ) vec3 P@0x1e69cb0)\n" + " (declare (in ) float lod@0x1e69dc0)\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" + " (declare (in ) sampler1DArray sampler@0x1e69fa0)\n" + " (declare (in ) vec2 P@0x1e6a0b0)\n" + " (declare (in ) float lod@0x1e6a1c0)\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" + " (declare (in ) isampler1DArray sampler@0x1e6a3a0)\n" + " (declare (in ) vec2 P@0x1e6a4b0)\n" + " (declare (in ) float lod@0x1e6a5c0)\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" + " (declare (in ) usampler1DArray sampler@0x1e6a7a0)\n" + " (declare (in ) vec2 P@0x1e6a8b0)\n" + " (declare (in ) float lod@0x1e6a9c0)\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" + " (declare (in ) sampler2DArray sampler@0x1e6aba0)\n" + " (declare (in ) vec3 P@0x1e6acb0)\n" + " (declare (in ) float lod@0x1e6adc0)\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" + " (declare (in ) isampler2DArray sampler@0x1e6afa0)\n" + " (declare (in ) vec3 P@0x1e6b0b0)\n" + " (declare (in ) float lod@0x1e6b1c0)\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" + " (declare (in ) usampler2DArray sampler@0x1e6b3a0)\n" + " (declare (in ) vec3 P@0x1e6b4b0)\n" + " (declare (in ) float lod@0x1e6b5c0)\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" + " (declare (in ) sampler1DArrayShadow sampler@0x1e6b7a0)\n" + " (declare (in ) vec3 P@0x1e6b8b0)\n" + " (declare (in ) float lod@0x1e6b9c0)\n" " )\n" " (\n" " ))\n" @@ -20318,135 +20318,135 @@ static const char *prototypes_for_130_vert = "(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" + " (declare (in ) sampler1D sampler@0x1e6bba0)\n" + " (declare (in ) int P@0x1e6bcb0)\n" + " (declare (in ) int lod@0x1e6bdc0)\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" + " (declare (in ) isampler1D sampler@0x1e6c150)\n" + " (declare (in ) int P@0x1e6c260)\n" + " (declare (in ) int lod@0x1e6c370)\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" + " (declare (in ) usampler1D sampler@0x1e6c550)\n" + " (declare (in ) int P@0x1e6c660)\n" + " (declare (in ) int lod@0x1e6c770)\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" + " (declare (in ) sampler2D sampler@0x1e6c950)\n" + " (declare (in ) ivec2 P@0x1e6ca60)\n" + " (declare (in ) int lod@0x1e6cb70)\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" + " (declare (in ) isampler2D sampler@0x1e6cd50)\n" + " (declare (in ) ivec2 P@0x1e6ce60)\n" + " (declare (in ) int lod@0x1e6cf70)\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" + " (declare (in ) usampler2D sampler@0x1e6d150)\n" + " (declare (in ) ivec2 P@0x1e6d260)\n" + " (declare (in ) int lod@0x1e6d370)\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" + " (declare (in ) sampler3D sampler@0x1e6d550)\n" + " (declare (in ) ivec3 P@0x1e6d660)\n" + " (declare (in ) int lod@0x1e6d770)\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" + " (declare (in ) isampler3D sampler@0x1e6d950)\n" + " (declare (in ) ivec3 P@0x1e6da60)\n" + " (declare (in ) int lod@0x1e6db70)\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" + " (declare (in ) usampler3D sampler@0x1e6dd50)\n" + " (declare (in ) ivec3 P@0x1e6de60)\n" + " (declare (in ) int lod@0x1e6df70)\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" + " (declare (in ) sampler1DArray sampler@0x1e6e150)\n" + " (declare (in ) ivec2 P@0x1e6e260)\n" + " (declare (in ) int lod@0x1e6e370)\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" + " (declare (in ) isampler1DArray sampler@0x1e6e550)\n" + " (declare (in ) ivec2 P@0x1e6e660)\n" + " (declare (in ) int lod@0x1e6e770)\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" + " (declare (in ) usampler1DArray sampler@0x1e6e950)\n" + " (declare (in ) ivec2 P@0x1e6ea60)\n" + " (declare (in ) int lod@0x1e6eb70)\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" + " (declare (in ) sampler2DArray sampler@0x1e6ed50)\n" + " (declare (in ) ivec3 P@0x1e6ee60)\n" + " (declare (in ) int lod@0x1e6ef70)\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" + " (declare (in ) isampler2DArray sampler@0x1e6f150)\n" + " (declare (in ) ivec3 P@0x1e6f260)\n" + " (declare (in ) int lod@0x1e6f370)\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" + " (declare (in ) usampler2DArray sampler@0x1e6f550)\n" + " (declare (in ) ivec3 P@0x1e6f660)\n" + " (declare (in ) int lod@0x1e6f770)\n" " )\n" " (\n" " ))\n" @@ -20456,153 +20456,153 @@ static const char *prototypes_for_130_vert = "(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" + " (declare (in ) sampler1D sampler@0x1e6f950)\n" + " (declare (in ) vec2 P@0x1e6fa60)\n" + " (declare (in ) float lod@0x1e6fb70)\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" + " (declare (in ) isampler1D sampler@0x1e6ff00)\n" + " (declare (in ) vec2 P@0x1e70010)\n" + " (declare (in ) float lod@0x1e70120)\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" + " (declare (in ) usampler1D sampler@0x1e70300)\n" + " (declare (in ) vec2 P@0x1e70410)\n" + " (declare (in ) float lod@0x1e70520)\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" + " (declare (in ) sampler1D sampler@0x1e70700)\n" + " (declare (in ) vec4 P@0x1e70810)\n" + " (declare (in ) float lod@0x1e70920)\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" + " (declare (in ) isampler1D sampler@0x1e70b00)\n" + " (declare (in ) vec4 P@0x1e70c10)\n" + " (declare (in ) float lod@0x1e70d20)\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" + " (declare (in ) usampler1D sampler@0x1e70f00)\n" + " (declare (in ) vec4 P@0x1e71010)\n" + " (declare (in ) float lod@0x1e71120)\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" + " (declare (in ) sampler2D sampler@0x1e71300)\n" + " (declare (in ) vec3 P@0x1e71410)\n" + " (declare (in ) float lod@0x1e71520)\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" + " (declare (in ) isampler2D sampler@0x1e71700)\n" + " (declare (in ) vec3 P@0x1e71810)\n" + " (declare (in ) float lod@0x1e71920)\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" + " (declare (in ) usampler2D sampler@0x1e71b00)\n" + " (declare (in ) vec3 P@0x1e71c10)\n" + " (declare (in ) float lod@0x1e71d20)\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" + " (declare (in ) sampler2D sampler@0x1e71f00)\n" + " (declare (in ) vec4 P@0x1e72010)\n" + " (declare (in ) float lod@0x1e72120)\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" + " (declare (in ) isampler2D sampler@0x1e72300)\n" + " (declare (in ) vec4 P@0x1e72410)\n" + " (declare (in ) float lod@0x1e72520)\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" + " (declare (in ) usampler2D sampler@0x1e72700)\n" + " (declare (in ) vec4 P@0x1e72810)\n" + " (declare (in ) float lod@0x1e72920)\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" + " (declare (in ) sampler3D sampler@0x1e72b00)\n" + " (declare (in ) vec4 P@0x1e72c10)\n" + " (declare (in ) float lod@0x1e72d20)\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" + " (declare (in ) isampler3D sampler@0x1e72f00)\n" + " (declare (in ) vec4 P@0x1e73010)\n" + " (declare (in ) float lod@0x1e73120)\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" + " (declare (in ) usampler3D sampler@0x1e73300)\n" + " (declare (in ) vec4 P@0x1e73410)\n" + " (declare (in ) float lod@0x1e73520)\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" + " (declare (in ) sampler1DShadow sampler@0x1e73700)\n" + " (declare (in ) vec4 P@0x1e73810)\n" + " (declare (in ) float lod@0x1e73920)\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" + " (declare (in ) sampler2DShadow sampler@0x1e73b00)\n" + " (declare (in ) vec4 P@0x1e73c10)\n" + " (declare (in ) float lod@0x1e73d20)\n" " )\n" " (\n" " ))\n" @@ -20612,230 +20612,230 @@ static const char *prototypes_for_130_vert = "(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" + " (declare (in ) sampler1D sampler@0x1e73f00)\n" + " (declare (in ) float P@0x1e74010)\n" + " (declare (in ) float dPdx@0x1e74120)\n" + " (declare (in ) float dPdy@0x1e74230)\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" + " (declare (in ) isampler1D sampler@0x1e745c0)\n" + " (declare (in ) float P@0x1e746d0)\n" + " (declare (in ) float dPdx@0x1e747e0)\n" + " (declare (in ) float dPdy@0x1e748f0)\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" + " (declare (in ) usampler1D sampler@0x1e74ad0)\n" + " (declare (in ) float P@0x1e74be0)\n" + " (declare (in ) float dPdx@0x1e74cf0)\n" + " (declare (in ) float dPdy@0x1e74e00)\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" + " (declare (in ) sampler2D sampler@0x1e74fe0)\n" + " (declare (in ) vec2 P@0x1e750f0)\n" + " (declare (in ) vec2 dPdx@0x1e75200)\n" + " (declare (in ) vec2 dPdy@0x1e75310)\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" + " (declare (in ) isampler2D sampler@0x1e754f0)\n" + " (declare (in ) vec2 P@0x1e75600)\n" + " (declare (in ) vec2 dPdx@0x1e75710)\n" + " (declare (in ) vec2 dPdy@0x1e75820)\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" + " (declare (in ) usampler2D sampler@0x1e75a00)\n" + " (declare (in ) vec2 P@0x1e75b10)\n" + " (declare (in ) vec2 dPdx@0x1e75c20)\n" + " (declare (in ) vec2 dPdy@0x1e75d30)\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" + " (declare (in ) sampler3D sampler@0x1e75f10)\n" + " (declare (in ) vec3 P@0x1e76020)\n" + " (declare (in ) vec3 dPdx@0x1e76130)\n" + " (declare (in ) vec3 dPdy@0x1e76240)\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" + " (declare (in ) isampler3D sampler@0x1e76420)\n" + " (declare (in ) vec3 P@0x1e76530)\n" + " (declare (in ) vec3 dPdx@0x1e76640)\n" + " (declare (in ) vec3 dPdy@0x1e76750)\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" + " (declare (in ) usampler3D sampler@0x1e76930)\n" + " (declare (in ) vec3 P@0x1e76a40)\n" + " (declare (in ) vec3 dPdx@0x1e76b50)\n" + " (declare (in ) vec3 dPdy@0x1e76c60)\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" + " (declare (in ) samplerCube sampler@0x1e76e40)\n" + " (declare (in ) vec3 P@0x1e76f50)\n" + " (declare (in ) vec3 dPdx@0x1e77060)\n" + " (declare (in ) vec3 dPdy@0x1e77170)\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" + " (declare (in ) isamplerCube sampler@0x1e77350)\n" + " (declare (in ) vec3 P@0x1e77460)\n" + " (declare (in ) vec3 dPdx@0x1e77570)\n" + " (declare (in ) vec3 dPdy@0x1e77680)\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" + " (declare (in ) usamplerCube sampler@0x1e77860)\n" + " (declare (in ) vec3 P@0x1e77970)\n" + " (declare (in ) vec3 dPdx@0x1e77a80)\n" + " (declare (in ) vec3 dPdy@0x1e77b90)\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" + " (declare (in ) sampler1DShadow sampler@0x1e77d70)\n" + " (declare (in ) vec3 P@0x1e77e80)\n" + " (declare (in ) float dPdx@0x1e77f90)\n" + " (declare (in ) float dPdy@0x1e780a0)\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" + " (declare (in ) sampler2DShadow sampler@0x1e78280)\n" + " (declare (in ) vec3 P@0x1e78390)\n" + " (declare (in ) vec2 dPdx@0x1e784a0)\n" + " (declare (in ) vec2 dPdy@0x1e785b0)\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" + " (declare (in ) samplerCubeShadow sampler@0x1e78790)\n" + " (declare (in ) vec4 P@0x1e788a0)\n" + " (declare (in ) vec3 dPdx@0x1e789b0)\n" + " (declare (in ) vec3 dPdy@0x1e78ac0)\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" + " (declare (in ) sampler1DArray sampler@0x1e78ca0)\n" + " (declare (in ) vec2 P@0x1e78db0)\n" + " (declare (in ) float dPdx@0x1e78ec0)\n" + " (declare (in ) float dPdy@0x1e78fd0)\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" + " (declare (in ) isampler1DArray sampler@0x1e791b0)\n" + " (declare (in ) vec2 P@0x1e792c0)\n" + " (declare (in ) float dPdx@0x1e793d0)\n" + " (declare (in ) float dPdy@0x1e794e0)\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" + " (declare (in ) usampler1DArray sampler@0x1e796c0)\n" + " (declare (in ) vec2 P@0x1e797d0)\n" + " (declare (in ) float dPdx@0x1e798e0)\n" + " (declare (in ) float dPdy@0x1e799f0)\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" + " (declare (in ) sampler2DArray sampler@0x1e79bd0)\n" + " (declare (in ) vec3 P@0x1e79ce0)\n" + " (declare (in ) vec2 dPdx@0x1e79df0)\n" + " (declare (in ) vec2 dPdy@0x1e79f00)\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" + " (declare (in ) isampler2DArray sampler@0x1e7a0e0)\n" + " (declare (in ) vec3 P@0x1e7a1f0)\n" + " (declare (in ) vec2 dPdx@0x1e7a300)\n" + " (declare (in ) vec2 dPdy@0x1e7a410)\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" + " (declare (in ) usampler2DArray sampler@0x1e7a5f0)\n" + " (declare (in ) vec3 P@0x1e7a700)\n" + " (declare (in ) vec2 dPdx@0x1e7a810)\n" + " (declare (in ) vec2 dPdy@0x1e7a920)\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" + " (declare (in ) sampler1DArrayShadow sampler@0x1e7ab00)\n" + " (declare (in ) vec3 P@0x1e7ac10)\n" + " (declare (in ) float dPdx@0x1e7ad20)\n" + " (declare (in ) float dPdy@0x1e7ae30)\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" + " (declare (in ) sampler2DArrayShadow sampler@0x1e7b010)\n" + " (declare (in ) vec4 P@0x1e7b120)\n" + " (declare (in ) vec2 dPdx@0x1e7b230)\n" + " (declare (in ) vec2 dPdy@0x1e7b340)\n" " )\n" " (\n" " ))\n" @@ -20845,170 +20845,170 @@ static const char *prototypes_for_130_vert = "(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" + " (declare (in ) sampler1D sampler@0x1e7b520)\n" + " (declare (in ) vec2 P@0x1e7b630)\n" + " (declare (in ) float dPdx@0x1e7b740)\n" + " (declare (in ) float dPdy@0x1e7b850)\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" + " (declare (in ) isampler1D sampler@0x1e7bbe0)\n" + " (declare (in ) vec2 P@0x1e7bcf0)\n" + " (declare (in ) float dPdx@0x1e7be00)\n" + " (declare (in ) float dPdy@0x1e7bf10)\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" + " (declare (in ) usampler1D sampler@0x1e7c0f0)\n" + " (declare (in ) vec2 P@0x1e7c200)\n" + " (declare (in ) float dPdx@0x1e7c310)\n" + " (declare (in ) float dPdy@0x1e7c420)\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" + " (declare (in ) sampler1D sampler@0x1e7c600)\n" + " (declare (in ) vec4 P@0x1e7c710)\n" + " (declare (in ) float dPdx@0x1e7c820)\n" + " (declare (in ) float dPdy@0x1e7c930)\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" + " (declare (in ) isampler1D sampler@0x1e7cb10)\n" + " (declare (in ) vec4 P@0x1e7cc20)\n" + " (declare (in ) float dPdx@0x1e7cd30)\n" + " (declare (in ) float dPdy@0x1e7ce40)\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" + " (declare (in ) usampler1D sampler@0x1e7d020)\n" + " (declare (in ) vec4 P@0x1e7d130)\n" + " (declare (in ) float dPdx@0x1e7d240)\n" + " (declare (in ) float dPdy@0x1e7d350)\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" + " (declare (in ) sampler2D sampler@0x1e7d530)\n" + " (declare (in ) vec3 P@0x1e7d640)\n" + " (declare (in ) vec2 dPdx@0x1e7d750)\n" + " (declare (in ) vec2 dPdy@0x1e7d860)\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" + " (declare (in ) isampler2D sampler@0x1e7da40)\n" + " (declare (in ) vec3 P@0x1e7db50)\n" + " (declare (in ) vec2 dPdx@0x1e7dc60)\n" + " (declare (in ) vec2 dPdy@0x1e7dd70)\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" + " (declare (in ) usampler2D sampler@0x1e7df50)\n" + " (declare (in ) vec3 P@0x1e7e060)\n" + " (declare (in ) vec2 dPdx@0x1e7e170)\n" + " (declare (in ) vec2 dPdy@0x1e7e280)\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" + " (declare (in ) sampler2D sampler@0x1e7e460)\n" + " (declare (in ) vec4 P@0x1e7e570)\n" + " (declare (in ) vec2 dPdx@0x1e7e680)\n" + " (declare (in ) vec2 dPdy@0x1e7e790)\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" + " (declare (in ) isampler2D sampler@0x1e7e970)\n" + " (declare (in ) vec4 P@0x1e7ea80)\n" + " (declare (in ) vec2 dPdx@0x1e7eb90)\n" + " (declare (in ) vec2 dPdy@0x1e7eca0)\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" + " (declare (in ) usampler2D sampler@0x1e7ee80)\n" + " (declare (in ) vec4 P@0x1e7ef90)\n" + " (declare (in ) vec2 dPdx@0x1e7f0a0)\n" + " (declare (in ) vec2 dPdy@0x1e7f1b0)\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" + " (declare (in ) sampler3D sampler@0x1e7f390)\n" + " (declare (in ) vec4 P@0x1e7f4a0)\n" + " (declare (in ) vec3 dPdx@0x1e7f5b0)\n" + " (declare (in ) vec3 dPdy@0x1e7f6c0)\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" + " (declare (in ) isampler3D sampler@0x1e7f8a0)\n" + " (declare (in ) vec4 P@0x1e7f9b0)\n" + " (declare (in ) vec3 dPdx@0x1e7fac0)\n" + " (declare (in ) vec3 dPdy@0x1e7fbd0)\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" + " (declare (in ) usampler3D sampler@0x1e7fdb0)\n" + " (declare (in ) vec4 P@0x1e7fec0)\n" + " (declare (in ) vec3 dPdx@0x1e7ffd0)\n" + " (declare (in ) vec3 dPdy@0x1e800e0)\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" + " (declare (in ) sampler1DShadow sampler@0x1e802c0)\n" + " (declare (in ) vec4 P@0x1e803d0)\n" + " (declare (in ) float dPdx@0x1e804e0)\n" + " (declare (in ) float dPdy@0x1e805f0)\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" + " (declare (in ) sampler2DShadow sampler@0x1e807d0)\n" + " (declare (in ) vec4 P@0x1e808e0)\n" + " (declare (in ) vec2 dPdx@0x1e809f0)\n" + " (declare (in ) vec2 dPdy@0x1e80b00)\n" " )\n" " (\n" " ))\n" @@ -21018,17 +21018,17 @@ static const char *prototypes_for_130_vert = "(function texture1D\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1D sampler@0x1706ce0)\n" - " (declare (in ) float coord@0x1706df0)\n" + " (declare (in ) sampler1D sampler@0x1e80ce0)\n" + " (declare (in ) float coord@0x1e80df0)\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" + " (declare (in ) sampler1D sampler@0x1e81910)\n" + " (declare (in ) float coord@0x1e81a20)\n" + " (declare (in ) float bias@0x1e81b30)\n" " )\n" " (\n" " ))\n" @@ -21038,34 +21038,34 @@ static const char *prototypes_for_130_vert = "(function texture1DProj\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1D sampler@0x1707180)\n" - " (declare (in ) vec2 coord@0x1707290)\n" + " (declare (in ) sampler1D sampler@0x1e81180)\n" + " (declare (in ) vec2 coord@0x1e81290)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1D sampler@0x1707620)\n" - " (declare (in ) vec4 coord@0x1707730)\n" + " (declare (in ) sampler1D sampler@0x1e81620)\n" + " (declare (in ) vec4 coord@0x1e81730)\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" + " (declare (in ) sampler1D sampler@0x1e81d10)\n" + " (declare (in ) vec2 coord@0x1e81e20)\n" + " (declare (in ) float bias@0x1e81f30)\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" + " (declare (in ) sampler1D sampler@0x1e82110)\n" + " (declare (in ) vec4 coord@0x1e82220)\n" + " (declare (in ) float bias@0x1e82330)\n" " )\n" " (\n" " ))\n" @@ -21075,9 +21075,9 @@ static const char *prototypes_for_130_vert = "(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" + " (declare (in ) sampler1D sampler@0x1e82510)\n" + " (declare (in ) float coord@0x1e82620)\n" + " (declare (in ) float lod@0x1e82730)\n" " )\n" " (\n" " ))\n" @@ -21087,18 +21087,18 @@ static const char *prototypes_for_130_vert = "(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" + " (declare (in ) sampler1D sampler@0x1e82ac0)\n" + " (declare (in ) vec2 coord@0x1e82bd0)\n" + " (declare (in ) float lod@0x1e82ce0)\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" + " (declare (in ) sampler1D sampler@0x1e83070)\n" + " (declare (in ) vec4 coord@0x1e83180)\n" + " (declare (in ) float lod@0x1e83290)\n" " )\n" " (\n" " ))\n" @@ -21108,17 +21108,17 @@ static const char *prototypes_for_130_vert = "(function texture2D\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2D sampler@0x1709470)\n" - " (declare (in ) vec2 coord@0x1709580)\n" + " (declare (in ) sampler2D sampler@0x1e83470)\n" + " (declare (in ) vec2 coord@0x1e83580)\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" + " (declare (in ) sampler2D sampler@0x1e840a0)\n" + " (declare (in ) vec2 coord@0x1e841b0)\n" + " (declare (in ) float bias@0x1e842c0)\n" " )\n" " (\n" " ))\n" @@ -21128,34 +21128,34 @@ static const char *prototypes_for_130_vert = "(function texture2DProj\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2D sampler@0x1709910)\n" - " (declare (in ) vec3 coord@0x1709a20)\n" + " (declare (in ) sampler2D sampler@0x1e83910)\n" + " (declare (in ) vec3 coord@0x1e83a20)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2D sampler@0x1709db0)\n" - " (declare (in ) vec4 coord@0x1709ec0)\n" + " (declare (in ) sampler2D sampler@0x1e83db0)\n" + " (declare (in ) vec4 coord@0x1e83ec0)\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" + " (declare (in ) sampler2D sampler@0x1e844a0)\n" + " (declare (in ) vec3 coord@0x1e845b0)\n" + " (declare (in ) float bias@0x1e846c0)\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" + " (declare (in ) sampler2D sampler@0x1e848a0)\n" + " (declare (in ) vec4 coord@0x1e849b0)\n" + " (declare (in ) float bias@0x1e84ac0)\n" " )\n" " (\n" " ))\n" @@ -21165,9 +21165,9 @@ static const char *prototypes_for_130_vert = "(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" + " (declare (in ) sampler2D sampler@0x1e84ca0)\n" + " (declare (in ) vec2 coord@0x1e84db0)\n" + " (declare (in ) float lod@0x1e84ec0)\n" " )\n" " (\n" " ))\n" @@ -21177,18 +21177,18 @@ static const char *prototypes_for_130_vert = "(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" + " (declare (in ) sampler2D sampler@0x1e85250)\n" + " (declare (in ) vec3 coord@0x1e85360)\n" + " (declare (in ) float lod@0x1e85470)\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" + " (declare (in ) sampler2D sampler@0x1e85800)\n" + " (declare (in ) vec4 coord@0x1e85910)\n" + " (declare (in ) float lod@0x1e85a20)\n" " )\n" " (\n" " ))\n" @@ -21198,17 +21198,17 @@ static const char *prototypes_for_130_vert = "(function texture3D\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler3D sampler@0x170bc00)\n" - " (declare (in ) vec3 coord@0x170bd10)\n" + " (declare (in ) sampler3D sampler@0x1e85c00)\n" + " (declare (in ) vec3 coord@0x1e85d10)\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" + " (declare (in ) sampler3D sampler@0x1e86540)\n" + " (declare (in ) vec3 coord@0x1e86650)\n" + " (declare (in ) float bias@0x1e86760)\n" " )\n" " (\n" " ))\n" @@ -21218,17 +21218,17 @@ static const char *prototypes_for_130_vert = "(function texture3DProj\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler3D sampler@0x170c0a0)\n" - " (declare (in ) vec4 coord@0x170c1b0)\n" + " (declare (in ) sampler3D sampler@0x1e860a0)\n" + " (declare (in ) vec4 coord@0x1e861b0)\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" + " (declare (in ) sampler3D sampler@0x1e86940)\n" + " (declare (in ) vec4 coord@0x1e86a50)\n" + " (declare (in ) float bias@0x1e86b60)\n" " )\n" " (\n" " ))\n" @@ -21238,9 +21238,9 @@ static const char *prototypes_for_130_vert = "(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" + " (declare (in ) sampler3D sampler@0x1e86d40)\n" + " (declare (in ) vec3 coord@0x1e86e50)\n" + " (declare (in ) float lod@0x1e86f60)\n" " )\n" " (\n" " ))\n" @@ -21250,9 +21250,9 @@ static const char *prototypes_for_130_vert = "(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" + " (declare (in ) sampler3D sampler@0x1e872f0)\n" + " (declare (in ) vec4 coord@0x1e87400)\n" + " (declare (in ) float lod@0x1e87510)\n" " )\n" " (\n" " ))\n" @@ -21262,17 +21262,17 @@ static const char *prototypes_for_130_vert = "(function textureCube\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) samplerCube sampler@0x170d8a0)\n" - " (declare (in ) vec3 coord@0x170d9b0)\n" + " (declare (in ) samplerCube sampler@0x1e878a0)\n" + " (declare (in ) vec3 coord@0x1e879b0)\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" + " (declare (in ) samplerCube sampler@0x1e87d40)\n" + " (declare (in ) vec3 coord@0x1e87e50)\n" + " (declare (in ) float bias@0x1e87f60)\n" " )\n" " (\n" " ))\n" @@ -21282,9 +21282,9 @@ static const char *prototypes_for_130_vert = "(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" + " (declare (in ) samplerCube sampler@0x1e88140)\n" + " (declare (in ) vec3 coord@0x1e88250)\n" + " (declare (in ) float lod@0x1e88360)\n" " )\n" " (\n" " ))\n" @@ -21294,17 +21294,17 @@ static const char *prototypes_for_130_vert = "(function shadow1D\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1DShadow sampler@0x170e6f0)\n" - " (declare (in ) vec3 coord@0x170e800)\n" + " (declare (in ) sampler1DShadow sampler@0x1e886f0)\n" + " (declare (in ) vec3 coord@0x1e88800)\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" + " (declare (in ) sampler1DShadow sampler@0x1e89970)\n" + " (declare (in ) vec3 coord@0x1e89a80)\n" + " (declare (in ) float bias@0x1e89b90)\n" " )\n" " (\n" " ))\n" @@ -21314,17 +21314,17 @@ static const char *prototypes_for_130_vert = "(function shadow2D\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2DShadow sampler@0x170eb90)\n" - " (declare (in ) vec3 coord@0x170eca0)\n" + " (declare (in ) sampler2DShadow sampler@0x1e88b90)\n" + " (declare (in ) vec3 coord@0x1e88ca0)\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" + " (declare (in ) sampler2DShadow sampler@0x1e89d70)\n" + " (declare (in ) vec3 coord@0x1e89e80)\n" + " (declare (in ) float bias@0x1e89f90)\n" " )\n" " (\n" " ))\n" @@ -21334,17 +21334,17 @@ static const char *prototypes_for_130_vert = "(function shadow1DProj\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1DShadow sampler@0x170f030)\n" - " (declare (in ) vec4 coord@0x170f140)\n" + " (declare (in ) sampler1DShadow sampler@0x1e89030)\n" + " (declare (in ) vec4 coord@0x1e89140)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1DShadow sampler@0x1710170)\n" - " (declare (in ) vec4 coord@0x1710280)\n" - " (declare (in ) float bias@0x1710390)\n" + " (declare (in ) sampler1DShadow sampler@0x1e8a170)\n" + " (declare (in ) vec4 coord@0x1e8a280)\n" + " (declare (in ) float bias@0x1e8a390)\n" " )\n" " (\n" " ))\n" @@ -21354,17 +21354,17 @@ static const char *prototypes_for_130_vert = "(function shadow2DProj\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2DShadow sampler@0x170f4d0)\n" - " (declare (in ) vec4 coord@0x170f5e0)\n" + " (declare (in ) sampler2DShadow sampler@0x1e894d0)\n" + " (declare (in ) vec4 coord@0x1e895e0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2DShadow sampler@0x1710570)\n" - " (declare (in ) vec4 coord@0x1710680)\n" - " (declare (in ) float bias@0x1710790)\n" + " (declare (in ) sampler2DShadow sampler@0x1e8a570)\n" + " (declare (in ) vec4 coord@0x1e8a680)\n" + " (declare (in ) float bias@0x1e8a790)\n" " )\n" " (\n" " ))\n" @@ -21374,9 +21374,9 @@ static const char *prototypes_for_130_vert = "(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" + " (declare (in ) sampler1DShadow sampler@0x1e8a970)\n" + " (declare (in ) vec3 coord@0x1e8aa80)\n" + " (declare (in ) float lod@0x1e8ab90)\n" " )\n" " (\n" " ))\n" @@ -21386,9 +21386,9 @@ static const char *prototypes_for_130_vert = "(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" + " (declare (in ) sampler2DShadow sampler@0x1e8af20)\n" + " (declare (in ) vec3 coord@0x1e8b030)\n" + " (declare (in ) float lod@0x1e8b140)\n" " )\n" " (\n" " ))\n" @@ -21398,9 +21398,9 @@ static const char *prototypes_for_130_vert = "(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" + " (declare (in ) sampler1DShadow sampler@0x1e8b4d0)\n" + " (declare (in ) vec4 coord@0x1e8b5e0)\n" + " (declare (in ) float lod@0x1e8b6f0)\n" " )\n" " (\n" " ))\n" @@ -21410,9 +21410,9 @@ static const char *prototypes_for_130_vert = "(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" + " (declare (in ) sampler2DShadow sampler@0x1e8ba80)\n" + " (declare (in ) vec4 coord@0x1e8bb90)\n" + " (declare (in ) float lod@0x1e8bca0)\n" " )\n" " (\n" " ))\n" @@ -21422,28 +21422,28 @@ static const char *prototypes_for_130_vert = "(function noise1\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x1712030)\n" + " (declare (in ) float x@0x1e8c030)\n" " )\n" " (\n" " ))\n" "\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec2 x@0x17123b0)\n" + " (declare (in ) vec2 x@0x1e8c3b0)\n" " )\n" " (\n" " ))\n" "\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec3 x@0x1712590)\n" + " (declare (in ) vec3 x@0x1e8c590)\n" " )\n" " (\n" " ))\n" "\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec4 x@0x1712770)\n" + " (declare (in ) vec4 x@0x1e8c770)\n" " )\n" " (\n" " ))\n" @@ -21453,28 +21453,28 @@ static const char *prototypes_for_130_vert = "(function noise2\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) float x@0x1712950)\n" + " (declare (in ) float x@0x1e8c950)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x1712cd0)\n" + " (declare (in ) vec2 x@0x1e8ccd0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec3 x@0x1712eb0)\n" + " (declare (in ) vec3 x@0x1e8ceb0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec4 x@0x1713090)\n" + " (declare (in ) vec4 x@0x1e8d090)\n" " )\n" " (\n" " ))\n" @@ -21484,28 +21484,28 @@ static const char *prototypes_for_130_vert = "(function noise3\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) float x@0x1713270)\n" + " (declare (in ) float x@0x1e8d270)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec2 x@0x17135f0)\n" + " (declare (in ) vec2 x@0x1e8d5f0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x17137d0)\n" + " (declare (in ) vec3 x@0x1e8d7d0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec4 x@0x17139b0)\n" + " (declare (in ) vec4 x@0x1e8d9b0)\n" " )\n" " (\n" " ))\n" @@ -21515,28 +21515,28 @@ static const char *prototypes_for_130_vert = "(function noise4\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) float x@0x1713b90)\n" + " (declare (in ) float x@0x1e8db90)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec2 x@0x1713f10)\n" + " (declare (in ) vec2 x@0x1e8df10)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec3 x@0x17140f0)\n" + " (declare (in ) vec3 x@0x1e8e0f0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x17142d0)\n" + " (declare (in ) vec4 x@0x1e8e2d0)\n" " )\n" " (\n" " ))\n" @@ -21634,8 +21634,8 @@ static const char *prototypes_for_ARB_texture_rectangle_frag = "(function texture2DRect\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2DRect sampler@0x225e0f0)\n" - " (declare (in ) vec2 coord@0x225e200)\n" + " (declare (in ) sampler2DRect sampler@0xd610f0)\n" + " (declare (in ) vec2 coord@0xd61200)\n" " )\n" " (\n" " ))\n" @@ -21645,16 +21645,16 @@ static const char *prototypes_for_ARB_texture_rectangle_frag = "(function texture2DRectProj\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2DRect sampler@0x225e590)\n" - " (declare (in ) vec3 coord@0x225e6a0)\n" + " (declare (in ) sampler2DRect sampler@0xd61590)\n" + " (declare (in ) vec3 coord@0xd616a0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2DRect sampler@0x225ea30)\n" - " (declare (in ) vec4 coord@0x225eb40)\n" + " (declare (in ) sampler2DRect sampler@0xd61a30)\n" + " (declare (in ) vec4 coord@0xd61b40)\n" " )\n" " (\n" " ))\n" @@ -21664,8 +21664,8 @@ static const char *prototypes_for_ARB_texture_rectangle_frag = "(function shadow2DRect\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2DRectShadow sampler@0x225ed20)\n" - " (declare (in ) vec3 coord@0x225ee30)\n" + " (declare (in ) sampler2DRectShadow sampler@0xd61d20)\n" + " (declare (in ) vec3 coord@0xd61e30)\n" " )\n" " (\n" " ))\n" @@ -21675,8 +21675,8 @@ static const char *prototypes_for_ARB_texture_rectangle_frag = "(function shadow2DRectProj\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2DRectShadow sampler@0x225f1c0)\n" - " (declare (in ) vec4 coord@0x225f2d0)\n" + " (declare (in ) sampler2DRectShadow sampler@0xd621c0)\n" + " (declare (in ) vec4 coord@0xd622d0)\n" " )\n" " (\n" " ))\n" @@ -21697,28 +21697,28 @@ static const char *prototypes_for_120_frag = "(function radians\n" " (signature float\n" " (parameters\n" - " (declare (in ) float degrees@0xaf8340)\n" + " (declare (in ) float degrees@0x20d2340)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 degrees@0xaf86c0)\n" + " (declare (in ) vec2 degrees@0x20d26c0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 degrees@0xaf88a0)\n" + " (declare (in ) vec3 degrees@0x20d28a0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 degrees@0xaf8a80)\n" + " (declare (in ) vec4 degrees@0x20d2a80)\n" " )\n" " (\n" " ))\n" @@ -21728,28 +21728,28 @@ static const char *prototypes_for_120_frag = "(function degrees\n" " (signature float\n" " (parameters\n" - " (declare (in ) float radians@0xaf8c60)\n" + " (declare (in ) float radians@0x20d2c60)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 radians@0xaf8fe0)\n" + " (declare (in ) vec2 radians@0x20d2fe0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 radians@0xaf91c0)\n" + " (declare (in ) vec3 radians@0x20d31c0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 radians@0xaf93a0)\n" + " (declare (in ) vec4 radians@0x20d33a0)\n" " )\n" " (\n" " ))\n" @@ -21759,28 +21759,28 @@ static const char *prototypes_for_120_frag = "(function sin\n" " (signature float\n" " (parameters\n" - " (declare (in ) float angle@0xaf9580)\n" + " (declare (in ) float angle@0x20d3580)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 angle@0xaf9900)\n" + " (declare (in ) vec2 angle@0x20d3900)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 angle@0xaf9ae0)\n" + " (declare (in ) vec3 angle@0x20d3ae0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 angle@0xaf9cc0)\n" + " (declare (in ) vec4 angle@0x20d3cc0)\n" " )\n" " (\n" " ))\n" @@ -21790,28 +21790,28 @@ static const char *prototypes_for_120_frag = "(function cos\n" " (signature float\n" " (parameters\n" - " (declare (in ) float angle@0xaf9ea0)\n" + " (declare (in ) float angle@0x20d3ea0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 angle@0xafa220)\n" + " (declare (in ) vec2 angle@0x20d4220)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 angle@0xafa400)\n" + " (declare (in ) vec3 angle@0x20d4400)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 angle@0xafa5e0)\n" + " (declare (in ) vec4 angle@0x20d45e0)\n" " )\n" " (\n" " ))\n" @@ -21821,28 +21821,28 @@ static const char *prototypes_for_120_frag = "(function tan\n" " (signature float\n" " (parameters\n" - " (declare (in ) float angle@0xafa7c0)\n" + " (declare (in ) float angle@0x20d47c0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 angle@0xafab40)\n" + " (declare (in ) vec2 angle@0x20d4b40)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 angle@0xafad20)\n" + " (declare (in ) vec3 angle@0x20d4d20)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 angle@0xafaf00)\n" + " (declare (in ) vec4 angle@0x20d4f00)\n" " )\n" " (\n" " ))\n" @@ -21852,28 +21852,28 @@ static const char *prototypes_for_120_frag = "(function asin\n" " (signature float\n" " (parameters\n" - " (declare (in ) float angle@0xafb0e0)\n" + " (declare (in ) float angle@0x20d50e0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 angle@0xafb460)\n" + " (declare (in ) vec2 angle@0x20d5460)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 angle@0xafb640)\n" + " (declare (in ) vec3 angle@0x20d5640)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 angle@0xafb820)\n" + " (declare (in ) vec4 angle@0x20d5820)\n" " )\n" " (\n" " ))\n" @@ -21883,28 +21883,28 @@ static const char *prototypes_for_120_frag = "(function acos\n" " (signature float\n" " (parameters\n" - " (declare (in ) float angle@0xafba00)\n" + " (declare (in ) float angle@0x20d5a00)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 angle@0xafbd80)\n" + " (declare (in ) vec2 angle@0x20d5d80)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 angle@0xafbf60)\n" + " (declare (in ) vec3 angle@0x20d5f60)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 angle@0xafc140)\n" + " (declare (in ) vec4 angle@0x20d6140)\n" " )\n" " (\n" " ))\n" @@ -21914,60 +21914,60 @@ static const char *prototypes_for_120_frag = "(function atan\n" " (signature float\n" " (parameters\n" - " (declare (in ) float y@0xafc320)\n" - " (declare (in ) float x@0xafc430)\n" + " (declare (in ) float y@0x20d6320)\n" + " (declare (in ) float x@0x20d6430)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 y@0xafc7b0)\n" - " (declare (in ) vec2 x@0xafc8c0)\n" + " (declare (in ) vec2 y@0x20d67b0)\n" + " (declare (in ) vec2 x@0x20d68c0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 y@0xafcaa0)\n" - " (declare (in ) vec3 x@0xafcbb0)\n" + " (declare (in ) vec3 y@0x20d6aa0)\n" + " (declare (in ) vec3 x@0x20d6bb0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 y@0xafcd90)\n" - " (declare (in ) vec4 x@0xafcea0)\n" + " (declare (in ) vec4 y@0x20d6d90)\n" + " (declare (in ) vec4 x@0x20d6ea0)\n" " )\n" " (\n" " ))\n" "\n" " (signature float\n" " (parameters\n" - " (declare (in ) float y_over_x@0xafd080)\n" + " (declare (in ) float y_over_x@0x20d7080)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 y_over_x@0xafd270)\n" + " (declare (in ) vec2 y_over_x@0x20d7270)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 y_over_x@0xafd460)\n" + " (declare (in ) vec3 y_over_x@0x20d7460)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 y_over_x@0xafd650)\n" + " (declare (in ) vec4 y_over_x@0x20d7650)\n" " )\n" " (\n" " ))\n" @@ -21977,32 +21977,32 @@ static const char *prototypes_for_120_frag = "(function pow\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0xafd840)\n" - " (declare (in ) float y@0xafd950)\n" + " (declare (in ) float x@0x20d7840)\n" + " (declare (in ) float y@0x20d7950)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0xafdcd0)\n" - " (declare (in ) vec2 y@0xafdde0)\n" + " (declare (in ) vec2 x@0x20d7cd0)\n" + " (declare (in ) vec2 y@0x20d7de0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0xafdfc0)\n" - " (declare (in ) vec3 y@0xafe0d0)\n" + " (declare (in ) vec3 x@0x20d7fc0)\n" + " (declare (in ) vec3 y@0x20d80d0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0xafe2b0)\n" - " (declare (in ) vec4 y@0xafe3c0)\n" + " (declare (in ) vec4 x@0x20d82b0)\n" + " (declare (in ) vec4 y@0x20d83c0)\n" " )\n" " (\n" " ))\n" @@ -22012,28 +22012,28 @@ static const char *prototypes_for_120_frag = "(function exp\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0xafe5a0)\n" + " (declare (in ) float x@0x20d85a0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0xafe920)\n" + " (declare (in ) vec2 x@0x20d8920)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0xafeb00)\n" + " (declare (in ) vec3 x@0x20d8b00)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0xafece0)\n" + " (declare (in ) vec4 x@0x20d8ce0)\n" " )\n" " (\n" " ))\n" @@ -22043,28 +22043,28 @@ static const char *prototypes_for_120_frag = "(function log\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0xafeec0)\n" + " (declare (in ) float x@0x20d8ec0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0xaff240)\n" + " (declare (in ) vec2 x@0x20d9240)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0xaff420)\n" + " (declare (in ) vec3 x@0x20d9420)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0xaff600)\n" + " (declare (in ) vec4 x@0x20d9600)\n" " )\n" " (\n" " ))\n" @@ -22074,28 +22074,28 @@ static const char *prototypes_for_120_frag = "(function exp2\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0xaff7e0)\n" + " (declare (in ) float x@0x20d97e0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0xaffb60)\n" + " (declare (in ) vec2 x@0x20d9b60)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0xaffd40)\n" + " (declare (in ) vec3 x@0x20d9d40)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0xafff20)\n" + " (declare (in ) vec4 x@0x20d9f20)\n" " )\n" " (\n" " ))\n" @@ -22105,28 +22105,28 @@ static const char *prototypes_for_120_frag = "(function log2\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0xb00100)\n" + " (declare (in ) float x@0x20da100)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0xb00480)\n" + " (declare (in ) vec2 x@0x20da480)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0xb00660)\n" + " (declare (in ) vec3 x@0x20da660)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0xb00840)\n" + " (declare (in ) vec4 x@0x20da840)\n" " )\n" " (\n" " ))\n" @@ -22136,28 +22136,28 @@ static const char *prototypes_for_120_frag = "(function sqrt\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0xb00a20)\n" + " (declare (in ) float x@0x20daa20)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0xb00da0)\n" + " (declare (in ) vec2 x@0x20dada0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0xb00f80)\n" + " (declare (in ) vec3 x@0x20daf80)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0xb01160)\n" + " (declare (in ) vec4 x@0x20db160)\n" " )\n" " (\n" " ))\n" @@ -22167,28 +22167,28 @@ static const char *prototypes_for_120_frag = "(function inversesqrt\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0xb01340)\n" + " (declare (in ) float x@0x20db340)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0xb016d0)\n" + " (declare (in ) vec2 x@0x20db6d0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0xb018b0)\n" + " (declare (in ) vec3 x@0x20db8b0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0xb01a90)\n" + " (declare (in ) vec4 x@0x20dba90)\n" " )\n" " (\n" " ))\n" @@ -22198,28 +22198,28 @@ static const char *prototypes_for_120_frag = "(function abs\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0xb01c70)\n" + " (declare (in ) float x@0x20dbc70)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0xb01ff0)\n" + " (declare (in ) vec2 x@0x20dbff0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0xb021d0)\n" + " (declare (in ) vec3 x@0x20dc1d0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0xb023b0)\n" + " (declare (in ) vec4 x@0x20dc3b0)\n" " )\n" " (\n" " ))\n" @@ -22229,28 +22229,28 @@ static const char *prototypes_for_120_frag = "(function sign\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0xb02590)\n" + " (declare (in ) float x@0x20dc590)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0xb02910)\n" + " (declare (in ) vec2 x@0x20dc910)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0xb02af0)\n" + " (declare (in ) vec3 x@0x20dcaf0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0xb02cd0)\n" + " (declare (in ) vec4 x@0x20dccd0)\n" " )\n" " (\n" " ))\n" @@ -22260,28 +22260,28 @@ static const char *prototypes_for_120_frag = "(function floor\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0xb02eb0)\n" + " (declare (in ) float x@0x20dceb0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0xb03230)\n" + " (declare (in ) vec2 x@0x20dd230)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0xb03410)\n" + " (declare (in ) vec3 x@0x20dd410)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0xb035f0)\n" + " (declare (in ) vec4 x@0x20dd5f0)\n" " )\n" " (\n" " ))\n" @@ -22291,28 +22291,28 @@ static const char *prototypes_for_120_frag = "(function ceil\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0xb037d0)\n" + " (declare (in ) float x@0x20dd7d0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0xb03b50)\n" + " (declare (in ) vec2 x@0x20ddb50)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0xb03d30)\n" + " (declare (in ) vec3 x@0x20ddd30)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0xb03f10)\n" + " (declare (in ) vec4 x@0x20ddf10)\n" " )\n" " (\n" " ))\n" @@ -22322,28 +22322,28 @@ static const char *prototypes_for_120_frag = "(function fract\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0xb040f0)\n" + " (declare (in ) float x@0x20de0f0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0xb04470)\n" + " (declare (in ) vec2 x@0x20de470)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0xb04650)\n" + " (declare (in ) vec3 x@0x20de650)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0xb04830)\n" + " (declare (in ) vec4 x@0x20de830)\n" " )\n" " (\n" " ))\n" @@ -22353,56 +22353,56 @@ static const char *prototypes_for_120_frag = "(function mod\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0xb04a10)\n" - " (declare (in ) float y@0xb04b20)\n" + " (declare (in ) float x@0x20dea10)\n" + " (declare (in ) float y@0x20deb20)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0xb04ea0)\n" - " (declare (in ) float y@0xb04fb0)\n" + " (declare (in ) vec2 x@0x20deea0)\n" + " (declare (in ) float y@0x20defb0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0xb05190)\n" - " (declare (in ) float y@0xb052a0)\n" + " (declare (in ) vec3 x@0x20df190)\n" + " (declare (in ) float y@0x20df2a0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0xb05480)\n" - " (declare (in ) float y@0xb05590)\n" + " (declare (in ) vec4 x@0x20df480)\n" + " (declare (in ) float y@0x20df590)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0xb05770)\n" - " (declare (in ) vec2 y@0xb05880)\n" + " (declare (in ) vec2 x@0x20df770)\n" + " (declare (in ) vec2 y@0x20df880)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0xb05a60)\n" - " (declare (in ) vec3 y@0xb05b70)\n" + " (declare (in ) vec3 x@0x20dfa60)\n" + " (declare (in ) vec3 y@0x20dfb70)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0xb05d50)\n" - " (declare (in ) vec4 y@0xb05e60)\n" + " (declare (in ) vec4 x@0x20dfd50)\n" + " (declare (in ) vec4 y@0x20dfe60)\n" " )\n" " (\n" " ))\n" @@ -22412,56 +22412,56 @@ static const char *prototypes_for_120_frag = "(function min\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0xb06040)\n" - " (declare (in ) float y@0xb06150)\n" + " (declare (in ) float x@0x20e0040)\n" + " (declare (in ) float y@0x20e0150)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0xb064d0)\n" - " (declare (in ) vec2 y@0xb065e0)\n" + " (declare (in ) vec2 x@0x20e04d0)\n" + " (declare (in ) vec2 y@0x20e05e0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0xb067c0)\n" - " (declare (in ) vec3 y@0xb068d0)\n" + " (declare (in ) vec3 x@0x20e07c0)\n" + " (declare (in ) vec3 y@0x20e08d0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0xb06ab0)\n" - " (declare (in ) vec4 y@0xb06bc0)\n" + " (declare (in ) vec4 x@0x20e0ab0)\n" + " (declare (in ) vec4 y@0x20e0bc0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0xb06da0)\n" - " (declare (in ) float y@0xb06eb0)\n" + " (declare (in ) vec2 x@0x20e0da0)\n" + " (declare (in ) float y@0x20e0eb0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0xb07090)\n" - " (declare (in ) float y@0xb071a0)\n" + " (declare (in ) vec3 x@0x20e1090)\n" + " (declare (in ) float y@0x20e11a0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0xb07380)\n" - " (declare (in ) float y@0xb07490)\n" + " (declare (in ) vec4 x@0x20e1380)\n" + " (declare (in ) float y@0x20e1490)\n" " )\n" " (\n" " ))\n" @@ -22471,56 +22471,56 @@ static const char *prototypes_for_120_frag = "(function max\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0xb07670)\n" - " (declare (in ) float y@0xb07780)\n" + " (declare (in ) float x@0x20e1670)\n" + " (declare (in ) float y@0x20e1780)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0xb07b00)\n" - " (declare (in ) vec2 y@0xb07c10)\n" + " (declare (in ) vec2 x@0x20e1b00)\n" + " (declare (in ) vec2 y@0x20e1c10)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0xb07df0)\n" - " (declare (in ) vec3 y@0xb07f00)\n" + " (declare (in ) vec3 x@0x20e1df0)\n" + " (declare (in ) vec3 y@0x20e1f00)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0xb080e0)\n" - " (declare (in ) vec4 y@0xb081f0)\n" + " (declare (in ) vec4 x@0x20e20e0)\n" + " (declare (in ) vec4 y@0x20e21f0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0xb083d0)\n" - " (declare (in ) float y@0xb084e0)\n" + " (declare (in ) vec2 x@0x20e23d0)\n" + " (declare (in ) float y@0x20e24e0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0xb086c0)\n" - " (declare (in ) float y@0xb087d0)\n" + " (declare (in ) vec3 x@0x20e26c0)\n" + " (declare (in ) float y@0x20e27d0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0xb089b0)\n" - " (declare (in ) float y@0xb08ac0)\n" + " (declare (in ) vec4 x@0x20e29b0)\n" + " (declare (in ) float y@0x20e2ac0)\n" " )\n" " (\n" " ))\n" @@ -22530,63 +22530,63 @@ static const char *prototypes_for_120_frag = "(function clamp\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0xb08ca0)\n" - " (declare (in ) float minVal@0xb08db0)\n" - " (declare (in ) float maxVal@0xb08ec0)\n" + " (declare (in ) float x@0x20e2ca0)\n" + " (declare (in ) float minVal@0x20e2db0)\n" + " (declare (in ) float maxVal@0x20e2ec0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0xb09240)\n" - " (declare (in ) vec2 minVal@0xb09350)\n" - " (declare (in ) vec2 maxVal@0xb09460)\n" + " (declare (in ) vec2 x@0x20e3240)\n" + " (declare (in ) vec2 minVal@0x20e3350)\n" + " (declare (in ) vec2 maxVal@0x20e3460)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0xb09640)\n" - " (declare (in ) vec3 minVal@0xb09750)\n" - " (declare (in ) vec3 maxVal@0xb09860)\n" + " (declare (in ) vec3 x@0x20e3640)\n" + " (declare (in ) vec3 minVal@0x20e3750)\n" + " (declare (in ) vec3 maxVal@0x20e3860)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0xb09a40)\n" - " (declare (in ) vec4 minVal@0xb09b50)\n" - " (declare (in ) vec4 maxVal@0xb09c60)\n" + " (declare (in ) vec4 x@0x20e3a40)\n" + " (declare (in ) vec4 minVal@0x20e3b50)\n" + " (declare (in ) vec4 maxVal@0x20e3c60)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0xb09e40)\n" - " (declare (in ) float minVal@0xb09f50)\n" - " (declare (in ) float maxVal@0xb0a060)\n" + " (declare (in ) vec2 x@0x20e3e40)\n" + " (declare (in ) float minVal@0x20e3f50)\n" + " (declare (in ) float maxVal@0x20e4060)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0xb0a240)\n" - " (declare (in ) float minVal@0xb0a350)\n" - " (declare (in ) float maxVal@0xb0a460)\n" + " (declare (in ) vec3 x@0x20e4240)\n" + " (declare (in ) float minVal@0x20e4350)\n" + " (declare (in ) float maxVal@0x20e4460)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0xb0a640)\n" - " (declare (in ) float minVal@0xb0a750)\n" - " (declare (in ) float maxVal@0xb0a860)\n" + " (declare (in ) vec4 x@0x20e4640)\n" + " (declare (in ) float minVal@0x20e4750)\n" + " (declare (in ) float maxVal@0x20e4860)\n" " )\n" " (\n" " ))\n" @@ -22596,63 +22596,63 @@ static const char *prototypes_for_120_frag = "(function mix\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0xb0aa40)\n" - " (declare (in ) float y@0xb0ab50)\n" - " (declare (in ) float a@0xb0ac60)\n" + " (declare (in ) float x@0x20e4a40)\n" + " (declare (in ) float y@0x20e4b50)\n" + " (declare (in ) float a@0x20e4c60)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0xb0afe0)\n" - " (declare (in ) vec2 y@0xb0b0f0)\n" - " (declare (in ) vec2 a@0xb0b200)\n" + " (declare (in ) vec2 x@0x20e4fe0)\n" + " (declare (in ) vec2 y@0x20e50f0)\n" + " (declare (in ) vec2 a@0x20e5200)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0xb0b3e0)\n" - " (declare (in ) vec3 y@0xb0b4f0)\n" - " (declare (in ) vec3 a@0xb0b600)\n" + " (declare (in ) vec3 x@0x20e53e0)\n" + " (declare (in ) vec3 y@0x20e54f0)\n" + " (declare (in ) vec3 a@0x20e5600)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0xb0b7e0)\n" - " (declare (in ) vec4 y@0xb0b8f0)\n" - " (declare (in ) vec4 a@0xb0ba00)\n" + " (declare (in ) vec4 x@0x20e57e0)\n" + " (declare (in ) vec4 y@0x20e58f0)\n" + " (declare (in ) vec4 a@0x20e5a00)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0xb0bbe0)\n" - " (declare (in ) vec2 y@0xb0bcf0)\n" - " (declare (in ) float a@0xb0be00)\n" + " (declare (in ) vec2 x@0x20e5be0)\n" + " (declare (in ) vec2 y@0x20e5cf0)\n" + " (declare (in ) float a@0x20e5e00)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0xb0bfe0)\n" - " (declare (in ) vec3 y@0xb0c0f0)\n" - " (declare (in ) float a@0xb0c200)\n" + " (declare (in ) vec3 x@0x20e5fe0)\n" + " (declare (in ) vec3 y@0x20e60f0)\n" + " (declare (in ) float a@0x20e6200)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0xb0c3e0)\n" - " (declare (in ) vec4 y@0xb0c4f0)\n" - " (declare (in ) float a@0xb0c600)\n" + " (declare (in ) vec4 x@0x20e63e0)\n" + " (declare (in ) vec4 y@0x20e64f0)\n" + " (declare (in ) float a@0x20e6600)\n" " )\n" " (\n" " ))\n" @@ -22662,56 +22662,56 @@ static const char *prototypes_for_120_frag = "(function step\n" " (signature float\n" " (parameters\n" - " (declare (in ) float edge@0xb0c7e0)\n" - " (declare (in ) float x@0xb0c8f0)\n" + " (declare (in ) float edge@0x20e67e0)\n" + " (declare (in ) float x@0x20e68f0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 edge@0xb0cc70)\n" - " (declare (in ) vec2 x@0xb0cd80)\n" + " (declare (in ) vec2 edge@0x20e6c70)\n" + " (declare (in ) vec2 x@0x20e6d80)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 edge@0xb0cf60)\n" - " (declare (in ) vec3 x@0xb0d070)\n" + " (declare (in ) vec3 edge@0x20e6f60)\n" + " (declare (in ) vec3 x@0x20e7070)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 edge@0xb0d250)\n" - " (declare (in ) vec4 x@0xb0d360)\n" + " (declare (in ) vec4 edge@0x20e7250)\n" + " (declare (in ) vec4 x@0x20e7360)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) float edge@0xb0d540)\n" - " (declare (in ) vec2 x@0xb0d650)\n" + " (declare (in ) float edge@0x20e7540)\n" + " (declare (in ) vec2 x@0x20e7650)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) float edge@0xb0d830)\n" - " (declare (in ) vec3 x@0xb0d940)\n" + " (declare (in ) float edge@0x20e7830)\n" + " (declare (in ) vec3 x@0x20e7940)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) float edge@0xb0db20)\n" - " (declare (in ) vec4 x@0xb0dc30)\n" + " (declare (in ) float edge@0x20e7b20)\n" + " (declare (in ) vec4 x@0x20e7c30)\n" " )\n" " (\n" " ))\n" @@ -22721,63 +22721,63 @@ static const char *prototypes_for_120_frag = "(function smoothstep\n" " (signature float\n" " (parameters\n" - " (declare (in ) float edge0@0xb0de10)\n" - " (declare (in ) float edge1@0xb0df20)\n" - " (declare (in ) float x@0xb0e030)\n" + " (declare (in ) float edge0@0x20e7e10)\n" + " (declare (in ) float edge1@0x20e7f20)\n" + " (declare (in ) float x@0x20e8030)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 edge0@0xb0e3c0)\n" - " (declare (in ) vec2 edge1@0xb0e4d0)\n" - " (declare (in ) vec2 x@0xb0e5e0)\n" + " (declare (in ) vec2 edge0@0x20e83c0)\n" + " (declare (in ) vec2 edge1@0x20e84d0)\n" + " (declare (in ) vec2 x@0x20e85e0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 edge0@0xb0e7c0)\n" - " (declare (in ) vec3 edge1@0xb0e8d0)\n" - " (declare (in ) vec3 x@0xb0e9e0)\n" + " (declare (in ) vec3 edge0@0x20e87c0)\n" + " (declare (in ) vec3 edge1@0x20e88d0)\n" + " (declare (in ) vec3 x@0x20e89e0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 edge0@0xb0ebc0)\n" - " (declare (in ) vec4 edge1@0xb0ecd0)\n" - " (declare (in ) vec4 x@0xb0ede0)\n" + " (declare (in ) vec4 edge0@0x20e8bc0)\n" + " (declare (in ) vec4 edge1@0x20e8cd0)\n" + " (declare (in ) vec4 x@0x20e8de0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) float edge0@0xb0efc0)\n" - " (declare (in ) float edge1@0xb0f0d0)\n" - " (declare (in ) vec2 x@0xb0f1e0)\n" + " (declare (in ) float edge0@0x20e8fc0)\n" + " (declare (in ) float edge1@0x20e90d0)\n" + " (declare (in ) vec2 x@0x20e91e0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) float edge0@0xb0f3c0)\n" - " (declare (in ) float edge1@0xb0f4d0)\n" - " (declare (in ) vec3 x@0xb0f5e0)\n" + " (declare (in ) float edge0@0x20e93c0)\n" + " (declare (in ) float edge1@0x20e94d0)\n" + " (declare (in ) vec3 x@0x20e95e0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) float edge0@0xb0f7c0)\n" - " (declare (in ) float edge1@0xb0f8d0)\n" - " (declare (in ) vec4 x@0xb0f9e0)\n" + " (declare (in ) float edge0@0x20e97c0)\n" + " (declare (in ) float edge1@0x20e98d0)\n" + " (declare (in ) vec4 x@0x20e99e0)\n" " )\n" " (\n" " ))\n" @@ -22787,28 +22787,28 @@ static const char *prototypes_for_120_frag = "(function length\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0xb0fbc0)\n" + " (declare (in ) float x@0x20e9bc0)\n" " )\n" " (\n" " ))\n" "\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec2 x@0xb0ff40)\n" + " (declare (in ) vec2 x@0x20e9f40)\n" " )\n" " (\n" " ))\n" "\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec3 x@0xb10120)\n" + " (declare (in ) vec3 x@0x20ea120)\n" " )\n" " (\n" " ))\n" "\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec4 x@0xb10300)\n" + " (declare (in ) vec4 x@0x20ea300)\n" " )\n" " (\n" " ))\n" @@ -22818,32 +22818,32 @@ static const char *prototypes_for_120_frag = "(function distance\n" " (signature float\n" " (parameters\n" - " (declare (in ) float p0@0xb104e0)\n" - " (declare (in ) float p1@0xb105f0)\n" + " (declare (in ) float p0@0x20ea4e0)\n" + " (declare (in ) float p1@0x20ea5f0)\n" " )\n" " (\n" " ))\n" "\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec2 p0@0xb10980)\n" - " (declare (in ) vec2 p1@0xb10a90)\n" + " (declare (in ) vec2 p0@0x20ea980)\n" + " (declare (in ) vec2 p1@0x20eaa90)\n" " )\n" " (\n" " ))\n" "\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec3 p0@0xb10c70)\n" - " (declare (in ) vec3 p1@0xb10d80)\n" + " (declare (in ) vec3 p0@0x20eac70)\n" + " (declare (in ) vec3 p1@0x20ead80)\n" " )\n" " (\n" " ))\n" "\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec4 p0@0xb10f60)\n" - " (declare (in ) vec4 p1@0xb11070)\n" + " (declare (in ) vec4 p0@0x20eaf60)\n" + " (declare (in ) vec4 p1@0x20eb070)\n" " )\n" " (\n" " ))\n" @@ -22853,32 +22853,32 @@ static const char *prototypes_for_120_frag = "(function dot\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0xb11250)\n" - " (declare (in ) float y@0xb11360)\n" + " (declare (in ) float x@0x20eb250)\n" + " (declare (in ) float y@0x20eb360)\n" " )\n" " (\n" " ))\n" "\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec2 x@0xb116e0)\n" - " (declare (in ) vec2 y@0xb117f0)\n" + " (declare (in ) vec2 x@0x20eb6e0)\n" + " (declare (in ) vec2 y@0x20eb7f0)\n" " )\n" " (\n" " ))\n" "\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec3 x@0xb119d0)\n" - " (declare (in ) vec3 y@0xb11ae0)\n" + " (declare (in ) vec3 x@0x20eb9d0)\n" + " (declare (in ) vec3 y@0x20ebae0)\n" " )\n" " (\n" " ))\n" "\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec4 x@0xb11cc0)\n" - " (declare (in ) vec4 y@0xb11dd0)\n" + " (declare (in ) vec4 x@0x20ebcc0)\n" + " (declare (in ) vec4 y@0x20ebdd0)\n" " )\n" " (\n" " ))\n" @@ -22888,8 +22888,8 @@ static const char *prototypes_for_120_frag = "(function cross\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0xb11fb0)\n" - " (declare (in ) vec3 y@0xb120c0)\n" + " (declare (in ) vec3 x@0x20ebfb0)\n" + " (declare (in ) vec3 y@0x20ec0c0)\n" " )\n" " (\n" " ))\n" @@ -22899,28 +22899,28 @@ static const char *prototypes_for_120_frag = "(function normalize\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0xb12440)\n" + " (declare (in ) float x@0x20ec440)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0xb127d0)\n" + " (declare (in ) vec2 x@0x20ec7d0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0xb129b0)\n" + " (declare (in ) vec3 x@0x20ec9b0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0xb12b90)\n" + " (declare (in ) vec4 x@0x20ecb90)\n" " )\n" " (\n" " ))\n" @@ -22930,36 +22930,36 @@ static const char *prototypes_for_120_frag = "(function faceforward\n" " (signature float\n" " (parameters\n" - " (declare (in ) float N@0xb12d70)\n" - " (declare (in ) float I@0xb12e80)\n" - " (declare (in ) float Nref@0xb12f90)\n" + " (declare (in ) float N@0x20ecd70)\n" + " (declare (in ) float I@0x20ece80)\n" + " (declare (in ) float Nref@0x20ecf90)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 N@0xb13320)\n" - " (declare (in ) vec2 I@0xb13430)\n" - " (declare (in ) vec2 Nref@0xb13540)\n" + " (declare (in ) vec2 N@0x20ed320)\n" + " (declare (in ) vec2 I@0x20ed430)\n" + " (declare (in ) vec2 Nref@0x20ed540)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 N@0xb13720)\n" - " (declare (in ) vec3 I@0xb13830)\n" - " (declare (in ) vec3 Nref@0xb13940)\n" + " (declare (in ) vec3 N@0x20ed720)\n" + " (declare (in ) vec3 I@0x20ed830)\n" + " (declare (in ) vec3 Nref@0x20ed940)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 N@0xb13b20)\n" - " (declare (in ) vec4 I@0xb13c30)\n" - " (declare (in ) vec4 Nref@0xb13d40)\n" + " (declare (in ) vec4 N@0x20edb20)\n" + " (declare (in ) vec4 I@0x20edc30)\n" + " (declare (in ) vec4 Nref@0x20edd40)\n" " )\n" " (\n" " ))\n" @@ -22969,32 +22969,32 @@ static const char *prototypes_for_120_frag = "(function reflect\n" " (signature float\n" " (parameters\n" - " (declare (in ) float I@0xb13f20)\n" - " (declare (in ) float N@0xb14030)\n" + " (declare (in ) float I@0x20edf20)\n" + " (declare (in ) float N@0x20ee030)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 I@0xb143b0)\n" - " (declare (in ) vec2 N@0xb144c0)\n" + " (declare (in ) vec2 I@0x20ee3b0)\n" + " (declare (in ) vec2 N@0x20ee4c0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 I@0xb146a0)\n" - " (declare (in ) vec3 N@0xb147b0)\n" + " (declare (in ) vec3 I@0x20ee6a0)\n" + " (declare (in ) vec3 N@0x20ee7b0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 I@0xb14990)\n" - " (declare (in ) vec4 N@0xb14aa0)\n" + " (declare (in ) vec4 I@0x20ee990)\n" + " (declare (in ) vec4 N@0x20eeaa0)\n" " )\n" " (\n" " ))\n" @@ -23004,36 +23004,36 @@ static const char *prototypes_for_120_frag = "(function refract\n" " (signature float\n" " (parameters\n" - " (declare (in ) float I@0xb14c80)\n" - " (declare (in ) float N@0xb14d90)\n" - " (declare (in ) float eta@0xb14ea0)\n" + " (declare (in ) float I@0x20eec80)\n" + " (declare (in ) float N@0x20eed90)\n" + " (declare (in ) float eta@0x20eeea0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 I@0xb15220)\n" - " (declare (in ) vec2 N@0xb15330)\n" - " (declare (in ) float eta@0xb15440)\n" + " (declare (in ) vec2 I@0x20ef220)\n" + " (declare (in ) vec2 N@0x20ef330)\n" + " (declare (in ) float eta@0x20ef440)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 I@0xb15620)\n" - " (declare (in ) vec3 N@0xb15730)\n" - " (declare (in ) float eta@0xb15840)\n" + " (declare (in ) vec3 I@0x20ef620)\n" + " (declare (in ) vec3 N@0x20ef730)\n" + " (declare (in ) float eta@0x20ef840)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 I@0xb15a20)\n" - " (declare (in ) vec4 N@0xb15b30)\n" - " (declare (in ) float eta@0xb15c40)\n" + " (declare (in ) vec4 I@0x20efa20)\n" + " (declare (in ) vec4 N@0x20efb30)\n" + " (declare (in ) float eta@0x20efc40)\n" " )\n" " (\n" " ))\n" @@ -23043,72 +23043,72 @@ static const char *prototypes_for_120_frag = "(function matrixCompMult\n" " (signature mat2\n" " (parameters\n" - " (declare (in ) mat2 x@0xb15e20)\n" - " (declare (in ) mat2 y@0xb15f30)\n" + " (declare (in ) mat2 x@0x20efe20)\n" + " (declare (in ) mat2 y@0x20eff30)\n" " )\n" " (\n" " ))\n" "\n" " (signature mat3\n" " (parameters\n" - " (declare (in ) mat3 x@0xb162c0)\n" - " (declare (in ) mat3 y@0xb163d0)\n" + " (declare (in ) mat3 x@0x20f02c0)\n" + " (declare (in ) mat3 y@0x20f03d0)\n" " )\n" " (\n" " ))\n" "\n" " (signature mat4\n" " (parameters\n" - " (declare (in ) mat4 x@0xb165b0)\n" - " (declare (in ) mat4 y@0xb166c0)\n" + " (declare (in ) mat4 x@0x20f05b0)\n" + " (declare (in ) mat4 y@0x20f06c0)\n" " )\n" " (\n" " ))\n" "\n" " (signature mat2x3\n" " (parameters\n" - " (declare (in ) mat2x3 x@0xb168a0)\n" - " (declare (in ) mat2x3 y@0xb169b0)\n" + " (declare (in ) mat2x3 x@0x20f08a0)\n" + " (declare (in ) mat2x3 y@0x20f09b0)\n" " )\n" " (\n" " ))\n" "\n" " (signature mat2x4\n" " (parameters\n" - " (declare (in ) mat2x4 x@0xb16b90)\n" - " (declare (in ) mat2x4 y@0xb16ca0)\n" + " (declare (in ) mat2x4 x@0x20f0b90)\n" + " (declare (in ) mat2x4 y@0x20f0ca0)\n" " )\n" " (\n" " ))\n" "\n" " (signature mat3x2\n" " (parameters\n" - " (declare (in ) mat3x2 x@0xb16e80)\n" - " (declare (in ) mat3x2 y@0xb16f90)\n" + " (declare (in ) mat3x2 x@0x20f0e80)\n" + " (declare (in ) mat3x2 y@0x20f0f90)\n" " )\n" " (\n" " ))\n" "\n" " (signature mat3x4\n" " (parameters\n" - " (declare (in ) mat3x4 x@0xb17170)\n" - " (declare (in ) mat3x4 y@0xb17280)\n" + " (declare (in ) mat3x4 x@0x20f1170)\n" + " (declare (in ) mat3x4 y@0x20f1280)\n" " )\n" " (\n" " ))\n" "\n" " (signature mat4x2\n" " (parameters\n" - " (declare (in ) mat4x2 x@0xb17460)\n" - " (declare (in ) mat4x2 y@0xb17570)\n" + " (declare (in ) mat4x2 x@0x20f1460)\n" + " (declare (in ) mat4x2 y@0x20f1570)\n" " )\n" " (\n" " ))\n" "\n" " (signature mat4x3\n" " (parameters\n" - " (declare (in ) mat4x3 x@0xb17750)\n" - " (declare (in ) mat4x3 y@0xb17860)\n" + " (declare (in ) mat4x3 x@0x20f1750)\n" + " (declare (in ) mat4x3 y@0x20f1860)\n" " )\n" " (\n" " ))\n" @@ -23118,72 +23118,72 @@ static const char *prototypes_for_120_frag = "(function outerProduct\n" " (signature mat2\n" " (parameters\n" - " (declare (in ) vec2 c@0xb17a40)\n" - " (declare (in ) vec2 r@0xb17b50)\n" + " (declare (in ) vec2 c@0x20f1a40)\n" + " (declare (in ) vec2 r@0x20f1b50)\n" " )\n" " (\n" " ))\n" "\n" " (signature mat3\n" " (parameters\n" - " (declare (in ) vec3 c@0xb17ee0)\n" - " (declare (in ) vec3 r@0xb17ff0)\n" + " (declare (in ) vec3 c@0x20f1ee0)\n" + " (declare (in ) vec3 r@0x20f1ff0)\n" " )\n" " (\n" " ))\n" "\n" " (signature mat4\n" " (parameters\n" - " (declare (in ) vec4 c@0xb181d0)\n" - " (declare (in ) vec4 r@0xb182e0)\n" + " (declare (in ) vec4 c@0x20f21d0)\n" + " (declare (in ) vec4 r@0x20f22e0)\n" " )\n" " (\n" " ))\n" "\n" " (signature mat2x3\n" " (parameters\n" - " (declare (in ) vec3 c@0xb184c0)\n" - " (declare (in ) vec2 r@0xb185d0)\n" + " (declare (in ) vec3 c@0x20f24c0)\n" + " (declare (in ) vec2 r@0x20f25d0)\n" " )\n" " (\n" " ))\n" "\n" " (signature mat3x2\n" " (parameters\n" - " (declare (in ) vec2 c@0xb187b0)\n" - " (declare (in ) vec3 r@0xb188c0)\n" + " (declare (in ) vec2 c@0x20f27b0)\n" + " (declare (in ) vec3 r@0x20f28c0)\n" " )\n" " (\n" " ))\n" "\n" " (signature mat2x4\n" " (parameters\n" - " (declare (in ) vec4 c@0xb18aa0)\n" - " (declare (in ) vec2 r@0xb18bb0)\n" + " (declare (in ) vec4 c@0x20f2aa0)\n" + " (declare (in ) vec2 r@0x20f2bb0)\n" " )\n" " (\n" " ))\n" "\n" " (signature mat4x2\n" " (parameters\n" - " (declare (in ) vec2 c@0xb18d90)\n" - " (declare (in ) vec4 r@0xb18ea0)\n" + " (declare (in ) vec2 c@0x20f2d90)\n" + " (declare (in ) vec4 r@0x20f2ea0)\n" " )\n" " (\n" " ))\n" "\n" " (signature mat3x4\n" " (parameters\n" - " (declare (in ) vec4 c@0xb19080)\n" - " (declare (in ) vec3 r@0xb19190)\n" + " (declare (in ) vec4 c@0x20f3080)\n" + " (declare (in ) vec3 r@0x20f3190)\n" " )\n" " (\n" " ))\n" "\n" " (signature mat4x3\n" " (parameters\n" - " (declare (in ) vec3 c@0xb19370)\n" - " (declare (in ) vec4 r@0xb19480)\n" + " (declare (in ) vec3 c@0x20f3370)\n" + " (declare (in ) vec4 r@0x20f3480)\n" " )\n" " (\n" " ))\n" @@ -23193,63 +23193,63 @@ static const char *prototypes_for_120_frag = "(function transpose\n" " (signature mat2\n" " (parameters\n" - " (declare (in ) mat2 m@0xb19660)\n" + " (declare (in ) mat2 m@0x20f3660)\n" " )\n" " (\n" " ))\n" "\n" " (signature mat3\n" " (parameters\n" - " (declare (in ) mat3 m@0xb199f0)\n" + " (declare (in ) mat3 m@0x20f39f0)\n" " )\n" " (\n" " ))\n" "\n" " (signature mat4\n" " (parameters\n" - " (declare (in ) mat4 m@0xb19bd0)\n" + " (declare (in ) mat4 m@0x20f3bd0)\n" " )\n" " (\n" " ))\n" "\n" " (signature mat2x3\n" " (parameters\n" - " (declare (in ) mat3x2 m@0xb19db0)\n" + " (declare (in ) mat3x2 m@0x20f3db0)\n" " )\n" " (\n" " ))\n" "\n" " (signature mat3x2\n" " (parameters\n" - " (declare (in ) mat2x3 m@0xb19f90)\n" + " (declare (in ) mat2x3 m@0x20f3f90)\n" " )\n" " (\n" " ))\n" "\n" " (signature mat2x4\n" " (parameters\n" - " (declare (in ) mat4x2 m@0xb1a170)\n" + " (declare (in ) mat4x2 m@0x20f4170)\n" " )\n" " (\n" " ))\n" "\n" " (signature mat4x2\n" " (parameters\n" - " (declare (in ) mat2x4 m@0xb1a350)\n" + " (declare (in ) mat2x4 m@0x20f4350)\n" " )\n" " (\n" " ))\n" "\n" " (signature mat3x4\n" " (parameters\n" - " (declare (in ) mat4x3 m@0xb1a530)\n" + " (declare (in ) mat4x3 m@0x20f4530)\n" " )\n" " (\n" " ))\n" "\n" " (signature mat4x3\n" " (parameters\n" - " (declare (in ) mat3x4 m@0xb1a710)\n" + " (declare (in ) mat3x4 m@0x20f4710)\n" " )\n" " (\n" " ))\n" @@ -23259,48 +23259,48 @@ static const char *prototypes_for_120_frag = "(function lessThan\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) vec2 x@0xb1a8f0)\n" - " (declare (in ) vec2 y@0xb1aa00)\n" + " (declare (in ) vec2 x@0x20f48f0)\n" + " (declare (in ) vec2 y@0x20f4a00)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) vec3 x@0xb1ad90)\n" - " (declare (in ) vec3 y@0xb1aea0)\n" + " (declare (in ) vec3 x@0x20f4d90)\n" + " (declare (in ) vec3 y@0x20f4ea0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) vec4 x@0xb1b080)\n" - " (declare (in ) vec4 y@0xb1b190)\n" + " (declare (in ) vec4 x@0x20f5080)\n" + " (declare (in ) vec4 y@0x20f5190)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) ivec2 x@0xb1b370)\n" - " (declare (in ) ivec2 y@0xb1b480)\n" + " (declare (in ) ivec2 x@0x20f5370)\n" + " (declare (in ) ivec2 y@0x20f5480)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) ivec3 x@0xb1b660)\n" - " (declare (in ) ivec3 y@0xb1b770)\n" + " (declare (in ) ivec3 x@0x20f5660)\n" + " (declare (in ) ivec3 y@0x20f5770)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) ivec4 x@0xb1b950)\n" - " (declare (in ) ivec4 y@0xb1ba60)\n" + " (declare (in ) ivec4 x@0x20f5950)\n" + " (declare (in ) ivec4 y@0x20f5a60)\n" " )\n" " (\n" " ))\n" @@ -23310,48 +23310,48 @@ static const char *prototypes_for_120_frag = "(function lessThanEqual\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) vec2 x@0xb1bc40)\n" - " (declare (in ) vec2 y@0xb1bd50)\n" + " (declare (in ) vec2 x@0x20f5c40)\n" + " (declare (in ) vec2 y@0x20f5d50)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) vec3 x@0xb1c0e0)\n" - " (declare (in ) vec3 y@0xb1c1f0)\n" + " (declare (in ) vec3 x@0x20f60e0)\n" + " (declare (in ) vec3 y@0x20f61f0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) vec4 x@0xb1c3d0)\n" - " (declare (in ) vec4 y@0xb1c4e0)\n" + " (declare (in ) vec4 x@0x20f63d0)\n" + " (declare (in ) vec4 y@0x20f64e0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) ivec2 x@0xb1c6c0)\n" - " (declare (in ) ivec2 y@0xb1c7d0)\n" + " (declare (in ) ivec2 x@0x20f66c0)\n" + " (declare (in ) ivec2 y@0x20f67d0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) ivec3 x@0xb1c9b0)\n" - " (declare (in ) ivec3 y@0xb1cac0)\n" + " (declare (in ) ivec3 x@0x20f69b0)\n" + " (declare (in ) ivec3 y@0x20f6ac0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) ivec4 x@0xb1cca0)\n" - " (declare (in ) ivec4 y@0xb1cdb0)\n" + " (declare (in ) ivec4 x@0x20f6ca0)\n" + " (declare (in ) ivec4 y@0x20f6db0)\n" " )\n" " (\n" " ))\n" @@ -23361,48 +23361,48 @@ static const char *prototypes_for_120_frag = "(function greaterThan\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) vec2 x@0xb1cf90)\n" - " (declare (in ) vec2 y@0xb1d0a0)\n" + " (declare (in ) vec2 x@0x20f6f90)\n" + " (declare (in ) vec2 y@0x20f70a0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) vec3 x@0xb1d430)\n" - " (declare (in ) vec3 y@0xb1d540)\n" + " (declare (in ) vec3 x@0x20f7430)\n" + " (declare (in ) vec3 y@0x20f7540)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) vec4 x@0xb1d720)\n" - " (declare (in ) vec4 y@0xb1d830)\n" + " (declare (in ) vec4 x@0x20f7720)\n" + " (declare (in ) vec4 y@0x20f7830)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) ivec2 x@0xb1da10)\n" - " (declare (in ) ivec2 y@0xb1db20)\n" + " (declare (in ) ivec2 x@0x20f7a10)\n" + " (declare (in ) ivec2 y@0x20f7b20)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) ivec3 x@0xb1dd00)\n" - " (declare (in ) ivec3 y@0xb1de10)\n" + " (declare (in ) ivec3 x@0x20f7d00)\n" + " (declare (in ) ivec3 y@0x20f7e10)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) ivec4 x@0xb1dff0)\n" - " (declare (in ) ivec4 y@0xb1e100)\n" + " (declare (in ) ivec4 x@0x20f7ff0)\n" + " (declare (in ) ivec4 y@0x20f8100)\n" " )\n" " (\n" " ))\n" @@ -23412,48 +23412,48 @@ static const char *prototypes_for_120_frag = "(function greaterThanEqual\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) vec2 x@0xb1e2e0)\n" - " (declare (in ) vec2 y@0xb1e3f0)\n" + " (declare (in ) vec2 x@0x20f82e0)\n" + " (declare (in ) vec2 y@0x20f83f0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) vec3 x@0xb1e780)\n" - " (declare (in ) vec3 y@0xb1e890)\n" + " (declare (in ) vec3 x@0x20f8780)\n" + " (declare (in ) vec3 y@0x20f8890)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) vec4 x@0xb1ea70)\n" - " (declare (in ) vec4 y@0xb1eb80)\n" + " (declare (in ) vec4 x@0x20f8a70)\n" + " (declare (in ) vec4 y@0x20f8b80)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) ivec2 x@0xb1ed60)\n" - " (declare (in ) ivec2 y@0xb1ee70)\n" + " (declare (in ) ivec2 x@0x20f8d60)\n" + " (declare (in ) ivec2 y@0x20f8e70)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) ivec3 x@0xb1f050)\n" - " (declare (in ) ivec3 y@0xb1f160)\n" + " (declare (in ) ivec3 x@0x20f9050)\n" + " (declare (in ) ivec3 y@0x20f9160)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) ivec4 x@0xb1f340)\n" - " (declare (in ) ivec4 y@0xb1f450)\n" + " (declare (in ) ivec4 x@0x20f9340)\n" + " (declare (in ) ivec4 y@0x20f9450)\n" " )\n" " (\n" " ))\n" @@ -23463,72 +23463,72 @@ static const char *prototypes_for_120_frag = "(function equal\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) vec2 x@0xb1f630)\n" - " (declare (in ) vec2 y@0xb1f740)\n" + " (declare (in ) vec2 x@0x20f9630)\n" + " (declare (in ) vec2 y@0x20f9740)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) vec3 x@0xb1fac0)\n" - " (declare (in ) vec3 y@0xb1fbd0)\n" + " (declare (in ) vec3 x@0x20f9ac0)\n" + " (declare (in ) vec3 y@0x20f9bd0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) vec4 x@0xb1fdb0)\n" - " (declare (in ) vec4 y@0xb1fec0)\n" + " (declare (in ) vec4 x@0x20f9db0)\n" + " (declare (in ) vec4 y@0x20f9ec0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) ivec2 x@0xb200a0)\n" - " (declare (in ) ivec2 y@0xb201b0)\n" + " (declare (in ) ivec2 x@0x20fa0a0)\n" + " (declare (in ) ivec2 y@0x20fa1b0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) ivec3 x@0xb20390)\n" - " (declare (in ) ivec3 y@0xb204a0)\n" + " (declare (in ) ivec3 x@0x20fa390)\n" + " (declare (in ) ivec3 y@0x20fa4a0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) ivec4 x@0xb20680)\n" - " (declare (in ) ivec4 y@0xb20790)\n" + " (declare (in ) ivec4 x@0x20fa680)\n" + " (declare (in ) ivec4 y@0x20fa790)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) bvec2 x@0xb20970)\n" - " (declare (in ) bvec2 y@0xb20a80)\n" + " (declare (in ) bvec2 x@0x20fa970)\n" + " (declare (in ) bvec2 y@0x20faa80)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) bvec3 x@0xb20c60)\n" - " (declare (in ) bvec3 y@0xb20d70)\n" + " (declare (in ) bvec3 x@0x20fac60)\n" + " (declare (in ) bvec3 y@0x20fad70)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) bvec4 x@0xb20f50)\n" - " (declare (in ) bvec4 y@0xb21060)\n" + " (declare (in ) bvec4 x@0x20faf50)\n" + " (declare (in ) bvec4 y@0x20fb060)\n" " )\n" " (\n" " ))\n" @@ -23538,72 +23538,72 @@ static const char *prototypes_for_120_frag = "(function notEqual\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) vec2 x@0xb21240)\n" - " (declare (in ) vec2 y@0xb21350)\n" + " (declare (in ) vec2 x@0x20fb240)\n" + " (declare (in ) vec2 y@0x20fb350)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) vec3 x@0xb216e0)\n" - " (declare (in ) vec3 y@0xb217f0)\n" + " (declare (in ) vec3 x@0x20fb6e0)\n" + " (declare (in ) vec3 y@0x20fb7f0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) vec4 x@0xb219d0)\n" - " (declare (in ) vec4 y@0xb21ae0)\n" + " (declare (in ) vec4 x@0x20fb9d0)\n" + " (declare (in ) vec4 y@0x20fbae0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) ivec2 x@0xb21cc0)\n" - " (declare (in ) ivec2 y@0xb21dd0)\n" + " (declare (in ) ivec2 x@0x20fbcc0)\n" + " (declare (in ) ivec2 y@0x20fbdd0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) ivec3 x@0xb21fb0)\n" - " (declare (in ) ivec3 y@0xb220c0)\n" + " (declare (in ) ivec3 x@0x20fbfb0)\n" + " (declare (in ) ivec3 y@0x20fc0c0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) ivec4 x@0xb222a0)\n" - " (declare (in ) ivec4 y@0xb223b0)\n" + " (declare (in ) ivec4 x@0x20fc2a0)\n" + " (declare (in ) ivec4 y@0x20fc3b0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) bvec2 x@0xb22590)\n" - " (declare (in ) bvec2 y@0xb226a0)\n" + " (declare (in ) bvec2 x@0x20fc590)\n" + " (declare (in ) bvec2 y@0x20fc6a0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) bvec3 x@0xb22880)\n" - " (declare (in ) bvec3 y@0xb22990)\n" + " (declare (in ) bvec3 x@0x20fc880)\n" + " (declare (in ) bvec3 y@0x20fc990)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) bvec4 x@0xb22b70)\n" - " (declare (in ) bvec4 y@0xb22c80)\n" + " (declare (in ) bvec4 x@0x20fcb70)\n" + " (declare (in ) bvec4 y@0x20fcc80)\n" " )\n" " (\n" " ))\n" @@ -23613,21 +23613,21 @@ static const char *prototypes_for_120_frag = "(function any\n" " (signature bool\n" " (parameters\n" - " (declare (in ) bvec2 x@0xb22e60)\n" + " (declare (in ) bvec2 x@0x20fce60)\n" " )\n" " (\n" " ))\n" "\n" " (signature bool\n" " (parameters\n" - " (declare (in ) bvec3 x@0xb231e0)\n" + " (declare (in ) bvec3 x@0x20fd1e0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bool\n" " (parameters\n" - " (declare (in ) bvec4 x@0xb233c0)\n" + " (declare (in ) bvec4 x@0x20fd3c0)\n" " )\n" " (\n" " ))\n" @@ -23637,21 +23637,21 @@ static const char *prototypes_for_120_frag = "(function all\n" " (signature bool\n" " (parameters\n" - " (declare (in ) bvec2 x@0xb235a0)\n" + " (declare (in ) bvec2 x@0x20fd5a0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bool\n" " (parameters\n" - " (declare (in ) bvec3 x@0xb23920)\n" + " (declare (in ) bvec3 x@0x20fd920)\n" " )\n" " (\n" " ))\n" "\n" " (signature bool\n" " (parameters\n" - " (declare (in ) bvec4 x@0xb23b00)\n" + " (declare (in ) bvec4 x@0x20fdb00)\n" " )\n" " (\n" " ))\n" @@ -23661,21 +23661,21 @@ static const char *prototypes_for_120_frag = "(function not\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) bvec2 x@0xb23ce0)\n" + " (declare (in ) bvec2 x@0x20fdce0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) bvec3 x@0xb24060)\n" + " (declare (in ) bvec3 x@0x20fe060)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) bvec4 x@0xb24240)\n" + " (declare (in ) bvec4 x@0x20fe240)\n" " )\n" " (\n" " ))\n" @@ -23685,17 +23685,17 @@ static const char *prototypes_for_120_frag = "(function texture1D\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1D sampler@0xb24420)\n" - " (declare (in ) float coord@0xb24530)\n" + " (declare (in ) sampler1D sampler@0x20fe420)\n" + " (declare (in ) float coord@0x20fe530)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1D sampler@0xb25050)\n" - " (declare (in ) float coord@0xb25160)\n" - " (declare (in ) float bias@0xb25270)\n" + " (declare (in ) sampler1D sampler@0x20ff050)\n" + " (declare (in ) float coord@0x20ff160)\n" + " (declare (in ) float bias@0x20ff270)\n" " )\n" " (\n" " ))\n" @@ -23705,34 +23705,34 @@ static const char *prototypes_for_120_frag = "(function texture1DProj\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1D sampler@0xb248c0)\n" - " (declare (in ) vec2 coord@0xb249d0)\n" + " (declare (in ) sampler1D sampler@0x20fe8c0)\n" + " (declare (in ) vec2 coord@0x20fe9d0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1D sampler@0xb24d60)\n" - " (declare (in ) vec4 coord@0xb24e70)\n" + " (declare (in ) sampler1D sampler@0x20fed60)\n" + " (declare (in ) vec4 coord@0x20fee70)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1D sampler@0xb25450)\n" - " (declare (in ) vec2 coord@0xb25560)\n" - " (declare (in ) float bias@0xb25670)\n" + " (declare (in ) sampler1D sampler@0x20ff450)\n" + " (declare (in ) vec2 coord@0x20ff560)\n" + " (declare (in ) float bias@0x20ff670)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1D sampler@0xb25850)\n" - " (declare (in ) vec4 coord@0xb25960)\n" - " (declare (in ) float bias@0xb25a70)\n" + " (declare (in ) sampler1D sampler@0x20ff850)\n" + " (declare (in ) vec4 coord@0x20ff960)\n" + " (declare (in ) float bias@0x20ffa70)\n" " )\n" " (\n" " ))\n" @@ -23742,17 +23742,17 @@ static const char *prototypes_for_120_frag = "(function texture2D\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2D sampler@0xb25c50)\n" - " (declare (in ) vec2 coord@0xb25d60)\n" + " (declare (in ) sampler2D sampler@0x20ffc50)\n" + " (declare (in ) vec2 coord@0x20ffd60)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2D sampler@0xb26880)\n" - " (declare (in ) vec2 coord@0xb26990)\n" - " (declare (in ) float bias@0xb26aa0)\n" + " (declare (in ) sampler2D sampler@0x2100880)\n" + " (declare (in ) vec2 coord@0x2100990)\n" + " (declare (in ) float bias@0x2100aa0)\n" " )\n" " (\n" " ))\n" @@ -23762,34 +23762,34 @@ static const char *prototypes_for_120_frag = "(function texture2DProj\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2D sampler@0xb260f0)\n" - " (declare (in ) vec3 coord@0xb26200)\n" + " (declare (in ) sampler2D sampler@0x21000f0)\n" + " (declare (in ) vec3 coord@0x2100200)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2D sampler@0xb26590)\n" - " (declare (in ) vec4 coord@0xb266a0)\n" + " (declare (in ) sampler2D sampler@0x2100590)\n" + " (declare (in ) vec4 coord@0x21006a0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2D sampler@0xb26c80)\n" - " (declare (in ) vec3 coord@0xb26d90)\n" - " (declare (in ) float bias@0xb26ea0)\n" + " (declare (in ) sampler2D sampler@0x2100c80)\n" + " (declare (in ) vec3 coord@0x2100d90)\n" + " (declare (in ) float bias@0x2100ea0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2D sampler@0xb27080)\n" - " (declare (in ) vec4 coord@0xb27190)\n" - " (declare (in ) float bias@0xb272a0)\n" + " (declare (in ) sampler2D sampler@0x2101080)\n" + " (declare (in ) vec4 coord@0x2101190)\n" + " (declare (in ) float bias@0x21012a0)\n" " )\n" " (\n" " ))\n" @@ -23799,17 +23799,17 @@ static const char *prototypes_for_120_frag = "(function texture3D\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler3D sampler@0xb27480)\n" - " (declare (in ) vec3 coord@0xb27590)\n" + " (declare (in ) sampler3D sampler@0x2101480)\n" + " (declare (in ) vec3 coord@0x2101590)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler3D sampler@0xb27dc0)\n" - " (declare (in ) vec3 coord@0xb27ed0)\n" - " (declare (in ) float bias@0xb27fe0)\n" + " (declare (in ) sampler3D sampler@0x2101dc0)\n" + " (declare (in ) vec3 coord@0x2101ed0)\n" + " (declare (in ) float bias@0x2101fe0)\n" " )\n" " (\n" " ))\n" @@ -23819,17 +23819,17 @@ static const char *prototypes_for_120_frag = "(function texture3DProj\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler3D sampler@0xb27920)\n" - " (declare (in ) vec4 coord@0xb27a30)\n" + " (declare (in ) sampler3D sampler@0x2101920)\n" + " (declare (in ) vec4 coord@0x2101a30)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler3D sampler@0xb281c0)\n" - " (declare (in ) vec4 coord@0xb282d0)\n" - " (declare (in ) float bias@0xb283e0)\n" + " (declare (in ) sampler3D sampler@0x21021c0)\n" + " (declare (in ) vec4 coord@0x21022d0)\n" + " (declare (in ) float bias@0x21023e0)\n" " )\n" " (\n" " ))\n" @@ -23839,17 +23839,17 @@ static const char *prototypes_for_120_frag = "(function textureCube\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) samplerCube sampler@0xb285c0)\n" - " (declare (in ) vec3 coord@0xb286d0)\n" + " (declare (in ) samplerCube sampler@0x21025c0)\n" + " (declare (in ) vec3 coord@0x21026d0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) samplerCube sampler@0xb28a60)\n" - " (declare (in ) vec3 coord@0xb28b70)\n" - " (declare (in ) float bias@0xb28c80)\n" + " (declare (in ) samplerCube sampler@0x2102a60)\n" + " (declare (in ) vec3 coord@0x2102b70)\n" + " (declare (in ) float bias@0x2102c80)\n" " )\n" " (\n" " ))\n" @@ -23859,17 +23859,17 @@ static const char *prototypes_for_120_frag = "(function shadow1D\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1DShadow sampler@0xb28e60)\n" - " (declare (in ) vec3 coord@0xb28f70)\n" + " (declare (in ) sampler1DShadow sampler@0x2102e60)\n" + " (declare (in ) vec3 coord@0x2102f70)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1DShadow sampler@0xb2a0e0)\n" - " (declare (in ) vec3 coord@0xb2a1f0)\n" - " (declare (in ) float bias@0xb2a300)\n" + " (declare (in ) sampler1DShadow sampler@0x21040e0)\n" + " (declare (in ) vec3 coord@0x21041f0)\n" + " (declare (in ) float bias@0x2104300)\n" " )\n" " (\n" " ))\n" @@ -23879,17 +23879,17 @@ static const char *prototypes_for_120_frag = "(function shadow2D\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2DShadow sampler@0xb29300)\n" - " (declare (in ) vec3 coord@0xb29410)\n" + " (declare (in ) sampler2DShadow sampler@0x2103300)\n" + " (declare (in ) vec3 coord@0x2103410)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2DShadow sampler@0xb2a4e0)\n" - " (declare (in ) vec3 coord@0xb2a5f0)\n" - " (declare (in ) float bias@0xb2a700)\n" + " (declare (in ) sampler2DShadow sampler@0x21044e0)\n" + " (declare (in ) vec3 coord@0x21045f0)\n" + " (declare (in ) float bias@0x2104700)\n" " )\n" " (\n" " ))\n" @@ -23899,17 +23899,17 @@ static const char *prototypes_for_120_frag = "(function shadow1DProj\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1DShadow sampler@0xb297a0)\n" - " (declare (in ) vec4 coord@0xb298b0)\n" + " (declare (in ) sampler1DShadow sampler@0x21037a0)\n" + " (declare (in ) vec4 coord@0x21038b0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1DShadow sampler@0xb2a8e0)\n" - " (declare (in ) vec4 coord@0xb2a9f0)\n" - " (declare (in ) float bias@0xb2ab00)\n" + " (declare (in ) sampler1DShadow sampler@0x21048e0)\n" + " (declare (in ) vec4 coord@0x21049f0)\n" + " (declare (in ) float bias@0x2104b00)\n" " )\n" " (\n" " ))\n" @@ -23919,17 +23919,17 @@ static const char *prototypes_for_120_frag = "(function shadow2DProj\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2DShadow sampler@0xb29c40)\n" - " (declare (in ) vec4 coord@0xb29d50)\n" + " (declare (in ) sampler2DShadow sampler@0x2103c40)\n" + " (declare (in ) vec4 coord@0x2103d50)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2DShadow sampler@0xb2ace0)\n" - " (declare (in ) vec4 coord@0xb2adf0)\n" - " (declare (in ) float bias@0xb2af00)\n" + " (declare (in ) sampler2DShadow sampler@0x2104ce0)\n" + " (declare (in ) vec4 coord@0x2104df0)\n" + " (declare (in ) float bias@0x2104f00)\n" " )\n" " (\n" " ))\n" @@ -23939,28 +23939,28 @@ static const char *prototypes_for_120_frag = "(function dFdx\n" " (signature float\n" " (parameters\n" - " (declare (in ) float p@0xb2b0e0)\n" + " (declare (in ) float p@0x21050e0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 p@0xb2b460)\n" + " (declare (in ) vec2 p@0x2105460)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 p@0xb2b640)\n" + " (declare (in ) vec3 p@0x2105640)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 p@0xb2b820)\n" + " (declare (in ) vec4 p@0x2105820)\n" " )\n" " (\n" " ))\n" @@ -23970,28 +23970,28 @@ static const char *prototypes_for_120_frag = "(function dFdy\n" " (signature float\n" " (parameters\n" - " (declare (in ) float p@0xb2ba00)\n" + " (declare (in ) float p@0x2105a00)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 p@0xb2bd80)\n" + " (declare (in ) vec2 p@0x2105d80)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 p@0xb2bf60)\n" + " (declare (in ) vec3 p@0x2105f60)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 p@0xb2c140)\n" + " (declare (in ) vec4 p@0x2106140)\n" " )\n" " (\n" " ))\n" @@ -24001,28 +24001,28 @@ static const char *prototypes_for_120_frag = "(function fwidth\n" " (signature float\n" " (parameters\n" - " (declare (in ) float p@0xb2c320)\n" + " (declare (in ) float p@0x2106320)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 p@0xb2c6a0)\n" + " (declare (in ) vec2 p@0x21066a0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 p@0xb2c880)\n" + " (declare (in ) vec3 p@0x2106880)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 p@0xb2ca60)\n" + " (declare (in ) vec4 p@0x2106a60)\n" " )\n" " (\n" " ))\n" @@ -24032,28 +24032,28 @@ static const char *prototypes_for_120_frag = "(function noise1\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0xb2cc40)\n" + " (declare (in ) float x@0x2106c40)\n" " )\n" " (\n" " ))\n" "\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec2 x@0xb2cfc0)\n" + " (declare (in ) vec2 x@0x2106fc0)\n" " )\n" " (\n" " ))\n" "\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec3 x@0xb2d1a0)\n" + " (declare (in ) vec3 x@0x21071a0)\n" " )\n" " (\n" " ))\n" "\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec4 x@0xb2d380)\n" + " (declare (in ) vec4 x@0x2107380)\n" " )\n" " (\n" " ))\n" @@ -24063,28 +24063,28 @@ static const char *prototypes_for_120_frag = "(function noise2\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) float x@0xb2d560)\n" + " (declare (in ) float x@0x2107560)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0xb2d8e0)\n" + " (declare (in ) vec2 x@0x21078e0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec3 x@0xb2dac0)\n" + " (declare (in ) vec3 x@0x2107ac0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec4 x@0xb2dca0)\n" + " (declare (in ) vec4 x@0x2107ca0)\n" " )\n" " (\n" " ))\n" @@ -24094,28 +24094,28 @@ static const char *prototypes_for_120_frag = "(function noise3\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) float x@0xb2de80)\n" + " (declare (in ) float x@0x2107e80)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec2 x@0xb2e200)\n" + " (declare (in ) vec2 x@0x2108200)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0xb2e3e0)\n" + " (declare (in ) vec3 x@0x21083e0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec4 x@0xb2e5c0)\n" + " (declare (in ) vec4 x@0x21085c0)\n" " )\n" " (\n" " ))\n" @@ -24125,28 +24125,28 @@ static const char *prototypes_for_120_frag = "(function noise4\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) float x@0xb2e7a0)\n" + " (declare (in ) float x@0x21087a0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec2 x@0xb2eb20)\n" + " (declare (in ) vec2 x@0x2108b20)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec3 x@0xb2ed00)\n" + " (declare (in ) vec3 x@0x2108d00)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0xb2eee0)\n" + " (declare (in ) vec4 x@0x2108ee0)\n" " )\n" " (\n" " ))\n" -- cgit v1.2.3 From c17d5de593fbfee91b799894b1c1a8a37a6a9c95 Mon Sep 17 00:00:00 2001 From: Andre Maasikas Date: Wed, 18 Aug 2010 11:57:28 +0300 Subject: r600: implement DP2 opcode --- src/mesa/drivers/dri/r600/r700_assembler.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r600/r700_assembler.c b/src/mesa/drivers/dri/r600/r700_assembler.c index 94bc26145d..4902f7630c 100644 --- a/src/mesa/drivers/dri/r600/r700_assembler.c +++ b/src/mesa/drivers/dri/r600/r700_assembler.c @@ -3017,7 +3017,14 @@ GLboolean assemble_DOT(r700_AssemblerBase *pAsm) return GL_FALSE; } - if(OPCODE_DP3 == pAsm->pILInst[pAsm->uiCurInst].Opcode) + if(OPCODE_DP2 == pAsm->pILInst[pAsm->uiCurInst].Opcode) + { + zerocomp_PVSSRC(&(pAsm->S[0].src),2); + zerocomp_PVSSRC(&(pAsm->S[0].src),3); + zerocomp_PVSSRC(&(pAsm->S[1].src),2); + zerocomp_PVSSRC(&(pAsm->S[1].src),3); + } + else if(OPCODE_DP3 == pAsm->pILInst[pAsm->uiCurInst].Opcode) { zerocomp_PVSSRC(&(pAsm->S[0].src), 3); zerocomp_PVSSRC(&(pAsm->S[1].src), 3); @@ -5694,6 +5701,7 @@ GLboolean AssembleInstr(GLuint uiFirstInst, return GL_FALSE; break; + case OPCODE_DP2: case OPCODE_DP3: case OPCODE_DP4: case OPCODE_DPH: @@ -6019,7 +6027,7 @@ GLboolean AssembleInstr(GLuint uiFirstInst, return GL_TRUE; default: - radeon_error("internal: unknown instruction\n"); + radeon_error("r600: unknown instruction %d\n", pILInst[i].Opcode); return GL_FALSE; } } -- cgit v1.2.3 From 8690c6a6b4fb0b48e2ae75cd0f64de86b039081c Mon Sep 17 00:00:00 2001 From: michal Date: Wed, 18 Aug 2010 13:16:42 +0200 Subject: gallivm: Use proper index to lookup predicate register array. Doesn't fix anything, as those indices were both always 0. --- src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c index 0aa64affac..ca8db9ce01 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c @@ -802,7 +802,7 @@ emit_store( case TGSI_FILE_PREDICATE: lp_exec_mask_store(&bld->exec_mask, pred, value, - bld->preds[index][chan_index]); + bld->preds[reg->Register.Index][chan_index]); break; default: -- cgit v1.2.3 From d442a01ac14382d83cdaac87d2832315ceb3e963 Mon Sep 17 00:00:00 2001 From: Andre Maasikas Date: Wed, 18 Aug 2010 14:14:38 +0300 Subject: r600: implement SSG instruction --- src/mesa/drivers/dri/r600/r700_assembler.c | 66 ++++++++++++++++++++++++++++++ src/mesa/drivers/dri/r600/r700_assembler.h | 1 + 2 files changed, 67 insertions(+) (limited to 'src') diff --git a/src/mesa/drivers/dri/r600/r700_assembler.c b/src/mesa/drivers/dri/r600/r700_assembler.c index 4902f7630c..247617408c 100644 --- a/src/mesa/drivers/dri/r600/r700_assembler.c +++ b/src/mesa/drivers/dri/r600/r700_assembler.c @@ -4369,6 +4369,65 @@ GLboolean assemble_SLT(r700_AssemblerBase *pAsm) return GL_TRUE; } +GLboolean assemble_SSG(r700_AssemblerBase *pAsm) +{ + checkop1(pAsm); + + GLuint tmp = gethelpr(pAsm); + /* tmp = (src > 0 ? 1 : src) */ + pAsm->D.dst.opcode = SQ_OP3_INST_CNDGT; + pAsm->D.dst.op3 = 1; + pAsm->D.dst.rtype = DST_REG_TEMPORARY; + pAsm->D.dst.reg = tmp; + + if( GL_FALSE == assemble_src(pAsm, 0, -1) ) + { + return GL_FALSE; + } + + setswizzle_PVSSRC(&(pAsm->S[1].src), SQ_SEL_1); + + if( GL_FALSE == assemble_src(pAsm, 0, 2) ) + { + return GL_FALSE; + } + + if( GL_FALSE == next_ins(pAsm) ) + { + return GL_FALSE; + } + + /* dst = (-tmp > 0 ? -1 : tmp) */ + pAsm->D.dst.opcode = SQ_OP3_INST_CNDGT; + pAsm->D.dst.op3 = 1; + + if( GL_FALSE == assemble_dst(pAsm) ) + { + return GL_FALSE; + } + + setaddrmode_PVSSRC(&(pAsm->S[0].src), ADDR_ABSOLUTE); + pAsm->S[0].src.rtype = SRC_REG_TEMPORARY; + pAsm->S[0].src.reg = tmp; + noswizzle_PVSSRC(&(pAsm->S[0].src)); + neg_PVSSRC(&(pAsm->S[0].src)); + + setswizzle_PVSSRC(&(pAsm->S[1].src), SQ_SEL_1); + neg_PVSSRC(&(pAsm->S[1].src)); + + setaddrmode_PVSSRC(&(pAsm->S[2].src), ADDR_ABSOLUTE); + pAsm->S[2].src.rtype = SRC_REG_TEMPORARY; + pAsm->S[2].src.reg = tmp; + noswizzle_PVSSRC(&(pAsm->S[2].src)); + + if( GL_FALSE == next_ins(pAsm) ) + { + return GL_FALSE; + } + + return GL_TRUE; +} + GLboolean assemble_STP(r700_AssemblerBase *pAsm) { return GL_TRUE; @@ -5893,6 +5952,13 @@ GLboolean AssembleInstr(GLuint uiFirstInst, // return GL_FALSE; // break; + case OPCODE_SSG: + if ( GL_FALSE == assemble_SSG(pR700AsmCode) ) + { + return GL_FALSE; + } + break; + case OPCODE_SWZ: if ( GL_FALSE == assemble_MOV(pR700AsmCode) ) { diff --git a/src/mesa/drivers/dri/r600/r700_assembler.h b/src/mesa/drivers/dri/r600/r700_assembler.h index ab954ec143..f00f4da847 100644 --- a/src/mesa/drivers/dri/r600/r700_assembler.h +++ b/src/mesa/drivers/dri/r600/r700_assembler.h @@ -625,6 +625,7 @@ GLboolean assemble_LOGIC_PRED(r700_AssemblerBase *pAsm, BITS opcode); GLboolean assemble_TRIG(r700_AssemblerBase *pAsm, BITS opcode); GLboolean assemble_SLT(r700_AssemblerBase *pAsm); +GLboolean assemble_SSG(r700_AssemblerBase *pAsm); GLboolean assemble_STP(r700_AssemblerBase *pAsm); GLboolean assemble_TEX(r700_AssemblerBase *pAsm); GLboolean assemble_XPD(r700_AssemblerBase *pAsm); -- cgit v1.2.3 From d12cb77d85ec726a67c2099c4105df63829b45a4 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Wed, 18 Aug 2010 12:06:25 -0700 Subject: ir_constant_expression: Implement equal/notEqual for booleans. Calls to equal(bvec, bvec) or notEqual(bvec, bvec) previously caused an assertion. Fixes piglit tests glsl-const-builtin-equal-bool and glsl-const-builtin-notEqual-bool. --- src/glsl/ir_constant_expression.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src') diff --git a/src/glsl/ir_constant_expression.cpp b/src/glsl/ir_constant_expression.cpp index 0a924246da..54f14d1a54 100644 --- a/src/glsl/ir_constant_expression.cpp +++ b/src/glsl/ir_constant_expression.cpp @@ -904,6 +904,9 @@ ir_call::constant_expression_value() case GLSL_TYPE_FLOAT: data.b[c] = op[0]->value.f[c] == op[1]->value.f[c]; break; + case GLSL_TYPE_BOOL: + data.b[c] = op[0]->value.b[c] == op[1]->value.b[c]; + break; default: assert(!"Should not get here."); } @@ -1047,6 +1050,9 @@ ir_call::constant_expression_value() case GLSL_TYPE_FLOAT: data.b[c] = op[0]->value.f[c] != op[1]->value.f[c]; break; + case GLSL_TYPE_BOOL: + data.b[c] = op[0]->value.b[c] != op[1]->value.b[c]; + break; default: assert(!"Should not get here."); } -- cgit v1.2.3 From 08a84c6a4aa8f69af6b6981f62d81dd0424dae4a Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Wed, 18 Aug 2010 13:16:50 -0700 Subject: glsl/builtins: Add forgotten hyperbolic trig builtins in 1.30 profiles. --- src/glsl/builtins/profiles/130.frag | 32 ++++++++++++++++++++++++++++++++ src/glsl/builtins/profiles/130.vert | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 64 insertions(+) (limited to 'src') diff --git a/src/glsl/builtins/profiles/130.frag b/src/glsl/builtins/profiles/130.frag index 39c73c4eef..aa7a6adb1d 100644 --- a/src/glsl/builtins/profiles/130.frag +++ b/src/glsl/builtins/profiles/130.frag @@ -47,6 +47,38 @@ vec2 atan(vec2 y_over_x); vec3 atan(vec3 y_over_x); vec4 atan(vec4 y_over_x); +float sinh(float x); +vec2 sinh(vec2 x); +vec3 sinh(vec3 x); +vec4 sinh(vec4 x); + +float cosh(float x); +vec2 cosh(vec2 x); +vec3 cosh(vec3 x); +vec4 cosh(vec4 x); + +float tanh(float x); +vec2 tanh(vec2 x); +vec3 tanh(vec3 x); +vec4 tanh(vec4 x); + +#if 0 +float asinh(float x); +vec2 asinh(vec2 x); +vec3 asinh(vec3 x); +vec4 asinh(vec4 x); + +float acosh(float x); +vec2 acosh(vec2 x); +vec3 acosh(vec3 x); +vec4 acosh(vec4 x); + +float atanh(float x); +vec2 atanh(vec2 x); +vec3 atanh(vec3 x); +vec4 atanh(vec4 x); +#endif + /* * 8.2 - Exponential Functions */ diff --git a/src/glsl/builtins/profiles/130.vert b/src/glsl/builtins/profiles/130.vert index 1aaad190d5..d0152b0374 100644 --- a/src/glsl/builtins/profiles/130.vert +++ b/src/glsl/builtins/profiles/130.vert @@ -47,6 +47,38 @@ vec2 atan(vec2 y_over_x); vec3 atan(vec3 y_over_x); vec4 atan(vec4 y_over_x); +float sinh(float x); +vec2 sinh(vec2 x); +vec3 sinh(vec3 x); +vec4 sinh(vec4 x); + +float cosh(float x); +vec2 cosh(vec2 x); +vec3 cosh(vec3 x); +vec4 cosh(vec4 x); + +float tanh(float x); +vec2 tanh(vec2 x); +vec3 tanh(vec3 x); +vec4 tanh(vec4 x); + +#if 0 +float asinh(float x); +vec2 asinh(vec2 x); +vec3 asinh(vec3 x); +vec4 asinh(vec4 x); + +float acosh(float x); +vec2 acosh(vec2 x); +vec3 acosh(vec3 x); +vec4 acosh(vec4 x); + +float atanh(float x); +vec2 atanh(vec2 x); +vec3 atanh(vec3 x); +vec4 atanh(vec4 x); +#endif + /* * 8.2 - Exponential Functions */ -- cgit v1.2.3 From 011be6b5948e66adb468aef292a7c8e9be600a89 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Wed, 18 Aug 2010 13:17:27 -0700 Subject: generate_builtins.py: Clean up generated output a bit. This should make it easier to diff the output, clean up some of the insane whitespace, and make the strings a bit smaller. We'll probably need to split up the prototype strings eventually, but for now, this gets it under the 65K mark. --- src/glsl/builtins/tools/generate_builtins.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src') diff --git a/src/glsl/builtins/tools/generate_builtins.py b/src/glsl/builtins/tools/generate_builtins.py index 2eb67e398a..6c3892269a 100755 --- a/src/glsl/builtins/tools/generate_builtins.py +++ b/src/glsl/builtins/tools/generate_builtins.py @@ -38,6 +38,14 @@ def run_compiler(args): command = [compiler_path, '--dump-lir'] + args p = Popen(command, 1, stdout=PIPE, shell=False) output = p.communicate()[0] + + # Clean up output a bit by killing whitespace before a closing paren. + kill_paren_whitespace = re.compile(r'[ \n]*\)', re.MULTILINE); + output = kill_paren_whitespace.sub(')', output); + + # Also toss any duplicate newlines + output = output.replace('\n\n', '\n') + return (output, p.returncode) def write_profile(filename, profile): @@ -51,6 +59,10 @@ def write_profile(filename, profile): kill_globals = re.compile(r'^\(declare.*\n', re.MULTILINE); proto_ir = kill_globals.sub('', proto_ir) + # Kill pointer addresses. They're not necessary in prototypes and just + # clutter the diff output. + proto_ir = re.sub(r'@0x[0-9a-f]+', '', proto_ir); + print 'static const char *prototypes_for_' + profile + ' =' print stringify(proto_ir), ';' -- cgit v1.2.3 From cf37ba34301374aecf16fea659ac70b000a11a55 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Wed, 18 Aug 2010 13:20:58 -0700 Subject: glsl: Refresh autogenerated file builtin_function.cpp. --- src/glsl/builtin_function.cpp | 20951 +++++++++++++--------------------------- 1 file changed, 6743 insertions(+), 14208 deletions(-) (limited to 'src') diff --git a/src/glsl/builtin_function.cpp b/src/glsl/builtin_function.cpp index 8f375cf47d..b4138d0af7 100644 --- a/src/glsl/builtin_function.cpp +++ b/src/glsl/builtin_function.cpp @@ -4718,2413 +4718,1414 @@ static const char *prototypes_for_120_vert = "(function radians\n" " (signature float\n" " (parameters\n" - " (declare (in ) float degrees@0x1db60b0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float degrees))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 degrees@0x1db6430)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 degrees))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 degrees@0x1db6610)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 degrees))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 degrees@0x1db67f0)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 degrees))\n" + " ()))\n" "(function degrees\n" " (signature float\n" " (parameters\n" - " (declare (in ) float radians@0x1db69d0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float radians))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 radians@0x1db6d50)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 radians))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 radians@0x1db6f30)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 radians))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 radians@0x1db7110)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 radians))\n" + " ()))\n" "(function sin\n" " (signature float\n" " (parameters\n" - " (declare (in ) float angle@0x1db72f0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float angle))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 angle@0x1db7670)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 angle))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 angle@0x1db7850)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 angle))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 angle@0x1db7a30)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 angle))\n" + " ()))\n" "(function cos\n" " (signature float\n" " (parameters\n" - " (declare (in ) float angle@0x1db7c10)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float angle))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 angle@0x1db7f90)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 angle))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 angle@0x1db8170)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 angle))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 angle@0x1db8350)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 angle))\n" + " ()))\n" "(function tan\n" " (signature float\n" " (parameters\n" - " (declare (in ) float angle@0x1db8530)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float angle))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 angle@0x1db88b0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 angle))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 angle@0x1db8a90)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 angle))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 angle@0x1db8c70)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 angle))\n" + " ()))\n" "(function asin\n" " (signature float\n" " (parameters\n" - " (declare (in ) float angle@0x1db8e50)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float angle))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 angle@0x1db91d0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 angle))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 angle@0x1db93b0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 angle))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 angle@0x1db9590)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 angle))\n" + " ()))\n" "(function acos\n" " (signature float\n" " (parameters\n" - " (declare (in ) float angle@0x1db9770)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float angle))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 angle@0x1db9af0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 angle))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 angle@0x1db9cd0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 angle))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 angle@0x1db9eb0)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 angle))\n" + " ()))\n" "(function atan\n" " (signature float\n" " (parameters\n" - " (declare (in ) float y@0x1dba090)\n" - " (declare (in ) float x@0x1dba1a0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float y)\n" + " (declare (in) float x))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 y@0x1dba520)\n" - " (declare (in ) vec2 x@0x1dba630)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 y)\n" + " (declare (in) vec2 x))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 y@0x1dba810)\n" - " (declare (in ) vec3 x@0x1dba920)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 y)\n" + " (declare (in) vec3 x))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 y@0x1dbab00)\n" - " (declare (in ) vec4 x@0x1dbac10)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec4 y)\n" + " (declare (in) vec4 x))\n" + " ())\n" " (signature float\n" " (parameters\n" - " (declare (in ) float y_over_x@0x1dbadf0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float y_over_x))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 y_over_x@0x1dbafe0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 y_over_x))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 y_over_x@0x1dbb1d0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 y_over_x))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 y_over_x@0x1dbb3c0)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 y_over_x))\n" + " ()))\n" "(function pow\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x1dbb5b0)\n" - " (declare (in ) float y@0x1dbb6c0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float x)\n" + " (declare (in) float y))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x1dbba40)\n" - " (declare (in ) vec2 y@0x1dbbb50)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x1dbbd30)\n" - " (declare (in ) vec3 y@0x1dbbe40)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x1dbc020)\n" - " (declare (in ) vec4 y@0x1dbc130)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" + " ()))\n" "(function exp\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x1dbc310)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float x))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x1dbc690)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x1dbc870)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x1dbca50)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 x))\n" + " ()))\n" "(function log\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x1dbcc30)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float x))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x1dbcfb0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x1dbd190)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x1dbd370)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 x))\n" + " ()))\n" "(function exp2\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x1dbd550)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float x))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x1dbd8d0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x1dbdab0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x1dbdc90)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 x))\n" + " ()))\n" "(function log2\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x1dbde70)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float x))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x1dbe1f0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x1dbe3d0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x1dbe5b0)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 x))\n" + " ()))\n" "(function sqrt\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x1dbe790)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float x))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x1dbeb10)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x1dbecf0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x1dbeed0)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 x))\n" + " ()))\n" "(function inversesqrt\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x1dbf0b0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float x))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x1dbf440)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x1dbf620)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x1dbf800)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 x))\n" + " ()))\n" "(function abs\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x1dbf9e0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float x))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x1dbfd60)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x1dbff40)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x1dc0120)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 x))\n" + " ()))\n" "(function sign\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x1dc0300)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float x))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x1dc0680)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x1dc0860)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x1dc0a40)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 x))\n" + " ()))\n" "(function floor\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x1dc0c20)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float x))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x1dc0fa0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x1dc1180)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x1dc1360)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 x))\n" + " ()))\n" "(function ceil\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x1dc1540)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float x))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x1dc18c0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x1dc1aa0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x1dc1c80)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 x))\n" + " ()))\n" "(function fract\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x1dc1e60)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float x))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x1dc21e0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x1dc23c0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x1dc25a0)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 x))\n" + " ()))\n" "(function mod\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x1dc2780)\n" - " (declare (in ) float y@0x1dc2890)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float x)\n" + " (declare (in) float y))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x1dc2c10)\n" - " (declare (in ) float y@0x1dc2d20)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x)\n" + " (declare (in) float y))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x1dc2f00)\n" - " (declare (in ) float y@0x1dc3010)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x)\n" + " (declare (in) float y))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x1dc31f0)\n" - " (declare (in ) float y@0x1dc3300)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec4 x)\n" + " (declare (in) float y))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x1dc34e0)\n" - " (declare (in ) vec2 y@0x1dc35f0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x1dc37d0)\n" - " (declare (in ) vec3 y@0x1dc38e0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x1dc3ac0)\n" - " (declare (in ) vec4 y@0x1dc3bd0)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" + " ()))\n" "(function min\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x1dc3db0)\n" - " (declare (in ) float y@0x1dc3ec0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float x)\n" + " (declare (in) float y))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x1dc4240)\n" - " (declare (in ) vec2 y@0x1dc4350)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x1dc4530)\n" - " (declare (in ) vec3 y@0x1dc4640)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x1dc4820)\n" - " (declare (in ) vec4 y@0x1dc4930)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x1dc4b10)\n" - " (declare (in ) float y@0x1dc4c20)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x)\n" + " (declare (in) float y))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x1dc4e00)\n" - " (declare (in ) float y@0x1dc4f10)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x)\n" + " (declare (in) float y))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x1dc50f0)\n" - " (declare (in ) float y@0x1dc5200)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 x)\n" + " (declare (in) float y))\n" + " ()))\n" "(function max\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x1dc53e0)\n" - " (declare (in ) float y@0x1dc54f0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float x)\n" + " (declare (in) float y))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x1dc5870)\n" - " (declare (in ) vec2 y@0x1dc5980)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x1dc5b60)\n" - " (declare (in ) vec3 y@0x1dc5c70)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x1dc5e50)\n" - " (declare (in ) vec4 y@0x1dc5f60)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x1dc6140)\n" - " (declare (in ) float y@0x1dc6250)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x)\n" + " (declare (in) float y))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x1dc6430)\n" - " (declare (in ) float y@0x1dc6540)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x)\n" + " (declare (in) float y))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x1dc6720)\n" - " (declare (in ) float y@0x1dc6830)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 x)\n" + " (declare (in) float y))\n" + " ()))\n" "(function clamp\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x1dc6a10)\n" - " (declare (in ) float minVal@0x1dc6b20)\n" - " (declare (in ) float maxVal@0x1dc6c30)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float x)\n" + " (declare (in) float minVal)\n" + " (declare (in) float maxVal))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x1dc6fb0)\n" - " (declare (in ) vec2 minVal@0x1dc70c0)\n" - " (declare (in ) vec2 maxVal@0x1dc71d0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 minVal)\n" + " (declare (in) vec2 maxVal))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x1dc73b0)\n" - " (declare (in ) vec3 minVal@0x1dc74c0)\n" - " (declare (in ) vec3 maxVal@0x1dc75d0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 minVal)\n" + " (declare (in) vec3 maxVal))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x1dc77b0)\n" - " (declare (in ) vec4 minVal@0x1dc78c0)\n" - " (declare (in ) vec4 maxVal@0x1dc79d0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 minVal)\n" + " (declare (in) vec4 maxVal))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x1dc7bb0)\n" - " (declare (in ) float minVal@0x1dc7cc0)\n" - " (declare (in ) float maxVal@0x1dc7dd0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x)\n" + " (declare (in) float minVal)\n" + " (declare (in) float maxVal))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x1dc7fb0)\n" - " (declare (in ) float minVal@0x1dc80c0)\n" - " (declare (in ) float maxVal@0x1dc81d0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x)\n" + " (declare (in) float minVal)\n" + " (declare (in) float maxVal))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x1dc83b0)\n" - " (declare (in ) float minVal@0x1dc84c0)\n" - " (declare (in ) float maxVal@0x1dc85d0)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 x)\n" + " (declare (in) float minVal)\n" + " (declare (in) float maxVal))\n" + " ()))\n" "(function mix\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x1dc87b0)\n" - " (declare (in ) float y@0x1dc88c0)\n" - " (declare (in ) float a@0x1dc89d0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float x)\n" + " (declare (in) float y)\n" + " (declare (in) float a))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x1dc8d50)\n" - " (declare (in ) vec2 y@0x1dc8e60)\n" - " (declare (in ) vec2 a@0x1dc8f70)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y)\n" + " (declare (in) vec2 a))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x1dc9150)\n" - " (declare (in ) vec3 y@0x1dc9260)\n" - " (declare (in ) vec3 a@0x1dc9370)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y)\n" + " (declare (in) vec3 a))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x1dc9550)\n" - " (declare (in ) vec4 y@0x1dc9660)\n" - " (declare (in ) vec4 a@0x1dc9770)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y)\n" + " (declare (in) vec4 a))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x1dc9950)\n" - " (declare (in ) vec2 y@0x1dc9a60)\n" - " (declare (in ) float a@0x1dc9b70)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y)\n" + " (declare (in) float a))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x1dc9d50)\n" - " (declare (in ) vec3 y@0x1dc9e60)\n" - " (declare (in ) float a@0x1dc9f70)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y)\n" + " (declare (in) float a))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x1dca150)\n" - " (declare (in ) vec4 y@0x1dca260)\n" - " (declare (in ) float a@0x1dca370)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y)\n" + " (declare (in) float a))\n" + " ()))\n" "(function step\n" " (signature float\n" " (parameters\n" - " (declare (in ) float edge@0x1dca550)\n" - " (declare (in ) float x@0x1dca660)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float edge)\n" + " (declare (in) float x))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 edge@0x1dca9e0)\n" - " (declare (in ) vec2 x@0x1dcaaf0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 edge)\n" + " (declare (in) vec2 x))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 edge@0x1dcacd0)\n" - " (declare (in ) vec3 x@0x1dcade0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 edge)\n" + " (declare (in) vec3 x))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 edge@0x1dcafc0)\n" - " (declare (in ) vec4 x@0x1dcb0d0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec4 edge)\n" + " (declare (in) vec4 x))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) float edge@0x1dcb2b0)\n" - " (declare (in ) vec2 x@0x1dcb3c0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float edge)\n" + " (declare (in) vec2 x))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) float edge@0x1dcb5a0)\n" - " (declare (in ) vec3 x@0x1dcb6b0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float edge)\n" + " (declare (in) vec3 x))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) float edge@0x1dcb890)\n" - " (declare (in ) vec4 x@0x1dcb9a0)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) float edge)\n" + " (declare (in) vec4 x))\n" + " ()))\n" "(function smoothstep\n" " (signature float\n" " (parameters\n" - " (declare (in ) float edge0@0x1dcbb80)\n" - " (declare (in ) float edge1@0x1dcbc90)\n" - " (declare (in ) float x@0x1dcbda0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float edge0)\n" + " (declare (in) float edge1)\n" + " (declare (in) float x))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 edge0@0x1dcc130)\n" - " (declare (in ) vec2 edge1@0x1dcc240)\n" - " (declare (in ) vec2 x@0x1dcc350)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 edge0)\n" + " (declare (in) vec2 edge1)\n" + " (declare (in) vec2 x))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 edge0@0x1dcc530)\n" - " (declare (in ) vec3 edge1@0x1dcc640)\n" - " (declare (in ) vec3 x@0x1dcc750)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 edge0)\n" + " (declare (in) vec3 edge1)\n" + " (declare (in) vec3 x))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 edge0@0x1dcc930)\n" - " (declare (in ) vec4 edge1@0x1dcca40)\n" - " (declare (in ) vec4 x@0x1dccb50)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec4 edge0)\n" + " (declare (in) vec4 edge1)\n" + " (declare (in) vec4 x))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) float edge0@0x1dccd30)\n" - " (declare (in ) float edge1@0x1dcce40)\n" - " (declare (in ) vec2 x@0x1dccf50)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float edge0)\n" + " (declare (in) float edge1)\n" + " (declare (in) vec2 x))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) float edge0@0x1dcd130)\n" - " (declare (in ) float edge1@0x1dcd240)\n" - " (declare (in ) vec3 x@0x1dcd350)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float edge0)\n" + " (declare (in) float edge1)\n" + " (declare (in) vec3 x))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) float edge0@0x1dcd530)\n" - " (declare (in ) float edge1@0x1dcd640)\n" - " (declare (in ) vec4 x@0x1dcd750)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) float edge0)\n" + " (declare (in) float edge1)\n" + " (declare (in) vec4 x))\n" + " ()))\n" "(function length\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x1dcd930)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float x))\n" + " ())\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec2 x@0x1dcdcb0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x))\n" + " ())\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec3 x@0x1dcde90)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x))\n" + " ())\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec4 x@0x1dce070)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 x))\n" + " ()))\n" "(function distance\n" " (signature float\n" " (parameters\n" - " (declare (in ) float p0@0x1dce250)\n" - " (declare (in ) float p1@0x1dce360)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float p0)\n" + " (declare (in) float p1))\n" + " ())\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec2 p0@0x1dce6f0)\n" - " (declare (in ) vec2 p1@0x1dce800)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 p0)\n" + " (declare (in) vec2 p1))\n" + " ())\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec3 p0@0x1dce9e0)\n" - " (declare (in ) vec3 p1@0x1dceaf0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 p0)\n" + " (declare (in) vec3 p1))\n" + " ())\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec4 p0@0x1dcecd0)\n" - " (declare (in ) vec4 p1@0x1dcede0)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 p0)\n" + " (declare (in) vec4 p1))\n" + " ()))\n" "(function dot\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x1dcefc0)\n" - " (declare (in ) float y@0x1dcf0d0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float x)\n" + " (declare (in) float y))\n" + " ())\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec2 x@0x1dcf450)\n" - " (declare (in ) vec2 y@0x1dcf560)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" + " ())\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec3 x@0x1dcf740)\n" - " (declare (in ) vec3 y@0x1dcf850)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ())\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec4 x@0x1dcfa30)\n" - " (declare (in ) vec4 y@0x1dcfb40)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" + " ()))\n" "(function cross\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x1dcfd20)\n" - " (declare (in ) vec3 y@0x1dcfe30)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ()))\n" "(function normalize\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x1dd01b0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float x))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x1dd0540)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x1dd0720)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x1dd0900)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 x))\n" + " ()))\n" "(function ftransform\n" " (signature vec4\n" - " (parameters\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (parameters)\n" + " ()))\n" "(function faceforward\n" " (signature float\n" " (parameters\n" - " (declare (in ) float N@0x1dd0d60)\n" - " (declare (in ) float I@0x1dd0e70)\n" - " (declare (in ) float Nref@0x1dd0f80)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float N)\n" + " (declare (in) float I)\n" + " (declare (in) float Nref))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 N@0x1dd1310)\n" - " (declare (in ) vec2 I@0x1dd1420)\n" - " (declare (in ) vec2 Nref@0x1dd1530)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 N)\n" + " (declare (in) vec2 I)\n" + " (declare (in) vec2 Nref))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 N@0x1dd1710)\n" - " (declare (in ) vec3 I@0x1dd1820)\n" - " (declare (in ) vec3 Nref@0x1dd1930)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 N)\n" + " (declare (in) vec3 I)\n" + " (declare (in) vec3 Nref))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 N@0x1dd1b10)\n" - " (declare (in ) vec4 I@0x1dd1c20)\n" - " (declare (in ) vec4 Nref@0x1dd1d30)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 N)\n" + " (declare (in) vec4 I)\n" + " (declare (in) vec4 Nref))\n" + " ()))\n" "(function reflect\n" " (signature float\n" " (parameters\n" - " (declare (in ) float I@0x1dd1f10)\n" - " (declare (in ) float N@0x1dd2020)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float I)\n" + " (declare (in) float N))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 I@0x1dd23a0)\n" - " (declare (in ) vec2 N@0x1dd24b0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 I)\n" + " (declare (in) vec2 N))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 I@0x1dd2690)\n" - " (declare (in ) vec3 N@0x1dd27a0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 I)\n" + " (declare (in) vec3 N))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 I@0x1dd2980)\n" - " (declare (in ) vec4 N@0x1dd2a90)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 I)\n" + " (declare (in) vec4 N))\n" + " ()))\n" "(function refract\n" " (signature float\n" " (parameters\n" - " (declare (in ) float I@0x1dd2c70)\n" - " (declare (in ) float N@0x1dd2d80)\n" - " (declare (in ) float eta@0x1dd2e90)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float I)\n" + " (declare (in) float N)\n" + " (declare (in) float eta))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 I@0x1dd3210)\n" - " (declare (in ) vec2 N@0x1dd3320)\n" - " (declare (in ) float eta@0x1dd3430)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 I)\n" + " (declare (in) vec2 N)\n" + " (declare (in) float eta))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 I@0x1dd3610)\n" - " (declare (in ) vec3 N@0x1dd3720)\n" - " (declare (in ) float eta@0x1dd3830)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 I)\n" + " (declare (in) vec3 N)\n" + " (declare (in) float eta))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 I@0x1dd3a10)\n" - " (declare (in ) vec4 N@0x1dd3b20)\n" - " (declare (in ) float eta@0x1dd3c30)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 I)\n" + " (declare (in) vec4 N)\n" + " (declare (in) float eta))\n" + " ()))\n" "(function matrixCompMult\n" " (signature mat2\n" " (parameters\n" - " (declare (in ) mat2 x@0x1dd3e10)\n" - " (declare (in ) mat2 y@0x1dd3f20)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) mat2 x)\n" + " (declare (in) mat2 y))\n" + " ())\n" " (signature mat3\n" " (parameters\n" - " (declare (in ) mat3 x@0x1dd42b0)\n" - " (declare (in ) mat3 y@0x1dd43c0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) mat3 x)\n" + " (declare (in) mat3 y))\n" + " ())\n" " (signature mat4\n" " (parameters\n" - " (declare (in ) mat4 x@0x1dd45a0)\n" - " (declare (in ) mat4 y@0x1dd46b0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) mat4 x)\n" + " (declare (in) mat4 y))\n" + " ())\n" " (signature mat2x3\n" " (parameters\n" - " (declare (in ) mat2x3 x@0x1dd4890)\n" - " (declare (in ) mat2x3 y@0x1dd49a0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) mat2x3 x)\n" + " (declare (in) mat2x3 y))\n" + " ())\n" " (signature mat2x4\n" " (parameters\n" - " (declare (in ) mat2x4 x@0x1dd4b80)\n" - " (declare (in ) mat2x4 y@0x1dd4c90)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) mat2x4 x)\n" + " (declare (in) mat2x4 y))\n" + " ())\n" " (signature mat3x2\n" " (parameters\n" - " (declare (in ) mat3x2 x@0x1dd4e70)\n" - " (declare (in ) mat3x2 y@0x1dd4f80)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) mat3x2 x)\n" + " (declare (in) mat3x2 y))\n" + " ())\n" " (signature mat3x4\n" " (parameters\n" - " (declare (in ) mat3x4 x@0x1dd5160)\n" - " (declare (in ) mat3x4 y@0x1dd5270)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) mat3x4 x)\n" + " (declare (in) mat3x4 y))\n" + " ())\n" " (signature mat4x2\n" " (parameters\n" - " (declare (in ) mat4x2 x@0x1dd5450)\n" - " (declare (in ) mat4x2 y@0x1dd5560)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) mat4x2 x)\n" + " (declare (in) mat4x2 y))\n" + " ())\n" " (signature mat4x3\n" " (parameters\n" - " (declare (in ) mat4x3 x@0x1dd5740)\n" - " (declare (in ) mat4x3 y@0x1dd5850)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) mat4x3 x)\n" + " (declare (in) mat4x3 y))\n" + " ()))\n" "(function outerProduct\n" " (signature mat2\n" " (parameters\n" - " (declare (in ) vec2 c@0x1dd5a30)\n" - " (declare (in ) vec2 r@0x1dd5b40)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 c)\n" + " (declare (in) vec2 r))\n" + " ())\n" " (signature mat3\n" " (parameters\n" - " (declare (in ) vec3 c@0x1dd5ed0)\n" - " (declare (in ) vec3 r@0x1dd5fe0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 c)\n" + " (declare (in) vec3 r))\n" + " ())\n" " (signature mat4\n" " (parameters\n" - " (declare (in ) vec4 c@0x1dd61c0)\n" - " (declare (in ) vec4 r@0x1dd62d0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec4 c)\n" + " (declare (in) vec4 r))\n" + " ())\n" " (signature mat2x3\n" " (parameters\n" - " (declare (in ) vec3 c@0x1dd64b0)\n" - " (declare (in ) vec2 r@0x1dd65c0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 c)\n" + " (declare (in) vec2 r))\n" + " ())\n" " (signature mat3x2\n" " (parameters\n" - " (declare (in ) vec2 c@0x1dd67a0)\n" - " (declare (in ) vec3 r@0x1dd68b0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 c)\n" + " (declare (in) vec3 r))\n" + " ())\n" " (signature mat2x4\n" " (parameters\n" - " (declare (in ) vec4 c@0x1dd6a90)\n" - " (declare (in ) vec2 r@0x1dd6ba0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec4 c)\n" + " (declare (in) vec2 r))\n" + " ())\n" " (signature mat4x2\n" " (parameters\n" - " (declare (in ) vec2 c@0x1dd6d80)\n" - " (declare (in ) vec4 r@0x1dd6e90)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 c)\n" + " (declare (in) vec4 r))\n" + " ())\n" " (signature mat3x4\n" " (parameters\n" - " (declare (in ) vec4 c@0x1dd7070)\n" - " (declare (in ) vec3 r@0x1dd7180)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec4 c)\n" + " (declare (in) vec3 r))\n" + " ())\n" " (signature mat4x3\n" " (parameters\n" - " (declare (in ) vec3 c@0x1dd7360)\n" - " (declare (in ) vec4 r@0x1dd7470)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec3 c)\n" + " (declare (in) vec4 r))\n" + " ()))\n" "(function transpose\n" " (signature mat2\n" " (parameters\n" - " (declare (in ) mat2 m@0x1dd7650)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) mat2 m))\n" + " ())\n" " (signature mat3\n" " (parameters\n" - " (declare (in ) mat3 m@0x1dd79e0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) mat3 m))\n" + " ())\n" " (signature mat4\n" " (parameters\n" - " (declare (in ) mat4 m@0x1dd7bc0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) mat4 m))\n" + " ())\n" " (signature mat2x3\n" " (parameters\n" - " (declare (in ) mat3x2 m@0x1dd7da0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) mat3x2 m))\n" + " ())\n" " (signature mat3x2\n" " (parameters\n" - " (declare (in ) mat2x3 m@0x1dd7f80)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) mat2x3 m))\n" + " ())\n" " (signature mat2x4\n" " (parameters\n" - " (declare (in ) mat4x2 m@0x1dd8160)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) mat4x2 m))\n" + " ())\n" " (signature mat4x2\n" " (parameters\n" - " (declare (in ) mat2x4 m@0x1dd8340)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) mat2x4 m))\n" + " ())\n" " (signature mat3x4\n" " (parameters\n" - " (declare (in ) mat4x3 m@0x1dd8520)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) mat4x3 m))\n" + " ())\n" " (signature mat4x3\n" " (parameters\n" - " (declare (in ) mat3x4 m@0x1dd8700)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) mat3x4 m))\n" + " ()))\n" "(function lessThan\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x1dd88e0)\n" - " (declare (in ) vec2 y@0x1dd89f0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" + " ())\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x1dd8d80)\n" - " (declare (in ) vec3 y@0x1dd8e90)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ())\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x1dd9070)\n" - " (declare (in ) vec4 y@0x1dd9180)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" + " ())\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) ivec2 x@0x1dd9360)\n" - " (declare (in ) ivec2 y@0x1dd9470)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) ivec2 x)\n" + " (declare (in) ivec2 y))\n" + " ())\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) ivec3 x@0x1dd9650)\n" - " (declare (in ) ivec3 y@0x1dd9760)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) ivec3 x)\n" + " (declare (in) ivec3 y))\n" + " ())\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) ivec4 x@0x1dd9940)\n" - " (declare (in ) ivec4 y@0x1dd9a50)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) ivec4 x)\n" + " (declare (in) ivec4 y))\n" + " ()))\n" "(function lessThanEqual\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x1dd9c30)\n" - " (declare (in ) vec2 y@0x1dd9d40)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" + " ())\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x1dda0d0)\n" - " (declare (in ) vec3 y@0x1dda1e0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ())\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x1dda3c0)\n" - " (declare (in ) vec4 y@0x1dda4d0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" + " ())\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) ivec2 x@0x1dda6b0)\n" - " (declare (in ) ivec2 y@0x1dda7c0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) ivec2 x)\n" + " (declare (in) ivec2 y))\n" + " ())\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) ivec3 x@0x1dda9a0)\n" - " (declare (in ) ivec3 y@0x1ddaab0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) ivec3 x)\n" + " (declare (in) ivec3 y))\n" + " ())\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) ivec4 x@0x1ddac90)\n" - " (declare (in ) ivec4 y@0x1ddada0)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) ivec4 x)\n" + " (declare (in) ivec4 y))\n" + " ()))\n" "(function greaterThan\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x1ddaf80)\n" - " (declare (in ) vec2 y@0x1ddb090)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" + " ())\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x1ddb420)\n" - " (declare (in ) vec3 y@0x1ddb530)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ())\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x1ddb710)\n" - " (declare (in ) vec4 y@0x1ddb820)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" + " ())\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) ivec2 x@0x1ddba00)\n" - " (declare (in ) ivec2 y@0x1ddbb10)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) ivec2 x)\n" + " (declare (in) ivec2 y))\n" + " ())\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) ivec3 x@0x1ddbcf0)\n" - " (declare (in ) ivec3 y@0x1ddbe00)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) ivec3 x)\n" + " (declare (in) ivec3 y))\n" + " ())\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) ivec4 x@0x1ddbfe0)\n" - " (declare (in ) ivec4 y@0x1ddc0f0)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) ivec4 x)\n" + " (declare (in) ivec4 y))\n" + " ()))\n" "(function greaterThanEqual\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x1ddc2d0)\n" - " (declare (in ) vec2 y@0x1ddc3e0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" + " ())\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x1ddc770)\n" - " (declare (in ) vec3 y@0x1ddc880)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ())\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x1ddca60)\n" - " (declare (in ) vec4 y@0x1ddcb70)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" + " ())\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) ivec2 x@0x1ddcd50)\n" - " (declare (in ) ivec2 y@0x1ddce60)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) ivec2 x)\n" + " (declare (in) ivec2 y))\n" + " ())\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) ivec3 x@0x1ddd040)\n" - " (declare (in ) ivec3 y@0x1ddd150)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) ivec3 x)\n" + " (declare (in) ivec3 y))\n" + " ())\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) ivec4 x@0x1ddd330)\n" - " (declare (in ) ivec4 y@0x1ddd440)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) ivec4 x)\n" + " (declare (in) ivec4 y))\n" + " ()))\n" "(function equal\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x1ddd620)\n" - " (declare (in ) vec2 y@0x1ddd730)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" + " ())\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x1dddab0)\n" - " (declare (in ) vec3 y@0x1dddbc0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ())\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x1dddda0)\n" - " (declare (in ) vec4 y@0x1dddeb0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" + " ())\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) ivec2 x@0x1dde090)\n" - " (declare (in ) ivec2 y@0x1dde1a0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) ivec2 x)\n" + " (declare (in) ivec2 y))\n" + " ())\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) ivec3 x@0x1dde380)\n" - " (declare (in ) ivec3 y@0x1dde490)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) ivec3 x)\n" + " (declare (in) ivec3 y))\n" + " ())\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) ivec4 x@0x1dde670)\n" - " (declare (in ) ivec4 y@0x1dde780)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) ivec4 x)\n" + " (declare (in) ivec4 y))\n" + " ())\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) bvec2 x@0x1dde960)\n" - " (declare (in ) bvec2 y@0x1ddea70)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) bvec2 x)\n" + " (declare (in) bvec2 y))\n" + " ())\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) bvec3 x@0x1ddec50)\n" - " (declare (in ) bvec3 y@0x1dded60)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) bvec3 x)\n" + " (declare (in) bvec3 y))\n" + " ())\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) bvec4 x@0x1ddef40)\n" - " (declare (in ) bvec4 y@0x1ddf050)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) bvec4 x)\n" + " (declare (in) bvec4 y))\n" + " ()))\n" "(function notEqual\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x1ddf230)\n" - " (declare (in ) vec2 y@0x1ddf340)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" + " ())\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x1ddf6d0)\n" - " (declare (in ) vec3 y@0x1ddf7e0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ())\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x1ddf9c0)\n" - " (declare (in ) vec4 y@0x1ddfad0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" + " ())\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) ivec2 x@0x1ddfcb0)\n" - " (declare (in ) ivec2 y@0x1ddfdc0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) ivec2 x)\n" + " (declare (in) ivec2 y))\n" + " ())\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) ivec3 x@0x1ddffa0)\n" - " (declare (in ) ivec3 y@0x1de00b0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) ivec3 x)\n" + " (declare (in) ivec3 y))\n" + " ())\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) ivec4 x@0x1de0290)\n" - " (declare (in ) ivec4 y@0x1de03a0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) ivec4 x)\n" + " (declare (in) ivec4 y))\n" + " ())\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) bvec2 x@0x1de0580)\n" - " (declare (in ) bvec2 y@0x1de0690)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) bvec2 x)\n" + " (declare (in) bvec2 y))\n" + " ())\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) bvec3 x@0x1de0870)\n" - " (declare (in ) bvec3 y@0x1de0980)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) bvec3 x)\n" + " (declare (in) bvec3 y))\n" + " ())\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) bvec4 x@0x1de0b60)\n" - " (declare (in ) bvec4 y@0x1de0c70)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) bvec4 x)\n" + " (declare (in) bvec4 y))\n" + " ()))\n" "(function any\n" " (signature bool\n" " (parameters\n" - " (declare (in ) bvec2 x@0x1de0e50)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) bvec2 x))\n" + " ())\n" " (signature bool\n" " (parameters\n" - " (declare (in ) bvec3 x@0x1de11d0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) bvec3 x))\n" + " ())\n" " (signature bool\n" " (parameters\n" - " (declare (in ) bvec4 x@0x1de13b0)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) bvec4 x))\n" + " ()))\n" "(function all\n" " (signature bool\n" " (parameters\n" - " (declare (in ) bvec2 x@0x1de1590)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) bvec2 x))\n" + " ())\n" " (signature bool\n" " (parameters\n" - " (declare (in ) bvec3 x@0x1de1910)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) bvec3 x))\n" + " ())\n" " (signature bool\n" " (parameters\n" - " (declare (in ) bvec4 x@0x1de1af0)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) bvec4 x))\n" + " ()))\n" "(function not\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) bvec2 x@0x1de1cd0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) bvec2 x))\n" + " ())\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) bvec3 x@0x1de2050)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) bvec3 x))\n" + " ())\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) bvec4 x@0x1de2230)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) bvec4 x))\n" + " ()))\n" "(function texture1D\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1D sampler@0x1de2410)\n" - " (declare (in ) float coord@0x1de2520)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) float coord))\n" + " ()))\n" "(function texture1DProj\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1D sampler@0x1de28b0)\n" - " (declare (in ) vec2 coord@0x1de29c0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) vec2 coord))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1D sampler@0x1de2d50)\n" - " (declare (in ) vec4 coord@0x1de2e60)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) vec4 coord))\n" + " ()))\n" "(function texture1DLod\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1D sampler@0x1de3040)\n" - " (declare (in ) float coord@0x1de3150)\n" - " (declare (in ) float lod@0x1de3260)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) float coord)\n" + " (declare (in) float lod))\n" + " ()))\n" "(function texture1DProjLod\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1D sampler@0x1de35f0)\n" - " (declare (in ) vec2 coord@0x1de3700)\n" - " (declare (in ) float lod@0x1de3810)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) vec2 coord)\n" + " (declare (in) float lod))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1D sampler@0x1de3ba0)\n" - " (declare (in ) vec4 coord@0x1de3cb0)\n" - " (declare (in ) float lod@0x1de3dc0)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) vec4 coord)\n" + " (declare (in) float lod))\n" + " ()))\n" "(function texture2D\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2D sampler@0x1de3fa0)\n" - " (declare (in ) vec2 coord@0x1de40b0)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec2 coord))\n" + " ()))\n" "(function texture2DProj\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2D sampler@0x1de4440)\n" - " (declare (in ) vec3 coord@0x1de4550)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec3 coord))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2D sampler@0x1de48e0)\n" - " (declare (in ) vec4 coord@0x1de49f0)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec4 coord))\n" + " ()))\n" "(function texture2DLod\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2D sampler@0x1de4bd0)\n" - " (declare (in ) vec2 coord@0x1de4ce0)\n" - " (declare (in ) float lod@0x1de4df0)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec2 coord)\n" + " (declare (in) float lod))\n" + " ()))\n" "(function texture2DProjLod\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2D sampler@0x1de5180)\n" - " (declare (in ) vec3 coord@0x1de5290)\n" - " (declare (in ) float lod@0x1de53a0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec3 coord)\n" + " (declare (in) float lod))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2D sampler@0x1de5730)\n" - " (declare (in ) vec4 coord@0x1de5840)\n" - " (declare (in ) float lod@0x1de5950)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec4 coord)\n" + " (declare (in) float lod))\n" + " ()))\n" "(function texture3D\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler3D sampler@0x1de5b30)\n" - " (declare (in ) vec3 coord@0x1de5c40)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) sampler3D sampler)\n" + " (declare (in) vec3 coord))\n" + " ()))\n" "(function texture3DProj\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler3D sampler@0x1de5fd0)\n" - " (declare (in ) vec4 coord@0x1de60e0)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) sampler3D sampler)\n" + " (declare (in) vec4 coord))\n" + " ()))\n" "(function texture3DLod\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler3D sampler@0x1de6470)\n" - " (declare (in ) vec3 coord@0x1de6580)\n" - " (declare (in ) float lod@0x1de6690)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) sampler3D sampler)\n" + " (declare (in) vec3 coord)\n" + " (declare (in) float lod))\n" + " ()))\n" "(function texture3DProjLod\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler3D sampler@0x1de6a20)\n" - " (declare (in ) vec4 coord@0x1de6b30)\n" - " (declare (in ) float lod@0x1de6c40)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) sampler3D sampler)\n" + " (declare (in) vec4 coord)\n" + " (declare (in) float lod))\n" + " ()))\n" "(function textureCube\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) samplerCube sampler@0x1de6fd0)\n" - " (declare (in ) vec3 coord@0x1de70e0)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) samplerCube sampler)\n" + " (declare (in) vec3 coord))\n" + " ()))\n" "(function textureCubeLod\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) samplerCube sampler@0x1de7470)\n" - " (declare (in ) vec3 coord@0x1de7580)\n" - " (declare (in ) float lod@0x1de7690)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) samplerCube sampler)\n" + " (declare (in) vec3 coord)\n" + " (declare (in) float lod))\n" + " ()))\n" "(function shadow1D\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1DShadow sampler@0x1de7a20)\n" - " (declare (in ) vec3 coord@0x1de7b30)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) sampler1DShadow sampler)\n" + " (declare (in) vec3 coord))\n" + " ()))\n" "(function shadow2D\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2DShadow sampler@0x1de7ec0)\n" - " (declare (in ) vec3 coord@0x1de7fd0)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) sampler2DShadow sampler)\n" + " (declare (in) vec3 coord))\n" + " ()))\n" "(function shadow1DProj\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1DShadow sampler@0x1de8360)\n" - " (declare (in ) vec4 coord@0x1de8470)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) sampler1DShadow sampler)\n" + " (declare (in) vec4 coord))\n" + " ()))\n" "(function shadow2DProj\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2DShadow sampler@0x1de8800)\n" - " (declare (in ) vec4 coord@0x1de8910)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) sampler2DShadow sampler)\n" + " (declare (in) vec4 coord))\n" + " ()))\n" "(function shadow1DLod\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1DShadow sampler@0x1de8ca0)\n" - " (declare (in ) vec3 coord@0x1de8db0)\n" - " (declare (in ) float lod@0x1de8ec0)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) sampler1DShadow sampler)\n" + " (declare (in) vec3 coord)\n" + " (declare (in) float lod))\n" + " ()))\n" "(function shadow2DLod\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2DShadow sampler@0x1de9250)\n" - " (declare (in ) vec3 coord@0x1de9360)\n" - " (declare (in ) float lod@0x1de9470)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) sampler2DShadow sampler)\n" + " (declare (in) vec3 coord)\n" + " (declare (in) float lod))\n" + " ()))\n" "(function shadow1DProjLod\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1DShadow sampler@0x1de9800)\n" - " (declare (in ) vec4 coord@0x1de9910)\n" - " (declare (in ) float lod@0x1de9a20)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) sampler1DShadow sampler)\n" + " (declare (in) vec4 coord)\n" + " (declare (in) float lod))\n" + " ()))\n" "(function shadow2DProjLod\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2DShadow sampler@0x1de9db0)\n" - " (declare (in ) vec4 coord@0x1de9ec0)\n" - " (declare (in ) float lod@0x1de9fd0)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) sampler2DShadow sampler)\n" + " (declare (in) vec4 coord)\n" + " (declare (in) float lod))\n" + " ()))\n" "(function noise1\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x1dea360)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float x))\n" + " ())\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec2 x@0x1dea6e0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x))\n" + " ())\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec3 x@0x1dea8c0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x))\n" + " ())\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec4 x@0x1deaaa0)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 x))\n" + " ()))\n" "(function noise2\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) float x@0x1deac80)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float x))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x1deb000)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec3 x@0x1deb1e0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec4 x@0x1deb3c0)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 x))\n" + " ()))\n" "(function noise3\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) float x@0x1deb5a0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float x))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec2 x@0x1deb920)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x1debb00)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec4 x@0x1debce0)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 x))\n" + " ()))\n" "(function noise4\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) float x@0x1debec0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float x))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec2 x@0x1dec240)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec3 x@0x1dec420)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x1dec600)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" - "\n" - ")" + " (declare (in) vec4 x))\n" + " ())))" ; static const char *functions_for_120_vert [] = { builtin_clamp, @@ -7207,76 +6208,45 @@ static const char *prototypes_for_EXT_texture_array_frag = "(function texture1DArray\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1DArray sampler@0xd79bd0)\n" - " (declare (in ) vec2 coord@0xd79ce0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler1DArray sampler)\n" + " (declare (in) vec2 coord))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1DArray sampler@0xd7a070)\n" - " (declare (in ) vec2 coord@0xd7a180)\n" - " (declare (in ) float bias@0xd7a290)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) sampler1DArray sampler)\n" + " (declare (in) vec2 coord)\n" + " (declare (in) float bias))\n" + " ()))\n" "(function texture2DArray\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2DArray sampler@0xd7a470)\n" - " (declare (in ) vec3 coord@0xd7a580)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler2DArray sampler)\n" + " (declare (in) vec3 coord))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2DArray sampler@0xd7a910)\n" - " (declare (in ) vec3 coord@0xd7aa20)\n" - " (declare (in ) float bias@0xd7ab30)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) sampler2DArray sampler)\n" + " (declare (in) vec3 coord)\n" + " (declare (in) float bias))\n" + " ()))\n" "(function shadow1DArray\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1DArrayShadow sampler@0xd7ad10)\n" - " (declare (in ) vec3 coord@0xd7ae20)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler1DArrayShadow sampler)\n" + " (declare (in) vec3 coord))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1DArrayShadow sampler@0xd7b1b0)\n" - " (declare (in ) vec3 coord@0xd7b2c0)\n" - " (declare (in ) float bias@0xd7b3d0)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) sampler1DArrayShadow sampler)\n" + " (declare (in) vec3 coord)\n" + " (declare (in) float bias))\n" + " ()))\n" "(function shadow2DArray\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2DArrayShadow sampler@0xd7b5b0)\n" - " (declare (in ) vec4 coord@0xd7b6c0)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" - "\n" - ")" + " (declare (in) sampler2DArrayShadow sampler)\n" + " (declare (in) vec4 coord))\n" + " ())))" ; static const char *functions_for_EXT_texture_array_frag [] = { builtin_shadow2DArray, @@ -7289,2224 +6259,1301 @@ static const char *prototypes_for_110_vert = "(function radians\n" " (signature float\n" " (parameters\n" - " (declare (in ) float degrees@0x26861c0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float degrees))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 degrees@0x2686540)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 degrees))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 degrees@0x2686720)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 degrees))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 degrees@0x2686900)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 degrees))\n" + " ()))\n" "(function degrees\n" " (signature float\n" " (parameters\n" - " (declare (in ) float radians@0x2686ae0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float radians))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 radians@0x2686e60)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 radians))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 radians@0x2687040)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 radians))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 radians@0x2687220)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 radians))\n" + " ()))\n" "(function sin\n" " (signature float\n" " (parameters\n" - " (declare (in ) float angle@0x2687400)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float angle))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 angle@0x2687780)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 angle))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 angle@0x2687960)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 angle))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 angle@0x2687b40)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 angle))\n" + " ()))\n" "(function cos\n" " (signature float\n" " (parameters\n" - " (declare (in ) float angle@0x2687d20)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float angle))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 angle@0x26880a0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 angle))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 angle@0x2688280)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 angle))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 angle@0x2688460)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 angle))\n" + " ()))\n" "(function tan\n" " (signature float\n" " (parameters\n" - " (declare (in ) float angle@0x2688640)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float angle))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 angle@0x26889c0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 angle))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 angle@0x2688ba0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 angle))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 angle@0x2688d80)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 angle))\n" + " ()))\n" "(function asin\n" " (signature float\n" " (parameters\n" - " (declare (in ) float angle@0x2688f60)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float angle))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 angle@0x26892e0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 angle))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 angle@0x26894c0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 angle))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 angle@0x26896a0)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 angle))\n" + " ()))\n" "(function acos\n" " (signature float\n" " (parameters\n" - " (declare (in ) float angle@0x2689880)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float angle))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 angle@0x2689c00)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 angle))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 angle@0x2689de0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 angle))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 angle@0x2689fc0)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 angle))\n" + " ()))\n" "(function atan\n" " (signature float\n" " (parameters\n" - " (declare (in ) float y@0x268a1a0)\n" - " (declare (in ) float x@0x268a2b0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float y)\n" + " (declare (in) float x))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 y@0x268a630)\n" - " (declare (in ) vec2 x@0x268a740)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 y)\n" + " (declare (in) vec2 x))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 y@0x268a920)\n" - " (declare (in ) vec3 x@0x268aa30)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 y)\n" + " (declare (in) vec3 x))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 y@0x268ac10)\n" - " (declare (in ) vec4 x@0x268ad20)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec4 y)\n" + " (declare (in) vec4 x))\n" + " ())\n" " (signature float\n" " (parameters\n" - " (declare (in ) float y_over_x@0x268af00)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float y_over_x))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 y_over_x@0x268b0f0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 y_over_x))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 y_over_x@0x268b2e0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 y_over_x))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 y_over_x@0x268b4d0)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 y_over_x))\n" + " ()))\n" "(function pow\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x268b6c0)\n" - " (declare (in ) float y@0x268b7d0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float x)\n" + " (declare (in) float y))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x268bb50)\n" - " (declare (in ) vec2 y@0x268bc60)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x268be40)\n" - " (declare (in ) vec3 y@0x268bf50)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x268c130)\n" - " (declare (in ) vec4 y@0x268c240)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" + " ()))\n" "(function exp\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x268c420)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float x))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x268c7a0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x268c980)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x268cb60)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 x))\n" + " ()))\n" "(function log\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x268cd40)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float x))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x268d0c0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x268d2a0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x268d480)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 x))\n" + " ()))\n" "(function exp2\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x268d660)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float x))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x268d9e0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x268dbc0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x268dda0)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 x))\n" + " ()))\n" "(function log2\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x268df80)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float x))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x268e300)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x268e4e0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x268e6c0)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 x))\n" + " ()))\n" "(function sqrt\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x268e8a0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float x))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x268ec20)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x268ee00)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x268efe0)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 x))\n" + " ()))\n" "(function inversesqrt\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x268f1c0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float x))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x268f550)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x268f730)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x268f910)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 x))\n" + " ()))\n" "(function abs\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x268faf0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float x))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x268fe70)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x2690050)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x2690230)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 x))\n" + " ()))\n" "(function sign\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x2690410)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float x))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x2690790)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x2690970)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x2690b50)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 x))\n" + " ()))\n" "(function floor\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x2690d30)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float x))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x26910b0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x2691290)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x2691470)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 x))\n" + " ()))\n" "(function ceil\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x2691650)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float x))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x26919d0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x2691bb0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x2691d90)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 x))\n" + " ()))\n" "(function fract\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x2691f70)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float x))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x26922f0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x26924d0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x26926b0)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 x))\n" + " ()))\n" "(function mod\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x2692890)\n" - " (declare (in ) float y@0x26929a0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float x)\n" + " (declare (in) float y))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x2692d20)\n" - " (declare (in ) float y@0x2692e30)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x)\n" + " (declare (in) float y))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x2693010)\n" - " (declare (in ) float y@0x2693120)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x)\n" + " (declare (in) float y))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x2693300)\n" - " (declare (in ) float y@0x2693410)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec4 x)\n" + " (declare (in) float y))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x26935f0)\n" - " (declare (in ) vec2 y@0x2693700)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x26938e0)\n" - " (declare (in ) vec3 y@0x26939f0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x2693bd0)\n" - " (declare (in ) vec4 y@0x2693ce0)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" + " ()))\n" "(function min\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x2693ec0)\n" - " (declare (in ) float y@0x2693fd0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float x)\n" + " (declare (in) float y))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x2694350)\n" - " (declare (in ) vec2 y@0x2694460)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x2694640)\n" - " (declare (in ) vec3 y@0x2694750)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x2694930)\n" - " (declare (in ) vec4 y@0x2694a40)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x2694c20)\n" - " (declare (in ) float y@0x2694d30)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x)\n" + " (declare (in) float y))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x2694f10)\n" - " (declare (in ) float y@0x2695020)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x)\n" + " (declare (in) float y))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x2695200)\n" - " (declare (in ) float y@0x2695310)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 x)\n" + " (declare (in) float y))\n" + " ()))\n" "(function max\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x26954f0)\n" - " (declare (in ) float y@0x2695600)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float x)\n" + " (declare (in) float y))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x2695980)\n" - " (declare (in ) vec2 y@0x2695a90)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x2695c70)\n" - " (declare (in ) vec3 y@0x2695d80)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x2695f60)\n" - " (declare (in ) vec4 y@0x2696070)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x2696250)\n" - " (declare (in ) float y@0x2696360)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x)\n" + " (declare (in) float y))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x2696540)\n" - " (declare (in ) float y@0x2696650)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x)\n" + " (declare (in) float y))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x2696830)\n" - " (declare (in ) float y@0x2696940)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 x)\n" + " (declare (in) float y))\n" + " ()))\n" "(function clamp\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x2696b20)\n" - " (declare (in ) float minVal@0x2696c30)\n" - " (declare (in ) float maxVal@0x2696d40)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float x)\n" + " (declare (in) float minVal)\n" + " (declare (in) float maxVal))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x26970c0)\n" - " (declare (in ) vec2 minVal@0x26971d0)\n" - " (declare (in ) vec2 maxVal@0x26972e0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 minVal)\n" + " (declare (in) vec2 maxVal))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x26974c0)\n" - " (declare (in ) vec3 minVal@0x26975d0)\n" - " (declare (in ) vec3 maxVal@0x26976e0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 minVal)\n" + " (declare (in) vec3 maxVal))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x26978c0)\n" - " (declare (in ) vec4 minVal@0x26979d0)\n" - " (declare (in ) vec4 maxVal@0x2697ae0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 minVal)\n" + " (declare (in) vec4 maxVal))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x2697cc0)\n" - " (declare (in ) float minVal@0x2697dd0)\n" - " (declare (in ) float maxVal@0x2697ee0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x)\n" + " (declare (in) float minVal)\n" + " (declare (in) float maxVal))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x26980c0)\n" - " (declare (in ) float minVal@0x26981d0)\n" - " (declare (in ) float maxVal@0x26982e0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x)\n" + " (declare (in) float minVal)\n" + " (declare (in) float maxVal))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x26984c0)\n" - " (declare (in ) float minVal@0x26985d0)\n" - " (declare (in ) float maxVal@0x26986e0)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 x)\n" + " (declare (in) float minVal)\n" + " (declare (in) float maxVal))\n" + " ()))\n" "(function mix\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x26988c0)\n" - " (declare (in ) float y@0x26989d0)\n" - " (declare (in ) float a@0x2698ae0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float x)\n" + " (declare (in) float y)\n" + " (declare (in) float a))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x2698e60)\n" - " (declare (in ) vec2 y@0x2698f70)\n" - " (declare (in ) vec2 a@0x2699080)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y)\n" + " (declare (in) vec2 a))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x2699260)\n" - " (declare (in ) vec3 y@0x2699370)\n" - " (declare (in ) vec3 a@0x2699480)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y)\n" + " (declare (in) vec3 a))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x2699660)\n" - " (declare (in ) vec4 y@0x2699770)\n" - " (declare (in ) vec4 a@0x2699880)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y)\n" + " (declare (in) vec4 a))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x2699a60)\n" - " (declare (in ) vec2 y@0x2699b70)\n" - " (declare (in ) float a@0x2699c80)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y)\n" + " (declare (in) float a))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x2699e60)\n" - " (declare (in ) vec3 y@0x2699f70)\n" - " (declare (in ) float a@0x269a080)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y)\n" + " (declare (in) float a))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x269a260)\n" - " (declare (in ) vec4 y@0x269a370)\n" - " (declare (in ) float a@0x269a480)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y)\n" + " (declare (in) float a))\n" + " ()))\n" "(function step\n" " (signature float\n" " (parameters\n" - " (declare (in ) float edge@0x269a660)\n" - " (declare (in ) float x@0x269a770)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float edge)\n" + " (declare (in) float x))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 edge@0x269aaf0)\n" - " (declare (in ) vec2 x@0x269ac00)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 edge)\n" + " (declare (in) vec2 x))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 edge@0x269ade0)\n" - " (declare (in ) vec3 x@0x269aef0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 edge)\n" + " (declare (in) vec3 x))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 edge@0x269b0d0)\n" - " (declare (in ) vec4 x@0x269b1e0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec4 edge)\n" + " (declare (in) vec4 x))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) float edge@0x269b3c0)\n" - " (declare (in ) vec2 x@0x269b4d0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float edge)\n" + " (declare (in) vec2 x))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) float edge@0x269b6b0)\n" - " (declare (in ) vec3 x@0x269b7c0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float edge)\n" + " (declare (in) vec3 x))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) float edge@0x269b9a0)\n" - " (declare (in ) vec4 x@0x269bab0)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) float edge)\n" + " (declare (in) vec4 x))\n" + " ()))\n" "(function smoothstep\n" " (signature float\n" " (parameters\n" - " (declare (in ) float edge0@0x269bc90)\n" - " (declare (in ) float edge1@0x269bda0)\n" - " (declare (in ) float x@0x269beb0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float edge0)\n" + " (declare (in) float edge1)\n" + " (declare (in) float x))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 edge0@0x269c240)\n" - " (declare (in ) vec2 edge1@0x269c350)\n" - " (declare (in ) vec2 x@0x269c460)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 edge0)\n" + " (declare (in) vec2 edge1)\n" + " (declare (in) vec2 x))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 edge0@0x269c640)\n" - " (declare (in ) vec3 edge1@0x269c750)\n" - " (declare (in ) vec3 x@0x269c860)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 edge0)\n" + " (declare (in) vec3 edge1)\n" + " (declare (in) vec3 x))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 edge0@0x269ca40)\n" - " (declare (in ) vec4 edge1@0x269cb50)\n" - " (declare (in ) vec4 x@0x269cc60)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec4 edge0)\n" + " (declare (in) vec4 edge1)\n" + " (declare (in) vec4 x))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) float edge0@0x269ce40)\n" - " (declare (in ) float edge1@0x269cf50)\n" - " (declare (in ) vec2 x@0x269d060)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float edge0)\n" + " (declare (in) float edge1)\n" + " (declare (in) vec2 x))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) float edge0@0x269d240)\n" - " (declare (in ) float edge1@0x269d350)\n" - " (declare (in ) vec3 x@0x269d460)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float edge0)\n" + " (declare (in) float edge1)\n" + " (declare (in) vec3 x))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) float edge0@0x269d640)\n" - " (declare (in ) float edge1@0x269d750)\n" - " (declare (in ) vec4 x@0x269d860)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) float edge0)\n" + " (declare (in) float edge1)\n" + " (declare (in) vec4 x))\n" + " ()))\n" "(function length\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x269da40)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float x))\n" + " ())\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec2 x@0x269ddc0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x))\n" + " ())\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec3 x@0x269dfa0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x))\n" + " ())\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec4 x@0x269e180)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 x))\n" + " ()))\n" "(function distance\n" " (signature float\n" " (parameters\n" - " (declare (in ) float p0@0x269e360)\n" - " (declare (in ) float p1@0x269e470)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float p0)\n" + " (declare (in) float p1))\n" + " ())\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec2 p0@0x269e800)\n" - " (declare (in ) vec2 p1@0x269e910)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 p0)\n" + " (declare (in) vec2 p1))\n" + " ())\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec3 p0@0x269eaf0)\n" - " (declare (in ) vec3 p1@0x269ec00)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 p0)\n" + " (declare (in) vec3 p1))\n" + " ())\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec4 p0@0x269ede0)\n" - " (declare (in ) vec4 p1@0x269eef0)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 p0)\n" + " (declare (in) vec4 p1))\n" + " ()))\n" "(function dot\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x269f0d0)\n" - " (declare (in ) float y@0x269f1e0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float x)\n" + " (declare (in) float y))\n" + " ())\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec2 x@0x269f560)\n" - " (declare (in ) vec2 y@0x269f670)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" + " ())\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec3 x@0x269f850)\n" - " (declare (in ) vec3 y@0x269f960)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ())\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec4 x@0x269fb40)\n" - " (declare (in ) vec4 y@0x269fc50)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" + " ()))\n" "(function cross\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x269fe30)\n" - " (declare (in ) vec3 y@0x269ff40)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ()))\n" "(function normalize\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x26a02c0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float x))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x26a0650)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x26a0830)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x26a0a10)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 x))\n" + " ()))\n" "(function ftransform\n" " (signature vec4\n" - " (parameters\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (parameters)\n" + " ()))\n" "(function faceforward\n" " (signature float\n" " (parameters\n" - " (declare (in ) float N@0x26a0e70)\n" - " (declare (in ) float I@0x26a0f80)\n" - " (declare (in ) float Nref@0x26a1090)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float N)\n" + " (declare (in) float I)\n" + " (declare (in) float Nref))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 N@0x26a1420)\n" - " (declare (in ) vec2 I@0x26a1530)\n" - " (declare (in ) vec2 Nref@0x26a1640)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 N)\n" + " (declare (in) vec2 I)\n" + " (declare (in) vec2 Nref))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 N@0x26a1820)\n" - " (declare (in ) vec3 I@0x26a1930)\n" - " (declare (in ) vec3 Nref@0x26a1a40)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 N)\n" + " (declare (in) vec3 I)\n" + " (declare (in) vec3 Nref))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 N@0x26a1c20)\n" - " (declare (in ) vec4 I@0x26a1d30)\n" - " (declare (in ) vec4 Nref@0x26a1e40)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 N)\n" + " (declare (in) vec4 I)\n" + " (declare (in) vec4 Nref))\n" + " ()))\n" "(function reflect\n" " (signature float\n" " (parameters\n" - " (declare (in ) float I@0x26a2020)\n" - " (declare (in ) float N@0x26a2130)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float I)\n" + " (declare (in) float N))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 I@0x26a24b0)\n" - " (declare (in ) vec2 N@0x26a25c0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 I)\n" + " (declare (in) vec2 N))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 I@0x26a27a0)\n" - " (declare (in ) vec3 N@0x26a28b0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 I)\n" + " (declare (in) vec3 N))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 I@0x26a2a90)\n" - " (declare (in ) vec4 N@0x26a2ba0)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 I)\n" + " (declare (in) vec4 N))\n" + " ()))\n" "(function refract\n" " (signature float\n" " (parameters\n" - " (declare (in ) float I@0x26a2d80)\n" - " (declare (in ) float N@0x26a2e90)\n" - " (declare (in ) float eta@0x26a2fa0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float I)\n" + " (declare (in) float N)\n" + " (declare (in) float eta))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 I@0x26a3320)\n" - " (declare (in ) vec2 N@0x26a3430)\n" - " (declare (in ) float eta@0x26a3540)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 I)\n" + " (declare (in) vec2 N)\n" + " (declare (in) float eta))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 I@0x26a3720)\n" - " (declare (in ) vec3 N@0x26a3830)\n" - " (declare (in ) float eta@0x26a3940)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 I)\n" + " (declare (in) vec3 N)\n" + " (declare (in) float eta))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 I@0x26a3b20)\n" - " (declare (in ) vec4 N@0x26a3c30)\n" - " (declare (in ) float eta@0x26a3d40)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 I)\n" + " (declare (in) vec4 N)\n" + " (declare (in) float eta))\n" + " ()))\n" "(function matrixCompMult\n" " (signature mat2\n" " (parameters\n" - " (declare (in ) mat2 x@0x26a3f20)\n" - " (declare (in ) mat2 y@0x26a4030)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) mat2 x)\n" + " (declare (in) mat2 y))\n" + " ())\n" " (signature mat3\n" " (parameters\n" - " (declare (in ) mat3 x@0x26a43c0)\n" - " (declare (in ) mat3 y@0x26a44d0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) mat3 x)\n" + " (declare (in) mat3 y))\n" + " ())\n" " (signature mat4\n" " (parameters\n" - " (declare (in ) mat4 x@0x26a46b0)\n" - " (declare (in ) mat4 y@0x26a47c0)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) mat4 x)\n" + " (declare (in) mat4 y))\n" + " ()))\n" "(function lessThan\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x26a49a0)\n" - " (declare (in ) vec2 y@0x26a4ab0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" + " ())\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x26a4e40)\n" - " (declare (in ) vec3 y@0x26a4f50)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ())\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x26a5130)\n" - " (declare (in ) vec4 y@0x26a5240)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" + " ())\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) ivec2 x@0x26a5420)\n" - " (declare (in ) ivec2 y@0x26a5530)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) ivec2 x)\n" + " (declare (in) ivec2 y))\n" + " ())\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) ivec3 x@0x26a5710)\n" - " (declare (in ) ivec3 y@0x26a5820)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) ivec3 x)\n" + " (declare (in) ivec3 y))\n" + " ())\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) ivec4 x@0x26a5a00)\n" - " (declare (in ) ivec4 y@0x26a5b10)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) ivec4 x)\n" + " (declare (in) ivec4 y))\n" + " ()))\n" "(function lessThanEqual\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x26a5cf0)\n" - " (declare (in ) vec2 y@0x26a5e00)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" + " ())\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x26a6190)\n" - " (declare (in ) vec3 y@0x26a62a0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ())\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x26a6480)\n" - " (declare (in ) vec4 y@0x26a6590)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" + " ())\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) ivec2 x@0x26a6770)\n" - " (declare (in ) ivec2 y@0x26a6880)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) ivec2 x)\n" + " (declare (in) ivec2 y))\n" + " ())\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) ivec3 x@0x26a6a60)\n" - " (declare (in ) ivec3 y@0x26a6b70)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) ivec3 x)\n" + " (declare (in) ivec3 y))\n" + " ())\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) ivec4 x@0x26a6d50)\n" - " (declare (in ) ivec4 y@0x26a6e60)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) ivec4 x)\n" + " (declare (in) ivec4 y))\n" + " ()))\n" "(function greaterThan\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x26a7040)\n" - " (declare (in ) vec2 y@0x26a7150)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" + " ())\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x26a74e0)\n" - " (declare (in ) vec3 y@0x26a75f0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ())\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x26a77d0)\n" - " (declare (in ) vec4 y@0x26a78e0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" + " ())\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) ivec2 x@0x26a7ac0)\n" - " (declare (in ) ivec2 y@0x26a7bd0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) ivec2 x)\n" + " (declare (in) ivec2 y))\n" + " ())\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) ivec3 x@0x26a7db0)\n" - " (declare (in ) ivec3 y@0x26a7ec0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) ivec3 x)\n" + " (declare (in) ivec3 y))\n" + " ())\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) ivec4 x@0x26a80a0)\n" - " (declare (in ) ivec4 y@0x26a81b0)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) ivec4 x)\n" + " (declare (in) ivec4 y))\n" + " ()))\n" "(function greaterThanEqual\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x26a8390)\n" - " (declare (in ) vec2 y@0x26a84a0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" + " ())\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x26a8830)\n" - " (declare (in ) vec3 y@0x26a8940)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ())\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x26a8b20)\n" - " (declare (in ) vec4 y@0x26a8c30)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" + " ())\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) ivec2 x@0x26a8e10)\n" - " (declare (in ) ivec2 y@0x26a8f20)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) ivec2 x)\n" + " (declare (in) ivec2 y))\n" + " ())\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) ivec3 x@0x26a9100)\n" - " (declare (in ) ivec3 y@0x26a9210)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) ivec3 x)\n" + " (declare (in) ivec3 y))\n" + " ())\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) ivec4 x@0x26a93f0)\n" - " (declare (in ) ivec4 y@0x26a9500)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) ivec4 x)\n" + " (declare (in) ivec4 y))\n" + " ()))\n" "(function equal\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x26a96e0)\n" - " (declare (in ) vec2 y@0x26a97f0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" + " ())\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x26a9b70)\n" - " (declare (in ) vec3 y@0x26a9c80)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ())\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x26a9e60)\n" - " (declare (in ) vec4 y@0x26a9f70)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" + " ())\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) ivec2 x@0x26aa150)\n" - " (declare (in ) ivec2 y@0x26aa260)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) ivec2 x)\n" + " (declare (in) ivec2 y))\n" + " ())\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) ivec3 x@0x26aa440)\n" - " (declare (in ) ivec3 y@0x26aa550)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) ivec3 x)\n" + " (declare (in) ivec3 y))\n" + " ())\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) ivec4 x@0x26aa730)\n" - " (declare (in ) ivec4 y@0x26aa840)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) ivec4 x)\n" + " (declare (in) ivec4 y))\n" + " ())\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) bvec2 x@0x26aaa20)\n" - " (declare (in ) bvec2 y@0x26aab30)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) bvec2 x)\n" + " (declare (in) bvec2 y))\n" + " ())\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) bvec3 x@0x26aad10)\n" - " (declare (in ) bvec3 y@0x26aae20)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) bvec3 x)\n" + " (declare (in) bvec3 y))\n" + " ())\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) bvec4 x@0x26ab000)\n" - " (declare (in ) bvec4 y@0x26ab110)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) bvec4 x)\n" + " (declare (in) bvec4 y))\n" + " ()))\n" "(function notEqual\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x26ab2f0)\n" - " (declare (in ) vec2 y@0x26ab400)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" + " ())\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x26ab790)\n" - " (declare (in ) vec3 y@0x26ab8a0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ())\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x26aba80)\n" - " (declare (in ) vec4 y@0x26abb90)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" + " ())\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) ivec2 x@0x26abd70)\n" - " (declare (in ) ivec2 y@0x26abe80)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) ivec2 x)\n" + " (declare (in) ivec2 y))\n" + " ())\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) ivec3 x@0x26ac060)\n" - " (declare (in ) ivec3 y@0x26ac170)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) ivec3 x)\n" + " (declare (in) ivec3 y))\n" + " ())\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) ivec4 x@0x26ac350)\n" - " (declare (in ) ivec4 y@0x26ac460)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) ivec4 x)\n" + " (declare (in) ivec4 y))\n" + " ())\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) bvec2 x@0x26ac640)\n" - " (declare (in ) bvec2 y@0x26ac750)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) bvec2 x)\n" + " (declare (in) bvec2 y))\n" + " ())\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) bvec3 x@0x26ac930)\n" - " (declare (in ) bvec3 y@0x26aca40)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) bvec3 x)\n" + " (declare (in) bvec3 y))\n" + " ())\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) bvec4 x@0x26acc20)\n" - " (declare (in ) bvec4 y@0x26acd30)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) bvec4 x)\n" + " (declare (in) bvec4 y))\n" + " ()))\n" "(function any\n" " (signature bool\n" " (parameters\n" - " (declare (in ) bvec2 x@0x26acf10)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) bvec2 x))\n" + " ())\n" " (signature bool\n" " (parameters\n" - " (declare (in ) bvec3 x@0x26ad290)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) bvec3 x))\n" + " ())\n" " (signature bool\n" " (parameters\n" - " (declare (in ) bvec4 x@0x26ad470)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) bvec4 x))\n" + " ()))\n" "(function all\n" " (signature bool\n" " (parameters\n" - " (declare (in ) bvec2 x@0x26ad650)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) bvec2 x))\n" + " ())\n" " (signature bool\n" " (parameters\n" - " (declare (in ) bvec3 x@0x26ad9d0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) bvec3 x))\n" + " ())\n" " (signature bool\n" " (parameters\n" - " (declare (in ) bvec4 x@0x26adbb0)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) bvec4 x))\n" + " ()))\n" "(function not\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) bvec2 x@0x26add90)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) bvec2 x))\n" + " ())\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) bvec3 x@0x26ae110)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) bvec3 x))\n" + " ())\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) bvec4 x@0x26ae2f0)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) bvec4 x))\n" + " ()))\n" "(function texture1D\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1D sampler@0x26ae4d0)\n" - " (declare (in ) float coord@0x26ae5e0)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) float coord))\n" + " ()))\n" "(function texture1DProj\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1D sampler@0x26ae970)\n" - " (declare (in ) vec2 coord@0x26aea80)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) vec2 coord))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1D sampler@0x26aee10)\n" - " (declare (in ) vec4 coord@0x26aef20)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) vec4 coord))\n" + " ()))\n" "(function texture1DLod\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1D sampler@0x26af100)\n" - " (declare (in ) float coord@0x26af210)\n" - " (declare (in ) float lod@0x26af320)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) float coord)\n" + " (declare (in) float lod))\n" + " ()))\n" "(function texture1DProjLod\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1D sampler@0x26af6b0)\n" - " (declare (in ) vec2 coord@0x26af7c0)\n" - " (declare (in ) float lod@0x26af8d0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) vec2 coord)\n" + " (declare (in) float lod))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1D sampler@0x26afc60)\n" - " (declare (in ) vec4 coord@0x26afd70)\n" - " (declare (in ) float lod@0x26afe80)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) vec4 coord)\n" + " (declare (in) float lod))\n" + " ()))\n" "(function texture2D\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2D sampler@0x26b0060)\n" - " (declare (in ) vec2 coord@0x26b0170)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec2 coord))\n" + " ()))\n" "(function texture2DProj\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2D sampler@0x26b0500)\n" - " (declare (in ) vec3 coord@0x26b0610)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec3 coord))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2D sampler@0x26b09a0)\n" - " (declare (in ) vec4 coord@0x26b0ab0)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec4 coord))\n" + " ()))\n" "(function texture2DLod\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2D sampler@0x26b0c90)\n" - " (declare (in ) vec2 coord@0x26b0da0)\n" - " (declare (in ) float lod@0x26b0eb0)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec2 coord)\n" + " (declare (in) float lod))\n" + " ()))\n" "(function texture2DProjLod\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2D sampler@0x26b1240)\n" - " (declare (in ) vec3 coord@0x26b1350)\n" - " (declare (in ) float lod@0x26b1460)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec3 coord)\n" + " (declare (in) float lod))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2D sampler@0x26b17f0)\n" - " (declare (in ) vec4 coord@0x26b1900)\n" - " (declare (in ) float lod@0x26b1a10)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec4 coord)\n" + " (declare (in) float lod))\n" + " ()))\n" "(function texture3D\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler3D sampler@0x26b1bf0)\n" - " (declare (in ) vec3 coord@0x26b1d00)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) sampler3D sampler)\n" + " (declare (in) vec3 coord))\n" + " ()))\n" "(function texture3DProj\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler3D sampler@0x26b2090)\n" - " (declare (in ) vec4 coord@0x26b21a0)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) sampler3D sampler)\n" + " (declare (in) vec4 coord))\n" + " ()))\n" "(function texture3DLod\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler3D sampler@0x26b2530)\n" - " (declare (in ) vec3 coord@0x26b2640)\n" - " (declare (in ) float lod@0x26b2750)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) sampler3D sampler)\n" + " (declare (in) vec3 coord)\n" + " (declare (in) float lod))\n" + " ()))\n" "(function texture3DProjLod\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler3D sampler@0x26b2ae0)\n" - " (declare (in ) vec4 coord@0x26b2bf0)\n" - " (declare (in ) float lod@0x26b2d00)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) sampler3D sampler)\n" + " (declare (in) vec4 coord)\n" + " (declare (in) float lod))\n" + " ()))\n" "(function textureCube\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) samplerCube sampler@0x26b3090)\n" - " (declare (in ) vec3 coord@0x26b31a0)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) samplerCube sampler)\n" + " (declare (in) vec3 coord))\n" + " ()))\n" "(function textureCubeLod\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) samplerCube sampler@0x26b3530)\n" - " (declare (in ) vec3 coord@0x26b3640)\n" - " (declare (in ) float lod@0x26b3750)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) samplerCube sampler)\n" + " (declare (in) vec3 coord)\n" + " (declare (in) float lod))\n" + " ()))\n" "(function shadow1D\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1DShadow sampler@0x26b3ae0)\n" - " (declare (in ) vec3 coord@0x26b3bf0)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) sampler1DShadow sampler)\n" + " (declare (in) vec3 coord))\n" + " ()))\n" "(function shadow2D\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2DShadow sampler@0x26b3f80)\n" - " (declare (in ) vec3 coord@0x26b4090)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) sampler2DShadow sampler)\n" + " (declare (in) vec3 coord))\n" + " ()))\n" "(function shadow1DProj\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1DShadow sampler@0x26b4420)\n" - " (declare (in ) vec4 coord@0x26b4530)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) sampler1DShadow sampler)\n" + " (declare (in) vec4 coord))\n" + " ()))\n" "(function shadow2DProj\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2DShadow sampler@0x26b48c0)\n" - " (declare (in ) vec4 coord@0x26b49d0)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) sampler2DShadow sampler)\n" + " (declare (in) vec4 coord))\n" + " ()))\n" "(function shadow1DLod\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1DShadow sampler@0x26b4d60)\n" - " (declare (in ) vec3 coord@0x26b4e70)\n" - " (declare (in ) float lod@0x26b4f80)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) sampler1DShadow sampler)\n" + " (declare (in) vec3 coord)\n" + " (declare (in) float lod))\n" + " ()))\n" "(function shadow2DLod\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2DShadow sampler@0x26b5310)\n" - " (declare (in ) vec3 coord@0x26b5420)\n" - " (declare (in ) float lod@0x26b5530)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) sampler2DShadow sampler)\n" + " (declare (in) vec3 coord)\n" + " (declare (in) float lod))\n" + " ()))\n" "(function shadow1DProjLod\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1DShadow sampler@0x26b58c0)\n" - " (declare (in ) vec4 coord@0x26b59d0)\n" - " (declare (in ) float lod@0x26b5ae0)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) sampler1DShadow sampler)\n" + " (declare (in) vec4 coord)\n" + " (declare (in) float lod))\n" + " ()))\n" "(function shadow2DProjLod\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2DShadow sampler@0x26b5e70)\n" - " (declare (in ) vec4 coord@0x26b5f80)\n" - " (declare (in ) float lod@0x26b6090)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) sampler2DShadow sampler)\n" + " (declare (in) vec4 coord)\n" + " (declare (in) float lod))\n" + " ()))\n" "(function noise1\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x26b6420)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float x))\n" + " ())\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec2 x@0x26b67a0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x))\n" + " ())\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec3 x@0x26b6980)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x))\n" + " ())\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec4 x@0x26b6b60)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 x))\n" + " ()))\n" "(function noise2\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) float x@0x26b6d40)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float x))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x26b70c0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec3 x@0x26b72a0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec4 x@0x26b7480)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 x))\n" + " ()))\n" "(function noise3\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) float x@0x26b7660)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float x))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec2 x@0x26b79e0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x26b7bc0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec4 x@0x26b7da0)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 x))\n" + " ()))\n" "(function noise4\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) float x@0x26b7f80)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float x))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec2 x@0x26b8300)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec3 x@0x26b84e0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x26b86c0)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" - "\n" - ")" + " (declare (in) vec4 x))\n" + " ())))" ; static const char *functions_for_110_vert [] = { builtin_clamp, @@ -9587,2275 +7634,1337 @@ static const char *prototypes_for_110_frag = "(function radians\n" " (signature float\n" " (parameters\n" - " (declare (in ) float degrees@0x25c3280)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float degrees))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 degrees@0x25c3600)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 degrees))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 degrees@0x25c37e0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 degrees))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 degrees@0x25c39c0)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 degrees))\n" + " ()))\n" "(function degrees\n" " (signature float\n" " (parameters\n" - " (declare (in ) float radians@0x25c3ba0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float radians))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 radians@0x25c3f20)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 radians))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 radians@0x25c4100)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 radians))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 radians@0x25c42e0)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 radians))\n" + " ()))\n" "(function sin\n" " (signature float\n" " (parameters\n" - " (declare (in ) float angle@0x25c44c0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float angle))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 angle@0x25c4840)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 angle))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 angle@0x25c4a20)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 angle))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 angle@0x25c4c00)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 angle))\n" + " ()))\n" "(function cos\n" " (signature float\n" " (parameters\n" - " (declare (in ) float angle@0x25c4de0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float angle))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 angle@0x25c5160)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 angle))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 angle@0x25c5340)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 angle))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 angle@0x25c5520)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 angle))\n" + " ()))\n" "(function tan\n" " (signature float\n" " (parameters\n" - " (declare (in ) float angle@0x25c5700)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float angle))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 angle@0x25c5a80)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 angle))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 angle@0x25c5c60)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 angle))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 angle@0x25c5e40)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 angle))\n" + " ()))\n" "(function asin\n" " (signature float\n" " (parameters\n" - " (declare (in ) float angle@0x25c6020)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float angle))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 angle@0x25c63a0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 angle))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 angle@0x25c6580)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 angle))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 angle@0x25c6760)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 angle))\n" + " ()))\n" "(function acos\n" " (signature float\n" " (parameters\n" - " (declare (in ) float angle@0x25c6940)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float angle))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 angle@0x25c6cc0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 angle))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 angle@0x25c6ea0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 angle))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 angle@0x25c7080)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 angle))\n" + " ()))\n" "(function atan\n" " (signature float\n" " (parameters\n" - " (declare (in ) float y@0x25c7260)\n" - " (declare (in ) float x@0x25c7370)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float y)\n" + " (declare (in) float x))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 y@0x25c76f0)\n" - " (declare (in ) vec2 x@0x25c7800)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 y)\n" + " (declare (in) vec2 x))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 y@0x25c79e0)\n" - " (declare (in ) vec3 x@0x25c7af0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 y)\n" + " (declare (in) vec3 x))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 y@0x25c7cd0)\n" - " (declare (in ) vec4 x@0x25c7de0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec4 y)\n" + " (declare (in) vec4 x))\n" + " ())\n" " (signature float\n" " (parameters\n" - " (declare (in ) float y_over_x@0x25c7fc0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float y_over_x))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 y_over_x@0x25c81b0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 y_over_x))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 y_over_x@0x25c83a0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 y_over_x))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 y_over_x@0x25c8590)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 y_over_x))\n" + " ()))\n" "(function pow\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x25c8780)\n" - " (declare (in ) float y@0x25c8890)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float x)\n" + " (declare (in) float y))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x25c8c10)\n" - " (declare (in ) vec2 y@0x25c8d20)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x25c8f00)\n" - " (declare (in ) vec3 y@0x25c9010)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x25c91f0)\n" - " (declare (in ) vec4 y@0x25c9300)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" + " ()))\n" "(function exp\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x25c94e0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float x))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x25c9860)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x25c9a40)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x25c9c20)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 x))\n" + " ()))\n" "(function log\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x25c9e00)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float x))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x25ca180)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x25ca360)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x25ca540)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 x))\n" + " ()))\n" "(function exp2\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x25ca720)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float x))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x25caaa0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x25cac80)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x25cae60)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 x))\n" + " ()))\n" "(function log2\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x25cb040)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float x))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x25cb3c0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x25cb5a0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x25cb780)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 x))\n" + " ()))\n" "(function sqrt\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x25cb960)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float x))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x25cbce0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x25cbec0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x25cc0a0)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 x))\n" + " ()))\n" "(function inversesqrt\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x25cc280)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float x))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x25cc610)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x25cc7f0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x25cc9d0)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 x))\n" + " ()))\n" "(function abs\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x25ccbb0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float x))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x25ccf30)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x25cd110)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x25cd2f0)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 x))\n" + " ()))\n" "(function sign\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x25cd4d0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float x))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x25cd850)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x25cda30)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x25cdc10)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 x))\n" + " ()))\n" "(function floor\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x25cddf0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float x))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x25ce170)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x25ce350)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x25ce530)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 x))\n" + " ()))\n" "(function ceil\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x25ce710)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float x))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x25cea90)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x25cec70)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x25cee50)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 x))\n" + " ()))\n" "(function fract\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x25cf030)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float x))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x25cf3b0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x25cf590)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x25cf770)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 x))\n" + " ()))\n" "(function mod\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x25cf950)\n" - " (declare (in ) float y@0x25cfa60)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float x)\n" + " (declare (in) float y))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x25cfde0)\n" - " (declare (in ) float y@0x25cfef0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x)\n" + " (declare (in) float y))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x25d00d0)\n" - " (declare (in ) float y@0x25d01e0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x)\n" + " (declare (in) float y))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x25d03c0)\n" - " (declare (in ) float y@0x25d04d0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec4 x)\n" + " (declare (in) float y))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x25d06b0)\n" - " (declare (in ) vec2 y@0x25d07c0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x25d09a0)\n" - " (declare (in ) vec3 y@0x25d0ab0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x25d0c90)\n" - " (declare (in ) vec4 y@0x25d0da0)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" + " ()))\n" "(function min\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x25d0f80)\n" - " (declare (in ) float y@0x25d1090)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float x)\n" + " (declare (in) float y))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x25d1410)\n" - " (declare (in ) vec2 y@0x25d1520)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x25d1700)\n" - " (declare (in ) vec3 y@0x25d1810)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x25d19f0)\n" - " (declare (in ) vec4 y@0x25d1b00)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x25d1ce0)\n" - " (declare (in ) float y@0x25d1df0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x)\n" + " (declare (in) float y))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x25d1fd0)\n" - " (declare (in ) float y@0x25d20e0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x)\n" + " (declare (in) float y))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x25d22c0)\n" - " (declare (in ) float y@0x25d23d0)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 x)\n" + " (declare (in) float y))\n" + " ()))\n" "(function max\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x25d25b0)\n" - " (declare (in ) float y@0x25d26c0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float x)\n" + " (declare (in) float y))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x25d2a40)\n" - " (declare (in ) vec2 y@0x25d2b50)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x25d2d30)\n" - " (declare (in ) vec3 y@0x25d2e40)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x25d3020)\n" - " (declare (in ) vec4 y@0x25d3130)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x25d3310)\n" - " (declare (in ) float y@0x25d3420)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x)\n" + " (declare (in) float y))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x25d3600)\n" - " (declare (in ) float y@0x25d3710)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x)\n" + " (declare (in) float y))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x25d38f0)\n" - " (declare (in ) float y@0x25d3a00)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 x)\n" + " (declare (in) float y))\n" + " ()))\n" "(function clamp\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x25d3be0)\n" - " (declare (in ) float minVal@0x25d3cf0)\n" - " (declare (in ) float maxVal@0x25d3e00)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float x)\n" + " (declare (in) float minVal)\n" + " (declare (in) float maxVal))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x25d4180)\n" - " (declare (in ) vec2 minVal@0x25d4290)\n" - " (declare (in ) vec2 maxVal@0x25d43a0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 minVal)\n" + " (declare (in) vec2 maxVal))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x25d4580)\n" - " (declare (in ) vec3 minVal@0x25d4690)\n" - " (declare (in ) vec3 maxVal@0x25d47a0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 minVal)\n" + " (declare (in) vec3 maxVal))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x25d4980)\n" - " (declare (in ) vec4 minVal@0x25d4a90)\n" - " (declare (in ) vec4 maxVal@0x25d4ba0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 minVal)\n" + " (declare (in) vec4 maxVal))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x25d4d80)\n" - " (declare (in ) float minVal@0x25d4e90)\n" - " (declare (in ) float maxVal@0x25d4fa0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x)\n" + " (declare (in) float minVal)\n" + " (declare (in) float maxVal))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x25d5180)\n" - " (declare (in ) float minVal@0x25d5290)\n" - " (declare (in ) float maxVal@0x25d53a0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x)\n" + " (declare (in) float minVal)\n" + " (declare (in) float maxVal))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x25d5580)\n" - " (declare (in ) float minVal@0x25d5690)\n" - " (declare (in ) float maxVal@0x25d57a0)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 x)\n" + " (declare (in) float minVal)\n" + " (declare (in) float maxVal))\n" + " ()))\n" "(function mix\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x25d5980)\n" - " (declare (in ) float y@0x25d5a90)\n" - " (declare (in ) float a@0x25d5ba0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float x)\n" + " (declare (in) float y)\n" + " (declare (in) float a))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x25d5f20)\n" - " (declare (in ) vec2 y@0x25d6030)\n" - " (declare (in ) vec2 a@0x25d6140)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y)\n" + " (declare (in) vec2 a))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x25d6320)\n" - " (declare (in ) vec3 y@0x25d6430)\n" - " (declare (in ) vec3 a@0x25d6540)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y)\n" + " (declare (in) vec3 a))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x25d6720)\n" - " (declare (in ) vec4 y@0x25d6830)\n" - " (declare (in ) vec4 a@0x25d6940)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y)\n" + " (declare (in) vec4 a))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x25d6b20)\n" - " (declare (in ) vec2 y@0x25d6c30)\n" - " (declare (in ) float a@0x25d6d40)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y)\n" + " (declare (in) float a))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x25d6f20)\n" - " (declare (in ) vec3 y@0x25d7030)\n" - " (declare (in ) float a@0x25d7140)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y)\n" + " (declare (in) float a))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x25d7320)\n" - " (declare (in ) vec4 y@0x25d7430)\n" - " (declare (in ) float a@0x25d7540)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y)\n" + " (declare (in) float a))\n" + " ()))\n" "(function step\n" " (signature float\n" " (parameters\n" - " (declare (in ) float edge@0x25d7720)\n" - " (declare (in ) float x@0x25d7830)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float edge)\n" + " (declare (in) float x))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 edge@0x25d7bb0)\n" - " (declare (in ) vec2 x@0x25d7cc0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 edge)\n" + " (declare (in) vec2 x))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 edge@0x25d7ea0)\n" - " (declare (in ) vec3 x@0x25d7fb0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 edge)\n" + " (declare (in) vec3 x))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 edge@0x25d8190)\n" - " (declare (in ) vec4 x@0x25d82a0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec4 edge)\n" + " (declare (in) vec4 x))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) float edge@0x25d8480)\n" - " (declare (in ) vec2 x@0x25d8590)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float edge)\n" + " (declare (in) vec2 x))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) float edge@0x25d8770)\n" - " (declare (in ) vec3 x@0x25d8880)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float edge)\n" + " (declare (in) vec3 x))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) float edge@0x25d8a60)\n" - " (declare (in ) vec4 x@0x25d8b70)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) float edge)\n" + " (declare (in) vec4 x))\n" + " ()))\n" "(function smoothstep\n" " (signature float\n" " (parameters\n" - " (declare (in ) float edge0@0x25d8d50)\n" - " (declare (in ) float edge1@0x25d8e60)\n" - " (declare (in ) float x@0x25d8f70)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float edge0)\n" + " (declare (in) float edge1)\n" + " (declare (in) float x))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 edge0@0x25d9300)\n" - " (declare (in ) vec2 edge1@0x25d9410)\n" - " (declare (in ) vec2 x@0x25d9520)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 edge0)\n" + " (declare (in) vec2 edge1)\n" + " (declare (in) vec2 x))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 edge0@0x25d9700)\n" - " (declare (in ) vec3 edge1@0x25d9810)\n" - " (declare (in ) vec3 x@0x25d9920)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 edge0)\n" + " (declare (in) vec3 edge1)\n" + " (declare (in) vec3 x))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 edge0@0x25d9b00)\n" - " (declare (in ) vec4 edge1@0x25d9c10)\n" - " (declare (in ) vec4 x@0x25d9d20)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec4 edge0)\n" + " (declare (in) vec4 edge1)\n" + " (declare (in) vec4 x))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) float edge0@0x25d9f00)\n" - " (declare (in ) float edge1@0x25da010)\n" - " (declare (in ) vec2 x@0x25da120)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float edge0)\n" + " (declare (in) float edge1)\n" + " (declare (in) vec2 x))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) float edge0@0x25da300)\n" - " (declare (in ) float edge1@0x25da410)\n" - " (declare (in ) vec3 x@0x25da520)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float edge0)\n" + " (declare (in) float edge1)\n" + " (declare (in) vec3 x))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) float edge0@0x25da700)\n" - " (declare (in ) float edge1@0x25da810)\n" - " (declare (in ) vec4 x@0x25da920)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) float edge0)\n" + " (declare (in) float edge1)\n" + " (declare (in) vec4 x))\n" + " ()))\n" "(function length\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x25dab00)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float x))\n" + " ())\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec2 x@0x25dae80)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x))\n" + " ())\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec3 x@0x25db060)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x))\n" + " ())\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec4 x@0x25db240)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 x))\n" + " ()))\n" "(function distance\n" " (signature float\n" " (parameters\n" - " (declare (in ) float p0@0x25db420)\n" - " (declare (in ) float p1@0x25db530)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float p0)\n" + " (declare (in) float p1))\n" + " ())\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec2 p0@0x25db8c0)\n" - " (declare (in ) vec2 p1@0x25db9d0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 p0)\n" + " (declare (in) vec2 p1))\n" + " ())\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec3 p0@0x25dbbb0)\n" - " (declare (in ) vec3 p1@0x25dbcc0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 p0)\n" + " (declare (in) vec3 p1))\n" + " ())\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec4 p0@0x25dbea0)\n" - " (declare (in ) vec4 p1@0x25dbfb0)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 p0)\n" + " (declare (in) vec4 p1))\n" + " ()))\n" "(function dot\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x25dc190)\n" - " (declare (in ) float y@0x25dc2a0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float x)\n" + " (declare (in) float y))\n" + " ())\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec2 x@0x25dc620)\n" - " (declare (in ) vec2 y@0x25dc730)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" + " ())\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec3 x@0x25dc910)\n" - " (declare (in ) vec3 y@0x25dca20)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ())\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec4 x@0x25dcc00)\n" - " (declare (in ) vec4 y@0x25dcd10)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" + " ()))\n" "(function cross\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x25dcef0)\n" - " (declare (in ) vec3 y@0x25dd000)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ()))\n" "(function normalize\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x25dd380)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float x))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x25dd710)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x25dd8f0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x25ddad0)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 x))\n" + " ()))\n" "(function faceforward\n" " (signature float\n" " (parameters\n" - " (declare (in ) float N@0x25ddcb0)\n" - " (declare (in ) float I@0x25dddc0)\n" - " (declare (in ) float Nref@0x25dded0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float N)\n" + " (declare (in) float I)\n" + " (declare (in) float Nref))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 N@0x25de260)\n" - " (declare (in ) vec2 I@0x25de370)\n" - " (declare (in ) vec2 Nref@0x25de480)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 N)\n" + " (declare (in) vec2 I)\n" + " (declare (in) vec2 Nref))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 N@0x25de660)\n" - " (declare (in ) vec3 I@0x25de770)\n" - " (declare (in ) vec3 Nref@0x25de880)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 N)\n" + " (declare (in) vec3 I)\n" + " (declare (in) vec3 Nref))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 N@0x25dea60)\n" - " (declare (in ) vec4 I@0x25deb70)\n" - " (declare (in ) vec4 Nref@0x25dec80)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 N)\n" + " (declare (in) vec4 I)\n" + " (declare (in) vec4 Nref))\n" + " ()))\n" "(function reflect\n" " (signature float\n" " (parameters\n" - " (declare (in ) float I@0x25dee60)\n" - " (declare (in ) float N@0x25def70)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float I)\n" + " (declare (in) float N))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 I@0x25df2f0)\n" - " (declare (in ) vec2 N@0x25df400)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 I)\n" + " (declare (in) vec2 N))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 I@0x25df5e0)\n" - " (declare (in ) vec3 N@0x25df6f0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 I)\n" + " (declare (in) vec3 N))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 I@0x25df8d0)\n" - " (declare (in ) vec4 N@0x25df9e0)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 I)\n" + " (declare (in) vec4 N))\n" + " ()))\n" "(function refract\n" " (signature float\n" " (parameters\n" - " (declare (in ) float I@0x25dfbc0)\n" - " (declare (in ) float N@0x25dfcd0)\n" - " (declare (in ) float eta@0x25dfde0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float I)\n" + " (declare (in) float N)\n" + " (declare (in) float eta))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 I@0x25e0160)\n" - " (declare (in ) vec2 N@0x25e0270)\n" - " (declare (in ) float eta@0x25e0380)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 I)\n" + " (declare (in) vec2 N)\n" + " (declare (in) float eta))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 I@0x25e0560)\n" - " (declare (in ) vec3 N@0x25e0670)\n" - " (declare (in ) float eta@0x25e0780)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 I)\n" + " (declare (in) vec3 N)\n" + " (declare (in) float eta))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 I@0x25e0960)\n" - " (declare (in ) vec4 N@0x25e0a70)\n" - " (declare (in ) float eta@0x25e0b80)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 I)\n" + " (declare (in) vec4 N)\n" + " (declare (in) float eta))\n" + " ()))\n" "(function matrixCompMult\n" " (signature mat2\n" " (parameters\n" - " (declare (in ) mat2 x@0x25e0d60)\n" - " (declare (in ) mat2 y@0x25e0e70)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) mat2 x)\n" + " (declare (in) mat2 y))\n" + " ())\n" " (signature mat3\n" " (parameters\n" - " (declare (in ) mat3 x@0x25e1200)\n" - " (declare (in ) mat3 y@0x25e1310)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) mat3 x)\n" + " (declare (in) mat3 y))\n" + " ())\n" " (signature mat4\n" " (parameters\n" - " (declare (in ) mat4 x@0x25e14f0)\n" - " (declare (in ) mat4 y@0x25e1600)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) mat4 x)\n" + " (declare (in) mat4 y))\n" + " ()))\n" "(function lessThan\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x25e17e0)\n" - " (declare (in ) vec2 y@0x25e18f0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" + " ())\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x25e1c80)\n" - " (declare (in ) vec3 y@0x25e1d90)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ())\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x25e1f70)\n" - " (declare (in ) vec4 y@0x25e2080)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" + " ())\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) ivec2 x@0x25e2260)\n" - " (declare (in ) ivec2 y@0x25e2370)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) ivec2 x)\n" + " (declare (in) ivec2 y))\n" + " ())\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) ivec3 x@0x25e2550)\n" - " (declare (in ) ivec3 y@0x25e2660)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) ivec3 x)\n" + " (declare (in) ivec3 y))\n" + " ())\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) ivec4 x@0x25e2840)\n" - " (declare (in ) ivec4 y@0x25e2950)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) ivec4 x)\n" + " (declare (in) ivec4 y))\n" + " ()))\n" "(function lessThanEqual\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x25e2b30)\n" - " (declare (in ) vec2 y@0x25e2c40)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" + " ())\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x25e2fd0)\n" - " (declare (in ) vec3 y@0x25e30e0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ())\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x25e32c0)\n" - " (declare (in ) vec4 y@0x25e33d0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" + " ())\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) ivec2 x@0x25e35b0)\n" - " (declare (in ) ivec2 y@0x25e36c0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) ivec2 x)\n" + " (declare (in) ivec2 y))\n" + " ())\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) ivec3 x@0x25e38a0)\n" - " (declare (in ) ivec3 y@0x25e39b0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) ivec3 x)\n" + " (declare (in) ivec3 y))\n" + " ())\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) ivec4 x@0x25e3b90)\n" - " (declare (in ) ivec4 y@0x25e3ca0)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) ivec4 x)\n" + " (declare (in) ivec4 y))\n" + " ()))\n" "(function greaterThan\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x25e3e80)\n" - " (declare (in ) vec2 y@0x25e3f90)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" + " ())\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x25e4320)\n" - " (declare (in ) vec3 y@0x25e4430)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ())\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x25e4610)\n" - " (declare (in ) vec4 y@0x25e4720)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" + " ())\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) ivec2 x@0x25e4900)\n" - " (declare (in ) ivec2 y@0x25e4a10)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) ivec2 x)\n" + " (declare (in) ivec2 y))\n" + " ())\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) ivec3 x@0x25e4bf0)\n" - " (declare (in ) ivec3 y@0x25e4d00)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) ivec3 x)\n" + " (declare (in) ivec3 y))\n" + " ())\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) ivec4 x@0x25e4ee0)\n" - " (declare (in ) ivec4 y@0x25e4ff0)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) ivec4 x)\n" + " (declare (in) ivec4 y))\n" + " ()))\n" "(function greaterThanEqual\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x25e51d0)\n" - " (declare (in ) vec2 y@0x25e52e0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" + " ())\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x25e5670)\n" - " (declare (in ) vec3 y@0x25e5780)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ())\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x25e5960)\n" - " (declare (in ) vec4 y@0x25e5a70)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" + " ())\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) ivec2 x@0x25e5c50)\n" - " (declare (in ) ivec2 y@0x25e5d60)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) ivec2 x)\n" + " (declare (in) ivec2 y))\n" + " ())\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) ivec3 x@0x25e5f40)\n" - " (declare (in ) ivec3 y@0x25e6050)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) ivec3 x)\n" + " (declare (in) ivec3 y))\n" + " ())\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) ivec4 x@0x25e6230)\n" - " (declare (in ) ivec4 y@0x25e6340)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) ivec4 x)\n" + " (declare (in) ivec4 y))\n" + " ()))\n" "(function equal\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x25e6520)\n" - " (declare (in ) vec2 y@0x25e6630)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" + " ())\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x25e69b0)\n" - " (declare (in ) vec3 y@0x25e6ac0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ())\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x25e6ca0)\n" - " (declare (in ) vec4 y@0x25e6db0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" + " ())\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) ivec2 x@0x25e6f90)\n" - " (declare (in ) ivec2 y@0x25e70a0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) ivec2 x)\n" + " (declare (in) ivec2 y))\n" + " ())\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) ivec3 x@0x25e7280)\n" - " (declare (in ) ivec3 y@0x25e7390)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) ivec3 x)\n" + " (declare (in) ivec3 y))\n" + " ())\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) ivec4 x@0x25e7570)\n" - " (declare (in ) ivec4 y@0x25e7680)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) ivec4 x)\n" + " (declare (in) ivec4 y))\n" + " ())\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) bvec2 x@0x25e7860)\n" - " (declare (in ) bvec2 y@0x25e7970)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) bvec2 x)\n" + " (declare (in) bvec2 y))\n" + " ())\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) bvec3 x@0x25e7b50)\n" - " (declare (in ) bvec3 y@0x25e7c60)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) bvec3 x)\n" + " (declare (in) bvec3 y))\n" + " ())\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) bvec4 x@0x25e7e40)\n" - " (declare (in ) bvec4 y@0x25e7f50)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) bvec4 x)\n" + " (declare (in) bvec4 y))\n" + " ()))\n" "(function notEqual\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x25e8130)\n" - " (declare (in ) vec2 y@0x25e8240)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" + " ())\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x25e85d0)\n" - " (declare (in ) vec3 y@0x25e86e0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ())\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x25e88c0)\n" - " (declare (in ) vec4 y@0x25e89d0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" + " ())\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) ivec2 x@0x25e8bb0)\n" - " (declare (in ) ivec2 y@0x25e8cc0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) ivec2 x)\n" + " (declare (in) ivec2 y))\n" + " ())\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) ivec3 x@0x25e8ea0)\n" - " (declare (in ) ivec3 y@0x25e8fb0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) ivec3 x)\n" + " (declare (in) ivec3 y))\n" + " ())\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) ivec4 x@0x25e9190)\n" - " (declare (in ) ivec4 y@0x25e92a0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) ivec4 x)\n" + " (declare (in) ivec4 y))\n" + " ())\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) bvec2 x@0x25e9480)\n" - " (declare (in ) bvec2 y@0x25e9590)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) bvec2 x)\n" + " (declare (in) bvec2 y))\n" + " ())\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) bvec3 x@0x25e9770)\n" - " (declare (in ) bvec3 y@0x25e9880)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) bvec3 x)\n" + " (declare (in) bvec3 y))\n" + " ())\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) bvec4 x@0x25e9a60)\n" - " (declare (in ) bvec4 y@0x25e9b70)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) bvec4 x)\n" + " (declare (in) bvec4 y))\n" + " ()))\n" "(function any\n" " (signature bool\n" " (parameters\n" - " (declare (in ) bvec2 x@0x25e9d50)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) bvec2 x))\n" + " ())\n" " (signature bool\n" " (parameters\n" - " (declare (in ) bvec3 x@0x25ea0d0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) bvec3 x))\n" + " ())\n" " (signature bool\n" " (parameters\n" - " (declare (in ) bvec4 x@0x25ea2b0)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) bvec4 x))\n" + " ()))\n" "(function all\n" " (signature bool\n" " (parameters\n" - " (declare (in ) bvec2 x@0x25ea490)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) bvec2 x))\n" + " ())\n" " (signature bool\n" " (parameters\n" - " (declare (in ) bvec3 x@0x25ea810)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) bvec3 x))\n" + " ())\n" " (signature bool\n" " (parameters\n" - " (declare (in ) bvec4 x@0x25ea9f0)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) bvec4 x))\n" + " ()))\n" "(function not\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) bvec2 x@0x25eabd0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) bvec2 x))\n" + " ())\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) bvec3 x@0x25eaf50)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) bvec3 x))\n" + " ())\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) bvec4 x@0x25eb130)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) bvec4 x))\n" + " ()))\n" "(function texture1D\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1D sampler@0x25eb310)\n" - " (declare (in ) float coord@0x25eb420)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) float coord))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1D sampler@0x25ebf40)\n" - " (declare (in ) float coord@0x25ec050)\n" - " (declare (in ) float bias@0x25ec160)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) float coord)\n" + " (declare (in) float bias))\n" + " ()))\n" "(function texture1DProj\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1D sampler@0x25eb7b0)\n" - " (declare (in ) vec2 coord@0x25eb8c0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) vec2 coord))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1D sampler@0x25ebc50)\n" - " (declare (in ) vec4 coord@0x25ebd60)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) vec4 coord))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1D sampler@0x25ec340)\n" - " (declare (in ) vec2 coord@0x25ec450)\n" - " (declare (in ) float bias@0x25ec560)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) vec2 coord)\n" + " (declare (in) float bias))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1D sampler@0x25ec740)\n" - " (declare (in ) vec4 coord@0x25ec850)\n" - " (declare (in ) float bias@0x25ec960)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) vec4 coord)\n" + " (declare (in) float bias))\n" + " ()))\n" "(function texture2D\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2D sampler@0x25ecb40)\n" - " (declare (in ) vec2 coord@0x25ecc50)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec2 coord))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2D sampler@0x25ed770)\n" - " (declare (in ) vec2 coord@0x25ed880)\n" - " (declare (in ) float bias@0x25ed990)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec2 coord)\n" + " (declare (in) float bias))\n" + " ()))\n" "(function texture2DProj\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2D sampler@0x25ecfe0)\n" - " (declare (in ) vec3 coord@0x25ed0f0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec3 coord))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2D sampler@0x25ed480)\n" - " (declare (in ) vec4 coord@0x25ed590)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec4 coord))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2D sampler@0x25edb70)\n" - " (declare (in ) vec3 coord@0x25edc80)\n" - " (declare (in ) float bias@0x25edd90)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec3 coord)\n" + " (declare (in) float bias))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2D sampler@0x25edf70)\n" - " (declare (in ) vec4 coord@0x25ee080)\n" - " (declare (in ) float bias@0x25ee190)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec4 coord)\n" + " (declare (in) float bias))\n" + " ()))\n" "(function texture3D\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler3D sampler@0x25ee370)\n" - " (declare (in ) vec3 coord@0x25ee480)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler3D sampler)\n" + " (declare (in) vec3 coord))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler3D sampler@0x25eecb0)\n" - " (declare (in ) vec3 coord@0x25eedc0)\n" - " (declare (in ) float bias@0x25eeed0)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) sampler3D sampler)\n" + " (declare (in) vec3 coord)\n" + " (declare (in) float bias))\n" + " ()))\n" "(function texture3DProj\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler3D sampler@0x25ee810)\n" - " (declare (in ) vec4 coord@0x25ee920)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler3D sampler)\n" + " (declare (in) vec4 coord))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler3D sampler@0x25ef0b0)\n" - " (declare (in ) vec4 coord@0x25ef1c0)\n" - " (declare (in ) float bias@0x25ef2d0)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) sampler3D sampler)\n" + " (declare (in) vec4 coord)\n" + " (declare (in) float bias))\n" + " ()))\n" "(function textureCube\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) samplerCube sampler@0x25ef4b0)\n" - " (declare (in ) vec3 coord@0x25ef5c0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) samplerCube sampler)\n" + " (declare (in) vec3 coord))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) samplerCube sampler@0x25ef950)\n" - " (declare (in ) vec3 coord@0x25efa60)\n" - " (declare (in ) float bias@0x25efb70)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) samplerCube sampler)\n" + " (declare (in) vec3 coord)\n" + " (declare (in) float bias))\n" + " ()))\n" "(function shadow1D\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1DShadow sampler@0x25efd50)\n" - " (declare (in ) vec3 coord@0x25efe60)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler1DShadow sampler)\n" + " (declare (in) vec3 coord))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1DShadow sampler@0x25f0fd0)\n" - " (declare (in ) vec3 coord@0x25f10e0)\n" - " (declare (in ) float bias@0x25f11f0)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) sampler1DShadow sampler)\n" + " (declare (in) vec3 coord)\n" + " (declare (in) float bias))\n" + " ()))\n" "(function shadow2D\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2DShadow sampler@0x25f01f0)\n" - " (declare (in ) vec3 coord@0x25f0300)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler2DShadow sampler)\n" + " (declare (in) vec3 coord))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2DShadow sampler@0x25f13d0)\n" - " (declare (in ) vec3 coord@0x25f14e0)\n" - " (declare (in ) float bias@0x25f15f0)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) sampler2DShadow sampler)\n" + " (declare (in) vec3 coord)\n" + " (declare (in) float bias))\n" + " ()))\n" "(function shadow1DProj\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1DShadow sampler@0x25f0690)\n" - " (declare (in ) vec4 coord@0x25f07a0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler1DShadow sampler)\n" + " (declare (in) vec4 coord))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1DShadow sampler@0x25f17d0)\n" - " (declare (in ) vec4 coord@0x25f18e0)\n" - " (declare (in ) float bias@0x25f19f0)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) sampler1DShadow sampler)\n" + " (declare (in) vec4 coord)\n" + " (declare (in) float bias))\n" + " ()))\n" "(function shadow2DProj\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2DShadow sampler@0x25f0b30)\n" - " (declare (in ) vec4 coord@0x25f0c40)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler2DShadow sampler)\n" + " (declare (in) vec4 coord))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2DShadow sampler@0x25f1bd0)\n" - " (declare (in ) vec4 coord@0x25f1ce0)\n" - " (declare (in ) float bias@0x25f1df0)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) sampler2DShadow sampler)\n" + " (declare (in) vec4 coord)\n" + " (declare (in) float bias))\n" + " ()))\n" "(function dFdx\n" " (signature float\n" " (parameters\n" - " (declare (in ) float p@0x25f1fd0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float p))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 p@0x25f2350)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 p))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 p@0x25f2530)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 p))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 p@0x25f2710)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 p))\n" + " ()))\n" "(function dFdy\n" " (signature float\n" " (parameters\n" - " (declare (in ) float p@0x25f28f0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float p))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 p@0x25f2c70)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 p))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 p@0x25f2e50)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 p))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 p@0x25f3030)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 p))\n" + " ()))\n" "(function fwidth\n" " (signature float\n" " (parameters\n" - " (declare (in ) float p@0x25f3210)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float p))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 p@0x25f3590)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 p))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 p@0x25f3770)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 p))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 p@0x25f3950)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 p))\n" + " ()))\n" "(function noise1\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x25f3b30)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float x))\n" + " ())\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec2 x@0x25f3eb0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x))\n" + " ())\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec3 x@0x25f4090)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x))\n" + " ())\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec4 x@0x25f4270)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 x))\n" + " ()))\n" "(function noise2\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) float x@0x25f4450)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float x))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x25f47d0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec3 x@0x25f49b0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec4 x@0x25f4b90)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 x))\n" + " ()))\n" "(function noise3\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) float x@0x25f4d70)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float x))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec2 x@0x25f50f0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x25f52d0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec4 x@0x25f54b0)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 x))\n" + " ()))\n" "(function noise4\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) float x@0x25f5690)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float x))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec2 x@0x25f5a10)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec3 x@0x25f5bf0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x25f5dd0)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" - "\n" - ")" + " (declare (in) vec4 x))\n" + " ())))" ; static const char *functions_for_110_frag [] = { builtin_clamp, @@ -11927,85 +9036,48 @@ static const char *prototypes_for_EXT_texture_array_vert = "(function texture1DArray\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1DArray sampler@0x1bf6290)\n" - " (declare (in ) vec2 coord@0x1bf63a0)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) sampler1DArray sampler)\n" + " (declare (in) vec2 coord))\n" + " ()))\n" "(function texture1DArrayLod\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1DArray sampler@0x1bf6730)\n" - " (declare (in ) vec2 coord@0x1bf6840)\n" - " (declare (in ) float lod@0x1bf6950)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) sampler1DArray sampler)\n" + " (declare (in) vec2 coord)\n" + " (declare (in) float lod))\n" + " ()))\n" "(function texture2DArray\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2DArray sampler@0x1bf6ce0)\n" - " (declare (in ) vec3 coord@0x1bf6df0)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) sampler2DArray sampler)\n" + " (declare (in) vec3 coord))\n" + " ()))\n" "(function texture2DArrayLod\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2DArray sampler@0x1bf7180)\n" - " (declare (in ) vec3 coord@0x1bf7290)\n" - " (declare (in ) float lod@0x1bf73a0)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) sampler2DArray sampler)\n" + " (declare (in) vec3 coord)\n" + " (declare (in) float lod))\n" + " ()))\n" "(function shadow1DArray\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1DArrayShadow sampler@0x1bf7730)\n" - " (declare (in ) vec3 coord@0x1bf7840)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) sampler1DArrayShadow sampler)\n" + " (declare (in) vec3 coord))\n" + " ()))\n" "(function shadow1DArrayLod\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1DArrayShadow sampler@0x1bf7bd0)\n" - " (declare (in ) vec3 coord@0x1bf7ce0)\n" - " (declare (in ) float lod@0x1bf7df0)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) sampler1DArrayShadow sampler)\n" + " (declare (in) vec3 coord)\n" + " (declare (in) float lod))\n" + " ()))\n" "(function shadow2DArray\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2DArrayShadow sampler@0x1bf8180)\n" - " (declare (in ) vec4 coord@0x1bf8290)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" - "\n" - ")" + " (declare (in) sampler2DArrayShadow sampler)\n" + " (declare (in) vec4 coord))\n" + " ())))" ; static const char *functions_for_EXT_texture_array_vert [] = { builtin_texture1DArrayLod, @@ -12021,4817 +9093,3062 @@ static const char *prototypes_for_130_frag = "(function radians\n" " (signature float\n" " (parameters\n" - " (declare (in ) float degrees@0x15ce070)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float degrees))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 degrees@0x15ce3f0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 degrees))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 degrees@0x15ce5d0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 degrees))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 degrees@0x15ce7b0)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 degrees))\n" + " ()))\n" "(function degrees\n" " (signature float\n" " (parameters\n" - " (declare (in ) float radians@0x15ce990)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float radians))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 radians@0x15ced10)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 radians))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 radians@0x15ceef0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 radians))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 radians@0x15cf0d0)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 radians))\n" + " ()))\n" "(function sin\n" " (signature float\n" " (parameters\n" - " (declare (in ) float angle@0x15cf2b0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float angle))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 angle@0x15cf630)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 angle))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 angle@0x15cf810)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 angle))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 angle@0x15cf9f0)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 angle))\n" + " ()))\n" "(function cos\n" " (signature float\n" " (parameters\n" - " (declare (in ) float angle@0x15cfbd0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float angle))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 angle@0x15cff50)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 angle))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 angle@0x15d0130)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 angle))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 angle@0x15d0310)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 angle))\n" + " ()))\n" "(function tan\n" " (signature float\n" " (parameters\n" - " (declare (in ) float angle@0x15d04f0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float angle))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 angle@0x15d0870)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 angle))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 angle@0x15d0a50)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 angle))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 angle@0x15d0c30)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 angle))\n" + " ()))\n" "(function asin\n" " (signature float\n" " (parameters\n" - " (declare (in ) float angle@0x15d0e10)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float angle))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 angle@0x15d1190)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 angle))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 angle@0x15d1370)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 angle))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 angle@0x15d1550)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 angle))\n" + " ()))\n" "(function acos\n" " (signature float\n" " (parameters\n" - " (declare (in ) float angle@0x15d1730)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float angle))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 angle@0x15d1ab0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 angle))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 angle@0x15d1c90)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 angle))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 angle@0x15d1e70)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 angle))\n" + " ()))\n" "(function atan\n" " (signature float\n" " (parameters\n" - " (declare (in ) float y@0x15d2050)\n" - " (declare (in ) float x@0x15d2160)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float y)\n" + " (declare (in) float x))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 y@0x15d24e0)\n" - " (declare (in ) vec2 x@0x15d25f0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 y)\n" + " (declare (in) vec2 x))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 y@0x15d27d0)\n" - " (declare (in ) vec3 x@0x15d28e0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 y)\n" + " (declare (in) vec3 x))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 y@0x15d2ac0)\n" - " (declare (in ) vec4 x@0x15d2bd0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec4 y)\n" + " (declare (in) vec4 x))\n" + " ())\n" " (signature float\n" " (parameters\n" - " (declare (in ) float y_over_x@0x15d2db0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float y_over_x))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 y_over_x@0x15d2fa0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 y_over_x))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 y_over_x@0x15d3190)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 y_over_x))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 y_over_x@0x15d3380)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 y_over_x))\n" + " ()))\n" + "(function sinh\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function cosh\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function tanh\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x))\n" + " ()))\n" "(function pow\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x15d3570)\n" - " (declare (in ) float y@0x15d3680)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float x)\n" + " (declare (in) float y))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x15d3a00)\n" - " (declare (in ) vec2 y@0x15d3b10)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x15d3cf0)\n" - " (declare (in ) vec3 y@0x15d3e00)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x15d3fe0)\n" - " (declare (in ) vec4 y@0x15d40f0)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" + " ()))\n" "(function exp\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x15d42d0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float x))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x15d4650)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x15d4830)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x15d4a10)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 x))\n" + " ()))\n" "(function log\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x15d4bf0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float x))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x15d4f70)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x15d5150)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x15d5330)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 x))\n" + " ()))\n" "(function exp2\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x15d5510)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float x))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x15d5890)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x15d5a70)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x15d5c50)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 x))\n" + " ()))\n" "(function log2\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x15d5e30)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float x))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x15d61b0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x15d6390)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x15d6570)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 x))\n" + " ()))\n" "(function sqrt\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x15d6750)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float x))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x15d6ad0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x15d6cb0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x15d6e90)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 x))\n" + " ()))\n" "(function inversesqrt\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x15d7070)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float x))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x15d7400)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x15d75e0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x15d77c0)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 x))\n" + " ()))\n" "(function abs\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x15d79a0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float x))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x15d7d20)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x15d7f00)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x15d80e0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec4 x))\n" + " ())\n" " (signature int\n" " (parameters\n" - " (declare (in ) int x@0x15d82c0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) int x))\n" + " ())\n" " (signature ivec2\n" " (parameters\n" - " (declare (in ) ivec2 x@0x15d84a0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) ivec2 x))\n" + " ())\n" " (signature ivec3\n" " (parameters\n" - " (declare (in ) ivec3 x@0x15d8680)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) ivec3 x))\n" + " ())\n" " (signature ivec4\n" " (parameters\n" - " (declare (in ) ivec4 x@0x15d8860)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) ivec4 x))\n" + " ()))\n" "(function sign\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x15d8a40)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float x))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x15d8dc0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x15d8fa0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x15d9180)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec4 x))\n" + " ())\n" " (signature int\n" " (parameters\n" - " (declare (in ) int x@0x15d9360)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) int x))\n" + " ())\n" " (signature ivec2\n" " (parameters\n" - " (declare (in ) ivec2 x@0x15d9540)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) ivec2 x))\n" + " ())\n" " (signature ivec3\n" " (parameters\n" - " (declare (in ) ivec3 x@0x15d9720)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) ivec3 x))\n" + " ())\n" " (signature ivec4\n" " (parameters\n" - " (declare (in ) ivec4 x@0x15d9900)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) ivec4 x))\n" + " ()))\n" "(function floor\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x15d9ae0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float x))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x15d9e60)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x15da040)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x15da220)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 x))\n" + " ()))\n" "(function ceil\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x15da400)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float x))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x15da780)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x15da960)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x15dab40)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 x))\n" + " ()))\n" "(function fract\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x15dad20)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float x))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x15db0a0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x15db280)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x15db460)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 x))\n" + " ()))\n" "(function mod\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x15db640)\n" - " (declare (in ) float y@0x15db750)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float x)\n" + " (declare (in) float y))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x15dbad0)\n" - " (declare (in ) float y@0x15dbbe0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x)\n" + " (declare (in) float y))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x15dbdc0)\n" - " (declare (in ) float y@0x15dbed0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x)\n" + " (declare (in) float y))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x15dc0b0)\n" - " (declare (in ) float y@0x15dc1c0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec4 x)\n" + " (declare (in) float y))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x15dc3a0)\n" - " (declare (in ) vec2 y@0x15dc4b0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x15dc690)\n" - " (declare (in ) vec3 y@0x15dc7a0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x15dc980)\n" - " (declare (in ) vec4 y@0x15dca90)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" + " ()))\n" "(function min\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x15dcc70)\n" - " (declare (in ) float y@0x15dcd80)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float x)\n" + " (declare (in) float y))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x15dd100)\n" - " (declare (in ) vec2 y@0x15dd210)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x15dd3f0)\n" - " (declare (in ) vec3 y@0x15dd500)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x15dd6e0)\n" - " (declare (in ) vec4 y@0x15dd7f0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x15dd9d0)\n" - " (declare (in ) float y@0x15ddae0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x)\n" + " (declare (in) float y))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x15ddcc0)\n" - " (declare (in ) float y@0x15dddd0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x)\n" + " (declare (in) float y))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x15ddfb0)\n" - " (declare (in ) float y@0x15de0c0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec4 x)\n" + " (declare (in) float y))\n" + " ())\n" " (signature int\n" " (parameters\n" - " (declare (in ) int x@0x15de2a0)\n" - " (declare (in ) int y@0x15de3b0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) int x)\n" + " (declare (in) int y))\n" + " ())\n" " (signature ivec2\n" " (parameters\n" - " (declare (in ) ivec2 x@0x15de590)\n" - " (declare (in ) ivec2 y@0x15de6a0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) ivec2 x)\n" + " (declare (in) ivec2 y))\n" + " ())\n" " (signature ivec3\n" " (parameters\n" - " (declare (in ) ivec3 x@0x15de880)\n" - " (declare (in ) ivec3 y@0x15de990)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) ivec3 x)\n" + " (declare (in) ivec3 y))\n" + " ())\n" " (signature ivec4\n" " (parameters\n" - " (declare (in ) ivec4 x@0x15deb70)\n" - " (declare (in ) ivec4 y@0x15dec80)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) ivec4 x)\n" + " (declare (in) ivec4 y))\n" + " ())\n" " (signature ivec2\n" " (parameters\n" - " (declare (in ) ivec2 x@0x15dee60)\n" - " (declare (in ) int y@0x15def70)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) ivec2 x)\n" + " (declare (in) int y))\n" + " ())\n" " (signature ivec3\n" " (parameters\n" - " (declare (in ) ivec3 x@0x15df150)\n" - " (declare (in ) int y@0x15df260)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) ivec3 x)\n" + " (declare (in) int y))\n" + " ())\n" " (signature ivec4\n" " (parameters\n" - " (declare (in ) ivec4 x@0x15df440)\n" - " (declare (in ) int y@0x15df550)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) ivec4 x)\n" + " (declare (in) int y))\n" + " ())\n" " (signature uint\n" " (parameters\n" - " (declare (in ) uint x@0x15df730)\n" - " (declare (in ) uint y@0x15df840)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) uint x)\n" + " (declare (in) uint y))\n" + " ())\n" " (signature uvec2\n" " (parameters\n" - " (declare (in ) uvec2 x@0x15dfa20)\n" - " (declare (in ) uvec2 y@0x15dfb30)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) uvec2 x)\n" + " (declare (in) uvec2 y))\n" + " ())\n" " (signature uvec3\n" " (parameters\n" - " (declare (in ) uvec3 x@0x15dfd10)\n" - " (declare (in ) uvec3 y@0x15dfe20)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) uvec3 x)\n" + " (declare (in) uvec3 y))\n" + " ())\n" " (signature uvec4\n" " (parameters\n" - " (declare (in ) uvec4 x@0x15e0000)\n" - " (declare (in ) uvec4 y@0x15e0110)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) uvec4 x)\n" + " (declare (in) uvec4 y))\n" + " ())\n" " (signature uvec2\n" " (parameters\n" - " (declare (in ) uvec2 x@0x15e02f0)\n" - " (declare (in ) uint y@0x15e0400)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) uvec2 x)\n" + " (declare (in) uint y))\n" + " ())\n" " (signature uvec3\n" " (parameters\n" - " (declare (in ) uvec3 x@0x15e05e0)\n" - " (declare (in ) uint y@0x15e06f0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) uvec3 x)\n" + " (declare (in) uint y))\n" + " ())\n" " (signature uvec4\n" " (parameters\n" - " (declare (in ) uvec4 x@0x15e08d0)\n" - " (declare (in ) uint y@0x15e09e0)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) uvec4 x)\n" + " (declare (in) uint y))\n" + " ()))\n" "(function max\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x15e0bc0)\n" - " (declare (in ) float y@0x15e0cd0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float x)\n" + " (declare (in) float y))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x15e1050)\n" - " (declare (in ) vec2 y@0x15e1160)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x15e1340)\n" - " (declare (in ) vec3 y@0x15e1450)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x15e1630)\n" - " (declare (in ) vec4 y@0x15e1740)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x15e1920)\n" - " (declare (in ) float y@0x15e1a30)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x)\n" + " (declare (in) float y))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x15e1c10)\n" - " (declare (in ) float y@0x15e1d20)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x)\n" + " (declare (in) float y))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x15e1f00)\n" - " (declare (in ) float y@0x15e2010)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec4 x)\n" + " (declare (in) float y))\n" + " ())\n" " (signature int\n" " (parameters\n" - " (declare (in ) int x@0x15e21f0)\n" - " (declare (in ) int y@0x15e2300)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) int x)\n" + " (declare (in) int y))\n" + " ())\n" " (signature ivec2\n" " (parameters\n" - " (declare (in ) ivec2 x@0x15e24e0)\n" - " (declare (in ) ivec2 y@0x15e25f0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) ivec2 x)\n" + " (declare (in) ivec2 y))\n" + " ())\n" " (signature ivec3\n" " (parameters\n" - " (declare (in ) ivec3 x@0x15e27d0)\n" - " (declare (in ) ivec3 y@0x15e28e0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) ivec3 x)\n" + " (declare (in) ivec3 y))\n" + " ())\n" " (signature ivec4\n" " (parameters\n" - " (declare (in ) ivec4 x@0x15e2ac0)\n" - " (declare (in ) ivec4 y@0x15e2bd0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) ivec4 x)\n" + " (declare (in) ivec4 y))\n" + " ())\n" " (signature ivec2\n" " (parameters\n" - " (declare (in ) ivec2 x@0x15e2db0)\n" - " (declare (in ) int y@0x15e2ec0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) ivec2 x)\n" + " (declare (in) int y))\n" + " ())\n" " (signature ivec3\n" " (parameters\n" - " (declare (in ) ivec3 x@0x15e30a0)\n" - " (declare (in ) int y@0x15e31b0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) ivec3 x)\n" + " (declare (in) int y))\n" + " ())\n" " (signature ivec4\n" " (parameters\n" - " (declare (in ) ivec4 x@0x15e3390)\n" - " (declare (in ) int y@0x15e34a0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) ivec4 x)\n" + " (declare (in) int y))\n" + " ())\n" " (signature uint\n" " (parameters\n" - " (declare (in ) uint x@0x15e3680)\n" - " (declare (in ) uint y@0x15e3790)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) uint x)\n" + " (declare (in) uint y))\n" + " ())\n" " (signature uvec2\n" " (parameters\n" - " (declare (in ) uvec2 x@0x15e3970)\n" - " (declare (in ) uvec2 y@0x15e3a80)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) uvec2 x)\n" + " (declare (in) uvec2 y))\n" + " ())\n" " (signature uvec3\n" " (parameters\n" - " (declare (in ) uvec3 x@0x15e3c60)\n" - " (declare (in ) uvec3 y@0x15e3d70)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) uvec3 x)\n" + " (declare (in) uvec3 y))\n" + " ())\n" " (signature uvec4\n" " (parameters\n" - " (declare (in ) uvec4 x@0x15e3f50)\n" - " (declare (in ) uvec4 y@0x15e4060)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) uvec4 x)\n" + " (declare (in) uvec4 y))\n" + " ())\n" " (signature uvec2\n" " (parameters\n" - " (declare (in ) uvec2 x@0x15e4240)\n" - " (declare (in ) uint y@0x15e4350)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) uvec2 x)\n" + " (declare (in) uint y))\n" + " ())\n" " (signature uvec3\n" " (parameters\n" - " (declare (in ) uvec3 x@0x15e4530)\n" - " (declare (in ) uint y@0x15e4640)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) uvec3 x)\n" + " (declare (in) uint y))\n" + " ())\n" " (signature uvec4\n" " (parameters\n" - " (declare (in ) uvec4 x@0x15e4820)\n" - " (declare (in ) uint y@0x15e4930)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) uvec4 x)\n" + " (declare (in) uint y))\n" + " ()))\n" "(function clamp\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x15e4b10)\n" - " (declare (in ) float minVal@0x15e4c20)\n" - " (declare (in ) float maxVal@0x15e4d30)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float x)\n" + " (declare (in) float minVal)\n" + " (declare (in) float maxVal))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x15e50b0)\n" - " (declare (in ) vec2 minVal@0x15e51c0)\n" - " (declare (in ) vec2 maxVal@0x15e52d0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 minVal)\n" + " (declare (in) vec2 maxVal))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x15e54b0)\n" - " (declare (in ) vec3 minVal@0x15e55c0)\n" - " (declare (in ) vec3 maxVal@0x15e56d0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 minVal)\n" + " (declare (in) vec3 maxVal))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x15e58b0)\n" - " (declare (in ) vec4 minVal@0x15e59c0)\n" - " (declare (in ) vec4 maxVal@0x15e5ad0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 minVal)\n" + " (declare (in) vec4 maxVal))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x15e5cb0)\n" - " (declare (in ) float minVal@0x15e5dc0)\n" - " (declare (in ) float maxVal@0x15e5ed0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x)\n" + " (declare (in) float minVal)\n" + " (declare (in) float maxVal))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x15e60b0)\n" - " (declare (in ) float minVal@0x15e61c0)\n" - " (declare (in ) float maxVal@0x15e62d0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x)\n" + " (declare (in) float minVal)\n" + " (declare (in) float maxVal))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x15e64b0)\n" - " (declare (in ) float minVal@0x15e65c0)\n" - " (declare (in ) float maxVal@0x15e66d0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec4 x)\n" + " (declare (in) float minVal)\n" + " (declare (in) float maxVal))\n" + " ())\n" " (signature int\n" " (parameters\n" - " (declare (in ) int x@0x15e68b0)\n" - " (declare (in ) int minVal@0x15e69c0)\n" - " (declare (in ) int maxVal@0x15e6ad0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) int x)\n" + " (declare (in) int minVal)\n" + " (declare (in) int maxVal))\n" + " ())\n" " (signature ivec2\n" " (parameters\n" - " (declare (in ) ivec2 x@0x15e6cb0)\n" - " (declare (in ) ivec2 minVal@0x15e6dc0)\n" - " (declare (in ) ivec2 maxVal@0x15e6ed0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) ivec2 x)\n" + " (declare (in) ivec2 minVal)\n" + " (declare (in) ivec2 maxVal))\n" + " ())\n" " (signature ivec3\n" " (parameters\n" - " (declare (in ) ivec3 x@0x15e70b0)\n" - " (declare (in ) ivec3 minVal@0x15e71c0)\n" - " (declare (in ) ivec3 maxVal@0x15e72d0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) ivec3 x)\n" + " (declare (in) ivec3 minVal)\n" + " (declare (in) ivec3 maxVal))\n" + " ())\n" " (signature ivec4\n" " (parameters\n" - " (declare (in ) ivec4 x@0x15e74b0)\n" - " (declare (in ) ivec4 minVal@0x15e75c0)\n" - " (declare (in ) ivec4 maxVal@0x15e76d0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) ivec4 x)\n" + " (declare (in) ivec4 minVal)\n" + " (declare (in) ivec4 maxVal))\n" + " ())\n" " (signature ivec2\n" " (parameters\n" - " (declare (in ) ivec2 x@0x15e78b0)\n" - " (declare (in ) int minVal@0x15e79c0)\n" - " (declare (in ) int maxVal@0x15e7ad0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) ivec2 x)\n" + " (declare (in) int minVal)\n" + " (declare (in) int maxVal))\n" + " ())\n" " (signature ivec3\n" " (parameters\n" - " (declare (in ) ivec3 x@0x15e7cb0)\n" - " (declare (in ) int minVal@0x15e7dc0)\n" - " (declare (in ) int maxVal@0x15e7ed0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) ivec3 x)\n" + " (declare (in) int minVal)\n" + " (declare (in) int maxVal))\n" + " ())\n" " (signature ivec4\n" " (parameters\n" - " (declare (in ) ivec4 x@0x15e80b0)\n" - " (declare (in ) int minVal@0x15e81c0)\n" - " (declare (in ) int maxVal@0x15e82d0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) ivec4 x)\n" + " (declare (in) int minVal)\n" + " (declare (in) int maxVal))\n" + " ())\n" " (signature uint\n" " (parameters\n" - " (declare (in ) uint x@0x15e84b0)\n" - " (declare (in ) uint minVal@0x15e85c0)\n" - " (declare (in ) uint maxVal@0x15e86d0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) uint x)\n" + " (declare (in) uint minVal)\n" + " (declare (in) uint maxVal))\n" + " ())\n" " (signature uvec2\n" " (parameters\n" - " (declare (in ) uvec2 x@0x15e88b0)\n" - " (declare (in ) uvec2 minVal@0x15e89c0)\n" - " (declare (in ) uvec2 maxVal@0x15e8ad0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) uvec2 x)\n" + " (declare (in) uvec2 minVal)\n" + " (declare (in) uvec2 maxVal))\n" + " ())\n" " (signature uvec3\n" " (parameters\n" - " (declare (in ) uvec3 x@0x15e8cb0)\n" - " (declare (in ) uvec3 minVal@0x15e8dc0)\n" - " (declare (in ) uvec3 maxVal@0x15e8ed0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) uvec3 x)\n" + " (declare (in) uvec3 minVal)\n" + " (declare (in) uvec3 maxVal))\n" + " ())\n" " (signature uvec4\n" " (parameters\n" - " (declare (in ) uvec4 x@0x15e90b0)\n" - " (declare (in ) uvec4 minVal@0x15e91c0)\n" - " (declare (in ) uvec4 maxVal@0x15e92d0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) uvec4 x)\n" + " (declare (in) uvec4 minVal)\n" + " (declare (in) uvec4 maxVal))\n" + " ())\n" " (signature uvec2\n" " (parameters\n" - " (declare (in ) uvec2 x@0x15e94b0)\n" - " (declare (in ) uint minVal@0x15e95c0)\n" - " (declare (in ) uint maxVal@0x15e96d0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) uvec2 x)\n" + " (declare (in) uint minVal)\n" + " (declare (in) uint maxVal))\n" + " ())\n" " (signature uvec3\n" " (parameters\n" - " (declare (in ) uvec3 x@0x15e98b0)\n" - " (declare (in ) uint minVal@0x15e99c0)\n" - " (declare (in ) uint maxVal@0x15e9ad0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) uvec3 x)\n" + " (declare (in) uint minVal)\n" + " (declare (in) uint maxVal))\n" + " ())\n" " (signature uvec4\n" " (parameters\n" - " (declare (in ) uvec4 x@0x15e9cb0)\n" - " (declare (in ) uint minVal@0x15e9dc0)\n" - " (declare (in ) uint maxVal@0x15e9ed0)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) uvec4 x)\n" + " (declare (in) uint minVal)\n" + " (declare (in) uint maxVal))\n" + " ()))\n" "(function mix\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x15ea0b0)\n" - " (declare (in ) float y@0x15ea1c0)\n" - " (declare (in ) float a@0x15ea2d0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float x)\n" + " (declare (in) float y)\n" + " (declare (in) float a))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x15ea650)\n" - " (declare (in ) vec2 y@0x15ea760)\n" - " (declare (in ) vec2 a@0x15ea870)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y)\n" + " (declare (in) vec2 a))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x15eaa50)\n" - " (declare (in ) vec3 y@0x15eab60)\n" - " (declare (in ) vec3 a@0x15eac70)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y)\n" + " (declare (in) vec3 a))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x15eae50)\n" - " (declare (in ) vec4 y@0x15eaf60)\n" - " (declare (in ) vec4 a@0x15eb070)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y)\n" + " (declare (in) vec4 a))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x15eb250)\n" - " (declare (in ) vec2 y@0x15eb360)\n" - " (declare (in ) float a@0x15eb470)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y)\n" + " (declare (in) float a))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x15eb650)\n" - " (declare (in ) vec3 y@0x15eb760)\n" - " (declare (in ) float a@0x15eb870)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y)\n" + " (declare (in) float a))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x15eba50)\n" - " (declare (in ) vec4 y@0x15ebb60)\n" - " (declare (in ) float a@0x15ebc70)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y)\n" + " (declare (in) float a))\n" + " ()))\n" "(function step\n" " (signature float\n" " (parameters\n" - " (declare (in ) float edge@0x15ebe50)\n" - " (declare (in ) float x@0x15ebf60)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float edge)\n" + " (declare (in) float x))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 edge@0x15ec2e0)\n" - " (declare (in ) vec2 x@0x15ec3f0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 edge)\n" + " (declare (in) vec2 x))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 edge@0x15ec5d0)\n" - " (declare (in ) vec3 x@0x15ec6e0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 edge)\n" + " (declare (in) vec3 x))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 edge@0x15ec8c0)\n" - " (declare (in ) vec4 x@0x15ec9d0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec4 edge)\n" + " (declare (in) vec4 x))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) float edge@0x15ecbb0)\n" - " (declare (in ) vec2 x@0x15eccc0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float edge)\n" + " (declare (in) vec2 x))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) float edge@0x15ecea0)\n" - " (declare (in ) vec3 x@0x15ecfb0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float edge)\n" + " (declare (in) vec3 x))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) float edge@0x15ed190)\n" - " (declare (in ) vec4 x@0x15ed2a0)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) float edge)\n" + " (declare (in) vec4 x))\n" + " ()))\n" "(function smoothstep\n" " (signature float\n" " (parameters\n" - " (declare (in ) float edge0@0x15ed480)\n" - " (declare (in ) float edge1@0x15ed590)\n" - " (declare (in ) float x@0x15ed6a0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float edge0)\n" + " (declare (in) float edge1)\n" + " (declare (in) float x))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 edge0@0x15eda30)\n" - " (declare (in ) vec2 edge1@0x15edb40)\n" - " (declare (in ) vec2 x@0x15edc50)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 edge0)\n" + " (declare (in) vec2 edge1)\n" + " (declare (in) vec2 x))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 edge0@0x15ede30)\n" - " (declare (in ) vec3 edge1@0x15edf40)\n" - " (declare (in ) vec3 x@0x15ee050)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 edge0)\n" + " (declare (in) vec3 edge1)\n" + " (declare (in) vec3 x))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 edge0@0x15ee230)\n" - " (declare (in ) vec4 edge1@0x15ee340)\n" - " (declare (in ) vec4 x@0x15ee450)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec4 edge0)\n" + " (declare (in) vec4 edge1)\n" + " (declare (in) vec4 x))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) float edge0@0x15ee630)\n" - " (declare (in ) float edge1@0x15ee740)\n" - " (declare (in ) vec2 x@0x15ee850)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float edge0)\n" + " (declare (in) float edge1)\n" + " (declare (in) vec2 x))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) float edge0@0x15eea30)\n" - " (declare (in ) float edge1@0x15eeb40)\n" - " (declare (in ) vec3 x@0x15eec50)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float edge0)\n" + " (declare (in) float edge1)\n" + " (declare (in) vec3 x))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) float edge0@0x15eee30)\n" - " (declare (in ) float edge1@0x15eef40)\n" - " (declare (in ) vec4 x@0x15ef050)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) float edge0)\n" + " (declare (in) float edge1)\n" + " (declare (in) vec4 x))\n" + " ()))\n" "(function length\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x15ef230)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float x))\n" + " ())\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec2 x@0x15ef5b0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x))\n" + " ())\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec3 x@0x15ef790)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x))\n" + " ())\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec4 x@0x15ef970)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 x))\n" + " ()))\n" "(function distance\n" " (signature float\n" " (parameters\n" - " (declare (in ) float p0@0x15efb50)\n" - " (declare (in ) float p1@0x15efc60)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float p0)\n" + " (declare (in) float p1))\n" + " ())\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec2 p0@0x15efff0)\n" - " (declare (in ) vec2 p1@0x15f0100)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 p0)\n" + " (declare (in) vec2 p1))\n" + " ())\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec3 p0@0x15f02e0)\n" - " (declare (in ) vec3 p1@0x15f03f0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 p0)\n" + " (declare (in) vec3 p1))\n" + " ())\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec4 p0@0x15f05d0)\n" - " (declare (in ) vec4 p1@0x15f06e0)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 p0)\n" + " (declare (in) vec4 p1))\n" + " ()))\n" "(function dot\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x15f08c0)\n" - " (declare (in ) float y@0x15f09d0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float x)\n" + " (declare (in) float y))\n" + " ())\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec2 x@0x15f0d50)\n" - " (declare (in ) vec2 y@0x15f0e60)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" + " ())\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec3 x@0x15f1040)\n" - " (declare (in ) vec3 y@0x15f1150)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ())\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec4 x@0x15f1330)\n" - " (declare (in ) vec4 y@0x15f1440)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" + " ()))\n" "(function cross\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x15f1620)\n" - " (declare (in ) vec3 y@0x15f1730)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ()))\n" "(function normalize\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x15f1ab0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float x))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x15f1e40)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x15f2020)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x15f2200)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 x))\n" + " ()))\n" "(function faceforward\n" " (signature float\n" " (parameters\n" - " (declare (in ) float N@0x15f23e0)\n" - " (declare (in ) float I@0x15f24f0)\n" - " (declare (in ) float Nref@0x15f2600)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float N)\n" + " (declare (in) float I)\n" + " (declare (in) float Nref))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 N@0x15f2990)\n" - " (declare (in ) vec2 I@0x15f2aa0)\n" - " (declare (in ) vec2 Nref@0x15f2bb0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 N)\n" + " (declare (in) vec2 I)\n" + " (declare (in) vec2 Nref))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 N@0x15f2d90)\n" - " (declare (in ) vec3 I@0x15f2ea0)\n" - " (declare (in ) vec3 Nref@0x15f2fb0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 N)\n" + " (declare (in) vec3 I)\n" + " (declare (in) vec3 Nref))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 N@0x15f3190)\n" - " (declare (in ) vec4 I@0x15f32a0)\n" - " (declare (in ) vec4 Nref@0x15f33b0)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 N)\n" + " (declare (in) vec4 I)\n" + " (declare (in) vec4 Nref))\n" + " ()))\n" "(function reflect\n" " (signature float\n" " (parameters\n" - " (declare (in ) float I@0x15f3590)\n" - " (declare (in ) float N@0x15f36a0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float I)\n" + " (declare (in) float N))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 I@0x15f3a20)\n" - " (declare (in ) vec2 N@0x15f3b30)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 I)\n" + " (declare (in) vec2 N))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 I@0x15f3d10)\n" - " (declare (in ) vec3 N@0x15f3e20)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 I)\n" + " (declare (in) vec3 N))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 I@0x15f4000)\n" - " (declare (in ) vec4 N@0x15f4110)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 I)\n" + " (declare (in) vec4 N))\n" + " ()))\n" "(function refract\n" " (signature float\n" " (parameters\n" - " (declare (in ) float I@0x15f42f0)\n" - " (declare (in ) float N@0x15f4400)\n" - " (declare (in ) float eta@0x15f4510)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float I)\n" + " (declare (in) float N)\n" + " (declare (in) float eta))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 I@0x15f4890)\n" - " (declare (in ) vec2 N@0x15f49a0)\n" - " (declare (in ) float eta@0x15f4ab0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 I)\n" + " (declare (in) vec2 N)\n" + " (declare (in) float eta))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 I@0x15f4c90)\n" - " (declare (in ) vec3 N@0x15f4da0)\n" - " (declare (in ) float eta@0x15f4eb0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 I)\n" + " (declare (in) vec3 N)\n" + " (declare (in) float eta))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 I@0x15f5090)\n" - " (declare (in ) vec4 N@0x15f51a0)\n" - " (declare (in ) float eta@0x15f52b0)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 I)\n" + " (declare (in) vec4 N)\n" + " (declare (in) float eta))\n" + " ()))\n" "(function matrixCompMult\n" " (signature mat2\n" " (parameters\n" - " (declare (in ) mat2 x@0x15f5490)\n" - " (declare (in ) mat2 y@0x15f55a0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) mat2 x)\n" + " (declare (in) mat2 y))\n" + " ())\n" " (signature mat3\n" " (parameters\n" - " (declare (in ) mat3 x@0x15f5930)\n" - " (declare (in ) mat3 y@0x15f5a40)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) mat3 x)\n" + " (declare (in) mat3 y))\n" + " ())\n" " (signature mat4\n" " (parameters\n" - " (declare (in ) mat4 x@0x15f5c20)\n" - " (declare (in ) mat4 y@0x15f5d30)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) mat4 x)\n" + " (declare (in) mat4 y))\n" + " ())\n" " (signature mat2x3\n" " (parameters\n" - " (declare (in ) mat2x3 x@0x15f5f10)\n" - " (declare (in ) mat2x3 y@0x15f6020)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) mat2x3 x)\n" + " (declare (in) mat2x3 y))\n" + " ())\n" " (signature mat2x4\n" " (parameters\n" - " (declare (in ) mat2x4 x@0x15f6200)\n" - " (declare (in ) mat2x4 y@0x15f6310)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) mat2x4 x)\n" + " (declare (in) mat2x4 y))\n" + " ())\n" " (signature mat3x2\n" " (parameters\n" - " (declare (in ) mat3x2 x@0x15f64f0)\n" - " (declare (in ) mat3x2 y@0x15f6600)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) mat3x2 x)\n" + " (declare (in) mat3x2 y))\n" + " ())\n" " (signature mat3x4\n" " (parameters\n" - " (declare (in ) mat3x4 x@0x15f67e0)\n" - " (declare (in ) mat3x4 y@0x15f68f0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) mat3x4 x)\n" + " (declare (in) mat3x4 y))\n" + " ())\n" " (signature mat4x2\n" " (parameters\n" - " (declare (in ) mat4x2 x@0x15f6ad0)\n" - " (declare (in ) mat4x2 y@0x15f6be0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) mat4x2 x)\n" + " (declare (in) mat4x2 y))\n" + " ())\n" " (signature mat4x3\n" " (parameters\n" - " (declare (in ) mat4x3 x@0x15f6dc0)\n" - " (declare (in ) mat4x3 y@0x15f6ed0)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) mat4x3 x)\n" + " (declare (in) mat4x3 y))\n" + " ()))\n" "(function outerProduct\n" " (signature mat2\n" " (parameters\n" - " (declare (in ) vec2 c@0x15f70b0)\n" - " (declare (in ) vec2 r@0x15f71c0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 c)\n" + " (declare (in) vec2 r))\n" + " ())\n" " (signature mat3\n" " (parameters\n" - " (declare (in ) vec3 c@0x15f7550)\n" - " (declare (in ) vec3 r@0x15f7660)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 c)\n" + " (declare (in) vec3 r))\n" + " ())\n" " (signature mat4\n" " (parameters\n" - " (declare (in ) vec4 c@0x15f7840)\n" - " (declare (in ) vec4 r@0x15f7950)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec4 c)\n" + " (declare (in) vec4 r))\n" + " ())\n" " (signature mat2x3\n" " (parameters\n" - " (declare (in ) vec3 c@0x15f7b30)\n" - " (declare (in ) vec2 r@0x15f7c40)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 c)\n" + " (declare (in) vec2 r))\n" + " ())\n" " (signature mat3x2\n" " (parameters\n" - " (declare (in ) vec2 c@0x15f7e20)\n" - " (declare (in ) vec3 r@0x15f7f30)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 c)\n" + " (declare (in) vec3 r))\n" + " ())\n" " (signature mat2x4\n" " (parameters\n" - " (declare (in ) vec4 c@0x15f8110)\n" - " (declare (in ) vec2 r@0x15f8220)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec4 c)\n" + " (declare (in) vec2 r))\n" + " ())\n" " (signature mat4x2\n" " (parameters\n" - " (declare (in ) vec2 c@0x15f8400)\n" - " (declare (in ) vec4 r@0x15f8510)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 c)\n" + " (declare (in) vec4 r))\n" + " ())\n" " (signature mat3x4\n" " (parameters\n" - " (declare (in ) vec4 c@0x15f86f0)\n" - " (declare (in ) vec3 r@0x15f8800)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec4 c)\n" + " (declare (in) vec3 r))\n" + " ())\n" " (signature mat4x3\n" " (parameters\n" - " (declare (in ) vec3 c@0x15f89e0)\n" - " (declare (in ) vec4 r@0x15f8af0)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec3 c)\n" + " (declare (in) vec4 r))\n" + " ()))\n" "(function transpose\n" " (signature mat2\n" " (parameters\n" - " (declare (in ) mat2 m@0x15f8cd0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) mat2 m))\n" + " ())\n" " (signature mat3\n" " (parameters\n" - " (declare (in ) mat3 m@0x15f9060)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) mat3 m))\n" + " ())\n" " (signature mat4\n" " (parameters\n" - " (declare (in ) mat4 m@0x15f9240)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) mat4 m))\n" + " ())\n" " (signature mat2x3\n" " (parameters\n" - " (declare (in ) mat3x2 m@0x15f9420)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) mat3x2 m))\n" + " ())\n" " (signature mat3x2\n" " (parameters\n" - " (declare (in ) mat2x3 m@0x15f9600)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) mat2x3 m))\n" + " ())\n" " (signature mat2x4\n" " (parameters\n" - " (declare (in ) mat4x2 m@0x15f97e0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) mat4x2 m))\n" + " ())\n" " (signature mat4x2\n" " (parameters\n" - " (declare (in ) mat2x4 m@0x15f99c0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) mat2x4 m))\n" + " ())\n" " (signature mat3x4\n" " (parameters\n" - " (declare (in ) mat4x3 m@0x15f9ba0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) mat4x3 m))\n" + " ())\n" " (signature mat4x3\n" " (parameters\n" - " (declare (in ) mat3x4 m@0x15f9d80)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) mat3x4 m))\n" + " ()))\n" "(function lessThan\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x15f9f60)\n" - " (declare (in ) vec2 y@0x15fa070)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" + " ())\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x15fa400)\n" - " (declare (in ) vec3 y@0x15fa510)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ())\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x15fa6f0)\n" - " (declare (in ) vec4 y@0x15fa800)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" + " ())\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) ivec2 x@0x15fa9e0)\n" - " (declare (in ) ivec2 y@0x15faaf0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) ivec2 x)\n" + " (declare (in) ivec2 y))\n" + " ())\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) ivec3 x@0x15facd0)\n" - " (declare (in ) ivec3 y@0x15fade0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) ivec3 x)\n" + " (declare (in) ivec3 y))\n" + " ())\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) ivec4 x@0x15fafc0)\n" - " (declare (in ) ivec4 y@0x15fb0d0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) ivec4 x)\n" + " (declare (in) ivec4 y))\n" + " ())\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) uvec2 x@0x15fb2b0)\n" - " (declare (in ) uvec2 y@0x15fb3c0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) uvec2 x)\n" + " (declare (in) uvec2 y))\n" + " ())\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) uvec3 x@0x15fb5a0)\n" - " (declare (in ) uvec3 y@0x15fb6b0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) uvec3 x)\n" + " (declare (in) uvec3 y))\n" + " ())\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) uvec4 x@0x15fb890)\n" - " (declare (in ) uvec4 y@0x15fb9a0)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) uvec4 x)\n" + " (declare (in) uvec4 y))\n" + " ()))\n" "(function lessThanEqual\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x15fbb80)\n" - " (declare (in ) vec2 y@0x15fbc90)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" + " ())\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x15fc020)\n" - " (declare (in ) vec3 y@0x15fc130)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ())\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x15fc310)\n" - " (declare (in ) vec4 y@0x15fc420)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" + " ())\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) ivec2 x@0x15fc600)\n" - " (declare (in ) ivec2 y@0x15fc710)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) ivec2 x)\n" + " (declare (in) ivec2 y))\n" + " ())\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) ivec3 x@0x15fc8f0)\n" - " (declare (in ) ivec3 y@0x15fca00)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) ivec3 x)\n" + " (declare (in) ivec3 y))\n" + " ())\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) ivec4 x@0x15fcbe0)\n" - " (declare (in ) ivec4 y@0x15fccf0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) ivec4 x)\n" + " (declare (in) ivec4 y))\n" + " ())\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) uvec2 x@0x15fced0)\n" - " (declare (in ) uvec2 y@0x15fcfe0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) uvec2 x)\n" + " (declare (in) uvec2 y))\n" + " ())\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) uvec3 x@0x15fd1c0)\n" - " (declare (in ) uvec3 y@0x15fd2d0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) uvec3 x)\n" + " (declare (in) uvec3 y))\n" + " ())\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) uvec4 x@0x15fd4b0)\n" - " (declare (in ) uvec4 y@0x15fd5c0)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) uvec4 x)\n" + " (declare (in) uvec4 y))\n" + " ()))\n" "(function greaterThan\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x15fd7a0)\n" - " (declare (in ) vec2 y@0x15fd8b0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" + " ())\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x15fdc40)\n" - " (declare (in ) vec3 y@0x15fdd50)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ())\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x15fdf30)\n" - " (declare (in ) vec4 y@0x15fe040)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" + " ())\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) ivec2 x@0x15fe220)\n" - " (declare (in ) ivec2 y@0x15fe330)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) ivec2 x)\n" + " (declare (in) ivec2 y))\n" + " ())\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) ivec3 x@0x15fe510)\n" - " (declare (in ) ivec3 y@0x15fe620)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) ivec3 x)\n" + " (declare (in) ivec3 y))\n" + " ())\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) ivec4 x@0x15fe800)\n" - " (declare (in ) ivec4 y@0x15fe910)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) ivec4 x)\n" + " (declare (in) ivec4 y))\n" + " ())\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) uvec2 x@0x15feaf0)\n" - " (declare (in ) uvec2 y@0x15fec00)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) uvec2 x)\n" + " (declare (in) uvec2 y))\n" + " ())\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) uvec3 x@0x15fede0)\n" - " (declare (in ) uvec3 y@0x15feef0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) uvec3 x)\n" + " (declare (in) uvec3 y))\n" + " ())\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) uvec4 x@0x15ff0d0)\n" - " (declare (in ) uvec4 y@0x15ff1e0)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) uvec4 x)\n" + " (declare (in) uvec4 y))\n" + " ()))\n" "(function greaterThanEqual\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x15ff3c0)\n" - " (declare (in ) vec2 y@0x15ff4d0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" + " ())\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x15ff860)\n" - " (declare (in ) vec3 y@0x15ff970)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ())\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x15ffb50)\n" - " (declare (in ) vec4 y@0x15ffc60)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" + " ())\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) ivec2 x@0x15ffe40)\n" - " (declare (in ) ivec2 y@0x15fff50)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) ivec2 x)\n" + " (declare (in) ivec2 y))\n" + " ())\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) ivec3 x@0x1600130)\n" - " (declare (in ) ivec3 y@0x1600240)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) ivec3 x)\n" + " (declare (in) ivec3 y))\n" + " ())\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) ivec4 x@0x1600420)\n" - " (declare (in ) ivec4 y@0x1600530)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) ivec4 x)\n" + " (declare (in) ivec4 y))\n" + " ())\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) uvec2 x@0x1600710)\n" - " (declare (in ) uvec2 y@0x1600820)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) uvec2 x)\n" + " (declare (in) uvec2 y))\n" + " ())\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) uvec3 x@0x1600a00)\n" - " (declare (in ) uvec3 y@0x1600b10)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) uvec3 x)\n" + " (declare (in) uvec3 y))\n" + " ())\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) uvec4 x@0x1600cf0)\n" - " (declare (in ) uvec4 y@0x1600e00)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) uvec4 x)\n" + " (declare (in) uvec4 y))\n" + " ()))\n" "(function equal\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x1600fe0)\n" - " (declare (in ) vec2 y@0x16010f0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" + " ())\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x1601470)\n" - " (declare (in ) vec3 y@0x1601580)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ())\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x1601760)\n" - " (declare (in ) vec4 y@0x1601870)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" + " ())\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) ivec2 x@0x1601a50)\n" - " (declare (in ) ivec2 y@0x1601b60)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) ivec2 x)\n" + " (declare (in) ivec2 y))\n" + " ())\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) ivec3 x@0x1601d40)\n" - " (declare (in ) ivec3 y@0x1601e50)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) ivec3 x)\n" + " (declare (in) ivec3 y))\n" + " ())\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) ivec4 x@0x1602030)\n" - " (declare (in ) ivec4 y@0x1602140)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) ivec4 x)\n" + " (declare (in) ivec4 y))\n" + " ())\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) uvec2 x@0x1602320)\n" - " (declare (in ) uvec2 y@0x1602430)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) uvec2 x)\n" + " (declare (in) uvec2 y))\n" + " ())\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) uvec3 x@0x1602610)\n" - " (declare (in ) uvec3 y@0x1602720)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) uvec3 x)\n" + " (declare (in) uvec3 y))\n" + " ())\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) uvec4 x@0x1602900)\n" - " (declare (in ) uvec4 y@0x1602a10)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) uvec4 x)\n" + " (declare (in) uvec4 y))\n" + " ())\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) bvec2 x@0x1602bf0)\n" - " (declare (in ) bvec2 y@0x1602d00)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) bvec2 x)\n" + " (declare (in) bvec2 y))\n" + " ())\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) bvec3 x@0x1602ee0)\n" - " (declare (in ) bvec3 y@0x1602ff0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) bvec3 x)\n" + " (declare (in) bvec3 y))\n" + " ())\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) bvec4 x@0x16031d0)\n" - " (declare (in ) bvec4 y@0x16032e0)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) bvec4 x)\n" + " (declare (in) bvec4 y))\n" + " ()))\n" "(function notEqual\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x16034c0)\n" - " (declare (in ) vec2 y@0x16035d0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" + " ())\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x1603960)\n" - " (declare (in ) vec3 y@0x1603a70)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ())\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x1603c50)\n" - " (declare (in ) vec4 y@0x1603d60)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" + " ())\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) ivec2 x@0x1603f40)\n" - " (declare (in ) ivec2 y@0x1604050)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) ivec2 x)\n" + " (declare (in) ivec2 y))\n" + " ())\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) ivec3 x@0x1604230)\n" - " (declare (in ) ivec3 y@0x1604340)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) ivec3 x)\n" + " (declare (in) ivec3 y))\n" + " ())\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) ivec4 x@0x1604520)\n" - " (declare (in ) ivec4 y@0x1604630)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) ivec4 x)\n" + " (declare (in) ivec4 y))\n" + " ())\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) uvec2 x@0x1604810)\n" - " (declare (in ) uvec2 y@0x1604920)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) uvec2 x)\n" + " (declare (in) uvec2 y))\n" + " ())\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) uvec3 x@0x1604b00)\n" - " (declare (in ) uvec3 y@0x1604c10)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) uvec3 x)\n" + " (declare (in) uvec3 y))\n" + " ())\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) uvec4 x@0x1604df0)\n" - " (declare (in ) uvec4 y@0x1604f00)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) uvec4 x)\n" + " (declare (in) uvec4 y))\n" + " ())\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) bvec2 x@0x16050e0)\n" - " (declare (in ) bvec2 y@0x16051f0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) bvec2 x)\n" + " (declare (in) bvec2 y))\n" + " ())\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) bvec3 x@0x16053d0)\n" - " (declare (in ) bvec3 y@0x16054e0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) bvec3 x)\n" + " (declare (in) bvec3 y))\n" + " ())\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) bvec4 x@0x16056c0)\n" - " (declare (in ) bvec4 y@0x16057d0)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) bvec4 x)\n" + " (declare (in) bvec4 y))\n" + " ()))\n" "(function any\n" " (signature bool\n" " (parameters\n" - " (declare (in ) bvec2 x@0x16059b0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) bvec2 x))\n" + " ())\n" " (signature bool\n" " (parameters\n" - " (declare (in ) bvec3 x@0x1605d30)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) bvec3 x))\n" + " ())\n" " (signature bool\n" " (parameters\n" - " (declare (in ) bvec4 x@0x1605f10)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) bvec4 x))\n" + " ()))\n" "(function all\n" " (signature bool\n" " (parameters\n" - " (declare (in ) bvec2 x@0x16060f0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) bvec2 x))\n" + " ())\n" " (signature bool\n" " (parameters\n" - " (declare (in ) bvec3 x@0x1606470)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) bvec3 x))\n" + " ())\n" " (signature bool\n" " (parameters\n" - " (declare (in ) bvec4 x@0x1606650)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) bvec4 x))\n" + " ()))\n" "(function not\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) bvec2 x@0x1606830)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) bvec2 x))\n" + " ())\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) bvec3 x@0x1606bb0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) bvec3 x))\n" + " ())\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) bvec4 x@0x1606d90)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) bvec4 x))\n" + " ()))\n" "(function texture\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1D sampler@0x1606f70)\n" - " (declare (in ) float P@0x1607080)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) float P))\n" + " ())\n" " (signature ivec4\n" " (parameters\n" - " (declare (in ) isampler1D sampler@0x1607400)\n" - " (declare (in ) float P@0x1607510)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) isampler1D sampler)\n" + " (declare (in) float P))\n" + " ())\n" " (signature uvec4\n" " (parameters\n" - " (declare (in ) usampler1D sampler@0x16076f0)\n" - " (declare (in ) float P@0x1607800)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) usampler1D sampler)\n" + " (declare (in) float P))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2D sampler@0x16079e0)\n" - " (declare (in ) vec2 P@0x1607af0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec2 P))\n" + " ())\n" " (signature ivec4\n" " (parameters\n" - " (declare (in ) isampler2D sampler@0x1607cd0)\n" - " (declare (in ) vec2 P@0x1607de0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) isampler2D sampler)\n" + " (declare (in) vec2 P))\n" + " ())\n" " (signature uvec4\n" " (parameters\n" - " (declare (in ) usampler2D sampler@0x1607fc0)\n" - " (declare (in ) vec2 P@0x16080d0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) usampler2D sampler)\n" + " (declare (in) vec2 P))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler3D sampler@0x16082b0)\n" - " (declare (in ) vec3 P@0x16083c0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler3D sampler)\n" + " (declare (in) vec3 P))\n" + " ())\n" " (signature ivec4\n" " (parameters\n" - " (declare (in ) isampler3D sampler@0x16085a0)\n" - " (declare (in ) vec3 P@0x16086b0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) isampler3D sampler)\n" + " (declare (in) vec3 P))\n" + " ())\n" " (signature uvec4\n" " (parameters\n" - " (declare (in ) usampler3D sampler@0x1608890)\n" - " (declare (in ) vec3 P@0x16089a0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) usampler3D sampler)\n" + " (declare (in) vec3 P))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) samplerCube sampler@0x1608b80)\n" - " (declare (in ) vec3 P@0x1608c90)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) samplerCube sampler)\n" + " (declare (in) vec3 P))\n" + " ())\n" " (signature ivec4\n" " (parameters\n" - " (declare (in ) isamplerCube sampler@0x1608e70)\n" - " (declare (in ) vec3 P@0x1608f80)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) isamplerCube sampler)\n" + " (declare (in) vec3 P))\n" + " ())\n" " (signature uvec4\n" " (parameters\n" - " (declare (in ) usamplerCube sampler@0x1609160)\n" - " (declare (in ) vec3 P@0x1609270)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) usamplerCube sampler)\n" + " (declare (in) vec3 P))\n" + " ())\n" " (signature float\n" " (parameters\n" - " (declare (in ) sampler1DShadow sampler@0x1609450)\n" - " (declare (in ) vec3 P@0x1609560)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler1DShadow sampler)\n" + " (declare (in) vec3 P))\n" + " ())\n" " (signature float\n" " (parameters\n" - " (declare (in ) sampler2DShadow sampler@0x1609740)\n" - " (declare (in ) vec3 P@0x1609850)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler2DShadow sampler)\n" + " (declare (in) vec3 P))\n" + " ())\n" " (signature float\n" " (parameters\n" - " (declare (in ) samplerCubeShadow sampler@0x1609a30)\n" - " (declare (in ) vec4 P@0x1609b40)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) samplerCubeShadow sampler)\n" + " (declare (in) vec4 P))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1DArray sampler@0x1609d20)\n" - " (declare (in ) vec2 P@0x1609e30)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler1DArray sampler)\n" + " (declare (in) vec2 P))\n" + " ())\n" " (signature ivec4\n" " (parameters\n" - " (declare (in ) isampler1DArray sampler@0x160a010)\n" - " (declare (in ) vec2 P@0x160a120)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) isampler1DArray sampler)\n" + " (declare (in) vec2 P))\n" + " ())\n" " (signature uvec4\n" " (parameters\n" - " (declare (in ) usampler1DArray sampler@0x160a300)\n" - " (declare (in ) vec2 P@0x160a410)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) usampler1DArray sampler)\n" + " (declare (in) vec2 P))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2DArray sampler@0x160a5f0)\n" - " (declare (in ) vec3 P@0x160a700)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler2DArray sampler)\n" + " (declare (in) vec3 P))\n" + " ())\n" " (signature ivec4\n" " (parameters\n" - " (declare (in ) isampler2DArray sampler@0x160a8e0)\n" - " (declare (in ) vec3 P@0x160a9f0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) isampler2DArray sampler)\n" + " (declare (in) vec3 P))\n" + " ())\n" " (signature uvec4\n" " (parameters\n" - " (declare (in ) usampler2DArray sampler@0x160abd0)\n" - " (declare (in ) vec3 P@0x160ace0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) usampler2DArray sampler)\n" + " (declare (in) vec3 P))\n" + " ())\n" " (signature float\n" " (parameters\n" - " (declare (in ) sampler1DArrayShadow sampler@0x160aec0)\n" - " (declare (in ) vec3 P@0x160afd0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler1DArrayShadow sampler)\n" + " (declare (in) vec3 P))\n" + " ())\n" " (signature float\n" " (parameters\n" - " (declare (in ) sampler2DArrayShadow sampler@0x160b1b0)\n" - " (declare (in ) vec4 P@0x160b2c0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler2DArrayShadow sampler)\n" + " (declare (in) vec4 P))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1D sampler@0x160b4a0)\n" - " (declare (in ) float P@0x160b5b0)\n" - " (declare (in ) float bias@0x160b6c0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) float P)\n" + " (declare (in) float bias))\n" + " ())\n" " (signature ivec4\n" " (parameters\n" - " (declare (in ) isampler1D sampler@0x160b8a0)\n" - " (declare (in ) float P@0x160b9b0)\n" - " (declare (in ) float bias@0x160bac0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) isampler1D sampler)\n" + " (declare (in) float P)\n" + " (declare (in) float bias))\n" + " ())\n" " (signature uvec4\n" " (parameters\n" - " (declare (in ) usampler1D sampler@0x160bca0)\n" - " (declare (in ) float P@0x160bdb0)\n" - " (declare (in ) float bias@0x160bec0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) usampler1D sampler)\n" + " (declare (in) float P)\n" + " (declare (in) float bias))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2D sampler@0x160c0a0)\n" - " (declare (in ) vec2 P@0x160c1b0)\n" - " (declare (in ) float bias@0x160c2c0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec2 P)\n" + " (declare (in) float bias))\n" + " ())\n" " (signature ivec4\n" " (parameters\n" - " (declare (in ) isampler2D sampler@0x160c4a0)\n" - " (declare (in ) vec2 P@0x160c5b0)\n" - " (declare (in ) float bias@0x160c6c0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) isampler2D sampler)\n" + " (declare (in) vec2 P)\n" + " (declare (in) float bias))\n" + " ())\n" " (signature uvec4\n" " (parameters\n" - " (declare (in ) usampler2D sampler@0x160c8a0)\n" - " (declare (in ) vec2 P@0x160c9b0)\n" - " (declare (in ) float bias@0x160cac0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) usampler2D sampler)\n" + " (declare (in) vec2 P)\n" + " (declare (in) float bias))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler3D sampler@0x160cca0)\n" - " (declare (in ) vec3 P@0x160cdb0)\n" - " (declare (in ) float bias@0x160cec0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler3D sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float bias))\n" + " ())\n" " (signature ivec4\n" " (parameters\n" - " (declare (in ) isampler3D sampler@0x160d0a0)\n" - " (declare (in ) vec3 P@0x160d1b0)\n" - " (declare (in ) float bias@0x160d2c0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) isampler3D sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float bias))\n" + " ())\n" " (signature uvec4\n" " (parameters\n" - " (declare (in ) usampler3D sampler@0x160d4a0)\n" - " (declare (in ) vec3 P@0x160d5b0)\n" - " (declare (in ) float bias@0x160d6c0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) usampler3D sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float bias))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) samplerCube sampler@0x160d8a0)\n" - " (declare (in ) vec3 P@0x160d9b0)\n" - " (declare (in ) float bias@0x160dac0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) samplerCube sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float bias))\n" + " ())\n" " (signature ivec4\n" " (parameters\n" - " (declare (in ) isamplerCube sampler@0x160dca0)\n" - " (declare (in ) vec3 P@0x160ddb0)\n" - " (declare (in ) float bias@0x160dec0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) isamplerCube sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float bias))\n" + " ())\n" " (signature uvec4\n" " (parameters\n" - " (declare (in ) usamplerCube sampler@0x160e0a0)\n" - " (declare (in ) vec3 P@0x160e1b0)\n" - " (declare (in ) float bias@0x160e2c0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) usamplerCube sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float bias))\n" + " ())\n" " (signature float\n" " (parameters\n" - " (declare (in ) sampler1DShadow sampler@0x160e4a0)\n" - " (declare (in ) vec3 P@0x160e5b0)\n" - " (declare (in ) float bias@0x160e6c0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler1DShadow sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float bias))\n" + " ())\n" " (signature float\n" " (parameters\n" - " (declare (in ) sampler2DShadow sampler@0x160e8a0)\n" - " (declare (in ) vec3 P@0x160e9b0)\n" - " (declare (in ) float bias@0x160eac0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler2DShadow sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float bias))\n" + " ())\n" " (signature float\n" " (parameters\n" - " (declare (in ) samplerCubeShadow sampler@0x160eca0)\n" - " (declare (in ) vec4 P@0x160edb0)\n" - " (declare (in ) float bias@0x160eec0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) samplerCubeShadow sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) float bias))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1DArray sampler@0x160f0a0)\n" - " (declare (in ) vec2 P@0x160f1b0)\n" - " (declare (in ) float bias@0x160f2c0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler1DArray sampler)\n" + " (declare (in) vec2 P)\n" + " (declare (in) float bias))\n" + " ())\n" " (signature ivec4\n" " (parameters\n" - " (declare (in ) isampler1DArray sampler@0x160f4a0)\n" - " (declare (in ) vec2 P@0x160f5b0)\n" - " (declare (in ) float bias@0x160f6c0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) isampler1DArray sampler)\n" + " (declare (in) vec2 P)\n" + " (declare (in) float bias))\n" + " ())\n" " (signature uvec4\n" " (parameters\n" - " (declare (in ) usampler1DArray sampler@0x160f8a0)\n" - " (declare (in ) vec2 P@0x160f9b0)\n" - " (declare (in ) float bias@0x160fac0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) usampler1DArray sampler)\n" + " (declare (in) vec2 P)\n" + " (declare (in) float bias))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2DArray sampler@0x160fca0)\n" - " (declare (in ) vec3 P@0x160fdb0)\n" - " (declare (in ) float bias@0x160fec0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler2DArray sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float bias))\n" + " ())\n" " (signature ivec4\n" " (parameters\n" - " (declare (in ) isampler2DArray sampler@0x16100a0)\n" - " (declare (in ) vec3 P@0x16101b0)\n" - " (declare (in ) float bias@0x16102c0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) isampler2DArray sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float bias))\n" + " ())\n" " (signature uvec4\n" " (parameters\n" - " (declare (in ) usampler2DArray sampler@0x16104a0)\n" - " (declare (in ) vec3 P@0x16105b0)\n" - " (declare (in ) float bias@0x16106c0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) usampler2DArray sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float bias))\n" + " ())\n" " (signature float\n" " (parameters\n" - " (declare (in ) sampler1DArrayShadow sampler@0x16108a0)\n" - " (declare (in ) vec3 P@0x16109b0)\n" - " (declare (in ) float bias@0x1610ac0)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) sampler1DArrayShadow sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float bias))\n" + " ()))\n" "(function textureProj\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1D sampler@0x1610ca0)\n" - " (declare (in ) vec2 P@0x1610db0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) vec2 P))\n" + " ())\n" " (signature ivec4\n" " (parameters\n" - " (declare (in ) isampler1D sampler@0x1611140)\n" - " (declare (in ) vec2 P@0x1611250)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) isampler1D sampler)\n" + " (declare (in) vec2 P))\n" + " ())\n" " (signature uvec4\n" " (parameters\n" - " (declare (in ) usampler1D sampler@0x1611430)\n" - " (declare (in ) vec2 P@0x1611540)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) usampler1D sampler)\n" + " (declare (in) vec2 P))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1D sampler@0x1611720)\n" - " (declare (in ) vec4 P@0x1611830)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) vec4 P))\n" + " ())\n" " (signature ivec4\n" " (parameters\n" - " (declare (in ) isampler1D sampler@0x1611a10)\n" - " (declare (in ) vec4 P@0x1611b20)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) isampler1D sampler)\n" + " (declare (in) vec4 P))\n" + " ())\n" " (signature uvec4\n" " (parameters\n" - " (declare (in ) usampler1D sampler@0x1611d00)\n" - " (declare (in ) vec4 P@0x1611e10)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) usampler1D sampler)\n" + " (declare (in) vec4 P))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2D sampler@0x1611ff0)\n" - " (declare (in ) vec3 P@0x1612100)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec3 P))\n" + " ())\n" " (signature ivec4\n" " (parameters\n" - " (declare (in ) isampler2D sampler@0x16122e0)\n" - " (declare (in ) vec3 P@0x16123f0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) isampler2D sampler)\n" + " (declare (in) vec3 P))\n" + " ())\n" " (signature uvec4\n" " (parameters\n" - " (declare (in ) usampler2D sampler@0x16125d0)\n" - " (declare (in ) vec3 P@0x16126e0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) usampler2D sampler)\n" + " (declare (in) vec3 P))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2D sampler@0x16128c0)\n" - " (declare (in ) vec4 P@0x16129d0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec4 P))\n" + " ())\n" " (signature ivec4\n" " (parameters\n" - " (declare (in ) isampler2D sampler@0x1612bb0)\n" - " (declare (in ) vec4 P@0x1612cc0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) isampler2D sampler)\n" + " (declare (in) vec4 P))\n" + " ())\n" " (signature uvec4\n" " (parameters\n" - " (declare (in ) usampler2D sampler@0x1612ea0)\n" - " (declare (in ) vec4 P@0x1612fb0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) usampler2D sampler)\n" + " (declare (in) vec4 P))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler3D sampler@0x1613190)\n" - " (declare (in ) vec4 P@0x16132a0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler3D sampler)\n" + " (declare (in) vec4 P))\n" + " ())\n" " (signature ivec4\n" " (parameters\n" - " (declare (in ) isampler3D sampler@0x1613480)\n" - " (declare (in ) vec4 P@0x1613590)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) isampler3D sampler)\n" + " (declare (in) vec4 P))\n" + " ())\n" " (signature uvec4\n" " (parameters\n" - " (declare (in ) usampler3D sampler@0x1613770)\n" - " (declare (in ) vec4 P@0x1613880)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) usampler3D sampler)\n" + " (declare (in) vec4 P))\n" + " ())\n" " (signature float\n" " (parameters\n" - " (declare (in ) sampler1DShadow sampler@0x1613a60)\n" - " (declare (in ) vec4 P@0x1613b70)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler1DShadow sampler)\n" + " (declare (in) vec4 P))\n" + " ())\n" " (signature float\n" " (parameters\n" - " (declare (in ) sampler2DShadow sampler@0x1613d50)\n" - " (declare (in ) vec4 P@0x1613e60)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler2DShadow sampler)\n" + " (declare (in) vec4 P))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1D sampler@0x1614040)\n" - " (declare (in ) vec2 P@0x1614150)\n" - " (declare (in ) float bias@0x1614260)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) vec2 P)\n" + " (declare (in) float bias))\n" + " ())\n" " (signature ivec4\n" " (parameters\n" - " (declare (in ) isampler1D sampler@0x1614440)\n" - " (declare (in ) vec2 P@0x1614550)\n" - " (declare (in ) float bias@0x1614660)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) isampler1D sampler)\n" + " (declare (in) vec2 P)\n" + " (declare (in) float bias))\n" + " ())\n" " (signature uvec4\n" " (parameters\n" - " (declare (in ) usampler1D sampler@0x1614840)\n" - " (declare (in ) vec2 P@0x1614950)\n" - " (declare (in ) float bias@0x1614a60)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) usampler1D sampler)\n" + " (declare (in) vec2 P)\n" + " (declare (in) float bias))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1D sampler@0x1614c40)\n" - " (declare (in ) vec4 P@0x1614d50)\n" - " (declare (in ) float bias@0x1614e60)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) float bias))\n" + " ())\n" " (signature ivec4\n" " (parameters\n" - " (declare (in ) isampler1D sampler@0x1615040)\n" - " (declare (in ) vec4 P@0x1615150)\n" - " (declare (in ) float bias@0x1615260)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) isampler1D sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) float bias))\n" + " ())\n" " (signature uvec4\n" " (parameters\n" - " (declare (in ) usampler1D sampler@0x1615440)\n" - " (declare (in ) vec4 P@0x1615550)\n" - " (declare (in ) float bias@0x1615660)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) usampler1D sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) float bias))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2D sampler@0x1615840)\n" - " (declare (in ) vec3 P@0x1615950)\n" - " (declare (in ) float bias@0x1615a60)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float bias))\n" + " ())\n" " (signature ivec4\n" " (parameters\n" - " (declare (in ) isampler2D sampler@0x1615c40)\n" - " (declare (in ) vec3 P@0x1615d50)\n" - " (declare (in ) float bias@0x1615e60)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) isampler2D sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float bias))\n" + " ())\n" " (signature uvec4\n" " (parameters\n" - " (declare (in ) usampler2D sampler@0x1616040)\n" - " (declare (in ) vec3 P@0x1616150)\n" - " (declare (in ) float bias@0x1616260)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) usampler2D sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float bias))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2D sampler@0x1616440)\n" - " (declare (in ) vec4 P@0x1616550)\n" - " (declare (in ) float bias@0x1616660)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) float bias))\n" + " ())\n" " (signature ivec4\n" " (parameters\n" - " (declare (in ) isampler2D sampler@0x1616840)\n" - " (declare (in ) vec4 P@0x1616950)\n" - " (declare (in ) float bias@0x1616a60)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) isampler2D sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) float bias))\n" + " ())\n" " (signature uvec4\n" " (parameters\n" - " (declare (in ) usampler2D sampler@0x1616c40)\n" - " (declare (in ) vec4 P@0x1616d50)\n" - " (declare (in ) float bias@0x1616e60)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) usampler2D sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) float bias))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler3D sampler@0x1617040)\n" - " (declare (in ) vec4 P@0x1617150)\n" - " (declare (in ) float bias@0x1617260)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler3D sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) float bias))\n" + " ())\n" " (signature ivec4\n" " (parameters\n" - " (declare (in ) isampler3D sampler@0x1617440)\n" - " (declare (in ) vec4 P@0x1617550)\n" - " (declare (in ) float bias@0x1617660)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) isampler3D sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) float bias))\n" + " ())\n" " (signature uvec4\n" " (parameters\n" - " (declare (in ) usampler3D sampler@0x1617840)\n" - " (declare (in ) vec4 P@0x1617950)\n" - " (declare (in ) float bias@0x1617a60)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) usampler3D sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) float bias))\n" + " ())\n" " (signature float\n" " (parameters\n" - " (declare (in ) sampler1DShadow sampler@0x1617c40)\n" - " (declare (in ) vec4 P@0x1617d50)\n" - " (declare (in ) float bias@0x1617e60)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler1DShadow sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) float bias))\n" + " ())\n" " (signature float\n" " (parameters\n" - " (declare (in ) sampler2DShadow sampler@0x1618040)\n" - " (declare (in ) vec4 P@0x1618150)\n" - " (declare (in ) float bias@0x1618260)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) sampler2DShadow sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) float bias))\n" + " ()))\n" "(function textureLod\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1D sampler@0x1618440)\n" - " (declare (in ) float P@0x1618550)\n" - " (declare (in ) float lod@0x1618660)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) float P)\n" + " (declare (in) float lod))\n" + " ())\n" " (signature ivec4\n" " (parameters\n" - " (declare (in ) isampler1D sampler@0x16189f0)\n" - " (declare (in ) float P@0x1618b00)\n" - " (declare (in ) float lod@0x1618c10)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) isampler1D sampler)\n" + " (declare (in) float P)\n" + " (declare (in) float lod))\n" + " ())\n" " (signature uvec4\n" " (parameters\n" - " (declare (in ) usampler1D sampler@0x1618df0)\n" - " (declare (in ) float P@0x1618f00)\n" - " (declare (in ) float lod@0x1619010)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) usampler1D sampler)\n" + " (declare (in) float P)\n" + " (declare (in) float lod))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2D sampler@0x16191f0)\n" - " (declare (in ) vec2 P@0x1619300)\n" - " (declare (in ) float lod@0x1619410)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec2 P)\n" + " (declare (in) float lod))\n" + " ())\n" " (signature ivec4\n" " (parameters\n" - " (declare (in ) isampler2D sampler@0x16195f0)\n" - " (declare (in ) vec2 P@0x1619700)\n" - " (declare (in ) float lod@0x1619810)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) isampler2D sampler)\n" + " (declare (in) vec2 P)\n" + " (declare (in) float lod))\n" + " ())\n" " (signature uvec4\n" " (parameters\n" - " (declare (in ) usampler2D sampler@0x16199f0)\n" - " (declare (in ) vec2 P@0x1619b00)\n" - " (declare (in ) float lod@0x1619c10)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) usampler2D sampler)\n" + " (declare (in) vec2 P)\n" + " (declare (in) float lod))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler3D sampler@0x1619df0)\n" - " (declare (in ) vec3 P@0x1619f00)\n" - " (declare (in ) float lod@0x161a010)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler3D sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float lod))\n" + " ())\n" " (signature ivec4\n" " (parameters\n" - " (declare (in ) isampler3D sampler@0x161a1f0)\n" - " (declare (in ) vec3 P@0x161a300)\n" - " (declare (in ) float lod@0x161a410)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) isampler3D sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float lod))\n" + " ())\n" " (signature uvec4\n" " (parameters\n" - " (declare (in ) usampler3D sampler@0x161a5f0)\n" - " (declare (in ) vec3 P@0x161a700)\n" - " (declare (in ) float lod@0x161a810)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) usampler3D sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float lod))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) samplerCube sampler@0x161a9f0)\n" - " (declare (in ) vec3 P@0x161ab00)\n" - " (declare (in ) float lod@0x161ac10)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) samplerCube sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float lod))\n" + " ())\n" " (signature ivec4\n" " (parameters\n" - " (declare (in ) isamplerCube sampler@0x161adf0)\n" - " (declare (in ) vec3 P@0x161af00)\n" - " (declare (in ) float lod@0x161b010)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) isamplerCube sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float lod))\n" + " ())\n" " (signature uvec4\n" " (parameters\n" - " (declare (in ) usamplerCube sampler@0x161b1f0)\n" - " (declare (in ) vec3 P@0x161b300)\n" - " (declare (in ) float lod@0x161b410)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) usamplerCube sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float lod))\n" + " ())\n" " (signature float\n" " (parameters\n" - " (declare (in ) sampler1DShadow sampler@0x161b5f0)\n" - " (declare (in ) vec3 P@0x161b700)\n" - " (declare (in ) float lod@0x161b810)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler1DShadow sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float lod))\n" + " ())\n" " (signature float\n" " (parameters\n" - " (declare (in ) sampler2DShadow sampler@0x161b9f0)\n" - " (declare (in ) vec3 P@0x161bb00)\n" - " (declare (in ) float lod@0x161bc10)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler2DShadow sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float lod))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1DArray sampler@0x161bdf0)\n" - " (declare (in ) vec2 P@0x161bf00)\n" - " (declare (in ) float lod@0x161c010)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler1DArray sampler)\n" + " (declare (in) vec2 P)\n" + " (declare (in) float lod))\n" + " ())\n" " (signature ivec4\n" " (parameters\n" - " (declare (in ) isampler1DArray sampler@0x161c1f0)\n" - " (declare (in ) vec2 P@0x161c300)\n" - " (declare (in ) float lod@0x161c410)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) isampler1DArray sampler)\n" + " (declare (in) vec2 P)\n" + " (declare (in) float lod))\n" + " ())\n" " (signature uvec4\n" " (parameters\n" - " (declare (in ) usampler1DArray sampler@0x161c5f0)\n" - " (declare (in ) vec2 P@0x161c700)\n" - " (declare (in ) float lod@0x161c810)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) usampler1DArray sampler)\n" + " (declare (in) vec2 P)\n" + " (declare (in) float lod))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2DArray sampler@0x161c9f0)\n" - " (declare (in ) vec3 P@0x161cb00)\n" - " (declare (in ) float lod@0x161cc10)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler2DArray sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float lod))\n" + " ())\n" " (signature ivec4\n" " (parameters\n" - " (declare (in ) isampler2DArray sampler@0x161cdf0)\n" - " (declare (in ) vec3 P@0x161cf00)\n" - " (declare (in ) float lod@0x161d010)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) isampler2DArray sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float lod))\n" + " ())\n" " (signature uvec4\n" " (parameters\n" - " (declare (in ) usampler2DArray sampler@0x161d1f0)\n" - " (declare (in ) vec3 P@0x161d300)\n" - " (declare (in ) float lod@0x161d410)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) usampler2DArray sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float lod))\n" + " ())\n" " (signature float\n" " (parameters\n" - " (declare (in ) sampler1DArrayShadow sampler@0x161d5f0)\n" - " (declare (in ) vec3 P@0x161d700)\n" - " (declare (in ) float lod@0x161d810)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) sampler1DArrayShadow sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float lod))\n" + " ()))\n" "(function texelFetch\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1D sampler@0x161d9f0)\n" - " (declare (in ) int P@0x161db00)\n" - " (declare (in ) int lod@0x161dc10)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) int P)\n" + " (declare (in) int lod))\n" + " ())\n" " (signature ivec4\n" " (parameters\n" - " (declare (in ) isampler1D sampler@0x161dfa0)\n" - " (declare (in ) int P@0x161e0b0)\n" - " (declare (in ) int lod@0x161e1c0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) isampler1D sampler)\n" + " (declare (in) int P)\n" + " (declare (in) int lod))\n" + " ())\n" " (signature uvec4\n" " (parameters\n" - " (declare (in ) usampler1D sampler@0x161e3a0)\n" - " (declare (in ) int P@0x161e4b0)\n" - " (declare (in ) int lod@0x161e5c0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) usampler1D sampler)\n" + " (declare (in) int P)\n" + " (declare (in) int lod))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2D sampler@0x161e7a0)\n" - " (declare (in ) ivec2 P@0x161e8b0)\n" - " (declare (in ) int lod@0x161e9c0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) ivec2 P)\n" + " (declare (in) int lod))\n" + " ())\n" " (signature ivec4\n" " (parameters\n" - " (declare (in ) isampler2D sampler@0x161eba0)\n" - " (declare (in ) ivec2 P@0x161ecb0)\n" - " (declare (in ) int lod@0x161edc0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) isampler2D sampler)\n" + " (declare (in) ivec2 P)\n" + " (declare (in) int lod))\n" + " ())\n" " (signature uvec4\n" " (parameters\n" - " (declare (in ) usampler2D sampler@0x161efa0)\n" - " (declare (in ) ivec2 P@0x161f0b0)\n" - " (declare (in ) int lod@0x161f1c0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) usampler2D sampler)\n" + " (declare (in) ivec2 P)\n" + " (declare (in) int lod))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler3D sampler@0x161f3a0)\n" - " (declare (in ) ivec3 P@0x161f4b0)\n" - " (declare (in ) int lod@0x161f5c0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler3D sampler)\n" + " (declare (in) ivec3 P)\n" + " (declare (in) int lod))\n" + " ())\n" " (signature ivec4\n" " (parameters\n" - " (declare (in ) isampler3D sampler@0x161f7a0)\n" - " (declare (in ) ivec3 P@0x161f8b0)\n" - " (declare (in ) int lod@0x161f9c0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) isampler3D sampler)\n" + " (declare (in) ivec3 P)\n" + " (declare (in) int lod))\n" + " ())\n" " (signature uvec4\n" " (parameters\n" - " (declare (in ) usampler3D sampler@0x161fba0)\n" - " (declare (in ) ivec3 P@0x161fcb0)\n" - " (declare (in ) int lod@0x161fdc0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) usampler3D sampler)\n" + " (declare (in) ivec3 P)\n" + " (declare (in) int lod))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1DArray sampler@0x161ffa0)\n" - " (declare (in ) ivec2 P@0x16200b0)\n" - " (declare (in ) int lod@0x16201c0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler1DArray sampler)\n" + " (declare (in) ivec2 P)\n" + " (declare (in) int lod))\n" + " ())\n" " (signature ivec4\n" " (parameters\n" - " (declare (in ) isampler1DArray sampler@0x16203a0)\n" - " (declare (in ) ivec2 P@0x16204b0)\n" - " (declare (in ) int lod@0x16205c0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) isampler1DArray sampler)\n" + " (declare (in) ivec2 P)\n" + " (declare (in) int lod))\n" + " ())\n" " (signature uvec4\n" " (parameters\n" - " (declare (in ) usampler1DArray sampler@0x16207a0)\n" - " (declare (in ) ivec2 P@0x16208b0)\n" - " (declare (in ) int lod@0x16209c0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) usampler1DArray sampler)\n" + " (declare (in) ivec2 P)\n" + " (declare (in) int lod))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2DArray sampler@0x1620ba0)\n" - " (declare (in ) ivec3 P@0x1620cb0)\n" - " (declare (in ) int lod@0x1620dc0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler2DArray sampler)\n" + " (declare (in) ivec3 P)\n" + " (declare (in) int lod))\n" + " ())\n" " (signature ivec4\n" " (parameters\n" - " (declare (in ) isampler2DArray sampler@0x1620fa0)\n" - " (declare (in ) ivec3 P@0x16210b0)\n" - " (declare (in ) int lod@0x16211c0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) isampler2DArray sampler)\n" + " (declare (in) ivec3 P)\n" + " (declare (in) int lod))\n" + " ())\n" " (signature uvec4\n" " (parameters\n" - " (declare (in ) usampler2DArray sampler@0x16213a0)\n" - " (declare (in ) ivec3 P@0x16214b0)\n" - " (declare (in ) int lod@0x16215c0)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) usampler2DArray sampler)\n" + " (declare (in) ivec3 P)\n" + " (declare (in) int lod))\n" + " ()))\n" "(function textureProjLod\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1D sampler@0x16217a0)\n" - " (declare (in ) vec2 P@0x16218b0)\n" - " (declare (in ) float lod@0x16219c0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) vec2 P)\n" + " (declare (in) float lod))\n" + " ())\n" " (signature ivec4\n" " (parameters\n" - " (declare (in ) isampler1D sampler@0x1621d50)\n" - " (declare (in ) vec2 P@0x1621e60)\n" - " (declare (in ) float lod@0x1621f70)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) isampler1D sampler)\n" + " (declare (in) vec2 P)\n" + " (declare (in) float lod))\n" + " ())\n" " (signature uvec4\n" " (parameters\n" - " (declare (in ) usampler1D sampler@0x1622150)\n" - " (declare (in ) vec2 P@0x1622260)\n" - " (declare (in ) float lod@0x1622370)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) usampler1D sampler)\n" + " (declare (in) vec2 P)\n" + " (declare (in) float lod))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1D sampler@0x1622550)\n" - " (declare (in ) vec4 P@0x1622660)\n" - " (declare (in ) float lod@0x1622770)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) float lod))\n" + " ())\n" " (signature ivec4\n" " (parameters\n" - " (declare (in ) isampler1D sampler@0x1622950)\n" - " (declare (in ) vec4 P@0x1622a60)\n" - " (declare (in ) float lod@0x1622b70)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) isampler1D sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) float lod))\n" + " ())\n" " (signature uvec4\n" " (parameters\n" - " (declare (in ) usampler1D sampler@0x1622d50)\n" - " (declare (in ) vec4 P@0x1622e60)\n" - " (declare (in ) float lod@0x1622f70)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) usampler1D sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) float lod))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2D sampler@0x1623150)\n" - " (declare (in ) vec3 P@0x1623260)\n" - " (declare (in ) float lod@0x1623370)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float lod))\n" + " ())\n" " (signature ivec4\n" " (parameters\n" - " (declare (in ) isampler2D sampler@0x1623550)\n" - " (declare (in ) vec3 P@0x1623660)\n" - " (declare (in ) float lod@0x1623770)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) isampler2D sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float lod))\n" + " ())\n" " (signature uvec4\n" " (parameters\n" - " (declare (in ) usampler2D sampler@0x1623950)\n" - " (declare (in ) vec3 P@0x1623a60)\n" - " (declare (in ) float lod@0x1623b70)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) usampler2D sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float lod))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2D sampler@0x1623d50)\n" - " (declare (in ) vec4 P@0x1623e60)\n" - " (declare (in ) float lod@0x1623f70)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) float lod))\n" + " ())\n" " (signature ivec4\n" " (parameters\n" - " (declare (in ) isampler2D sampler@0x1624150)\n" - " (declare (in ) vec4 P@0x1624260)\n" - " (declare (in ) float lod@0x1624370)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) isampler2D sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) float lod))\n" + " ())\n" " (signature uvec4\n" " (parameters\n" - " (declare (in ) usampler2D sampler@0x1624550)\n" - " (declare (in ) vec4 P@0x1624660)\n" - " (declare (in ) float lod@0x1624770)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) usampler2D sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) float lod))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler3D sampler@0x1624950)\n" - " (declare (in ) vec4 P@0x1624a60)\n" - " (declare (in ) float lod@0x1624b70)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler3D sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) float lod))\n" + " ())\n" " (signature ivec4\n" " (parameters\n" - " (declare (in ) isampler3D sampler@0x1624d50)\n" - " (declare (in ) vec4 P@0x1624e60)\n" - " (declare (in ) float lod@0x1624f70)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) isampler3D sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) float lod))\n" + " ())\n" " (signature uvec4\n" " (parameters\n" - " (declare (in ) usampler3D sampler@0x1625150)\n" - " (declare (in ) vec4 P@0x1625260)\n" - " (declare (in ) float lod@0x1625370)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) usampler3D sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) float lod))\n" + " ())\n" " (signature float\n" " (parameters\n" - " (declare (in ) sampler1DShadow sampler@0x1625550)\n" - " (declare (in ) vec4 P@0x1625660)\n" - " (declare (in ) float lod@0x1625770)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler1DShadow sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) float lod))\n" + " ())\n" " (signature float\n" " (parameters\n" - " (declare (in ) sampler2DShadow sampler@0x1625950)\n" - " (declare (in ) vec4 P@0x1625a60)\n" - " (declare (in ) float lod@0x1625b70)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) sampler2DShadow sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) float lod))\n" + " ()))\n" "(function textureGrad\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1D sampler@0x1625d50)\n" - " (declare (in ) float P@0x1625e60)\n" - " (declare (in ) float dPdx@0x1625f70)\n" - " (declare (in ) float dPdy@0x1626080)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) float P)\n" + " (declare (in) float dPdx)\n" + " (declare (in) float dPdy))\n" + " ())\n" " (signature ivec4\n" " (parameters\n" - " (declare (in ) isampler1D sampler@0x1626410)\n" - " (declare (in ) float P@0x1626520)\n" - " (declare (in ) float dPdx@0x1626630)\n" - " (declare (in ) float dPdy@0x1626740)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) isampler1D sampler)\n" + " (declare (in) float P)\n" + " (declare (in) float dPdx)\n" + " (declare (in) float dPdy))\n" + " ())\n" " (signature uvec4\n" " (parameters\n" - " (declare (in ) usampler1D sampler@0x1626920)\n" - " (declare (in ) float P@0x1626a30)\n" - " (declare (in ) float dPdx@0x1626b40)\n" - " (declare (in ) float dPdy@0x1626c50)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) usampler1D sampler)\n" + " (declare (in) float P)\n" + " (declare (in) float dPdx)\n" + " (declare (in) float dPdy))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2D sampler@0x1626e30)\n" - " (declare (in ) vec2 P@0x1626f40)\n" - " (declare (in ) vec2 dPdx@0x1627050)\n" - " (declare (in ) vec2 dPdy@0x1627160)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec2 P)\n" + " (declare (in) vec2 dPdx)\n" + " (declare (in) vec2 dPdy))\n" + " ())\n" " (signature ivec4\n" " (parameters\n" - " (declare (in ) isampler2D sampler@0x1627340)\n" - " (declare (in ) vec2 P@0x1627450)\n" - " (declare (in ) vec2 dPdx@0x1627560)\n" - " (declare (in ) vec2 dPdy@0x1627670)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) isampler2D sampler)\n" + " (declare (in) vec2 P)\n" + " (declare (in) vec2 dPdx)\n" + " (declare (in) vec2 dPdy))\n" + " ())\n" " (signature uvec4\n" " (parameters\n" - " (declare (in ) usampler2D sampler@0x1627850)\n" - " (declare (in ) vec2 P@0x1627960)\n" - " (declare (in ) vec2 dPdx@0x1627a70)\n" - " (declare (in ) vec2 dPdy@0x1627b80)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) usampler2D sampler)\n" + " (declare (in) vec2 P)\n" + " (declare (in) vec2 dPdx)\n" + " (declare (in) vec2 dPdy))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler3D sampler@0x1627d60)\n" - " (declare (in ) vec3 P@0x1627e70)\n" - " (declare (in ) vec3 dPdx@0x1627f80)\n" - " (declare (in ) vec3 dPdy@0x1628090)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler3D sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) vec3 dPdx)\n" + " (declare (in) vec3 dPdy))\n" + " ())\n" " (signature ivec4\n" " (parameters\n" - " (declare (in ) isampler3D sampler@0x1628270)\n" - " (declare (in ) vec3 P@0x1628380)\n" - " (declare (in ) vec3 dPdx@0x1628490)\n" - " (declare (in ) vec3 dPdy@0x16285a0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) isampler3D sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) vec3 dPdx)\n" + " (declare (in) vec3 dPdy))\n" + " ())\n" " (signature uvec4\n" " (parameters\n" - " (declare (in ) usampler3D sampler@0x1628780)\n" - " (declare (in ) vec3 P@0x1628890)\n" - " (declare (in ) vec3 dPdx@0x16289a0)\n" - " (declare (in ) vec3 dPdy@0x1628ab0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) usampler3D sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) vec3 dPdx)\n" + " (declare (in) vec3 dPdy))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) samplerCube sampler@0x1628c90)\n" - " (declare (in ) vec3 P@0x1628da0)\n" - " (declare (in ) vec3 dPdx@0x1628eb0)\n" - " (declare (in ) vec3 dPdy@0x1628fc0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) samplerCube sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) vec3 dPdx)\n" + " (declare (in) vec3 dPdy))\n" + " ())\n" " (signature ivec4\n" " (parameters\n" - " (declare (in ) isamplerCube sampler@0x16291a0)\n" - " (declare (in ) vec3 P@0x16292b0)\n" - " (declare (in ) vec3 dPdx@0x16293c0)\n" - " (declare (in ) vec3 dPdy@0x16294d0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) isamplerCube sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) vec3 dPdx)\n" + " (declare (in) vec3 dPdy))\n" + " ())\n" " (signature uvec4\n" " (parameters\n" - " (declare (in ) usamplerCube sampler@0x16296b0)\n" - " (declare (in ) vec3 P@0x16297c0)\n" - " (declare (in ) vec3 dPdx@0x16298d0)\n" - " (declare (in ) vec3 dPdy@0x16299e0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) usamplerCube sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) vec3 dPdx)\n" + " (declare (in) vec3 dPdy))\n" + " ())\n" " (signature float\n" " (parameters\n" - " (declare (in ) sampler1DShadow sampler@0x1629bc0)\n" - " (declare (in ) vec3 P@0x1629cd0)\n" - " (declare (in ) float dPdx@0x1629de0)\n" - " (declare (in ) float dPdy@0x1629ef0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler1DShadow sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float dPdx)\n" + " (declare (in) float dPdy))\n" + " ())\n" " (signature float\n" " (parameters\n" - " (declare (in ) sampler2DShadow sampler@0x162a0d0)\n" - " (declare (in ) vec3 P@0x162a1e0)\n" - " (declare (in ) vec2 dPdx@0x162a2f0)\n" - " (declare (in ) vec2 dPdy@0x162a400)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler2DShadow sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) vec2 dPdx)\n" + " (declare (in) vec2 dPdy))\n" + " ())\n" " (signature float\n" " (parameters\n" - " (declare (in ) samplerCubeShadow sampler@0x162a5e0)\n" - " (declare (in ) vec4 P@0x162a6f0)\n" - " (declare (in ) vec3 dPdx@0x162a800)\n" - " (declare (in ) vec3 dPdy@0x162a910)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) samplerCubeShadow sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) vec3 dPdx)\n" + " (declare (in) vec3 dPdy))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1DArray sampler@0x162aaf0)\n" - " (declare (in ) vec2 P@0x162ac00)\n" - " (declare (in ) float dPdx@0x162ad10)\n" - " (declare (in ) float dPdy@0x162ae20)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler1DArray sampler)\n" + " (declare (in) vec2 P)\n" + " (declare (in) float dPdx)\n" + " (declare (in) float dPdy))\n" + " ())\n" " (signature ivec4\n" " (parameters\n" - " (declare (in ) isampler1DArray sampler@0x162b000)\n" - " (declare (in ) vec2 P@0x162b110)\n" - " (declare (in ) float dPdx@0x162b220)\n" - " (declare (in ) float dPdy@0x162b330)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) isampler1DArray sampler)\n" + " (declare (in) vec2 P)\n" + " (declare (in) float dPdx)\n" + " (declare (in) float dPdy))\n" + " ())\n" " (signature uvec4\n" " (parameters\n" - " (declare (in ) usampler1DArray sampler@0x162b510)\n" - " (declare (in ) vec2 P@0x162b620)\n" - " (declare (in ) float dPdx@0x162b730)\n" - " (declare (in ) float dPdy@0x162b840)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) usampler1DArray sampler)\n" + " (declare (in) vec2 P)\n" + " (declare (in) float dPdx)\n" + " (declare (in) float dPdy))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2DArray sampler@0x162ba20)\n" - " (declare (in ) vec3 P@0x162bb30)\n" - " (declare (in ) vec2 dPdx@0x162bc40)\n" - " (declare (in ) vec2 dPdy@0x162bd50)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler2DArray sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) vec2 dPdx)\n" + " (declare (in) vec2 dPdy))\n" + " ())\n" " (signature ivec4\n" " (parameters\n" - " (declare (in ) isampler2DArray sampler@0x162bf30)\n" - " (declare (in ) vec3 P@0x162c040)\n" - " (declare (in ) vec2 dPdx@0x162c150)\n" - " (declare (in ) vec2 dPdy@0x162c260)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) isampler2DArray sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) vec2 dPdx)\n" + " (declare (in) vec2 dPdy))\n" + " ())\n" " (signature uvec4\n" " (parameters\n" - " (declare (in ) usampler2DArray sampler@0x162c440)\n" - " (declare (in ) vec3 P@0x162c550)\n" - " (declare (in ) vec2 dPdx@0x162c660)\n" - " (declare (in ) vec2 dPdy@0x162c770)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) usampler2DArray sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) vec2 dPdx)\n" + " (declare (in) vec2 dPdy))\n" + " ())\n" " (signature float\n" " (parameters\n" - " (declare (in ) sampler1DArrayShadow sampler@0x162c950)\n" - " (declare (in ) vec3 P@0x162ca60)\n" - " (declare (in ) float dPdx@0x162cb70)\n" - " (declare (in ) float dPdy@0x162cc80)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler1DArrayShadow sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float dPdx)\n" + " (declare (in) float dPdy))\n" + " ())\n" " (signature float\n" " (parameters\n" - " (declare (in ) sampler2DArrayShadow sampler@0x162ce60)\n" - " (declare (in ) vec4 P@0x162cf70)\n" - " (declare (in ) vec2 dPdx@0x162d080)\n" - " (declare (in ) vec2 dPdy@0x162d190)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) sampler2DArrayShadow sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) vec2 dPdx)\n" + " (declare (in) vec2 dPdy))\n" + " ()))\n" "(function textureProjGrad\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1D sampler@0x162d370)\n" - " (declare (in ) vec2 P@0x162d480)\n" - " (declare (in ) float dPdx@0x162d590)\n" - " (declare (in ) float dPdy@0x162d6a0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) vec2 P)\n" + " (declare (in) float dPdx)\n" + " (declare (in) float dPdy))\n" + " ())\n" " (signature ivec4\n" " (parameters\n" - " (declare (in ) isampler1D sampler@0x162da30)\n" - " (declare (in ) vec2 P@0x162db40)\n" - " (declare (in ) float dPdx@0x162dc50)\n" - " (declare (in ) float dPdy@0x162dd60)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) isampler1D sampler)\n" + " (declare (in) vec2 P)\n" + " (declare (in) float dPdx)\n" + " (declare (in) float dPdy))\n" + " ())\n" " (signature uvec4\n" " (parameters\n" - " (declare (in ) usampler1D sampler@0x162df40)\n" - " (declare (in ) vec2 P@0x162e050)\n" - " (declare (in ) float dPdx@0x162e160)\n" - " (declare (in ) float dPdy@0x162e270)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) usampler1D sampler)\n" + " (declare (in) vec2 P)\n" + " (declare (in) float dPdx)\n" + " (declare (in) float dPdy))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1D sampler@0x162e450)\n" - " (declare (in ) vec4 P@0x162e560)\n" - " (declare (in ) float dPdx@0x162e670)\n" - " (declare (in ) float dPdy@0x162e780)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) float dPdx)\n" + " (declare (in) float dPdy))\n" + " ())\n" " (signature ivec4\n" " (parameters\n" - " (declare (in ) isampler1D sampler@0x162e960)\n" - " (declare (in ) vec4 P@0x162ea70)\n" - " (declare (in ) float dPdx@0x162eb80)\n" - " (declare (in ) float dPdy@0x162ec90)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) isampler1D sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) float dPdx)\n" + " (declare (in) float dPdy))\n" + " ())\n" " (signature uvec4\n" " (parameters\n" - " (declare (in ) usampler1D sampler@0x162ee70)\n" - " (declare (in ) vec4 P@0x162ef80)\n" - " (declare (in ) float dPdx@0x162f090)\n" - " (declare (in ) float dPdy@0x162f1a0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) usampler1D sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) float dPdx)\n" + " (declare (in) float dPdy))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2D sampler@0x162f380)\n" - " (declare (in ) vec3 P@0x162f490)\n" - " (declare (in ) vec2 dPdx@0x162f5a0)\n" - " (declare (in ) vec2 dPdy@0x162f6b0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) vec2 dPdx)\n" + " (declare (in) vec2 dPdy))\n" + " ())\n" " (signature ivec4\n" " (parameters\n" - " (declare (in ) isampler2D sampler@0x162f890)\n" - " (declare (in ) vec3 P@0x162f9a0)\n" - " (declare (in ) vec2 dPdx@0x162fab0)\n" - " (declare (in ) vec2 dPdy@0x162fbc0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) isampler2D sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) vec2 dPdx)\n" + " (declare (in) vec2 dPdy))\n" + " ())\n" " (signature uvec4\n" " (parameters\n" - " (declare (in ) usampler2D sampler@0x162fda0)\n" - " (declare (in ) vec3 P@0x162feb0)\n" - " (declare (in ) vec2 dPdx@0x162ffc0)\n" - " (declare (in ) vec2 dPdy@0x16300d0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) usampler2D sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) vec2 dPdx)\n" + " (declare (in) vec2 dPdy))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2D sampler@0x16302b0)\n" - " (declare (in ) vec4 P@0x16303c0)\n" - " (declare (in ) vec2 dPdx@0x16304d0)\n" - " (declare (in ) vec2 dPdy@0x16305e0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) vec2 dPdx)\n" + " (declare (in) vec2 dPdy))\n" + " ())\n" " (signature ivec4\n" " (parameters\n" - " (declare (in ) isampler2D sampler@0x16307c0)\n" - " (declare (in ) vec4 P@0x16308d0)\n" - " (declare (in ) vec2 dPdx@0x16309e0)\n" - " (declare (in ) vec2 dPdy@0x1630af0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) isampler2D sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) vec2 dPdx)\n" + " (declare (in) vec2 dPdy))\n" + " ())\n" " (signature uvec4\n" " (parameters\n" - " (declare (in ) usampler2D sampler@0x1630cd0)\n" - " (declare (in ) vec4 P@0x1630de0)\n" - " (declare (in ) vec2 dPdx@0x1630ef0)\n" - " (declare (in ) vec2 dPdy@0x1631000)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) usampler2D sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) vec2 dPdx)\n" + " (declare (in) vec2 dPdy))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler3D sampler@0x16311e0)\n" - " (declare (in ) vec4 P@0x16312f0)\n" - " (declare (in ) vec3 dPdx@0x1631400)\n" - " (declare (in ) vec3 dPdy@0x1631510)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler3D sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) vec3 dPdx)\n" + " (declare (in) vec3 dPdy))\n" + " ())\n" " (signature ivec4\n" " (parameters\n" - " (declare (in ) isampler3D sampler@0x16316f0)\n" - " (declare (in ) vec4 P@0x1631800)\n" - " (declare (in ) vec3 dPdx@0x1631910)\n" - " (declare (in ) vec3 dPdy@0x1631a20)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) isampler3D sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) vec3 dPdx)\n" + " (declare (in) vec3 dPdy))\n" + " ())\n" " (signature uvec4\n" " (parameters\n" - " (declare (in ) usampler3D sampler@0x1631c00)\n" - " (declare (in ) vec4 P@0x1631d10)\n" - " (declare (in ) vec3 dPdx@0x1631e20)\n" - " (declare (in ) vec3 dPdy@0x1631f30)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) usampler3D sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) vec3 dPdx)\n" + " (declare (in) vec3 dPdy))\n" + " ())\n" " (signature float\n" " (parameters\n" - " (declare (in ) sampler1DShadow sampler@0x1632110)\n" - " (declare (in ) vec4 P@0x1632220)\n" - " (declare (in ) float dPdx@0x1632330)\n" - " (declare (in ) float dPdy@0x1632440)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler1DShadow sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) float dPdx)\n" + " (declare (in) float dPdy))\n" + " ())\n" " (signature float\n" " (parameters\n" - " (declare (in ) sampler2DShadow sampler@0x1632620)\n" - " (declare (in ) vec4 P@0x1632730)\n" - " (declare (in ) vec2 dPdx@0x1632840)\n" - " (declare (in ) vec2 dPdy@0x1632950)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) sampler2DShadow sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) vec2 dPdx)\n" + " (declare (in) vec2 dPdy))\n" + " ()))\n" "(function texture1D\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1D sampler@0x1632b30)\n" - " (declare (in ) float coord@0x1632c40)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) float coord))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1D sampler@0x1633760)\n" - " (declare (in ) float coord@0x1633870)\n" - " (declare (in ) float bias@0x1633980)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) float coord)\n" + " (declare (in) float bias))\n" + " ()))\n" "(function texture1DProj\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1D sampler@0x1632fd0)\n" - " (declare (in ) vec2 coord@0x16330e0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) vec2 coord))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1D sampler@0x1633470)\n" - " (declare (in ) vec4 coord@0x1633580)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) vec4 coord))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1D sampler@0x1633b60)\n" - " (declare (in ) vec2 coord@0x1633c70)\n" - " (declare (in ) float bias@0x1633d80)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) vec2 coord)\n" + " (declare (in) float bias))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1D sampler@0x1633f60)\n" - " (declare (in ) vec4 coord@0x1634070)\n" - " (declare (in ) float bias@0x1634180)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) vec4 coord)\n" + " (declare (in) float bias))\n" + " ()))\n" "(function texture1DLod\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1D sampler@0x1634360)\n" - " (declare (in ) float coord@0x1634470)\n" - " (declare (in ) float lod@0x1634580)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) float coord)\n" + " (declare (in) float lod))\n" + " ()))\n" "(function texture1DProjLod\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1D sampler@0x1634910)\n" - " (declare (in ) vec2 coord@0x1634a20)\n" - " (declare (in ) float lod@0x1634b30)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) vec2 coord)\n" + " (declare (in) float lod))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1D sampler@0x1634ec0)\n" - " (declare (in ) vec4 coord@0x1634fd0)\n" - " (declare (in ) float lod@0x16350e0)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) vec4 coord)\n" + " (declare (in) float lod))\n" + " ()))\n" "(function texture2D\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2D sampler@0x16352c0)\n" - " (declare (in ) vec2 coord@0x16353d0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec2 coord))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2D sampler@0x1635ef0)\n" - " (declare (in ) vec2 coord@0x1636000)\n" - " (declare (in ) float bias@0x1636110)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec2 coord)\n" + " (declare (in) float bias))\n" + " ()))\n" "(function texture2DProj\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2D sampler@0x1635760)\n" - " (declare (in ) vec3 coord@0x1635870)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec3 coord))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2D sampler@0x1635c00)\n" - " (declare (in ) vec4 coord@0x1635d10)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec4 coord))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2D sampler@0x16362f0)\n" - " (declare (in ) vec3 coord@0x1636400)\n" - " (declare (in ) float bias@0x1636510)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec3 coord)\n" + " (declare (in) float bias))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2D sampler@0x16366f0)\n" - " (declare (in ) vec4 coord@0x1636800)\n" - " (declare (in ) float bias@0x1636910)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec4 coord)\n" + " (declare (in) float bias))\n" + " ()))\n" "(function texture2DLod\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2D sampler@0x1636af0)\n" - " (declare (in ) vec2 coord@0x1636c00)\n" - " (declare (in ) float lod@0x1636d10)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec2 coord)\n" + " (declare (in) float lod))\n" + " ()))\n" "(function texture2DProjLod\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2D sampler@0x16370a0)\n" - " (declare (in ) vec3 coord@0x16371b0)\n" - " (declare (in ) float lod@0x16372c0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec3 coord)\n" + " (declare (in) float lod))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2D sampler@0x1637650)\n" - " (declare (in ) vec4 coord@0x1637760)\n" - " (declare (in ) float lod@0x1637870)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec4 coord)\n" + " (declare (in) float lod))\n" + " ()))\n" "(function texture3D\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler3D sampler@0x1637a50)\n" - " (declare (in ) vec3 coord@0x1637b60)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler3D sampler)\n" + " (declare (in) vec3 coord))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler3D sampler@0x1638390)\n" - " (declare (in ) vec3 coord@0x16384a0)\n" - " (declare (in ) float bias@0x16385b0)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) sampler3D sampler)\n" + " (declare (in) vec3 coord)\n" + " (declare (in) float bias))\n" + " ()))\n" "(function texture3DProj\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler3D sampler@0x1637ef0)\n" - " (declare (in ) vec4 coord@0x1638000)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler3D sampler)\n" + " (declare (in) vec4 coord))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler3D sampler@0x1638790)\n" - " (declare (in ) vec4 coord@0x16388a0)\n" - " (declare (in ) float bias@0x16389b0)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) sampler3D sampler)\n" + " (declare (in) vec4 coord)\n" + " (declare (in) float bias))\n" + " ()))\n" "(function texture3DLod\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler3D sampler@0x1638b90)\n" - " (declare (in ) vec3 coord@0x1638ca0)\n" - " (declare (in ) float lod@0x1638db0)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) sampler3D sampler)\n" + " (declare (in) vec3 coord)\n" + " (declare (in) float lod))\n" + " ()))\n" "(function texture3DProjLod\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler3D sampler@0x1639140)\n" - " (declare (in ) vec4 coord@0x1639250)\n" - " (declare (in ) float lod@0x1639360)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) sampler3D sampler)\n" + " (declare (in) vec4 coord)\n" + " (declare (in) float lod))\n" + " ()))\n" "(function textureCube\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) samplerCube sampler@0x16396f0)\n" - " (declare (in ) vec3 coord@0x1639800)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) samplerCube sampler)\n" + " (declare (in) vec3 coord))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) samplerCube sampler@0x1639b90)\n" - " (declare (in ) vec3 coord@0x1639ca0)\n" - " (declare (in ) float bias@0x1639db0)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) samplerCube sampler)\n" + " (declare (in) vec3 coord)\n" + " (declare (in) float bias))\n" + " ()))\n" "(function textureCubeLod\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) samplerCube sampler@0x1639f90)\n" - " (declare (in ) vec3 coord@0x163a0a0)\n" - " (declare (in ) float lod@0x163a1b0)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) samplerCube sampler)\n" + " (declare (in) vec3 coord)\n" + " (declare (in) float lod))\n" + " ()))\n" "(function shadow1D\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1DShadow sampler@0x163a540)\n" - " (declare (in ) vec3 coord@0x163a650)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler1DShadow sampler)\n" + " (declare (in) vec3 coord))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1DShadow sampler@0x163b7c0)\n" - " (declare (in ) vec3 coord@0x163b8d0)\n" - " (declare (in ) float bias@0x163b9e0)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) sampler1DShadow sampler)\n" + " (declare (in) vec3 coord)\n" + " (declare (in) float bias))\n" + " ()))\n" "(function shadow2D\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2DShadow sampler@0x163a9e0)\n" - " (declare (in ) vec3 coord@0x163aaf0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler2DShadow sampler)\n" + " (declare (in) vec3 coord))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2DShadow sampler@0x163bbc0)\n" - " (declare (in ) vec3 coord@0x163bcd0)\n" - " (declare (in ) float bias@0x163bde0)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) sampler2DShadow sampler)\n" + " (declare (in) vec3 coord)\n" + " (declare (in) float bias))\n" + " ()))\n" "(function shadow1DProj\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1DShadow sampler@0x163ae80)\n" - " (declare (in ) vec4 coord@0x163af90)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler1DShadow sampler)\n" + " (declare (in) vec4 coord))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1DShadow sampler@0x163bfc0)\n" - " (declare (in ) vec4 coord@0x163c0d0)\n" - " (declare (in ) float bias@0x163c1e0)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) sampler1DShadow sampler)\n" + " (declare (in) vec4 coord)\n" + " (declare (in) float bias))\n" + " ()))\n" "(function shadow2DProj\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2DShadow sampler@0x163b320)\n" - " (declare (in ) vec4 coord@0x163b430)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler2DShadow sampler)\n" + " (declare (in) vec4 coord))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2DShadow sampler@0x163c3c0)\n" - " (declare (in ) vec4 coord@0x163c4d0)\n" - " (declare (in ) float bias@0x163c5e0)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) sampler2DShadow sampler)\n" + " (declare (in) vec4 coord)\n" + " (declare (in) float bias))\n" + " ()))\n" "(function shadow1DLod\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1DShadow sampler@0x163c7c0)\n" - " (declare (in ) vec3 coord@0x163c8d0)\n" - " (declare (in ) float lod@0x163c9e0)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) sampler1DShadow sampler)\n" + " (declare (in) vec3 coord)\n" + " (declare (in) float lod))\n" + " ()))\n" "(function shadow2DLod\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2DShadow sampler@0x163cd70)\n" - " (declare (in ) vec3 coord@0x163ce80)\n" - " (declare (in ) float lod@0x163cf90)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) sampler2DShadow sampler)\n" + " (declare (in) vec3 coord)\n" + " (declare (in) float lod))\n" + " ()))\n" "(function shadow1DProjLod\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1DShadow sampler@0x163d320)\n" - " (declare (in ) vec4 coord@0x163d430)\n" - " (declare (in ) float lod@0x163d540)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) sampler1DShadow sampler)\n" + " (declare (in) vec4 coord)\n" + " (declare (in) float lod))\n" + " ()))\n" "(function shadow2DProjLod\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2DShadow sampler@0x163d8d0)\n" - " (declare (in ) vec4 coord@0x163d9e0)\n" - " (declare (in ) float lod@0x163daf0)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) sampler2DShadow sampler)\n" + " (declare (in) vec4 coord)\n" + " (declare (in) float lod))\n" + " ()))\n" "(function dFdx\n" " (signature float\n" " (parameters\n" - " (declare (in ) float p@0x163de80)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float p))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 p@0x163e200)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 p))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 p@0x163e3e0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 p))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 p@0x163e5c0)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 p))\n" + " ()))\n" "(function dFdy\n" " (signature float\n" " (parameters\n" - " (declare (in ) float p@0x163e7a0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float p))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 p@0x163eb20)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 p))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 p@0x163ed00)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 p))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 p@0x163eee0)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 p))\n" + " ()))\n" "(function fwidth\n" " (signature float\n" " (parameters\n" - " (declare (in ) float p@0x163f0c0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float p))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 p@0x163f440)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 p))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 p@0x163f620)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 p))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 p@0x163f800)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 p))\n" + " ()))\n" "(function noise1\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x163f9e0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float x))\n" + " ())\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec2 x@0x163fd60)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x))\n" + " ())\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec3 x@0x163ff40)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x))\n" + " ())\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec4 x@0x1640120)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 x))\n" + " ()))\n" "(function noise2\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) float x@0x1640300)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float x))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x1640680)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec3 x@0x1640860)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec4 x@0x1640a40)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 x))\n" + " ()))\n" "(function noise3\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) float x@0x1640c20)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float x))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec2 x@0x1640fa0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x1641180)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec4 x@0x1641360)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 x))\n" + " ()))\n" "(function noise4\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) float x@0x1641540)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float x))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec2 x@0x16418c0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec3 x@0x1641aa0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x1641c80)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" - "\n" - ")" + " (declare (in) vec4 x))\n" + " ())))" ; static const char *functions_for_130_frag [] = { - builtin_clamp, - builtin_matrixCompMult, + builtin_all, 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_texture2DProj, builtin_shadow1DProjLod, - builtin_any, - builtin_shadow1DProj, - builtin_normalize, + builtin_texture3DLod, + builtin_mix, + builtin_texture, + builtin_degrees, + builtin_ceil, + builtin_texture1D, + builtin_not, + builtin_mod, + builtin_radians, + builtin_smoothstep, + builtin_textureProjGrad, + builtin_lessThan, + builtin_dFdy, + builtin_textureGrad, + builtin_clamp, + builtin_cosh, builtin_asin, builtin_texture1DProj, + builtin_dFdx, + builtin_shadow2DProj, + builtin_textureLod, + builtin_faceforward, + builtin_abs, + builtin_log2, + builtin_lessThanEqual, + builtin_transpose, + builtin_step, + builtin_sinh, + builtin_cos, + builtin_shadow2DProjLod, + builtin_equal, + builtin_length, + builtin_texelFetch, + builtin_matrixCompMult, + builtin_pow, + builtin_texture2DProjLod, + builtin_textureProjLod, 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_texture1DLod, + builtin_greaterThan, + builtin_texture3DProj, + builtin_sign, + builtin_inversesqrt, + builtin_distance, + builtin_refract, + builtin_tanh, + builtin_texture1DProjLod, + builtin_texture2D, + builtin_greaterThanEqual, + builtin_texture3DProjLod, + builtin_tan, + builtin_any, + builtin_normalize, + builtin_shadow1DProj, + builtin_floor, + builtin_cross, + builtin_sqrt, + builtin_textureCubeLod, 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_acos, builtin_noise4, - builtin_distance, - builtin_cos, + builtin_notEqual, + builtin_outerProduct, builtin_shadow1D, builtin_noise1, - builtin_refract, + builtin_noise2, 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_texture2DLod, builtin_dot, }; static const char *prototypes_for_ARB_texture_rectangle_vert = @@ -16839,57 +12156,32 @@ static const char *prototypes_for_ARB_texture_rectangle_vert = "(function texture2DRect\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2DRect sampler@0x7e97b0)\n" - " (declare (in ) vec2 coord@0x7e98c0)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) sampler2DRect sampler)\n" + " (declare (in) vec2 coord))\n" + " ()))\n" "(function texture2DRectProj\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2DRect sampler@0x7e9c50)\n" - " (declare (in ) vec3 coord@0x7e9d60)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler2DRect sampler)\n" + " (declare (in) vec3 coord))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2DRect sampler@0x7ea0f0)\n" - " (declare (in ) vec4 coord@0x7ea200)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) sampler2DRect sampler)\n" + " (declare (in) vec4 coord))\n" + " ()))\n" "(function shadow2DRect\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2DRectShadow sampler@0x7ea3e0)\n" - " (declare (in ) vec3 coord@0x7ea4f0)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) sampler2DRectShadow sampler)\n" + " (declare (in) vec3 coord))\n" + " ()))\n" "(function shadow2DRectProj\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2DRectShadow sampler@0x7ea880)\n" - " (declare (in ) vec4 coord@0x7ea990)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" - "\n" - ")" + " (declare (in) sampler2DRectShadow sampler)\n" + " (declare (in) vec4 coord))\n" + " ())))" ; static const char *functions_for_ARB_texture_rectangle_vert [] = { builtin_texture2DRect, @@ -16902,4652 +12194,2932 @@ static const char *prototypes_for_130_vert = "(function radians\n" " (signature float\n" " (parameters\n" - " (declare (in ) float degrees@0x1e1bfa0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float degrees))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 degrees@0x1e1c320)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 degrees))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 degrees@0x1e1c500)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 degrees))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 degrees@0x1e1c6e0)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 degrees))\n" + " ()))\n" "(function degrees\n" " (signature float\n" " (parameters\n" - " (declare (in ) float radians@0x1e1c8c0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float radians))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 radians@0x1e1cc40)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 radians))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 radians@0x1e1ce20)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 radians))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 radians@0x1e1d000)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 radians))\n" + " ()))\n" "(function sin\n" " (signature float\n" " (parameters\n" - " (declare (in ) float angle@0x1e1d1e0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float angle))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 angle@0x1e1d560)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 angle))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 angle@0x1e1d740)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 angle))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 angle@0x1e1d920)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 angle))\n" + " ()))\n" "(function cos\n" " (signature float\n" " (parameters\n" - " (declare (in ) float angle@0x1e1db00)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float angle))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 angle@0x1e1de80)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 angle))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 angle@0x1e1e060)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 angle))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 angle@0x1e1e240)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 angle))\n" + " ()))\n" "(function tan\n" " (signature float\n" " (parameters\n" - " (declare (in ) float angle@0x1e1e420)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float angle))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 angle@0x1e1e7a0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 angle))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 angle@0x1e1e980)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 angle))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 angle@0x1e1eb60)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 angle))\n" + " ()))\n" "(function asin\n" " (signature float\n" " (parameters\n" - " (declare (in ) float angle@0x1e1ed40)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float angle))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 angle@0x1e1f0c0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 angle))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 angle@0x1e1f2a0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 angle))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 angle@0x1e1f480)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 angle))\n" + " ()))\n" "(function acos\n" " (signature float\n" " (parameters\n" - " (declare (in ) float angle@0x1e1f660)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float angle))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 angle))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 angle))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 angle))\n" + " ()))\n" + "(function atan\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float y)\n" + " (declare (in) float x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 y)\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 y)\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 y)\n" + " (declare (in) vec4 x))\n" + " ())\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float y_over_x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 y_over_x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 y_over_x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 y_over_x))\n" + " ()))\n" + "(function sinh\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 angle@0x1e1f9e0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 angle@0x1e1fbc0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 angle@0x1e1fda0)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" - "(function atan\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function cosh\n" " (signature float\n" " (parameters\n" - " (declare (in ) float y@0x1e1ff80)\n" - " (declare (in ) float x@0x1e20090)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float x))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 y@0x1e20410)\n" - " (declare (in ) vec2 x@0x1e20520)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 y@0x1e20700)\n" - " (declare (in ) vec3 x@0x1e20810)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 y@0x1e209f0)\n" - " (declare (in ) vec4 x@0x1e20b00)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function tanh\n" " (signature float\n" " (parameters\n" - " (declare (in ) float y_over_x@0x1e20ce0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float x))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 y_over_x@0x1e20ed0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 y_over_x@0x1e210c0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 y_over_x@0x1e212b0)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 x))\n" + " ()))\n" "(function pow\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x1e214a0)\n" - " (declare (in ) float y@0x1e215b0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float x)\n" + " (declare (in) float y))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x1e21930)\n" - " (declare (in ) vec2 y@0x1e21a40)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x1e21c20)\n" - " (declare (in ) vec3 y@0x1e21d30)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x1e21f10)\n" - " (declare (in ) vec4 y@0x1e22020)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" + " ()))\n" "(function exp\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x1e22200)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float x))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x1e22580)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x1e22760)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x1e22940)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 x))\n" + " ()))\n" "(function log\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x1e22b20)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float x))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x1e22ea0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x1e23080)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x1e23260)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 x))\n" + " ()))\n" "(function exp2\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x1e23440)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float x))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x1e237c0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x1e239a0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x1e23b80)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 x))\n" + " ()))\n" "(function log2\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x1e23d60)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float x))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x1e240e0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x1e242c0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x1e244a0)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 x))\n" + " ()))\n" "(function sqrt\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x1e24680)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float x))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x1e24a00)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x1e24be0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x1e24dc0)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 x))\n" + " ()))\n" "(function inversesqrt\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x1e24fa0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float x))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x1e25330)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x1e25510)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x1e256f0)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 x))\n" + " ()))\n" "(function abs\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x1e258d0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float x))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x1e25c50)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x1e25e30)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x1e26010)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec4 x))\n" + " ())\n" " (signature int\n" " (parameters\n" - " (declare (in ) int x@0x1e261f0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) int x))\n" + " ())\n" " (signature ivec2\n" " (parameters\n" - " (declare (in ) ivec2 x@0x1e263d0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) ivec2 x))\n" + " ())\n" " (signature ivec3\n" " (parameters\n" - " (declare (in ) ivec3 x@0x1e265b0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) ivec3 x))\n" + " ())\n" " (signature ivec4\n" " (parameters\n" - " (declare (in ) ivec4 x@0x1e26790)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) ivec4 x))\n" + " ()))\n" "(function sign\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x1e26970)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float x))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x1e26cf0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x1e26ed0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x1e270b0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec4 x))\n" + " ())\n" " (signature int\n" " (parameters\n" - " (declare (in ) int x@0x1e27290)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) int x))\n" + " ())\n" " (signature ivec2\n" " (parameters\n" - " (declare (in ) ivec2 x@0x1e27470)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) ivec2 x))\n" + " ())\n" " (signature ivec3\n" " (parameters\n" - " (declare (in ) ivec3 x@0x1e27650)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) ivec3 x))\n" + " ())\n" " (signature ivec4\n" " (parameters\n" - " (declare (in ) ivec4 x@0x1e27830)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) ivec4 x))\n" + " ()))\n" "(function floor\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x1e27a10)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float x))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x1e27d90)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x1e27f70)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x1e28150)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 x))\n" + " ()))\n" "(function ceil\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x1e28330)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float x))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x1e286b0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x1e28890)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x1e28a70)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 x))\n" + " ()))\n" "(function fract\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x1e28c50)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float x))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x1e28fd0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x1e291b0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x1e29390)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 x))\n" + " ()))\n" "(function mod\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x1e29570)\n" - " (declare (in ) float y@0x1e29680)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float x)\n" + " (declare (in) float y))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x1e29a00)\n" - " (declare (in ) float y@0x1e29b10)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x)\n" + " (declare (in) float y))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x1e29cf0)\n" - " (declare (in ) float y@0x1e29e00)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x)\n" + " (declare (in) float y))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x1e29fe0)\n" - " (declare (in ) float y@0x1e2a0f0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec4 x)\n" + " (declare (in) float y))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x1e2a2d0)\n" - " (declare (in ) vec2 y@0x1e2a3e0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x1e2a5c0)\n" - " (declare (in ) vec3 y@0x1e2a6d0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x1e2a8b0)\n" - " (declare (in ) vec4 y@0x1e2a9c0)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" + " ()))\n" "(function min\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x1e2aba0)\n" - " (declare (in ) float y@0x1e2acb0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float x)\n" + " (declare (in) float y))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x1e2b030)\n" - " (declare (in ) vec2 y@0x1e2b140)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x1e2b320)\n" - " (declare (in ) vec3 y@0x1e2b430)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x1e2b610)\n" - " (declare (in ) vec4 y@0x1e2b720)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x1e2b900)\n" - " (declare (in ) float y@0x1e2ba10)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x)\n" + " (declare (in) float y))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x1e2bbf0)\n" - " (declare (in ) float y@0x1e2bd00)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x)\n" + " (declare (in) float y))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x1e2bee0)\n" - " (declare (in ) float y@0x1e2bff0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec4 x)\n" + " (declare (in) float y))\n" + " ())\n" " (signature int\n" " (parameters\n" - " (declare (in ) int x@0x1e2c1d0)\n" - " (declare (in ) int y@0x1e2c2e0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) int x)\n" + " (declare (in) int y))\n" + " ())\n" " (signature ivec2\n" " (parameters\n" - " (declare (in ) ivec2 x@0x1e2c4c0)\n" - " (declare (in ) ivec2 y@0x1e2c5d0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) ivec2 x)\n" + " (declare (in) ivec2 y))\n" + " ())\n" " (signature ivec3\n" " (parameters\n" - " (declare (in ) ivec3 x@0x1e2c7b0)\n" - " (declare (in ) ivec3 y@0x1e2c8c0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) ivec3 x)\n" + " (declare (in) ivec3 y))\n" + " ())\n" " (signature ivec4\n" " (parameters\n" - " (declare (in ) ivec4 x@0x1e2caa0)\n" - " (declare (in ) ivec4 y@0x1e2cbb0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) ivec4 x)\n" + " (declare (in) ivec4 y))\n" + " ())\n" " (signature ivec2\n" " (parameters\n" - " (declare (in ) ivec2 x@0x1e2cd90)\n" - " (declare (in ) int y@0x1e2cea0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) ivec2 x)\n" + " (declare (in) int y))\n" + " ())\n" " (signature ivec3\n" " (parameters\n" - " (declare (in ) ivec3 x@0x1e2d080)\n" - " (declare (in ) int y@0x1e2d190)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) ivec3 x)\n" + " (declare (in) int y))\n" + " ())\n" " (signature ivec4\n" " (parameters\n" - " (declare (in ) ivec4 x@0x1e2d370)\n" - " (declare (in ) int y@0x1e2d480)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) ivec4 x)\n" + " (declare (in) int y))\n" + " ())\n" " (signature uint\n" " (parameters\n" - " (declare (in ) uint x@0x1e2d660)\n" - " (declare (in ) uint y@0x1e2d770)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) uint x)\n" + " (declare (in) uint y))\n" + " ())\n" " (signature uvec2\n" " (parameters\n" - " (declare (in ) uvec2 x@0x1e2d950)\n" - " (declare (in ) uvec2 y@0x1e2da60)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) uvec2 x)\n" + " (declare (in) uvec2 y))\n" + " ())\n" " (signature uvec3\n" " (parameters\n" - " (declare (in ) uvec3 x@0x1e2dc40)\n" - " (declare (in ) uvec3 y@0x1e2dd50)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) uvec3 x)\n" + " (declare (in) uvec3 y))\n" + " ())\n" " (signature uvec4\n" " (parameters\n" - " (declare (in ) uvec4 x@0x1e2df30)\n" - " (declare (in ) uvec4 y@0x1e2e040)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) uvec4 x)\n" + " (declare (in) uvec4 y))\n" + " ())\n" " (signature uvec2\n" " (parameters\n" - " (declare (in ) uvec2 x@0x1e2e220)\n" - " (declare (in ) uint y@0x1e2e330)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) uvec2 x)\n" + " (declare (in) uint y))\n" + " ())\n" " (signature uvec3\n" " (parameters\n" - " (declare (in ) uvec3 x@0x1e2e510)\n" - " (declare (in ) uint y@0x1e2e620)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) uvec3 x)\n" + " (declare (in) uint y))\n" + " ())\n" " (signature uvec4\n" " (parameters\n" - " (declare (in ) uvec4 x@0x1e2e800)\n" - " (declare (in ) uint y@0x1e2e910)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) uvec4 x)\n" + " (declare (in) uint y))\n" + " ()))\n" "(function max\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x1e2eaf0)\n" - " (declare (in ) float y@0x1e2ec00)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float x)\n" + " (declare (in) float y))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x1e2ef80)\n" - " (declare (in ) vec2 y@0x1e2f090)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x1e2f270)\n" - " (declare (in ) vec3 y@0x1e2f380)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x1e2f560)\n" - " (declare (in ) vec4 y@0x1e2f670)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x1e2f850)\n" - " (declare (in ) float y@0x1e2f960)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x)\n" + " (declare (in) float y))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x1e2fb40)\n" - " (declare (in ) float y@0x1e2fc50)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x)\n" + " (declare (in) float y))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x1e2fe30)\n" - " (declare (in ) float y@0x1e2ff40)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec4 x)\n" + " (declare (in) float y))\n" + " ())\n" " (signature int\n" " (parameters\n" - " (declare (in ) int x@0x1e30120)\n" - " (declare (in ) int y@0x1e30230)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) int x)\n" + " (declare (in) int y))\n" + " ())\n" " (signature ivec2\n" " (parameters\n" - " (declare (in ) ivec2 x@0x1e30410)\n" - " (declare (in ) ivec2 y@0x1e30520)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) ivec2 x)\n" + " (declare (in) ivec2 y))\n" + " ())\n" " (signature ivec3\n" " (parameters\n" - " (declare (in ) ivec3 x@0x1e30700)\n" - " (declare (in ) ivec3 y@0x1e30810)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) ivec3 x)\n" + " (declare (in) ivec3 y))\n" + " ())\n" " (signature ivec4\n" " (parameters\n" - " (declare (in ) ivec4 x@0x1e309f0)\n" - " (declare (in ) ivec4 y@0x1e30b00)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) ivec4 x)\n" + " (declare (in) ivec4 y))\n" + " ())\n" " (signature ivec2\n" " (parameters\n" - " (declare (in ) ivec2 x@0x1e30ce0)\n" - " (declare (in ) int y@0x1e30df0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) ivec2 x)\n" + " (declare (in) int y))\n" + " ())\n" " (signature ivec3\n" " (parameters\n" - " (declare (in ) ivec3 x@0x1e30fd0)\n" - " (declare (in ) int y@0x1e310e0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) ivec3 x)\n" + " (declare (in) int y))\n" + " ())\n" " (signature ivec4\n" " (parameters\n" - " (declare (in ) ivec4 x@0x1e312c0)\n" - " (declare (in ) int y@0x1e313d0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) ivec4 x)\n" + " (declare (in) int y))\n" + " ())\n" " (signature uint\n" " (parameters\n" - " (declare (in ) uint x@0x1e315b0)\n" - " (declare (in ) uint y@0x1e316c0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) uint x)\n" + " (declare (in) uint y))\n" + " ())\n" " (signature uvec2\n" " (parameters\n" - " (declare (in ) uvec2 x@0x1e318a0)\n" - " (declare (in ) uvec2 y@0x1e319b0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) uvec2 x)\n" + " (declare (in) uvec2 y))\n" + " ())\n" " (signature uvec3\n" " (parameters\n" - " (declare (in ) uvec3 x@0x1e31b90)\n" - " (declare (in ) uvec3 y@0x1e31ca0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) uvec3 x)\n" + " (declare (in) uvec3 y))\n" + " ())\n" " (signature uvec4\n" " (parameters\n" - " (declare (in ) uvec4 x@0x1e31e80)\n" - " (declare (in ) uvec4 y@0x1e31f90)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) uvec4 x)\n" + " (declare (in) uvec4 y))\n" + " ())\n" " (signature uvec2\n" " (parameters\n" - " (declare (in ) uvec2 x@0x1e32170)\n" - " (declare (in ) uint y@0x1e32280)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) uvec2 x)\n" + " (declare (in) uint y))\n" + " ())\n" " (signature uvec3\n" " (parameters\n" - " (declare (in ) uvec3 x@0x1e32460)\n" - " (declare (in ) uint y@0x1e32570)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) uvec3 x)\n" + " (declare (in) uint y))\n" + " ())\n" " (signature uvec4\n" " (parameters\n" - " (declare (in ) uvec4 x@0x1e32750)\n" - " (declare (in ) uint y@0x1e32860)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) uvec4 x)\n" + " (declare (in) uint y))\n" + " ()))\n" "(function clamp\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x1e32a40)\n" - " (declare (in ) float minVal@0x1e32b50)\n" - " (declare (in ) float maxVal@0x1e32c60)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float x)\n" + " (declare (in) float minVal)\n" + " (declare (in) float maxVal))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x1e32fe0)\n" - " (declare (in ) vec2 minVal@0x1e330f0)\n" - " (declare (in ) vec2 maxVal@0x1e33200)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 minVal)\n" + " (declare (in) vec2 maxVal))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x1e333e0)\n" - " (declare (in ) vec3 minVal@0x1e334f0)\n" - " (declare (in ) vec3 maxVal@0x1e33600)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 minVal)\n" + " (declare (in) vec3 maxVal))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x1e337e0)\n" - " (declare (in ) vec4 minVal@0x1e338f0)\n" - " (declare (in ) vec4 maxVal@0x1e33a00)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 minVal)\n" + " (declare (in) vec4 maxVal))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x1e33be0)\n" - " (declare (in ) float minVal@0x1e33cf0)\n" - " (declare (in ) float maxVal@0x1e33e00)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x)\n" + " (declare (in) float minVal)\n" + " (declare (in) float maxVal))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x1e33fe0)\n" - " (declare (in ) float minVal@0x1e340f0)\n" - " (declare (in ) float maxVal@0x1e34200)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x)\n" + " (declare (in) float minVal)\n" + " (declare (in) float maxVal))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x1e343e0)\n" - " (declare (in ) float minVal@0x1e344f0)\n" - " (declare (in ) float maxVal@0x1e34600)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec4 x)\n" + " (declare (in) float minVal)\n" + " (declare (in) float maxVal))\n" + " ())\n" " (signature int\n" " (parameters\n" - " (declare (in ) int x@0x1e347e0)\n" - " (declare (in ) int minVal@0x1e348f0)\n" - " (declare (in ) int maxVal@0x1e34a00)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) int x)\n" + " (declare (in) int minVal)\n" + " (declare (in) int maxVal))\n" + " ())\n" " (signature ivec2\n" " (parameters\n" - " (declare (in ) ivec2 x@0x1e34be0)\n" - " (declare (in ) ivec2 minVal@0x1e34cf0)\n" - " (declare (in ) ivec2 maxVal@0x1e34e00)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) ivec2 x)\n" + " (declare (in) ivec2 minVal)\n" + " (declare (in) ivec2 maxVal))\n" + " ())\n" " (signature ivec3\n" " (parameters\n" - " (declare (in ) ivec3 x@0x1e34fe0)\n" - " (declare (in ) ivec3 minVal@0x1e350f0)\n" - " (declare (in ) ivec3 maxVal@0x1e35200)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) ivec3 x)\n" + " (declare (in) ivec3 minVal)\n" + " (declare (in) ivec3 maxVal))\n" + " ())\n" " (signature ivec4\n" " (parameters\n" - " (declare (in ) ivec4 x@0x1e353e0)\n" - " (declare (in ) ivec4 minVal@0x1e354f0)\n" - " (declare (in ) ivec4 maxVal@0x1e35600)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) ivec4 x)\n" + " (declare (in) ivec4 minVal)\n" + " (declare (in) ivec4 maxVal))\n" + " ())\n" " (signature ivec2\n" " (parameters\n" - " (declare (in ) ivec2 x@0x1e357e0)\n" - " (declare (in ) int minVal@0x1e358f0)\n" - " (declare (in ) int maxVal@0x1e35a00)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) ivec2 x)\n" + " (declare (in) int minVal)\n" + " (declare (in) int maxVal))\n" + " ())\n" " (signature ivec3\n" " (parameters\n" - " (declare (in ) ivec3 x@0x1e35be0)\n" - " (declare (in ) int minVal@0x1e35cf0)\n" - " (declare (in ) int maxVal@0x1e35e00)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) ivec3 x)\n" + " (declare (in) int minVal)\n" + " (declare (in) int maxVal))\n" + " ())\n" " (signature ivec4\n" " (parameters\n" - " (declare (in ) ivec4 x@0x1e35fe0)\n" - " (declare (in ) int minVal@0x1e360f0)\n" - " (declare (in ) int maxVal@0x1e36200)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) ivec4 x)\n" + " (declare (in) int minVal)\n" + " (declare (in) int maxVal))\n" + " ())\n" " (signature uint\n" " (parameters\n" - " (declare (in ) uint x@0x1e363e0)\n" - " (declare (in ) uint minVal@0x1e364f0)\n" - " (declare (in ) uint maxVal@0x1e36600)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) uint x)\n" + " (declare (in) uint minVal)\n" + " (declare (in) uint maxVal))\n" + " ())\n" " (signature uvec2\n" " (parameters\n" - " (declare (in ) uvec2 x@0x1e367e0)\n" - " (declare (in ) uvec2 minVal@0x1e368f0)\n" - " (declare (in ) uvec2 maxVal@0x1e36a00)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) uvec2 x)\n" + " (declare (in) uvec2 minVal)\n" + " (declare (in) uvec2 maxVal))\n" + " ())\n" " (signature uvec3\n" " (parameters\n" - " (declare (in ) uvec3 x@0x1e36be0)\n" - " (declare (in ) uvec3 minVal@0x1e36cf0)\n" - " (declare (in ) uvec3 maxVal@0x1e36e00)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) uvec3 x)\n" + " (declare (in) uvec3 minVal)\n" + " (declare (in) uvec3 maxVal))\n" + " ())\n" " (signature uvec4\n" " (parameters\n" - " (declare (in ) uvec4 x@0x1e36fe0)\n" - " (declare (in ) uvec4 minVal@0x1e370f0)\n" - " (declare (in ) uvec4 maxVal@0x1e37200)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) uvec4 x)\n" + " (declare (in) uvec4 minVal)\n" + " (declare (in) uvec4 maxVal))\n" + " ())\n" " (signature uvec2\n" " (parameters\n" - " (declare (in ) uvec2 x@0x1e373e0)\n" - " (declare (in ) uint minVal@0x1e374f0)\n" - " (declare (in ) uint maxVal@0x1e37600)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) uvec2 x)\n" + " (declare (in) uint minVal)\n" + " (declare (in) uint maxVal))\n" + " ())\n" " (signature uvec3\n" " (parameters\n" - " (declare (in ) uvec3 x@0x1e377e0)\n" - " (declare (in ) uint minVal@0x1e378f0)\n" - " (declare (in ) uint maxVal@0x1e37a00)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) uvec3 x)\n" + " (declare (in) uint minVal)\n" + " (declare (in) uint maxVal))\n" + " ())\n" " (signature uvec4\n" " (parameters\n" - " (declare (in ) uvec4 x@0x1e37be0)\n" - " (declare (in ) uint minVal@0x1e37cf0)\n" - " (declare (in ) uint maxVal@0x1e37e00)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) uvec4 x)\n" + " (declare (in) uint minVal)\n" + " (declare (in) uint maxVal))\n" + " ()))\n" "(function mix\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x1e37fe0)\n" - " (declare (in ) float y@0x1e380f0)\n" - " (declare (in ) float a@0x1e38200)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float x)\n" + " (declare (in) float y)\n" + " (declare (in) float a))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x1e38580)\n" - " (declare (in ) vec2 y@0x1e38690)\n" - " (declare (in ) vec2 a@0x1e387a0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y)\n" + " (declare (in) vec2 a))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x1e38980)\n" - " (declare (in ) vec3 y@0x1e38a90)\n" - " (declare (in ) vec3 a@0x1e38ba0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y)\n" + " (declare (in) vec3 a))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x1e38d80)\n" - " (declare (in ) vec4 y@0x1e38e90)\n" - " (declare (in ) vec4 a@0x1e38fa0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y)\n" + " (declare (in) vec4 a))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x1e39180)\n" - " (declare (in ) vec2 y@0x1e39290)\n" - " (declare (in ) float a@0x1e393a0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y)\n" + " (declare (in) float a))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x1e39580)\n" - " (declare (in ) vec3 y@0x1e39690)\n" - " (declare (in ) float a@0x1e397a0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y)\n" + " (declare (in) float a))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x1e39980)\n" - " (declare (in ) vec4 y@0x1e39a90)\n" - " (declare (in ) float a@0x1e39ba0)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y)\n" + " (declare (in) float a))\n" + " ()))\n" "(function step\n" " (signature float\n" " (parameters\n" - " (declare (in ) float edge@0x1e39d80)\n" - " (declare (in ) float x@0x1e39e90)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float edge)\n" + " (declare (in) float x))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 edge@0x1e3a210)\n" - " (declare (in ) vec2 x@0x1e3a320)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 edge)\n" + " (declare (in) vec2 x))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 edge@0x1e3a500)\n" - " (declare (in ) vec3 x@0x1e3a610)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 edge)\n" + " (declare (in) vec3 x))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 edge@0x1e3a7f0)\n" - " (declare (in ) vec4 x@0x1e3a900)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec4 edge)\n" + " (declare (in) vec4 x))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) float edge@0x1e3aae0)\n" - " (declare (in ) vec2 x@0x1e3abf0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float edge)\n" + " (declare (in) vec2 x))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) float edge@0x1e3add0)\n" - " (declare (in ) vec3 x@0x1e3aee0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float edge)\n" + " (declare (in) vec3 x))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) float edge@0x1e3b0c0)\n" - " (declare (in ) vec4 x@0x1e3b1d0)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) float edge)\n" + " (declare (in) vec4 x))\n" + " ()))\n" "(function smoothstep\n" " (signature float\n" " (parameters\n" - " (declare (in ) float edge0@0x1e3b3b0)\n" - " (declare (in ) float edge1@0x1e3b4c0)\n" - " (declare (in ) float x@0x1e3b5d0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float edge0)\n" + " (declare (in) float edge1)\n" + " (declare (in) float x))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 edge0@0x1e3b960)\n" - " (declare (in ) vec2 edge1@0x1e3ba70)\n" - " (declare (in ) vec2 x@0x1e3bb80)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 edge0)\n" + " (declare (in) vec2 edge1)\n" + " (declare (in) vec2 x))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 edge0@0x1e3bd60)\n" - " (declare (in ) vec3 edge1@0x1e3be70)\n" - " (declare (in ) vec3 x@0x1e3bf80)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 edge0)\n" + " (declare (in) vec3 edge1)\n" + " (declare (in) vec3 x))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 edge0@0x1e3c160)\n" - " (declare (in ) vec4 edge1@0x1e3c270)\n" - " (declare (in ) vec4 x@0x1e3c380)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec4 edge0)\n" + " (declare (in) vec4 edge1)\n" + " (declare (in) vec4 x))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) float edge0@0x1e3c560)\n" - " (declare (in ) float edge1@0x1e3c670)\n" - " (declare (in ) vec2 x@0x1e3c780)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float edge0)\n" + " (declare (in) float edge1)\n" + " (declare (in) vec2 x))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) float edge0@0x1e3c960)\n" - " (declare (in ) float edge1@0x1e3ca70)\n" - " (declare (in ) vec3 x@0x1e3cb80)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float edge0)\n" + " (declare (in) float edge1)\n" + " (declare (in) vec3 x))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) float edge0@0x1e3cd60)\n" - " (declare (in ) float edge1@0x1e3ce70)\n" - " (declare (in ) vec4 x@0x1e3cf80)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) float edge0)\n" + " (declare (in) float edge1)\n" + " (declare (in) vec4 x))\n" + " ()))\n" "(function length\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x1e3d160)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float x))\n" + " ())\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec2 x@0x1e3d4e0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x))\n" + " ())\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec3 x@0x1e3d6c0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x))\n" + " ())\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec4 x@0x1e3d8a0)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 x))\n" + " ()))\n" "(function distance\n" " (signature float\n" " (parameters\n" - " (declare (in ) float p0@0x1e3da80)\n" - " (declare (in ) float p1@0x1e3db90)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float p0)\n" + " (declare (in) float p1))\n" + " ())\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec2 p0@0x1e3df20)\n" - " (declare (in ) vec2 p1@0x1e3e030)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 p0)\n" + " (declare (in) vec2 p1))\n" + " ())\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec3 p0@0x1e3e210)\n" - " (declare (in ) vec3 p1@0x1e3e320)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 p0)\n" + " (declare (in) vec3 p1))\n" + " ())\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec4 p0@0x1e3e500)\n" - " (declare (in ) vec4 p1@0x1e3e610)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 p0)\n" + " (declare (in) vec4 p1))\n" + " ()))\n" "(function dot\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x1e3e7f0)\n" - " (declare (in ) float y@0x1e3e900)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float x)\n" + " (declare (in) float y))\n" + " ())\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec2 x@0x1e3ec80)\n" - " (declare (in ) vec2 y@0x1e3ed90)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" + " ())\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec3 x@0x1e3ef70)\n" - " (declare (in ) vec3 y@0x1e3f080)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ())\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec4 x@0x1e3f260)\n" - " (declare (in ) vec4 y@0x1e3f370)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" + " ()))\n" "(function cross\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x1e3f550)\n" - " (declare (in ) vec3 y@0x1e3f660)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ()))\n" "(function normalize\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x1e3f9e0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float x))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x1e3fd70)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x1e3ff50)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x1e40130)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 x))\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@0x1e40590)\n" - " (declare (in ) float I@0x1e406a0)\n" - " (declare (in ) float Nref@0x1e407b0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (parameters)\n" + " ()))\n" + "(function faceforward\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float N)\n" + " (declare (in) float I)\n" + " (declare (in) float Nref))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 N@0x1e40b40)\n" - " (declare (in ) vec2 I@0x1e40c50)\n" - " (declare (in ) vec2 Nref@0x1e40d60)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 N)\n" + " (declare (in) vec2 I)\n" + " (declare (in) vec2 Nref))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 N@0x1e40f40)\n" - " (declare (in ) vec3 I@0x1e41050)\n" - " (declare (in ) vec3 Nref@0x1e41160)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 N)\n" + " (declare (in) vec3 I)\n" + " (declare (in) vec3 Nref))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 N@0x1e41340)\n" - " (declare (in ) vec4 I@0x1e41450)\n" - " (declare (in ) vec4 Nref@0x1e41560)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 N)\n" + " (declare (in) vec4 I)\n" + " (declare (in) vec4 Nref))\n" + " ()))\n" "(function reflect\n" " (signature float\n" " (parameters\n" - " (declare (in ) float I@0x1e41740)\n" - " (declare (in ) float N@0x1e41850)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float I)\n" + " (declare (in) float N))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 I@0x1e41bd0)\n" - " (declare (in ) vec2 N@0x1e41ce0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 I)\n" + " (declare (in) vec2 N))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 I@0x1e41ec0)\n" - " (declare (in ) vec3 N@0x1e41fd0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 I)\n" + " (declare (in) vec3 N))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 I@0x1e421b0)\n" - " (declare (in ) vec4 N@0x1e422c0)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 I)\n" + " (declare (in) vec4 N))\n" + " ()))\n" "(function refract\n" " (signature float\n" " (parameters\n" - " (declare (in ) float I@0x1e424a0)\n" - " (declare (in ) float N@0x1e425b0)\n" - " (declare (in ) float eta@0x1e426c0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float I)\n" + " (declare (in) float N)\n" + " (declare (in) float eta))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 I@0x1e42a40)\n" - " (declare (in ) vec2 N@0x1e42b50)\n" - " (declare (in ) float eta@0x1e42c60)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 I)\n" + " (declare (in) vec2 N)\n" + " (declare (in) float eta))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 I@0x1e42e40)\n" - " (declare (in ) vec3 N@0x1e42f50)\n" - " (declare (in ) float eta@0x1e43060)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 I)\n" + " (declare (in) vec3 N)\n" + " (declare (in) float eta))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 I@0x1e43240)\n" - " (declare (in ) vec4 N@0x1e43350)\n" - " (declare (in ) float eta@0x1e43460)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 I)\n" + " (declare (in) vec4 N)\n" + " (declare (in) float eta))\n" + " ()))\n" "(function matrixCompMult\n" " (signature mat2\n" " (parameters\n" - " (declare (in ) mat2 x@0x1e43640)\n" - " (declare (in ) mat2 y@0x1e43750)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) mat2 x)\n" + " (declare (in) mat2 y))\n" + " ())\n" " (signature mat3\n" " (parameters\n" - " (declare (in ) mat3 x@0x1e43ae0)\n" - " (declare (in ) mat3 y@0x1e43bf0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) mat3 x)\n" + " (declare (in) mat3 y))\n" + " ())\n" " (signature mat4\n" " (parameters\n" - " (declare (in ) mat4 x@0x1e43dd0)\n" - " (declare (in ) mat4 y@0x1e43ee0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) mat4 x)\n" + " (declare (in) mat4 y))\n" + " ())\n" " (signature mat2x3\n" " (parameters\n" - " (declare (in ) mat2x3 x@0x1e440c0)\n" - " (declare (in ) mat2x3 y@0x1e441d0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) mat2x3 x)\n" + " (declare (in) mat2x3 y))\n" + " ())\n" " (signature mat2x4\n" " (parameters\n" - " (declare (in ) mat2x4 x@0x1e443b0)\n" - " (declare (in ) mat2x4 y@0x1e444c0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) mat2x4 x)\n" + " (declare (in) mat2x4 y))\n" + " ())\n" " (signature mat3x2\n" " (parameters\n" - " (declare (in ) mat3x2 x@0x1e446a0)\n" - " (declare (in ) mat3x2 y@0x1e447b0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) mat3x2 x)\n" + " (declare (in) mat3x2 y))\n" + " ())\n" " (signature mat3x4\n" " (parameters\n" - " (declare (in ) mat3x4 x@0x1e44990)\n" - " (declare (in ) mat3x4 y@0x1e44aa0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) mat3x4 x)\n" + " (declare (in) mat3x4 y))\n" + " ())\n" " (signature mat4x2\n" " (parameters\n" - " (declare (in ) mat4x2 x@0x1e44c80)\n" - " (declare (in ) mat4x2 y@0x1e44d90)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) mat4x2 x)\n" + " (declare (in) mat4x2 y))\n" + " ())\n" " (signature mat4x3\n" " (parameters\n" - " (declare (in ) mat4x3 x@0x1e44f70)\n" - " (declare (in ) mat4x3 y@0x1e45080)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) mat4x3 x)\n" + " (declare (in) mat4x3 y))\n" + " ()))\n" "(function outerProduct\n" " (signature mat2\n" " (parameters\n" - " (declare (in ) vec2 c@0x1e45260)\n" - " (declare (in ) vec2 r@0x1e45370)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 c)\n" + " (declare (in) vec2 r))\n" + " ())\n" " (signature mat3\n" " (parameters\n" - " (declare (in ) vec3 c@0x1e45700)\n" - " (declare (in ) vec3 r@0x1e45810)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 c)\n" + " (declare (in) vec3 r))\n" + " ())\n" " (signature mat4\n" " (parameters\n" - " (declare (in ) vec4 c@0x1e459f0)\n" - " (declare (in ) vec4 r@0x1e45b00)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec4 c)\n" + " (declare (in) vec4 r))\n" + " ())\n" " (signature mat2x3\n" " (parameters\n" - " (declare (in ) vec3 c@0x1e45ce0)\n" - " (declare (in ) vec2 r@0x1e45df0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 c)\n" + " (declare (in) vec2 r))\n" + " ())\n" " (signature mat3x2\n" " (parameters\n" - " (declare (in ) vec2 c@0x1e45fd0)\n" - " (declare (in ) vec3 r@0x1e460e0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 c)\n" + " (declare (in) vec3 r))\n" + " ())\n" " (signature mat2x4\n" " (parameters\n" - " (declare (in ) vec4 c@0x1e462c0)\n" - " (declare (in ) vec2 r@0x1e463d0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec4 c)\n" + " (declare (in) vec2 r))\n" + " ())\n" " (signature mat4x2\n" " (parameters\n" - " (declare (in ) vec2 c@0x1e465b0)\n" - " (declare (in ) vec4 r@0x1e466c0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 c)\n" + " (declare (in) vec4 r))\n" + " ())\n" " (signature mat3x4\n" " (parameters\n" - " (declare (in ) vec4 c@0x1e468a0)\n" - " (declare (in ) vec3 r@0x1e469b0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec4 c)\n" + " (declare (in) vec3 r))\n" + " ())\n" " (signature mat4x3\n" " (parameters\n" - " (declare (in ) vec3 c@0x1e46b90)\n" - " (declare (in ) vec4 r@0x1e46ca0)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec3 c)\n" + " (declare (in) vec4 r))\n" + " ()))\n" "(function transpose\n" " (signature mat2\n" " (parameters\n" - " (declare (in ) mat2 m@0x1e46e80)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) mat2 m))\n" + " ())\n" " (signature mat3\n" " (parameters\n" - " (declare (in ) mat3 m@0x1e47210)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) mat3 m))\n" + " ())\n" " (signature mat4\n" " (parameters\n" - " (declare (in ) mat4 m@0x1e473f0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) mat4 m))\n" + " ())\n" " (signature mat2x3\n" " (parameters\n" - " (declare (in ) mat3x2 m@0x1e475d0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) mat3x2 m))\n" + " ())\n" " (signature mat3x2\n" " (parameters\n" - " (declare (in ) mat2x3 m@0x1e477b0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) mat2x3 m))\n" + " ())\n" " (signature mat2x4\n" " (parameters\n" - " (declare (in ) mat4x2 m@0x1e47990)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) mat4x2 m))\n" + " ())\n" " (signature mat4x2\n" " (parameters\n" - " (declare (in ) mat2x4 m@0x1e47b70)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) mat2x4 m))\n" + " ())\n" " (signature mat3x4\n" " (parameters\n" - " (declare (in ) mat4x3 m@0x1e47d50)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) mat4x3 m))\n" + " ())\n" " (signature mat4x3\n" " (parameters\n" - " (declare (in ) mat3x4 m@0x1e47f30)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) mat3x4 m))\n" + " ()))\n" "(function lessThan\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x1e48110)\n" - " (declare (in ) vec2 y@0x1e48220)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" + " ())\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x1e485b0)\n" - " (declare (in ) vec3 y@0x1e486c0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ())\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x1e488a0)\n" - " (declare (in ) vec4 y@0x1e489b0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" + " ())\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) ivec2 x@0x1e48b90)\n" - " (declare (in ) ivec2 y@0x1e48ca0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) ivec2 x)\n" + " (declare (in) ivec2 y))\n" + " ())\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) ivec3 x@0x1e48e80)\n" - " (declare (in ) ivec3 y@0x1e48f90)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) ivec3 x)\n" + " (declare (in) ivec3 y))\n" + " ())\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) ivec4 x@0x1e49170)\n" - " (declare (in ) ivec4 y@0x1e49280)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) ivec4 x)\n" + " (declare (in) ivec4 y))\n" + " ())\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) uvec2 x@0x1e49460)\n" - " (declare (in ) uvec2 y@0x1e49570)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) uvec2 x)\n" + " (declare (in) uvec2 y))\n" + " ())\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) uvec3 x@0x1e49750)\n" - " (declare (in ) uvec3 y@0x1e49860)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) uvec3 x)\n" + " (declare (in) uvec3 y))\n" + " ())\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) uvec4 x@0x1e49a40)\n" - " (declare (in ) uvec4 y@0x1e49b50)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) uvec4 x)\n" + " (declare (in) uvec4 y))\n" + " ()))\n" "(function lessThanEqual\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x1e49d30)\n" - " (declare (in ) vec2 y@0x1e49e40)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" + " ())\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x1e4a1d0)\n" - " (declare (in ) vec3 y@0x1e4a2e0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ())\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x1e4a4c0)\n" - " (declare (in ) vec4 y@0x1e4a5d0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" + " ())\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) ivec2 x@0x1e4a7b0)\n" - " (declare (in ) ivec2 y@0x1e4a8c0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) ivec2 x)\n" + " (declare (in) ivec2 y))\n" + " ())\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) ivec3 x@0x1e4aaa0)\n" - " (declare (in ) ivec3 y@0x1e4abb0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) ivec3 x)\n" + " (declare (in) ivec3 y))\n" + " ())\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) ivec4 x@0x1e4ad90)\n" - " (declare (in ) ivec4 y@0x1e4aea0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) ivec4 x)\n" + " (declare (in) ivec4 y))\n" + " ())\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) uvec2 x@0x1e4b080)\n" - " (declare (in ) uvec2 y@0x1e4b190)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) uvec2 x)\n" + " (declare (in) uvec2 y))\n" + " ())\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) uvec3 x@0x1e4b370)\n" - " (declare (in ) uvec3 y@0x1e4b480)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) uvec3 x)\n" + " (declare (in) uvec3 y))\n" + " ())\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) uvec4 x@0x1e4b660)\n" - " (declare (in ) uvec4 y@0x1e4b770)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) uvec4 x)\n" + " (declare (in) uvec4 y))\n" + " ()))\n" "(function greaterThan\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x1e4b950)\n" - " (declare (in ) vec2 y@0x1e4ba60)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" + " ())\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x1e4bdf0)\n" - " (declare (in ) vec3 y@0x1e4bf00)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ())\n" " (signature bvec4\n" - " (parameters\n" - " (declare (in ) vec4 x@0x1e4c0e0)\n" - " (declare (in ) vec4 y@0x1e4c1f0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (parameters\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" + " ())\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) ivec2 x@0x1e4c3d0)\n" - " (declare (in ) ivec2 y@0x1e4c4e0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) ivec2 x)\n" + " (declare (in) ivec2 y))\n" + " ())\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) ivec3 x@0x1e4c6c0)\n" - " (declare (in ) ivec3 y@0x1e4c7d0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) ivec3 x)\n" + " (declare (in) ivec3 y))\n" + " ())\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) ivec4 x@0x1e4c9b0)\n" - " (declare (in ) ivec4 y@0x1e4cac0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) ivec4 x)\n" + " (declare (in) ivec4 y))\n" + " ())\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) uvec2 x@0x1e4cca0)\n" - " (declare (in ) uvec2 y@0x1e4cdb0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) uvec2 x)\n" + " (declare (in) uvec2 y))\n" + " ())\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) uvec3 x@0x1e4cf90)\n" - " (declare (in ) uvec3 y@0x1e4d0a0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) uvec3 x)\n" + " (declare (in) uvec3 y))\n" + " ())\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) uvec4 x@0x1e4d280)\n" - " (declare (in ) uvec4 y@0x1e4d390)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) uvec4 x)\n" + " (declare (in) uvec4 y))\n" + " ()))\n" "(function greaterThanEqual\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x1e4d570)\n" - " (declare (in ) vec2 y@0x1e4d680)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" + " ())\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x1e4da10)\n" - " (declare (in ) vec3 y@0x1e4db20)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ())\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x1e4dd00)\n" - " (declare (in ) vec4 y@0x1e4de10)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" + " ())\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) ivec2 x@0x1e4dff0)\n" - " (declare (in ) ivec2 y@0x1e4e100)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) ivec2 x)\n" + " (declare (in) ivec2 y))\n" + " ())\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) ivec3 x@0x1e4e2e0)\n" - " (declare (in ) ivec3 y@0x1e4e3f0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) ivec3 x)\n" + " (declare (in) ivec3 y))\n" + " ())\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) ivec4 x@0x1e4e5d0)\n" - " (declare (in ) ivec4 y@0x1e4e6e0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) ivec4 x)\n" + " (declare (in) ivec4 y))\n" + " ())\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) uvec2 x@0x1e4e8c0)\n" - " (declare (in ) uvec2 y@0x1e4e9d0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) uvec2 x)\n" + " (declare (in) uvec2 y))\n" + " ())\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) uvec3 x@0x1e4ebb0)\n" - " (declare (in ) uvec3 y@0x1e4ecc0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) uvec3 x)\n" + " (declare (in) uvec3 y))\n" + " ())\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) uvec4 x@0x1e4eea0)\n" - " (declare (in ) uvec4 y@0x1e4efb0)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) uvec4 x)\n" + " (declare (in) uvec4 y))\n" + " ()))\n" "(function equal\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x1e4f190)\n" - " (declare (in ) vec2 y@0x1e4f2a0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" + " ())\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x1e4f620)\n" - " (declare (in ) vec3 y@0x1e4f730)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ())\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x1e4f910)\n" - " (declare (in ) vec4 y@0x1e4fa20)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" + " ())\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) ivec2 x@0x1e4fc00)\n" - " (declare (in ) ivec2 y@0x1e4fd10)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) ivec2 x)\n" + " (declare (in) ivec2 y))\n" + " ())\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) ivec3 x@0x1e4fef0)\n" - " (declare (in ) ivec3 y@0x1e50000)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) ivec3 x)\n" + " (declare (in) ivec3 y))\n" + " ())\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) ivec4 x@0x1e501e0)\n" - " (declare (in ) ivec4 y@0x1e502f0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) ivec4 x)\n" + " (declare (in) ivec4 y))\n" + " ())\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) uvec2 x@0x1e504d0)\n" - " (declare (in ) uvec2 y@0x1e505e0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) uvec2 x)\n" + " (declare (in) uvec2 y))\n" + " ())\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) uvec3 x@0x1e507c0)\n" - " (declare (in ) uvec3 y@0x1e508d0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) uvec3 x)\n" + " (declare (in) uvec3 y))\n" + " ())\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) uvec4 x@0x1e50ab0)\n" - " (declare (in ) uvec4 y@0x1e50bc0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) uvec4 x)\n" + " (declare (in) uvec4 y))\n" + " ())\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) bvec2 x@0x1e50da0)\n" - " (declare (in ) bvec2 y@0x1e50eb0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) bvec2 x)\n" + " (declare (in) bvec2 y))\n" + " ())\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) bvec3 x@0x1e51090)\n" - " (declare (in ) bvec3 y@0x1e511a0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) bvec3 x)\n" + " (declare (in) bvec3 y))\n" + " ())\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) bvec4 x@0x1e51380)\n" - " (declare (in ) bvec4 y@0x1e51490)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) bvec4 x)\n" + " (declare (in) bvec4 y))\n" + " ()))\n" "(function notEqual\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x1e51670)\n" - " (declare (in ) vec2 y@0x1e51780)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" + " ())\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x1e51b10)\n" - " (declare (in ) vec3 y@0x1e51c20)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ())\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x1e51e00)\n" - " (declare (in ) vec4 y@0x1e51f10)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" + " ())\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) ivec2 x@0x1e520f0)\n" - " (declare (in ) ivec2 y@0x1e52200)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) ivec2 x)\n" + " (declare (in) ivec2 y))\n" + " ())\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) ivec3 x@0x1e523e0)\n" - " (declare (in ) ivec3 y@0x1e524f0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) ivec3 x)\n" + " (declare (in) ivec3 y))\n" + " ())\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) ivec4 x@0x1e526d0)\n" - " (declare (in ) ivec4 y@0x1e527e0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) ivec4 x)\n" + " (declare (in) ivec4 y))\n" + " ())\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) uvec2 x@0x1e529c0)\n" - " (declare (in ) uvec2 y@0x1e52ad0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) uvec2 x)\n" + " (declare (in) uvec2 y))\n" + " ())\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) uvec3 x@0x1e52cb0)\n" - " (declare (in ) uvec3 y@0x1e52dc0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) uvec3 x)\n" + " (declare (in) uvec3 y))\n" + " ())\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) uvec4 x@0x1e52fa0)\n" - " (declare (in ) uvec4 y@0x1e530b0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) uvec4 x)\n" + " (declare (in) uvec4 y))\n" + " ())\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) bvec2 x@0x1e53290)\n" - " (declare (in ) bvec2 y@0x1e533a0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) bvec2 x)\n" + " (declare (in) bvec2 y))\n" + " ())\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) bvec3 x@0x1e53580)\n" - " (declare (in ) bvec3 y@0x1e53690)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) bvec3 x)\n" + " (declare (in) bvec3 y))\n" + " ())\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) bvec4 x@0x1e53870)\n" - " (declare (in ) bvec4 y@0x1e53980)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) bvec4 x)\n" + " (declare (in) bvec4 y))\n" + " ()))\n" "(function any\n" " (signature bool\n" " (parameters\n" - " (declare (in ) bvec2 x@0x1e53b60)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) bvec2 x))\n" + " ())\n" " (signature bool\n" " (parameters\n" - " (declare (in ) bvec3 x@0x1e53ee0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) bvec3 x))\n" + " ())\n" " (signature bool\n" " (parameters\n" - " (declare (in ) bvec4 x@0x1e540c0)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) bvec4 x))\n" + " ()))\n" "(function all\n" " (signature bool\n" " (parameters\n" - " (declare (in ) bvec2 x@0x1e542a0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) bvec2 x))\n" + " ())\n" " (signature bool\n" " (parameters\n" - " (declare (in ) bvec3 x@0x1e54620)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) bvec3 x))\n" + " ())\n" " (signature bool\n" " (parameters\n" - " (declare (in ) bvec4 x@0x1e54800)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) bvec4 x))\n" + " ()))\n" "(function not\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) bvec2 x@0x1e549e0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) bvec2 x))\n" + " ())\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) bvec3 x@0x1e54d60)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) bvec3 x))\n" + " ())\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) bvec4 x@0x1e54f40)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) bvec4 x))\n" + " ()))\n" "(function texture\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1D sampler@0x1e55120)\n" - " (declare (in ) float P@0x1e55230)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) float P))\n" + " ())\n" " (signature ivec4\n" " (parameters\n" - " (declare (in ) isampler1D sampler@0x1e555b0)\n" - " (declare (in ) float P@0x1e556c0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) isampler1D sampler)\n" + " (declare (in) float P))\n" + " ())\n" " (signature uvec4\n" " (parameters\n" - " (declare (in ) usampler1D sampler@0x1e558a0)\n" - " (declare (in ) float P@0x1e559b0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) usampler1D sampler)\n" + " (declare (in) float P))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2D sampler@0x1e55b90)\n" - " (declare (in ) vec2 P@0x1e55ca0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec2 P))\n" + " ())\n" " (signature ivec4\n" " (parameters\n" - " (declare (in ) isampler2D sampler@0x1e55e80)\n" - " (declare (in ) vec2 P@0x1e55f90)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) isampler2D sampler)\n" + " (declare (in) vec2 P))\n" + " ())\n" " (signature uvec4\n" " (parameters\n" - " (declare (in ) usampler2D sampler@0x1e56170)\n" - " (declare (in ) vec2 P@0x1e56280)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) usampler2D sampler)\n" + " (declare (in) vec2 P))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler3D sampler@0x1e56460)\n" - " (declare (in ) vec3 P@0x1e56570)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler3D sampler)\n" + " (declare (in) vec3 P))\n" + " ())\n" " (signature ivec4\n" " (parameters\n" - " (declare (in ) isampler3D sampler@0x1e56750)\n" - " (declare (in ) vec3 P@0x1e56860)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) isampler3D sampler)\n" + " (declare (in) vec3 P))\n" + " ())\n" " (signature uvec4\n" " (parameters\n" - " (declare (in ) usampler3D sampler@0x1e56a40)\n" - " (declare (in ) vec3 P@0x1e56b50)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) usampler3D sampler)\n" + " (declare (in) vec3 P))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) samplerCube sampler@0x1e56d30)\n" - " (declare (in ) vec3 P@0x1e56e40)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) samplerCube sampler)\n" + " (declare (in) vec3 P))\n" + " ())\n" " (signature ivec4\n" " (parameters\n" - " (declare (in ) isamplerCube sampler@0x1e57020)\n" - " (declare (in ) vec3 P@0x1e57130)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) isamplerCube sampler)\n" + " (declare (in) vec3 P))\n" + " ())\n" " (signature uvec4\n" - " (parameters\n" - " (declare (in ) usamplerCube sampler@0x1e57310)\n" - " (declare (in ) vec3 P@0x1e57420)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (parameters\n" + " (declare (in) usamplerCube sampler)\n" + " (declare (in) vec3 P))\n" + " ())\n" " (signature float\n" " (parameters\n" - " (declare (in ) sampler1DShadow sampler@0x1e57600)\n" - " (declare (in ) vec3 P@0x1e57710)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler1DShadow sampler)\n" + " (declare (in) vec3 P))\n" + " ())\n" " (signature float\n" " (parameters\n" - " (declare (in ) sampler2DShadow sampler@0x1e578f0)\n" - " (declare (in ) vec3 P@0x1e57a00)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler2DShadow sampler)\n" + " (declare (in) vec3 P))\n" + " ())\n" " (signature float\n" " (parameters\n" - " (declare (in ) samplerCubeShadow sampler@0x1e57be0)\n" - " (declare (in ) vec4 P@0x1e57cf0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) samplerCubeShadow sampler)\n" + " (declare (in) vec4 P))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1DArray sampler@0x1e57ed0)\n" - " (declare (in ) vec2 P@0x1e57fe0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler1DArray sampler)\n" + " (declare (in) vec2 P))\n" + " ())\n" " (signature ivec4\n" " (parameters\n" - " (declare (in ) isampler1DArray sampler@0x1e581c0)\n" - " (declare (in ) vec2 P@0x1e582d0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) isampler1DArray sampler)\n" + " (declare (in) vec2 P))\n" + " ())\n" " (signature uvec4\n" " (parameters\n" - " (declare (in ) usampler1DArray sampler@0x1e584b0)\n" - " (declare (in ) vec2 P@0x1e585c0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) usampler1DArray sampler)\n" + " (declare (in) vec2 P))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2DArray sampler@0x1e587a0)\n" - " (declare (in ) vec3 P@0x1e588b0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler2DArray sampler)\n" + " (declare (in) vec3 P))\n" + " ())\n" " (signature ivec4\n" " (parameters\n" - " (declare (in ) isampler2DArray sampler@0x1e58a90)\n" - " (declare (in ) vec3 P@0x1e58ba0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) isampler2DArray sampler)\n" + " (declare (in) vec3 P))\n" + " ())\n" " (signature uvec4\n" " (parameters\n" - " (declare (in ) usampler2DArray sampler@0x1e58d80)\n" - " (declare (in ) vec3 P@0x1e58e90)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) usampler2DArray sampler)\n" + " (declare (in) vec3 P))\n" + " ())\n" " (signature float\n" " (parameters\n" - " (declare (in ) sampler1DArrayShadow sampler@0x1e59070)\n" - " (declare (in ) vec3 P@0x1e59180)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler1DArrayShadow sampler)\n" + " (declare (in) vec3 P))\n" + " ())\n" " (signature float\n" " (parameters\n" - " (declare (in ) sampler2DArrayShadow sampler@0x1e59360)\n" - " (declare (in ) vec4 P@0x1e59470)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler2DArrayShadow sampler)\n" + " (declare (in) vec4 P))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1D sampler@0x1e59650)\n" - " (declare (in ) float P@0x1e59760)\n" - " (declare (in ) float bias@0x1e59870)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) float P)\n" + " (declare (in) float bias))\n" + " ())\n" " (signature ivec4\n" " (parameters\n" - " (declare (in ) isampler1D sampler@0x1e59a50)\n" - " (declare (in ) float P@0x1e59b60)\n" - " (declare (in ) float bias@0x1e59c70)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) isampler1D sampler)\n" + " (declare (in) float P)\n" + " (declare (in) float bias))\n" + " ())\n" " (signature uvec4\n" " (parameters\n" - " (declare (in ) usampler1D sampler@0x1e59e50)\n" - " (declare (in ) float P@0x1e59f60)\n" - " (declare (in ) float bias@0x1e5a070)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) usampler1D sampler)\n" + " (declare (in) float P)\n" + " (declare (in) float bias))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2D sampler@0x1e5a250)\n" - " (declare (in ) vec2 P@0x1e5a360)\n" - " (declare (in ) float bias@0x1e5a470)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec2 P)\n" + " (declare (in) float bias))\n" + " ())\n" " (signature ivec4\n" " (parameters\n" - " (declare (in ) isampler2D sampler@0x1e5a650)\n" - " (declare (in ) vec2 P@0x1e5a760)\n" - " (declare (in ) float bias@0x1e5a870)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) isampler2D sampler)\n" + " (declare (in) vec2 P)\n" + " (declare (in) float bias))\n" + " ())\n" " (signature uvec4\n" " (parameters\n" - " (declare (in ) usampler2D sampler@0x1e5aa50)\n" - " (declare (in ) vec2 P@0x1e5ab60)\n" - " (declare (in ) float bias@0x1e5ac70)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) usampler2D sampler)\n" + " (declare (in) vec2 P)\n" + " (declare (in) float bias))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler3D sampler@0x1e5ae50)\n" - " (declare (in ) vec3 P@0x1e5af60)\n" - " (declare (in ) float bias@0x1e5b070)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler3D sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float bias))\n" + " ())\n" " (signature ivec4\n" " (parameters\n" - " (declare (in ) isampler3D sampler@0x1e5b250)\n" - " (declare (in ) vec3 P@0x1e5b360)\n" - " (declare (in ) float bias@0x1e5b470)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) isampler3D sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float bias))\n" + " ())\n" " (signature uvec4\n" " (parameters\n" - " (declare (in ) usampler3D sampler@0x1e5b650)\n" - " (declare (in ) vec3 P@0x1e5b760)\n" - " (declare (in ) float bias@0x1e5b870)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) usampler3D sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float bias))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) samplerCube sampler@0x1e5ba50)\n" - " (declare (in ) vec3 P@0x1e5bb60)\n" - " (declare (in ) float bias@0x1e5bc70)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) samplerCube sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float bias))\n" + " ())\n" " (signature ivec4\n" " (parameters\n" - " (declare (in ) isamplerCube sampler@0x1e5be50)\n" - " (declare (in ) vec3 P@0x1e5bf60)\n" - " (declare (in ) float bias@0x1e5c070)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) isamplerCube sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float bias))\n" + " ())\n" " (signature uvec4\n" " (parameters\n" - " (declare (in ) usamplerCube sampler@0x1e5c250)\n" - " (declare (in ) vec3 P@0x1e5c360)\n" - " (declare (in ) float bias@0x1e5c470)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) usamplerCube sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float bias))\n" + " ())\n" " (signature float\n" " (parameters\n" - " (declare (in ) sampler1DShadow sampler@0x1e5c650)\n" - " (declare (in ) vec3 P@0x1e5c760)\n" - " (declare (in ) float bias@0x1e5c870)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler1DShadow sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float bias))\n" + " ())\n" " (signature float\n" " (parameters\n" - " (declare (in ) sampler2DShadow sampler@0x1e5ca50)\n" - " (declare (in ) vec3 P@0x1e5cb60)\n" - " (declare (in ) float bias@0x1e5cc70)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler2DShadow sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float bias))\n" + " ())\n" " (signature float\n" " (parameters\n" - " (declare (in ) samplerCubeShadow sampler@0x1e5ce50)\n" - " (declare (in ) vec4 P@0x1e5cf60)\n" - " (declare (in ) float bias@0x1e5d070)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) samplerCubeShadow sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) float bias))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1DArray sampler@0x1e5d250)\n" - " (declare (in ) vec2 P@0x1e5d360)\n" - " (declare (in ) float bias@0x1e5d470)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler1DArray sampler)\n" + " (declare (in) vec2 P)\n" + " (declare (in) float bias))\n" + " ())\n" " (signature ivec4\n" " (parameters\n" - " (declare (in ) isampler1DArray sampler@0x1e5d650)\n" - " (declare (in ) vec2 P@0x1e5d760)\n" - " (declare (in ) float bias@0x1e5d870)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) isampler1DArray sampler)\n" + " (declare (in) vec2 P)\n" + " (declare (in) float bias))\n" + " ())\n" " (signature uvec4\n" " (parameters\n" - " (declare (in ) usampler1DArray sampler@0x1e5da50)\n" - " (declare (in ) vec2 P@0x1e5db60)\n" - " (declare (in ) float bias@0x1e5dc70)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) usampler1DArray sampler)\n" + " (declare (in) vec2 P)\n" + " (declare (in) float bias))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2DArray sampler@0x1e5de50)\n" - " (declare (in ) vec3 P@0x1e5df60)\n" - " (declare (in ) float bias@0x1e5e070)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler2DArray sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float bias))\n" + " ())\n" " (signature ivec4\n" " (parameters\n" - " (declare (in ) isampler2DArray sampler@0x1e5e250)\n" - " (declare (in ) vec3 P@0x1e5e360)\n" - " (declare (in ) float bias@0x1e5e470)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) isampler2DArray sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float bias))\n" + " ())\n" " (signature uvec4\n" " (parameters\n" - " (declare (in ) usampler2DArray sampler@0x1e5e650)\n" - " (declare (in ) vec3 P@0x1e5e760)\n" - " (declare (in ) float bias@0x1e5e870)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) usampler2DArray sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float bias))\n" + " ())\n" " (signature float\n" " (parameters\n" - " (declare (in ) sampler1DArrayShadow sampler@0x1e5ea50)\n" - " (declare (in ) vec3 P@0x1e5eb60)\n" - " (declare (in ) float bias@0x1e5ec70)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) sampler1DArrayShadow sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float bias))\n" + " ()))\n" "(function textureProj\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1D sampler@0x1e5ee50)\n" - " (declare (in ) vec2 P@0x1e5ef60)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) vec2 P))\n" + " ())\n" " (signature ivec4\n" " (parameters\n" - " (declare (in ) isampler1D sampler@0x1e5f2f0)\n" - " (declare (in ) vec2 P@0x1e5f400)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) isampler1D sampler)\n" + " (declare (in) vec2 P))\n" + " ())\n" " (signature uvec4\n" " (parameters\n" - " (declare (in ) usampler1D sampler@0x1e5f5e0)\n" - " (declare (in ) vec2 P@0x1e5f6f0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) usampler1D sampler)\n" + " (declare (in) vec2 P))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1D sampler@0x1e5f8d0)\n" - " (declare (in ) vec4 P@0x1e5f9e0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) vec4 P))\n" + " ())\n" " (signature ivec4\n" " (parameters\n" - " (declare (in ) isampler1D sampler@0x1e5fbc0)\n" - " (declare (in ) vec4 P@0x1e5fcd0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) isampler1D sampler)\n" + " (declare (in) vec4 P))\n" + " ())\n" " (signature uvec4\n" " (parameters\n" - " (declare (in ) usampler1D sampler@0x1e5feb0)\n" - " (declare (in ) vec4 P@0x1e5ffc0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) usampler1D sampler)\n" + " (declare (in) vec4 P))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2D sampler@0x1e601a0)\n" - " (declare (in ) vec3 P@0x1e602b0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec3 P))\n" + " ())\n" " (signature ivec4\n" " (parameters\n" - " (declare (in ) isampler2D sampler@0x1e60490)\n" - " (declare (in ) vec3 P@0x1e605a0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) isampler2D sampler)\n" + " (declare (in) vec3 P))\n" + " ())\n" " (signature uvec4\n" " (parameters\n" - " (declare (in ) usampler2D sampler@0x1e60780)\n" - " (declare (in ) vec3 P@0x1e60890)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) usampler2D sampler)\n" + " (declare (in) vec3 P))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2D sampler@0x1e60a70)\n" - " (declare (in ) vec4 P@0x1e60b80)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec4 P))\n" + " ())\n" " (signature ivec4\n" " (parameters\n" - " (declare (in ) isampler2D sampler@0x1e60d60)\n" - " (declare (in ) vec4 P@0x1e60e70)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) isampler2D sampler)\n" + " (declare (in) vec4 P))\n" + " ())\n" " (signature uvec4\n" " (parameters\n" - " (declare (in ) usampler2D sampler@0x1e61050)\n" - " (declare (in ) vec4 P@0x1e61160)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) usampler2D sampler)\n" + " (declare (in) vec4 P))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler3D sampler@0x1e61340)\n" - " (declare (in ) vec4 P@0x1e61450)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler3D sampler)\n" + " (declare (in) vec4 P))\n" + " ())\n" " (signature ivec4\n" " (parameters\n" - " (declare (in ) isampler3D sampler@0x1e61630)\n" - " (declare (in ) vec4 P@0x1e61740)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) isampler3D sampler)\n" + " (declare (in) vec4 P))\n" + " ())\n" " (signature uvec4\n" " (parameters\n" - " (declare (in ) usampler3D sampler@0x1e61920)\n" - " (declare (in ) vec4 P@0x1e61a30)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) usampler3D sampler)\n" + " (declare (in) vec4 P))\n" + " ())\n" " (signature float\n" " (parameters\n" - " (declare (in ) sampler1DShadow sampler@0x1e61c10)\n" - " (declare (in ) vec4 P@0x1e61d20)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler1DShadow sampler)\n" + " (declare (in) vec4 P))\n" + " ())\n" " (signature float\n" " (parameters\n" - " (declare (in ) sampler2DShadow sampler@0x1e61f00)\n" - " (declare (in ) vec4 P@0x1e62010)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler2DShadow sampler)\n" + " (declare (in) vec4 P))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1D sampler@0x1e621f0)\n" - " (declare (in ) vec2 P@0x1e62300)\n" - " (declare (in ) float bias@0x1e62410)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) vec2 P)\n" + " (declare (in) float bias))\n" + " ())\n" " (signature ivec4\n" " (parameters\n" - " (declare (in ) isampler1D sampler@0x1e625f0)\n" - " (declare (in ) vec2 P@0x1e62700)\n" - " (declare (in ) float bias@0x1e62810)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) isampler1D sampler)\n" + " (declare (in) vec2 P)\n" + " (declare (in) float bias))\n" + " ())\n" " (signature uvec4\n" " (parameters\n" - " (declare (in ) usampler1D sampler@0x1e629f0)\n" - " (declare (in ) vec2 P@0x1e62b00)\n" - " (declare (in ) float bias@0x1e62c10)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) usampler1D sampler)\n" + " (declare (in) vec2 P)\n" + " (declare (in) float bias))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1D sampler@0x1e62df0)\n" - " (declare (in ) vec4 P@0x1e62f00)\n" - " (declare (in ) float bias@0x1e63010)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) float bias))\n" + " ())\n" " (signature ivec4\n" " (parameters\n" - " (declare (in ) isampler1D sampler@0x1e631f0)\n" - " (declare (in ) vec4 P@0x1e63300)\n" - " (declare (in ) float bias@0x1e63410)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) isampler1D sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) float bias))\n" + " ())\n" " (signature uvec4\n" " (parameters\n" - " (declare (in ) usampler1D sampler@0x1e635f0)\n" - " (declare (in ) vec4 P@0x1e63700)\n" - " (declare (in ) float bias@0x1e63810)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) usampler1D sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) float bias))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2D sampler@0x1e639f0)\n" - " (declare (in ) vec3 P@0x1e63b00)\n" - " (declare (in ) float bias@0x1e63c10)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float bias))\n" + " ())\n" " (signature ivec4\n" " (parameters\n" - " (declare (in ) isampler2D sampler@0x1e63df0)\n" - " (declare (in ) vec3 P@0x1e63f00)\n" - " (declare (in ) float bias@0x1e64010)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) isampler2D sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float bias))\n" + " ())\n" " (signature uvec4\n" " (parameters\n" - " (declare (in ) usampler2D sampler@0x1e641f0)\n" - " (declare (in ) vec3 P@0x1e64300)\n" - " (declare (in ) float bias@0x1e64410)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) usampler2D sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float bias))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2D sampler@0x1e645f0)\n" - " (declare (in ) vec4 P@0x1e64700)\n" - " (declare (in ) float bias@0x1e64810)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) float bias))\n" + " ())\n" " (signature ivec4\n" " (parameters\n" - " (declare (in ) isampler2D sampler@0x1e649f0)\n" - " (declare (in ) vec4 P@0x1e64b00)\n" - " (declare (in ) float bias@0x1e64c10)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) isampler2D sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) float bias))\n" + " ())\n" " (signature uvec4\n" " (parameters\n" - " (declare (in ) usampler2D sampler@0x1e64df0)\n" - " (declare (in ) vec4 P@0x1e64f00)\n" - " (declare (in ) float bias@0x1e65010)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) usampler2D sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) float bias))\n" + " ())\n" " (signature vec4\n" - " (parameters\n" - " (declare (in ) sampler3D sampler@0x1e651f0)\n" - " (declare (in ) vec4 P@0x1e65300)\n" - " (declare (in ) float bias@0x1e65410)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (parameters\n" + " (declare (in) sampler3D sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) float bias))\n" + " ())\n" " (signature ivec4\n" " (parameters\n" - " (declare (in ) isampler3D sampler@0x1e655f0)\n" - " (declare (in ) vec4 P@0x1e65700)\n" - " (declare (in ) float bias@0x1e65810)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) isampler3D sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) float bias))\n" + " ())\n" " (signature uvec4\n" " (parameters\n" - " (declare (in ) usampler3D sampler@0x1e659f0)\n" - " (declare (in ) vec4 P@0x1e65b00)\n" - " (declare (in ) float bias@0x1e65c10)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) usampler3D sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) float bias))\n" + " ())\n" " (signature float\n" " (parameters\n" - " (declare (in ) sampler1DShadow sampler@0x1e65df0)\n" - " (declare (in ) vec4 P@0x1e65f00)\n" - " (declare (in ) float bias@0x1e66010)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler1DShadow sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) float bias))\n" + " ())\n" " (signature float\n" " (parameters\n" - " (declare (in ) sampler2DShadow sampler@0x1e661f0)\n" - " (declare (in ) vec4 P@0x1e66300)\n" - " (declare (in ) float bias@0x1e66410)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) sampler2DShadow sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) float bias))\n" + " ()))\n" "(function textureLod\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1D sampler@0x1e665f0)\n" - " (declare (in ) float P@0x1e66700)\n" - " (declare (in ) float lod@0x1e66810)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) float P)\n" + " (declare (in) float lod))\n" + " ())\n" " (signature ivec4\n" " (parameters\n" - " (declare (in ) isampler1D sampler@0x1e66ba0)\n" - " (declare (in ) float P@0x1e66cb0)\n" - " (declare (in ) float lod@0x1e66dc0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) isampler1D sampler)\n" + " (declare (in) float P)\n" + " (declare (in) float lod))\n" + " ())\n" " (signature uvec4\n" " (parameters\n" - " (declare (in ) usampler1D sampler@0x1e66fa0)\n" - " (declare (in ) float P@0x1e670b0)\n" - " (declare (in ) float lod@0x1e671c0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) usampler1D sampler)\n" + " (declare (in) float P)\n" + " (declare (in) float lod))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2D sampler@0x1e673a0)\n" - " (declare (in ) vec2 P@0x1e674b0)\n" - " (declare (in ) float lod@0x1e675c0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec2 P)\n" + " (declare (in) float lod))\n" + " ())\n" " (signature ivec4\n" " (parameters\n" - " (declare (in ) isampler2D sampler@0x1e677a0)\n" - " (declare (in ) vec2 P@0x1e678b0)\n" - " (declare (in ) float lod@0x1e679c0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) isampler2D sampler)\n" + " (declare (in) vec2 P)\n" + " (declare (in) float lod))\n" + " ())\n" " (signature uvec4\n" " (parameters\n" - " (declare (in ) usampler2D sampler@0x1e67ba0)\n" - " (declare (in ) vec2 P@0x1e67cb0)\n" - " (declare (in ) float lod@0x1e67dc0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) usampler2D sampler)\n" + " (declare (in) vec2 P)\n" + " (declare (in) float lod))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler3D sampler@0x1e67fa0)\n" - " (declare (in ) vec3 P@0x1e680b0)\n" - " (declare (in ) float lod@0x1e681c0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler3D sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float lod))\n" + " ())\n" " (signature ivec4\n" " (parameters\n" - " (declare (in ) isampler3D sampler@0x1e683a0)\n" - " (declare (in ) vec3 P@0x1e684b0)\n" - " (declare (in ) float lod@0x1e685c0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) isampler3D sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float lod))\n" + " ())\n" " (signature uvec4\n" " (parameters\n" - " (declare (in ) usampler3D sampler@0x1e687a0)\n" - " (declare (in ) vec3 P@0x1e688b0)\n" - " (declare (in ) float lod@0x1e689c0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) usampler3D sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float lod))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) samplerCube sampler@0x1e68ba0)\n" - " (declare (in ) vec3 P@0x1e68cb0)\n" - " (declare (in ) float lod@0x1e68dc0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) samplerCube sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float lod))\n" + " ())\n" " (signature ivec4\n" " (parameters\n" - " (declare (in ) isamplerCube sampler@0x1e68fa0)\n" - " (declare (in ) vec3 P@0x1e690b0)\n" - " (declare (in ) float lod@0x1e691c0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) isamplerCube sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float lod))\n" + " ())\n" " (signature uvec4\n" " (parameters\n" - " (declare (in ) usamplerCube sampler@0x1e693a0)\n" - " (declare (in ) vec3 P@0x1e694b0)\n" - " (declare (in ) float lod@0x1e695c0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) usamplerCube sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float lod))\n" + " ())\n" " (signature float\n" " (parameters\n" - " (declare (in ) sampler1DShadow sampler@0x1e697a0)\n" - " (declare (in ) vec3 P@0x1e698b0)\n" - " (declare (in ) float lod@0x1e699c0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler1DShadow sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float lod))\n" + " ())\n" " (signature float\n" " (parameters\n" - " (declare (in ) sampler2DShadow sampler@0x1e69ba0)\n" - " (declare (in ) vec3 P@0x1e69cb0)\n" - " (declare (in ) float lod@0x1e69dc0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler2DShadow sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float lod))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1DArray sampler@0x1e69fa0)\n" - " (declare (in ) vec2 P@0x1e6a0b0)\n" - " (declare (in ) float lod@0x1e6a1c0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler1DArray sampler)\n" + " (declare (in) vec2 P)\n" + " (declare (in) float lod))\n" + " ())\n" " (signature ivec4\n" " (parameters\n" - " (declare (in ) isampler1DArray sampler@0x1e6a3a0)\n" - " (declare (in ) vec2 P@0x1e6a4b0)\n" - " (declare (in ) float lod@0x1e6a5c0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) isampler1DArray sampler)\n" + " (declare (in) vec2 P)\n" + " (declare (in) float lod))\n" + " ())\n" " (signature uvec4\n" " (parameters\n" - " (declare (in ) usampler1DArray sampler@0x1e6a7a0)\n" - " (declare (in ) vec2 P@0x1e6a8b0)\n" - " (declare (in ) float lod@0x1e6a9c0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) usampler1DArray sampler)\n" + " (declare (in) vec2 P)\n" + " (declare (in) float lod))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2DArray sampler@0x1e6aba0)\n" - " (declare (in ) vec3 P@0x1e6acb0)\n" - " (declare (in ) float lod@0x1e6adc0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler2DArray sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float lod))\n" + " ())\n" " (signature ivec4\n" " (parameters\n" - " (declare (in ) isampler2DArray sampler@0x1e6afa0)\n" - " (declare (in ) vec3 P@0x1e6b0b0)\n" - " (declare (in ) float lod@0x1e6b1c0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) isampler2DArray sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float lod))\n" + " ())\n" " (signature uvec4\n" " (parameters\n" - " (declare (in ) usampler2DArray sampler@0x1e6b3a0)\n" - " (declare (in ) vec3 P@0x1e6b4b0)\n" - " (declare (in ) float lod@0x1e6b5c0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) usampler2DArray sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float lod))\n" + " ())\n" " (signature float\n" " (parameters\n" - " (declare (in ) sampler1DArrayShadow sampler@0x1e6b7a0)\n" - " (declare (in ) vec3 P@0x1e6b8b0)\n" - " (declare (in ) float lod@0x1e6b9c0)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) sampler1DArrayShadow sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float lod))\n" + " ()))\n" "(function texelFetch\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1D sampler@0x1e6bba0)\n" - " (declare (in ) int P@0x1e6bcb0)\n" - " (declare (in ) int lod@0x1e6bdc0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) int P)\n" + " (declare (in) int lod))\n" + " ())\n" " (signature ivec4\n" " (parameters\n" - " (declare (in ) isampler1D sampler@0x1e6c150)\n" - " (declare (in ) int P@0x1e6c260)\n" - " (declare (in ) int lod@0x1e6c370)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) isampler1D sampler)\n" + " (declare (in) int P)\n" + " (declare (in) int lod))\n" + " ())\n" " (signature uvec4\n" " (parameters\n" - " (declare (in ) usampler1D sampler@0x1e6c550)\n" - " (declare (in ) int P@0x1e6c660)\n" - " (declare (in ) int lod@0x1e6c770)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) usampler1D sampler)\n" + " (declare (in) int P)\n" + " (declare (in) int lod))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2D sampler@0x1e6c950)\n" - " (declare (in ) ivec2 P@0x1e6ca60)\n" - " (declare (in ) int lod@0x1e6cb70)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) ivec2 P)\n" + " (declare (in) int lod))\n" + " ())\n" " (signature ivec4\n" " (parameters\n" - " (declare (in ) isampler2D sampler@0x1e6cd50)\n" - " (declare (in ) ivec2 P@0x1e6ce60)\n" - " (declare (in ) int lod@0x1e6cf70)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) isampler2D sampler)\n" + " (declare (in) ivec2 P)\n" + " (declare (in) int lod))\n" + " ())\n" " (signature uvec4\n" " (parameters\n" - " (declare (in ) usampler2D sampler@0x1e6d150)\n" - " (declare (in ) ivec2 P@0x1e6d260)\n" - " (declare (in ) int lod@0x1e6d370)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) usampler2D sampler)\n" + " (declare (in) ivec2 P)\n" + " (declare (in) int lod))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler3D sampler@0x1e6d550)\n" - " (declare (in ) ivec3 P@0x1e6d660)\n" - " (declare (in ) int lod@0x1e6d770)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler3D sampler)\n" + " (declare (in) ivec3 P)\n" + " (declare (in) int lod))\n" + " ())\n" " (signature ivec4\n" " (parameters\n" - " (declare (in ) isampler3D sampler@0x1e6d950)\n" - " (declare (in ) ivec3 P@0x1e6da60)\n" - " (declare (in ) int lod@0x1e6db70)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) isampler3D sampler)\n" + " (declare (in) ivec3 P)\n" + " (declare (in) int lod))\n" + " ())\n" " (signature uvec4\n" " (parameters\n" - " (declare (in ) usampler3D sampler@0x1e6dd50)\n" - " (declare (in ) ivec3 P@0x1e6de60)\n" - " (declare (in ) int lod@0x1e6df70)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) usampler3D sampler)\n" + " (declare (in) ivec3 P)\n" + " (declare (in) int lod))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1DArray sampler@0x1e6e150)\n" - " (declare (in ) ivec2 P@0x1e6e260)\n" - " (declare (in ) int lod@0x1e6e370)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler1DArray sampler)\n" + " (declare (in) ivec2 P)\n" + " (declare (in) int lod))\n" + " ())\n" " (signature ivec4\n" " (parameters\n" - " (declare (in ) isampler1DArray sampler@0x1e6e550)\n" - " (declare (in ) ivec2 P@0x1e6e660)\n" - " (declare (in ) int lod@0x1e6e770)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) isampler1DArray sampler)\n" + " (declare (in) ivec2 P)\n" + " (declare (in) int lod))\n" + " ())\n" " (signature uvec4\n" " (parameters\n" - " (declare (in ) usampler1DArray sampler@0x1e6e950)\n" - " (declare (in ) ivec2 P@0x1e6ea60)\n" - " (declare (in ) int lod@0x1e6eb70)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) usampler1DArray sampler)\n" + " (declare (in) ivec2 P)\n" + " (declare (in) int lod))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2DArray sampler@0x1e6ed50)\n" - " (declare (in ) ivec3 P@0x1e6ee60)\n" - " (declare (in ) int lod@0x1e6ef70)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler2DArray sampler)\n" + " (declare (in) ivec3 P)\n" + " (declare (in) int lod))\n" + " ())\n" " (signature ivec4\n" " (parameters\n" - " (declare (in ) isampler2DArray sampler@0x1e6f150)\n" - " (declare (in ) ivec3 P@0x1e6f260)\n" - " (declare (in ) int lod@0x1e6f370)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) isampler2DArray sampler)\n" + " (declare (in) ivec3 P)\n" + " (declare (in) int lod))\n" + " ())\n" " (signature uvec4\n" " (parameters\n" - " (declare (in ) usampler2DArray sampler@0x1e6f550)\n" - " (declare (in ) ivec3 P@0x1e6f660)\n" - " (declare (in ) int lod@0x1e6f770)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) usampler2DArray sampler)\n" + " (declare (in) ivec3 P)\n" + " (declare (in) int lod))\n" + " ()))\n" "(function textureProjLod\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1D sampler@0x1e6f950)\n" - " (declare (in ) vec2 P@0x1e6fa60)\n" - " (declare (in ) float lod@0x1e6fb70)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) vec2 P)\n" + " (declare (in) float lod))\n" + " ())\n" " (signature ivec4\n" " (parameters\n" - " (declare (in ) isampler1D sampler@0x1e6ff00)\n" - " (declare (in ) vec2 P@0x1e70010)\n" - " (declare (in ) float lod@0x1e70120)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) isampler1D sampler)\n" + " (declare (in) vec2 P)\n" + " (declare (in) float lod))\n" + " ())\n" " (signature uvec4\n" " (parameters\n" - " (declare (in ) usampler1D sampler@0x1e70300)\n" - " (declare (in ) vec2 P@0x1e70410)\n" - " (declare (in ) float lod@0x1e70520)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) usampler1D sampler)\n" + " (declare (in) vec2 P)\n" + " (declare (in) float lod))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1D sampler@0x1e70700)\n" - " (declare (in ) vec4 P@0x1e70810)\n" - " (declare (in ) float lod@0x1e70920)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) float lod))\n" + " ())\n" " (signature ivec4\n" " (parameters\n" - " (declare (in ) isampler1D sampler@0x1e70b00)\n" - " (declare (in ) vec4 P@0x1e70c10)\n" - " (declare (in ) float lod@0x1e70d20)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) isampler1D sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) float lod))\n" + " ())\n" " (signature uvec4\n" " (parameters\n" - " (declare (in ) usampler1D sampler@0x1e70f00)\n" - " (declare (in ) vec4 P@0x1e71010)\n" - " (declare (in ) float lod@0x1e71120)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) usampler1D sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) float lod))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2D sampler@0x1e71300)\n" - " (declare (in ) vec3 P@0x1e71410)\n" - " (declare (in ) float lod@0x1e71520)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float lod))\n" + " ())\n" " (signature ivec4\n" " (parameters\n" - " (declare (in ) isampler2D sampler@0x1e71700)\n" - " (declare (in ) vec3 P@0x1e71810)\n" - " (declare (in ) float lod@0x1e71920)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) isampler2D sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float lod))\n" + " ())\n" " (signature uvec4\n" " (parameters\n" - " (declare (in ) usampler2D sampler@0x1e71b00)\n" - " (declare (in ) vec3 P@0x1e71c10)\n" - " (declare (in ) float lod@0x1e71d20)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) usampler2D sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float lod))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2D sampler@0x1e71f00)\n" - " (declare (in ) vec4 P@0x1e72010)\n" - " (declare (in ) float lod@0x1e72120)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) float lod))\n" + " ())\n" " (signature ivec4\n" " (parameters\n" - " (declare (in ) isampler2D sampler@0x1e72300)\n" - " (declare (in ) vec4 P@0x1e72410)\n" - " (declare (in ) float lod@0x1e72520)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) isampler2D sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) float lod))\n" + " ())\n" " (signature uvec4\n" " (parameters\n" - " (declare (in ) usampler2D sampler@0x1e72700)\n" - " (declare (in ) vec4 P@0x1e72810)\n" - " (declare (in ) float lod@0x1e72920)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) usampler2D sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) float lod))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler3D sampler@0x1e72b00)\n" - " (declare (in ) vec4 P@0x1e72c10)\n" - " (declare (in ) float lod@0x1e72d20)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler3D sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) float lod))\n" + " ())\n" " (signature ivec4\n" " (parameters\n" - " (declare (in ) isampler3D sampler@0x1e72f00)\n" - " (declare (in ) vec4 P@0x1e73010)\n" - " (declare (in ) float lod@0x1e73120)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) isampler3D sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) float lod))\n" + " ())\n" " (signature uvec4\n" " (parameters\n" - " (declare (in ) usampler3D sampler@0x1e73300)\n" - " (declare (in ) vec4 P@0x1e73410)\n" - " (declare (in ) float lod@0x1e73520)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) usampler3D sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) float lod))\n" + " ())\n" " (signature float\n" " (parameters\n" - " (declare (in ) sampler1DShadow sampler@0x1e73700)\n" - " (declare (in ) vec4 P@0x1e73810)\n" - " (declare (in ) float lod@0x1e73920)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler1DShadow sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) float lod))\n" + " ())\n" " (signature float\n" " (parameters\n" - " (declare (in ) sampler2DShadow sampler@0x1e73b00)\n" - " (declare (in ) vec4 P@0x1e73c10)\n" - " (declare (in ) float lod@0x1e73d20)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) sampler2DShadow sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) float lod))\n" + " ()))\n" "(function textureGrad\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1D sampler@0x1e73f00)\n" - " (declare (in ) float P@0x1e74010)\n" - " (declare (in ) float dPdx@0x1e74120)\n" - " (declare (in ) float dPdy@0x1e74230)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) float P)\n" + " (declare (in) float dPdx)\n" + " (declare (in) float dPdy))\n" + " ())\n" " (signature ivec4\n" " (parameters\n" - " (declare (in ) isampler1D sampler@0x1e745c0)\n" - " (declare (in ) float P@0x1e746d0)\n" - " (declare (in ) float dPdx@0x1e747e0)\n" - " (declare (in ) float dPdy@0x1e748f0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) isampler1D sampler)\n" + " (declare (in) float P)\n" + " (declare (in) float dPdx)\n" + " (declare (in) float dPdy))\n" + " ())\n" " (signature uvec4\n" - " (parameters\n" - " (declare (in ) usampler1D sampler@0x1e74ad0)\n" - " (declare (in ) float P@0x1e74be0)\n" - " (declare (in ) float dPdx@0x1e74cf0)\n" - " (declare (in ) float dPdy@0x1e74e00)\n" - " )\n" - " (\n" - " ))\n" - "\n" - " (signature vec4\n" - " (parameters\n" - " (declare (in ) sampler2D sampler@0x1e74fe0)\n" - " (declare (in ) vec2 P@0x1e750f0)\n" - " (declare (in ) vec2 dPdx@0x1e75200)\n" - " (declare (in ) vec2 dPdy@0x1e75310)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (parameters\n" + " (declare (in) usampler1D sampler)\n" + " (declare (in) float P)\n" + " (declare (in) float dPdx)\n" + " (declare (in) float 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" + " ())\n" " (signature ivec4\n" " (parameters\n" - " (declare (in ) isampler2D sampler@0x1e754f0)\n" - " (declare (in ) vec2 P@0x1e75600)\n" - " (declare (in ) vec2 dPdx@0x1e75710)\n" - " (declare (in ) vec2 dPdy@0x1e75820)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) isampler2D sampler)\n" + " (declare (in) vec2 P)\n" + " (declare (in) vec2 dPdx)\n" + " (declare (in) vec2 dPdy))\n" + " ())\n" " (signature uvec4\n" " (parameters\n" - " (declare (in ) usampler2D sampler@0x1e75a00)\n" - " (declare (in ) vec2 P@0x1e75b10)\n" - " (declare (in ) vec2 dPdx@0x1e75c20)\n" - " (declare (in ) vec2 dPdy@0x1e75d30)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) usampler2D sampler)\n" + " (declare (in) vec2 P)\n" + " (declare (in) vec2 dPdx)\n" + " (declare (in) vec2 dPdy))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler3D sampler@0x1e75f10)\n" - " (declare (in ) vec3 P@0x1e76020)\n" - " (declare (in ) vec3 dPdx@0x1e76130)\n" - " (declare (in ) vec3 dPdy@0x1e76240)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler3D sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) vec3 dPdx)\n" + " (declare (in) vec3 dPdy))\n" + " ())\n" " (signature ivec4\n" " (parameters\n" - " (declare (in ) isampler3D sampler@0x1e76420)\n" - " (declare (in ) vec3 P@0x1e76530)\n" - " (declare (in ) vec3 dPdx@0x1e76640)\n" - " (declare (in ) vec3 dPdy@0x1e76750)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) isampler3D sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) vec3 dPdx)\n" + " (declare (in) vec3 dPdy))\n" + " ())\n" " (signature uvec4\n" " (parameters\n" - " (declare (in ) usampler3D sampler@0x1e76930)\n" - " (declare (in ) vec3 P@0x1e76a40)\n" - " (declare (in ) vec3 dPdx@0x1e76b50)\n" - " (declare (in ) vec3 dPdy@0x1e76c60)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) usampler3D sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) vec3 dPdx)\n" + " (declare (in) vec3 dPdy))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) samplerCube sampler@0x1e76e40)\n" - " (declare (in ) vec3 P@0x1e76f50)\n" - " (declare (in ) vec3 dPdx@0x1e77060)\n" - " (declare (in ) vec3 dPdy@0x1e77170)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) samplerCube sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) vec3 dPdx)\n" + " (declare (in) vec3 dPdy))\n" + " ())\n" " (signature ivec4\n" " (parameters\n" - " (declare (in ) isamplerCube sampler@0x1e77350)\n" - " (declare (in ) vec3 P@0x1e77460)\n" - " (declare (in ) vec3 dPdx@0x1e77570)\n" - " (declare (in ) vec3 dPdy@0x1e77680)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) isamplerCube sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) vec3 dPdx)\n" + " (declare (in) vec3 dPdy))\n" + " ())\n" " (signature uvec4\n" " (parameters\n" - " (declare (in ) usamplerCube sampler@0x1e77860)\n" - " (declare (in ) vec3 P@0x1e77970)\n" - " (declare (in ) vec3 dPdx@0x1e77a80)\n" - " (declare (in ) vec3 dPdy@0x1e77b90)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) usamplerCube sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) vec3 dPdx)\n" + " (declare (in) vec3 dPdy))\n" + " ())\n" " (signature float\n" " (parameters\n" - " (declare (in ) sampler1DShadow sampler@0x1e77d70)\n" - " (declare (in ) vec3 P@0x1e77e80)\n" - " (declare (in ) float dPdx@0x1e77f90)\n" - " (declare (in ) float dPdy@0x1e780a0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler1DShadow sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float dPdx)\n" + " (declare (in) float dPdy))\n" + " ())\n" " (signature float\n" " (parameters\n" - " (declare (in ) sampler2DShadow sampler@0x1e78280)\n" - " (declare (in ) vec3 P@0x1e78390)\n" - " (declare (in ) vec2 dPdx@0x1e784a0)\n" - " (declare (in ) vec2 dPdy@0x1e785b0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler2DShadow sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) vec2 dPdx)\n" + " (declare (in) vec2 dPdy))\n" + " ())\n" " (signature float\n" " (parameters\n" - " (declare (in ) samplerCubeShadow sampler@0x1e78790)\n" - " (declare (in ) vec4 P@0x1e788a0)\n" - " (declare (in ) vec3 dPdx@0x1e789b0)\n" - " (declare (in ) vec3 dPdy@0x1e78ac0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) samplerCubeShadow sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) vec3 dPdx)\n" + " (declare (in) vec3 dPdy))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1DArray sampler@0x1e78ca0)\n" - " (declare (in ) vec2 P@0x1e78db0)\n" - " (declare (in ) float dPdx@0x1e78ec0)\n" - " (declare (in ) float dPdy@0x1e78fd0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler1DArray sampler)\n" + " (declare (in) vec2 P)\n" + " (declare (in) float dPdx)\n" + " (declare (in) float dPdy))\n" + " ())\n" " (signature ivec4\n" " (parameters\n" - " (declare (in ) isampler1DArray sampler@0x1e791b0)\n" - " (declare (in ) vec2 P@0x1e792c0)\n" - " (declare (in ) float dPdx@0x1e793d0)\n" - " (declare (in ) float dPdy@0x1e794e0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) isampler1DArray sampler)\n" + " (declare (in) vec2 P)\n" + " (declare (in) float dPdx)\n" + " (declare (in) float dPdy))\n" + " ())\n" " (signature uvec4\n" " (parameters\n" - " (declare (in ) usampler1DArray sampler@0x1e796c0)\n" - " (declare (in ) vec2 P@0x1e797d0)\n" - " (declare (in ) float dPdx@0x1e798e0)\n" - " (declare (in ) float dPdy@0x1e799f0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) usampler1DArray sampler)\n" + " (declare (in) vec2 P)\n" + " (declare (in) float dPdx)\n" + " (declare (in) float dPdy))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2DArray sampler@0x1e79bd0)\n" - " (declare (in ) vec3 P@0x1e79ce0)\n" - " (declare (in ) vec2 dPdx@0x1e79df0)\n" - " (declare (in ) vec2 dPdy@0x1e79f00)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler2DArray sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) vec2 dPdx)\n" + " (declare (in) vec2 dPdy))\n" + " ())\n" " (signature ivec4\n" " (parameters\n" - " (declare (in ) isampler2DArray sampler@0x1e7a0e0)\n" - " (declare (in ) vec3 P@0x1e7a1f0)\n" - " (declare (in ) vec2 dPdx@0x1e7a300)\n" - " (declare (in ) vec2 dPdy@0x1e7a410)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) isampler2DArray sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) vec2 dPdx)\n" + " (declare (in) vec2 dPdy))\n" + " ())\n" " (signature uvec4\n" " (parameters\n" - " (declare (in ) usampler2DArray sampler@0x1e7a5f0)\n" - " (declare (in ) vec3 P@0x1e7a700)\n" - " (declare (in ) vec2 dPdx@0x1e7a810)\n" - " (declare (in ) vec2 dPdy@0x1e7a920)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) usampler2DArray sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) vec2 dPdx)\n" + " (declare (in) vec2 dPdy))\n" + " ())\n" " (signature float\n" " (parameters\n" - " (declare (in ) sampler1DArrayShadow sampler@0x1e7ab00)\n" - " (declare (in ) vec3 P@0x1e7ac10)\n" - " (declare (in ) float dPdx@0x1e7ad20)\n" - " (declare (in ) float dPdy@0x1e7ae30)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler1DArrayShadow sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float dPdx)\n" + " (declare (in) float dPdy))\n" + " ())\n" " (signature float\n" " (parameters\n" - " (declare (in ) sampler2DArrayShadow sampler@0x1e7b010)\n" - " (declare (in ) vec4 P@0x1e7b120)\n" - " (declare (in ) vec2 dPdx@0x1e7b230)\n" - " (declare (in ) vec2 dPdy@0x1e7b340)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) sampler2DArrayShadow sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) vec2 dPdx)\n" + " (declare (in) vec2 dPdy))\n" + " ()))\n" "(function textureProjGrad\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1D sampler@0x1e7b520)\n" - " (declare (in ) vec2 P@0x1e7b630)\n" - " (declare (in ) float dPdx@0x1e7b740)\n" - " (declare (in ) float dPdy@0x1e7b850)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) vec2 P)\n" + " (declare (in) float dPdx)\n" + " (declare (in) float dPdy))\n" + " ())\n" " (signature ivec4\n" " (parameters\n" - " (declare (in ) isampler1D sampler@0x1e7bbe0)\n" - " (declare (in ) vec2 P@0x1e7bcf0)\n" - " (declare (in ) float dPdx@0x1e7be00)\n" - " (declare (in ) float dPdy@0x1e7bf10)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) isampler1D sampler)\n" + " (declare (in) vec2 P)\n" + " (declare (in) float dPdx)\n" + " (declare (in) float dPdy))\n" + " ())\n" " (signature uvec4\n" " (parameters\n" - " (declare (in ) usampler1D sampler@0x1e7c0f0)\n" - " (declare (in ) vec2 P@0x1e7c200)\n" - " (declare (in ) float dPdx@0x1e7c310)\n" - " (declare (in ) float dPdy@0x1e7c420)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) usampler1D sampler)\n" + " (declare (in) vec2 P)\n" + " (declare (in) float dPdx)\n" + " (declare (in) float dPdy))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1D sampler@0x1e7c600)\n" - " (declare (in ) vec4 P@0x1e7c710)\n" - " (declare (in ) float dPdx@0x1e7c820)\n" - " (declare (in ) float dPdy@0x1e7c930)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) float dPdx)\n" + " (declare (in) float dPdy))\n" + " ())\n" " (signature ivec4\n" " (parameters\n" - " (declare (in ) isampler1D sampler@0x1e7cb10)\n" - " (declare (in ) vec4 P@0x1e7cc20)\n" - " (declare (in ) float dPdx@0x1e7cd30)\n" - " (declare (in ) float dPdy@0x1e7ce40)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) isampler1D sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) float dPdx)\n" + " (declare (in) float dPdy))\n" + " ())\n" " (signature uvec4\n" " (parameters\n" - " (declare (in ) usampler1D sampler@0x1e7d020)\n" - " (declare (in ) vec4 P@0x1e7d130)\n" - " (declare (in ) float dPdx@0x1e7d240)\n" - " (declare (in ) float dPdy@0x1e7d350)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) usampler1D sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) float dPdx)\n" + " (declare (in) float dPdy))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2D sampler@0x1e7d530)\n" - " (declare (in ) vec3 P@0x1e7d640)\n" - " (declare (in ) vec2 dPdx@0x1e7d750)\n" - " (declare (in ) vec2 dPdy@0x1e7d860)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) vec2 dPdx)\n" + " (declare (in) vec2 dPdy))\n" + " ())\n" " (signature ivec4\n" " (parameters\n" - " (declare (in ) isampler2D sampler@0x1e7da40)\n" - " (declare (in ) vec3 P@0x1e7db50)\n" - " (declare (in ) vec2 dPdx@0x1e7dc60)\n" - " (declare (in ) vec2 dPdy@0x1e7dd70)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) isampler2D sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) vec2 dPdx)\n" + " (declare (in) vec2 dPdy))\n" + " ())\n" " (signature uvec4\n" " (parameters\n" - " (declare (in ) usampler2D sampler@0x1e7df50)\n" - " (declare (in ) vec3 P@0x1e7e060)\n" - " (declare (in ) vec2 dPdx@0x1e7e170)\n" - " (declare (in ) vec2 dPdy@0x1e7e280)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) usampler2D sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) vec2 dPdx)\n" + " (declare (in) vec2 dPdy))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2D sampler@0x1e7e460)\n" - " (declare (in ) vec4 P@0x1e7e570)\n" - " (declare (in ) vec2 dPdx@0x1e7e680)\n" - " (declare (in ) vec2 dPdy@0x1e7e790)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) vec2 dPdx)\n" + " (declare (in) vec2 dPdy))\n" + " ())\n" " (signature ivec4\n" " (parameters\n" - " (declare (in ) isampler2D sampler@0x1e7e970)\n" - " (declare (in ) vec4 P@0x1e7ea80)\n" - " (declare (in ) vec2 dPdx@0x1e7eb90)\n" - " (declare (in ) vec2 dPdy@0x1e7eca0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) isampler2D sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) vec2 dPdx)\n" + " (declare (in) vec2 dPdy))\n" + " ())\n" " (signature uvec4\n" " (parameters\n" - " (declare (in ) usampler2D sampler@0x1e7ee80)\n" - " (declare (in ) vec4 P@0x1e7ef90)\n" - " (declare (in ) vec2 dPdx@0x1e7f0a0)\n" - " (declare (in ) vec2 dPdy@0x1e7f1b0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) usampler2D sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) vec2 dPdx)\n" + " (declare (in) vec2 dPdy))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler3D sampler@0x1e7f390)\n" - " (declare (in ) vec4 P@0x1e7f4a0)\n" - " (declare (in ) vec3 dPdx@0x1e7f5b0)\n" - " (declare (in ) vec3 dPdy@0x1e7f6c0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler3D sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) vec3 dPdx)\n" + " (declare (in) vec3 dPdy))\n" + " ())\n" " (signature ivec4\n" " (parameters\n" - " (declare (in ) isampler3D sampler@0x1e7f8a0)\n" - " (declare (in ) vec4 P@0x1e7f9b0)\n" - " (declare (in ) vec3 dPdx@0x1e7fac0)\n" - " (declare (in ) vec3 dPdy@0x1e7fbd0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) isampler3D sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) vec3 dPdx)\n" + " (declare (in) vec3 dPdy))\n" + " ())\n" " (signature uvec4\n" " (parameters\n" - " (declare (in ) usampler3D sampler@0x1e7fdb0)\n" - " (declare (in ) vec4 P@0x1e7fec0)\n" - " (declare (in ) vec3 dPdx@0x1e7ffd0)\n" - " (declare (in ) vec3 dPdy@0x1e800e0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) usampler3D sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) vec3 dPdx)\n" + " (declare (in) vec3 dPdy))\n" + " ())\n" " (signature float\n" " (parameters\n" - " (declare (in ) sampler1DShadow sampler@0x1e802c0)\n" - " (declare (in ) vec4 P@0x1e803d0)\n" - " (declare (in ) float dPdx@0x1e804e0)\n" - " (declare (in ) float dPdy@0x1e805f0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler1DShadow sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) float dPdx)\n" + " (declare (in) float dPdy))\n" + " ())\n" " (signature float\n" " (parameters\n" - " (declare (in ) sampler2DShadow sampler@0x1e807d0)\n" - " (declare (in ) vec4 P@0x1e808e0)\n" - " (declare (in ) vec2 dPdx@0x1e809f0)\n" - " (declare (in ) vec2 dPdy@0x1e80b00)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) sampler2DShadow sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) vec2 dPdx)\n" + " (declare (in) vec2 dPdy))\n" + " ()))\n" "(function texture1D\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1D sampler@0x1e80ce0)\n" - " (declare (in ) float coord@0x1e80df0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) float coord))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1D sampler@0x1e81910)\n" - " (declare (in ) float coord@0x1e81a20)\n" - " (declare (in ) float bias@0x1e81b30)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) float coord)\n" + " (declare (in) float bias))\n" + " ()))\n" "(function texture1DProj\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1D sampler@0x1e81180)\n" - " (declare (in ) vec2 coord@0x1e81290)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) vec2 coord))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1D sampler@0x1e81620)\n" - " (declare (in ) vec4 coord@0x1e81730)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) vec4 coord))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1D sampler@0x1e81d10)\n" - " (declare (in ) vec2 coord@0x1e81e20)\n" - " (declare (in ) float bias@0x1e81f30)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) vec2 coord)\n" + " (declare (in) float bias))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1D sampler@0x1e82110)\n" - " (declare (in ) vec4 coord@0x1e82220)\n" - " (declare (in ) float bias@0x1e82330)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) vec4 coord)\n" + " (declare (in) float bias))\n" + " ()))\n" "(function texture1DLod\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1D sampler@0x1e82510)\n" - " (declare (in ) float coord@0x1e82620)\n" - " (declare (in ) float lod@0x1e82730)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) float coord)\n" + " (declare (in) float lod))\n" + " ()))\n" "(function texture1DProjLod\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1D sampler@0x1e82ac0)\n" - " (declare (in ) vec2 coord@0x1e82bd0)\n" - " (declare (in ) float lod@0x1e82ce0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) vec2 coord)\n" + " (declare (in) float lod))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1D sampler@0x1e83070)\n" - " (declare (in ) vec4 coord@0x1e83180)\n" - " (declare (in ) float lod@0x1e83290)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) vec4 coord)\n" + " (declare (in) float lod))\n" + " ()))\n" "(function texture2D\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2D sampler@0x1e83470)\n" - " (declare (in ) vec2 coord@0x1e83580)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec2 coord))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2D sampler@0x1e840a0)\n" - " (declare (in ) vec2 coord@0x1e841b0)\n" - " (declare (in ) float bias@0x1e842c0)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec2 coord)\n" + " (declare (in) float bias))\n" + " ()))\n" "(function texture2DProj\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2D sampler@0x1e83910)\n" - " (declare (in ) vec3 coord@0x1e83a20)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec3 coord))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2D sampler@0x1e83db0)\n" - " (declare (in ) vec4 coord@0x1e83ec0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec4 coord))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2D sampler@0x1e844a0)\n" - " (declare (in ) vec3 coord@0x1e845b0)\n" - " (declare (in ) float bias@0x1e846c0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec3 coord)\n" + " (declare (in) float bias))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2D sampler@0x1e848a0)\n" - " (declare (in ) vec4 coord@0x1e849b0)\n" - " (declare (in ) float bias@0x1e84ac0)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec4 coord)\n" + " (declare (in) float bias))\n" + " ()))\n" "(function texture2DLod\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2D sampler@0x1e84ca0)\n" - " (declare (in ) vec2 coord@0x1e84db0)\n" - " (declare (in ) float lod@0x1e84ec0)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec2 coord)\n" + " (declare (in) float lod))\n" + " ()))\n" "(function texture2DProjLod\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2D sampler@0x1e85250)\n" - " (declare (in ) vec3 coord@0x1e85360)\n" - " (declare (in ) float lod@0x1e85470)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec3 coord)\n" + " (declare (in) float lod))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2D sampler@0x1e85800)\n" - " (declare (in ) vec4 coord@0x1e85910)\n" - " (declare (in ) float lod@0x1e85a20)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec4 coord)\n" + " (declare (in) float lod))\n" + " ()))\n" "(function texture3D\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler3D sampler@0x1e85c00)\n" - " (declare (in ) vec3 coord@0x1e85d10)\n" - " )\n" - " (\n" - " ))\n" - "\n" - " (signature vec4\n" - " (parameters\n" - " (declare (in ) sampler3D sampler@0x1e86540)\n" - " (declare (in ) vec3 coord@0x1e86650)\n" - " (declare (in ) float bias@0x1e86760)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" - "(function texture3DProj\n" + " (declare (in) sampler3D sampler)\n" + " (declare (in) vec3 coord))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler3D sampler@0x1e860a0)\n" - " (declare (in ) vec4 coord@0x1e861b0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler3D sampler)\n" + " (declare (in) vec3 coord)\n" + " (declare (in) float bias))\n" + " ()))\n" + "(function texture3DProj\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler3D sampler@0x1e86940)\n" - " (declare (in ) vec4 coord@0x1e86a50)\n" - " (declare (in ) float bias@0x1e86b60)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) sampler3D sampler)\n" + " (declare (in) vec4 coord))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler3D sampler)\n" + " (declare (in) vec4 coord)\n" + " (declare (in) float bias))\n" + " ()))\n" "(function texture3DLod\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler3D sampler@0x1e86d40)\n" - " (declare (in ) vec3 coord@0x1e86e50)\n" - " (declare (in ) float lod@0x1e86f60)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) sampler3D sampler)\n" + " (declare (in) vec3 coord)\n" + " (declare (in) float lod))\n" + " ()))\n" "(function texture3DProjLod\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler3D sampler@0x1e872f0)\n" - " (declare (in ) vec4 coord@0x1e87400)\n" - " (declare (in ) float lod@0x1e87510)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) sampler3D sampler)\n" + " (declare (in) vec4 coord)\n" + " (declare (in) float lod))\n" + " ()))\n" "(function textureCube\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) samplerCube sampler@0x1e878a0)\n" - " (declare (in ) vec3 coord@0x1e879b0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) samplerCube sampler)\n" + " (declare (in) vec3 coord))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) samplerCube sampler@0x1e87d40)\n" - " (declare (in ) vec3 coord@0x1e87e50)\n" - " (declare (in ) float bias@0x1e87f60)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) samplerCube sampler)\n" + " (declare (in) vec3 coord)\n" + " (declare (in) float bias))\n" + " ()))\n" "(function textureCubeLod\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) samplerCube sampler@0x1e88140)\n" - " (declare (in ) vec3 coord@0x1e88250)\n" - " (declare (in ) float lod@0x1e88360)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) samplerCube sampler)\n" + " (declare (in) vec3 coord)\n" + " (declare (in) float lod))\n" + " ()))\n" "(function shadow1D\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1DShadow sampler@0x1e886f0)\n" - " (declare (in ) vec3 coord@0x1e88800)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler1DShadow sampler)\n" + " (declare (in) vec3 coord))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1DShadow sampler@0x1e89970)\n" - " (declare (in ) vec3 coord@0x1e89a80)\n" - " (declare (in ) float bias@0x1e89b90)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) sampler1DShadow sampler)\n" + " (declare (in) vec3 coord)\n" + " (declare (in) float bias))\n" + " ()))\n" "(function shadow2D\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2DShadow sampler@0x1e88b90)\n" - " (declare (in ) vec3 coord@0x1e88ca0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler2DShadow sampler)\n" + " (declare (in) vec3 coord))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2DShadow sampler@0x1e89d70)\n" - " (declare (in ) vec3 coord@0x1e89e80)\n" - " (declare (in ) float bias@0x1e89f90)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) sampler2DShadow sampler)\n" + " (declare (in) vec3 coord)\n" + " (declare (in) float bias))\n" + " ()))\n" "(function shadow1DProj\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1DShadow sampler@0x1e89030)\n" - " (declare (in ) vec4 coord@0x1e89140)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler1DShadow sampler)\n" + " (declare (in) vec4 coord))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1DShadow sampler@0x1e8a170)\n" - " (declare (in ) vec4 coord@0x1e8a280)\n" - " (declare (in ) float bias@0x1e8a390)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) sampler1DShadow sampler)\n" + " (declare (in) vec4 coord)\n" + " (declare (in) float bias))\n" + " ()))\n" "(function shadow2DProj\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2DShadow sampler@0x1e894d0)\n" - " (declare (in ) vec4 coord@0x1e895e0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler2DShadow sampler)\n" + " (declare (in) vec4 coord))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2DShadow sampler@0x1e8a570)\n" - " (declare (in ) vec4 coord@0x1e8a680)\n" - " (declare (in ) float bias@0x1e8a790)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) sampler2DShadow sampler)\n" + " (declare (in) vec4 coord)\n" + " (declare (in) float bias))\n" + " ()))\n" "(function shadow1DLod\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1DShadow sampler@0x1e8a970)\n" - " (declare (in ) vec3 coord@0x1e8aa80)\n" - " (declare (in ) float lod@0x1e8ab90)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) sampler1DShadow sampler)\n" + " (declare (in) vec3 coord)\n" + " (declare (in) float lod))\n" + " ()))\n" "(function shadow2DLod\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2DShadow sampler@0x1e8af20)\n" - " (declare (in ) vec3 coord@0x1e8b030)\n" - " (declare (in ) float lod@0x1e8b140)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) sampler2DShadow sampler)\n" + " (declare (in) vec3 coord)\n" + " (declare (in) float lod))\n" + " ()))\n" "(function shadow1DProjLod\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1DShadow sampler@0x1e8b4d0)\n" - " (declare (in ) vec4 coord@0x1e8b5e0)\n" - " (declare (in ) float lod@0x1e8b6f0)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) sampler1DShadow sampler)\n" + " (declare (in) vec4 coord)\n" + " (declare (in) float lod))\n" + " ()))\n" "(function shadow2DProjLod\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2DShadow sampler@0x1e8ba80)\n" - " (declare (in ) vec4 coord@0x1e8bb90)\n" - " (declare (in ) float lod@0x1e8bca0)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) sampler2DShadow sampler)\n" + " (declare (in) vec4 coord)\n" + " (declare (in) float lod))\n" + " ()))\n" "(function noise1\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x1e8c030)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float x))\n" + " ())\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec2 x@0x1e8c3b0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x))\n" + " ())\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec3 x@0x1e8c590)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x))\n" + " ())\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec4 x@0x1e8c770)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 x))\n" + " ()))\n" "(function noise2\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) float x@0x1e8c950)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float x))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x1e8ccd0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec3 x@0x1e8ceb0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec4 x@0x1e8d090)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 x))\n" + " ()))\n" "(function noise3\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) float x@0x1e8d270)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float x))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec2 x@0x1e8d5f0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x1e8d7d0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec4 x@0x1e8d9b0)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 x))\n" + " ()))\n" "(function noise4\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) float x@0x1e8db90)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float x))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec2 x@0x1e8df10)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec3 x@0x1e8e0f0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x1e8e2d0)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" - "\n" - ")" + " (declare (in) vec4 x))\n" + " ())))" ; static const char *functions_for_130_vert [] = { builtin_clamp, + builtin_shadow2DLod, builtin_matrixCompMult, builtin_textureProj, builtin_noise2, @@ -21555,7 +15127,7 @@ static const char *functions_for_130_vert [] = { builtin_pow, builtin_texture2DProj, builtin_greaterThanEqual, - builtin_sign, + builtin_cosh, builtin_texture3DProj, builtin_textureProjLod, builtin_texture, @@ -21585,7 +15157,8 @@ static const char *functions_for_130_vert [] = { builtin_ftransform, builtin_sin, builtin_shadow2D, - builtin_shadow2DLod, + builtin_noise3, + builtin_texture2DProjLod, builtin_all, builtin_log2, builtin_textureGrad, @@ -21602,9 +15175,10 @@ static const char *functions_for_130_vert [] = { builtin_texture1D, builtin_greaterThan, builtin_texture3D, + builtin_sinh, builtin_shadow2DProjLod, builtin_not, - builtin_texture2DProjLod, + builtin_sign, builtin_inversesqrt, builtin_mod, builtin_noise4, @@ -21613,7 +15187,7 @@ static const char *functions_for_130_vert [] = { builtin_shadow1D, builtin_noise1, builtin_refract, - builtin_noise3, + builtin_tanh, builtin_texelFetch, builtin_min, builtin_radians, @@ -21634,57 +15208,32 @@ static const char *prototypes_for_ARB_texture_rectangle_frag = "(function texture2DRect\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2DRect sampler@0xd610f0)\n" - " (declare (in ) vec2 coord@0xd61200)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) sampler2DRect sampler)\n" + " (declare (in) vec2 coord))\n" + " ()))\n" "(function texture2DRectProj\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2DRect sampler@0xd61590)\n" - " (declare (in ) vec3 coord@0xd616a0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler2DRect sampler)\n" + " (declare (in) vec3 coord))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2DRect sampler@0xd61a30)\n" - " (declare (in ) vec4 coord@0xd61b40)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) sampler2DRect sampler)\n" + " (declare (in) vec4 coord))\n" + " ()))\n" "(function shadow2DRect\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2DRectShadow sampler@0xd61d20)\n" - " (declare (in ) vec3 coord@0xd61e30)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) sampler2DRectShadow sampler)\n" + " (declare (in) vec3 coord))\n" + " ()))\n" "(function shadow2DRectProj\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2DRectShadow sampler@0xd621c0)\n" - " (declare (in ) vec4 coord@0xd622d0)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" - "\n" - ")" + " (declare (in) sampler2DRectShadow sampler)\n" + " (declare (in) vec4 coord))\n" + " ())))" ; static const char *functions_for_ARB_texture_rectangle_frag [] = { builtin_texture2DRect, @@ -21697,2464 +15246,1450 @@ static const char *prototypes_for_120_frag = "(function radians\n" " (signature float\n" " (parameters\n" - " (declare (in ) float degrees@0x20d2340)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float degrees))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 degrees@0x20d26c0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 degrees))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 degrees@0x20d28a0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 degrees))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 degrees@0x20d2a80)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 degrees))\n" + " ()))\n" "(function degrees\n" " (signature float\n" " (parameters\n" - " (declare (in ) float radians@0x20d2c60)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float radians))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 radians@0x20d2fe0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 radians))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 radians@0x20d31c0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 radians))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 radians@0x20d33a0)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 radians))\n" + " ()))\n" "(function sin\n" " (signature float\n" " (parameters\n" - " (declare (in ) float angle@0x20d3580)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float angle))\n" + " ())\n" " (signature vec2\n" - " (parameters\n" - " (declare (in ) vec2 angle@0x20d3900)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (parameters\n" + " (declare (in) vec2 angle))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 angle@0x20d3ae0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 angle))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 angle@0x20d3cc0)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 angle))\n" + " ()))\n" "(function cos\n" " (signature float\n" " (parameters\n" - " (declare (in ) float angle@0x20d3ea0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float angle))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 angle@0x20d4220)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 angle))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 angle@0x20d4400)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 angle))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 angle@0x20d45e0)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 angle))\n" + " ()))\n" "(function tan\n" " (signature float\n" " (parameters\n" - " (declare (in ) float angle@0x20d47c0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float angle))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 angle@0x20d4b40)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 angle))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 angle@0x20d4d20)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 angle))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 angle@0x20d4f00)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 angle))\n" + " ()))\n" "(function asin\n" " (signature float\n" " (parameters\n" - " (declare (in ) float angle@0x20d50e0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float angle))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 angle@0x20d5460)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 angle))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 angle@0x20d5640)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 angle))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 angle@0x20d5820)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 angle))\n" + " ()))\n" "(function acos\n" " (signature float\n" " (parameters\n" - " (declare (in ) float angle@0x20d5a00)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float angle))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 angle@0x20d5d80)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 angle))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 angle@0x20d5f60)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 angle))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 angle@0x20d6140)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 angle))\n" + " ()))\n" "(function atan\n" " (signature float\n" " (parameters\n" - " (declare (in ) float y@0x20d6320)\n" - " (declare (in ) float x@0x20d6430)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float y)\n" + " (declare (in) float x))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 y@0x20d67b0)\n" - " (declare (in ) vec2 x@0x20d68c0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 y)\n" + " (declare (in) vec2 x))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 y@0x20d6aa0)\n" - " (declare (in ) vec3 x@0x20d6bb0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 y)\n" + " (declare (in) vec3 x))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 y@0x20d6d90)\n" - " (declare (in ) vec4 x@0x20d6ea0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec4 y)\n" + " (declare (in) vec4 x))\n" + " ())\n" " (signature float\n" " (parameters\n" - " (declare (in ) float y_over_x@0x20d7080)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float y_over_x))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 y_over_x@0x20d7270)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 y_over_x))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 y_over_x@0x20d7460)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 y_over_x))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 y_over_x@0x20d7650)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 y_over_x))\n" + " ()))\n" "(function pow\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x20d7840)\n" - " (declare (in ) float y@0x20d7950)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float x)\n" + " (declare (in) float y))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x20d7cd0)\n" - " (declare (in ) vec2 y@0x20d7de0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x20d7fc0)\n" - " (declare (in ) vec3 y@0x20d80d0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x20d82b0)\n" - " (declare (in ) vec4 y@0x20d83c0)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" + " ()))\n" "(function exp\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x20d85a0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float x))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x20d8920)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x20d8b00)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x20d8ce0)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 x))\n" + " ()))\n" "(function log\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x20d8ec0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float x))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x20d9240)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x20d9420)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x20d9600)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 x))\n" + " ()))\n" "(function exp2\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x20d97e0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float x))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x20d9b60)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x20d9d40)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x20d9f20)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 x))\n" + " ()))\n" "(function log2\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x20da100)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float x))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x20da480)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x20da660)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x20da840)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 x))\n" + " ()))\n" "(function sqrt\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x20daa20)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float x))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x20dada0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x20daf80)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x20db160)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 x))\n" + " ()))\n" "(function inversesqrt\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x20db340)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float x))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x20db6d0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x20db8b0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x20dba90)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 x))\n" + " ()))\n" "(function abs\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x20dbc70)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float x))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x20dbff0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x))\n" + " ())\n" " (signature vec3\n" - " (parameters\n" - " (declare (in ) vec3 x@0x20dc1d0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (parameters\n" + " (declare (in) vec3 x))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x20dc3b0)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 x))\n" + " ()))\n" "(function sign\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x20dc590)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float x))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x20dc910)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x20dcaf0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x20dccd0)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 x))\n" + " ()))\n" "(function floor\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x20dceb0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float x))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x20dd230)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x20dd410)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x20dd5f0)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 x))\n" + " ()))\n" "(function ceil\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x20dd7d0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float x))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x20ddb50)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x20ddd30)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x20ddf10)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 x))\n" + " ()))\n" "(function fract\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x20de0f0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float x))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x20de470)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x20de650)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x20de830)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 x))\n" + " ()))\n" "(function mod\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x20dea10)\n" - " (declare (in ) float y@0x20deb20)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float x)\n" + " (declare (in) float y))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x20deea0)\n" - " (declare (in ) float y@0x20defb0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x)\n" + " (declare (in) float y))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x20df190)\n" - " (declare (in ) float y@0x20df2a0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x)\n" + " (declare (in) float y))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x20df480)\n" - " (declare (in ) float y@0x20df590)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec4 x)\n" + " (declare (in) float y))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x20df770)\n" - " (declare (in ) vec2 y@0x20df880)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x20dfa60)\n" - " (declare (in ) vec3 y@0x20dfb70)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x20dfd50)\n" - " (declare (in ) vec4 y@0x20dfe60)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" + " ()))\n" "(function min\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x20e0040)\n" - " (declare (in ) float y@0x20e0150)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float x)\n" + " (declare (in) float y))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x20e04d0)\n" - " (declare (in ) vec2 y@0x20e05e0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x20e07c0)\n" - " (declare (in ) vec3 y@0x20e08d0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x20e0ab0)\n" - " (declare (in ) vec4 y@0x20e0bc0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x20e0da0)\n" - " (declare (in ) float y@0x20e0eb0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x)\n" + " (declare (in) float y))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x20e1090)\n" - " (declare (in ) float y@0x20e11a0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x)\n" + " (declare (in) float y))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x20e1380)\n" - " (declare (in ) float y@0x20e1490)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 x)\n" + " (declare (in) float y))\n" + " ()))\n" "(function max\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x20e1670)\n" - " (declare (in ) float y@0x20e1780)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float x)\n" + " (declare (in) float y))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x20e1b00)\n" - " (declare (in ) vec2 y@0x20e1c10)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x20e1df0)\n" - " (declare (in ) vec3 y@0x20e1f00)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x20e20e0)\n" - " (declare (in ) vec4 y@0x20e21f0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x20e23d0)\n" - " (declare (in ) float y@0x20e24e0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x)\n" + " (declare (in) float y))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x20e26c0)\n" - " (declare (in ) float y@0x20e27d0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x)\n" + " (declare (in) float y))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x20e29b0)\n" - " (declare (in ) float y@0x20e2ac0)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 x)\n" + " (declare (in) float y))\n" + " ()))\n" "(function clamp\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x20e2ca0)\n" - " (declare (in ) float minVal@0x20e2db0)\n" - " (declare (in ) float maxVal@0x20e2ec0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float x)\n" + " (declare (in) float minVal)\n" + " (declare (in) float maxVal))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x20e3240)\n" - " (declare (in ) vec2 minVal@0x20e3350)\n" - " (declare (in ) vec2 maxVal@0x20e3460)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 minVal)\n" + " (declare (in) vec2 maxVal))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x20e3640)\n" - " (declare (in ) vec3 minVal@0x20e3750)\n" - " (declare (in ) vec3 maxVal@0x20e3860)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 minVal)\n" + " (declare (in) vec3 maxVal))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x20e3a40)\n" - " (declare (in ) vec4 minVal@0x20e3b50)\n" - " (declare (in ) vec4 maxVal@0x20e3c60)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 minVal)\n" + " (declare (in) vec4 maxVal))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x20e3e40)\n" - " (declare (in ) float minVal@0x20e3f50)\n" - " (declare (in ) float maxVal@0x20e4060)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x)\n" + " (declare (in) float minVal)\n" + " (declare (in) float maxVal))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x20e4240)\n" - " (declare (in ) float minVal@0x20e4350)\n" - " (declare (in ) float maxVal@0x20e4460)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x)\n" + " (declare (in) float minVal)\n" + " (declare (in) float maxVal))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x20e4640)\n" - " (declare (in ) float minVal@0x20e4750)\n" - " (declare (in ) float maxVal@0x20e4860)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 x)\n" + " (declare (in) float minVal)\n" + " (declare (in) float maxVal))\n" + " ()))\n" "(function mix\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x20e4a40)\n" - " (declare (in ) float y@0x20e4b50)\n" - " (declare (in ) float a@0x20e4c60)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float x)\n" + " (declare (in) float y)\n" + " (declare (in) float a))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x20e4fe0)\n" - " (declare (in ) vec2 y@0x20e50f0)\n" - " (declare (in ) vec2 a@0x20e5200)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y)\n" + " (declare (in) vec2 a))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x20e53e0)\n" - " (declare (in ) vec3 y@0x20e54f0)\n" - " (declare (in ) vec3 a@0x20e5600)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y)\n" + " (declare (in) vec3 a))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x20e57e0)\n" - " (declare (in ) vec4 y@0x20e58f0)\n" - " (declare (in ) vec4 a@0x20e5a00)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y)\n" + " (declare (in) vec4 a))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x20e5be0)\n" - " (declare (in ) vec2 y@0x20e5cf0)\n" - " (declare (in ) float a@0x20e5e00)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y)\n" + " (declare (in) float a))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x20e5fe0)\n" - " (declare (in ) vec3 y@0x20e60f0)\n" - " (declare (in ) float a@0x20e6200)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y)\n" + " (declare (in) float a))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x20e63e0)\n" - " (declare (in ) vec4 y@0x20e64f0)\n" - " (declare (in ) float a@0x20e6600)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y)\n" + " (declare (in) float a))\n" + " ()))\n" "(function step\n" " (signature float\n" " (parameters\n" - " (declare (in ) float edge@0x20e67e0)\n" - " (declare (in ) float x@0x20e68f0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float edge)\n" + " (declare (in) float x))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 edge@0x20e6c70)\n" - " (declare (in ) vec2 x@0x20e6d80)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 edge)\n" + " (declare (in) vec2 x))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 edge@0x20e6f60)\n" - " (declare (in ) vec3 x@0x20e7070)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 edge)\n" + " (declare (in) vec3 x))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 edge@0x20e7250)\n" - " (declare (in ) vec4 x@0x20e7360)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec4 edge)\n" + " (declare (in) vec4 x))\n" + " ())\n" " (signature vec2\n" - " (parameters\n" - " (declare (in ) float edge@0x20e7540)\n" - " (declare (in ) vec2 x@0x20e7650)\n" - " )\n" - " (\n" - " ))\n" - "\n" - " (signature vec3\n" - " (parameters\n" - " (declare (in ) float edge@0x20e7830)\n" - " (declare (in ) vec3 x@0x20e7940)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (parameters\n" + " (declare (in) float edge)\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) float edge)\n" + " (declare (in) vec3 x))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) float edge@0x20e7b20)\n" - " (declare (in ) vec4 x@0x20e7c30)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) float edge)\n" + " (declare (in) vec4 x))\n" + " ()))\n" "(function smoothstep\n" " (signature float\n" " (parameters\n" - " (declare (in ) float edge0@0x20e7e10)\n" - " (declare (in ) float edge1@0x20e7f20)\n" - " (declare (in ) float x@0x20e8030)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float edge0)\n" + " (declare (in) float edge1)\n" + " (declare (in) float x))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 edge0@0x20e83c0)\n" - " (declare (in ) vec2 edge1@0x20e84d0)\n" - " (declare (in ) vec2 x@0x20e85e0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 edge0)\n" + " (declare (in) vec2 edge1)\n" + " (declare (in) vec2 x))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 edge0@0x20e87c0)\n" - " (declare (in ) vec3 edge1@0x20e88d0)\n" - " (declare (in ) vec3 x@0x20e89e0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 edge0)\n" + " (declare (in) vec3 edge1)\n" + " (declare (in) vec3 x))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 edge0@0x20e8bc0)\n" - " (declare (in ) vec4 edge1@0x20e8cd0)\n" - " (declare (in ) vec4 x@0x20e8de0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec4 edge0)\n" + " (declare (in) vec4 edge1)\n" + " (declare (in) vec4 x))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) float edge0@0x20e8fc0)\n" - " (declare (in ) float edge1@0x20e90d0)\n" - " (declare (in ) vec2 x@0x20e91e0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float edge0)\n" + " (declare (in) float edge1)\n" + " (declare (in) vec2 x))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) float edge0@0x20e93c0)\n" - " (declare (in ) float edge1@0x20e94d0)\n" - " (declare (in ) vec3 x@0x20e95e0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float edge0)\n" + " (declare (in) float edge1)\n" + " (declare (in) vec3 x))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) float edge0@0x20e97c0)\n" - " (declare (in ) float edge1@0x20e98d0)\n" - " (declare (in ) vec4 x@0x20e99e0)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) float edge0)\n" + " (declare (in) float edge1)\n" + " (declare (in) vec4 x))\n" + " ()))\n" "(function length\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x20e9bc0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float x))\n" + " ())\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec2 x@0x20e9f40)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x))\n" + " ())\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec3 x@0x20ea120)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x))\n" + " ())\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec4 x@0x20ea300)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 x))\n" + " ()))\n" "(function distance\n" " (signature float\n" " (parameters\n" - " (declare (in ) float p0@0x20ea4e0)\n" - " (declare (in ) float p1@0x20ea5f0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float p0)\n" + " (declare (in) float p1))\n" + " ())\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec2 p0@0x20ea980)\n" - " (declare (in ) vec2 p1@0x20eaa90)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 p0)\n" + " (declare (in) vec2 p1))\n" + " ())\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec3 p0@0x20eac70)\n" - " (declare (in ) vec3 p1@0x20ead80)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 p0)\n" + " (declare (in) vec3 p1))\n" + " ())\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec4 p0@0x20eaf60)\n" - " (declare (in ) vec4 p1@0x20eb070)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 p0)\n" + " (declare (in) vec4 p1))\n" + " ()))\n" "(function dot\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x20eb250)\n" - " (declare (in ) float y@0x20eb360)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float x)\n" + " (declare (in) float y))\n" + " ())\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec2 x@0x20eb6e0)\n" - " (declare (in ) vec2 y@0x20eb7f0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" + " ())\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec3 x@0x20eb9d0)\n" - " (declare (in ) vec3 y@0x20ebae0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ())\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec4 x@0x20ebcc0)\n" - " (declare (in ) vec4 y@0x20ebdd0)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" + " ()))\n" "(function cross\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x20ebfb0)\n" - " (declare (in ) vec3 y@0x20ec0c0)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ()))\n" "(function normalize\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x20ec440)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float x))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x20ec7d0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x20ec9b0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x20ecb90)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 x))\n" + " ()))\n" "(function faceforward\n" " (signature float\n" " (parameters\n" - " (declare (in ) float N@0x20ecd70)\n" - " (declare (in ) float I@0x20ece80)\n" - " (declare (in ) float Nref@0x20ecf90)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float N)\n" + " (declare (in) float I)\n" + " (declare (in) float Nref))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 N@0x20ed320)\n" - " (declare (in ) vec2 I@0x20ed430)\n" - " (declare (in ) vec2 Nref@0x20ed540)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 N)\n" + " (declare (in) vec2 I)\n" + " (declare (in) vec2 Nref))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 N@0x20ed720)\n" - " (declare (in ) vec3 I@0x20ed830)\n" - " (declare (in ) vec3 Nref@0x20ed940)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 N)\n" + " (declare (in) vec3 I)\n" + " (declare (in) vec3 Nref))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 N@0x20edb20)\n" - " (declare (in ) vec4 I@0x20edc30)\n" - " (declare (in ) vec4 Nref@0x20edd40)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 N)\n" + " (declare (in) vec4 I)\n" + " (declare (in) vec4 Nref))\n" + " ()))\n" "(function reflect\n" " (signature float\n" " (parameters\n" - " (declare (in ) float I@0x20edf20)\n" - " (declare (in ) float N@0x20ee030)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float I)\n" + " (declare (in) float N))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 I@0x20ee3b0)\n" - " (declare (in ) vec2 N@0x20ee4c0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 I)\n" + " (declare (in) vec2 N))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 I@0x20ee6a0)\n" - " (declare (in ) vec3 N@0x20ee7b0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 I)\n" + " (declare (in) vec3 N))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 I@0x20ee990)\n" - " (declare (in ) vec4 N@0x20eeaa0)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 I)\n" + " (declare (in) vec4 N))\n" + " ()))\n" "(function refract\n" " (signature float\n" " (parameters\n" - " (declare (in ) float I@0x20eec80)\n" - " (declare (in ) float N@0x20eed90)\n" - " (declare (in ) float eta@0x20eeea0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float I)\n" + " (declare (in) float N)\n" + " (declare (in) float eta))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 I@0x20ef220)\n" - " (declare (in ) vec2 N@0x20ef330)\n" - " (declare (in ) float eta@0x20ef440)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 I)\n" + " (declare (in) vec2 N)\n" + " (declare (in) float eta))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 I@0x20ef620)\n" - " (declare (in ) vec3 N@0x20ef730)\n" - " (declare (in ) float eta@0x20ef840)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 I)\n" + " (declare (in) vec3 N)\n" + " (declare (in) float eta))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 I@0x20efa20)\n" - " (declare (in ) vec4 N@0x20efb30)\n" - " (declare (in ) float eta@0x20efc40)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 I)\n" + " (declare (in) vec4 N)\n" + " (declare (in) float eta))\n" + " ()))\n" "(function matrixCompMult\n" " (signature mat2\n" " (parameters\n" - " (declare (in ) mat2 x@0x20efe20)\n" - " (declare (in ) mat2 y@0x20eff30)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) mat2 x)\n" + " (declare (in) mat2 y))\n" + " ())\n" " (signature mat3\n" " (parameters\n" - " (declare (in ) mat3 x@0x20f02c0)\n" - " (declare (in ) mat3 y@0x20f03d0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) mat3 x)\n" + " (declare (in) mat3 y))\n" + " ())\n" " (signature mat4\n" " (parameters\n" - " (declare (in ) mat4 x@0x20f05b0)\n" - " (declare (in ) mat4 y@0x20f06c0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) mat4 x)\n" + " (declare (in) mat4 y))\n" + " ())\n" " (signature mat2x3\n" " (parameters\n" - " (declare (in ) mat2x3 x@0x20f08a0)\n" - " (declare (in ) mat2x3 y@0x20f09b0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) mat2x3 x)\n" + " (declare (in) mat2x3 y))\n" + " ())\n" " (signature mat2x4\n" " (parameters\n" - " (declare (in ) mat2x4 x@0x20f0b90)\n" - " (declare (in ) mat2x4 y@0x20f0ca0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) mat2x4 x)\n" + " (declare (in) mat2x4 y))\n" + " ())\n" " (signature mat3x2\n" " (parameters\n" - " (declare (in ) mat3x2 x@0x20f0e80)\n" - " (declare (in ) mat3x2 y@0x20f0f90)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) mat3x2 x)\n" + " (declare (in) mat3x2 y))\n" + " ())\n" " (signature mat3x4\n" " (parameters\n" - " (declare (in ) mat3x4 x@0x20f1170)\n" - " (declare (in ) mat3x4 y@0x20f1280)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) mat3x4 x)\n" + " (declare (in) mat3x4 y))\n" + " ())\n" " (signature mat4x2\n" " (parameters\n" - " (declare (in ) mat4x2 x@0x20f1460)\n" - " (declare (in ) mat4x2 y@0x20f1570)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) mat4x2 x)\n" + " (declare (in) mat4x2 y))\n" + " ())\n" " (signature mat4x3\n" " (parameters\n" - " (declare (in ) mat4x3 x@0x20f1750)\n" - " (declare (in ) mat4x3 y@0x20f1860)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) mat4x3 x)\n" + " (declare (in) mat4x3 y))\n" + " ()))\n" "(function outerProduct\n" " (signature mat2\n" " (parameters\n" - " (declare (in ) vec2 c@0x20f1a40)\n" - " (declare (in ) vec2 r@0x20f1b50)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 c)\n" + " (declare (in) vec2 r))\n" + " ())\n" " (signature mat3\n" " (parameters\n" - " (declare (in ) vec3 c@0x20f1ee0)\n" - " (declare (in ) vec3 r@0x20f1ff0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 c)\n" + " (declare (in) vec3 r))\n" + " ())\n" " (signature mat4\n" " (parameters\n" - " (declare (in ) vec4 c@0x20f21d0)\n" - " (declare (in ) vec4 r@0x20f22e0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec4 c)\n" + " (declare (in) vec4 r))\n" + " ())\n" " (signature mat2x3\n" " (parameters\n" - " (declare (in ) vec3 c@0x20f24c0)\n" - " (declare (in ) vec2 r@0x20f25d0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 c)\n" + " (declare (in) vec2 r))\n" + " ())\n" " (signature mat3x2\n" " (parameters\n" - " (declare (in ) vec2 c@0x20f27b0)\n" - " (declare (in ) vec3 r@0x20f28c0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 c)\n" + " (declare (in) vec3 r))\n" + " ())\n" " (signature mat2x4\n" " (parameters\n" - " (declare (in ) vec4 c@0x20f2aa0)\n" - " (declare (in ) vec2 r@0x20f2bb0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec4 c)\n" + " (declare (in) vec2 r))\n" + " ())\n" " (signature mat4x2\n" " (parameters\n" - " (declare (in ) vec2 c@0x20f2d90)\n" - " (declare (in ) vec4 r@0x20f2ea0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 c)\n" + " (declare (in) vec4 r))\n" + " ())\n" " (signature mat3x4\n" " (parameters\n" - " (declare (in ) vec4 c@0x20f3080)\n" - " (declare (in ) vec3 r@0x20f3190)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec4 c)\n" + " (declare (in) vec3 r))\n" + " ())\n" " (signature mat4x3\n" " (parameters\n" - " (declare (in ) vec3 c@0x20f3370)\n" - " (declare (in ) vec4 r@0x20f3480)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec3 c)\n" + " (declare (in) vec4 r))\n" + " ()))\n" "(function transpose\n" " (signature mat2\n" " (parameters\n" - " (declare (in ) mat2 m@0x20f3660)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) mat2 m))\n" + " ())\n" " (signature mat3\n" - " (parameters\n" - " (declare (in ) mat3 m@0x20f39f0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (parameters\n" + " (declare (in) mat3 m))\n" + " ())\n" " (signature mat4\n" " (parameters\n" - " (declare (in ) mat4 m@0x20f3bd0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) mat4 m))\n" + " ())\n" " (signature mat2x3\n" " (parameters\n" - " (declare (in ) mat3x2 m@0x20f3db0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) mat3x2 m))\n" + " ())\n" " (signature mat3x2\n" " (parameters\n" - " (declare (in ) mat2x3 m@0x20f3f90)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) mat2x3 m))\n" + " ())\n" " (signature mat2x4\n" " (parameters\n" - " (declare (in ) mat4x2 m@0x20f4170)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) mat4x2 m))\n" + " ())\n" " (signature mat4x2\n" " (parameters\n" - " (declare (in ) mat2x4 m@0x20f4350)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) mat2x4 m))\n" + " ())\n" " (signature mat3x4\n" " (parameters\n" - " (declare (in ) mat4x3 m@0x20f4530)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) mat4x3 m))\n" + " ())\n" " (signature mat4x3\n" " (parameters\n" - " (declare (in ) mat3x4 m@0x20f4710)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) mat3x4 m))\n" + " ()))\n" "(function lessThan\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x20f48f0)\n" - " (declare (in ) vec2 y@0x20f4a00)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" + " ())\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x20f4d90)\n" - " (declare (in ) vec3 y@0x20f4ea0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ())\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x20f5080)\n" - " (declare (in ) vec4 y@0x20f5190)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" + " ())\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) ivec2 x@0x20f5370)\n" - " (declare (in ) ivec2 y@0x20f5480)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) ivec2 x)\n" + " (declare (in) ivec2 y))\n" + " ())\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) ivec3 x@0x20f5660)\n" - " (declare (in ) ivec3 y@0x20f5770)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) ivec3 x)\n" + " (declare (in) ivec3 y))\n" + " ())\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) ivec4 x@0x20f5950)\n" - " (declare (in ) ivec4 y@0x20f5a60)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) ivec4 x)\n" + " (declare (in) ivec4 y))\n" + " ()))\n" "(function lessThanEqual\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x20f5c40)\n" - " (declare (in ) vec2 y@0x20f5d50)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" + " ())\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x20f60e0)\n" - " (declare (in ) vec3 y@0x20f61f0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ())\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x20f63d0)\n" - " (declare (in ) vec4 y@0x20f64e0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" + " ())\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) ivec2 x@0x20f66c0)\n" - " (declare (in ) ivec2 y@0x20f67d0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) ivec2 x)\n" + " (declare (in) ivec2 y))\n" + " ())\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) ivec3 x@0x20f69b0)\n" - " (declare (in ) ivec3 y@0x20f6ac0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) ivec3 x)\n" + " (declare (in) ivec3 y))\n" + " ())\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) ivec4 x@0x20f6ca0)\n" - " (declare (in ) ivec4 y@0x20f6db0)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) ivec4 x)\n" + " (declare (in) ivec4 y))\n" + " ()))\n" "(function greaterThan\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x20f6f90)\n" - " (declare (in ) vec2 y@0x20f70a0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" + " ())\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x20f7430)\n" - " (declare (in ) vec3 y@0x20f7540)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ())\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x20f7720)\n" - " (declare (in ) vec4 y@0x20f7830)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" + " ())\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) ivec2 x@0x20f7a10)\n" - " (declare (in ) ivec2 y@0x20f7b20)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) ivec2 x)\n" + " (declare (in) ivec2 y))\n" + " ())\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) ivec3 x@0x20f7d00)\n" - " (declare (in ) ivec3 y@0x20f7e10)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) ivec3 x)\n" + " (declare (in) ivec3 y))\n" + " ())\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) ivec4 x@0x20f7ff0)\n" - " (declare (in ) ivec4 y@0x20f8100)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) ivec4 x)\n" + " (declare (in) ivec4 y))\n" + " ()))\n" "(function greaterThanEqual\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x20f82e0)\n" - " (declare (in ) vec2 y@0x20f83f0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" + " ())\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x20f8780)\n" - " (declare (in ) vec3 y@0x20f8890)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ())\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x20f8a70)\n" - " (declare (in ) vec4 y@0x20f8b80)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" + " ())\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) ivec2 x@0x20f8d60)\n" - " (declare (in ) ivec2 y@0x20f8e70)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) ivec2 x)\n" + " (declare (in) ivec2 y))\n" + " ())\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) ivec3 x@0x20f9050)\n" - " (declare (in ) ivec3 y@0x20f9160)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) ivec3 x)\n" + " (declare (in) ivec3 y))\n" + " ())\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) ivec4 x@0x20f9340)\n" - " (declare (in ) ivec4 y@0x20f9450)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) ivec4 x)\n" + " (declare (in) ivec4 y))\n" + " ()))\n" "(function equal\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x20f9630)\n" - " (declare (in ) vec2 y@0x20f9740)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" + " ())\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x20f9ac0)\n" - " (declare (in ) vec3 y@0x20f9bd0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ())\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x20f9db0)\n" - " (declare (in ) vec4 y@0x20f9ec0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" + " ())\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) ivec2 x@0x20fa0a0)\n" - " (declare (in ) ivec2 y@0x20fa1b0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) ivec2 x)\n" + " (declare (in) ivec2 y))\n" + " ())\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) ivec3 x@0x20fa390)\n" - " (declare (in ) ivec3 y@0x20fa4a0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) ivec3 x)\n" + " (declare (in) ivec3 y))\n" + " ())\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) ivec4 x@0x20fa680)\n" - " (declare (in ) ivec4 y@0x20fa790)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) ivec4 x)\n" + " (declare (in) ivec4 y))\n" + " ())\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) bvec2 x@0x20fa970)\n" - " (declare (in ) bvec2 y@0x20faa80)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) bvec2 x)\n" + " (declare (in) bvec2 y))\n" + " ())\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) bvec3 x@0x20fac60)\n" - " (declare (in ) bvec3 y@0x20fad70)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) bvec3 x)\n" + " (declare (in) bvec3 y))\n" + " ())\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) bvec4 x@0x20faf50)\n" - " (declare (in ) bvec4 y@0x20fb060)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) bvec4 x)\n" + " (declare (in) bvec4 y))\n" + " ()))\n" "(function notEqual\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x20fb240)\n" - " (declare (in ) vec2 y@0x20fb350)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" + " ())\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x20fb6e0)\n" - " (declare (in ) vec3 y@0x20fb7f0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ())\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x20fb9d0)\n" - " (declare (in ) vec4 y@0x20fbae0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" + " ())\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) ivec2 x@0x20fbcc0)\n" - " (declare (in ) ivec2 y@0x20fbdd0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) ivec2 x)\n" + " (declare (in) ivec2 y))\n" + " ())\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) ivec3 x@0x20fbfb0)\n" - " (declare (in ) ivec3 y@0x20fc0c0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) ivec3 x)\n" + " (declare (in) ivec3 y))\n" + " ())\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) ivec4 x@0x20fc2a0)\n" - " (declare (in ) ivec4 y@0x20fc3b0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) ivec4 x)\n" + " (declare (in) ivec4 y))\n" + " ())\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) bvec2 x@0x20fc590)\n" - " (declare (in ) bvec2 y@0x20fc6a0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) bvec2 x)\n" + " (declare (in) bvec2 y))\n" + " ())\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) bvec3 x@0x20fc880)\n" - " (declare (in ) bvec3 y@0x20fc990)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) bvec3 x)\n" + " (declare (in) bvec3 y))\n" + " ())\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) bvec4 x@0x20fcb70)\n" - " (declare (in ) bvec4 y@0x20fcc80)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) bvec4 x)\n" + " (declare (in) bvec4 y))\n" + " ()))\n" "(function any\n" " (signature bool\n" " (parameters\n" - " (declare (in ) bvec2 x@0x20fce60)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) bvec2 x))\n" + " ())\n" " (signature bool\n" " (parameters\n" - " (declare (in ) bvec3 x@0x20fd1e0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) bvec3 x))\n" + " ())\n" " (signature bool\n" " (parameters\n" - " (declare (in ) bvec4 x@0x20fd3c0)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) bvec4 x))\n" + " ()))\n" "(function all\n" " (signature bool\n" " (parameters\n" - " (declare (in ) bvec2 x@0x20fd5a0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) bvec2 x))\n" + " ())\n" " (signature bool\n" " (parameters\n" - " (declare (in ) bvec3 x@0x20fd920)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) bvec3 x))\n" + " ())\n" " (signature bool\n" " (parameters\n" - " (declare (in ) bvec4 x@0x20fdb00)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) bvec4 x))\n" + " ()))\n" "(function not\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) bvec2 x@0x20fdce0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) bvec2 x))\n" + " ())\n" " (signature bvec3\n" - " (parameters\n" - " (declare (in ) bvec3 x@0x20fe060)\n" - " )\n" - " (\n" - " ))\n" - "\n" - " (signature bvec4\n" - " (parameters\n" - " (declare (in ) bvec4 x@0x20fe240)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (parameters\n" + " (declare (in) bvec3 x))\n" + " ())\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) bvec4 x))\n" + " ()))\n" "(function texture1D\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1D sampler@0x20fe420)\n" - " (declare (in ) float coord@0x20fe530)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) float coord))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1D sampler@0x20ff050)\n" - " (declare (in ) float coord@0x20ff160)\n" - " (declare (in ) float bias@0x20ff270)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) float coord)\n" + " (declare (in) float bias))\n" + " ()))\n" "(function texture1DProj\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1D sampler@0x20fe8c0)\n" - " (declare (in ) vec2 coord@0x20fe9d0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) vec2 coord))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1D sampler@0x20fed60)\n" - " (declare (in ) vec4 coord@0x20fee70)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) vec4 coord))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1D sampler@0x20ff450)\n" - " (declare (in ) vec2 coord@0x20ff560)\n" - " (declare (in ) float bias@0x20ff670)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) vec2 coord)\n" + " (declare (in) float bias))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1D sampler@0x20ff850)\n" - " (declare (in ) vec4 coord@0x20ff960)\n" - " (declare (in ) float bias@0x20ffa70)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) vec4 coord)\n" + " (declare (in) float bias))\n" + " ()))\n" "(function texture2D\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2D sampler@0x20ffc50)\n" - " (declare (in ) vec2 coord@0x20ffd60)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec2 coord))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2D sampler@0x2100880)\n" - " (declare (in ) vec2 coord@0x2100990)\n" - " (declare (in ) float bias@0x2100aa0)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec2 coord)\n" + " (declare (in) float bias))\n" + " ()))\n" "(function texture2DProj\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2D sampler@0x21000f0)\n" - " (declare (in ) vec3 coord@0x2100200)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec3 coord))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2D sampler@0x2100590)\n" - " (declare (in ) vec4 coord@0x21006a0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec4 coord))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2D sampler@0x2100c80)\n" - " (declare (in ) vec3 coord@0x2100d90)\n" - " (declare (in ) float bias@0x2100ea0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec3 coord)\n" + " (declare (in) float bias))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2D sampler@0x2101080)\n" - " (declare (in ) vec4 coord@0x2101190)\n" - " (declare (in ) float bias@0x21012a0)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec4 coord)\n" + " (declare (in) float bias))\n" + " ()))\n" "(function texture3D\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler3D sampler@0x2101480)\n" - " (declare (in ) vec3 coord@0x2101590)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler3D sampler)\n" + " (declare (in) vec3 coord))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler3D sampler@0x2101dc0)\n" - " (declare (in ) vec3 coord@0x2101ed0)\n" - " (declare (in ) float bias@0x2101fe0)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) sampler3D sampler)\n" + " (declare (in) vec3 coord)\n" + " (declare (in) float bias))\n" + " ()))\n" "(function texture3DProj\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler3D sampler@0x2101920)\n" - " (declare (in ) vec4 coord@0x2101a30)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler3D sampler)\n" + " (declare (in) vec4 coord))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler3D sampler@0x21021c0)\n" - " (declare (in ) vec4 coord@0x21022d0)\n" - " (declare (in ) float bias@0x21023e0)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) sampler3D sampler)\n" + " (declare (in) vec4 coord)\n" + " (declare (in) float bias))\n" + " ()))\n" "(function textureCube\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) samplerCube sampler@0x21025c0)\n" - " (declare (in ) vec3 coord@0x21026d0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) samplerCube sampler)\n" + " (declare (in) vec3 coord))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) samplerCube sampler@0x2102a60)\n" - " (declare (in ) vec3 coord@0x2102b70)\n" - " (declare (in ) float bias@0x2102c80)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) samplerCube sampler)\n" + " (declare (in) vec3 coord)\n" + " (declare (in) float bias))\n" + " ()))\n" "(function shadow1D\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1DShadow sampler@0x2102e60)\n" - " (declare (in ) vec3 coord@0x2102f70)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler1DShadow sampler)\n" + " (declare (in) vec3 coord))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1DShadow sampler@0x21040e0)\n" - " (declare (in ) vec3 coord@0x21041f0)\n" - " (declare (in ) float bias@0x2104300)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) sampler1DShadow sampler)\n" + " (declare (in) vec3 coord)\n" + " (declare (in) float bias))\n" + " ()))\n" "(function shadow2D\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2DShadow sampler@0x2103300)\n" - " (declare (in ) vec3 coord@0x2103410)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler2DShadow sampler)\n" + " (declare (in) vec3 coord))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2DShadow sampler@0x21044e0)\n" - " (declare (in ) vec3 coord@0x21045f0)\n" - " (declare (in ) float bias@0x2104700)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) sampler2DShadow sampler)\n" + " (declare (in) vec3 coord)\n" + " (declare (in) float bias))\n" + " ()))\n" "(function shadow1DProj\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1DShadow sampler@0x21037a0)\n" - " (declare (in ) vec4 coord@0x21038b0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler1DShadow sampler)\n" + " (declare (in) vec4 coord))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1DShadow sampler@0x21048e0)\n" - " (declare (in ) vec4 coord@0x21049f0)\n" - " (declare (in ) float bias@0x2104b00)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) sampler1DShadow sampler)\n" + " (declare (in) vec4 coord)\n" + " (declare (in) float bias))\n" + " ()))\n" "(function shadow2DProj\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2DShadow sampler@0x2103c40)\n" - " (declare (in ) vec4 coord@0x2103d50)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) sampler2DShadow sampler)\n" + " (declare (in) vec4 coord))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2DShadow sampler@0x2104ce0)\n" - " (declare (in ) vec4 coord@0x2104df0)\n" - " (declare (in ) float bias@0x2104f00)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) sampler2DShadow sampler)\n" + " (declare (in) vec4 coord)\n" + " (declare (in) float bias))\n" + " ()))\n" "(function dFdx\n" " (signature float\n" " (parameters\n" - " (declare (in ) float p@0x21050e0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float p))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 p@0x2105460)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 p))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 p@0x2105640)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 p))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 p@0x2105820)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 p))\n" + " ()))\n" "(function dFdy\n" " (signature float\n" " (parameters\n" - " (declare (in ) float p@0x2105a00)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float p))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 p@0x2105d80)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 p))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 p@0x2105f60)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 p))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 p@0x2106140)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 p))\n" + " ()))\n" "(function fwidth\n" " (signature float\n" " (parameters\n" - " (declare (in ) float p@0x2106320)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float p))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 p@0x21066a0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 p))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 p@0x2106880)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 p))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 p@0x2106a60)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 p))\n" + " ()))\n" "(function noise1\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x2106c40)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float x))\n" + " ())\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec2 x@0x2106fc0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x))\n" + " ())\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec3 x@0x21071a0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x))\n" + " ())\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec4 x@0x2107380)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 x))\n" + " ()))\n" "(function noise2\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) float x@0x2107560)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float x))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x21078e0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec3 x@0x2107ac0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x))\n" + " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec4 x@0x2107ca0)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 x))\n" + " ()))\n" "(function noise3\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) float x@0x2107e80)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float x))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec2 x@0x2108200)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x21083e0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x))\n" + " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec4 x@0x21085c0)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" + " (declare (in) vec4 x))\n" + " ()))\n" "(function noise4\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) float x@0x21087a0)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) float x))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec2 x@0x2108b20)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec2 x))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec3 x@0x2108d00)\n" - " )\n" - " (\n" - " ))\n" - "\n" + " (declare (in) vec3 x))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x2108ee0)\n" - " )\n" - " (\n" - " ))\n" - "\n" - ")\n" - "\n" - "\n" - ")" + " (declare (in) vec4 x))\n" + " ())))" ; static const char *functions_for_120_frag [] = { builtin_clamp, -- cgit v1.2.3 From 665d75cc5a23f8024034d0c4176fb281f94a30e9 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Wed, 18 Aug 2010 13:54:50 -0700 Subject: glsl: Fix scoping bug in if statements. Fixes glslparsertest/glsl2/scoping-01.frag (successfully compiled but should've failed) and scoping-02.frag (assertion triggered). --- src/glsl/ast_to_hir.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp index 6e5d01ee26..bd1ab78d4a 100644 --- a/src/glsl/ast_to_hir.cpp +++ b/src/glsl/ast_to_hir.cpp @@ -2395,11 +2395,17 @@ ast_selection_statement::hir(exec_list *instructions, ir_if *const stmt = new(ctx) ir_if(condition); - if (then_statement != NULL) + if (then_statement != NULL) { + state->symbols->push_scope(); then_statement->hir(& stmt->then_instructions, state); + state->symbols->pop_scope(); + } - if (else_statement != NULL) + if (else_statement != NULL) { + state->symbols->push_scope(); else_statement->hir(& stmt->else_instructions, state); + state->symbols->pop_scope(); + } instructions->push_tail(stmt); -- cgit v1.2.3 From 0df61bdb669d03d9c25e49d5698f193deca3cf6d Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 18 Aug 2010 11:35:15 -0700 Subject: mesa: Make MESA_GLSL=dump include when compile/link fails, and the info log. --- src/mesa/program/ir_to_mesa.cpp | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp index 7de1939b63..58d3b41d08 100644 --- a/src/mesa/program/ir_to_mesa.cpp +++ b/src/mesa/program/ir_to_mesa.cpp @@ -2691,10 +2691,18 @@ _mesa_glsl_compile_shader(GLcontext *ctx, struct gl_shader *shader) _mesa_write_shader_to_file(shader); } - if ((ctx->Shader.Flags & GLSL_DUMP) && shader->CompileStatus) { - printf("GLSL IR for shader %d:\n", shader->Name); - _mesa_print_ir(shader->ir, NULL); - printf("\n\n"); + if (ctx->Shader.Flags & GLSL_DUMP) { + if (shader->CompileStatus) { + printf("GLSL IR for shader %d:\n", shader->Name); + _mesa_print_ir(shader->ir, NULL); + printf("\n\n"); + } else { + printf("GLSL shader %d failed to compile.\n", shader->Name); + } + if (shader->InfoLog && shader->InfoLog[0] != 0) { + printf("GLSL shader %d info log:\n", shader->Name); + printf("%s\n", shader->InfoLog); + } } /* Retain any live IR, but trash the rest. */ @@ -2741,8 +2749,15 @@ _mesa_glsl_link_shader(GLcontext *ctx, struct gl_shader_program *prog) } if (prog->LinkStatus) { - if (!ctx->Driver.LinkShader(ctx, prog)) + if (!ctx->Driver.LinkShader(ctx, prog)) { prog->LinkStatus = GL_FALSE; + printf("GLSL shader program %d failed to link\n", prog->Name); + } + + if (prog->InfoLog && prog->InfoLog[0] != 0) { + printf("GLSL shader program %d info log:\n", prog->Name); + printf("%s\n", prog->InfoLog); + } } } -- cgit v1.2.3 From 4a6a4316846ead3ec12759c96ecc4b61491aad65 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 18 Aug 2010 11:36:09 -0700 Subject: mesa: Hang the compiled shader off the shader->ir, not the shader. Otherwise, with repeated program recompile, we never free the results of the previous compile. --- src/mesa/program/ir_to_mesa.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp index 58d3b41d08..8ed3834061 100644 --- a/src/mesa/program/ir_to_mesa.cpp +++ b/src/mesa/program/ir_to_mesa.cpp @@ -2662,6 +2662,7 @@ _mesa_glsl_compile_shader(GLcontext *ctx, struct gl_shader *shader) _mesa_glsl_lexer_dtor(state); } + talloc_free(shader->ir); shader->ir = new(shader) exec_list; if (!state->error && !state->translation_unit.is_empty()) _mesa_ast_to_hir(shader->ir, state); @@ -2706,7 +2707,7 @@ _mesa_glsl_compile_shader(GLcontext *ctx, struct gl_shader *shader) } /* Retain any live IR, but trash the rest. */ - reparent_ir(shader->ir, shader); + reparent_ir(shader->ir, shader->ir); talloc_free(state); -- cgit v1.2.3 From abc6d7e0b4b04c75129d24c3cb6f021b92cd46f6 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 18 Aug 2010 11:37:18 -0700 Subject: ir_to_mesa: Free the ir_to_mesa temporary storage when we're done. --- src/mesa/program/ir_to_mesa.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp index 8ed3834061..4f4994392d 100644 --- a/src/mesa/program/ir_to_mesa.cpp +++ b/src/mesa/program/ir_to_mesa.cpp @@ -2212,10 +2212,12 @@ ir_to_mesa_visitor::ir_to_mesa_visitor() next_signature_id = 1; sampler_map = NULL; current_function = NULL; + mem_ctx = talloc_new(NULL); } ir_to_mesa_visitor::~ir_to_mesa_visitor() { + talloc_free(mem_ctx); if (this->sampler_map) hash_table_dtor(this->sampler_map); } @@ -2445,8 +2447,6 @@ get_mesa_program(GLcontext *ctx, struct gl_shader_program *shader_program, v.ctx = ctx; v.prog = prog; - v.mem_ctx = talloc_new(NULL); - /* Emit Mesa IR for main(). */ visit_exec_list(shader->ir, &v); v.ir_to_mesa_emit_op0(NULL, OPCODE_END); -- cgit v1.2.3 From 0b09e6410f1173c2f69b601e43c5b14d8ad97345 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 18 Aug 2010 11:42:42 -0700 Subject: glsl2: Fix copy'n'paste hilarity leading to leaking in the refcount visitor. --- src/glsl/ir_dead_code.cpp | 1 - src/glsl/ir_variable_refcount.h | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) (limited to 'src') diff --git a/src/glsl/ir_dead_code.cpp b/src/glsl/ir_dead_code.cpp index fce921262f..7ff580d538 100644 --- a/src/glsl/ir_dead_code.cpp +++ b/src/glsl/ir_dead_code.cpp @@ -101,7 +101,6 @@ do_dead_code(exec_list *instructions) } } } - talloc_free(v.mem_ctx); return progress; } diff --git a/src/glsl/ir_variable_refcount.h b/src/glsl/ir_variable_refcount.h index 30dd2bd587..059ea097a6 100644 --- a/src/glsl/ir_variable_refcount.h +++ b/src/glsl/ir_variable_refcount.h @@ -67,7 +67,7 @@ public: ~ir_variable_refcount_visitor(void) { - this->mem_ctx = talloc_new(NULL); + talloc_free(this->mem_ctx); } virtual ir_visitor_status visit(ir_variable *); -- cgit v1.2.3 From 5d0f430e8ed01db29d11d22e4b6c3760d8c39f8f Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 18 Aug 2010 12:02:35 -0700 Subject: mesa: Free old linked shaders when relinking new shaders. --- src/glsl/linker.cpp | 15 ++++++++++----- src/glsl/main.cpp | 6 +++++- src/glsl/program.h | 2 +- src/mesa/program/ir_to_mesa.cpp | 2 +- 4 files changed, 17 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp index 4172e41910..b256574446 100644 --- a/src/glsl/linker.cpp +++ b/src/glsl/linker.cpp @@ -674,7 +674,8 @@ get_main_function_signature(gl_shader *sh) * shader is returned. */ static struct gl_shader * -link_intrastage_shaders(struct gl_shader_program *prog, +link_intrastage_shaders(GLcontext *ctx, + struct gl_shader_program *prog, struct gl_shader **shader_list, unsigned num_shaders) { @@ -747,7 +748,7 @@ link_intrastage_shaders(struct gl_shader_program *prog, return NULL; } - gl_shader *const linked = _mesa_new_shader(NULL, 0, main->Type); + gl_shader *const linked = ctx->Driver.NewShader(NULL, 0, main->Type); linked->ir = new(linked) exec_list; clone_ir_list(linked, linked->ir, main->ir); @@ -1212,7 +1213,7 @@ assign_varying_locations(struct gl_shader_program *prog, void -link_shaders(struct gl_shader_program *prog) +link_shaders(GLcontext *ctx, struct gl_shader_program *prog) { prog->LinkStatus = false; prog->Validated = false; @@ -1270,12 +1271,16 @@ link_shaders(struct gl_shader_program *prog) prog->Version = max_version; + for (unsigned int i = 0; i < prog->_NumLinkedShaders; i++) { + ctx->Driver.DeleteShader(ctx, prog->_LinkedShaders[i]); + } + /* Link all shaders for a particular stage and validate the result. */ prog->_NumLinkedShaders = 0; if (num_vert_shaders > 0) { gl_shader *const sh = - link_intrastage_shaders(prog, vert_shader_list, num_vert_shaders); + link_intrastage_shaders(ctx, prog, vert_shader_list, num_vert_shaders); if (sh == NULL) goto done; @@ -1289,7 +1294,7 @@ link_shaders(struct gl_shader_program *prog) if (num_frag_shaders > 0) { gl_shader *const sh = - link_intrastage_shaders(prog, frag_shader_list, num_frag_shaders); + link_intrastage_shaders(ctx, prog, frag_shader_list, num_frag_shaders); if (sh == NULL) goto done; diff --git a/src/glsl/main.cpp b/src/glsl/main.cpp index 24d6076d07..cb9f8a5277 100644 --- a/src/glsl/main.cpp +++ b/src/glsl/main.cpp @@ -209,6 +209,10 @@ int main(int argc, char **argv) { int status = EXIT_SUCCESS; + GLcontext local_ctx; + GLcontext *ctx = &local_ctx; + + ctx->Driver.NewShader = _mesa_new_shader; int c; int idx = 0; @@ -265,7 +269,7 @@ main(int argc, char **argv) } if ((status == EXIT_SUCCESS) && do_link) { - link_shaders(whole_program); + link_shaders(ctx, whole_program); status = (whole_program->LinkStatus) ? EXIT_SUCCESS : EXIT_FAILURE; if (strlen(whole_program->InfoLog) > 0) diff --git a/src/glsl/program.h b/src/glsl/program.h index 0a49203d4b..ea2c4ab0dd 100644 --- a/src/glsl/program.h +++ b/src/glsl/program.h @@ -30,4 +30,4 @@ extern "C" { } extern void -link_shaders(struct gl_shader_program *prog); +link_shaders(GLcontext *ctx, struct gl_shader_program *prog); diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp index 4f4994392d..394370d46d 100644 --- a/src/mesa/program/ir_to_mesa.cpp +++ b/src/mesa/program/ir_to_mesa.cpp @@ -2740,7 +2740,7 @@ _mesa_glsl_link_shader(GLcontext *ctx, struct gl_shader_program *prog) _mesa_reference_fragprog(ctx, &prog->FragmentProgram, NULL); if (prog->LinkStatus) { - link_shaders(prog); + link_shaders(ctx, prog); /* We don't use the linker's uniforms list, and cook up our own at * generate time. -- cgit v1.2.3 From 56a0690a81cd6a0e7db4c041430ca38e5063e145 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 18 Aug 2010 14:12:52 -0700 Subject: mesa: Free linked shaders when deleting the shader program. --- src/mesa/main/shaderobj.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src') diff --git a/src/mesa/main/shaderobj.c b/src/mesa/main/shaderobj.c index 863d50fbe5..1755e8a33c 100644 --- a/src/mesa/main/shaderobj.c +++ b/src/mesa/main/shaderobj.c @@ -314,6 +314,12 @@ _mesa_free_shader_program_data(GLcontext *ctx, free(shProg->TransformFeedback.VaryingNames); shProg->TransformFeedback.VaryingNames = NULL; shProg->TransformFeedback.NumVarying = 0; + + + for (i = 0; i < shProg->_NumLinkedShaders; i++) { + ctx->Driver.DeleteShader(ctx, shProg->_LinkedShaders[i]); + } + shProg->_NumLinkedShaders = 0; } -- cgit v1.2.3 From 850c659044d081c53713800cacf8d518fae6cd70 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 18 Aug 2010 13:48:32 -0700 Subject: ir_to_mesa: Stop leaking the ir_instruction * annotation of our compile. --- src/mesa/program/ir_to_mesa.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src') diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp index 394370d46d..5299d7706c 100644 --- a/src/mesa/program/ir_to_mesa.cpp +++ b/src/mesa/program/ir_to_mesa.cpp @@ -2412,7 +2412,6 @@ struct gl_program * get_mesa_program(GLcontext *ctx, struct gl_shader_program *shader_program, struct gl_shader *shader) { - void *mem_ctx = shader_program; ir_to_mesa_visitor v; struct prog_instruction *mesa_instructions, *mesa_inst; ir_instruction **mesa_instruction_annotation; @@ -2490,7 +2489,7 @@ get_mesa_program(GLcontext *ctx, struct gl_shader_program *shader_program, mesa_instructions = (struct prog_instruction *)calloc(num_instructions, sizeof(*mesa_instructions)); - mesa_instruction_annotation = talloc_array(mem_ctx, ir_instruction *, + mesa_instruction_annotation = talloc_array(v.mem_ctx, ir_instruction *, num_instructions); mesa_inst = mesa_instructions; -- cgit v1.2.3 From e271384219ebc1f9e8afb63b20256f9d56102592 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 18 Aug 2010 12:04:43 -0700 Subject: glsl: Garbage collect old prototype for ir_to_mesa. --- src/glsl/glsl_parser_extras.h | 2 -- 1 file changed, 2 deletions(-) (limited to 'src') diff --git a/src/glsl/glsl_parser_extras.h b/src/glsl/glsl_parser_extras.h index 3b53ba07f6..9e3cac26e2 100644 --- a/src/glsl/glsl_parser_extras.h +++ b/src/glsl/glsl_parser_extras.h @@ -209,6 +209,4 @@ extern bool _mesa_glsl_process_extension(const char *name, YYLTYPE *name_locp, 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 */ -- cgit v1.2.3 From 3ef83d270b2c24867a0d020b81bdc6c54cb1c9b0 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 18 Aug 2010 14:13:30 -0700 Subject: ir_to_mesa: Fix leak of set_branchtargets temp data. --- src/mesa/program/ir_to_mesa.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp index 5299d7706c..eb3be913e7 100644 --- a/src/mesa/program/ir_to_mesa.cpp +++ b/src/mesa/program/ir_to_mesa.cpp @@ -2266,8 +2266,8 @@ set_branchtargets(ir_to_mesa_visitor *v, } } - if_stack = (int *)calloc(if_count, sizeof(*if_stack)); - loop_stack = (int *)calloc(loop_count, sizeof(*loop_stack)); + if_stack = talloc_zero_array(v->mem_ctx, int, if_count); + loop_stack = talloc_zero_array(v->mem_ctx, int, loop_count); for (i = 0; i < num_instructions; i++) { switch (mesa_instructions[i].Opcode) { @@ -2319,8 +2319,6 @@ set_branchtargets(ir_to_mesa_visitor *v, break; } } - - free(if_stack); } static void -- cgit v1.2.3 From e1c7f3af0cb6769ef20a954459cfb87b9f99b4d6 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Wed, 18 Aug 2010 14:36:08 -0700 Subject: mesa: fpclassify is available on OpenSolaris. There is no explicit predefined macro to distinguish between OpenSolaris and Solaris. This patch assumes that the difference is in the compilers. OpenSolaris uses GCC and not the Sun Studio compiler. Assume that the availability of fpclassify is due to GCC. This patch was not tested on Solaris. It would break the build on Solaris with GCC if GCC on Solaris does not have fpclassify. --- src/mesa/main/querymatrix.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/main/querymatrix.c b/src/mesa/main/querymatrix.c index 32aaa79f7f..36236eb9a7 100644 --- a/src/mesa/main/querymatrix.c +++ b/src/mesa/main/querymatrix.c @@ -72,7 +72,8 @@ fpclassify(double x) #elif defined(__APPLE__) || defined(__CYGWIN__) || defined(__FreeBSD__) || \ defined(__OpenBSD__) || defined(__NetBSD__) || defined(__DragonFly__) || \ - (defined(__sun) && defined(__C99FEATURES__)) || defined(__MINGW32__) + (defined(__sun) && defined(__C99FEATURES__)) || defined(__MINGW32__) || \ + (defined(__sun) && defined(__GNUC__)) /* fpclassify is available. */ -- cgit v1.2.3 From 352e62c3c26c75ddce1345962339f78c64d0aa95 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Wed, 18 Aug 2010 16:10:15 -0700 Subject: glsl: Fix uninitialized member in ir_hierarchical_vistor constructor. Class member base_ir was not initialized by the default constructor. --- src/glsl/ir_hierarchical_visitor.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/glsl/ir_hierarchical_visitor.cpp b/src/glsl/ir_hierarchical_visitor.cpp index d475df62fc..809b08ee62 100644 --- a/src/glsl/ir_hierarchical_visitor.cpp +++ b/src/glsl/ir_hierarchical_visitor.cpp @@ -26,6 +26,7 @@ ir_hierarchical_visitor::ir_hierarchical_visitor() { + this->base_ir = NULL; this->callback = NULL; this->data = NULL; } -- cgit v1.2.3 From 4532feba14fcf4e39ea6e44dd2b6a290697bbd50 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 18 Aug 2010 15:59:31 -0700 Subject: glsl: Fix leak-causing typo in destructor that made it another constructor. --- src/glsl/ir_set_program_inouts.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/glsl/ir_set_program_inouts.cpp b/src/glsl/ir_set_program_inouts.cpp index 658637775a..534f602128 100644 --- a/src/glsl/ir_set_program_inouts.cpp +++ b/src/glsl/ir_set_program_inouts.cpp @@ -51,7 +51,7 @@ public: hash_table_pointer_hash, hash_table_pointer_compare); } - ir_set_program_inouts_visitor() + ~ir_set_program_inouts_visitor() { hash_table_dtor(this->ht); } -- cgit v1.2.3 From a482e033082bb0794fdf56c47dd76d949afde6fa Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 18 Aug 2010 16:17:10 -0700 Subject: dri2: Clean up the common dri2 options at screen destroy. --- src/mesa/drivers/dri/common/dri_util.c | 10 +++++++--- src/mesa/drivers/dri/common/dri_util.h | 1 + 2 files changed, 8 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/common/dri_util.c b/src/mesa/drivers/dri/common/dri_util.c index dce84ef0de..5eb8b62f45 100644 --- a/src/mesa/drivers/dri/common/dri_util.c +++ b/src/mesa/drivers/dri/common/dri_util.c @@ -714,6 +714,9 @@ static void driDestroyScreen(__DRIscreen *psp) (void)drmUnmap((drmAddress)psp->pSAREA, SAREA_MAX); (void)drmUnmap((drmAddress)psp->pFB, psp->fbSize); (void)drmCloseOnce(psp->fd); + } else { + driDestroyOptionCache(&psp->optionCache); + driDestroyOptionInfo(&psp->optionInfo); } free(psp); @@ -839,7 +842,6 @@ dri2CreateNewScreen(int scrn, int fd, static const __DRIextension *emptyExtensionList[] = { NULL }; __DRIscreen *psp; drmVersionPtr version; - driOptionCache options; if (driDriverAPI.InitScreen2 == NULL) return NULL; @@ -873,8 +875,10 @@ dri2CreateNewScreen(int scrn, int fd, psp->DriverAPI = driDriverAPI; - driParseOptionInfo(&options, __dri2ConfigOptions, __dri2NConfigOptions); - driParseConfigFiles(&psp->optionCache, &options, psp->myNum, "dri2"); + driParseOptionInfo(&psp->optionInfo, __dri2ConfigOptions, + __dri2NConfigOptions); + driParseConfigFiles(&psp->optionCache, &psp->optionInfo, psp->myNum, + "dri2"); return psp; } diff --git a/src/mesa/drivers/dri/common/dri_util.h b/src/mesa/drivers/dri/common/dri_util.h index e2fcdaa638..5096d22cad 100644 --- a/src/mesa/drivers/dri/common/dri_util.h +++ b/src/mesa/drivers/dri/common/dri_util.h @@ -536,6 +536,7 @@ struct __DRIscreenRec { /* The lock actually in use, old sarea or DRI2 */ drmLock *lock; + driOptionCache optionInfo; driOptionCache optionCache; unsigned int api_mask; }; -- cgit v1.2.3 From 3cd233eb5714137dccb6218ad78005511bcc02bd Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 18 Aug 2010 16:29:02 -0700 Subject: ir_to_mesa: Don't leak the whole linked assembly program. --- src/mesa/program/ir_to_mesa.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp index eb3be913e7..b566706d72 100644 --- a/src/mesa/program/ir_to_mesa.cpp +++ b/src/mesa/program/ir_to_mesa.cpp @@ -2633,6 +2633,7 @@ _mesa_ir_link_shader(GLcontext *ctx, struct gl_shader_program *prog) if (!ok) { return GL_FALSE; } + _mesa_reference_program(ctx, &linked_prog, NULL); } return GL_TRUE; -- cgit v1.2.3 From b83846475bac76268d75f53632faf8aad8cad02c Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 18 Aug 2010 16:56:39 -0700 Subject: glsl2: Free the shader compiler at dri screen destruction. Hooray, we can valgrind again without adding suppressions. This also adds an interface for use by an implementation of glReleaseShaderCompiler(). --- src/glsl/glsl_parser_extras.cpp | 30 ++++++++++++++++++++++++++++++ src/glsl/glsl_parser_extras.h | 3 +++ src/mesa/drivers/dri/common/dri_util.c | 2 ++ 3 files changed, 35 insertions(+) (limited to 'src') diff --git a/src/glsl/glsl_parser_extras.cpp b/src/glsl/glsl_parser_extras.cpp index d1bb1ae5ec..b864218d50 100644 --- a/src/glsl/glsl_parser_extras.cpp +++ b/src/glsl/glsl_parser_extras.cpp @@ -741,3 +741,33 @@ do_common_optimization(exec_list *ir, bool linked) return progress; } + +extern "C" { + +/** + * To be called at GL teardown time, this frees compiler datastructures. + * + * After calling this, any previously compiled shaders and shader + * programs would be invalid. So this should happen at approximately + * program exit. + */ +void +_mesa_destroy_shader_compiler(void) +{ + _mesa_destroy_shader_compiler_caches(); + + _mesa_glsl_release_types(); +} + +/** + * Releases compiler caches to trade off performance for memory. + * + * Intended to be used with glReleaseShaderCompiler(). + */ +void +_mesa_destroy_shader_compiler_caches(void) +{ + _mesa_glsl_release_functions(); +} + +} diff --git a/src/glsl/glsl_parser_extras.h b/src/glsl/glsl_parser_extras.h index 9e3cac26e2..b0b1bc31d0 100644 --- a/src/glsl/glsl_parser_extras.h +++ b/src/glsl/glsl_parser_extras.h @@ -178,6 +178,9 @@ extern void _mesa_glsl_warning(const YYLTYPE *locp, extern "C" { extern int preprocess(void *ctx, const char **shader, char **info_log, const struct gl_extensions *extensions); + +extern void _mesa_destroy_shader_compiler(); +extern void _mesa_destroy_shader_compiler_caches(); } extern void _mesa_glsl_lexer_ctor(struct _mesa_glsl_parse_state *state, diff --git a/src/mesa/drivers/dri/common/dri_util.c b/src/mesa/drivers/dri/common/dri_util.c index 5eb8b62f45..b1a7b3ed34 100644 --- a/src/mesa/drivers/dri/common/dri_util.c +++ b/src/mesa/drivers/dri/common/dri_util.c @@ -707,6 +707,8 @@ static void driDestroyScreen(__DRIscreen *psp) * stream open to the X-server anymore. */ + _mesa_destroy_shader_compiler(); + if (psp->DriverAPI.DestroyScreen) (*psp->DriverAPI.DestroyScreen)(psp); -- cgit v1.2.3 From 49dfa89873403967d9f99d08d2e25042dea544e0 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 18 Aug 2010 17:12:18 -0700 Subject: ir_to_mesa: Fix leak by improper freeing of a uniform list. --- src/mesa/program/ir_to_mesa.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp index b566706d72..7b0c28e5be 100644 --- a/src/mesa/program/ir_to_mesa.cpp +++ b/src/mesa/program/ir_to_mesa.cpp @@ -2743,7 +2743,7 @@ _mesa_glsl_link_shader(GLcontext *ctx, struct gl_shader_program *prog) /* We don't use the linker's uniforms list, and cook up our own at * generate time. */ - free(prog->Uniforms); + _mesa_free_uniform_list(prog->Uniforms); prog->Uniforms = _mesa_new_uniform_list(); } -- cgit v1.2.3 From 9cf62bdfeb3982405b9360500d7e0fa52036f38f Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Wed, 18 Aug 2010 17:38:05 -0700 Subject: glcpp: Add basic #line support (adapted from the main compiler). --- src/glsl/glcpp/glcpp-lex.l | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'src') diff --git a/src/glsl/glcpp/glcpp-lex.l b/src/glsl/glcpp/glcpp-lex.l index a14e580ab1..c81bd044a2 100644 --- a/src/glsl/glcpp/glcpp-lex.l +++ b/src/glsl/glcpp/glcpp-lex.l @@ -100,6 +100,37 @@ HEXADECIMAL_INTEGER 0[xX][0-9a-fA-F]+[uU]? return OTHER; } +{HASH}line{HSPACE}+{DECIMAL_INTEGER}{HSPACE}+{DECIMAL_INTEGER}{HSPACE}*$ { + /* 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{HSPACE}+{DECIMAL_INTEGER}{HSPACE}*$ { + /* 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; +} + {HASH}ifdef/.*\n { yyextra->lexing_if = 1; yyextra->space_tokens = 0; -- cgit v1.2.3 From bd7853768dd7ad52604e3b636ae71dacaa7352fe Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Wed, 18 Aug 2010 17:38:24 -0700 Subject: glcpp: Refresh autogenerated lexer. --- src/glsl/glcpp/glcpp-lex.c | 589 +++++++++++++++++++++++++-------------------- 1 file changed, 326 insertions(+), 263 deletions(-) (limited to 'src') diff --git a/src/glsl/glcpp/glcpp-lex.c b/src/glsl/glcpp/glcpp-lex.c index a0de91a634..1f0a77be8e 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. @@ -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 41 -#define YY_END_OF_BUFFER 42 +#define YY_NUM_RULES 43 +#define YY_END_OF_BUFFER 44 /* This struct is not used in this scanner, but its presence is necessary. */ struct yy_trans_info @@ -367,26 +358,26 @@ struct yy_trans_info flex_int32_t yy_verify; flex_int32_t yy_nxt; }; -static yyconst flex_int16_t yy_acclist[133] = +static yyconst flex_int16_t yy_acclist[137] = { 0, - 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, 1, - 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, 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 + 3, 3, 44, 39, 43, 40, 43, 41, 43, 43, + 38, 43, 43, 38, 43, 38, 43, 38, 43, 25, + 39, 43, 24, 39, 43, 38, 43, 38, 43, 38, + 43, 37, 39, 43, 37, 39, 43, 38, 43, 40, + 43, 23, 43, 43, 3, 43, 4, 43, 5, 43, + 42, 43, 39, 18, 40, 32, 35, 33, 2, 1, + 25, 39, 25, 39, 39, 24, 39, 24, 39, 27, + 29, 31, 30, 28, 37, 39, 37, 39, 34, 40, + 23, 23, 3, 4, 5, 6, 5, 7, 1, 26, + 39, 37, 39,16398, 26, 39, 37, 39, 18, 37, + + 39,16399,16400, 8206, 18, 8206, 37, 39, 8207, 18, + 8208, 18,16401, 19,16396, 22, 36, 37, 39, 21, + 8209, 18, 19, 8204, 18,16397,16404, 8205, 18, 11, + 18, 9, 8, 8212, 10, 18 } ; -static yyconst flex_int16_t yy_accept[151] = +static yyconst flex_int16_t yy_accept[166] = { 0, 1, 1, 1, 1, 1, 2, 3, 3, 3, 4, 6, 8, 10, 11, 13, 14, 16, 18, 20, 23, @@ -394,16 +385,18 @@ static yyconst flex_int16_t yy_accept[151] = 47, 49, 51, 53, 54, 54, 55, 56, 57, 58, 59, 60, 61, 63, 65, 66, 68, 70, 71, 72, 73, 74, 75, 77, 79, 80, 81, 82, 83, 83, - 83, 83, 83, 83, 83, 84, 85, 86, 87, 88, - 89, 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, 132, 132, 132, 133, 133, 133 + 83, 83, 83, 83, 83, 83, 84, 85, 86, 87, + 88, 89, 90, 92, 94, 94, 94, 94, 94, 94, + 95, 95, 95, 95, 95, 97, 99, 99, 99, 99, + 99, 99, 99, 99, 100, 100, 100, 100, 100, 100, + + 100, 102, 102, 103, 104, 104, 104, 104, 104, 106, + 106, 107, 107, 107, 107, 107, 107, 107, 109, 109, + 109, 111, 111, 113, 114, 115, 115, 116, 116, 116, + 116, 117, 117, 120, 121, 121, 123, 124, 124, 124, + 126, 127, 127, 127, 127, 128, 128, 128, 130, 130, + 132, 132, 132, 133, 134, 134, 134, 134, 135, 135, + 135, 137, 137, 137, 137 } ; static yyconst flex_int32_t yy_ec[256] = @@ -446,51 +439,55 @@ 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[184] = { 0, - 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, 162, 159, 227, 229, 230, 234, 199, 303, 232, - 235, 236, 262, 56, 243, 237, 247, 245, 252, 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 + 0, 38, 0, 0, 38, 39, 465, 464, 466, 48, + 43, 665, 462, 44, 63, 460, 59, 65, 87, 125, + 58, 67, 68, 164, 203, 40, 75, 241, 665, 459, + 665, 140, 665, 140, 458, 665, 144, 457, 456, 452, + 451, 450, 156, 179, 267, 0, 209, 449, 448, 447, + 446, 445, 381, 124, 401, 153, 397, 396, 154, 198, + 159, 155, 183, 160, 193, 398, 665, 222, 665, 227, + 665, 397, 204, 161, 231, 232, 238, 243, 236, 303, + 245, 180, 247, 249, 281, 56, 257, 271, 248, 259, + 252, 264, 396, 395, 297, 299, 312, 313, 320, 294, + + 373, 295, 393, 391, 321, 296, 324, 390, 665, 389, + 665, 327, 329, 195, 328, 331, 332, 230, 334, 388, + 665, 386, 665, 378, 372, 335, 367, 337, 347, 342, + 360, 340, 331, 255, 348, 665, 260, 338, 246, 665, + 197, 370, 192, 344, 406, 345, 186, 665, 364, 665, + 444, 377, 184, 141, 480, 365, 518, 79, 554, 383, + 665, 592, 385, 665, 628, 630, 632, 634, 636, 638, + 71, 640, 642, 644, 646, 648, 650, 652, 654, 656, + 658, 660, 662 } ; -static yyconst flex_int16_t yy_def[169] = +static yyconst flex_int16_t yy_def[184] = { 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, 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, 154, 168, 154, 154, 168, 0, 149, - 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, - 149, 149, 149, 149, 149, 149, 149, 149 + 164, 1, 165, 165, 166, 166, 167, 167, 164, 168, + 169, 164, 169, 169, 169, 169, 169, 169, 164, 168, + 169, 169, 169, 170, 170, 169, 169, 169, 164, 171, + 164, 172, 164, 20, 169, 164, 169, 169, 169, 169, + 169, 173, 19, 20, 20, 20, 20, 169, 169, 169, + 169, 169, 25, 25, 169, 169, 28, 28, 169, 169, + 169, 169, 169, 169, 169, 171, 164, 172, 164, 172, + 164, 173, 45, 25, 169, 169, 169, 169, 169, 169, + 169, 169, 169, 169, 20, 25, 169, 169, 169, 169, + 169, 169, 174, 175, 169, 169, 169, 169, 169, 169, + + 25, 169, 176, 177, 169, 169, 169, 174, 164, 175, + 164, 169, 169, 169, 169, 169, 169, 25, 169, 176, + 164, 177, 164, 178, 179, 169, 180, 169, 169, 169, + 169, 169, 25, 169, 178, 164, 179, 169, 180, 164, + 181, 169, 182, 169, 164, 169, 181, 164, 169, 164, + 169, 169, 182, 169, 183, 169, 169, 169, 183, 169, + 164, 169, 169, 0, 164, 164, 164, 164, 164, 164, + 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, + 164, 164, 164 } ; -static yyconst flex_int16_t yy_nxt[589] = +static yyconst flex_int16_t yy_nxt[705] = { 0, 10, 11, 12, 13, 14, 15, 16, 17, 16, 16, 18, 19, 20, 20, 21, 22, 23, 24, 24, 24, @@ -499,66 +496,80 @@ static yyconst flex_int16_t yy_nxt[589] = 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, 98, 35, 34, 35, 36, + 36, 66, 48, 49, 41, 42, 56, 36, 55, 53, + 57, 36, 50, 51, 52, 101, 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, 73, 69, - 70, 34, 34, 34, 56, 36, 36, 36, 57, 34, + 35, 35, 69, 36, 47, 37, 36, 53, 74, 70, + 71, 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, 74, 35, 35, - 35, 83, 53, 79, 36, 84, 142, 80, 68, 81, - 34, 34, 34, 34, 36, 149, 149, 83, 34, 36, - - 36, 36, 35, 34, 35, 36, 35, 35, 35, 35, - 35, 35, 35, 35, 34, 82, 68, 35, 35, 35, - 34, 34, 34, 69, 70, 75, 54, 76, 34, 36, - 77, 36, 36, 90, 36, 78, 36, 36, 36, 36, - 36, 35, 58, 36, 34, 36, 39, 36, 142, 36, - 135, 85, 88, 95, 36, 86, 36, 96, 36, 36, - 110, 100, 87, 59, 60, 36, 89, 61, 97, 99, - 101, 102, 62, 34, 34, 34, 63, 64, 72, 72, - 72, 34, 103, 127, 72, 115, 34, 113, 72, 72, - 72, 72, 122, 36, 36, 36, 36, 34, 36, 36, - - 36, 36, 34, 91, 91, 92, 91, 91, 91, 91, - 91, 91, 91, 91, 104, 109, 112, 91, 91, 91, - 124, 111, 120, 123, 36, 93, 121, 36, 128, 53, - 36, 36, 94, 36, 36, 36, 139, 36, 36, 36, - 36, 91, 131, 53, 36, 135, 36, 131, 119, 126, - 125, 129, 117, 137, 108, 136, 106, 119, 117, 114, - 108, 106, 133, 138, 140, 144, 35, 139, 36, 35, + 35, 35, 35, 35, 35, 34, 34, 75, 35, 35, + 35, 81, 36, 80, 53, 36, 36, 86, 148, 83, + 34, 34, 34, 34, 36, 36, 129, 36, 34, 148, + + 36, 98, 35, 34, 35, 36, 35, 35, 35, 35, + 35, 35, 35, 35, 34, 82, 84, 35, 35, 35, + 34, 34, 34, 85, 69, 76, 54, 77, 34, 69, + 78, 164, 164, 36, 36, 79, 70, 71, 36, 85, + 36, 35, 58, 36, 34, 36, 39, 36, 140, 36, + 36, 36, 133, 53, 36, 87, 145, 36, 88, 36, + 90, 36, 36, 59, 60, 89, 36, 61, 62, 99, + 92, 104, 63, 36, 97, 91, 64, 65, 73, 73, + 73, 100, 106, 102, 73, 105, 34, 107, 73, 73, + 73, 73, 34, 34, 34, 103, 36, 36, 36, 36, + + 34, 36, 34, 93, 93, 94, 93, 93, 93, 93, + 93, 93, 93, 93, 36, 36, 34, 93, 93, 93, + 112, 113, 36, 36, 119, 95, 36, 117, 125, 36, + 36, 36, 96, 36, 36, 114, 36, 36, 115, 36, + 36, 93, 36, 116, 36, 124, 36, 36, 129, 36, + 136, 127, 128, 126, 53, 131, 130, 134, 132, 142, + 142, 141, 36, 143, 146, 149, 150, 36, 138, 140, + 144, 149, 150, 154, 36, 156, 157, 157, 149, 150, + 136, 151, 151, 151, 160, 161, 160, 161, 123, 152, + 121, 111, 109, 123, 143, 121, 118, 111, 109, 36, + + 67, 35, 35, 36, 53, 152, 35, 145, 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, 36, 66, 35, 35, - 36, 53, 36, 36, 36, 36, 36, 36, 36, 36, - 36, 36, 36, 36, 66, 36, 36, 149, 29, 29, - 149, 149, 149, 146, 35, 35, 36, 35, 35, 35, - 35, 35, 147, 35, 35, 137, 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, 105, 105, - 107, 107, 116, 116, 118, 118, 130, 130, 132, 132, - 134, 134, 141, 141, 143, 143, 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 + 35, 35, 35, 155, 155, 155, 155, 155, 155, 155, + 155, 155, 155, 155, 155, 155, 155, 155, 155, 155, + 155, 155, 155, 155, 35, 149, 150, 36, 36, 36, + 36, 36, 36, 36, 36, 151, 151, 151, 36, 36, + 36, 67, 36, 152, 36, 164, 29, 29, 164, 164, + 164, 164, 164, 164, 164, 164, 164, 164, 164, 152, + 35, 35, 36, 35, 35, 35, 35, 35, 158, 35, + 35, 164, 164, 164, 35, 35, 35, 164, 164, 164, + + 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, + 164, 164, 164, 164, 164, 164, 164, 164, 35, 160, + 161, 164, 164, 164, 164, 164, 164, 164, 164, 162, + 162, 162, 164, 164, 164, 164, 164, 163, 164, 164, + 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, + 164, 164, 164, 163, 35, 35, 36, 35, 35, 35, + 35, 35, 158, 35, 35, 164, 164, 164, 35, 35, + 35, 164, 164, 164, 164, 164, 164, 164, 164, 164, + 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, + 164, 164, 35, 160, 161, 164, 164, 164, 164, 164, + + 164, 164, 164, 162, 162, 162, 164, 164, 164, 164, + 164, 163, 164, 164, 164, 164, 164, 164, 164, 164, + 164, 164, 164, 164, 164, 164, 164, 163, 29, 29, + 30, 30, 33, 33, 34, 34, 35, 35, 53, 53, + 68, 68, 72, 72, 108, 108, 110, 110, 120, 120, + 122, 122, 135, 135, 137, 137, 139, 139, 147, 147, + 153, 153, 159, 159, 9, 164, 164, 164, 164, 164, + 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, + 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, + 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, + + 164, 164, 164, 164 } ; -static yyconst flex_int16_t yy_chk[589] = +static yyconst flex_int16_t yy_chk[705] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, @@ -567,63 +578,77 @@ 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, 84, - 27, 147, 22, 23, 23, 84, 10, 19, 19, 19, + 23, 171, 21, 21, 18, 18, 27, 27, 26, 86, + 27, 158, 22, 23, 23, 86, 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, 154, 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, + 20, 61, 64, 20, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 34, 43, 59, 24, 24, - 24, 72, 73, 61, 143, 73, 141, 62, 67, 63, - 44, 44, 44, 43, 64, 67, 67, 72, 44, 137, - - 60, 78, 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, 74, - 60, 75, 76, 78, 80, 60, 77, 81, 82, 86, - 94, 25, 28, 28, 47, 85, 28, 88, 136, 87, - 134, 74, 76, 80, 89, 75, 97, 81, 99, 113, - 94, 86, 75, 28, 28, 104, 77, 28, 82, 85, - 87, 88, 28, 83, 83, 83, 28, 28, 45, 45, - 45, 83, 89, 113, 45, 99, 45, 97, 45, 45, - 45, 45, 104, 90, 93, 96, 103, 83, 95, 110, - - 102, 109, 45, 79, 79, 79, 79, 79, 79, 79, - 79, 79, 79, 79, 90, 93, 96, 79, 79, 79, - 110, 95, 102, 109, 111, 79, 103, 112, 114, 114, - 115, 122, 79, 124, 125, 127, 129, 129, 138, 132, - 133, 79, 130, 128, 126, 123, 121, 120, 118, 112, - 111, 115, 116, 125, 107, 124, 105, 101, 100, 98, - 92, 91, 122, 127, 133, 138, 139, 139, 139, 139, - 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, - 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, - 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, - - 139, 139, 139, 139, 139, 140, 71, 65, 58, 57, - 55, 53, 52, 51, 50, 49, 48, 42, 146, 41, - 40, 39, 38, 35, 30, 16, 13, 9, 8, 7, - 0, 0, 0, 140, 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, + 24, 62, 82, 61, 74, 63, 153, 74, 147, 64, + 44, 44, 44, 43, 143, 65, 114, 114, 44, 141, + + 60, 82, 24, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 44, 63, 65, 25, 25, 25, + 47, 47, 47, 73, 68, 60, 25, 60, 47, 70, + 60, 68, 68, 75, 76, 60, 70, 70, 79, 73, + 77, 25, 28, 28, 47, 78, 28, 81, 139, 83, + 89, 84, 118, 118, 91, 75, 134, 134, 76, 87, + 77, 90, 137, 28, 28, 76, 92, 28, 28, 83, + 79, 89, 28, 88, 81, 78, 28, 28, 45, 45, + 45, 84, 91, 87, 45, 90, 45, 92, 45, 45, + 45, 45, 85, 85, 85, 88, 100, 102, 106, 95, + + 85, 96, 45, 80, 80, 80, 80, 80, 80, 80, + 80, 80, 80, 80, 97, 98, 85, 80, 80, 80, + 95, 96, 99, 105, 102, 80, 107, 100, 106, 112, + 115, 113, 80, 116, 117, 97, 119, 126, 98, 128, + 138, 80, 132, 99, 130, 105, 144, 146, 129, 129, + 135, 112, 113, 107, 133, 116, 115, 119, 117, 129, + 129, 128, 131, 130, 138, 149, 149, 156, 126, 127, + 132, 142, 142, 144, 125, 146, 149, 149, 152, 152, + 124, 142, 142, 142, 160, 160, 163, 163, 122, 142, + 120, 110, 108, 104, 156, 103, 101, 94, 93, 72, + + 66, 58, 57, 55, 53, 142, 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, 145, 145, 145, 145, 145, 145, + 145, 145, 145, 145, 145, 151, 151, 52, 51, 50, + 49, 48, 42, 41, 40, 151, 151, 151, 39, 38, + 35, 30, 16, 151, 13, 9, 8, 7, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 151, + 155, 155, 155, 155, 155, 155, 155, 155, 155, 155, + 155, 0, 0, 0, 155, 155, 155, 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, 155, 157, + 157, 0, 0, 0, 0, 0, 0, 0, 0, 157, + 157, 157, 0, 0, 0, 0, 0, 157, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - + 0, 0, 0, 157, 159, 159, 159, 159, 159, 159, + 159, 159, 159, 159, 159, 0, 0, 0, 159, 159, + 159, 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, 0, 159, 162, 162, 0, 0, 0, 0, 0, + + 0, 0, 0, 162, 162, 162, 0, 0, 0, 0, + 0, 162, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 162, 165, 165, + 166, 166, 167, 167, 168, 168, 169, 169, 170, 170, + 172, 172, 173, 173, 174, 174, 175, 175, 176, 176, + 177, 177, 178, 178, 179, 179, 180, 180, 181, 181, + 182, 182, 183, 183, 164, 164, 164, 164, 164, 164, + 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, + 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, + 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, + + 164, 164, 164, 164 } ; #define YY_TRAILING_MASK 0x2000 @@ -690,7 +715,7 @@ void glcpp_set_column (int column_no , yyscan_t yyscanner); } while(0); #define YY_USER_INIT yylineno = 1; yycolumn = 1; -#line 694 "glcpp/glcpp-lex.c" +#line 719 "glcpp/glcpp-lex.c" #define INITIAL 0 #define DONE 1 @@ -837,12 +862,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. */ @@ -850,7 +870,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, @@ -861,7 +881,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; \ @@ -953,7 +973,7 @@ YY_DECL /* Single-line comments */ -#line 957 "glcpp/glcpp-lex.c" +#line 977 "glcpp/glcpp-lex.c" yylval = yylval_param; @@ -1016,14 +1036,14 @@ 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 >= 165 ) 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_current_state != 149 ); + while ( yy_current_state != 164 ); yy_find_action: yy_current_state = *--yyg->yy_state_ptr; @@ -1138,58 +1158,101 @@ YY_RULE_SETUP } YY_BREAK case 10: -/* rule 10 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 103 "glcpp/glcpp-lex.l" { - yyextra->lexing_if = 1; - yyextra->space_tokens = 0; - return HASH_IFDEF; + /* 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 11: -/* rule 11 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 109 "glcpp/glcpp-lex.l" +#line 119 "glcpp/glcpp-lex.l" { - yyextra->lexing_if = 1; - yyextra->space_tokens = 0; - return HASH_IFNDEF; + /* 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 12: /* rule 12 can match eol */ YY_RULE_SETUP -#line 115 "glcpp/glcpp-lex.l" +#line 134 "glcpp/glcpp-lex.l" { yyextra->lexing_if = 1; yyextra->space_tokens = 0; - return HASH_IF; + return HASH_IFDEF; } YY_BREAK case 13: /* rule 13 can match eol */ YY_RULE_SETUP -#line 121 "glcpp/glcpp-lex.l" +#line 140 "glcpp/glcpp-lex.l" { yyextra->lexing_if = 1; yyextra->space_tokens = 0; - return HASH_ELIF; + return HASH_IFNDEF; } YY_BREAK case 14: /* rule 14 can match eol */ YY_RULE_SETUP -#line 127 "glcpp/glcpp-lex.l" +#line 146 "glcpp/glcpp-lex.l" { + yyextra->lexing_if = 1; yyextra->space_tokens = 0; - return HASH_ELSE; + return HASH_IF; } YY_BREAK case 15: /* rule 15 can match eol */ YY_RULE_SETUP -#line 132 "glcpp/glcpp-lex.l" +#line 152 "glcpp/glcpp-lex.l" +{ + yyextra->lexing_if = 1; + yyextra->space_tokens = 0; + return HASH_ELIF; +} + YY_BREAK +case 16: +/* rule 16 can match eol */ +YY_RULE_SETUP +#line 158 "glcpp/glcpp-lex.l" +{ + yyextra->space_tokens = 0; + return HASH_ELSE; +} + YY_BREAK +case 17: +/* rule 17 can match eol */ +YY_RULE_SETUP +#line 163 "glcpp/glcpp-lex.l" { yyextra->space_tokens = 0; return HASH_ENDIF; @@ -1203,13 +1266,13 @@ YY_RULE_SETUP * * We use the lexing_if flag to avoid skipping any part of an * if conditional expression. */ -case 16: -/* rule 16 can match eol */ +case 18: +/* rule 18 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 145 "glcpp/glcpp-lex.l" +#line 176 "glcpp/glcpp-lex.l" { /* Since this rule always matches, YY_USER_ACTION gets called for it, * wrongly incrementing yycolumn. We undo that effect here. */ @@ -1222,9 +1285,9 @@ YY_RULE_SETUP } } YY_BREAK -case 17: +case 19: YY_RULE_SETUP -#line 157 "glcpp/glcpp-lex.l" +#line 188 "glcpp/glcpp-lex.l" { char *p; for (p = yytext; !isalpha(p[0]); p++); /* skip " # " */ @@ -1232,168 +1295,168 @@ YY_RULE_SETUP glcpp_error(yylloc, yyextra, "#error%s", p); } YY_BREAK -case 18: +case 20: YY_RULE_SETUP -#line 164 "glcpp/glcpp-lex.l" +#line 195 "glcpp/glcpp-lex.l" { yyextra->space_tokens = 0; return HASH_DEFINE_FUNC; } YY_BREAK -case 19: +case 21: YY_RULE_SETUP -#line 169 "glcpp/glcpp-lex.l" +#line 200 "glcpp/glcpp-lex.l" { yyextra->space_tokens = 0; return HASH_DEFINE_OBJ; } YY_BREAK -case 20: +case 22: YY_RULE_SETUP -#line 174 "glcpp/glcpp-lex.l" +#line 205 "glcpp/glcpp-lex.l" { yyextra->space_tokens = 0; return HASH_UNDEF; } YY_BREAK -case 21: +case 23: YY_RULE_SETUP -#line 179 "glcpp/glcpp-lex.l" +#line 210 "glcpp/glcpp-lex.l" { yyextra->space_tokens = 0; return HASH; } YY_BREAK -case 22: +case 24: YY_RULE_SETUP -#line 184 "glcpp/glcpp-lex.l" +#line 215 "glcpp/glcpp-lex.l" { yylval->str = talloc_strdup (yyextra, yytext); return INTEGER_STRING; } YY_BREAK -case 23: +case 25: YY_RULE_SETUP -#line 189 "glcpp/glcpp-lex.l" +#line 220 "glcpp/glcpp-lex.l" { yylval->str = talloc_strdup (yyextra, yytext); return INTEGER_STRING; } YY_BREAK -case 24: +case 26: YY_RULE_SETUP -#line 194 "glcpp/glcpp-lex.l" +#line 225 "glcpp/glcpp-lex.l" { yylval->str = talloc_strdup (yyextra, yytext); return INTEGER_STRING; } YY_BREAK -case 25: +case 27: YY_RULE_SETUP -#line 199 "glcpp/glcpp-lex.l" +#line 230 "glcpp/glcpp-lex.l" { return LEFT_SHIFT; } YY_BREAK -case 26: +case 28: YY_RULE_SETUP -#line 203 "glcpp/glcpp-lex.l" +#line 234 "glcpp/glcpp-lex.l" { return RIGHT_SHIFT; } YY_BREAK -case 27: +case 29: YY_RULE_SETUP -#line 207 "glcpp/glcpp-lex.l" +#line 238 "glcpp/glcpp-lex.l" { return LESS_OR_EQUAL; } YY_BREAK -case 28: +case 30: YY_RULE_SETUP -#line 211 "glcpp/glcpp-lex.l" +#line 242 "glcpp/glcpp-lex.l" { return GREATER_OR_EQUAL; } YY_BREAK -case 29: +case 31: YY_RULE_SETUP -#line 215 "glcpp/glcpp-lex.l" +#line 246 "glcpp/glcpp-lex.l" { return EQUAL; } YY_BREAK -case 30: +case 32: YY_RULE_SETUP -#line 219 "glcpp/glcpp-lex.l" +#line 250 "glcpp/glcpp-lex.l" { return NOT_EQUAL; } YY_BREAK -case 31: +case 33: YY_RULE_SETUP -#line 223 "glcpp/glcpp-lex.l" +#line 254 "glcpp/glcpp-lex.l" { return AND; } YY_BREAK -case 32: +case 34: YY_RULE_SETUP -#line 227 "glcpp/glcpp-lex.l" +#line 258 "glcpp/glcpp-lex.l" { return OR; } YY_BREAK -case 33: +case 35: YY_RULE_SETUP -#line 231 "glcpp/glcpp-lex.l" +#line 262 "glcpp/glcpp-lex.l" { return PASTE; } YY_BREAK -case 34: +case 36: YY_RULE_SETUP -#line 235 "glcpp/glcpp-lex.l" +#line 266 "glcpp/glcpp-lex.l" { return DEFINED; } YY_BREAK -case 35: +case 37: YY_RULE_SETUP -#line 239 "glcpp/glcpp-lex.l" +#line 270 "glcpp/glcpp-lex.l" { yylval->str = talloc_strdup (yyextra, yytext); return IDENTIFIER; } YY_BREAK -case 36: +case 38: YY_RULE_SETUP -#line 244 "glcpp/glcpp-lex.l" +#line 275 "glcpp/glcpp-lex.l" { return yytext[0]; } YY_BREAK -case 37: +case 39: YY_RULE_SETUP -#line 248 "glcpp/glcpp-lex.l" +#line 279 "glcpp/glcpp-lex.l" { yylval->str = talloc_strdup (yyextra, yytext); return OTHER; } YY_BREAK -case 38: +case 40: YY_RULE_SETUP -#line 253 "glcpp/glcpp-lex.l" +#line 284 "glcpp/glcpp-lex.l" { if (yyextra->space_tokens) { return SPACE; } } YY_BREAK -case 39: -/* rule 39 can match eol */ +case 41: +/* rule 41 can match eol */ YY_RULE_SETUP -#line 259 "glcpp/glcpp-lex.l" +#line 290 "glcpp/glcpp-lex.l" { yyextra->lexing_if = 0; yylineno++; @@ -1403,7 +1466,7 @@ YY_RULE_SETUP YY_BREAK /* Handle missing newline at EOF. */ case YY_STATE_EOF(INITIAL): -#line 267 "glcpp/glcpp-lex.l" +#line 298 "glcpp/glcpp-lex.l" { BEGIN DONE; /* Don't keep matching this rule forever. */ yyextra->lexing_if = 0; @@ -1414,20 +1477,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 40: +case 42: YY_RULE_SETUP -#line 277 "glcpp/glcpp-lex.l" +#line 308 "glcpp/glcpp-lex.l" { unput('.'); yy_top_state(yyextra); } YY_BREAK -case 41: +case 43: YY_RULE_SETUP -#line 282 "glcpp/glcpp-lex.l" +#line 313 "glcpp/glcpp-lex.l" ECHO; YY_BREAK -#line 1431 "glcpp/glcpp-lex.c" +#line 1494 "glcpp/glcpp-lex.c" case YY_STATE_EOF(DONE): case YY_STATE_EOF(COMMENT): case YY_STATE_EOF(UNREACHABLE): @@ -1693,7 +1756,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 >= 165 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; @@ -1717,11 +1780,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 >= 165 ) 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 == 164); if ( ! yy_is_jam ) *yyg->yy_state_ptr++ = yy_current_state; @@ -2166,8 +2229,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. */ @@ -2621,7 +2684,7 @@ void glcpp_free (void * ptr , yyscan_t yyscanner) #define YYTABLES_NAME "yytables" -#line 282 "glcpp/glcpp-lex.l" +#line 313 "glcpp/glcpp-lex.l" -- cgit v1.2.3 From f1d5a9419784e939da1a4bcc482567f315da541a Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 18 Aug 2010 17:39:57 -0700 Subject: glsl: Also strdup the names of uniform list entries for >vec4 types. Fixes double-free since the fix to free all of the uniform list. --- src/glsl/linker.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp index b256574446..2dc569777e 100644 --- a/src/glsl/linker.cpp +++ b/src/glsl/linker.cpp @@ -843,7 +843,7 @@ assign_uniform_locations(struct gl_shader_program *prog) n->u[0].Name = strdup(var->name); for (unsigned j = 1; j < vec4_slots; j++) - n->u[j].Name = n->u[0].Name; + n->u[j].Name = strdup(var->name); hash_table_insert(ht, n, n->u[0].Name); uniforms.push_tail(& n->link); -- cgit v1.2.3 From f5703a54e2f765237e01eef6ddbd019ca6a58e81 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 18 Aug 2010 17:42:34 -0700 Subject: mesa: Don't try to free components of a NULL uniform list. This might happen if we manage to trigger the right linker errors. --- src/mesa/program/prog_uniform.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src') diff --git a/src/mesa/program/prog_uniform.c b/src/mesa/program/prog_uniform.c index 5aa9878d43..28acb8871a 100644 --- a/src/mesa/program/prog_uniform.c +++ b/src/mesa/program/prog_uniform.c @@ -44,6 +44,10 @@ void _mesa_free_uniform_list(struct gl_uniform_list *list) { GLuint i; + + if (!list) + return; + for (i = 0; i < list->NumUniforms; i++) { free((void *) list->Uniforms[i].Name); } -- cgit v1.2.3 From a575067d7029c7af3bb6d650d6bd944ac8bb6bb7 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Wed, 18 Aug 2010 18:49:32 -0700 Subject: mesa: Remove unnecessary heaaders from shaderapi.c. --- src/mesa/main/shaderapi.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'src') diff --git a/src/mesa/main/shaderapi.c b/src/mesa/main/shaderapi.c index 89b9557e84..cc350c93b9 100644 --- a/src/mesa/main/shaderapi.c +++ b/src/mesa/main/shaderapi.c @@ -46,8 +46,6 @@ #include "program/program.h" #include "program/prog_parameter.h" #include "program/prog_uniform.h" -#include "slang/slang_compile.h" -#include "slang/slang_link.h" #include "talloc.h" -- cgit v1.2.3 From 365ce61997a28a0c0dad79e7d3f7616e57f105f5 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Wed, 18 Aug 2010 18:03:22 -0700 Subject: glsl: Replace sscanf in s_expression reader with strspn and strcspn. This seems to give roughly a 20% speedup. --- src/glsl/s_expression.cpp | 49 ++++++++++++++++++++++++++++------------------- src/glsl/s_expression.h | 2 +- 2 files changed, 30 insertions(+), 21 deletions(-) (limited to 'src') diff --git a/src/glsl/s_expression.cpp b/src/glsl/s_expression.cpp index 26be23ea8f..4458c48d6b 100644 --- a/src/glsl/s_expression.cpp +++ b/src/glsl/s_expression.cpp @@ -28,9 +28,9 @@ #include #include "s_expression.h" -s_symbol::s_symbol(const char *tmp) +s_symbol::s_symbol(const char *tmp, size_t n) { - this->str = talloc_strdup (this, tmp); + this->str = talloc_strndup (this, tmp, n); assert(this->str != NULL); } @@ -51,26 +51,34 @@ s_list::length() const 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) + s_expression *expr = NULL; + + // Skip leading spaces. + src += strspn(src, " \v\t\r\n"); + + size_t n = strcspn(src, "( \v\t\r\n)"); + if (n == 0) 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) { + double f = strtod(src, &float_end); + if (float_end != src) { char *int_end = NULL; - int i = strtol(buf, &int_end, 10); + int i = strtol(src, &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); + expr = new(ctx) s_float(f); + else + expr = new(ctx) s_int(i); + } else { + // Not a number; return a symbol. + expr = new(ctx) s_symbol(src, n); } - // Not a number; return a symbol. - return new(ctx) s_symbol(buf); + + src += n; + + return expr; } s_expression * @@ -82,10 +90,10 @@ s_expression::read_expression(void *ctx, const char *&src) if (atom != NULL) return atom; - char c; - int n; - if (sscanf(src, " %c%n", &c, &n) == 1 && c == '(') { - src += n; + // Skip leading spaces. + src += strspn(src, " \v\t\r\n"); + if (src[0] == '(') { + ++src; s_list *list = new(ctx) s_list; s_expression *expr; @@ -93,11 +101,12 @@ s_expression::read_expression(void *ctx, const char *&src) while ((expr = read_expression(ctx, src)) != NULL) { list->subexpressions.push_tail(expr); } - if (sscanf(src, " %c%n", &c, &n) != 1 || c != ')') { + src += strspn(src, " \v\t\r\n"); + if (src[0] != ')') { printf("Unclosed expression (check your parenthesis).\n"); return NULL; } - src += n; + ++src; return list; } return NULL; diff --git a/src/glsl/s_expression.h b/src/glsl/s_expression.h index 1a0c03c218..aa22475a1b 100644 --- a/src/glsl/s_expression.h +++ b/src/glsl/s_expression.h @@ -113,7 +113,7 @@ private: class s_symbol : public s_expression { public: - s_symbol(const char *); + s_symbol(const char *, size_t); bool is_symbol() const { return true; } -- cgit v1.2.3 From af2ef53a2701426d32382e861d8f238a449e9cd9 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 18 Aug 2010 18:01:55 -0700 Subject: mesa: Fix the whining for link failures to actually be under MESA_GLSL=dump. --- src/mesa/program/ir_to_mesa.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src') diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp index 7b0c28e5be..fafc6200be 100644 --- a/src/mesa/program/ir_to_mesa.cpp +++ b/src/mesa/program/ir_to_mesa.cpp @@ -2750,6 +2750,11 @@ _mesa_glsl_link_shader(GLcontext *ctx, struct gl_shader_program *prog) if (prog->LinkStatus) { if (!ctx->Driver.LinkShader(ctx, prog)) { prog->LinkStatus = GL_FALSE; + } + } + + if (ctx->Shader.Flags & GLSL_DUMP) { + if (!prog->LinkStatus) { printf("GLSL shader program %d failed to link\n", prog->Name); } -- cgit v1.2.3 From bad29dc6dad7ed1bff46c67e61dab01f8d82b557 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 18 Aug 2010 21:18:23 -0700 Subject: i965: Don't set the swizzle on an immediate value in the VS. Fixes glsl-vs-if-nested (70.0 is not <= 70.000648 thanks to the swizzle bits getting set). Some safety checks are added to make sure this doesn't happen again as we increase the usage of immediate values in program generation. --- src/mesa/drivers/dri/i965/brw_eu.h | 4 ++++ src/mesa/drivers/dri/i965/brw_vs_emit.c | 11 +++++++---- 2 files changed, 11 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_eu.h b/src/mesa/drivers/dri/i965/brw_eu.h index ffdddd0a38..d15a8f9008 100644 --- a/src/mesa/drivers/dri/i965/brw_eu.h +++ b/src/mesa/drivers/dri/i965/brw_eu.h @@ -633,6 +633,8 @@ static INLINE struct brw_reg brw_swizzle( struct brw_reg reg, GLuint z, GLuint w) { + assert(reg.file != BRW_IMMEDIATE_VALUE); + reg.dw1.bits.swizzle = BRW_SWIZZLE4(BRW_GET_SWZ(reg.dw1.bits.swizzle, x), BRW_GET_SWZ(reg.dw1.bits.swizzle, y), BRW_GET_SWZ(reg.dw1.bits.swizzle, z), @@ -650,6 +652,7 @@ static INLINE struct brw_reg brw_swizzle1( struct brw_reg reg, static INLINE struct brw_reg brw_writemask( struct brw_reg reg, GLuint mask ) { + assert(reg.file != BRW_IMMEDIATE_VALUE); reg.dw1.bits.writemask &= mask; return reg; } @@ -657,6 +660,7 @@ static INLINE struct brw_reg brw_writemask( struct brw_reg reg, static INLINE struct brw_reg brw_set_writemask( struct brw_reg reg, GLuint mask ) { + assert(reg.file != BRW_IMMEDIATE_VALUE); reg.dw1.bits.writemask = mask; return reg; } diff --git a/src/mesa/drivers/dri/i965/brw_vs_emit.c b/src/mesa/drivers/dri/i965/brw_vs_emit.c index 7b946eb0d8..7cbf22f2da 100644 --- a/src/mesa/drivers/dri/i965/brw_vs_emit.c +++ b/src/mesa/drivers/dri/i965/brw_vs_emit.c @@ -1180,10 +1180,12 @@ static struct brw_reg get_arg( struct brw_vs_compile *c, /* Convert 3-bit swizzle to 2-bit. */ - reg.dw1.bits.swizzle = BRW_SWIZZLE4(GET_SWZ(src->Swizzle, 0), - GET_SWZ(src->Swizzle, 1), - GET_SWZ(src->Swizzle, 2), - GET_SWZ(src->Swizzle, 3)); + if (reg.file != BRW_IMMEDIATE_VALUE) { + reg.dw1.bits.swizzle = BRW_SWIZZLE4(GET_SWZ(src->Swizzle, 0), + GET_SWZ(src->Swizzle, 1), + GET_SWZ(src->Swizzle, 2), + GET_SWZ(src->Swizzle, 3)); + } /* Note this is ok for non-swizzle instructions: */ @@ -1229,6 +1231,7 @@ static struct brw_reg get_dst( struct brw_vs_compile *c, reg = brw_null_reg(); } + assert(reg.type != BRW_IMMEDIATE_VALUE); reg.dw1.bits.writemask = dst.WriteMask; return reg; -- cgit v1.2.3 From 8de8c97275e9555183a7e8f2238143657bbe60b2 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 18 Aug 2010 21:21:05 -0700 Subject: i965: Set the if stack pop count when breaking out of a loop inside an if. Otherwise, we might end up with the if stack pointing at the wrong place. Fixes GPU hang with glsl-vs-if-loop. --- src/mesa/drivers/dri/i965/brw_vs_emit.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_vs_emit.c b/src/mesa/drivers/dri/i965/brw_vs_emit.c index 7cbf22f2da..18eb845ed8 100644 --- a/src/mesa/drivers/dri/i965/brw_vs_emit.c +++ b/src/mesa/drivers/dri/i965/brw_vs_emit.c @@ -1562,6 +1562,7 @@ void brw_vs_emit(struct brw_vs_compile *c ) const GLuint nr_insns = c->vp->program.Base.NumInstructions; GLuint insn, if_depth = 0, loop_depth = 0; struct brw_instruction *if_inst[MAX_IF_DEPTH], *loop_inst[MAX_LOOP_DEPTH] = { 0 }; + int if_depth_in_loop[MAX_LOOP_DEPTH]; const struct brw_indirect stack_index = brw_indirect(0, 0); GLuint index; GLuint file; @@ -1575,6 +1576,7 @@ void brw_vs_emit(struct brw_vs_compile *c ) brw_set_compression_control(p, BRW_COMPRESSION_NONE); brw_set_access_mode(p, BRW_ALIGN_16); + if_depth_in_loop[loop_depth] = 0; for (insn = 0; insn < nr_insns; insn++) { GLuint i; @@ -1613,7 +1615,8 @@ void brw_vs_emit(struct brw_vs_compile *c ) const struct prog_instruction *inst = &c->vp->program.Base.Instructions[insn]; struct brw_reg args[3], dst; GLuint i; - + struct brw_instruction *temp; + #if 0 printf("%d: ", insn); _mesa_print_instruction(inst); @@ -1781,6 +1784,7 @@ void brw_vs_emit(struct brw_vs_compile *c ) if_inst[if_depth] = brw_IF(p, BRW_EXECUTE_8); /* Note that brw_IF smashes the predicate_control field. */ if_inst[if_depth]->header.predicate_control = get_predicate(inst); + if_depth_in_loop[loop_depth]++; if_depth++; break; case OPCODE_ELSE: @@ -1790,18 +1794,22 @@ void brw_vs_emit(struct brw_vs_compile *c ) case OPCODE_ENDIF: assert(if_depth > 0); brw_ENDIF(p, if_inst[--if_depth]); + if_depth_in_loop[loop_depth]--; break; case OPCODE_BGNLOOP: loop_inst[loop_depth++] = brw_DO(p, BRW_EXECUTE_8); + if_depth_in_loop[loop_depth] = 0; break; case OPCODE_BRK: brw_set_predicate_control(p, get_predicate(inst)); - brw_BREAK(p); + temp = brw_BREAK(p); + temp->bits3.if_else.pop_count = if_depth_in_loop[loop_depth]; brw_set_predicate_control(p, BRW_PREDICATE_NONE); break; case OPCODE_CONT: brw_set_predicate_control(p, get_predicate(inst)); - brw_CONT(p); + temp = brw_CONT(p); + temp->bits3.if_else.pop_count = if_depth_in_loop[loop_depth]; brw_set_predicate_control(p, BRW_PREDICATE_NONE); break; case OPCODE_ENDLOOP: @@ -1821,12 +1829,10 @@ void brw_vs_emit(struct brw_vs_compile *c ) if (inst0->header.opcode == BRW_OPCODE_BREAK && inst0->bits3.if_else.jump_count == 0) { inst0->bits3.if_else.jump_count = br * (inst1 - inst0 + 1); - inst0->bits3.if_else.pop_count = 0; } else if (inst0->header.opcode == BRW_OPCODE_CONTINUE && inst0->bits3.if_else.jump_count == 0) { inst0->bits3.if_else.jump_count = br * (inst1 - inst0); - inst0->bits3.if_else.pop_count = 0; } } } -- cgit v1.2.3 From 0d48925a56ad4fb253386110b545abda82a25464 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Thu, 19 Aug 2010 11:41:18 +1000 Subject: r600g: add SSG, SEQ, SGT and SNE --- src/gallium/drivers/r600/r600_shader.c | 84 +++++++++++++++++++++++++++++----- src/gallium/drivers/r600/r600_sq.h | 16 +++++++ 2 files changed, 88 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/r600_shader.c b/src/gallium/drivers/r600/r600_shader.c index 828082d10b..3caeaa3a2a 100644 --- a/src/gallium/drivers/r600/r600_shader.c +++ b/src/gallium/drivers/r600/r600_shader.c @@ -684,7 +684,7 @@ static int tgsi_kill(struct r600_shader_ctx *ctx) memset(&alu, 0, sizeof(struct r600_bc_alu)); alu.inst = ctx->inst_info->r600_opcode; alu.dst.chan = i; - alu.src[0].sel = 248; + alu.src[0].sel = SQ_ALU_SRC_0; r = tgsi_src(ctx, &inst->Src[0], &alu.src[1]); if (r) return r; @@ -743,7 +743,7 @@ static int tgsi_lit(struct r600_shader_ctx *ctx) /* dst.x, <- 1.0 */ memset(&alu, 0, sizeof(struct r600_bc_alu)); alu.inst = V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV; - alu.src[0].sel = 249; /*1.0*/ + alu.src[0].sel = SQ_ALU_SRC_1; /*1.0*/ alu.src[0].chan = 0; r = tgsi_dst(ctx, &inst->Dst[0], 0, &alu.dst); if (r) @@ -759,7 +759,7 @@ static int tgsi_lit(struct r600_shader_ctx *ctx) r = tgsi_src(ctx, &inst->Src[0], &alu.src[0]); if (r) return r; - alu.src[1].sel = 248; /*0.0*/ + alu.src[1].sel = SQ_ALU_SRC_0; /*0.0*/ alu.src[1].chan = tgsi_chan(&inst->Src[0], 0); r = tgsi_dst(ctx, &inst->Dst[0], 1, &alu.dst); if (r) @@ -780,7 +780,7 @@ static int tgsi_lit(struct r600_shader_ctx *ctx) /* dst.w, <- 1.0 */ memset(&alu, 0, sizeof(struct r600_bc_alu)); alu.inst = V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV; - alu.src[0].sel = 249; + alu.src[0].sel = SQ_ALU_SRC_1; alu.src[0].chan = 0; r = tgsi_dst(ctx, &inst->Dst[0], 3, &alu.dst); if (r) @@ -919,6 +919,66 @@ static int tgsi_trans_srcx_replicate(struct r600_shader_ctx *ctx) return 0; } +static int tgsi_ssg(struct r600_shader_ctx *ctx) +{ + struct tgsi_full_instruction *inst = &ctx->parse.FullToken.FullInstruction; + struct r600_bc_alu alu; + struct r600_bc_alu_src r600_src[3]; + int i, j, r; + + r = tgsi_split_constant(ctx, r600_src); + if (r) + return r; + + /* tmp = (src > 0 ? 1 : src) */ + for (i = 0; i < 4; i++) { + memset(&alu, 0, sizeof(struct r600_bc_alu)); + alu.inst = V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_CNDGT; + alu.is_op3 = 1; + alu.dst.sel = ctx->temp_reg; + alu.dst.write = 1; + + alu.src[0] = r600_src[0]; + alu.src[0].chan = tgsi_chan(&inst->Src[0], i); + + alu.src[1].sel = SQ_ALU_SRC_1; + + alu.src[2] = r600_src[0]; + alu.src[2].chan = tgsi_chan(&inst->Src[0], i); + if (i == 3) + alu.last = 1; + r = r600_bc_add_alu(ctx->bc, &alu); + if (r) + return r; + } + + /* dst = (-tmp > 0 ? -1 : tmp) */ + for (i = 0; i < 4; i++) { + memset(&alu, 0, sizeof(struct r600_bc_alu)); + alu.inst = V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_CNDGT; + alu.is_op3 = 1; + r = tgsi_dst(ctx, &inst->Dst[0], i, &alu.dst); + if (r) + return r; + + alu.src[0].sel = ctx->temp_reg; + alu.src[0].neg = 1; + + alu.src[1].sel = SQ_ALU_SRC_1; + alu.src[1].neg = 1; + + alu.src[2].sel = ctx->temp_reg; + + alu.dst.write = 1; + if (i == 3) + alu.last = 1; + r = r600_bc_add_alu(ctx->bc, &alu); + if (r) + return r; + } + return 0; +} + static int tgsi_helper_copy(struct r600_shader_ctx *ctx, struct tgsi_full_instruction *inst) { struct r600_bc_alu alu; @@ -1006,13 +1066,13 @@ static int tgsi_dp(struct r600_shader_ctx *ctx) switch (ctx->inst_info->tgsi_opcode) { case TGSI_OPCODE_DP2: if (i > 1) { - alu.src[0].sel = alu.src[1].sel = 248; + alu.src[0].sel = alu.src[1].sel = SQ_ALU_SRC_0; alu.src[0].chan = alu.src[1].chan = 0; } break; case TGSI_OPCODE_DP3: if (i > 2) { - alu.src[0].sel = alu.src[1].sel = 248; + alu.src[0].sel = alu.src[1].sel = SQ_ALU_SRC_0; alu.src[0].chan = alu.src[1].chan = 0; } break; @@ -1069,7 +1129,7 @@ static int tgsi_tex(struct r600_shader_ctx *ctx) } memset(&alu, 0, sizeof(struct r600_bc_alu)); alu.inst = V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV; - alu.src[0].sel = 249; + alu.src[0].sel = SQ_ALU_SRC_1; alu.src[0].chan = 0; alu.dst.sel = ctx->temp_reg; alu.dst.chan = 3; @@ -1136,7 +1196,7 @@ static int tgsi_lrp(struct r600_shader_ctx *ctx) for (i = 0; i < 4; i++) { memset(&alu, 0, sizeof(struct r600_bc_alu)); alu.inst = V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_ADD; - alu.src[0].sel = 249; + alu.src[0].sel = SQ_ALU_SRC_1; alu.src[0].chan = 0; alu.src[1] = r600_src[0]; alu.src[1].chan = tgsi_chan(&inst->Src[0], i); @@ -1249,12 +1309,12 @@ static struct r600_shader_tgsi_instruction r600_shader_tgsi_instruction[] = { {TGSI_OPCODE_PK4B, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported}, {TGSI_OPCODE_PK4UB, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported}, {TGSI_OPCODE_RFL, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported}, - {TGSI_OPCODE_SEQ, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported}, + {TGSI_OPCODE_SEQ, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETE, tgsi_op2}, {TGSI_OPCODE_SFL, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported}, - {TGSI_OPCODE_SGT, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported}, + {TGSI_OPCODE_SGT, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETGT, tgsi_op2}, {TGSI_OPCODE_SIN, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported}, {TGSI_OPCODE_SLE, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETGE, tgsi_slt}, - {TGSI_OPCODE_SNE, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported}, + {TGSI_OPCODE_SNE, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETNE, tgsi_op2}, {TGSI_OPCODE_STR, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported}, {TGSI_OPCODE_TEX, 0, SQ_TEX_INST_SAMPLE, tgsi_tex}, {TGSI_OPCODE_TXD, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported}, @@ -1269,7 +1329,7 @@ static struct r600_shader_tgsi_instruction r600_shader_tgsi_instruction[] = { {TGSI_OPCODE_BRA, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported}, {TGSI_OPCODE_CAL, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported}, {TGSI_OPCODE_RET, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported}, - {TGSI_OPCODE_SSG, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported}, /* SGN */ + {TGSI_OPCODE_SSG, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_ssg}, {TGSI_OPCODE_CMP, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported}, {TGSI_OPCODE_SCS, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported}, {TGSI_OPCODE_TXB, 0, SQ_TEX_INST_SAMPLE_L, tgsi_tex}, diff --git a/src/gallium/drivers/r600/r600_sq.h b/src/gallium/drivers/r600/r600_sq.h index 002660c654..b0ad3d24bd 100644 --- a/src/gallium/drivers/r600/r600_sq.h +++ b/src/gallium/drivers/r600/r600_sq.h @@ -583,4 +583,20 @@ #define G_SQ_TEX_WORD2_SRC_SEL_W(x) (((x) >> 29) & 0x7) #define C_SQ_TEX_WORD2_SRC_SEL_W 0x1FFFFFFF +/* + * 248 SQ_ALU_SRC_0: special constant 0.0. + * 249 SQ_ALU_SRC_1: special constant 1.0 float. + * 250 SQ_ALU_SRC_1_INT: special constant 1 integer. + * 251 SQ_ALU_SRC_M_1_INT: special constant -1 integer. + * 252 SQ_ALU_SRC_0_5: special constant 0.5 float. + * 253 SQ_ALU_SRC_LITERAL: literal constant. + * 254 SQ_ALU_SRC_PV: previous vector result. + * 255 SQ_ALU_SRC_PS: previous scalar result. + */ +#define SQ_ALU_SRC_0 248 +#define SQ_ALU_SRC_1 249 +#define SQ_ALU_SRC_1_INT 250 +#define SQ_ALU_SRC_M_1_INT 251 +#define SQ_ALU_SRC_0_5 252 + #endif -- cgit v1.2.3 From 098064e8cb6950f60c51a44e280cb335f07920b1 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Thu, 19 Aug 2010 14:43:11 +1000 Subject: r600g: add a chiprev type for r600/r700/evergreen instead of using family --- src/gallium/drivers/r600/r600_asm.c | 37 ++++++++++++++++++++++++------------- src/gallium/drivers/r600/r600_asm.h | 1 + 2 files changed, 25 insertions(+), 13 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/r600_asm.c b/src/gallium/drivers/r600/r600_asm.c index 9ea9d4354d..e6efae4c56 100644 --- a/src/gallium/drivers/r600/r600_asm.c +++ b/src/gallium/drivers/r600/r600_asm.c @@ -76,6 +76,27 @@ int r600_bc_init(struct r600_bc *bc, enum radeon_family family) { LIST_INITHEAD(&bc->cf); bc->family = family; + switch (bc->family) { + case CHIP_R600: + case CHIP_RV610: + case CHIP_RV630: + case CHIP_RV670: + case CHIP_RV620: + case CHIP_RV635: + case CHIP_RS780: + case CHIP_RS880: + bc->chiprev = 0; + break; + case CHIP_RV770: + case CHIP_RV730: + case CHIP_RV710: + case CHIP_RV740: + bc->chiprev = 1; + break; + default: + R600_ERR("unknown family %d\n", bc->family); + return -EINVAL; + } return 0; } @@ -418,21 +439,11 @@ int r600_bc_build(struct r600_bc *bc) switch (cf->inst) { case (V_SQ_CF_ALU_WORD1_SQ_CF_INST_ALU << 3): LIST_FOR_EACH_ENTRY(alu, &cf->alu, list) { - switch (bc->family) { - case CHIP_R600: - case CHIP_RV610: - case CHIP_RV630: - case CHIP_RV670: - case CHIP_RV620: - case CHIP_RV635: - case CHIP_RS780: - case CHIP_RS880: + switch(bc->chiprev) { + case 0: r = r600_bc_alu_build(bc, alu, addr); break; - case CHIP_RV770: - case CHIP_RV730: - case CHIP_RV710: - case CHIP_RV740: + case 1: r = r700_bc_alu_build(bc, alu, addr); break; default: diff --git a/src/gallium/drivers/r600/r600_asm.h b/src/gallium/drivers/r600/r600_asm.h index 10d98afaf0..e944bd02de 100644 --- a/src/gallium/drivers/r600/r600_asm.h +++ b/src/gallium/drivers/r600/r600_asm.h @@ -122,6 +122,7 @@ struct r600_bc_cf { struct r600_bc { enum radeon_family family; + int chiprev; /* 0 - r600, 1 - r700, 2 - evergreen */ struct list_head cf; struct r600_bc_cf *cf_last; unsigned ndw; -- cgit v1.2.3 From 88f5976484842671ecb2cefcfa91838a43032359 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Thu, 19 Aug 2010 14:43:44 +1000 Subject: r600g: add sin/cos This pretty much ports the code from r600c, however it doesn't always seem to work quite perfectly, but I can't find anything in this code that is wrong. I'm guessing either literal input or constants aren't working always. --- src/gallium/drivers/r600/r600_shader.c | 124 ++++++++++++++++++++++++++++++++- src/gallium/drivers/r600/r600_sq.h | 1 + 2 files changed, 123 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/r600_shader.c b/src/gallium/drivers/r600/r600_shader.c index 3caeaa3a2a..4d390f9f62 100644 --- a/src/gallium/drivers/r600/r600_shader.c +++ b/src/gallium/drivers/r600/r600_shader.c @@ -674,6 +674,126 @@ static int tgsi_op2(struct r600_shader_ctx *ctx) return 0; } +/* + * r600 - trunc to -PI..PI range + * r700 - normalize by dividing by 2PI + * see fdo bug 27901 + */ +static int tgsi_trig(struct r600_shader_ctx *ctx) +{ + struct tgsi_full_instruction *inst = &ctx->parse.FullToken.FullInstruction; + struct r600_bc_alu_src r600_src[3]; + struct r600_bc_alu alu; + int i, r; + uint32_t lit_vals[4]; + + memset(lit_vals, 0, 4*4); + r = tgsi_split_constant(ctx, r600_src); + if (r) + return r; + lit_vals[0] = fui(1.0 /(3.1415926535 * 2)); + lit_vals[1] = fui(0.5f); + + memset(&alu, 0, sizeof(struct r600_bc_alu)); + alu.inst = V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_MULADD; + alu.is_op3 = 1; + + alu.dst.chan = 0; + alu.dst.sel = ctx->temp_reg; + alu.dst.write = 1; + + alu.src[0] = r600_src[0]; + alu.src[0].chan = tgsi_chan(&inst->Src[0], 0); + + alu.src[1].sel = SQ_ALU_SRC_LITERAL; + alu.src[1].chan = 0; + alu.src[2].sel = SQ_ALU_SRC_LITERAL; + alu.src[2].chan = 1; + alu.last = 1; + r = r600_bc_add_alu(ctx->bc, &alu); + if (r) + return r; + r = r600_bc_add_literal(ctx->bc, lit_vals); + if (r) + return r; + + memset(&alu, 0, sizeof(struct r600_bc_alu)); + alu.inst = V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FRACT; + + alu.dst.chan = 0; + alu.dst.sel = ctx->temp_reg; + alu.dst.write = 1; + + alu.src[0].sel = ctx->temp_reg; + alu.src[0].chan = 0; + alu.last = 1; + r = r600_bc_add_alu(ctx->bc, &alu); + if (r) + return r; + + if (ctx->bc->chiprev == 0) { + lit_vals[0] = fui(3.1415926535897f * 2.0f); + lit_vals[1] = fui(-3.1415926535897f); + } else { + lit_vals[0] = fui(1.0f); + lit_vals[1] = fui(-0.5f); + } + + memset(&alu, 0, sizeof(struct r600_bc_alu)); + alu.inst = V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_MULADD; + alu.is_op3 = 1; + + alu.dst.chan = 0; + alu.dst.sel = ctx->temp_reg; + alu.dst.write = 1; + + alu.src[0].sel = ctx->temp_reg; + alu.src[0].chan = 0; + + alu.src[1].sel = SQ_ALU_SRC_LITERAL; + alu.src[1].chan = 0; + alu.src[2].sel = SQ_ALU_SRC_LITERAL; + alu.src[2].chan = 1; + alu.last = 1; + r = r600_bc_add_alu(ctx->bc, &alu); + if (r) + return r; + r = r600_bc_add_literal(ctx->bc, lit_vals); + if (r) + return r; + + memset(&alu, 0, sizeof(struct r600_bc_alu)); + alu.inst = ctx->inst_info->r600_opcode; + alu.dst.chan = 0; + alu.dst.sel = ctx->temp_reg; + alu.dst.write = 1; + + alu.src[0].sel = ctx->temp_reg; + alu.src[0].chan = 0; + alu.last = 1; + r = r600_bc_add_alu(ctx->bc, &alu); + if (r) + return r; + + /* replicate result */ + for (i = 0; i < 4; i++) { + memset(&alu, 0, sizeof(struct r600_bc_alu)); + alu.src[0].sel = ctx->temp_reg; + alu.inst = V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV; + alu.dst.chan = i; + r = tgsi_dst(ctx, &inst->Dst[0], i, &alu.dst); + if (r) + return r; + alu.dst.write = (inst->Dst[0].Register.WriteMask >> i) & 1; + if (i == 3) + alu.last = 1; + r = r600_bc_add_alu(ctx->bc, &alu); + if (r) + return r; + } + return 0; +} + static int tgsi_kill(struct r600_shader_ctx *ctx) { struct tgsi_full_instruction *inst = &ctx->parse.FullToken.FullInstruction; @@ -1300,7 +1420,7 @@ static struct r600_shader_tgsi_instruction r600_shader_tgsi_instruction[] = { {TGSI_OPCODE_ABS, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV, tgsi_op2}, {TGSI_OPCODE_RCC, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported}, {TGSI_OPCODE_DPH, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported}, - {TGSI_OPCODE_COS, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported}, + {TGSI_OPCODE_COS, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_COS, tgsi_trig}, {TGSI_OPCODE_DDX, 0, SQ_TEX_INST_GET_GRADIENTS_H, tgsi_tex}, {TGSI_OPCODE_DDY, 0, SQ_TEX_INST_GET_GRADIENTS_V, tgsi_tex}, {TGSI_OPCODE_KILP, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported}, /* predicated kill */ @@ -1312,7 +1432,7 @@ static struct r600_shader_tgsi_instruction r600_shader_tgsi_instruction[] = { {TGSI_OPCODE_SEQ, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETE, tgsi_op2}, {TGSI_OPCODE_SFL, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported}, {TGSI_OPCODE_SGT, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETGT, tgsi_op2}, - {TGSI_OPCODE_SIN, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported}, + {TGSI_OPCODE_SIN, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SIN, tgsi_trig}, {TGSI_OPCODE_SLE, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETGE, tgsi_slt}, {TGSI_OPCODE_SNE, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETNE, tgsi_op2}, {TGSI_OPCODE_STR, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported}, diff --git a/src/gallium/drivers/r600/r600_sq.h b/src/gallium/drivers/r600/r600_sq.h index b0ad3d24bd..da717783aa 100644 --- a/src/gallium/drivers/r600/r600_sq.h +++ b/src/gallium/drivers/r600/r600_sq.h @@ -598,5 +598,6 @@ #define SQ_ALU_SRC_1_INT 250 #define SQ_ALU_SRC_M_1_INT 251 #define SQ_ALU_SRC_0_5 252 +#define SQ_ALU_SRC_LITERAL 253 #endif -- cgit v1.2.3 From ce29e864588b0fdf36607864df45a3c237781e78 Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Thu, 19 Aug 2010 13:45:29 +0800 Subject: st/egl: Fix win32 build. Add new source files to SConscripts. --- src/egl/main/SConscript | 1 + src/gallium/state_trackers/egl/SConscript | 1 + 2 files changed, 2 insertions(+) (limited to 'src') diff --git a/src/egl/main/SConscript b/src/egl/main/SConscript index 3d7ae3a8e4..c7ba45c0d6 100644 --- a/src/egl/main/SConscript +++ b/src/egl/main/SConscript @@ -36,6 +36,7 @@ if env['platform'] != 'winddk': 'eglscreen.c', 'eglstring.c', 'eglsurface.c', + 'eglsync.c', ] egl = env.SharedLibrary( diff --git a/src/gallium/state_trackers/egl/SConscript b/src/gallium/state_trackers/egl/SConscript index e71aec35b7..efcce25e31 100644 --- a/src/gallium/state_trackers/egl/SConscript +++ b/src/gallium/state_trackers/egl/SConscript @@ -21,6 +21,7 @@ if 'egl' in env['statetrackers']: 'common/egl_g3d_api.c', 'common/egl_g3d_image.c', 'common/egl_g3d_st.c', + 'common/egl_g3d_sync.c', 'common/native_helper.c', ] -- cgit v1.2.3 From 11726c4e867c78c4b7aca2ea04d1dfa19ae622fb Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Thu, 19 Aug 2010 00:29:59 -0700 Subject: i915: Remove unnecessary header from i830_context.c. --- src/mesa/drivers/dri/i915/i830_context.c | 1 - 1 file changed, 1 deletion(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i915/i830_context.c b/src/mesa/drivers/dri/i915/i830_context.c index d52ea9812f..8ddce6d82a 100644 --- a/src/mesa/drivers/dri/i915/i830_context.c +++ b/src/mesa/drivers/dri/i915/i830_context.c @@ -27,7 +27,6 @@ #include "i830_context.h" #include "main/imports.h" -#include "texmem.h" #include "tnl/tnl.h" #include "tnl/t_vertex.h" #include "tnl/t_context.h" -- cgit v1.2.3 From 18f207310b3c7dd7207d56e86a80b2e1d23c5364 Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Thu, 19 Aug 2010 10:03:03 +0200 Subject: translate_sse: fix emit_load_sse2 --- src/gallium/auxiliary/translate/translate_sse.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/gallium/auxiliary/translate/translate_sse.c b/src/gallium/auxiliary/translate/translate_sse.c index 48e59590bc..06b8f32fe6 100644 --- a/src/gallium/auxiliary/translate/translate_sse.c +++ b/src/gallium/auxiliary/translate/translate_sse.c @@ -190,11 +190,13 @@ static boolean emit_load_sse2( struct translate_sse *p, case 2: x86_movzx16(p->func, tmp, src); sse2_movd(p->func, data, tmp); + break; case 3: x86_movzx8(p->func, tmp, x86_make_disp(src, 2)); x86_shl_imm(p->func, tmp, 16); x86_mov16(p->func, tmp, src); sse2_movd(p->func, data, tmp); + break; case 4: sse2_movd(p->func, data, src); break; -- cgit v1.2.3 From c54dea66fd86f6000e334c703ea4890179c39c81 Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Thu, 19 Aug 2010 10:07:58 +0200 Subject: translate_sse: try to fix Win64 Not sure whether it works now (it is still disabled). --- src/gallium/auxiliary/rtasm/rtasm_x86sse.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/auxiliary/rtasm/rtasm_x86sse.c b/src/gallium/auxiliary/rtasm/rtasm_x86sse.c index 0fe6ebfcb4..75b0f6a68e 100644 --- a/src/gallium/auxiliary/rtasm/rtasm_x86sse.c +++ b/src/gallium/auxiliary/rtasm/rtasm_x86sse.c @@ -2105,8 +2105,9 @@ struct x86_reg x86_fn_arg( struct x86_function *p, case 4: return x86_make_reg(file_REG32, reg_R9); default: + /* Win64 allocates stack slots as if it pushed the first 4 arguments too */ return x86_make_disp(x86_make_reg(file_REG32, reg_SP), - p->stack_offset + (arg - 4) * 8); /* ??? */ + p->stack_offset + arg * 8); } case X86_64_STD_ABI: switch(arg) -- cgit v1.2.3 From 076c53879b90855ecf38602584f22e4ab6db7569 Mon Sep 17 00:00:00 2001 From: Alex Deucher Date: Thu, 19 Aug 2010 12:06:20 -0400 Subject: r600g: update comments about ALU src operands --- src/gallium/drivers/r600/r600_shader.c | 10 ++++++++-- src/gallium/drivers/r600/r600_sq.h | 4 ++++ 2 files changed, 12 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/r600_shader.c b/src/gallium/drivers/r600/r600_shader.c index 4d390f9f62..455730320e 100644 --- a/src/gallium/drivers/r600/r600_shader.c +++ b/src/gallium/drivers/r600/r600_shader.c @@ -362,9 +362,15 @@ int r600_shader_from_tgsi(const struct tgsi_token *tokens, struct r600_shader *s shader->processor_type = ctx.type; /* register allocations */ - /* Values [0,127] correspond to GPR[0..127]. - * Values [256,511] correspond to cfile constants c[0..255]. + /* Values [0,127] correspond to GPR[0..127]. + * Values [128,159] correspond to constant buffer bank 0 + * Values [160,191] correspond to constant buffer bank 1 + * Values [256,511] correspond to cfile constants c[0..255]. * Other special values are shown in the list below. + * 244 ALU_SRC_1_DBL_L: special constant 1.0 double-float, LSW. (RV670+) + * 245 ALU_SRC_1_DBL_M: special constant 1.0 double-float, MSW. (RV670+) + * 246 ALU_SRC_0_5_DBL_L: special constant 0.5 double-float, LSW. (RV670+) + * 247 ALU_SRC_0_5_DBL_M: special constant 0.5 double-float, MSW. (RV670+) * 248 SQ_ALU_SRC_0: special constant 0.0. * 249 SQ_ALU_SRC_1: special constant 1.0 float. * 250 SQ_ALU_SRC_1_INT: special constant 1 integer. diff --git a/src/gallium/drivers/r600/r600_sq.h b/src/gallium/drivers/r600/r600_sq.h index da717783aa..819624e689 100644 --- a/src/gallium/drivers/r600/r600_sq.h +++ b/src/gallium/drivers/r600/r600_sq.h @@ -584,6 +584,10 @@ #define C_SQ_TEX_WORD2_SRC_SEL_W 0x1FFFFFFF /* + * 244 ALU_SRC_1_DBL_L: special constant 1.0 double-float, LSW. (RV670+) + * 245 ALU_SRC_1_DBL_M: special constant 1.0 double-float, MSW. (RV670+) + * 246 ALU_SRC_0_5_DBL_L: special constant 0.5 double-float, LSW. (RV670+) + * 247 ALU_SRC_0_5_DBL_M: special constant 0.5 double-float, MSW. (RV670+) * 248 SQ_ALU_SRC_0: special constant 0.0. * 249 SQ_ALU_SRC_1: special constant 1.0 float. * 250 SQ_ALU_SRC_1_INT: special constant 1 integer. -- cgit v1.2.3 From 06991d87bedaaba5dde65027caa6fb49325b754e Mon Sep 17 00:00:00 2001 From: Marek Olšák Date: Thu, 19 Aug 2010 22:18:40 +0200 Subject: r300g: do not use fastfill with 16-bit zbuffers To my knowledge, there is no way to flush zmask and thus write the clear value. This fixes zbuffer reads, among other things. --- src/gallium/drivers/r300/r300_hyperz.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_hyperz.c b/src/gallium/drivers/r300/r300_hyperz.c index a471b7353b..b2526d6e41 100644 --- a/src/gallium/drivers/r300/r300_hyperz.c +++ b/src/gallium/drivers/r300/r300_hyperz.c @@ -357,6 +357,10 @@ void r300_zmask_alloc_block(struct r300_context *r300, struct r300_surface *surf tex->desc.b.b.target != PIPE_TEXTURE_2D) return; + /* Cannot flush zmask of 16-bit zbuffers. */ + if (util_format_get_blocksizebits(tex->desc.b.b.format) == 16) + return; + if (tex->zmask_mem[level]) return; -- cgit v1.2.3 From a9b20d45974045397b95b08a7a26e2b0aa8e32cf Mon Sep 17 00:00:00 2001 From: Marek Olšák Date: Thu, 19 Aug 2010 23:32:04 +0200 Subject: u_blitter: fix a memory leak --- src/gallium/auxiliary/util/u_blitter.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/gallium/auxiliary/util/u_blitter.c b/src/gallium/auxiliary/util/u_blitter.c index b5b86b7214..49ee7bb31d 100644 --- a/src/gallium/auxiliary/util/u_blitter.c +++ b/src/gallium/auxiliary/util/u_blitter.c @@ -254,6 +254,7 @@ void util_blitter_destroy(struct blitter_context *blitter) ctx->dsa_write_depth_keep_stencil); pipe->delete_depth_stencil_alpha_state(pipe, ctx->dsa_write_depth_stencil); pipe->delete_depth_stencil_alpha_state(pipe, ctx->dsa_keep_depth_write_stencil); + pipe->delete_depth_stencil_alpha_state(pipe, ctx->dsa_flush_depth_stencil); pipe->delete_rasterizer_state(pipe, ctx->rs_state); pipe->delete_vs_state(pipe, ctx->vs_col); -- cgit v1.2.3 From d3fe699b0b2d46480b699b3fa4c77e41eea8d30d Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Fri, 20 Aug 2010 00:04:30 +0200 Subject: translate_sse: enable on Win64 According to Vinson, enabling it causes no regressions --- src/gallium/auxiliary/translate/translate.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src') diff --git a/src/gallium/auxiliary/translate/translate.c b/src/gallium/auxiliary/translate/translate.c index 03a7f050aa..73287b667d 100644 --- a/src/gallium/auxiliary/translate/translate.c +++ b/src/gallium/auxiliary/translate/translate.c @@ -38,8 +38,7 @@ struct translate *translate_create( const struct translate_key *key ) { struct translate *translate = NULL; -/* TODO: enable Win64 once it has actually been tested */ -#if defined(PIPE_ARCH_X86) || (defined(PIPE_ARCH_X86_64) && !defined(_WIN64)) +#if defined(PIPE_ARCH_X86) || defined(PIPE_ARCH_X86_64) translate = translate_sse2_create( key ); if (translate) return translate; -- cgit v1.2.3 From 48dca27e33b333ee7ed16287a348db16eef02ac1 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Thu, 19 Aug 2010 17:07:28 -0700 Subject: mesa: Silence uninitialized variable warnings in dummy_enum_func. --- src/mesa/main/context.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index b01fed1781..6205d3456a 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -339,16 +339,16 @@ _mesa_destroy_visual( GLvisual *vis ) static void dummy_enum_func(void) { - gl_buffer_index bi; - gl_colortable_index ci; - gl_face_index fi; - gl_frag_attrib fa; - gl_frag_result fr; - gl_texture_index ti; - gl_vert_attrib va; - gl_vert_result vr; - gl_geom_attrib ga; - gl_geom_result gr; + gl_buffer_index bi = BUFFER_FRONT_LEFT; + gl_colortable_index ci = COLORTABLE_PRECONVOLUTION; + gl_face_index fi = FACE_POS_X; + gl_frag_attrib fa = FRAG_ATTRIB_WPOS; + gl_frag_result fr = FRAG_RESULT_DEPTH; + gl_texture_index ti = TEXTURE_2D_ARRAY_INDEX; + gl_vert_attrib va = VERT_ATTRIB_POS; + gl_vert_result vr = VERT_RESULT_HPOS; + gl_geom_attrib ga = GEOM_ATTRIB_POSITION; + gl_geom_result gr = GEOM_RESULT_POS; (void) bi; (void) ci; -- cgit v1.2.3 From d377abd93fed4f5d27047bf3c8b9a032a21c5224 Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Fri, 20 Aug 2010 02:28:36 +0100 Subject: gallium/docs: Add Galahad --- src/gallium/docs/source/debugging.rst | 4 ++++ src/gallium/docs/source/distro.rst | 9 +++++++++ 2 files changed, 13 insertions(+) (limited to 'src') diff --git a/src/gallium/docs/source/debugging.rst b/src/gallium/docs/source/debugging.rst index 42bda5aee9..e081cbf74e 100644 --- a/src/gallium/docs/source/debugging.rst +++ b/src/gallium/docs/source/debugging.rst @@ -21,6 +21,10 @@ This option controls if the debug variables should be printed to stderr. This is probably the most useful variable, since it allows you to find which variables a driver uses. +.. envvar:: GALLIUM_GALAHAD (false) + +Controls if the :ref:`galahad` sanity checker module should be used. + .. envvar:: GALLIUM_RBUG (false) Controls if the :ref:`rbug` should be used. diff --git a/src/gallium/docs/source/distro.rst b/src/gallium/docs/source/distro.rst index 70d75b51e6..08c8eab890 100644 --- a/src/gallium/docs/source/distro.rst +++ b/src/gallium/docs/source/distro.rst @@ -79,6 +79,15 @@ Rbug Wrapper driver. :ref:`rbug` driver used with stand alone rbug-gui. +.. _galahad: + +Galahad +^^^^^^^ + +Wrapper driver. Sanity checker for the internal gallium state. Normally +a driver should n't have to sanity check the input it gets from a state +tracker. Any wrong state received should be perceived as a state tracker bug. + State Trackers -------------- -- cgit v1.2.3 From 11fde173c21039fdab18439641ffeb74bddaca9b Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Thu, 19 Aug 2010 23:34:39 -0700 Subject: galahad: Make it obvious on stderr that Galahad's active. --- src/gallium/drivers/galahad/glhd_context.c | 2 ++ src/gallium/drivers/galahad/glhd_screen.c | 2 ++ 2 files changed, 4 insertions(+) (limited to 'src') diff --git a/src/gallium/drivers/galahad/glhd_context.c b/src/gallium/drivers/galahad/glhd_context.c index fe14a287ef..ddf38860ab 100644 --- a/src/gallium/drivers/galahad/glhd_context.c +++ b/src/gallium/drivers/galahad/glhd_context.c @@ -972,5 +972,7 @@ galahad_context_create(struct pipe_screen *_screen, struct pipe_context *pipe) glhd_pipe->pipe = pipe; + glhd_warn("Created context %p", glhd_pipe); + return &glhd_pipe->base; } diff --git a/src/gallium/drivers/galahad/glhd_screen.c b/src/gallium/drivers/galahad/glhd_screen.c index 4117485702..e1a1b59f20 100644 --- a/src/gallium/drivers/galahad/glhd_screen.c +++ b/src/gallium/drivers/galahad/glhd_screen.c @@ -330,5 +330,7 @@ galahad_screen_create(struct pipe_screen *screen) glhd_screen->screen = screen; + glhd_warn("Created screen %p", glhd_screen); + return &glhd_screen->base; } -- cgit v1.2.3 From cdc1c67b9896cd0d919f736fe61a4396bf0ad5c0 Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Fri, 20 Aug 2010 00:00:40 -0700 Subject: galahad, i915g: Move over a few state asserts. --- src/gallium/drivers/galahad/glhd_context.c | 16 ++++++++++++++++ src/gallium/drivers/i915/i915_state.c | 3 --- 2 files changed, 16 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/galahad/glhd_context.c b/src/gallium/drivers/galahad/glhd_context.c index ddf38860ab..10e4679bf1 100644 --- a/src/gallium/drivers/galahad/glhd_context.c +++ b/src/gallium/drivers/galahad/glhd_context.c @@ -185,6 +185,12 @@ galahad_bind_fragment_sampler_states(struct pipe_context *_pipe, struct galahad_context *glhd_pipe = galahad_context(_pipe); struct pipe_context *pipe = glhd_pipe->pipe; + if (num_samplers > PIPE_MAX_SAMPLERS) { + glhd_error("%u fragment samplers requested, " + "but only %u are permitted by API", + num_samplers, PIPE_MAX_SAMPLERS); + } + pipe->bind_fragment_sampler_states(pipe, num_samplers, samplers); @@ -198,6 +204,12 @@ galahad_bind_vertex_sampler_states(struct pipe_context *_pipe, struct galahad_context *glhd_pipe = galahad_context(_pipe); struct pipe_context *pipe = glhd_pipe->pipe; + if (num_samplers > PIPE_MAX_VERTEX_SAMPLERS) { + glhd_error("%u vertex samplers requested, " + "but only %u are permitted by API", + num_samplers, PIPE_MAX_VERTEX_SAMPLERS); + } + pipe->bind_vertex_sampler_states(pipe, num_samplers, samplers); @@ -447,6 +459,10 @@ galahad_set_constant_buffer(struct pipe_context *_pipe, struct pipe_resource *unwrapped_resource; struct pipe_resource *resource = NULL; + if (shader >= PIPE_SHADER_TYPES) { + glhd_error("Unknown shader type %u", shader); + } + /* XXX hmm? unwrap the input state */ if (_resource) { unwrapped_resource = galahad_resource_unwrap(_resource); diff --git a/src/gallium/drivers/i915/i915_state.c b/src/gallium/drivers/i915/i915_state.c index 385c3b2d2d..cbddb214fb 100644 --- a/src/gallium/drivers/i915/i915_state.c +++ b/src/gallium/drivers/i915/i915_state.c @@ -294,8 +294,6 @@ static void i915_bind_sampler_states(struct pipe_context *pipe, struct i915_context *i915 = i915_context(pipe); unsigned i; - assert(num <= PIPE_MAX_SAMPLERS); - /* Check for no-op */ if (num == i915->num_samplers && !memcmp(i915->sampler, sampler, num * sizeof(void *))) @@ -529,7 +527,6 @@ static void i915_set_constant_buffer(struct pipe_context *pipe, struct i915_context *i915 = i915_context(pipe); draw_flush(i915->draw); - assert(shader < PIPE_SHADER_TYPES); assert(index == 0); /* Make a copy of shader constants. -- cgit v1.2.3 From e0ef4800f5deb81ed57dccf8ba39e01c12f4beff Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Fri, 20 Aug 2010 00:18:30 -0700 Subject: galahad, i915g: Copy over constant buffer index check. --- src/gallium/drivers/galahad/glhd_context.c | 9 +++++++++ src/gallium/drivers/i915/i915_state.c | 2 -- 2 files changed, 9 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/galahad/glhd_context.c b/src/gallium/drivers/galahad/glhd_context.c index 10e4679bf1..383c448926 100644 --- a/src/gallium/drivers/galahad/glhd_context.c +++ b/src/gallium/drivers/galahad/glhd_context.c @@ -463,6 +463,15 @@ galahad_set_constant_buffer(struct pipe_context *_pipe, glhd_error("Unknown shader type %u", shader); } + if (index && + index >= + pipe->screen->get_param(pipe->screen, PIPE_CAP_MAX_CONST_BUFFERS)) { + glhd_error("Access to constant buffer %u requested, " + "but only %d are supported", + index, + pipe->screen->get_param(pipe->screen, PIPE_CAP_MAX_CONST_BUFFERS)); + } + /* XXX hmm? unwrap the input state */ if (_resource) { unwrapped_resource = galahad_resource_unwrap(_resource); diff --git a/src/gallium/drivers/i915/i915_state.c b/src/gallium/drivers/i915/i915_state.c index cbddb214fb..8c53b06931 100644 --- a/src/gallium/drivers/i915/i915_state.c +++ b/src/gallium/drivers/i915/i915_state.c @@ -527,8 +527,6 @@ static void i915_set_constant_buffer(struct pipe_context *pipe, struct i915_context *i915 = i915_context(pipe); draw_flush(i915->draw); - assert(index == 0); - /* Make a copy of shader constants. * During fragment program translation we may add additional * constants to the array. -- cgit v1.2.3 From 826a39cb14244820e8539a2328bb52447348f184 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Fri, 20 Aug 2010 02:04:52 -0700 Subject: ast_to_hir: Fix crash when a function shadows a variable. The code would attempt to add a new signature to the ir_function, which didn't exist. Simply bailing out/returning early seems reasonable. Fixes piglit test redeclaration-02.vert, and fixes a crash in redeclaration-03.vert (the test still fails). --- src/glsl/ast_to_hir.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp index bd1ab78d4a..0d2c471f45 100644 --- a/src/glsl/ast_to_hir.cpp +++ b/src/glsl/ast_to_hir.cpp @@ -2149,7 +2149,6 @@ ast_function::hir(exec_list *instructions, 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)) { @@ -2159,7 +2158,7 @@ ast_function::hir(exec_list *instructions, _mesa_glsl_error(& loc, state, "function name `%s' conflicts with " "non-function", name); - sig = NULL; + return NULL; } else { f = new(ctx) ir_function(name); state->symbols->add_function(f->name, f); @@ -2207,6 +2206,8 @@ ast_function_definition::hir(exec_list *instructions, prototype->hir(instructions, state); ir_function_signature *signature = prototype->signature; + if (signature == NULL) + return NULL; assert(state->current_function == NULL); state->current_function = signature; -- cgit v1.2.3 From edd180f03216d2fcb2771aeea34e7015fb2b83c3 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Fri, 20 Aug 2010 02:14:35 -0700 Subject: ast_to_hir: Reject function names that start with "gl_". Fixes piglit test redeclaration-03.vert. --- src/glsl/ast_to_hir.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src') diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp index 0d2c471f45..4188348626 100644 --- a/src/glsl/ast_to_hir.cpp +++ b/src/glsl/ast_to_hir.cpp @@ -2099,6 +2099,18 @@ ast_function::hir(exec_list *instructions, const char *const name = identifier; + /* 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(name, "gl_", 3) == 0) { + YYLTYPE loc = this->get_location(); + _mesa_glsl_error(&loc, state, + "identifier `%s' uses reserved `gl_' prefix", name); + } + /* 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. -- cgit v1.2.3 From 9b3362932df0ec27efd605dfd0838c76111bb23e Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Fri, 20 Aug 2010 02:41:42 -0700 Subject: i965: Fix compile warnings on 64-bit Linux. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit format ‘%d’ expects type ‘int’, but argument 2 has type ‘long int’ --- src/mesa/drivers/dri/i965/brw_wm_debug.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_wm_debug.c b/src/mesa/drivers/dri/i965/brw_wm_debug.c index a78cc8b54e..191670d498 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_debug.c +++ b/src/mesa/drivers/dri/i965/brw_wm_debug.c @@ -44,16 +44,16 @@ void brw_wm_print_value( struct brw_wm_compile *c, printf("undef"); else if( value - c->vreg >= 0 && value - c->vreg < BRW_WM_MAX_VREG) - printf("r%d", value - c->vreg); + printf("r%ld", value - c->vreg); else if (value - c->creg >= 0 && value - c->creg < BRW_WM_MAX_PARAM) - printf("c%d", value - c->creg); + printf("c%ld", value - c->creg); else if (value - c->payload.input_interp >= 0 && value - c->payload.input_interp < FRAG_ATTRIB_MAX) - printf("i%d", value - c->payload.input_interp); + printf("i%ld", value - c->payload.input_interp); else if (value - c->payload.depth >= 0 && value - c->payload.depth < FRAG_ATTRIB_MAX) - printf("d%d", value - c->payload.depth); + printf("d%ld", value - c->payload.depth); else printf("?"); } -- cgit v1.2.3 From 72b3e3fee37413fefe205fa03a111a0180ed19c1 Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Thu, 15 Apr 2010 09:02:29 +0200 Subject: gallium: add PIPE_TEXTURE_RECT target This allows to properly support OpenGL rectangle textures in a well defined way, especially on drivers that don't expose PIPE_CAP_NPOT_TEXTURES. --- src/gallium/docs/source/index.rst | 1 + src/gallium/docs/source/resources.rst | 41 +++++++++++++++++++++++++++++++++++ src/gallium/include/pipe/p_defines.h | 4 +++- 3 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 src/gallium/docs/source/resources.rst (limited to 'src') diff --git a/src/gallium/docs/source/index.rst b/src/gallium/docs/source/index.rst index 6c19842dac..2a73e3ab59 100644 --- a/src/gallium/docs/source/index.rst +++ b/src/gallium/docs/source/index.rst @@ -15,6 +15,7 @@ Contents: debugging tgsi screen + resources context cso distro diff --git a/src/gallium/docs/source/resources.rst b/src/gallium/docs/source/resources.rst new file mode 100644 index 0000000000..a380e5080c --- /dev/null +++ b/src/gallium/docs/source/resources.rst @@ -0,0 +1,41 @@ +Resources +========= + +Resources represent objects that hold data: textures and buffers. + +They are mostly modelled after the resources in Direct3D 10/11, but with a +different transfer/update mechanism, and more features for OpenGL support. + +Resource targets +---------------- + +Resource targets determine the type of a resource. + +Note that drivers may not actually have the restrictions listed regarding +coordinate normalization and wrap modes, and in fact efficient OpenCL +support will probably require drivers that don't have any of them, which +will probably be advertised with an appropriate cap. + +TODO: document all targets. Note that both 3D and cube have restrictions +that depend on the hardware generation. + +TODO: can buffers have a non-R8 format? + +PIPE_TEXTURE_RECT +^^^^^^^^^^^^^^^^^ +2D surface with OpenGL GL_TEXTURE_RECTANGLE semantics. + +depth must be 1 +- last_level must be 0 +- Must use unnormalized coordinates +- Must use a clamp wrap mode + +PIPE_TEXTURE_2D +^^^^^^^^^^^^^^^ +2D surface accessed with normalized coordinates. + +- If PIPE_CAP_NPOT_TEXTURES is not supported, + width and height must be powers of two +- Mipmaps can be used +- Must use normalized coordinates +- No special restrictions on wrap modes diff --git a/src/gallium/include/pipe/p_defines.h b/src/gallium/include/pipe/p_defines.h index 00aa2076ed..35eccf1c90 100644 --- a/src/gallium/include/pipe/p_defines.h +++ b/src/gallium/include/pipe/p_defines.h @@ -135,13 +135,15 @@ enum pipe_error { #define PIPE_STENCIL_OP_DECR_WRAP 6 #define PIPE_STENCIL_OP_INVERT 7 -/** Texture types */ +/** Texture types. + * See the documentation for info on PIPE_TEXTURE_RECT vs PIPE_TEXTURE_2D */ enum pipe_texture_target { PIPE_BUFFER = 0, PIPE_TEXTURE_1D = 1, PIPE_TEXTURE_2D = 2, PIPE_TEXTURE_3D = 3, PIPE_TEXTURE_CUBE = 4, + PIPE_TEXTURE_RECT = 5, PIPE_MAX_TEXTURE_TYPES }; -- cgit v1.2.3 From ae0ef6f69f351cacdc7eaa9b21097a7c1b414e44 Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Wed, 18 Aug 2010 17:28:08 +0200 Subject: gallium: make all checks for PIPE_TEXTURE_2D check for PIPE_TEXTURE_RECT too Searched for them with: git grep -E '[!=]=.*PIPE_TEXTURE_2D|PIPE_TEXTURE_2D.*[!=]=|case.*PIPE_TEXTURE_2D' Behavior hasn't been changed. --- src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c | 7 +++++-- src/gallium/auxiliary/util/u_blit.c | 3 ++- src/gallium/auxiliary/util/u_blitter.c | 3 +++ src/gallium/auxiliary/util/u_gen_mipmap.c | 1 + src/gallium/auxiliary/util/u_surfaces.h | 4 ++-- src/gallium/drivers/i915/i915_resource_texture.c | 5 ++++- src/gallium/drivers/i965/brw_resource_texture.c | 4 +++- src/gallium/drivers/llvmpipe/lp_screen.c | 1 + src/gallium/drivers/llvmpipe/lp_texture.c | 1 + src/gallium/drivers/nv50/nv50_miptree.c | 3 ++- src/gallium/drivers/nv50/nv50_tex.c | 1 + src/gallium/drivers/nvfx/nv30_fragtex.c | 1 + src/gallium/drivers/nvfx/nv40_fragtex.c | 1 + src/gallium/drivers/nvfx/nvfx_miptree.c | 3 ++- src/gallium/drivers/r300/r300_hyperz.c | 3 ++- src/gallium/drivers/r300/r300_texture.c | 6 ++++-- src/gallium/drivers/r300/r300_texture_desc.c | 6 ++++-- src/gallium/drivers/r600/r600_state.c | 1 + src/gallium/drivers/r600/r600_texture.c | 3 ++- src/gallium/drivers/softpipe/sp_screen.c | 1 + src/gallium/drivers/softpipe/sp_tex_sample.c | 2 ++ src/gallium/drivers/svga/svga_resource_texture.c | 3 ++- src/gallium/drivers/svga/svga_tgsi_emit.h | 1 + src/gallium/tests/python/tests/texture_blit.py | 2 +- src/mesa/state_tracker/st_cb_bitmap.c | 2 +- 25 files changed, 50 insertions(+), 18 deletions(-) (limited to 'src') diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c index 806c7d56a8..f6b6162f63 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c @@ -176,6 +176,7 @@ texture_dims(enum pipe_texture_target tex) case PIPE_TEXTURE_1D: return 1; case PIPE_TEXTURE_2D: + case PIPE_TEXTURE_RECT: case PIPE_TEXTURE_CUBE: return 2; case PIPE_TEXTURE_3D: @@ -1749,7 +1750,8 @@ lp_build_sample_2d_linear_aos(struct lp_build_sample_context *bld, LLVMValueRef unswizzled[4]; LLVMValueRef stride; - assert(bld->static_state->target == PIPE_TEXTURE_2D); + assert(bld->static_state->target == PIPE_TEXTURE_2D + || bld->static_state->target == PIPE_TEXTURE_RECT); assert(bld->static_state->min_img_filter == PIPE_TEX_FILTER_LINEAR); assert(bld->static_state->mag_img_filter == PIPE_TEX_FILTER_LINEAR); assert(bld->static_state->min_mip_filter == PIPE_TEX_MIPFILTER_NONE); @@ -2077,7 +2079,8 @@ lp_build_sample_soa(LLVMBuilderRef builder, } else if (util_format_fits_8unorm(bld.format_desc) && bld.format_desc->nr_channels > 1 && - static_state->target == PIPE_TEXTURE_2D && + (static_state->target == PIPE_TEXTURE_2D || + static_state->target == PIPE_TEXTURE_RECT) && static_state->min_img_filter == PIPE_TEX_FILTER_LINEAR && static_state->mag_img_filter == PIPE_TEX_FILTER_LINEAR && static_state->min_mip_filter == PIPE_TEX_MIPFILTER_NONE && diff --git a/src/gallium/auxiliary/util/u_blit.c b/src/gallium/auxiliary/util/u_blit.c index 97fa99ec65..30c7a96462 100644 --- a/src/gallium/auxiliary/util/u_blit.c +++ b/src/gallium/auxiliary/util/u_blit.c @@ -347,7 +347,8 @@ util_blit_pixels_writemask(struct blit_state *ctx, dst->face == srcsub.face && dst->level == srcsub.level && dst->zslice == srcZ0) || - src_tex->target != PIPE_TEXTURE_2D) + (src_tex->target != PIPE_TEXTURE_2D && + src_tex->target != PIPE_TEXTURE_RECT)) { struct pipe_resource texTemp; struct pipe_resource *tex; diff --git a/src/gallium/auxiliary/util/u_blitter.c b/src/gallium/auxiliary/util/u_blitter.c index 49ee7bb31d..4b69a7fb6a 100644 --- a/src/gallium/auxiliary/util/u_blitter.c +++ b/src/gallium/auxiliary/util/u_blitter.c @@ -569,6 +569,8 @@ pipe_tex_to_tgsi_tex(enum pipe_texture_target pipe_tex_target) return TGSI_TEXTURE_1D; case PIPE_TEXTURE_2D: return TGSI_TEXTURE_2D; + case PIPE_TEXTURE_RECT: + return TGSI_TEXTURE_2D; case PIPE_TEXTURE_3D: return TGSI_TEXTURE_3D; case PIPE_TEXTURE_CUBE: @@ -807,6 +809,7 @@ void util_blitter_copy_region(struct blitter_context *blitter, /* Draw the quad with the draw_rectangle callback. */ case PIPE_TEXTURE_1D: case PIPE_TEXTURE_2D: + case PIPE_TEXTURE_RECT: { /* Set texture coordinates. */ float coord[4]; diff --git a/src/gallium/auxiliary/util/u_gen_mipmap.c b/src/gallium/auxiliary/util/u_gen_mipmap.c index b7fe2d3003..6a931a9581 100644 --- a/src/gallium/auxiliary/util/u_gen_mipmap.c +++ b/src/gallium/auxiliary/util/u_gen_mipmap.c @@ -1255,6 +1255,7 @@ fallback_gen_mipmap(struct gen_mipmap_state *ctx, make_1d_mipmap(ctx, pt, face, baseLevel, lastLevel); break; case PIPE_TEXTURE_2D: + case PIPE_TEXTURE_RECT: case PIPE_TEXTURE_CUBE: make_2d_mipmap(ctx, pt, face, baseLevel, lastLevel); break; diff --git a/src/gallium/auxiliary/util/u_surfaces.h b/src/gallium/auxiliary/util/u_surfaces.h index af978c7057..46f3ec5d7d 100644 --- a/src/gallium/auxiliary/util/u_surfaces.h +++ b/src/gallium/auxiliary/util/u_surfaces.h @@ -22,7 +22,7 @@ struct pipe_surface *util_surfaces_do_get(struct util_surfaces *us, unsigned sur static INLINE struct pipe_surface * util_surfaces_get(struct util_surfaces *us, unsigned surface_struct_size, struct pipe_screen *pscreen, struct pipe_resource *pt, unsigned face, unsigned level, unsigned zslice, unsigned flags) { - if(likely(pt->target == PIPE_TEXTURE_2D && us->u.array)) + if(likely((pt->target == PIPE_TEXTURE_2D || pt->target == PIPE_TEXTURE_RECT) && us->u.array)) { struct pipe_surface *ps = us->u.array[level]; if(ps) @@ -52,7 +52,7 @@ void util_surfaces_do_detach(struct util_surfaces *us, struct pipe_surface *ps); static INLINE void util_surfaces_detach(struct util_surfaces *us, struct pipe_surface *ps) { - if(likely(ps->texture->target == PIPE_TEXTURE_2D)) + if(likely(ps->texture->target == PIPE_TEXTURE_2D || ps->texture->target == PIPE_TEXTURE_RECT)) { us->u.array[ps->level] = 0; return; diff --git a/src/gallium/drivers/i915/i915_resource_texture.c b/src/gallium/drivers/i915/i915_resource_texture.c index 752ddaae7b..c5c6179b16 100644 --- a/src/gallium/drivers/i915/i915_resource_texture.c +++ b/src/gallium/drivers/i915/i915_resource_texture.c @@ -360,6 +360,7 @@ i915_texture_layout(struct i915_texture * tex) switch (pt->target) { case PIPE_TEXTURE_1D: case PIPE_TEXTURE_2D: + case PIPE_TEXTURE_RECT: if (!i9x5_special_layout(tex)) i915_texture_layout_2d(tex); break; @@ -605,6 +606,7 @@ i945_texture_layout(struct i915_texture * tex) switch (pt->target) { case PIPE_TEXTURE_1D: case PIPE_TEXTURE_2D: + case PIPE_TEXTURE_RECT: if (!i9x5_special_layout(tex)) i945_texture_layout_2d(tex); break; @@ -829,7 +831,8 @@ i915_texture_from_handle(struct pipe_screen * screen, buffer = iws->buffer_from_handle(iws, whandle, &stride); /* Only supports one type */ - if (template->target != PIPE_TEXTURE_2D || + if ((template->target != PIPE_TEXTURE_2D && + template->target != PIPE_TEXTURE_RECT) || template->last_level != 0 || template->depth0 != 1) { return NULL; diff --git a/src/gallium/drivers/i965/brw_resource_texture.c b/src/gallium/drivers/i965/brw_resource_texture.c index ffd0f38672..3860d18a7a 100644 --- a/src/gallium/drivers/i965/brw_resource_texture.c +++ b/src/gallium/drivers/i965/brw_resource_texture.c @@ -66,6 +66,7 @@ static GLuint translate_tex_target( unsigned target ) return BRW_SURFACE_1D; case PIPE_TEXTURE_2D: + case PIPE_TEXTURE_RECT: return BRW_SURFACE_2D; case PIPE_TEXTURE_3D: @@ -498,7 +499,8 @@ brw_texture_from_handle(struct pipe_screen *screen, unsigned pitch; GLuint format; - if (template->target != PIPE_TEXTURE_2D || + if ((template->target != PIPE_TEXTURE_2D + && template->target != PIPE_TEXTURE_RECT) || template->last_level != 0 || template->depth0 != 1) return NULL; diff --git a/src/gallium/drivers/llvmpipe/lp_screen.c b/src/gallium/drivers/llvmpipe/lp_screen.c index 167cb2ee2e..6968cda629 100644 --- a/src/gallium/drivers/llvmpipe/lp_screen.c +++ b/src/gallium/drivers/llvmpipe/lp_screen.c @@ -230,6 +230,7 @@ llvmpipe_is_format_supported( struct pipe_screen *_screen, assert(target == PIPE_BUFFER || target == PIPE_TEXTURE_1D || target == PIPE_TEXTURE_2D || + target == PIPE_TEXTURE_RECT || target == PIPE_TEXTURE_3D || target == PIPE_TEXTURE_CUBE); diff --git a/src/gallium/drivers/llvmpipe/lp_texture.c b/src/gallium/drivers/llvmpipe/lp_texture.c index 25112c10a6..ff4773fd7c 100644 --- a/src/gallium/drivers/llvmpipe/lp_texture.c +++ b/src/gallium/drivers/llvmpipe/lp_texture.c @@ -67,6 +67,7 @@ resource_is_texture(const struct pipe_resource *resource) return FALSE; case PIPE_TEXTURE_1D: case PIPE_TEXTURE_2D: + case PIPE_TEXTURE_RECT: case PIPE_TEXTURE_3D: case PIPE_TEXTURE_CUBE: return TRUE; diff --git a/src/gallium/drivers/nv50/nv50_miptree.c b/src/gallium/drivers/nv50/nv50_miptree.c index b7cd92158f..c0f5cc10dd 100644 --- a/src/gallium/drivers/nv50/nv50_miptree.c +++ b/src/gallium/drivers/nv50/nv50_miptree.c @@ -235,7 +235,8 @@ nv50_miptree_from_handle(struct pipe_screen *pscreen, unsigned stride; /* Only supports 2D, non-mipmapped textures for the moment */ - if (template->target != PIPE_TEXTURE_2D || + if ((template->target != PIPE_TEXTURE_2D && + template->target != PIPE_TEXTURE_RECT) || template->last_level != 0 || template->depth0 != 1) return NULL; diff --git a/src/gallium/drivers/nv50/nv50_tex.c b/src/gallium/drivers/nv50/nv50_tex.c index 5ea0c1d726..4db53f7ec2 100644 --- a/src/gallium/drivers/nv50/nv50_tex.c +++ b/src/gallium/drivers/nv50/nv50_tex.c @@ -131,6 +131,7 @@ nv50_tex_construct(struct nv50_sampler_view *view) tic[2] |= NV50TIC_0_2_TARGET_1D; break; case PIPE_TEXTURE_2D: + case PIPE_TEXTURE_RECT: tic[2] |= NV50TIC_0_2_TARGET_2D; break; case PIPE_TEXTURE_3D: diff --git a/src/gallium/drivers/nvfx/nv30_fragtex.c b/src/gallium/drivers/nvfx/nv30_fragtex.c index dec073ac90..0cd70ca104 100644 --- a/src/gallium/drivers/nvfx/nv30_fragtex.c +++ b/src/gallium/drivers/nvfx/nv30_fragtex.c @@ -116,6 +116,7 @@ nv30_fragtex_set(struct nvfx_context *nvfx, int unit) txf |= NV34TCL_TX_FORMAT_CUBIC; /* fall-through */ case PIPE_TEXTURE_2D: + case PIPE_TEXTURE_RECT: txf |= NV34TCL_TX_FORMAT_DIMS_2D; break; case PIPE_TEXTURE_3D: diff --git a/src/gallium/drivers/nvfx/nv40_fragtex.c b/src/gallium/drivers/nvfx/nv40_fragtex.c index 0068b1ba54..0d3e90dcb0 100644 --- a/src/gallium/drivers/nvfx/nv40_fragtex.c +++ b/src/gallium/drivers/nvfx/nv40_fragtex.c @@ -135,6 +135,7 @@ nv40_fragtex_set(struct nvfx_context *nvfx, int unit) txf |= NV34TCL_TX_FORMAT_CUBIC; /* fall-through */ case PIPE_TEXTURE_2D: + case PIPE_TEXTURE_RECT: txf |= NV34TCL_TX_FORMAT_DIMS_2D; break; case PIPE_TEXTURE_3D: diff --git a/src/gallium/drivers/nvfx/nvfx_miptree.c b/src/gallium/drivers/nvfx/nvfx_miptree.c index b5639bb464..1fec1ffa42 100644 --- a/src/gallium/drivers/nvfx/nvfx_miptree.c +++ b/src/gallium/drivers/nvfx/nvfx_miptree.c @@ -205,7 +205,8 @@ nvfx_miptree_from_handle(struct pipe_screen *pscreen, unsigned stride; /* Only supports 2D, non-mipmapped textures for the moment */ - if (template->target != PIPE_TEXTURE_2D || + if ((template->target != PIPE_TEXTURE_2D && + template->target != PIPE_TEXTURE_RECT) || template->last_level != 0 || template->depth0 != 1) return NULL; diff --git a/src/gallium/drivers/r300/r300_hyperz.c b/src/gallium/drivers/r300/r300_hyperz.c index b2526d6e41..eb5b0c36f8 100644 --- a/src/gallium/drivers/r300/r300_hyperz.c +++ b/src/gallium/drivers/r300/r300_hyperz.c @@ -354,7 +354,8 @@ void r300_zmask_alloc_block(struct r300_context *r300, struct r300_surface *surf /* We currently don't handle decompression for 3D textures and cubemaps * correctly. */ if (tex->desc.b.b.target != PIPE_TEXTURE_1D && - tex->desc.b.b.target != PIPE_TEXTURE_2D) + tex->desc.b.b.target != PIPE_TEXTURE_2D && + tex->desc.b.b.target != PIPE_TEXTURE_RECT) return; /* Cannot flush zmask of 16-bit zbuffers. */ diff --git a/src/gallium/drivers/r300/r300_texture.c b/src/gallium/drivers/r300/r300_texture.c index da8eadd3b5..852acdd462 100644 --- a/src/gallium/drivers/r300/r300_texture.c +++ b/src/gallium/drivers/r300/r300_texture.c @@ -754,7 +754,8 @@ struct pipe_resource *r300_texture_create(struct pipe_screen *screen, /* Refuse to create a texture with size 0. */ if (!base->width0 || (!base->height0 && (base->target == PIPE_TEXTURE_2D || - base->target == PIPE_TEXTURE_CUBE)) || + base->target == PIPE_TEXTURE_CUBE || + base->target == PIPE_TEXTURE_RECT)) || (!base->depth0 && base->target == PIPE_TEXTURE_3D)) { fprintf(stderr, "r300: texture_create: " "Got invalid texture dimensions: %ix%ix%i\n", @@ -787,7 +788,8 @@ struct pipe_resource *r300_texture_from_handle(struct pipe_screen *screen, unsigned stride, size; /* Support only 2D textures without mipmaps */ - if (base->target != PIPE_TEXTURE_2D || + if ((base->target != PIPE_TEXTURE_2D && + base->target != PIPE_TEXTURE_RECT) || base->depth0 != 1 || base->last_level != 0) { return NULL; diff --git a/src/gallium/drivers/r300/r300_texture_desc.c b/src/gallium/drivers/r300/r300_texture_desc.c index 5d690e8c33..2fe5d72188 100644 --- a/src/gallium/drivers/r300/r300_texture_desc.c +++ b/src/gallium/drivers/r300/r300_texture_desc.c @@ -184,7 +184,8 @@ static unsigned r300_texture_get_nblocksy(struct r300_texture_desc *desc, /* This is needed for the kernel checker, unfortunately. */ if ((desc->b.b.target != PIPE_TEXTURE_1D && - desc->b.b.target != PIPE_TEXTURE_2D) || + desc->b.b.target != PIPE_TEXTURE_2D && + desc->b.b.target != PIPE_TEXTURE_RECT) || desc->b.b.last_level != 0) { height = util_next_power_of_two(height); } @@ -202,7 +203,8 @@ static unsigned r300_texture_get_nblocksy(struct r300_texture_desc *desc, * Do so for 3 or more macrotiles in the Y direction. */ if (level == 0 && desc->b.b.last_level == 0 && (desc->b.b.target == PIPE_TEXTURE_1D || - desc->b.b.target == PIPE_TEXTURE_2D) && + desc->b.b.target == PIPE_TEXTURE_2D || + desc->b.b.target == PIPE_TEXTURE_RECT) && height >= tile_height * 3) { height = align(height, tile_height * 2); } diff --git a/src/gallium/drivers/r600/r600_state.c b/src/gallium/drivers/r600/r600_state.c index f78d1671ba..7d2b61f9b0 100644 --- a/src/gallium/drivers/r600/r600_state.c +++ b/src/gallium/drivers/r600/r600_state.c @@ -1199,6 +1199,7 @@ static inline unsigned r600_tex_dim(unsigned dim) case PIPE_TEXTURE_1D: return V_038000_SQ_TEX_DIM_1D; case PIPE_TEXTURE_2D: + case PIPE_TEXTURE_RECT: return V_038000_SQ_TEX_DIM_2D; case PIPE_TEXTURE_3D: return V_038000_SQ_TEX_DIM_3D; diff --git a/src/gallium/drivers/r600/r600_texture.c b/src/gallium/drivers/r600/r600_texture.c index eabd7f7705..8a6b5f8764 100644 --- a/src/gallium/drivers/r600/r600_texture.c +++ b/src/gallium/drivers/r600/r600_texture.c @@ -170,7 +170,8 @@ struct pipe_resource *r600_texture_from_handle(struct pipe_screen *screen, } /* Support only 2D textures without mipmaps */ - if (templ->target != PIPE_TEXTURE_2D || templ->depth0 != 1 || templ->last_level != 0) + if ((templ->target != PIPE_TEXTURE_2D && templ->target != PIPE_TEXTURE_RECT) || + templ->depth0 != 1 || templ->last_level != 0) return NULL; rtex = CALLOC_STRUCT(r600_resource_texture); diff --git a/src/gallium/drivers/softpipe/sp_screen.c b/src/gallium/drivers/softpipe/sp_screen.c index 93af6ee5b0..73ae2dea56 100644 --- a/src/gallium/drivers/softpipe/sp_screen.c +++ b/src/gallium/drivers/softpipe/sp_screen.c @@ -199,6 +199,7 @@ softpipe_is_format_supported( struct pipe_screen *screen, assert(target == PIPE_BUFFER || target == PIPE_TEXTURE_1D || target == PIPE_TEXTURE_2D || + target == PIPE_TEXTURE_RECT || target == PIPE_TEXTURE_3D || target == PIPE_TEXTURE_CUBE); diff --git a/src/gallium/drivers/softpipe/sp_tex_sample.c b/src/gallium/drivers/softpipe/sp_tex_sample.c index cf7ab81405..e654bb77c2 100644 --- a/src/gallium/drivers/softpipe/sp_tex_sample.c +++ b/src/gallium/drivers/softpipe/sp_tex_sample.c @@ -1785,6 +1785,7 @@ get_lambda_func(const union sp_sampler_key key) case PIPE_TEXTURE_1D: return compute_lambda_1d; case PIPE_TEXTURE_2D: + case PIPE_TEXTURE_RECT: case PIPE_TEXTURE_CUBE: return compute_lambda_2d; case PIPE_TEXTURE_3D: @@ -1809,6 +1810,7 @@ get_img_filter(const union sp_sampler_key key, return img_filter_1d_linear; break; case PIPE_TEXTURE_2D: + case PIPE_TEXTURE_RECT: /* Try for fast path: */ if (key.bits.is_pot && diff --git a/src/gallium/drivers/svga/svga_resource_texture.c b/src/gallium/drivers/svga/svga_resource_texture.c index ff83c750aa..26eb03a895 100644 --- a/src/gallium/drivers/svga/svga_resource_texture.c +++ b/src/gallium/drivers/svga/svga_resource_texture.c @@ -583,7 +583,8 @@ svga_texture_from_handle(struct pipe_screen *screen, assert(screen); /* Only supports one type */ - if (template->target != PIPE_TEXTURE_2D || + if ((template->target != PIPE_TEXTURE_2D && + template->target != PIPE_TEXTURE_RECT) || template->last_level != 0 || template->depth0 != 1) { return NULL; diff --git a/src/gallium/drivers/svga/svga_tgsi_emit.h b/src/gallium/drivers/svga/svga_tgsi_emit.h index 48eced2ece..b4e90a957d 100644 --- a/src/gallium/drivers/svga/svga_tgsi_emit.h +++ b/src/gallium/drivers/svga/svga_tgsi_emit.h @@ -353,6 +353,7 @@ static INLINE ubyte svga_tgsi_sampler_type( struct svga_shader_emitter *emit, case PIPE_TEXTURE_1D: return SVGA3DSAMP_2D; case PIPE_TEXTURE_2D: + case PIPE_TEXTURE_RECT: return SVGA3DSAMP_2D; case PIPE_TEXTURE_3D: return SVGA3DSAMP_VOLUME; diff --git a/src/gallium/tests/python/tests/texture_blit.py b/src/gallium/tests/python/tests/texture_blit.py index 58706dab93..089d05c623 100755 --- a/src/gallium/tests/python/tests/texture_blit.py +++ b/src/gallium/tests/python/tests/texture_blit.py @@ -55,7 +55,7 @@ def tex_coords(texture, face, level, zslice): [0.0, 1.0], ] - if texture.target == PIPE_TEXTURE_2D: + if texture.target == PIPE_TEXTURE_2D or texture.target == PIPE_TEXTURE_RECT: return [[s, t, 0.0] for s, t in st] elif texture.target == PIPE_TEXTURE_3D: depth = texture.get_depth(level) diff --git a/src/mesa/state_tracker/st_cb_bitmap.c b/src/mesa/state_tracker/st_cb_bitmap.c index 0b8ecd27cb..91037ab223 100644 --- a/src/mesa/state_tracker/st_cb_bitmap.c +++ b/src/mesa/state_tracker/st_cb_bitmap.c @@ -761,7 +761,7 @@ st_Bitmap(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height, if (pt) { struct pipe_sampler_view *sv = st_create_texture_sampler_view(st->pipe, pt); - assert(pt->target == PIPE_TEXTURE_2D); + assert(pt->target == PIPE_TEXTURE_2D || pt->target == PIPE_TEXTURE_RECT); if (sv) { draw_bitmap_quad(ctx, x, y, ctx->Current.RasterPos[2], -- cgit v1.2.3 From cbe367227959a32ff20e146106162a81d2be02c3 Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Wed, 18 Aug 2010 17:30:20 +0200 Subject: u_blitter: use TGSI_TEXTURE_RECT This seems to make sense, although I suspect the semantics of TGSI_TEXTURE_RECT need to be closely reviewed. --- src/gallium/auxiliary/util/u_blitter.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/auxiliary/util/u_blitter.c b/src/gallium/auxiliary/util/u_blitter.c index 4b69a7fb6a..9c6887b5cd 100644 --- a/src/gallium/auxiliary/util/u_blitter.c +++ b/src/gallium/auxiliary/util/u_blitter.c @@ -570,7 +570,7 @@ pipe_tex_to_tgsi_tex(enum pipe_texture_target pipe_tex_target) case PIPE_TEXTURE_2D: return TGSI_TEXTURE_2D; case PIPE_TEXTURE_RECT: - return TGSI_TEXTURE_2D; + return TGSI_TEXTURE_RECT; case PIPE_TEXTURE_3D: return TGSI_TEXTURE_3D; case PIPE_TEXTURE_CUBE: -- cgit v1.2.3 From 4a9bfb24eb907080b2e3e49215ad9912758d56c6 Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Wed, 18 Aug 2010 22:57:02 +0200 Subject: u_staging: use PIPE_TEXTURE_RECT --- src/gallium/auxiliary/util/u_staging.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/auxiliary/util/u_staging.c b/src/gallium/auxiliary/util/u_staging.c index 607c31f5ee..e2dc696d20 100644 --- a/src/gallium/auxiliary/util/u_staging.c +++ b/src/gallium/auxiliary/util/u_staging.c @@ -8,7 +8,7 @@ util_staging_resource_template(struct pipe_resource *pt, unsigned width, unsigne { memset(template, 0, sizeof(struct pipe_resource)); if(pt->target != PIPE_BUFFER && depth <= 1) - template->target = PIPE_TEXTURE_2D; + template->target = PIPE_TEXTURE_RECT; else template->target = pt->target; template->format = pt->format; -- cgit v1.2.3 From 3070e0ea41ab4aa24804e8fd26895924a8583830 Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Fri, 6 Aug 2010 07:39:21 +0200 Subject: mesa/st: support using PIPE_TEXTURE_RECT internally Currently Gallium internals always use PIPE_TEXTURE_2D and normalized coordinates to access textures. However, PIPE_TEXTURE_2D is not always supported for NPOT textures, and PIPE_TEXTURE_RECT requires unnormalized coordinates. Hence, this change adds support for both kinds of normalization. --- src/mesa/state_tracker/st_cb_bitmap.c | 23 +++++++++++------ src/mesa/state_tracker/st_cb_drawpixels.c | 42 +++++++------------------------ src/mesa/state_tracker/st_cb_fbo.c | 2 +- src/mesa/state_tracker/st_context.c | 5 ++++ src/mesa/state_tracker/st_context.h | 3 ++- 5 files changed, 32 insertions(+), 43 deletions(-) (limited to 'src') diff --git a/src/mesa/state_tracker/st_cb_bitmap.c b/src/mesa/state_tracker/st_cb_bitmap.c index 91037ab223..d40e413296 100644 --- a/src/mesa/state_tracker/st_cb_bitmap.c +++ b/src/mesa/state_tracker/st_cb_bitmap.c @@ -275,7 +275,7 @@ make_bitmap_texture(GLcontext *ctx, GLsizei width, GLsizei height, /** * Create texture to hold bitmap pattern. */ - pt = st_texture_create(st, PIPE_TEXTURE_2D, st->bitmap.tex_format, + pt = st_texture_create(st, st->internal_target, st->bitmap.tex_format, 0, width, height, 1, PIPE_BIND_SAMPLER_VIEW); if (!pt) { @@ -304,7 +304,7 @@ make_bitmap_texture(GLcontext *ctx, GLsizei width, GLsizei height, } static GLuint -setup_bitmap_vertex_data(struct st_context *st, +setup_bitmap_vertex_data(struct st_context *st, bool normalized, int x, int y, int width, int height, float z, const float color[4]) { @@ -316,13 +316,19 @@ setup_bitmap_vertex_data(struct st_context *st, const GLfloat x1 = (GLfloat)(x + width); const GLfloat y0 = (GLfloat)y; const GLfloat y1 = (GLfloat)(y + height); - const GLfloat sLeft = (GLfloat)0.0, sRight = (GLfloat)1.0; - const GLfloat tTop = (GLfloat)0.0, tBot = (GLfloat)1.0 - tTop; + GLfloat sLeft = (GLfloat)0.0, sRight = (GLfloat)1.0; + GLfloat tTop = (GLfloat)0.0, tBot = (GLfloat)1.0 - tTop; const GLfloat clip_x0 = (GLfloat)(x0 / fb_width * 2.0 - 1.0); const GLfloat clip_y0 = (GLfloat)(y0 / fb_height * 2.0 - 1.0); const GLfloat clip_x1 = (GLfloat)(x1 / fb_width * 2.0 - 1.0); const GLfloat clip_y1 = (GLfloat)(y1 / fb_height * 2.0 - 1.0); + if(!normalized) + { + sRight = width; + tBot = height; + } + /* XXX: Need to improve buffer_write to allow NO_WAIT (as well as * no_flush) updates to buffers where we know there is no conflict * with previous data. Currently using max_slots > 1 will cause @@ -462,7 +468,7 @@ draw_bitmap_quad(GLcontext *ctx, GLint x, GLint y, GLfloat z, for (i = 0; i < st->state.num_samplers; i++) { samplers[i] = &st->state.samplers[i]; } - samplers[stfp->bitmap_sampler] = &st->bitmap.sampler; + samplers[stfp->bitmap_sampler] = &st->bitmap.samplers[sv->texture->target != PIPE_TEXTURE_RECT]; cso_set_samplers(cso, num, (const struct pipe_sampler_state **) samplers); } @@ -499,7 +505,7 @@ draw_bitmap_quad(GLcontext *ctx, GLint x, GLint y, GLfloat z, z = z * 2.0 - 1.0; /* draw textured quad */ - offset = setup_bitmap_vertex_data(st, x, y, width, height, z, color); + offset = setup_bitmap_vertex_data(st, sv->texture->target != PIPE_TEXTURE_RECT, x, y, width, height, z, color); util_draw_vertex_buffer(pipe, st->bitmap.vbuf, offset, PIPE_PRIM_TRIANGLE_FAN, @@ -789,7 +795,7 @@ st_init_bitmap_functions(struct dd_function_table *functions) void st_init_bitmap(struct st_context *st) { - struct pipe_sampler_state *sampler = &st->bitmap.sampler; + struct pipe_sampler_state *sampler = &st->bitmap.samplers[0]; struct pipe_context *pipe = st->pipe; struct pipe_screen *screen = pipe->screen; @@ -801,7 +807,8 @@ st_init_bitmap(struct st_context *st) sampler->min_img_filter = PIPE_TEX_FILTER_NEAREST; sampler->min_mip_filter = PIPE_TEX_MIPFILTER_NONE; sampler->mag_img_filter = PIPE_TEX_FILTER_NEAREST; - sampler->normalized_coords = 1; + st->bitmap.samplers[1] = *sampler; + st->bitmap.samplers[1].normalized_coords = 1; /* init baseline rasterizer state once */ memset(&st->bitmap.rasterizer, 0, sizeof(st->bitmap.rasterizer)); diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c b/src/mesa/state_tracker/st_cb_drawpixels.c index 69a3dd45e8..d934fdc170 100644 --- a/src/mesa/state_tracker/st_cb_drawpixels.c +++ b/src/mesa/state_tracker/st_cb_drawpixels.c @@ -304,34 +304,9 @@ alloc_texture(struct st_context *st, GLsizei width, GLsizei height, struct pipe_context *pipe = st->pipe; struct pipe_screen *screen = pipe->screen; struct pipe_resource *pt; - int ptw, pth; - ptw = width; - pth = height; - - /* Need to use POT texture? */ - if (!screen->get_param(screen, PIPE_CAP_NPOT_TEXTURES)) { - int l2pt, maxSize; - - l2pt = util_logbase2(width); - if (1 << l2pt != width) { - ptw = 1 << (l2pt + 1); - } - - l2pt = util_logbase2(height); - if (1 << l2pt != height) { - pth = 1 << (l2pt + 1); - } - - /* Check against maximum texture size */ - maxSize = 1 << (pipe->screen->get_param(pipe->screen, - PIPE_CAP_MAX_TEXTURE_2D_LEVELS) - 1); - assert(ptw <= maxSize); - assert(pth <= maxSize); - } - - pt = st_texture_create(st, PIPE_TEXTURE_2D, texFormat, 0, - ptw, pth, 1, PIPE_BIND_SAMPLER_VIEW); + pt = st_texture_create(st, st->internal_target, texFormat, 0, + width, height, 1, PIPE_BIND_SAMPLER_VIEW); return pt; } @@ -536,6 +511,7 @@ draw_textured_quad(GLcontext *ctx, GLint x, GLint y, GLfloat z, struct cso_context *cso = st->cso_context; GLfloat x0, y0, x1, y1; GLsizei maxSize; + boolean normalized = sv->texture->target != PIPE_TEXTURE_RECT; /* limit checks */ /* XXX if DrawPixels image is larger than max texture size, break @@ -579,7 +555,7 @@ draw_textured_quad(GLcontext *ctx, GLint x, GLint y, GLfloat z, sampler.min_img_filter = PIPE_TEX_FILTER_NEAREST; sampler.min_mip_filter = PIPE_TEX_MIPFILTER_NONE; sampler.mag_img_filter = PIPE_TEX_FILTER_NEAREST; - sampler.normalized_coords = 1; + sampler.normalized_coords = normalized; cso_single_sampler(cso, 0, &sampler); if (st->pixel_xfer.pixelmap_enabled) { @@ -635,8 +611,8 @@ draw_textured_quad(GLcontext *ctx, GLint x, GLint y, GLfloat z, z = z * 2.0 - 1.0; draw_quad(ctx, x0, y0, z, x1, y1, color, invertTex, - (GLfloat) width / sv->texture->width0, - (GLfloat) height / sv->texture->height0); + normalized ? ((GLfloat) width / sv->texture->width0) : (GLfloat)width, + normalized ? ((GLfloat) height / sv->texture->height0) : (GLfloat)height); /* restore state */ cso_restore_rasterizer(cso); @@ -1002,7 +978,7 @@ st_CopyPixels(GLcontext *ctx, GLint srcx, GLint srcy, srcFormat = rbRead->texture->format; - if (screen->is_format_supported(screen, srcFormat, PIPE_TEXTURE_2D, sample_count, + if (screen->is_format_supported(screen, srcFormat, st->internal_target, sample_count, PIPE_BIND_SAMPLER_VIEW, 0)) { texFormat = srcFormat; } @@ -1010,13 +986,13 @@ st_CopyPixels(GLcontext *ctx, GLint srcx, GLint srcy, /* srcFormat can't be used as a texture format */ if (type == GL_DEPTH) { texFormat = st_choose_format(screen, GL_DEPTH_COMPONENT, - PIPE_TEXTURE_2D, sample_count, + st->internal_target, sample_count, PIPE_BIND_DEPTH_STENCIL); assert(texFormat != PIPE_FORMAT_NONE); } else { /* default color format */ - texFormat = st_choose_format(screen, GL_RGBA, PIPE_TEXTURE_2D, + texFormat = st_choose_format(screen, GL_RGBA, st->internal_target, sample_count, PIPE_BIND_SAMPLER_VIEW); assert(texFormat != PIPE_FORMAT_NONE); } diff --git a/src/mesa/state_tracker/st_cb_fbo.c b/src/mesa/state_tracker/st_cb_fbo.c index 86bb788903..48d83ded55 100644 --- a/src/mesa/state_tracker/st_cb_fbo.c +++ b/src/mesa/state_tracker/st_cb_fbo.c @@ -108,7 +108,7 @@ st_renderbuffer_alloc_storage(GLcontext * ctx, struct gl_renderbuffer *rb, /* Setup new texture template. */ memset(&template, 0, sizeof(template)); - template.target = PIPE_TEXTURE_2D; + template.target = st->internal_target; template.format = format; template.width0 = width; template.height0 = height; diff --git a/src/mesa/state_tracker/st_context.c b/src/mesa/state_tracker/st_context.c index 2ce5f08753..3b046962ef 100644 --- a/src/mesa/state_tracker/st_context.c +++ b/src/mesa/state_tracker/st_context.c @@ -125,6 +125,11 @@ st_create_context_priv( GLcontext *ctx, struct pipe_context *pipe ) st_init_generate_mipmap(st); st_init_blit(st); + if(pipe->screen->get_param(pipe->screen, PIPE_CAP_NPOT_TEXTURES)) + st->internal_target = PIPE_TEXTURE_2D; + else + st->internal_target = PIPE_TEXTURE_RECT; + for (i = 0; i < PIPE_MAX_SAMPLERS; i++) st->state.sampler_list[i] = &st->state.samplers[i]; diff --git a/src/mesa/state_tracker/st_context.h b/src/mesa/state_tracker/st_context.h index 60c25fb8f0..991feee300 100644 --- a/src/mesa/state_tracker/st_context.h +++ b/src/mesa/state_tracker/st_context.h @@ -149,7 +149,7 @@ struct st_context /** for glBitmap */ struct { struct pipe_rasterizer_state rasterizer; - struct pipe_sampler_state sampler; + struct pipe_sampler_state samplers[2]; enum pipe_format tex_format; void *vs; float vertices[4][3][4]; /**< vertex pos + color + texcoord */ @@ -182,6 +182,7 @@ struct st_context void *passthrough_fs; /**< simple pass-through frag shader */ + enum pipe_texture_target internal_target; struct gen_mipmap_state *gen_mipmap; struct blit_state *blit; -- cgit v1.2.3 From d4ec85e62423336d3cddc45f26bef6764f435a18 Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Fri, 6 Aug 2010 07:39:21 +0200 Subject: auxiliary: support using PIPE_TEXTURE_RECT internally Currently Gallium internals always use PIPE_TEXTURE_2D and normalized coordinates to access textures. However, PIPE_TEXTURE_2D is not always supported for NPOT textures, and PIPE_TEXTURE_RECT requires unnormalized coordinates. Hence, this change adds support for both kinds of normalization. --- src/gallium/auxiliary/util/u_blit.c | 67 +++++++++++++++++++++++++--------- src/gallium/auxiliary/util/u_blitter.c | 48 +++++++++++++++--------- 2 files changed, 81 insertions(+), 34 deletions(-) (limited to 'src') diff --git a/src/gallium/auxiliary/util/u_blit.c b/src/gallium/auxiliary/util/u_blit.c index 30c7a96462..6fb341eaf2 100644 --- a/src/gallium/auxiliary/util/u_blit.c +++ b/src/gallium/auxiliary/util/u_blit.c @@ -62,6 +62,7 @@ struct blit_state struct pipe_viewport_state viewport; struct pipe_clip_state clip; struct pipe_vertex_element velem[2]; + enum pipe_texture_target internal_target; void *vs; void *fs[TGSI_WRITEMASK_XYZW + 1]; @@ -110,7 +111,6 @@ util_create_blit(struct pipe_context *pipe, struct cso_context *cso) ctx->sampler.min_mip_filter = PIPE_TEX_MIPFILTER_NONE; ctx->sampler.min_img_filter = 0; /* set later */ ctx->sampler.mag_img_filter = 0; /* set later */ - ctx->sampler.normalized_coords = 1; /* vertex elements state */ memset(&ctx->velem[0], 0, sizeof(ctx->velem[0]) * 2); @@ -145,6 +145,11 @@ util_create_blit(struct pipe_context *pipe, struct cso_context *cso) ctx->vertices[i][1][3] = 1.0f; /* q */ } + if(pipe->screen->get_param(pipe->screen, PIPE_CAP_NPOT_TEXTURES)) + ctx->internal_target = PIPE_TEXTURE_2D; + else + ctx->internal_target = PIPE_TEXTURE_RECT; + return ctx; } @@ -296,6 +301,7 @@ util_blit_pixels_writemask(struct blit_state *ctx, unsigned offset; boolean overlap; float s0, t0, s1, t1; + boolean normalized; assert(filter == PIPE_TEX_MIPFILTER_NEAREST || filter == PIPE_TEX_MIPFILTER_LINEAR); @@ -335,7 +341,6 @@ util_blit_pixels_writemask(struct blit_state *ctx, return; } - /* Create a temporary texture when src and dest alias or when src * is anything other than a 2d texture. * XXX should just use appropriate shader to access 1d / 3d slice / cube face, @@ -373,7 +378,7 @@ util_blit_pixels_writemask(struct blit_state *ctx, /* create temp texture */ memset(&texTemp, 0, sizeof(texTemp)); - texTemp.target = PIPE_TEXTURE_2D; + texTemp.target = ctx->internal_target; texTemp.format = src_tex->format; texTemp.last_level = 0; texTemp.width0 = srcW; @@ -393,10 +398,19 @@ util_blit_pixels_writemask(struct blit_state *ctx, src_tex, srcsub, srcLeft, srcTop, srcZ0, /* src */ srcW, srcH); /* size */ - s0 = 0.0f; - s1 = 1.0f; - t0 = 0.0f; - t1 = 1.0f; + normalized = tex->target != PIPE_TEXTURE_RECT; + if(normalized) { + s0 = 0.0f; + s1 = 1.0f; + t0 = 0.0f; + t1 = 1.0f; + } + else { + s0 = 0; + s1 = srcW; + t0 = 0; + t1 = srcH; + } u_sampler_view_default_template(&sv_templ, tex, tex->format); sampler_view = pipe->create_sampler_view(pipe, tex, &sv_templ); @@ -416,17 +430,25 @@ util_blit_pixels_writemask(struct blit_state *ctx, return; } - s0 = srcX0 / (float)(u_minify(sampler_view->texture->width0, srcsub.level)); - s1 = srcX1 / (float)(u_minify(sampler_view->texture->width0, srcsub.level)); - t0 = srcY0 / (float)(u_minify(sampler_view->texture->height0, srcsub.level)); - t1 = srcY1 / (float)(u_minify(sampler_view->texture->height0, srcsub.level)); + s0 = srcX0; + s1 = srcX1; + t0 = srcY0; + t1 = srcY1; + normalized = sampler_view->texture->target != PIPE_TEXTURE_RECT; + if(normalized) + { + s0 /= (float)(u_minify(sampler_view->texture->width0, srcsub.level)); + s1 /= (float)(u_minify(sampler_view->texture->width0, srcsub.level)); + t0 /= (float)(u_minify(sampler_view->texture->height0, srcsub.level)); + t1 /= (float)(u_minify(sampler_view->texture->height0, srcsub.level)); + } } - assert(screen->is_format_supported(screen, sampler_view->format, PIPE_TEXTURE_2D, + assert(screen->is_format_supported(screen, sampler_view->format, ctx->internal_target, sampler_view->texture->nr_samples, PIPE_BIND_SAMPLER_VIEW, 0)); - assert(screen->is_format_supported(screen, dst->format, PIPE_TEXTURE_2D, + assert(screen->is_format_supported(screen, dst->format, ctx->internal_target, dst->texture->nr_samples, PIPE_BIND_RENDER_TARGET, 0)); @@ -451,6 +473,7 @@ util_blit_pixels_writemask(struct blit_state *ctx, cso_set_vertex_elements(ctx->cso, 2, ctx->velem); /* sampler */ + ctx->sampler.normalized_coords = normalized; ctx->sampler.min_img_filter = filter; ctx->sampler.mag_img_filter = filter; /* we've limited this already with the sampler view but you never know... */ @@ -575,6 +598,7 @@ util_blit_pixels_tex(struct blit_state *ctx, int dstX1, int dstY1, float z, uint filter) { + boolean normalized = src_sampler_view->texture->target != PIPE_TEXTURE_RECT; struct pipe_framebuffer_state fb; float s0, t0, s1, t1; unsigned offset; @@ -587,10 +611,18 @@ util_blit_pixels_tex(struct blit_state *ctx, assert(tex->width0 != 0); assert(tex->height0 != 0); - s0 = srcX0 / (float)tex->width0; - s1 = srcX1 / (float)tex->width0; - t0 = srcY0 / (float)tex->height0; - t1 = srcY1 / (float)tex->height0; + s0 = srcX0; + s1 = srcX1; + t0 = srcY0; + t1 = srcY1; + + if(normalized) + { + s0 /= (float)tex->width0; + s1 /= (float)tex->width0; + t0 /= (float)tex->height0; + t1 /= (float)tex->height0; + } assert(ctx->pipe->screen->is_format_supported(ctx->pipe->screen, dst->format, PIPE_TEXTURE_2D, @@ -618,6 +650,7 @@ util_blit_pixels_tex(struct blit_state *ctx, cso_set_vertex_elements(ctx->cso, 2, ctx->velem); /* sampler */ + ctx->sampler.normalized_coords = normalized; ctx->sampler.min_img_filter = filter; ctx->sampler.mag_img_filter = filter; cso_single_sampler(ctx->cso, 0, &ctx->sampler); diff --git a/src/gallium/auxiliary/util/u_blitter.c b/src/gallium/auxiliary/util/u_blitter.c index 9c6887b5cd..8f93dac011 100644 --- a/src/gallium/auxiliary/util/u_blitter.c +++ b/src/gallium/auxiliary/util/u_blitter.c @@ -92,7 +92,7 @@ struct blitter_context_priv void *velem_state; /* Sampler state for clamping to a miplevel. */ - void *sampler_state[PIPE_MAX_TEXTURE_LEVELS]; + void *sampler_state[PIPE_MAX_TEXTURE_LEVELS * 2]; /* Rasterizer state. */ void *rs_state; @@ -272,7 +272,7 @@ void util_blitter_destroy(struct blitter_context *blitter) if (ctx->fs_col[i]) pipe->delete_fs_state(pipe, ctx->fs_col[i]); - for (i = 0; i < PIPE_MAX_TEXTURE_LEVELS; i++) + for (i = 0; i < PIPE_MAX_TEXTURE_LEVELS * 2; i++) if (ctx->sampler_state[i]) pipe->delete_sampler_state(pipe, ctx->sampler_state[i]); @@ -418,16 +418,26 @@ static void blitter_set_clear_color(struct blitter_context_priv *ctx, } } -static void get_normalized_texcoords(struct pipe_resource *src, +static void get_texcoords(struct pipe_resource *src, struct pipe_subresource subsrc, unsigned x1, unsigned y1, unsigned x2, unsigned y2, - float out[4]) + boolean normalized, float out[4]) { - out[0] = x1 / (float)u_minify(src->width0, subsrc.level); - out[1] = y1 / (float)u_minify(src->height0, subsrc.level); - out[2] = x2 / (float)u_minify(src->width0, subsrc.level); - out[3] = y2 / (float)u_minify(src->height0, subsrc.level); + if(normalized) + { + out[0] = x1 / (float)u_minify(src->width0, subsrc.level); + out[1] = y1 / (float)u_minify(src->height0, subsrc.level); + out[2] = x2 / (float)u_minify(src->width0, subsrc.level); + out[3] = y2 / (float)u_minify(src->height0, subsrc.level); + } + else + { + out[0] = x1; + out[1] = y1; + out[2] = x2; + out[3] = y2; + } } static void set_texcoords_in_vertices(const float coord[4], @@ -455,7 +465,7 @@ static void blitter_set_texcoords_2d(struct blitter_context_priv *ctx, unsigned i; float coord[4]; - get_normalized_texcoords(src, subsrc, x1, y1, x2, y2, coord); + get_texcoords(src, subsrc, x1, y1, x2, y2, TRUE, coord); set_texcoords_in_vertices(coord, &ctx->vertices[0][1][0], 8); for (i = 0; i < 4; i++) { @@ -490,7 +500,7 @@ static void blitter_set_texcoords_cube(struct blitter_context_priv *ctx, float coord[4]; float st[4][2]; - get_normalized_texcoords(src, subsrc, x1, y1, x2, y2, coord); + get_texcoords(src, subsrc, x1, y1, x2, y2, TRUE, coord); set_texcoords_in_vertices(coord, &st[0][0], 2); util_map_texcoords2d_onto_cubemap(subsrc.face, @@ -524,7 +534,7 @@ static void blitter_draw_quad(struct blitter_context_priv *ctx) static INLINE void **blitter_get_sampler_state(struct blitter_context_priv *ctx, - int miplevel) + int miplevel, boolean normalized) { struct pipe_context *pipe = ctx->base.pipe; struct pipe_sampler_state *sampler_state = &ctx->template_sampler_state; @@ -532,18 +542,19 @@ void **blitter_get_sampler_state(struct blitter_context_priv *ctx, assert(miplevel < PIPE_MAX_TEXTURE_LEVELS); /* Create the sampler state on-demand. */ - if (!ctx->sampler_state[miplevel]) { + if (!ctx->sampler_state[miplevel * 2 + normalized]) { sampler_state->lod_bias = miplevel; sampler_state->min_lod = miplevel; sampler_state->max_lod = miplevel; + sampler_state->normalized_coords = normalized; - ctx->sampler_state[miplevel] = pipe->create_sampler_state(pipe, + ctx->sampler_state[miplevel * 2 + normalized] = pipe->create_sampler_state(pipe, sampler_state); } /* Return void** so that it can be passed to bind_fragment_sampler_states * directly. */ - return &ctx->sampler_state[miplevel]; + return &ctx->sampler_state[miplevel * 2 + normalized]; } static INLINE @@ -719,6 +730,7 @@ void util_blitter_copy_region(struct blitter_context *blitter, struct pipe_sampler_view viewTempl, *view; unsigned bind; boolean is_stencil, is_depth; + boolean normalized; /* Give up if textures are not set. */ assert(dst && src); @@ -790,6 +802,8 @@ void util_blitter_copy_region(struct blitter_context *blitter, fb_state.zsbuf = 0; } + normalized = src->target != PIPE_TEXTURE_RECT; + /* Initialize sampler view. */ u_sampler_view_default_template(&viewTempl, src, src->format); view = pipe->create_sampler_view(pipe, src, &viewTempl); @@ -798,7 +812,7 @@ void util_blitter_copy_region(struct blitter_context *blitter, pipe->bind_rasterizer_state(pipe, ctx->rs_state); pipe->bind_vs_state(pipe, ctx->vs_tex); pipe->bind_fragment_sampler_states(pipe, 1, - blitter_get_sampler_state(ctx, subsrc.level)); + blitter_get_sampler_state(ctx, subsrc.level, normalized)); pipe->bind_vertex_elements_state(pipe, ctx->velem_state); pipe->set_fragment_sampler_views(pipe, 1, &view); pipe->set_framebuffer_state(pipe, &fb_state); @@ -813,8 +827,8 @@ void util_blitter_copy_region(struct blitter_context *blitter, { /* Set texture coordinates. */ float coord[4]; - get_normalized_texcoords(src, subsrc, srcx, srcy, - srcx+width, srcy+height, coord); + get_texcoords(src, subsrc, srcx, srcy, + srcx+width, srcy+height, normalized, coord); /* Draw. */ blitter->draw_rectangle(blitter, dstx, dsty, dstx+width, dsty+height, 0, -- cgit v1.2.3 From 4a5acc0ec7d6d94ea2a73b3d8ee498f75e929a1c Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Wed, 18 Aug 2010 22:57:22 +0200 Subject: st/dri: use PIPE_TEXTURE_RECT if appropriate --- src/gallium/state_trackers/dri/common/dri_screen.c | 5 +++++ src/gallium/state_trackers/dri/common/dri_screen.h | 1 + src/gallium/state_trackers/dri/drm/dri2.c | 4 ++-- src/gallium/state_trackers/dri/sw/drisw.c | 2 +- 4 files changed, 9 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/gallium/state_trackers/dri/common/dri_screen.c b/src/gallium/state_trackers/dri/common/dri_screen.c index 6ad2c7da4d..0ab4dd1893 100644 --- a/src/gallium/state_trackers/dri/common/dri_screen.c +++ b/src/gallium/state_trackers/dri/common/dri_screen.c @@ -383,6 +383,11 @@ dri_init_screen_helper(struct dri_screen *screen, if (!screen->st_api) return NULL; + if(pscreen->get_param(pscreen, PIPE_CAP_NPOT_TEXTURES)) + screen->target = PIPE_TEXTURE_2D; + else + screen->target = PIPE_TEXTURE_RECT; + driParseOptionInfo(&screen->optionCache, __driConfigOptions, __driNConfigOptions); diff --git a/src/gallium/state_trackers/dri/common/dri_screen.h b/src/gallium/state_trackers/dri/common/dri_screen.h index 53ccce145b..849f399b2f 100644 --- a/src/gallium/state_trackers/dri/common/dri_screen.h +++ b/src/gallium/state_trackers/dri/common/dri_screen.h @@ -68,6 +68,7 @@ struct dri_screen boolean d_depth_bits_last; boolean sd_depth_bits_last; boolean auto_fake_front; + enum pipe_texture_target target; }; /** cast wrapper */ diff --git a/src/gallium/state_trackers/dri/drm/dri2.c b/src/gallium/state_trackers/dri/drm/dri2.c index 47005c17e2..93f910a26d 100644 --- a/src/gallium/state_trackers/dri/drm/dri2.c +++ b/src/gallium/state_trackers/dri/drm/dri2.c @@ -195,7 +195,7 @@ dri2_drawable_process_buffers(struct dri_drawable *drawable, pipe_resource_reference(&drawable->textures[i], NULL); memset(&templ, 0, sizeof(templ)); - templ.target = PIPE_TEXTURE_2D; + templ.target = screen->target; templ.last_level = 0; templ.width0 = dri_drawable->w; templ.height0 = dri_drawable->h; @@ -342,7 +342,7 @@ dri2_create_image_from_name(__DRIcontext *context, memset(&templ, 0, sizeof(templ)); templ.bind = tex_usage; templ.format = pf; - templ.target = PIPE_TEXTURE_2D; + templ.target = screen->target; templ.last_level = 0; templ.width0 = width; templ.height0 = height; diff --git a/src/gallium/state_trackers/dri/sw/drisw.c b/src/gallium/state_trackers/dri/sw/drisw.c index 249ccd7fcf..04bba631ae 100644 --- a/src/gallium/state_trackers/dri/sw/drisw.c +++ b/src/gallium/state_trackers/dri/sw/drisw.c @@ -216,7 +216,7 @@ drisw_allocate_textures(struct dri_drawable *drawable, } memset(&templ, 0, sizeof(templ)); - templ.target = PIPE_TEXTURE_2D; + templ.target = screen->target; templ.width0 = width; templ.height0 = height; templ.depth0 = 1; -- cgit v1.2.3 From d34f6e9db15a1fa3a7e3b68e47ac4eef2706b8cd Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Thu, 19 Aug 2010 00:55:13 +0200 Subject: st/glx: use PIPE_TEXTURE_RECT if appropriate --- src/gallium/state_trackers/glx/xlib/xm_st.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/state_trackers/glx/xlib/xm_st.c b/src/gallium/state_trackers/glx/xlib/xm_st.c index c62eb8bfbd..9cd744c3a6 100644 --- a/src/gallium/state_trackers/glx/xlib/xm_st.c +++ b/src/gallium/state_trackers/glx/xlib/xm_st.c @@ -38,6 +38,7 @@ struct xmesa_st_framebuffer { struct pipe_screen *screen; struct st_visual stvis; + enum pipe_texture_target target; unsigned texture_width, texture_height, texture_mask; struct pipe_resource *textures[ST_ATTACHMENT_COUNT]; @@ -139,7 +140,7 @@ xmesa_st_framebuffer_validate_textures(struct st_framebuffer_iface *stfbi, } memset(&templ, 0, sizeof(templ)); - templ.target = PIPE_TEXTURE_2D; + templ.target = xstfb->target; templ.width0 = width; templ.height0 = height; templ.depth0 = 1; @@ -279,6 +280,10 @@ xmesa_create_st_framebuffer(XMesaDisplay xmdpy, XMesaBuffer b) xstfb->buffer = b; xstfb->screen = xmdpy->screen; xstfb->stvis = b->xm_visual->stvis; + if(xstfb->screen->get_param(xstfb->screen, PIPE_CAP_NPOT_TEXTURES)) + xstfb->target = PIPE_TEXTURE_2D; + else + xstfb->target = PIPE_TEXTURE_RECT; stfbi->visual = &xstfb->stvis; stfbi->flush_front = xmesa_st_framebuffer_flush_front; -- cgit v1.2.3 From 96a82cc314667542b7e046311595f58b01704205 Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Thu, 19 Aug 2010 01:44:02 +0200 Subject: winsys/sw: use PIPE_TEXTURE_RECT if appropriate --- src/gallium/winsys/sw/wrapper/wrapper_sw_winsys.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/winsys/sw/wrapper/wrapper_sw_winsys.c b/src/gallium/winsys/sw/wrapper/wrapper_sw_winsys.c index b997abda9b..3a76098b65 100644 --- a/src/gallium/winsys/sw/wrapper/wrapper_sw_winsys.c +++ b/src/gallium/winsys/sw/wrapper/wrapper_sw_winsys.c @@ -52,6 +52,7 @@ struct wrapper_sw_winsys struct sw_winsys base; struct pipe_screen *screen; struct pipe_context *pipe; + enum pipe_texture_target target; }; struct wrapper_sw_displaytarget @@ -145,7 +146,7 @@ wsw_dt_create(struct sw_winsys *ws, * XXX Why don't we just get the template. */ memset(&templ, 0, sizeof(templ)); - templ.target = PIPE_TEXTURE_2D; + templ.target = wsw->target; templ.width0 = width; templ.height0 = height; templ.format = format; @@ -291,6 +292,11 @@ wrapper_sw_winsys_warp_pipe_screen(struct pipe_screen *screen) if (!wsw->pipe) goto err_free; + if(screen->get_param(screen, PIPE_CAP_NPOT_TEXTURES)) + wsw->target = PIPE_TEXTURE_2D; + else + wsw->target = PIPE_TEXTURE_RECT; + return &wsw->base; err_free: -- cgit v1.2.3 From 7f15dca6d963b0a69131e8761c477064dba49307 Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Thu, 15 Apr 2010 09:04:20 +0200 Subject: mesa/st: use PIPE_TEXTURE_RECT for GL_TEXTURE_RECTANGLE --- src/mesa/state_tracker/st_cb_texture.c | 6 ++++-- src/mesa/state_tracker/st_texture.c | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c index 4c3e3688dd..a41c780d6e 100644 --- a/src/mesa/state_tracker/st_cb_texture.c +++ b/src/mesa/state_tracker/st_cb_texture.c @@ -74,9 +74,11 @@ gl_target_to_pipe(GLenum target) return PIPE_TEXTURE_1D; case GL_TEXTURE_2D: - case GL_TEXTURE_RECTANGLE_NV: return PIPE_TEXTURE_2D; + case GL_TEXTURE_RECTANGLE_NV: + return PIPE_TEXTURE_RECT; + case GL_TEXTURE_3D: return PIPE_TEXTURE_3D; @@ -449,7 +451,7 @@ compress_with_blit(GLcontext * ctx, /* Create the temporary source texture */ memset(&templ, 0, sizeof(templ)); - templ.target = PIPE_TEXTURE_2D; + templ.target = st->internal_target; templ.format = st_mesa_format_to_pipe_format(mesa_format); templ.width0 = width; templ.height0 = height; diff --git a/src/mesa/state_tracker/st_texture.c b/src/mesa/state_tracker/st_texture.c index add6e949df..c6cf2ba061 100644 --- a/src/mesa/state_tracker/st_texture.c +++ b/src/mesa/state_tracker/st_texture.c @@ -64,7 +64,7 @@ st_texture_create(struct st_context *st, struct pipe_resource pt, *newtex; struct pipe_screen *screen = st->pipe->screen; - assert(target <= PIPE_TEXTURE_CUBE); + assert(target < PIPE_MAX_TEXTURE_TYPES); assert(width0 > 0); assert(height0 > 0); assert(depth0 > 0); -- cgit v1.2.3 From ccd08643577988d416b339b84fe7bfda6fb77ef6 Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Thu, 19 Aug 2010 01:38:33 +0200 Subject: galahad: check resource_create template --- src/gallium/drivers/galahad/glhd_screen.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'src') diff --git a/src/gallium/drivers/galahad/glhd_screen.c b/src/gallium/drivers/galahad/glhd_screen.c index e1a1b59f20..2d7383acba 100644 --- a/src/gallium/drivers/galahad/glhd_screen.c +++ b/src/gallium/drivers/galahad/glhd_screen.c @@ -30,6 +30,7 @@ #include "pipe/p_screen.h" #include "pipe/p_state.h" #include "util/u_memory.h" +#include "util/u_math.h" #include "glhd_public.h" #include "glhd_screen.h" @@ -134,6 +135,34 @@ galahad_screen_resource_create(struct pipe_screen *_screen, struct pipe_screen *screen = glhd_screen->screen; struct pipe_resource *result; + if (templat->target >= PIPE_MAX_TEXTURE_TYPES) + glhd_warn("Received bogus resource target %d", templat->target); + + if(templat->target != PIPE_TEXTURE_RECT && templat->target != PIPE_BUFFER && !screen->get_param(screen, PIPE_CAP_NPOT_TEXTURES)) + { + if(!util_is_pot(templat->width0) || !util_is_pot(templat->height0)) + glhd_warn("Requested NPOT (%ux%u) non-rectangle texture without NPOT support", templat->width0, templat->height0); + } + + /* TODO: allow this for OpenCL flexible sampling */ + if(templat->target == PIPE_TEXTURE_RECT && templat->last_level) + glhd_warn("Rectangle textures cannot have mipmaps, but last_level = %u", templat->last_level); + + if(templat->target == PIPE_BUFFER && templat->last_level) + glhd_warn("Buffers cannot have mipmaps, but last_level = %u", templat->last_level); + + if(templat->target != PIPE_TEXTURE_3D && templat->depth0 != 1) + glhd_warn("Only 3D textures can have depth != 1, but received target %u and depth %u", templat->target, templat->depth0); + + if(templat->target == PIPE_TEXTURE_1D && templat->height0 != 1) + glhd_warn("1D textures must have height 1 but got asked for height %u", templat->height0); + + if(templat->target == PIPE_BUFFER && templat->height0 != 1) + glhd_warn("Buffers must have height 1 but got asked for height %u", templat->height0); + + if(templat->target == PIPE_TEXTURE_CUBE && templat->width0 != templat->height0) + glhd_warn("Cube maps must be square, but got asked for %ux%u", templat->width0, templat->height0); + result = screen->resource_create(screen, templat); -- cgit v1.2.3 From 09bf09cf92c3958c3b8268f38387804084ca30e2 Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Wed, 18 Aug 2010 17:29:59 +0200 Subject: nv50: use NV50TIC_0_2_TARGET_RECT --- src/gallium/drivers/nv50/nv50_tex.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/drivers/nv50/nv50_tex.c b/src/gallium/drivers/nv50/nv50_tex.c index 4db53f7ec2..d41d9c5102 100644 --- a/src/gallium/drivers/nv50/nv50_tex.c +++ b/src/gallium/drivers/nv50/nv50_tex.c @@ -131,9 +131,11 @@ nv50_tex_construct(struct nv50_sampler_view *view) tic[2] |= NV50TIC_0_2_TARGET_1D; break; case PIPE_TEXTURE_2D: - case PIPE_TEXTURE_RECT: tic[2] |= NV50TIC_0_2_TARGET_2D; break; + case PIPE_TEXTURE_RECT: + tic[2] |= NV50TIC_0_2_TARGET_RECT; + break; case PIPE_TEXTURE_3D: tic[2] |= NV50TIC_0_2_TARGET_3D; break; -- cgit v1.2.3 From 7344e6d9b50e39960713503681d6b37299ce2ccf Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Fri, 20 Aug 2010 12:06:44 +0200 Subject: galahad: remove incorrect comment just added --- src/gallium/drivers/galahad/glhd_screen.c | 1 - 1 file changed, 1 deletion(-) (limited to 'src') diff --git a/src/gallium/drivers/galahad/glhd_screen.c b/src/gallium/drivers/galahad/glhd_screen.c index 2d7383acba..a4eac11ae3 100644 --- a/src/gallium/drivers/galahad/glhd_screen.c +++ b/src/gallium/drivers/galahad/glhd_screen.c @@ -144,7 +144,6 @@ galahad_screen_resource_create(struct pipe_screen *_screen, glhd_warn("Requested NPOT (%ux%u) non-rectangle texture without NPOT support", templat->width0, templat->height0); } - /* TODO: allow this for OpenCL flexible sampling */ if(templat->target == PIPE_TEXTURE_RECT && templat->last_level) glhd_warn("Rectangle textures cannot have mipmaps, but last_level = %u", templat->last_level); -- cgit v1.2.3 From 4df17f9dfea527b83a896aabd9944e3563cb4a0e Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Fri, 20 Aug 2010 11:52:01 +0100 Subject: st/mesa: fix code/declaration mixing --- src/mesa/state_tracker/st_cb_bitmap.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/mesa/state_tracker/st_cb_bitmap.c b/src/mesa/state_tracker/st_cb_bitmap.c index d40e413296..8da5cbb5e6 100644 --- a/src/mesa/state_tracker/st_cb_bitmap.c +++ b/src/mesa/state_tracker/st_cb_bitmap.c @@ -322,6 +322,8 @@ setup_bitmap_vertex_data(struct st_context *st, bool normalized, const GLfloat clip_y0 = (GLfloat)(y0 / fb_height * 2.0 - 1.0); const GLfloat clip_x1 = (GLfloat)(x1 / fb_width * 2.0 - 1.0); const GLfloat clip_y1 = (GLfloat)(y1 / fb_height * 2.0 - 1.0); + const GLuint max_slots = 1; /* 4096 / sizeof(st->bitmap.vertices); */ + GLuint i; if(!normalized) { @@ -339,9 +341,6 @@ setup_bitmap_vertex_data(struct st_context *st, bool normalized, * price of allocating a new buffer for each bitmap cache-flush to * avoid synchronous rendering. */ - const GLuint max_slots = 1; /* 4096 / sizeof(st->bitmap.vertices); */ - GLuint i; - if (st->bitmap.vbuf_slot >= max_slots) { pipe_resource_reference(&st->bitmap.vbuf, NULL); st->bitmap.vbuf_slot = 0; -- cgit v1.2.3 From f508c0c09702a5ea53dcb58721f3674605594c6e Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Fri, 20 Aug 2010 12:35:02 +0800 Subject: egl: Allow core functions to be queried. When _EGL_GET_CORE_ADDRESSES is defined, eglGetProcAddress can be used to query core functions. This is non-standard, but some apps expect it. --- src/egl/main/SConscript | 1 + src/egl/main/eglapi.c | 39 ++++++++++++++++++++++++++++++++++++++- 2 files changed, 39 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/egl/main/SConscript b/src/egl/main/SConscript index c7ba45c0d6..1e4d4f39de 100644 --- a/src/egl/main/SConscript +++ b/src/egl/main/SConscript @@ -12,6 +12,7 @@ if env['platform'] != 'winddk': '_EGL_NATIVE_PLATFORM=_EGL_PLATFORM_WINDOWS', '_EGL_DRIVER_SEARCH_DIR=\\"\\"', '_EGL_OS_WINDOWS', + '_EGL_GET_CORE_ADDRESSES', 'KHRONOS_DLL_EXPORTS', ]) diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c index 53a5f6ed22..c62459ec6f 100644 --- a/src/egl/main/eglapi.c +++ b/src/egl/main/eglapi.c @@ -832,7 +832,44 @@ eglGetProcAddress(const char *procname) const char *name; _EGLProc function; } egl_functions[] = { - /* extensions only */ + /* core functions should not be queryable, but, well... */ +#ifdef _EGL_GET_CORE_ADDRESSES + /* alphabetical order */ + { "eglBindAPI", (_EGLProc) eglBindAPI }, + { "eglBindTexImage", (_EGLProc) eglBindTexImage }, + { "eglChooseConfig", (_EGLProc) eglChooseConfig }, + { "eglCopyBuffers", (_EGLProc) eglCopyBuffers }, + { "eglCreateContext", (_EGLProc) eglCreateContext }, + { "eglCreatePbufferFromClientBuffer", (_EGLProc) eglCreatePbufferFromClientBuffer }, + { "eglCreatePbufferSurface", (_EGLProc) eglCreatePbufferSurface }, + { "eglCreatePixmapSurface", (_EGLProc) eglCreatePixmapSurface }, + { "eglCreateWindowSurface", (_EGLProc) eglCreateWindowSurface }, + { "eglDestroyContext", (_EGLProc) eglDestroyContext }, + { "eglDestroySurface", (_EGLProc) eglDestroySurface }, + { "eglGetConfigAttrib", (_EGLProc) eglGetConfigAttrib }, + { "eglGetConfigs", (_EGLProc) eglGetConfigs }, + { "eglGetCurrentContext", (_EGLProc) eglGetCurrentContext }, + { "eglGetCurrentDisplay", (_EGLProc) eglGetCurrentDisplay }, + { "eglGetCurrentSurface", (_EGLProc) eglGetCurrentSurface }, + { "eglGetDisplay", (_EGLProc) eglGetDisplay }, + { "eglGetError", (_EGLProc) eglGetError }, + { "eglGetProcAddress", (_EGLProc) eglGetProcAddress }, + { "eglInitialize", (_EGLProc) eglInitialize }, + { "eglMakeCurrent", (_EGLProc) eglMakeCurrent }, + { "eglQueryAPI", (_EGLProc) eglQueryAPI }, + { "eglQueryContext", (_EGLProc) eglQueryContext }, + { "eglQueryString", (_EGLProc) eglQueryString }, + { "eglQuerySurface", (_EGLProc) eglQuerySurface }, + { "eglReleaseTexImage", (_EGLProc) eglReleaseTexImage }, + { "eglReleaseThread", (_EGLProc) eglReleaseThread }, + { "eglSurfaceAttrib", (_EGLProc) eglSurfaceAttrib }, + { "eglSwapBuffers", (_EGLProc) eglSwapBuffers }, + { "eglSwapInterval", (_EGLProc) eglSwapInterval }, + { "eglTerminate", (_EGLProc) eglTerminate }, + { "eglWaitClient", (_EGLProc) eglWaitClient }, + { "eglWaitGL", (_EGLProc) eglWaitGL }, + { "eglWaitNative", (_EGLProc) eglWaitNative }, +#endif /* _EGL_GET_CORE_ADDRESSES */ #ifdef EGL_MESA_screen_surface { "eglChooseModeMESA", (_EGLProc) eglChooseModeMESA }, { "eglGetModesMESA", (_EGLProc) eglGetModesMESA }, -- cgit v1.2.3 From ce2cae4130548872a0205097b0b5dbe0f4f57d5f Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Fri, 20 Aug 2010 12:41:46 +0800 Subject: egl: Add egl.def for win32 build. Without the .def file, function names are decorated and cannot be queried by GetProcAddress easily. --- src/egl/main/SConscript | 2 +- src/egl/main/egl.def | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 src/egl/main/egl.def (limited to 'src') diff --git a/src/egl/main/SConscript b/src/egl/main/SConscript index 1e4d4f39de..06846475ba 100644 --- a/src/egl/main/SConscript +++ b/src/egl/main/SConscript @@ -42,7 +42,7 @@ if env['platform'] != 'winddk': egl = env.SharedLibrary( target = 'libEGL', - source = egl_sources, + source = egl_sources + ['egl.def'], ) env.InstallSharedLibrary(egl, version=(1, 4, 0)) diff --git a/src/egl/main/egl.def b/src/egl/main/egl.def new file mode 100644 index 0000000000..0cfe920e0e --- /dev/null +++ b/src/egl/main/egl.def @@ -0,0 +1,35 @@ +EXPORTS + eglBindAPI + eglBindTexImage + eglChooseConfig + eglCopyBuffers + eglCreateContext + eglCreatePbufferFromClientBuffer + eglCreatePbufferSurface + eglCreatePixmapSurface + eglCreateWindowSurface + eglDestroyContext + eglDestroySurface + eglGetConfigAttrib + eglGetConfigs + eglGetCurrentContext + eglGetCurrentDisplay + eglGetCurrentSurface + eglGetDisplay + eglGetError + eglGetProcAddress + eglInitialize + eglMakeCurrent + eglQueryAPI + eglQueryContext + eglQueryString + eglQuerySurface + eglReleaseTexImage + eglReleaseThread + eglSurfaceAttrib + eglSwapBuffers + eglSwapInterval + eglTerminate + eglWaitClient + eglWaitGL + eglWaitNative -- cgit v1.2.3 From 5eb33596a0db26586957365ab27fc6afdebfe057 Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Fri, 20 Aug 2010 13:19:10 +0800 Subject: egl: Fix context API check and be verbose. The API of the context was not checked against EGL_RENDERABLE_TYPE when there was no attribute list. Move the check to _eglInitContext, and be verbose about common mistakes (EGL_RENDERABLE_TYPE not set, EGL_CONTEXT_CLIENT_VERSION not set, or eglBindAPI not called). --- src/egl/main/eglconfig.c | 7 +++++-- src/egl/main/eglcontext.c | 20 +++++++++++--------- 2 files changed, 16 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/egl/main/eglconfig.c b/src/egl/main/eglconfig.c index ea8e47d02b..01e7144d40 100644 --- a/src/egl/main/eglconfig.c +++ b/src/egl/main/eglconfig.c @@ -460,11 +460,14 @@ _eglMatchConfig(const _EGLConfig *conf, const _EGLConfig *criteria) } if (!matched) { -#ifdef DEBUG +#ifndef DEBUG + /* only print the common errors when DEBUG is not defined */ + if (attr != EGL_RENDERABLE_TYPE) + break; +#endif _eglLog(_EGL_DEBUG, "the value (0x%x) of attribute 0x%04x did not meet the criteria (0x%x)", val, attr, cmp); -#endif break; } } diff --git a/src/egl/main/eglcontext.c b/src/egl/main/eglcontext.c index 9fc529613e..e72664c23c 100644 --- a/src/egl/main/eglcontext.c +++ b/src/egl/main/eglcontext.c @@ -83,15 +83,6 @@ _eglParseContextAttribList(_EGLContext *ctx, const EGLint *attrib_list) } } - if (err == EGL_SUCCESS && ctx->Config) { - EGLint renderable_type, api_bit; - - renderable_type = GET_CONFIG_ATTRIB(ctx->Config, EGL_RENDERABLE_TYPE); - api_bit = _eglGetContextAPIBit(ctx); - if (!(renderable_type & api_bit)) - err = EGL_BAD_CONFIG; - } - return err; } @@ -121,6 +112,17 @@ _eglInitContext(_EGLContext *ctx, _EGLDisplay *dpy, _EGLConfig *conf, ctx->ClientVersion = 1; /* the default, per EGL spec */ err = _eglParseContextAttribList(ctx, attrib_list); + if (err == EGL_SUCCESS && ctx->Config) { + EGLint renderable_type, api_bit; + + renderable_type = GET_CONFIG_ATTRIB(ctx->Config, EGL_RENDERABLE_TYPE); + api_bit = _eglGetContextAPIBit(ctx); + if (!(renderable_type & api_bit)) { + _eglLog(_EGL_DEBUG, "context api is 0x%x while config supports 0x%x", + api_bit, renderable_type); + err = EGL_BAD_CONFIG; + } + } if (err != EGL_SUCCESS) return _eglError(err, "eglCreateContext"); -- cgit v1.2.3 From 5004f823ad3c82ec0b50822a4889798c81ce1cfc Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Fri, 20 Aug 2010 12:58:52 +0800 Subject: targets/egl-gdi: Implement guess_gl_api. It is needed to support calling eglGetProcAddress before eglInitialize. --- src/gallium/targets/egl-gdi/egl-static.c | 39 ++++++++++++++++++++++++++++++-- 1 file changed, 37 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/gallium/targets/egl-gdi/egl-static.c b/src/gallium/targets/egl-gdi/egl-static.c index ec2f865c31..4655d79117 100644 --- a/src/gallium/targets/egl-gdi/egl-static.c +++ b/src/gallium/targets/egl-gdi/egl-static.c @@ -33,6 +33,8 @@ #include "target-helpers/inline_debug_helper.h" #include "egldriver.h" +static struct st_api *stapis[ST_API_COUNT]; + static uint get_api_mask(void) { @@ -57,7 +59,11 @@ get_api_mask(void) static struct st_api * get_st_api(enum st_api_type api) { - struct st_api *stapi = NULL; + struct st_api *stapi; + + stapi = stapis[api]; + if (stapi) + return stapi; switch (api) { #if FEATURE_GL @@ -84,13 +90,33 @@ get_st_api(enum st_api_type api) break; } + stapis[api] = stapi; + return stapi; } static struct st_api * guess_gl_api(void) { - return NULL; + struct st_api *stapi = NULL; + +#if FEATURE_GL + stapi = get_st_api(ST_API_OPENGL); + if (stapi) + return stapi; +#endif +#if FEATURE_ES1 + stapi = get_st_api(ST_API_OPENGL_ES1); + if (stapi) + return stapi; +#endif +#if FEATURE_ES2 + stapi = get_st_api(ST_API_OPENGL_ES2); + if (stapi) + return stapi; +#endif + + return stapi; } static struct pipe_screen * @@ -127,7 +153,16 @@ init_loader(struct egl_g3d_loader *loader) static void egl_g3d_unload(_EGLDriver *drv) { + int i; + egl_g3d_destroy_driver(drv); + + for (i = 0; i < ST_API_COUNT; i++) { + if (stapis[i]) { + stapis[i]->destroy(stapis[i]); + stapis[i] = NULL; + } + } } static struct egl_g3d_loader loader; -- cgit v1.2.3 From 8043bf555e14cf20826753d59d66d0cef7a5e5a0 Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Fri, 20 Aug 2010 10:27:26 +0800 Subject: mesa: Include compiler.h for ASSERT. mfeatures.h defines ASSERT_NO_FEATURE to ASSERT, which is defined in compiler.h. Header files using the macro should include compiler.h. --- src/mesa/main/accum.h | 2 ++ src/mesa/main/attrib.h | 2 ++ src/mesa/main/colortab.h | 2 ++ src/mesa/main/convolve.h | 2 ++ src/mesa/main/dlist.h | 2 ++ src/mesa/main/feedback.h | 2 ++ src/mesa/state_tracker/st_cb_accum.h | 2 ++ 7 files changed, 14 insertions(+) (limited to 'src') diff --git a/src/mesa/main/accum.h b/src/mesa/main/accum.h index 63740f07ed..c2b74b23cb 100644 --- a/src/mesa/main/accum.h +++ b/src/mesa/main/accum.h @@ -55,6 +55,8 @@ _mesa_init_accum_dispatch(struct _glapi_table *disp); #else /* FEATURE_accum */ +#include "main/compiler.h" + #define _MESA_INIT_ACCUM_FUNCTIONS(driver, impl) do { } while (0) static INLINE void diff --git a/src/mesa/main/attrib.h b/src/mesa/main/attrib.h index 6b48a17663..83b28a65b7 100644 --- a/src/mesa/main/attrib.h +++ b/src/mesa/main/attrib.h @@ -48,6 +48,8 @@ _mesa_init_attrib_dispatch(struct _glapi_table *disp); #else /* FEATURE_attrib_stack */ +#include "main/compiler.h" + static INLINE void _mesa_PushClientAttrib( GLbitfield mask ) { diff --git a/src/mesa/main/colortab.h b/src/mesa/main/colortab.h index 652fb58246..744f092d93 100644 --- a/src/mesa/main/colortab.h +++ b/src/mesa/main/colortab.h @@ -53,6 +53,8 @@ _mesa_init_colortable_dispatch(struct _glapi_table *disp); #else /* FEATURE_colortable */ +#include "main/compiler.h" + #define _MESA_INIT_COLORTABLE_FUNCTIONS(driver, impl) do { } while (0) static INLINE void GLAPIENTRY diff --git a/src/mesa/main/convolve.h b/src/mesa/main/convolve.h index 59492bc7c5..d1401885df 100644 --- a/src/mesa/main/convolve.h +++ b/src/mesa/main/convolve.h @@ -70,6 +70,8 @@ _mesa_init_convolve_dispatch(struct _glapi_table *disp); #else /* FEATURE_convolve */ +#include "main/compiler.h" + #define _MESA_INIT_CONVOLVE_FUNCTIONS(driver, impl) do { } while (0) static INLINE void GLAPIENTRY diff --git a/src/mesa/main/dlist.h b/src/mesa/main/dlist.h index f8255facc5..d3f5c5cb4e 100644 --- a/src/mesa/main/dlist.h +++ b/src/mesa/main/dlist.h @@ -81,6 +81,8 @@ extern void _mesa_init_dlist_dispatch(struct _glapi_table *disp); #else /* FEATURE_dlist */ +#include "main/compiler.h" + #define _MESA_INIT_DLIST_FUNCTIONS(driver, impl) do { } while (0) #define _MESA_INIT_DLIST_VTXFMT(vfmt, impl) do { } while (0) diff --git a/src/mesa/main/feedback.h b/src/mesa/main/feedback.h index 3e8283ed23..0762930044 100644 --- a/src/mesa/main/feedback.h +++ b/src/mesa/main/feedback.h @@ -63,6 +63,8 @@ _mesa_init_feedback_dispatch(struct _glapi_table *disp); #else /* FEATURE_feedback */ +#include "main/compiler.h" + #define _MESA_INIT_FEEDBACK_FUNCTIONS(driver, impl) do { } while (0) static INLINE void diff --git a/src/mesa/state_tracker/st_cb_accum.h b/src/mesa/state_tracker/st_cb_accum.h index 7d52481c82..06425dc8a3 100644 --- a/src/mesa/state_tracker/st_cb_accum.h +++ b/src/mesa/state_tracker/st_cb_accum.h @@ -41,6 +41,8 @@ extern void st_init_accum_functions(struct dd_function_table *functions); #else +#include "main/compiler.h" + static INLINE void st_clear_accum_buffer(GLcontext *ctx, struct gl_renderbuffer *rb) { -- cgit v1.2.3 From ae2ace64f49a39e72eff393b8569653647b8b94f Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Thu, 19 Aug 2010 21:20:01 +0800 Subject: mesa: Decorate functions with GL_APIENTRY in es_generator.py. Note that GLES headers use GL_APIENTRY, not GLAPIENTRY. --- src/mesa/main/es_generator.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/mesa/main/es_generator.py b/src/mesa/main/es_generator.py index 9a8f5a6f5e..c1fe2401c4 100644 --- a/src/mesa/main/es_generator.py +++ b/src/mesa/main/es_generator.py @@ -609,7 +609,7 @@ for funcName in keys: # is to create them ourselves. if funcName in allSpecials: print "/* this function is special and is defined elsewhere */" - print "extern %s GLAPIENTRY %s(%s);" % (returnType, passthroughFuncName, passthroughDeclarationString) + print "extern %s GL_APIENTRY %s(%s);" % (returnType, passthroughFuncName, passthroughDeclarationString) # A function may be a core function (i.e. it exists in # the core specification), a core addition (extension @@ -662,7 +662,7 @@ for funcName in keys: print continue - print "static %s %s(%s)" % (returnType, fullFuncName, declarationString) + print "static %s GL_APIENTRY %s(%s)" % (returnType, fullFuncName, declarationString) print "{" # Start printing our code pieces. Start with any local -- cgit v1.2.3 From cfc00817407932346d1b977d2f3c24394b4a3336 Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Thu, 19 Aug 2010 20:42:10 +0800 Subject: mesa: Add missing ES sources to SConscript. These sources compile to nothing when FEATURE_ES is not defined and thus were overlooked. Note that api_exec_es[12].c are still missing on the list. They should be added when they can be generated on the fly. --- src/mesa/SConscript | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src') diff --git a/src/mesa/SConscript b/src/mesa/SConscript index 5c02abc914..41fa0645fe 100644 --- a/src/mesa/SConscript +++ b/src/mesa/SConscript @@ -53,6 +53,7 @@ if env['platform'] != 'winddk': 'main/dlist.c', 'main/dlopen.c', 'main/drawpix.c', + 'main/drawtex.c', 'main/enable.c', 'main/enums.c', 'main/eval.c', @@ -106,6 +107,7 @@ if env['platform'] != 'winddk': 'main/texgetimage.c', 'main/teximage.c', 'main/texobj.c', + 'main/texpal.c', 'main/texparam.c', 'main/texrender.c', 'main/texstate.c', @@ -176,6 +178,7 @@ if env['platform'] != 'winddk': 'state_tracker/st_cb_condrender.c', 'state_tracker/st_cb_flush.c', 'state_tracker/st_cb_drawpixels.c', + 'state_tracker/st_cb_drawtex.c', 'state_tracker/st_cb_eglimage.c', 'state_tracker/st_cb_fbo.c', 'state_tracker/st_cb_feedback.c', -- cgit v1.2.3 From c843a60e6319f38991a3519c11a6525416593c04 Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Fri, 20 Aug 2010 13:11:58 +0200 Subject: gallium/docs: improve documentation for resources --- src/gallium/docs/source/resources.rst | 160 +++++++++++++++++++++++++++++++++- 1 file changed, 157 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/gallium/docs/source/resources.rst b/src/gallium/docs/source/resources.rst index a380e5080c..c8a5766821 100644 --- a/src/gallium/docs/source/resources.rst +++ b/src/gallium/docs/source/resources.rst @@ -1,11 +1,26 @@ -Resources -========= +Resources and derived objects +============================= Resources represent objects that hold data: textures and buffers. They are mostly modelled after the resources in Direct3D 10/11, but with a different transfer/update mechanism, and more features for OpenGL support. +Resources can be used in several ways, and it is required to specify all planned uses through an appropriate set of bind flags. + +TODO: write much more on resources + +Transfers +--------- + +Transfers are the mechanism used to access resources with the CPU. + +OpenGL: OpenGL supports mapping buffers and has inline transfer functions for both buffers and textures + +D3D11: D3D11 lacks transfers, but has special resource types that are mappable to the CPU address space + +TODO: write much more on transfers + Resource targets ---------------- @@ -21,21 +36,160 @@ that depend on the hardware generation. TODO: can buffers have a non-R8 format? +PIPE_BUFFER +^^^^^^^^^^^ + +Buffer resource: can be used as a vertex, index, constant buffer (appropriate bind flags must be requested). + +They can be bound to stream output if supported. +TODO: what about the restrictions lifted by the several later GL transform feedback extensions? How does one advertise that in Gallium? + +They can be also be bound to a shader stage as usual. +TODO: are all drivers supposed to support this? how does this work exactly? are there size limits? + +They can be also be bound to the framebuffer as usual. +TODO: are all drivers supposed to support this? how does this work exactly? are there size limits? +TODO: is there any chance of supporting GL pixel buffer object acceleration with this? + +- depth0 must be 1 +- last_level must be 0 +- TODO: what about normalization? +- TODO: wrap modes/other sampling state? +- TODO: are arbitrary formats supported? in which cases? + +OpenGL: vertex buffers in GL 1.5 or GL_ARB_vertex_buffer_object + +- Binding to stream out requires GL 3.0 or GL_NV_transform_feedback +- Binding as constant buffers requires GL 3.1 or GL_ARB_uniform_buffer_object +- Binding to a sampling stage requires GL 3.1 or GL_ARB_texture_buffer_object +- TODO: can they be bound to an FBO? + +D3D11: buffer resources +- Binding to a render target requires D3D_FEATURE_LEVEL_10_0 + +PIPE_TEXTURE_1D +^^^^^^^^^^^^^^^ +1D surface accessed with normalized coordinates. + +UNIMPLEMENTED: 1D texture arrays not supported + +- If PIPE_CAP_NPOT_TEXTURES is not supported, + width must be a power of two +- height0 must be 1 +- depth0 must be 1 +- Mipmaps can be used +- Must use normalized coordinates + +OpenGL: GL_TEXTURE_1D in GL 1.0 + +- PIPE_CAP_NPOT_TEXTURES is equivalent to GL 2.0 or GL_ARB_texture_non_power_of_two + +D3D11: 1D textures in D3D_FEATURE_LEVEL_10_0 + PIPE_TEXTURE_RECT ^^^^^^^^^^^^^^^^^ 2D surface with OpenGL GL_TEXTURE_RECTANGLE semantics. -depth must be 1 +- depth0 must be 1 - last_level must be 0 - Must use unnormalized coordinates - Must use a clamp wrap mode +OpenGL: GL_TEXTURE_RECTANGLE in GL 3.1 or GL_ARB_texture_rectangle or GL_NV_texture_rectangle + +OpenCL: can create OpenCL images based on this, that can then be sampled arbitrarily + +D3D11: not supported (only PIPE_TEXTURE_2D with normalized coordinates is supported) + PIPE_TEXTURE_2D ^^^^^^^^^^^^^^^ 2D surface accessed with normalized coordinates. +UNIMPLEMENTED: 2D texture arrays not supported + - If PIPE_CAP_NPOT_TEXTURES is not supported, width and height must be powers of two +- depth0 must be 1 - Mipmaps can be used - Must use normalized coordinates - No special restrictions on wrap modes + +OpenGL: GL_TEXTURE_2D in GL 1.0 + +- PIPE_CAP_NPOT_TEXTURES is equivalent to GL 2.0 or GL_ARB_texture_non_power_of_two + +OpenCL: can create OpenCL images based on this, that can then be sampled arbitrarily + +D3D11: 2D textures + +- PIPE_CAP_NPOT_TEXTURES is equivalent to D3D_FEATURE_LEVEL_9_3 + +PIPE_TEXTURE_3D +^^^^^^^^^^^^^^^ + +3-dimensional array of texels. +Mipmap dimensions are reduced in all 3 coordinates. + +- If PIPE_CAP_NPOT_TEXTURES is not supported, + width, height and depth must be powers of two +- Must use normalized coordinates + +OpenGL: GL_TEXTURE_3D in GL 1.2 or GL_EXT_texture3D + +- PIPE_CAP_NPOT_TEXTURES is equivalent to GL 2.0 or GL_ARB_texture_non_power_of_two + +D3D11: 3D textures + +- PIPE_CAP_NPOT_TEXTURES is equivalent to D3D_FEATURE_LEVEL_10_0 + +PIPE_TEXTURE_CUBE +^^^^^^^^^^^^^^^^^ + +Cube maps consist of 6 2D faces. +The 6 surfaces form an imaginary cube, and sampling happens by mapping an +input 3-vector to the point of the cube surface in that direction. + +Sampling may be optionally seamless, resulting in filtering taking samples +from multiple surfaces near to the edge. +UNIMPLEMENTED: seamless cube map sampling not supported + +UNIMPLEMENTED: cube map arrays not supported + +- Width and height must be equal +- If PIPE_CAP_NPOT_TEXTURES is not supported, + width and height must be powers of two +- Must use normalized coordinates + +OpenGL: GL_TEXTURE_CUBE_MAP in GL 1.3 or EXT_texture_cube_map + +- PIPE_CAP_NPOT_TEXTURES is equivalent to GL 2.0 or GL_ARB_texture_non_power_of_two +- Seamless cube maps require GL 3.2 or GL_ARB_seamless_cube_map or GL_AMD_seamless_cubemap_per_texture +- Cube map arrays require GL 4.0 or GL_ARB_texture_cube_map_array + +D3D11: 2D array textures with the D3D11_RESOURCE_MISC_TEXTURECUBE flag + +- PIPE_CAP_NPOT_TEXTURES is equivalent to D3D_FEATURE_LEVEL_10_0 +- Cube map arrays require D3D_FEATURE_LEVEL_10_1 +- TODO: are (non)seamless cube maps supported in D3D11? how? + +Surfaces +-------- + +Surfaces are views of a resource that can be bound as a framebuffer to serve as the render target or depth buffer. + +TODO: write much more on surfaces + +OpenGL: FBOs are collections of surfaces in GL 3.0 or GL_ARB_framebuffer_object + +D3D11: render target views and depth/stencil views + +Sampler views +------------- + +Sampler views are views of a resource that can be bound to a pipeline stage to be sampled from shaders. + +TODO: write much more on sampler views + +OpenGL: texture objects are actually sampler view and resource in a single unit + +D3D11: shader resource views -- cgit v1.2.3 From 3aaec4750d6fda39b3bb4fc0a159fba1655feede Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Fri, 20 Aug 2010 16:35:34 +0200 Subject: u_staging: improve interface --- src/gallium/auxiliary/util/u_staging.c | 10 +++------- src/gallium/auxiliary/util/u_staging.h | 8 ++++---- 2 files changed, 7 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/gallium/auxiliary/util/u_staging.c b/src/gallium/auxiliary/util/u_staging.c index e2dc696d20..363e1c864b 100644 --- a/src/gallium/auxiliary/util/u_staging.c +++ b/src/gallium/auxiliary/util/u_staging.c @@ -23,20 +23,16 @@ util_staging_resource_template(struct pipe_resource *pt, unsigned width, unsigne } struct util_staging_transfer * -util_staging_transfer_new(struct pipe_context *pipe, +util_staging_transfer_init(struct pipe_context *pipe, struct pipe_resource *pt, struct pipe_subresource sr, unsigned usage, const struct pipe_box *box, - bool direct) + bool direct, struct util_staging_transfer *tx) { struct pipe_screen *pscreen = pipe->screen; - struct util_staging_transfer *tx; - struct pipe_resource staging_resource_template; - tx = CALLOC_STRUCT(util_staging_transfer); - if (!tx) - return NULL; + struct pipe_resource staging_resource_template; pipe_resource_reference(&tx->base.resource, pt); tx->base.sr = sr; diff --git a/src/gallium/auxiliary/util/u_staging.h b/src/gallium/auxiliary/util/u_staging.h index 602faa2971..3a9da9b401 100644 --- a/src/gallium/auxiliary/util/u_staging.h +++ b/src/gallium/auxiliary/util/u_staging.h @@ -21,15 +21,15 @@ struct util_staging_transfer { }; /* user must be stride, slice_stride and offset */ -/* pt->usage == PIPE_USAGE_DYNAMIC should be a good value to pass for direct */ -/* staging resource is currently created with PIPE_USAGE_DYNAMIC */ +/* pt->usage == PIPE_USAGE_DYNAMIC || pt->usage == PIPE_USAGE_STAGING should be a good value to pass for direct */ +/* staging resource is currently created with PIPE_USAGE_STAGING */ struct util_staging_transfer * -util_staging_transfer_new(struct pipe_context *pipe, +util_staging_transfer_init(struct pipe_context *pipe, struct pipe_resource *pt, struct pipe_subresource sr, unsigned usage, const struct pipe_box *box, - bool direct); + bool direct, struct util_staging_transfer *tx); void util_staging_transfer_destroy(struct pipe_context *pipe, struct pipe_transfer *ptx); -- cgit v1.2.3 From 63d010115c7972d854e0583f8f74e8d0c3407fcd Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Tue, 17 Aug 2010 16:07:23 +1000 Subject: r600g: add occlusion query support Signed-off-by: Dave Airlie Signed-off-by: Jerome Glisse --- src/gallium/drivers/r600/r600_blit.c | 34 +++-- src/gallium/drivers/r600/r600_context.c | 13 +- src/gallium/drivers/r600/r600_context.h | 37 +++++- src/gallium/drivers/r600/r600_query.c | 208 +++++++++++++++++++++++++++++- src/gallium/drivers/r600/r600_state.c | 1 - src/gallium/drivers/r600/radeon.h | 30 +++-- src/gallium/winsys/r600/drm/r600_state.c | 36 ++++++ src/gallium/winsys/r600/drm/r600_states.h | 25 ++-- src/gallium/winsys/r600/drm/r600d.h | 1 + src/gallium/winsys/r600/drm/radeon_ctx.c | 36 +++++- 10 files changed, 379 insertions(+), 42 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/r600_blit.c b/src/gallium/drivers/r600/r600_blit.c index db7aef7ebd..aef4fbd9af 100644 --- a/src/gallium/drivers/r600/r600_blit.c +++ b/src/gallium/drivers/r600/r600_blit.c @@ -32,8 +32,10 @@ #include "r600_screen.h" #include "r600_context.h" -static void r600_blitter_save_states(struct r600_context *rctx) +static void r600_blitter_save_states(struct pipe_context *ctx) { + struct r600_context *rctx = r600_context(ctx); + util_blitter_save_blend(rctx->blitter, rctx->blend); util_blitter_save_depth_stencil_alpha(rctx->blitter, rctx->dsa); if (rctx->stencil_ref) { @@ -47,8 +49,9 @@ static void r600_blitter_save_states(struct r600_context *rctx) if (rctx->viewport) { util_blitter_save_viewport(rctx->blitter, &rctx->viewport->state.viewport); } - if (rctx->clip) - util_blitter_save_clip(rctx->blitter, &rctx->clip->state.clip); + if (rctx->clip) { + util_blitter_save_clip(rctx->blitter, &rctx->clip->state.clip); + } util_blitter_save_vertex_buffers(rctx->blitter, rctx->nvertex_buffer, rctx->vertex_buffer); @@ -60,37 +63,44 @@ static void r600_blitter_save_states(struct r600_context *rctx) rctx->rasterizer = NULL; rctx->dsa = NULL; rctx->vertex_elements = NULL; + + /* suspend queries */ + r600_queries_suspend(ctx); } static void r600_clear(struct pipe_context *ctx, unsigned buffers, - const float *rgba, double depth, unsigned stencil) + const float *rgba, double depth, unsigned stencil) { struct r600_context *rctx = r600_context(ctx); struct pipe_framebuffer_state *fb = &rctx->framebuffer->state.framebuffer; - r600_blitter_save_states(rctx); + r600_blitter_save_states(ctx); util_blitter_clear(rctx->blitter, fb->width, fb->height, fb->nr_cbufs, buffers, rgba, depth, stencil); + /* resume queries */ + r600_queries_resume(ctx); } -static void r600_clear_render_target(struct pipe_context *pipe, +static void r600_clear_render_target(struct pipe_context *ctx, struct pipe_surface *dst, const float *rgba, unsigned dstx, unsigned dsty, unsigned width, unsigned height) { - struct r600_context *rctx = r600_context(pipe); + struct r600_context *rctx = r600_context(ctx); struct pipe_framebuffer_state *fb = &rctx->framebuffer->state.framebuffer; - r600_blitter_save_states(rctx); + r600_blitter_save_states(ctx); util_blitter_save_framebuffer(rctx->blitter, fb); util_blitter_clear_render_target(rctx->blitter, dst, rgba, dstx, dsty, width, height); + /* resume queries */ + r600_queries_resume(ctx); } -static void r600_clear_depth_stencil(struct pipe_context *pipe, +static void r600_clear_depth_stencil(struct pipe_context *ctx, struct pipe_surface *dst, unsigned clear_flags, double depth, @@ -98,14 +108,16 @@ static void r600_clear_depth_stencil(struct pipe_context *pipe, unsigned dstx, unsigned dsty, unsigned width, unsigned height) { - struct r600_context *rctx = r600_context(pipe); + struct r600_context *rctx = r600_context(ctx); struct pipe_framebuffer_state *fb = &rctx->framebuffer->state.framebuffer; - r600_blitter_save_states(rctx); + r600_blitter_save_states(ctx); util_blitter_save_framebuffer(rctx->blitter, fb); util_blitter_clear_depth_stencil(rctx->blitter, dst, clear_flags, depth, stencil, dstx, dsty, width, height); + /* resume queries */ + r600_queries_resume(ctx); } static void r600_resource_copy_region(struct pipe_context *pipe, diff --git a/src/gallium/drivers/r600/r600_context.c b/src/gallium/drivers/r600/r600_context.c index edde80c660..2f59a550f5 100644 --- a/src/gallium/drivers/r600/r600_context.c +++ b/src/gallium/drivers/r600/r600_context.c @@ -34,6 +34,7 @@ #include "r600_resource.h" #include "r600d.h" + static void r600_destroy_context(struct pipe_context *context) { struct r600_context *rctx = r600_context(context); @@ -46,26 +47,34 @@ void r600_flush(struct pipe_context *ctx, unsigned flags, { struct r600_context *rctx = r600_context(ctx); struct r600_screen *rscreen = rctx->screen; + struct r600_query *rquery; static int dc = 0; char dname[256]; + /* suspend queries */ + r600_queries_suspend(rctx); if (radeon_ctx_pm4(rctx->ctx)) - return; + goto out; /* FIXME dumping should be removed once shader support instructions * without throwing bad code */ if (!rctx->ctx->cpm4) goto out; sprintf(dname, "gallium-%08d.bof", dc); - if (dc < 1) + if (dc < 10) radeon_ctx_dump_bof(rctx->ctx, dname); #if 1 radeon_ctx_submit(rctx->ctx); #endif + LIST_FOR_EACH_ENTRY(rquery, &rctx->query_list, list) { + rquery->flushed = true; + } dc++; out: rctx->ctx = radeon_ctx_decref(rctx->ctx); rctx->ctx = radeon_ctx(rscreen->rw); + /* resume queries */ + r600_queries_resume(rctx); } static void r600_init_config(struct r600_context *rctx) diff --git a/src/gallium/drivers/r600/r600_context.h b/src/gallium/drivers/r600/r600_context.h index 2ce29720d9..900aa9fd0c 100644 --- a/src/gallium/drivers/r600/r600_context.h +++ b/src/gallium/drivers/r600/r600_context.h @@ -30,9 +30,32 @@ #include #include #include +#include #include "radeon.h" #include "r600_shader.h" +#define R600_QUERY_STATE_STARTED (1 << 0) +#define R600_QUERY_STATE_ENDED (1 << 1) +#define R600_QUERY_STATE_SUSPENDED (1 << 2) + +struct r600_query { + u64 result; + /* The kind of query. Currently only OQ is supported. */ + unsigned type; + /* How many results have been written, in dwords. It's incremented + * after end_query and flush. */ + unsigned num_results; + /* if we've flushed the query */ + boolean flushed; + unsigned state; + /* The buffer where query results are stored. */ + struct radeon_bo *buffer; + unsigned buffer_size; + /* linked list of queries */ + struct list_head list; + struct radeon_state *rstate; +}; + /* XXX move this to a more appropriate place */ union pipe_states { struct pipe_rasterizer_state rasterizer; @@ -142,7 +165,8 @@ struct r600_context { struct r600_vertex_element *vertex_elements; struct pipe_vertex_buffer vertex_buffer[PIPE_MAX_ATTRIBS]; struct pipe_index_buffer index_buffer; - struct pipe_blend_color blend_color; + struct pipe_blend_color blend_color; + struct list_head query_list; }; /* Convenience cast wrapper. */ @@ -151,6 +175,11 @@ static INLINE struct r600_context *r600_context(struct pipe_context *pipe) return (struct r600_context*)pipe; } +static INLINE struct r600_query* r600_query(struct pipe_query* q) +{ + return (struct r600_query*)q; +} + struct r600_context_state *r600_context_state(struct r600_context *rctx, unsigned type, const void *state); struct r600_context_state *r600_context_state_incref(struct r600_context_state *rstate); struct r600_context_state *r600_context_state_decref(struct r600_context_state *rstate); @@ -179,4 +208,10 @@ extern int r600_pipe_shader_update(struct pipe_context *ctx, uint32_t r600_translate_texformat(enum pipe_format format, const unsigned char *swizzle_view, uint32_t *word4_p, uint32_t *yuv_format_p); + +/* query */ +extern void r600_queries_resume(struct pipe_context *ctx); +extern void r600_queries_suspend(struct pipe_context *ctx); + + #endif diff --git a/src/gallium/drivers/r600/r600_query.c b/src/gallium/drivers/r600/r600_query.c index 9b02ae680e..5929606cd2 100644 --- a/src/gallium/drivers/r600/r600_query.c +++ b/src/gallium/drivers/r600/r600_query.c @@ -24,39 +24,233 @@ * Jerome Glisse * Corbin Simpson */ +#include #include #include #include #include "r600_screen.h" #include "r600_context.h" -static struct pipe_query *r600_create_query(struct pipe_context *pipe, unsigned query_type) +static struct radeon_state *r600_query_begin(struct r600_context *rctx, struct r600_query *rquery) { - return NULL; + struct r600_screen *rscreen = rctx->screen; + struct radeon_state *rstate; + + rstate = radeon_state(rscreen->rw, R600_QUERY_BEGIN_TYPE, R600_QUERY_BEGIN); + if (rstate == NULL) + return NULL; + rstate->states[R600_QUERY__OFFSET] = rquery->num_results; + rstate->bo[0] = radeon_bo_incref(rscreen->rw, rquery->buffer); + rstate->nbo = 1; + rstate->placement[0] = RADEON_GEM_DOMAIN_GTT; + if (radeon_state_pm4(rstate)) { + radeon_state_decref(rstate); + return NULL; + } + return rstate; +} + +static struct radeon_state *r600_query_end(struct r600_context *rctx, struct r600_query *rquery) +{ + struct r600_screen *rscreen = rctx->screen; + struct radeon_state *rstate; + + rstate = radeon_state(rscreen->rw, R600_QUERY_END_TYPE, R600_QUERY_END); + if (rstate == NULL) + return NULL; + rstate->states[R600_QUERY__OFFSET] = rquery->num_results + 8; + rstate->bo[0] = radeon_bo_incref(rscreen->rw, rquery->buffer); + rstate->nbo = 1; + rstate->placement[0] = RADEON_GEM_DOMAIN_GTT; + if (radeon_state_pm4(rstate)) { + radeon_state_decref(rstate); + return NULL; + } + return rstate; } -static void r600_destroy_query(struct pipe_context *pipe, struct pipe_query *query) +static struct pipe_query *r600_create_query(struct pipe_context *ctx, unsigned query_type) { + struct r600_screen *rscreen = r600_screen(ctx->screen); + struct r600_context *rctx = r600_context(ctx); + struct r600_query *q; + + if (query_type != PIPE_QUERY_OCCLUSION_COUNTER) + return NULL; + + q = CALLOC_STRUCT(r600_query); + if (!q) + return NULL; + + q->type = query_type; + LIST_ADDTAIL(&q->list, &rctx->query_list); + q->buffer_size = 4096; + + q->buffer = radeon_bo(rscreen->rw, 0, q->buffer_size, 1, NULL); + if (!q->buffer) { + FREE(q); + return NULL; + } + return (struct pipe_query *)q; +} + +static void r600_destroy_query(struct pipe_context *ctx, + struct pipe_query *query) +{ + struct r600_screen *rscreen = r600_screen(ctx->screen); + struct r600_query *q = r600_query(query); + + radeon_bo_decref(rscreen->rw, q->buffer); + LIST_DEL(&q->list); FREE(query); } -static void r600_begin_query(struct pipe_context *pipe, struct pipe_query *query) +static void r600_query_result(struct pipe_context *ctx, struct r600_query *rquery) { + struct r600_screen *rscreen = r600_screen(ctx->screen); + u64 start, end; + u32 *results; + int i; + + radeon_bo_wait(rscreen->rw, rquery->buffer); + radeon_bo_map(rscreen->rw, rquery->buffer); + results = rquery->buffer->data; + for (i = 0; i < rquery->num_results; i += 4) { + start = (u64)results[i] | (u64)results[i + 1] << 32; + end = (u64)results[i + 2] | (u64)results[i + 3] << 32; + if ((start & 0x8000000000000000UL) && (end & 0x8000000000000000UL)) { + rquery->result += end - start; + } + } + radeon_bo_unmap(rscreen->rw, rquery->buffer); + rquery->num_results = 0; } -static void r600_end_query(struct pipe_context *pipe, struct pipe_query *query) +static void r600_query_resume(struct pipe_context *ctx, struct r600_query *rquery) { + struct r600_context *rctx = r600_context(ctx); + + if (rquery->num_results >= ((rquery->buffer_size >> 2) - 2)) { + /* running out of space */ + if (!rquery->flushed) { + ctx->flush(ctx, 0, NULL); + } + r600_query_result(ctx, rquery); + } + rquery->rstate = radeon_state_decref(rquery->rstate); + rquery->rstate = r600_query_begin(rctx, rquery); + rquery->flushed = false; +} + +static void r600_query_suspend(struct pipe_context *ctx, struct r600_query *rquery) +{ + struct r600_context *rctx = r600_context(ctx); + + rquery->rstate = radeon_state_decref(rquery->rstate); + rquery->rstate = r600_query_end(rctx, rquery); + rquery->num_results += 16; } -static boolean r600_get_query_result(struct pipe_context *pipe, +static void r600_begin_query(struct pipe_context *ctx, struct pipe_query *query) +{ + struct r600_context *rctx = r600_context(ctx); + struct r600_query *rquery = r600_query(query); + int r; + + rquery->state = R600_QUERY_STATE_STARTED; + rquery->num_results = 0; + rquery->flushed = false; + r600_query_resume(ctx, rquery); + r = radeon_ctx_set_query_state(rctx->ctx, rquery->rstate); + if (r == -EBUSY) { + /* this shouldn't happen */ + R600_ERR("had to flush while emitting end query\n"); + ctx->flush(ctx, 0, NULL); + r = radeon_ctx_set_query_state(rctx->ctx, rquery->rstate); + } +} + +static void r600_end_query(struct pipe_context *ctx, struct pipe_query *query) +{ + struct r600_context *rctx = r600_context(ctx); + struct r600_query *rquery = r600_query(query); + int r; + + rquery->state &= ~R600_QUERY_STATE_STARTED; + rquery->state |= R600_QUERY_STATE_ENDED; + r600_query_suspend(ctx, rquery); + r = radeon_ctx_set_query_state(rctx->ctx, rquery->rstate); + if (r == -EBUSY) { + /* this shouldn't happen */ + R600_ERR("had to flush while emitting end query\n"); + ctx->flush(ctx, 0, NULL); + r = radeon_ctx_set_query_state(rctx->ctx, rquery->rstate); + } +} + +void r600_queries_suspend(struct pipe_context *ctx) +{ + struct r600_context *rctx = r600_context(ctx); + struct r600_query *rquery; + int r; + + LIST_FOR_EACH_ENTRY(rquery, &rctx->query_list, list) { + if (rquery->state & R600_QUERY_STATE_STARTED) { + r600_query_suspend(ctx, rquery); + r = radeon_ctx_set_query_state(rctx->ctx, rquery->rstate); + if (r == -EBUSY) { + /* this shouldn't happen */ + R600_ERR("had to flush while emitting end query\n"); + ctx->flush(ctx, 0, NULL); + r = radeon_ctx_set_query_state(rctx->ctx, rquery->rstate); + } + } + rquery->state |= R600_QUERY_STATE_SUSPENDED; + } +} + +void r600_queries_resume(struct pipe_context *ctx) +{ + struct r600_context *rctx = r600_context(ctx); + struct r600_query *rquery; + int r; + + LIST_FOR_EACH_ENTRY(rquery, &rctx->query_list, list) { + if (rquery->state & R600_QUERY_STATE_STARTED) { + r600_query_resume(ctx, rquery); + r = radeon_ctx_set_query_state(rctx->ctx, rquery->rstate); + if (r == -EBUSY) { + /* this shouldn't happen */ + R600_ERR("had to flush while emitting end query\n"); + ctx->flush(ctx, 0, NULL); + r = radeon_ctx_set_query_state(rctx->ctx, rquery->rstate); + } + } + rquery->state &= ~R600_QUERY_STATE_SUSPENDED; + } +} + +static boolean r600_get_query_result(struct pipe_context *ctx, struct pipe_query *query, - boolean wait, void *result) + boolean wait, void *vresult) { + struct r600_query *rquery = r600_query(query); + uint64_t *result = (uint64_t*)vresult; + + if (!rquery->flushed) { + ctx->flush(ctx, 0, NULL); + rquery->flushed = true; + } + r600_query_result(ctx, rquery); + *result = rquery->result; + rquery->result = 0; return TRUE; } void r600_init_query_functions(struct r600_context* rctx) { + LIST_INITHEAD(&rctx->query_list); + rctx->context.create_query = r600_create_query; rctx->context.destroy_query = r600_destroy_query; rctx->context.begin_query = r600_begin_query; diff --git a/src/gallium/drivers/r600/r600_state.c b/src/gallium/drivers/r600/r600_state.c index 7d2b61f9b0..3943ebacb3 100644 --- a/src/gallium/drivers/r600/r600_state.c +++ b/src/gallium/drivers/r600/r600_state.c @@ -268,7 +268,6 @@ static void r600_set_blend_color(struct pipe_context *ctx, static void r600_set_clip_state(struct pipe_context *ctx, const struct pipe_clip_state *state) { - struct r600_screen *rscreen = r600_screen(ctx->screen); struct r600_context *rctx = r600_context(ctx); struct r600_context_state *rstate; diff --git a/src/gallium/drivers/r600/radeon.h b/src/gallium/drivers/r600/radeon.h index d36c89d6a7..b2cc74f696 100644 --- a/src/gallium/drivers/r600/radeon.h +++ b/src/gallium/drivers/r600/radeon.h @@ -151,6 +151,7 @@ struct radeon_ctx *radeon_ctx(struct radeon *radeon); struct radeon_ctx *radeon_ctx_decref(struct radeon_ctx *ctx); struct radeon_ctx *radeon_ctx_incref(struct radeon_ctx *ctx); int radeon_ctx_set_draw(struct radeon_ctx *ctx, struct radeon_draw *draw); +int radeon_ctx_set_query_state(struct radeon_ctx *ctx, struct radeon_state *state); int radeon_ctx_set_draw_new(struct radeon_ctx *ctx, struct radeon_draw *draw); int radeon_ctx_pm4(struct radeon_ctx *ctx); int radeon_ctx_submit(struct radeon_ctx *ctx); @@ -191,8 +192,8 @@ struct radeon_ctx { * R600/R700 */ -#define R600_NSTATE 1286 -#define R600_NTYPE 33 +#define R600_NSTATE 1288 +#define R600_NTYPE 35 #define R600_CONFIG 0 #define R600_CONFIG_TYPE 0 @@ -252,14 +253,18 @@ struct radeon_ctx { #define R600_CB6_TYPE 27 #define R600_CB7 1276 #define R600_CB7_TYPE 28 -#define R600_DB 1277 -#define R600_DB_TYPE 29 -#define R600_CLIP 1278 -#define R600_CLIP_TYPE 30 -#define R600_VGT 1284 -#define R600_VGT_TYPE 31 -#define R600_DRAW 1285 -#define R600_DRAW_TYPE 32 +#define R600_QUERY_BEGIN 1277 +#define R600_QUERY_BEGIN_TYPE 29 +#define R600_QUERY_END 1278 +#define R600_QUERY_END_TYPE 30 +#define R600_DB 1279 +#define R600_DB_TYPE 31 +#define R600_CLIP 1280 +#define R600_CLIP_TYPE 32 +#define R600_VGT 1286 +#define R600_VGT_TYPE 33 +#define R600_DRAW 1287 +#define R600_DRAW_TYPE 34 /* R600_CONFIG */ #define R600_CONFIG__SQ_CONFIG 0 @@ -653,4 +658,9 @@ struct radeon_ctx { #define R600_CLIP__PA_CL_UCP_W_0 3 #define R600_CLIP_SIZE 4 #define R600_CLIP_PM4 128 +/* R600 QUERY BEGIN/END */ +#define R600_QUERY__OFFSET 0 +#define R600_QUERY_SIZE 1 +#define R600_QUERY_PM4 128 + #endif diff --git a/src/gallium/winsys/r600/drm/r600_state.c b/src/gallium/winsys/r600/drm/r600_state.c index 2facec75de..9b7c11bdc0 100644 --- a/src/gallium/winsys/r600/drm/r600_state.c +++ b/src/gallium/winsys/r600/drm/r600_state.c @@ -38,6 +38,8 @@ static int r600_state_pm4_shader(struct radeon_state *state); static int r600_state_pm4_draw(struct radeon_state *state); static int r600_state_pm4_config(struct radeon_state *state); static int r600_state_pm4_generic(struct radeon_state *state); +static int r600_state_pm4_query_begin(struct radeon_state *state); +static int r600_state_pm4_query_end(struct radeon_state *state); static int r700_state_pm4_config(struct radeon_state *state); static int r700_state_pm4_cb0(struct radeon_state *state); static int r700_state_pm4_db(struct radeon_state *state); @@ -240,6 +242,40 @@ static int r600_state_pm4_config(struct radeon_state *state) return r600_state_pm4_generic(state); } +static int r600_state_pm4_query_begin(struct radeon_state *state) +{ + int r; + + state->cpm4 = 0; + state->pm4[state->cpm4++] = PKT3(PKT3_EVENT_WRITE, 2); + state->pm4[state->cpm4++] = EVENT_TYPE_ZPASS_DONE; + state->pm4[state->cpm4++] = state->states[0]; + state->pm4[state->cpm4++] = 0x0; + state->pm4[state->cpm4++] = PKT3(PKT3_NOP, 0); + r = radeon_state_reloc(state, state->cpm4, 0); + if (r) + return r; + state->pm4[state->cpm4++] = state->bo[0]->handle; + return 0; +} + +static int r600_state_pm4_query_end(struct radeon_state *state) +{ + int r; + + state->cpm4 = 0; + state->pm4[state->cpm4++] = PKT3(PKT3_EVENT_WRITE, 2); + state->pm4[state->cpm4++] = EVENT_TYPE_ZPASS_DONE; + state->pm4[state->cpm4++] = state->states[0]; + state->pm4[state->cpm4++] = 0x0; + state->pm4[state->cpm4++] = PKT3(PKT3_NOP, 0); + r = radeon_state_reloc(state, state->cpm4, 0); + if (r) + return r; + state->pm4[state->cpm4++] = state->bo[0]->handle; + return 0; +} + static int r700_state_pm4_config(struct radeon_state *state) { state->pm4[state->cpm4++] = PKT3(PKT3_CONTEXT_CONTROL, 1); diff --git a/src/gallium/winsys/r600/drm/r600_states.h b/src/gallium/winsys/r600/drm/r600_states.h index 2d7a1d31c8..b5365e4275 100644 --- a/src/gallium/winsys/r600/drm/r600_states.h +++ b/src/gallium/winsys/r600/drm/r600_states.h @@ -479,6 +479,10 @@ static const struct radeon_register R600_DRAW_names[] = { {0x000287F0, 0, 0, "VGT_DRAW_INITIATOR"}, }; +static const struct radeon_register R600_VGT_EVENT_names[] = { + {0x00028A90, 1, 0, "VGT_EVENT_INITIATOR"}, +}; + static struct radeon_type R600_types[] = { { 128, 0, 0x00000000, 0x00000000, 0x0000, 0, "R600_CONFIG", 41, r600_state_pm4_config, R600_CONFIG_names}, { 128, 1, 0x00000000, 0x00000000, 0x0000, 0, "R600_CB_CNTL", 18, r600_state_pm4_generic, R600_CB_CNTL_names}, @@ -509,11 +513,12 @@ static struct radeon_type R600_types[] = { { 128, 1274, 0x00000000, 0x00000000, 0x0000, 0, "R600_CB5", 7, r600_state_pm4_cb0, R600_CB5_names}, { 128, 1275, 0x00000000, 0x00000000, 0x0000, 0, "R600_CB6", 7, r600_state_pm4_cb0, R600_CB6_names}, { 128, 1276, 0x00000000, 0x00000000, 0x0000, 0, "R600_CB7", 7, r600_state_pm4_cb0, R600_CB7_names}, - { 128, 1277, 0x00000000, 0x00000000, 0x0000, 0, "R600_DB", 6, r600_state_pm4_db, R600_DB_names}, - { 128, 1278, 0x00028e20, 0x00028e70, 0x0010, 0, "R600_UCP", 4, r600_state_pm4_generic, R600_UCP_names}, - { 128, 1284, 0x00000000, 0x00000000, 0x0000, 0, "R600_VGT", 11, r600_state_pm4_vgt, R600_VGT_names}, - { 128, 1285, 0x00000000, 0x00000000, 0x0000, 0, "R600_DRAW", 4, r600_state_pm4_draw, R600_DRAW_names}, - + { 128, 1277, 0x00000000, 0x00000000, 0x0000, 0, "R600_QUERY_BEGIN", 1, r600_state_pm4_query_begin, R600_VGT_EVENT_names}, + { 128, 1278, 0x00000000, 0x00000000, 0x0000, 0, "R600_QUERY_END", 1, r600_state_pm4_query_end, R600_VGT_EVENT_names}, + { 128, 1279, 0x00000000, 0x00000000, 0x0000, 0, "R600_DB", 6, r600_state_pm4_db, R600_DB_names}, + { 128, 1280, 0x00028e20, 0x00028e70, 0x0010, 0, "R600_UCP", 4, r600_state_pm4_generic, R600_UCP_names}, + { 128, 1286, 0x00000000, 0x00000000, 0x0000, 0, "R600_VGT", 11, r600_state_pm4_vgt, R600_VGT_names}, + { 128, 1287, 0x00000000, 0x00000000, 0x0000, 0, "R600_DRAW", 4, r600_state_pm4_draw, R600_DRAW_names}, }; static struct radeon_type R700_types[] = { @@ -546,10 +551,12 @@ static struct radeon_type R700_types[] = { { 128, 1274, 0x00000000, 0x00000000, 0x0000, 0, "R600_CB5", 7, r600_state_pm4_cb0, R600_CB5_names}, { 128, 1275, 0x00000000, 0x00000000, 0x0000, 0, "R600_CB6", 7, r600_state_pm4_cb0, R600_CB6_names}, { 128, 1276, 0x00000000, 0x00000000, 0x0000, 0, "R600_CB7", 7, r600_state_pm4_cb0, R600_CB7_names}, - { 128, 1277, 0x00000000, 0x00000000, 0x0000, 0, "R600_DB", 6, r700_state_pm4_db, R600_DB_names}, - { 128, 1278, 0x00028e20, 0x00028e70, 0x0010, 0, "R600_UCP", 4, r600_state_pm4_generic, R600_UCP_names}, - { 128, 1284, 0x00000000, 0x00000000, 0x0000, 0, "R600_VGT", 11, r600_state_pm4_vgt, R600_VGT_names}, - { 128, 1285, 0x00000000, 0x00000000, 0x0000, 0, "R600_DRAW", 4, r600_state_pm4_draw, R600_DRAW_names}, + { 128, 1277, 0x00000000, 0x00000000, 0x0000, 0, "R600_QUERY_BEGIN", 1, r600_state_pm4_query_begin, R600_VGT_EVENT_names}, + { 128, 1278, 0x00000000, 0x00000000, 0x0000, 0, "R600_QUERY_END", 1, r600_state_pm4_query_end, R600_VGT_EVENT_names}, + { 128, 1279, 0x00000000, 0x00000000, 0x0000, 0, "R600_DB", 6, r700_state_pm4_db, R600_DB_names}, + { 128, 1280, 0x00028e20, 0x00028e70, 0x0010, 0, "R600_UCP", 4, r600_state_pm4_generic, R600_UCP_names}, + { 128, 1286, 0x00000000, 0x00000000, 0x0000, 0, "R600_VGT", 11, r600_state_pm4_vgt, R600_VGT_names}, + { 128, 1287, 0x00000000, 0x00000000, 0x0000, 0, "R600_DRAW", 4, r600_state_pm4_draw, R600_DRAW_names}, }; #endif diff --git a/src/gallium/winsys/r600/drm/r600d.h b/src/gallium/winsys/r600/drm/r600d.h index 235b2b3d97..e8c2dc0651 100644 --- a/src/gallium/winsys/r600/drm/r600d.h +++ b/src/gallium/winsys/r600/drm/r600d.h @@ -82,6 +82,7 @@ #define PKT3_SET_CTL_CONST 0x6F #define PKT3_SURFACE_BASE_UPDATE 0x73 +#define EVENT_TYPE_ZPASS_DONE 0x15 #define EVENT_TYPE_CACHE_FLUSH_AND_INV_EVENT 0x16 #define PKT_TYPE_S(x) (((x) & 0x3) << 30) diff --git a/src/gallium/winsys/r600/drm/radeon_ctx.c b/src/gallium/winsys/r600/drm/radeon_ctx.c index 45b706bb0f..bd050c4cf9 100644 --- a/src/gallium/winsys/r600/drm/radeon_ctx.c +++ b/src/gallium/winsys/r600/drm/radeon_ctx.c @@ -224,6 +224,41 @@ static int radeon_ctx_state_schedule(struct radeon_ctx *ctx, struct radeon_state return 0; } +int radeon_ctx_set_query_state(struct radeon_ctx *ctx, struct radeon_state *state) +{ + void *tmp; + int r = 0; + + /* !!! ONLY ACCEPT QUERY STATE HERE !!! */ + if (state->type != R600_QUERY_BEGIN_TYPE && state->type != R600_QUERY_END_TYPE) { + return -EINVAL; + } + r = radeon_state_pm4(state); + if (r) + return r; + if ((ctx->draw_cpm4 + state->cpm4) > RADEON_CTX_MAX_PM4) { + /* need to flush */ + return -EBUSY; + } + if (state->cpm4 >= RADEON_CTX_MAX_PM4) { + fprintf(stderr, "%s single state too big %d, max %d\n", + __func__, state->cpm4, RADEON_CTX_MAX_PM4); + return -EINVAL; + } + tmp = realloc(ctx->state, (ctx->nstate + 1) * sizeof(void*)); + if (tmp == NULL) + return -ENOMEM; + ctx->state = tmp; + ctx->state[ctx->nstate++] = radeon_state_incref(state); + /* BEGIN/END query are balanced in the same cs so account for END + * END query when scheduling BEGIN query + */ + if (state->type == R600_QUERY_BEGIN_TYPE) { + ctx->draw_cpm4 += state->cpm4 * 2; + } + return 0; +} + int radeon_ctx_set_draw_new(struct radeon_ctx *ctx, struct radeon_draw *draw) { struct radeon_draw *pdraw = NULL; @@ -366,7 +401,6 @@ printf("%d pm4\n", ctx->cpm4); if (bo == NULL) goto out_err; size = bof_int32(ctx->bo[i]->size); -printf("[%d] %d bo\n", i, size); if (size == NULL) goto out_err; if (bof_object_set(bo, "size", size)) -- cgit v1.2.3 From d46f91af68e4930b84dd066687c4d865cb54c9b3 Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Wed, 18 Aug 2010 00:36:14 +0200 Subject: auxiliary: add functions to describe gallium objects --- src/gallium/auxiliary/Makefile | 1 + src/gallium/auxiliary/SConscript | 1 + src/gallium/auxiliary/util/u_debug_describe.c | 43 +++++++++++++++++++++++++++ src/gallium/auxiliary/util/u_debug_describe.h | 10 +++++++ 4 files changed, 55 insertions(+) create mode 100644 src/gallium/auxiliary/util/u_debug_describe.c create mode 100644 src/gallium/auxiliary/util/u_debug_describe.h (limited to 'src') diff --git a/src/gallium/auxiliary/Makefile b/src/gallium/auxiliary/Makefile index eb2a40cbaa..2dae479275 100644 --- a/src/gallium/auxiliary/Makefile +++ b/src/gallium/auxiliary/Makefile @@ -92,6 +92,7 @@ C_SOURCES = \ translate/translate.c \ translate/translate_cache.c \ util/u_debug.c \ + util/u_debug_describe.c \ util/u_debug_symbol.c \ util/u_debug_stack.c \ util/u_dump_defines.c \ diff --git a/src/gallium/auxiliary/SConscript b/src/gallium/auxiliary/SConscript index 30e5d02c9b..43774e3311 100644 --- a/src/gallium/auxiliary/SConscript +++ b/src/gallium/auxiliary/SConscript @@ -146,6 +146,7 @@ source = [ 'util/u_caps.c', 'util/u_cpu_detect.c', 'util/u_debug.c', + 'util/u_debug_describe.c', 'util/u_debug_memory.c', 'util/u_debug_stack.c', 'util/u_debug_symbol.c', diff --git a/src/gallium/auxiliary/util/u_debug_describe.c b/src/gallium/auxiliary/util/u_debug_describe.c new file mode 100644 index 0000000000..5c7808f7ec --- /dev/null +++ b/src/gallium/auxiliary/util/u_debug_describe.c @@ -0,0 +1,43 @@ +#include +#include +#include +#include + +void +debug_describe_reference(char* buf, const struct pipe_reference*ptr) +{ + strcpy(buf, "pipe_object"); +} + +void +debug_describe_resource(char* buf, const struct pipe_resource *ptr) +{ + if(ptr->target == PIPE_BUFFER) + util_sprintf(buf, "pipe_buffer<%u>", util_format_get_stride(ptr->format, ptr->width0)); + else if(ptr->target == PIPE_TEXTURE_1D) + util_sprintf(buf, "pipe_texture1d<%u,%s,%u>", ptr->width0, util_format_short_name(ptr->format), ptr->last_level); + else if(ptr->target == PIPE_TEXTURE_2D) + util_sprintf(buf, "pipe_texture2d<%u,%u,%s,%u>", ptr->width0, ptr->height0, util_format_short_name(ptr->format), ptr->last_level); + else if(ptr->target == PIPE_TEXTURE_CUBE) + util_sprintf(buf, "pipe_texture_cube<%u,%u,%s,%u>", ptr->width0, ptr->height0, util_format_short_name(ptr->format), ptr->last_level); + else if(ptr->target == PIPE_TEXTURE_3D) + util_sprintf(buf, "pipe_texture3d<%u,%u,%u,%s,%u>", ptr->width0, ptr->height0, ptr->depth0, util_format_short_name(ptr->format), ptr->last_level); + else + util_sprintf(buf, "pipe_martian_resource<%u>", ptr->target); +} + +void +debug_describe_surface(char* buf, const struct pipe_surface *ptr) +{ + char res[128]; + debug_describe_resource(res, ptr->texture); + util_sprintf(buf, "pipe_surface<%s,%u,%u,%u>", res, ptr->face, ptr->level, ptr->zslice); +} + +void +debug_describe_sampler_view(char* buf, const struct pipe_sampler_view *ptr) +{ + char res[128]; + debug_describe_resource(res, ptr->texture); + util_sprintf(buf, "pipe_sampler_view<%s,%s>", res, util_format_short_name(ptr->format)); +} diff --git a/src/gallium/auxiliary/util/u_debug_describe.h b/src/gallium/auxiliary/util/u_debug_describe.h new file mode 100644 index 0000000000..cab614bdc2 --- /dev/null +++ b/src/gallium/auxiliary/util/u_debug_describe.h @@ -0,0 +1,10 @@ +#ifndef U_DEBUG_DESCRIBE_H_ +#define U_DEBUG_DESCRIBE_H_ + +/* a 256-byte buffer is necessary and sufficient */ +void debug_describe_reference(char* buf, const struct pipe_reference*ptr); +void debug_describe_resource(char* buf, const struct pipe_resource *ptr); +void debug_describe_surface(char* buf, const struct pipe_surface *ptr); +void debug_describe_sampler_view(char* buf, const struct pipe_sampler_view *ptr); + +#endif /* U_DEBUG_DESCRIBE_H_ */ -- cgit v1.2.3 From 64c4f9c56645768aa3cc4a9a60b266a20acca0c2 Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Wed, 18 Aug 2010 00:38:19 +0200 Subject: u_debug_symbol: support getting a string without output --- src/gallium/auxiliary/util/u_debug_symbol.c | 38 ++++++++++++++++++----------- src/gallium/auxiliary/util/u_debug_symbol.h | 3 +++ 2 files changed, 27 insertions(+), 14 deletions(-) (limited to 'src') diff --git a/src/gallium/auxiliary/util/u_debug_symbol.c b/src/gallium/auxiliary/util/u_debug_symbol.c index 6e250575d6..7147bbc32b 100644 --- a/src/gallium/auxiliary/util/u_debug_symbol.c +++ b/src/gallium/auxiliary/util/u_debug_symbol.c @@ -33,6 +33,7 @@ */ #include "pipe/p_compiler.h" +#include "u_string.h" #include "u_debug.h" #include "u_debug_symbol.h" @@ -113,8 +114,8 @@ BOOL WINAPI j_SymGetSymFromAddr(HANDLE hProcess, DWORD Address, PDWORD Displacem } -static INLINE boolean -debug_symbol_print_imagehlp(const void *addr) +static INLINE void +debug_symbol_name_imagehlp(const void *addr, char* buf, unsigned size) { HANDLE hProcess; BYTE symbolBuffer[1024]; @@ -131,25 +132,34 @@ debug_symbol_print_imagehlp(const void *addr) if(j_SymInitialize(hProcess, NULL, TRUE)) bSymInitialized = TRUE; } - - if(!j_SymGetSymFromAddr(hProcess, (DWORD)addr, &dwDisplacement, pSymbol)) - return FALSE; - debug_printf("\t%s\n", pSymbol->Name); - - return TRUE; - + if(!j_SymGetSymFromAddr(hProcess, (DWORD)addr, &dwDisplacement, pSymbol)) + buf[0] = 0; + else + { + strncpy(buf, pSymbol->Name, size); + buf[size - 1] = 0; + } } #endif - void -debug_symbol_print(const void *addr) +debug_symbol_name(const void *addr, char* buf, unsigned size) { #if defined(PIPE_SUBSYSTEM_WINDOWS_USER) && defined(PIPE_ARCH_X86) - if(debug_symbol_print_imagehlp(addr)) + debug_symbol_name_imagehlp(addr, buf, size); + if(buf[0]) return; #endif - - debug_printf("\t%p\n", addr); + + util_snprintf(buf, size, "%p", addr); + buf[size - 1] = 0; +} + +void +debug_symbol_print(const void *addr) +{ + char buf[1024]; + debug_symbol_name(addr, buf, sizeof(buf)); + debug_printf("\t%s\n", buf); } diff --git a/src/gallium/auxiliary/util/u_debug_symbol.h b/src/gallium/auxiliary/util/u_debug_symbol.h index 021586987b..5e283e5ba3 100644 --- a/src/gallium/auxiliary/util/u_debug_symbol.h +++ b/src/gallium/auxiliary/util/u_debug_symbol.h @@ -42,6 +42,9 @@ extern "C" { #endif +void +debug_symbol_name(const void *addr, char* buf, unsigned size); + void debug_symbol_print(const void *addr); -- cgit v1.2.3 From b3e57fc8685af44dcf35a7f429b7410e63a9a571 Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Wed, 18 Aug 2010 00:39:49 +0200 Subject: u_debug_symbol: add support for getting symbol names from glibc --- src/gallium/auxiliary/util/u_debug_symbol.c | 23 +++++++++++++++++++++++ src/gallium/tools/addr2line.sh | 26 ++++++++++++++++++++++++++ 2 files changed, 49 insertions(+) create mode 100755 src/gallium/tools/addr2line.sh (limited to 'src') diff --git a/src/gallium/auxiliary/util/u_debug_symbol.c b/src/gallium/auxiliary/util/u_debug_symbol.c index 7147bbc32b..ebea517f90 100644 --- a/src/gallium/auxiliary/util/u_debug_symbol.c +++ b/src/gallium/auxiliary/util/u_debug_symbol.c @@ -143,6 +143,23 @@ debug_symbol_name_imagehlp(const void *addr, char* buf, unsigned size) } #endif +#ifdef __GLIBC__ +#include + +/* This can only provide dynamic symbols, or binary offsets into a file. + * + * To fix this, post-process the output with tools/addr2line.sh + */ +static INLINE void +debug_symbol_name_glibc(const void *addr, char* buf, unsigned size) +{ + char** syms = backtrace_symbols((void**)&addr, 1); + strncpy(buf, syms[0], size); + buf[size - 1] = 0; + free(syms); +} +#endif + void debug_symbol_name(const void *addr, char* buf, unsigned size) { @@ -152,6 +169,12 @@ debug_symbol_name(const void *addr, char* buf, unsigned size) return; #endif +#ifdef __GLIBC__ + debug_symbol_name_glibc(addr, buf, size); + if(buf[0]) + return; +#endif + util_snprintf(buf, size, "%p", addr); buf[size - 1] = 0; } diff --git a/src/gallium/tools/addr2line.sh b/src/gallium/tools/addr2line.sh new file mode 100755 index 0000000000..34dec14271 --- /dev/null +++ b/src/gallium/tools/addr2line.sh @@ -0,0 +1,26 @@ +#!/bin/bash +# This script processes symbols output by Gallium using glibc to human-readable function names + +lastbin= +i=-1 +dir="$(mktemp -d)" +input="$1" + +# Gather all unique addresses for each binary +sed -nre 's|([^ ]*/[^ ]*)\(\+0x([^)]*).*|\1 \2|p' "$input"|sort|uniq|while read bin addr; do + if test "$lastbin" != "$bin"; then + ((++i)) + lastbin="$bin" + echo "$bin" > "$dir/$i.addrs.bin" + fi + echo "$addr" >> "$dir/$i.addrs" +done + +# Construct a sed script to convert hex address to human readable form, and apply it +for i in "$dir"/*.addrs; do + bin="$(<"$i.bin")" + addr2line -p -e "$bin" -a -f < "$i"|sed -nre 's@^0x0*([^:]*): ([^?]*)$@s|'"$bin"'(+0x\1)|\2|g@gp' + rm -f "$i" "$i.bin" +done|sed -f - "$input" + +rmdir "$dir" -- cgit v1.2.3 From 40eef4c20cc0b4500a0d8c8538872ed4b473d737 Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Wed, 18 Aug 2010 16:38:17 +0200 Subject: u_debug_symbol: add symbol name caching Without this, any form of logging that dumps stack traces continuously will spend a lot of time resolving symbol names. --- src/gallium/auxiliary/util/u_debug_symbol.c | 40 +++++++++++++++++++++++++++++ src/gallium/auxiliary/util/u_debug_symbol.h | 4 ++- 2 files changed, 43 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/auxiliary/util/u_debug_symbol.c b/src/gallium/auxiliary/util/u_debug_symbol.c index ebea517f90..332952af88 100644 --- a/src/gallium/auxiliary/util/u_debug_symbol.c +++ b/src/gallium/auxiliary/util/u_debug_symbol.c @@ -33,10 +33,12 @@ */ #include "pipe/p_compiler.h" +#include "os/os_thread.h" #include "u_string.h" #include "u_debug.h" #include "u_debug_symbol.h" +#include "u_hash_table.h" #if defined(PIPE_SUBSYSTEM_WINDOWS_USER) && defined(PIPE_ARCH_X86) @@ -186,3 +188,41 @@ debug_symbol_print(const void *addr) debug_symbol_name(addr, buf, sizeof(buf)); debug_printf("\t%s\n", buf); } + +struct util_hash_table* symbols_hash; +pipe_mutex symbols_mutex; + +static unsigned hash_ptr(void* p) +{ + return (unsigned)(uintptr_t)p; +} + +static int compare_ptr(void* a, void* b) +{ + if(a == b) + return 0; + else if(a < b) + return -1; + else + return 1; +} + +const char* +debug_symbol_name_cached(const void *addr) +{ + const char* name; + pipe_mutex_lock(symbols_mutex); + if(!symbols_hash) + symbols_hash = util_hash_table_create(hash_ptr, compare_ptr); + name = util_hash_table_get(symbols_hash, (void*)addr); + if(!name) + { + char buf[1024]; + debug_symbol_name(addr, buf, sizeof(buf)); + name = strdup(buf); + + util_hash_table_set(symbols_hash, (void*)addr, (void*)name); + } + pipe_mutex_unlock(symbols_mutex); + return name; +} diff --git a/src/gallium/auxiliary/util/u_debug_symbol.h b/src/gallium/auxiliary/util/u_debug_symbol.h index 5e283e5ba3..b247706c2a 100644 --- a/src/gallium/auxiliary/util/u_debug_symbol.h +++ b/src/gallium/auxiliary/util/u_debug_symbol.h @@ -45,10 +45,12 @@ extern "C" { void debug_symbol_name(const void *addr, char* buf, unsigned size); +const char* +debug_symbol_name_cached(const void *addr); + void debug_symbol_print(const void *addr); - #ifdef __cplusplus } #endif -- cgit v1.2.3 From b1fa352db8a69883f97dd579d892291f414a67f5 Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Fri, 20 Aug 2010 11:31:24 +0200 Subject: os_stream: add printf facility --- src/gallium/auxiliary/Makefile | 1 + src/gallium/auxiliary/SConscript | 1 + src/gallium/auxiliary/os/os_stream.c | 40 +++++++++++++++++++++++++++++++ src/gallium/auxiliary/os/os_stream.h | 25 ++++++++++++++++++- src/gallium/auxiliary/os/os_stream_log.c | 3 ++- src/gallium/auxiliary/os/os_stream_null.c | 8 ++++++- src/gallium/auxiliary/os/os_stream_stdc.c | 9 +++++++ src/gallium/auxiliary/os/os_stream_str.c | 1 + 8 files changed, 85 insertions(+), 3 deletions(-) create mode 100644 src/gallium/auxiliary/os/os_stream.c (limited to 'src') diff --git a/src/gallium/auxiliary/Makefile b/src/gallium/auxiliary/Makefile index 2dae479275..7bd6a33a19 100644 --- a/src/gallium/auxiliary/Makefile +++ b/src/gallium/auxiliary/Makefile @@ -47,6 +47,7 @@ C_SOURCES = \ indices/u_indices_gen.c \ indices/u_unfilled_gen.c \ os/os_misc.c \ + os/os_stream.c \ os/os_stream_log.c \ os/os_stream_stdc.c \ os/os_stream_str.c \ diff --git a/src/gallium/auxiliary/SConscript b/src/gallium/auxiliary/SConscript index 43774e3311..0ece469f36 100644 --- a/src/gallium/auxiliary/SConscript +++ b/src/gallium/auxiliary/SConscript @@ -95,6 +95,7 @@ source = [ 'indices/u_indices_gen.c', 'indices/u_unfilled_gen.c', 'os/os_misc.c', + 'os/os_stream.c', 'os/os_stream_log.c', 'os/os_stream_stdc.c', 'os/os_stream_str.c', diff --git a/src/gallium/auxiliary/os/os_stream.c b/src/gallium/auxiliary/os/os_stream.c new file mode 100644 index 0000000000..2d4e1852ba --- /dev/null +++ b/src/gallium/auxiliary/os/os_stream.c @@ -0,0 +1,40 @@ +#include "pipe/p_config.h" + +#include "os_stream.h" +#include "util/u_memory.h" +#include "util/u_string.h" + +int +os_default_stream_vprintf (struct os_stream* stream, const char *format, va_list ap) +{ + char buf[1024]; + int retval; + + retval = util_vsnprintf(buf, sizeof(buf), format, ap); + if(retval <= 0) + {} + else if(retval < sizeof(buf)) + stream->write(stream, buf, retval); + else + { + int alloc = sizeof(buf); + char* str = NULL; + for(;;) + { + alloc += alloc; + if(str) + FREE(str); + str = MALLOC(alloc); + if(!str) + return -1; + + retval = util_vsnprintf(str, alloc, format, ap); + } while(retval >= alloc); + + if(retval > 0) + stream->write(stream, str, retval); + FREE(str); + } + + return retval; +} diff --git a/src/gallium/auxiliary/os/os_stream.h b/src/gallium/auxiliary/os/os_stream.h index 693a0621e2..6c6050bb02 100644 --- a/src/gallium/auxiliary/os/os_stream.h +++ b/src/gallium/auxiliary/os/os_stream.h @@ -50,6 +50,9 @@ struct os_stream void (*flush)(struct os_stream *stream); + + int + (*vprintf)(struct os_stream *stream, const char* format, va_list ap); }; @@ -90,6 +93,27 @@ os_stream_flush(struct os_stream *stream) stream->flush(stream); } +int +os_default_stream_vprintf (struct os_stream* stream, const char *format, va_list ap); + +static INLINE int +os_stream_vprintf (struct os_stream* stream, const char *format, va_list ap) +{ + return stream->vprintf(stream, format, ap); +} + +static INLINE int +os_stream_printf (struct os_stream* stream, const char *format, ...) +{ + int retval; + va_list args; + + va_start (args, format); + retval = stream->vprintf(stream, format, args); + va_end (args); + + return retval; +} struct os_stream * os_file_stream_create(const char *filename); @@ -118,5 +142,4 @@ os_str_stream_get_and_close(struct os_stream *stream); #define os_file_stream_create(_filename) os_null_stream_create() #endif - #endif /* _OS_STREAM_H_ */ diff --git a/src/gallium/auxiliary/os/os_stream_log.c b/src/gallium/auxiliary/os/os_stream_log.c index 7cc2028a22..b01377c346 100644 --- a/src/gallium/auxiliary/os/os_stream_log.c +++ b/src/gallium/auxiliary/os/os_stream_log.c @@ -73,7 +73,8 @@ static struct os_stream os_log_stream_struct = { &os_log_stream_close, &os_log_stream_write, - &os_log_stream_flush + &os_log_stream_flush, + &os_default_stream_vprintf, }; diff --git a/src/gallium/auxiliary/os/os_stream_null.c b/src/gallium/auxiliary/os/os_stream_null.c index 128c4e8f0e..a549a789e6 100644 --- a/src/gallium/auxiliary/os/os_stream_null.c +++ b/src/gallium/auxiliary/os/os_stream_null.c @@ -56,12 +56,18 @@ os_null_stream_flush(struct os_stream *stream) (void)stream; } +static int +os_null_stream_vprintf (struct os_stream* stream, const char *format, va_list ap) +{ + return 0; +} static struct os_stream os_null_stream = { &os_null_stream_close, &os_null_stream_write, - &os_null_stream_flush + &os_null_stream_flush, + &os_null_stream_vprintf }; diff --git a/src/gallium/auxiliary/os/os_stream_stdc.c b/src/gallium/auxiliary/os/os_stream_stdc.c index 9e7ed71107..37e7d063e2 100644 --- a/src/gallium/auxiliary/os/os_stream_stdc.c +++ b/src/gallium/auxiliary/os/os_stream_stdc.c @@ -83,6 +83,14 @@ os_stdc_stream_flush(struct os_stream *_stream) fflush(stream->file); } +static int +os_stdc_stream_vprintf (struct os_stream* _stream, const char *format, va_list ap) +{ + struct os_stdc_stream *stream = os_stdc_stream(_stream); + + return vfprintf(stream->file, format, ap); +} + struct os_stream * os_file_stream_create(const char *filename) @@ -96,6 +104,7 @@ os_file_stream_create(const char *filename) stream->base.close = &os_stdc_stream_close; stream->base.write = &os_stdc_stream_write; stream->base.flush = &os_stdc_stream_flush; + stream->base.vprintf = &os_stdc_stream_vprintf; stream->file = fopen(filename, "w"); if(!stream->file) diff --git a/src/gallium/auxiliary/os/os_stream_str.c b/src/gallium/auxiliary/os/os_stream_str.c index b5c7270d2a..be9478b2a1 100644 --- a/src/gallium/auxiliary/os/os_stream_str.c +++ b/src/gallium/auxiliary/os/os_stream_str.c @@ -118,6 +118,7 @@ os_str_stream_create(size_t size) stream->base.close = &os_str_stream_close; stream->base.write = &os_str_stream_write; stream->base.flush = &os_str_stream_flush; + stream->base.vprintf = &os_default_stream_vprintf; stream->str = os_malloc(size); if(!stream->str) -- cgit v1.2.3 From 2ff13fe89e8f0b372512f16bb64d5a703e9bf891 Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Wed, 18 Aug 2010 00:40:33 +0200 Subject: auxiliary: add reference count debugging code --- src/gallium/auxiliary/Makefile | 1 + src/gallium/auxiliary/SConscript | 1 + src/gallium/auxiliary/util/u_debug_refcnt.c | 156 ++++++++++++++++++++++++++++ src/gallium/auxiliary/util/u_debug_refcnt.h | 29 ++++++ 4 files changed, 187 insertions(+) create mode 100644 src/gallium/auxiliary/util/u_debug_refcnt.c create mode 100644 src/gallium/auxiliary/util/u_debug_refcnt.h (limited to 'src') diff --git a/src/gallium/auxiliary/Makefile b/src/gallium/auxiliary/Makefile index 7bd6a33a19..287ee8c29f 100644 --- a/src/gallium/auxiliary/Makefile +++ b/src/gallium/auxiliary/Makefile @@ -94,6 +94,7 @@ C_SOURCES = \ translate/translate_cache.c \ util/u_debug.c \ util/u_debug_describe.c \ + util/u_debug_refcnt.c \ util/u_debug_symbol.c \ util/u_debug_stack.c \ util/u_dump_defines.c \ diff --git a/src/gallium/auxiliary/SConscript b/src/gallium/auxiliary/SConscript index 0ece469f36..93bfe9f01f 100644 --- a/src/gallium/auxiliary/SConscript +++ b/src/gallium/auxiliary/SConscript @@ -149,6 +149,7 @@ source = [ 'util/u_debug.c', 'util/u_debug_describe.c', 'util/u_debug_memory.c', + 'util/u_debug_refcnt.c', 'util/u_debug_stack.c', 'util/u_debug_symbol.c', 'util/u_dump_defines.c', diff --git a/src/gallium/auxiliary/util/u_debug_refcnt.c b/src/gallium/auxiliary/util/u_debug_refcnt.c new file mode 100644 index 0000000000..9d6fca56ab --- /dev/null +++ b/src/gallium/auxiliary/util/u_debug_refcnt.c @@ -0,0 +1,156 @@ +#if defined(DEBUG) && (!defined(PIPE_OS_WINDOWS) || defined(PIPE_SUBSYSTEM_WINDOWS_USER)) + +/* see http://www.mozilla.org/performance/refcnt-balancer.html for what do with the output + * on Linux, use tools/addr2line.sh to postprocess it before anything else + **/ +#include +#include +#include +#include +#include +#include +#include +#include + +int debug_refcnt_state; + +struct os_stream* stream; + +/* TODO: maybe move this serial machinery to a stand-alone module and expose it? */ +static pipe_mutex serials_mutex; +static struct util_hash_table* serials_hash; +static unsigned serials_last; + +static unsigned hash_ptr(void* p) +{ + return (unsigned)(uintptr_t)p; +} + +static int compare_ptr(void* a, void* b) +{ + if(a == b) + return 0; + else if(a < b) + return -1; + else + return 1; +} + +static boolean debug_serial(void* p, unsigned* pserial) +{ + unsigned serial; + boolean found = TRUE; + pipe_mutex_lock(serials_mutex); + if(!serials_hash) + serials_hash = util_hash_table_create(hash_ptr, compare_ptr); + serial = (unsigned)(uintptr_t)util_hash_table_get(serials_hash, p); + if(!serial) + { + /* time to stop logging... (you'll have a 100 GB logfile at least at this point) + * TODO: avoid this + */ + serial = ++serials_last; + if(!serial) + { + debug_error("More than 2^32 objects detected, aborting.\n"); + os_abort(); + } + + util_hash_table_set(serials_hash, p, (void*)(uintptr_t)serial); + found = FALSE; + } + pipe_mutex_unlock(serials_mutex); + *pserial = serial; + return found; +} + +static void debug_serial_delete(void* p) +{ + pipe_mutex_lock(serials_mutex); + util_hash_table_remove(serials_hash, p); + pipe_mutex_unlock(serials_mutex); +} + +#define STACK_LEN 64 + +static void dump_stack(const char* symbols[STACK_LEN]) +{ + unsigned i; + for(i = 0; i < STACK_LEN; ++i) + { + if(symbols[i]) + os_stream_printf(stream, "%s\n", symbols[i]); + } + os_stream_write(stream, "\n", 1); +} + +void debug_reference_slowpath(const struct pipe_reference* p, void* pget_desc, int change) +{ + if(debug_refcnt_state < 0) + return; + + if(!debug_refcnt_state) + { + const char* filename = debug_get_option("GALLIUM_REFCNT_LOG", NULL); + if(filename && filename[0]) + stream = os_file_stream_create(filename); + + if(stream) + debug_refcnt_state = 1; + else + debug_refcnt_state = -1; + } + + if(debug_refcnt_state > 0) + { + struct debug_stack_frame frames[STACK_LEN]; + const char* symbols[STACK_LEN]; + char buf[1024]; + + void (*get_desc)(char*, const struct pipe_reference*) = pget_desc; + unsigned i; + unsigned refcnt = p->count; + unsigned serial; + boolean existing = debug_serial((void*)p, &serial); + + debug_backtrace_capture(frames, 1, STACK_LEN); + for(i = 0; i < STACK_LEN; ++i) + { + if(frames[i].function) + symbols[i] = debug_symbol_name_cached(frames[i].function); + else + symbols[i] = 0; + } + + get_desc(buf, p); + + if(!existing) + { + os_stream_printf(stream, "<%s> %p %u Create\n", buf, p, serial); + dump_stack(symbols); + + /* this is there to provide a gradual change even if we don't see the initialization */ + for(i = 1; i <= refcnt - change; ++i) + { + os_stream_printf(stream, "<%s> %p %u AddRef %u\n", buf, p, serial, i); + dump_stack(symbols); + } + } + + if(change) + { + os_stream_printf(stream, "<%s> %p %u %s %u\n", buf, p, serial, change > 0 ? "AddRef" : "Release", refcnt); + dump_stack(symbols); + } + + if(!refcnt) + { + debug_serial_delete((void*)p); + os_stream_printf(stream, "<%s> %p %u Destroy\n", buf, p, serial); + dump_stack(symbols); + } + + os_stream_flush(stream); + } +} +#endif diff --git a/src/gallium/auxiliary/util/u_debug_refcnt.h b/src/gallium/auxiliary/util/u_debug_refcnt.h new file mode 100644 index 0000000000..e48a2a645c --- /dev/null +++ b/src/gallium/auxiliary/util/u_debug_refcnt.h @@ -0,0 +1,29 @@ +/* + * u_debug_refcnt.h + * + * Created on: Aug 17, 2010 + * Author: lb + */ + +#ifndef U_DEBUG_REFCNT_H_ +#define U_DEBUG_REFCNT_H_ + +#include +#include + +#if defined(DEBUG) && (!defined(PIPE_OS_WINDOWS) || defined(PIPE_SUBSYSTEM_WINDOWS_USER)) +extern int debug_refcnt_state; + +void debug_reference_slowpath(const struct pipe_reference* p, void* get_desc, int change); + +static INLINE void debug_reference(const struct pipe_reference* p, void* get_desc, int change) +{ + if(debug_refcnt_state >= 0) + debug_reference_slowpath(p, get_desc, change); +} +#else +static INLINE void debug_reference(const struct pipe_reference* p, void* get_desc, const char* op) +{} +#endif + +#endif /* U_DEBUG_REFCNT_H_ */ -- cgit v1.2.3 From c806a40277bb5d2dab07908ef79078b0fcc56336 Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Wed, 18 Aug 2010 00:41:10 +0200 Subject: gallium: hook up reference count debugging code This commit adds the ability to produce a log file containing all reference count changes, and object creation/destruction, on Gallium objects. The data allows to answer these crucial questions: 1. This app is exhausting all my memory due to a resource leak: where is the bug? 2. Which resources is this app using at a given moment? Which parts of the code created them? 3. What kinds of resources does this app use? 4. How fast does this app create and destroy resources? Which parts of the code create resources fast? The output is compatible with the one produced by the similar facility in Mozilla Firefox, allowing to use Mozilla's tools to analyze the data. To get the log file: export GALLIUM_REFCNT_LOG= To get function names and source lines in the log file: tools/addr2line.sh To process the log file, see: http://www.mozilla.org/performance/refcnt-balancer.html --- src/gallium/auxiliary/util/u_inlines.h | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/gallium/auxiliary/util/u_inlines.h b/src/gallium/auxiliary/util/u_inlines.h index 540305c146..90b0903e3f 100644 --- a/src/gallium/auxiliary/util/u_inlines.h +++ b/src/gallium/auxiliary/util/u_inlines.h @@ -33,6 +33,8 @@ #include "pipe/p_state.h" #include "pipe/p_screen.h" #include "util/u_debug.h" +#include "util/u_debug_describe.h" +#include "util/u_debug_refcnt.h" #include "util/u_atomic.h" #include "util/u_box.h" #include "util/u_math.h" @@ -67,7 +69,7 @@ pipe_is_referenced(struct pipe_reference *reference) * \return TRUE if the object's refcount hits zero and should be destroyed. */ static INLINE boolean -pipe_reference(struct pipe_reference *ptr, struct pipe_reference *reference) +pipe_reference_described(struct pipe_reference *ptr, struct pipe_reference *reference, void* get_desc) { boolean destroy = FALSE; @@ -76,6 +78,7 @@ pipe_reference(struct pipe_reference *ptr, struct pipe_reference *reference) if (reference) { assert(pipe_is_referenced(reference)); p_atomic_inc(&reference->count); + debug_reference(reference, get_desc, 1); } if (ptr) { @@ -83,41 +86,45 @@ pipe_reference(struct pipe_reference *ptr, struct pipe_reference *reference) if (p_atomic_dec_zero(&ptr->count)) { destroy = TRUE; } + debug_reference(ptr, get_desc, -1); } } return destroy; } +static INLINE boolean +pipe_reference(struct pipe_reference *ptr, struct pipe_reference *reference) +{ + return pipe_reference_described(ptr, reference, debug_describe_reference); +} static INLINE void pipe_surface_reference(struct pipe_surface **ptr, struct pipe_surface *surf) { struct pipe_surface *old_surf = *ptr; - if (pipe_reference(&(*ptr)->reference, &surf->reference)) + if (pipe_reference_described(&(*ptr)->reference, &surf->reference, debug_describe_surface)) old_surf->texture->screen->tex_surface_destroy(old_surf); *ptr = surf; } - static INLINE void pipe_resource_reference(struct pipe_resource **ptr, struct pipe_resource *tex) { struct pipe_resource *old_tex = *ptr; - if (pipe_reference(&(*ptr)->reference, &tex->reference)) + if (pipe_reference_described(&(*ptr)->reference, &tex->reference, debug_describe_resource)) old_tex->screen->resource_destroy(old_tex->screen, old_tex); *ptr = tex; } - static INLINE void pipe_sampler_view_reference(struct pipe_sampler_view **ptr, struct pipe_sampler_view *view) { struct pipe_sampler_view *old_view = *ptr; - if (pipe_reference(&(*ptr)->reference, &view->reference)) + if (pipe_reference_described(&(*ptr)->reference, &view->reference, debug_describe_sampler_view)) old_view->context->sampler_view_destroy(old_view->context, old_view); *ptr = view; } -- cgit v1.2.3 From a43a2f0662c4aa33b50882411181252198819942 Mon Sep 17 00:00:00 2001 From: Michal Krol Date: Fri, 20 Aug 2010 18:51:22 +0200 Subject: util: Fix build for C++ compilers. --- src/gallium/auxiliary/util/u_debug_describe.h | 8 ++++++++ src/gallium/auxiliary/util/u_debug_refcnt.h | 8 ++++++++ 2 files changed, 16 insertions(+) (limited to 'src') diff --git a/src/gallium/auxiliary/util/u_debug_describe.h b/src/gallium/auxiliary/util/u_debug_describe.h index cab614bdc2..8c32f02ee5 100644 --- a/src/gallium/auxiliary/util/u_debug_describe.h +++ b/src/gallium/auxiliary/util/u_debug_describe.h @@ -1,10 +1,18 @@ #ifndef U_DEBUG_DESCRIBE_H_ #define U_DEBUG_DESCRIBE_H_ +#ifdef __cplusplus +extern "C" { +#endif + /* a 256-byte buffer is necessary and sufficient */ void debug_describe_reference(char* buf, const struct pipe_reference*ptr); void debug_describe_resource(char* buf, const struct pipe_resource *ptr); void debug_describe_surface(char* buf, const struct pipe_surface *ptr); void debug_describe_sampler_view(char* buf, const struct pipe_sampler_view *ptr); +#ifdef __cplusplus +} +#endif + #endif /* U_DEBUG_DESCRIBE_H_ */ diff --git a/src/gallium/auxiliary/util/u_debug_refcnt.h b/src/gallium/auxiliary/util/u_debug_refcnt.h index e48a2a645c..ba40999bf2 100644 --- a/src/gallium/auxiliary/util/u_debug_refcnt.h +++ b/src/gallium/auxiliary/util/u_debug_refcnt.h @@ -11,6 +11,10 @@ #include #include +#ifdef __cplusplus +extern "C" { +#endif + #if defined(DEBUG) && (!defined(PIPE_OS_WINDOWS) || defined(PIPE_SUBSYSTEM_WINDOWS_USER)) extern int debug_refcnt_state; @@ -26,4 +30,8 @@ static INLINE void debug_reference(const struct pipe_reference* p, void* get_des {} #endif +#ifdef __cplusplus +} +#endif + #endif /* U_DEBUG_REFCNT_H_ */ -- cgit v1.2.3 From 921c987c6f43b4d63a98b61013d43bac97baff21 Mon Sep 17 00:00:00 2001 From: Jerome Glisse Date: Fri, 20 Aug 2010 17:57:38 +0200 Subject: r600g: cleanup definition, fix segfault when no valid pixel shader Signed-off-by: Jerome Glisse --- src/gallium/drivers/r600/r600_shader.c | 30 ++++++++++++------------- src/gallium/drivers/r600/r600_sq.h | 41 +++++++++++++++++----------------- src/gallium/drivers/r600/r600_state.c | 6 ++++- 3 files changed, 40 insertions(+), 37 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/r600_shader.c b/src/gallium/drivers/r600/r600_shader.c index 455730320e..62cd8f567a 100644 --- a/src/gallium/drivers/r600/r600_shader.c +++ b/src/gallium/drivers/r600/r600_shader.c @@ -711,9 +711,9 @@ static int tgsi_trig(struct r600_shader_ctx *ctx) alu.src[0] = r600_src[0]; alu.src[0].chan = tgsi_chan(&inst->Src[0], 0); - alu.src[1].sel = SQ_ALU_SRC_LITERAL; + alu.src[1].sel = V_SQ_ALU_SRC_LITERAL; alu.src[1].chan = 0; - alu.src[2].sel = SQ_ALU_SRC_LITERAL; + alu.src[2].sel = V_SQ_ALU_SRC_LITERAL; alu.src[2].chan = 1; alu.last = 1; r = r600_bc_add_alu(ctx->bc, &alu); @@ -756,9 +756,9 @@ static int tgsi_trig(struct r600_shader_ctx *ctx) alu.src[0].sel = ctx->temp_reg; alu.src[0].chan = 0; - alu.src[1].sel = SQ_ALU_SRC_LITERAL; + alu.src[1].sel = V_SQ_ALU_SRC_LITERAL; alu.src[1].chan = 0; - alu.src[2].sel = SQ_ALU_SRC_LITERAL; + alu.src[2].sel = V_SQ_ALU_SRC_LITERAL; alu.src[2].chan = 1; alu.last = 1; r = r600_bc_add_alu(ctx->bc, &alu); @@ -810,7 +810,7 @@ static int tgsi_kill(struct r600_shader_ctx *ctx) memset(&alu, 0, sizeof(struct r600_bc_alu)); alu.inst = ctx->inst_info->r600_opcode; alu.dst.chan = i; - alu.src[0].sel = SQ_ALU_SRC_0; + alu.src[0].sel = V_SQ_ALU_SRC_0; r = tgsi_src(ctx, &inst->Src[0], &alu.src[1]); if (r) return r; @@ -869,7 +869,7 @@ static int tgsi_lit(struct r600_shader_ctx *ctx) /* dst.x, <- 1.0 */ memset(&alu, 0, sizeof(struct r600_bc_alu)); alu.inst = V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV; - alu.src[0].sel = SQ_ALU_SRC_1; /*1.0*/ + alu.src[0].sel = V_SQ_ALU_SRC_1; /*1.0*/ alu.src[0].chan = 0; r = tgsi_dst(ctx, &inst->Dst[0], 0, &alu.dst); if (r) @@ -885,7 +885,7 @@ static int tgsi_lit(struct r600_shader_ctx *ctx) r = tgsi_src(ctx, &inst->Src[0], &alu.src[0]); if (r) return r; - alu.src[1].sel = SQ_ALU_SRC_0; /*0.0*/ + alu.src[1].sel = V_SQ_ALU_SRC_0; /*0.0*/ alu.src[1].chan = tgsi_chan(&inst->Src[0], 0); r = tgsi_dst(ctx, &inst->Dst[0], 1, &alu.dst); if (r) @@ -906,7 +906,7 @@ static int tgsi_lit(struct r600_shader_ctx *ctx) /* dst.w, <- 1.0 */ memset(&alu, 0, sizeof(struct r600_bc_alu)); alu.inst = V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV; - alu.src[0].sel = SQ_ALU_SRC_1; + alu.src[0].sel = V_SQ_ALU_SRC_1; alu.src[0].chan = 0; r = tgsi_dst(ctx, &inst->Dst[0], 3, &alu.dst); if (r) @@ -1050,7 +1050,7 @@ static int tgsi_ssg(struct r600_shader_ctx *ctx) struct tgsi_full_instruction *inst = &ctx->parse.FullToken.FullInstruction; struct r600_bc_alu alu; struct r600_bc_alu_src r600_src[3]; - int i, j, r; + int i, r; r = tgsi_split_constant(ctx, r600_src); if (r) @@ -1067,7 +1067,7 @@ static int tgsi_ssg(struct r600_shader_ctx *ctx) alu.src[0] = r600_src[0]; alu.src[0].chan = tgsi_chan(&inst->Src[0], i); - alu.src[1].sel = SQ_ALU_SRC_1; + alu.src[1].sel = V_SQ_ALU_SRC_1; alu.src[2] = r600_src[0]; alu.src[2].chan = tgsi_chan(&inst->Src[0], i); @@ -1090,7 +1090,7 @@ static int tgsi_ssg(struct r600_shader_ctx *ctx) alu.src[0].sel = ctx->temp_reg; alu.src[0].neg = 1; - alu.src[1].sel = SQ_ALU_SRC_1; + alu.src[1].sel = V_SQ_ALU_SRC_1; alu.src[1].neg = 1; alu.src[2].sel = ctx->temp_reg; @@ -1192,13 +1192,13 @@ static int tgsi_dp(struct r600_shader_ctx *ctx) switch (ctx->inst_info->tgsi_opcode) { case TGSI_OPCODE_DP2: if (i > 1) { - alu.src[0].sel = alu.src[1].sel = SQ_ALU_SRC_0; + alu.src[0].sel = alu.src[1].sel = V_SQ_ALU_SRC_0; alu.src[0].chan = alu.src[1].chan = 0; } break; case TGSI_OPCODE_DP3: if (i > 2) { - alu.src[0].sel = alu.src[1].sel = SQ_ALU_SRC_0; + alu.src[0].sel = alu.src[1].sel = V_SQ_ALU_SRC_0; alu.src[0].chan = alu.src[1].chan = 0; } break; @@ -1255,7 +1255,7 @@ static int tgsi_tex(struct r600_shader_ctx *ctx) } memset(&alu, 0, sizeof(struct r600_bc_alu)); alu.inst = V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV; - alu.src[0].sel = SQ_ALU_SRC_1; + alu.src[0].sel = V_SQ_ALU_SRC_1; alu.src[0].chan = 0; alu.dst.sel = ctx->temp_reg; alu.dst.chan = 3; @@ -1322,7 +1322,7 @@ static int tgsi_lrp(struct r600_shader_ctx *ctx) for (i = 0; i < 4; i++) { memset(&alu, 0, sizeof(struct r600_bc_alu)); alu.inst = V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_ADD; - alu.src[0].sel = SQ_ALU_SRC_1; + alu.src[0].sel = V_SQ_ALU_SRC_1; alu.src[0].chan = 0; alu.src[1] = r600_src[0]; alu.src[1].chan = tgsi_chan(&inst->Src[0], i); diff --git a/src/gallium/drivers/r600/r600_sq.h b/src/gallium/drivers/r600/r600_sq.h index 819624e689..ad4de0b072 100644 --- a/src/gallium/drivers/r600/r600_sq.h +++ b/src/gallium/drivers/r600/r600_sq.h @@ -206,6 +206,26 @@ #define S_SQ_ALU_WORD0_SRC0_SEL(x) (((x) & 0x1FF) << 0) #define G_SQ_ALU_WORD0_SRC0_SEL(x) (((x) >> 0) & 0x1FF) #define C_SQ_ALU_WORD0_SRC0_SEL 0xFFFFFE00 +/* + * 244 ALU_SRC_1_DBL_L: special constant 1.0 double-float, LSW. (RV670+) + * 245 ALU_SRC_1_DBL_M: special constant 1.0 double-float, MSW. (RV670+) + * 246 ALU_SRC_0_5_DBL_L: special constant 0.5 double-float, LSW. (RV670+) + * 247 ALU_SRC_0_5_DBL_M: special constant 0.5 double-float, MSW. (RV670+) + * 248 SQ_ALU_SRC_0: special constant 0.0. + * 249 SQ_ALU_SRC_1: special constant 1.0 float. + * 250 SQ_ALU_SRC_1_INT: special constant 1 integer. + * 251 SQ_ALU_SRC_M_1_INT: special constant -1 integer. + * 252 SQ_ALU_SRC_0_5: special constant 0.5 float. + * 253 SQ_ALU_SRC_LITERAL: literal constant. + * 254 SQ_ALU_SRC_PV: previous vector result. + * 255 SQ_ALU_SRC_PS: previous scalar result. + */ +#define V_SQ_ALU_SRC_0 0x000000F8 +#define V_SQ_ALU_SRC_1 0x000000F9 +#define V_SQ_ALU_SRC_1_INT 0x000000FA +#define V_SQ_ALU_SRC_M_1_INT 0x000000FB +#define V_SQ_ALU_SRC_0_5 0x000000FC +#define V_SQ_ALU_SRC_LITERAL 0x000000FD #define S_SQ_ALU_WORD0_SRC0_REL(x) (((x) & 0x1) << 9) #define G_SQ_ALU_WORD0_SRC0_REL(x) (((x) >> 9) & 0x1) #define C_SQ_ALU_WORD0_SRC0_REL 0xFFFFFDFF @@ -583,25 +603,4 @@ #define G_SQ_TEX_WORD2_SRC_SEL_W(x) (((x) >> 29) & 0x7) #define C_SQ_TEX_WORD2_SRC_SEL_W 0x1FFFFFFF -/* - * 244 ALU_SRC_1_DBL_L: special constant 1.0 double-float, LSW. (RV670+) - * 245 ALU_SRC_1_DBL_M: special constant 1.0 double-float, MSW. (RV670+) - * 246 ALU_SRC_0_5_DBL_L: special constant 0.5 double-float, LSW. (RV670+) - * 247 ALU_SRC_0_5_DBL_M: special constant 0.5 double-float, MSW. (RV670+) - * 248 SQ_ALU_SRC_0: special constant 0.0. - * 249 SQ_ALU_SRC_1: special constant 1.0 float. - * 250 SQ_ALU_SRC_1_INT: special constant 1 integer. - * 251 SQ_ALU_SRC_M_1_INT: special constant -1 integer. - * 252 SQ_ALU_SRC_0_5: special constant 0.5 float. - * 253 SQ_ALU_SRC_LITERAL: literal constant. - * 254 SQ_ALU_SRC_PV: previous vector result. - * 255 SQ_ALU_SRC_PS: previous scalar result. - */ -#define SQ_ALU_SRC_0 248 -#define SQ_ALU_SRC_1 249 -#define SQ_ALU_SRC_1_INT 250 -#define SQ_ALU_SRC_M_1_INT 251 -#define SQ_ALU_SRC_0_5 252 -#define SQ_ALU_SRC_LITERAL 253 - #endif diff --git a/src/gallium/drivers/r600/r600_state.c b/src/gallium/drivers/r600/r600_state.c index 3943ebacb3..93fc68e42e 100644 --- a/src/gallium/drivers/r600/r600_state.c +++ b/src/gallium/drivers/r600/r600_state.c @@ -980,15 +980,19 @@ static struct radeon_state *r600_dsa(struct r600_context *rctx) struct r600_screen *rscreen = rctx->screen; unsigned db_depth_control, alpha_test_control, alpha_ref, db_shader_control; unsigned stencil_ref_mask, stencil_ref_mask_bf; - struct r600_shader *rshader = &rctx->ps_shader->shader; + struct r600_shader *rshader; struct radeon_state *rstate; int i; + if (rctx->ps_shader == NULL) { + return NULL; + } rstate = radeon_state(rscreen->rw, R600_DSA_TYPE, R600_DSA); if (rstate == NULL) return NULL; db_shader_control = 0x210; + rshader = &rctx->ps_shader->shader; for (i = 0; i < rshader->noutput; i++) { if (rshader->output[i].name == TGSI_SEMANTIC_POSITION) db_shader_control |= 1; -- cgit v1.2.3 From a4b10a56145ea253def4cf958410d770d0640bc9 Mon Sep 17 00:00:00 2001 From: Jerome Glisse Date: Fri, 20 Aug 2010 18:53:29 +0200 Subject: r600g: add POW instruction Signed-off-by: Jerome Glisse --- src/gallium/drivers/r600/r600_shader.c | 91 +++++++++++++++++++++++++++------- 1 file changed, 73 insertions(+), 18 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/r600_shader.c b/src/gallium/drivers/r600/r600_shader.c index 62cd8f567a..da1af6702c 100644 --- a/src/gallium/drivers/r600/r600_shader.c +++ b/src/gallium/drivers/r600/r600_shader.c @@ -1006,27 +1006,12 @@ static int tgsi_trans(struct r600_shader_ctx *ctx) return 0; } -static int tgsi_trans_srcx_replicate(struct r600_shader_ctx *ctx) +static int tgsi_helper_tempx_replicate(struct r600_shader_ctx *ctx) { struct tgsi_full_instruction *inst = &ctx->parse.FullToken.FullInstruction; struct r600_bc_alu alu; - int i, j, r; + int i, r; - memset(&alu, 0, sizeof(struct r600_bc_alu)); - alu.inst = ctx->inst_info->r600_opcode; - for (j = 0; j < inst->Instruction.NumSrcRegs; j++) { - r = tgsi_src(ctx, &inst->Src[j], &alu.src[j]); - if (r) - return r; - alu.src[j].chan = tgsi_chan(&inst->Src[j], 0); - } - alu.dst.sel = ctx->temp_reg; - alu.dst.write = 1; - alu.last = 1; - r = r600_bc_add_alu(ctx->bc, &alu); - if (r) - return r; - /* replicate result */ for (i = 0; i < 4; i++) { memset(&alu, 0, sizeof(struct r600_bc_alu)); alu.src[0].sel = ctx->temp_reg; @@ -1045,6 +1030,76 @@ static int tgsi_trans_srcx_replicate(struct r600_shader_ctx *ctx) return 0; } +static int tgsi_trans_srcx_replicate(struct r600_shader_ctx *ctx) +{ + struct tgsi_full_instruction *inst = &ctx->parse.FullToken.FullInstruction; + struct r600_bc_alu alu; + int i, r; + + memset(&alu, 0, sizeof(struct r600_bc_alu)); + alu.inst = ctx->inst_info->r600_opcode; + for (i = 0; i < inst->Instruction.NumSrcRegs; i++) { + r = tgsi_src(ctx, &inst->Src[i], &alu.src[i]); + if (r) + return r; + alu.src[i].chan = tgsi_chan(&inst->Src[i], 0); + } + alu.dst.sel = ctx->temp_reg; + alu.dst.write = 1; + alu.last = 1; + r = r600_bc_add_alu(ctx->bc, &alu); + if (r) + return r; + /* replicate result */ + return tgsi_helper_tempx_replicate(ctx); +} + +static int tgsi_pow(struct r600_shader_ctx *ctx) +{ + struct tgsi_full_instruction *inst = &ctx->parse.FullToken.FullInstruction; + struct r600_bc_alu alu; + int r; + + /* LOG2(a) */ + memset(&alu, 0, sizeof(struct r600_bc_alu)); + alu.inst = V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_LOG_IEEE; + r = tgsi_src(ctx, &inst->Src[0], &alu.src[0]); + if (r) + return r; + alu.src[0].chan = tgsi_chan(&inst->Src[0], 0); + alu.dst.sel = ctx->temp_reg; + alu.dst.write = 1; + alu.last = 1; + r = r600_bc_add_alu(ctx->bc, &alu); + if (r) + return r; + /* b * LOG2(a) */ + memset(&alu, 0, sizeof(struct r600_bc_alu)); + alu.inst = V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MUL_IEEE; + r = tgsi_src(ctx, &inst->Src[1], &alu.src[0]); + if (r) + return r; + alu.src[0].chan = tgsi_chan(&inst->Src[1], 0); + alu.src[1].sel = ctx->temp_reg; + alu.dst.sel = ctx->temp_reg; + alu.dst.write = 1; + alu.last = 1; + r = r600_bc_add_alu(ctx->bc, &alu); + if (r) + return r; + /* POW(a,b) = EXP2(b * LOG2(a))*/ + memset(&alu, 0, sizeof(struct r600_bc_alu)); + alu.inst = V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_EXP_IEEE; + alu.src[0].sel = ctx->temp_reg; + alu.dst.sel = ctx->temp_reg; + alu.dst.write = 1; + alu.last = 1; + r = r600_bc_add_alu(ctx->bc, &alu); + if (r) + return r; + return tgsi_helper_tempx_replicate(ctx); +} + static int tgsi_ssg(struct r600_shader_ctx *ctx) { struct tgsi_full_instruction *inst = &ctx->parse.FullToken.FullInstruction; @@ -1419,7 +1474,7 @@ static struct r600_shader_tgsi_instruction r600_shader_tgsi_instruction[] = { {TGSI_OPCODE_ROUND, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported}, {TGSI_OPCODE_EX2, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_EXP_IEEE, tgsi_trans_srcx_replicate}, {TGSI_OPCODE_LG2, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_LOG_IEEE, tgsi_trans_srcx_replicate}, - {TGSI_OPCODE_POW, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported}, + {TGSI_OPCODE_POW, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_pow}, {TGSI_OPCODE_XPD, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported}, /* gap */ {32, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported}, -- cgit v1.2.3 From 284ce20901b0c2cfab1d952cc129b8f3cd068f12 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Fri, 20 Aug 2010 10:52:14 -0700 Subject: Remove remnants of the old glsl compiler. --- Makefile | 12 +- src/glsl/cl/Makefile | 13 - src/glsl/cl/sl_cl_parse.c | 3027 ----------- src/glsl/cl/sl_cl_parse.h | 42 - src/glsl/pp/Makefile | 27 - src/glsl/pp/sl_pp_context.c | 183 - src/glsl/pp/sl_pp_context.h | 99 - src/glsl/pp/sl_pp_define.c | 240 - src/glsl/pp/sl_pp_dict.c | 85 - src/glsl/pp/sl_pp_dict.h | 77 - src/glsl/pp/sl_pp_error.c | 271 - src/glsl/pp/sl_pp_expression.c | 413 -- src/glsl/pp/sl_pp_expression.h | 40 - src/glsl/pp/sl_pp_extension.c | 180 - src/glsl/pp/sl_pp_if.c | 343 -- src/glsl/pp/sl_pp_line.c | 129 - src/glsl/pp/sl_pp_macro.c | 415 -- src/glsl/pp/sl_pp_macro.h | 70 - src/glsl/pp/sl_pp_pragma.c | 110 - src/glsl/pp/sl_pp_process.c | 331 -- src/glsl/pp/sl_pp_process.h | 113 - src/glsl/pp/sl_pp_public.h | 79 - src/glsl/pp/sl_pp_purify.c | 302 -- src/glsl/pp/sl_pp_purify.h | 63 - src/glsl/pp/sl_pp_token.c | 854 --- src/glsl/pp/sl_pp_token.h | 133 - src/glsl/pp/sl_pp_token_util.c | 183 - src/glsl/pp/sl_pp_token_util.h | 98 - src/glsl/pp/sl_pp_version.c | 162 - src/mesa/drivers/glslcompiler/Makefile | 43 - src/mesa/drivers/glslcompiler/glslcompiler.c | 436 -- src/mesa/slang/descrip.mms | 67 - src/mesa/slang/library/.gitignore | 1 - src/mesa/slang/library/Makefile | 54 - src/mesa/slang/library/SConscript | 62 - src/mesa/slang/library/slang_120_core.gc | 1978 ------- src/mesa/slang/library/slang_builtin_120_common.gc | 200 - .../slang/library/slang_builtin_120_fragment.gc | 30 - src/mesa/slang/library/slang_common_builtin.gc | 1887 ------- src/mesa/slang/library/slang_core.gc | 2619 ---------- src/mesa/slang/library/slang_fragment_builtin.gc | 299 -- src/mesa/slang/library/slang_geometry_builtin.gc | 55 - src/mesa/slang/library/slang_vertex_builtin.gc | 210 - src/mesa/slang/slang_builtin.c | 1020 ---- src/mesa/slang/slang_builtin.h | 68 - src/mesa/slang/slang_codegen.c | 5410 -------------------- src/mesa/slang/slang_codegen.h | 78 - src/mesa/slang/slang_compile.c | 3103 ----------- src/mesa/slang/slang_compile.h | 103 - src/mesa/slang/slang_compile_function.c | 262 - src/mesa/slang/slang_compile_function.h | 100 - src/mesa/slang/slang_compile_operation.c | 334 -- src/mesa/slang/slang_compile_operation.h | 230 - src/mesa/slang/slang_compile_struct.c | 174 - src/mesa/slang/slang_compile_struct.h | 69 - src/mesa/slang/slang_compile_variable.c | 247 - src/mesa/slang/slang_compile_variable.h | 92 - src/mesa/slang/slang_emit.c | 2686 ---------- src/mesa/slang/slang_emit.h | 49 - src/mesa/slang/slang_ir.c | 534 -- src/mesa/slang/slang_ir.h | 293 -- src/mesa/slang/slang_label.c | 107 - src/mesa/slang/slang_label.h | 44 - src/mesa/slang/slang_link.c | 1288 ----- src/mesa/slang/slang_link.h | 37 - src/mesa/slang/slang_log.c | 133 - src/mesa/slang/slang_log.h | 59 - src/mesa/slang/slang_mem.c | 243 - src/mesa/slang/slang_mem.h | 55 - src/mesa/slang/slang_print.c | 883 ---- src/mesa/slang/slang_print.h | 35 - src/mesa/slang/slang_simplify.c | 527 -- src/mesa/slang/slang_simplify.h | 57 - src/mesa/slang/slang_storage.c | 321 -- src/mesa/slang/slang_storage.h | 144 - src/mesa/slang/slang_typeinfo.c | 1177 ----- src/mesa/slang/slang_typeinfo.h | 263 - src/mesa/slang/slang_utility.c | 228 - src/mesa/slang/slang_utility.h | 102 - src/mesa/slang/slang_vartable.c | 362 -- src/mesa/slang/slang_vartable.h | 45 - 81 files changed, 5 insertions(+), 36992 deletions(-) delete mode 100644 src/glsl/cl/Makefile delete mode 100644 src/glsl/cl/sl_cl_parse.c delete mode 100644 src/glsl/cl/sl_cl_parse.h delete mode 100644 src/glsl/pp/Makefile delete mode 100644 src/glsl/pp/sl_pp_context.c delete mode 100644 src/glsl/pp/sl_pp_context.h delete mode 100644 src/glsl/pp/sl_pp_define.c delete mode 100644 src/glsl/pp/sl_pp_dict.c delete mode 100644 src/glsl/pp/sl_pp_dict.h delete mode 100644 src/glsl/pp/sl_pp_error.c delete mode 100644 src/glsl/pp/sl_pp_expression.c delete mode 100644 src/glsl/pp/sl_pp_expression.h delete mode 100644 src/glsl/pp/sl_pp_extension.c delete mode 100644 src/glsl/pp/sl_pp_if.c delete mode 100644 src/glsl/pp/sl_pp_line.c delete mode 100644 src/glsl/pp/sl_pp_macro.c delete mode 100644 src/glsl/pp/sl_pp_macro.h delete mode 100644 src/glsl/pp/sl_pp_pragma.c delete mode 100644 src/glsl/pp/sl_pp_process.c delete mode 100644 src/glsl/pp/sl_pp_process.h delete mode 100644 src/glsl/pp/sl_pp_public.h delete mode 100644 src/glsl/pp/sl_pp_purify.c delete mode 100644 src/glsl/pp/sl_pp_purify.h delete mode 100644 src/glsl/pp/sl_pp_token.c delete mode 100644 src/glsl/pp/sl_pp_token.h delete mode 100644 src/glsl/pp/sl_pp_token_util.c delete mode 100644 src/glsl/pp/sl_pp_token_util.h delete mode 100644 src/glsl/pp/sl_pp_version.c delete mode 100644 src/mesa/drivers/glslcompiler/Makefile delete mode 100644 src/mesa/drivers/glslcompiler/glslcompiler.c delete mode 100644 src/mesa/slang/descrip.mms delete mode 100644 src/mesa/slang/library/.gitignore delete mode 100644 src/mesa/slang/library/Makefile delete mode 100644 src/mesa/slang/library/SConscript delete mode 100644 src/mesa/slang/library/slang_120_core.gc delete mode 100644 src/mesa/slang/library/slang_builtin_120_common.gc delete mode 100644 src/mesa/slang/library/slang_builtin_120_fragment.gc delete mode 100644 src/mesa/slang/library/slang_common_builtin.gc delete mode 100644 src/mesa/slang/library/slang_core.gc delete mode 100644 src/mesa/slang/library/slang_fragment_builtin.gc delete mode 100644 src/mesa/slang/library/slang_geometry_builtin.gc delete mode 100644 src/mesa/slang/library/slang_vertex_builtin.gc delete mode 100644 src/mesa/slang/slang_builtin.c delete mode 100644 src/mesa/slang/slang_builtin.h delete mode 100644 src/mesa/slang/slang_codegen.c delete mode 100644 src/mesa/slang/slang_codegen.h delete mode 100644 src/mesa/slang/slang_compile.c delete mode 100644 src/mesa/slang/slang_compile.h delete mode 100644 src/mesa/slang/slang_compile_function.c delete mode 100644 src/mesa/slang/slang_compile_function.h delete mode 100644 src/mesa/slang/slang_compile_operation.c delete mode 100644 src/mesa/slang/slang_compile_operation.h delete mode 100644 src/mesa/slang/slang_compile_struct.c delete mode 100644 src/mesa/slang/slang_compile_struct.h delete mode 100644 src/mesa/slang/slang_compile_variable.c delete mode 100644 src/mesa/slang/slang_compile_variable.h delete mode 100644 src/mesa/slang/slang_emit.c delete mode 100644 src/mesa/slang/slang_emit.h delete mode 100644 src/mesa/slang/slang_ir.c delete mode 100644 src/mesa/slang/slang_ir.h delete mode 100644 src/mesa/slang/slang_label.c delete mode 100644 src/mesa/slang/slang_label.h delete mode 100644 src/mesa/slang/slang_link.c delete mode 100644 src/mesa/slang/slang_link.h delete mode 100644 src/mesa/slang/slang_log.c delete mode 100644 src/mesa/slang/slang_log.h delete mode 100644 src/mesa/slang/slang_mem.c delete mode 100644 src/mesa/slang/slang_mem.h delete mode 100644 src/mesa/slang/slang_print.c delete mode 100644 src/mesa/slang/slang_print.h delete mode 100644 src/mesa/slang/slang_simplify.c delete mode 100644 src/mesa/slang/slang_simplify.h delete mode 100644 src/mesa/slang/slang_storage.c delete mode 100644 src/mesa/slang/slang_storage.h delete mode 100644 src/mesa/slang/slang_typeinfo.c delete mode 100644 src/mesa/slang/slang_typeinfo.h delete mode 100644 src/mesa/slang/slang_utility.c delete mode 100644 src/mesa/slang/slang_utility.h delete mode 100644 src/mesa/slang/slang_vartable.c delete mode 100644 src/mesa/slang/slang_vartable.h (limited to 'src') diff --git a/Makefile b/Makefile index ca46504715..b50a311761 100644 --- a/Makefile +++ b/Makefile @@ -230,7 +230,10 @@ MAIN_FILES = \ $(DIRECTORY)/src/glsl/Makefile.template \ $(DIRECTORY)/src/glsl/SConscript \ $(DIRECTORY)/src/glsl/*/Makefile \ - $(DIRECTORY)/src/glsl/*/*.[ch] \ + $(DIRECTORY)/src/glsl/*.[ch] \ + $(DIRECTORY)/src/glsl/*.[cly]pp \ + $(DIRECTORY)/src/glsl/README \ + $(DIRECTORY)/src/glsl/glcpp/README \ $(DIRECTORY)/src/Makefile \ $(DIRECTORY)/src/mesa/Makefile* \ $(DIRECTORY)/src/mesa/sources.mak \ @@ -240,16 +243,13 @@ MAIN_FILES = \ $(DIRECTORY)/src/mesa/depend \ $(MAIN_ES_FILES) \ $(DIRECTORY)/src/mesa/main/*.[chS] \ + $(DIRECTORY)/src/mesa/main/*.cpp \ $(DIRECTORY)/src/mesa/main/descrip.mms \ $(DIRECTORY)/src/mesa/math/*.[ch] \ $(DIRECTORY)/src/mesa/math/descrip.mms \ $(DIRECTORY)/src/mesa/program/*.[chly] \ $(DIRECTORY)/src/mesa/program/Makefile \ $(DIRECTORY)/src/mesa/program/descrip.mms \ - $(DIRECTORY)/src/mesa/slang/*.[ch] \ - $(DIRECTORY)/src/mesa/slang/descrip.mms \ - $(DIRECTORY)/src/mesa/slang/library/*.gc \ - $(DIRECTORY)/src/mesa/slang/library/Makefile \ $(DIRECTORY)/src/mesa/swrast/*.[ch] \ $(DIRECTORY)/src/mesa/swrast/descrip.mms \ $(DIRECTORY)/src/mesa/swrast_setup/*.[ch] \ @@ -278,8 +278,6 @@ MAIN_FILES = \ $(DIRECTORY)/src/mesa/drivers/x11/Makefile \ $(DIRECTORY)/src/mesa/drivers/x11/descrip.mms \ $(DIRECTORY)/src/mesa/drivers/x11/*.[ch] \ - $(DIRECTORY)/src/mesa/drivers/glslcompiler/Makefile \ - $(DIRECTORY)/src/mesa/drivers/glslcompiler/glslcompiler.c \ $(DIRECTORY)/src/mesa/ppc/*.[ch] \ $(DIRECTORY)/src/mesa/sparc/*.[chS] \ $(DIRECTORY)/src/mesa/x86/Makefile \ diff --git a/src/glsl/cl/Makefile b/src/glsl/cl/Makefile deleted file mode 100644 index 04a52df8c3..0000000000 --- a/src/glsl/cl/Makefile +++ /dev/null @@ -1,13 +0,0 @@ -#src/glsl/cl/Makefile - -TOP = ../../.. - -include $(TOP)/configs/current - -LIBNAME = glslcl - -C_SOURCES = \ - sl_cl_parse.c - -include ../Makefile.template - diff --git a/src/glsl/cl/sl_cl_parse.c b/src/glsl/cl/sl_cl_parse.c deleted file mode 100644 index c1bc6031ce..0000000000 --- a/src/glsl/cl/sl_cl_parse.c +++ /dev/null @@ -1,3027 +0,0 @@ -/************************************************************************** - * - * Copyright 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, 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 TUNGSTEN GRAPHICS AND/OR ITS 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. - * - **************************************************************************/ - -#include -#include -#include -#include "../pp/sl_pp_public.h" -#include "../pp/sl_pp_token.h" -#include "sl_cl_parse.h" - - -/* revision number - increment after each change affecting emitted output */ -#define REVISION 5 - -/* external declaration (or precision or invariant stmt) */ -#define EXTERNAL_NULL 0 -#define EXTERNAL_FUNCTION_DEFINITION 1 -#define EXTERNAL_DECLARATION 2 -#define DEFAULT_PRECISION 3 -#define INVARIANT_STMT 4 - -/* precision */ -#define PRECISION_DEFAULT 0 -#define PRECISION_LOW 1 -#define PRECISION_MEDIUM 2 -#define PRECISION_HIGH 3 - -/* declaration */ -#define DECLARATION_FUNCTION_PROTOTYPE 1 -#define DECLARATION_INIT_DECLARATOR_LIST 2 - -/* function type */ -#define FUNCTION_ORDINARY 0 -#define FUNCTION_CONSTRUCTOR 1 -#define FUNCTION_OPERATOR 2 - -/* function call type */ -#define FUNCTION_CALL_NONARRAY 0 -#define FUNCTION_CALL_ARRAY 1 - -/* operator type */ -#define OPERATOR_ADDASSIGN 1 -#define OPERATOR_SUBASSIGN 2 -#define OPERATOR_MULASSIGN 3 -#define OPERATOR_DIVASSIGN 4 -/*#define OPERATOR_MODASSIGN 5*/ -/*#define OPERATOR_LSHASSIGN 6*/ -/*#define OPERATOR_RSHASSIGN 7*/ -/*#define OPERATOR_ORASSIGN 8*/ -/*#define OPERATOR_XORASSIGN 9*/ -/*#define OPERATOR_ANDASSIGN 10*/ -#define OPERATOR_LOGICALXOR 11 -/*#define OPERATOR_BITOR 12*/ -/*#define OPERATOR_BITXOR 13*/ -/*#define OPERATOR_BITAND 14*/ -#define OPERATOR_LESS 15 -#define OPERATOR_GREATER 16 -#define OPERATOR_LESSEQUAL 17 -#define OPERATOR_GREATEREQUAL 18 -/*#define OPERATOR_LSHIFT 19*/ -/*#define OPERATOR_RSHIFT 20*/ -#define OPERATOR_MULTIPLY 21 -#define OPERATOR_DIVIDE 22 -/*#define OPERATOR_MODULUS 23*/ -#define OPERATOR_INCREMENT 24 -#define OPERATOR_DECREMENT 25 -#define OPERATOR_PLUS 26 -#define OPERATOR_MINUS 27 -/*#define OPERATOR_COMPLEMENT 28*/ -#define OPERATOR_NOT 29 - -/* init declarator list */ -#define DECLARATOR_NONE 0 -#define DECLARATOR_NEXT 1 - -/* variable declaration */ -#define VARIABLE_NONE 0 -#define VARIABLE_IDENTIFIER 1 -#define VARIABLE_INITIALIZER 2 -#define VARIABLE_ARRAY_EXPLICIT 3 -#define VARIABLE_ARRAY_UNKNOWN 4 - -/* type qualifier */ -#define TYPE_QUALIFIER_NONE 0 -#define TYPE_QUALIFIER_CONST 1 -#define TYPE_QUALIFIER_ATTRIBUTE 2 -#define TYPE_QUALIFIER_VARYING 3 -#define TYPE_QUALIFIER_UNIFORM 4 -#define TYPE_QUALIFIER_FIXEDOUTPUT 5 -#define TYPE_QUALIFIER_FIXEDINPUT 6 - -/* invariant qualifier */ -#define TYPE_VARIANT 90 -#define TYPE_INVARIANT 91 - -/* centroid qualifier */ -#define TYPE_CENTER 95 -#define TYPE_CENTROID 96 - -/* layout qualifiers */ -#define LAYOUT_QUALIFIER_NONE 0 -#define LAYOUT_QUALIFIER_UPPER_LEFT 1 -#define LAYOUT_QUALIFIER_PIXEL_CENTER_INTEGER 2 - -/* type specifier */ -#define TYPE_SPECIFIER_VOID 0 -#define TYPE_SPECIFIER_BOOL 1 -#define TYPE_SPECIFIER_BVEC2 2 -#define TYPE_SPECIFIER_BVEC3 3 -#define TYPE_SPECIFIER_BVEC4 4 -#define TYPE_SPECIFIER_INT 5 -#define TYPE_SPECIFIER_IVEC2 6 -#define TYPE_SPECIFIER_IVEC3 7 -#define TYPE_SPECIFIER_IVEC4 8 -#define TYPE_SPECIFIER_FLOAT 9 -#define TYPE_SPECIFIER_VEC2 10 -#define TYPE_SPECIFIER_VEC3 11 -#define TYPE_SPECIFIER_VEC4 12 -#define TYPE_SPECIFIER_MAT2 13 -#define TYPE_SPECIFIER_MAT3 14 -#define TYPE_SPECIFIER_MAT4 15 -#define TYPE_SPECIFIER_SAMPLER1D 16 -#define TYPE_SPECIFIER_SAMPLER2D 17 -#define TYPE_SPECIFIER_SAMPLER3D 18 -#define TYPE_SPECIFIER_SAMPLERCUBE 19 -#define TYPE_SPECIFIER_SAMPLER1DSHADOW 20 -#define TYPE_SPECIFIER_SAMPLER2DSHADOW 21 -#define TYPE_SPECIFIER_SAMPLER2DRECT 22 -#define TYPE_SPECIFIER_SAMPLER2DRECTSHADOW 23 -#define TYPE_SPECIFIER_STRUCT 24 -#define TYPE_SPECIFIER_TYPENAME 25 - -/* OpenGL 2.1 */ -#define TYPE_SPECIFIER_MAT23 26 -#define TYPE_SPECIFIER_MAT32 27 -#define TYPE_SPECIFIER_MAT24 28 -#define TYPE_SPECIFIER_MAT42 29 -#define TYPE_SPECIFIER_MAT34 30 -#define TYPE_SPECIFIER_MAT43 31 - -/* GL_EXT_texture_array */ -#define TYPE_SPECIFIER_SAMPLER_1D_ARRAY 32 -#define TYPE_SPECIFIER_SAMPLER_2D_ARRAY 33 -#define TYPE_SPECIFIER_SAMPLER_1D_ARRAY_SHADOW 34 -#define TYPE_SPECIFIER_SAMPLER_2D_ARRAY_SHADOW 35 - -/* type specifier array */ -#define TYPE_SPECIFIER_NONARRAY 0 -#define TYPE_SPECIFIER_ARRAY 1 - -/* structure field */ -#define FIELD_NONE 0 -#define FIELD_NEXT 1 -#define FIELD_ARRAY 2 - -/* operation */ -#define OP_END 0 -#define OP_BLOCK_BEGIN_NO_NEW_SCOPE 1 -#define OP_BLOCK_BEGIN_NEW_SCOPE 2 -#define OP_DECLARE 3 -#define OP_ASM 4 -#define OP_BREAK 5 -#define OP_CONTINUE 6 -#define OP_DISCARD 7 -#define OP_RETURN 8 -#define OP_EXPRESSION 9 -#define OP_IF 10 -#define OP_WHILE 11 -#define OP_DO 12 -#define OP_FOR 13 -#define OP_PUSH_VOID 14 -#define OP_PUSH_BOOL 15 -#define OP_PUSH_INT 16 -#define OP_PUSH_FLOAT 17 -#define OP_PUSH_IDENTIFIER 18 -#define OP_SEQUENCE 19 -#define OP_ASSIGN 20 -#define OP_ADDASSIGN 21 -#define OP_SUBASSIGN 22 -#define OP_MULASSIGN 23 -#define OP_DIVASSIGN 24 -/*#define OP_MODASSIGN 25*/ -/*#define OP_LSHASSIGN 26*/ -/*#define OP_RSHASSIGN 27*/ -/*#define OP_ORASSIGN 28*/ -/*#define OP_XORASSIGN 29*/ -/*#define OP_ANDASSIGN 30*/ -#define OP_SELECT 31 -#define OP_LOGICALOR 32 -#define OP_LOGICALXOR 33 -#define OP_LOGICALAND 34 -/*#define OP_BITOR 35*/ -/*#define OP_BITXOR 36*/ -/*#define OP_BITAND 37*/ -#define OP_EQUAL 38 -#define OP_NOTEQUAL 39 -#define OP_LESS 40 -#define OP_GREATER 41 -#define OP_LESSEQUAL 42 -#define OP_GREATEREQUAL 43 -/*#define OP_LSHIFT 44*/ -/*#define OP_RSHIFT 45*/ -#define OP_ADD 46 -#define OP_SUBTRACT 47 -#define OP_MULTIPLY 48 -#define OP_DIVIDE 49 -/*#define OP_MODULUS 50*/ -#define OP_PREINCREMENT 51 -#define OP_PREDECREMENT 52 -#define OP_PLUS 53 -#define OP_MINUS 54 -/*#define OP_COMPLEMENT 55*/ -#define OP_NOT 56 -#define OP_SUBSCRIPT 57 -#define OP_CALL 58 -#define OP_FIELD 59 -#define OP_POSTINCREMENT 60 -#define OP_POSTDECREMENT 61 -#define OP_PRECISION 62 -#define OP_METHOD 63 - -/* parameter qualifier */ -#define PARAM_QUALIFIER_IN 0 -#define PARAM_QUALIFIER_OUT 1 -#define PARAM_QUALIFIER_INOUT 2 -#define PARAM_QUALIFIER_NONE 3 - -/* function parameter */ -#define PARAMETER_NONE 0 -#define PARAMETER_NEXT 1 - -/* function parameter array presence */ -#define PARAMETER_ARRAY_NOT_PRESENT 0 -#define PARAMETER_ARRAY_PRESENT 1 - - -struct parse_dict { - int _void; - int _float; - int _int; - int _bool; - int vec2; - int vec3; - int vec4; - int bvec2; - int bvec3; - int bvec4; - int ivec2; - int ivec3; - int ivec4; - int mat2; - int mat3; - int mat4; - int mat2x3; - int mat3x2; - int mat2x4; - int mat4x2; - int mat3x4; - int mat4x3; - int sampler1D; - int sampler2D; - int sampler3D; - int samplerCube; - int sampler1DShadow; - int sampler2DShadow; - int sampler2DRect; - int sampler2DRectShadow; - int sampler1DArray; - int sampler2DArray; - int sampler1DArrayShadow; - int sampler2DArrayShadow; - - int invariant; - - int centroid; - - int precision; - int lowp; - int mediump; - int highp; - - int _const; - int attribute; - int varying; - int uniform; - int __fixed_output; - int __fixed_input; - - int in; - int out; - int inout; - - int layout; - int origin_upper_left; - int pixel_center_integer; - - int _struct; - - int __constructor; - int __operator; - int ___asm; - - int _if; - int _else; - int _for; - int _while; - int _do; - - int _continue; - int _break; - int _return; - int discard; - - int _false; - int _true; - - int all; - int _GL_ARB_fragment_coord_conventions; - int _GL_ARB_texture_rectangle; -}; - - -struct parse_context { - struct sl_pp_context *context; - - struct parse_dict dict; - - struct sl_pp_token_info *tokens; - unsigned int tokens_read; - unsigned int tokens_cap; - - unsigned char *out_buf; - unsigned int out_cap; - - unsigned int shader_type; - unsigned int parsing_builtin; - - unsigned int fragment_coord_conventions:1; - unsigned int texture_rectangle:1; - - char error[256]; - int process_error; -}; - - -struct parse_state { - unsigned int in; - unsigned int out; -}; - - -static unsigned int -_emit(struct parse_context *ctx, - unsigned int *out, - unsigned char b) -{ - if (*out == ctx->out_cap) { - ctx->out_cap += 4096; - ctx->out_buf = (unsigned char *)realloc(ctx->out_buf, ctx->out_cap * sizeof(unsigned char)); - } - ctx->out_buf[*out] = b; - return (*out)++; -} - - -static void -_update(struct parse_context *ctx, - unsigned int out, - unsigned char b) -{ - ctx->out_buf[out] = b; -} - - -static void -_error(struct parse_context *ctx, - const char *msg) -{ - if (ctx->error[0] == '\0') { - strncpy(ctx->error, msg, sizeof(ctx->error) - 1); - ctx->error[sizeof(ctx->error) - 1] = '\0'; - } -} - - -static const struct sl_pp_token_info * -_fetch_token(struct parse_context *ctx, - unsigned int pos) -{ - if (ctx->process_error) { - return NULL; - } - - while (pos >= ctx->tokens_read) { - if (ctx->tokens_read == ctx->tokens_cap) { - ctx->tokens_cap += 1024; - ctx->tokens = realloc(ctx->tokens, - ctx->tokens_cap * sizeof(struct sl_pp_token_info)); - if (!ctx->tokens) { - _error(ctx, "out of memory"); - ctx->process_error = 1; - return NULL; - } - } - if (sl_pp_process_get(ctx->context, &ctx->tokens[ctx->tokens_read])) { - _error(ctx, sl_pp_context_error_message(ctx->context)); - ctx->process_error = 1; - return NULL; - } - switch (ctx->tokens[ctx->tokens_read].token) { - case SL_PP_COMMA: - case SL_PP_SEMICOLON: - case SL_PP_LBRACE: - case SL_PP_RBRACE: - case SL_PP_LPAREN: - case SL_PP_RPAREN: - case SL_PP_LBRACKET: - case SL_PP_RBRACKET: - case SL_PP_DOT: - case SL_PP_INCREMENT: - case SL_PP_ADDASSIGN: - case SL_PP_PLUS: - case SL_PP_DECREMENT: - case SL_PP_SUBASSIGN: - case SL_PP_MINUS: - case SL_PP_BITNOT: - case SL_PP_NOTEQUAL: - case SL_PP_NOT: - case SL_PP_MULASSIGN: - case SL_PP_STAR: - case SL_PP_DIVASSIGN: - case SL_PP_SLASH: - case SL_PP_MODASSIGN: - case SL_PP_MODULO: - case SL_PP_LSHIFTASSIGN: - case SL_PP_LSHIFT: - case SL_PP_LESSEQUAL: - case SL_PP_LESS: - case SL_PP_RSHIFTASSIGN: - case SL_PP_RSHIFT: - case SL_PP_GREATEREQUAL: - case SL_PP_GREATER: - case SL_PP_EQUAL: - case SL_PP_ASSIGN: - case SL_PP_AND: - case SL_PP_BITANDASSIGN: - case SL_PP_BITAND: - case SL_PP_XOR: - case SL_PP_BITXORASSIGN: - case SL_PP_BITXOR: - case SL_PP_OR: - case SL_PP_BITORASSIGN: - case SL_PP_BITOR: - case SL_PP_QUESTION: - case SL_PP_COLON: - case SL_PP_IDENTIFIER: - case SL_PP_UINT: - case SL_PP_FLOAT: - case SL_PP_EXTENSION_REQUIRE: - case SL_PP_EXTENSION_ENABLE: - case SL_PP_EXTENSION_WARN: - case SL_PP_EXTENSION_DISABLE: - case SL_PP_EOF: - ctx->tokens_read++; - break; - default: - ; /* no-op */ - } - } - return &ctx->tokens[pos]; -} - - -/** - * Try to parse/match a particular token. - * \return 0 for success, -1 for error. - */ -static int -_parse_token(struct parse_context *ctx, - enum sl_pp_token token, - struct parse_state *ps) -{ - const struct sl_pp_token_info *input = _fetch_token(ctx, ps->in); - - if (input && input->token == token) { - ps->in++; - return 0; - } - return -1; -} - - -/** - * Try to parse an identifer. - * \return 0 for success, -1 for error - */ -static int -_parse_id(struct parse_context *ctx, - int id, - struct parse_state *ps) -{ - const struct sl_pp_token_info *input = _fetch_token(ctx, ps->in); - - if (input && input->token == SL_PP_IDENTIFIER && input->data.identifier == id) { - ps->in++; - return 0; - } - return -1; -} - - -static int -_parse_identifier(struct parse_context *ctx, - struct parse_state *ps) -{ - const struct sl_pp_token_info *input = _fetch_token(ctx, ps->in); - - if (input && input->token == SL_PP_IDENTIFIER) { - const char *cstr = sl_pp_context_cstr(ctx->context, input->data.identifier); - - do { - _emit(ctx, &ps->out, *cstr); - } while (*cstr++); - ps->in++; - return 0; - } - return -1; -} - - -static int -_parse_float(struct parse_context *ctx, - struct parse_state *ps) -{ - const struct sl_pp_token_info *input = _fetch_token(ctx, ps->in); - - if (input && input->token == SL_PP_FLOAT) { - const char *cstr = sl_pp_context_cstr(ctx->context, input->data._float); - - _emit(ctx, &ps->out, 1); - do { - _emit(ctx, &ps->out, *cstr); - } while (*cstr++); - ps->in++; - return 0; - } - return -1; -} - - -static int -_parse_uint(struct parse_context *ctx, - struct parse_state *ps) -{ - const struct sl_pp_token_info *input = _fetch_token(ctx, ps->in); - - if (input && input->token == SL_PP_UINT) { - const char *cstr = sl_pp_context_cstr(ctx->context, input->data._uint); - - _emit(ctx, &ps->out, 1); - do { - _emit(ctx, &ps->out, *cstr); - } while (*cstr++); - ps->in++; - return 0; - } - return -1; -} - - -/**************************************/ - - -static int -_parse_unary_expression(struct parse_context *ctx, - struct parse_state *ps); - -static int -_parse_conditional_expression(struct parse_context *ctx, - struct parse_state *ps); - - -static int -_parse_constant_expression(struct parse_context *ctx, - struct parse_state *ps); - - -static int -_parse_primary_expression(struct parse_context *ctx, - struct parse_state *ps); - - -static int -_parse_statement(struct parse_context *ctx, - struct parse_state *ps); - - -static int -_parse_type_specifier(struct parse_context *ctx, - struct parse_state *ps); - - -static int -_parse_declaration(struct parse_context *ctx, - struct parse_state *ps); - - -static int -_parse_statement_list(struct parse_context *ctx, - struct parse_state *ps); - - -static int -_parse_assignment_expression(struct parse_context *ctx, - struct parse_state *ps); - - -static int -_parse_precision(struct parse_context *ctx, - struct parse_state *ps); - - -static int -_parse_overriden_operator(struct parse_context *ctx, - struct parse_state *ps) -{ - unsigned int op; - - if (_parse_token(ctx, SL_PP_INCREMENT, ps) == 0) { - op = OPERATOR_INCREMENT; - } else if (_parse_token(ctx, SL_PP_ADDASSIGN, ps) == 0) { - op = OPERATOR_ADDASSIGN; - } else if (_parse_token(ctx, SL_PP_PLUS, ps) == 0) { - op = OPERATOR_PLUS; - } else if (_parse_token(ctx, SL_PP_DECREMENT, ps) == 0) { - op = OPERATOR_DECREMENT; - } else if (_parse_token(ctx, SL_PP_SUBASSIGN, ps) == 0) { - op = OPERATOR_SUBASSIGN; - } else if (_parse_token(ctx, SL_PP_MINUS, ps) == 0) { - op = OPERATOR_MINUS; - } else if (_parse_token(ctx, SL_PP_NOT, ps) == 0) { - op = OPERATOR_NOT; - } else if (_parse_token(ctx, SL_PP_MULASSIGN, ps) == 0) { - op = OPERATOR_MULASSIGN; - } else if (_parse_token(ctx, SL_PP_STAR, ps) == 0) { - op = OPERATOR_MULTIPLY; - } else if (_parse_token(ctx, SL_PP_DIVASSIGN, ps) == 0) { - op = OPERATOR_DIVASSIGN; - } else if (_parse_token(ctx, SL_PP_SLASH, ps) == 0) { - op = OPERATOR_DIVIDE; - } else if (_parse_token(ctx, SL_PP_LESSEQUAL, ps) == 0) { - op = OPERATOR_LESSEQUAL; - } else if (_parse_token(ctx, SL_PP_LESS, ps) == 0) { - op = OPERATOR_LESS; - } else if (_parse_token(ctx, SL_PP_GREATEREQUAL, ps) == 0) { - op = OPERATOR_GREATEREQUAL; - } else if (_parse_token(ctx, SL_PP_GREATER, ps) == 0) { - op = OPERATOR_GREATER; - } else if (_parse_token(ctx, SL_PP_XOR, ps) == 0) { - op = OPERATOR_LOGICALXOR; - } else { - return -1; - } - - _emit(ctx, &ps->out, op); - return 0; -} - - -static int -_parse_function_decl_identifier(struct parse_context *ctx, - struct parse_state *ps) -{ - struct parse_state p = *ps; - unsigned int e = _emit(ctx, &p.out, 0); - - if (ctx->parsing_builtin && _parse_id(ctx, ctx->dict.__constructor, &p) == 0) { - _update(ctx, e, FUNCTION_CONSTRUCTOR); - *ps = p; - return 0; - } - - if (ctx->parsing_builtin && _parse_id(ctx, ctx->dict.__operator, &p) == 0) { - _update(ctx, e, FUNCTION_OPERATOR); - if (_parse_overriden_operator(ctx, &p) == 0) { - *ps = p; - return 0; - } - return -1; - } - - if (_parse_identifier(ctx, &p) == 0) { - _update(ctx, e, FUNCTION_ORDINARY); - *ps = p; - return 0; - } - - return -1; -} - - -static int -_parse_invariant_qualifier(struct parse_context *ctx, - struct parse_state *ps) -{ - if (_parse_id(ctx, ctx->dict.invariant, ps)) { - return -1; - } - _emit(ctx, &ps->out, TYPE_INVARIANT); - return 0; -} - - -static int -_parse_centroid_qualifier(struct parse_context *ctx, - struct parse_state *ps) -{ - if (_parse_id(ctx, ctx->dict.centroid, ps)) { - return -1; - } - _emit(ctx, &ps->out, TYPE_CENTROID); - return 0; -} - - -static int -_parse_layout_qualifier(struct parse_context *ctx, - struct parse_state *ps) -{ - if (_parse_id(ctx, ctx->dict.layout, ps) == 0) { - if (!ctx->fragment_coord_conventions) { - _error(ctx, "GL_ARB_fragment_coord_conventions extension must be enabled " - "in order to use a layout qualifier"); - return -1; - } - - /* Layout qualifiers are only defined for fragment shaders, - * so do an early check. - */ - if (ctx->shader_type != 1) { - _error(ctx, "layout qualifiers are only valid for fragment shaders"); - return -1; - } - - /* start of a parenthesised list of layout qualifiers */ - - if (_parse_token(ctx, SL_PP_LPAREN, ps)) { - _error(ctx, "expected `('"); - return -1; - } - - /* parse comma-separated ID list */ - while (1) { - if (_parse_id(ctx, ctx->dict.origin_upper_left, ps) == 0) { - _emit(ctx, &ps->out, LAYOUT_QUALIFIER_UPPER_LEFT); - } - else if (_parse_id(ctx, ctx->dict.pixel_center_integer, ps) == 0) { - _emit(ctx, &ps->out, LAYOUT_QUALIFIER_PIXEL_CENTER_INTEGER); - } - else { - _error(ctx, "expected a layout qualifier name"); - return -1; - } - - if (_parse_token(ctx, SL_PP_RPAREN, ps) == 0) { - /* all done */ - break; - } - else if (_parse_token(ctx, SL_PP_COMMA, ps) == 0) { - /* another layout qualifier is coming */ - } - else { - _error(ctx, "expected `,' or `)'"); - return -1; - } - } - } - - return 0; -} - - -static int -_parse_storage_qualifier(struct parse_context *ctx, - struct parse_state *ps) -{ - struct parse_state p = *ps; - const struct sl_pp_token_info *input = _fetch_token(ctx, p.in); - unsigned int e = _emit(ctx, &p.out, 0); - int id; - - if (!input || input->token != SL_PP_IDENTIFIER) { - return -1; - } - id = input->data.identifier; - - if (id == ctx->dict._const) { - _update(ctx, e, TYPE_QUALIFIER_CONST); - } else if (ctx->shader_type == 2 && id == ctx->dict.attribute) { - _update(ctx, e, TYPE_QUALIFIER_ATTRIBUTE); - } else if (id == ctx->dict.varying) { - _update(ctx, e, TYPE_QUALIFIER_VARYING); - } else if (id == ctx->dict.uniform) { - _update(ctx, e, TYPE_QUALIFIER_UNIFORM); - } else if (ctx->parsing_builtin && id == ctx->dict.__fixed_output) { - _update(ctx, e, TYPE_QUALIFIER_FIXEDOUTPUT); - } else if (ctx->parsing_builtin && id == ctx->dict.__fixed_input) { - _update(ctx, e, TYPE_QUALIFIER_FIXEDINPUT); - } else { - return -1; - } - _parse_token(ctx, SL_PP_IDENTIFIER, &p); - *ps = p; - return 0; -} - -static int -_parse_struct_declarator(struct parse_context *ctx, - struct parse_state *ps) -{ - struct parse_state p = *ps; - unsigned int e; - - if (_parse_identifier(ctx, &p)) { - return -1; - } - e = _emit(ctx, &p.out, FIELD_NONE); - *ps = p; - - if (_parse_token(ctx, SL_PP_LBRACKET, &p)) { - return 0; - } - if (_parse_constant_expression(ctx, &p)) { - _error(ctx, "expected constant integral expression"); - return -1; - } - if (_parse_token(ctx, SL_PP_RBRACKET, &p)) { - _error(ctx, "expected `]'"); - return -1; - } - _update(ctx, e, FIELD_ARRAY); - *ps = p; - return 0; -} - - -static int -_parse_struct_declarator_list(struct parse_context *ctx, - struct parse_state *ps) -{ - struct parse_state p = *ps; - - if (_parse_struct_declarator(ctx, &p)) { - return -1; - } - - for (;;) { - *ps = p; - _emit(ctx, &p.out, FIELD_NEXT); - if (_parse_token(ctx, SL_PP_COMMA, &p)) { - return 0; - } - if (_parse_struct_declarator(ctx, &p)) { - return 0; - } - } -} - - -static int -_parse_struct_declaration(struct parse_context *ctx, - struct parse_state *ps) -{ - struct parse_state p = *ps; - - if (_parse_type_specifier(ctx, &p)) { - return -1; - } - if (_parse_struct_declarator_list(ctx, &p)) { - return -1; - } - if (_parse_token(ctx, SL_PP_SEMICOLON, &p)) { - return -1; - } - _emit(ctx, &p.out, FIELD_NONE); - *ps = p; - return 0; -} - - -static int -_parse_struct_declaration_list(struct parse_context *ctx, - struct parse_state *ps) -{ - struct parse_state p = *ps; - - if (_parse_struct_declaration(ctx, &p)) { - return -1; - } - - for (;;) { - *ps = p; - _emit(ctx, &p.out, FIELD_NEXT); - if (_parse_struct_declaration(ctx, &p)) { - return 0; - } - } -} - - -static int -_parse_struct_specifier(struct parse_context *ctx, - struct parse_state *ps) -{ - struct parse_state p = *ps; - - if (_parse_id(ctx, ctx->dict._struct, &p)) { - return -1; - } - if (_parse_identifier(ctx, &p)) { - _emit(ctx, &p.out, '\0'); - } - if (_parse_token(ctx, SL_PP_LBRACE, &p)) { - _error(ctx, "expected `{'"); - return -1; - } - if (_parse_struct_declaration_list(ctx, &p)) { - return -1; - } - if (_parse_token(ctx, SL_PP_RBRACE, &p)) { - return -1; - } - _emit(ctx, &p.out, FIELD_NONE); - *ps = p; - return 0; -} - - -static int -_parse_type_specifier_nonarray(struct parse_context *ctx, - struct parse_state *ps) -{ - struct parse_state p = *ps; - unsigned int e = _emit(ctx, &p.out, 0); - const struct sl_pp_token_info *input; - int id; - - if (_parse_struct_specifier(ctx, &p) == 0) { - _update(ctx, e, TYPE_SPECIFIER_STRUCT); - *ps = p; - return 0; - } - - input = _fetch_token(ctx, p.in); - if (!input || input->token != SL_PP_IDENTIFIER) { - return -1; - } - id = input->data.identifier; - - if (id == ctx->dict._void) { - _update(ctx, e, TYPE_SPECIFIER_VOID); - } else if (id == ctx->dict._float) { - _update(ctx, e, TYPE_SPECIFIER_FLOAT); - } else if (id == ctx->dict._int) { - _update(ctx, e, TYPE_SPECIFIER_INT); - } else if (id == ctx->dict._bool) { - _update(ctx, e, TYPE_SPECIFIER_BOOL); - } else if (id == ctx->dict.vec2) { - _update(ctx, e, TYPE_SPECIFIER_VEC2); - } else if (id == ctx->dict.vec3) { - _update(ctx, e, TYPE_SPECIFIER_VEC3); - } else if (id == ctx->dict.vec4) { - _update(ctx, e, TYPE_SPECIFIER_VEC4); - } else if (id == ctx->dict.bvec2) { - _update(ctx, e, TYPE_SPECIFIER_BVEC2); - } else if (id == ctx->dict.bvec3) { - _update(ctx, e, TYPE_SPECIFIER_BVEC3); - } else if (id == ctx->dict.bvec4) { - _update(ctx, e, TYPE_SPECIFIER_BVEC4); - } else if (id == ctx->dict.ivec2) { - _update(ctx, e, TYPE_SPECIFIER_IVEC2); - } else if (id == ctx->dict.ivec3) { - _update(ctx, e, TYPE_SPECIFIER_IVEC3); - } else if (id == ctx->dict.ivec4) { - _update(ctx, e, TYPE_SPECIFIER_IVEC4); - } else if (id == ctx->dict.mat2) { - _update(ctx, e, TYPE_SPECIFIER_MAT2); - } else if (id == ctx->dict.mat3) { - _update(ctx, e, TYPE_SPECIFIER_MAT3); - } else if (id == ctx->dict.mat4) { - _update(ctx, e, TYPE_SPECIFIER_MAT4); - } else if (id == ctx->dict.mat2x3) { - _update(ctx, e, TYPE_SPECIFIER_MAT23); - } else if (id == ctx->dict.mat3x2) { - _update(ctx, e, TYPE_SPECIFIER_MAT32); - } else if (id == ctx->dict.mat2x4) { - _update(ctx, e, TYPE_SPECIFIER_MAT24); - } else if (id == ctx->dict.mat4x2) { - _update(ctx, e, TYPE_SPECIFIER_MAT42); - } else if (id == ctx->dict.mat3x4) { - _update(ctx, e, TYPE_SPECIFIER_MAT34); - } else if (id == ctx->dict.mat4x3) { - _update(ctx, e, TYPE_SPECIFIER_MAT43); - } else if (id == ctx->dict.sampler1D) { - _update(ctx, e, TYPE_SPECIFIER_SAMPLER1D); - } else if (id == ctx->dict.sampler2D) { - _update(ctx, e, TYPE_SPECIFIER_SAMPLER2D); - } else if (id == ctx->dict.sampler3D) { - _update(ctx, e, TYPE_SPECIFIER_SAMPLER3D); - } else if (id == ctx->dict.samplerCube) { - _update(ctx, e, TYPE_SPECIFIER_SAMPLERCUBE); - } else if (id == ctx->dict.sampler1DShadow) { - _update(ctx, e, TYPE_SPECIFIER_SAMPLER1DSHADOW); - } else if (id == ctx->dict.sampler2DShadow) { - _update(ctx, e, TYPE_SPECIFIER_SAMPLER2DSHADOW); - } else if (id == ctx->dict.sampler2DRect) { - if (!ctx->texture_rectangle) { - _error(ctx, "GL_ARB_texture_rectangle extension must be enabled " - "in order to use a rect sampler"); - return -1; - } - _update(ctx, e, TYPE_SPECIFIER_SAMPLER2DRECT); - } else if (id == ctx->dict.sampler2DRectShadow) { - if (!ctx->texture_rectangle) { - _error(ctx, "GL_ARB_texture_rectangle extension must be enabled " - "in order to use a rect sampler"); - return -1; - } - _update(ctx, e, TYPE_SPECIFIER_SAMPLER2DRECTSHADOW); - } else if (id == ctx->dict.sampler1DArray) { - _update(ctx, e, TYPE_SPECIFIER_SAMPLER_1D_ARRAY); - } else if (id == ctx->dict.sampler2DArray) { - /* XXX check for GL_EXT_texture_array */ - _update(ctx, e, TYPE_SPECIFIER_SAMPLER_2D_ARRAY); - } else if (id == ctx->dict.sampler1DArrayShadow) { - _update(ctx, e, TYPE_SPECIFIER_SAMPLER_1D_ARRAY_SHADOW); - } else if (id == ctx->dict.sampler2DArrayShadow) { - _update(ctx, e, TYPE_SPECIFIER_SAMPLER_2D_ARRAY_SHADOW); - } else if (_parse_identifier(ctx, &p) == 0) { - _update(ctx, e, TYPE_SPECIFIER_TYPENAME); - *ps = p; - return 0; - } else { - return -1; - } - - _parse_token(ctx, SL_PP_IDENTIFIER, &p); - *ps = p; - return 0; -} - - -static int -_parse_type_specifier_array(struct parse_context *ctx, - struct parse_state *ps) -{ - struct parse_state p = *ps; - - if (_parse_token(ctx, SL_PP_LBRACKET, &p)) { - return -1; - } - if (_parse_constant_expression(ctx, &p)) { - _error(ctx, "expected constant integral expression"); - return -1; - } - if (_parse_token(ctx, SL_PP_RBRACKET, &p)) { - _error(ctx, "expected `]'"); - return -1; - } - *ps = p; - return 0; -} - - -static int -_parse_type_specifier(struct parse_context *ctx, - struct parse_state *ps) -{ - struct parse_state p = *ps; - unsigned int e; - - if (_parse_type_specifier_nonarray(ctx, &p)) { - return -1; - } - - e = _emit(ctx, &p.out, TYPE_SPECIFIER_ARRAY); - if (_parse_type_specifier_array(ctx, &p)) { - _update(ctx, e, TYPE_SPECIFIER_NONARRAY); - } - *ps = p; - return 0; -} - -static int -_parse_parameter_qualifier(struct parse_context *ctx, - struct parse_state *ps) -{ - unsigned int e = _emit(ctx, &ps->out, PARAM_QUALIFIER_NONE); - - if (_parse_id(ctx, ctx->dict.in, ps) == 0) { - _update(ctx, e, PARAM_QUALIFIER_IN); - } else if (_parse_id(ctx, ctx->dict.out, ps) == 0) { - _update(ctx, e, PARAM_QUALIFIER_OUT); - } else if (_parse_id(ctx, ctx->dict.inout, ps) == 0) { - _update(ctx, e, PARAM_QUALIFIER_INOUT); - } - return 0; -} - -static int -_parse_fully_specified_type(struct parse_context *ctx, - struct parse_state *ps) -{ - struct parse_state p = *ps; - - if (_parse_layout_qualifier(ctx, &p)) { - return -1; - } - _emit(ctx, &p.out, LAYOUT_QUALIFIER_NONE); - - if (_parse_invariant_qualifier(ctx, &p)) { - _emit(ctx, &p.out, TYPE_VARIANT); - } - - if (_parse_centroid_qualifier(ctx, &p)) { - _emit(ctx, &p.out, TYPE_CENTER); - } - if (_parse_storage_qualifier(ctx, &p)) { - _emit(ctx, &p.out, TYPE_QUALIFIER_NONE); - } - _parse_parameter_qualifier(ctx, &p); - if (_parse_precision(ctx, &p)) { - _emit(ctx, &p.out, PRECISION_DEFAULT); - } - if (_parse_type_specifier(ctx, &p)) { - return -1; - } - *ps = p; - return 0; -} - - -static int -_parse_function_header(struct parse_context *ctx, - struct parse_state *ps) -{ - struct parse_state p = *ps; - - if (_parse_fully_specified_type(ctx, &p)) { - return -1; - } - if (_parse_function_decl_identifier(ctx, &p)) { - return -1; - } - if (_parse_token(ctx, SL_PP_LPAREN, &p)) { - return -1; - } - *ps = p; - return 0; -} - - -static int -_parse_function_identifier(struct parse_context *ctx, - struct parse_state *ps) -{ - struct parse_state p; - unsigned int e; - - if (_parse_identifier(ctx, ps)) { - return -1; - } - e = _emit(ctx, &ps->out, FUNCTION_CALL_NONARRAY); - - p = *ps; - if (_parse_token(ctx, SL_PP_LBRACKET, &p)) { - return 0; - } - if (_parse_constant_expression(ctx, &p)) { - _error(ctx, "expected constant integral expression"); - return -1; - } - if (_parse_token(ctx, SL_PP_RBRACKET, &p)) { - _error(ctx, "expected `]'"); - return -1; - } - _update(ctx, e, FUNCTION_CALL_ARRAY); - *ps = p; - return 0; -} - - -static int -_parse_function_call_header(struct parse_context *ctx, - struct parse_state *ps) -{ - struct parse_state p = *ps; - - if (_parse_function_identifier(ctx, &p)) { - return -1; - } - if (_parse_token(ctx, SL_PP_LPAREN, &p)) { - return -1; - } - *ps = p; - return 0; -} - - -static int -_parse_assign_expression(struct parse_context *ctx, - struct parse_state *ps) -{ - struct parse_state p = *ps; - unsigned int op; - - if (_parse_unary_expression(ctx, &p)) { - return -1; - } - - if (_parse_token(ctx, SL_PP_ASSIGN, &p) == 0) { - op = OP_ASSIGN; - } else if (_parse_token(ctx, SL_PP_MULASSIGN, &p) == 0) { - op = OP_MULASSIGN; - } else if (_parse_token(ctx, SL_PP_DIVASSIGN, &p) == 0) { - op = OP_DIVASSIGN; - } else if (_parse_token(ctx, SL_PP_ADDASSIGN, &p) == 0) { - op = OP_ADDASSIGN; - } else if (_parse_token(ctx, SL_PP_SUBASSIGN, &p) == 0) { - op = OP_SUBASSIGN; - } else { - return -1; - } - - if (_parse_assignment_expression(ctx, &p)) { - return -1; - } - _emit(ctx, &p.out, op); - - *ps = p; - return 0; -} - - -static int -_parse_assignment_expression(struct parse_context *ctx, - struct parse_state *ps) -{ - if (_parse_assign_expression(ctx, ps) == 0) { - return 0; - } - - if (_parse_conditional_expression(ctx, ps) == 0) { - return 0; - } - - return -1; -} - - -static int -_parse_function_call_header_with_parameters(struct parse_context *ctx, - struct parse_state *ps) -{ - struct parse_state p = *ps; - - if (_parse_function_call_header(ctx, &p)) { - return -1; - } - if (_parse_assignment_expression(ctx, &p)) { - return -1; - } - _emit(ctx, &p.out, OP_END); - for (;;) { - *ps = p; - if (_parse_token(ctx, SL_PP_COMMA, &p)) { - return 0; - } - if (_parse_assignment_expression(ctx, &p)) { - return 0; - } - _emit(ctx, &p.out, OP_END); - } -} - - -static int -_parse_function_call_header_no_parameters(struct parse_context *ctx, - struct parse_state *ps) -{ - if (_parse_function_call_header(ctx, ps)) { - return -1; - } - _parse_id(ctx, ctx->dict._void, ps); - return 0; -} - - -static int -_parse_function_call_generic(struct parse_context *ctx, - struct parse_state *ps) -{ - struct parse_state p = *ps; - - if (_parse_function_call_header_with_parameters(ctx, &p) == 0) { - if (_parse_token(ctx, SL_PP_RPAREN, &p) == 0) { - *ps = p; - return 0; - } - _error(ctx, "expected `)'"); - return -1; - } - - p = *ps; - if (_parse_function_call_header_no_parameters(ctx, &p) == 0) { - if (_parse_token(ctx, SL_PP_RPAREN, &p) == 0) { - *ps = p; - return 0; - } - _error(ctx, "expected `)'"); - return -1; - } - - return -1; -} - - -static int -_parse_method_call(struct parse_context *ctx, - struct parse_state *ps) -{ - struct parse_state p = *ps; - - _emit(ctx, &p.out, OP_METHOD); - if (_parse_identifier(ctx, &p)) { - return -1; - } - if (_parse_token(ctx, SL_PP_DOT, &p)) { - return -1; - } - if (_parse_function_call_generic(ctx, &p)) { - return -1; - } - _emit(ctx, &p.out, OP_END); - *ps = p; - return 0; -} - - -static int -_parse_regular_function_call(struct parse_context *ctx, - struct parse_state *ps) -{ - struct parse_state p = *ps; - - _emit(ctx, &p.out, OP_CALL); - if (_parse_function_call_generic(ctx, &p)) { - return -1; - } - _emit(ctx, &p.out, OP_END); - *ps = p; - return 0; -} - - -static int -_parse_function_call(struct parse_context *ctx, - struct parse_state *ps) -{ - if (_parse_regular_function_call(ctx, ps) == 0) { - return 0; - } - - if (_parse_method_call(ctx, ps) == 0) { - return 0; - } - - return -1; -} - - -static int -_parse_expression(struct parse_context *ctx, - struct parse_state *ps) -{ - struct parse_state p = *ps; - - if (_parse_assignment_expression(ctx, &p)) { - return -1; - } - - for (;;) { - *ps = p; - if (_parse_token(ctx, SL_PP_COMMA, &p)) { - return 0; - } - if (_parse_assignment_expression(ctx, &p)) { - return 0; - } - _emit(ctx, &p.out, OP_SEQUENCE); - } -} - - -static int -_parse_postfix_expression(struct parse_context *ctx, - struct parse_state *ps) -{ - struct parse_state p; - - if (_parse_function_call(ctx, ps)) { - if (_parse_primary_expression(ctx, ps)) { - return -1; - } - } - - for (p = *ps;;) { - *ps = p; - if (_parse_token(ctx, SL_PP_INCREMENT, &p) == 0) { - _emit(ctx, &p.out, OP_POSTINCREMENT); - } else if (_parse_token(ctx, SL_PP_DECREMENT, &p) == 0) { - _emit(ctx, &p.out, OP_POSTDECREMENT); - } else if (_parse_token(ctx, SL_PP_LBRACKET, &p) == 0) { - if (_parse_expression(ctx, &p)) { - _error(ctx, "expected an integral expression"); - return -1; - } - if (_parse_token(ctx, SL_PP_RBRACKET, &p)) { - _error(ctx, "expected `]'"); - return -1; - } - _emit(ctx, &p.out, OP_SUBSCRIPT); - } else if (_parse_token(ctx, SL_PP_DOT, &p) == 0) { - _emit(ctx, &p.out, OP_FIELD); - if (_parse_identifier(ctx, &p)) { - return 0; - } - } else { - return 0; - } - } -} - - -static int -_parse_unary_expression(struct parse_context *ctx, - struct parse_state *ps) -{ - struct parse_state p; - unsigned int op; - - if (_parse_postfix_expression(ctx, ps) == 0) { - return 0; - } - - p = *ps; - if (_parse_token(ctx, SL_PP_INCREMENT, &p) == 0) { - op = OP_PREINCREMENT; - } else if (_parse_token(ctx, SL_PP_DECREMENT, &p) == 0) { - op = OP_PREDECREMENT; - } else if (_parse_token(ctx, SL_PP_PLUS, &p) == 0) { - op = OP_PLUS; - } else if (_parse_token(ctx, SL_PP_MINUS, &p) == 0) { - op = OP_MINUS; - } else if (_parse_token(ctx, SL_PP_NOT, &p) == 0) { - op = OP_NOT; - } else { - return -1; - } - - if (_parse_unary_expression(ctx, &p)) { - return -1; - } - _emit(ctx, &p.out, op); - *ps = p; - return 0; -} - - -static int -_parse_multiplicative_expression(struct parse_context *ctx, - struct parse_state *ps) -{ - struct parse_state p = *ps; - - if (_parse_unary_expression(ctx, &p)) { - return -1; - } - for (;;) { - unsigned int op; - - *ps = p; - if (_parse_token(ctx, SL_PP_STAR, &p) == 0) { - op = OP_MULTIPLY; - } else if (_parse_token(ctx, SL_PP_SLASH, &p) == 0) { - op = OP_DIVIDE; - } else { - return 0; - } - if (_parse_unary_expression(ctx, &p)) { - return 0; - } - _emit(ctx, &p.out, op); - } -} - - -static int -_parse_additive_expression(struct parse_context *ctx, - struct parse_state *ps) -{ - struct parse_state p = *ps; - - if (_parse_multiplicative_expression(ctx, &p)) { - return -1; - } - for (;;) { - unsigned int op; - - *ps = p; - if (_parse_token(ctx, SL_PP_PLUS, &p) == 0) { - op = OP_ADD; - } else if (_parse_token(ctx, SL_PP_MINUS, &p) == 0) { - op = OP_SUBTRACT; - } else { - return 0; - } - if (_parse_multiplicative_expression(ctx, &p)) { - return 0; - } - _emit(ctx, &p.out, op); - } -} - - -static int -_parse_relational_expression(struct parse_context *ctx, - struct parse_state *ps) -{ - struct parse_state p = *ps; - - if (_parse_additive_expression(ctx, &p)) { - return -1; - } - for (;;) { - unsigned int op; - - *ps = p; - if (_parse_token(ctx, SL_PP_LESS, &p) == 0) { - op = OP_LESS; - } else if (_parse_token(ctx, SL_PP_GREATER, &p) == 0) { - op = OP_GREATER; - } else if (_parse_token(ctx, SL_PP_LESSEQUAL, &p) == 0) { - op = OP_LESSEQUAL; - } else if (_parse_token(ctx, SL_PP_GREATEREQUAL, &p) == 0) { - op = OP_GREATEREQUAL; - } else { - return 0; - } - if (_parse_additive_expression(ctx, &p)) { - return 0; - } - _emit(ctx, &p.out, op); - } -} - - -static int -_parse_equality_expression(struct parse_context *ctx, - struct parse_state *ps) -{ - struct parse_state p = *ps; - - if (_parse_relational_expression(ctx, &p)) { - return -1; - } - for (;;) { - unsigned int op; - - *ps = p; - if (_parse_token(ctx, SL_PP_EQUAL, &p) == 0) { - op = OP_EQUAL; - } else if (_parse_token(ctx, SL_PP_NOTEQUAL, &p) == 0) { - op = OP_NOTEQUAL; - } else { - return 0; - } - if (_parse_relational_expression(ctx, &p)) { - return -1; - } - _emit(ctx, &p.out, op); - } -} - - -static int -_parse_logical_and_expression(struct parse_context *ctx, - struct parse_state *ps) -{ - struct parse_state p = *ps; - - if (_parse_equality_expression(ctx, &p)) { - return -1; - } - for (;;) { - *ps = p; - if (_parse_token(ctx, SL_PP_AND, &p)) { - return 0; - } - if (_parse_equality_expression(ctx, &p)) { - return 0; - } - _emit(ctx, &p.out, OP_LOGICALAND); - } -} - - -static int -_parse_logical_xor_expression(struct parse_context *ctx, - struct parse_state *ps) -{ - struct parse_state p = *ps; - - if (_parse_logical_and_expression(ctx, &p)) { - return -1; - } - for (;;) { - *ps = p; - if (_parse_token(ctx, SL_PP_XOR, &p)) { - return 0; - } - if (_parse_logical_and_expression(ctx, &p)) { - return 0; - } - _emit(ctx, &p.out, OP_LOGICALXOR); - } -} - - -static int -_parse_logical_or_expression(struct parse_context *ctx, - struct parse_state *ps) -{ - struct parse_state p = *ps; - - if (_parse_logical_xor_expression(ctx, &p)) { - return -1; - } - for (;;) { - *ps = p; - if (_parse_token(ctx, SL_PP_OR, &p)) { - return 0; - } - if (_parse_logical_xor_expression(ctx, &p)) { - return 0; - } - _emit(ctx, &p.out, OP_LOGICALOR); - } -} - - -static int -_parse_conditional_expression(struct parse_context *ctx, - struct parse_state *ps) -{ - struct parse_state p = *ps; - - if (_parse_logical_or_expression(ctx, &p)) { - return -1; - } - for (;;) { - *ps = p; - if (_parse_token(ctx, SL_PP_QUESTION, &p)) { - return 0; - } - if (_parse_expression(ctx, &p)) { - return 0; - } - if (_parse_token(ctx, SL_PP_COLON, &p)) { - return 0; - } - if (_parse_conditional_expression(ctx, &p)) { - return 0; - } - _emit(ctx, &p.out, OP_SELECT); - } -} - - -static int -_parse_constant_expression(struct parse_context *ctx, - struct parse_state *ps) -{ - if (_parse_conditional_expression(ctx, ps)) { - return -1; - } - _emit(ctx, &ps->out, OP_END); - return 0; -} - - -static int -_parse_parameter_declarator_array(struct parse_context *ctx, - struct parse_state *ps) -{ - struct parse_state p = *ps; - - if (_parse_token(ctx, SL_PP_LBRACKET, &p)) { - return -1; - } - if (_parse_constant_expression(ctx, &p)) { - _error(ctx, "expected constant integral expression"); - return -1; - } - if (_parse_token(ctx, SL_PP_RBRACKET, &p)) { - _error(ctx, "expected `]'"); - return -1; - } - *ps = p; - return 0; -} - - -static int -_parse_parameter_declarator(struct parse_context *ctx, - struct parse_state *ps) -{ - struct parse_state p = *ps; - unsigned int e; - - if (_parse_type_specifier(ctx, &p)) { - return -1; - } - if (_parse_identifier(ctx, &p)) { - return -1; - } - e = _emit(ctx, &p.out, PARAMETER_ARRAY_PRESENT); - if (_parse_parameter_declarator_array(ctx, &p)) { - _update(ctx, e, PARAMETER_ARRAY_NOT_PRESENT); - } - *ps = p; - return 0; -} - - -static int -_parse_parameter_type_specifier_array(struct parse_context *ctx, - struct parse_state *ps) -{ - struct parse_state p = *ps; - - if (_parse_token(ctx, SL_PP_LBRACKET, &p)) { - return -1; - } - if (_parse_constant_expression(ctx, &p)) { - _error(ctx, "expected constant integral expression"); - return -1; - } - if (_parse_token(ctx, SL_PP_RBRACKET, &p)) { - _error(ctx, "expected `]'"); - return -1; - } - *ps = p; - return 0; -} - - -static int -_parse_parameter_type_specifier(struct parse_context *ctx, - struct parse_state *ps) -{ - struct parse_state p = *ps; - unsigned int e; - - if (_parse_type_specifier(ctx, &p)) { - return -1; - } - _emit(ctx, &p.out, '\0'); - - e = _emit(ctx, &p.out, PARAMETER_ARRAY_PRESENT); - if (_parse_parameter_type_specifier_array(ctx, &p)) { - _update(ctx, e, PARAMETER_ARRAY_NOT_PRESENT); - } - *ps = p; - return 0; -} - - -static int -_parse_parameter_declaration(struct parse_context *ctx, - struct parse_state *ps) -{ - struct parse_state p = *ps; - unsigned int e = _emit(ctx, &p.out, PARAMETER_NEXT); - - (void) e; - - if (_parse_storage_qualifier(ctx, &p)) { - _emit(ctx, &p.out, TYPE_QUALIFIER_NONE); - } - _parse_parameter_qualifier(ctx, &p); - if (_parse_precision(ctx, &p)) { - _emit(ctx, &p.out, PRECISION_DEFAULT); - } - if (_parse_parameter_declarator(ctx, &p) == 0) { - *ps = p; - return 0; - } - if (_parse_parameter_type_specifier(ctx, &p) == 0) { - *ps = p; - return 0; - } - - return -1; -} - - -static int -_parse_function_header_with_parameters(struct parse_context *ctx, - struct parse_state *ps) -{ - struct parse_state p = *ps; - - if (_parse_function_header(ctx, &p)) { - return -1; - } - if (_parse_parameter_declaration(ctx, &p)) { - return -1; - } - - for (;;) { - *ps = p; - if (_parse_token(ctx, SL_PP_COMMA, &p)) { - return 0; - } - if (_parse_parameter_declaration(ctx, &p)) { - return 0; - } - } -} - - -static int -_parse_function_declarator(struct parse_context *ctx, - struct parse_state *ps) -{ - if (_parse_function_header_with_parameters(ctx, ps) == 0) { - return 0; - } - - if (_parse_function_header(ctx, ps) == 0) { - return 0; - } - - return -1; -} - - -static int -_parse_function_prototype(struct parse_context *ctx, - struct parse_state *ps) -{ - struct parse_state p = *ps; - - if (_parse_function_header(ctx, &p) == 0) { - if (_parse_id(ctx, ctx->dict._void, &p) == 0) { - if (_parse_token(ctx, SL_PP_RPAREN, &p) == 0) { - _emit(ctx, &p.out, PARAMETER_NONE); - *ps = p; - return 0; - } - _error(ctx, "expected `)'"); - return -1; - } - } - - p = *ps; - if (_parse_function_declarator(ctx, &p) == 0) { - if (_parse_token(ctx, SL_PP_RPAREN, &p) == 0) { - _emit(ctx, &p.out, PARAMETER_NONE); - *ps = p; - return 0; - } - _error(ctx, "expected `)'"); - return -1; - } - - return -1; -} - - -static int -_parse_precision(struct parse_context *ctx, - struct parse_state *ps) -{ - const struct sl_pp_token_info *input = _fetch_token(ctx, ps->in); - int id; - unsigned int precision; - - if (!input || input->token != SL_PP_IDENTIFIER) { - return -1; - } - id = input->data.identifier; - - if (id == ctx->dict.lowp) { - precision = PRECISION_LOW; - } else if (id == ctx->dict.mediump) { - precision = PRECISION_MEDIUM; - } else if (id == ctx->dict.highp) { - precision = PRECISION_HIGH; - } else { - return -1; - } - - _parse_token(ctx, SL_PP_IDENTIFIER, ps); - _emit(ctx, &ps->out, precision); - return 0; -} - - -static int -_parse_prectype(struct parse_context *ctx, - struct parse_state *ps) -{ - const struct sl_pp_token_info *input = _fetch_token(ctx, ps->in); - int id; - unsigned int type; - - if (!input || input->token != SL_PP_IDENTIFIER) { - return -1; - } - id = input->data.identifier; - - if (id == ctx->dict._int) { - type = TYPE_SPECIFIER_INT; - } else if (id == ctx->dict._float) { - type = TYPE_SPECIFIER_FLOAT; - } else if (id == ctx->dict.sampler1D) { - type = TYPE_SPECIFIER_SAMPLER1D; - } else if (id == ctx->dict.sampler2D) { - type = TYPE_SPECIFIER_SAMPLER2D; - } else if (id == ctx->dict.sampler3D) { - type = TYPE_SPECIFIER_SAMPLER3D; - } else if (id == ctx->dict.samplerCube) { - type = TYPE_SPECIFIER_SAMPLERCUBE; - } else if (id == ctx->dict.sampler1DShadow) { - type = TYPE_SPECIFIER_SAMPLER1DSHADOW; - } else if (id == ctx->dict.sampler2DShadow) { - type = TYPE_SPECIFIER_SAMPLER2DSHADOW; - } else if (id == ctx->dict.sampler2DRect) { - if (!ctx->texture_rectangle) { - _error(ctx, "GL_ARB_texture_rectangle extension must be enabled " - "in order to use a rect sampler"); - return -1; - } - type = TYPE_SPECIFIER_SAMPLER2DRECT; - } else if (id == ctx->dict.sampler2DRectShadow) { - if (!ctx->texture_rectangle) { - _error(ctx, "GL_ARB_texture_rectangle extension must be enabled " - "in order to use a rect sampler"); - return -1; - } - type = TYPE_SPECIFIER_SAMPLER2DRECTSHADOW; - } else if (id == ctx->dict.sampler1DArray) { - type = TYPE_SPECIFIER_SAMPLER_1D_ARRAY; - } else if (id == ctx->dict.sampler2DArray) { - type = TYPE_SPECIFIER_SAMPLER_2D_ARRAY; - } else if (id == ctx->dict.sampler1DArrayShadow) { - type = TYPE_SPECIFIER_SAMPLER_1D_ARRAY_SHADOW; - } else if (id == ctx->dict.sampler2DArrayShadow) { - type = TYPE_SPECIFIER_SAMPLER_2D_ARRAY_SHADOW; - } else { - return -1; - } - - _parse_token(ctx, SL_PP_IDENTIFIER, ps); - _emit(ctx, &ps->out, type); - return 0; -} - - -static int -_parse_precision_stmt(struct parse_context *ctx, - struct parse_state *ps) -{ - struct parse_state p = *ps; - - if (_parse_id(ctx, ctx->dict.precision, &p)) { - return -1; - } - if (_parse_precision(ctx, &p)) { - return -1; - } - if (_parse_prectype(ctx, &p)) { - return -1; - } - if (_parse_token(ctx, SL_PP_SEMICOLON, &p)) { - return -1; - } - *ps = p; - return 0; -} - - -static int -_parse_floatconstant(struct parse_context *ctx, - struct parse_state *ps) -{ - struct parse_state p = *ps; - - _emit(ctx, &p.out, OP_PUSH_FLOAT); - if (_parse_float(ctx, &p)) { - return -1; - } - *ps = p; - return 0; -} - - -static int -_parse_intconstant(struct parse_context *ctx, - struct parse_state *ps) -{ - struct parse_state p = *ps; - - _emit(ctx, &p.out, OP_PUSH_INT); - if (_parse_uint(ctx, &p)) { - return -1; - } - *ps = p; - return 0; -} - - -static int -_parse_boolconstant(struct parse_context *ctx, - struct parse_state *ps) -{ - if (_parse_id(ctx, ctx->dict._false, ps) == 0) { - _emit(ctx, &ps->out, OP_PUSH_BOOL); - _emit(ctx, &ps->out, 2); /* radix */ - _emit(ctx, &ps->out, '0'); - _emit(ctx, &ps->out, '\0'); - return 0; - } - - if (_parse_id(ctx, ctx->dict._true, ps) == 0) { - _emit(ctx, &ps->out, OP_PUSH_BOOL); - _emit(ctx, &ps->out, 2); /* radix */ - _emit(ctx, &ps->out, '1'); - _emit(ctx, &ps->out, '\0'); - return 0; - } - - return -1; -} - - -static int -_parse_variable_identifier(struct parse_context *ctx, - struct parse_state *ps) -{ - struct parse_state p = *ps; - - _emit(ctx, &p.out, OP_PUSH_IDENTIFIER); - if (_parse_identifier(ctx, &p)) { - return -1; - } - *ps = p; - return 0; -} - - -static int -_parse_primary_expression(struct parse_context *ctx, - struct parse_state *ps) -{ - struct parse_state p; - - if (_parse_floatconstant(ctx, ps) == 0) { - return 0; - } - if (_parse_boolconstant(ctx, ps) == 0) { - return 0; - } - if (_parse_intconstant(ctx, ps) == 0) { - return 0; - } - if (_parse_variable_identifier(ctx, ps) == 0) { - return 0; - } - - p = *ps; - if (_parse_token(ctx, SL_PP_LPAREN, &p)) { - return -1; - } - if (_parse_expression(ctx, &p)) { - return -1; - } - if (_parse_token(ctx, SL_PP_RPAREN, &p)) { - return -1; - } - - *ps = p; - return 0; -} - - -static int -_parse_asm_argument(struct parse_context *ctx, - struct parse_state *ps) -{ - if (_parse_variable_identifier(ctx, ps) == 0) { - struct parse_state p = *ps; - - if (_parse_token(ctx, SL_PP_DOT, &p)) { - return 0; - } - _emit(ctx, &p.out, OP_FIELD); - if (_parse_identifier(ctx, &p)) { - return 0; - } - *ps = p; - return 0; - } - - if (_parse_floatconstant(ctx, ps) == 0) { - return 0; - } - - return -1; -} - - -static int -_parse_asm_arguments(struct parse_context *ctx, - struct parse_state *ps) -{ - struct parse_state p = *ps; - - if (_parse_asm_argument(ctx, &p)) { - return -1; - } - _emit(ctx, &p.out, OP_END); - - for (;;) { - *ps = p; - if (_parse_token(ctx, SL_PP_COMMA, &p)) { - return 0; - } - if (_parse_asm_argument(ctx, &p)) { - return 0; - } - _emit(ctx, &p.out, OP_END); - } -} - - -static int -_parse_asm_statement(struct parse_context *ctx, - struct parse_state *ps) -{ - struct parse_state p = *ps; - - if (_parse_id(ctx, ctx->dict.___asm, &p)) { - return -1; - } - if (_parse_identifier(ctx, &p)) { - return -1; - } - /* optional arguments */ - _parse_asm_arguments(ctx, &p); - if (_parse_token(ctx, SL_PP_SEMICOLON, &p)) { - return -1; - } - _emit(ctx, &p.out, OP_END); - *ps = p; - return 0; -} - - -static int -_parse_selection_statement(struct parse_context *ctx, - struct parse_state *ps) -{ - struct parse_state p = *ps; - - _emit(ctx, &p.out, OP_IF); - if (_parse_id(ctx, ctx->dict._if, &p)) { - return -1; - } - if (_parse_token(ctx, SL_PP_LPAREN, &p)) { - _error(ctx, "expected `('"); - return -1; - } - if (_parse_expression(ctx, &p)) { - _error(ctx, "expected an expression"); - return -1; - } - if (_parse_token(ctx, SL_PP_RPAREN, &p)) { - _error(ctx, "expected `)'"); - return -1; - } - _emit(ctx, &p.out, OP_END); - if (_parse_statement(ctx, &p)) { - return -1; - } - - *ps = p; - if (_parse_id(ctx, ctx->dict._else, &p) == 0) { - if (_parse_statement(ctx, &p) == 0) { - *ps = p; - return 0; - } - } - - _emit(ctx, &ps->out, OP_EXPRESSION); - _emit(ctx, &ps->out, OP_PUSH_VOID); - _emit(ctx, &ps->out, OP_END); - return 0; -} - - -static int -_parse_expression_statement(struct parse_context *ctx, - struct parse_state *ps) -{ - struct parse_state p = *ps; - - if (_parse_expression(ctx, &p)) { - _emit(ctx, &p.out, OP_PUSH_VOID); - } - if (_parse_token(ctx, SL_PP_SEMICOLON, &p)) { - return -1; - } - _emit(ctx, &p.out, OP_END); - *ps = p; - return 0; -} - - -static int -_parse_for_init_statement(struct parse_context *ctx, - struct parse_state *ps) -{ - struct parse_state p = *ps; - unsigned int e = _emit(ctx, &p.out, OP_EXPRESSION); - - if (_parse_expression_statement(ctx, &p) == 0) { - *ps = p; - return 0; - } - - if (_parse_declaration(ctx, &p) == 0) { - _update(ctx, e, OP_DECLARE); - *ps = p; - return 0; - } - - return -1; -} - - -static int -_parse_initializer(struct parse_context *ctx, - struct parse_state *ps) -{ - if (_parse_assignment_expression(ctx, ps) == 0) { - _emit(ctx, &ps->out, OP_END); - return 0; - } - return -1; -} - - -static int -_parse_condition_initializer(struct parse_context *ctx, - struct parse_state *ps) -{ - struct parse_state p = *ps; - - _emit(ctx, &p.out, OP_DECLARE); - _emit(ctx, &p.out, DECLARATION_INIT_DECLARATOR_LIST); - if (_parse_fully_specified_type(ctx, &p)) { - return -1; - } - _emit(ctx, &p.out, VARIABLE_IDENTIFIER); - if (_parse_identifier(ctx, &p)) { - return -1; - } - if (_parse_token(ctx, SL_PP_ASSIGN, &p)) { - _error(ctx, "expected `='"); - return -1; - } - _emit(ctx, &p.out, VARIABLE_INITIALIZER); - if (_parse_initializer(ctx, &p)) { - _error(ctx, "expected an initialiser"); - return -1; - } - _emit(ctx, &p.out, DECLARATOR_NONE); - *ps = p; - return 0; -} - - -static int -_parse_condition(struct parse_context *ctx, - struct parse_state *ps) -{ - struct parse_state p; - - if (_parse_condition_initializer(ctx, ps) == 0) { - return 0; - } - - p = *ps; - _emit(ctx, &p.out, OP_EXPRESSION); - if (_parse_expression(ctx, &p) == 0) { - _emit(ctx, &p.out, OP_END); - *ps = p; - return 0; - } - - return -1; -} - - -static int -_parse_for_rest_statement(struct parse_context *ctx, - struct parse_state *ps) -{ - struct parse_state p = *ps; - - if (_parse_condition(ctx, &p)) { - _emit(ctx, &p.out, OP_EXPRESSION); - _emit(ctx, &p.out, OP_PUSH_BOOL); - _emit(ctx, &p.out, 2); - _emit(ctx, &p.out, '1'); - _emit(ctx, &p.out, '\0'); - _emit(ctx, &p.out, OP_END); - } - if (_parse_token(ctx, SL_PP_SEMICOLON, &p)) { - return -1; - } - if (_parse_expression(ctx, &p)) { - _emit(ctx, &p.out, OP_PUSH_VOID); - } - _emit(ctx, &p.out, OP_END); - *ps = p; - return 0; -} - - -static int -_parse_iteration_statement(struct parse_context *ctx, - struct parse_state *ps) -{ - struct parse_state p = *ps; - - if (_parse_id(ctx, ctx->dict._while, &p) == 0) { - _emit(ctx, &p.out, OP_WHILE); - if (_parse_token(ctx, SL_PP_LPAREN, &p)) { - _error(ctx, "expected `('"); - return -1; - } - if (_parse_condition(ctx, &p)) { - _error(ctx, "expected an expression"); - return -1; - } - if (_parse_token(ctx, SL_PP_RPAREN, &p)) { - _error(ctx, "expected `)'"); - return -1; - } - if (_parse_statement(ctx, &p)) { - return -1; - } - *ps = p; - return 0; - } - - if (_parse_id(ctx, ctx->dict._do, &p) == 0) { - _emit(ctx, &p.out, OP_DO); - if (_parse_statement(ctx, &p)) { - return -1; - } - if (_parse_id(ctx, ctx->dict._while, &p)) { - return -1; - } - if (_parse_token(ctx, SL_PP_LPAREN, &p)) { - _error(ctx, "expected `('"); - return -1; - } - if (_parse_expression(ctx, &p)) { - _error(ctx, "expected an expression"); - return -1; - } - if (_parse_token(ctx, SL_PP_RPAREN, &p)) { - _error(ctx, "expected `)'"); - return -1; - } - _emit(ctx, &p.out, OP_END); - if (_parse_token(ctx, SL_PP_SEMICOLON, &p)) { - _error(ctx, "expected `;'"); - return -1; - } - *ps = p; - return 0; - } - - if (_parse_id(ctx, ctx->dict._for, &p) == 0) { - _emit(ctx, &p.out, OP_FOR); - if (_parse_token(ctx, SL_PP_LPAREN, &p)) { - _error(ctx, "expected `('"); - return -1; - } - if (_parse_for_init_statement(ctx, &p)) { - return -1; - } - if (_parse_for_rest_statement(ctx, &p)) { - return -1; - } - if (_parse_token(ctx, SL_PP_RPAREN, &p)) { - _error(ctx, "expected `)'"); - return -1; - } - if (_parse_statement(ctx, &p)) { - return -1; - } - *ps = p; - return 0; - } - - return -1; -} - - -static int -_parse_jump_statement(struct parse_context *ctx, - struct parse_state *ps) -{ - struct parse_state p = *ps; - unsigned int e = _emit(ctx, &p.out, 0); - - if (_parse_id(ctx, ctx->dict._continue, &p) == 0) { - _update(ctx, e, OP_CONTINUE); - } else if (_parse_id(ctx, ctx->dict._break, &p) == 0) { - _update(ctx, e, OP_BREAK); - } else if (_parse_id(ctx, ctx->dict._return, &p) == 0) { - _update(ctx, e, OP_RETURN); - if (_parse_expression(ctx, &p)) { - _emit(ctx, &p.out, OP_PUSH_VOID); - } - _emit(ctx, &p.out, OP_END); - } else if (ctx->shader_type == 1 && _parse_id(ctx, ctx->dict.discard, &p) == 0) { - _update(ctx, e, OP_DISCARD); - } else { - return -1; - } - if (_parse_token(ctx, SL_PP_SEMICOLON, &p)) { - return -1; - } - *ps = p; - return 0; -} - - -static int -_parse_simple_statement(struct parse_context *ctx, - struct parse_state *ps) -{ - struct parse_state p; - unsigned int e; - - if (_parse_selection_statement(ctx, ps) == 0) { - return 0; - } - - if (_parse_iteration_statement(ctx, ps) == 0) { - return 0; - } - - if (_parse_jump_statement(ctx, ps) == 0) { - return 0; - } - - p = *ps; - e = _emit(ctx, &p.out, OP_EXPRESSION); - if (_parse_expression_statement(ctx, &p) == 0) { - *ps = p; - return 0; - } - - if (_parse_precision_stmt(ctx, &p) == 0) { - _update(ctx, e, OP_PRECISION); - *ps = p; - return 0; - } - - if (ctx->parsing_builtin && _parse_asm_statement(ctx, &p) == 0) { - _update(ctx, e, OP_ASM); - *ps = p; - return 0; - } - - if (_parse_declaration(ctx, &p) == 0) { - _update(ctx, e, OP_DECLARE); - *ps = p; - return 0; - } - - return -1; -} - - -static int -_parse_compound_statement(struct parse_context *ctx, - struct parse_state *ps) -{ - struct parse_state p = *ps; - - if (_parse_token(ctx, SL_PP_LBRACE, &p)) { - return -1; - } - _emit(ctx, &p.out, OP_BLOCK_BEGIN_NEW_SCOPE); - _parse_statement_list(ctx, &p); - if (_parse_token(ctx, SL_PP_RBRACE, &p)) { - return -1; - } - _emit(ctx, &p.out, OP_END); - *ps = p; - return 0; -} - - -static int -_parse_statement(struct parse_context *ctx, - struct parse_state *ps) -{ - if (_parse_compound_statement(ctx, ps) == 0) { - return 0; - } - - if (_parse_simple_statement(ctx, ps) == 0) { - return 0; - } - - return -1; -} - - -static int -_parse_statement_list(struct parse_context *ctx, - struct parse_state *ps) -{ - struct parse_state p = *ps; - - if (_parse_statement(ctx, &p)) { - return -1; - } - - for (;;) { - *ps = p; - if (_parse_statement(ctx, &p)) { - return 0; - } - } -} - - -static int -_parse_compound_statement_no_new_scope(struct parse_context *ctx, - struct parse_state *ps) -{ - struct parse_state p = *ps; - - if (_parse_token(ctx, SL_PP_LBRACE, &p)) { - return -1; - } - _emit(ctx, &p.out, OP_BLOCK_BEGIN_NO_NEW_SCOPE); - _parse_statement_list(ctx, &p); - if (_parse_token(ctx, SL_PP_RBRACE, &p)) { - return -1; - } - _emit(ctx, &p.out, OP_END); - *ps = p; - return 0; -} - - -static int -_parse_function_definition(struct parse_context *ctx, - struct parse_state *ps) -{ - struct parse_state p = *ps; - - if (_parse_function_prototype(ctx, &p)) { - return -1; - } - if (_parse_compound_statement_no_new_scope(ctx, &p)) { - return -1; - } - *ps = p; - return 0; -} - - -static int -_parse_invariant_stmt(struct parse_context *ctx, - struct parse_state *ps) -{ - struct parse_state p = *ps; - - if (_parse_id(ctx, ctx->dict.invariant, &p)) { - return -1; - } - if (_parse_identifier(ctx, &p)) { - return -1; - } - if (_parse_token(ctx, SL_PP_SEMICOLON, &p)) { - return -1; - } - *ps = p; - return 0; -} - - -static int -_parse_single_declaration(struct parse_context *ctx, - struct parse_state *ps) -{ - struct parse_state p = *ps; - unsigned int e; - - if (_parse_fully_specified_type(ctx, &p)) { - return -1; - } - - e = _emit(ctx, &p.out, VARIABLE_IDENTIFIER); - if (_parse_identifier(ctx, &p)) { - _update(ctx, e, VARIABLE_NONE); - *ps = p; - return 0; - } - - e = _emit(ctx, &p.out, VARIABLE_NONE); - *ps = p; - - if (_parse_token(ctx, SL_PP_ASSIGN, &p) == 0) { - _update(ctx, e, VARIABLE_INITIALIZER); - if (_parse_initializer(ctx, &p) == 0) { - *ps = p; - return 0; - } - _error(ctx, "expected an initialiser"); - return -1; - } - p = *ps; - - if (_parse_token(ctx, SL_PP_LBRACKET, &p) == 0) { - if (_parse_constant_expression(ctx, &p)) { - _update(ctx, e, VARIABLE_ARRAY_UNKNOWN); - } else { - _update(ctx, e, VARIABLE_ARRAY_EXPLICIT); - } - if (_parse_token(ctx, SL_PP_RBRACKET, &p) == 0) { - *ps = p; - return 0; - } - _error(ctx, "expected `]'"); - return -1; - } - return 0; -} - - -static int -_parse_init_declarator_list(struct parse_context *ctx, - struct parse_state *ps) -{ - struct parse_state p = *ps; - - if (_parse_single_declaration(ctx, &p)) { - return -1; - } - - for (;;) { - unsigned int e; - - *ps = p; - if (_parse_token(ctx, SL_PP_COMMA, &p)) { - break; - } - _emit(ctx, &p.out, DECLARATOR_NEXT); - _emit(ctx, &p.out, VARIABLE_IDENTIFIER); - if (_parse_identifier(ctx, &p)) { - break; - } - - e = _emit(ctx, &p.out, VARIABLE_NONE); - *ps = p; - - if (_parse_token(ctx, SL_PP_ASSIGN, &p) == 0) { - if (_parse_initializer(ctx, &p) == 0) { - _update(ctx, e, VARIABLE_INITIALIZER); - *ps = p; - continue; - } - _error(ctx, "expected an initialiser"); - break; - } - p = *ps; - - if (_parse_token(ctx, SL_PP_LBRACKET, &p) == 0) { - unsigned int arr; - - if (_parse_constant_expression(ctx, &p)) { - arr = VARIABLE_ARRAY_UNKNOWN; - } else { - arr = VARIABLE_ARRAY_EXPLICIT; - } - if (_parse_token(ctx, SL_PP_RBRACKET, &p) == 0) { - _update(ctx, e, arr); - *ps = p; - continue; - } - _error(ctx, "expected `]'"); - break; - } - p = *ps; - } - - _emit(ctx, &ps->out, DECLARATOR_NONE); - return 0; -} - - -static int -_parse_declaration(struct parse_context *ctx, - struct parse_state *ps) -{ - struct parse_state p = *ps; - unsigned int e = _emit(ctx, &p.out, DECLARATION_FUNCTION_PROTOTYPE); - - if (_parse_function_prototype(ctx, &p)) { - if (_parse_init_declarator_list(ctx, &p)) { - return -1; - } - _update(ctx, e, DECLARATION_INIT_DECLARATOR_LIST); - } - if (_parse_token(ctx, SL_PP_SEMICOLON, &p)) { - _error(ctx, "expected `;'"); - return -1; - } - *ps = p; - return 0; -} - - -static int -_parse_external_declaration(struct parse_context *ctx, - struct parse_state *ps) -{ - struct parse_state p = *ps; - unsigned int e = _emit(ctx, &p.out, 0); - - if (_parse_precision_stmt(ctx, &p) == 0) { - _update(ctx, e, DEFAULT_PRECISION); - *ps = p; - return 0; - } - - if (_parse_function_definition(ctx, &p) == 0) { - _update(ctx, e, EXTERNAL_FUNCTION_DEFINITION); - *ps = p; - return 0; - } - - if (_parse_invariant_stmt(ctx, &p) == 0) { - _update(ctx, e, INVARIANT_STMT); - *ps = p; - return 0; - } - - if (_parse_declaration(ctx, &p) == 0) { - _update(ctx, e, EXTERNAL_DECLARATION); - *ps = p; - return 0; - } - - _error(ctx, "expected an identifier"); - return -1; -} - - -static int -_parse_extensions(struct parse_context *ctx, - struct parse_state *ps) -{ - for (;;) { - const struct sl_pp_token_info *input = _fetch_token(ctx, ps->in); - unsigned int enable; - - if (!input) { - return -1; - } - - switch (input->token) { - case SL_PP_EXTENSION_REQUIRE: - case SL_PP_EXTENSION_ENABLE: - case SL_PP_EXTENSION_WARN: - enable = 1; - break; - case SL_PP_EXTENSION_DISABLE: - enable = 0; - break; - default: - return 0; - } - - ps->in++; - if (input->data.extension == ctx->dict.all) { - ctx->fragment_coord_conventions = enable; - } - else if (input->data.extension == ctx->dict._GL_ARB_fragment_coord_conventions) { - ctx->fragment_coord_conventions = enable; - } - else if (input->data.extension == ctx->dict._GL_ARB_texture_rectangle) { - ctx->texture_rectangle = enable; - } - } -} - - -static int -_parse_translation_unit(struct parse_context *ctx, - struct parse_state *ps) -{ - _emit(ctx, &ps->out, REVISION); - if (_parse_extensions(ctx, ps)) { - return -1; - } - if (_parse_external_declaration(ctx, ps)) { - return -1; - } - for (;;) { - if (_parse_extensions(ctx, ps)) { - return -1; - } - if (_parse_external_declaration(ctx, ps)) { - break; - } - } - _emit(ctx, &ps->out, EXTERNAL_NULL); - if (_parse_token(ctx, SL_PP_EOF, ps)) { - return -1; - } - return 0; -} - - -#define ADD_NAME_STR(CTX, NAME, STR)\ - do {\ - (CTX).dict.NAME = sl_pp_context_add_unique_str((CTX).context, (STR));\ - if ((CTX).dict.NAME == -1) {\ - return -1;\ - }\ - } while (0) - -#define ADD_NAME(CTX, NAME) ADD_NAME_STR(CTX, NAME, #NAME) - - -int -sl_cl_compile(struct sl_pp_context *context, - unsigned int shader_type, - unsigned int parsing_builtin, - unsigned char **output, - unsigned int *cboutput, - char *error, - unsigned int cberror) -{ - struct parse_context ctx; - struct parse_state ps; - - ctx.context = context; - - ADD_NAME_STR(ctx, _void, "void"); - ADD_NAME_STR(ctx, _float, "float"); - ADD_NAME_STR(ctx, _int, "int"); - ADD_NAME_STR(ctx, _bool, "bool"); - ADD_NAME(ctx, vec2); - ADD_NAME(ctx, vec3); - ADD_NAME(ctx, vec4); - ADD_NAME(ctx, bvec2); - ADD_NAME(ctx, bvec3); - ADD_NAME(ctx, bvec4); - ADD_NAME(ctx, ivec2); - ADD_NAME(ctx, ivec3); - ADD_NAME(ctx, ivec4); - ADD_NAME(ctx, mat2); - ADD_NAME(ctx, mat3); - ADD_NAME(ctx, mat4); - ADD_NAME(ctx, mat2x3); - ADD_NAME(ctx, mat3x2); - ADD_NAME(ctx, mat2x4); - ADD_NAME(ctx, mat4x2); - ADD_NAME(ctx, mat3x4); - ADD_NAME(ctx, mat4x3); - ADD_NAME(ctx, sampler1D); - ADD_NAME(ctx, sampler2D); - ADD_NAME(ctx, sampler3D); - ADD_NAME(ctx, samplerCube); - ADD_NAME(ctx, sampler1DShadow); - ADD_NAME(ctx, sampler2DShadow); - ADD_NAME(ctx, sampler2DRect); - ADD_NAME(ctx, sampler2DRectShadow); - ADD_NAME(ctx, sampler1DArray); - ADD_NAME(ctx, sampler2DArray); - ADD_NAME(ctx, sampler1DArrayShadow); - ADD_NAME(ctx, sampler2DArrayShadow); - - ADD_NAME(ctx, invariant); - - ADD_NAME(ctx, centroid); - - ADD_NAME(ctx, precision); - ADD_NAME(ctx, lowp); - ADD_NAME(ctx, mediump); - ADD_NAME(ctx, highp); - - ADD_NAME_STR(ctx, _const, "const"); - ADD_NAME(ctx, attribute); - ADD_NAME(ctx, varying); - ADD_NAME(ctx, uniform); - ADD_NAME(ctx, __fixed_output); - ADD_NAME(ctx, __fixed_input); - - ADD_NAME(ctx, in); - ADD_NAME(ctx, out); - ADD_NAME(ctx, inout); - - ADD_NAME(ctx, layout); - ADD_NAME(ctx, origin_upper_left); - ADD_NAME(ctx, pixel_center_integer); - - ADD_NAME_STR(ctx, _struct, "struct"); - - ADD_NAME(ctx, __constructor); - ADD_NAME(ctx, __operator); - ADD_NAME_STR(ctx, ___asm, "__asm"); - - ADD_NAME_STR(ctx, _if, "if"); - ADD_NAME_STR(ctx, _else, "else"); - ADD_NAME_STR(ctx, _for, "for"); - ADD_NAME_STR(ctx, _while, "while"); - ADD_NAME_STR(ctx, _do, "do"); - - ADD_NAME_STR(ctx, _continue, "continue"); - ADD_NAME_STR(ctx, _break, "break"); - ADD_NAME_STR(ctx, _return, "return"); - ADD_NAME(ctx, discard); - - ADD_NAME_STR(ctx, _false, "false"); - ADD_NAME_STR(ctx, _true, "true"); - - ADD_NAME(ctx, all); - ADD_NAME_STR(ctx, _GL_ARB_fragment_coord_conventions, "GL_ARB_fragment_coord_conventions"); - ADD_NAME_STR(ctx, _GL_ARB_texture_rectangle, "GL_ARB_texture_rectangle"); - - ctx.out_buf = NULL; - ctx.out_cap = 0; - - ctx.shader_type = shader_type; - ctx.parsing_builtin = 1; - - ctx.fragment_coord_conventions = 0; - ctx.texture_rectangle = 1; - - ctx.error[0] = '\0'; - ctx.process_error = 0; - - ctx.tokens_cap = 1024; - ctx.tokens_read = 0; - ctx.tokens = malloc(ctx.tokens_cap * sizeof(struct sl_pp_token_info)); - if (!ctx.tokens) { - strncpy(error, "out of memory", cberror - 1); - error[cberror - 1] = '\0'; - return -1; - } - - ps.in = 0; - ps.out = 0; - - if (_parse_translation_unit(&ctx, &ps)) { - strncpy(error, ctx.error, cberror); - free(ctx.tokens); - return -1; - } - - *output = ctx.out_buf; - *cboutput = ps.out; - free(ctx.tokens); - return 0; -} diff --git a/src/glsl/cl/sl_cl_parse.h b/src/glsl/cl/sl_cl_parse.h deleted file mode 100644 index a954d43927..0000000000 --- a/src/glsl/cl/sl_cl_parse.h +++ /dev/null @@ -1,42 +0,0 @@ -/************************************************************************** - * - * Copyright 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, 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 TUNGSTEN GRAPHICS AND/OR ITS 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. - * - **************************************************************************/ - -#ifndef SL_CL_PARSE_H -#define SL_CL_PARSE_H - -struct sl_pp_context; - -int -sl_cl_compile(struct sl_pp_context *context, - unsigned int shader_type, - unsigned int parsing_builtin, - unsigned char **output, - unsigned int *cboutput, - char *error, - unsigned int cberror); - -#endif /* SL_CL_PARSE_H */ diff --git a/src/glsl/pp/Makefile b/src/glsl/pp/Makefile deleted file mode 100644 index fda1c4202b..0000000000 --- a/src/glsl/pp/Makefile +++ /dev/null @@ -1,27 +0,0 @@ -#src/glsl/pp/Makefile - -TOP = ../../.. - -include $(TOP)/configs/current - -LIBNAME = glslpp - -C_SOURCES = \ - sl_pp_context.c \ - sl_pp_define.c \ - sl_pp_dict.c \ - sl_pp_error.c \ - sl_pp_expression.c \ - sl_pp_extension.c \ - sl_pp_if.c \ - sl_pp_line.c \ - sl_pp_macro.c \ - sl_pp_pragma.c \ - sl_pp_process.c \ - sl_pp_purify.c \ - sl_pp_token.c \ - sl_pp_token_util.c \ - sl_pp_version.c - -include ../Makefile.template - diff --git a/src/glsl/pp/sl_pp_context.c b/src/glsl/pp/sl_pp_context.c deleted file mode 100644 index b8e1e99fc8..0000000000 --- a/src/glsl/pp/sl_pp_context.c +++ /dev/null @@ -1,183 +0,0 @@ -/************************************************************************** - * - * Copyright 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, 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 TUNGSTEN GRAPHICS AND/OR ITS 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. - * - **************************************************************************/ - -#include -#include -#include "sl_pp_macro.h" -#include "sl_pp_public.h" -#include "sl_pp_context.h" - - -struct sl_pp_context * -sl_pp_context_create(const char *input, - const struct sl_pp_purify_options *options) -{ - struct sl_pp_context *context; - - context = calloc(1, sizeof(struct sl_pp_context)); - if (!context) { - return NULL; - } - - if (sl_pp_dict_init(context)) { - sl_pp_context_destroy(context); - return NULL; - } - - context->getc_buf_capacity = 64; - context->getc_buf = malloc(context->getc_buf_capacity * sizeof(char)); - if (!context->getc_buf) { - sl_pp_context_destroy(context); - return NULL; - } - - if (sl_pp_token_buffer_init(&context->tokens, context)) { - sl_pp_context_destroy(context); - return NULL; - } - - context->macro_tail = &context->macro; - context->if_ptr = SL_PP_MAX_IF_NESTING; - context->if_value = 1; - memset(context->error_msg, 0, sizeof(context->error_msg)); - context->error_line = 1; - context->line = 1; - context->file = 0; - - sl_pp_purify_state_init(&context->pure, input, options); - - memset(&context->process_state, 0, sizeof(context->process_state)); - - return context; -} - -void -sl_pp_context_destroy(struct sl_pp_context *context) -{ - if (context) { - free(context->cstr_pool); - sl_pp_macro_free(context->macro); - free(context->getc_buf); - sl_pp_token_buffer_destroy(&context->tokens); - free(context->process_state.out); - free(context); - } -} - -const char * -sl_pp_context_error_message(const struct sl_pp_context *context) -{ - return context->error_msg; -} - -void -sl_pp_context_error_position(const struct sl_pp_context *context, - unsigned int *file, - unsigned int *line) -{ - if (file) { - *file = 0; - } - if (line) { - *line = context->error_line; - } -} - -int -sl_pp_context_add_predefined(struct sl_pp_context *context, - const char *name, - const char *value) -{ - struct sl_pp_predefined pre; - - if (context->num_predefined == SL_PP_MAX_PREDEFINED) { - return -1; - } - - pre.name = sl_pp_context_add_unique_str(context, name); - if (pre.name == -1) { - return -1; - } - - pre.value = sl_pp_context_add_unique_str(context, value); - if (pre.value == -1) { - return -1; - } - - context->predefined[context->num_predefined++] = pre; - return 0; -} - -int -sl_pp_context_add_unique_str(struct sl_pp_context *context, - const char *str) -{ - unsigned int size; - unsigned int offset = 0; - - size = strlen(str) + 1; - - /* Find out if this is a unique string. */ - while (offset < context->cstr_pool_len) { - const char *str2; - unsigned int size2; - - str2 = &context->cstr_pool[offset]; - size2 = strlen(str2) + 1; - if (size == size2 && !memcmp(str, str2, size - 1)) { - return offset; - } - - offset += size2; - } - - if (context->cstr_pool_len + size > context->cstr_pool_max) { - context->cstr_pool_max = (context->cstr_pool_len + size + 0xffff) & ~0xffff; - context->cstr_pool = realloc(context->cstr_pool, context->cstr_pool_max); - } - - if (!context->cstr_pool) { - strcpy(context->error_msg, "out of memory"); - return -1; - } - - offset = context->cstr_pool_len; - memcpy(&context->cstr_pool[offset], str, size); - context->cstr_pool_len += size; - - return offset; -} - -const char * -sl_pp_context_cstr(const struct sl_pp_context *context, - int offset) -{ - if (offset == -1) { - return NULL; - } - return &context->cstr_pool[offset]; -} diff --git a/src/glsl/pp/sl_pp_context.h b/src/glsl/pp/sl_pp_context.h deleted file mode 100644 index e6244f6257..0000000000 --- a/src/glsl/pp/sl_pp_context.h +++ /dev/null @@ -1,99 +0,0 @@ -/************************************************************************** - * - * Copyright 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, 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 TUNGSTEN GRAPHICS AND/OR ITS 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. - * - **************************************************************************/ - -#ifndef SL_PP_CONTEXT_H -#define SL_PP_CONTEXT_H - -#include "sl_pp_dict.h" -#include "sl_pp_process.h" -#include "sl_pp_purify.h" -#include "sl_pp_token_util.h" - - -#define SL_PP_MAX_IF_NESTING 64 - -#define SL_PP_MAX_ERROR_MSG 1024 - -#define SL_PP_MAX_EXTENSIONS 16 - -#define SL_PP_MAX_PREDEFINED 16 - -struct sl_pp_extension { - int name; /*< GL_VENDOR_extension_name */ -}; - -struct sl_pp_predefined { - int name; - int value; -}; - -union sl_pp_if_state { - struct { - unsigned int condition:1; - unsigned int went_thru_else:1; - unsigned int had_true_cond:1; - } u; - unsigned int value; -}; - -struct sl_pp_context { - char *cstr_pool; - unsigned int cstr_pool_max; - unsigned int cstr_pool_len; - struct sl_pp_dict dict; - - struct sl_pp_macro *macro; - struct sl_pp_macro **macro_tail; - - struct sl_pp_extension extensions[SL_PP_MAX_EXTENSIONS]; - unsigned int num_extensions; - - struct sl_pp_predefined predefined[SL_PP_MAX_PREDEFINED]; - unsigned int num_predefined; - - union sl_pp_if_state if_stack[SL_PP_MAX_IF_NESTING]; - unsigned int if_ptr; - unsigned int if_value; - - char error_msg[SL_PP_MAX_ERROR_MSG]; - unsigned int error_line; - - unsigned int line; - unsigned int file; - - struct sl_pp_purify_state pure; - - char *getc_buf; - unsigned int getc_buf_size; - unsigned int getc_buf_capacity; - - struct sl_pp_token_buffer tokens; - - struct sl_pp_process_state process_state; -}; - -#endif /* SL_PP_CONTEXT_H */ diff --git a/src/glsl/pp/sl_pp_define.c b/src/glsl/pp/sl_pp_define.c deleted file mode 100644 index 370e6aa660..0000000000 --- a/src/glsl/pp/sl_pp_define.c +++ /dev/null @@ -1,240 +0,0 @@ -/************************************************************************** - * - * Copyright 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, 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 TUNGSTEN GRAPHICS AND/OR ITS 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. - * - **************************************************************************/ - -#include -#include -#include "sl_pp_context.h" -#include "sl_pp_macro.h" -#include "sl_pp_process.h" -#include "sl_pp_public.h" -#include "sl_pp_token.h" - - -static void -skip_whitespace(const struct sl_pp_token_info *input, - unsigned int *first, - unsigned int last) -{ - while (*first < last && input[*first].token == SL_PP_WHITESPACE) { - (*first)++; - } -} - - -static int -_parse_formal_args(struct sl_pp_context *context, - const struct sl_pp_token_info *input, - unsigned int *first, - unsigned int last, - struct sl_pp_macro *macro) -{ - struct sl_pp_macro_formal_arg **arg; - - macro->num_args = 0; - - skip_whitespace(input, first, last); - if (*first < last) { - if (input[*first].token == SL_PP_RPAREN) { - (*first)++; - return 0; - } - } else { - strcpy(context->error_msg, "expected either macro formal argument or `)'"); - return -1; - } - - arg = ¯o->arg; - - for (;;) { - if (*first < last && input[*first].token != SL_PP_IDENTIFIER) { - strcpy(context->error_msg, "expected macro formal argument"); - return -1; - } - - *arg = malloc(sizeof(struct sl_pp_macro_formal_arg)); - if (!*arg) { - strcpy(context->error_msg, "out of memory"); - return -1; - } - - (**arg).name = input[*first].data.identifier; - (*first)++; - - (**arg).next = NULL; - arg = &(**arg).next; - - macro->num_args++; - - skip_whitespace(input, first, last); - if (*first < last) { - if (input[*first].token == SL_PP_COMMA) { - (*first)++; - skip_whitespace(input, first, last); - } else if (input[*first].token == SL_PP_RPAREN) { - (*first)++; - return 0; - } else { - strcpy(context->error_msg, "expected either `,' or `)'"); - return -1; - } - } else { - strcpy(context->error_msg, "expected either `,' or `)'"); - return -1; - } - } - - /* Should not gete here. */ -} - - -int -sl_pp_process_define(struct sl_pp_context *context, - const struct sl_pp_token_info *input, - unsigned int first, - unsigned int last) -{ - int macro_name = -1; - struct sl_pp_macro *macro; - unsigned int i; - unsigned int body_len; - unsigned int j; - - if (first < last && input[first].token == SL_PP_IDENTIFIER) { - macro_name = input[first].data.identifier; - first++; - } - if (macro_name == -1) { - strcpy(context->error_msg, "expected macro name"); - return -1; - } - - /* Check for reserved macro names */ - { - const char *name = sl_pp_context_cstr(context, macro_name); - - if (strstr(name, "__")) { - strcpy(context->error_msg, "macro names containing `__' are reserved"); - return 1; - } - if (name[0] == 'G' && name[1] == 'L' && name[2] == '_') { - strcpy(context->error_msg, "macro names prefixed with `GL_' are reserved"); - return 1; - } - } - - for (macro = context->macro; macro; macro = macro->next) { - if (macro->name == macro_name) { - break; - } - } - - if (!macro) { - macro = sl_pp_macro_new(); - if (!macro) { - strcpy(context->error_msg, "out of memory"); - return -1; - } - - *context->macro_tail = macro; - context->macro_tail = ¯o->next; - } else { - sl_pp_macro_reset(macro); - } - - macro->name = macro_name; - - /* - * If there is no whitespace between macro name and left paren, a macro - * formal argument list follows. This is the only place where the presence - * of a whitespace matters and it's the only reason why we are dealing - * with whitespace at this level. - */ - if (first < last && input[first].token == SL_PP_LPAREN) { - first++; - if (_parse_formal_args(context, input, &first, last, macro)) { - return -1; - } - } - - /* Calculate body size, trim out whitespace, make room for EOF. */ - body_len = 1; - for (i = first; i < last; i++) { - if (input[i].token != SL_PP_WHITESPACE) { - body_len++; - } - } - - macro->body = malloc(sizeof(struct sl_pp_token_info) * body_len); - if (!macro->body) { - strcpy(context->error_msg, "out of memory"); - return -1; - } - - for (j = 0, i = first; i < last; i++) { - if (input[i].token != SL_PP_WHITESPACE) { - macro->body[j++] = input[i]; - } - } - macro->body[j++].token = SL_PP_EOF; - - return 0; -} - - -int -sl_pp_process_undef(struct sl_pp_context *context, - const struct sl_pp_token_info *input, - unsigned int first, - unsigned int last) -{ - int macro_name = -1; - struct sl_pp_macro **pmacro; - struct sl_pp_macro *macro; - - if (first < last && input[first].token == SL_PP_IDENTIFIER) { - macro_name = input[first].data.identifier; - } - if (macro_name == -1) { - return 0; - } - - for (pmacro = &context->macro; *pmacro; pmacro = &(**pmacro).next) { - if ((**pmacro).name == macro_name) { - break; - } - } - if (!*pmacro) { - return 0; - } - - macro = *pmacro; - *pmacro = macro->next; - macro->next = NULL; - sl_pp_macro_free(macro); - - return 0; -} diff --git a/src/glsl/pp/sl_pp_dict.c b/src/glsl/pp/sl_pp_dict.c deleted file mode 100644 index 062139e6ac..0000000000 --- a/src/glsl/pp/sl_pp_dict.c +++ /dev/null @@ -1,85 +0,0 @@ -/************************************************************************** - * - * Copyright 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, 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 TUNGSTEN GRAPHICS AND/OR ITS 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. - * - **************************************************************************/ - -#include "sl_pp_public.h" -#include "sl_pp_context.h" -#include "sl_pp_dict.h" - - -#define ADD_NAME_STR(CTX, NAME, STR)\ - do {\ - (CTX)->dict.NAME = sl_pp_context_add_unique_str((CTX), (STR));\ - if ((CTX)->dict.NAME == -1) {\ - return -1;\ - }\ - } while (0) - -#define ADD_NAME(CTX, NAME) ADD_NAME_STR(CTX, NAME, #NAME) - - -int -sl_pp_dict_init(struct sl_pp_context *context) -{ - ADD_NAME(context, all); - - ADD_NAME(context, require); - ADD_NAME(context, enable); - ADD_NAME(context, warn); - ADD_NAME(context, disable); - - ADD_NAME(context, defined); - - ADD_NAME_STR(context, ___LINE__, "__LINE__"); - ADD_NAME_STR(context, ___FILE__, "__FILE__"); - ADD_NAME_STR(context, ___VERSION__, "__VERSION__"); - - ADD_NAME(context, optimize); - ADD_NAME(context, debug); - - ADD_NAME(context, off); - ADD_NAME(context, on); - - ADD_NAME(context, define); - ADD_NAME(context, elif); - ADD_NAME_STR(context, _else, "else"); - ADD_NAME(context, endif); - ADD_NAME(context, error); - ADD_NAME(context, extension); - ADD_NAME_STR(context, _if, "if"); - ADD_NAME(context, ifdef); - ADD_NAME(context, ifndef); - ADD_NAME(context, line); - ADD_NAME(context, pragma); - ADD_NAME(context, undef); - - ADD_NAME(context, version); - - ADD_NAME_STR(context, _0, "0"); - ADD_NAME_STR(context, _1, "1"); - - return 0; -} diff --git a/src/glsl/pp/sl_pp_dict.h b/src/glsl/pp/sl_pp_dict.h deleted file mode 100644 index 875217bd30..0000000000 --- a/src/glsl/pp/sl_pp_dict.h +++ /dev/null @@ -1,77 +0,0 @@ -/************************************************************************** - * - * Copyright 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, 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 TUNGSTEN GRAPHICS AND/OR ITS 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. - * - **************************************************************************/ - -#ifndef SL_PP_DICT_H -#define SL_PP_DICT_H - - -struct sl_pp_context; - -struct sl_pp_dict { - int all; - - int require; - int enable; - int warn; - int disable; - - int defined; - - int ___LINE__; - int ___FILE__; - int ___VERSION__; - - int optimize; - int debug; - - int off; - int on; - - int define; - int elif; - int _else; - int endif; - int error; - int extension; - int _if; - int ifdef; - int ifndef; - int line; - int pragma; - int undef; - - int version; - - int _0; - int _1; -}; - - -int -sl_pp_dict_init(struct sl_pp_context *context); - -#endif /* SL_PP_DICT_H */ diff --git a/src/glsl/pp/sl_pp_error.c b/src/glsl/pp/sl_pp_error.c deleted file mode 100644 index 482b67fcaf..0000000000 --- a/src/glsl/pp/sl_pp_error.c +++ /dev/null @@ -1,271 +0,0 @@ -/************************************************************************** - * - * Copyright 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, 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 TUNGSTEN GRAPHICS AND/OR ITS 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. - * - **************************************************************************/ - -#include -#include -#include "sl_pp_context.h" -#include "sl_pp_process.h" -#include "sl_pp_public.h" -#include "sl_pp_token.h" - - -void -sl_pp_process_error(struct sl_pp_context *context, - const struct sl_pp_token_info *input, - unsigned int first, - unsigned int last) -{ - unsigned int out_len = 0; - unsigned int i; - - for (i = first; i < last; i++) { - const char *s = NULL; - char buf[2]; - - switch (input[i].token) { - case SL_PP_WHITESPACE: - s = " "; - break; - - case SL_PP_NEWLINE: - s = "\n"; - break; - - case SL_PP_HASH: - s = "#"; - break; - - case SL_PP_COMMA: - s = ","; - break; - - case SL_PP_SEMICOLON: - s = ";"; - break; - - case SL_PP_LBRACE: - s = "{"; - break; - - case SL_PP_RBRACE: - s = "}"; - break; - - case SL_PP_LPAREN: - s = "("; - break; - - case SL_PP_RPAREN: - s = ")"; - break; - - case SL_PP_LBRACKET: - s = "["; - break; - - case SL_PP_RBRACKET: - s = "]"; - break; - - case SL_PP_DOT: - s = "."; - break; - - case SL_PP_INCREMENT: - s = "++"; - break; - - case SL_PP_ADDASSIGN: - s = "+="; - break; - - case SL_PP_PLUS: - s = "+"; - break; - - case SL_PP_DECREMENT: - s = "--"; - break; - - case SL_PP_SUBASSIGN: - s = "-="; - break; - - case SL_PP_MINUS: - s = "-"; - break; - - case SL_PP_BITNOT: - s = "~"; - break; - - case SL_PP_NOTEQUAL: - s = "!="; - break; - - case SL_PP_NOT: - s = "!"; - break; - - case SL_PP_MULASSIGN: - s = "*="; - break; - - case SL_PP_STAR: - s = "*"; - break; - - case SL_PP_DIVASSIGN: - s = "/="; - break; - - case SL_PP_SLASH: - s = "/"; - break; - - case SL_PP_MODASSIGN: - s = "%="; - break; - - case SL_PP_MODULO: - s = "%"; - break; - - case SL_PP_LSHIFTASSIGN: - s = "<<="; - break; - - case SL_PP_LSHIFT: - s = "<<"; - break; - - case SL_PP_LESSEQUAL: - s = "<="; - break; - - case SL_PP_LESS: - s = "<"; - break; - - case SL_PP_RSHIFTASSIGN: - s = ">>="; - break; - - case SL_PP_RSHIFT: - s = ">>"; - break; - - case SL_PP_GREATEREQUAL: - s = ">="; - break; - - case SL_PP_GREATER: - s = ">"; - break; - - case SL_PP_EQUAL: - s = "=="; - break; - - case SL_PP_ASSIGN: - s = "="; - break; - - case SL_PP_AND: - s = "&&"; - break; - - case SL_PP_BITANDASSIGN: - s = "&="; - break; - - case SL_PP_BITAND: - s = "&"; - break; - - case SL_PP_XOR: - s = "^^"; - break; - - case SL_PP_BITXORASSIGN: - s = "^="; - break; - - case SL_PP_BITXOR: - s = "^"; - break; - - case SL_PP_OR: - s = "||"; - break; - - case SL_PP_BITORASSIGN: - s = "|="; - break; - - case SL_PP_BITOR: - s = "|"; - break; - - case SL_PP_QUESTION: - s = "?"; - break; - - case SL_PP_COLON: - s = ":"; - break; - - case SL_PP_IDENTIFIER: - s = sl_pp_context_cstr(context, input[i].data.identifier); - break; - - case SL_PP_UINT: - s = sl_pp_context_cstr(context, input[i].data._uint); - break; - - case SL_PP_FLOAT: - s = sl_pp_context_cstr(context, input[i].data._float); - break; - - case SL_PP_OTHER: - buf[0] = input[i].data.other; - buf[1] = '\0'; - s = buf; - break; - - default: - strcpy(context->error_msg, "internal error"); - return; - } - - while (*s != '\0' && out_len < sizeof(context->error_msg) - 1) { - context->error_msg[out_len++] = *s++; - } - } - - context->error_msg[out_len] = '\0'; -} diff --git a/src/glsl/pp/sl_pp_expression.c b/src/glsl/pp/sl_pp_expression.c deleted file mode 100644 index c3f48356b0..0000000000 --- a/src/glsl/pp/sl_pp_expression.c +++ /dev/null @@ -1,413 +0,0 @@ -/************************************************************************** - * - * Copyright 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, 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 TUNGSTEN GRAPHICS AND/OR ITS 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. - * - **************************************************************************/ - -#include -#include -#include "sl_pp_context.h" -#include "sl_pp_expression.h" -#include "sl_pp_public.h" -#include "sl_pp_token.h" - - -struct parse_context { - struct sl_pp_context *context; - const struct sl_pp_token_info *input; -}; - -static int -_parse_or(struct parse_context *ctx, - int *result); - -static int -_parse_primary(struct parse_context *ctx, - int *result) -{ - if (ctx->input->token == SL_PP_UINT) { - *result = atoi(sl_pp_context_cstr(ctx->context, ctx->input->data._uint)); - ctx->input++; - } else { - if (ctx->input->token != SL_PP_LPAREN) { - strcpy(ctx->context->error_msg, "expected `('"); - return -1; - } - ctx->input++; - if (_parse_or(ctx, result)) { - return -1; - } - if (ctx->input->token != SL_PP_RPAREN) { - strcpy(ctx->context->error_msg, "expected `)'"); - return -1; - } - ctx->input++; - } - return 0; -} - -static int -_parse_unary(struct parse_context *ctx, - int *result) -{ - if (!_parse_primary(ctx, result)) { - return 0; - } - - switch (ctx->input->token) { - case SL_PP_PLUS: - ctx->input++; - if (_parse_unary(ctx, result)) { - return -1; - } - *result = +*result; - break; - - case SL_PP_MINUS: - ctx->input++; - if (_parse_unary(ctx, result)) { - return -1; - } - *result = -*result; - break; - - case SL_PP_NOT: - ctx->input++; - if (_parse_unary(ctx, result)) { - return -1; - } - *result = !*result; - break; - - case SL_PP_BITNOT: - ctx->input++; - if (_parse_unary(ctx, result)) { - return -1; - } - *result = ~*result; - break; - - default: - return -1; - } - - return 0; -} - -static int -_parse_multiplicative(struct parse_context *ctx, - int *result) -{ - if (_parse_unary(ctx, result)) { - return -1; - } - for (;;) { - int right; - - switch (ctx->input->token) { - case SL_PP_STAR: - ctx->input++; - if (_parse_unary(ctx, &right)) { - return -1; - } - *result = *result * right; - break; - - case SL_PP_SLASH: - ctx->input++; - if (_parse_unary(ctx, &right)) { - return -1; - } - *result = *result / right; - break; - - case SL_PP_MODULO: - ctx->input++; - if (_parse_unary(ctx, &right)) { - return -1; - } - *result = *result % right; - break; - - default: - return 0; - } - } -} - -static int -_parse_additive(struct parse_context *ctx, - int *result) -{ - if (_parse_multiplicative(ctx, result)) { - return -1; - } - for (;;) { - int right; - - switch (ctx->input->token) { - case SL_PP_PLUS: - ctx->input++; - if (_parse_multiplicative(ctx, &right)) { - return -1; - } - *result = *result + right; - break; - - case SL_PP_MINUS: - ctx->input++; - if (_parse_multiplicative(ctx, &right)) { - return -1; - } - *result = *result - right; - break; - - default: - return 0; - } - } -} - -static int -_parse_shift(struct parse_context *ctx, - int *result) -{ - if (_parse_additive(ctx, result)) { - return -1; - } - for (;;) { - int right; - - switch (ctx->input->token) { - case SL_PP_LSHIFT: - ctx->input++; - if (_parse_additive(ctx, &right)) { - return -1; - } - *result = *result << right; - break; - - case SL_PP_RSHIFT: - ctx->input++; - if (_parse_additive(ctx, &right)) { - return -1; - } - *result = *result >> right; - break; - - default: - return 0; - } - } -} - -static int -_parse_relational(struct parse_context *ctx, - int *result) -{ - if (_parse_shift(ctx, result)) { - return -1; - } - for (;;) { - int right; - - switch (ctx->input->token) { - case SL_PP_LESSEQUAL: - ctx->input++; - if (_parse_shift(ctx, &right)) { - return -1; - } - *result = *result <= right; - break; - - case SL_PP_GREATEREQUAL: - ctx->input++; - if (_parse_shift(ctx, &right)) { - return -1; - } - *result = *result >= right; - break; - - case SL_PP_LESS: - ctx->input++; - if (_parse_shift(ctx, &right)) { - return -1; - } - *result = *result < right; - break; - - case SL_PP_GREATER: - ctx->input++; - if (_parse_shift(ctx, &right)) { - return -1; - } - *result = *result > right; - break; - - default: - return 0; - } - } -} - -static int -_parse_equality(struct parse_context *ctx, - int *result) -{ - if (_parse_relational(ctx, result)) { - return -1; - } - for (;;) { - int right; - - switch (ctx->input->token) { - case SL_PP_EQUAL: - ctx->input++; - if (_parse_relational(ctx, &right)) { - return -1; - } - *result = *result == right; - break; - - case SL_PP_NOTEQUAL: - ctx->input++; - if (_parse_relational(ctx, &right)) { - return -1; - } - *result = *result != right; - break; - - default: - return 0; - } - } -} - -static int -_parse_bitand(struct parse_context *ctx, - int *result) -{ - if (_parse_equality(ctx, result)) { - return -1; - } - while (ctx->input->token == SL_PP_BITAND) { - int right; - - ctx->input++; - if (_parse_equality(ctx, &right)) { - return -1; - } - *result = *result & right; - } - return 0; -} - -static int -_parse_xor(struct parse_context *ctx, - int *result) -{ - if (_parse_bitand(ctx, result)) { - return -1; - } - while (ctx->input->token == SL_PP_XOR) { - int right; - - ctx->input++; - if (_parse_bitand(ctx, &right)) { - return -1; - } - *result = *result ^ right; - } - return 0; -} - -static int -_parse_bitor(struct parse_context *ctx, - int *result) -{ - if (_parse_xor(ctx, result)) { - return -1; - } - while (ctx->input->token == SL_PP_BITOR) { - int right; - - ctx->input++; - if (_parse_xor(ctx, &right)) { - return -1; - } - *result = *result | right; - } - return 0; -} - -static int -_parse_and(struct parse_context *ctx, - int *result) -{ - if (_parse_bitor(ctx, result)) { - return -1; - } - while (ctx->input->token == SL_PP_AND) { - int right; - - ctx->input++; - if (_parse_bitor(ctx, &right)) { - return -1; - } - *result = *result && right; - } - return 0; -} - -static int -_parse_or(struct parse_context *ctx, - int *result) -{ - if (_parse_and(ctx, result)) { - return -1; - } - while (ctx->input->token == SL_PP_OR) { - int right; - - ctx->input++; - if (_parse_and(ctx, &right)) { - return -1; - } - *result = *result || right; - } - return 0; -} - -int -sl_pp_execute_expression(struct sl_pp_context *context, - const struct sl_pp_token_info *input, - int *result) -{ - struct parse_context ctx; - - ctx.context = context; - ctx.input = input; - - return _parse_or(&ctx, result); -} diff --git a/src/glsl/pp/sl_pp_expression.h b/src/glsl/pp/sl_pp_expression.h deleted file mode 100644 index 522263bb25..0000000000 --- a/src/glsl/pp/sl_pp_expression.h +++ /dev/null @@ -1,40 +0,0 @@ -/************************************************************************** - * - * Copyright 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, 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 TUNGSTEN GRAPHICS AND/OR ITS 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. - * - **************************************************************************/ - -#ifndef SL_PP_EXPRESSION_H -#define SL_PP_EXPRESSION_H - -struct sl_pp_context; -struct sl_pp_token_info; - - -int -sl_pp_execute_expression(struct sl_pp_context *context, - const struct sl_pp_token_info *input, - int *result); - -#endif /* SL_PP_EXPRESSION_H */ diff --git a/src/glsl/pp/sl_pp_extension.c b/src/glsl/pp/sl_pp_extension.c deleted file mode 100644 index 00dbdcf22b..0000000000 --- a/src/glsl/pp/sl_pp_extension.c +++ /dev/null @@ -1,180 +0,0 @@ -/************************************************************************** - * - * Copyright 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, 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 TUNGSTEN GRAPHICS AND/OR ITS 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. - * - **************************************************************************/ - -#include -#include -#include -#include "sl_pp_context.h" -#include "sl_pp_process.h" -#include "sl_pp_public.h" -#include "sl_pp_token.h" - - -/** - * Declare an extension to the preprocessor. This tells the preprocessor - * which extensions are supported by Mesa. - * The shader still needs to have a "#extension name: behavior" line to enable - * the extension. - */ -int -sl_pp_context_add_extension(struct sl_pp_context *context, - const char *name) -{ - struct sl_pp_extension ext; - - if (context->num_extensions == SL_PP_MAX_EXTENSIONS) { - return -1; - } - - ext.name = sl_pp_context_add_unique_str(context, name); - if (ext.name == -1) { - return -1; - } - - context->extensions[context->num_extensions++] = ext; - - assert(context->num_extensions <= sizeof(context->extensions)); - - return 0; -} - - -/** - * Process a "#extension name: behavior" directive. - */ -int -sl_pp_process_extension(struct sl_pp_context *context, - const struct sl_pp_token_info *input, - unsigned int first, - unsigned int last, - struct sl_pp_process_state *state) -{ - int extension_name = -1; - int behavior = -1; - struct sl_pp_token_info out; - - /* Grab the extension name. */ - if (first < last && input[first].token == SL_PP_IDENTIFIER) { - extension_name = input[first].data.identifier; - first++; - } - if (extension_name == -1) { - strcpy(context->error_msg, "expected identifier after `#extension'"); - return -1; - } - - /* Make sure the extension is supported. */ - if (extension_name == context->dict.all) { - out.data.extension = extension_name; - } else { - unsigned int i; - - out.data.extension = -1; - for (i = 0; i < context->num_extensions; i++) { - if (extension_name == context->extensions[i].name) { - out.data.extension = extension_name; - break; - } - } - } - - /* Grab the colon separating the extension name and behavior. */ - while (first < last && input[first].token == SL_PP_WHITESPACE) { - first++; - } - if (first < last && input[first].token == SL_PP_COLON) { - first++; - } else { - strcpy(context->error_msg, "expected `:' after extension name"); - return -1; - } - while (first < last && input[first].token == SL_PP_WHITESPACE) { - first++; - } - - /* Grab the behavior name. */ - if (first < last && input[first].token == SL_PP_IDENTIFIER) { - behavior = input[first].data.identifier; - first++; - } - if (behavior == -1) { - strcpy(context->error_msg, "expected identifier after `:'"); - return -1; - } - - if (behavior == context->dict.require) { - if (out.data.extension == -1) { - strcpy(context->error_msg, "the required extension is not supported"); - return -1; - } - if (out.data.extension == context->dict.all) { - strcpy(context->error_msg, "invalid behavior for `all' extension: `require'"); - return -1; - } - out.token = SL_PP_EXTENSION_REQUIRE; - } else if (behavior == context->dict.enable) { - if (out.data.extension == -1) { - /* Warning: the extension cannot be enabled. */ - return 0; - } - if (out.data.extension == context->dict.all) { - strcpy(context->error_msg, "invalid behavior for `all' extension: `enable'"); - return -1; - } - out.token = SL_PP_EXTENSION_ENABLE; - } else if (behavior == context->dict.warn) { - if (out.data.extension == -1) { - /* Warning: the extension is not supported. */ - return 0; - } - out.token = SL_PP_EXTENSION_WARN; - } else if (behavior == context->dict.disable) { - if (out.data.extension == -1) { - /* Warning: the extension is not supported. */ - return 0; - } - out.token = SL_PP_EXTENSION_DISABLE; - } else { - strcpy(context->error_msg, "unrecognised behavior name"); - return -1; - } - - /* Grab the end of line. */ - while (first < last && input[first].token == SL_PP_WHITESPACE) { - first++; - } - if (first < last) { - strcpy(context->error_msg, "expected end of line after behavior name"); - return -1; - } - - if (sl_pp_process_out(state, &out)) { - return -1; - } - - return 0; -} diff --git a/src/glsl/pp/sl_pp_if.c b/src/glsl/pp/sl_pp_if.c deleted file mode 100644 index 6b7a1590b4..0000000000 --- a/src/glsl/pp/sl_pp_if.c +++ /dev/null @@ -1,343 +0,0 @@ -/************************************************************************** - * - * Copyright 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, 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 TUNGSTEN GRAPHICS AND/OR ITS 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. - * - **************************************************************************/ - -#include -#include -#include "sl_pp_context.h" -#include "sl_pp_expression.h" -#include "sl_pp_macro.h" -#include "sl_pp_process.h" -#include "sl_pp_token.h" - - -static int -_macro_is_defined(struct sl_pp_context *context, - int macro_name) -{ - unsigned int i; - struct sl_pp_macro *macro; - - for (i = 0; i < context->num_extensions; i++) { - if (macro_name == context->extensions[i].name) { - return 1; - } - } - - for (macro = context->macro; macro; macro = macro->next) { - if (macro_name == macro->name) { - return 1; - } - } - - return 0; -} - -static int -_parse_defined(struct sl_pp_context *context, - struct sl_pp_token_buffer *buffer, - struct sl_pp_process_state *state) -{ - struct sl_pp_token_info input; - int parens = 0; - int defined; - struct sl_pp_token_info result; - - if (sl_pp_token_buffer_skip_white(buffer, &input)) { - return -1; - } - - if (input.token == SL_PP_LPAREN) { - if (sl_pp_token_buffer_skip_white(buffer, &input)) { - return -1; - } - parens = 1; - } - - if (input.token != SL_PP_IDENTIFIER) { - strcpy(context->error_msg, "expected an identifier"); - return -1; - } - - defined = _macro_is_defined(context, input.data.identifier); - - if (parens) { - if (sl_pp_token_buffer_skip_white(buffer, &input)) { - return -1; - } - if (input.token != SL_PP_RPAREN) { - strcpy(context->error_msg, "expected `)'"); - return -1; - } - } - - result.token = SL_PP_UINT; - result.data._uint = (defined ? context->dict._1 : context->dict._0); - - if (sl_pp_process_out(state, &result)) { - strcpy(context->error_msg, "out of memory"); - return -1; - } - - return 0; -} - -static unsigned int -_evaluate_if_stack(struct sl_pp_context *context) -{ - unsigned int i; - - for (i = context->if_ptr; i < SL_PP_MAX_IF_NESTING; i++) { - if (!context->if_stack[i].u.condition) { - return 0; - } - } - return 1; -} - -static int -_parse_if(struct sl_pp_context *context, - struct sl_pp_token_buffer *buffer) -{ - struct sl_pp_process_state state; - int found_end = 0; - struct sl_pp_token_info eof; - int result; - - if (!context->if_ptr) { - strcpy(context->error_msg, "`#if' nesting too deep"); - return -1; - } - - memset(&state, 0, sizeof(state)); - while (!found_end) { - struct sl_pp_token_info input; - - sl_pp_token_buffer_get(buffer, &input); - switch (input.token) { - case SL_PP_WHITESPACE: - break; - - case SL_PP_IDENTIFIER: - if (input.data.identifier == context->dict.defined) { - if (_parse_defined(context, buffer, &state)) { - free(state.out); - return -1; - } - } else { - sl_pp_token_buffer_unget(buffer, &input); - if (sl_pp_macro_expand(context, buffer, NULL, &state, sl_pp_macro_expand_unknown_to_0)) { - free(state.out); - return -1; - } - } - break; - - case SL_PP_NEWLINE: - case SL_PP_EOF: - found_end = 1; - break; - - default: - if (sl_pp_process_out(&state, &input)) { - strcpy(context->error_msg, "out of memory"); - free(state.out); - return -1; - } - } - } - - eof.token = SL_PP_EOF; - if (sl_pp_process_out(&state, &eof)) { - strcpy(context->error_msg, "out of memory"); - free(state.out); - return -1; - } - - if (sl_pp_execute_expression(context, state.out, &result)) { - free(state.out); - return -1; - } - - free(state.out); - - context->if_ptr--; - context->if_stack[context->if_ptr].value = 0; - context->if_stack[context->if_ptr].u.condition = result ? 1 : 0; - context->if_value = _evaluate_if_stack(context); - - return 0; -} - -static int -_parse_else(struct sl_pp_context *context) -{ - union sl_pp_if_state *state = &context->if_stack[context->if_ptr]; - - if (context->if_ptr == SL_PP_MAX_IF_NESTING) { - strcpy(context->error_msg, "no matching `#if'"); - return -1; - } - - if (state->u.went_thru_else) { - strcpy(context->error_msg, "no matching `#if'"); - return -1; - } - - /* Once we had a true condition, the subsequent #elifs should always be false. */ - state->u.had_true_cond |= state->u.condition; - - /* Update current condition value and mark that we are in the #else block. */ - state->u.condition = !(state->u.had_true_cond | state->u.condition); - state->u.went_thru_else = 1; - context->if_value = _evaluate_if_stack(context); - - return 0; -} - -int -sl_pp_process_if(struct sl_pp_context *context, - struct sl_pp_token_buffer *buffer) -{ - return _parse_if(context, buffer); -} - -int -sl_pp_process_ifdef(struct sl_pp_context *context, - const struct sl_pp_token_info *input, - unsigned int first, - unsigned int last) -{ - unsigned int i; - - if (!context->if_ptr) { - strcpy(context->error_msg, "`#if' nesting too deep"); - return -1; - } - - for (i = first; i < last; i++) { - switch (input[i].token) { - case SL_PP_IDENTIFIER: - context->if_ptr--; - context->if_stack[context->if_ptr].value = 0; - context->if_stack[context->if_ptr].u.condition = _macro_is_defined(context, input[i].data.identifier); - context->if_value = _evaluate_if_stack(context); - return 0; - - case SL_PP_WHITESPACE: - break; - - default: - strcpy(context->error_msg, "expected an identifier"); - return -1; - } - } - - strcpy(context->error_msg, "expected an identifier"); - return -1; -} - -int -sl_pp_process_ifndef(struct sl_pp_context *context, - const struct sl_pp_token_info *input, - unsigned int first, - unsigned int last) -{ - unsigned int i; - - if (!context->if_ptr) { - strcpy(context->error_msg, "`#if' nesting too deep"); - return -1; - } - - for (i = first; i < last; i++) { - switch (input[i].token) { - case SL_PP_IDENTIFIER: - context->if_ptr--; - context->if_stack[context->if_ptr].value = 0; - context->if_stack[context->if_ptr].u.condition = !_macro_is_defined(context, input[i].data.identifier); - context->if_value = _evaluate_if_stack(context); - return 0; - - case SL_PP_WHITESPACE: - break; - - default: - strcpy(context->error_msg, "expected an identifier"); - return -1; - } - } - - strcpy(context->error_msg, "expected an identifier"); - return -1; -} - -int -sl_pp_process_elif(struct sl_pp_context *context, - struct sl_pp_token_buffer *buffer) -{ - if (_parse_else(context)) { - return -1; - } - - if (context->if_stack[context->if_ptr].u.condition) { - context->if_ptr++; - if (_parse_if(context, buffer)) { - return -1; - } - } - - /* We are still in the #if block. */ - context->if_stack[context->if_ptr].u.went_thru_else = 0; - - return 0; -} - -int -sl_pp_process_else(struct sl_pp_context *context, - const struct sl_pp_token_info *input, - unsigned int first, - unsigned int last) -{ - return _parse_else(context); -} - -int -sl_pp_process_endif(struct sl_pp_context *context, - const struct sl_pp_token_info *input, - unsigned int first, - unsigned int last) -{ - if (context->if_ptr == SL_PP_MAX_IF_NESTING) { - strcpy(context->error_msg, "no matching `#if'"); - return -1; - } - - context->if_ptr++; - context->if_value = _evaluate_if_stack(context); - - return 0; -} diff --git a/src/glsl/pp/sl_pp_line.c b/src/glsl/pp/sl_pp_line.c deleted file mode 100644 index 51581c7bb5..0000000000 --- a/src/glsl/pp/sl_pp_line.c +++ /dev/null @@ -1,129 +0,0 @@ -/************************************************************************** - * - * Copyright 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, 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 TUNGSTEN GRAPHICS AND/OR ITS 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. - * - **************************************************************************/ - -#include -#include -#include "sl_pp_context.h" -#include "sl_pp_macro.h" -#include "sl_pp_public.h" -#include "sl_pp_process.h" -#include "sl_pp_token.h" - - -int -sl_pp_process_line(struct sl_pp_context *context, - struct sl_pp_token_buffer *buffer, - struct sl_pp_process_state *pstate) -{ - struct sl_pp_process_state state; - int found_end = 0; - int line_number = -1; - int file_number = -1; - unsigned int line; - unsigned int file; - - memset(&state, 0, sizeof(state)); - while (!found_end) { - struct sl_pp_token_info input; - - sl_pp_token_buffer_get(buffer, &input); - switch (input.token) { - case SL_PP_WHITESPACE: - break; - - case SL_PP_IDENTIFIER: - sl_pp_token_buffer_unget(buffer, &input); - if (sl_pp_macro_expand(context, buffer, NULL, &state, sl_pp_macro_expand_normal)) { - free(state.out); - return -1; - } - break; - - case SL_PP_NEWLINE: - case SL_PP_EOF: - found_end = 1; - break; - - default: - if (sl_pp_process_out(&state, &input)) { - strcpy(context->error_msg, "out of memory"); - free(state.out); - return -1; - } - } - } - - if (state.out_len > 0 && state.out[0].token == SL_PP_UINT) { - line_number = state.out[0].data._uint; - } else { - strcpy(context->error_msg, "expected a number after `#line'"); - free(state.out); - return -1; - } - - if (state.out_len > 1) { - if (state.out[1].token == SL_PP_UINT) { - file_number = state.out[1].data._uint; - } else { - strcpy(context->error_msg, "expected a number after line number"); - free(state.out); - return -1; - } - - if (state.out_len > 2) { - strcpy(context->error_msg, "expected an end of line after file number"); - free(state.out); - return -1; - } - } - - free(state.out); - - line = atoi(sl_pp_context_cstr(context, line_number)); - if (file_number != -1) { - file = atoi(sl_pp_context_cstr(context, file_number)); - } else { - file = context->file; - } - - if (context->line != line || context->file != file) { - struct sl_pp_token_info ti; - - ti.token = SL_PP_LINE; - ti.data.line.lineno = line; - ti.data.line.fileno = file; - if (sl_pp_process_out(pstate, &ti)) { - strcpy(context->error_msg, "out of memory"); - return -1; - } - - context->line = line; - context->file = file; - } - - return 0; -} diff --git a/src/glsl/pp/sl_pp_macro.c b/src/glsl/pp/sl_pp_macro.c deleted file mode 100644 index 2cf9ea342b..0000000000 --- a/src/glsl/pp/sl_pp_macro.c +++ /dev/null @@ -1,415 +0,0 @@ -/************************************************************************** - * - * Copyright 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, 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 TUNGSTEN GRAPHICS AND/OR ITS 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. - * - **************************************************************************/ - -#include -#include -#include -#include "sl_pp_context.h" -#include "sl_pp_public.h" -#include "sl_pp_macro.h" -#include "sl_pp_process.h" -#include "sl_pp_token.h" - - -static void -_macro_init(struct sl_pp_macro *macro) -{ - macro->name = -1; - macro->num_args = -1; - macro->arg = NULL; - macro->body = NULL; -} - -struct sl_pp_macro * -sl_pp_macro_new(void) -{ - struct sl_pp_macro *macro; - - macro = calloc(1, sizeof(struct sl_pp_macro)); - if (macro) { - _macro_init(macro); - } - return macro; -} - -static void -_macro_destroy(struct sl_pp_macro *macro) -{ - struct sl_pp_macro_formal_arg *arg = macro->arg; - - while (arg) { - struct sl_pp_macro_formal_arg *next_arg = arg->next; - - free(arg); - arg = next_arg; - } - - free(macro->body); -} - -void -sl_pp_macro_free(struct sl_pp_macro *macro) -{ - while (macro) { - struct sl_pp_macro *next_macro = macro->next; - - _macro_destroy(macro); - free(macro); - macro = next_macro; - } -} - -void -sl_pp_macro_reset(struct sl_pp_macro *macro) -{ - _macro_destroy(macro); - _macro_init(macro); -} - -static int -_out_number(struct sl_pp_context *context, - struct sl_pp_process_state *state, - unsigned int number) -{ - char buf[32]; - struct sl_pp_token_info ti; - - sprintf(buf, "%u", number); - - ti.token = SL_PP_UINT; - ti.data._uint = sl_pp_context_add_unique_str(context, buf); - if (sl_pp_process_out(state, &ti)) { - strcpy(context->error_msg, "out of memory"); - return -1; - } - - return 0; -} - -int -sl_pp_macro_expand(struct sl_pp_context *context, - struct sl_pp_token_buffer *tokens, - struct sl_pp_macro *local, - struct sl_pp_process_state *state, - enum sl_pp_macro_expand_behaviour behaviour) -{ - int mute = (behaviour == sl_pp_macro_expand_mute); - struct sl_pp_token_info input; - int macro_name; - struct sl_pp_macro *macro = NULL; - struct sl_pp_macro *actual_arg = NULL; - unsigned int j; - - if (sl_pp_token_buffer_get(tokens, &input)) { - return -1; - } - - if (input.token != SL_PP_IDENTIFIER) { - strcpy(context->error_msg, "expected an identifier"); - return -1; - } - - macro_name = input.data.identifier; - - /* First look for predefined macros. - */ - - if (macro_name == context->dict.___LINE__) { - if (!mute && _out_number(context, state, context->line)) { - return -1; - } - return 0; - } - if (macro_name == context->dict.___FILE__) { - if (!mute && _out_number(context, state, context->file)) { - return -1; - } - return 0; - } - if (macro_name == context->dict.___VERSION__) { - if (!mute && _out_number(context, state, 110)) { - return -1; - } - return 0; - } - - for (j = 0; j < context->num_predefined; j++) { - if (macro_name == context->predefined[j].name) { - if (!mute) { - struct sl_pp_token_info ti; - - ti.token = SL_PP_UINT; - ti.data._uint = context->predefined[j].value; - if (sl_pp_process_out(state, &ti)) { - strcpy(context->error_msg, "out of memory"); - return -1; - } - } - return 0; - } - } - - /* Replace extension names with 1. - */ - for (j = 0; j < context->num_extensions; j++) { - if (macro_name == context->extensions[j].name) { - if (!mute && _out_number(context, state, 1)) { - return -1; - } - return 0; - } - } - - if (local) { - for (macro = local; macro; macro = macro->next) { - if (macro->name == macro_name) { - break; - } - } - } - - if (!macro) { - for (macro = context->macro; macro; macro = macro->next) { - if (macro->name == macro_name) { - break; - } - } - } - - if (!macro) { - if (behaviour == sl_pp_macro_expand_unknown_to_0) { - if (_out_number(context, state, 0)) { - strcpy(context->error_msg, "out of memory"); - return -1; - } - } else if (!mute) { - if (sl_pp_process_out(state, &input)) { - strcpy(context->error_msg, "out of memory"); - return -1; - } - } - return 0; - } - - if (macro->num_args >= 0) { - if (sl_pp_token_buffer_skip_white(tokens, &input)) { - return -1; - } - if (input.token != SL_PP_LPAREN) { - strcpy(context->error_msg, "expected `('"); - return -1; - } - if (sl_pp_token_buffer_skip_white(tokens, &input)) { - return -1; - } - sl_pp_token_buffer_unget(tokens, &input); - } - - if (macro->num_args > 0) { - struct sl_pp_macro_formal_arg *formal_arg = macro->arg; - struct sl_pp_macro **pmacro = &actual_arg; - - for (j = 0; j < (unsigned int)macro->num_args; j++) { - struct sl_pp_process_state arg_state; - int done = 0; - unsigned int paren_nesting = 0; - struct sl_pp_token_info eof; - - memset(&arg_state, 0, sizeof(arg_state)); - - while (!done) { - if (sl_pp_token_buffer_get(tokens, &input)) { - goto fail_arg; - } - switch (input.token) { - case SL_PP_WHITESPACE: - break; - - case SL_PP_COMMA: - if (!paren_nesting) { - if (j < (unsigned int)macro->num_args - 1) { - done = 1; - } else { - strcpy(context->error_msg, "too many actual macro arguments"); - goto fail_arg; - } - } else { - if (sl_pp_process_out(&arg_state, &input)) { - strcpy(context->error_msg, "out of memory"); - goto fail_arg; - } - } - break; - - case SL_PP_LPAREN: - paren_nesting++; - if (sl_pp_process_out(&arg_state, &input)) { - goto oom_arg; - } - break; - - case SL_PP_RPAREN: - if (!paren_nesting) { - if (j == (unsigned int)macro->num_args - 1) { - done = 1; - } else { - strcpy(context->error_msg, "too few actual macro arguments"); - goto fail_arg; - } - } else { - paren_nesting--; - if (sl_pp_process_out(&arg_state, &input)) { - goto oom_arg; - } - } - break; - - case SL_PP_IDENTIFIER: - sl_pp_token_buffer_unget(tokens, &input); - if (sl_pp_macro_expand(context, tokens, local, &arg_state, sl_pp_macro_expand_normal)) { - goto fail_arg; - } - break; - - case SL_PP_EOF: - strcpy(context->error_msg, "too few actual macro arguments"); - goto fail_arg; - - default: - if (sl_pp_process_out(&arg_state, &input)) { - goto oom_arg; - } - } - } - - eof.token = SL_PP_EOF; - if (sl_pp_process_out(&arg_state, &eof)) { - goto oom_arg; - } - - *pmacro = sl_pp_macro_new(); - if (!*pmacro) { - goto oom_arg; - } - - (**pmacro).name = formal_arg->name; - (**pmacro).body = arg_state.out; - - formal_arg = formal_arg->next; - pmacro = &(**pmacro).next; - - continue; - -oom_arg: - strcpy(context->error_msg, "out of memory"); -fail_arg: - free(arg_state.out); - goto fail; - } - } - - /* Right paren for non-empty argument list has already been eaten. */ - if (macro->num_args == 0) { - if (sl_pp_token_buffer_skip_white(tokens, &input)) { - goto fail; - } - if (input.token != SL_PP_RPAREN) { - strcpy(context->error_msg, "expected `)'"); - goto fail; - } - } - - /* XXX: This is all wrong, we should be ungetting all tokens - * back to the main token buffer. - */ - { - struct sl_pp_token_buffer buffer; - - /* Seek to the end. - */ - for (j = 0; macro->body[j].token != SL_PP_EOF; j++) { - } - j++; - - /* Create a context-less token buffer since we are not going to underrun - * its internal buffer. - */ - if (sl_pp_token_buffer_init(&buffer, NULL)) { - strcpy(context->error_msg, "out of memory"); - goto fail; - } - - /* Unget the tokens in reverse order so later they will be fetched correctly. - */ - for (; j > 0; j--) { - sl_pp_token_buffer_unget(&buffer, ¯o->body[j - 1]); - } - - /* Expand. - */ - for (;;) { - struct sl_pp_token_info input; - - sl_pp_token_buffer_get(&buffer, &input); - switch (input.token) { - case SL_PP_NEWLINE: - if (sl_pp_process_out(state, &input)) { - strcpy(context->error_msg, "out of memory"); - sl_pp_token_buffer_destroy(&buffer); - goto fail; - } - break; - - case SL_PP_IDENTIFIER: - sl_pp_token_buffer_unget(&buffer, &input); - if (sl_pp_macro_expand(context, &buffer, actual_arg, state, behaviour)) { - sl_pp_token_buffer_destroy(&buffer); - goto fail; - } - break; - - case SL_PP_EOF: - sl_pp_token_buffer_destroy(&buffer); - sl_pp_macro_free(actual_arg); - return 0; - - default: - if (!mute) { - if (sl_pp_process_out(state, &input)) { - strcpy(context->error_msg, "out of memory"); - sl_pp_token_buffer_destroy(&buffer); - goto fail; - } - } - } - } - } - -fail: - sl_pp_macro_free(actual_arg); - return -1; -} diff --git a/src/glsl/pp/sl_pp_macro.h b/src/glsl/pp/sl_pp_macro.h deleted file mode 100644 index 6e65a0a588..0000000000 --- a/src/glsl/pp/sl_pp_macro.h +++ /dev/null @@ -1,70 +0,0 @@ -/************************************************************************** - * - * Copyright 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, 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 TUNGSTEN GRAPHICS AND/OR ITS 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. - * - **************************************************************************/ - -#ifndef SL_PP_MACRO_H -#define SL_PP_MACRO_H - -struct sl_pp_context; -struct sl_pp_process_state; -struct sl_pp_token_buffer; - -struct sl_pp_macro_formal_arg { - int name; - struct sl_pp_macro_formal_arg *next; -}; - -struct sl_pp_macro { - int name; - int num_args; /* -1 means no args, 0 means `()' */ - struct sl_pp_macro_formal_arg *arg; - struct sl_pp_token_info *body; - struct sl_pp_macro *next; -}; - -struct sl_pp_macro * -sl_pp_macro_new(void); - -void -sl_pp_macro_free(struct sl_pp_macro *macro); - -void -sl_pp_macro_reset(struct sl_pp_macro *macro); - -enum sl_pp_macro_expand_behaviour { - sl_pp_macro_expand_normal, - sl_pp_macro_expand_mute, - sl_pp_macro_expand_unknown_to_0 -}; - -int -sl_pp_macro_expand(struct sl_pp_context *context, - struct sl_pp_token_buffer *tokens, - struct sl_pp_macro *local, - struct sl_pp_process_state *state, - enum sl_pp_macro_expand_behaviour behaviour); - -#endif /* SL_PP_MACRO_H */ diff --git a/src/glsl/pp/sl_pp_pragma.c b/src/glsl/pp/sl_pp_pragma.c deleted file mode 100644 index 6789704db0..0000000000 --- a/src/glsl/pp/sl_pp_pragma.c +++ /dev/null @@ -1,110 +0,0 @@ -/************************************************************************** - * - * Copyright 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, 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 TUNGSTEN GRAPHICS AND/OR ITS 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. - * - **************************************************************************/ - -#include -#include -#include "sl_pp_context.h" -#include "sl_pp_process.h" -#include "sl_pp_token.h" - - -int -sl_pp_process_pragma(struct sl_pp_context *context, - const struct sl_pp_token_info *input, - unsigned int first, - unsigned int last, - struct sl_pp_process_state *state) -{ - int pragma_name = -1; - struct sl_pp_token_info out; - int arg_name = -1; - - if (first < last && input[first].token == SL_PP_IDENTIFIER) { - pragma_name = input[first].data.identifier; - first++; - } - if (pragma_name == -1) { - return 0; - } - - if (pragma_name == context->dict.optimize) { - out.token = SL_PP_PRAGMA_OPTIMIZE; - } else if (pragma_name == context->dict.debug) { - out.token = SL_PP_PRAGMA_DEBUG; - } else { - return 0; - } - - while (first < last && input[first].token == SL_PP_WHITESPACE) { - first++; - } - - if (first < last && input[first].token == SL_PP_LPAREN) { - first++; - } else { - return 0; - } - - while (first < last && input[first].token == SL_PP_WHITESPACE) { - first++; - } - - if (first < last && input[first].token == SL_PP_IDENTIFIER) { - arg_name = input[first].data.identifier; - first++; - } - if (arg_name == -1) { - return 0; - } - - if (arg_name == context->dict.off) { - out.data.pragma = 0; - } else if (arg_name == context->dict.on) { - out.data.pragma = 1; - } else { - return 0; - } - - while (first < last && input[first].token == SL_PP_WHITESPACE) { - first++; - } - - if (first < last && input[first].token == SL_PP_RPAREN) { - first++; - } else { - return 0; - } - - /* Ignore the tokens that follow. */ - - if (sl_pp_process_out(state, &out)) { - strcpy(context->error_msg, "out of memory"); - return -1; - } - - return 0; -} diff --git a/src/glsl/pp/sl_pp_process.c b/src/glsl/pp/sl_pp_process.c deleted file mode 100644 index 2f12393237..0000000000 --- a/src/glsl/pp/sl_pp_process.c +++ /dev/null @@ -1,331 +0,0 @@ -/************************************************************************** - * - * Copyright 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, 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 TUNGSTEN GRAPHICS AND/OR ITS 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. - * - **************************************************************************/ - -#include -#include -#include -#include "sl_pp_context.h" -#include "sl_pp_macro.h" -#include "sl_pp_process.h" -#include "sl_pp_public.h" -#include "sl_pp_token.h" - - -int -sl_pp_process_out(struct sl_pp_process_state *state, - const struct sl_pp_token_info *token) -{ - if (state->out_len >= state->out_max) { - unsigned int new_max = state->out_max; - - if (new_max < 0x100) { - new_max = 0x100; - } else if (new_max < 0x10000) { - new_max *= 2; - } else { - new_max += 0x10000; - } - - state->out = realloc(state->out, new_max * sizeof(struct sl_pp_token_info)); - if (!state->out) { - return -1; - } - state->out_max = new_max; - } - - state->out[state->out_len++] = *token; - return 0; -} - -int -sl_pp_process_get(struct sl_pp_context *context, - struct sl_pp_token_info *output) -{ - if (!context->process_state.out) { - if (context->line > 1) { - struct sl_pp_token_info ti; - - ti.token = SL_PP_LINE; - ti.data.line.lineno = context->line - 1; - ti.data.line.fileno = context->file; - if (sl_pp_process_out(&context->process_state, &ti)) { - strcpy(context->error_msg, "out of memory"); - return -1; - } - - ti.token = SL_PP_NEWLINE; - if (sl_pp_process_out(&context->process_state, &ti)) { - strcpy(context->error_msg, "out of memory"); - return -1; - } - } - } - - for (;;) { - struct sl_pp_token_info input; - int found_eof = 0; - - if (context->process_state.out_len) { - assert(context->process_state.out); - *output = context->process_state.out[0]; - - if (context->process_state.out_len > 1) { - unsigned int i; - - for (i = 1; i < context->process_state.out_len; i++) { - context->process_state.out[i - 1] = context->process_state.out[i]; - } - } - context->process_state.out_len--; - - return 0; - } - - if (sl_pp_token_buffer_skip_white(&context->tokens, &input)) { - return -1; - } - if (input.token == SL_PP_HASH) { - if (sl_pp_token_buffer_skip_white(&context->tokens, &input)) { - return -1; - } - switch (input.token) { - case SL_PP_IDENTIFIER: - { - int name; - int found_eol = 0; - struct sl_pp_token_info endof; - struct sl_pp_token_peek peek; - int result = 0; - - /* Directive name. */ - name = input.data.identifier; - - if (sl_pp_token_buffer_skip_white(&context->tokens, &input)) { - return -1; - } - sl_pp_token_buffer_unget(&context->tokens, &input); - - if (sl_pp_token_peek_init(&peek, &context->tokens)) { - return -1; - } - - while (!found_eol) { - if (sl_pp_token_peek_get(&peek, &input)) { - sl_pp_token_peek_destroy(&peek); - return -1; - } - switch (input.token) { - case SL_PP_NEWLINE: - /* Preserve newline just for the sake of line numbering. */ - endof = input; - found_eol = 1; - break; - - case SL_PP_EOF: - endof = input; - found_eof = 1; - found_eol = 1; - break; - - default: - break; - } - } - - if (name == context->dict._if) { - struct sl_pp_token_buffer buffer; - - result = sl_pp_token_peek_to_buffer(&peek, &buffer); - if (result == 0) { - result = sl_pp_process_if(context, &buffer); - sl_pp_token_buffer_destroy(&buffer); - } - } else if (name == context->dict.ifdef) { - result = sl_pp_process_ifdef(context, peek.tokens, 0, peek.size - 1); - } else if (name == context->dict.ifndef) { - result = sl_pp_process_ifndef(context, peek.tokens, 0, peek.size - 1); - } else if (name == context->dict.elif) { - struct sl_pp_token_buffer buffer; - - result = sl_pp_token_peek_to_buffer(&peek, &buffer); - if (result == 0) { - result = sl_pp_process_elif(context, &buffer); - sl_pp_token_buffer_destroy(&buffer); - } - } else if (name == context->dict._else) { - result = sl_pp_process_else(context, peek.tokens, 0, peek.size - 1); - } else if (name == context->dict.endif) { - result = sl_pp_process_endif(context, peek.tokens, 0, peek.size - 1); - } else if (context->if_value) { - if (name == context->dict.define) { - result = sl_pp_process_define(context, peek.tokens, 0, peek.size - 1); - } else if (name == context->dict.error) { - sl_pp_process_error(context, peek.tokens, 0, peek.size - 1); - result = -1; - } else if (name == context->dict.extension) { - result = sl_pp_process_extension(context, peek.tokens, 0, peek.size - 1, &context->process_state); - } else if (name == context->dict.line) { - struct sl_pp_token_buffer buffer; - - result = sl_pp_token_peek_to_buffer(&peek, &buffer); - if (result == 0) { - result = sl_pp_process_line(context, &buffer, &context->process_state); - sl_pp_token_buffer_destroy(&buffer); - } - } else if (name == context->dict.pragma) { - result = sl_pp_process_pragma(context, peek.tokens, 0, peek.size - 1, &context->process_state); - } else if (name == context->dict.undef) { - result = sl_pp_process_undef(context, peek.tokens, 0, peek.size - 1); - } else { - strcpy(context->error_msg, "unrecognised directive name"); - result = -1; - } - } - - sl_pp_token_peek_commit(&peek); - sl_pp_token_peek_destroy(&peek); - - if (result) { - return result; - } - - if (sl_pp_process_out(&context->process_state, &endof)) { - strcpy(context->error_msg, "out of memory"); - return -1; - } - context->line++; - } - break; - - case SL_PP_NEWLINE: - /* Empty directive. */ - if (sl_pp_process_out(&context->process_state, &input)) { - strcpy(context->error_msg, "out of memory"); - return -1; - } - context->line++; - break; - - case SL_PP_EOF: - /* Empty directive. */ - if (sl_pp_process_out(&context->process_state, &input)) { - strcpy(context->error_msg, "out of memory"); - return -1; - } - found_eof = 1; - break; - - default: - strcpy(context->error_msg, "expected a directive name"); - return -1; - } - } else { - int found_eol = 0; - - sl_pp_token_buffer_unget(&context->tokens, &input); - - while (!found_eol) { - if (sl_pp_token_buffer_get(&context->tokens, &input)) { - return -1; - } - - switch (input.token) { - case SL_PP_WHITESPACE: - /* Drop whitespace all together at this point. */ - break; - - case SL_PP_NEWLINE: - /* Preserve newline just for the sake of line numbering. */ - if (sl_pp_process_out(&context->process_state, &input)) { - strcpy(context->error_msg, "out of memory"); - return -1; - } - context->line++; - found_eol = 1; - break; - - case SL_PP_EOF: - if (sl_pp_process_out(&context->process_state, &input)) { - strcpy(context->error_msg, "out of memory"); - return -1; - } - found_eof = 1; - found_eol = 1; - break; - - case SL_PP_IDENTIFIER: - sl_pp_token_buffer_unget(&context->tokens, &input); - if (sl_pp_macro_expand(context, &context->tokens, NULL, &context->process_state, - context->if_value ? sl_pp_macro_expand_normal : sl_pp_macro_expand_mute)) { - return -1; - } - break; - - default: - if (context->if_value) { - if (sl_pp_process_out(&context->process_state, &input)) { - strcpy(context->error_msg, "out of memory"); - return -1; - } - } - } - } - } - - if (found_eof) { - if (context->if_ptr != SL_PP_MAX_IF_NESTING) { - strcpy(context->error_msg, "expected `#endif' directive"); - return -1; - } - } - } -} - -int -sl_pp_process(struct sl_pp_context *context, - struct sl_pp_token_info **output) -{ - struct sl_pp_process_state state; - - memset(&state, 0, sizeof(state)); - for (;;) { - struct sl_pp_token_info input; - - if (sl_pp_process_get(context, &input)) { - free(state.out); - return -1; - } - if (sl_pp_process_out(&state, &input)) { - free(state.out); - return -1; - } - if (input.token == SL_PP_EOF) { - *output = state.out; - return 0; - } - } -} diff --git a/src/glsl/pp/sl_pp_process.h b/src/glsl/pp/sl_pp_process.h deleted file mode 100644 index 04e9be4398..0000000000 --- a/src/glsl/pp/sl_pp_process.h +++ /dev/null @@ -1,113 +0,0 @@ -/************************************************************************** - * - * Copyright 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, 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 TUNGSTEN GRAPHICS AND/OR ITS 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. - * - **************************************************************************/ - -#ifndef SL_PP_PROCESS_H -#define SL_PP_PROCESS_H - -struct sl_pp_context; -struct sl_pp_token_buffer; - -struct sl_pp_process_state { - struct sl_pp_token_info *out; - unsigned int out_len; - unsigned int out_max; -}; - -int -sl_pp_process_define(struct sl_pp_context *context, - const struct sl_pp_token_info *input, - unsigned int first, - unsigned int last); - -int -sl_pp_process_undef(struct sl_pp_context *context, - const struct sl_pp_token_info *input, - unsigned int first, - unsigned int last); - -int -sl_pp_process_if(struct sl_pp_context *context, - struct sl_pp_token_buffer *input); - -int -sl_pp_process_ifdef(struct sl_pp_context *context, - const struct sl_pp_token_info *input, - unsigned int first, - unsigned int last); - -int -sl_pp_process_ifndef(struct sl_pp_context *context, - const struct sl_pp_token_info *input, - unsigned int first, - unsigned int last); - -int -sl_pp_process_elif(struct sl_pp_context *context, - struct sl_pp_token_buffer *buffer); - -int -sl_pp_process_else(struct sl_pp_context *context, - const struct sl_pp_token_info *input, - unsigned int first, - unsigned int last); - -int -sl_pp_process_endif(struct sl_pp_context *context, - const struct sl_pp_token_info *input, - unsigned int first, - unsigned int last); - -void -sl_pp_process_error(struct sl_pp_context *context, - const struct sl_pp_token_info *input, - unsigned int first, - unsigned int last); - -int -sl_pp_process_pragma(struct sl_pp_context *context, - const struct sl_pp_token_info *input, - unsigned int first, - unsigned int last, - struct sl_pp_process_state *state); - -int -sl_pp_process_extension(struct sl_pp_context *context, - const struct sl_pp_token_info *input, - unsigned int first, - unsigned int last, - struct sl_pp_process_state *state); - -int -sl_pp_process_line(struct sl_pp_context *context, - struct sl_pp_token_buffer *buffer, - struct sl_pp_process_state *state); - -int -sl_pp_process_out(struct sl_pp_process_state *state, - const struct sl_pp_token_info *token); - -#endif /* SL_PP_PROCESS_H */ diff --git a/src/glsl/pp/sl_pp_public.h b/src/glsl/pp/sl_pp_public.h deleted file mode 100644 index 66ced6cf58..0000000000 --- a/src/glsl/pp/sl_pp_public.h +++ /dev/null @@ -1,79 +0,0 @@ -/************************************************************************** - * - * Copyright 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, 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 TUNGSTEN GRAPHICS AND/OR ITS 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. - * - **************************************************************************/ - -#ifndef SL_PP_PUBLIC_H -#define SL_PP_PUBLIC_H - -struct sl_pp_context; -struct sl_pp_purify_options; -struct sl_pp_token_info; - -struct sl_pp_context * -sl_pp_context_create(const char *input, - const struct sl_pp_purify_options *options); - -void -sl_pp_context_destroy(struct sl_pp_context *context); - -const char * -sl_pp_context_error_message(const struct sl_pp_context *context); - -void -sl_pp_context_error_position(const struct sl_pp_context *context, - unsigned int *file, - unsigned int *line); - -int -sl_pp_context_add_extension(struct sl_pp_context *context, - const char *name); - -int -sl_pp_context_add_predefined(struct sl_pp_context *context, - const char *name, - const char *value); - -int -sl_pp_context_add_unique_str(struct sl_pp_context *context, - const char *str); - -const char * -sl_pp_context_cstr(const struct sl_pp_context *context, - int offset); - -int -sl_pp_version(struct sl_pp_context *context, - unsigned int *version); - -int -sl_pp_process_get(struct sl_pp_context *context, - struct sl_pp_token_info *output); - -int -sl_pp_process(struct sl_pp_context *context, - struct sl_pp_token_info **output); - -#endif /* SL_PP_PUBLIC_H */ diff --git a/src/glsl/pp/sl_pp_purify.c b/src/glsl/pp/sl_pp_purify.c deleted file mode 100644 index acc000cf3d..0000000000 --- a/src/glsl/pp/sl_pp_purify.c +++ /dev/null @@ -1,302 +0,0 @@ -/************************************************************************** - * - * Copyright 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, 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 TUNGSTEN GRAPHICS AND/OR ITS 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. - * - **************************************************************************/ - -#include -#include -#include -#include "sl_pp_purify.h" - - -/* - * Preprocessor purifier performs the following tasks. - * - Convert all variants of newlines into a Unix newline. - * - Merge continued lines into a single long line. - * - Remove line comments and replace block comments with whitespace. - */ - - -static unsigned int -_purify_newline(const char *input, - char *out, - unsigned int *current_line) -{ - if (input[0] == '\n') { - *out = '\n'; - (*current_line)++; - if (input[1] == '\r') { - /* - * The GLSL spec is not explicit about whether this - * combination is a valid newline or not. - * Let's assume it is acceptable. - */ - return 2; - } - return 1; - } - if (input[0] == '\r') { - *out = '\n'; - (*current_line)++; - if (input[1] == '\n') { - return 2; - } - return 1; - } - *out = input[0]; - return 1; -} - - -static unsigned int -_purify_backslash(const char *input, - char *out, - unsigned int *current_line) -{ - unsigned int eaten = 0; - - for (;;) { - if (input[0] == '\\') { - char next; - unsigned int next_eaten; - unsigned int next_line = *current_line; - - eaten++; - input++; - - next_eaten = _purify_newline(input, &next, &next_line); - if (next == '\n') { - /* - * If this is really a line continuation sequence, eat - * it and do not exit the loop. - */ - eaten += next_eaten; - input += next_eaten; - *current_line = next_line; - } else { - /* - * It is an error to put anything between a backslash - * and a newline and still expect it to behave like a line - * continuation sequence. - * Even if it is an innocent whitespace. - */ - *out = '\\'; - break; - } - } else { - eaten += _purify_newline(input, out, current_line); - break; - } - } - return eaten; -} - - -static void -_report_error(char *buf, - unsigned int cbbuf, - const char *msg, - ...) -{ - va_list args; - - va_start(args, msg); - vsnprintf(buf, cbbuf, msg, args); - va_end(args); -} - - -void -sl_pp_purify_state_init(struct sl_pp_purify_state *state, - const char *input, - const struct sl_pp_purify_options *options) -{ - state->options = *options; - state->input = input; - state->current_line = 1; - state->inside_c_comment = 0; -} - - -static unsigned int -_purify_comment(struct sl_pp_purify_state *state, - char *output, - unsigned int *current_line, - char *errormsg, - unsigned int cberrormsg) -{ - for (;;) { - unsigned int eaten; - char next; - - eaten = _purify_backslash(state->input, &next, current_line); - state->input += eaten; - while (next == '*') { - eaten = _purify_backslash(state->input, &next, current_line); - state->input += eaten; - if (next == '/') { - *output = ' '; - state->inside_c_comment = 0; - return 1; - } - } - if (next == '\n') { - *output = '\n'; - state->inside_c_comment = 1; - return 1; - } - if (next == '\0') { - _report_error(errormsg, cberrormsg, "expected `*/' but end of translation unit found"); - return 0; - } - } -} - - -unsigned int -sl_pp_purify_getc(struct sl_pp_purify_state *state, - char *output, - unsigned int *current_line, - char *errormsg, - unsigned int cberrormsg) -{ - unsigned int eaten; - - if (state->inside_c_comment) { - return _purify_comment(state, output, current_line, errormsg, cberrormsg); - } - - eaten = _purify_backslash(state->input, output, current_line); - state->input += eaten; - if (*output == '/') { - char next; - unsigned int next_line = *current_line; - - eaten = _purify_backslash(state->input, &next, &next_line); - if (next == '/') { - state->input += eaten; - *current_line = next_line; - - /* Replace a line comment with either a newline or nil. */ - for (;;) { - eaten = _purify_backslash(state->input, &next, current_line); - state->input += eaten; - if (next == '\n' || next == '\0') { - *output = next; - return eaten; - } - } - } else if (next == '*') { - state->input += eaten; - *current_line = next_line; - - return _purify_comment(state, output, current_line, errormsg, cberrormsg); - } - } - return eaten; -} - - -struct out_buf { - char *out; - unsigned int len; - unsigned int capacity; - unsigned int current_line; - char *errormsg; - unsigned int cberrormsg; -}; - - -static int -_out_buf_putc(struct out_buf *obuf, - char c) -{ - if (obuf->len >= obuf->capacity) { - unsigned int new_max = obuf->capacity; - - if (new_max < 0x100) { - new_max = 0x100; - } else if (new_max < 0x10000) { - new_max *= 2; - } else { - new_max += 0x10000; - } - - obuf->out = realloc(obuf->out, new_max); - if (!obuf->out) { - _report_error(obuf->errormsg, obuf->cberrormsg, "out of memory"); - return -1; - } - obuf->capacity = new_max; - } - - obuf->out[obuf->len++] = c; - - return 0; -} - - -int -sl_pp_purify(const char *input, - const struct sl_pp_purify_options *options, - char **output, - char *errormsg, - unsigned int cberrormsg, - unsigned int *errorline) -{ - struct out_buf obuf; - struct sl_pp_purify_state state; - - obuf.out = NULL; - obuf.len = 0; - obuf.capacity = 0; - obuf.current_line = 1; - obuf.errormsg = errormsg; - obuf.cberrormsg = cberrormsg; - - sl_pp_purify_state_init(&state, input, options); - - for (;;) { - unsigned int eaten; - char c; - - eaten = sl_pp_purify_getc(&state, &c, &obuf.current_line, errormsg, cberrormsg); - if (!eaten) { - *errorline = obuf.current_line; - return -1; - } - if (_out_buf_putc(&obuf, c)) { - *errorline = obuf.current_line; - return -1; - } - - if (c == '\0') { - break; - } - } - - *output = obuf.out; - return 0; -} diff --git a/src/glsl/pp/sl_pp_purify.h b/src/glsl/pp/sl_pp_purify.h deleted file mode 100644 index c0f55cbfd8..0000000000 --- a/src/glsl/pp/sl_pp_purify.h +++ /dev/null @@ -1,63 +0,0 @@ -/************************************************************************** - * - * Copyright 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, 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 TUNGSTEN GRAPHICS AND/OR ITS 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. - * - **************************************************************************/ - -#ifndef SL_PP_PURIFY_H -#define SL_PP_PURIFY_H - -struct sl_pp_purify_options { - unsigned int preserve_columns:1; - unsigned int tab_width:4; -}; - -int -sl_pp_purify(const char *input, - const struct sl_pp_purify_options *options, - char **output, - char *errormsg, - unsigned int cberrormsg, - unsigned int *errorline); - -struct sl_pp_purify_state { - struct sl_pp_purify_options options; - const char *input; - unsigned int current_line; - unsigned int inside_c_comment:1; -}; - -void -sl_pp_purify_state_init(struct sl_pp_purify_state *state, - const char *input, - const struct sl_pp_purify_options *options); - -unsigned int -sl_pp_purify_getc(struct sl_pp_purify_state *state, - char *output, - unsigned int *current_line, - char *errormsg, - unsigned int cberrormsg); - -#endif /* SL_PP_PURIFY_H */ diff --git a/src/glsl/pp/sl_pp_token.c b/src/glsl/pp/sl_pp_token.c deleted file mode 100644 index a708978700..0000000000 --- a/src/glsl/pp/sl_pp_token.c +++ /dev/null @@ -1,854 +0,0 @@ -/************************************************************************** - * - * Copyright 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, 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 TUNGSTEN GRAPHICS AND/OR ITS 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. - * - **************************************************************************/ - -#include -#include -#include -#include "sl_pp_public.h" -#include "sl_pp_context.h" -#include "sl_pp_token.h" - - -#define PURE_ERROR 256 - -static int -_pure_getc(struct sl_pp_context *context) -{ - char c; - - if (context->getc_buf_size) { - return context->getc_buf[--context->getc_buf_size]; - } - - if (sl_pp_purify_getc(&context->pure, &c, &context->error_line, context->error_msg, sizeof(context->error_msg)) == 0) { - return PURE_ERROR; - } - return c; -} - - -static void -_pure_ungetc(struct sl_pp_context *context, - int c) -{ - assert(c != PURE_ERROR); - - if (context->getc_buf_size == context->getc_buf_capacity) { - context->getc_buf_capacity += 64; - context->getc_buf = realloc(context->getc_buf, context->getc_buf_capacity * sizeof(char)); - assert(context->getc_buf); - } - - context->getc_buf[context->getc_buf_size++] = (char)c; -} - - -struct lookahead_state { - char buf[256]; - unsigned int pos; - struct sl_pp_context *context; -}; - - -static void -_lookahead_init(struct lookahead_state *lookahead, - struct sl_pp_context *context) -{ - lookahead->pos = 0; - lookahead->context = context; -} - - -static unsigned int -_lookahead_tell(const struct lookahead_state *lookahead) -{ - return lookahead->pos; -} - - -static const void * -_lookahead_buf(const struct lookahead_state *lookahead) -{ - return lookahead->buf; -} - - -static void -_lookahead_revert(struct lookahead_state *lookahead, - unsigned int pos) -{ - assert(pos <= lookahead->pos); - - while (lookahead->pos > pos) { - _pure_ungetc(lookahead->context, lookahead->buf[--lookahead->pos]); - } -} - - -static int -_lookahead_getc(struct lookahead_state *lookahead) -{ - int c; - - assert(lookahead->pos < sizeof(lookahead->buf) / sizeof(lookahead->buf[0])); - - c = _pure_getc(lookahead->context); - if (c != PURE_ERROR) { - lookahead->buf[lookahead->pos++] = (char)c; - } - return c; -} - - -static int -_is_identifier_char(char c) -{ - return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || (c >= '0' && c <= '9') || c == '_'; -} - - -static int -_tokenise_identifier(struct sl_pp_context *context, - struct sl_pp_token_info *out) -{ - int c; - char identifier[256]; /* XXX: Remove this artifical limit. */ - unsigned int i = 0; - - out->token = SL_PP_IDENTIFIER; - out->data.identifier = -1; - - c = _pure_getc(context); - if (c == PURE_ERROR) { - return -1; - } - identifier[i++] = (char)c; - for (;;) { - c = _pure_getc(context); - if (c == PURE_ERROR) { - return -1; - } - - if (_is_identifier_char((char)c)) { - if (i >= sizeof(identifier) / sizeof(char) - 1) { - strcpy(context->error_msg, "out of memory"); - _pure_ungetc(context, c); - while (i) { - _pure_ungetc(context, identifier[--i]); - } - return -1; - } - identifier[i++] = (char)c; - } else { - _pure_ungetc(context, c); - break; - } - } - identifier[i] = '\0'; - - out->data.identifier = sl_pp_context_add_unique_str(context, identifier); - if (out->data.identifier == -1) { - while (i) { - _pure_ungetc(context, identifier[--i]); - } - return -1; - } - - return 0; -} - - -/* - * Return the number of consecutive decimal digits in the input stream. - */ -static unsigned int -_parse_float_digits(struct lookahead_state *lookahead) -{ - unsigned int eaten; - - for (eaten = 0;; eaten++) { - unsigned int pos = _lookahead_tell(lookahead); - char c = _lookahead_getc(lookahead); - - if (c < '0' || c > '9') { - _lookahead_revert(lookahead, pos); - break; - } - } - return eaten; -} - - -/* - * Try to match one of the following patterns for the fractional part - * of a floating point number. - * - * digits . [digits] - * . digits - * - * Return 0 if the pattern could not be matched, otherwise the number - * of eaten characters from the input stream. - */ -static unsigned int -_parse_float_frac(struct lookahead_state *lookahead) -{ - unsigned int pos; - int c; - unsigned int eaten; - - pos = _lookahead_tell(lookahead); - c = _lookahead_getc(lookahead); - if (c == '.') { - eaten = _parse_float_digits(lookahead); - if (eaten) { - return eaten + 1; - } - _lookahead_revert(lookahead, pos); - return 0; - } - - _lookahead_revert(lookahead, pos); - eaten = _parse_float_digits(lookahead); - if (eaten) { - c = _lookahead_getc(lookahead); - if (c == '.') { - return eaten + 1 + _parse_float_digits(lookahead); - } - } - - _lookahead_revert(lookahead, pos); - return 0; -} - - -/* - * Try to match the following pattern for the exponential part - * of a floating point number. - * - * (e|E) [(+|-)] digits - * - * Return 0 if the pattern could not be matched, otherwise the number - * of eaten characters from the input stream. - */ -static unsigned int -_parse_float_exp(struct lookahead_state *lookahead) -{ - unsigned int pos, pos2; - int c; - unsigned int eaten, digits; - - pos = _lookahead_tell(lookahead); - c = _lookahead_getc(lookahead); - if (c != 'e' && c != 'E') { - _lookahead_revert(lookahead, pos); - return 0; - } - - pos2 = _lookahead_tell(lookahead); - c = _lookahead_getc(lookahead); - if (c == '-' || c == '+') { - eaten = 2; - } else { - _lookahead_revert(lookahead, pos2); - eaten = 1; - } - - digits = _parse_float_digits(lookahead); - if (!digits) { - _lookahead_revert(lookahead, pos); - return 0; - } - - return eaten + digits; -} - - -/* - * Try to match one of the following patterns for a floating point number. - * - * fract [exp] [(f|F)] - * digits exp [(f|F)] - * - * Return 0 if the pattern could not be matched, otherwise the number - * of eaten characters from the input stream. - */ -static unsigned int -_parse_float(struct lookahead_state *lookahead) -{ - unsigned int eaten; - - eaten = _parse_float_frac(lookahead); - if (eaten) { - unsigned int pos; - int c; - - eaten += _parse_float_exp(lookahead); - - pos = _lookahead_tell(lookahead); - c = _lookahead_getc(lookahead); - if (c == 'f' || c == 'F') { - eaten++; - } else { - _lookahead_revert(lookahead, pos); - } - - return eaten; - } - - eaten = _parse_float_digits(lookahead); - if (eaten) { - unsigned int exponent; - - exponent = _parse_float_exp(lookahead); - if (exponent) { - unsigned int pos; - int c; - - eaten += exponent; - - pos = _lookahead_tell(lookahead); - c = _lookahead_getc(lookahead); - if (c == 'f' || c == 'F') { - eaten++; - } else { - _lookahead_revert(lookahead, pos); - } - - return eaten; - } - } - - _lookahead_revert(lookahead, 0); - return 0; -} - - -static unsigned int -_parse_hex(struct lookahead_state *lookahead) -{ - int c; - unsigned int n; - - c = _lookahead_getc(lookahead); - if (c != '0') { - _lookahead_revert(lookahead, 0); - return 0; - } - - c = _lookahead_getc(lookahead); - if (c != 'x' && c != 'X') { - _lookahead_revert(lookahead, 0); - return 0; - } - - for (n = 2;;) { - unsigned int pos = _lookahead_tell(lookahead); - - c = _lookahead_getc(lookahead); - if ((c >= '0' && c <= '9') || (c >= 'a' && c <= 'f') || (c >= 'A' && c <= 'F')) { - n++; - } else { - _lookahead_revert(lookahead, pos); - break; - } - } - - if (n > 2) { - return n; - } - - _lookahead_revert(lookahead, 0); - return 0; -} - - -static unsigned int -_parse_oct(struct lookahead_state *lookahead) -{ - int c; - unsigned int n; - - c = _lookahead_getc(lookahead); - if (c != '0') { - _lookahead_revert(lookahead, 0); - return 0; - } - - for (n = 1;;) { - unsigned int pos = _lookahead_tell(lookahead); - - c = _lookahead_getc(lookahead); - if ((c >= '0' && c <= '7')) { - n++; - } else { - _lookahead_revert(lookahead, pos); - break; - } - } - - return n; -} - - -static unsigned int -_parse_dec(struct lookahead_state *lookahead) -{ - unsigned int n = 0; - - for (;;) { - unsigned int pos = _lookahead_tell(lookahead); - int c = _lookahead_getc(lookahead); - - if ((c >= '0' && c <= '9')) { - n++; - } else { - _lookahead_revert(lookahead, pos); - break; - } - } - - return n; -} - - -static int -_tokenise_number(struct sl_pp_context *context, - struct sl_pp_token_info *out) -{ - struct lookahead_state lookahead; - unsigned int eaten; - unsigned int is_float = 0; - unsigned int pos; - int c; - char number[256]; /* XXX: Remove this artifical limit. */ - - _lookahead_init(&lookahead, context); - - eaten = _parse_float(&lookahead); - if (!eaten) { - eaten = _parse_hex(&lookahead); - if (!eaten) { - eaten = _parse_oct(&lookahead); - if (!eaten) { - eaten = _parse_dec(&lookahead); - } - } - } else { - is_float = 1; - } - - if (!eaten) { - strcpy(context->error_msg, "expected a number"); - return -1; - } - - pos = _lookahead_tell(&lookahead); - c = _lookahead_getc(&lookahead); - _lookahead_revert(&lookahead, pos); - - if (_is_identifier_char(c)) { - strcpy(context->error_msg, "expected a number"); - _lookahead_revert(&lookahead, 0); - return -1; - } - - if (eaten > sizeof(number) - 1) { - strcpy(context->error_msg, "out of memory"); - _lookahead_revert(&lookahead, 0); - return -1; - } - - assert(_lookahead_tell(&lookahead) == eaten); - - memcpy(number, _lookahead_buf(&lookahead), eaten); - number[eaten] = '\0'; - - if (is_float) { - out->token = SL_PP_FLOAT; - out->data._float = sl_pp_context_add_unique_str(context, number); - if (out->data._float == -1) { - _lookahead_revert(&lookahead, 0); - return -1; - } - } else { - out->token = SL_PP_UINT; - out->data._uint = sl_pp_context_add_unique_str(context, number); - if (out->data._uint == -1) { - _lookahead_revert(&lookahead, 0); - return -1; - } - } - - return 0; -} - - -int -sl_pp_token_get(struct sl_pp_context *context, - struct sl_pp_token_info *out) -{ - int c = _pure_getc(context); - - switch (c) { - case ' ': - case '\t': - out->token = SL_PP_WHITESPACE; - break; - - case '\n': - out->token = SL_PP_NEWLINE; - break; - - case '#': - out->token = SL_PP_HASH; - break; - - case ',': - out->token = SL_PP_COMMA; - break; - - case ';': - out->token = SL_PP_SEMICOLON; - break; - - case '{': - out->token = SL_PP_LBRACE; - break; - - case '}': - out->token = SL_PP_RBRACE; - break; - - case '(': - out->token = SL_PP_LPAREN; - break; - - case ')': - out->token = SL_PP_RPAREN; - break; - - case '[': - out->token = SL_PP_LBRACKET; - break; - - case ']': - out->token = SL_PP_RBRACKET; - break; - - case '.': - { - int c2 = _pure_getc(context); - - if (c2 == PURE_ERROR) { - return -1; - } - if (c2 >= '0' && c2 <= '9') { - _pure_ungetc(context, c2); - _pure_ungetc(context, c); - if (_tokenise_number(context, out)) { - return -1; - } - } else { - _pure_ungetc(context, c2); - out->token = SL_PP_DOT; - } - } - break; - - case '+': - c = _pure_getc(context); - if (c == PURE_ERROR) { - return -1; - } - if (c == '+') { - out->token = SL_PP_INCREMENT; - } else if (c == '=') { - out->token = SL_PP_ADDASSIGN; - } else { - _pure_ungetc(context, c); - out->token = SL_PP_PLUS; - } - break; - - case '-': - c = _pure_getc(context); - if (c == PURE_ERROR) { - return -1; - } - if (c == '-') { - out->token = SL_PP_DECREMENT; - } else if (c == '=') { - out->token = SL_PP_SUBASSIGN; - } else { - _pure_ungetc(context, c); - out->token = SL_PP_MINUS; - } - break; - - case '~': - out->token = SL_PP_BITNOT; - break; - - case '!': - c = _pure_getc(context); - if (c == PURE_ERROR) { - return -1; - } - if (c == '=') { - out->token = SL_PP_NOTEQUAL; - } else { - _pure_ungetc(context, c); - out->token = SL_PP_NOT; - } - break; - - case '*': - c = _pure_getc(context); - if (c == PURE_ERROR) { - return -1; - } - if (c == '=') { - out->token = SL_PP_MULASSIGN; - } else { - _pure_ungetc(context, c); - out->token = SL_PP_STAR; - } - break; - - case '/': - c = _pure_getc(context); - if (c == PURE_ERROR) { - return -1; - } - if (c == '=') { - out->token = SL_PP_DIVASSIGN; - } else { - _pure_ungetc(context, c); - out->token = SL_PP_SLASH; - } - break; - - case '%': - c = _pure_getc(context); - if (c == PURE_ERROR) { - return -1; - } - if (c == '=') { - out->token = SL_PP_MODASSIGN; - } else { - _pure_ungetc(context, c); - out->token = SL_PP_MODULO; - } - break; - - case '<': - c = _pure_getc(context); - if (c == PURE_ERROR) { - return -1; - } - if (c == '<') { - c = _pure_getc(context); - if (c == PURE_ERROR) { - return -1; - } - if (c == '=') { - out->token = SL_PP_LSHIFTASSIGN; - } else { - _pure_ungetc(context, c); - out->token = SL_PP_LSHIFT; - } - } else if (c == '=') { - out->token = SL_PP_LESSEQUAL; - } else { - _pure_ungetc(context, c); - out->token = SL_PP_LESS; - } - break; - - case '>': - c = _pure_getc(context); - if (c == PURE_ERROR) { - return -1; - } - if (c == '>') { - c = _pure_getc(context); - if (c == PURE_ERROR) { - return -1; - } - if (c == '=') { - out->token = SL_PP_RSHIFTASSIGN; - } else { - _pure_ungetc(context, c); - out->token = SL_PP_RSHIFT; - } - } else if (c == '=') { - out->token = SL_PP_GREATEREQUAL; - } else { - _pure_ungetc(context, c); - out->token = SL_PP_GREATER; - } - break; - - case '=': - c = _pure_getc(context); - if (c == PURE_ERROR) { - return -1; - } - if (c == '=') { - out->token = SL_PP_EQUAL; - } else { - _pure_ungetc(context, c); - out->token = SL_PP_ASSIGN; - } - break; - - case '&': - c = _pure_getc(context); - if (c == PURE_ERROR) { - return -1; - } - if (c == '&') { - out->token = SL_PP_AND; - } else if (c == '=') { - out->token = SL_PP_BITANDASSIGN; - } else { - _pure_ungetc(context, c); - out->token = SL_PP_BITAND; - } - break; - - case '^': - c = _pure_getc(context); - if (c == PURE_ERROR) { - return -1; - } - if (c == '^') { - out->token = SL_PP_XOR; - } else if (c == '=') { - out->token = SL_PP_BITXORASSIGN; - } else { - _pure_ungetc(context, c); - out->token = SL_PP_BITXOR; - } - break; - - case '|': - c = _pure_getc(context); - if (c == PURE_ERROR) { - return -1; - } - if (c == '|') { - out->token = SL_PP_OR; - } else if (c == '=') { - out->token = SL_PP_BITORASSIGN; - } else { - _pure_ungetc(context, c); - out->token = SL_PP_BITOR; - } - break; - - case '?': - out->token = SL_PP_QUESTION; - break; - - case ':': - out->token = SL_PP_COLON; - break; - - case '\0': - out->token = SL_PP_EOF; - break; - - case PURE_ERROR: - return -1; - - default: - if ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || c == '_') { - _pure_ungetc(context, c); - if (_tokenise_identifier(context, out)) { - return -1; - } - } else if (c >= '0' && c <= '9') { - _pure_ungetc(context, c); - if (_tokenise_number(context, out)) { - return -1; - } - } else { - out->data.other = c; - out->token = SL_PP_OTHER; - } - } - - return 0; -} - - -int -sl_pp_tokenise(struct sl_pp_context *context, - struct sl_pp_token_info **output) -{ - struct sl_pp_token_info *out = NULL; - unsigned int out_len = 0; - unsigned int out_max = 0; - - for (;;) { - struct sl_pp_token_info info; - - if (sl_pp_token_buffer_get(&context->tokens, &info)) { - free(out); - return -1; - } - - if (out_len >= out_max) { - unsigned int new_max = out_max; - - if (new_max < 0x100) { - new_max = 0x100; - } else if (new_max < 0x10000) { - new_max *= 2; - } else { - new_max += 0x10000; - } - - out = realloc(out, new_max * sizeof(struct sl_pp_token_info)); - if (!out) { - strcpy(context->error_msg, "out of memory"); - return -1; - } - out_max = new_max; - } - - out[out_len++] = info; - - if (info.token == SL_PP_EOF) { - break; - } - } - - *output = out; - return 0; -} diff --git a/src/glsl/pp/sl_pp_token.h b/src/glsl/pp/sl_pp_token.h deleted file mode 100644 index a12b193401..0000000000 --- a/src/glsl/pp/sl_pp_token.h +++ /dev/null @@ -1,133 +0,0 @@ -/************************************************************************** - * - * Copyright 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, 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 TUNGSTEN GRAPHICS AND/OR ITS 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. - * - **************************************************************************/ - -#ifndef SL_PP_TOKEN_H -#define SL_PP_TOKEN_H - - -struct sl_pp_context; - -enum sl_pp_token { - SL_PP_WHITESPACE, - SL_PP_NEWLINE, - SL_PP_HASH, /* # */ - - SL_PP_COMMA, /* , */ - SL_PP_SEMICOLON, /* ; */ - SL_PP_LBRACE, /* { */ - SL_PP_RBRACE, /* } */ - SL_PP_LPAREN, /* ( */ - SL_PP_RPAREN, /* ) */ - SL_PP_LBRACKET, /* [ */ - SL_PP_RBRACKET, /* ] */ - SL_PP_DOT, /* . */ - SL_PP_INCREMENT, /* ++ */ - SL_PP_ADDASSIGN, /* += */ - SL_PP_PLUS, /* + */ - SL_PP_DECREMENT, /* -- */ - SL_PP_SUBASSIGN, /* -= */ - SL_PP_MINUS, /* - */ - SL_PP_BITNOT, /* ~ */ - SL_PP_NOTEQUAL, /* != */ - SL_PP_NOT, /* ! */ - SL_PP_MULASSIGN, /* *= */ - SL_PP_STAR, /* * */ - SL_PP_DIVASSIGN, /* /= */ - SL_PP_SLASH, /* / */ - SL_PP_MODASSIGN, /* %= */ - SL_PP_MODULO, /* % */ - SL_PP_LSHIFTASSIGN, /* <<= */ - SL_PP_LSHIFT, /* << */ - SL_PP_LESSEQUAL, /* <= */ - SL_PP_LESS, /* < */ - SL_PP_RSHIFTASSIGN, /* >>= */ - SL_PP_RSHIFT, /* >> */ - SL_PP_GREATEREQUAL, /* >= */ - SL_PP_GREATER, /* > */ - SL_PP_EQUAL, /* == */ - SL_PP_ASSIGN, /* = */ - SL_PP_AND, /* && */ - SL_PP_BITANDASSIGN, /* &= */ - SL_PP_BITAND, /* & */ - SL_PP_XOR, /* ^^ */ - SL_PP_BITXORASSIGN, /* ^= */ - SL_PP_BITXOR, /* ^ */ - SL_PP_OR, /* || */ - SL_PP_BITORASSIGN, /* |= */ - SL_PP_BITOR, /* | */ - SL_PP_QUESTION, /* ? */ - SL_PP_COLON, /* : */ - - SL_PP_IDENTIFIER, - - SL_PP_UINT, - SL_PP_FLOAT, - - SL_PP_OTHER, - - SL_PP_PRAGMA_OPTIMIZE, - SL_PP_PRAGMA_DEBUG, - - SL_PP_EXTENSION_REQUIRE, - SL_PP_EXTENSION_ENABLE, - SL_PP_EXTENSION_WARN, - SL_PP_EXTENSION_DISABLE, - - SL_PP_LINE, - - SL_PP_EOF -}; - -union sl_pp_token_data { - int identifier; - int _uint; - int _float; - char other; - int pragma; - int extension; - struct { - unsigned int lineno: 24; - unsigned int fileno: 8; - } line; -}; - -struct sl_pp_token_info { - enum sl_pp_token token; - union sl_pp_token_data data; -}; - -struct sl_pp_purify_options; - -int -sl_pp_token_get(struct sl_pp_context *context, - struct sl_pp_token_info *out); - -int -sl_pp_tokenise(struct sl_pp_context *context, - struct sl_pp_token_info **output); - -#endif /* SL_PP_TOKEN_H */ diff --git a/src/glsl/pp/sl_pp_token_util.c b/src/glsl/pp/sl_pp_token_util.c deleted file mode 100644 index 43be49670b..0000000000 --- a/src/glsl/pp/sl_pp_token_util.c +++ /dev/null @@ -1,183 +0,0 @@ -/************************************************************************** - * - * Copyright 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, 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 TUNGSTEN GRAPHICS AND/OR ITS 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. - * - **************************************************************************/ - -#include -#include -#include "sl_pp_token_util.h" -#include "sl_pp_token.h" - - -int -sl_pp_token_buffer_init(struct sl_pp_token_buffer *buffer, - struct sl_pp_context *context) -{ - buffer->context = context; - buffer->size = 0; - buffer->capacity = 64; - buffer->tokens = malloc(buffer->capacity * sizeof(struct sl_pp_token_info)); - if (!buffer->tokens) { - return -1; - } - return 0; -} - -void -sl_pp_token_buffer_destroy(struct sl_pp_token_buffer *buffer) -{ - free(buffer->tokens); -} - -int -sl_pp_token_buffer_get(struct sl_pp_token_buffer *buffer, - struct sl_pp_token_info *out) -{ - /* Pop from stack first if not empty. */ - if (buffer->size) { - *out = buffer->tokens[--buffer->size]; - return 0; - } - - assert(buffer->context); - return sl_pp_token_get(buffer->context, out); -} - -void -sl_pp_token_buffer_unget(struct sl_pp_token_buffer *buffer, - const struct sl_pp_token_info *in) -{ - /* Resize if needed. */ - if (buffer->size == buffer->capacity) { - buffer->capacity += 64; - buffer->tokens = realloc(buffer->tokens, - buffer->capacity * sizeof(struct sl_pp_token_info)); - assert(buffer->tokens); - } - - /* Push token on stack. */ - buffer->tokens[buffer->size++] = *in; -} - -int -sl_pp_token_buffer_skip_white(struct sl_pp_token_buffer *buffer, - struct sl_pp_token_info *out) -{ - if (sl_pp_token_buffer_get(buffer, out)) { - return -1; - } - - while (out->token == SL_PP_WHITESPACE) { - if (sl_pp_token_buffer_get(buffer, out)) { - return -1; - } - } - - return 0; -} - - - -int -sl_pp_token_peek_init(struct sl_pp_token_peek *peek, - struct sl_pp_token_buffer *buffer) -{ - peek->buffer = buffer; - peek->size = 0; - peek->capacity = 64; - peek->tokens = malloc(peek->capacity * sizeof(struct sl_pp_token_info)); - if (!peek->tokens) { - return -1; - } - return 0; -} - -void -sl_pp_token_peek_destroy(struct sl_pp_token_peek *peek) -{ - /* Abort. */ - while (peek->size) { - sl_pp_token_buffer_unget(peek->buffer, &peek->tokens[--peek->size]); - } - free(peek->tokens); -} - -int -sl_pp_token_peek_get(struct sl_pp_token_peek *peek, - struct sl_pp_token_info *out) -{ - /* Get token from buffer. */ - if (sl_pp_token_buffer_get(peek->buffer, out)) { - return -1; - } - - /* Save it. */ - if (peek->size == peek->capacity) { - peek->capacity += 64; - peek->tokens = realloc(peek->tokens, - peek->capacity * sizeof(struct sl_pp_token_info)); - assert(peek->tokens); - } - peek->tokens[peek->size++] = *out; - return 0; -} - -void -sl_pp_token_peek_commit(struct sl_pp_token_peek *peek) -{ - peek->size = 0; -} - -int -sl_pp_token_peek_to_buffer(const struct sl_pp_token_peek *peek, - struct sl_pp_token_buffer *buffer) -{ - unsigned int i; - - if (sl_pp_token_buffer_init(buffer, NULL)) { - return -1; - } - for (i = peek->size; i > 0; i--) { - sl_pp_token_buffer_unget(buffer, &peek->tokens[i - 1]); - } - return 0; -} - -int -sl_pp_token_peek_skip_white(struct sl_pp_token_peek *peek, - struct sl_pp_token_info *out) -{ - if (sl_pp_token_peek_get(peek, out)) { - return -1; - } - - while (out->token == SL_PP_WHITESPACE) { - if (sl_pp_token_peek_get(peek, out)) { - return -1; - } - } - - return 0; -} diff --git a/src/glsl/pp/sl_pp_token_util.h b/src/glsl/pp/sl_pp_token_util.h deleted file mode 100644 index 35d72101ca..0000000000 --- a/src/glsl/pp/sl_pp_token_util.h +++ /dev/null @@ -1,98 +0,0 @@ -/************************************************************************** - * - * Copyright 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, 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 TUNGSTEN GRAPHICS AND/OR ITS 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. - * - **************************************************************************/ - -#ifndef SL_PP_TOKEN_UTIL_H -#define SL_PP_TOKEN_UTIL_H - -struct sl_pp_context; - -/* - * A token buffer allows one to get and unget a token - * from a preprocessor context. - */ -struct sl_pp_token_buffer { - struct sl_pp_context *context; - unsigned int size; - unsigned int capacity; - struct sl_pp_token_info *tokens; -}; - -int -sl_pp_token_buffer_init(struct sl_pp_token_buffer *buffer, - struct sl_pp_context *context); - -void -sl_pp_token_buffer_destroy(struct sl_pp_token_buffer *buffer); - -int -sl_pp_token_buffer_get(struct sl_pp_token_buffer *buffer, - struct sl_pp_token_info *out); - -void -sl_pp_token_buffer_unget(struct sl_pp_token_buffer *buffer, - const struct sl_pp_token_info *in); - -int -sl_pp_token_buffer_skip_white(struct sl_pp_token_buffer *buffer, - struct sl_pp_token_info *out); - - -/* - * A token peek allows one to get a number of tokens from a buffer - * and then either commit the operation or abort it, - * effectively ungetting the peeked tokens. - */ -struct sl_pp_token_peek { - struct sl_pp_token_buffer *buffer; - unsigned int size; - unsigned int capacity; - struct sl_pp_token_info *tokens; -}; - -int -sl_pp_token_peek_init(struct sl_pp_token_peek *peek, - struct sl_pp_token_buffer *buffer); - -void -sl_pp_token_peek_destroy(struct sl_pp_token_peek *peek); - -int -sl_pp_token_peek_get(struct sl_pp_token_peek *peek, - struct sl_pp_token_info *out); - -void -sl_pp_token_peek_commit(struct sl_pp_token_peek *peek); - -int -sl_pp_token_peek_to_buffer(const struct sl_pp_token_peek *peek, - struct sl_pp_token_buffer *buffer); - -int -sl_pp_token_peek_skip_white(struct sl_pp_token_peek *peek, - struct sl_pp_token_info *out); - -#endif /* SL_PP_TOKEN_UTIL_H */ diff --git a/src/glsl/pp/sl_pp_version.c b/src/glsl/pp/sl_pp_version.c deleted file mode 100644 index 6735c05e8a..0000000000 --- a/src/glsl/pp/sl_pp_version.c +++ /dev/null @@ -1,162 +0,0 @@ -/************************************************************************** - * - * Copyright 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, 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 TUNGSTEN GRAPHICS AND/OR ITS 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. - * - **************************************************************************/ - -#include -#include -#include "sl_pp_public.h" -#include "sl_pp_context.h" -#include "sl_pp_token.h" - - -int -sl_pp_version(struct sl_pp_context *context, - unsigned int *version) -{ - struct sl_pp_token_peek peek; - unsigned int line = context->line; - - /* Default values if `#version' is not present. */ - *version = 110; - - if (sl_pp_token_peek_init(&peek, &context->tokens)) { - return -1; - } - - /* There can be multiple `#version' directives present. - * Accept the value of the last one. - */ - for (;;) { - struct sl_pp_token_info input; - int found_hash = 0; - int found_version = 0; - int found_number = 0; - int found_end = 0; - - /* Skip whitespace and newlines and seek for hash. */ - while (!found_hash) { - if (sl_pp_token_peek_get(&peek, &input)) { - sl_pp_token_peek_destroy(&peek); - return -1; - } - - switch (input.token) { - case SL_PP_NEWLINE: - line++; - break; - - case SL_PP_WHITESPACE: - break; - - case SL_PP_HASH: - found_hash = 1; - break; - - default: - sl_pp_token_peek_destroy(&peek); - return 0; - } - } - - /* Skip whitespace and seek for `version'. */ - while (!found_version) { - if (sl_pp_token_peek_get(&peek, &input)) { - sl_pp_token_peek_destroy(&peek); - return -1; - } - - switch (input.token) { - case SL_PP_WHITESPACE: - break; - - case SL_PP_IDENTIFIER: - if (input.data.identifier != context->dict.version) { - sl_pp_token_peek_destroy(&peek); - return 0; - } - found_version = 1; - break; - - default: - sl_pp_token_peek_destroy(&peek); - return 0; - } - } - - sl_pp_token_peek_commit(&peek); - - /* Skip whitespace and seek for version number. */ - while (!found_number) { - if (sl_pp_token_buffer_get(&context->tokens, &input)) { - sl_pp_token_peek_destroy(&peek); - return -1; - } - - switch (input.token) { - case SL_PP_WHITESPACE: - break; - - case SL_PP_UINT: - *version = atoi(sl_pp_context_cstr(context, input.data._uint)); - found_number = 1; - break; - - default: - strcpy(context->error_msg, "expected version number after `#version'"); - sl_pp_token_peek_destroy(&peek); - return -1; - } - } - - /* Skip whitespace and seek for either newline or eof. */ - while (!found_end) { - if (sl_pp_token_buffer_get(&context->tokens, &input)) { - sl_pp_token_peek_destroy(&peek); - return -1; - } - - switch (input.token) { - case SL_PP_WHITESPACE: - break; - - case SL_PP_NEWLINE: - line++; - /* pass thru */ - case SL_PP_EOF: - context->line = line; - found_end = 1; - break; - - default: - strcpy(context->error_msg, "expected end of line after version number"); - sl_pp_token_peek_destroy(&peek); - return -1; - } - } - } - - /* Should not get here. */ -} diff --git a/src/mesa/drivers/glslcompiler/Makefile b/src/mesa/drivers/glslcompiler/Makefile deleted file mode 100644 index 6da9f93f59..0000000000 --- a/src/mesa/drivers/glslcompiler/Makefile +++ /dev/null @@ -1,43 +0,0 @@ -# Makefile for stand-alone GL-SL compiler - -TOP = ../../../.. - -include $(TOP)/configs/current - - -PROGRAM = glslcompiler - -OBJECTS = \ - glslcompiler.o \ - ../common/driverfuncs.o \ - ../../libmesa.a \ - $(TOP)/src/mapi/glapi/libglapi.a - -INCLUDES = \ - -I$(TOP)/include \ - -I$(TOP)/include/GL/internal \ - -I$(TOP)/src/mapi \ - -I$(TOP)/src/mesa \ - -I$(TOP)/src/mesa/main \ - -I$(TOP)/src/mesa/glapi \ - -I$(TOP)/src/mesa/math \ - -I$(TOP)/src/mesa/transform \ - -I$(TOP)/src/mesa/shader \ - -I$(TOP)/src/mesa/swrast \ - -I$(TOP)/src/mesa/swrast_setup \ - - -default: $(PROGRAM) - $(INSTALL) $(PROGRAM) $(TOP)/bin - - -glslcompiler: $(OBJECTS) - $(CC) $(OBJECTS) $(GL_LIB_DEPS) -o $@ - - -glslcompiler.o: glslcompiler.c - $(CC) -c $(INCLUDES) $(CFLAGS) glslcompiler.c -o $@ - - -clean: - -rm -f *.o *~ $(PROGRAM) diff --git a/src/mesa/drivers/glslcompiler/glslcompiler.c b/src/mesa/drivers/glslcompiler/glslcompiler.c deleted file mode 100644 index 7259bf4c56..0000000000 --- a/src/mesa/drivers/glslcompiler/glslcompiler.c +++ /dev/null @@ -1,436 +0,0 @@ -/* - * Mesa 3-D graphics library - * Version: 6.5.3 - * - * Copyright (C) 1999-2007 Brian Paul, Tungsten Graphics, 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. - */ - -/** - * \mainpage - * - * Stand-alone Shading Language compiler. - * Basically, a command-line program which accepts GLSL shaders and emits - * vertex/fragment programs (GPU instructions). - * - * This file is basically just a Mesa device driver but instead of building - * a shared library we build an executable. - * - * We can emit programs in three different formats: - * 1. ARB-style (GL_ARB_vertex/fragment_program) - * 2. NV-style (GL_NV_vertex/fragment_program) - * 3. debug-style (a slightly more sophisticated, internal format) - * - * Note that the ARB and NV program languages can't express all the - * features that might be used by a fragment program (examples being - * uniform and varying vars). So, the ARB/NV programs that are - * emitted aren't always legal programs in those languages. - */ - - -#include "main/imports.h" -#include "main/context.h" -#include "main/extensions.h" -#include "main/framebuffer.h" -#include "main/shaderapi.h" -#include "main/shaderobj.h" -#include "program/prog_print.h" -#include "drivers/common/driverfuncs.h" -#include "tnl/tnl.h" -#include "tnl/t_context.h" -#include "tnl/t_pipeline.h" -#include "swrast/swrast.h" -#include "swrast_setup/swrast_setup.h" -#include "vbo/vbo.h" - - -static const char *Prog = "glslcompiler"; - - -struct options { - GLboolean LineNumbers; - GLboolean Link; - gl_prog_print_mode Mode; - const char *VertFile; - const char *FragFile; - const char *GeoFile; - const char *OutputFile; - GLboolean Params; - struct gl_sl_pragmas Pragmas; -}; - -static struct options Options; - - -/** - * GLSL compiler driver context. (kind of an artificial thing for now) - */ -struct compiler_context -{ - GLcontext MesaContext; - int foo; -}; - -typedef struct compiler_context CompilerContext; - - - -static void -UpdateState(GLcontext *ctx, GLuint new_state) -{ - /* easy - just propogate */ - _swrast_InvalidateState( ctx, new_state ); - _swsetup_InvalidateState( ctx, new_state ); - _tnl_InvalidateState( ctx, new_state ); - _vbo_InvalidateState( ctx, new_state ); -} - - - -static GLboolean -CreateContext(void) -{ - struct dd_function_table ddFuncs; - GLvisual *vis; - GLframebuffer *buf; - GLcontext *ctx; - CompilerContext *cc; - - vis = _mesa_create_visual(GL_FALSE, GL_FALSE, /* RGB */ - 8, 8, 8, 8, /* color */ - 0, 0, /* z, stencil */ - 0, 0, 0, 0, 1); /* accum */ - buf = _mesa_create_framebuffer(vis); - - cc = calloc(1, sizeof(*cc)); - if (!vis || !buf || !cc) { - if (vis) - _mesa_destroy_visual(vis); - if (buf) - _mesa_destroy_framebuffer(buf); - free(cc); - return GL_FALSE; - } - - _mesa_init_driver_functions(&ddFuncs); - ddFuncs.GetString = NULL;/*get_string;*/ - ddFuncs.UpdateState = UpdateState; - ddFuncs.GetBufferSize = NULL; - - ctx = &cc->MesaContext; - _mesa_initialize_context(ctx, vis, NULL, &ddFuncs, cc); - _mesa_enable_sw_extensions(ctx); - - if (!_swrast_CreateContext( ctx ) || - !_vbo_CreateContext( ctx ) || - !_tnl_CreateContext( ctx ) || - !_swsetup_CreateContext( ctx )) { - _mesa_destroy_visual(vis); - _mesa_destroy_framebuffer(buf); - _mesa_free_context_data(ctx); - free(cc); - return GL_FALSE; - } - TNL_CONTEXT(ctx)->Driver.RunPipeline = _tnl_run_pipeline; - _swsetup_Wakeup( ctx ); - - /* Override the context's default pragma settings */ - ctx->Shader.DefaultPragmas = Options.Pragmas; - - _mesa_make_current(ctx, buf, buf); - - return GL_TRUE; -} - - -static void -LoadAndCompileShader(GLuint shader, const char *text) -{ - GLint stat; - _mesa_ShaderSourceARB(shader, 1, (const GLchar **) &text, NULL); - _mesa_CompileShaderARB(shader); - _mesa_GetShaderiv(shader, GL_COMPILE_STATUS, &stat); - if (!stat) { - GLchar log[1000]; - GLsizei len; - _mesa_GetShaderInfoLog(shader, 1000, &len, log); - fprintf(stderr, "%s: problem compiling shader: %s\n", Prog, log); - exit(1); - } - else { - printf("Shader compiled OK\n"); - } -} - - -/** - * Read a shader from a file. - */ -static void -ReadShader(GLuint shader, const char *filename) -{ - const int max = 100*1000; - int n; - char *buffer = (char*) malloc(max); - FILE *f = fopen(filename, "r"); - if (!f) { - fprintf(stderr, "%s: Unable to open shader file %s\n", Prog, filename); - exit(1); - } - - n = fread(buffer, 1, max, f); - /* - printf("%s: read %d bytes from shader file %s\n", Prog, n, filename); - */ - if (n > 0) { - buffer[n] = 0; - LoadAndCompileShader(shader, buffer); - } - - fclose(f); - free(buffer); -} - - -static void -CheckLink(GLuint v_shader, GLuint f_shader) -{ - GLuint prog; - GLint stat; - - prog = _mesa_CreateProgram(); - - _mesa_AttachShader(prog, v_shader); - _mesa_AttachShader(prog, f_shader); - - _mesa_LinkProgramARB(prog); - _mesa_GetProgramiv(prog, GL_LINK_STATUS, &stat); - if (!stat) { - GLchar log[1000]; - GLsizei len; - _mesa_GetProgramInfoLog(prog, 1000, &len, log); - fprintf(stderr, "Linker error:\n%s\n", log); - } - else { - fprintf(stderr, "Link success!\n"); - } -} - - -static void -PrintShaderInstructions(GLuint shader, FILE *f) -{ - GET_CURRENT_CONTEXT(ctx); - struct gl_shader *sh = _mesa_lookup_shader(ctx, shader); - struct gl_program *prog = sh->Program; - _mesa_fprint_program_opt(stdout, prog, Options.Mode, Options.LineNumbers); - if (Options.Params) - _mesa_print_program_parameters(ctx, prog); -} - - -static GLuint -CompileShader(const char *filename, GLenum type) -{ - GLuint shader; - - assert(type == GL_FRAGMENT_SHADER || - type == GL_VERTEX_SHADER || - type == GL_GEOMETRY_SHADER_ARB); - - shader = _mesa_CreateShader(type); - ReadShader(shader, filename); - - return shader; -} - - -static void -Usage(void) -{ - printf("Mesa GLSL stand-alone compiler\n"); - printf("Usage:\n"); - printf(" --vs FILE vertex shader input filename\n"); - printf(" --fs FILE fragment shader input filename\n"); - printf(" --gs FILE geometry shader input filename\n"); - printf(" --arb emit ARB-style instructions\n"); - printf(" --nv emit NV-style instructions\n"); - printf(" --link run linker\n"); - printf(" --debug force #pragma debug(on)\n"); - printf(" --nodebug force #pragma debug(off)\n"); - printf(" --opt force #pragma optimize(on)\n"); - printf(" --noopt force #pragma optimize(off)\n"); - printf(" --number, -n emit line numbers (if --arb or --nv)\n"); - printf(" --output, -o FILE output filename\n"); - printf(" --params also emit program parameter info\n"); - printf(" --help display this information\n"); -} - - -static void -ParseOptions(int argc, char *argv[]) -{ - int i; - - Options.LineNumbers = GL_FALSE; - Options.Mode = PROG_PRINT_DEBUG; - Options.VertFile = NULL; - Options.FragFile = NULL; - Options.GeoFile = NULL; - Options.OutputFile = NULL; - Options.Params = GL_FALSE; - Options.Pragmas.IgnoreOptimize = GL_FALSE; - Options.Pragmas.IgnoreDebug = GL_FALSE; - Options.Pragmas.Debug = GL_FALSE; - Options.Pragmas.Optimize = GL_TRUE; - - if (argc == 1) { - Usage(); - exit(0); - } - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "--vs") == 0) { - Options.VertFile = argv[i + 1]; - i++; - } - else if (strcmp(argv[i], "--fs") == 0) { - Options.FragFile = argv[i + 1]; - i++; - } - else if (strcmp(argv[i], "--gs") == 0) { - Options.GeoFile = argv[i + 1]; - i++; - } - else if (strcmp(argv[i], "--arb") == 0) { - Options.Mode = PROG_PRINT_ARB; - } - else if (strcmp(argv[i], "--nv") == 0) { - Options.Mode = PROG_PRINT_NV; - } - else if (strcmp(argv[i], "--link") == 0) { - Options.Link = GL_TRUE; - } - else if (strcmp(argv[i], "--debug") == 0) { - Options.Pragmas.IgnoreDebug = GL_TRUE; - Options.Pragmas.Debug = GL_TRUE; - } - else if (strcmp(argv[i], "--nodebug") == 0) { - Options.Pragmas.IgnoreDebug = GL_TRUE; - Options.Pragmas.Debug = GL_FALSE; - } - else if (strcmp(argv[i], "--opt") == 0) { - Options.Pragmas.IgnoreOptimize = GL_TRUE; - Options.Pragmas.Optimize = GL_TRUE; - } - else if (strcmp(argv[i], "--noopt") == 0) { - Options.Pragmas.IgnoreOptimize = GL_TRUE; - Options.Pragmas.Optimize = GL_FALSE; - } - else if (strcmp(argv[i], "--number") == 0 || - strcmp(argv[i], "-n") == 0) { - Options.LineNumbers = GL_TRUE; - } - else if (strcmp(argv[i], "--output") == 0 || - strcmp(argv[i], "-o") == 0) { - Options.OutputFile = argv[i + 1]; - i++; - } - else if (strcmp(argv[i], "--params") == 0) { - Options.Params = GL_TRUE; - } - else if (strcmp(argv[i], "--help") == 0) { - Usage(); - exit(0); - } - else { - printf("Unknown option: %s\n", argv[i]); - Usage(); - exit(1); - } - } - - if (Options.Mode == PROG_PRINT_DEBUG) { - /* always print line numbers when emitting debug-style output */ - Options.LineNumbers = GL_TRUE; - } -} - - -int -main(int argc, char *argv[]) -{ - GLuint v_shader = 0, f_shader = 0, g_shader = 0; - - ParseOptions(argc, argv); - - if (!CreateContext()) { - fprintf(stderr, "%s: Failed to create compiler context\n", Prog); - exit(1); - } - - if (Options.VertFile) { - v_shader = CompileShader(Options.VertFile, GL_VERTEX_SHADER); - } - - if (Options.FragFile) { - f_shader = CompileShader(Options.FragFile, GL_FRAGMENT_SHADER); - } - - if (Options.GeoFile) { - g_shader = CompileShader(Options.GeoFile, GL_GEOMETRY_SHADER_ARB); - } - - - if (v_shader || f_shader || g_shader) { - if (Options.OutputFile) { - FILE *f; - fclose(stdout); - /*stdout =*/ f = freopen(Options.OutputFile, "w", stdout); - if (!f) { - fprintf(stderr, "freopen error\n"); - } - } - if (stdout && v_shader) { - PrintShaderInstructions(v_shader, stdout); - } - if (stdout && f_shader) { - PrintShaderInstructions(f_shader, stdout); - } - if (stdout && g_shader) { - PrintShaderInstructions(g_shader, stdout); - } - if (Options.OutputFile) { - fclose(stdout); - } - } - - if (Options.Link) { - if (!v_shader || !f_shader) { - fprintf(stderr, - "--link option requires both a vertex and fragment shader.\n"); - exit(1); - } - - CheckLink(v_shader, f_shader); - } - - return 0; -} diff --git a/src/mesa/slang/descrip.mms b/src/mesa/slang/descrip.mms deleted file mode 100644 index 674b786ac0..0000000000 --- a/src/mesa/slang/descrip.mms +++ /dev/null @@ -1,67 +0,0 @@ -# Makefile for core library for VMS -# contributed by Jouk Jansen joukj@hrem.nano.tudelft.nl -# Last revision : 3 October 2007 - -.first - define gl [----.include.gl] - define math [--.math] - define swrast [--.swrast] - define array_cache [--.array_cache] - define main [--.main] - define glapi [--.glapi] - define shader [--.shader] - -.include [----]mms-config. - -##### MACROS ##### - -VPATH = RCS - -INCDIR = [----.include],[--.main],[--.glapi],[-.slang],[-] -LIBDIR = [----.lib] -CFLAGS = /include=($(INCDIR),[])/define=(PTHREADS=1)/name=(as_is,short)/float=ieee/ieee=denorm - -SOURCES = \ - slang_compile.c - -OBJECTS = slang_builtin.obj,slang_codegen.obj,slang_compile.obj,\ - slang_compile_function.obj,slang_compile_operation.obj,\ - slang_compile_struct.obj,slang_compile_variable.obj,slang_emit.obj,\ - slang_ir.obj,slang_label.obj,slang_library_noise.obj,slang_link.obj,\ - slang_log.obj,slang_mem.obj,slang_preprocess.obj,slang_print.obj,\ - slang_simplify.obj,slang_storage.obj,slang_typeinfo.obj,\ - slang_utility.obj,slang_vartable.obj - -##### RULES ##### - -VERSION=Mesa V3.4 - -##### TARGETS ##### -# Make the library -$(LIBDIR)$(GL_LIB) : $(OBJECTS) - @ library $(LIBDIR)$(GL_LIB) $(OBJECTS) - -clean : - purge - delete *.obj;* - -slang_builtin.obj : slang_builtin.c -slang_codegen.obj : slang_codegen.c -slang_compile.obj : slang_compile.c -slang_compile_function.obj : slang_compile_function.c -slang_compile_operation.obj : slang_compile_operation.c -slang_compile_struct.obj : slang_compile_struct.c -slang_compile_variable.obj : slang_compile_variable.c -slang_emit.obj : slang_emit.c -slang_ir.obj : slang_ir.c -slang_label.obj : slang_label.c -slang_library_noise.obj : slang_library_noise.c -slang_link.obj : slang_link.c -slang_log.obj : slang_log.c -slang_mem.obj : slang_mem.c -slang_print.obj : slang_print.c -slang_simplify.obj : slang_simplify.c -slang_storage.obj : slang_storage.c -slang_typeinfo.obj : slang_typeinfo.c -slang_utility.obj : slang_utility.c -slang_vartable.obj : slang_vartable.c diff --git a/src/mesa/slang/library/.gitignore b/src/mesa/slang/library/.gitignore deleted file mode 100644 index 02a89fc7df..0000000000 --- a/src/mesa/slang/library/.gitignore +++ /dev/null @@ -1 +0,0 @@ -*_gc.h diff --git a/src/mesa/slang/library/Makefile b/src/mesa/slang/library/Makefile deleted file mode 100644 index f546a03907..0000000000 --- a/src/mesa/slang/library/Makefile +++ /dev/null @@ -1,54 +0,0 @@ -# src/mesa/slang/library/Makefile - -TOP = ../../../.. - -include $(TOP)/configs/current - -GLSL_CL = $(TOP)/src/glsl/apps/compile - -# -# targets -# - -.PHONY: default clean - -default: builtin - -clean: - -rm -f *_gc.h - -builtin: builtin_110 builtin_120 - -# -# builtin library sources -# - -builtin_110: slang_common_builtin_gc.h slang_core_gc.h slang_fragment_builtin_gc.h slang_vertex_builtin_gc.h slang_geometry_builtin_gc.h - -builtin_120: slang_120_core_gc.h slang_builtin_120_common_gc.h slang_builtin_120_fragment_gc.h - - -slang_120_core_gc.h: slang_120_core.gc - $(GLSL_CL) fragment slang_120_core.gc slang_120_core_gc.h - -slang_builtin_120_common_gc.h: slang_builtin_120_common.gc - $(GLSL_CL) fragment slang_builtin_120_common.gc slang_builtin_120_common_gc.h - -slang_builtin_120_fragment_gc.h: slang_builtin_120_fragment.gc - $(GLSL_CL) fragment slang_builtin_120_fragment.gc slang_builtin_120_fragment_gc.h - -slang_common_builtin_gc.h: slang_common_builtin.gc - $(GLSL_CL) fragment slang_common_builtin.gc slang_common_builtin_gc.h - -slang_core_gc.h: slang_core.gc - $(GLSL_CL) fragment slang_core.gc slang_core_gc.h - -slang_fragment_builtin_gc.h: slang_fragment_builtin.gc - $(GLSL_CL) fragment slang_fragment_builtin.gc slang_fragment_builtin_gc.h - -slang_vertex_builtin_gc.h: slang_vertex_builtin.gc - $(GLSL_CL) vertex slang_vertex_builtin.gc slang_vertex_builtin_gc.h - -slang_geometry_builtin_gc.h: slang_geometry_builtin.gc - $(GLSL_CL) geometry slang_geometry_builtin.gc slang_geometry_builtin_gc.h - diff --git a/src/mesa/slang/library/SConscript b/src/mesa/slang/library/SConscript deleted file mode 100644 index 5112cefb3e..0000000000 --- a/src/mesa/slang/library/SConscript +++ /dev/null @@ -1,62 +0,0 @@ -####################################################################### -# SConscript for GLSL builtin library - -Import('*') - -env = env.Clone() - -# See also http://www.scons.org/wiki/UsingCodeGenerators - -def glsl_compile_emitter(target, source, env): - env.Depends(target, glsl_compile) - return (target, source) - -bld_frag = Builder( - action = Action(glsl_compile[0].abspath + ' fragment $SOURCE $TARGET', '$CODEGENCODESTR'), - emitter = glsl_compile_emitter, - suffix = '.gc', - src_suffix = '_gc.h') - -bld_vert = Builder( - action = Action(glsl_compile[0].abspath + ' vertex $SOURCE $TARGET', '$CODEGENCODESTR'), - emitter = glsl_compile_emitter, - suffix = '.gc', - src_suffix = '_gc.h') - -bld_geom = Builder( - action = Action(glsl_compile[0].abspath + ' geometry $SOURCE $TARGET', '$CODEGENCODESTR'), - emitter = glsl_compile_emitter, - suffix = '.gc', - src_suffix = '_gc.h') - -env['BUILDERS']['bld_frag'] = bld_frag -env['BUILDERS']['bld_vert'] = bld_vert -env['BUILDERS']['bld_geom'] = bld_geom - -# Generate GLSL builtin library binaries -env.bld_frag( - '#src/mesa/slang/library/slang_core_gc.h', - '#src/mesa/slang/library/slang_core.gc') -env.bld_frag( - '#src/mesa/slang/library/slang_common_builtin_gc.h', - '#src/mesa/slang/library/slang_common_builtin.gc') -env.bld_frag( - '#src/mesa/slang/library/slang_fragment_builtin_gc.h', - '#src/mesa/slang/library/slang_fragment_builtin.gc') -env.bld_vert( - '#src/mesa/slang/library/slang_vertex_builtin_gc.h', - '#src/mesa/slang/library/slang_vertex_builtin.gc') -env.bld_geom( - '#src/mesa/slang/library/slang_geometry_builtin_gc.h', - '#src/mesa/slang/library/slang_geometry_builtin.gc') - -# Generate GLSL 1.20 builtin library binaries -env.bld_frag( - '#src/mesa/slang/library/slang_120_core_gc.h', - '#src/mesa/slang/library/slang_120_core.gc') -env.bld_frag( - '#src/mesa/slang/library/slang_builtin_120_common_gc.h', - '#src/mesa/slang/library/slang_builtin_120_common.gc') -env.bld_frag( - '#src/mesa/slang/library/slang_builtin_120_fragment_gc.h', - '#src/mesa/slang/library/slang_builtin_120_fragment.gc') diff --git a/src/mesa/slang/library/slang_120_core.gc b/src/mesa/slang/library/slang_120_core.gc deleted file mode 100644 index 04c5ec2ec5..0000000000 --- a/src/mesa/slang/library/slang_120_core.gc +++ /dev/null @@ -1,1978 +0,0 @@ -/* - * Mesa 3-D graphics library - * Version: 6.5 - * - * Copyright (C) 2006 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. - */ - -// -// Constructors and operators introduced in GLSL 1.20 - mostly on new -// (non-square) types of matrices. -// -// One important change in the language is that when a matrix is used -// as an argument to a matrix constructor, it must be the only argument -// for the constructor. The compiler takes care of it by itself and -// here we only care to re-introduce constructors for old (square) -// types of matrices. -// - -// -// From Shader Spec, ver. 1.20, rev. 6 -// - -//// mat2x3: 2 columns of vec3 - -mat2x3 __constructor(const float f00, const float f10, const float f20, - const float f01, const float f11, const float f21) -{ - __retVal[0].x = f00; - __retVal[0].y = f10; - __retVal[0].z = f20; - __retVal[1].x = f01; - __retVal[1].y = f11; - __retVal[1].z = f21; -} - -mat2x3 __constructor(const float f) -{ - __retVal = mat2x3( f, 0.0, 0.0, - 0.0, f, 0.0); -} - -mat2x3 __constructor(const int i) -{ - const float f = float(i); - __retVal = mat2x3(f); -} - -mat2x3 __constructor(const bool b) -{ - const float f = float(b); - __retVal = mat2x3(f); -} - -mat2x3 __constructor(const vec3 c0, const vec3 c1) -{ - __retVal[0] = c0; - __retVal[1] = c1; -} - - - -//// mat2x4: 2 columns of vec4 - -mat2x4 __constructor(const float f00, const float f10, const float f20, const float f30, - const float f01, const float f11, const float f21, const float f31) -{ - __retVal[0].x = f00; - __retVal[0].y = f10; - __retVal[0].z = f20; - __retVal[0].w = f30; - __retVal[1].x = f01; - __retVal[1].y = f11; - __retVal[1].z = f21; - __retVal[1].w = f31; -} - -mat2x4 __constructor(const float f) -{ - __retVal = mat2x4( f, 0.0, 0.0, 0.0, - 0.0, f, 0.0, 0.0); -} - -mat2x4 __constructor(const int i) -{ - const float f = float(i); - __retVal = mat2x4(f); -} - -mat2x4 __constructor(const bool b) -{ - const float f = float(b); - __retVal = mat2x4(f); -} - -mat2x4 __constructor(const vec4 c0, const vec4 c1) -{ - __retVal[0] = c0; - __retVal[1] = c1; -} - - - -//// mat3x2: 3 columns of vec2 - -mat3x2 __constructor(const float f00, const float f10, - const float f01, const float f11, - const float f02, const float f12) -{ - __retVal[0].x = f00; - __retVal[0].y = f10; - __retVal[1].x = f01; - __retVal[1].y = f11; - __retVal[2].x = f02; - __retVal[2].y = f12; -} - -mat3x2 __constructor(const float f) -{ - __retVal = mat3x2( f, 0.0, - 0.0, f, - 0.0, 0.0); -} - -mat3x2 __constructor(const int i) -{ - const float f = float(i); - __retVal = mat3x2(f); -} - -mat3x2 __constructor(const bool b) -{ - const float f = float(b); - __retVal = mat3x2(f); -} - -mat3x2 __constructor(const vec2 c0, const vec2 c1, const vec2 c2) -{ - __retVal[0] = c0; - __retVal[1] = c1; - __retVal[2] = c2; -} - - - -//// mat3x4: 3 columns of vec4 - -mat3x4 __constructor(const float f00, const float f10, const float f20, const float f30, - const float f01, const float f11, const float f21, const float f31, - const float f02, const float f12, const float f22, const float f32) -{ - __retVal[0].x = f00; - __retVal[0].y = f10; - __retVal[0].z = f20; - __retVal[0].w = f30; - __retVal[1].x = f01; - __retVal[1].y = f11; - __retVal[1].z = f21; - __retVal[1].w = f31; - __retVal[2].x = f02; - __retVal[2].y = f12; - __retVal[2].z = f22; - __retVal[2].w = f32; -} - -mat3x4 __constructor(const float f) -{ - __retVal = mat3x4( f, 0.0, 0.0, 0.0, - 0.0, f, 0.0, 0.0, - 0.0, 0.0, f, 0.0); -} - -mat3x4 __constructor(const int i) -{ - const float f = float(i); - __retVal = mat3x4(f); -} - -mat3x4 __constructor(const bool b) -{ - const float f = float(b); - __retVal = mat3x4(f); -} - -mat3x4 __constructor(const vec4 c0, const vec4 c1, const vec4 c2) -{ - __retVal[0] = c0; - __retVal[1] = c1; - __retVal[2] = c2; -} - - - -//// mat4x2: 4 columns of vec2 - -mat4x2 __constructor(const float f00, const float f10, - const float f01, const float f11, - const float f02, const float f12, - const float f03, const float f13) -{ - __retVal[0].x = f00; - __retVal[0].y = f10; - __retVal[1].x = f01; - __retVal[1].y = f11; - __retVal[2].x = f02; - __retVal[2].y = f12; - __retVal[3].x = f03; - __retVal[3].y = f13; -} - -mat4x2 __constructor(const float f) -{ - __retVal = mat4x2( f, 0.0, - 0.0, 4, - 0.0, 0.0, - 0.0, 0.0); -} - -mat4x2 __constructor(const int i) -{ - const float f = float(i); - __retVal = mat4x2(f); -} - -mat4x2 __constructor(const bool b) -{ - const float f = float(b); - __retVal = mat4x2(f); -} - -mat4x2 __constructor(const vec2 c0, const vec2 c1, const vec2 c2, const vec2 c3) -{ - __retVal[0] = c0; - __retVal[1] = c1; - __retVal[2] = c2; - __retVal[3] = c3; -} - - - -//// mat4x3: 4 columns of vec3 - -mat4x3 __constructor(const float f00, const float f10, const float f20, - const float f01, const float f11, const float f21, - const float f02, const float f12, const float f22, - const float f03, const float f13, const float f23) -{ - __retVal[0].x = f00; - __retVal[0].y = f10; - __retVal[0].z = f20; - __retVal[1].x = f01; - __retVal[1].y = f11; - __retVal[1].z = f21; - __retVal[2].x = f02; - __retVal[2].y = f12; - __retVal[2].z = f22; - __retVal[3].x = f03; - __retVal[3].y = f13; - __retVal[3].z = f23; -} - -mat4x3 __constructor(const float f) -{ - __retVal = mat4x3( f, 0.0, 0.0, - 0.0, f, 0.0, - 0.0, 0.0, f, - 0.0, 0.0, 0.0); -} - -mat4x3 __constructor(const int i) -{ - const float f = float(i); - __retVal = mat4x3(f); -} - -mat4x3 __constructor(const bool b) -{ - const float f = float(b); - __retVal = mat4x3(f); -} - -mat4x3 __constructor(const vec3 c0, const vec3 c1, const vec3 c2, const vec3 c3) -{ - __retVal[0] = c0; - __retVal[1] = c1; - __retVal[2] = c2; - __retVal[3] = c3; -} - - - -//// misc assorted matrix constructors - -mat2 __constructor(const mat2 m) -{ - __retVal = m; -} - -mat2 __constructor(const mat3x2 m) -{ - __retVal = mat2(m[0], m[1]); -} - -mat2 __constructor(const mat4x2 m) -{ - __retVal = mat2(m[0], m[1]); -} - -mat2 __constructor(const mat2x3 m) -{ - __retVal = mat2(m[0].xy, m[1].xy); -} - -mat2 __constructor(const mat2x4 m) -{ - __retVal = mat2(m[0].xy, m[1].xy); -} - -mat2 __constructor(const mat3 m) -{ - __retVal = mat2(m[0].xy, m[1].xy); -} - -mat2 __constructor(const mat3x4 m) -{ - __retVal = mat2(m[0].xy, m[1].xy); -} - -mat2 __constructor(const mat4x3 m) -{ - __retVal = mat2(m[0].xy, m[1].xy); -} - -mat2 __constructor(const mat4 m) -{ - __retVal = mat2(m[0].xy, m[1].xy); -} - - - -mat2x3 __constructor(const mat2x3 m) -{ - __retVal = m; -} - -mat2x3 __constructor(const mat3 m) -{ - __retVal = mat2x3(m[0], m[1]); -} - -mat2x3 __constructor(const mat4x3 m) -{ - __retVal = mat2x3(m[0], m[1]); -} - -mat2x3 __constructor(const mat2x4 m) -{ - __retVal = mat2x3(m[0].xyz, m[1].xyz); -} - -mat2x3 __constructor(const mat3x4 m) -{ - __retVal = mat2x3(m[0].xyz, m[1].xyz); -} - -mat2x3 __constructor(const mat4 m) -{ - __retVal = mat2x3(m[0].xyz, m[1].xyz); -} - -mat2x3 __constructor(const mat2 m) -{ - __retVal = mat2x3(m[0].x, m[0].y, 0.0, - m[1].x, m[1].y, 0.0); -} - -mat2x3 __constructor(const mat3x2 m) -{ - __retVal = mat2x3(m[0].x, m[0].y, 0.0, - m[1].x, m[1].y, 0.0); -} - -mat2x3 __constructor(const mat4x2 m) -{ - __retVal = mat2x3(m[0].x, m[0].y, 0.0, - m[1].x, m[1].y, 0.0); -} - - - -mat2x4 __constructor(const mat2x4 m) -{ - __retVal = m; -} - -mat2x4 __constructor(const mat3x4 m) -{ - __retVal = mat2x4(m[0], m[1]); -} - -mat2x4 __constructor(const mat4 m) -{ - __retVal = mat2x4(m[0], m[1]); -} - -mat2x4 __constructor(const mat2x3 m) -{ - __retVal = mat2x4(m[0].x, m[0].y, m[0].z, 0.0, - m[1].x, m[1].y, m[1].z, 0.0); -} - -mat2x4 __constructor(const mat3 m) -{ - __retVal = mat2x4(m[0].x, m[0].y, m[0].z, 0.0, - m[1].x, m[1].y, m[1].z, 0.0); -} - -mat2x4 __constructor(const mat4x3 m) -{ - __retVal = mat2x4(m[0].x, m[0].y, m[0].z, 0.0, - m[1].x, m[1].y, m[1].z, 0.0); -} - -mat2x4 __constructor(const mat2 m) -{ - __retVal = mat2x4(m[0].x, m[1].y, 0.0, 0.0, - m[1].x, m[1].y, 0.0, 0.0); -} - -mat2x4 __constructor(const mat3x2 m) -{ - __retVal = mat2x4(m[0].x, m[0].y, 0.0, 0.0, - m[1].x, m[1].y, 0.0, 0.0); -} - -mat2x4 __constructor(const mat4x2 m) -{ - __retVal = mat2x4(m[0].x, m[0].y, 0.0, 0.0, - m[1].x, m[1].y, 0.0, 0.0); -} - - - -mat3x2 __constructor(const mat3x2 m) -{ - __retVal = m; -} - -mat3x2 __constructor(const mat4x2 m) -{ - __retVal = mat3x2(m[0], m[1], m[2]); -} - -mat3x2 __constructor(const mat3 m) -{ - __retVal = mat3x2(m[0], m[1], m[2]); -} - -mat3x2 __constructor(const mat3x4 m) -{ - __retVal = mat3x2(m[0].x, m[0].y, - m[1].x, m[1].y, - m[2].x, m[2].y); -} - -mat3x2 __constructor(const mat4x3 m) -{ - __retVal = mat3x2(m[0].x, m[0].y, - m[1].x, m[1].y, - m[2].x, m[2].y); -} - -mat3x2 __constructor(const mat4 m) -{ - __retVal = mat3x2(m[0].x, m[0].y, - m[1].x, m[1].y, - 0.0, 0.0); -} - -mat3x2 __constructor(const mat2 m) -{ - __retVal = mat3x2(m[0], m[1], vec2(0.0)); -} - -mat3x2 __constructor(const mat2x3 m) -{ - __retVal = mat3x2(m[0].x, m[0].y, - m[1].x, m[1].y, - 0.0, 0.0); -} - -mat3x2 __constructor(const mat2x4 m) -{ - __retVal = mat3x2(m[0].x, m[0].y, - m[1].x, m[1].y, - 0.0, 0.0); -} - - - - -mat3 __constructor(const mat3 m) -{ - __retVal = m; -} - -mat3 __constructor(const mat4x3 m) -{ - __retVal = mat3 ( - m[0], - m[1], - m[2] - ); -} - -mat3 __constructor(const mat3x4 m) -{ - __retVal = mat3 ( - m[0].xyz, - m[1].xyz, - m[2].xyz - ); -} - -mat3 __constructor(const mat4 m) -{ - __retVal = mat3 ( - m[0].xyz, - m[1].xyz, - m[2].xyz - ); -} - -mat3 __constructor(const mat2x3 m) -{ - __retVal = mat3 ( - m[0], - m[1], - 0., 0., 1. - ); -} - -mat3 __constructor(const mat2x4 m) -{ - __retVal = mat3 ( - m[0].xyz, - m[1].xyz, - 0., 0., 1. - ); -} - -mat3 __constructor(const mat3x2 m) -{ - __retVal = mat3 ( - m[0], 0., - m[1], 0., - m[2], 1. - ); -} - -mat3 __constructor(const mat4x2 m) -{ - __retVal = mat3 ( - m[0], 0., - m[1], 0., - m[2], 1. - ); -} - -mat3 __constructor(const mat2 m) -{ - __retVal = mat3 ( - m[0], 0., - m[1], 0., - 0., 0., 1. - ); -} - - -mat3x4 __constructor(const mat3x4 m) -{ - __retVal = m; -} - -mat3x4 __constructor(const mat4 m) -{ - __retVal = mat3x4 ( - m[0], - m[1], - m[2] - ); -} - -mat3x4 __constructor(const mat3 m) -{ - __retVal = mat3x4 ( - m[0], 0., - m[1], 0., - m[2], 0. - ); -} - -mat3x4 __constructor(const mat4x3 m) -{ - __retVal = mat3x4 ( - m[0], 0., - m[1], 0., - m[2], 0. - ); -} - -mat3x4 __constructor(const mat2x4 m) -{ - __retVal = mat3x4 ( - m[0], - m[1], - 0., 0., 1., 0. - ); -} - -mat3x4 __constructor(const mat2x3 m) -{ - __retVal = mat3x4 ( - m[0], 0., - m[1], 0., - 0., 0., 1., 0. - ); -} - -mat3x4 __constructor(const mat3x2 m) -{ - __retVal = mat3x4 ( - m[0], 0., 0., - m[1], 0., 0., - m[2], 1., 0. - ); -} - -mat3x4 __constructor(const mat4x2 m) -{ - __retVal = mat3x4 ( - m[0], 0., 0., - m[1], 0., 0., - m[2], 1., 0. - ); -} - -mat3x4 __constructor(const mat2 m) -{ - __retVal = mat3x4 ( - m[0], 0., 0., - m[1], 0., 0., - 0., 0., 1., 0. - ); -} - - -mat4x2 __constructor(const mat4x2 m) -{ - __retVal = m; -} - -mat4x2 __constructor(const mat4x3 m) -{ - __retVal = mat4x2 ( - m[0].xy, - m[1].xy, - m[2].xy, - m[3].xy - ); -} - -mat4x2 __constructor(const mat4 m) -{ - __retVal = mat4x2 ( - m[0].xy, - m[1].xy, - m[2].xy, - m[3].xy - ); -} - -mat4x2 __constructor(const mat3x2 m) -{ - __retVal = mat4x2 ( - m[0], - m[1], - 0., 0. - ); -} - -mat4x2 __constructor(const mat3 m) -{ - __retVal = mat4x2 ( - m[0].xy, - m[1].xy, - m[2].xy, - 0., 0. - ); -} - -mat4x2 __constructor(const mat3x4 m) -{ - __retVal = mat4x2 ( - m[0].xy, - m[1].xy, - m[2].xy, - 0., 0. - ); -} - -mat4x2 __constructor(const mat2 m) -{ - __retVal = mat4x2 ( - m[0], - m[1], - 0., 0., - 0., 0. - ); -} - -mat4x2 __constructor(const mat2x3 m) -{ - __retVal = mat4x2 ( - m[0].xy, - m[1].xy, - 0., 0., - 0., 0. - ); -} - -mat4x2 __constructor(const mat2x4 m) -{ - __retVal = mat4x2 ( - m[0].xy, - m[1].xy, - 0., 0., - 0., 0. - ); -} - - -mat4x3 __constructor(const mat4x3 m) -{ - __retVal = m; -} - -mat4x3 __constructor(const mat4 m) -{ - __retVal = mat4x3 ( - m[0].xyz, - m[1].xyz, - m[2].xyz, - m[3].xyz - ); -} - -mat4x3 __constructor(const mat3 m) -{ - __retVal = mat4x3 ( - m[0], - m[1], - m[2], - 0., 0., 0. - ); -} - -mat4x3 __constructor(const mat3x4 m) -{ - __retVal = mat4x3 ( - m[0].xyz, - m[1].xyz, - m[2].xyz, - 0., 0., 0. - ); -} - -mat4x3 __constructor(const mat4x2 m) -{ - __retVal = mat4x3 ( - m[0], 0., - m[1], 0., - m[2], 1., - m[3], 0. - ); -} - -mat4x3 __constructor(const mat2x3 m) -{ - __retVal = mat4x3 ( - m[0], - m[1], - 0., 0., 1., - 0., 0., 0. - ); -} - -mat4x3 __constructor(const mat3x2 m) -{ - __retVal = mat4x3 ( - m[0], 0., - m[1], 0., - m[2], 1., - 0., 0., 0. - ); -} - -mat4x3 __constructor(const mat2x4 m) -{ - __retVal = mat4x3 ( - m[0].xyz, - m[1].xyz, - 0., 0., 1., - 0., 0., 0. - ); -} - -mat4x3 __constructor(const mat2 m) -{ - __retVal = mat4x3 ( - m[0], 0., - m[1], 0., - 0., 0., 1., - 0., 0., 0. - ); -} - - -mat4 __constructor(const mat4 m) -{ - __retVal = m; -} - -mat4 __constructor(const mat3x4 m) -{ - __retVal = mat4 ( - m[0], - m[1], - m[2], - 0., 0., 0., 1. - ); -} - -mat4 __constructor(const mat4x3 m) -{ - __retVal = mat4 ( - m[0], 0., - m[1], 0., - m[2], 0., - m[3], 1. - ); -} - -mat4 __constructor(const mat2x4 m) -{ - __retVal = mat4 ( - m[0], - m[1], - 0., 0., 1., 0., - 0., 0., 0., 1. - ); -} - -mat4 __constructor(const mat4x2 m) -{ - __retVal = mat4 ( - m[0], 0., 0., - m[1], 0., 0., - m[2], 1., 0., - m[3], 0., 1. - ); -} - -mat4 __constructor(const mat3 m) -{ - __retVal = mat4 ( - m[0], 0., - m[1], 0., - m[2], 0., - 0., 0., 0., 1. - ); -} - -mat4 __constructor(const mat2x3 m) -{ - __retVal = mat4 ( - m[0], 0., - m[1], 0., - 0., 0., 1., 0., - 0., 0., 0., 1. - ); -} - -mat4 __constructor(const mat3x2 m) -{ - __retVal = mat4 ( - m[0], 0., 0., - m[1], 0., 0., - m[2], 1., 0., - 0., 0., 0., 1. - ); -} - -mat4 __constructor(const mat2 m) -{ - __retVal = mat4 ( - m[0], 0., 0., - m[1], 0., 0., - 0., 0., 1., 0., - 0., 0., 0., 1. - ); -} - - -void __operator += (inout mat2x3 m, const mat2x3 n) { - m[0] += n[0]; - m[1] += n[1]; -} - -void __operator += (inout mat2x4 m, const mat2x4 n) { - m[0] += n[0]; - m[1] += n[1]; -} - -void __operator += (inout mat3x2 m, const mat3x2 n) { - m[0] += n[0]; - m[1] += n[1]; - m[2] += n[2]; -} - -void __operator += (inout mat3x4 m, const mat3x4 n) { - m[0] += n[0]; - m[1] += n[1]; - m[2] += n[2]; -} - -void __operator += (inout mat4x2 m, const mat4x2 n) { - m[0] += n[0]; - m[1] += n[1]; - m[2] += n[2]; - m[3] += n[3]; -} - -void __operator += (inout mat4x3 m, const mat4x3 n) { - m[0] += n[0]; - m[1] += n[1]; - m[2] += n[2]; - m[3] += n[3]; -} - - -void __operator -= (inout mat2x3 m, const mat2x3 n) { - m[0] -= n[0]; - m[1] -= n[1]; -} - -void __operator -= (inout mat2x4 m, const mat2x4 n) { - m[0] -= n[0]; - m[1] -= n[1]; -} - -void __operator -= (inout mat3x2 m, const mat3x2 n) { - m[0] -= n[0]; - m[1] -= n[1]; - m[2] -= n[2]; -} - -void __operator -= (inout mat3x4 m, const mat3x4 n) { - m[0] -= n[0]; - m[1] -= n[1]; - m[2] -= n[2]; -} - -void __operator -= (inout mat4x2 m, const mat4x2 n) { - m[0] -= n[0]; - m[1] -= n[1]; - m[2] -= n[2]; - m[3] -= n[3]; -} - -void __operator -= (inout mat4x3 m, const mat4x3 n) { - m[0] -= n[0]; - m[1] -= n[1]; - m[2] -= n[2]; - m[3] -= n[3]; -} - - -void __operator /= (inout mat2x3 m, const mat2x3 n) { - m[0] /= n[0]; - m[1] /= n[1]; -} - -void __operator /= (inout mat2x4 m, const mat2x4 n) { - m[0] /= n[0]; - m[1] /= n[1]; -} - -void __operator /= (inout mat3x2 m, const mat3x2 n) { - m[0] /= n[0]; - m[1] /= n[1]; - m[2] /= n[2]; -} - -void __operator /= (inout mat3x4 m, const mat3x4 n) { - m[0] /= n[0]; - m[1] /= n[1]; - m[2] /= n[2]; -} - -void __operator /= (inout mat4x2 m, const mat4x2 n) { - m[0] /= n[0]; - m[1] /= n[1]; - m[2] /= n[2]; - m[3] /= n[3]; -} - -void __operator /= (inout mat4x3 m, const mat4x3 n) { - m[0] /= n[0]; - m[1] /= n[1]; - m[2] /= n[2]; - m[3] /= n[3]; -} - - -vec3 __operator * (const mat2x3 m, const vec2 v) -{ - __retVal.x = v.x * m[0].x + v.y * m[1].x; - __retVal.y = v.x * m[0].y + v.y * m[1].y; - __retVal.z = v.x * m[0].z + v.y * m[1].z; -} - -vec4 __operator * (const mat2x4 m, const vec2 v) -{ - __retVal.x = v.x * m[0].x + v.y * m[1].x; - __retVal.y = v.x * m[0].y + v.y * m[1].y; - __retVal.z = v.x * m[0].z + v.y * m[1].z; - __retVal.w = v.x * m[0].w + v.y * m[1].w; -} - -vec2 __operator * (const mat3x2 m, const vec3 v) -{ - __retVal.x = v.x * m[0].x + v.y * m[1].x + v.z * m[2].x; - __retVal.y = v.x * m[0].y + v.y * m[1].y + v.z * m[2].y; -} - -vec4 __operator * (const mat3x4 m, const vec3 v) -{ - __retVal.x = v.x * m[0].x + v.y * m[1].x + v.z * m[2].x; - __retVal.y = v.x * m[0].y + v.y * m[1].y + v.z * m[2].y; - __retVal.z = v.x * m[0].z + v.y * m[1].z + v.z * m[2].z; - __retVal.w = v.x * m[0].w + v.y * m[1].w + v.z * m[2].w; -} - -vec2 __operator * (const mat4x2 m, const vec4 v) -{ - __retVal.x = v.x * m[0].x + v.y * m[1].x + v.z * m[2].x + v.w * m[3].x; - __retVal.y = v.x * m[0].y + v.y * m[1].y + v.z * m[2].y + v.w * m[3].y; -} - -vec3 __operator * (const mat4x3 m, const vec4 v) -{ - __retVal.x = v.x * m[0].x + v.y * m[1].x + v.z * m[2].x + v.w * m[3].x; - __retVal.y = v.x * m[0].y + v.y * m[1].y + v.z * m[2].y + v.w * m[3].y; - __retVal.z = v.x * m[0].z + v.y * m[1].z + v.z * m[2].z + v.w * m[3].z; -} - - -mat3x2 __operator * (const mat2 m, const mat3x2 n) -{ - //return mat3x2 (m * n[0], m * n[1], m * n[2]); - __retVal[0] = m * n[0]; - __retVal[1] = m * n[1]; - __retVal[2] = m * n[2]; -} - -mat4x2 __operator * (const mat2 m, const mat4x2 n) -{ - //return mat4x2 (m * n[0], m * n[1], m * n[2], m * n[3]); - __retVal[0] = m * n[0]; - __retVal[1] = m * n[1]; - __retVal[2] = m * n[2]; - __retVal[3] = m * n[3]; -} - - -mat2x3 __operator * (const mat2x3 m, const mat2 n) -{ - //return mat2x3 (m * n[0], m * n[1]); - __retVal[0] = m * n[0]; - __retVal[1] = m * n[1]; -} - -mat3 __operator * (const mat2x3 m, const mat3x2 n) -{ - //return mat3 (m * n[0], m * n[1], m * n[2]); - __retVal[0] = m * n[0]; - __retVal[1] = m * n[1]; - __retVal[2] = m * n[2]; -} - -mat4x3 __operator * (const mat2x3 m, const mat4x2 n) -{ - //return mat4x3 (m * n[0], m * n[1], m * n[2], m * n[3]); - __retVal[0] = m * n[0]; - __retVal[1] = m * n[1]; - __retVal[2] = m * n[2]; - __retVal[3] = m * n[3]; -} - - -mat2x4 __operator * (const mat2x4 m, const mat2 n) -{ - //return mat2x4 (m * n[0], m * n[1]); - __retVal[0] = m * n[0]; - __retVal[1] = m * n[1]; -} - -mat3x4 __operator * (const mat2x4 m, const mat3x2 n) -{ - //return mat3x4 (m * n[0], m * n[1], m * n[2]); - __retVal[0] = m * n[0]; - __retVal[1] = m * n[1]; - __retVal[2] = m * n[2]; -} - -mat4 __operator * (const mat2x4 m, const mat4x2 n) -{ - //return mat4 (m * n[0], m * n[1], m * n[2], m * n[3]); - __retVal[0] = m * n[0]; - __retVal[1] = m * n[1]; - __retVal[2] = m * n[2]; - __retVal[3] = m * n[3]; -} - - -mat2 __operator * (const mat3x2 m, const mat2x3 n) -{ - //return mat2 (m * n[0], m * n[1]); - __retVal[0] = m * n[0]; - __retVal[1] = m * n[1]; -} - -mat3x2 __operator * (const mat3x2 m, const mat3 n) -{ - //return mat3x2 (m * n[0], m * n[1], m * n[2]); - __retVal[0] = m * n[0]; - __retVal[1] = m * n[1]; - __retVal[2] = m * n[2]; -} - -mat4x2 __operator * (const mat3x2 m, const mat4x3 n) -{ - //return mat4x2 (m * n[0], m * n[1], m * n[2], m * n[3]); - __retVal[0] = m * n[0]; - __retVal[1] = m * n[1]; - __retVal[2] = m * n[2]; - __retVal[3] = m * n[3]; -} - - -mat2x3 __operator * (const mat3 m, const mat2x3 n) -{ - //return mat2x3 (m * n[0], m * n[1]); - __retVal[0] = m * n[0]; - __retVal[1] = m * n[1]; -} - -mat4x3 __operator * (const mat3 m, const mat4x3 n) -{ - //return mat4x3 (m * n[0], m * n[1], m * n[2], m * n[3]); - __retVal[0] = m * n[0]; - __retVal[1] = m * n[1]; - __retVal[2] = m * n[2]; - __retVal[3] = m * n[3]; -} - - -mat2x4 __operator * (const mat3x4 m, const mat2x3 n) -{ - //return mat2x4 (m * n[0], m * n[1]); - __retVal[0] = m * n[0]; - __retVal[1] = m * n[1]; -} - -mat3x4 __operator * (const mat3x4 m, const mat3 n) -{ - //return mat3x4 (m * n[0], m * n[1], m * n[2]); - __retVal[0] = m * n[0]; - __retVal[1] = m * n[1]; - __retVal[2] = m * n[2]; -} - -mat4 __operator * (const mat3x4 m, const mat4x3 n) -{ - //return mat4 (m * n[0], m * n[1], m * n[2], m * n[3]); - __retVal[0] = m * n[0]; - __retVal[1] = m * n[1]; - __retVal[2] = m * n[2]; - __retVal[3] = m * n[3]; -} - - -mat2 __operator * (const mat4x2 m, const mat2x4 n) -{ - //return = mat2 (m * n[0], m * n[1]); - __retVal[0] = m * n[0]; - __retVal[1] = m * n[1]; -} - -mat3x2 __operator * (const mat4x2 m, const mat3x4 n) -{ - //return mat3x2 (m * n[0], m * n[1], m * n[2]); - __retVal[0] = m * n[0]; - __retVal[1] = m * n[1]; - __retVal[2] = m * n[2]; -} - -mat4x2 __operator * (const mat4x2 m, const mat4 n) -{ - //return mat4x2 (m * n[0], m * n[1], m * n[2], m * n[3]); - __retVal[0] = m * n[0]; - __retVal[1] = m * n[1]; - __retVal[2] = m * n[2]; - __retVal[3] = m * n[3]; -} - - -mat2x3 __operator * (const mat4x3 m, const mat2x4 n) -{ - //return mat2x3 (m * n[0], m * n[1]); - __retVal[0] = m * n[0]; - __retVal[1] = m * n[1]; -} - -mat3 __operator * (const mat4x3 m, const mat3x4 n) -{ - //return mat3 (m * n[0], m * n[1], m * n[2]); - __retVal[0] = m * n[0]; - __retVal[1] = m * n[1]; - __retVal[2] = m * n[2]; -} - -mat4x3 __operator * (const mat4x3 m, const mat4 n) -{ - //return mat4x3 (m * n[0], m * n[1], m * n[2], m * n[3]); - __retVal[0] = m * n[0]; - __retVal[1] = m * n[1]; - __retVal[2] = m * n[2]; - __retVal[3] = m * n[3]; -} - - -mat2x4 __operator * (const mat4 m, const mat2x4 n) -{ - //return mat2x4 (m * n[0], m * n[1]); - __retVal[0] = m * n[0]; - __retVal[1] = m * n[1]; -} - -mat3x4 __operator * (const mat4 m, const mat3x4 n) -{ - //return mat3x4 (m * n[0], m * n[1], m * n[2]); - __retVal[0] = m * n[0]; - __retVal[1] = m * n[1]; - __retVal[2] = m * n[2]; -} - - -void __operator *= (inout mat2x3 m, const mat2 n) { - m = m * n; -} - -void __operator *= (inout mat2x4 m, const mat2 n) { - m = m * n; -} - -void __operator *= (inout mat3x2 m, const mat3 n) { - m = m * n; -} - -void __operator *= (inout mat3x4 m, const mat3 n) { - m = m * n; -} - -void __operator *= (inout mat4x2 m, const mat4 n) { - m = m * n; -} - -void __operator *= (inout mat4x3 m, const mat4 n) { - m = m * n; -} - - -vec3 __operator * (const vec2 v, const mat3x2 m) -{ - __retVal.x = dot(v, m[0]); - __retVal.y = dot(v, m[1]); - __retVal.z = dot(v, m[2]); -} - -vec4 __operator * (const vec2 v, const mat4x2 m) -{ - __retVal.x = dot(v, m[0]); - __retVal.y = dot(v, m[1]); - __retVal.z = dot(v, m[2]); - __retVal.w = dot(v, m[3]); -} - -vec2 __operator * (const vec3 v, const mat2x3 m) -{ - __retVal.x = dot(v, m[0]); - __retVal.y = dot(v, m[1]); -} - -vec4 __operator * (const vec3 v, const mat4x3 m) -{ - __retVal.x = dot(v, m[0]); - __retVal.y = dot(v, m[1]); - __retVal.z = dot(v, m[2]); - __retVal.w = dot(v, m[3]); -} - -vec2 __operator * (const vec4 v, const mat2x4 m) -{ - __retVal.x = dot(v, m[0]); - __retVal.y = dot(v, m[1]); -} - -vec3 __operator * (const vec4 v, const mat3x4 m) -{ - __retVal.x = dot(v, m[0]); - __retVal.y = dot(v, m[1]); - __retVal.z = dot(v, m[2]); -} - - -void __operator += (inout mat2x3 m, const float a) { - m[0] += a; - m[1] += a; -} - -void __operator += (inout mat2x4 m, const float a) { - m[0] += a; - m[1] += a; -} - -void __operator += (inout mat3x2 m, const float a) { - m[0] += a; - m[1] += a; - m[2] += a; -} - -void __operator += (inout mat3x4 m, const float a) { - m[0] += a; - m[1] += a; - m[2] += a; -} - -void __operator += (inout mat4x2 m, const float a) { - m[0] += a; - m[1] += a; - m[2] += a; - m[3] += a; -} - -void __operator += (inout mat4x3 m, const float a) { - m[0] += a; - m[1] += a; - m[2] += a; - m[3] += a; -} - - -void __operator -= (inout mat2x3 m, const float a) { - m[0] -= a; - m[1] -= a; -} - -void __operator -= (inout mat2x4 m, const float a) { - m[0] -= a; - m[1] -= a; -} - -void __operator -= (inout mat3x2 m, const float a) { - m[0] -= a; - m[1] -= a; - m[2] -= a; -} - -void __operator -= (inout mat3x4 m, const float a) { - m[0] -= a; - m[1] -= a; - m[2] -= a; -} - -void __operator -= (inout mat4x2 m, const float a) { - m[0] -= a; - m[1] -= a; - m[2] -= a; - m[3] -= a; -} - -void __operator -= (inout mat4x3 m, const float a) { - m[0] -= a; - m[1] -= a; - m[2] -= a; - m[3] -= a; -} - - -void __operator *= (inout mat2x3 m, const float a) { - m[0] *= a; - m[1] *= a; -} - -void __operator *= (inout mat2x4 m, const float a) { - m[0] *= a; - m[1] *= a; -} - -void __operator *= (inout mat3x2 m, const float a) { - m[0] *= a; - m[1] *= a; - m[2] *= a; -} - -void __operator *= (inout mat3x4 m, const float a) { - m[0] *= a; - m[1] *= a; - m[2] *= a; -} - -void __operator *= (inout mat4x2 m, const float a) { - m[0] *= a; - m[1] *= a; - m[2] *= a; - m[3] *= a; -} - -void __operator *= (inout mat4x3 m, const float a) { - m[0] *= a; - m[1] *= a; - m[2] *= a; - m[3] *= a; -} - - -void __operator /= (inout mat2x3 m, const float a) { - m[0] /= a; - m[1] /= a; -} - -void __operator /= (inout mat2x4 m, const float a) { - m[0] /= a; - m[1] /= a; -} - -void __operator /= (inout mat3x2 m, const float a) { - m[0] /= a; - m[1] /= a; - m[2] /= a; -} - -void __operator /= (inout mat3x4 m, const float a) { - m[0] /= a; - m[1] /= a; - m[2] /= a; -} - -void __operator /= (inout mat4x2 m, const float a) { - m[0] /= a; - m[1] /= a; - m[2] /= a; - m[3] /= a; -} - -void __operator /= (inout mat4x3 m, const float a) { - m[0] /= a; - m[1] /= a; - m[2] /= a; - m[3] /= a; -} - - -mat2x3 __operator + (const mat2x3 m, const mat2x3 n) { - return mat2x3 (m[0] + n[0], m[1] + n[1]); -} - -mat2x4 __operator + (const mat2x4 m, const mat2x4 n) { - return mat2x4 (m[0] + n[0], m[1] + n[1]); -} - -mat3x2 __operator + (const mat3x2 m, const mat3x2 n) { - return mat3x2 (m[0] + n[0], m[1] + n[1], m[2] + n[2]); -} - -mat3x4 __operator + (const mat3x4 m, const mat3x4 n) { - return mat3x4 (m[0] + n[0], m[1] + n[1], m[2] + n[2]); -} - -mat4x2 __operator + (const mat4x2 m, const mat4x2 n) { - return mat4x2 (m[0] + n[0], m[1] + n[1], m[2] + n[2], m[3] + n[3]); -} - -mat4x3 __operator + (const mat4x3 m, const mat4x3 n) { - return mat4x3 (m[0] + n[0], m[1] + n[1], m[2] + n[2], m[3] + n[3]); -} - - -mat2x3 __operator - (const mat2x3 m, const mat2x3 n) { - return mat2x3 (m[0] - n[0], m[1] - n[1]); -} - -mat2x4 __operator - (const mat2x4 m, const mat2x4 n) { - return mat2x4 (m[0] - n[0], m[1] - n[1]); -} - -mat3x2 __operator - (const mat3x2 m, const mat3x2 n) { - return mat3x2 (m[0] - n[0], m[1] - n[1], m[2] - n[2]); -} - -mat3x4 __operator - (const mat3x4 m, const mat3x4 n) { - return mat3x4 (m[0] - n[0], m[1] - n[1], m[2] - n[2]); -} - -mat4x2 __operator - (const mat4x2 m, const mat4x2 n) { - return mat4x2 (m[0] - n[0], m[1] - n[1], m[2] - n[2], m[3] - n[3]); -} - -mat4x3 __operator - (const mat4x3 m, const mat4x3 n) { - return mat4x3 (m[0] - n[0], m[1] - n[1], m[2] - n[2], m[3] - n[3]); -} - - -mat2x3 __operator / (const mat2x3 m, const mat2x3 n) { - return mat2x3 (m[0] / n[0], m[1] / n[1]); -} - -mat2x4 __operator / (const mat2x4 m, const mat2x4 n) { - return mat2x4 (m[0] / n[0], m[1] / n[1]); -} - -mat3x2 __operator / (const mat3x2 m, const mat3x2 n) { - return mat3x2 (m[0] / n[0], m[1] / n[1], m[2] / n[2]); -} - -mat3x4 __operator / (const mat3x4 m, const mat3x4 n) { - return mat3x4 (m[0] / n[0], m[1] / n[1], m[2] / n[2]); -} - -mat4x2 __operator / (const mat4x2 m, const mat4x2 n) { - return mat4x2 (m[0] / n[0], m[1] / n[1], m[2] / n[2], m[3] / n[3]); -} - -mat4x3 __operator / (const mat4x3 m, const mat4x3 n) { - return mat4x3 (m[0] / n[0], m[1] / n[1], m[2] / n[2], m[3] / n[3]); -} - - -mat2x3 __operator + (const float a, const mat2x3 n) { - return mat2x3 (a + n[0], a + n[1]); -} - -mat2x3 __operator + (const mat2x3 m, const float b) { - return mat2x3 (m[0] + b, m[1] + b); -} - -mat2x4 __operator + (const float a, const mat2x4 n) { - return mat2x4 (a + n[0], a + n[1]); -} - -mat2x4 __operator + (const mat2x4 m, const float b) { - return mat2x4 (m[0] + b, m[1] + b); -} - -mat3x2 __operator + (const float a, const mat3x2 n) { - return mat3x2 (a + n[0], a + n[1], a + n[2]); -} - -mat3x2 __operator + (const mat3x2 m, const float b) { - return mat3x2 (m[0] + b, m[1] + b, m[2] + b); -} - -mat3x4 __operator + (const float a, const mat3x4 n) { - return mat3x4 (a + n[0], a + n[1], a + n[2]); -} - -mat3x4 __operator + (const mat3x4 m, const float b) { - return mat3x4 (m[0] + b, m[1] + b, m[2] + b); -} - -mat4x2 __operator + (const mat4x2 m, const float b) { - return mat4x2 (m[0] + b, m[1] + b, m[2] + b, m[3] + b); -} - -mat4x2 __operator + (const float a, const mat4x2 n) { - return mat4x2 (a + n[0], a + n[1], a + n[2], a + n[3]); -} - -mat4x3 __operator + (const mat4x3 m, const float b) { - return mat4x3 (m[0] + b, m[1] + b, m[2] + b, m[3] + b); -} - -mat4x3 __operator + (const float a, const mat4x3 n) { - return mat4x3 (a + n[0], a + n[1], a + n[2], a + n[3]); -} - - -mat2x3 __operator - (const float a, const mat2x3 n) { - return mat2x3 (a - n[0], a - n[1]); -} - -mat2x3 __operator - (const mat2x3 m, const float b) { - return mat2x3 (m[0] - b, m[1] - b); -} - -mat2x4 __operator - (const float a, const mat2x4 n) { - return mat2x4 (a - n[0], a - n[1]); -} - -mat2x4 __operator - (const mat2x4 m, const float b) { - return mat2x4 (m[0] - b, m[1] - b); -} - -mat3x2 __operator - (const float a, const mat3x2 n) { - return mat3x2 (a - n[0], a - n[1], a - n[2]); -} - -mat3x2 __operator - (const mat3x2 m, const float b) { - return mat3x2 (m[0] - b, m[1] - b, m[2] - b); -} - -mat3x4 __operator - (const float a, const mat3x4 n) { - return mat3x4 (a - n[0], a - n[1], a - n[2]); -} - -mat3x4 __operator - (const mat3x4 m, const float b) { - return mat3x4 (m[0] - b, m[1] - b, m[2] - b); -} - -mat4x2 __operator - (const mat4x2 m, const float b) { - return mat4x2 (m[0] - b, m[1] - b, m[2] - b, m[3] - b); -} - -mat4x2 __operator - (const float a, const mat4x2 n) { - return mat4x2 (a - n[0], a - n[1], a - n[2], a - n[3]); -} - -mat4x3 __operator - (const mat4x3 m, const float b) { - return mat4x3 (m[0] - b, m[1] - b, m[2] - b, m[3] - b); -} - -mat4x3 __operator - (const float a, const mat4x3 n) { - return mat4x3 (a - n[0], a - n[1], a - n[2], a - n[3]); -} - - -mat2x3 __operator * (const float a, const mat2x3 n) -{ - //return mat2x3 (a * n[0], a * n[1]); - __retVal[0] = a * n[0]; - __retVal[1] = a * n[1]; -} - -mat2x3 __operator * (const mat2x3 m, const float b) -{ - //return mat2x3 (m[0] * b, m[1] * b); - __retVal[0] = m[0] * b; - __retVal[1] = m[1] * b; -} - -mat2x4 __operator * (const float a, const mat2x4 n) -{ - //return mat2x4 (a * n[0], a * n[1]); - __retVal[0] = a * n[0]; - __retVal[1] = a * n[1]; -} - -mat2x4 __operator * (const mat2x4 m, const float b) -{ - //return mat2x4 (m[0] * b, m[1] * b); - __retVal[0] = m[0] * b; - __retVal[1] = m[1] * b; -} - -mat3x2 __operator * (const float a, const mat3x2 n) -{ - //return mat3x2 (a * n[0], a * n[1], a * n[2]); - __retVal[0] = a * n[0]; - __retVal[1] = a * n[1]; - __retVal[2] = a * n[2]; -} - -mat3x2 __operator * (const mat3x2 m, const float b) -{ - //return mat3x2 (m[0] * b, m[1] * b, m[2] * b); - __retVal[0] = m[0] * b; - __retVal[1] = m[1] * b; - __retVal[2] = m[2] * b; -} - -mat3x4 __operator * (const float a, const mat3x4 n) -{ - //return mat3x4 (a * n[0], a * n[1], a * n[2]); - __retVal[0] = a * n[0]; - __retVal[1] = a * n[1]; - __retVal[2] = a * n[2]; -} - -mat3x4 __operator * (const mat3x4 m, const float b) -{ - //return mat3x4 (m[0] * b, m[1] * b, m[2] * b); - __retVal[0] = m[0] * b; - __retVal[1] = m[1] * b; - __retVal[2] = m[2] * b; -} - -mat4x2 __operator * (const mat4x2 m, const float b) -{ - //return mat4x2 (m[0] * b, m[1] * b, m[2] * b, m[3] * b); - __retVal[0] = m[0] * b; - __retVal[1] = m[1] * b; - __retVal[2] = m[2] * b; - __retVal[3] = m[3] * b; -} - -mat4x2 __operator * (const float a, const mat4x2 n) -{ - //return mat4x2 (a * n[0], a * n[1], a * n[2], a * n[3]); - __retVal[0] = a * n[0]; - __retVal[1] = a * n[1]; - __retVal[2] = a * n[2]; - __retVal[3] = a * n[3]; -} - -mat4x3 __operator * (const mat4x3 m, const float b) -{ - //return mat4x3 (m[0] * b, m[1] * b, m[2] * b, m[3] * b); - __retVal[0] = m[0] * b; - __retVal[1] = m[1] * b; - __retVal[2] = m[2] * b; - __retVal[3] = m[3] * b; -} - -mat4x3 __operator * (const float a, const mat4x3 n) -{ - //return mat4x3 (a * n[0], a * n[1], a * n[2], a * n[3]); - __retVal[0] = a * n[0]; - __retVal[1] = a * n[1]; - __retVal[2] = a * n[2]; - __retVal[3] = a * n[3]; -} - - -mat2x3 __operator / (const float a, const mat2x3 n) -{ - //return mat2x3 (a / n[0], a / n[1]); - const float inv = 1.0 / a; - __retVal[0] = inv * n[0]; - __retVal[1] = inv * n[1]; -} - -mat2x3 __operator / (const mat2x3 m, const float b) -{ - //return mat2x3 (m[0] / b, m[1] / b); - const float inv = 1.0 / b; - __retVal[0] = m[0] * inv; - __retVal[1] = m[1] * inv; -} - -mat2x4 __operator / (const float a, const mat2x4 n) -{ - //return mat2x4 (a / n[0], a / n[1]); - const float inv = 1.0 / a; - __retVal[0] = inv * n[0]; - __retVal[1] = inv * n[1]; -} - -mat2x4 __operator / (const mat2x4 m, const float b) -{ - //return mat2x4 (m[0] / b, m[1] / b); - const float inv = 1.0 / b; - __retVal[0] = m[0] * inv; - __retVal[1] = m[1] * inv; -} - -mat3x2 __operator / (const float a, const mat3x2 n) -{ - //return mat3x2 (a / n[0], a / n[1], a / n[2]); - const float inv = 1.0 / a; - __retVal[0] = inv * n[0]; - __retVal[1] = inv * n[1]; - __retVal[2] = inv * n[2]; -} - -mat3x2 __operator / (const mat3x2 m, const float b) -{ - //return mat3x2 (m[0] / b, m[1] / b, m[2] / b); - const float inv = 1.0 / b; - __retVal[0] = m[0] * inv; - __retVal[1] = m[1] * inv; - __retVal[2] = m[2] * inv; -} - -mat3x4 __operator / (const float a, const mat3x4 n) -{ - //return mat3x4 (a / n[0], a / n[1], a / n[2]); - const float inv = 1.0 / a; - __retVal[0] = inv * n[0]; - __retVal[1] = inv * n[1]; - __retVal[2] = inv * n[2]; -} - -mat3x4 __operator / (const mat3x4 m, const float b) -{ - //return mat3x4 (m[0] / b, m[1] / b, m[2] / b); - const float inv = 1.0 / b; - __retVal[0] = m[0] * inv; - __retVal[1] = m[1] * inv; - __retVal[2] = m[2] * inv; -} - -mat4x2 __operator / (const mat4x2 m, const float b) -{ - //return mat4x2 (m[0] / b, m[1] / b, m[2] / b, m[3] / b); - const float inv = 1.0 / b; - __retVal[0] = m[0] * inv; - __retVal[1] = m[1] * inv; - __retVal[2] = m[2] * inv; - __retVal[3] = m[3] * inv; -} - -mat4x2 __operator / (const float a, const mat4x2 n) -{ - //return mat4x2 (a / n[0], a / n[1], a / n[2], a / n[3]); - const float inv = 1.0 / a; - __retVal[0] = inv * n[0]; - __retVal[1] = inv * n[1]; - __retVal[2] = inv * n[2]; - __retVal[3] = inv * n[3]; -} - -mat4x3 __operator / (const mat4x3 m, const float b) -{ - //return mat4x3 (m[0] / b, m[1] / b, m[2] / b, m[3] / b); - const float inv = 1.0 / b; - __retVal[0] = m[0] * inv; - __retVal[1] = m[1] * inv; - __retVal[2] = m[2] * inv; - __retVal[3] = m[3] * inv; -} - -mat4x3 __operator / (const float a, const mat4x3 n) -{ - //return mat4x3 (a / n[0], a / n[1], a / n[2], a / n[3]); - const float inv = 1.0 / a; - __retVal[0] = inv * n[0]; - __retVal[1] = inv * n[1]; - __retVal[2] = inv * n[2]; - __retVal[3] = inv * n[3]; -} - - -mat2x3 __operator - (const mat2x3 m) { - return mat2x3 (-m[0], -m[1]); -} - -mat2x4 __operator - (const mat2x4 m) { - return mat2x4 (-m[0], -m[1]); -} - -mat3x2 __operator - (const mat3x2 m) { - return mat3x2 (-m[0], -m[1], -m[2]); -} - -mat3x4 __operator - (const mat3x4 m) { - return mat3x4 (-m[0], -m[1], -m[2]); -} - -mat4x2 __operator - (const mat4x2 m) { - return mat4x2 (-m[0], -m[1], -m[2], -m[3]); -} - -mat4x3 __operator - (const mat4x3 m) { - return mat4x3 (-m[0], -m[1], -m[2], -m[3]); -} - - -void __operator -- (inout mat2x3 m) { - --m[0]; - --m[1]; -} - -void __operator -- (inout mat2x4 m) { - --m[0]; - --m[1]; -} - -void __operator -- (inout mat3x2 m) { - --m[0]; - --m[1]; - --m[2]; -} - -void __operator -- (inout mat3x4 m) { - --m[0]; - --m[1]; - --m[2]; -} - -void __operator -- (inout mat4x2 m) { - --m[0]; - --m[1]; - --m[2]; - --m[3]; -} - -void __operator -- (inout mat4x3 m) { - --m[0]; - --m[1]; - --m[2]; - --m[3]; -} - - -void __operator ++ (inout mat2x3 m) { - ++m[0]; - ++m[1]; -} - -void __operator ++ (inout mat2x4 m) { - ++m[0]; - ++m[1]; -} - -void __operator ++ (inout mat3x2 m) { - ++m[0]; - ++m[1]; - ++m[2]; -} - -void __operator ++ (inout mat3x4 m) { - ++m[0]; - ++m[1]; - ++m[2]; -} - -void __operator ++ (inout mat4x2 m) { - ++m[0]; - ++m[1]; - ++m[2]; - ++m[3]; -} - -void __operator ++ (inout mat4x3 m) { - ++m[0]; - ++m[1]; - ++m[2]; - ++m[3]; -} - diff --git a/src/mesa/slang/library/slang_builtin_120_common.gc b/src/mesa/slang/library/slang_builtin_120_common.gc deleted file mode 100644 index c6264c3b47..0000000000 --- a/src/mesa/slang/library/slang_builtin_120_common.gc +++ /dev/null @@ -1,200 +0,0 @@ -/* - * Mesa 3-D graphics library - * Version: 6.6 - * - * Copyright (C) 2006 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. - */ - -// -// From Shader Spec, ver. 1.20, rev. 6 -// - -// -// 8.5 Matrix Functions -// - -mat2x3 matrixCompMult (mat2x3 m, mat2x3 n) { - return mat2x3 (m[0] * n[0], m[1] * n[1]); -} - -mat2x4 matrixCompMult (mat2x4 m, mat2x4 n) { - return mat2x4 (m[0] * n[0], m[1] * n[1]); -} - -mat3x2 matrixCompMult (mat3x2 m, mat3x2 n) { - return mat3x2 (m[0] * n[0], m[1] * n[1], m[2] * n[2]); -} - -mat3x4 matrixCompMult (mat3x4 m, mat3x4 n) { - return mat3x4 (m[0] * n[0], m[1] * n[1], m[2] * n[2]); -} - -mat4x2 matrixCompMult (mat4x2 m, mat4x2 n) { - return mat4x2 (m[0] * n[0], m[1] * n[1], m[2] * n[2], m[3] * n[3]); -} - -mat4x3 matrixCompMult (mat4x3 m, mat4x3 n) { - return mat4x3 (m[0] * n[0], m[1] * n[1], m[2] * n[2], m[3] * n[3]); -} - -mat2 outerProduct (vec2 c, vec2 r) { - return mat2 ( - c.x * r.x, c.y * r.x, - c.x * r.y, c.y * r.y - ); -} - -mat3 outerProduct (vec3 c, vec3 r) { - return mat3 ( - c.x * r.x, c.y * r.x, c.z * r.x, - c.x * r.y, c.y * r.y, c.z * r.y, - c.x * r.z, c.y * r.z, c.z * r.z - ); -} - -mat4 outerProduct (vec4 c, vec4 r) { - return mat4 ( - c.x * r.x, c.y * r.x, c.z * r.x, c.w * r.x, - c.x * r.y, c.y * r.y, c.z * r.y, c.w * r.y, - c.x * r.z, c.y * r.z, c.z * r.z, c.w * r.z, - c.x * r.w, c.y * r.w, c.z * r.w, c.w * r.w - ); -} - -mat2x3 outerProduct (vec3 c, vec2 r) { - return mat2x3 ( - c.x * r.x, c.y * r.x, c.z * r.x, - c.x * r.y, c.y * r.y, c.z * r.y - ); -} - -mat3x2 outerProduct (vec2 c, vec3 r) { - return mat3x2 ( - c.x * r.x, c.y * r.x, - c.x * r.y, c.y * r.y, - c.x * r.z, c.y * r.z - ); -} - -mat2x4 outerProduct (vec4 c, vec2 r) { - return mat2x4 ( - c.x * r.x, c.y * r.x, c.z * r.x, c.w * r.x, - c.x * r.y, c.y * r.y, c.z * r.y, c.w * r.y - ); -} - -mat4x2 outerProduct (vec2 c, vec4 r) { - return mat4x2 ( - c.x * r.x, c.y * r.x, - c.x * r.y, c.y * r.y, - c.x * r.z, c.y * r.z, - c.x * r.w, c.y * r.w - ); -} - -mat3x4 outerProduct (vec4 c, vec3 r) { - return mat3x4 ( - c.x * r.x, c.y * r.x, c.z * r.x, c.w * r.x, - c.x * r.y, c.y * r.y, c.z * r.y, c.w * r.y, - c.x * r.z, c.y * r.z, c.z * r.z, c.w * r.z - ); -} - -mat4x3 outerProduct (vec3 c, vec4 r) { - return mat4x3 ( - c.x * r.x, c.y * r.x, c.z * r.x, - c.x * r.y, c.y * r.y, c.z * r.y, - c.x * r.z, c.y * r.z, c.z * r.z, - c.x * r.w, c.y * r.w, c.z * r.w - ); -} - -mat2 transpose (mat2 m) { - return mat2 ( - m[0].x, m[1].x, - m[0].y, m[1].y - ); -} - -mat3 transpose (mat3 m) { - return mat3 ( - m[0].x, m[1].x, m[2].x, - m[0].y, m[1].y, m[2].y, - m[0].z, m[1].z, m[2].z - ); -} - -mat4 transpose (mat4 m) { - return mat4 ( - m[0].x, m[1].x, m[2].x, m[3].x, - m[0].y, m[1].y, m[2].y, m[3].y, - m[0].z, m[1].z, m[2].z, m[3].z, - m[0].w, m[1].w, m[2].w, m[3].w - ); -} - -mat2x3 transpose (mat3x2 m) { - return mat2x3 ( - m[0].x, m[1].x, m[2].x, - m[0].y, m[1].y, m[2].y - ); -} - -mat3x2 transpose (mat2x3 m) { - return mat3x2 ( - m[0].x, m[1].x, - m[0].y, m[1].y, - m[0].z, m[1].z - ); -} - -mat2x4 transpose (mat4x2 m) { - return mat2x4 ( - m[0].x, m[1].x, m[2].x, m[3].x, - m[0].y, m[1].y, m[2].y, m[3].y - ); -} - -mat4x2 transpose (mat2x4 m) { - return mat4x2 ( - m[0].x, m[1].x, - m[0].y, m[1].y, - m[0].z, m[1].z, - m[0].w, m[1].w - ); -} - -mat3x4 transpose (mat4x3 m) { - return mat3x4 ( - m[0].x, m[1].x, m[2].x, m[3].x, - m[0].y, m[1].y, m[2].y, m[3].y, - m[0].z, m[1].z, m[2].z, m[3].z - ); -} - -mat4x3 transpose (mat3x4 m) { - return mat4x3 ( - m[0].x, m[1].x, m[2].x, - m[0].y, m[1].y, m[2].y, - m[0].z, m[1].z, m[2].z, - m[0].w, m[1].w, m[2].w - ); -} - diff --git a/src/mesa/slang/library/slang_builtin_120_fragment.gc b/src/mesa/slang/library/slang_builtin_120_fragment.gc deleted file mode 100644 index 7d516046a1..0000000000 --- a/src/mesa/slang/library/slang_builtin_120_fragment.gc +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Mesa 3-D graphics library - * Version: 6.5 - * - * Copyright (C) 2006 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. - */ - -// -// From Shader Spec, ver. 1.20, rev. 6 -// - -varying vec2 gl_PointCoord; - diff --git a/src/mesa/slang/library/slang_common_builtin.gc b/src/mesa/slang/library/slang_common_builtin.gc deleted file mode 100644 index 1f5ddbc1ee..0000000000 --- a/src/mesa/slang/library/slang_common_builtin.gc +++ /dev/null @@ -1,1887 +0,0 @@ -/* - * Mesa 3-D graphics library - * Version: 7.3 - * - * Copyright (C) 2006 Brian Paul All Rights Reserved. - * Copyright (C) 2008 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. - */ - -// -// From Shader Spec, ver. 1.10, rev. 59 -// - -// Note: the values assigned to these constants here aren't actually used. -// They're set by the compiler according to the GL context limits. -// See slang_simplify.c -const int gl_MaxLights = 8; -const int gl_MaxClipPlanes = 6; -const int gl_MaxTextureUnits = 8; -const int gl_MaxTextureCoords = 8; -const int gl_MaxVertexAttribs = 16; -const int gl_MaxVertexUniformComponents = 512; -const int gl_MaxVaryingFloats = 32; -const int gl_MaxVertexTextureImageUnits = 0; -const int gl_MaxCombinedTextureImageUnits = 2; -const int gl_MaxTextureImageUnits = 2; -const int gl_MaxFragmentUniformComponents = 64; -const int gl_MaxDrawBuffers = 1; - -uniform mat4 gl_ModelViewMatrix; -uniform mat4 gl_ProjectionMatrix; -uniform mat4 gl_ModelViewProjectionMatrix; -uniform mat4 gl_TextureMatrix[gl_MaxTextureCoords]; - -uniform mat3 gl_NormalMatrix; - -uniform mat4 gl_ModelViewMatrixInverse; -uniform mat4 gl_ProjectionMatrixInverse; -uniform mat4 gl_ModelViewProjectionMatrixInverse; -uniform mat4 gl_TextureMatrixInverse[gl_MaxTextureCoords]; - -uniform mat4 gl_ModelViewMatrixTranspose; -uniform mat4 gl_ProjectionMatrixTranspose; -uniform mat4 gl_ModelViewProjectionMatrixTranspose; -uniform mat4 gl_TextureMatrixTranspose[gl_MaxTextureCoords]; - -uniform mat4 gl_ModelViewMatrixInverseTranspose; -uniform mat4 gl_ProjectionMatrixInverseTranspose; -uniform mat4 gl_ModelViewProjectionMatrixInverseTranspose; -uniform mat4 gl_TextureMatrixInverseTranspose[gl_MaxTextureCoords]; - -uniform float gl_NormalScale; - -struct gl_DepthRangeParameters { - float near; - float far; - float diff; -}; - -uniform gl_DepthRangeParameters gl_DepthRange; - -uniform vec4 gl_ClipPlane[gl_MaxClipPlanes]; - -struct gl_PointParameters { - float size; - float sizeMin; - float sizeMax; - float fadeThresholdSize; - float distanceConstantAttenuation; - float distanceLinearAttenuation; - float distanceQuadraticAttenuation; -}; - -uniform gl_PointParameters gl_Point; - -struct gl_MaterialParameters { - vec4 emission; - vec4 ambient; - vec4 diffuse; - vec4 specular; - float shininess; -}; - -uniform gl_MaterialParameters gl_FrontMaterial; -uniform gl_MaterialParameters gl_BackMaterial; - -/* NOTE: the order of these fields is significant! - * See the definition of the lighting state vars such as STATE_SPOT_DIRECTION. - */ -struct gl_LightSourceParameters { - vec4 ambient; - vec4 diffuse; - vec4 specular; - vec4 position; - vec4 halfVector; - vec3 spotDirection; - float spotCosCutoff; - - float constantAttenuation; - float linearAttenuation; - float quadraticAttenuation; - float spotExponent; - - float spotCutoff; -}; - -uniform gl_LightSourceParameters gl_LightSource[gl_MaxLights]; - -struct gl_LightModelParameters { - vec4 ambient; -}; - -uniform gl_LightModelParameters gl_LightModel; - -struct gl_LightModelProducts { - vec4 sceneColor; -}; - -uniform gl_LightModelProducts gl_FrontLightModelProduct; -uniform gl_LightModelProducts gl_BackLightModelProduct; - -struct gl_LightProducts { - vec4 ambient; - vec4 diffuse; - vec4 specular; -}; - -uniform gl_LightProducts gl_FrontLightProduct[gl_MaxLights]; -uniform gl_LightProducts gl_BackLightProduct[gl_MaxLights]; - -uniform vec4 gl_TextureEnvColor[gl_MaxTextureImageUnits]; -uniform vec4 gl_EyePlaneS[gl_MaxTextureCoords]; -uniform vec4 gl_EyePlaneT[gl_MaxTextureCoords]; -uniform vec4 gl_EyePlaneR[gl_MaxTextureCoords]; -uniform vec4 gl_EyePlaneQ[gl_MaxTextureCoords]; -uniform vec4 gl_ObjectPlaneS[gl_MaxTextureCoords]; -uniform vec4 gl_ObjectPlaneT[gl_MaxTextureCoords]; -uniform vec4 gl_ObjectPlaneR[gl_MaxTextureCoords]; -uniform vec4 gl_ObjectPlaneQ[gl_MaxTextureCoords]; - -struct gl_FogParameters { - vec4 color; - float density; - float start; - float end; - float scale; -}; - -uniform gl_FogParameters gl_Fog; - - - - - -// -// 8.1 Angle and Trigonometry Functions -// - -//// radians - -float radians(const float deg) -{ - const float c = 3.1415926 / 180.0; - __asm vec4_multiply __retVal, deg, c; -} - -vec2 radians(const vec2 deg) -{ - const float c = 3.1415926 / 180.0; - __asm vec4_multiply __retVal.xy, deg.xy, c.xx; -} - -vec3 radians(const vec3 deg) -{ - const float c = 3.1415926 / 180.0; - __asm vec4_multiply __retVal.xyz, deg.xyz, c.xxx; -} - -vec4 radians(const vec4 deg) -{ - const float c = 3.1415926 / 180.0; - __asm vec4_multiply __retVal, deg, c.xxxx; -} - - -//// degrees - -float degrees(const float rad) -{ - const float c = 180.0 / 3.1415926; - __asm vec4_multiply __retVal, rad, c; -} - -vec2 degrees(const vec2 rad) -{ - const float c = 180.0 / 3.1415926; - __asm vec4_multiply __retVal.xy, rad.xy, c.xx; -} - -vec3 degrees(const vec3 rad) -{ - const float c = 180.0 / 3.1415926; - __asm vec4_multiply __retVal.xyz, rad.xyz, c.xxx; -} - -vec4 degrees(const vec4 rad) -{ - const float c = 180.0 / 3.1415926; - __asm vec4_multiply __retVal, rad, c.xxxx; -} - - -//// sin - -float sin(const float radians) -{ - __asm float_sine __retVal, radians; -} - -vec2 sin(const vec2 radians) -{ - __asm float_sine __retVal.x, radians.x; - __asm float_sine __retVal.y, radians.y; -} - -vec3 sin(const vec3 radians) -{ - __asm float_sine __retVal.x, radians.x; - __asm float_sine __retVal.y, radians.y; - __asm float_sine __retVal.z, radians.z; -} - -vec4 sin(const vec4 radians) -{ - __asm float_sine __retVal.x, radians.x; - __asm float_sine __retVal.y, radians.y; - __asm float_sine __retVal.z, radians.z; - __asm float_sine __retVal.w, radians.w; -} - - -//// cos - -float cos(const float radians) -{ - __asm float_cosine __retVal, radians; -} - -vec2 cos(const vec2 radians) -{ - __asm float_cosine __retVal.x, radians.x; - __asm float_cosine __retVal.y, radians.y; -} - -vec3 cos(const vec3 radians) -{ - __asm float_cosine __retVal.x, radians.x; - __asm float_cosine __retVal.y, radians.y; - __asm float_cosine __retVal.z, radians.z; -} - -vec4 cos(const vec4 radians) -{ - __asm float_cosine __retVal.x, radians.x; - __asm float_cosine __retVal.y, radians.y; - __asm float_cosine __retVal.z, radians.z; - __asm float_cosine __retVal.w, radians.w; -} - - - -//// tan - -float tan(const float angle) -{ - const float s = sin(angle); - const float c = cos(angle); - return s / c; -} - -vec2 tan(const vec2 angle) -{ - const vec2 s = sin(angle); - const vec2 c = cos(angle); - return s / c; -} - -vec3 tan(const vec3 angle) -{ - const vec3 s = sin(angle); - const vec3 c = cos(angle); - return s / c; -} - -vec4 tan(const vec4 angle) -{ - const vec4 s = sin(angle); - const vec4 c = cos(angle); - return s / c; -} - - - -float asin(const float x) -{ - const float a0 = 1.5707288; // PI/2? - const float a1 = -0.2121144; - const float a2 = 0.0742610; - //const float a3 = -0.0187293; - const float halfPi = 3.1415926 * 0.5; - const float y = abs(x); - // three terms seem to be enough: - __retVal = (halfPi - sqrt(1.0 - y) * (a0 + y * (a1 + a2 * y))) * sign(x); - // otherwise, try four: - //__retVal = (halfPi - sqrt(1.0 - y) * (a0 + y * (a1 + y * (a2 + y * a3)))) * sign(x); -} - -vec2 asin(const vec2 v) -{ - __retVal.x = asin(v.x); - __retVal.y = asin(v.y); -} - -vec3 asin(const vec3 v) -{ - __retVal.x = asin(v.x); - __retVal.y = asin(v.y); - __retVal.z = asin(v.z); -} - -vec4 asin(const vec4 v) -{ - __retVal.x = asin(v.x); - __retVal.y = asin(v.y); - __retVal.z = asin(v.z); - __retVal.w = asin(v.w); -} - -float acos(const float x) -{ - const float halfPi = 3.1415926 * 0.5; - __retVal = halfPi - asin(x); -} - -vec2 acos(const vec2 v) -{ - __retVal.x = acos(v.x); - __retVal.y = acos(v.y); -} - -vec3 acos(const vec3 v) -{ - __retVal.x = acos(v.x); - __retVal.y = acos(v.y); - __retVal.z = acos(v.z); -} - -vec4 acos(const vec4 v) -{ - __retVal.x = acos(v.x); - __retVal.y = acos(v.y); - __retVal.z = acos(v.z); - __retVal.w = acos(v.w); -} - -float atan(const float x) -{ - __retVal = asin(x * inversesqrt(x * x + 1.0)); -} - -vec2 atan(const vec2 y_over_x) -{ - __retVal.x = atan(y_over_x.x); - __retVal.y = atan(y_over_x.y); -} - -vec3 atan(const vec3 y_over_x) -{ - __retVal.x = atan(y_over_x.x); - __retVal.y = atan(y_over_x.y); - __retVal.z = atan(y_over_x.z); -} - -vec4 atan(const vec4 y_over_x) -{ - __retVal.x = atan(y_over_x.x); - __retVal.y = atan(y_over_x.y); - __retVal.z = atan(y_over_x.z); - __retVal.w = atan(y_over_x.w); -} - -float atan(const float y, const float x) -{ - float r; - if (abs(x) > 1.0e-4) { - r = atan(y / x); - if (x < 0.0) { - r = r + 3.141593 - 6.283186 * float(y < 0.0); - } - } - else { - r = sign(y) * 1.5707965; // pi/2 - } - return r; -} - -vec2 atan(const vec2 u, const vec2 v) -{ - __retVal.x = atan(u.x, v.x); - __retVal.y = atan(u.y, v.y); -} - -vec3 atan(const vec3 u, const vec3 v) -{ - __retVal.x = atan(u.x, v.x); - __retVal.y = atan(u.y, v.y); - __retVal.z = atan(u.z, v.z); -} - -vec4 atan(const vec4 u, const vec4 v) -{ - __retVal.x = atan(u.x, v.x); - __retVal.y = atan(u.y, v.y); - __retVal.z = atan(u.z, v.z); - __retVal.w = atan(u.w, v.w); -} - - -// -// 8.2 Exponential Functions -// - -//// pow - -float pow(const float a, const float b) -{ - __asm float_power __retVal, a, b; -} - -vec2 pow(const vec2 a, const vec2 b) -{ - __asm float_power __retVal.x, a.x, b.x; - __asm float_power __retVal.y, a.y, b.y; -} - -vec3 pow(const vec3 a, const vec3 b) -{ - __asm float_power __retVal.x, a.x, b.x; - __asm float_power __retVal.y, a.y, b.y; - __asm float_power __retVal.z, a.z, b.z; -} - -vec4 pow(const vec4 a, const vec4 b) -{ - __asm float_power __retVal.x, a.x, b.x; - __asm float_power __retVal.y, a.y, b.y; - __asm float_power __retVal.z, a.z, b.z; - __asm float_power __retVal.w, a.w, b.w; -} - - -//// exp - -float exp(const float a) -{ - // NOTE: log2(e) = 1.44269502 - float t = a * 1.44269502; - __asm float_exp2 __retVal, t; -} - -vec2 exp(const vec2 a) -{ - vec2 t = a * 1.44269502; - __asm float_exp2 __retVal.x, t.x; - __asm float_exp2 __retVal.y, t.y; -} - -vec3 exp(const vec3 a) -{ - vec3 t = a * 1.44269502; - __asm float_exp2 __retVal.x, t.x; - __asm float_exp2 __retVal.y, t.y; - __asm float_exp2 __retVal.z, t.z; -} - -vec4 exp(const vec4 a) -{ - vec4 t = a * 1.44269502; - __asm float_exp2 __retVal.x, t.x; - __asm float_exp2 __retVal.y, t.y; - __asm float_exp2 __retVal.z, t.z; - __asm float_exp2 __retVal.w, t.w; -} - - - -//// log2 - -float log2(const float x) -{ - __asm float_log2 __retVal, x; -} - -vec2 log2(const vec2 v) -{ - __asm float_log2 __retVal.x, v.x; - __asm float_log2 __retVal.y, v.y; -} - -vec3 log2(const vec3 v) -{ - __asm float_log2 __retVal.x, v.x; - __asm float_log2 __retVal.y, v.y; - __asm float_log2 __retVal.z, v.z; -} - -vec4 log2(const vec4 v) -{ - __asm float_log2 __retVal.x, v.x; - __asm float_log2 __retVal.y, v.y; - __asm float_log2 __retVal.z, v.z; - __asm float_log2 __retVal.w, v.w; -} - - -//// log (natural log) - -float log(const float x) -{ - // note: logBaseB(x) = logBaseN(x) / logBaseN(B) - // compute log(x) = log2(x) / log2(e) - // c = 1.0 / log2(e) = 0.693147181 - const float c = 0.693147181; - return log2(x) * c; -} - -vec2 log(const vec2 v) -{ - const float c = 0.693147181; - return log2(v) * c; -} - -vec3 log(const vec3 v) -{ - const float c = 0.693147181; - return log2(v) * c; -} - -vec4 log(const vec4 v) -{ - const float c = 0.693147181; - return log2(v) * c; -} - - -//// exp2 - -float exp2(const float a) -{ - __asm float_exp2 __retVal, a; -} - -vec2 exp2(const vec2 a) -{ - __asm float_exp2 __retVal.x, a.x; - __asm float_exp2 __retVal.y, a.y; -} - -vec3 exp2(const vec3 a) -{ - __asm float_exp2 __retVal.x, a.x; - __asm float_exp2 __retVal.y, a.y; - __asm float_exp2 __retVal.z, a.z; -} - -vec4 exp2(const vec4 a) -{ - __asm float_exp2 __retVal.x, a.x; - __asm float_exp2 __retVal.y, a.y; - __asm float_exp2 __retVal.z, a.z; - __asm float_exp2 __retVal.w, a.w; -} - - -//// sqrt - -float sqrt(const float x) -{ - const float nx = -x; - float r; - __asm float_rsq r, x; - r = r * x; - __asm vec4_cmp __retVal, nx, r, 0.0; -} - -vec2 sqrt(const vec2 x) -{ - const vec2 nx = -x, zero = vec2(0.0); - vec2 r; - __asm float_rsq r.x, x.x; - __asm float_rsq r.y, x.y; - r = r * x; - __asm vec4_cmp __retVal, nx, r, zero; -} - -vec3 sqrt(const vec3 x) -{ - const vec3 nx = -x, zero = vec3(0.0); - vec3 r; - __asm float_rsq r.x, x.x; - __asm float_rsq r.y, x.y; - __asm float_rsq r.z, x.z; - r = r * x; - __asm vec4_cmp __retVal, nx, r, zero; -} - -vec4 sqrt(const vec4 x) -{ - const vec4 nx = -x, zero = vec4(0.0); - vec4 r; - __asm float_rsq r.x, x.x; - __asm float_rsq r.y, x.y; - __asm float_rsq r.z, x.z; - __asm float_rsq r.w, x.w; - r = r * x; - __asm vec4_cmp __retVal, nx, r, zero; -} - - -//// inversesqrt - -float inversesqrt(const float x) -{ - __asm float_rsq __retVal.x, x; -} - -vec2 inversesqrt(const vec2 v) -{ - __asm float_rsq __retVal.x, v.x; - __asm float_rsq __retVal.y, v.y; -} - -vec3 inversesqrt(const vec3 v) -{ - __asm float_rsq __retVal.x, v.x; - __asm float_rsq __retVal.y, v.y; - __asm float_rsq __retVal.z, v.z; -} - -vec4 inversesqrt(const vec4 v) -{ - __asm float_rsq __retVal.x, v.x; - __asm float_rsq __retVal.y, v.y; - __asm float_rsq __retVal.z, v.z; - __asm float_rsq __retVal.w, v.w; -} - - -//// normalize - -float normalize(const float x) -{ - __retVal = 1.0; -} - -vec2 normalize(const vec2 v) -{ - const float s = inversesqrt(dot(v, v)); - __asm vec4_multiply __retVal.xy, v, s; -} - -vec3 normalize(const vec3 v) -{ -// const float s = inversesqrt(dot(v, v)); -// __retVal = v * s; -// XXX note, we _could_ use __retVal.w instead of tmp and save a -// register, but that's actually a compilation error because v is a vec3 -// and the .w suffix is illegal. Oh well. - float tmp; - __asm vec3_dot tmp, v, v; - __asm float_rsq tmp, tmp; - __asm vec4_multiply __retVal.xyz, v, tmp; -} - -vec4 normalize(const vec4 v) -{ - float tmp; - __asm vec4_dot tmp, v, v; - __asm float_rsq tmp, tmp; - __asm vec4_multiply __retVal.xyz, v, tmp; -} - - - -// -// 8.3 Common Functions -// - - -//// abs - -float abs(const float a) -{ - __asm vec4_abs __retVal, a; -} - -vec2 abs(const vec2 a) -{ - __asm vec4_abs __retVal.xy, a; -} - -vec3 abs(const vec3 a) -{ - __asm vec4_abs __retVal.xyz, a; -} - -vec4 abs(const vec4 a) -{ - __asm vec4_abs __retVal, a; -} - - -//// sign - -float sign(const float x) -{ - float p, n; - __asm vec4_sgt p, x, 0.0; // p = (x > 0) - __asm vec4_sgt n, 0.0, x; // n = (x < 0) - __asm vec4_subtract __retVal, p, n; // sign = p - n -} - -vec2 sign(const vec2 v) -{ - vec2 p, n; - __asm vec4_sgt p.xy, v, 0.0; - __asm vec4_sgt n.xy, 0.0, v; - __asm vec4_subtract __retVal.xy, p, n; -} - -vec3 sign(const vec3 v) -{ - vec3 p, n; - __asm vec4_sgt p.xyz, v, 0.0; - __asm vec4_sgt n.xyz, 0.0, v; - __asm vec4_subtract __retVal.xyz, p, n; -} - -vec4 sign(const vec4 v) -{ - vec4 p, n; - __asm vec4_sgt p, v, 0.0; - __asm vec4_sgt n, 0.0, v; - __asm vec4_subtract __retVal, p, n; -} - - -//// floor - -float floor(const float a) -{ - __asm vec4_floor __retVal, a; -} - -vec2 floor(const vec2 a) -{ - __asm vec4_floor __retVal.xy, a; -} - -vec3 floor(const vec3 a) -{ - __asm vec4_floor __retVal.xyz, a; -} - -vec4 floor(const vec4 a) -{ - __asm vec4_floor __retVal, a; -} - - -//// ceil - -float ceil(const float a) -{ - // XXX this could be improved - float b = -a; - __asm vec4_floor b, b; - __retVal = -b; -} - -vec2 ceil(const vec2 a) -{ - vec2 b = -a; - __asm vec4_floor b, b; - __retVal.xy = -b; -} - -vec3 ceil(const vec3 a) -{ - vec3 b = -a; - __asm vec4_floor b, b; - __retVal.xyz = -b; -} - -vec4 ceil(const vec4 a) -{ - vec4 b = -a; - __asm vec4_floor b, b; - __retVal = -b; -} - - -//// fract - -float fract(const float a) -{ - __asm vec4_frac __retVal, a; -} - -vec2 fract(const vec2 a) -{ - __asm vec4_frac __retVal.xy, a; -} - -vec3 fract(const vec3 a) -{ - __asm vec4_frac __retVal.xyz, a; -} - -vec4 fract(const vec4 a) -{ - __asm vec4_frac __retVal, a; -} - - -//// mod (very untested!) - -float mod(const float a, const float b) -{ - float oneOverB; - __asm float_rcp oneOverB, b; - __retVal = a - b * floor(a * oneOverB); -} - -vec2 mod(const vec2 a, const float b) -{ - float oneOverB; - __asm float_rcp oneOverB, b; - __retVal.xy = a - b * floor(a * oneOverB); -} - -vec3 mod(const vec3 a, const float b) -{ - float oneOverB; - __asm float_rcp oneOverB, b; - __retVal.xyz = a - b * floor(a * oneOverB); -} - -vec4 mod(const vec4 a, const float b) -{ - float oneOverB; - __asm float_rcp oneOverB, b; - __retVal = a - b * floor(a * oneOverB); -} - -vec2 mod(const vec2 a, const vec2 b) -{ - vec2 oneOverB; - __asm float_rcp oneOverB.x, b.x; - __asm float_rcp oneOverB.y, b.y; - __retVal = a - b * floor(a * oneOverB); -} - -vec3 mod(const vec3 a, const vec3 b) -{ - vec3 oneOverB; - __asm float_rcp oneOverB.x, b.x; - __asm float_rcp oneOverB.y, b.y; - __asm float_rcp oneOverB.z, b.z; - __retVal = a - b * floor(a * oneOverB); -} - -vec4 mod(const vec4 a, const vec4 b) -{ - vec4 oneOverB; - __asm float_rcp oneOverB.x, b.x; - __asm float_rcp oneOverB.y, b.y; - __asm float_rcp oneOverB.z, b.z; - __asm float_rcp oneOverB.w, b.w; - __retVal = a - b * floor(a * oneOverB); -} - - -//// min - -float min(const float a, const float b) -{ - __asm vec4_min __retVal, a, b; -} - -vec2 min(const vec2 a, const vec2 b) -{ - __asm vec4_min __retVal.xy, a.xy, b.xy; -} - -vec3 min(const vec3 a, const vec3 b) -{ - __asm vec4_min __retVal.xyz, a.xyz, b.xyz; -} - -vec4 min(const vec4 a, const vec4 b) -{ - __asm vec4_min __retVal, a, b; -} - -vec2 min(const vec2 a, const float b) -{ - __asm vec4_min __retVal, a.xy, b; -} - -vec3 min(const vec3 a, const float b) -{ - __asm vec4_min __retVal, a.xyz, b; -} - -vec4 min(const vec4 a, const float b) -{ - __asm vec4_min __retVal, a, b; -} - - -//// max - -float max(const float a, const float b) -{ - __asm vec4_max __retVal, a, b; -} - -vec2 max(const vec2 a, const vec2 b) -{ - __asm vec4_max __retVal.xy, a.xy, b.xy; -} - -vec3 max(const vec3 a, const vec3 b) -{ - __asm vec4_max __retVal.xyz, a.xyz, b.xyz; -} - -vec4 max(const vec4 a, const vec4 b) -{ - __asm vec4_max __retVal, a, b; -} - -vec2 max(const vec2 a, const float b) -{ - __asm vec4_max __retVal, a.xy, b; -} - -vec3 max(const vec3 a, const float b) -{ - __asm vec4_max __retVal, a.xyz, b; -} - -vec4 max(const vec4 a, const float b) -{ - __asm vec4_max __retVal, a, b; -} - - -//// clamp - -float clamp(const float val, const float minVal, const float maxVal) -{ - __asm vec4_clamp __retVal, val, minVal, maxVal; -} - -vec2 clamp(const vec2 val, const float minVal, const float maxVal) -{ - __asm vec4_clamp __retVal, val, minVal, maxVal; -} - -vec3 clamp(const vec3 val, const float minVal, const float maxVal) -{ - __asm vec4_clamp __retVal, val, minVal, maxVal; -} - -vec4 clamp(const vec4 val, const float minVal, const float maxVal) -{ - __asm vec4_clamp __retVal, val, minVal, maxVal; -} - -vec2 clamp(const vec2 val, const vec2 minVal, const vec2 maxVal) -{ - __asm vec4_clamp __retVal, val, minVal, maxVal; -} - -vec3 clamp(const vec3 val, const vec3 minVal, const vec3 maxVal) -{ - __asm vec4_clamp __retVal, val, minVal, maxVal; -} - -vec4 clamp(const vec4 val, const vec4 minVal, const vec4 maxVal) -{ - __asm vec4_clamp __retVal, val, minVal, maxVal; -} - - -//// mix - -float mix(const float x, const float y, const float a) -{ - __asm vec4_lrp __retVal, a, y, x; -} - -vec2 mix(const vec2 x, const vec2 y, const float a) -{ - __asm vec4_lrp __retVal, a, y, x; -} - -vec3 mix(const vec3 x, const vec3 y, const float a) -{ - __asm vec4_lrp __retVal, a, y, x; -} - -vec4 mix(const vec4 x, const vec4 y, const float a) -{ - __asm vec4_lrp __retVal, a, y, x; -} - -vec2 mix(const vec2 x, const vec2 y, const vec2 a) -{ - __asm vec4_lrp __retVal, a, y, x; -} - -vec3 mix(const vec3 x, const vec3 y, const vec3 a) -{ - __asm vec4_lrp __retVal, a, y, x; -} - -vec4 mix(const vec4 x, const vec4 y, const vec4 a) -{ - __asm vec4_lrp __retVal, a, y, x; -} - - -//// step - -float step(const float edge, const float x) -{ - __asm vec4_sge __retVal, x, edge; -} - -vec2 step(const vec2 edge, const vec2 x) -{ - __asm vec4_sge __retVal.xy, x, edge; -} - -vec3 step(const vec3 edge, const vec3 x) -{ - __asm vec4_sge __retVal.xyz, x, edge; -} - -vec4 step(const vec4 edge, const vec4 x) -{ - __asm vec4_sge __retVal, x, edge; -} - -vec2 step(const float edge, const vec2 v) -{ - __asm vec4_sge __retVal.xy, v, edge; -} - -vec3 step(const float edge, const vec3 v) -{ - __asm vec4_sge __retVal.xyz, v, edge; -} - -vec4 step(const float edge, const vec4 v) -{ - __asm vec4_sge __retVal, v, edge; -} - - -//// smoothstep - -float smoothstep(const float edge0, const float edge1, const float x) -{ - float t = clamp((x - edge0) / (edge1 - edge0), 0.0, 1.0); - return t * t * (3.0 - 2.0 * t); -} - -vec2 smoothstep(const vec2 edge0, const vec2 edge1, const vec2 v) -{ - vec2 t = clamp((v - edge0) / (edge1 - edge0), 0.0, 1.0); - return t * t * (3.0 - 2.0 * t); -} - -vec3 smoothstep(const vec3 edge0, const vec3 edge1, const vec3 v) -{ - vec3 t = clamp((v - edge0) / (edge1 - edge0), 0.0, 1.0); - return t * t * (3.0 - 2.0 * t); -} - -vec4 smoothstep(const vec4 edge0, const vec4 edge1, const vec4 v) -{ - vec4 t = clamp((v - edge0) / (edge1 - edge0), 0.0, 1.0); - return t * t * (3.0 - 2.0 * t); -} - -vec2 smoothstep(const float edge0, const float edge1, const vec2 v) -{ - vec2 t = clamp((v - edge0) / (edge1 - edge0), 0.0, 1.0); - return t * t * (3.0 - 2.0 * t); -} - -vec3 smoothstep(const float edge0, const float edge1, const vec3 v) -{ - vec3 t = clamp((v - edge0) / (edge1 - edge0), 0.0, 1.0); - return t * t * (3.0 - 2.0 * t); -} - -vec4 smoothstep(const float edge0, const float edge1, const vec4 v) -{ - vec4 t = clamp((v - edge0) / (edge1 - edge0), 0.0, 1.0); - return t * t * (3.0 - 2.0 * t); -} - - - -// -// 8.4 Geometric Functions -// - - -//// length - -float length(const float x) -{ - return abs(x); -} - -float length(const vec2 v) -{ - float r; - const float p = dot(v, v); // p = v.x * v.x + v.y * v.y - __asm float_rsq r, p; // r = 1 / sqrt(p) - __retVal = p * r; // p * r = sqrt(p); -} - -float length(const vec3 v) -{ - float r; - const float p = dot(v, v); // p = v.x * v.x + v.y * v.y + v.z * v.z - __asm float_rsq r, p; // r = 1 / sqrt(p) - __retVal = p * r; // p * r = sqrt(p); -} - -float length(const vec4 v) -{ - float r; - const float p = dot(v, v); // p = v.x * v.x + v.y * v.y + ... - __asm float_rsq r, p; // r = 1 / sqrt(p) - __retVal = p * r; // p * r = sqrt(p); -} - - -//// distance - -float distance(const float x, const float y) -{ - const float d = x - y; - __retVal = length(d); -} - -float distance(const vec2 v, const vec2 u) -{ - const vec2 d2 = v - u; - __retVal = length(d2); -} - -float distance(const vec3 v, const vec3 u) -{ - const vec3 d3 = v - u; - __retVal = length(d3); -} - -float distance(const vec4 v, const vec4 u) -{ - const vec4 d4 = v - u; - __retVal = length(d4); -} - - -//// cross - -vec3 cross(const vec3 v, const vec3 u) -{ - __asm vec3_cross __retVal.xyz, v, u; -} - - -//// faceforward - -float faceforward(const float N, const float I, const float Nref) -{ - // this could probably be done better - const float d = dot(Nref, I); - float s; - __asm vec4_sgt s, 0.0, d; // s = (0.0 > d) ? 1 : 0 - return mix(-N, N, s); -} - -vec2 faceforward(const vec2 N, const vec2 I, const vec2 Nref) -{ - // this could probably be done better - const float d = dot(Nref, I); - float s; - __asm vec4_sgt s, 0.0, d; // s = (0.0 > d) ? 1 : 0 - return mix(-N, N, s); -} - -vec3 faceforward(const vec3 N, const vec3 I, const vec3 Nref) -{ - // this could probably be done better - const float d = dot(Nref, I); - float s; - __asm vec4_sgt s, 0.0, d; // s = (0.0 > d) ? 1 : 0 - return mix(-N, N, s); -} - -vec4 faceforward(const vec4 N, const vec4 I, const vec4 Nref) -{ - // this could probably be done better - const float d = dot(Nref, I); - float s; - __asm vec4_sgt s, 0.0, d; // s = (0.0 > d) ? 1 : 0 - return mix(-N, N, s); -} - - -//// reflect - -float reflect(const float I, const float N) -{ - return I - 2.0 * dot(N, I) * N; -} - -vec2 reflect(const vec2 I, const vec2 N) -{ - return I - 2.0 * dot(N, I) * N; -} - -vec3 reflect(const vec3 I, const vec3 N) -{ - return I - 2.0 * dot(N, I) * N; -} - -vec4 reflect(const vec4 I, const vec4 N) -{ - return I - 2.0 * dot(N, I) * N; -} - -//// refract - -float refract(const float I, const float N, const float eta) -{ - float n_dot_i = dot(N, I); - float k = 1.0 - eta * eta * (1.0 - n_dot_i * n_dot_i); - float retval; - if (k < 0.0) - retval = 0.0; - else - retval = eta * I - (eta * n_dot_i + sqrt(k)) * N; - return retval; -} - -vec2 refract(const vec2 I, const vec2 N, const float eta) -{ - float n_dot_i = dot(N, I); - float k = 1.0 - eta * eta * (1.0 - n_dot_i * n_dot_i); - vec2 retval; - if (k < 0.0) - retval = vec2(0.0); - else - retval = eta * I - (eta * n_dot_i + sqrt(k)) * N; - return retval; -} - -vec3 refract(const vec3 I, const vec3 N, const float eta) -{ - float n_dot_i = dot(N, I); - float k = 1.0 - eta * eta * (1.0 - n_dot_i * n_dot_i); - vec3 retval; - if (k < 0.0) - retval = vec3(0.0); - else - retval = eta * I - (eta * n_dot_i + sqrt(k)) * N; - return retval; -} - -vec4 refract(const vec4 I, const vec4 N, const float eta) -{ - float n_dot_i = dot(N, I); - float k = 1.0 - eta * eta * (1.0 - n_dot_i * n_dot_i); - vec4 retval; - if (k < 0.0) - retval = vec4(0.0); - else - retval = eta * I - (eta * n_dot_i + sqrt(k)) * N; - return retval; -} - - - - -// -// 8.5 Matrix Functions -// - -mat2 matrixCompMult (mat2 m, mat2 n) { - return mat2 (m[0] * n[0], m[1] * n[1]); -} - -mat3 matrixCompMult (mat3 m, mat3 n) { - return mat3 (m[0] * n[0], m[1] * n[1], m[2] * n[2]); -} - -mat4 matrixCompMult (mat4 m, mat4 n) { - return mat4 (m[0] * n[0], m[1] * n[1], m[2] * n[2], m[3] * n[3]); -} - - - - -// -// 8.6 Vector Relational Functions -// - -//// lessThan - -bvec2 lessThan(const vec2 u, const vec2 v) -{ - __asm vec4_slt __retVal.xy, u, v; -} - -bvec3 lessThan(const vec3 u, const vec3 v) -{ - __asm vec4_slt __retVal.xyz, u, v; -} - -bvec4 lessThan(const vec4 u, const vec4 v) -{ - __asm vec4_slt __retVal, u, v; -} - -bvec2 lessThan(const ivec2 u, const ivec2 v) -{ - __asm vec4_slt __retVal.xy, u, v; -} - -bvec3 lessThan(const ivec3 u, const ivec3 v) -{ - __asm vec4_slt __retVal.xyz, u, v; -} - -bvec4 lessThan(const ivec4 u, const ivec4 v) -{ - __asm vec4_slt __retVal, u, v; -} - - -//// lessThanEqual - -bvec2 lessThanEqual(const vec2 u, const vec2 v) -{ - __asm vec4_sle __retVal.xy, u, v; -} - -bvec3 lessThanEqual(const vec3 u, const vec3 v) -{ - __asm vec4_sle __retVal.xyz, u, v; -} - -bvec4 lessThanEqual(const vec4 u, const vec4 v) -{ - __asm vec4_sle __retVal, u, v; -} - -bvec2 lessThanEqual(const ivec2 u, const ivec2 v) -{ - __asm vec4_sle __retVal.xy, u, v; -} - -bvec3 lessThanEqual(const ivec3 u, const ivec3 v) -{ - __asm vec4_sle __retVal.xyz, u, v; -} - -bvec4 lessThanEqual(const ivec4 u, const ivec4 v) -{ - __asm vec4_sle __retVal, u, v; -} - - -//// greaterThan - -bvec2 greaterThan(const vec2 u, const vec2 v) -{ - __asm vec4_sgt __retVal.xy, u, v; -} - -bvec3 greaterThan(const vec3 u, const vec3 v) -{ - __asm vec4_sgt __retVal.xyz, u, v; -} - -bvec4 greaterThan(const vec4 u, const vec4 v) -{ - __asm vec4_sgt __retVal, u, v; -} - -bvec2 greaterThan(const ivec2 u, const ivec2 v) -{ - __asm vec4_sgt __retVal.xy, u.xy, v.xy; -} - -bvec3 greaterThan(const ivec3 u, const ivec3 v) -{ - __asm vec4_sgt __retVal.xyz, u, v; -} - -bvec4 greaterThan(const ivec4 u, const ivec4 v) -{ - __asm vec4_sgt __retVal, u, v; -} - - -//// greaterThanEqual - -bvec2 greaterThanEqual(const vec2 u, const vec2 v) -{ - __asm vec4_sge __retVal.xy, u, v; -} - -bvec3 greaterThanEqual(const vec3 u, const vec3 v) -{ - __asm vec4_sge __retVal.xyz, u, v; -} - -bvec4 greaterThanEqual(const vec4 u, const vec4 v) -{ - __asm vec4_sge __retVal, u, v; -} - -bvec2 greaterThanEqual(const ivec2 u, const ivec2 v) -{ - __asm vec4_sge __retVal.xy, u, v; -} - -bvec3 greaterThanEqual(const ivec3 u, const ivec3 v) -{ - __asm vec4_sge __retVal.xyz, u, v; -} - -bvec4 greaterThanEqual(const ivec4 u, const ivec4 v) -{ - __asm vec4_sge __retVal, u, v; -} - - -//// equal - -bvec2 equal(const vec2 u, const vec2 v) -{ - __asm vec4_seq __retVal.xy, u, v; -} - -bvec3 equal(const vec3 u, const vec3 v) -{ - __asm vec4_seq __retVal.xyz, u, v; -} - -bvec4 equal(const vec4 u, const vec4 v) -{ - __asm vec4_seq __retVal, u, v; -} - -bvec2 equal(const ivec2 u, const ivec2 v) -{ - __asm vec4_seq __retVal.xy, u, v; -} - -bvec3 equal(const ivec3 u, const ivec3 v) -{ - __asm vec4_seq __retVal.xyz, u, v; -} - -bvec4 equal(const ivec4 u, const ivec4 v) -{ - __asm vec4_seq __retVal, u, v; -} - -bvec2 equal(const bvec2 u, const bvec2 v) -{ - __asm vec4_seq __retVal.xy, u, v; -} - -bvec3 equal(const bvec3 u, const bvec3 v) -{ - __asm vec4_seq __retVal.xyz, u, v; -} - -bvec4 equal(const bvec4 u, const bvec4 v) -{ - __asm vec4_seq __retVal, u, v; -} - - - - -//// notEqual - -bvec2 notEqual(const vec2 u, const vec2 v) -{ - __asm vec4_sne __retVal.xy, u, v; -} - -bvec3 notEqual(const vec3 u, const vec3 v) -{ - __asm vec4_sne __retVal.xyz, u, v; -} - -bvec4 notEqual(const vec4 u, const vec4 v) -{ - __asm vec4_sne __retVal, u, v; -} - -bvec2 notEqual(const ivec2 u, const ivec2 v) -{ - __asm vec4_sne __retVal.xy, u, v; -} - -bvec3 notEqual(const ivec3 u, const ivec3 v) -{ - __asm vec4_sne __retVal.xyz, u, v; -} - -bvec4 notEqual(const ivec4 u, const ivec4 v) -{ - __asm vec4_sne __retVal, u, v; -} - -bvec2 notEqual(const bvec2 u, const bvec2 v) -{ - __asm vec4_sne __retVal.xy, u, v; -} - -bvec3 notEqual(const bvec3 u, const bvec3 v) -{ - __asm vec4_sne __retVal.xyz, u, v; -} - -bvec4 notEqual(const bvec4 u, const bvec4 v) -{ - __asm vec4_sne __retVal, u, v; -} - - - -//// any - -bool any(const bvec2 v) -{ - float sum; - __asm vec4_add sum.x, v.x, v.y; - __asm vec4_sne __retVal.x, sum.x, 0.0; -} - -bool any(const bvec3 v) -{ - float sum; - __asm vec4_add sum.x, v.x, v.y; - __asm vec4_add sum.x, sum.x, v.z; - __asm vec4_sne __retVal.x, sum.x, 0.0; -} - -bool any(const bvec4 v) -{ - float sum; - __asm vec4_add sum.x, v.x, v.y; - __asm vec4_add sum.x, sum.x, v.z; - __asm vec4_add sum.x, sum.x, v.w; - __asm vec4_sne __retVal.x, sum.x, 0.0; -} - - -//// all - -bool all (const bvec2 v) -{ - float prod; - __asm vec4_multiply prod, v.x, v.y; - __asm vec4_sne __retVal, prod, 0.0; -} - -bool all (const bvec3 v) -{ - float prod; - __asm vec4_multiply prod, v.x, v.y; - __asm vec4_multiply prod, prod, v.z; - __asm vec4_sne __retVal, prod, 0.0; -} - -bool all (const bvec4 v) -{ - float prod; - __asm vec4_multiply prod, v.x, v.y; - __asm vec4_multiply prod, prod, v.z; - __asm vec4_multiply prod, prod, v.w; - __asm vec4_sne __retVal, prod, 0.0; -} - - - -//// not - -bvec2 not (const bvec2 v) -{ - __asm vec4_seq __retVal.xy, v, 0.0; -} - -bvec3 not (const bvec3 v) -{ - __asm vec4_seq __retVal.xyz, v, 0.0; -} - -bvec4 not (const bvec4 v) -{ - __asm vec4_seq __retVal, v, 0.0; -} - - - -//// Texture Lookup Functions (for both fragment and vertex shaders) - -vec4 texture1D(const sampler1D sampler, const float coord) -{ - __asm vec4_tex_1d __retVal, sampler, coord; -} - -vec4 texture1DProj(const sampler1D sampler, const vec2 coord) -{ - // need to swizzle .y into .w - __asm vec4_tex_1d_proj __retVal, sampler, coord.xyyy; -} - -vec4 texture1DProj(const sampler1D sampler, const vec4 coord) -{ - __asm vec4_tex_1d_proj __retVal, sampler, coord; -} - - -vec4 texture2D(const sampler2D sampler, const vec2 coord) -{ - __asm vec4_tex_2d __retVal, sampler, coord; -} - -vec4 texture2DProj(const sampler2D sampler, const vec3 coord) -{ - // need to swizzle 'z' into 'w'. - __asm vec4_tex_2d_proj __retVal, sampler, coord.xyzz; -} - -vec4 texture2DProj(const sampler2D sampler, const vec4 coord) -{ - __asm vec4_tex_2d_proj __retVal, sampler, coord; -} - - -vec4 texture3D(const sampler3D sampler, const vec3 coord) -{ - __asm vec4_tex_3d __retVal, sampler, coord; -} - -vec4 texture3DProj(const sampler3D sampler, const vec4 coord) -{ - __asm vec4_tex_3d_proj __retVal, sampler, coord; -} - - -vec4 textureCube(const samplerCube sampler, const vec3 coord) -{ - __asm vec4_tex_cube __retVal, sampler, coord; -} - - - -vec4 shadow1D(const sampler1DShadow sampler, const vec3 coord) -{ - __asm vec4_tex_1d_shadow __retVal, sampler, coord; -} - -vec4 shadow1DProj(const sampler1DShadow sampler, const vec4 coord) -{ - // .s and .p will be divided by .q - __asm vec4_tex_1d_proj_shadow __retVal, sampler, coord; -} - -vec4 shadow2D(const sampler2DShadow sampler, const vec3 coord) -{ - __asm vec4_tex_2d_shadow __retVal, sampler, coord; -} - -vec4 shadow2DProj(const sampler2DShadow sampler, const vec4 coord) -{ - // .s, .t and .p will be divided by .q - __asm vec4_tex_2d_proj_shadow __retVal, sampler, coord; -} - - -//// GL_ARB_texture_rectangle: -vec4 texture2DRect(const sampler2DRect sampler, const vec2 coord) -{ - __asm vec4_tex_rect __retVal, sampler, coord; -} - -vec4 texture2DRectProj(const sampler2DRect sampler, const vec3 coord) -{ - // need to swizzle .y into .w - __asm vec4_tex_rect_proj __retVal, sampler, coord.xyzz; -} - -vec4 texture2DRectProj(const sampler2DRect sampler, const vec4 coord) -{ - __asm vec4_tex_rect_proj __retVal, sampler, ccoord; -} - -vec4 shadow2DRect(const sampler2DRectShadow sampler, const vec3 coord) -{ - __asm vec4_tex_rect_shadow __retVal, sampler, coord; -} - -vec4 shadow2DRectProj(const sampler2DRectShadow sampler, const vec4 coord) -{ - __asm vec4_tex_rect_proj_shadow __retVal, sampler, coord; -} - - - -//// GL_EXT_texture_array -vec4 texture1DArray(const sampler1DArray sampler, const vec2 coord) -{ - __asm vec4_tex_1d_array __retVal, sampler, coord; -} - -vec4 texture2DArray(const sampler2DArray sampler, const vec3 coord) -{ - __asm vec4_tex_2d_array __retVal, sampler, coord; -} - - -// -// 8.9 Noise Functions -// -// AUTHOR: Stefan Gustavson (stegu@itn.liu.se), Nov 26, 2005 -// - -float noise1(const float x) -{ - __asm float_noise1 __retVal, x; -} - - -float noise1(const vec2 x) -{ - __asm float_noise2 __retVal, x; -} - -float noise1(const vec3 x) -{ - __asm float_noise3 __retVal, x; -} - -float noise1(const vec4 x) -{ - __asm float_noise4 __retVal, x; -} - -vec2 noise2(const float x) -{ - __retVal.x = noise1(x); - __retVal.y = noise1(x + 19.34); -} - -vec2 noise2(const vec2 x) -{ - __retVal.x = noise1(x); - __retVal.y = noise1(x + vec2(19.34, 7.66)); -} - -vec2 noise2(const vec3 x) -{ - __retVal.x = noise1(x); - __retVal.y = noise1(x + vec3(19.34, 7.66, 3.23)); -} - -vec2 noise2(const vec4 x) -{ - __retVal.x = noise1(x); - __retVal.y = noise1(x + vec4(19.34, 7.66, 3.23, 2.77)); -} - -vec3 noise3(const float x) -{ - __retVal.x = noise1(x); - __retVal.y = noise1(x + 19.34); - __retVal.z = noise1(x + 5.47); -} - -vec3 noise3(const vec2 x) -{ - __retVal.x = noise1(x); - __retVal.y = noise1(x + vec2(19.34, 7.66)); - __retVal.z = noise1(x + vec2(5.47, 17.85)); -} - -vec3 noise3(const vec3 x) -{ - __retVal.x = noise1(x); - __retVal.y = noise1(x + vec3(19.34, 7.66, 3.23)); - __retVal.z = noise1(x + vec3(5.47, 17.85, 11.04)); -} - -vec3 noise3(const vec4 x) -{ - __retVal.x = noise1(x); - __retVal.y = noise1(x + vec4(19.34, 7.66, 3.23, 2.77)); - __retVal.z = noise1(x + vec4(5.47, 17.85, 11.04, 13.19)); -} - -vec4 noise4(const float x) -{ - __retVal.x = noise1(x); - __retVal.y = noise1(x + 19.34); - __retVal.z = noise1(x + 5.47); - __retVal.w = noise1(x + 23.54); -} - -vec4 noise4(const vec2 x) -{ - __retVal.x = noise1(x); - __retVal.y = noise1(x + vec2 (19.34, 7.66)); - __retVal.z = noise1(x + vec2 (5.47, 17.85)); - __retVal.w = noise1(x + vec2 (23.54, 29.11)); -} - -vec4 noise4(const vec3 x) -{ - __retVal.x = noise1(x); - __retVal.y = noise1(x + vec3(19.34, 7.66, 3.23)); - __retVal.z = noise1(x + vec3(5.47, 17.85, 11.04)); - __retVal.w = noise1(x + vec3(23.54, 29.11, 31.91)); -} - -vec4 noise4(const vec4 x) -{ - __retVal.x = noise1(x); - __retVal.y = noise1(x + vec4(19.34, 7.66, 3.23, 2.77)); - __retVal.z = noise1(x + vec4(5.47, 17.85, 11.04, 13.19)); - __retVal.w = noise1(x + vec4(23.54, 29.11, 31.91, 37.48)); -} diff --git a/src/mesa/slang/library/slang_core.gc b/src/mesa/slang/library/slang_core.gc deleted file mode 100644 index 0a0d15903b..0000000000 --- a/src/mesa/slang/library/slang_core.gc +++ /dev/null @@ -1,2619 +0,0 @@ -/* - * Mesa 3-D graphics library - * Version: 6.5 - * - * Copyright (C) 2006 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. - */ - -// -// This file defines nearly all constructors and operators for built-in data -// types, using extended language syntax. In general, compiler treats -// constructors and operators as ordinary functions with some exceptions. -// For example, the language does not allow functions to be called in -// constant expressions - here the exception is made to allow it. -// -// Each implementation provides its own version of this file. Each -// implementation can define the required set of operators and constructors -// in its own fashion. -// -// The extended language syntax is only present when compiling this file. -// It is implicitly included at the very beginning of the compiled shader, -// so no built-in functions can be used. -// -// To communicate with the implementation, a special extended "__asm" keyword -// is used, followed by an instruction name (any valid identifier), a -// destination variable identifier and a list of zero or more source -// variable identifiers. -// -// A variable identifier is a variable name declared earlier in the code -// (as a function parameter, local or global variable). -// -// An instruction name designates an instruction that must be exported -// by the implementation. Each instruction receives data from source -// variable identifiers and returns data in the destination variable -// identifier. -// -// It is up to the implementation how to define a particular operator -// or constructor. If it is expected to being used rarely, it can be -// defined in terms of other operators and constructors, -// for example: -// -// ivec2 __operator + (const ivec2 x, const ivec2 y) { -// return ivec2 (x[0] + y[0], x[1] + y[1]); -// } -// -// If a particular operator or constructor is expected to be used very -// often or is an atomic operation (that is, an operation that cannot be -// expressed in terms of other operations or would create a dependency -// cycle) it must be defined using one or more __asm constructs. -// -// Each implementation must define constructors for all scalar types -// (bool, float, int). There are 9 scalar-to-scalar constructors -// (including identity constructors). However, since the language -// introduces special constructors (like matrix constructor with a single -// scalar value), implementations must also implement these cases. -// The compiler provides the following algorithm when resolving a constructor: -// - try to find a constructor with a prototype matching ours, -// - if no constructor is found and this is a scalar-to-scalar constructor, -// raise an error, -// - if a constructor is found, execute it and return, -// - count the size of the constructor parameter list - if it is less than -// the size of our constructor's type, raise an error, -// - for each parameter in the list do a recursive constructor matching for -// appropriate scalar fields in the constructed variable, -// -// Each implementation must also define a set of operators that deal with -// built-in data types. -// There are four kinds of operators: -// 1) Operators that are implemented only by the compiler: "()" (function -// call), "," (sequence) and "?:" (selection). -// 2) Operators that are implemented by the compiler by expressing it in -// terms of other operators: -// - "." (field selection) - translated to subscript access, -// - "&&" (logical and) - translated to " ? : -// false", -// - "||" (logical or) - translated to " ? true : ", -// 3) Operators that can be defined by the implementation and if the required -// prototype is not found, standard behaviour is used: -// - "==", "!=", "=" (equality, assignment) - compare or assign -// matching fields one-by-one; -// note that at least operators for scalar data types must be defined -// by the implementation to get it work, -// 4) All other operators not mentioned above. If no required prototype is -// found, an error is raised. An implementation must follow the language -// specification to provide all valid operator prototypes. -// - - - -//// Basic, scalar constructors/casts - -int __constructor(const float f) -{ - __asm vec4_to_ivec4 __retVal, f; -} - -int __constructor(const bool b) -{ - __retVal = b; -} - -int __constructor(const int i) -{ - __retVal = i; -} - -bool __constructor(const int i) -{ - __asm vec4_sne __retVal, i, 0.0; -} - -bool __constructor(const float f) -{ - __asm vec4_sne __retVal, f, 0.0; -} - -bool __constructor(const bool b) -{ - __retVal = b; -} - -float __constructor(const int i) -{ - __asm ivec4_to_vec4 __retVal, i; -} - -float __constructor(const bool b) -{ - __asm ivec4_to_vec4 __retVal, b; -} - -float __constructor(const float f) -{ - __retVal = f; -} - - -//// vec2 constructors - -vec2 __constructor(const float x, const float y) -{ - __retVal.x = x; - __retVal.y = y; -} - -vec2 __constructor(const float f) -{ - __asm vec4_move __retVal.xy, f; -} - -vec2 __constructor(const int i) -{ - __asm ivec4_to_vec4 __retVal.xy, i; -} - -vec2 __constructor(const bool b) -{ - __asm ivec4_to_vec4 __retVal.xy, b; -} - -vec2 __constructor(const bvec2 b) -{ -// __retVal = b; - __asm ivec4_to_vec4 __retVal.xy, b; -} - -vec2 __constructor(const vec3 v) -{ - __asm vec4_move __retVal.xy, v.xy; -} - -vec2 __constructor(const vec4 v) -{ - __asm vec4_move __retVal.xy, v.xy; -} - - -//// vec3 constructors - -vec3 __constructor(const float x, const float y, const float z) -{ - __retVal.x = x; - __retVal.y = y; - __retVal.z = z; -} - -vec3 __constructor(const float f) -{ - // Note: this could be "__retVal.xyz = f" but that's an illegal assignment - __asm vec4_move __retVal.xyz, f; -} - -vec3 __constructor(const int i) -{ - __asm ivec4_to_vec4 __retVal.xyz, i; -} - -vec3 __constructor(const bool b) -{ - __asm ivec4_to_vec4 __retVal.xyz, b; -} - -vec3 __constructor(const bvec3 b) -{ - __asm ivec4_to_vec4 __retVal.xyz, b; -} - -vec3 __constructor(const vec4 v) -{ - __asm vec4_move __retVal.xyz, v; -} - - -//// vec4 constructors - -vec4 __constructor(const float x, const float y, const float z, const float w) -{ - __retVal.x = x; - __retVal.y = y; - __retVal.z = z; - __retVal.w = w; -} - -vec4 __constructor(const float f) -{ - // Note: this could be "__retVal = f" but that's an illegal assignment - __asm vec4_move __retVal, f; -} - -vec4 __constructor(const int i) -{ - __asm ivec4_to_vec4 __retVal, i; -} - -vec4 __constructor(const bool b) -{ - __asm ivec4_to_vec4 __retVal, b; -} - -vec4 __constructor(const bvec4 b) -{ - __asm ivec4_to_vec4 __retVal, b; -} - -vec4 __constructor(const ivec4 i) -{ - __asm ivec4_to_vec4 __retVal, i; -} - -vec4 __constructor(const vec3 v3, const float f) -{ - // XXX this constructor shouldn't be needed anymore - __retVal.xyz = v3; - __retVal.w = f; -} - -vec4 __constructor(const vec2 v2, const float f1, const float f2) -{ - // XXX this constructor shouldn't be needed anymore - __retVal.xy = v2; - __retVal.z = f1; - __retVal.w = f2; -} - - -//// ivec2 constructors - -ivec2 __constructor(const int i, const int j) -{ - __retVal.x = i; - __retVal.y = j; -} - -ivec2 __constructor(const int i) -{ - __asm vec4_move __retVal.xy, i; -} - -ivec2 __constructor(const float f) -{ - __asm vec4_to_ivec4 __retVal.xy, f; -} - -ivec2 __constructor(const bool b) -{ - __asm vec4_to_ivec4 __retVal.xy, b; -} - - -//// ivec3 constructors - -ivec3 __constructor(const int i, const int j, const int k) -{ - __retVal.x = i; - __retVal.y = j; - __retVal.z = k; -} - -ivec3 __constructor(const int i) -{ - __asm vec4_move __retVal.xyz, i; -} - -ivec3 __constructor(const float f) -{ - __asm vec4_to_ivec4 __retVal.xyz, f; -} - -ivec3 __constructor(const bool b) -{ - __asm vec4_move __retVal.xyz, b; -} - - -//// ivec4 constructors - -ivec4 __constructor(const int x, const int y, const int z, const int w) -{ - __retVal.x = x; - __retVal.y = y; - __retVal.z = z; - __retVal.w = w; -} - -ivec4 __constructor(const int i) -{ - __asm vec4_move __retVal, i; -} - -ivec4 __constructor(const float f) -{ - __asm vec4_to_ivec4 __retVal, f; -} - -ivec4 __constructor(const bool b) -{ - __asm vec4_to_ivec4 __retVal, b; -} - - -//// bvec2 constructors - -bvec2 __constructor(const bool b1, const bool b2) -{ - __retVal.x = b1; - __retVal.y = b2; -} - -bvec2 __constructor(const int i1, const int i2) -{ - __asm vec4_sne __retVal.x, i1, 0.0; - __asm vec4_sne __retVal.y, i2, 0.0; -} - - -bvec2 __constructor(const bool b) -{ - __asm vec4_move __retVal.xy, b; -} - -bvec2 __constructor(const float f) -{ - __asm vec4_sne __retVal.xy, f, 0.0; -} - -bvec2 __constructor(const int i) -{ - __asm vec4_sne __retVal.xy, i, 0.0; -} - -bvec2 __constructor(const vec2 v) -{ - __asm vec4_sne __retVal.xy, v, 0.0; -} - -bvec2 __constructor(const ivec2 v) -{ - __asm vec4_sne __retVal.xy, v, 0.0; -} - - - -//// bvec3 constructors - -bvec3 __constructor(const bool b1, const bool b2, const bool b3) -{ - __retVal.x = b1; - __retVal.y = b2; - __retVal.z = b3; -} - -bvec3 __constructor(const float f1, const float f2, const float f3) -{ - __asm vec4_sne __retVal.x, f1, 0.0; - __asm vec4_sne __retVal.y, f2, 0.0; - __asm vec4_sne __retVal.z, f3, 0.0; -} - -bvec3 __constructor(const bool b) -{ - __asm vec4_move __retVal.xyz, b; -} - -bvec3 __constructor(const float f) -{ - __asm vec4_sne __retVal.xyz, f, 0.0; -} - -bvec3 __constructor(const int i) -{ - __asm vec4_sne __retVal.xyz, i, 0.0; -} - -bvec3 __constructor(const vec3 v) -{ - __asm vec4_sne __retVal.xyz, v, 0.0; -} - -bvec3 __constructor(const ivec3 v) -{ - __asm vec4_sne __retVal.xyz, v, 0.0; -} - - - -//// bvec4 constructors - -bvec4 __constructor(const bool b1, const bool b2, const bool b3, const bool b4) -{ - __retVal.x = b1; - __retVal.y = b2; - __retVal.z = b3; - __retVal.w = b4; -} - -bvec4 __constructor(const float f1, const float f2, const float f3, const float f4) -{ - const float zero = 0.0; - __asm vec4_sne __retVal.x, f1, zero; - __asm vec4_sne __retVal.y, f2, zero; - __asm vec4_sne __retVal.z, f3, zero; - __asm vec4_sne __retVal.w, f4, zero; -} - -bvec4 __constructor(const bool b) -{ - __asm vec4_move __retVal.xyzw, b; -} - -bvec4 __constructor(const float f) -{ - __asm vec4_sne __retVal.xyzw, f, 0.0; -} - -bvec4 __constructor(const int i) -{ - __asm vec4_sne __retVal.xyzw, i, 0.0; -} - -bvec4 __constructor(const vec4 v) -{ - __asm vec4_sne __retVal.xyzw, v, 0.0; -} - -bvec4 __constructor(const ivec4 v) -{ - __asm vec4_sne __retVal.xyzw, v, 0.0; -} - - - -//// mat2 constructors - -mat2 __constructor(const float m00, const float m10, - const float m01, const float m11) -{ - __retVal[0].x = m00; - __retVal[0].y = m10; - __retVal[1].x = m01; - __retVal[1].y = m11; -} - -mat2 __constructor(const float f) -{ - __retVal[0].x = f; - __retVal[0].y = 0.0; - __retVal[1].x = 0.0; - __retVal[1].y = f; -} - -mat2 __constructor(const int i) -{ - return mat2(float(i)); -} - -mat2 __constructor(const bool b) -{ - return mat2(float(b)); -} - -mat2 __constructor(const vec2 c0, const vec2 c1) -{ - __retVal[0] = c0; - __retVal[1] = c1; -} - - -//// mat3 constructors - -mat3 __constructor(const float m00, const float m10, const float m20, - const float m01, const float m11, const float m21, - const float m02, const float m12, const float m22) -{ - __retVal[0].x = m00; - __retVal[0].y = m10; - __retVal[0].z = m20; - __retVal[1].x = m01; - __retVal[1].y = m11; - __retVal[1].z = m21; - __retVal[2].x = m02; - __retVal[2].y = m12; - __retVal[2].z = m22; -} - -mat3 __constructor(const float f) -{ - vec2 v = vec2(f, 0.0); - __retVal[0] = v.xyy; - __retVal[1] = v.yxy; - __retVal[2] = v.yyx; -} - -mat3 __constructor(const int i) -{ - return mat3(float(i)); -} - -mat3 __constructor(const bool b) -{ - return mat3(float(b)); -} - -mat3 __constructor(const vec3 c0, const vec3 c1, const vec3 c2) -{ - __retVal[0] = c0; - __retVal[1] = c1; - __retVal[2] = c2; -} - - -//// mat4 constructors - -mat4 __constructor(const float m00, const float m10, const float m20, const float m30, - const float m01, const float m11, const float m21, const float m31, - const float m02, const float m12, const float m22, const float m32, - const float m03, const float m13, const float m23, const float m33) -{ - __retVal[0].x = m00; - __retVal[0].y = m10; - __retVal[0].z = m20; - __retVal[0].w = m30; - __retVal[1].x = m01; - __retVal[1].y = m11; - __retVal[1].z = m21; - __retVal[1].w = m31; - __retVal[2].x = m02; - __retVal[2].y = m12; - __retVal[2].z = m22; - __retVal[2].w = m32; - __retVal[3].x = m03; - __retVal[3].y = m13; - __retVal[3].z = m23; - __retVal[3].w = m33; -} - - -mat4 __constructor(const float f) -{ - vec2 v = vec2(f, 0.0); - __retVal[0] = v.xyyy; - __retVal[1] = v.yxyy; - __retVal[2] = v.yyxy; - __retVal[3] = v.yyyx; -} - -mat4 __constructor(const int i) -{ - return mat4(float(i)); -} - -mat4 __constructor(const bool b) -{ - return mat4(float(b)); -} - -mat4 __constructor(const vec4 c0, const vec4 c1, const vec4 c2, const vec4 c3) -{ - __retVal[0] = c0; - __retVal[1] = c1; - __retVal[2] = c2; - __retVal[3] = c3; -} - - - -//// Basic int operators - -int __operator + (const int a, const int b) -{ - __asm vec4_add __retVal, a, b; -} - -int __operator - (const int a, const int b) -{ - __asm vec4_subtract __retVal, a, b; -} - -int __operator * (const int a, const int b) -{ - __asm vec4_multiply __retVal, a, b; -} - -int __operator / (const int a, const int b) -{ - float bInv, x; - __asm float_rcp bInv, b; - __asm vec4_multiply x, a, bInv; - __asm vec4_to_ivec4 __retVal, x; -} - - -//// Basic ivec2 operators - -ivec2 __operator + (const ivec2 a, const ivec2 b) -{ - __asm vec4_add __retVal, a, b; -} - -ivec2 __operator - (const ivec2 a, const ivec2 b) -{ - __asm vec4_subtract __retVal, a, b; -} - -ivec2 __operator * (const ivec2 a, const ivec2 b) -{ - __asm vec4_multiply __retVal, a, b; -} - -ivec2 __operator / (const ivec2 a, const ivec2 b) -{ - vec2 bInv, x; - __asm float_rcp bInv.x, b.x; - __asm float_rcp bInv.y, b.y; - __asm vec4_multiply x, a, bInv; - __asm vec4_to_ivec4 __retVal, x; -} - - -//// Basic ivec3 operators - -ivec3 __operator + (const ivec3 a, const ivec3 b) -{ - __asm vec4_add __retVal, a, b; -} - -ivec3 __operator - (const ivec3 a, const ivec3 b) -{ - __asm vec4_subtract __retVal, a, b; -} - -ivec3 __operator * (const ivec3 a, const ivec3 b) -{ - __asm vec4_multiply __retVal, a, b; -} - -ivec3 __operator / (const ivec3 a, const ivec3 b) -{ - vec3 bInv, x; - __asm float_rcp bInv.x, b.x; - __asm float_rcp bInv.y, b.y; - __asm float_rcp bInv.z, b.z; - __asm vec4_multiply x, a, bInv; - __asm vec4_to_ivec4 __retVal, x; -} - - -//// Basic ivec4 operators - -ivec4 __operator + (const ivec4 a, const ivec4 b) -{ - __asm vec4_add __retVal, a, b; -} - -ivec4 __operator - (const ivec4 a, const ivec4 b) -{ - __asm vec4_subtract __retVal, a, b; -} - -ivec4 __operator * (const ivec4 a, const ivec4 b) -{ - __asm vec4_multiply __retVal, a, b; -} - -ivec4 __operator / (const ivec4 a, const ivec4 b) -{ - vec4 bInv, x; - __asm float_rcp bInv.x, b.x; - __asm float_rcp bInv.y, b.y; - __asm float_rcp bInv.z, b.z; - __asm float_rcp bInv.w, b.w; - __asm vec4_multiply x, a, bInv; - __asm vec4_to_ivec4 __retVal, x; -} - - -//// Basic float operators - -float __operator + (const float a, const float b) -{ - __asm vec4_add __retVal, a, b; -} - -float __operator - (const float a, const float b) -{ - __asm vec4_subtract __retVal, a, b; -} - -float __operator * (const float a, const float b) -{ - __asm vec4_multiply __retVal, a, b; -} - -float __operator / (const float a, const float b) -{ - float bInv; - __asm float_rcp bInv.x, b; - __asm vec4_multiply __retVal, a, bInv; -} - - -//// Basic vec2 operators - -vec2 __operator + (const vec2 v, const vec2 u) -{ - __asm vec4_add __retVal.xy, v, u; -} - -vec2 __operator - (const vec2 v, const vec2 u) -{ - __asm vec4_subtract __retVal.xy, v, u; -} - -vec2 __operator * (const vec2 v, const vec2 u) -{ - __asm vec4_multiply __retVal.xy, v, u; -} - -vec2 __operator / (const vec2 v, const vec2 u) -{ - vec2 w; // = 1 / u - __asm float_rcp w.x, u.x; - __asm float_rcp w.y, u.y; - __asm vec4_multiply __retVal.xy, v, w; -} - - -//// Basic vec3 operators - -vec3 __operator + (const vec3 v, const vec3 u) -{ - __asm vec4_add __retVal.xyz, v, u; -} - -vec3 __operator - (const vec3 v, const vec3 u) -{ - __asm vec4_subtract __retVal.xyz, v, u; -} - -vec3 __operator * (const vec3 v, const vec3 u) -{ - __asm vec4_multiply __retVal.xyz, v, u; -} - -vec3 __operator / (const vec3 v, const vec3 u) -{ - vec3 w; // = 1 / u - __asm float_rcp w.x, u.x; - __asm float_rcp w.y, u.y; - __asm float_rcp w.z, u.z; - __asm vec4_multiply __retVal.xyz, v, w; -} - - -//// Basic vec4 operators - -vec4 __operator + (const vec4 v, const vec4 u) -{ - __asm vec4_add __retVal, v, u; -} - -vec4 __operator - (const vec4 v, const vec4 u) -{ - __asm vec4_subtract __retVal, v, u; -} - -vec4 __operator * (const vec4 v, const vec4 u) -{ - __asm vec4_multiply __retVal, v, u; -} - -vec4 __operator / (const vec4 v, const vec4 u) -{ - vec4 w; // = 1 / u - __asm float_rcp w.x, u.x; - __asm float_rcp w.y, u.y; - __asm float_rcp w.z, u.z; - __asm float_rcp w.w, u.w; - __asm vec4_multiply __retVal, v, w; -} - - - - -//// Basic vec2/float operators - -vec2 __operator + (const float a, const vec2 u) -{ - __asm vec4_add __retVal.xy, a, u.xy; -} - -vec2 __operator + (const vec2 v, const float b) -{ - __asm vec4_add __retVal.xy, v.xy, b; -} - -vec2 __operator - (const float a, const vec2 u) -{ - __asm vec4_subtract __retVal.xy, a, u.xy; -} - -vec2 __operator - (const vec2 v, const float b) -{ - __asm vec4_subtract __retVal.xy, v.xy, b; -} - -vec2 __operator * (const float a, const vec2 u) -{ - __asm vec4_multiply __retVal.xy, a, u.xy; -} - -vec2 __operator * (const vec2 v, const float b) -{ - __asm vec4_multiply __retVal.xy, v.xy, b; -} - -vec2 __operator / (const float a, const vec2 u) -{ - vec2 invU; - __asm float_rcp invU.x, u.x; - __asm float_rcp invU.y, u.y; - __asm vec4_multiply __retVal.xy, a, invU.xy; -} - -vec2 __operator / (const vec2 v, const float b) -{ - float invB; - __asm float_rcp invB, b; - __asm vec4_multiply __retVal.xy, v.xy, invB; -} - - -//// Basic vec3/float operators - -vec3 __operator + (const float a, const vec3 u) -{ - __asm vec4_add __retVal.xyz, a, u.xyz; -} - -vec3 __operator + (const vec3 v, const float b) -{ - __asm vec4_add __retVal.xyz, v.xyz, b; -} - -vec3 __operator - (const float a, const vec3 u) -{ - __asm vec4_subtract __retVal.xyz, a, u.xyz; -} - -vec3 __operator - (const vec3 v, const float b) -{ - __asm vec4_subtract __retVal.xyz, v.xyz, b; -} - -vec3 __operator * (const float a, const vec3 u) -{ - __asm vec4_multiply __retVal.xyz, a, u.xyz; -} - -vec3 __operator * (const vec3 v, const float b) -{ - __asm vec4_multiply __retVal.xyz, v.xyz, b; -} - -vec3 __operator / (const float a, const vec3 u) -{ - vec3 invU; - __asm float_rcp invU.x, u.x; - __asm float_rcp invU.y, u.y; - __asm float_rcp invU.z, u.z; - __asm vec4_multiply __retVal.xyz, a, invU.xyz; -} - -vec3 __operator / (const vec3 v, const float b) -{ - float invB; - __asm float_rcp invB, b; - __asm vec4_multiply __retVal.xyz, v.xyz, invB; -} - - -//// Basic vec4/float operators - -vec4 __operator + (const float a, const vec4 u) -{ - __asm vec4_add __retVal, a, u; -} - -vec4 __operator + (const vec4 v, const float b) -{ - __asm vec4_add __retVal, v, b; -} - -vec4 __operator - (const float a, const vec4 u) -{ - __asm vec4_subtract __retVal, a, u; -} - -vec4 __operator - (const vec4 v, const float b) -{ - __asm vec4_subtract __retVal, v, b; -} - -vec4 __operator * (const float a, const vec4 u) -{ - __asm vec4_multiply __retVal, a, u; -} - -vec4 __operator * (const vec4 v, const float b) -{ - __asm vec4_multiply __retVal, v, b; -} - -vec4 __operator / (const float a, const vec4 u) -{ - vec4 invU; - __asm float_rcp invU.x, u.x; - __asm float_rcp invU.y, u.y; - __asm float_rcp invU.z, u.z; - __asm float_rcp invU.w, u.w; - __asm vec4_multiply __retVal, a, invU; -} - -vec4 __operator / (const vec4 v, const float b) -{ - float invB; - __asm float_rcp invB, b; - __asm vec4_multiply __retVal, v, invB; -} - - - -//// Basic ivec2/int operators - -ivec2 __operator + (const int a, const ivec2 u) -{ - __retVal = ivec2(a) + u; -} - -ivec2 __operator + (const ivec2 v, const int b) -{ - __retVal = v + ivec2(b); -} - -ivec2 __operator - (const int a, const ivec2 u) -{ - __retVal = ivec2(a) - u; -} - -ivec2 __operator - (const ivec2 v, const int b) -{ - __retVal = v - ivec2(b); -} - -ivec2 __operator * (const int a, const ivec2 u) -{ - __retVal = ivec2(a) * u; -} - -ivec2 __operator * (const ivec2 v, const int b) -{ - __retVal = v * ivec2(b); -} - -ivec2 __operator / (const int a, const ivec2 u) -{ - __retVal = ivec2(a) / u; -} - -ivec2 __operator / (const ivec2 v, const int b) -{ - __retVal = v / ivec2(b); -} - - -//// Basic ivec3/int operators - -ivec3 __operator + (const int a, const ivec3 u) -{ - __retVal = ivec3(a) + u; -} - -ivec3 __operator + (const ivec3 v, const int b) -{ - __retVal = v + ivec3(b); -} - -ivec3 __operator - (const int a, const ivec3 u) -{ - __retVal = ivec3(a) - u; -} - -ivec3 __operator - (const ivec3 v, const int b) -{ - __retVal = v - ivec3(b); -} - -ivec3 __operator * (const int a, const ivec3 u) -{ - __retVal = ivec3(a) * u; -} - -ivec3 __operator * (const ivec3 v, const int b) -{ - __retVal = v * ivec3(b); -} - -ivec3 __operator / (const int a, const ivec3 u) -{ - __retVal = ivec3(a) / u; -} - -ivec3 __operator / (const ivec3 v, const int b) -{ - __retVal = v / ivec3(b); -} - - -//// Basic ivec4/int operators - -ivec4 __operator + (const int a, const ivec4 u) -{ - __retVal = ivec4(a) + u; -} - -ivec4 __operator + (const ivec4 v, const int b) -{ - __retVal = v + ivec4(b); -} - -ivec4 __operator - (const int a, const ivec4 u) -{ - __retVal = ivec4(a) - u; -} - -ivec4 __operator - (const ivec4 v, const int b) -{ - __retVal = v - ivec4(b); -} - -ivec4 __operator * (const int a, const ivec4 u) -{ - __retVal = ivec4(a) * u; -} - -ivec4 __operator * (const ivec4 v, const int b) -{ - __retVal = v * ivec4(b); -} - -ivec4 __operator / (const int a, const ivec4 u) -{ - __retVal = ivec4(a) / u; -} - -ivec4 __operator / (const ivec4 v, const int b) -{ - __retVal = v / ivec4(b); -} - - - - -//// Unary negation operator - -int __operator - (const int a) -{ - __asm vec4_negate __retVal.x, a; -} - -ivec2 __operator - (const ivec2 v) -{ - __asm vec4_negate __retVal, v; -} - -ivec3 __operator - (const ivec3 v) -{ - __asm vec4_negate __retVal, v; -} - -ivec4 __operator - (const ivec4 v) -{ - __asm vec4_negate __retVal, v; -} - -float __operator - (const float a) -{ - __asm vec4_negate __retVal.x, a; -} - -vec2 __operator - (const vec2 v) -{ - __asm vec4_negate __retVal.xy, v.xy; -} - -vec3 __operator - (const vec3 v) -{ - __asm vec4_negate __retVal.xyz, v.xyz; -} - -vec4 __operator - (const vec4 v) -{ - __asm vec4_negate __retVal, v; -} - -mat2 __operator - (const mat2 m) -{ - __retVal[0] = -m[0]; - __retVal[1] = -m[1]; -} - -mat3 __operator - (const mat3 m) -{ - __retVal[0] = -m[0]; - __retVal[1] = -m[1]; - __retVal[2] = -m[2]; -} - -mat4 __operator - (const mat4 m) -{ - __retVal[0] = -m[0]; - __retVal[1] = -m[1]; - __retVal[2] = -m[2]; - __retVal[3] = -m[3]; -} - - - -//// dot product - -float dot(const float a, const float b) -{ - __retVal = a * b; -} - -float dot(const vec2 a, const vec2 b) -{ - __retVal = a.x * b.x + a.y * b.y; -} - -float dot(const vec3 a, const vec3 b) -{ - __asm vec3_dot __retVal, a, b; -} - -float dot(const vec4 a, const vec4 b) -{ - __asm vec4_dot __retVal, a, b; -} - - - -//// int assignment operators - -int __operator += (inout int a, const int b) -{ - a = a + b; - return a; -} - -int __operator -= (inout int a, const int b) -{ - a = a - b; - return a; -} - -int __operator *= (inout int a, const int b) -{ - a = a * b; - return a; -} - -int __operator /= (inout int a, const int b) -{ - a = a / b; - return a; -} - - -//// ivec2 assignment operators - -ivec2 __operator += (inout ivec2 v, const ivec2 u) -{ - v = v + u; - return v; -} - -ivec2 __operator -= (inout ivec2 v, const ivec2 u) -{ - v = v - u; - return v; -} - -ivec2 __operator *= (inout ivec2 v, const ivec2 u) -{ - v = v * u; - return v; -} - -ivec2 __operator /= (inout ivec2 v, const ivec2 u) -{ - v = v / u; - return v; -} - - -//// ivec3 assignment operators - -ivec3 __operator += (inout ivec3 v, const ivec3 u) -{ - v = v + u; - return v; -} - -ivec3 __operator -= (inout ivec3 v, const ivec3 u) -{ - v = v - u; - return v; -} - -ivec3 __operator *= (inout ivec3 v, const ivec3 u) -{ - v = v * u; - return v; -} - -ivec3 __operator /= (inout ivec3 v, const ivec3 u) -{ - v = v / u; - return v; -} - - -//// ivec4 assignment operators - -ivec4 __operator += (inout ivec4 v, const ivec4 u) -{ - v = v + u; - return v; -} - -ivec4 __operator -= (inout ivec4 v, const ivec4 u) -{ - v = v - u; - return v; -} - -ivec4 __operator *= (inout ivec4 v, const ivec4 u) -{ - v = v * u; - return v; -} - -ivec4 __operator /= (inout ivec4 v, const ivec4 u) -{ - v = v / u; - return v; -} - - -//// float assignment operators - -float __operator += (inout float a, const float b) -{ - a = a + b; - return a; -} - -float __operator -= (inout float a, const float b) -{ - a = a - b; - return a; -} - -float __operator *= (inout float a, const float b) -{ - a = a * b; - return a; -} - -float __operator /= (inout float a, const float b) -{ - a = a / b; - return a; -} - - -//// vec2 assignment operators - -vec2 __operator += (inout vec2 v, const vec2 u) -{ - v = v + u; - return v; -} - -vec2 __operator -= (inout vec2 v, const vec2 u) -{ - v = v - u; - return v; -} - -vec2 __operator *= (inout vec2 v, const vec2 u) -{ - v = v * u; - return v; -} - -vec2 __operator /= (inout vec2 v, const vec2 u) -{ - v = v / u; - return v; -} - - -//// vec3 assignment operators - -vec3 __operator += (inout vec3 v, const vec3 u) -{ - v = v + u; - return v; -} - -vec3 __operator -= (inout vec3 v, const vec3 u) -{ - v = v - u; - return v; -} - -vec3 __operator *= (inout vec3 v, const vec3 u) -{ - v = v * u; - return v; -} - -vec3 __operator /= (inout vec3 v, const vec3 u) -{ - v = v / u; - return v; -} - - -//// vec4 assignment operators - -vec4 __operator += (inout vec4 v, const vec4 u) -{ - v = v + u; - return v; -} - -vec4 __operator -= (inout vec4 v, const vec4 u) -{ - v = v - u; - return v; -} - -vec4 __operator *= (inout vec4 v, const vec4 u) -{ - v = v * u; - return v; -} - -vec4 __operator /= (inout vec4 v, const vec4 u) -{ - v = v / u; - return v; -} - - - -//// ivec2/int assignment operators - -ivec2 __operator += (inout ivec2 v, const int a) -{ - v = v + ivec2(a); - return v; -} - -ivec2 __operator -= (inout ivec2 v, const int a) -{ - v = v - ivec2(a); - return v; -} - -ivec2 __operator *= (inout ivec2 v, const int a) -{ - v = v * ivec2(a); - return v; -} - -ivec2 __operator /= (inout ivec2 v, const int a) -{ - v = v / ivec2(a); - return v; -} - - -//// ivec3/int assignment operators - -ivec3 __operator += (inout ivec3 v, const int a) -{ - v = v + ivec3(a); - return v; -} - -ivec3 __operator -= (inout ivec3 v, const int a) -{ - v = v - ivec3(a); - return v; -} - -ivec3 __operator *= (inout ivec3 v, const int a) -{ - v = v * ivec3(a); - return v; -} - -ivec4 __operator /= (inout ivec3 v, const int a) -{ - v = v / ivec3(a); - return v; -} - - -//// ivec4/int assignment operators - -ivec4 __operator += (inout ivec4 v, const int a) -{ - v = v + ivec4(a); - return v; -} - -ivec4 __operator -= (inout ivec4 v, const int a) -{ - v = v - ivec4(a); - return v; -} - -ivec4 __operator *= (inout ivec4 v, const int a) -{ - v = v * ivec4(a); - return v; -} - -ivec4 __operator /= (inout ivec4 v, const int a) -{ - v = v / ivec4(a); - return v; -} - - - -//// vec2/float assignment operators - -vec2 __operator += (inout vec2 v, const float a) -{ - v = v + vec2(a); - return v; -} - -vec2 __operator -= (inout vec2 v, const float a) -{ - v = v - vec2(a); - return v; -} - -vec2 __operator *= (inout vec2 v, const float a) -{ - v = v * vec2(a); - return v; -} - -vec2 __operator /= (inout vec2 v, const float a) -{ - v = v / vec2(a); - return v; -} - - -//// vec3/float assignment operators - -vec3 __operator += (inout vec3 v, const float a) -{ - v = v + vec3(a); - return v; -} - -vec3 __operator -= (inout vec3 v, const float a) -{ - v = v - vec3(a); - return v; -} - -vec3 __operator *= (inout vec3 v, const float a) -{ - v = v * vec3(a); - return v; -} - -vec3 __operator /= (inout vec3 v, const float a) -{ - v = v / vec3(a); - return v; -} - - -//// vec4/float assignment operators - -vec4 __operator += (inout vec4 v, const float a) -{ - v = v + vec4(a); - return v; -} - -vec4 __operator -= (inout vec4 v, const float a) -{ - v = v - vec4(a); - return v; -} - -vec4 __operator *= (inout vec4 v, const float a) -{ - v = v * vec4(a); - return v; -} - -vec4 __operator /= (inout vec4 v, const float a) -{ - v = v / vec4(a); - return v; -} - - - - - -//// Basic mat2 operations - -mat2 __operator + (const mat2 m, const mat2 n) -{ - __retVal[0] = m[0] + n[0]; - __retVal[1] = m[1] + n[1]; -} - -mat2 __operator - (const mat2 m, const mat2 n) -{ - __retVal[0] = m[0] - n[0]; - __retVal[1] = m[1] - n[1]; -} - -mat2 __operator * (const mat2 m, const mat2 n) -{ - __retVal[0] = m[0] * n[0].xx + m[1] * n[0].yy; - __retVal[1] = m[0] * n[1].xx + m[1] * n[1].yy; -} - -mat2 __operator / (const mat2 m, const mat2 n) -{ - __retVal[0] = m[0] / n[0]; - __retVal[1] = m[1] / n[1]; -} - - -//// Basic mat3 operations - -mat3 __operator + (const mat3 m, const mat3 n) -{ - __retVal[0] = m[0] + n[0]; - __retVal[1] = m[1] + n[1]; - __retVal[2] = m[2] + n[2]; -} - -mat3 __operator - (const mat3 m, const mat3 n) -{ - __retVal[0] = m[0] - n[0]; - __retVal[1] = m[1] - n[1]; - __retVal[2] = m[2] - n[2]; -} - -mat3 __operator * (const mat3 m, const mat3 n) -{ - __retVal[0] = m[0] * n[0].xxx + m[1] * n[0].yyy + m[2] * n[0].zzz; - __retVal[1] = m[0] * n[1].xxx + m[1] * n[1].yyy + m[2] * n[1].zzz; - __retVal[2] = m[0] * n[2].xxx + m[1] * n[2].yyy + m[2] * n[2].zzz; -} - -mat3 __operator / (const mat3 m, const mat3 n) -{ - __retVal[0] = m[0] / n[0]; - __retVal[1] = m[1] / n[1]; - __retVal[2] = m[2] / n[2]; -} - - -//// Basic mat4 operations - -mat4 __operator + (const mat4 m, const mat4 n) -{ - __retVal[0] = m[0] + n[0]; - __retVal[1] = m[1] + n[1]; - __retVal[2] = m[2] + n[2]; - __retVal[3] = m[3] + n[3]; -} - -mat4 __operator - (const mat4 m, const mat4 n) -{ - __retVal[0] = m[0] - n[0]; - __retVal[1] = m[1] - n[1]; - __retVal[2] = m[2] - n[2]; - __retVal[3] = m[3] - n[3]; -} - -mat4 __operator * (const mat4 m, const mat4 n) -{ - __retVal[0] = m[0] * n[0].xxxx + m[1] * n[0].yyyy + m[2] * n[0].zzzz + m[3] * n[0].wwww; - __retVal[1] = m[0] * n[1].xxxx + m[1] * n[1].yyyy + m[2] * n[1].zzzz + m[3] * n[1].wwww; - __retVal[2] = m[0] * n[2].xxxx + m[1] * n[2].yyyy + m[2] * n[2].zzzz + m[3] * n[2].wwww; - __retVal[3] = m[0] * n[3].xxxx + m[1] * n[3].yyyy + m[2] * n[3].zzzz + m[3] * n[3].wwww; -} - -mat4 __operator / (const mat4 m, const mat4 n) -{ - __retVal[0] = m[0] / n[0]; - __retVal[1] = m[1] / n[1]; - __retVal[2] = m[2] / n[2]; - __retVal[3] = m[3] / n[3]; -} - - -//// mat2/float operations - -mat2 __operator + (const float a, const mat2 n) -{ - __retVal[0] = a + n[0]; - __retVal[1] = a + n[1]; -} - -mat2 __operator + (const mat2 m, const float b) -{ - __retVal[0] = m[0] + b; - __retVal[1] = m[1] + b; -} - -mat2 __operator - (const float a, const mat2 n) -{ - __retVal[0] = a - n[0]; - __retVal[1] = a - n[1]; -} - -mat2 __operator - (const mat2 m, const float b) -{ - __retVal[0] = m[0] - b; - __retVal[1] = m[1] - b; -} - -mat2 __operator * (const float a, const mat2 n) -{ - __retVal[0] = a * n[0]; - __retVal[1] = a * n[1]; -} - -mat2 __operator * (const mat2 m, const float b) -{ - __retVal[0] = m[0] * b; - __retVal[1] = m[1] * b; -} - -mat2 __operator / (const float a, const mat2 n) -{ - __retVal[0] = a / n[0]; - __retVal[1] = a / n[1]; -} - -mat2 __operator / (const mat2 m, const float b) -{ - __retVal[0] = m[0] / b; - __retVal[1] = m[1] / b; -} - - -//// mat3/float operations - -mat3 __operator + (const float a, const mat3 n) -{ - __retVal[0] = a + n[0]; - __retVal[1] = a + n[1]; - __retVal[2] = a + n[2]; -} - -mat3 __operator + (const mat3 m, const float b) -{ - __retVal[0] = m[0] + b; - __retVal[1] = m[1] + b; - __retVal[2] = m[2] + b; -} - -mat3 __operator - (const float a, const mat3 n) -{ - __retVal[0] = a - n[0]; - __retVal[1] = a - n[1]; - __retVal[2] = a - n[2]; -} - -mat3 __operator - (const mat3 m, const float b) -{ - __retVal[0] = m[0] - b; - __retVal[1] = m[1] - b; - __retVal[2] = m[2] - b; -} - -mat3 __operator * (const float a, const mat3 n) -{ - __retVal[0] = a * n[0]; - __retVal[1] = a * n[1]; - __retVal[2] = a * n[2]; -} - -mat3 __operator * (const mat3 m, const float b) -{ - __retVal[0] = m[0] * b; - __retVal[1] = m[1] * b; - __retVal[2] = m[2] * b; -} - -mat3 __operator / (const float a, const mat3 n) -{ - __retVal[0] = a / n[0]; - __retVal[1] = a / n[1]; - __retVal[2] = a / n[2]; -} - -mat3 __operator / (const mat3 m, const float b) -{ - __retVal[0] = m[0] / b; - __retVal[1] = m[1] / b; - __retVal[2] = m[2] / b; -} - - -//// mat4/float operations - -mat4 __operator + (const float a, const mat4 n) -{ - __retVal[0] = a + n[0]; - __retVal[1] = a + n[1]; - __retVal[2] = a + n[2]; - __retVal[3] = a + n[3]; -} - -mat4 __operator + (const mat4 m, const float b) -{ - __retVal[0] = m[0] + b; - __retVal[1] = m[1] + b; - __retVal[2] = m[2] + b; - __retVal[3] = m[3] + b; -} - -mat4 __operator - (const float a, const mat4 n) -{ - __retVal[0] = a - n[0]; - __retVal[1] = a - n[1]; - __retVal[2] = a - n[2]; - __retVal[3] = a - n[3]; -} - -mat4 __operator - (const mat4 m, const float b) -{ - __retVal[0] = m[0] - b; - __retVal[1] = m[1] - b; - __retVal[2] = m[2] - b; - __retVal[3] = m[3] - b; -} - -mat4 __operator * (const float a, const mat4 n) -{ - __retVal[0] = a * n[0]; - __retVal[1] = a * n[1]; - __retVal[2] = a * n[2]; - __retVal[3] = a * n[3]; -} - -mat4 __operator * (const mat4 m, const float b) -{ - __retVal[0] = m[0] * b; - __retVal[1] = m[1] * b; - __retVal[2] = m[2] * b; - __retVal[3] = m[3] * b; -} - -mat4 __operator / (const float a, const mat4 n) -{ - __retVal[0] = a / n[0]; - __retVal[1] = a / n[1]; - __retVal[2] = a / n[2]; - __retVal[3] = a / n[3]; -} - -mat4 __operator / (const mat4 m, const float b) -{ - __retVal[0] = m[0] / b; - __retVal[1] = m[1] / b; - __retVal[2] = m[2] / b; - __retVal[3] = m[3] / b; -} - - - -//// matrix / vector products - -vec2 __operator * (const mat2 m, const vec2 v) -{ - __retVal = m[0] * v.xx - + m[1] * v.yy; -} - -vec2 __operator * (const vec2 v, const mat2 m) -{ - __retVal.x = dot(v, m[0]); - __retVal.y = dot(v, m[1]); -} - -vec3 __operator * (const mat3 m, const vec3 v) -{ - __retVal = m[0] * v.xxx - + m[1] * v.yyy - + m[2] * v.zzz; -} - -vec3 __operator * (const vec3 v, const mat3 m) -{ - __retVal.x = dot(v, m[0]); - __retVal.y = dot(v, m[1]); - __retVal.z = dot(v, m[2]); -} - -vec4 __operator * (const mat4 m, const vec4 v) -{ - __retVal = m[0] * v.xxxx - + m[1] * v.yyyy - + m[2] * v.zzzz - + m[3] * v.wwww; -} - -vec4 __operator * (const vec4 v, const mat4 m) -{ - __retVal.x = dot(v, m[0]); - __retVal.y = dot(v, m[1]); - __retVal.z = dot(v, m[2]); - __retVal.w = dot(v, m[3]); -} - - - -//// mat2 assignment operators - -mat2 __operator += (inout mat2 m, const mat2 n) -{ - m[0] = m[0] + n[0]; - m[1] = m[1] + n[1]; - return m; -} - -mat2 __operator -= (inout mat2 m, const mat2 n) -{ - m[0] = m[0] - n[0]; - m[1] = m[1] - n[1]; - return m; -} - -mat2 __operator *= (inout mat2 m, const mat2 n) -{ - m = m * n; - return m; -} - -mat2 __operator /= (inout mat2 m, const mat2 n) -{ - m[0] = m[0] / n[0]; - m[1] = m[1] / n[1]; - return m; -} - - -//// mat3 assignment operators - -mat3 __operator += (inout mat3 m, const mat3 n) -{ - m[0] = m[0] + n[0]; - m[1] = m[1] + n[1]; - m[2] = m[2] + n[2]; - return m; -} - -mat3 __operator -= (inout mat3 m, const mat3 n) -{ - m[0] = m[0] - n[0]; - m[1] = m[1] - n[1]; - m[2] = m[2] - n[2]; - return m; -} - -mat3 __operator *= (inout mat3 m, const mat3 n) -{ - m = m * n; - return m; -} - -mat3 __operator /= (inout mat3 m, const mat3 n) -{ - m[0] = m[0] / n[0]; - m[1] = m[1] / n[1]; - m[2] = m[2] / n[2]; - return m; -} - - -// mat4 assignment operators - -mat4 __operator += (inout mat4 m, const mat4 n) -{ - m[0] = m[0] + n[0]; - m[1] = m[1] + n[1]; - m[2] = m[2] + n[2]; - m[3] = m[3] + n[3]; - return m; -} - -mat4 __operator -= (inout mat4 m, const mat4 n) -{ - m[0] = m[0] - n[0]; - m[1] = m[1] - n[1]; - m[2] = m[2] - n[2]; - m[3] = m[3] - n[3]; - return m; -} - -mat4 __operator *= (inout mat4 m, const mat4 n) -{ - m = m * n; - return m; -} - -mat4 __operator /= (inout mat4 m, const mat4 n) -{ - m[0] = m[0] / n[0]; - m[1] = m[1] / n[1]; - m[2] = m[2] / n[2]; - m[3] = m[3] / n[3]; - return m; -} - - -//// mat2/float assignment operators - -mat2 __operator += (inout mat2 m, const float a) -{ - vec2 v = vec2(a); - m[0] = m[0] + v; - m[1] = m[1] + v; - return m; -} - -mat2 __operator -= (inout mat2 m, const float a) -{ - vec2 v = vec2(a); - m[0] = m[0] - v; - m[1] = m[1] - v; - return m; -} - -mat2 __operator *= (inout mat2 m, const float a) -{ - vec2 v = vec2(a); - m[0] = m[0] * v; - m[1] = m[1] * v; - return m; -} - -mat2 __operator /= (inout mat2 m, const float a) -{ - vec2 v = vec2(1.0 / a); - m[0] = m[0] * v; - m[1] = m[1] * v; - return m; -} - - -//// mat3/float assignment operators - -mat3 __operator += (inout mat3 m, const float a) -{ - vec3 v = vec3(a); - m[0] = m[0] + v; - m[1] = m[1] + v; - m[2] = m[2] + v; - return m; -} - -mat3 __operator -= (inout mat3 m, const float a) -{ - vec3 v = vec3(a); - m[0] = m[0] - v; - m[1] = m[1] - v; - m[2] = m[2] - v; - return m; -} - -mat3 __operator *= (inout mat3 m, const float a) -{ - vec3 v = vec3(a); - m[0] = m[0] * v; - m[1] = m[1] * v; - m[2] = m[2] * v; - return m; -} - -mat3 __operator /= (inout mat3 m, const float a) -{ - vec3 v = vec3(1.0 / a); - m[0] = m[0] * v; - m[1] = m[1] * v; - m[2] = m[2] * v; - return m; -} - - -//// mat4/float assignment operators - -mat4 __operator += (inout mat4 m, const float a) -{ - vec4 v = vec4(a); - m[0] = m[0] + v; - m[1] = m[1] + v; - m[2] = m[2] + v; - m[3] = m[3] + v; - return m; -} - -mat4 __operator -= (inout mat4 m, const float a) -{ - vec4 v = vec4(a); - m[0] = m[0] - v; - m[1] = m[1] - v; - m[2] = m[2] - v; - m[3] = m[3] - v; - return m; -} - -mat4 __operator *= (inout mat4 m, const float a) -{ - vec4 v = vec4(a); - m[0] = m[0] * v; - m[1] = m[1] * v; - m[2] = m[2] * v; - m[3] = m[3] * v; - return m; -} - -mat4 __operator /= (inout mat4 m, const float a) -{ - vec4 v = vec4(1.0 / a); - m[0] = m[0] * v; - m[1] = m[1] * v; - m[2] = m[2] * v; - m[3] = m[3] * v; - return m; -} - - - -//// vec/mat assignment operators - -vec2 __operator *= (inout vec2 v, const mat2 m) -{ - v = v * m; - return v; -} - -vec3 __operator *= (inout vec3 v, const mat3 m) -{ - v = v * m; - return v; -} - -vec4 __operator *= (inout vec4 v, const mat4 m) -{ - v = v * m; - return v; -} - - - -//// pre-decrement operators - -int __operator --(inout int a) -{ - a = a - 1; - __retVal = a; -} - -ivec2 __operator --(inout ivec2 v) -{ - v = v - ivec2(1); - __retVal = v; -} - -ivec3 __operator --(inout ivec3 v) -{ - v = v - ivec3(1); - __retVal = v; -} - -ivec4 __operator --(inout ivec4 v) -{ - v = v - ivec4(1); - __retVal = v; -} - - -float __operator --(inout float a) -{ - a = a - 1.0; - __retVal = a; -} - -vec2 __operator --(inout vec2 v) -{ - v = v - vec2(1.0); - __retVal = v; -} - -vec3 __operator --(inout vec3 v) -{ - v = v - vec3(1.0); - __retVal = v; -} - -vec4 __operator --(inout vec4 v) -{ - v = v - vec4(1.0); - __retVal = v; -} - - -mat2 __operator --(inout mat2 m) -{ - m[0] = m[0] - vec2(1.0); - m[1] = m[1] - vec2(1.0); - __retVal = m; -} - -mat3 __operator --(inout mat3 m) -{ - m[0] = m[0] - vec3(1.0); - m[1] = m[1] - vec3(1.0); - m[2] = m[2] - vec3(1.0); - __retVal = m; -} - -mat4 __operator --(inout mat4 m) -{ - m[0] = m[0] - vec4(1.0); - m[1] = m[1] - vec4(1.0); - m[2] = m[2] - vec4(1.0); - m[3] = m[3] - vec4(1.0); - __retVal = m; -} - - -//// pre-increment operators - -int __operator ++(inout int a) -{ - a = a + 1; - __retVal = a; -} - -ivec2 __operator ++(inout ivec2 v) -{ - v = v + ivec2(1); - __retVal = v; -} - -ivec3 __operator ++(inout ivec3 v) -{ - v = v + ivec3(1); - __retVal = v; -} - -ivec4 __operator ++(inout ivec4 v) -{ - v = v + ivec4(1); - __retVal = v; -} - - -float __operator ++(inout float a) -{ - a = a + 1.0; - __retVal = a; -} - -vec2 __operator ++(inout vec2 v) -{ - v = v + vec2(1.0); - __retVal = v; -} - -vec3 __operator ++(inout vec3 v) -{ - v = v + vec3(1.0); - __retVal = v; -} - -vec4 __operator ++(inout vec4 v) -{ - v = v + vec4(1.0); - __retVal = v; -} - - -mat2 __operator ++(inout mat2 m) -{ - m[0] = m[0] + vec2(1.0); - m[1] = m[1] + vec2(1.0); - __retVal = m; -} - -mat3 __operator ++(inout mat3 m) -{ - m[0] = m[0] + vec3(1.0); - m[1] = m[1] + vec3(1.0); - m[2] = m[2] + vec3(1.0); - __retVal = m; -} - -mat4 __operator ++(inout mat4 m) -{ - m[0] = m[0] + vec4(1.0); - m[1] = m[1] + vec4(1.0); - m[2] = m[2] + vec4(1.0); - m[3] = m[3] + vec4(1.0); - __retVal = m; -} - - - -//// post-decrement - -int __postDecr(inout int a) -{ - __retVal = a; - a = a - 1; -} - -ivec2 __postDecr(inout ivec2 v) -{ - __retVal = v; - v = v - ivec2(1); -} - -ivec3 __postDecr(inout ivec3 v) -{ - __retVal = v; - v = v - ivec3(1); -} - -ivec4 __postDecr(inout ivec4 v) -{ - __retVal = v; - v = v - ivec4(1); -} - - -float __postDecr(inout float a) -{ - __retVal = a; - a = a - 1.0; -} - -vec2 __postDecr(inout vec2 v) -{ - __retVal = v; - v = v - vec2(1.0); -} - -vec3 __postDecr(inout vec3 v) -{ - __retVal = v; - v = v - vec3(1.0); -} - -vec4 __postDecr(inout vec4 v) -{ - __retVal = v; - v = v - vec4(1.0); -} - - -mat2 __postDecr(inout mat2 m) -{ - __retVal = m; - m[0] = m[0] - vec2(1.0); - m[1] = m[1] - vec2(1.0); -} - -mat3 __postDecr(inout mat3 m) -{ - __retVal = m; - m[0] = m[0] - vec3(1.0); - m[1] = m[1] - vec3(1.0); - m[2] = m[2] - vec3(1.0); -} - -mat4 __postDecr(inout mat4 m) -{ - __retVal = m; - m[0] = m[0] - vec4(1.0); - m[1] = m[1] - vec4(1.0); - m[2] = m[2] - vec4(1.0); - m[3] = m[3] - vec4(1.0); -} - - -//// post-increment - -float __postIncr(inout float a) -{ - __retVal = a; - a = a + 1; -} - -vec2 __postIncr(inout vec2 v) -{ - __retVal = v; - v = v + vec2(1.0); -} - -vec3 __postIncr(inout vec3 v) -{ - __retVal = v; - v = v + vec3(1.0); -} - -vec4 __postIncr(inout vec4 v) -{ - __retVal = v; - v = v + vec4(1.0); -} - - -int __postIncr(inout int a) -{ - __retVal = a; - a = a + 1; -} - -ivec2 __postIncr(inout ivec2 v) -{ - __retVal = v; - v = v + ivec2(1); -} - -ivec3 __postIncr(inout ivec3 v) -{ - __retVal = v; - v = v + ivec3(1); -} - -ivec4 __postIncr(inout ivec4 v) -{ - __retVal = v; - v = v + ivec3(1); -} - - -mat2 __postIncr(inout mat2 m) -{ - mat2 n = m; - m[0] = m[0] + vec2(1.0); - m[1] = m[1] + vec2(1.0); - return n; -} - -mat3 __postIncr(inout mat3 m) -{ - mat3 n = m; - m[0] = m[0] + vec3(1.0); - m[1] = m[1] + vec3(1.0); - m[2] = m[2] + vec3(1.0); - return n; -} - -mat4 __postIncr(inout mat4 m) -{ - mat4 n = m; - m[0] = m[0] + vec4(1.0); - m[1] = m[1] + vec4(1.0); - m[2] = m[2] + vec4(1.0); - m[3] = m[3] + vec4(1.0); - return n; -} - - - -//// inequality operators - - -// XXX are the inequality operators for floats/ints really needed???? -bool __operator < (const float a, const float b) -{ - __asm vec4_sgt __retVal.x, b, a; -} - - -bool __operator < (const int a, const int b) { - return float (a) < float (b); -} - -bool __operator > (const float a, const float b) { - bool c; - __asm float_less c, b, a; - return c; -} - -bool __operator > (const int a, const int b) { - return float (a) > float (b); -} - -bool __operator >= (const float a, const float b) { - bool g, e; - __asm float_less g, b, a; - __asm float_equal e, a, b; - return g || e; -} - -bool __operator >= (const int a, const int b) { - return float (a) >= float (b); -} - -bool __operator <= (const float a, const float b) { - bool g, e; - __asm float_less g, a, b; - __asm float_equal e, a, b; - return g || e; -} - -bool __operator <= (const int a, const int b) { - return float (a) <= float (b); -} - - - -// -// MESA-specific extension functions. -// - -void printMESA (const float f) { - __asm float_print f; -} - -void printMESA (const int i) { - __asm int_print i; -} - -void printMESA (const bool b) { - __asm bool_print b; -} - -void printMESA (const vec2 v) { - printMESA (v.x); - printMESA (v.y); -} - -void printMESA (const vec3 v) { - printMESA (v.x); - printMESA (v.y); - printMESA (v.z); -} - -void printMESA (const vec4 v) { - printMESA (v.x); - printMESA (v.y); - printMESA (v.z); - printMESA (v.w); -} - -void printMESA (const ivec2 v) { - printMESA (v.x); - printMESA (v.y); -} - -void printMESA (const ivec3 v) { - printMESA (v.x); - printMESA (v.y); - printMESA (v.z); -} - -void printMESA (const ivec4 v) { - printMESA (v.x); - printMESA (v.y); - printMESA (v.z); - printMESA (v.w); -} - -void printMESA (const bvec2 v) { - printMESA (v.x); - printMESA (v.y); -} - -void printMESA (const bvec3 v) { - printMESA (v.x); - printMESA (v.y); - printMESA (v.z); -} - -void printMESA (const bvec4 v) { - printMESA (v.x); - printMESA (v.y); - printMESA (v.z); - printMESA (v.w); -} - -void printMESA (const mat2 m) { - printMESA (m[0]); - printMESA (m[1]); -} - -void printMESA (const mat3 m) { - printMESA (m[0]); - printMESA (m[1]); - printMESA (m[2]); -} - -void printMESA (const mat4 m) { - printMESA (m[0]); - printMESA (m[1]); - printMESA (m[2]); - printMESA (m[3]); -} - -void printMESA (const sampler1D e) { - __asm int_print e; -} - -void printMESA (const sampler2D e) { - __asm int_print e; -} - -void printMESA (const sampler3D e) { - __asm int_print e; -} - -void printMESA (const samplerCube e) { - __asm int_print e; -} - -void printMESA (const sampler1DShadow e) { - __asm int_print e; -} - -void printMESA (const sampler2DShadow e) { - __asm int_print e; -} - diff --git a/src/mesa/slang/library/slang_fragment_builtin.gc b/src/mesa/slang/library/slang_fragment_builtin.gc deleted file mode 100644 index 54a80ea0e0..0000000000 --- a/src/mesa/slang/library/slang_fragment_builtin.gc +++ /dev/null @@ -1,299 +0,0 @@ -/* - * Mesa 3-D graphics library - * Version: 6.5 - * - * Copyright (C) 2006 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. - */ - -// -// From Shader Spec, ver. 1.10, rev. 59 -// - -__fixed_input vec4 gl_FragCoord; -__fixed_input bool gl_FrontFacing; -__fixed_output vec4 gl_FragColor; -__fixed_output vec4 gl_FragData[gl_MaxDrawBuffers]; -__fixed_output float gl_FragDepth; - -varying vec4 gl_Color; -varying vec4 gl_SecondaryColor; -varying vec4 gl_TexCoord[gl_MaxTextureCoords]; -varying float gl_FogFragCoord; - - - -//// 8.7 Texture Lookup Functions (with bias) - -vec4 texture1D(const sampler1D sampler, const float coord, const float bias) -{ - vec4 coord4; - coord4.x = coord; - coord4.w = bias; - __asm vec4_tex_1d_bias __retVal, sampler, coord4; -} - -vec4 texture1DProj(const sampler1D sampler, const vec2 coord, const float bias) -{ - // do projection here (there's no vec4_texbp1d instruction) - vec4 pcoord; - pcoord.x = coord.x / coord.y; - pcoord.w = bias; - __asm vec4_tex_1d_bias __retVal, sampler, pcoord; -} - -vec4 texture1DProj(const sampler1D sampler, const vec4 coord, const float bias) -{ - // do projection here (there's no vec4_texbp1d instruction) - vec4 pcoord; - pcoord.x = coord.x / coord.z; - pcoord.w = bias; - __asm vec4_tex_1d_bias __retVal, sampler, pcoord; -} - - - - -vec4 texture2D(const sampler2D sampler, const vec2 coord, const float bias) -{ - vec4 coord4; - coord4.xy = coord.xy; - coord4.w = bias; - __asm vec4_tex_2d_bias __retVal, sampler, coord4; -} - -vec4 texture2DProj(const sampler2D sampler, const vec3 coord, const float bias) -{ - // do projection here (there's no vec4_texbp2d instruction) - vec4 pcoord; - pcoord.xy = coord.xy / coord.z; - pcoord.w = bias; - __asm vec4_tex_2d_bias __retVal, sampler, pcoord; -} - -vec4 texture2DProj(const sampler2D sampler, const vec4 coord, const float bias) -{ - // do projection here (there's no vec4_texbp2d instruction) - vec4 pcoord; - pcoord.xy = coord.xy / coord.w; - pcoord.w = bias; - __asm vec4_tex_2d_bias __retVal, sampler, pcoord; -} - - - - -vec4 texture3D(const sampler3D sampler, const vec3 coord, const float bias) -{ - vec4 coord4; - coord4.xyz = coord.xyz; - coord4.w = bias; - __asm vec4_tex_3d_bias __retVal, sampler, coord4; -} - -vec4 texture3DProj(const sampler3D sampler, const vec4 coord, const float bias) -{ - // do projection here (there's no vec4_texbp3d instruction) - vec4 pcoord; - pcoord.xyz = coord.xyz / coord.w; - pcoord.w = bias; - __asm vec4_tex_3d_bias __retVal, sampler, pcoord; -} - - - - -vec4 textureCube(const samplerCube sampler, const vec3 coord, const float bias) -{ - vec4 coord4; - coord4.xyz = coord; - coord4.w = bias; - __asm vec4_tex_cube __retVal, sampler, coord4; -} - - - -vec4 shadow1D(const sampler1DShadow sampler, const vec3 coord, const float bias) -{ - vec4 coord4; - coord4.xyz = coord; - coord4.w = bias; - __asm vec4_tex_1d_bias_shadow __retVal, sampler, coord4; -} - -vec4 shadow1DProj(const sampler1DShadow sampler, const vec4 coord, const float bias) -{ - vec4 pcoord; - pcoord.x = coord.x / coord.w; - pcoord.z = coord.z; - pcoord.w = bias; - __asm vec4_tex_1d_bias_shadow __retVal, sampler, pcoord; -} - -vec4 shadow2D(const sampler2DShadow sampler, const vec3 coord, const float bias) -{ - vec4 coord4; - coord4.xyz = coord; - coord4.w = bias; - __asm vec4_tex_2d_bias_shadow __retVal, sampler, coord4; -} - -vec4 shadow2DProj(const sampler2DShadow sampler, const vec4 coord, const float bias) -{ - vec4 pcoord; - pcoord.xy = coord.xy / coord.w; - pcoord.z = coord.z; - pcoord.w = bias; - __asm vec4_tex_2d_bias_shadow __retVal, sampler, pcoord; -} - - - -//// GL_EXT_texture_array - -vec4 texture1DArray(const sampler1DArray sampler, const vec2 coord) -{ - vec4 coord4; - coord4.xy = coord; - __asm vec4_tex_1d_array __retVal, sampler, coord4; -} - -vec4 texture1DArray(const sampler1DArray sampler, const vec2 coord, const float bias) -{ - vec4 coord4; - coord4.xy = coord; - coord4.w = bias; - __asm vec4_tex_1d_array_bias __retVal, sampler, coord4; -} - -vec4 texure2DArray(const sampler2DArray sampler, const vec3 coord) -{ - vec4 coord4; - coord4.xyz = coord; - __asm vec4_tex_2d_array __retVal, sampler, coord4; -} - -vec4 texture2DArray(const sampler2DArray sampler, const vec3 coord, const float bias) -{ - vec4 coord4; - coord4.xyz = coord; - coord4.w = bias; - __asm vec4_tex_2d_array_bias __retVal, sampler, coord4; -} - -vec4 shadow1DArray(const sampler1DArrayShadow sampler, const vec2 coord) -{ - vec4 coord4; - coord4.xy = coord; - __asm vec4_tex_1d_array_shadow __retVal, sampler, coord4; -} - -vec4 shadow1DArray(const sampler1DArrayShadow sampler, const vec2 coord, const float bias) -{ - vec4 coord4; - coord4.xy = coord; - coord4.w = bias; - __asm vec4_tex_1d_array_bias_shadow __retVal, sampler, coord4; -} - -vec4 shadow2DArray(const sampler2DArrayShadow sampler, const vec3 coord) -{ - vec4 coord4; - coord4.xyz = coord; - __asm vec4_tex_2d_array_shadow __retVal, sampler, coord4; -} - -vec4 shadow2DArray(const sampler2DArrayShadow sampler, const vec3 coord, const float bias) -{ - vec4 coord4; - coord4.xyz = coord; - coord4.w = bias; - __asm vec4_tex_2d_array_bias_shadow __retVal, sampler, coord4; -} - - - -// -// 8.8 Fragment Processing Functions -// - -float dFdx(const float p) -{ - __asm vec4_ddx __retVal.x, p.xxxx; -} - -vec2 dFdx(const vec2 p) -{ - __asm vec4_ddx __retVal.xy, p.xyyy; -} - -vec3 dFdx(const vec3 p) -{ - __asm vec4_ddx __retVal.xyz, p.xyzz; -} - -vec4 dFdx(const vec4 p) -{ - __asm vec4_ddx __retVal, p; -} - -float dFdy(const float p) -{ - __asm vec4_ddy __retVal.x, p.xxxx; -} - -vec2 dFdy(const vec2 p) -{ - __asm vec4_ddy __retVal.xy, p.xyyy; -} - -vec3 dFdy(const vec3 p) -{ - __asm vec4_ddy __retVal.xyz, p.xyzz; -} - -vec4 dFdy(const vec4 p) -{ - __asm vec4_ddy __retVal, p; -} - -float fwidth (const float p) -{ - // XXX hand-write with __asm - return abs(dFdx(p)) + abs(dFdy(p)); -} - -vec2 fwidth(const vec2 p) -{ - // XXX hand-write with __asm - return abs(dFdx(p)) + abs(dFdy(p)); -} - -vec3 fwidth(const vec3 p) -{ - // XXX hand-write with __asm - return abs(dFdx(p)) + abs(dFdy(p)); -} - -vec4 fwidth(const vec4 p) -{ - // XXX hand-write with __asm - return abs(dFdx(p)) + abs(dFdy(p)); -} - diff --git a/src/mesa/slang/library/slang_geometry_builtin.gc b/src/mesa/slang/library/slang_geometry_builtin.gc deleted file mode 100644 index 07524912ba..0000000000 --- a/src/mesa/slang/library/slang_geometry_builtin.gc +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Mesa 3-D graphics library - * - * 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. - */ - -const int _mesa_VerticesInMax = 6; - -__fixed_input int gl_PrimitiveIDIn; -__fixed_output int gl_PrimitiveID; -__fixed_output int gl_Layer; - - -varying in vec4 gl_FrontColorIn[_mesa_VerticesInMax]; -varying in vec4 gl_BackColorIn[_mesa_VerticesInMax]; -varying in vec4 gl_FrontSecondaryColorIn[_mesa_VerticesInMax]; -varying in vec4 gl_BackSecondaryColorIn[_mesa_VerticesInMax]; -/*varying in vec4 gl_TexCoordIn[_mesa_VerticesInMax][gl_MaxTextureCoords];*/ -varying in float gl_FogFragCoordIn[_mesa_VerticesInMax]; -varying in vec4 gl_PositionIn[_mesa_VerticesInMax]; -varying in float gl_PointSizeIn[_mesa_VerticesInMax]; -varying in vec4 gl_ClipVertexIn[_mesa_VerticesInMax]; - -varying out vec4 gl_Position; -varying out vec4 gl_FrontColor; -varying out vec4 gl_BackColor; -varying out vec4 gl_FrontSecondaryColor; -varying out vec4 gl_BackSecondaryColor; -varying out vec4 gl_TexCoord[gl_MaxTextureCoords]; -varying out float gl_FogFragCoord; - -void EmitVertex() -{ - __asm emit_vertex; -} - -void EndPrimitive() -{ - __asm end_primitive; -} diff --git a/src/mesa/slang/library/slang_vertex_builtin.gc b/src/mesa/slang/library/slang_vertex_builtin.gc deleted file mode 100644 index 0c67c2ef20..0000000000 --- a/src/mesa/slang/library/slang_vertex_builtin.gc +++ /dev/null @@ -1,210 +0,0 @@ -/* - * Mesa 3-D graphics library - * Version: 6.5 - * - * Copyright (C) 2006 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. - */ - -// -// From Shader Spec, ver. 1.10, rev. 59 -// - -__fixed_output vec4 gl_Position; -__fixed_output float gl_PointSize; -__fixed_output vec4 gl_ClipVertex; - -attribute vec4 gl_Color; -attribute vec4 gl_SecondaryColor; -attribute vec3 gl_Normal; -attribute vec4 gl_Vertex; -attribute vec4 gl_MultiTexCoord0; -attribute vec4 gl_MultiTexCoord1; -attribute vec4 gl_MultiTexCoord2; -attribute vec4 gl_MultiTexCoord3; -attribute vec4 gl_MultiTexCoord4; -attribute vec4 gl_MultiTexCoord5; -attribute vec4 gl_MultiTexCoord6; -attribute vec4 gl_MultiTexCoord7; -attribute float gl_FogCoord; - -varying vec4 gl_FrontColor; -varying vec4 gl_BackColor; -varying vec4 gl_FrontSecondaryColor; -varying vec4 gl_BackSecondaryColor; -varying vec4 gl_TexCoord[gl_MaxTextureCoords]; -varying float gl_FogFragCoord; - -// -// Geometric Functions -// - -vec4 ftransform() -{ - __retVal = gl_ModelViewProjectionMatrix[0] * gl_Vertex.xxxx - + gl_ModelViewProjectionMatrix[1] * gl_Vertex.yyyy - + gl_ModelViewProjectionMatrix[2] * gl_Vertex.zzzz - + gl_ModelViewProjectionMatrix[3] * gl_Vertex.wwww; -} - - - -// -// 8.7 Texture Lookup Functions -// These are pretty much identical to the ones in slang_fragment_builtin.gc -// When used in a vertex program, the texture sample instructions should not -// be using a LOD term so it's effectively zero. Adding 'lod' to that does -// what we want. -// - -vec4 texture1DLod(const sampler1D sampler, const float coord, const float lod) -{ - vec4 coord4; - coord4.x = coord; - coord4.w = lod; - __asm vec4_tex_1d_bias __retVal, sampler, coord4; -} - -vec4 texture1DProjLod(const sampler1D sampler, const vec2 coord, const float lod) -{ - vec4 pcoord; - pcoord.x = coord.x / coord.y; - pcoord.w = lod; - __asm vec4_tex_1d_bias __retVal, sampler, pcoord; -} - -vec4 texture1DProjLod(const sampler1D sampler, const vec4 coord, const float lod) -{ - vec4 pcoord; - pcoord.x = coord.x / coord.z; - pcoord.w = lod; - __asm vec4_tex_1d_bias __retVal, sampler, pcoord; -} - - - -vec4 texture2DLod(const sampler2D sampler, const vec2 coord, const float lod) -{ - vec4 coord4; - coord4.xy = coord.xy; - coord4.w = lod; - __asm vec4_tex_2d_bias __retVal, sampler, coord4; -} - -vec4 texture2DProjLod(const sampler2D sampler, const vec3 coord, const float lod) -{ - vec4 pcoord; - pcoord.xy = coord.xy / coord.z; - pcoord.w = lod; - __asm vec4_tex_2d_bias __retVal, sampler, pcoord; -} - -vec4 texture2DProjLod(const sampler2D sampler, const vec4 coord, const float lod) -{ - vec4 pcoord; - pcoord.xy = coord.xy / coord.z; - pcoord.w = lod; - __asm vec4_tex_2d_bias __retVal, sampler, pcoord; -} - - -vec4 texture3DLod(const sampler3D sampler, const vec3 coord, const float lod) -{ - vec4 coord4; - coord4.xyz = coord.xyz; - coord4.w = lod; - __asm vec4_tex_3d_bias __retVal, sampler, coord4; -} - -vec4 texture3DProjLod(const sampler3D sampler, const vec4 coord, const float lod) -{ - // do projection here (there's no vec4_tex_3d_bias_proj instruction) - vec4 pcoord; - pcoord.xyz = coord.xyz / coord.w; - pcoord.w = lod; - __asm vec4_tex_3d_bias __retVal, sampler, pcoord; -} - - -vec4 textureCubeLod(const samplerCube sampler, const vec3 coord, const float lod) -{ - vec4 coord4; - coord4.xyz = coord; - coord4.w = lod; - __asm vec4_tex_cube __retVal, sampler, coord4; -} - - -vec4 shadow1DLod(const sampler1DShadow sampler, const vec3 coord, const float lod) -{ - vec4 coord4; - coord4.xyz = coord; - coord4.w = lod; - __asm vec4_tex_1d_bias_shadow __retVal, sampler, coord4; -} - -vec4 shadow1DProjLod(const sampler1DShadow sampler, const vec4 coord, - const float lod) -{ - vec4 pcoord; - pcoord.x = coord.x / coord.w; - pcoord.z = coord.z; - pcoord.w = lod; - __asm vec4_tex_1d_bias_shadow __retVal, sampler, pcoord; -} - - -vec4 shadow2DLod(const sampler2DShadow sampler, const vec3 coord, const float lod) -{ - vec4 coord4; - coord4.xyz = coord; - coord4.w = lod; - __asm vec4_tex_2d_bias_shadow __retVal, sampler, coord4; -} - -vec4 shadow2DProjLod(const sampler2DShadow sampler, const vec4 coord, - const float lod) -{ - vec4 pcoord; - pcoord.xy = coord.xy / coord.w; - pcoord.z = coord.z; - pcoord.w = lod; - __asm vec4_tex_2d_bias_shadow __retVal, sampler, pcoord; -} - - -//// GL_EXT_texture_array - -vec4 texture1DArrayLod(const sampler1DArray sampler, const vec2 coord, const float lod) -{ - vec4 coord4; - coord4.xy = coord; - coord4.w = lod; - __asm vec4_tex_1d_array_bias __retVal, sampler, coord4; -} - - -vec4 texture2DArrayLod(const sampler2DArray sampler, const vec3 coord, const float lod) -{ - vec4 coord4; - coord4.xyz = coord; - coord4.w = lod; - __asm vec4_tex_2d_array_bias __retVal, sampler, coord4; -} - diff --git a/src/mesa/slang/slang_builtin.c b/src/mesa/slang/slang_builtin.c deleted file mode 100644 index 179571fab4..0000000000 --- a/src/mesa/slang/slang_builtin.c +++ /dev/null @@ -1,1020 +0,0 @@ -/* - * Mesa 3-D graphics library - * Version: 7.3 - * - * Copyright (C) 2005-2007 Brian Paul All Rights Reserved. - * Copyright (C) 2008 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 slang_builtin.c - * Resolve built-in uniform vars. - * \author Brian Paul - */ - -#include "main/imports.h" -#include "main/mtypes.h" -#include "program/program.h" -#include "program/prog_instruction.h" -#include "program/prog_parameter.h" -#include "program/prog_statevars.h" -#include "slang/slang_builtin.h" -#include "slang/slang_compile_struct.h" -#include "slang/slang_ir.h" -#include "slang/slang_typeinfo.h" - - -/** special state token (see below) */ -#define STATE_ARRAY ((gl_state_index) 0xfffff) - - -/** - * Lookup GL state given a variable name, 0, 1 or 2 indexes and a field. - * Allocate room for the state in the given param list and return position - * in the list. - * Yes, this is kind of ugly, but it works. - */ -static GLint -lookup_statevar(const char *var, GLint index1, GLint index2, const char *field, - GLuint *swizzleOut, - struct gl_program_parameter_list *paramList) -{ - /* - * NOTE: The ARB_vertex_program extension specified that matrices get - * loaded in registers in row-major order. With GLSL, we want column- - * major order. So, we need to transpose all matrices here... - */ - static const struct { - const char *name; - gl_state_index matrix; - gl_state_index modifier; - } matrices[] = { - { "gl_ModelViewMatrix", STATE_MODELVIEW_MATRIX, STATE_MATRIX_TRANSPOSE }, - { "gl_ModelViewMatrixInverse", STATE_MODELVIEW_MATRIX, STATE_MATRIX_INVTRANS }, - { "gl_ModelViewMatrixTranspose", STATE_MODELVIEW_MATRIX, 0 }, - { "gl_ModelViewMatrixInverseTranspose", STATE_MODELVIEW_MATRIX, STATE_MATRIX_INVERSE }, - - { "gl_ProjectionMatrix", STATE_PROJECTION_MATRIX, STATE_MATRIX_TRANSPOSE }, - { "gl_ProjectionMatrixInverse", STATE_PROJECTION_MATRIX, STATE_MATRIX_INVTRANS }, - { "gl_ProjectionMatrixTranspose", STATE_PROJECTION_MATRIX, 0 }, - { "gl_ProjectionMatrixInverseTranspose", STATE_PROJECTION_MATRIX, STATE_MATRIX_INVERSE }, - - { "gl_ModelViewProjectionMatrix", STATE_MVP_MATRIX, STATE_MATRIX_TRANSPOSE }, - { "gl_ModelViewProjectionMatrixInverse", STATE_MVP_MATRIX, STATE_MATRIX_INVTRANS }, - { "gl_ModelViewProjectionMatrixTranspose", STATE_MVP_MATRIX, 0 }, - { "gl_ModelViewProjectionMatrixInverseTranspose", STATE_MVP_MATRIX, STATE_MATRIX_INVERSE }, - - { "gl_TextureMatrix", STATE_TEXTURE_MATRIX, STATE_MATRIX_TRANSPOSE }, - { "gl_TextureMatrixInverse", STATE_TEXTURE_MATRIX, STATE_MATRIX_INVTRANS }, - { "gl_TextureMatrixTranspose", STATE_TEXTURE_MATRIX, 0 }, - { "gl_TextureMatrixInverseTranspose", STATE_TEXTURE_MATRIX, STATE_MATRIX_INVERSE }, - - { "gl_NormalMatrix", STATE_MODELVIEW_MATRIX, STATE_MATRIX_INVERSE }, - - { NULL, 0, 0 } - }; - gl_state_index tokens[STATE_LENGTH]; - GLuint i; - GLboolean isMatrix = GL_FALSE; - - for (i = 0; i < STATE_LENGTH; i++) { - tokens[i] = 0; - } - *swizzleOut = SWIZZLE_NOOP; - - /* first, look if var is a pre-defined matrix */ - for (i = 0; matrices[i].name; i++) { - if (strcmp(var, matrices[i].name) == 0) { - tokens[0] = matrices[i].matrix; - /* tokens[1], [2] and [3] filled below */ - tokens[4] = matrices[i].modifier; - isMatrix = GL_TRUE; - break; - } - } - - if (isMatrix) { - if (tokens[0] == STATE_TEXTURE_MATRIX) { - /* texture_matrix[index1][index2] */ - tokens[1] = index1 >= 0 ? index1 : 0; /* which texture matrix */ - index1 = index2; /* move matrix row value to index1 */ - } - if (index1 < 0) { - /* index1 is unused: prevent extra addition at end of function */ - index1 = 0; - } - } - else if (strcmp(var, "gl_DepthRange") == 0) { - tokens[0] = STATE_DEPTH_RANGE; - assert(field); - if (strcmp(field, "near") == 0) { - *swizzleOut = SWIZZLE_XXXX; - } - else if (strcmp(field, "far") == 0) { - *swizzleOut = SWIZZLE_YYYY; - } - else if (strcmp(field, "diff") == 0) { - *swizzleOut = SWIZZLE_ZZZZ; - } - else { - return -1; - } - } - else if (strcmp(var, "gl_ClipPlane") == 0) { - if (index1 < 0) - return -1; - tokens[0] = STATE_CLIPPLANE; - tokens[1] = index1; - } - else if (strcmp(var, "gl_Point") == 0) { - assert(field); - if (strcmp(field, "size") == 0) { - tokens[0] = STATE_POINT_SIZE; - *swizzleOut = SWIZZLE_XXXX; - } - else if (strcmp(field, "sizeMin") == 0) { - tokens[0] = STATE_POINT_SIZE; - *swizzleOut = SWIZZLE_YYYY; - } - else if (strcmp(field, "sizeMax") == 0) { - tokens[0] = STATE_POINT_SIZE; - *swizzleOut = SWIZZLE_ZZZZ; - } - else if (strcmp(field, "fadeThresholdSize") == 0) { - tokens[0] = STATE_POINT_SIZE; - *swizzleOut = SWIZZLE_WWWW; - } - else if (strcmp(field, "distanceConstantAttenuation") == 0) { - tokens[0] = STATE_POINT_ATTENUATION; - *swizzleOut = SWIZZLE_XXXX; - } - else if (strcmp(field, "distanceLinearAttenuation") == 0) { - tokens[0] = STATE_POINT_ATTENUATION; - *swizzleOut = SWIZZLE_YYYY; - } - else if (strcmp(field, "distanceQuadraticAttenuation") == 0) { - tokens[0] = STATE_POINT_ATTENUATION; - *swizzleOut = SWIZZLE_ZZZZ; - } - else { - return -1; - } - } - else if (strcmp(var, "gl_FrontMaterial") == 0 || - strcmp(var, "gl_BackMaterial") == 0) { - tokens[0] = STATE_MATERIAL; - if (strcmp(var, "gl_FrontMaterial") == 0) - tokens[1] = 0; - else - tokens[1] = 1; - assert(field); - if (strcmp(field, "emission") == 0) { - tokens[2] = STATE_EMISSION; - } - else if (strcmp(field, "ambient") == 0) { - tokens[2] = STATE_AMBIENT; - } - else if (strcmp(field, "diffuse") == 0) { - tokens[2] = STATE_DIFFUSE; - } - else if (strcmp(field, "specular") == 0) { - tokens[2] = STATE_SPECULAR; - } - else if (strcmp(field, "shininess") == 0) { - tokens[2] = STATE_SHININESS; - *swizzleOut = SWIZZLE_XXXX; - } - else { - return -1; - } - } - else if (strcmp(var, "gl_LightSource") == 0) { - if (!field || index1 < 0) - return -1; - - tokens[0] = STATE_LIGHT; - tokens[1] = index1; - - if (strcmp(field, "ambient") == 0) { - tokens[2] = STATE_AMBIENT; - } - else if (strcmp(field, "diffuse") == 0) { - tokens[2] = STATE_DIFFUSE; - } - else if (strcmp(field, "specular") == 0) { - tokens[2] = STATE_SPECULAR; - } - else if (strcmp(field, "position") == 0) { - tokens[2] = STATE_POSITION; - } - else if (strcmp(field, "halfVector") == 0) { - tokens[2] = STATE_HALF_VECTOR; - } - else if (strcmp(field, "spotDirection") == 0) { - tokens[2] = STATE_SPOT_DIRECTION; - } - else if (strcmp(field, "spotCosCutoff") == 0) { - tokens[2] = STATE_SPOT_DIRECTION; - *swizzleOut = SWIZZLE_WWWW; - } - else if (strcmp(field, "spotCutoff") == 0) { - tokens[2] = STATE_SPOT_CUTOFF; - *swizzleOut = SWIZZLE_XXXX; - } - else if (strcmp(field, "spotExponent") == 0) { - tokens[2] = STATE_ATTENUATION; - *swizzleOut = SWIZZLE_WWWW; - } - else if (strcmp(field, "constantAttenuation") == 0) { - tokens[2] = STATE_ATTENUATION; - *swizzleOut = SWIZZLE_XXXX; - } - else if (strcmp(field, "linearAttenuation") == 0) { - tokens[2] = STATE_ATTENUATION; - *swizzleOut = SWIZZLE_YYYY; - } - else if (strcmp(field, "quadraticAttenuation") == 0) { - tokens[2] = STATE_ATTENUATION; - *swizzleOut = SWIZZLE_ZZZZ; - } - else { - return -1; - } - } - else if (strcmp(var, "gl_LightModel") == 0) { - if (strcmp(field, "ambient") == 0) { - tokens[0] = STATE_LIGHTMODEL_AMBIENT; - } - else { - return -1; - } - } - else if (strcmp(var, "gl_FrontLightModelProduct") == 0) { - if (strcmp(field, "sceneColor") == 0) { - tokens[0] = STATE_LIGHTMODEL_SCENECOLOR; - tokens[1] = 0; - } - else { - return -1; - } - } - else if (strcmp(var, "gl_BackLightModelProduct") == 0) { - if (strcmp(field, "sceneColor") == 0) { - tokens[0] = STATE_LIGHTMODEL_SCENECOLOR; - tokens[1] = 1; - } - else { - return -1; - } - } - else if (strcmp(var, "gl_FrontLightProduct") == 0 || - strcmp(var, "gl_BackLightProduct") == 0) { - if (index1 < 0 || !field) - return -1; - - tokens[0] = STATE_LIGHTPROD; - tokens[1] = index1; /* light number */ - if (strcmp(var, "gl_FrontLightProduct") == 0) { - tokens[2] = 0; /* front */ - } - else { - tokens[2] = 1; /* back */ - } - if (strcmp(field, "ambient") == 0) { - tokens[3] = STATE_AMBIENT; - } - else if (strcmp(field, "diffuse") == 0) { - tokens[3] = STATE_DIFFUSE; - } - else if (strcmp(field, "specular") == 0) { - tokens[3] = STATE_SPECULAR; - } - else { - return -1; - } - } - else if (strcmp(var, "gl_TextureEnvColor") == 0) { - if (index1 < 0) - return -1; - tokens[0] = STATE_TEXENV_COLOR; - tokens[1] = index1; - } - else if (strcmp(var, "gl_EyePlaneS") == 0) { - if (index1 < 0) - return -1; - tokens[0] = STATE_TEXGEN; - tokens[1] = index1; /* tex unit */ - tokens[2] = STATE_TEXGEN_EYE_S; - } - else if (strcmp(var, "gl_EyePlaneT") == 0) { - if (index1 < 0) - return -1; - tokens[0] = STATE_TEXGEN; - tokens[1] = index1; /* tex unit */ - tokens[2] = STATE_TEXGEN_EYE_T; - } - else if (strcmp(var, "gl_EyePlaneR") == 0) { - if (index1 < 0) - return -1; - tokens[0] = STATE_TEXGEN; - tokens[1] = index1; /* tex unit */ - tokens[2] = STATE_TEXGEN_EYE_R; - } - else if (strcmp(var, "gl_EyePlaneQ") == 0) { - if (index1 < 0) - return -1; - tokens[0] = STATE_TEXGEN; - tokens[1] = index1; /* tex unit */ - tokens[2] = STATE_TEXGEN_EYE_Q; - } - else if (strcmp(var, "gl_ObjectPlaneS") == 0) { - if (index1 < 0) - return -1; - tokens[0] = STATE_TEXGEN; - tokens[1] = index1; /* tex unit */ - tokens[2] = STATE_TEXGEN_OBJECT_S; - } - else if (strcmp(var, "gl_ObjectPlaneT") == 0) { - if (index1 < 0) - return -1; - tokens[0] = STATE_TEXGEN; - tokens[1] = index1; /* tex unit */ - tokens[2] = STATE_TEXGEN_OBJECT_T; - } - else if (strcmp(var, "gl_ObjectPlaneR") == 0) { - if (index1 < 0) - return -1; - tokens[0] = STATE_TEXGEN; - tokens[1] = index1; /* tex unit */ - tokens[2] = STATE_TEXGEN_OBJECT_R; - } - else if (strcmp(var, "gl_ObjectPlaneQ") == 0) { - if (index1 < 0) - return -1; - tokens[0] = STATE_TEXGEN; - tokens[1] = index1; /* tex unit */ - tokens[2] = STATE_TEXGEN_OBJECT_Q; - } - else if (strcmp(var, "gl_Fog") == 0) { - if (strcmp(field, "color") == 0) { - tokens[0] = STATE_FOG_COLOR; - } - else if (strcmp(field, "density") == 0) { - tokens[0] = STATE_FOG_PARAMS; - *swizzleOut = SWIZZLE_XXXX; - } - else if (strcmp(field, "start") == 0) { - tokens[0] = STATE_FOG_PARAMS; - *swizzleOut = SWIZZLE_YYYY; - } - else if (strcmp(field, "end") == 0) { - tokens[0] = STATE_FOG_PARAMS; - *swizzleOut = SWIZZLE_ZZZZ; - } - else if (strcmp(field, "scale") == 0) { - tokens[0] = STATE_FOG_PARAMS; - *swizzleOut = SWIZZLE_WWWW; - } - else { - return -1; - } - } - else { - return -1; - } - - if (isMatrix) { - /* load all four rows (or columns) of matrix */ - GLint pos[4]; - GLuint j; - for (j = 0; j < 4; j++) { - tokens[2] = tokens[3] = j; /* jth row of matrix */ - pos[j] = _mesa_add_state_reference(paramList, tokens); - assert(pos[j] >= 0); - ASSERT(pos[j] >= 0); - } - return pos[0] + index1; - } - else { - /* allocate a single register */ - GLint pos = _mesa_add_state_reference(paramList, tokens); - ASSERT(pos >= 0); - return pos; - } -} - - - -/** - * Given a variable name and datatype, emit uniform/constant buffer - * entries which will store that state variable. - * For example, if name="gl_LightSource" we'll emit 64 state variable - * vectors/references and return position where that data starts. This will - * allow run-time array indexing into the light source array. - * - * Note that this is a recursive function. - * - * \return -1 if error, else index of start of data in the program parameter list - */ -static GLint -emit_statevars(const char *name, int array_len, - const slang_type_specifier *type, - gl_state_index tokens[STATE_LENGTH], - struct gl_program_parameter_list *paramList) -{ - if (type->type == SLANG_SPEC_ARRAY) { - GLint i, pos = -1; - assert(array_len > 0); - if (strcmp(name, "gl_ClipPlane") == 0) { - tokens[0] = STATE_CLIPPLANE; - } - else if (strcmp(name, "gl_LightSource") == 0) { - tokens[0] = STATE_LIGHT; - } - else if (strcmp(name, "gl_FrontLightProduct") == 0) { - tokens[0] = STATE_LIGHTPROD; - tokens[2] = 0; /* front */ - } - else if (strcmp(name, "gl_BackLightProduct") == 0) { - tokens[0] = STATE_LIGHTPROD; - tokens[2] = 1; /* back */ - } - else if (strcmp(name, "gl_TextureEnvColor") == 0) { - tokens[0] = STATE_TEXENV_COLOR; - } - else if (strcmp(name, "gl_EyePlaneS") == 0) { - tokens[0] = STATE_TEXGEN; - tokens[2] = STATE_TEXGEN_EYE_S; - } - else if (strcmp(name, "gl_EyePlaneT") == 0) { - tokens[0] = STATE_TEXGEN; - tokens[2] = STATE_TEXGEN_EYE_T; - } - else if (strcmp(name, "gl_EyePlaneR") == 0) { - tokens[0] = STATE_TEXGEN; - tokens[2] = STATE_TEXGEN_EYE_R; - } - else if (strcmp(name, "gl_EyePlaneQ") == 0) { - tokens[0] = STATE_TEXGEN; - tokens[2] = STATE_TEXGEN_EYE_Q; - } - else if (strcmp(name, "gl_ObjectPlaneS") == 0) { - tokens[0] = STATE_TEXGEN; - tokens[2] = STATE_TEXGEN_OBJECT_S; - } - else if (strcmp(name, "gl_ObjectPlaneT") == 0) { - tokens[0] = STATE_TEXGEN; - tokens[2] = STATE_TEXGEN_OBJECT_T; - } - else if (strcmp(name, "gl_ObjectPlaneR") == 0) { - tokens[0] = STATE_TEXGEN; - tokens[2] = STATE_TEXGEN_OBJECT_R; - } - else if (strcmp(name, "gl_ObjectPlaneQ") == 0) { - tokens[0] = STATE_TEXGEN; - tokens[2] = STATE_TEXGEN_OBJECT_Q; - } - else if (strcmp(name, "gl_TextureMatrix") == 0) { - tokens[0] = STATE_TEXTURE_MATRIX; - tokens[4] = STATE_MATRIX_TRANSPOSE; - } - else if (strcmp(name, "gl_TextureMatrixInverse") == 0) { - tokens[0] = STATE_TEXTURE_MATRIX; - tokens[4] = STATE_MATRIX_INVTRANS; - } - else if (strcmp(name, "gl_TextureMatrixTranspose") == 0) { - tokens[0] = STATE_TEXTURE_MATRIX; - tokens[4] = 0; - } - else if (strcmp(name, "gl_TextureMatrixInverseTranspose") == 0) { - tokens[0] = STATE_TEXTURE_MATRIX; - tokens[4] = STATE_MATRIX_INVERSE; - } - else { - return -1; /* invalid array name */ - } - /* emit state vars for each array element */ - for (i = 0; i < array_len; i++) { - GLint p; - tokens[1] = i; - p = emit_statevars(NULL, 0, type->_array, tokens, paramList); - if (i == 0) - pos = p; - } - return pos; - } - else if (type->type == SLANG_SPEC_STRUCT) { - const slang_variable_scope *fields = type->_struct->fields; - GLuint i, pos = 0; - for (i = 0; i < fields->num_variables; i++) { - const slang_variable *var = fields->variables[i]; - GLint p = emit_statevars(var->a_name, 0, &var->type.specifier, - tokens, paramList); - if (i == 0) - pos = p; - } - return pos; - } - else if (type->type == SLANG_SPEC_MAT4) { - /* unroll/emit 4 array rows (or columns) */ - slang_type_specifier vec4; - GLint i, p, pos = -1; - vec4.type = SLANG_SPEC_VEC4; - for (i = 0; i < 4; i++) { - tokens[2] = tokens[3] = i; /* row[i] (or column[i]) of matrix */ - p = emit_statevars(NULL, 0, &vec4, tokens, paramList); - if (pos == -1) - pos = p; - } - return pos; - } - else { - GLint pos; - assert(type->type == SLANG_SPEC_VEC4 || - type->type == SLANG_SPEC_VEC3 || - type->type == SLANG_SPEC_VEC2 || - type->type == SLANG_SPEC_FLOAT || - type->type == SLANG_SPEC_IVEC4 || - type->type == SLANG_SPEC_IVEC3 || - type->type == SLANG_SPEC_IVEC2 || - type->type == SLANG_SPEC_INT); - if (name) { - GLint t; - - if (tokens[0] == STATE_LIGHT) - t = 2; - else if (tokens[0] == STATE_LIGHTPROD) - t = 3; - else - return -1; /* invalid array name */ - - if (strcmp(name, "ambient") == 0) { - tokens[t] = STATE_AMBIENT; - } - else if (strcmp(name, "diffuse") == 0) { - tokens[t] = STATE_DIFFUSE; - } - else if (strcmp(name, "specular") == 0) { - tokens[t] = STATE_SPECULAR; - } - else if (strcmp(name, "position") == 0) { - tokens[t] = STATE_POSITION; - } - else if (strcmp(name, "halfVector") == 0) { - tokens[t] = STATE_HALF_VECTOR; - } - else if (strcmp(name, "spotDirection") == 0) { - tokens[t] = STATE_SPOT_DIRECTION; /* xyz components */ - } - else if (strcmp(name, "spotCosCutoff") == 0) { - tokens[t] = STATE_SPOT_DIRECTION; /* w component */ - } - - else if (strcmp(name, "constantAttenuation") == 0) { - tokens[t] = STATE_ATTENUATION; /* x component */ - } - else if (strcmp(name, "linearAttenuation") == 0) { - tokens[t] = STATE_ATTENUATION; /* y component */ - } - else if (strcmp(name, "quadraticAttenuation") == 0) { - tokens[t] = STATE_ATTENUATION; /* z component */ - } - else if (strcmp(name, "spotExponent") == 0) { - tokens[t] = STATE_ATTENUATION; /* w = spot exponent */ - } - - else if (strcmp(name, "spotCutoff") == 0) { - tokens[t] = STATE_SPOT_CUTOFF; /* x component */ - } - - else { - return -1; /* invalid field name */ - } - } - - pos = _mesa_add_state_reference(paramList, tokens); - return pos; - } - - return 1; -} - - -/** - * Unroll the named built-in uniform variable into a sequence of state - * vars in the given parameter list. - */ -static GLint -alloc_state_var_array(const slang_variable *var, - struct gl_program_parameter_list *paramList) -{ - gl_state_index tokens[STATE_LENGTH]; - GLuint i; - GLint pos; - - /* Initialize the state tokens array. This is very important. - * When we call _mesa_add_state_reference() it'll searches the parameter - * list to see if the given statevar token sequence is already present. - * This is normally a good thing since it prevents redundant values in the - * constant buffer. - * - * But when we're building arrays of state this can be bad. For example, - * consider this fragment of GLSL code: - * foo = gl_LightSource[3].diffuse; - * ... - * bar = gl_LightSource[i].diffuse; - * - * When we unroll the gl_LightSource array (for "bar") we want to re-emit - * gl_LightSource[3].diffuse and not re-use the first instance (from "foo") - * since that would upset the array layout. We handle this situation by - * setting the last token in the state var token array to the special - * value STATE_ARRAY. - * This token will only be set for array state. We can hijack the last - * element in the array for this since it's never used for light, clipplane - * or texture env array state. - */ - for (i = 0; i < STATE_LENGTH; i++) - tokens[i] = 0; - tokens[STATE_LENGTH - 1] = STATE_ARRAY; - - pos = emit_statevars(var->a_name, var->array_len, &var->type.specifier, - tokens, paramList); - - return pos; -} - - - -/** - * Allocate storage for a pre-defined uniform (a GL state variable). - * As a memory-saving optimization, we try to only allocate storage for - * state vars that are actually used. - * - * Arrays such as gl_LightSource are handled specially. For an expression - * like "gl_LightSource[2].diffuse", we can allocate a single uniform/constant - * slot and return the index. In this case, we return direct=TRUE. - * - * Buf for something like "gl_LightSource[i].diffuse" we don't know the value - * of 'i' at compile time so we need to "unroll" the gl_LightSource array - * into a consecutive sequence of uniform/constant slots so it can be indexed - * at runtime. In this case, we return direct=FALSE. - * - * Currently, all pre-defined uniforms are in one of these forms: - * var - * var[i] - * var.field - * var[i].field - * var[i][j] - * - * \return -1 upon error, else position in paramList of the state variable/data - */ -GLint -_slang_alloc_statevar(slang_ir_node *n, - struct gl_program_parameter_list *paramList, - GLboolean *direct) -{ - slang_ir_node *n0 = n; - const char *field = NULL; - GLint index1 = -1, index2 = -1; - GLuint swizzle; - - *direct = GL_TRUE; - - if (n->Opcode == IR_FIELD) { - field = n->Field; - n = n->Children[0]; - } - - if (n->Opcode == IR_ELEMENT) { - if (n->Children[1]->Opcode == IR_FLOAT) { - index1 = (GLint) n->Children[1]->Value[0]; - } - else { - *direct = GL_FALSE; - } - n = n->Children[0]; - } - - if (n->Opcode == IR_ELEMENT) { - /* XXX can only handle constant indexes for now */ - if (n->Children[1]->Opcode == IR_FLOAT) { - /* two-dimensional array index: mat[i][j] */ - index2 = index1; - index1 = (GLint) n->Children[1]->Value[0]; - } - else { - *direct = GL_FALSE; - } - n = n->Children[0]; - } - - assert(n->Opcode == IR_VAR); - - if (*direct) { - const char *var = (const char *) n->Var->a_name; - GLint pos = - lookup_statevar(var, index1, index2, field, &swizzle, paramList); - if (pos >= 0) { - /* newly resolved storage for the statevar/constant/uniform */ - n0->Store->File = PROGRAM_STATE_VAR; - n0->Store->Index = pos; - n0->Store->Swizzle = swizzle; - n0->Store->Parent = NULL; - return pos; - } - } - - *direct = GL_FALSE; - return alloc_state_var_array(n->Var, paramList); -} - - - - -#define SWIZZLE_ZWWW MAKE_SWIZZLE4(SWIZZLE_Z, SWIZZLE_W, SWIZZLE_W, SWIZZLE_W) - - -/** Predefined shader inputs */ -struct input_info -{ - const char *Name; - GLuint Attrib; - GLenum Type; - GLuint Swizzle; - GLboolean Array; -}; - -/** Predefined vertex shader inputs/attributes */ -static const struct input_info vertInputs[] = { - { "gl_Vertex", VERT_ATTRIB_POS, GL_FLOAT_VEC4, SWIZZLE_NOOP, GL_FALSE }, - { "gl_Normal", VERT_ATTRIB_NORMAL, GL_FLOAT_VEC3, SWIZZLE_NOOP, GL_FALSE }, - { "gl_Color", VERT_ATTRIB_COLOR0, GL_FLOAT_VEC4, SWIZZLE_NOOP, GL_FALSE }, - { "gl_SecondaryColor", VERT_ATTRIB_COLOR1, GL_FLOAT_VEC4, SWIZZLE_NOOP, GL_FALSE }, - { "gl_FogCoord", VERT_ATTRIB_FOG, GL_FLOAT, SWIZZLE_XXXX, GL_FALSE }, - { "gl_MultiTexCoord0", VERT_ATTRIB_TEX0, GL_FLOAT_VEC4, SWIZZLE_NOOP, GL_FALSE }, - { "gl_MultiTexCoord1", VERT_ATTRIB_TEX1, GL_FLOAT_VEC4, SWIZZLE_NOOP, GL_FALSE }, - { "gl_MultiTexCoord2", VERT_ATTRIB_TEX2, GL_FLOAT_VEC4, SWIZZLE_NOOP, GL_FALSE }, - { "gl_MultiTexCoord3", VERT_ATTRIB_TEX3, GL_FLOAT_VEC4, SWIZZLE_NOOP, GL_FALSE }, - { "gl_MultiTexCoord4", VERT_ATTRIB_TEX4, GL_FLOAT_VEC4, SWIZZLE_NOOP, GL_FALSE }, - { "gl_MultiTexCoord5", VERT_ATTRIB_TEX5, GL_FLOAT_VEC4, SWIZZLE_NOOP, GL_FALSE }, - { "gl_MultiTexCoord6", VERT_ATTRIB_TEX6, GL_FLOAT_VEC4, SWIZZLE_NOOP, GL_FALSE }, - { "gl_MultiTexCoord7", VERT_ATTRIB_TEX7, GL_FLOAT_VEC4, SWIZZLE_NOOP, GL_FALSE } -}; - -static const struct input_info geomInputs[] = { - { "gl_PrimitiveIDIn", GEOM_ATTRIB_PRIMITIVE_ID, GL_FLOAT, SWIZZLE_NOOP, GL_FALSE }, - { "gl_FrontColorIn", GEOM_ATTRIB_COLOR0, GL_FLOAT_VEC4, SWIZZLE_NOOP, GL_TRUE }, - { "gl_BackColorIn", GEOM_ATTRIB_COLOR1, GL_FLOAT_VEC4, SWIZZLE_NOOP, GL_TRUE }, - { "gl_FrontSecondaryColorIn", GEOM_ATTRIB_SECONDARY_COLOR0, GL_FLOAT_VEC4, SWIZZLE_NOOP, GL_TRUE }, - { "gl_BackSecondaryColorIn", GEOM_ATTRIB_SECONDARY_COLOR1, GL_FLOAT_VEC4, SWIZZLE_NOOP, GL_TRUE }, - { "gl_TexCoordIn", GEOM_ATTRIB_TEX_COORD, GL_FLOAT_VEC4, SWIZZLE_NOOP, GL_TRUE }, - { "gl_FogFragCoordIn", GEOM_ATTRIB_FOG_FRAG_COORD, GL_FLOAT, SWIZZLE_NOOP, GL_TRUE }, - { "gl_PositionIn", GEOM_ATTRIB_POSITION, GL_FLOAT_VEC4, SWIZZLE_NOOP, GL_TRUE }, - { "gl_ClipVertexIn", GEOM_ATTRIB_CLIP_VERTEX, GL_FLOAT_VEC4, SWIZZLE_NOOP, GL_TRUE }, - { "gl_PointSizeIn", GEOM_ATTRIB_POINT_SIZE, GL_FLOAT, SWIZZLE_NOOP, GL_TRUE } -}; - -/** Predefined fragment shader inputs */ -static const struct input_info fragInputs[] = { - { "gl_FragCoord", FRAG_ATTRIB_WPOS, GL_FLOAT_VEC4, SWIZZLE_NOOP, GL_FALSE }, - { "gl_Color", FRAG_ATTRIB_COL0, GL_FLOAT_VEC4, SWIZZLE_NOOP, GL_FALSE }, - { "gl_SecondaryColor", FRAG_ATTRIB_COL1, GL_FLOAT_VEC4, SWIZZLE_NOOP, GL_FALSE }, - { "gl_TexCoord", FRAG_ATTRIB_TEX0, GL_FLOAT_VEC4, SWIZZLE_NOOP, GL_FALSE }, - { "gl_FogFragCoord", FRAG_ATTRIB_FOGC, GL_FLOAT, SWIZZLE_XXXX, GL_FALSE }, - { "gl_FrontFacing", FRAG_ATTRIB_FACE, GL_FLOAT, SWIZZLE_XXXX, GL_FALSE }, - { "gl_PointCoord", FRAG_ATTRIB_PNTC, GL_FLOAT_VEC2, SWIZZLE_XYZW, GL_FALSE } -}; - - -/** - * Return the VERT_ATTRIB_* or FRAG_ATTRIB_* value that corresponds to - * a vertex or fragment program input variable. Return -1 if the input - * name is invalid. - * XXX return size too - */ -GLint -_slang_input_index(const char *name, GLenum target, GLuint *swizzleOut, - GLboolean *is_array) -{ - const struct input_info *inputs; - GLuint i, n; - - switch (target) { - case GL_VERTEX_PROGRAM_ARB: - inputs = vertInputs; - n = Elements(vertInputs); - break; - case GL_FRAGMENT_PROGRAM_ARB: - inputs = fragInputs; - n = Elements(fragInputs); - break; - case MESA_GEOMETRY_PROGRAM: - inputs = geomInputs; - n = Elements(geomInputs); - break; - default: - _mesa_problem(NULL, "bad target in _slang_input_index"); - return -1; - } - - ASSERT(MAX_TEXTURE_COORD_UNITS == 8); /* if this fails, fix vertInputs above */ - - for (i = 0; i < n; i++) { - if (strcmp(inputs[i].Name, name) == 0) { - /* found */ - *swizzleOut = inputs[i].Swizzle; - if (is_array) - *is_array = inputs[i].Array; - return inputs[i].Attrib; - } - } - return -1; -} - - -/** - * Return name of the given vertex attribute (VERT_ATTRIB_x). - */ -const char * -_slang_vert_attrib_name(GLuint attrib) -{ - GLuint i; - assert(attrib < VERT_ATTRIB_GENERIC0); - for (i = 0; Elements(vertInputs); i++) { - if (vertInputs[i].Attrib == attrib) - return vertInputs[i].Name; - } - return NULL; -} - - -/** - * Return type (GL_FLOAT, GL_FLOAT_VEC2, etc) of the given vertex - * attribute (VERT_ATTRIB_x). - */ -GLenum -_slang_vert_attrib_type(GLuint attrib) -{ - GLuint i; - assert(attrib < VERT_ATTRIB_GENERIC0); - for (i = 0; Elements(vertInputs); i++) { - if (vertInputs[i].Attrib == attrib) - return vertInputs[i].Type; - } - return GL_NONE; -} - - - - - -/** Predefined shader output info */ -struct output_info -{ - const char *Name; - GLuint Attrib; - GLenum Type; -}; - -/** Predefined vertex shader outputs */ -static const struct output_info vertOutputs[] = { - { "gl_Position", VERT_RESULT_HPOS, GL_FLOAT_VEC4 }, - { "gl_FrontColor", VERT_RESULT_COL0, GL_FLOAT_VEC4 }, - { "gl_BackColor", VERT_RESULT_BFC0, GL_FLOAT_VEC4 }, - { "gl_FrontSecondaryColor", VERT_RESULT_COL1, GL_FLOAT_VEC4 }, - { "gl_BackSecondaryColor", VERT_RESULT_BFC1, GL_FLOAT_VEC4 }, - { "gl_TexCoord", VERT_RESULT_TEX0, GL_FLOAT_VEC4 }, - { "gl_FogFragCoord", VERT_RESULT_FOGC, GL_FLOAT }, - { "gl_PointSize", VERT_RESULT_PSIZ, GL_FLOAT } -}; - -/** Predefined geometry shader outputs */ -static const struct output_info geomOutputs[] = { - { "gl_Position", GEOM_RESULT_POS, GL_FLOAT_VEC4 }, - { "gl_FrontColor", GEOM_RESULT_COL0, GL_FLOAT_VEC4 }, - { "gl_BackColor", GEOM_RESULT_COL1, GL_FLOAT_VEC4 }, - { "gl_FrontSecondaryColor", GEOM_RESULT_SCOL0, GL_FLOAT_VEC4 }, - { "gl_BackSecondaryColor", GEOM_RESULT_SCOL1, GL_FLOAT_VEC4 }, - { "gl_TexCoord", GEOM_RESULT_TEX0, GL_FLOAT_VEC4 }, - { "gl_FogFragCoord", GEOM_RESULT_FOGC, GL_FLOAT }, - { "gl_ClipVertex", GEOM_RESULT_CLPV, GL_FLOAT_VEC4 }, - { "gl_PointSize", GEOM_RESULT_PSIZ, GL_FLOAT }, - { "gl_PrimitiveID", GEOM_RESULT_PRID, GL_FLOAT }, - { "gl_Layer", GEOM_RESULT_LAYR, GL_FLOAT } -}; - -/** Predefined fragment shader outputs */ -static const struct output_info fragOutputs[] = { - { "gl_FragColor", FRAG_RESULT_COLOR, GL_FLOAT_VEC4 }, - { "gl_FragDepth", FRAG_RESULT_DEPTH, GL_FLOAT }, - { "gl_FragData", FRAG_RESULT_DATA0, GL_FLOAT_VEC4 } -}; - - -/** - * Return the VERT_RESULT_*, GEOM_RESULT_* or FRAG_RESULT_* value that corresponds - * to a vertex or fragment program output variable. Return -1 for an invalid - * output name. - */ -GLint -_slang_output_index(const char *name, GLenum target) -{ - const struct output_info *outputs; - GLuint i, n; - - switch (target) { - case GL_VERTEX_PROGRAM_ARB: - outputs = vertOutputs; - n = Elements(vertOutputs); - break; - case GL_FRAGMENT_PROGRAM_ARB: - outputs = fragOutputs; - n = Elements(fragOutputs); - break; - case MESA_GEOMETRY_PROGRAM: - outputs = geomOutputs; - n = Elements(geomOutputs); - break; - default: - _mesa_problem(NULL, "bad target in _slang_output_index"); - return -1; - } - - for (i = 0; i < n; i++) { - if (strcmp(outputs[i].Name, name) == 0) { - /* found */ - return outputs[i].Attrib; - } - } - return -1; -} - - -/** - * Given a VERT_RESULT_x index, return the corresponding string name. - */ -const char * -_slang_vertex_output_name(gl_vert_result index) -{ - if (index < Elements(vertOutputs)) - return vertOutputs[index].Name; - else - return NULL; -} - - -/** - * Given a GEOM_RESULT_x index, return the corresponding string name. - */ -const char * -_slang_geometry_output_name(gl_geom_result index) -{ - if (index < Elements(geomOutputs)) - return geomOutputs[index].Name; - else - return NULL; -} - - -/** - * Given a FRAG_RESULT_x index, return the corresponding string name. - */ -const char * -_slang_fragment_output_name(gl_frag_result index) -{ - if (index < Elements(fragOutputs)) - return fragOutputs[index].Name; - else - return NULL; -} - - -/** - * Given a VERT_RESULT_x index, return the corresponding varying - * var's datatype. - */ -GLenum -_slang_vertex_output_type(gl_vert_result index) -{ - if (index < Elements(vertOutputs)) - return vertOutputs[index].Type; - else - return GL_NONE; -} diff --git a/src/mesa/slang/slang_builtin.h b/src/mesa/slang/slang_builtin.h deleted file mode 100644 index dc92f83f8e..0000000000 --- a/src/mesa/slang/slang_builtin.h +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Mesa 3-D graphics library - * Version: 6.5.3 - * - * Copyright (C) 2005-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 SLANG_BUILTIN_H -#define SLANG_BUILTIN_H - -#include "main/glheader.h" -#include "main/mtypes.h" -#include "slang_ir.h" - - -extern GLint -_slang_alloc_statevar(slang_ir_node *n, - struct gl_program_parameter_list *paramList, - GLboolean *direct); - - -extern GLint -_slang_input_index(const char *name, GLenum target, GLuint *swizzleOut, - GLboolean *is_array); - -extern GLint -_slang_output_index(const char *name, GLenum target); - - -extern const char * -_slang_vert_attrib_name(GLuint attrib); - -extern GLenum -_slang_vert_attrib_type(GLuint attrib); - - -const char * -_slang_vertex_output_name(gl_vert_result index); - -const char * -_slang_fragment_output_name(gl_frag_result index); - -const char * -_slang_geometry_output_name(gl_geom_result index); - -GLenum -_slang_vertex_output_type(gl_vert_result index); - - -#endif /* SLANG_BUILTIN_H */ diff --git a/src/mesa/slang/slang_codegen.c b/src/mesa/slang/slang_codegen.c deleted file mode 100644 index 95787e4409..0000000000 --- a/src/mesa/slang/slang_codegen.c +++ /dev/null @@ -1,5410 +0,0 @@ -/* - * Mesa 3-D graphics library - * - * Copyright (C) 2005-2007 Brian Paul All Rights Reserved. - * Copyright (C) 2008 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 slang_codegen.c - * Generate IR tree from AST. - * \author Brian Paul - */ - - -/*** - *** NOTES: - *** The new_() functions return a new instance of a simple IR node. - *** The gen_() functions generate larger IR trees from the simple nodes. - ***/ - - - -#include "main/imports.h" -#include "main/macros.h" -#include "main/mtypes.h" -#include "program/program.h" -#include "program/prog_instruction.h" -#include "program/prog_parameter.h" -#include "program/prog_print.h" -#include "program/prog_statevars.h" -#include "slang_typeinfo.h" -#include "slang_builtin.h" -#include "slang_codegen.h" -#include "slang_compile.h" -#include "slang_label.h" -#include "slang_mem.h" -#include "slang_simplify.h" -#include "slang_emit.h" -#include "slang_vartable.h" -#include "slang_ir.h" -#include "slang_print.h" - - -/** Max iterations to unroll */ -const GLuint MAX_FOR_LOOP_UNROLL_ITERATIONS = 32; - -/** Max for-loop body size (in slang operations) to unroll */ -const GLuint MAX_FOR_LOOP_UNROLL_BODY_SIZE = 50; - -/** Max for-loop body complexity to unroll. - * We'll compute complexity as the product of the number of iterations - * and the size of the body. So long-ish loops with very simple bodies - * can be unrolled, as well as short loops with larger bodies. - */ -const GLuint MAX_FOR_LOOP_UNROLL_COMPLEXITY = 256; - - - -static slang_ir_node * -_slang_gen_operation(slang_assemble_ctx * A, slang_operation *oper); - -static void -slang_substitute(slang_assemble_ctx *A, slang_operation *oper, - GLuint substCount, slang_variable **substOld, - slang_operation **substNew, GLboolean isLHS); - - -/** - * Retrieves type information about an operation. - * Returns GL_TRUE on success. - * Returns GL_FALSE otherwise. - */ -static GLboolean -typeof_operation(const struct slang_assemble_ctx_ *A, - slang_operation *op, - slang_typeinfo *ti) -{ - return _slang_typeof_operation(op, &A->space, ti, A->atoms, A->log); -} - - -static GLboolean -is_sampler_type(const slang_fully_specified_type *t) -{ - switch (t->specifier.type) { - case SLANG_SPEC_SAMPLER_1D: - case SLANG_SPEC_SAMPLER_2D: - case SLANG_SPEC_SAMPLER_3D: - case SLANG_SPEC_SAMPLER_CUBE: - case SLANG_SPEC_SAMPLER_1D_SHADOW: - case SLANG_SPEC_SAMPLER_2D_SHADOW: - case SLANG_SPEC_SAMPLER_RECT: - case SLANG_SPEC_SAMPLER_RECT_SHADOW: - case SLANG_SPEC_SAMPLER_1D_ARRAY: - case SLANG_SPEC_SAMPLER_2D_ARRAY: - case SLANG_SPEC_SAMPLER_1D_ARRAY_SHADOW: - case SLANG_SPEC_SAMPLER_2D_ARRAY_SHADOW: - return GL_TRUE; - default: - return GL_FALSE; - } -} - - -/** - * Return the offset (in floats or ints) of the named field within - * the given struct. Return -1 if field not found. - * If field is NULL, return the size of the struct instead. - */ -static GLint -_slang_field_offset(const slang_type_specifier *spec, slang_atom field) -{ - GLint offset = 0; - GLuint i; - for (i = 0; i < spec->_struct->fields->num_variables; i++) { - const slang_variable *v = spec->_struct->fields->variables[i]; - const GLuint sz = _slang_sizeof_type_specifier(&v->type.specifier); - if (sz > 1) { - /* types larger than 1 float are register (4-float) aligned */ - offset = (offset + 3) & ~3; - } - if (field && v->a_name == field) { - return offset; - } - offset += sz; - } - if (field) - return -1; /* field not found */ - else - return offset; /* struct size */ -} - - -/** - * Return the size (in floats) of the given type specifier. - * If the size is greater than 4, the size should be a multiple of 4 - * so that the correct number of 4-float registers are allocated. - * For example, a mat3x2 is size 12 because we want to store the - * 3 columns in 3 float[4] registers. - */ -GLuint -_slang_sizeof_type_specifier(const slang_type_specifier *spec) -{ - GLuint sz; - switch (spec->type) { - case SLANG_SPEC_VOID: - sz = 0; - break; - case SLANG_SPEC_BOOL: - sz = 1; - break; - case SLANG_SPEC_BVEC2: - sz = 2; - break; - case SLANG_SPEC_BVEC3: - sz = 3; - break; - case SLANG_SPEC_BVEC4: - sz = 4; - break; - case SLANG_SPEC_INT: - sz = 1; - break; - case SLANG_SPEC_IVEC2: - sz = 2; - break; - case SLANG_SPEC_IVEC3: - sz = 3; - break; - case SLANG_SPEC_IVEC4: - sz = 4; - break; - case SLANG_SPEC_FLOAT: - sz = 1; - break; - case SLANG_SPEC_VEC2: - sz = 2; - break; - case SLANG_SPEC_VEC3: - sz = 3; - break; - case SLANG_SPEC_VEC4: - sz = 4; - break; - case SLANG_SPEC_MAT2: - sz = 2 * 4; /* 2 columns (regs) */ - break; - case SLANG_SPEC_MAT3: - sz = 3 * 4; - break; - case SLANG_SPEC_MAT4: - sz = 4 * 4; - break; - case SLANG_SPEC_MAT23: - sz = 2 * 4; /* 2 columns (regs) */ - break; - case SLANG_SPEC_MAT32: - sz = 3 * 4; /* 3 columns (regs) */ - break; - case SLANG_SPEC_MAT24: - sz = 2 * 4; - break; - case SLANG_SPEC_MAT42: - sz = 4 * 4; /* 4 columns (regs) */ - break; - case SLANG_SPEC_MAT34: - sz = 3 * 4; - break; - case SLANG_SPEC_MAT43: - sz = 4 * 4; /* 4 columns (regs) */ - break; - case SLANG_SPEC_SAMPLER_1D: - case SLANG_SPEC_SAMPLER_2D: - case SLANG_SPEC_SAMPLER_3D: - case SLANG_SPEC_SAMPLER_CUBE: - case SLANG_SPEC_SAMPLER_1D_SHADOW: - case SLANG_SPEC_SAMPLER_2D_SHADOW: - case SLANG_SPEC_SAMPLER_RECT: - case SLANG_SPEC_SAMPLER_RECT_SHADOW: - case SLANG_SPEC_SAMPLER_1D_ARRAY: - case SLANG_SPEC_SAMPLER_2D_ARRAY: - case SLANG_SPEC_SAMPLER_1D_ARRAY_SHADOW: - case SLANG_SPEC_SAMPLER_2D_ARRAY_SHADOW: - sz = 1; /* a sampler is basically just an integer index */ - break; - case SLANG_SPEC_STRUCT: - sz = _slang_field_offset(spec, 0); /* special use */ - if (sz == 1) { - /* 1-float structs are actually troublesome to deal with since they - * might get placed at R.x, R.y, R.z or R.z. Return size=2 to - * ensure the object is placed at R.x - */ - sz = 2; - } - else if (sz > 4) { - sz = (sz + 3) & ~0x3; /* round up to multiple of four */ - } - break; - case SLANG_SPEC_ARRAY: - sz = _slang_sizeof_type_specifier(spec->_array); - break; - default: - _mesa_problem(NULL, "Unexpected type in _slang_sizeof_type_specifier()"); - sz = 0; - } - - if (sz > 4) { - /* if size is > 4, it should be a multiple of four */ - assert((sz & 0x3) == 0); - } - return sz; -} - - -/** - * Query variable/array length (number of elements). - * This is slightly non-trivial because there are two ways to express - * arrays: "float x[3]" vs. "float[3] x". - * \return the length of the array for the given variable, or 0 if not an array - */ -static GLint -_slang_array_length(const slang_variable *var) -{ - if (var->type.array_len > 0) { - /* Ex: float[4] x; */ - return var->type.array_len; - } - if (var->array_len > 0) { - /* Ex: float x[4]; */ - return var->array_len; - } - return 0; -} - - -/** - * Compute total size of array give size of element, number of elements. - * \return size in floats - */ -static GLint -_slang_array_size(GLint elemSize, GLint arrayLen) -{ - GLint total; - assert(elemSize > 0); - if (arrayLen > 1) { - /* round up base type to multiple of 4 */ - total = ((elemSize + 3) & ~0x3) * MAX2(arrayLen, 1); - } - else { - total = elemSize; - } - return total; -} - - -/** - * Return the TEXTURE_*_INDEX value that corresponds to a sampler type, - * or -1 if the type is not a sampler. - */ -static GLint -sampler_to_texture_index(const slang_type_specifier_type type) -{ - switch (type) { - case SLANG_SPEC_SAMPLER_1D: - return TEXTURE_1D_INDEX; - case SLANG_SPEC_SAMPLER_2D: - return TEXTURE_2D_INDEX; - case SLANG_SPEC_SAMPLER_3D: - return TEXTURE_3D_INDEX; - case SLANG_SPEC_SAMPLER_CUBE: - return TEXTURE_CUBE_INDEX; - case SLANG_SPEC_SAMPLER_1D_SHADOW: - return TEXTURE_1D_INDEX; /* XXX fix */ - case SLANG_SPEC_SAMPLER_2D_SHADOW: - return TEXTURE_2D_INDEX; /* XXX fix */ - case SLANG_SPEC_SAMPLER_RECT: - return TEXTURE_RECT_INDEX; - case SLANG_SPEC_SAMPLER_RECT_SHADOW: - return TEXTURE_RECT_INDEX; /* XXX fix */ - case SLANG_SPEC_SAMPLER_1D_ARRAY: - return TEXTURE_1D_ARRAY_INDEX; - case SLANG_SPEC_SAMPLER_2D_ARRAY: - return TEXTURE_2D_ARRAY_INDEX; - case SLANG_SPEC_SAMPLER_1D_ARRAY_SHADOW: - return TEXTURE_1D_ARRAY_INDEX; - case SLANG_SPEC_SAMPLER_2D_ARRAY_SHADOW: - return TEXTURE_2D_ARRAY_INDEX; - default: - return -1; - } -} - - -/** helper to build a SLANG_OPER_IDENTIFIER node */ -static void -slang_operation_identifier(slang_operation *oper, - slang_assemble_ctx *A, - const char *name) -{ - oper->type = SLANG_OPER_IDENTIFIER; - oper->a_id = slang_atom_pool_atom(A->atoms, name); -} - - -/** - * Called when we begin code/IR generation for a new while/do/for loop. - */ -static void -push_loop(slang_assemble_ctx *A, slang_operation *loopOper, slang_ir_node *loopIR) -{ - A->LoopOperStack[A->LoopDepth] = loopOper; - A->LoopIRStack[A->LoopDepth] = loopIR; - A->LoopDepth++; -} - - -/** - * Called when we end code/IR generation for a new while/do/for loop. - */ -static void -pop_loop(slang_assemble_ctx *A) -{ - assert(A->LoopDepth > 0); - A->LoopDepth--; -} - - -/** - * Return pointer to slang_operation for the loop we're currently inside, - * or NULL if not in a loop. - */ -static const slang_operation * -current_loop_oper(const slang_assemble_ctx *A) -{ - if (A->LoopDepth > 0) - return A->LoopOperStack[A->LoopDepth - 1]; - else - return NULL; -} - - -/** - * Return pointer to slang_ir_node for the loop we're currently inside, - * or NULL if not in a loop. - */ -static slang_ir_node * -current_loop_ir(const slang_assemble_ctx *A) -{ - if (A->LoopDepth > 0) - return A->LoopIRStack[A->LoopDepth - 1]; - else - return NULL; -} - - -/**********************************************************************/ - - -/** - * Map "_asm foo" to IR_FOO, etc. - */ -typedef struct -{ - const char *Name; - slang_ir_opcode Opcode; - GLuint HaveRetValue, NumParams; -} slang_asm_info; - - -static slang_asm_info AsmInfo[] = { - /* vec4 binary op */ - { "vec4_add", IR_ADD, 1, 2 }, - { "vec4_subtract", IR_SUB, 1, 2 }, - { "vec4_multiply", IR_MUL, 1, 2 }, - { "vec4_dot", IR_DOT4, 1, 2 }, - { "vec3_dot", IR_DOT3, 1, 2 }, - { "vec2_dot", IR_DOT2, 1, 2 }, - { "vec3_nrm", IR_NRM3, 1, 1 }, - { "vec4_nrm", IR_NRM4, 1, 1 }, - { "vec3_cross", IR_CROSS, 1, 2 }, - { "vec4_lrp", IR_LRP, 1, 3 }, - { "vec4_min", IR_MIN, 1, 2 }, - { "vec4_max", IR_MAX, 1, 2 }, - { "vec4_cmp", IR_CMP, 1, 3 }, - { "vec4_clamp", IR_CLAMP, 1, 3 }, - { "vec4_seq", IR_SEQUAL, 1, 2 }, - { "vec4_sne", IR_SNEQUAL, 1, 2 }, - { "vec4_sge", IR_SGE, 1, 2 }, - { "vec4_sgt", IR_SGT, 1, 2 }, - { "vec4_sle", IR_SLE, 1, 2 }, - { "vec4_slt", IR_SLT, 1, 2 }, - /* vec4 unary */ - { "vec4_move", IR_MOVE, 1, 1 }, - { "vec4_floor", IR_FLOOR, 1, 1 }, - { "vec4_frac", IR_FRAC, 1, 1 }, - { "vec4_abs", IR_ABS, 1, 1 }, - { "vec4_negate", IR_NEG, 1, 1 }, - { "vec4_ddx", IR_DDX, 1, 1 }, - { "vec4_ddy", IR_DDY, 1, 1 }, - /* float binary op */ - { "float_power", IR_POW, 1, 2 }, - /* texture / sampler */ - { "vec4_tex_1d", IR_TEX, 1, 2 }, - { "vec4_tex_1d_bias", IR_TEXB, 1, 2 }, /* 1d w/ bias */ - { "vec4_tex_1d_proj", IR_TEXP, 1, 2 }, /* 1d w/ projection */ - { "vec4_tex_2d", IR_TEX, 1, 2 }, - { "vec4_tex_2d_bias", IR_TEXB, 1, 2 }, /* 2d w/ bias */ - { "vec4_tex_2d_proj", IR_TEXP, 1, 2 }, /* 2d w/ projection */ - { "vec4_tex_3d", IR_TEX, 1, 2 }, - { "vec4_tex_3d_bias", IR_TEXB, 1, 2 }, /* 3d w/ bias */ - { "vec4_tex_3d_proj", IR_TEXP, 1, 2 }, /* 3d w/ projection */ - { "vec4_tex_cube", IR_TEX, 1, 2 }, /* cubemap */ - { "vec4_tex_rect", IR_TEX, 1, 2 }, /* rectangle */ - { "vec4_tex_rect_bias", IR_TEX, 1, 2 }, /* rectangle w/ projection */ - { "vec4_tex_1d_array", IR_TEX, 1, 2 }, - { "vec4_tex_1d_array_bias", IR_TEXB, 1, 2 }, - { "vec4_tex_1d_array_shadow", IR_TEX, 1, 2 }, - { "vec4_tex_1d_array_bias_shadow", IR_TEXB, 1, 2 }, - { "vec4_tex_2d_array", IR_TEX, 1, 2 }, - { "vec4_tex_2d_array_bias", IR_TEXB, 1, 2 }, - { "vec4_tex_2d_array_shadow", IR_TEX, 1, 2 }, - { "vec4_tex_2d_array_bias_shadow", IR_TEXB, 1, 2 }, - - /* texture / sampler but with shadow comparison */ - { "vec4_tex_1d_shadow", IR_TEX_SH, 1, 2 }, - { "vec4_tex_1d_bias_shadow", IR_TEXB_SH, 1, 2 }, - { "vec4_tex_1d_proj_shadow", IR_TEXP_SH, 1, 2 }, - { "vec4_tex_2d_shadow", IR_TEX_SH, 1, 2 }, - { "vec4_tex_2d_bias_shadow", IR_TEXB_SH, 1, 2 }, - { "vec4_tex_2d_proj_shadow", IR_TEXP_SH, 1, 2 }, - { "vec4_tex_rect_shadow", IR_TEX_SH, 1, 2 }, - { "vec4_tex_rect_proj_shadow", IR_TEXP_SH, 1, 2 }, - - /* unary op */ - { "ivec4_to_vec4", IR_I_TO_F, 1, 1 }, /* int[4] to float[4] */ - { "vec4_to_ivec4", IR_F_TO_I, 1, 1 }, /* float[4] to int[4] */ - { "float_exp", IR_EXP, 1, 1 }, - { "float_exp2", IR_EXP2, 1, 1 }, - { "float_log2", IR_LOG2, 1, 1 }, - { "float_rsq", IR_RSQ, 1, 1 }, - { "float_rcp", IR_RCP, 1, 1 }, - { "float_sine", IR_SIN, 1, 1 }, - { "float_cosine", IR_COS, 1, 1 }, - { "float_noise1", IR_NOISE1, 1, 1}, - { "float_noise2", IR_NOISE2, 1, 1}, - { "float_noise3", IR_NOISE3, 1, 1}, - { "float_noise4", IR_NOISE4, 1, 1}, - - { "emit_vertex", IR_EMIT_VERTEX, 0, 0}, - { "end_primitive", IR_END_PRIMITIVE, 0, 0}, - - { NULL, IR_NOP, 0, 0 } -}; - - -static slang_ir_node * -new_node3(slang_ir_opcode op, - slang_ir_node *c0, slang_ir_node *c1, slang_ir_node *c2) -{ - slang_ir_node *n = (slang_ir_node *) _slang_alloc(sizeof(slang_ir_node)); - if (n) { - n->Opcode = op; - n->Children[0] = c0; - n->Children[1] = c1; - n->Children[2] = c2; - n->InstLocation = -1; - } - return n; -} - -static slang_ir_node * -new_node2(slang_ir_opcode op, slang_ir_node *c0, slang_ir_node *c1) -{ - return new_node3(op, c0, c1, NULL); -} - -static slang_ir_node * -new_node1(slang_ir_opcode op, slang_ir_node *c0) -{ - return new_node3(op, c0, NULL, NULL); -} - -static slang_ir_node * -new_node0(slang_ir_opcode op) -{ - return new_node3(op, NULL, NULL, NULL); -} - - -/** - * Create sequence of two nodes. - */ -static slang_ir_node * -new_seq(slang_ir_node *left, slang_ir_node *right) -{ - if (!left) - return right; - if (!right) - return left; - return new_node2(IR_SEQ, left, right); -} - -static slang_ir_node * -new_label(slang_label *label) -{ - slang_ir_node *n = new_node0(IR_LABEL); - assert(label); - if (n) - n->Label = label; - return n; -} - -static slang_ir_node * -new_float_literal(const float v[4], GLuint size) -{ - slang_ir_node *n = new_node0(IR_FLOAT); - assert(size <= 4); - COPY_4V(n->Value, v); - /* allocate a storage object, but compute actual location (Index) later */ - n->Store = _slang_new_ir_storage(PROGRAM_CONSTANT, -1, size); - return n; -} - - -static slang_ir_node * -new_not(slang_ir_node *n) -{ - return new_node1(IR_NOT, n); -} - - -/** - * Non-inlined function call. - */ -static slang_ir_node * -new_function_call(slang_ir_node *code, slang_label *name) -{ - slang_ir_node *n = new_node1(IR_CALL, code); - assert(name); - if (n) - n->Label = name; - return n; -} - - -/** - * Unconditional jump. - */ -static slang_ir_node * -new_return(slang_label *dest) -{ - slang_ir_node *n = new_node0(IR_RETURN); - assert(dest); - if (n) - n->Label = dest; - return n; -} - - -static slang_ir_node * -new_loop(slang_ir_node *body) -{ - return new_node1(IR_LOOP, body); -} - - -static slang_ir_node * -new_break(slang_ir_node *loopNode) -{ - slang_ir_node *n = new_node0(IR_BREAK); - assert(loopNode); - assert(loopNode->Opcode == IR_LOOP); - if (n) { - /* insert this node at head of linked list of cont/break instructions */ - n->List = loopNode->List; - loopNode->List = n; - } - return n; -} - - -/** - * Make new IR_BREAK_IF_TRUE. - */ -static slang_ir_node * -new_break_if_true(slang_assemble_ctx *A, slang_ir_node *cond) -{ - slang_ir_node *loopNode = current_loop_ir(A); - slang_ir_node *n; - assert(loopNode); - assert(loopNode->Opcode == IR_LOOP); - n = new_node1(IR_BREAK_IF_TRUE, cond); - if (n) { - /* insert this node at head of linked list of cont/break instructions */ - n->List = loopNode->List; - loopNode->List = n; - } - return n; -} - - -/** - * Make new IR_CONT_IF_TRUE node. - */ -static slang_ir_node * -new_cont_if_true(slang_assemble_ctx *A, slang_ir_node *cond) -{ - slang_ir_node *loopNode = current_loop_ir(A); - slang_ir_node *n; - assert(loopNode); - assert(loopNode->Opcode == IR_LOOP); - n = new_node1(IR_CONT_IF_TRUE, cond); - if (n) { - n->Parent = loopNode; /* pointer to containing loop */ - /* insert this node at head of linked list of cont/break instructions */ - n->List = loopNode->List; - loopNode->List = n; - } - return n; -} - - -static slang_ir_node * -new_cond(slang_ir_node *n) -{ - slang_ir_node *c = new_node1(IR_COND, n); - return c; -} - - -static slang_ir_node * -new_if(slang_ir_node *cond, slang_ir_node *ifPart, slang_ir_node *elsePart) -{ - return new_node3(IR_IF, cond, ifPart, elsePart); -} - - -/** - * New IR_VAR node - a reference to a previously declared variable. - */ -static slang_ir_node * -new_var(slang_assemble_ctx *A, slang_variable *var) -{ - slang_ir_node *n = new_node0(IR_VAR); - if (n) { - ASSERT(var); - ASSERT(var->store); - ASSERT(!n->Store); - ASSERT(!n->Var); - - /* Set IR node's Var and Store pointers */ - n->Var = var; - n->Store = var->store; - } - return n; -} - - -/** - * Check if the given function is really just a wrapper for a - * basic assembly instruction. - */ -static GLboolean -slang_is_asm_function(const slang_function *fun) -{ - if (fun->body->type == SLANG_OPER_BLOCK_NO_NEW_SCOPE && - fun->body->num_children == 1 && - fun->body->children[0].type == SLANG_OPER_ASM) { - return GL_TRUE; - } - return GL_FALSE; -} - - -static GLboolean -_slang_is_noop(const slang_operation *oper) -{ - if (!oper || - oper->type == SLANG_OPER_VOID || - (oper->num_children == 1 && oper->children[0].type == SLANG_OPER_VOID)) - return GL_TRUE; - else - return GL_FALSE; -} - - -/** - * Recursively search tree for a node of the given type. - */ -#if 0 -static slang_operation * -_slang_find_node_type(slang_operation *oper, slang_operation_type type) -{ - GLuint i; - if (oper->type == type) - return oper; - for (i = 0; i < oper->num_children; i++) { - slang_operation *p = _slang_find_node_type(&oper->children[i], type); - if (p) - return p; - } - return NULL; -} -#endif - - -/** - * Count the number of operations of the given time rooted at 'oper'. - */ -static GLuint -_slang_count_node_type(const slang_operation *oper, slang_operation_type type) -{ - GLuint i, count = 0; - if (oper->type == type) { - return 1; - } - for (i = 0; i < oper->num_children; i++) { - count += _slang_count_node_type(&oper->children[i], type); - } - return count; -} - - -/** - * Check if the 'return' statement found under 'oper' is a "tail return" - * that can be no-op'd. For example: - * - * void func(void) - * { - * .. do something .. - * return; // this is a no-op - * } - * - * This is used when determining if a function can be inlined. If the - * 'return' is not the last statement, we can't inline the function since - * we still need the semantic behaviour of the 'return' but we don't want - * to accidentally return from the _calling_ function. We'd need to use an - * unconditional branch, but we don't have such a GPU instruction (not - * always, at least). - */ -static GLboolean -_slang_is_tail_return(const slang_operation *oper) -{ - GLuint k = oper->num_children; - - while (k > 0) { - const slang_operation *last = &oper->children[k - 1]; - if (last->type == SLANG_OPER_RETURN) - return GL_TRUE; - else if (last->type == SLANG_OPER_IDENTIFIER || - last->type == SLANG_OPER_LABEL) - k--; /* try prev child */ - else if (last->type == SLANG_OPER_BLOCK_NO_NEW_SCOPE || - last->type == SLANG_OPER_BLOCK_NEW_SCOPE) - /* try sub-children */ - return _slang_is_tail_return(last); - else - break; - } - - return GL_FALSE; -} - - -/** - * Generate a variable declaration opeartion. - * I.e.: generate AST code for "bool flag = false;" - */ -static void -slang_generate_declaration(slang_assemble_ctx *A, - slang_variable_scope *scope, - slang_operation *decl, - slang_type_specifier_type type, - const char *name, - GLint initValue) -{ - slang_variable *var; - - assert(type == SLANG_SPEC_BOOL || - type == SLANG_SPEC_INT); - - decl->type = SLANG_OPER_VARIABLE_DECL; - - var = slang_variable_scope_grow(scope); - - slang_fully_specified_type_construct(&var->type); - - var->type.specifier.type = type; - var->a_name = slang_atom_pool_atom(A->atoms, name); - decl->a_id = var->a_name; - var->initializer = slang_operation_new(1); - slang_operation_literal_bool(var->initializer, initValue); -} - - -static void -slang_resolve_variable(slang_operation *oper) -{ - if (oper->type == SLANG_OPER_IDENTIFIER && !oper->var) { - oper->var = _slang_variable_locate(oper->locals, oper->a_id, GL_TRUE); - } -} - - -/** - * Rewrite AST code for "return expression;". - * - * We return values from functions by assinging the returned value to - * the hidden __retVal variable which is an extra 'out' parameter we add - * to the function signature. - * This code basically converts "return expr;" into "__retVal = expr; return;" - * - * \return the new AST code. - */ -static slang_operation * -gen_return_with_expression(slang_assemble_ctx *A, slang_operation *oper) -{ - slang_operation *blockOper, *assignOper; - - assert(oper->type == SLANG_OPER_RETURN); - - if (A->CurFunction->header.type.specifier.type == SLANG_SPEC_VOID) { - slang_info_log_error(A->log, "illegal return expression"); - return NULL; - } - - blockOper = slang_operation_new(1); - blockOper->type = SLANG_OPER_BLOCK_NO_NEW_SCOPE; - blockOper->locals->outer_scope = oper->locals->outer_scope; - slang_operation_add_children(blockOper, 2); - - if (A->UseReturnFlag) { - /* Emit: - * { - * if (__notRetFlag) - * __retVal = expr; - * __notRetFlag = 0; - * } - */ - { - slang_operation *ifOper = slang_oper_child(blockOper, 0); - ifOper->type = SLANG_OPER_IF; - slang_operation_add_children(ifOper, 3); - { - slang_operation *cond = slang_oper_child(ifOper, 0); - cond->type = SLANG_OPER_IDENTIFIER; - cond->a_id = slang_atom_pool_atom(A->atoms, "__notRetFlag"); - } - { - slang_operation *elseOper = slang_oper_child(ifOper, 2); - elseOper->type = SLANG_OPER_VOID; - } - assignOper = slang_oper_child(ifOper, 1); - } - { - slang_operation *setOper = slang_oper_child(blockOper, 1); - setOper->type = SLANG_OPER_ASSIGN; - slang_operation_add_children(setOper, 2); - { - slang_operation *lhs = slang_oper_child(setOper, 0); - lhs->type = SLANG_OPER_IDENTIFIER; - lhs->a_id = slang_atom_pool_atom(A->atoms, "__notRetFlag"); - } - { - slang_operation *rhs = slang_oper_child(setOper, 1); - slang_operation_literal_bool(rhs, GL_FALSE); - } - } - } - else { - /* Emit: - * { - * __retVal = expr; - * return_inlined; - * } - */ - assignOper = slang_oper_child(blockOper, 0); - { - slang_operation *returnOper = slang_oper_child(blockOper, 1); - returnOper->type = SLANG_OPER_RETURN_INLINED; - assert(returnOper->num_children == 0); - } - } - - /* __retVal = expression; */ - assignOper->type = SLANG_OPER_ASSIGN; - slang_operation_add_children(assignOper, 2); - { - slang_operation *lhs = slang_oper_child(assignOper, 0); - lhs->type = SLANG_OPER_IDENTIFIER; - lhs->a_id = slang_atom_pool_atom(A->atoms, "__retVal"); - } - { - slang_operation *rhs = slang_oper_child(assignOper, 1); - slang_operation_copy(rhs, &oper->children[0]); - } - - /*blockOper->locals->outer_scope = oper->locals->outer_scope;*/ - - /*slang_print_tree(blockOper, 0);*/ - - return blockOper; -} - - -/** - * Rewrite AST code for "return;" (no expression). - */ -static slang_operation * -gen_return_without_expression(slang_assemble_ctx *A, slang_operation *oper) -{ - slang_operation *newRet; - - assert(oper->type == SLANG_OPER_RETURN); - - if (A->CurFunction->header.type.specifier.type != SLANG_SPEC_VOID) { - slang_info_log_error(A->log, "return statement requires an expression"); - return NULL; - } - - if (A->UseReturnFlag) { - /* Emit: - * __notRetFlag = 0; - */ - { - newRet = slang_operation_new(1); - newRet->locals->outer_scope = oper->locals->outer_scope; - newRet->type = SLANG_OPER_ASSIGN; - slang_operation_add_children(newRet, 2); - { - slang_operation *lhs = slang_oper_child(newRet, 0); - lhs->type = SLANG_OPER_IDENTIFIER; - lhs->a_id = slang_atom_pool_atom(A->atoms, "__notRetFlag"); - } - { - slang_operation *rhs = slang_oper_child(newRet, 1); - slang_operation_literal_bool(rhs, GL_FALSE); - } - } - } - else { - /* Emit: - * return_inlined; - */ - newRet = slang_operation_new(1); - newRet->locals->outer_scope = oper->locals->outer_scope; - newRet->type = SLANG_OPER_RETURN_INLINED; - } - - /*slang_print_tree(newRet, 0);*/ - - return newRet; -} - - - - -/** - * Replace particular variables (SLANG_OPER_IDENTIFIER) with new expressions. - */ -static void -slang_substitute(slang_assemble_ctx *A, slang_operation *oper, - GLuint substCount, slang_variable **substOld, - slang_operation **substNew, GLboolean isLHS) -{ - switch (oper->type) { - case SLANG_OPER_VARIABLE_DECL: - { - slang_variable *v = _slang_variable_locate(oper->locals, - oper->a_id, GL_TRUE); - assert(v); - if (v->initializer && oper->num_children == 0) { - /* set child of oper to copy of initializer */ - oper->num_children = 1; - oper->children = slang_operation_new(1); - slang_operation_copy(&oper->children[0], v->initializer); - } - if (oper->num_children == 1) { - /* the initializer */ - slang_substitute(A, &oper->children[0], substCount, - substOld, substNew, GL_FALSE); - } - } - break; - case SLANG_OPER_IDENTIFIER: - assert(oper->num_children == 0); - if (1/**!isLHS XXX FIX */) { - slang_atom id = oper->a_id; - slang_variable *v; - GLuint i; - v = _slang_variable_locate(oper->locals, id, GL_TRUE); - if (!v) { -#if 0 - if (strcmp((char *) oper->a_id, "__notRetFlag")) - _mesa_problem(NULL, "var %s not found!\n", (char *) oper->a_id); -#endif - return; - } - - /* look for a substitution */ - for (i = 0; i < substCount; i++) { - if (v == substOld[i]) { - /* OK, replace this SLANG_OPER_IDENTIFIER with a new expr */ -#if 0 /* DEBUG only */ - if (substNew[i]->type == SLANG_OPER_IDENTIFIER) { - assert(substNew[i]->var); - assert(substNew[i]->var->a_name); - printf("Substitute %s with %s in id node %p\n", - (char*)v->a_name, (char*) substNew[i]->var->a_name, - (void*) oper); - } - else { - printf("Substitute %s with %f in id node %p\n", - (char*)v->a_name, substNew[i]->literal[0], - (void*) oper); - } -#endif - slang_operation_copy(oper, substNew[i]); - break; - } - } - } - break; - - case SLANG_OPER_RETURN: - { - slang_operation *newReturn; - /* generate new 'return' code' */ - if (slang_oper_child(oper, 0)->type == SLANG_OPER_VOID) - newReturn = gen_return_without_expression(A, oper); - else - newReturn = gen_return_with_expression(A, oper); - - if (!newReturn) - return; - - /* do substitutions on the new 'return' code */ - slang_substitute(A, newReturn, - substCount, substOld, substNew, GL_FALSE); - - /* install new 'return' code */ - slang_operation_copy(oper, newReturn); - slang_operation_destruct(newReturn); - } - break; - - case SLANG_OPER_ASSIGN: - case SLANG_OPER_SUBSCRIPT: - /* special case: - * child[0] can't have substitutions but child[1] can. - */ - slang_substitute(A, &oper->children[0], - substCount, substOld, substNew, GL_TRUE); - slang_substitute(A, &oper->children[1], - substCount, substOld, substNew, GL_FALSE); - break; - case SLANG_OPER_FIELD: - /* XXX NEW - test */ - slang_substitute(A, &oper->children[0], - substCount, substOld, substNew, GL_TRUE); - break; - default: - { - GLuint i; - for (i = 0; i < oper->num_children; i++) - slang_substitute(A, &oper->children[i], - substCount, substOld, substNew, GL_FALSE); - } - } -} - - -/** - * Produce inline code for a call to an assembly instruction. - * This is typically used to compile a call to a built-in function like this: - * - * vec4 mix(const vec4 x, const vec4 y, const vec4 a) - * { - * __asm vec4_lrp __retVal, a, y, x; - * } - * - * - * A call to - * r = mix(p1, p2, p3); - * - * Becomes: - * - * mov - * / \ - * r vec4_lrp - * / | \ - * p3 p2 p1 - * - * We basically translate a SLANG_OPER_CALL into a SLANG_OPER_ASM. - */ -static slang_operation * -slang_inline_asm_function(slang_assemble_ctx *A, - slang_function *fun, slang_operation *oper) -{ - const GLuint numArgs = oper->num_children; - GLuint i; - slang_operation *inlined; - const GLboolean haveRetValue = _slang_function_has_return_value(fun); - slang_variable **substOld; - slang_operation **substNew; - - ASSERT(slang_is_asm_function(fun)); - ASSERT(fun->param_count == numArgs + haveRetValue); - - /* - printf("Inline %s as %s\n", - (char*) fun->header.a_name, - (char*) fun->body->children[0].a_id); - */ - - /* - * We'll substitute formal params with actual args in the asm call. - */ - substOld = (slang_variable **) - _slang_alloc(numArgs * sizeof(slang_variable *)); - substNew = (slang_operation **) - _slang_alloc(numArgs * sizeof(slang_operation *)); - for (i = 0; i < numArgs; i++) { - substOld[i] = fun->parameters->variables[i]; - substNew[i] = oper->children + i; - } - - /* make a copy of the code to inline */ - inlined = slang_operation_new(1); - slang_operation_copy(inlined, &fun->body->children[0]); - if (haveRetValue) { - /* get rid of the __retVal child */ - inlined->num_children--; - for (i = 0; i < inlined->num_children; i++) { - inlined->children[i] = inlined->children[i + 1]; - } - } - - /* now do formal->actual substitutions */ - slang_substitute(A, inlined, numArgs, substOld, substNew, GL_FALSE); - - _slang_free(substOld); - _slang_free(substNew); - -#if 0 - printf("+++++++++++++ inlined asm function %s +++++++++++++\n", - (char *) fun->header.a_name); - slang_print_tree(inlined, 3); - printf("+++++++++++++++++++++++++++++++++++++++++++++++++++\n"); -#endif - - return inlined; -} - - -/** - * Inline the given function call operation. - * Return a new slang_operation that corresponds to the inlined code. - */ -static slang_operation * -slang_inline_function_call(slang_assemble_ctx * A, slang_function *fun, - slang_operation *oper, slang_operation *returnOper) -{ - typedef enum { - SUBST = 1, - COPY_IN, - COPY_OUT - } ParamMode; - ParamMode *paramMode; - const GLboolean haveRetValue = _slang_function_has_return_value(fun); - const GLuint numArgs = oper->num_children; - const GLuint totalArgs = numArgs + haveRetValue; - slang_operation *args = oper->children; - slang_operation *inlined, *top; - slang_variable **substOld; - slang_operation **substNew; - GLuint substCount, numCopyIn, i; - slang_function *prevFunction; - slang_variable_scope *newScope = NULL; - - /* save / push */ - prevFunction = A->CurFunction; - A->CurFunction = fun; - - /*assert(oper->type == SLANG_OPER_CALL); (or (matrix) multiply, etc) */ - assert(fun->param_count == totalArgs); - - /* allocate temporary arrays */ - paramMode = (ParamMode *) - _slang_alloc(totalArgs * sizeof(ParamMode)); - substOld = (slang_variable **) - _slang_alloc(totalArgs * sizeof(slang_variable *)); - substNew = (slang_operation **) - _slang_alloc(totalArgs * sizeof(slang_operation *)); - -#if 0 - printf("\nInline call to %s (total vars=%d nparams=%d)\n", - (char *) fun->header.a_name, - fun->parameters->num_variables, numArgs); -#endif - - if (haveRetValue && !returnOper) { - /* Create 3-child comma sequence for inlined code: - * child[0]: declare __resultTmp - * child[1]: inlined function body - * child[2]: __resultTmp - */ - slang_operation *commaSeq; - slang_operation *declOper = NULL; - slang_variable *resultVar; - - commaSeq = slang_operation_new(1); - commaSeq->type = SLANG_OPER_SEQUENCE; - assert(commaSeq->locals); - commaSeq->locals->outer_scope = oper->locals->outer_scope; - commaSeq->num_children = 3; - commaSeq->children = slang_operation_new(3); - /* allocate the return var */ - resultVar = slang_variable_scope_grow(commaSeq->locals); - /* - printf("Alloc __resultTmp in scope %p for retval of calling %s\n", - (void*)commaSeq->locals, (char *) fun->header.a_name); - */ - - resultVar->a_name = slang_atom_pool_atom(A->atoms, "__resultTmp"); - resultVar->type = fun->header.type; /* XXX copy? */ - resultVar->isTemp = GL_TRUE; - - /* child[0] = __resultTmp declaration */ - declOper = &commaSeq->children[0]; - declOper->type = SLANG_OPER_VARIABLE_DECL; - declOper->a_id = resultVar->a_name; - declOper->locals->outer_scope = commaSeq->locals; - - /* child[1] = function body */ - inlined = &commaSeq->children[1]; - inlined->locals->outer_scope = commaSeq->locals; - - /* child[2] = __resultTmp reference */ - returnOper = &commaSeq->children[2]; - returnOper->type = SLANG_OPER_IDENTIFIER; - returnOper->a_id = resultVar->a_name; - returnOper->locals->outer_scope = commaSeq->locals; - - top = commaSeq; - } - else { - top = inlined = slang_operation_new(1); - /* XXXX this may be inappropriate!!!! */ - inlined->locals->outer_scope = oper->locals->outer_scope; - } - - - assert(inlined->locals); - - /* Examine the parameters, look for inout/out params, look for possible - * substitutions, etc: - * param type behaviour - * in copy actual to local - * const in substitute param with actual - * out copy out - */ - substCount = 0; - for (i = 0; i < totalArgs; i++) { - slang_variable *p = fun->parameters->variables[i]; - /* - printf("Param %d: %s %s \n", i, - slang_type_qual_string(p->type.qualifier), - (char *) p->a_name); - */ - if (p->type.qualifier == SLANG_QUAL_INOUT || - p->type.qualifier == SLANG_QUAL_OUT) { - /* an output param */ - slang_operation *arg; - if (i < numArgs) - arg = &args[i]; - else - arg = returnOper; - paramMode[i] = SUBST; - - if (arg->type == SLANG_OPER_IDENTIFIER) - slang_resolve_variable(arg); - - /* replace parameter 'p' with argument 'arg' */ - substOld[substCount] = p; - substNew[substCount] = arg; /* will get copied */ - substCount++; - } - else if (p->type.qualifier == SLANG_QUAL_CONST) { - /* a constant input param */ - if (args[i].type == SLANG_OPER_IDENTIFIER || - args[i].type == SLANG_OPER_LITERAL_FLOAT || - args[i].type == SLANG_OPER_SUBSCRIPT) { - /* replace all occurances of this parameter variable with the - * actual argument variable or a literal. - */ - paramMode[i] = SUBST; - slang_resolve_variable(&args[i]); - substOld[substCount] = p; - substNew[substCount] = &args[i]; /* will get copied */ - substCount++; - } - else { - paramMode[i] = COPY_IN; - } - } - else { - paramMode[i] = COPY_IN; - } - assert(paramMode[i]); - } - - /* actual code inlining: */ - slang_operation_copy(inlined, fun->body); - - /*** XXX review this */ - assert(inlined->type == SLANG_OPER_BLOCK_NO_NEW_SCOPE || - inlined->type == SLANG_OPER_BLOCK_NEW_SCOPE); - inlined->type = SLANG_OPER_BLOCK_NEW_SCOPE; - -#if 0 - printf("======================= orig body code ======================\n"); - printf("=== params scope = %p\n", (void*) fun->parameters); - slang_print_tree(fun->body, 8); - printf("======================= copied code =========================\n"); - slang_print_tree(inlined, 8); -#endif - - /* do parameter substitution in inlined code: */ - slang_substitute(A, inlined, substCount, substOld, substNew, GL_FALSE); - -#if 0 - printf("======================= subst code ==========================\n"); - slang_print_tree(inlined, 8); - printf("=============================================================\n"); -#endif - - /* New prolog statements: (inserted before the inlined code) - * Copy the 'in' arguments. - */ - numCopyIn = 0; - for (i = 0; i < numArgs; i++) { - if (paramMode[i] == COPY_IN) { - slang_variable *p = fun->parameters->variables[i]; - /* declare parameter 'p' */ - slang_operation *decl = slang_operation_insert(&inlined->num_children, - &inlined->children, - numCopyIn); - - decl->type = SLANG_OPER_VARIABLE_DECL; - assert(decl->locals); - decl->locals->outer_scope = inlined->locals; - decl->a_id = p->a_name; - decl->num_children = 1; - decl->children = slang_operation_new(1); - - /* child[0] is the var's initializer */ - slang_operation_copy(&decl->children[0], args + i); - - /* add parameter 'p' to the local variable scope here */ - { - slang_variable *pCopy = slang_variable_scope_grow(inlined->locals); - pCopy->type = p->type; - pCopy->a_name = p->a_name; - pCopy->array_len = p->array_len; - } - - newScope = inlined->locals; - numCopyIn++; - } - } - - /* Now add copies of the function's local vars to the new variable scope */ - for (i = totalArgs; i < fun->parameters->num_variables; i++) { - slang_variable *p = fun->parameters->variables[i]; - slang_variable *pCopy = slang_variable_scope_grow(inlined->locals); - pCopy->type = p->type; - pCopy->a_name = p->a_name; - pCopy->array_len = p->array_len; - } - - - /* New epilog statements: - * 1. Create end of function label to jump to from return statements. - * 2. Copy the 'out' parameter vars - */ - { - slang_operation *lab = slang_operation_insert(&inlined->num_children, - &inlined->children, - inlined->num_children); - lab->type = SLANG_OPER_LABEL; - lab->label = A->curFuncEndLabel; - } - - for (i = 0; i < totalArgs; i++) { - if (paramMode[i] == COPY_OUT) { - const slang_variable *p = fun->parameters->variables[i]; - /* actualCallVar = outParam */ - /*if (i > 0 || !haveRetValue)*/ - slang_operation *ass = slang_operation_insert(&inlined->num_children, - &inlined->children, - inlined->num_children); - ass->type = SLANG_OPER_ASSIGN; - ass->num_children = 2; - ass->locals->outer_scope = inlined->locals; - ass->children = slang_operation_new(2); - ass->children[0] = args[i]; /*XXX copy */ - ass->children[1].type = SLANG_OPER_IDENTIFIER; - ass->children[1].a_id = p->a_name; - ass->children[1].locals->outer_scope = ass->locals; - } - } - - _slang_free(paramMode); - _slang_free(substOld); - _slang_free(substNew); - - /* Update scoping to use the new local vars instead of the - * original function's vars. This is especially important - * for nested inlining. - */ - if (newScope) - slang_replace_scope(inlined, fun->parameters, newScope); - -#if 0 - printf("Done Inline call to %s (total vars=%d nparams=%d)\n\n", - (char *) fun->header.a_name, - fun->parameters->num_variables, numArgs); - slang_print_tree(top, 0); -#endif - - /* pop */ - A->CurFunction = prevFunction; - - return top; -} - - -/** - * Insert declaration for "bool __notRetFlag" in given block operation. - * This is used when we can't emit "early" return statements in subroutines. - */ -static void -declare_return_flag(slang_assemble_ctx *A, slang_operation *oper) -{ - slang_operation *decl; - - assert(oper->type == SLANG_OPER_BLOCK_NEW_SCOPE || - oper->type == SLANG_OPER_SEQUENCE); - - decl = slang_operation_insert_child(oper, 1); - - slang_generate_declaration(A, oper->locals, decl, - SLANG_SPEC_BOOL, "__notRetFlag", GL_TRUE); - - /*slang_print_tree(oper, 0);*/ -} - - -/** - * Recursively replace instances of the old node type with the new type. - */ -static void -replace_node_type(slang_operation *oper, slang_operation_type oldType, - slang_operation_type newType) -{ - GLuint i; - - if (oper->type == oldType) - oper->type = newType; - - for (i = 0; i < slang_oper_num_children(oper); i++) { - replace_node_type(slang_oper_child(oper, i), oldType, newType); - } -} - - - -/** - * Test if the given function body has an "early return". That is, there's - * a 'return' statement that's not the very last instruction in the body. - */ -static GLboolean -has_early_return(const slang_operation *funcBody) -{ - GLuint retCount = _slang_count_node_type(funcBody, SLANG_OPER_RETURN); - if (retCount == 0) - return GL_FALSE; - else if (retCount == 1 && _slang_is_tail_return(funcBody)) - return GL_FALSE; - else - return GL_TRUE; -} - - -/** - * Emit IR code for a function call. This does one of two things: - * 1. Inline the function's code - * 2. Create an IR for the function's body and create a real call to it. - */ -static slang_ir_node * -_slang_gen_function_call(slang_assemble_ctx *A, slang_function *fun, - slang_operation *oper, slang_operation *dest) -{ - slang_ir_node *n; - slang_operation *instance; - slang_label *prevFuncEndLabel; - char name[200]; - - prevFuncEndLabel = A->curFuncEndLabel; - _mesa_snprintf(name, sizeof(name), "__endOfFunc_%s_", (char *) fun->header.a_name); - A->curFuncEndLabel = _slang_label_new(name); - assert(A->curFuncEndLabel); - - /* - * 'instance' is basically a copy of the function's body with various - * transformations. - */ - - if (slang_is_asm_function(fun) && !dest) { - /* assemble assembly function - tree style */ - instance = slang_inline_asm_function(A, fun, oper); - } - else { - /* non-assembly function */ - /* We always generate an "inline-able" block of code here. - * We may either: - * 1. insert the inline code - * 2. Generate a call to the "inline" code as a subroutine - */ - const GLboolean earlyReturn = has_early_return(fun->body); - - if (earlyReturn && !A->EmitContReturn) { - A->UseReturnFlag = GL_TRUE; - } - - instance = slang_inline_function_call(A, fun, oper, dest); - if (!instance) - return NULL; - - if (earlyReturn) { - /* The function we're calling has one or more 'return' statements - * that prevent us from inlining the function's code. - * - * In this case, change the function's body type from - * SLANG_OPER_BLOCK_NEW_SCOPE to SLANG_OPER_NON_INLINED_CALL. - * During code emit this will result in a true subroutine call. - * - * Also, convert SLANG_OPER_RETURN_INLINED nodes to SLANG_OPER_RETURN. - */ - slang_operation *callOper; - - assert(instance->type == SLANG_OPER_BLOCK_NEW_SCOPE || - instance->type == SLANG_OPER_SEQUENCE); - - if (_slang_function_has_return_value(fun) && !dest) { - assert(instance->children[0].type == SLANG_OPER_VARIABLE_DECL); - assert(instance->children[2].type == SLANG_OPER_IDENTIFIER); - callOper = &instance->children[1]; - } - else { - callOper = instance; - } - - if (A->UseReturnFlag) { - /* Early returns not supported. Create a _returnFlag variable - * that's set upon 'return' and tested elsewhere to no-op any - * remaining instructions in the subroutine. - */ - assert(callOper->type == SLANG_OPER_BLOCK_NEW_SCOPE || - callOper->type == SLANG_OPER_SEQUENCE); - declare_return_flag(A, callOper); - } - else { - /* We can emit real 'return' statements. If we generated any - * 'inline return' statements during function instantiation, - * change them back to regular 'return' statements. - */ - replace_node_type(instance, SLANG_OPER_RETURN_INLINED, - SLANG_OPER_RETURN); - } - - callOper->type = SLANG_OPER_NON_INLINED_CALL; - callOper->fun = fun; - callOper->label = _slang_label_new_unique((char*) fun->header.a_name); - } - else { - /* If there are any 'return' statements remaining, they're at the - * very end of the function and can effectively become no-ops. - */ - replace_node_type(instance, SLANG_OPER_RETURN_INLINED, - SLANG_OPER_VOID); - } - } - - if (!instance) - return NULL; - - /* Replace the function call with the instance block (or new CALL stmt) */ - slang_operation_destruct(oper); - *oper = *instance; - _slang_free(instance); - -#if 0 - assert(instance->locals); - printf("*** Inlined code for call to %s:\n", (char*) fun->header.a_name); - slang_print_tree(oper, 10); - printf("\n"); -#endif - - n = _slang_gen_operation(A, oper); - - /*_slang_label_delete(A->curFuncEndLabel);*/ - A->curFuncEndLabel = prevFuncEndLabel; - - if (A->pragmas->Debug) { - char s[1000]; - _mesa_snprintf(s, sizeof(s), "Call/inline %s()", (char *) fun->header.a_name); - n->Comment = _slang_strdup(s); - } - - A->UseReturnFlag = GL_FALSE; - - return n; -} - - -static slang_asm_info * -slang_find_asm_info(const char *name) -{ - GLuint i; - for (i = 0; AsmInfo[i].Name; i++) { - if (strcmp(AsmInfo[i].Name, name) == 0) { - return AsmInfo + i; - } - } - return NULL; -} - - -/** - * Some write-masked assignments are simple, but others are hard. - * Simple example: - * vec3 v; - * v.xy = vec2(a, b); - * Hard example: - * vec3 v; - * v.zy = vec2(a, b); - * this gets transformed/swizzled into: - * v.zy = vec2(a, b).*yx* (* = don't care) - * This function helps to determine simple vs. non-simple. - */ -static GLboolean -_slang_simple_writemask(GLuint writemask, GLuint swizzle) -{ - switch (writemask) { - case WRITEMASK_X: - return GET_SWZ(swizzle, 0) == SWIZZLE_X; - case WRITEMASK_Y: - return GET_SWZ(swizzle, 1) == SWIZZLE_Y; - case WRITEMASK_Z: - return GET_SWZ(swizzle, 2) == SWIZZLE_Z; - case WRITEMASK_W: - return GET_SWZ(swizzle, 3) == SWIZZLE_W; - case WRITEMASK_XY: - return (GET_SWZ(swizzle, 0) == SWIZZLE_X) - && (GET_SWZ(swizzle, 1) == SWIZZLE_Y); - case WRITEMASK_XYZ: - return (GET_SWZ(swizzle, 0) == SWIZZLE_X) - && (GET_SWZ(swizzle, 1) == SWIZZLE_Y) - && (GET_SWZ(swizzle, 2) == SWIZZLE_Z); - case WRITEMASK_XYZW: - return swizzle == SWIZZLE_NOOP; - default: - return GL_FALSE; - } -} - - -/** - * Convert the given swizzle into a writemask. In some cases this - * is trivial, in other cases, we'll need to also swizzle the right - * hand side to put components in the right places. - * See comment above for more info. - * XXX this function could be simplified and should probably be renamed. - * \param swizzle the incoming swizzle - * \param writemaskOut returns the writemask - * \param swizzleOut swizzle to apply to the right-hand-side - * \return GL_FALSE for simple writemasks, GL_TRUE for non-simple - */ -static GLboolean -swizzle_to_writemask(slang_assemble_ctx *A, GLuint swizzle, - GLuint *writemaskOut, GLuint *swizzleOut) -{ - GLuint mask = 0x0, newSwizzle[4]; - GLint i, size; - - /* make new dst writemask, compute size */ - for (i = 0; i < 4; i++) { - const GLuint swz = GET_SWZ(swizzle, i); - if (swz == SWIZZLE_NIL) { - /* end */ - break; - } - assert(swz <= 3); - - if (swizzle != SWIZZLE_XXXX && - swizzle != SWIZZLE_YYYY && - swizzle != SWIZZLE_ZZZZ && - swizzle != SWIZZLE_WWWW && - (mask & (1 << swz))) { - /* a channel can't be specified twice (ex: ".xyyz") */ - slang_info_log_error(A->log, "Invalid writemask '%s'", - _mesa_swizzle_string(swizzle, 0, 0)); - return GL_FALSE; - } - - mask |= (1 << swz); - } - assert(mask <= 0xf); - size = i; /* number of components in mask/swizzle */ - - *writemaskOut = mask; - - /* make new src swizzle, by inversion */ - for (i = 0; i < 4; i++) { - newSwizzle[i] = i; /*identity*/ - } - for (i = 0; i < size; i++) { - const GLuint swz = GET_SWZ(swizzle, i); - newSwizzle[swz] = i; - } - *swizzleOut = MAKE_SWIZZLE4(newSwizzle[0], - newSwizzle[1], - newSwizzle[2], - newSwizzle[3]); - - if (_slang_simple_writemask(mask, *swizzleOut)) { - if (size >= 1) - assert(GET_SWZ(*swizzleOut, 0) == SWIZZLE_X); - if (size >= 2) - assert(GET_SWZ(*swizzleOut, 1) == SWIZZLE_Y); - if (size >= 3) - assert(GET_SWZ(*swizzleOut, 2) == SWIZZLE_Z); - if (size >= 4) - assert(GET_SWZ(*swizzleOut, 3) == SWIZZLE_W); - return GL_TRUE; - } - else - return GL_FALSE; -} - - -#if 0 /* not used, but don't remove just yet */ -/** - * Recursively traverse 'oper' to produce a swizzle mask in the event - * of any vector subscripts and swizzle suffixes. - * Ex: for "vec4 v", "v[2].x" resolves to v.z - */ -static GLuint -resolve_swizzle(const slang_operation *oper) -{ - if (oper->type == SLANG_OPER_FIELD) { - /* writemask from .xyzw suffix */ - slang_swizzle swz; - if (_slang_is_swizzle((char*) oper->a_id, 4, &swz)) { - GLuint swizzle = MAKE_SWIZZLE4(swz.swizzle[0], - swz.swizzle[1], - swz.swizzle[2], - swz.swizzle[3]); - GLuint child_swizzle = resolve_swizzle(&oper->children[0]); - GLuint s = _slang_swizzle_swizzle(child_swizzle, swizzle); - return s; - } - else - return SWIZZLE_XYZW; - } - else if (oper->type == SLANG_OPER_SUBSCRIPT && - oper->children[1].type == SLANG_OPER_LITERAL_INT) { - /* writemask from [index] */ - GLuint child_swizzle = resolve_swizzle(&oper->children[0]); - GLuint i = (GLuint) oper->children[1].literal[0]; - GLuint swizzle; - GLuint s; - switch (i) { - case 0: - swizzle = SWIZZLE_XXXX; - break; - case 1: - swizzle = SWIZZLE_YYYY; - break; - case 2: - swizzle = SWIZZLE_ZZZZ; - break; - case 3: - swizzle = SWIZZLE_WWWW; - break; - default: - swizzle = SWIZZLE_XYZW; - } - s = _slang_swizzle_swizzle(child_swizzle, swizzle); - return s; - } - else { - return SWIZZLE_XYZW; - } -} -#endif - - -#if 0 -/** - * Recursively descend through swizzle nodes to find the node's storage info. - */ -static slang_ir_storage * -get_store(const slang_ir_node *n) -{ - if (n->Opcode == IR_SWIZZLE) { - return get_store(n->Children[0]); - } - return n->Store; -} -#endif - - -/** - * Generate IR tree for an asm instruction/operation such as: - * __asm vec4_dot __retVal.x, v1, v2; - */ -static slang_ir_node * -_slang_gen_asm(slang_assemble_ctx *A, slang_operation *oper, - slang_operation *dest) -{ - const slang_asm_info *info; - slang_ir_node *kids[3], *n; - GLuint j, firstOperand; - - assert(oper->type == SLANG_OPER_ASM); - - info = slang_find_asm_info((char *) oper->a_id); - if (!info) { - _mesa_problem(NULL, "undefined __asm function %s\n", - (char *) oper->a_id); - assert(info); - return NULL; - } - assert(info->NumParams <= 3); - - if (info->NumParams == oper->num_children) { - /* Storage for result is not specified. - * Children[0], [1], [2] are the operands. - */ - firstOperand = 0; - } - else { - /* Storage for result (child[0]) is specified. - * Children[1], [2], [3] are the operands. - */ - firstOperand = 1; - } - - /* assemble child(ren) */ - kids[0] = kids[1] = kids[2] = NULL; - for (j = 0; j < info->NumParams; j++) { - kids[j] = _slang_gen_operation(A, &oper->children[firstOperand + j]); - if (!kids[j]) - return NULL; - } - - n = new_node3(info->Opcode, kids[0], kids[1], kids[2]); - - if (firstOperand) { - /* Setup n->Store to be a particular location. Otherwise, storage - * for the result (a temporary) will be allocated later. - */ - slang_operation *dest_oper; - slang_ir_node *n0; - - dest_oper = &oper->children[0]; - - n0 = _slang_gen_operation(A, dest_oper); - if (!n0) - return NULL; - - assert(!n->Store); - n->Store = n0->Store; - - assert(n->Store->File != PROGRAM_UNDEFINED || n->Store->Parent); - - _slang_free(n0); - } - - return n; -} - - -#if 0 -static void -print_funcs(struct slang_function_scope_ *scope, const char *name) -{ - GLuint i; - for (i = 0; i < scope->num_functions; i++) { - slang_function *f = &scope->functions[i]; - if (!name || strcmp(name, (char*) f->header.a_name) == 0) - printf(" %s (%d args)\n", name, f->param_count); - - } - if (scope->outer_scope) - print_funcs(scope->outer_scope, name); -} -#endif - - -/** - * Find a function of the given name, taking 'numArgs' arguments. - * This is the function we'll try to call when there is no exact match - * between function parameters and call arguments. - * - * XXX we should really create a list of candidate functions and try - * all of them... - */ -static slang_function * -_slang_find_function_by_argc(slang_function_scope *scope, - const char *name, int numArgs) -{ - while (scope) { - GLuint i; - for (i = 0; i < scope->num_functions; i++) { - slang_function *f = &scope->functions[i]; - if (strcmp(name, (char*) f->header.a_name) == 0) { - int haveRetValue = _slang_function_has_return_value(f); - if (numArgs == f->param_count - haveRetValue) - return f; - } - } - scope = scope->outer_scope; - } - - return NULL; -} - - -static slang_function * -_slang_find_function_by_max_argc(slang_function_scope *scope, - const char *name) -{ - slang_function *maxFunc = NULL; - GLuint maxArgs = 0; - - while (scope) { - GLuint i; - for (i = 0; i < scope->num_functions; i++) { - slang_function *f = &scope->functions[i]; - if (strcmp(name, (char*) f->header.a_name) == 0) { - if (f->param_count > maxArgs) { - maxArgs = f->param_count; - maxFunc = f; - } - } - } - scope = scope->outer_scope; - } - - return maxFunc; -} - - -/** - * Generate a new slang_function which is a constructor for a user-defined - * struct type. - */ -static slang_function * -_slang_make_struct_constructor(slang_assemble_ctx *A, slang_struct *str) -{ - const GLint numFields = str->fields->num_variables; - slang_function *fun = slang_function_new(SLANG_FUNC_CONSTRUCTOR); - - /* function header (name, return type) */ - fun->header.a_name = str->a_name; - fun->header.type.qualifier = SLANG_QUAL_NONE; - fun->header.type.specifier.type = SLANG_SPEC_STRUCT; - fun->header.type.specifier._struct = str; - - /* function parameters (= struct's fields) */ - { - GLint i; - for (i = 0; i < numFields; i++) { - /* - printf("Field %d: %s\n", i, (char*) str->fields->variables[i]->a_name); - */ - slang_variable *p = slang_variable_scope_grow(fun->parameters); - *p = *str->fields->variables[i]; /* copy the variable and type */ - p->type.qualifier = SLANG_QUAL_CONST; - } - fun->param_count = fun->parameters->num_variables; - } - - /* Add __retVal to params */ - { - slang_variable *p = slang_variable_scope_grow(fun->parameters); - slang_atom a_retVal = slang_atom_pool_atom(A->atoms, "__retVal"); - assert(a_retVal); - p->a_name = a_retVal; - p->type = fun->header.type; - p->type.qualifier = SLANG_QUAL_OUT; - fun->param_count++; - } - - /* function body is: - * block: - * declare T; - * T.f1 = p1; - * T.f2 = p2; - * ... - * T.fn = pn; - * return T; - */ - { - slang_variable_scope *scope; - slang_variable *var; - GLint i; - - fun->body = slang_operation_new(1); - fun->body->type = SLANG_OPER_BLOCK_NEW_SCOPE; - fun->body->num_children = numFields + 2; - fun->body->children = slang_operation_new(numFields + 2); - - scope = fun->body->locals; - scope->outer_scope = fun->parameters; - - /* create local var 't' */ - var = slang_variable_scope_grow(scope); - var->a_name = slang_atom_pool_atom(A->atoms, "t"); - var->type = fun->header.type; - - /* declare t */ - { - slang_operation *decl; - - decl = &fun->body->children[0]; - decl->type = SLANG_OPER_VARIABLE_DECL; - decl->locals = _slang_variable_scope_new(scope); - decl->a_id = var->a_name; - } - - /* assign params to fields of t */ - for (i = 0; i < numFields; i++) { - slang_operation *assign = &fun->body->children[1 + i]; - - assign->type = SLANG_OPER_ASSIGN; - assign->locals = _slang_variable_scope_new(scope); - assign->num_children = 2; - assign->children = slang_operation_new(2); - - { - slang_operation *lhs = &assign->children[0]; - - lhs->type = SLANG_OPER_FIELD; - lhs->locals = _slang_variable_scope_new(scope); - lhs->num_children = 1; - lhs->children = slang_operation_new(1); - lhs->a_id = str->fields->variables[i]->a_name; - - lhs->children[0].type = SLANG_OPER_IDENTIFIER; - lhs->children[0].a_id = var->a_name; - lhs->children[0].locals = _slang_variable_scope_new(scope); - -#if 0 - lhs->children[1].num_children = 1; - lhs->children[1].children = slang_operation_new(1); - lhs->children[1].children[0].type = SLANG_OPER_IDENTIFIER; - lhs->children[1].children[0].a_id = str->fields->variables[i]->a_name; - lhs->children[1].children->locals = _slang_variable_scope_new(scope); -#endif - } - - { - slang_operation *rhs = &assign->children[1]; - - rhs->type = SLANG_OPER_IDENTIFIER; - rhs->locals = _slang_variable_scope_new(scope); - rhs->a_id = str->fields->variables[i]->a_name; - } - } - - /* return t; */ - { - slang_operation *ret = &fun->body->children[numFields + 1]; - - ret->type = SLANG_OPER_RETURN; - ret->locals = _slang_variable_scope_new(scope); - ret->num_children = 1; - ret->children = slang_operation_new(1); - ret->children[0].type = SLANG_OPER_IDENTIFIER; - ret->children[0].a_id = var->a_name; - ret->children[0].locals = _slang_variable_scope_new(scope); - } - } - /* - slang_print_function(fun, 1); - */ - return fun; -} - - -/** - * Find/create a function (constructor) for the given structure name. - */ -static slang_function * -_slang_locate_struct_constructor(slang_assemble_ctx *A, const char *name) -{ - unsigned int i; - for (i = 0; i < A->space.structs->num_structs; i++) { - slang_struct *str = &A->space.structs->structs[i]; - if (strcmp(name, (const char *) str->a_name) == 0) { - /* found a structure type that matches the function name */ - if (!str->constructor) { - /* create the constructor function now */ - str->constructor = _slang_make_struct_constructor(A, str); - } - return str->constructor; - } - } - return NULL; -} - - -/** - * Generate a new slang_function to satisfy a call to an array constructor. - * Ex: float[3](1., 2., 3.) - */ -static slang_function * -_slang_make_array_constructor(slang_assemble_ctx *A, slang_operation *oper) -{ - slang_type_specifier_type baseType; - slang_function *fun; - int num_elements; - - fun = slang_function_new(SLANG_FUNC_CONSTRUCTOR); - if (!fun) - return NULL; - - baseType = slang_type_specifier_type_from_string((char *) oper->a_id); - - num_elements = oper->num_children; - - /* function header, return type */ - { - fun->header.a_name = oper->a_id; - fun->header.type.qualifier = SLANG_QUAL_NONE; - fun->header.type.specifier.type = SLANG_SPEC_ARRAY; - fun->header.type.specifier._array = - slang_type_specifier_new(baseType, NULL, NULL); - fun->header.type.array_len = num_elements; - } - - /* function parameters (= number of elements) */ - { - GLint i; - for (i = 0; i < num_elements; i++) { - /* - printf("Field %d: %s\n", i, (char*) str->fields->variables[i]->a_name); - */ - slang_variable *p = slang_variable_scope_grow(fun->parameters); - char name[10]; - _mesa_snprintf(name, sizeof(name), "p%d", i); - p->a_name = slang_atom_pool_atom(A->atoms, name); - p->type.qualifier = SLANG_QUAL_CONST; - p->type.specifier.type = baseType; - } - fun->param_count = fun->parameters->num_variables; - } - - /* Add __retVal to params */ - { - slang_variable *p = slang_variable_scope_grow(fun->parameters); - slang_atom a_retVal = slang_atom_pool_atom(A->atoms, "__retVal"); - assert(a_retVal); - p->a_name = a_retVal; - p->type = fun->header.type; - p->type.qualifier = SLANG_QUAL_OUT; - p->type.specifier.type = baseType; - fun->param_count++; - } - - /* function body is: - * block: - * declare T; - * T[0] = p0; - * T[1] = p1; - * ... - * T[n] = pn; - * return T; - */ - { - slang_variable_scope *scope; - slang_variable *var; - GLint i; - - fun->body = slang_operation_new(1); - fun->body->type = SLANG_OPER_BLOCK_NEW_SCOPE; - fun->body->num_children = num_elements + 2; - fun->body->children = slang_operation_new(num_elements + 2); - - scope = fun->body->locals; - scope->outer_scope = fun->parameters; - - /* create local var 't' */ - var = slang_variable_scope_grow(scope); - var->a_name = slang_atom_pool_atom(A->atoms, "ttt"); - var->type = fun->header.type;/*XXX copy*/ - - /* declare t */ - { - slang_operation *decl; - - decl = &fun->body->children[0]; - decl->type = SLANG_OPER_VARIABLE_DECL; - decl->locals = _slang_variable_scope_new(scope); - decl->a_id = var->a_name; - } - - /* assign params to elements of t */ - for (i = 0; i < num_elements; i++) { - slang_operation *assign = &fun->body->children[1 + i]; - - assign->type = SLANG_OPER_ASSIGN; - assign->locals = _slang_variable_scope_new(scope); - assign->num_children = 2; - assign->children = slang_operation_new(2); - - { - slang_operation *lhs = &assign->children[0]; - - lhs->type = SLANG_OPER_SUBSCRIPT; - lhs->locals = _slang_variable_scope_new(scope); - lhs->num_children = 2; - lhs->children = slang_operation_new(2); - - lhs->children[0].type = SLANG_OPER_IDENTIFIER; - lhs->children[0].a_id = var->a_name; - lhs->children[0].locals = _slang_variable_scope_new(scope); - - lhs->children[1].type = SLANG_OPER_LITERAL_INT; - lhs->children[1].literal[0] = (GLfloat) i; - } - - { - slang_operation *rhs = &assign->children[1]; - - rhs->type = SLANG_OPER_IDENTIFIER; - rhs->locals = _slang_variable_scope_new(scope); - rhs->a_id = fun->parameters->variables[i]->a_name; - } - } - - /* return t; */ - { - slang_operation *ret = &fun->body->children[num_elements + 1]; - - ret->type = SLANG_OPER_RETURN; - ret->locals = _slang_variable_scope_new(scope); - ret->num_children = 1; - ret->children = slang_operation_new(1); - ret->children[0].type = SLANG_OPER_IDENTIFIER; - ret->children[0].a_id = var->a_name; - ret->children[0].locals = _slang_variable_scope_new(scope); - } - } - - /* - slang_print_function(fun, 1); - */ - - return fun; -} - - -static GLboolean -_slang_is_vec_mat_type(const char *name) -{ - static const char *vecmat_types[] = { - "float", "int", "bool", - "vec2", "vec3", "vec4", - "ivec2", "ivec3", "ivec4", - "bvec2", "bvec3", "bvec4", - "mat2", "mat3", "mat4", - "mat2x3", "mat2x4", "mat3x2", "mat3x4", "mat4x2", "mat4x3", - NULL - }; - int i; - for (i = 0; vecmat_types[i]; i++) - if (strcmp(name, vecmat_types[i]) == 0) - return GL_TRUE; - return GL_FALSE; -} - - -/** - * Assemble a function call, given a particular function name. - * \param name the function's name (operators like '*' are possible). - */ -static slang_ir_node * -_slang_gen_function_call_name(slang_assemble_ctx *A, const char *name, - slang_operation *oper, slang_operation *dest) -{ - slang_operation *params = oper->children; - const GLuint param_count = oper->num_children; - slang_atom atom; - slang_function *fun; - slang_ir_node *n; - - atom = slang_atom_pool_atom(A->atoms, name); - if (atom == SLANG_ATOM_NULL) - return NULL; - - if (oper->array_constructor) { - /* this needs special handling */ - fun = _slang_make_array_constructor(A, oper); - } - else { - /* Try to find function by name and exact argument type matching */ - GLboolean error = GL_FALSE; - fun = _slang_function_locate(A->space.funcs, atom, params, param_count, - &A->space, A->atoms, A->log, &error); - if (error) { - slang_info_log_error(A->log, - "Function '%s' not found (check argument types)", - name); - return NULL; - } - } - - if (!fun) { - /* Next, try locating a constructor function for a user-defined type */ - fun = _slang_locate_struct_constructor(A, name); - } - - /* - * At this point, some heuristics are used to try to find a function - * that matches the calling signature by means of casting or "unrolling" - * of constructors. - */ - - if (!fun && _slang_is_vec_mat_type(name)) { - /* Next, if this call looks like a vec() or mat() constructor call, - * try "unwinding" the args to satisfy a constructor. - */ - fun = _slang_find_function_by_max_argc(A->space.funcs, name); - if (fun) { - if (!_slang_adapt_call(oper, fun, &A->space, A->atoms, A->log)) { - slang_info_log_error(A->log, - "Function '%s' not found (check argument types)", - name); - return NULL; - } - } - } - - if (!fun && _slang_is_vec_mat_type(name)) { - /* Next, try casting args to the types of the formal parameters */ - int numArgs = oper->num_children; - fun = _slang_find_function_by_argc(A->space.funcs, name, numArgs); - if (!fun || !_slang_cast_func_params(oper, fun, &A->space, A->atoms, A->log)) { - slang_info_log_error(A->log, - "Function '%s' not found (check argument types)", - name); - return NULL; - } - assert(fun); - } - - if (!fun) { - slang_info_log_error(A->log, - "Function '%s' not found (check argument types)", - name); - return NULL; - } - - if (!fun->body) { - /* The function body may be in another compilation unit. - * We'll try concatenating the shaders and recompile at link time. - */ - A->UnresolvedRefs = GL_TRUE; - return new_node1(IR_NOP, NULL); - } - - /* type checking to be sure function's return type matches 'dest' type */ - if (dest) { - slang_typeinfo t0; - - slang_typeinfo_construct(&t0); - typeof_operation(A, dest, &t0); - - if (!slang_type_specifier_equal(&t0.spec, &fun->header.type.specifier)) { - slang_info_log_error(A->log, - "Incompatible type returned by call to '%s'", - name); - return NULL; - } - } - - n = _slang_gen_function_call(A, fun, oper, dest); - - if (n && !n->Store && !dest - && fun->header.type.specifier.type != SLANG_SPEC_VOID) { - /* setup n->Store for the result of the function call */ - GLint size = _slang_sizeof_type_specifier(&fun->header.type.specifier); - n->Store = _slang_new_ir_storage(PROGRAM_TEMPORARY, -1, size); - /*printf("Alloc storage for function result, size %d \n", size);*/ - } - - if (oper->array_constructor) { - /* free the temporary array constructor function now */ - slang_function_destruct(fun); - } - - return n; -} - - -static slang_ir_node * -_slang_gen_method_call(slang_assemble_ctx *A, slang_operation *oper) -{ - slang_atom *a_length = slang_atom_pool_atom(A->atoms, "length"); - slang_ir_node *n; - slang_variable *var; - - /* NOTE: In GLSL 1.20, there's only one kind of method - * call: array.length(). Anything else is an error. - */ - if (oper->a_id != a_length) { - slang_info_log_error(A->log, - "Undefined method call '%s'", (char *) oper->a_id); - return NULL; - } - - /* length() takes no arguments */ - if (oper->num_children > 0) { - slang_info_log_error(A->log, "Invalid arguments to length() method"); - return NULL; - } - - /* lookup the object/variable */ - var = _slang_variable_locate(oper->locals, oper->a_obj, GL_TRUE); - if (!var || var->type.specifier.type != SLANG_SPEC_ARRAY) { - slang_info_log_error(A->log, - "Undefined object '%s'", (char *) oper->a_obj); - return NULL; - } - - /* Create a float/literal IR node encoding the array length */ - n = new_node0(IR_FLOAT); - if (n) { - n->Value[0] = (float) _slang_array_length(var); - n->Store = _slang_new_ir_storage(PROGRAM_CONSTANT, -1, 1); - } - return n; -} - - -static GLboolean -_slang_is_constant_cond(const slang_operation *oper, GLboolean *value) -{ - if (oper->type == SLANG_OPER_LITERAL_FLOAT || - oper->type == SLANG_OPER_LITERAL_INT || - oper->type == SLANG_OPER_LITERAL_BOOL) { - if (oper->literal[0]) - *value = GL_TRUE; - else - *value = GL_FALSE; - return GL_TRUE; - } - else if (oper->type == SLANG_OPER_EXPRESSION && - oper->num_children == 1) { - return _slang_is_constant_cond(&oper->children[0], value); - } - return GL_FALSE; -} - - -/** - * Test if an operation is a scalar or boolean. - */ -static GLboolean -_slang_is_scalar_or_boolean(slang_assemble_ctx *A, slang_operation *oper) -{ - slang_typeinfo type; - GLint size; - - slang_typeinfo_construct(&type); - typeof_operation(A, oper, &type); - size = _slang_sizeof_type_specifier(&type.spec); - slang_typeinfo_destruct(&type); - return size == 1; -} - - -/** - * Test if an operation is boolean. - */ -static GLboolean -_slang_is_boolean(slang_assemble_ctx *A, slang_operation *oper) -{ - slang_typeinfo type; - GLboolean isBool; - - slang_typeinfo_construct(&type); - typeof_operation(A, oper, &type); - isBool = (type.spec.type == SLANG_SPEC_BOOL); - slang_typeinfo_destruct(&type); - return isBool; -} - - -/** - * Check if a loop contains a 'continue' statement. - * Stop looking if we find a nested loop. - */ -static GLboolean -_slang_loop_contains_continue(const slang_operation *oper) -{ - switch (oper->type) { - case SLANG_OPER_CONTINUE: - return GL_TRUE; - case SLANG_OPER_FOR: - case SLANG_OPER_DO: - case SLANG_OPER_WHILE: - /* stop upon finding a nested loop */ - return GL_FALSE; - default: - /* recurse */ - { - GLuint i; - for (i = 0; i < oper->num_children; i++) { - const slang_operation *child = slang_oper_child_const(oper, i); - if (_slang_loop_contains_continue(child)) - return GL_TRUE; - } - } - return GL_FALSE; - } -} - - -/** - * Check if a loop contains a 'continue' or 'break' statement. - * Stop looking if we find a nested loop. - */ -static GLboolean -_slang_loop_contains_continue_or_break(const slang_operation *oper) -{ - switch (oper->type) { - case SLANG_OPER_CONTINUE: - case SLANG_OPER_BREAK: - return GL_TRUE; - case SLANG_OPER_FOR: - case SLANG_OPER_DO: - case SLANG_OPER_WHILE: - /* stop upon finding a nested loop */ - return GL_FALSE; - default: - /* recurse */ - { - GLuint i; - for (i = 0; i < oper->num_children; i++) { - const slang_operation *child = slang_oper_child_const(oper, i); - if (_slang_loop_contains_continue_or_break(child)) - return GL_TRUE; - } - } - return GL_FALSE; - } -} - - -/** - * Replace 'break' and 'continue' statements inside a do and while loops. - * This is a recursive helper function used by - * _slang_gen_do/while_without_continue(). - */ -static void -replace_break_and_cont(slang_assemble_ctx *A, slang_operation *oper) -{ - switch (oper->type) { - case SLANG_OPER_BREAK: - /* replace 'break' with "_notBreakFlag = false; break" */ - { - slang_operation *block = oper; - block->type = SLANG_OPER_BLOCK_NEW_SCOPE; - slang_operation_add_children(block, 2); - { - slang_operation *assign = slang_oper_child(block, 0); - assign->type = SLANG_OPER_ASSIGN; - slang_operation_add_children(assign, 2); - { - slang_operation *lhs = slang_oper_child(assign, 0); - slang_operation_identifier(lhs, A, "_notBreakFlag"); - } - { - slang_operation *rhs = slang_oper_child(assign, 1); - slang_operation_literal_bool(rhs, GL_FALSE); - } - } - { - slang_operation *brk = slang_oper_child(block, 1); - brk->type = SLANG_OPER_BREAK; - assert(!brk->children); - } - } - break; - case SLANG_OPER_CONTINUE: - /* convert continue into a break */ - oper->type = SLANG_OPER_BREAK; - break; - case SLANG_OPER_FOR: - case SLANG_OPER_DO: - case SLANG_OPER_WHILE: - /* stop upon finding a nested loop */ - break; - default: - /* recurse */ - { - GLuint i; - for (i = 0; i < oper->num_children; i++) { - replace_break_and_cont(A, slang_oper_child(oper, i)); - } - } - } -} - - -/** - * Transform a while-loop so that continue statements are converted to breaks. - * Then do normal IR code generation. - * - * Before: - * - * while (LOOPCOND) { - * A; - * if (IFCOND) - * continue; - * B; - * break; - * C; - * } - * - * After: - * - * { - * bool _notBreakFlag = 1; - * while (_notBreakFlag && LOOPCOND) { - * do { - * A; - * if (IFCOND) { - * break; // was continue - * } - * B; - * _notBreakFlag = 0; // was - * break; // break - * C; - * } while (0) - * } - * } - */ -static slang_ir_node * -_slang_gen_while_without_continue(slang_assemble_ctx *A, slang_operation *oper) -{ - slang_operation *top; - slang_operation *innerBody; - - assert(oper->type == SLANG_OPER_WHILE); - - top = slang_operation_new(1); - top->type = SLANG_OPER_BLOCK_NEW_SCOPE; - top->locals->outer_scope = oper->locals->outer_scope; - slang_operation_add_children(top, 2); - - /* declare: bool _notBreakFlag = true */ - { - slang_operation *condDecl = slang_oper_child(top, 0); - slang_generate_declaration(A, top->locals, condDecl, - SLANG_SPEC_BOOL, "_notBreakFlag", GL_TRUE); - } - - /* build outer while-loop: while (_notBreakFlag && LOOPCOND) { ... } */ - { - slang_operation *outerWhile = slang_oper_child(top, 1); - outerWhile->type = SLANG_OPER_WHILE; - slang_operation_add_children(outerWhile, 2); - - /* _notBreakFlag && LOOPCOND */ - { - slang_operation *cond = slang_oper_child(outerWhile, 0); - cond->type = SLANG_OPER_LOGICALAND; - slang_operation_add_children(cond, 2); - { - slang_operation *notBreak = slang_oper_child(cond, 0); - slang_operation_identifier(notBreak, A, "_notBreakFlag"); - } - { - slang_operation *origCond = slang_oper_child(cond, 1); - slang_operation_copy(origCond, slang_oper_child(oper, 0)); - } - } - - /* inner loop */ - { - slang_operation *innerDo = slang_oper_child(outerWhile, 1); - innerDo->type = SLANG_OPER_DO; - slang_operation_add_children(innerDo, 2); - - /* copy original do-loop body into inner do-loop's body */ - innerBody = slang_oper_child(innerDo, 0); - slang_operation_copy(innerBody, slang_oper_child(oper, 1)); - innerBody->locals->outer_scope = innerDo->locals; - - /* inner do-loop's condition is constant/false */ - { - slang_operation *constFalse = slang_oper_child(innerDo, 1); - slang_operation_literal_bool(constFalse, GL_FALSE); - } - } - } - - /* Finally, in innerBody, - * replace "break" with "_notBreakFlag = 0; break" - * replace "continue" with "break" - */ - replace_break_and_cont(A, innerBody); - - /*slang_print_tree(top, 0);*/ - - return _slang_gen_operation(A, top); - - return NULL; -} - - -/** - * Generate loop code using high-level IR_LOOP instruction - */ -static slang_ir_node * -_slang_gen_while(slang_assemble_ctx * A, slang_operation *oper) -{ - /* - * LOOP: - * BREAK if !expr (child[0]) - * body code (child[1]) - */ - slang_ir_node *loop, *breakIf, *body; - GLboolean isConst, constTrue = GL_FALSE; - - if (!A->EmitContReturn) { - /* We don't want to emit CONT instructions. If this while-loop has - * a continue, translate it away. - */ - if (_slang_loop_contains_continue(slang_oper_child(oper, 1))) { - return _slang_gen_while_without_continue(A, oper); - } - } - - /* type-check expression */ - if (!_slang_is_boolean(A, &oper->children[0])) { - slang_info_log_error(A->log, "scalar/boolean expression expected for 'while'"); - return NULL; - } - - /* Check if loop condition is a constant */ - isConst = _slang_is_constant_cond(&oper->children[0], &constTrue); - - if (isConst && !constTrue) { - /* loop is never executed! */ - return new_node0(IR_NOP); - } - - /* Begin new loop */ - loop = new_loop(NULL); - - /* save loop state */ - push_loop(A, oper, loop); - - if (isConst && constTrue) { - /* while(nonzero constant), no conditional break */ - breakIf = NULL; - } - else { - slang_ir_node *cond - = new_cond(new_not(_slang_gen_operation(A, &oper->children[0]))); - breakIf = new_break_if_true(A, cond); - } - body = _slang_gen_operation(A, &oper->children[1]); - loop->Children[0] = new_seq(breakIf, body); - - /* Do infinite loop detection */ - /* loop->List is head of linked list of break/continue nodes */ - if (!loop->List && isConst && constTrue) { - /* infinite loop detected */ - pop_loop(A); - slang_info_log_error(A->log, "Infinite loop detected!"); - return NULL; - } - - /* restore loop state */ - pop_loop(A); - - return loop; -} - - -/** - * Transform a do-while-loop so that continue statements are converted to breaks. - * Then do normal IR code generation. - * - * Before: - * - * do { - * A; - * if (IFCOND) - * continue; - * B; - * break; - * C; - * } while (LOOPCOND); - * - * After: - * - * { - * bool _notBreakFlag = 1; - * do { - * do { - * A; - * if (IFCOND) { - * break; // was continue - * } - * B; - * _notBreakFlag = 0; // was - * break; // break - * C; - * } while (0) - * } while (_notBreakFlag && LOOPCOND); - * } - */ -static slang_ir_node * -_slang_gen_do_without_continue(slang_assemble_ctx *A, slang_operation *oper) -{ - slang_operation *top; - slang_operation *innerBody; - - assert(oper->type == SLANG_OPER_DO); - - top = slang_operation_new(1); - top->type = SLANG_OPER_BLOCK_NEW_SCOPE; - top->locals->outer_scope = oper->locals->outer_scope; - slang_operation_add_children(top, 2); - - /* declare: bool _notBreakFlag = true */ - { - slang_operation *condDecl = slang_oper_child(top, 0); - slang_generate_declaration(A, top->locals, condDecl, - SLANG_SPEC_BOOL, "_notBreakFlag", GL_TRUE); - } - - /* build outer do-loop: do { ... } while (_notBreakFlag && LOOPCOND) */ - { - slang_operation *outerDo = slang_oper_child(top, 1); - outerDo->type = SLANG_OPER_DO; - slang_operation_add_children(outerDo, 2); - - /* inner do-loop */ - { - slang_operation *innerDo = slang_oper_child(outerDo, 0); - innerDo->type = SLANG_OPER_DO; - slang_operation_add_children(innerDo, 2); - - /* copy original do-loop body into inner do-loop's body */ - innerBody = slang_oper_child(innerDo, 0); - slang_operation_copy(innerBody, slang_oper_child(oper, 0)); - innerBody->locals->outer_scope = innerDo->locals; - - /* inner do-loop's condition is constant/false */ - { - slang_operation *constFalse = slang_oper_child(innerDo, 1); - slang_operation_literal_bool(constFalse, GL_FALSE); - } - } - - /* _notBreakFlag && LOOPCOND */ - { - slang_operation *cond = slang_oper_child(outerDo, 1); - cond->type = SLANG_OPER_LOGICALAND; - slang_operation_add_children(cond, 2); - { - slang_operation *notBreak = slang_oper_child(cond, 0); - slang_operation_identifier(notBreak, A, "_notBreakFlag"); - } - { - slang_operation *origCond = slang_oper_child(cond, 1); - slang_operation_copy(origCond, slang_oper_child(oper, 1)); - } - } - } - - /* Finally, in innerBody, - * replace "break" with "_notBreakFlag = 0; break" - * replace "continue" with "break" - */ - replace_break_and_cont(A, innerBody); - - /*slang_print_tree(top, 0);*/ - - return _slang_gen_operation(A, top); -} - - -/** - * Generate IR tree for a do-while loop using high-level LOOP, IF instructions. - */ -static slang_ir_node * -_slang_gen_do(slang_assemble_ctx * A, slang_operation *oper) -{ - /* - * LOOP: - * body code (child[0]) - * tail code: - * BREAK if !expr (child[1]) - */ - slang_ir_node *loop; - GLboolean isConst, constTrue; - - if (!A->EmitContReturn) { - /* We don't want to emit CONT instructions. If this do-loop has - * a continue, translate it away. - */ - if (_slang_loop_contains_continue(slang_oper_child(oper, 0))) { - return _slang_gen_do_without_continue(A, oper); - } - } - - /* type-check expression */ - if (!_slang_is_boolean(A, &oper->children[1])) { - slang_info_log_error(A->log, "scalar/boolean expression expected for 'do/while'"); - return NULL; - } - - loop = new_loop(NULL); - - /* save loop state */ - push_loop(A, oper, loop); - - /* loop body: */ - loop->Children[0] = _slang_gen_operation(A, &oper->children[0]); - - /* Check if loop condition is a constant */ - isConst = _slang_is_constant_cond(&oper->children[1], &constTrue); - if (isConst && constTrue) { - /* do { } while(1) ==> no conditional break */ - loop->Children[1] = NULL; /* no tail code */ - } - else { - slang_ir_node *cond - = new_cond(new_not(_slang_gen_operation(A, &oper->children[1]))); - loop->Children[1] = new_break_if_true(A, cond); - } - - /* XXX we should do infinite loop detection, as above */ - - /* restore loop state */ - pop_loop(A); - - return loop; -} - - -/** - * Recursively count the number of operations rooted at 'oper'. - * This gives some kind of indication of the size/complexity of an operation. - */ -static GLuint -sizeof_operation(const slang_operation *oper) -{ - if (oper) { - GLuint count = 1; /* me */ - GLuint i; - for (i = 0; i < oper->num_children; i++) { - count += sizeof_operation(&oper->children[i]); - } - return count; - } - else { - return 0; - } -} - - -/** - * Determine if a for-loop can be unrolled. - * At this time, only a rather narrow class of for loops can be unrolled. - * See code for details. - * When a loop can't be unrolled because it's too large we'll emit a - * message to the log. - */ -static GLboolean -_slang_can_unroll_for_loop(slang_assemble_ctx * A, const slang_operation *oper) -{ - GLuint bodySize; - GLint start, end; - const char *varName; - slang_atom varId; - - if (oper->type != SLANG_OPER_FOR) - return GL_FALSE; - - assert(oper->num_children == 4); - - if (_slang_loop_contains_continue_or_break(slang_oper_child_const(oper, 3))) - return GL_FALSE; - - /* children[0] must be either "int i=constant" or "i=constant" */ - if (oper->children[0].type == SLANG_OPER_BLOCK_NO_NEW_SCOPE) { - slang_variable *var; - - if (oper->children[0].children[0].type != SLANG_OPER_VARIABLE_DECL) - return GL_FALSE; - - varId = oper->children[0].children[0].a_id; - - var = _slang_variable_locate(oper->children[0].children[0].locals, - varId, GL_TRUE); - if (!var) - return GL_FALSE; - if (!var->initializer) - return GL_FALSE; - if (var->initializer->type != SLANG_OPER_LITERAL_INT) - return GL_FALSE; - start = (GLint) var->initializer->literal[0]; - } - else if (oper->children[0].type == SLANG_OPER_EXPRESSION) { - if (oper->children[0].children[0].type != SLANG_OPER_ASSIGN) - return GL_FALSE; - if (oper->children[0].children[0].children[0].type != SLANG_OPER_IDENTIFIER) - return GL_FALSE; - if (oper->children[0].children[0].children[1].type != SLANG_OPER_LITERAL_INT) - return GL_FALSE; - - varId = oper->children[0].children[0].children[0].a_id; - - start = (GLint) oper->children[0].children[0].children[1].literal[0]; - } - else { - return GL_FALSE; - } - - /* children[1] must be "ichildren[1].type != SLANG_OPER_EXPRESSION) - return GL_FALSE; - if (oper->children[1].children[0].type != SLANG_OPER_LESS) - return GL_FALSE; - if (oper->children[1].children[0].children[0].type != SLANG_OPER_IDENTIFIER) - return GL_FALSE; - if (oper->children[1].children[0].children[1].type != SLANG_OPER_LITERAL_INT) - return GL_FALSE; - - end = (GLint) oper->children[1].children[0].children[1].literal[0]; - - /* children[2] must be "i++" or "++i" */ - if (oper->children[2].type != SLANG_OPER_POSTINCREMENT && - oper->children[2].type != SLANG_OPER_PREINCREMENT) - return GL_FALSE; - if (oper->children[2].children[0].type != SLANG_OPER_IDENTIFIER) - return GL_FALSE; - - /* make sure the same variable name is used in all places */ - if ((oper->children[1].children[0].children[0].a_id != varId) || - (oper->children[2].children[0].a_id != varId)) - return GL_FALSE; - - varName = (const char *) varId; - - /* children[3], the loop body, can't be too large */ - bodySize = sizeof_operation(&oper->children[3]); - if (bodySize > MAX_FOR_LOOP_UNROLL_BODY_SIZE) { - slang_info_log_print(A->log, - "Note: 'for (%s ... )' body is too large/complex" - " to unroll", - varName); - return GL_FALSE; - } - - if (start >= end) - return GL_FALSE; /* degenerate case */ - - if ((GLuint)(end - start) > MAX_FOR_LOOP_UNROLL_ITERATIONS) { - slang_info_log_print(A->log, - "Note: 'for (%s=%d; %s<%d; ++%s)' is too" - " many iterations to unroll", - varName, start, varName, end, varName); - return GL_FALSE; - } - - if ((end - start) * bodySize > MAX_FOR_LOOP_UNROLL_COMPLEXITY) { - slang_info_log_print(A->log, - "Note: 'for (%s=%d; %s<%d; ++%s)' will generate" - " too much code to unroll", - varName, start, varName, end, varName); - return GL_FALSE; - } - - return GL_TRUE; /* we can unroll the loop */ -} - - -/** - * Unroll a for-loop. - * First we determine the number of iterations to unroll. - * Then for each iteration: - * make a copy of the loop body - * replace instances of the loop variable with the current iteration value - * generate IR code for the body - * \return pointer to generated IR code or NULL if error, out of memory, etc. - */ -static slang_ir_node * -_slang_unroll_for_loop(slang_assemble_ctx * A, const slang_operation *oper) -{ - GLint start, end, iter; - slang_ir_node *n, *root = NULL; - slang_atom varId; - - if (oper->children[0].type == SLANG_OPER_BLOCK_NO_NEW_SCOPE) { - /* for (int i=0; ... */ - slang_variable *var; - - varId = oper->children[0].children[0].a_id; - var = _slang_variable_locate(oper->children[0].children[0].locals, - varId, GL_TRUE); - assert(var); - start = (GLint) var->initializer->literal[0]; - } - else { - /* for (i=0; ... */ - varId = oper->children[0].children[0].children[0].a_id; - start = (GLint) oper->children[0].children[0].children[1].literal[0]; - } - - end = (GLint) oper->children[1].children[0].children[1].literal[0]; - - for (iter = start; iter < end; iter++) { - slang_operation *body; - - /* make a copy of the loop body */ - body = slang_operation_new(1); - if (!body) - return NULL; - - if (!slang_operation_copy(body, &oper->children[3])) - return NULL; - - /* in body, replace instances of 'varId' with literal 'iter' */ - { - slang_variable *oldVar; - slang_operation *newOper; - - oldVar = _slang_variable_locate(oper->locals, varId, GL_TRUE); - if (!oldVar) { - /* undeclared loop variable */ - slang_operation_delete(body); - return NULL; - } - - newOper = slang_operation_new(1); - newOper->type = SLANG_OPER_LITERAL_INT; - newOper->literal_size = 1; - newOper->literal[0] = (GLfloat) iter; - - /* replace instances of the loop variable with newOper */ - slang_substitute(A, body, 1, &oldVar, &newOper, GL_FALSE); - } - - /* do IR codegen for body */ - n = _slang_gen_operation(A, body); - if (!n) - return NULL; - - root = new_seq(root, n); - - slang_operation_delete(body); - } - - return root; -} - - -/** - * Replace 'continue' statement with 'break' inside a for-loop. - * This is a recursive helper function used by _slang_gen_for_without_continue(). - */ -static void -replace_continue_with_break(slang_assemble_ctx *A, slang_operation *oper) -{ - switch (oper->type) { - case SLANG_OPER_CONTINUE: - oper->type = SLANG_OPER_BREAK; - break; - case SLANG_OPER_FOR: - case SLANG_OPER_DO: - case SLANG_OPER_WHILE: - /* stop upon finding a nested loop */ - break; - default: - /* recurse */ - { - GLuint i; - for (i = 0; i < oper->num_children; i++) { - replace_continue_with_break(A, slang_oper_child(oper, i)); - } - } - } -} - - -/** - * Transform a for-loop so that continue statements are converted to breaks. - * Then do normal IR code generation. - * - * Before: - * - * for (INIT; LOOPCOND; INCR) { - * A; - * if (IFCOND) { - * continue; - * } - * B; - * } - * - * After: - * - * { - * bool _condFlag = 1; - * for (INIT; _condFlag; ) { - * for ( ; _condFlag = LOOPCOND; INCR) { - * A; - * if (IFCOND) { - * break; - * } - * B; - * } - * if (_condFlag) - * INCR; - * } - * } - */ -static slang_ir_node * -_slang_gen_for_without_continue(slang_assemble_ctx *A, slang_operation *oper) -{ - slang_operation *top; - slang_operation *outerFor, *innerFor, *init, *cond, *incr; - slang_operation *lhs, *rhs; - - assert(oper->type == SLANG_OPER_FOR); - - top = slang_operation_new(1); - top->type = SLANG_OPER_BLOCK_NEW_SCOPE; - top->locals->outer_scope = oper->locals->outer_scope; - slang_operation_add_children(top, 2); - - /* declare: bool _condFlag = true */ - { - slang_operation *condDecl = slang_oper_child(top, 0); - slang_generate_declaration(A, top->locals, condDecl, - SLANG_SPEC_BOOL, "_condFlag", GL_TRUE); - } - - /* build outer loop: for (INIT; _condFlag; ) { */ - outerFor = slang_oper_child(top, 1); - outerFor->type = SLANG_OPER_FOR; - slang_operation_add_children(outerFor, 4); - - init = slang_oper_child(outerFor, 0); - slang_operation_copy(init, slang_oper_child(oper, 0)); - - cond = slang_oper_child(outerFor, 1); - cond->type = SLANG_OPER_IDENTIFIER; - cond->a_id = slang_atom_pool_atom(A->atoms, "_condFlag"); - - incr = slang_oper_child(outerFor, 2); - incr->type = SLANG_OPER_VOID; - - /* body of the outer loop */ - { - slang_operation *block = slang_oper_child(outerFor, 3); - - slang_operation_add_children(block, 2); - block->type = SLANG_OPER_BLOCK_NO_NEW_SCOPE; - - /* build inner loop: for ( ; _condFlag = LOOPCOND; INCR) { */ - { - innerFor = slang_oper_child(block, 0); - - /* make copy of orig loop */ - slang_operation_copy(innerFor, oper); - assert(innerFor->type == SLANG_OPER_FOR); - innerFor->locals->outer_scope = block->locals; - - init = slang_oper_child(innerFor, 0); - init->type = SLANG_OPER_VOID; /* leak? */ - - cond = slang_oper_child(innerFor, 1); - slang_operation_destruct(cond); - cond->type = SLANG_OPER_ASSIGN; - cond->locals = _slang_variable_scope_new(innerFor->locals); - slang_operation_add_children(cond, 2); - - lhs = slang_oper_child(cond, 0); - lhs->type = SLANG_OPER_IDENTIFIER; - lhs->a_id = slang_atom_pool_atom(A->atoms, "_condFlag"); - - rhs = slang_oper_child(cond, 1); - slang_operation_copy(rhs, slang_oper_child(oper, 1)); - } - - /* if (_condFlag) INCR; */ - { - slang_operation *ifop = slang_oper_child(block, 1); - ifop->type = SLANG_OPER_IF; - slang_operation_add_children(ifop, 2); - - /* re-use cond node build above */ - slang_operation_copy(slang_oper_child(ifop, 0), cond); - - /* incr node from original for-loop operation */ - slang_operation_copy(slang_oper_child(ifop, 1), - slang_oper_child(oper, 2)); - } - - /* finally, replace "continue" with "break" in the inner for-loop */ - replace_continue_with_break(A, slang_oper_child(innerFor, 3)); - } - - return _slang_gen_operation(A, top); -} - - - -/** - * Generate IR for a for-loop. Unrolling will be done when possible. - */ -static slang_ir_node * -_slang_gen_for(slang_assemble_ctx * A, slang_operation *oper) -{ - GLboolean unroll; - - if (!A->EmitContReturn) { - /* We don't want to emit CONT instructions. If this for-loop has - * a continue, translate it away. - */ - if (_slang_loop_contains_continue(slang_oper_child(oper, 3))) { - return _slang_gen_for_without_continue(A, oper); - } - } - - unroll = _slang_can_unroll_for_loop(A, oper); - if (unroll) { - slang_ir_node *code = _slang_unroll_for_loop(A, oper); - if (code) - return code; - } - - assert(oper->type == SLANG_OPER_FOR); - - /* conventional for-loop code generation */ - { - /* - * init code (child[0]) - * LOOP: - * BREAK if !expr (child[1]) - * body code (child[3]) - * tail code: - * incr code (child[2]) // XXX continue here - */ - slang_ir_node *loop, *cond, *breakIf, *body, *init, *incr; - init = _slang_gen_operation(A, &oper->children[0]); - loop = new_loop(NULL); - - /* save loop state */ - push_loop(A, oper, loop); - - cond = new_cond(new_not(_slang_gen_operation(A, &oper->children[1]))); - breakIf = new_break_if_true(A, cond); - body = _slang_gen_operation(A, &oper->children[3]); - incr = _slang_gen_operation(A, &oper->children[2]); - - loop->Children[0] = new_seq(breakIf, body); - loop->Children[1] = incr; /* tail code */ - - /* restore loop state */ - pop_loop(A); - - return new_seq(init, loop); - } -} - - -static slang_ir_node * -_slang_gen_continue(slang_assemble_ctx * A, const slang_operation *oper) -{ - slang_ir_node *n, *cont, *incr = NULL, *loopNode; - - assert(oper->type == SLANG_OPER_CONTINUE); - loopNode = current_loop_ir(A); - assert(loopNode); - assert(loopNode->Opcode == IR_LOOP); - - cont = new_node0(IR_CONT); - if (cont) { - cont->Parent = loopNode; - /* insert this node at head of linked list of cont/break instructions */ - cont->List = loopNode->List; - loopNode->List = cont; - } - - n = new_seq(incr, cont); - return n; -} - - -/** - * Determine if the given operation is of a specific type. - */ -static GLboolean -is_operation_type(const slang_operation *oper, slang_operation_type type) -{ - if (oper->type == type) - return GL_TRUE; - else if ((oper->type == SLANG_OPER_BLOCK_NEW_SCOPE || - oper->type == SLANG_OPER_BLOCK_NO_NEW_SCOPE) && - oper->num_children == 1) - return is_operation_type(&oper->children[0], type); - else - return GL_FALSE; -} - - -/** - * Generate IR tree for an if/then/else conditional using high-level - * IR_IF instruction. - */ -static slang_ir_node * -_slang_gen_if(slang_assemble_ctx * A, const slang_operation *oper) -{ - /* - * eval expr (child[0]) - * IF expr THEN - * if-body code - * ELSE - * else-body code - * ENDIF - */ - const GLboolean haveElseClause = !_slang_is_noop(&oper->children[2]); - slang_ir_node *ifNode, *cond, *ifBody, *elseBody; - GLboolean isConst, constTrue; - - /* type-check expression */ - if (!_slang_is_boolean(A, &oper->children[0])) { - slang_info_log_error(A->log, "boolean expression expected for 'if'"); - return NULL; - } - - if (!_slang_is_scalar_or_boolean(A, &oper->children[0])) { - slang_info_log_error(A->log, "scalar/boolean expression expected for 'if'"); - return NULL; - } - - isConst = _slang_is_constant_cond(&oper->children[0], &constTrue); - if (isConst) { - if (constTrue) { - /* if (true) ... */ - return _slang_gen_operation(A, &oper->children[1]); - } - else { - /* if (false) ... */ - return _slang_gen_operation(A, &oper->children[2]); - } - } - - cond = _slang_gen_operation(A, &oper->children[0]); - cond = new_cond(cond); - - if (is_operation_type(&oper->children[1], SLANG_OPER_BREAK) - && !haveElseClause) { - /* Special case: generate a conditional break */ - ifBody = new_break_if_true(A, cond); - return ifBody; - } - else if (is_operation_type(&oper->children[1], SLANG_OPER_CONTINUE) - && !haveElseClause - && current_loop_oper(A) - && current_loop_oper(A)->type != SLANG_OPER_FOR) { - /* Special case: generate a conditional continue */ - ifBody = new_cont_if_true(A, cond); - return ifBody; - } - else { - /* general case */ - ifBody = _slang_gen_operation(A, &oper->children[1]); - if (haveElseClause) - elseBody = _slang_gen_operation(A, &oper->children[2]); - else - elseBody = NULL; - ifNode = new_if(cond, ifBody, elseBody); - return ifNode; - } -} - - - -static slang_ir_node * -_slang_gen_not(slang_assemble_ctx * A, const slang_operation *oper) -{ - slang_ir_node *n; - - assert(oper->type == SLANG_OPER_NOT); - - /* type-check expression */ - if (!_slang_is_scalar_or_boolean(A, &oper->children[0])) { - slang_info_log_error(A->log, - "scalar/boolean expression expected for '!'"); - return NULL; - } - - n = _slang_gen_operation(A, &oper->children[0]); - if (n) - return new_not(n); - else - return NULL; -} - - -static slang_ir_node * -_slang_gen_xor(slang_assemble_ctx * A, const slang_operation *oper) -{ - slang_ir_node *n1, *n2; - - assert(oper->type == SLANG_OPER_LOGICALXOR); - - if (!_slang_is_scalar_or_boolean(A, &oper->children[0]) || - !_slang_is_scalar_or_boolean(A, &oper->children[0])) { - slang_info_log_error(A->log, - "scalar/boolean expressions expected for '^^'"); - return NULL; - } - - n1 = _slang_gen_operation(A, &oper->children[0]); - if (!n1) - return NULL; - n2 = _slang_gen_operation(A, &oper->children[1]); - if (!n2) - return NULL; - return new_node2(IR_NOTEQUAL, n1, n2); -} - - -/** - * Generate IR node for storage of a temporary of given size. - */ -static slang_ir_node * -_slang_gen_temporary(GLint size) -{ - slang_ir_storage *store; - slang_ir_node *n = NULL; - - store = _slang_new_ir_storage(PROGRAM_TEMPORARY, -2, size); - if (store) { - n = new_node0(IR_VAR_DECL); - if (n) { - n->Store = store; - } - else { - _slang_free(store); - } - } - return n; -} - - -/** - * Generate program constants for an array. - * Ex: const vec2[3] v = vec2[3](vec2(1,1), vec2(2,2), vec2(3,3)); - * This will allocate and initialize three vector constants, storing - * the array in constant memory, not temporaries like a non-const array. - * This can also be used for uniform array initializers. - * \return GL_TRUE for success, GL_FALSE if failure (semantic error, etc). - */ -static GLboolean -make_constant_array(slang_assemble_ctx *A, - slang_variable *var, - slang_operation *initializer) -{ - struct gl_program *prog = A->program; - const GLenum datatype = _slang_gltype_from_specifier(&var->type.specifier); - const char *varName = (char *) var->a_name; - const GLuint numElements = initializer->num_children; - GLint size; - GLuint i, j; - GLfloat *values; - - if (!var->store) { - var->store = _slang_new_ir_storage(PROGRAM_UNDEFINED, -6, -6); - } - size = var->store->Size; - - assert(var->type.qualifier == SLANG_QUAL_CONST || - var->type.qualifier == SLANG_QUAL_UNIFORM); - assert(initializer->type == SLANG_OPER_CALL); - assert(initializer->array_constructor); - - values = (GLfloat *) malloc(numElements * 4 * sizeof(GLfloat)); - - /* convert constructor params into ordinary floats */ - for (i = 0; i < numElements; i++) { - const slang_operation *op = &initializer->children[i]; - if (op->type != SLANG_OPER_LITERAL_FLOAT) { - /* unsupported type for this optimization */ - free(values); - return GL_FALSE; - } - for (j = 0; j < op->literal_size; j++) { - values[i * 4 + j] = op->literal[j]; - } - for ( ; j < 4; j++) { - values[i * 4 + j] = 0.0f; - } - } - - /* slightly different paths for constants vs. uniforms */ - if (var->type.qualifier == SLANG_QUAL_UNIFORM) { - var->store->File = PROGRAM_UNIFORM; - var->store->Index = _mesa_add_uniform(prog->Parameters, varName, - size, datatype, values); - } - else { - var->store->File = PROGRAM_CONSTANT; - var->store->Index = _mesa_add_named_constant(prog->Parameters, varName, - values, size); - } - assert(var->store->Size == size); - - free(values); - - return GL_TRUE; -} - - - -/** - * Generate IR node for allocating/declaring a variable (either a local or - * a global). - * Generally, this involves allocating an slang_ir_storage instance for the - * variable, choosing a register file (temporary, constant, etc). - * For ordinary variables we do not yet allocate storage though. We do that - * when we find the first actual use of the variable to avoid allocating temp - * regs that will never get used. - * At this time, uniforms are always allocated space in this function. - * - * \param initializer Optional initializer expression for the variable. - */ -static slang_ir_node * -_slang_gen_var_decl(slang_assemble_ctx *A, slang_variable *var, - slang_operation *initializer) -{ - const char *varName = (const char *) var->a_name; - const GLenum datatype = _slang_gltype_from_specifier(&var->type.specifier); - slang_ir_node *varDecl, *n; - slang_ir_storage *store; - GLint arrayLen, size, totalSize; /* if array then totalSize > size */ - gl_register_file file; - - /*assert(!var->declared);*/ - var->declared = GL_TRUE; - - /* determine GPU register file for simple cases */ - if (is_sampler_type(&var->type)) { - file = PROGRAM_SAMPLER; - } - else if (var->type.qualifier == SLANG_QUAL_UNIFORM) { - file = PROGRAM_UNIFORM; - } - else { - file = PROGRAM_TEMPORARY; - } - - size = _slang_sizeof_type_specifier(&var->type.specifier); - if (size <= 0) { - slang_info_log_error(A->log, "invalid declaration for '%s'", varName); - return NULL; - } - - arrayLen = _slang_array_length(var); - totalSize = _slang_array_size(size, arrayLen); - - /* Allocate IR node for the declaration */ - varDecl = new_node0(IR_VAR_DECL); - if (!varDecl) - return NULL; - - /* Allocate slang_ir_storage for this variable if needed. - * Note that we may not actually allocate a constant or temporary register - * until later. - */ - if (!var->store) { - GLint index = -7; /* TBD / unknown */ - var->store = _slang_new_ir_storage(file, index, totalSize); - if (!var->store) - return NULL; /* out of memory */ - } - - /* set the IR node's Var and Store pointers */ - varDecl->Var = var; - varDecl->Store = var->store; - - - store = var->store; - - /* if there's an initializer, generate IR for the expression */ - if (initializer) { - slang_ir_node *varRef, *init; - - if (var->type.qualifier == SLANG_QUAL_CONST) { - /* if the variable is const, the initializer must be a const - * expression as well. - */ -#if 0 - if (!_slang_is_constant_expr(initializer)) { - slang_info_log_error(A->log, - "initializer for %s not constant", varName); - return NULL; - } -#endif - } - - if (var->type.qualifier == SLANG_QUAL_UNIFORM && - !A->allow_uniform_initializers) { - slang_info_log_error(A->log, - "initializer for uniform %s not allowed", - varName); - return NULL; - } - - /* IR for the variable we're initializing */ - varRef = new_var(A, var); - if (!varRef) { - slang_info_log_error(A->log, "out of memory"); - return NULL; - } - - /* constant-folding, etc here */ - _slang_simplify(initializer, &A->space, A->atoms); - - /* look for simple constant-valued variables and uniforms */ - if (var->type.qualifier == SLANG_QUAL_CONST || - var->type.qualifier == SLANG_QUAL_UNIFORM) { - - if (initializer->type == SLANG_OPER_CALL && - initializer->array_constructor) { - /* array initializer */ - if (make_constant_array(A, var, initializer)) - return varRef; - } - else if (initializer->type == SLANG_OPER_LITERAL_FLOAT || - initializer->type == SLANG_OPER_LITERAL_INT) { - /* simple float/vector initializer */ - if (store->File == PROGRAM_UNIFORM) { - store->Index = _mesa_add_uniform(A->program->Parameters, - varName, - totalSize, datatype, - initializer->literal); - store->Swizzle = _slang_var_swizzle(size, 0); - return varRef; - } -#if 0 - else { - store->File = PROGRAM_CONSTANT; - store->Index = _mesa_add_named_constant(A->program->Parameters, - varName, - initializer->literal, - totalSize); - store->Swizzle = _slang_var_swizzle(size, 0); - return varRef; - } -#endif - } - } - - /* IR for initializer */ - init = _slang_gen_operation(A, initializer); - if (!init) - return NULL; - - /* XXX remove this when type checking is added above */ - if (init->Store && init->Store->Size != totalSize) { - slang_info_log_error(A->log, "invalid assignment (wrong types)"); - return NULL; - } - - /* assign RHS to LHS */ - n = new_node2(IR_COPY, varRef, init); - n = new_seq(varDecl, n); - } - else { - /* no initializer */ - n = varDecl; - } - - if (store->File == PROGRAM_UNIFORM && store->Index < 0) { - /* always need to allocate storage for uniforms at this point */ - store->Index = _mesa_add_uniform(A->program->Parameters, varName, - totalSize, datatype, NULL); - store->Swizzle = _slang_var_swizzle(size, 0); - } - -#if 0 - printf("%s var %p %s store=%p index=%d size=%d\n", - __FUNCTION__, (void *) var, (char *) varName, - (void *) store, store->Index, store->Size); -#endif - - return n; -} - - -/** - * Generate code for a selection expression: b ? x : y - * XXX In some cases we could implement a selection expression - * with an LRP instruction (use the boolean as the interpolant). - * Otherwise, we use an IF/ELSE/ENDIF construct. - */ -static slang_ir_node * -_slang_gen_select(slang_assemble_ctx *A, slang_operation *oper) -{ - slang_ir_node *cond, *ifNode, *trueExpr, *falseExpr, *trueNode, *falseNode; - slang_ir_node *tmpDecl, *tmpVar, *tree; - slang_typeinfo type0, type1, type2; - int size, isBool, isEqual; - - assert(oper->type == SLANG_OPER_SELECT); - assert(oper->num_children == 3); - - /* type of children[0] must be boolean */ - slang_typeinfo_construct(&type0); - typeof_operation(A, &oper->children[0], &type0); - isBool = (type0.spec.type == SLANG_SPEC_BOOL); - slang_typeinfo_destruct(&type0); - if (!isBool) { - slang_info_log_error(A->log, "selector type is not boolean"); - return NULL; - } - - slang_typeinfo_construct(&type1); - slang_typeinfo_construct(&type2); - typeof_operation(A, &oper->children[1], &type1); - typeof_operation(A, &oper->children[2], &type2); - isEqual = slang_type_specifier_equal(&type1.spec, &type2.spec); - slang_typeinfo_destruct(&type1); - slang_typeinfo_destruct(&type2); - if (!isEqual) { - slang_info_log_error(A->log, "incompatible types for ?: operator"); - return NULL; - } - - /* size of x or y's type */ - size = _slang_sizeof_type_specifier(&type1.spec); - assert(size > 0); - - /* temporary var */ - tmpDecl = _slang_gen_temporary(size); - - /* the condition (child 0) */ - cond = _slang_gen_operation(A, &oper->children[0]); - cond = new_cond(cond); - - /* if-true body (child 1) */ - tmpVar = new_node0(IR_VAR); - tmpVar->Store = tmpDecl->Store; - trueExpr = _slang_gen_operation(A, &oper->children[1]); - trueNode = new_node2(IR_COPY, tmpVar, trueExpr); - - /* if-false body (child 2) */ - tmpVar = new_node0(IR_VAR); - tmpVar->Store = tmpDecl->Store; - falseExpr = _slang_gen_operation(A, &oper->children[2]); - falseNode = new_node2(IR_COPY, tmpVar, falseExpr); - - ifNode = new_if(cond, trueNode, falseNode); - - /* tmp var value */ - tmpVar = new_node0(IR_VAR); - tmpVar->Store = tmpDecl->Store; - - tree = new_seq(ifNode, tmpVar); - tree = new_seq(tmpDecl, tree); - - /*_slang_print_ir_tree(tree, 10);*/ - return tree; -} - - -/** - * Generate code for &&. - */ -static slang_ir_node * -_slang_gen_logical_and(slang_assemble_ctx *A, slang_operation *oper) -{ - /* rewrite "a && b" as "a ? b : false" */ - slang_operation *select; - slang_ir_node *n; - - select = slang_operation_new(1); - select->type = SLANG_OPER_SELECT; - slang_operation_add_children(select, 3); - - slang_operation_copy(slang_oper_child(select, 0), &oper->children[0]); - slang_operation_copy(slang_oper_child(select, 1), &oper->children[1]); - slang_operation_literal_bool(slang_oper_child(select, 2), GL_FALSE); - - n = _slang_gen_select(A, select); - return n; -} - - -/** - * Generate code for ||. - */ -static slang_ir_node * -_slang_gen_logical_or(slang_assemble_ctx *A, slang_operation *oper) -{ - /* rewrite "a || b" as "a ? true : b" */ - slang_operation *select; - slang_ir_node *n; - - select = slang_operation_new(1); - select->type = SLANG_OPER_SELECT; - slang_operation_add_children(select, 3); - - slang_operation_copy(slang_oper_child(select, 0), &oper->children[0]); - slang_operation_literal_bool(slang_oper_child(select, 1), GL_TRUE); - slang_operation_copy(slang_oper_child(select, 2), &oper->children[1]); - - n = _slang_gen_select(A, select); - return n; -} - - -/** - * Generate IR tree for a return statement. - */ -static slang_ir_node * -_slang_gen_return(slang_assemble_ctx * A, slang_operation *oper) -{ - assert(oper->type == SLANG_OPER_RETURN); - return new_return(A->curFuncEndLabel); -} - - -#if 0 -/** - * Determine if the given operation/expression is const-valued. - */ -static GLboolean -_slang_is_constant_expr(const slang_operation *oper) -{ - slang_variable *var; - GLuint i; - - switch (oper->type) { - case SLANG_OPER_IDENTIFIER: - var = _slang_variable_locate(oper->locals, oper->a_id, GL_TRUE); - if (var && var->type.qualifier == SLANG_QUAL_CONST) - return GL_TRUE; - return GL_FALSE; - default: - for (i = 0; i < oper->num_children; i++) { - if (!_slang_is_constant_expr(&oper->children[i])) - return GL_FALSE; - } - return GL_TRUE; - } -} -#endif - - -/** - * Check if an assignment of type t1 to t0 is legal. - * XXX more cases needed. - */ -static GLboolean -_slang_assignment_compatible(slang_assemble_ctx *A, - slang_operation *op0, - slang_operation *op1) -{ - slang_typeinfo t0, t1; - GLuint sz0, sz1; - - if (op0->type == SLANG_OPER_POSTINCREMENT || - op0->type == SLANG_OPER_POSTDECREMENT) { - return GL_FALSE; - } - - slang_typeinfo_construct(&t0); - typeof_operation(A, op0, &t0); - - slang_typeinfo_construct(&t1); - typeof_operation(A, op1, &t1); - - sz0 = _slang_sizeof_type_specifier(&t0.spec); - sz1 = _slang_sizeof_type_specifier(&t1.spec); - -#if 1 - if (sz0 != sz1) { - /*printf("assignment size mismatch %u vs %u\n", sz0, sz1);*/ - return GL_FALSE; - } -#endif - - if (t0.spec.type == SLANG_SPEC_STRUCT && - t1.spec.type == SLANG_SPEC_STRUCT && - t0.spec._struct->a_name != t1.spec._struct->a_name) - return GL_FALSE; - - if (t0.spec.type == SLANG_SPEC_FLOAT && - t1.spec.type == SLANG_SPEC_BOOL) - return GL_FALSE; - -#if 0 /* not used just yet - causes problems elsewhere */ - if (t0.spec.type == SLANG_SPEC_INT && - t1.spec.type == SLANG_SPEC_FLOAT) - return GL_FALSE; -#endif - - if (t0.spec.type == SLANG_SPEC_BOOL && - t1.spec.type == SLANG_SPEC_FLOAT) - return GL_FALSE; - - if (t0.spec.type == SLANG_SPEC_BOOL && - t1.spec.type == SLANG_SPEC_INT) - return GL_FALSE; - - return GL_TRUE; -} - - -/** - * Generate IR tree for a local variable declaration. - * Basically do some error checking and call _slang_gen_var_decl(). - */ -static slang_ir_node * -_slang_gen_declaration(slang_assemble_ctx *A, slang_operation *oper) -{ - const char *varName = (char *) oper->a_id; - slang_variable *var; - slang_ir_node *varDecl; - slang_operation *initializer; - - assert(oper->type == SLANG_OPER_VARIABLE_DECL); - assert(oper->num_children <= 1); - - - /* lookup the variable by name */ - var = _slang_variable_locate(oper->locals, oper->a_id, GL_TRUE); - if (!var) - return NULL; /* "shouldn't happen" */ - - if (var->type.qualifier == SLANG_QUAL_ATTRIBUTE || - var->type.qualifier == SLANG_QUAL_VARYING || - var->type.qualifier == SLANG_QUAL_UNIFORM) { - /* can't declare attribute/uniform vars inside functions */ - slang_info_log_error(A->log, - "local variable '%s' cannot be an attribute/uniform/varying", - varName); - return NULL; - } - -#if 0 - if (v->declared) { - slang_info_log_error(A->log, "variable '%s' redeclared", varName); - return NULL; - } -#endif - - /* check if the var has an initializer */ - if (oper->num_children > 0) { - assert(oper->num_children == 1); - initializer = &oper->children[0]; - } - else if (var->initializer) { - initializer = var->initializer; - } - else { - initializer = NULL; - } - - if (initializer) { - /* check/compare var type and initializer type */ - if (!_slang_assignment_compatible(A, oper, initializer)) { - slang_info_log_error(A->log, "incompatible types in assignment"); - return NULL; - } - } - else { - if (var->type.qualifier == SLANG_QUAL_CONST) { - slang_info_log_error(A->log, - "const-qualified variable '%s' requires initializer", - varName); - return NULL; - } - } - - /* Generate IR node */ - varDecl = _slang_gen_var_decl(A, var, initializer); - if (!varDecl) - return NULL; - - return varDecl; -} - - -/** - * Generate IR tree for a reference to a variable (such as in an expression). - * This is different from a variable declaration. - */ -static slang_ir_node * -_slang_gen_variable(slang_assemble_ctx * A, slang_operation *oper) -{ - /* If there's a variable associated with this oper (from inlining) - * use it. Otherwise, use the oper's var id. - */ - slang_atom name = oper->var ? oper->var->a_name : oper->a_id; - slang_variable *var = _slang_variable_locate(oper->locals, name, GL_TRUE); - slang_ir_node *n; - if (!var || !var->declared) { - /* Geometry shaders set gl_VerticesIn at link time - * so we need to wait with resolving this variable - * until then */ - if (A->program->Target == MESA_GEOMETRY_PROGRAM && - !strcmp((char*)name, "gl_VerticesIn") ){ - A->UnresolvedRefs = GL_TRUE; - return NULL; - } - slang_info_log_error(A->log, "undefined variable '%s'", (char *) name); - return NULL; - } - n = new_var(A, var); - return n; -} - - - -/** - * Return the number of components actually named by the swizzle. - * Recall that swizzles may have undefined/don't-care values. - */ -static GLuint -swizzle_size(GLuint swizzle) -{ - GLuint size = 0, i; - for (i = 0; i < 4; i++) { - GLuint swz = GET_SWZ(swizzle, i); - size += (swz <= 3); - } - return size; -} - - -static slang_ir_node * -_slang_gen_swizzle(slang_ir_node *child, GLuint swizzle) -{ - slang_ir_node *n = new_node1(IR_SWIZZLE, child); - assert(child); - if (n) { - assert(!n->Store); - n->Store = _slang_new_ir_storage_relative(0, - swizzle_size(swizzle), - child->Store); - assert(n->Store); - n->Store->Swizzle = swizzle; - } - return n; -} - - -static GLboolean -is_store_writable(const slang_assemble_ctx *A, const slang_ir_storage *store) -{ - while (store->Parent) - store = store->Parent; - - if (!(store->File == PROGRAM_OUTPUT || - store->File == PROGRAM_TEMPORARY || - (store->File == PROGRAM_VARYING && - (A->program->Target == GL_VERTEX_PROGRAM_ARB || - A->program->Target == MESA_GEOMETRY_PROGRAM)))) { - return GL_FALSE; - } - else { - return GL_TRUE; - } -} - - -/** - * Walk up an IR storage path to compute the final swizzle. - * This is used when we find an expression such as "foo.xz.yx". - */ -static GLuint -root_swizzle(const slang_ir_storage *st) -{ - GLuint swizzle = st->Swizzle; - while (st->Parent) { - st = st->Parent; - swizzle = _slang_swizzle_swizzle(st->Swizzle, swizzle); - } - return swizzle; -} - - -/** - * Generate IR tree for an assignment (=). - */ -static slang_ir_node * -_slang_gen_assignment(slang_assemble_ctx * A, slang_operation *oper) -{ - slang_operation *pred = NULL; - slang_ir_node *n = NULL; - - if (oper->children[0].type == SLANG_OPER_IDENTIFIER) { - /* Check that var is writeable */ - const char *varName = (char *) oper->children[0].a_id; - slang_variable *var - = _slang_variable_locate(oper->children[0].locals, - oper->children[0].a_id, GL_TRUE); - if (!var) { - slang_info_log_error(A->log, "undefined variable '%s'", varName); - return NULL; - } - - if (var->type.qualifier == SLANG_QUAL_CONST || - var->type.qualifier == SLANG_QUAL_ATTRIBUTE || - var->type.qualifier == SLANG_QUAL_UNIFORM || - (var->type.qualifier == SLANG_QUAL_VARYING && - A->program->Target == GL_FRAGMENT_PROGRAM_ARB)) { - slang_info_log_error(A->log, - "illegal assignment to read-only variable '%s'", - varName); - return NULL; - } - - /* check if we need to predicate this assignment based on __notRetFlag */ - if ((var->is_global || - var->type.qualifier == SLANG_QUAL_OUT || - var->type.qualifier == SLANG_QUAL_INOUT) && A->UseReturnFlag) { - /* create predicate, used below */ - pred = slang_operation_new(1); - pred->type = SLANG_OPER_IDENTIFIER; - pred->a_id = slang_atom_pool_atom(A->atoms, "__notRetFlag"); - pred->locals->outer_scope = oper->locals->outer_scope; - } - } - - if (oper->children[0].type == SLANG_OPER_IDENTIFIER && - oper->children[1].type == SLANG_OPER_CALL) { - /* Special case of: x = f(a, b) - * Replace with f(a, b, x) (where x == hidden __retVal out param) - * - * XXX this could be even more effective if we could accomodate - * cases such as "v.x = f();" - would help with typical vertex - * transformation. - */ - n = _slang_gen_function_call_name(A, - (const char *) oper->children[1].a_id, - &oper->children[1], &oper->children[0]); - } - else { - slang_ir_node *lhs, *rhs; - - /* lhs and rhs type checking */ - if (!_slang_assignment_compatible(A, - &oper->children[0], - &oper->children[1])) { - slang_info_log_error(A->log, "incompatible types in assignment"); - return NULL; - } - - lhs = _slang_gen_operation(A, &oper->children[0]); - if (!lhs) { - return NULL; - } - - if (!lhs->Store) { - slang_info_log_error(A->log, - "invalid left hand side for assignment"); - return NULL; - } - - /* check that lhs is writable */ - if (!is_store_writable(A, lhs->Store)) { - slang_info_log_error(A->log, - "illegal assignment to read-only l-value"); - return NULL; - } - - rhs = _slang_gen_operation(A, &oper->children[1]); - if (lhs && rhs) { - /* convert lhs swizzle into writemask */ - const GLuint swizzle = root_swizzle(lhs->Store); - GLuint writemask, newSwizzle = 0x0; - if (!swizzle_to_writemask(A, swizzle, &writemask, &newSwizzle)) { - /* Non-simple writemask, need to swizzle right hand side in - * order to put components into the right place. - */ - rhs = _slang_gen_swizzle(rhs, newSwizzle); - } - n = new_node2(IR_COPY, lhs, rhs); - } - else { - return NULL; - } - } - - if (n && pred) { - /* predicate the assignment code on __notRetFlag */ - slang_ir_node *top, *cond; - - cond = _slang_gen_operation(A, pred); - top = new_if(cond, n, NULL); - return top; - } - return n; -} - - -/** - * Generate IR tree for referencing a field in a struct (or basic vector type) - */ -static slang_ir_node * -_slang_gen_struct_field(slang_assemble_ctx * A, slang_operation *oper) -{ - slang_typeinfo ti; - - /* type of struct */ - slang_typeinfo_construct(&ti); - typeof_operation(A, &oper->children[0], &ti); - - if (_slang_type_is_vector(ti.spec.type)) { - /* the field should be a swizzle */ - const GLuint rows = _slang_type_dim(ti.spec.type); - slang_swizzle swz; - slang_ir_node *n; - GLuint swizzle; - if (!_slang_is_swizzle((char *) oper->a_id, rows, &swz)) { - slang_info_log_error(A->log, "Bad swizzle"); - return NULL; - } - swizzle = MAKE_SWIZZLE4(swz.swizzle[0], - swz.swizzle[1], - swz.swizzle[2], - swz.swizzle[3]); - - n = _slang_gen_operation(A, &oper->children[0]); - /* create new parent node with swizzle */ - if (n) - n = _slang_gen_swizzle(n, swizzle); - return n; - } - else if ( ti.spec.type == SLANG_SPEC_FLOAT - || ti.spec.type == SLANG_SPEC_INT - || ti.spec.type == SLANG_SPEC_BOOL) { - const GLuint rows = 1; - slang_swizzle swz; - slang_ir_node *n; - GLuint swizzle; - if (!_slang_is_swizzle((char *) oper->a_id, rows, &swz)) { - slang_info_log_error(A->log, "Bad swizzle"); - } - swizzle = MAKE_SWIZZLE4(swz.swizzle[0], - swz.swizzle[1], - swz.swizzle[2], - swz.swizzle[3]); - n = _slang_gen_operation(A, &oper->children[0]); - /* create new parent node with swizzle */ - n = _slang_gen_swizzle(n, swizzle); - return n; - } - else { - /* the field is a structure member (base.field) */ - /* oper->children[0] is the base */ - /* oper->a_id is the field name */ - slang_ir_node *base, *n; - slang_typeinfo field_ti; - GLint fieldSize, fieldOffset = -1; - - /* type of field */ - slang_typeinfo_construct(&field_ti); - typeof_operation(A, oper, &field_ti); - - fieldSize = _slang_sizeof_type_specifier(&field_ti.spec); - if (fieldSize > 0) - fieldOffset = _slang_field_offset(&ti.spec, oper->a_id); - - if (fieldSize == 0 || fieldOffset < 0) { - const char *structName; - if (ti.spec._struct) - structName = (char *) ti.spec._struct->a_name; - else - structName = "unknown"; - slang_info_log_error(A->log, - "\"%s\" is not a member of struct \"%s\"", - (char *) oper->a_id, structName); - return NULL; - } - assert(fieldSize >= 0); - - base = _slang_gen_operation(A, &oper->children[0]); - if (!base) { - /* error msg should have already been logged */ - return NULL; - } - - n = new_node1(IR_FIELD, base); - if (!n) - return NULL; - - n->Field = (char *) oper->a_id; - - /* Store the field's offset in storage->Index */ - n->Store = _slang_new_ir_storage(base->Store->File, - fieldOffset, - fieldSize); - - return n; - } -} - - -/** - * Gen code for array indexing. - */ -static slang_ir_node * -_slang_gen_array_element(slang_assemble_ctx * A, slang_operation *oper) -{ - slang_typeinfo array_ti; - - /* get array's type info */ - slang_typeinfo_construct(&array_ti); - typeof_operation(A, &oper->children[0], &array_ti); - - if (_slang_type_is_vector(array_ti.spec.type)) { - /* indexing a simple vector type: "vec4 v; v[0]=p;" */ - /* translate the index into a swizzle/writemask: "v.x=p" */ - const GLuint max = _slang_type_dim(array_ti.spec.type); - GLint index; - slang_ir_node *n; - - index = (GLint) oper->children[1].literal[0]; - if (oper->children[1].type != SLANG_OPER_LITERAL_INT || - index >= (GLint) max) { -#if 0 - slang_info_log_error(A->log, "Invalid array index for vector type"); - printf("type = %d\n", oper->children[1].type); - printf("index = %d, max = %d\n", index, max); - printf("array = %s\n", (char*)oper->children[0].a_id); - printf("index = %s\n", (char*)oper->children[1].a_id); - return NULL; -#else - index = 0; -#endif - } - - n = _slang_gen_operation(A, &oper->children[0]); - if (n) { - /* use swizzle to access the element */ - GLuint swizzle = MAKE_SWIZZLE4(SWIZZLE_X + index, - SWIZZLE_NIL, - SWIZZLE_NIL, - SWIZZLE_NIL); - n = _slang_gen_swizzle(n, swizzle); - } - return n; - } - else { - /* conventional array */ - slang_typeinfo elem_ti; - slang_ir_node *elem, *array, *index; - GLint elemSize, arrayLen; - - /* size of array element */ - slang_typeinfo_construct(&elem_ti); - typeof_operation(A, oper, &elem_ti); - elemSize = _slang_sizeof_type_specifier(&elem_ti.spec); - - if (_slang_type_is_matrix(array_ti.spec.type)) - arrayLen = _slang_type_dim(array_ti.spec.type); - else - arrayLen = array_ti.array_len; - - slang_typeinfo_destruct(&array_ti); - slang_typeinfo_destruct(&elem_ti); - - if (elemSize <= 0) { - /* unknown var or type */ - slang_info_log_error(A->log, "Undefined variable or type"); - return NULL; - } - - array = _slang_gen_operation(A, &oper->children[0]); - index = _slang_gen_operation(A, &oper->children[1]); - if (array && index) { - /* bounds check */ - GLint constIndex = -1; - if (index->Opcode == IR_FLOAT) { - constIndex = (int) index->Value[0]; - if (constIndex < 0 || constIndex >= arrayLen) { - slang_info_log_error(A->log, - "Array index out of bounds (index=%d size=%d)", - constIndex, arrayLen); - _slang_free_ir_tree(array); - _slang_free_ir_tree(index); - return NULL; - } - } - - if (!array->Store) { - slang_info_log_error(A->log, "Invalid array"); - return NULL; - } - - elem = new_node2(IR_ELEMENT, array, index); - - /* The storage info here will be updated during code emit */ - elem->Store = _slang_new_ir_storage(array->Store->File, - array->Store->Index, - elemSize); - elem->Store->Swizzle = _slang_var_swizzle(elemSize, 0); - return elem; - } - else { - _slang_free_ir_tree(array); - _slang_free_ir_tree(index); - return NULL; - } - } -} - - -static slang_ir_node * -_slang_gen_compare(slang_assemble_ctx *A, slang_operation *oper, - slang_ir_opcode opcode) -{ - slang_typeinfo t0, t1; - slang_ir_node *n; - - slang_typeinfo_construct(&t0); - typeof_operation(A, &oper->children[0], &t0); - - slang_typeinfo_construct(&t1); - typeof_operation(A, &oper->children[0], &t1); - - if (t0.spec.type == SLANG_SPEC_ARRAY || - t1.spec.type == SLANG_SPEC_ARRAY) { - slang_info_log_error(A->log, "Illegal array comparison"); - return NULL; - } - - if (oper->type != SLANG_OPER_EQUAL && - oper->type != SLANG_OPER_NOTEQUAL) { - /* <, <=, >, >= can only be used with scalars */ - if ((t0.spec.type != SLANG_SPEC_INT && - t0.spec.type != SLANG_SPEC_FLOAT) || - (t1.spec.type != SLANG_SPEC_INT && - t1.spec.type != SLANG_SPEC_FLOAT)) { - slang_info_log_error(A->log, "Incompatible type(s) for inequality operator"); - return NULL; - } - } - - n = new_node2(opcode, - _slang_gen_operation(A, &oper->children[0]), - _slang_gen_operation(A, &oper->children[1])); - - /* result is a bool (size 1) */ - n->Store = _slang_new_ir_storage(PROGRAM_TEMPORARY, -1, 1); - - return n; -} - - -#if 0 -static void -print_vars(slang_variable_scope *s) -{ - int i; - printf("vars: "); - for (i = 0; i < s->num_variables; i++) { - printf("%s %d, \n", - (char*) s->variables[i]->a_name, - s->variables[i]->declared); - } - - printf("\n"); -} -#endif - - -#if 0 -static void -_slang_undeclare_vars(slang_variable_scope *locals) -{ - if (locals->num_variables > 0) { - int i; - for (i = 0; i < locals->num_variables; i++) { - slang_variable *v = locals->variables[i]; - printf("undeclare %s at %p\n", (char*) v->a_name, v); - v->declared = GL_FALSE; - } - } -} -#endif - - -/** - * Generate IR tree for a slang_operation (AST node) - */ -static slang_ir_node * -_slang_gen_operation(slang_assemble_ctx * A, slang_operation *oper) -{ - switch (oper->type) { - case SLANG_OPER_BLOCK_NEW_SCOPE: - { - slang_ir_node *n; - - _slang_push_var_table(A->vartable); - - oper->type = SLANG_OPER_BLOCK_NO_NEW_SCOPE; /* temp change */ - n = _slang_gen_operation(A, oper); - oper->type = SLANG_OPER_BLOCK_NEW_SCOPE; /* restore */ - - _slang_pop_var_table(A->vartable); - - /*_slang_undeclare_vars(oper->locals);*/ - /*print_vars(oper->locals);*/ - - if (n) - n = new_node1(IR_SCOPE, n); - return n; - } - break; - - case SLANG_OPER_BLOCK_NO_NEW_SCOPE: - /* list of operations */ - if (oper->num_children > 0) - { - slang_ir_node *n, *tree = NULL; - GLuint i; - - for (i = 0; i < oper->num_children; i++) { - n = _slang_gen_operation(A, &oper->children[i]); - if (!n) { - _slang_free_ir_tree(tree); - return NULL; /* error must have occured */ - } - tree = new_seq(tree, n); - } - - return tree; - } - else { - return new_node0(IR_NOP); - } - - case SLANG_OPER_EXPRESSION: - return _slang_gen_operation(A, &oper->children[0]); - - case SLANG_OPER_FOR: - return _slang_gen_for(A, oper); - case SLANG_OPER_DO: - return _slang_gen_do(A, oper); - case SLANG_OPER_WHILE: - return _slang_gen_while(A, oper); - case SLANG_OPER_BREAK: - if (!current_loop_oper(A)) { - slang_info_log_error(A->log, "'break' not in loop"); - return NULL; - } - return new_break(current_loop_ir(A)); - case SLANG_OPER_CONTINUE: - if (!current_loop_oper(A)) { - slang_info_log_error(A->log, "'continue' not in loop"); - return NULL; - } - return _slang_gen_continue(A, oper); - case SLANG_OPER_DISCARD: - return new_node0(IR_KILL); - - case SLANG_OPER_EQUAL: - return _slang_gen_compare(A, oper, IR_EQUAL); - case SLANG_OPER_NOTEQUAL: - return _slang_gen_compare(A, oper, IR_NOTEQUAL); - case SLANG_OPER_GREATER: - return _slang_gen_compare(A, oper, IR_SGT); - case SLANG_OPER_LESS: - return _slang_gen_compare(A, oper, IR_SLT); - case SLANG_OPER_GREATEREQUAL: - return _slang_gen_compare(A, oper, IR_SGE); - case SLANG_OPER_LESSEQUAL: - return _slang_gen_compare(A, oper, IR_SLE); - case SLANG_OPER_ADD: - { - slang_ir_node *n; - assert(oper->num_children == 2); - n = _slang_gen_function_call_name(A, "+", oper, NULL); - return n; - } - case SLANG_OPER_SUBTRACT: - { - slang_ir_node *n; - assert(oper->num_children == 2); - n = _slang_gen_function_call_name(A, "-", oper, NULL); - return n; - } - case SLANG_OPER_MULTIPLY: - { - slang_ir_node *n; - assert(oper->num_children == 2); - n = _slang_gen_function_call_name(A, "*", oper, NULL); - return n; - } - case SLANG_OPER_DIVIDE: - { - slang_ir_node *n; - assert(oper->num_children == 2); - n = _slang_gen_function_call_name(A, "/", oper, NULL); - return n; - } - case SLANG_OPER_MINUS: - { - slang_ir_node *n; - assert(oper->num_children == 1); - n = _slang_gen_function_call_name(A, "-", oper, NULL); - return n; - } - case SLANG_OPER_PLUS: - /* +expr --> do nothing */ - return _slang_gen_operation(A, &oper->children[0]); - case SLANG_OPER_VARIABLE_DECL: - return _slang_gen_declaration(A, oper); - case SLANG_OPER_ASSIGN: - return _slang_gen_assignment(A, oper); - case SLANG_OPER_ADDASSIGN: - { - slang_ir_node *n; - assert(oper->num_children == 2); - n = _slang_gen_function_call_name(A, "+=", oper, NULL); - return n; - } - case SLANG_OPER_SUBASSIGN: - { - slang_ir_node *n; - assert(oper->num_children == 2); - n = _slang_gen_function_call_name(A, "-=", oper, NULL); - return n; - } - break; - case SLANG_OPER_MULASSIGN: - { - slang_ir_node *n; - assert(oper->num_children == 2); - n = _slang_gen_function_call_name(A, "*=", oper, NULL); - return n; - } - case SLANG_OPER_DIVASSIGN: - { - slang_ir_node *n; - assert(oper->num_children == 2); - n = _slang_gen_function_call_name(A, "/=", oper, NULL); - return n; - } - case SLANG_OPER_LOGICALAND: - { - slang_ir_node *n; - assert(oper->num_children == 2); - n = _slang_gen_logical_and(A, oper); - return n; - } - case SLANG_OPER_LOGICALOR: - { - slang_ir_node *n; - assert(oper->num_children == 2); - n = _slang_gen_logical_or(A, oper); - return n; - } - case SLANG_OPER_LOGICALXOR: - return _slang_gen_xor(A, oper); - case SLANG_OPER_NOT: - return _slang_gen_not(A, oper); - case SLANG_OPER_SELECT: /* b ? x : y */ - { - slang_ir_node *n; - assert(oper->num_children == 3); - n = _slang_gen_select(A, oper); - return n; - } - - case SLANG_OPER_ASM: - return _slang_gen_asm(A, oper, NULL); - case SLANG_OPER_CALL: - return _slang_gen_function_call_name(A, (const char *) oper->a_id, - oper, NULL); - case SLANG_OPER_METHOD: - return _slang_gen_method_call(A, oper); - case SLANG_OPER_RETURN: - return _slang_gen_return(A, oper); - case SLANG_OPER_RETURN_INLINED: - return _slang_gen_return(A, oper); - case SLANG_OPER_LABEL: - return new_label(oper->label); - case SLANG_OPER_IDENTIFIER: - return _slang_gen_variable(A, oper); - case SLANG_OPER_IF: - return _slang_gen_if(A, oper); - case SLANG_OPER_FIELD: - return _slang_gen_struct_field(A, oper); - case SLANG_OPER_SUBSCRIPT: - return _slang_gen_array_element(A, oper); - case SLANG_OPER_LITERAL_FLOAT: - /* fall-through */ - case SLANG_OPER_LITERAL_INT: - /* fall-through */ - case SLANG_OPER_LITERAL_BOOL: - return new_float_literal(oper->literal, oper->literal_size); - - case SLANG_OPER_POSTINCREMENT: /* var++ */ - { - slang_ir_node *n; - assert(oper->num_children == 1); - n = _slang_gen_function_call_name(A, "__postIncr", oper, NULL); - return n; - } - case SLANG_OPER_POSTDECREMENT: /* var-- */ - { - slang_ir_node *n; - assert(oper->num_children == 1); - n = _slang_gen_function_call_name(A, "__postDecr", oper, NULL); - return n; - } - case SLANG_OPER_PREINCREMENT: /* ++var */ - { - slang_ir_node *n; - assert(oper->num_children == 1); - n = _slang_gen_function_call_name(A, "++", oper, NULL); - return n; - } - case SLANG_OPER_PREDECREMENT: /* --var */ - { - slang_ir_node *n; - assert(oper->num_children == 1); - n = _slang_gen_function_call_name(A, "--", oper, NULL); - return n; - } - - case SLANG_OPER_NON_INLINED_CALL: - case SLANG_OPER_SEQUENCE: - { - slang_ir_node *tree = NULL; - GLuint i; - for (i = 0; i < oper->num_children; i++) { - slang_ir_node *n = _slang_gen_operation(A, &oper->children[i]); - tree = new_seq(tree, n); - if (n) - tree->Store = n->Store; - } - if (oper->type == SLANG_OPER_NON_INLINED_CALL) { - tree = new_function_call(tree, oper->label); - } - return tree; - } - - case SLANG_OPER_NONE: - case SLANG_OPER_VOID: - /* returning NULL here would generate an error */ - return new_node0(IR_NOP); - - default: - _mesa_problem(NULL, "bad node type %d in _slang_gen_operation", - oper->type); - return new_node0(IR_NOP); - } - - return NULL; -} - - -/** - * Check if the given type specifier is a rectangular texture sampler. - */ -static GLboolean -is_rect_sampler_spec(const slang_type_specifier *spec) -{ - while (spec->_array) { - spec = spec->_array; - } - return spec->type == SLANG_SPEC_SAMPLER_RECT || - spec->type == SLANG_SPEC_SAMPLER_RECT_SHADOW; -} - - - -/** - * Called by compiler when a global variable has been parsed/compiled. - * Here we examine the variable's type to determine what kind of register - * storage will be used. - * - * A uniform such as "gl_Position" will become the register specification - * (PROGRAM_OUTPUT, VERT_RESULT_HPOS). Or, uniform "gl_FogFragCoord" - * will be (PROGRAM_INPUT, FRAG_ATTRIB_FOGC). - * - * Samplers are interesting. For "uniform sampler2D tex;" we'll specify - * (PROGRAM_SAMPLER, index) where index is resolved at link-time to an - * actual texture unit (as specified by the user calling glUniform1i()). - */ -GLboolean -_slang_codegen_global_variable(slang_assemble_ctx *A, slang_variable *var, - slang_unit_type type) -{ - GET_CURRENT_CONTEXT(ctx); - struct gl_program *prog = A->program; - const char *varName = (char *) var->a_name; - GLboolean success = GL_TRUE; - slang_ir_storage *store = NULL; - int dbg = 0; - const GLenum datatype = _slang_gltype_from_specifier(&var->type.specifier); - const GLint size = _slang_sizeof_type_specifier(&var->type.specifier); - const GLint arrayLen = _slang_array_length(var); - const GLint totalSize = _slang_array_size(size, arrayLen); - GLint texIndex = sampler_to_texture_index(var->type.specifier.type); - - var->is_global = GL_TRUE; - - /* check for sampler2D arrays */ - if (texIndex == -1 && var->type.specifier._array) - texIndex = sampler_to_texture_index(var->type.specifier._array->type); - - if (texIndex != -1) { - /* This is a texture sampler variable... - * store->File = PROGRAM_SAMPLER - * store->Index = sampler number (0..7, typically) - * store->Size = texture type index (1D, 2D, 3D, cube, etc) - */ - if (var->initializer) { - slang_info_log_error(A->log, "illegal assignment to '%s'", varName); - return GL_FALSE; - } -#if FEATURE_es2_glsl /* XXX should use FEATURE_texture_rect */ - /* disallow rect samplers */ - if (ctx->API == API_OPENGLES2 && - is_rect_sampler_spec(&var->type.specifier)) { - slang_info_log_error(A->log, "invalid sampler type for '%s'", varName); - return GL_FALSE; - } -#else - (void) is_rect_sampler_spec; /* silence warning */ - (void) ctx; -#endif - { - GLint sampNum = _mesa_add_sampler(prog->Parameters, varName, datatype); - store = _slang_new_ir_storage_sampler(sampNum, texIndex, totalSize); - - /* If we have a sampler array, then we need to allocate the - * additional samplers to ensure we don't allocate them elsewhere. - * We can't directly use _mesa_add_sampler() as that checks the - * varName and gets a match, so we call _mesa_add_parameter() - * directly and use the last sampler number from the call above. - */ - if (arrayLen > 0) { - GLint a = arrayLen - 1; - GLint i; - for (i = 0; i < a; i++) { - GLfloat value = (GLfloat)(i + sampNum + 1); - (void) _mesa_add_parameter(prog->Parameters, PROGRAM_SAMPLER, - varName, 1, datatype, &value, NULL, 0x0); - } - } - } - if (dbg) printf("SAMPLER "); - } - else if (var->type.qualifier == SLANG_QUAL_UNIFORM) { - /* Uniform variable */ - const GLuint swizzle = _slang_var_swizzle(totalSize, 0); - - if (prog) { - /* user-defined uniform */ - if (datatype == GL_NONE) { - if ((var->type.specifier.type == SLANG_SPEC_ARRAY && - var->type.specifier._array->type == SLANG_SPEC_STRUCT) || - (var->type.specifier.type == SLANG_SPEC_STRUCT)) { - /* temporary work-around */ - GLenum datatype = GL_FLOAT; - GLint uniformLoc = _mesa_add_uniform(prog->Parameters, varName, - totalSize, datatype, NULL); - store = _slang_new_ir_storage_swz(PROGRAM_UNIFORM, uniformLoc, - totalSize, swizzle); - - if (arrayLen > 0) { - GLint a = arrayLen - 1; - GLint i; - for (i = 0; i < a; i++) { - GLfloat value = (GLfloat)(i + uniformLoc + 1); - (void) _mesa_add_parameter(prog->Parameters, PROGRAM_UNIFORM, - varName, 1, datatype, &value, NULL, 0x0); - } - } - - /* XXX what we need to do is unroll the struct into its - * basic types, creating a uniform variable for each. - * For example: - * struct foo { - * vec3 a; - * vec4 b; - * }; - * uniform foo f; - * - * Should produce uniforms: - * "f.a" (GL_FLOAT_VEC3) - * "f.b" (GL_FLOAT_VEC4) - */ - - if (var->initializer) { - slang_info_log_error(A->log, - "unsupported initializer for uniform '%s'", varName); - return GL_FALSE; - } - } - else { - slang_info_log_error(A->log, - "invalid datatype for uniform variable %s", - varName); - return GL_FALSE; - } - } - else { - /* non-struct uniform */ - if (!_slang_gen_var_decl(A, var, var->initializer)) - return GL_FALSE; - store = var->store; - } - } - else { - /* pre-defined uniform, like gl_ModelviewMatrix */ - /* We know it's a uniform, but don't allocate storage unless - * it's really used. - */ - store = _slang_new_ir_storage_swz(PROGRAM_STATE_VAR, -1, - totalSize, swizzle); - } - if (dbg) printf("UNIFORM (sz %d) ", totalSize); - } - else if (var->type.qualifier == SLANG_QUAL_VARYING) { - /* varyings must be float, vec or mat */ - if (!_slang_type_is_float_vec_mat(var->type.specifier.type) && - var->type.specifier.type != SLANG_SPEC_ARRAY) { - slang_info_log_error(A->log, - "varying '%s' must be float/vector/matrix", - varName); - return GL_FALSE; - } - - if (var->initializer) { - slang_info_log_error(A->log, "illegal initializer for varying '%s'", - varName); - return GL_FALSE; - } - - if (prog) { - /* user-defined varying */ - GLbitfield flags; - GLint varyingLoc; - GLuint swizzle; - - flags = 0x0; - if (var->type.centroid == SLANG_CENTROID) - flags |= PROG_PARAM_BIT_CENTROID; - if (var->type.variant == SLANG_INVARIANT) - flags |= PROG_PARAM_BIT_INVARIANT; - - varyingLoc = _mesa_add_varying(prog->Varying, varName, - totalSize, GL_NONE, flags); - swizzle = _slang_var_swizzle(size, 0); - store = _slang_new_ir_storage_swz(PROGRAM_VARYING, varyingLoc, - totalSize, swizzle); - } - else { - /* pre-defined varying, like gl_Color or gl_TexCoord */ - if (type == SLANG_UNIT_FRAGMENT_BUILTIN) { - /* fragment program input */ - GLuint swizzle; - GLint index = _slang_input_index(varName, GL_FRAGMENT_PROGRAM_ARB, - &swizzle, NULL); - assert(index >= 0); - assert(index < FRAG_ATTRIB_MAX); - store = _slang_new_ir_storage_swz(PROGRAM_INPUT, index, - size, swizzle); - } else if (type == SLANG_UNIT_VERTEX_BUILTIN) { - /* vertex program output */ - GLint index = _slang_output_index(varName, GL_VERTEX_PROGRAM_ARB); - GLuint swizzle = _slang_var_swizzle(size, 0); - assert(index >= 0); - assert(index < VERT_RESULT_MAX); - assert(type == SLANG_UNIT_VERTEX_BUILTIN); - store = _slang_new_ir_storage_swz(PROGRAM_OUTPUT, index, - size, swizzle); - } else { - /* geometry program input */ - GLboolean is_array = GL_FALSE; - GLuint swizzle; - GLint index = _slang_input_index(varName, MESA_GEOMETRY_PROGRAM, - &swizzle, &is_array); - if (index < 0) { - /* geometry program output */ - index = _slang_output_index(varName, MESA_GEOMETRY_PROGRAM); - swizzle = _slang_var_swizzle(size, 0); - - assert(index >= 0); - assert(index < GEOM_RESULT_MAX); - - store = _slang_new_ir_storage_swz(PROGRAM_OUTPUT, index, - size, swizzle); - } else { - assert(index >= 0); - /* assert(index < GEOM_ATTRIB_MAX); */ - if (is_array) - store = _slang_new_ir_storage_2d(PROGRAM_INPUT, 0, index, - size, swizzle); - else - store = _slang_new_ir_storage_swz(PROGRAM_INPUT, index, - size, swizzle); - } - } - if (dbg) printf("V/F "); - } - if (dbg) printf("VARYING "); - } - else if (var->type.qualifier == SLANG_QUAL_ATTRIBUTE) { - GLuint swizzle; - GLint index; - /* attributes must be float, vec or mat */ - if (!_slang_type_is_float_vec_mat(var->type.specifier.type)) { - slang_info_log_error(A->log, - "attribute '%s' must be float/vector/matrix", - varName); - return GL_FALSE; - } - - if (prog) { - /* user-defined vertex attribute */ - const GLint attr = -1; /* unknown */ - swizzle = _slang_var_swizzle(size, 0); - index = _mesa_add_attribute(prog->Attributes, varName, - size, datatype, attr); - assert(index >= 0); - index = VERT_ATTRIB_GENERIC0 + index; - } - else { - /* pre-defined vertex attrib */ - index = _slang_input_index(varName, GL_VERTEX_PROGRAM_ARB, &swizzle, NULL); - assert(index >= 0); - } - store = _slang_new_ir_storage_swz(PROGRAM_INPUT, index, size, swizzle); - if (dbg) printf("ATTRIB "); - } - else if (var->type.qualifier == SLANG_QUAL_FIXEDINPUT) { - GLuint swizzle = SWIZZLE_XYZW; /* silence compiler warning */ - if (type == SLANG_UNIT_FRAGMENT_BUILTIN) { - GLint index = _slang_input_index(varName, GL_FRAGMENT_PROGRAM_ARB, - &swizzle, NULL); - store = _slang_new_ir_storage_swz(PROGRAM_INPUT, index, size, swizzle); - } else if (type == SLANG_UNIT_GEOMETRY_BUILTIN) { - GLboolean is_array; - GLint index = _slang_input_index(varName, MESA_GEOMETRY_PROGRAM, - &swizzle, &is_array); - if (is_array) - store = _slang_new_ir_storage_2d(PROGRAM_INPUT, 0, index, size, swizzle); - else - store = _slang_new_ir_storage_swz(PROGRAM_INPUT, index, size, swizzle); - } - if (dbg) printf("INPUT "); - } - else if (var->type.qualifier == SLANG_QUAL_FIXEDOUTPUT) { - if (type == SLANG_UNIT_VERTEX_BUILTIN) { - GLint index = _slang_output_index(varName, GL_VERTEX_PROGRAM_ARB); - store = _slang_new_ir_storage(PROGRAM_OUTPUT, index, size); - } else if (type == SLANG_UNIT_FRAGMENT_BUILTIN) { - GLint index = _slang_output_index(varName, GL_FRAGMENT_PROGRAM_ARB); - GLint specialSize = 4; /* treat all fragment outputs as float[4] */ - assert(type == SLANG_UNIT_FRAGMENT_BUILTIN); - store = _slang_new_ir_storage(PROGRAM_OUTPUT, index, specialSize); - } else { - GLint index = _slang_output_index(varName, MESA_GEOMETRY_PROGRAM); - GLint specialSize = 4; /* treat all fragment outputs as float[4] */ - assert(type == SLANG_UNIT_GEOMETRY_BUILTIN); - store = _slang_new_ir_storage(PROGRAM_OUTPUT, index, specialSize); - } - if (dbg) printf("OUTPUT "); - } - else if (var->type.qualifier == SLANG_QUAL_CONST && !prog) { - /* pre-defined global constant, like gl_MaxLights */ - store = _slang_new_ir_storage(PROGRAM_CONSTANT, -1, size); - if (dbg) printf("CONST "); - } - else { - /* ordinary variable (may be const) */ - slang_ir_node *n; - - /* IR node to declare the variable */ - n = _slang_gen_var_decl(A, var, var->initializer); - - /* emit GPU instructions */ - success = _slang_emit_code(n, A->vartable, A->program, A->pragmas, GL_FALSE, A->log); - - _slang_free_ir_tree(n); - } - - if (dbg) printf("GLOBAL VAR %s idx %d\n", (char*) var->a_name, - store ? store->Index : -2); - - if (store) - var->store = store; /* save var's storage info */ - - var->declared = GL_TRUE; - - return success; -} - - -/** - * Produce an IR tree from a function AST (fun->body). - * Then call the code emitter to convert the IR tree into gl_program - * instructions. - */ -GLboolean -_slang_codegen_function(slang_assemble_ctx * A, slang_function * fun) -{ - slang_ir_node *n; - GLboolean success = GL_TRUE; - - if (strcmp((char *) fun->header.a_name, "main") != 0) { - /* we only really generate code for main, all other functions get - * inlined or codegen'd upon an actual call. - */ -#if 0 - /* do some basic error checking though */ - if (fun->header.type.specifier.type != SLANG_SPEC_VOID) { - /* check that non-void functions actually return something */ - slang_operation *op - = _slang_find_node_type(fun->body, SLANG_OPER_RETURN); - if (!op) { - slang_info_log_error(A->log, - "function \"%s\" has no return statement", - (char *) fun->header.a_name); - printf( - "function \"%s\" has no return statement\n", - (char *) fun->header.a_name); - return GL_FALSE; - } - } -#endif - return GL_TRUE; /* not an error */ - } - -#if 0 - printf("\n*********** codegen_function %s\n", (char *) fun->header.a_name); - slang_print_function(fun, 1); -#endif - - /* should have been allocated earlier: */ - assert(A->program->Parameters ); - assert(A->program->Varying); - assert(A->vartable); - - A->LoopDepth = 0; - A->UseReturnFlag = GL_FALSE; - A->CurFunction = fun; - - /* fold constant expressions, etc. */ - _slang_simplify(fun->body, &A->space, A->atoms); - -#if 0 - printf("\n*********** simplified %s\n", (char *) fun->header.a_name); - slang_print_function(fun, 1); -#endif - - /* Create an end-of-function label */ - A->curFuncEndLabel = _slang_label_new("__endOfFunc__main"); - - /* push new vartable scope */ - _slang_push_var_table(A->vartable); - - /* Generate IR tree for the function body code */ - n = _slang_gen_operation(A, fun->body); - if (n) - n = new_node1(IR_SCOPE, n); - - /* pop vartable, restore previous */ - _slang_pop_var_table(A->vartable); - - if (!n) { - /* XXX record error */ - return GL_FALSE; - } - - /* append an end-of-function-label to IR tree */ - n = new_seq(n, new_label(A->curFuncEndLabel)); - - /*_slang_label_delete(A->curFuncEndLabel);*/ - A->curFuncEndLabel = NULL; - -#if 0 - printf("************* New AST for %s *****\n", (char*)fun->header.a_name); - slang_print_function(fun, 1); -#endif -#if 0 - printf("************* IR for %s *******\n", (char*)fun->header.a_name); - _slang_print_ir_tree(n, 0); -#endif -#if 0 - printf("************* End codegen function ************\n\n"); -#endif - - if (A->UnresolvedRefs) { - /* Can't codegen at this time. - * At link time we'll concatenate all the vertex shaders and/or all - * the fragment shaders and try recompiling. - */ - return GL_TRUE; - } - - /* Emit program instructions */ - success = _slang_emit_code(n, A->vartable, A->program, A->pragmas, GL_TRUE, A->log); - _slang_free_ir_tree(n); - - /* free codegen context */ - /* - free(A->codegen); - */ - - return success; -} - diff --git a/src/mesa/slang/slang_codegen.h b/src/mesa/slang/slang_codegen.h deleted file mode 100644 index 376a8cc264..0000000000 --- a/src/mesa/slang/slang_codegen.h +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Mesa 3-D graphics library - * Version: 6.5.3 - * - * Copyright (C) 2005-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 SLANG_CODEGEN_H -#define SLANG_CODEGEN_H - - -#include "main/glheader.h" -#include "slang_compile.h" -#include "slang_compile_variable.h" -#include "slang_typeinfo.h" -#include "slang_utility.h" -#include "slang_vartable.h" - -struct slang_function_; - -#define MAX_LOOP_DEPTH 30 - - -typedef struct slang_assemble_ctx_ -{ - slang_atom_pool *atoms; - slang_name_space space; - struct gl_program *program; - struct gl_sl_pragmas *pragmas; - slang_var_table *vartable; - slang_info_log *log; - GLboolean allow_uniform_initializers; - - /* current loop stack */ - const slang_operation *LoopOperStack[MAX_LOOP_DEPTH]; - struct slang_ir_node_ *LoopIRStack[MAX_LOOP_DEPTH]; - GLuint LoopDepth; - - /* current function */ - struct slang_function_ *CurFunction; - struct slang_label_ *curFuncEndLabel; - GLboolean UseReturnFlag; - - GLboolean UnresolvedRefs; - GLboolean EmitContReturn; -} slang_assemble_ctx; - - -extern GLuint -_slang_sizeof_type_specifier(const slang_type_specifier *spec); - -extern GLboolean -_slang_codegen_function(slang_assemble_ctx *A , struct slang_function_ *fun); - -extern GLboolean -_slang_codegen_global_variable(slang_assemble_ctx *A, slang_variable *var, - slang_unit_type type); - - -#endif /* SLANG_CODEGEN_H */ diff --git a/src/mesa/slang/slang_compile.c b/src/mesa/slang/slang_compile.c deleted file mode 100644 index de1bb56cd9..0000000000 --- a/src/mesa/slang/slang_compile.c +++ /dev/null @@ -1,3103 +0,0 @@ -/* - * Mesa 3-D graphics library - * - * Copyright (C) 2005-2006 Brian Paul All Rights Reserved. - * Copyright (C) 2008 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 slang_compile.c - * slang front-end compiler - * \author Michal Krol - */ - -#include "main/imports.h" -#include "main/context.h" -#include "program/program.h" -#include "program/programopt.h" -#include "program/prog_optimize.h" -#include "program/prog_print.h" -#include "program/prog_parameter.h" -#include "../../glsl/pp/sl_pp_public.h" -#include "../../glsl/pp/sl_pp_purify.h" -#include "../../glsl/cl/sl_cl_parse.h" -#include "slang_codegen.h" -#include "slang_compile.h" -#include "slang_storage.h" -#include "slang_log.h" -#include "slang_mem.h" -#include "slang_vartable.h" -#include "slang_simplify.h" - -/* - * This is a straightforward implementation of the slang front-end - * compiler. Lots of error-checking functionality is missing but - * every well-formed shader source should compile successfully and - * execute as expected. However, some semantically ill-formed shaders - * may be accepted resulting in undefined behaviour. - */ - - -/** re-defined below, should be the same though */ -#define TYPE_SPECIFIER_COUNT 36 - - -/** - * Check if the given identifier is legal. - */ -static GLboolean -legal_identifier(slang_atom name) -{ - /* "gl_" is a reserved prefix */ - if (strncmp((char *) name, "gl_", 3) == 0) { - return GL_FALSE; - } - return GL_TRUE; -} - - -/* - * slang_code_unit - */ - -GLvoid -_slang_code_unit_ctr(slang_code_unit * self, - struct slang_code_object_ * object) -{ - _slang_variable_scope_ctr(&self->vars); - _slang_function_scope_ctr(&self->funs); - _slang_struct_scope_ctr(&self->structs); - self->object = object; -} - -GLvoid -_slang_code_unit_dtr(slang_code_unit * self) -{ - slang_variable_scope_destruct(&self->vars); - slang_function_scope_destruct(&self->funs); - slang_struct_scope_destruct(&self->structs); -} - -/* - * slang_code_object - */ - -GLvoid -_slang_code_object_ctr(slang_code_object * self) -{ - GLuint i; - - for (i = 0; i < SLANG_BUILTIN_TOTAL; i++) - _slang_code_unit_ctr(&self->builtin[i], self); - _slang_code_unit_ctr(&self->unit, self); - slang_atom_pool_construct(&self->atompool); -} - -GLvoid -_slang_code_object_dtr(slang_code_object * self) -{ - GLuint i; - - for (i = 0; i < SLANG_BUILTIN_TOTAL; i++) - _slang_code_unit_dtr(&self->builtin[i]); - _slang_code_unit_dtr(&self->unit); - slang_atom_pool_destruct(&self->atompool); -} - - -/* slang_parse_ctx */ - -typedef struct slang_parse_ctx_ -{ - const unsigned char *I; - slang_info_log *L; - int parsing_builtin; - GLboolean global_scope; /**< Is object being declared a global? */ - slang_atom_pool *atoms; - slang_unit_type type; /**< Vertex vs. Fragment */ - GLuint version; /**< user-specified (or default) #version */ -} slang_parse_ctx; - -/* slang_output_ctx */ - -typedef struct slang_output_ctx_ -{ - slang_variable_scope *vars; - slang_function_scope *funs; - slang_struct_scope *structs; - struct gl_program *program; - struct gl_sl_pragmas *pragmas; - slang_var_table *vartable; - GLuint default_precision[TYPE_SPECIFIER_COUNT]; - GLboolean allow_precision; - GLboolean allow_invariant; - GLboolean allow_centroid; - GLboolean allow_array_types; /* float[] syntax */ -} slang_output_ctx; - -/* _slang_compile() */ - - -/* Debugging aid, print file/line where parsing error is detected */ -#define RETURN0 \ - do { \ - if (0) \ - printf("slang error at %s:%d\n", __FILE__, __LINE__); \ - return 0; \ - } while (0) - - -static void -parse_identifier_str(slang_parse_ctx * C, char **id) -{ - *id = (char *) C->I; - C->I += strlen(*id) + 1; -} - -static slang_atom -parse_identifier(slang_parse_ctx * C) -{ - const char *id; - - id = (const char *) C->I; - C->I += strlen(id) + 1; - return slang_atom_pool_atom(C->atoms, id); -} - -static int -is_hex_digit(char c) -{ - return (c >= '0' && c <= '9') || (c >= 'a' && c <= 'f') || (c >= 'A' && c <= 'F'); -} - -static int -parse_general_number(slang_parse_ctx *ctx, float *number) -{ - char *flt = NULL; - - if (*ctx->I == '0') { - int value = 0; - const unsigned char *pi; - - if (ctx->I[1] == 'x' || ctx->I[1] == 'X') { - ctx->I += 2; - if (!is_hex_digit(*ctx->I)) { - return 0; - } - do { - int digit; - - if (*ctx->I >= '0' && *ctx->I <= '9') { - digit = (int)(*ctx->I - '0'); - } else if (*ctx->I >= 'a' && *ctx->I <= 'f') { - digit = (int)(*ctx->I - 'a') + 10; - } else { - digit = (int)(*ctx->I - 'A') + 10; - } - value = value * 0x10 + digit; - ctx->I++; - } while (is_hex_digit(*ctx->I)); - if (*ctx->I != '\0') { - return 0; - } - ctx->I++; - *number = (float)value; - return 1; - } - - pi = ctx->I; - pi++; - while (*pi >= '0' && *pi <= '7') { - int digit; - - digit = (int)(*pi - '0'); - value = value * 010 + digit; - pi++; - } - if (*pi == '\0') { - pi++; - ctx->I = pi; - *number = (float)value; - return 1; - } - } - - parse_identifier_str(ctx, &flt); - flt = _mesa_strdup(flt); - if (!flt) { - return 0; - } - if (flt[strlen(flt) - 1] == 'f' || flt[strlen(flt) - 1] == 'F') { - flt[strlen(flt) - 1] = '\0'; - } - *number = _mesa_strtof(flt, (char **)NULL); - free(flt); - - return 1; -} - -static int -parse_number(slang_parse_ctx * C, int *number) -{ - const int radix = (int) (*C->I++); - - if (radix == 1) { - float f = 0.0f; - - parse_general_number(C, &f); - *number = (int)f; - } else { - *number = 0; - while (*C->I != '\0') { - int digit; - if (*C->I >= '0' && *C->I <= '9') - digit = (int) (*C->I - '0'); - else if (*C->I >= 'A' && *C->I <= 'Z') - digit = (int) (*C->I - 'A') + 10; - else - digit = (int) (*C->I - 'a') + 10; - *number = *number * radix + digit; - C->I++; - } - C->I++; - } - if (*number > 65535) - slang_info_log_warning(C->L, "%d: literal integer overflow.", *number); - return 1; -} - -static int -parse_float(slang_parse_ctx * C, float *number) -{ - if (*C->I == 1) { - C->I++; - parse_general_number(C, number); - } else { - char *integral = NULL; - char *fractional = NULL; - char *exponent = NULL; - char *whole = NULL; - - parse_identifier_str(C, &integral); - parse_identifier_str(C, &fractional); - parse_identifier_str(C, &exponent); - - whole = (char *) _slang_alloc((strlen(integral) + - strlen(fractional) + - strlen(exponent) + 3) * sizeof(char)); - if (whole == NULL) { - slang_info_log_memory(C->L); - RETURN0; - } - - slang_string_copy(whole, integral); - slang_string_concat(whole, "."); - slang_string_concat(whole, fractional); - slang_string_concat(whole, "E"); - slang_string_concat(whole, exponent); - - *number = _mesa_strtof(whole, (char **) NULL); - - _slang_free(whole); - } - - return 1; -} - -/* revision number - increment after each change affecting emitted output */ -#define REVISION 5 - -static int -check_revision(slang_parse_ctx * C) -{ - if (*C->I != REVISION) { - slang_info_log_error(C->L, "Internal compiler error."); - RETURN0; - } - C->I++; - return 1; -} - -static int parse_statement(slang_parse_ctx *, slang_output_ctx *, - slang_operation *); -static int parse_expression(slang_parse_ctx *, slang_output_ctx *, - slang_operation *); -static int parse_type_specifier(slang_parse_ctx *, slang_output_ctx *, - slang_type_specifier *); -static int -parse_type_array_size(slang_parse_ctx *C, - slang_output_ctx *O, - GLint *array_len); - -static GLboolean -parse_array_len(slang_parse_ctx * C, slang_output_ctx * O, GLuint * len) -{ - slang_operation array_size; - slang_name_space space; - GLboolean result; - - if (!slang_operation_construct(&array_size)) - return GL_FALSE; - if (!parse_expression(C, O, &array_size)) { - slang_operation_destruct(&array_size); - return GL_FALSE; - } - - space.funcs = O->funs; - space.structs = O->structs; - space.vars = O->vars; - - /* evaluate compile-time expression which is array size */ - _slang_simplify(&array_size, &space, C->atoms); - - if (array_size.type == SLANG_OPER_LITERAL_INT) { - result = GL_TRUE; - *len = (GLint) array_size.literal[0]; - } else if (array_size.type == SLANG_OPER_IDENTIFIER) { - slang_variable *var = _slang_variable_locate(array_size.locals, array_size.a_id, GL_TRUE); - if (!var) { - slang_info_log_error(C->L, "undefined variable '%s'", - (char *) array_size.a_id); - result = GL_FALSE; - } else if (var->type.qualifier == SLANG_QUAL_CONST && - var->type.specifier.type == SLANG_SPEC_INT) { - if (var->initializer && - var->initializer->type == SLANG_OPER_LITERAL_INT) { - *len = (GLint) var->initializer->literal[0]; - result = GL_TRUE; - } else { - slang_info_log_error(C->L, "unable to parse array size declaration"); - result = GL_FALSE; - } - } else { - slang_info_log_error(C->L, "unable to parse array size declaration"); - result = GL_FALSE; - } - } else { - result = GL_FALSE; - } - - slang_operation_destruct(&array_size); - return result; -} - -static GLboolean -calculate_var_size(slang_parse_ctx * C, slang_output_ctx * O, - slang_variable * var) -{ - slang_storage_aggregate agg; - - if (!slang_storage_aggregate_construct(&agg)) - return GL_FALSE; - if (!_slang_aggregate_variable(&agg, &var->type.specifier, var->array_len, - O->funs, O->structs, O->vars, C->atoms)) { - slang_storage_aggregate_destruct(&agg); - return GL_FALSE; - } - var->size = _slang_sizeof_aggregate(&agg); - slang_storage_aggregate_destruct(&agg); - return GL_TRUE; -} - -static void -promote_type_to_array(slang_parse_ctx *C, - slang_fully_specified_type *type, - GLint array_len) -{ - slang_type_specifier *baseType = - slang_type_specifier_new(type->specifier.type, NULL, NULL); - - type->specifier.type = SLANG_SPEC_ARRAY; - type->specifier._array = baseType; - type->array_len = array_len; -} - - -static GLboolean -convert_to_array(slang_parse_ctx * C, slang_variable * var, - const slang_type_specifier * sp) -{ - /* sized array - mark it as array, copy the specifier to the array element - * and parse the expression */ - var->type.specifier.type = SLANG_SPEC_ARRAY; - var->type.specifier._array = (slang_type_specifier *) - _slang_alloc(sizeof(slang_type_specifier)); - if (var->type.specifier._array == NULL) { - slang_info_log_memory(C->L); - return GL_FALSE; - } - slang_type_specifier_ctr(var->type.specifier._array); - return slang_type_specifier_copy(var->type.specifier._array, sp); -} - -/* structure field */ -#define FIELD_NONE 0 -#define FIELD_NEXT 1 -#define FIELD_ARRAY 2 - -static GLboolean -parse_struct_field_var(slang_parse_ctx * C, slang_output_ctx * O, - slang_variable * var, slang_atom a_name, - const slang_type_specifier * sp, - GLuint array_len) -{ - var->a_name = a_name; - if (var->a_name == SLANG_ATOM_NULL) - return GL_FALSE; - - switch (*C->I++) { - case FIELD_NONE: - if (array_len != -1) { - if (!convert_to_array(C, var, sp)) - return GL_FALSE; - var->array_len = array_len; - } - else { - if (!slang_type_specifier_copy(&var->type.specifier, sp)) - return GL_FALSE; - } - break; - case FIELD_ARRAY: - if (array_len != -1) - return GL_FALSE; - if (!convert_to_array(C, var, sp)) - return GL_FALSE; - if (!parse_array_len(C, O, &var->array_len)) - return GL_FALSE; - break; - default: - return GL_FALSE; - } - - return calculate_var_size(C, O, var); -} - -static int -parse_struct_field(slang_parse_ctx * C, slang_output_ctx * O, - slang_struct * st, slang_type_specifier * sp) -{ - slang_output_ctx o = *O; - GLint array_len; - - o.structs = st->structs; - if (!parse_type_specifier(C, &o, sp)) - RETURN0; - if (!parse_type_array_size(C, &o, &array_len)) - RETURN0; - - do { - slang_atom a_name; - slang_variable *var = slang_variable_scope_grow(st->fields); - if (!var) { - slang_info_log_memory(C->L); - RETURN0; - } - a_name = parse_identifier(C); - if (_slang_variable_locate(st->fields, a_name, GL_FALSE)) { - slang_info_log_error(C->L, "duplicate field '%s'", (char *) a_name); - RETURN0; - } - - if (!parse_struct_field_var(C, &o, var, a_name, sp, array_len)) - RETURN0; - } - while (*C->I++ != FIELD_NONE); - - return 1; -} - -static int -parse_struct(slang_parse_ctx * C, slang_output_ctx * O, slang_struct ** st) -{ - slang_atom a_name; - const char *name; - - /* parse struct name (if any) and make sure it is unique in current scope */ - a_name = parse_identifier(C); - if (a_name == SLANG_ATOM_NULL) - RETURN0; - - name = slang_atom_pool_id(C->atoms, a_name); - if (name[0] != '\0' - && slang_struct_scope_find(O->structs, a_name, 0) != NULL) { - slang_info_log_error(C->L, "%s: duplicate type name.", name); - RETURN0; - } - - /* set-up a new struct */ - *st = (slang_struct *) _slang_alloc(sizeof(slang_struct)); - if (*st == NULL) { - slang_info_log_memory(C->L); - RETURN0; - } - if (!slang_struct_construct(*st)) { - _slang_free(*st); - *st = NULL; - slang_info_log_memory(C->L); - RETURN0; - } - (**st).a_name = a_name; - (**st).structs->outer_scope = O->structs; - - /* parse individual struct fields */ - do { - slang_type_specifier sp; - - slang_type_specifier_ctr(&sp); - if (!parse_struct_field(C, O, *st, &sp)) { - slang_type_specifier_dtr(&sp); - RETURN0; - } - slang_type_specifier_dtr(&sp); - } - while (*C->I++ != FIELD_NONE); - - /* if named struct, copy it to current scope */ - if (name[0] != '\0') { - slang_struct *s; - - O->structs->structs = - (slang_struct *) _slang_realloc(O->structs->structs, - O->structs->num_structs - * sizeof(slang_struct), - (O->structs->num_structs + 1) - * sizeof(slang_struct)); - if (O->structs->structs == NULL) { - slang_info_log_memory(C->L); - RETURN0; - } - s = &O->structs->structs[O->structs->num_structs]; - if (!slang_struct_construct(s)) - RETURN0; - O->structs->num_structs++; - if (!slang_struct_copy(s, *st)) - RETURN0; - } - - return 1; -} - - -/* invariant qualifer */ -#define TYPE_VARIANT 90 -#define TYPE_INVARIANT 91 - -static int -parse_type_variant(slang_parse_ctx * C, slang_type_variant *variant) -{ - GLuint invariant = *C->I++; - switch (invariant) { - case TYPE_VARIANT: - *variant = SLANG_VARIANT; - return 1; - case TYPE_INVARIANT: - *variant = SLANG_INVARIANT; - return 1; - default: - RETURN0; - } -} - - -/* centroid qualifer */ -#define TYPE_CENTER 95 -#define TYPE_CENTROID 96 - -static int -parse_type_centroid(slang_parse_ctx * C, slang_type_centroid *centroid) -{ - GLuint c = *C->I++; - switch (c) { - case TYPE_CENTER: - *centroid = SLANG_CENTER; - return 1; - case TYPE_CENTROID: - *centroid = SLANG_CENTROID; - return 1; - default: - RETURN0; - } -} - - -/* Layout qualifiers */ -#define LAYOUT_QUALIFIER_NONE 0 -#define LAYOUT_QUALIFIER_UPPER_LEFT 1 -#define LAYOUT_QUALIFIER_PIXEL_CENTER_INTEGER 2 - -static int -parse_layout_qualifiers(slang_parse_ctx * C, slang_layout_qualifier *layout) -{ - *layout = 0x0; - - /* the layout qualifiers come as a list of LAYOUT_QUALIFER_x tokens, - * terminated by LAYOUT_QUALIFIER_NONE. - */ - while (1) { - GLuint c = *C->I++; - switch (c) { - case LAYOUT_QUALIFIER_NONE: - /* end of list of qualifiers */ - return 1; - case LAYOUT_QUALIFIER_UPPER_LEFT: - *layout |= SLANG_LAYOUT_UPPER_LEFT_BIT; - break; - case LAYOUT_QUALIFIER_PIXEL_CENTER_INTEGER: - *layout |= SLANG_LAYOUT_PIXEL_CENTER_INTEGER_BIT; - break; - default: - assert(0 && "Bad layout qualifier"); - } - } -} - - -/* type qualifier */ -#define TYPE_QUALIFIER_NONE 0 -#define TYPE_QUALIFIER_CONST 1 -#define TYPE_QUALIFIER_ATTRIBUTE 2 -#define TYPE_QUALIFIER_VARYING 3 -#define TYPE_QUALIFIER_UNIFORM 4 -#define TYPE_QUALIFIER_FIXEDOUTPUT 5 -#define TYPE_QUALIFIER_FIXEDINPUT 6 - -static int -parse_type_qualifier(slang_parse_ctx * C, slang_type_qualifier * qual) -{ - GLuint qualifier = *C->I++; - switch (qualifier) { - case TYPE_QUALIFIER_NONE: - *qual = SLANG_QUAL_NONE; - break; - case TYPE_QUALIFIER_CONST: - *qual = SLANG_QUAL_CONST; - break; - case TYPE_QUALIFIER_ATTRIBUTE: - *qual = SLANG_QUAL_ATTRIBUTE; - break; - case TYPE_QUALIFIER_VARYING: - *qual = SLANG_QUAL_VARYING; - break; - case TYPE_QUALIFIER_UNIFORM: - *qual = SLANG_QUAL_UNIFORM; - break; - case TYPE_QUALIFIER_FIXEDOUTPUT: - *qual = SLANG_QUAL_FIXEDOUTPUT; - break; - case TYPE_QUALIFIER_FIXEDINPUT: - *qual = SLANG_QUAL_FIXEDINPUT; - break; - default: - RETURN0; - } - return 1; -} - -/* type specifier */ -#define TYPE_SPECIFIER_VOID 0 -#define TYPE_SPECIFIER_BOOL 1 -#define TYPE_SPECIFIER_BVEC2 2 -#define TYPE_SPECIFIER_BVEC3 3 -#define TYPE_SPECIFIER_BVEC4 4 -#define TYPE_SPECIFIER_INT 5 -#define TYPE_SPECIFIER_IVEC2 6 -#define TYPE_SPECIFIER_IVEC3 7 -#define TYPE_SPECIFIER_IVEC4 8 -#define TYPE_SPECIFIER_FLOAT 9 -#define TYPE_SPECIFIER_VEC2 10 -#define TYPE_SPECIFIER_VEC3 11 -#define TYPE_SPECIFIER_VEC4 12 -#define TYPE_SPECIFIER_MAT2 13 -#define TYPE_SPECIFIER_MAT3 14 -#define TYPE_SPECIFIER_MAT4 15 -#define TYPE_SPECIFIER_SAMPLER1D 16 -#define TYPE_SPECIFIER_SAMPLER2D 17 -#define TYPE_SPECIFIER_SAMPLER3D 18 -#define TYPE_SPECIFIER_SAMPLERCUBE 19 -#define TYPE_SPECIFIER_SAMPLER1DSHADOW 20 -#define TYPE_SPECIFIER_SAMPLER2DSHADOW 21 -#define TYPE_SPECIFIER_SAMPLER2DRECT 22 -#define TYPE_SPECIFIER_SAMPLER2DRECTSHADOW 23 -#define TYPE_SPECIFIER_STRUCT 24 -#define TYPE_SPECIFIER_TYPENAME 25 -#define TYPE_SPECIFIER_MAT23 26 -#define TYPE_SPECIFIER_MAT32 27 -#define TYPE_SPECIFIER_MAT24 28 -#define TYPE_SPECIFIER_MAT42 29 -#define TYPE_SPECIFIER_MAT34 30 -#define TYPE_SPECIFIER_MAT43 31 -#define TYPE_SPECIFIER_SAMPLER_1D_ARRAY 32 -#define TYPE_SPECIFIER_SAMPLER_2D_ARRAY 33 -#define TYPE_SPECIFIER_SAMPLER_1D_ARRAY_SHADOW 34 -#define TYPE_SPECIFIER_SAMPLER_2D_ARRAY_SHADOW 35 -#define TYPE_SPECIFIER_COUNT 36 - -static int -parse_type_specifier(slang_parse_ctx * C, slang_output_ctx * O, - slang_type_specifier * spec) -{ - int type = *C->I++; - switch (type) { - case TYPE_SPECIFIER_VOID: - spec->type = SLANG_SPEC_VOID; - break; - case TYPE_SPECIFIER_BOOL: - spec->type = SLANG_SPEC_BOOL; - break; - case TYPE_SPECIFIER_BVEC2: - spec->type = SLANG_SPEC_BVEC2; - break; - case TYPE_SPECIFIER_BVEC3: - spec->type = SLANG_SPEC_BVEC3; - break; - case TYPE_SPECIFIER_BVEC4: - spec->type = SLANG_SPEC_BVEC4; - break; - case TYPE_SPECIFIER_INT: - spec->type = SLANG_SPEC_INT; - break; - case TYPE_SPECIFIER_IVEC2: - spec->type = SLANG_SPEC_IVEC2; - break; - case TYPE_SPECIFIER_IVEC3: - spec->type = SLANG_SPEC_IVEC3; - break; - case TYPE_SPECIFIER_IVEC4: - spec->type = SLANG_SPEC_IVEC4; - break; - case TYPE_SPECIFIER_FLOAT: - spec->type = SLANG_SPEC_FLOAT; - break; - case TYPE_SPECIFIER_VEC2: - spec->type = SLANG_SPEC_VEC2; - break; - case TYPE_SPECIFIER_VEC3: - spec->type = SLANG_SPEC_VEC3; - break; - case TYPE_SPECIFIER_VEC4: - spec->type = SLANG_SPEC_VEC4; - break; - case TYPE_SPECIFIER_MAT2: - spec->type = SLANG_SPEC_MAT2; - break; - case TYPE_SPECIFIER_MAT3: - spec->type = SLANG_SPEC_MAT3; - break; - case TYPE_SPECIFIER_MAT4: - spec->type = SLANG_SPEC_MAT4; - break; - case TYPE_SPECIFIER_MAT23: - spec->type = SLANG_SPEC_MAT23; - break; - case TYPE_SPECIFIER_MAT32: - spec->type = SLANG_SPEC_MAT32; - break; - case TYPE_SPECIFIER_MAT24: - spec->type = SLANG_SPEC_MAT24; - break; - case TYPE_SPECIFIER_MAT42: - spec->type = SLANG_SPEC_MAT42; - break; - case TYPE_SPECIFIER_MAT34: - spec->type = SLANG_SPEC_MAT34; - break; - case TYPE_SPECIFIER_MAT43: - spec->type = SLANG_SPEC_MAT43; - break; - case TYPE_SPECIFIER_SAMPLER1D: - spec->type = SLANG_SPEC_SAMPLER_1D; - break; - case TYPE_SPECIFIER_SAMPLER2D: - spec->type = SLANG_SPEC_SAMPLER_2D; - break; - case TYPE_SPECIFIER_SAMPLER3D: - spec->type = SLANG_SPEC_SAMPLER_3D; - break; - case TYPE_SPECIFIER_SAMPLERCUBE: - spec->type = SLANG_SPEC_SAMPLER_CUBE; - break; - case TYPE_SPECIFIER_SAMPLER2DRECT: - spec->type = SLANG_SPEC_SAMPLER_RECT; - break; - case TYPE_SPECIFIER_SAMPLER1DSHADOW: - spec->type = SLANG_SPEC_SAMPLER_1D_SHADOW; - break; - case TYPE_SPECIFIER_SAMPLER2DSHADOW: - spec->type = SLANG_SPEC_SAMPLER_2D_SHADOW; - break; - case TYPE_SPECIFIER_SAMPLER2DRECTSHADOW: - spec->type = SLANG_SPEC_SAMPLER_RECT_SHADOW; - break; - case TYPE_SPECIFIER_SAMPLER_1D_ARRAY: - spec->type = SLANG_SPEC_SAMPLER_1D_ARRAY; - break; - case TYPE_SPECIFIER_SAMPLER_2D_ARRAY: - spec->type = SLANG_SPEC_SAMPLER_2D_ARRAY; - break; - case TYPE_SPECIFIER_SAMPLER_1D_ARRAY_SHADOW: - spec->type = SLANG_SPEC_SAMPLER_1D_ARRAY_SHADOW; - break; - case TYPE_SPECIFIER_SAMPLER_2D_ARRAY_SHADOW: - spec->type = SLANG_SPEC_SAMPLER_2D_ARRAY_SHADOW; - break; - case TYPE_SPECIFIER_STRUCT: - spec->type = SLANG_SPEC_STRUCT; - if (!parse_struct(C, O, &spec->_struct)) - RETURN0; - break; - case TYPE_SPECIFIER_TYPENAME: - spec->type = SLANG_SPEC_STRUCT; - { - slang_atom a_name; - slang_struct *stru; - - a_name = parse_identifier(C); - if (a_name == NULL) - RETURN0; - - stru = slang_struct_scope_find(O->structs, a_name, 1); - if (stru == NULL) { - slang_info_log_error(C->L, "undeclared type name '%s'", - slang_atom_pool_id(C->atoms, a_name)); - RETURN0; - } - - spec->_struct = (slang_struct *) _slang_alloc(sizeof(slang_struct)); - if (spec->_struct == NULL) { - slang_info_log_memory(C->L); - RETURN0; - } - if (!slang_struct_construct(spec->_struct)) { - _slang_free(spec->_struct); - spec->_struct = NULL; - RETURN0; - } - if (!slang_struct_copy(spec->_struct, stru)) - RETURN0; - } - break; - default: - RETURN0; - } - return 1; -} - -#define TYPE_SPECIFIER_NONARRAY 0 -#define TYPE_SPECIFIER_ARRAY 1 - -static int -parse_type_array_size(slang_parse_ctx *C, - slang_output_ctx *O, - GLint *array_len) -{ - GLuint size; - - switch (*C->I++) { - case TYPE_SPECIFIER_NONARRAY: - *array_len = -1; /* -1 = not an array */ - break; - case TYPE_SPECIFIER_ARRAY: - if (!parse_array_len(C, O, &size)) - RETURN0; - *array_len = (GLint) size; - break; - default: - assert(0); - RETURN0; - } - return 1; -} - -#define PRECISION_DEFAULT 0 -#define PRECISION_LOW 1 -#define PRECISION_MEDIUM 2 -#define PRECISION_HIGH 3 - -static int -parse_type_precision(slang_parse_ctx *C, - slang_type_precision *precision) -{ - GLint prec = *C->I++; - switch (prec) { - case PRECISION_DEFAULT: - *precision = SLANG_PREC_DEFAULT; - return 1; - case PRECISION_LOW: - *precision = SLANG_PREC_LOW; - return 1; - case PRECISION_MEDIUM: - *precision = SLANG_PREC_MEDIUM; - return 1; - case PRECISION_HIGH: - *precision = SLANG_PREC_HIGH; - return 1; - default: - RETURN0; - } -} - - -/* parameter qualifier */ -#define PARAM_QUALIFIER_IN 0 -#define PARAM_QUALIFIER_OUT 1 -#define PARAM_QUALIFIER_INOUT 2 -#define PARAM_QUALIFIER_NONE 3 -static int -parse_varying_qualifier(slang_parse_ctx * C, slang_fully_specified_type *type) -{ - int param_qual = *C->I++; - - if (type->qualifier != SLANG_QUAL_VARYING && - param_qual != PARAM_QUALIFIER_NONE) { - slang_info_log_error(C->L, "Invalid type qualifier."); - RETURN0; - } - switch (param_qual) { - case PARAM_QUALIFIER_IN: - case PARAM_QUALIFIER_NONE: - type->varying_kind = SLANG_VARYING_IN; - break; - case PARAM_QUALIFIER_OUT: - type->varying_kind = SLANG_VARYING_OUT; - break; - case PARAM_QUALIFIER_INOUT: - slang_info_log_error(C->L, "Invalid type qualifier."); - RETURN0; - break; - default: - RETURN0; - } - return 1; -} - -static int -parse_fully_specified_type(slang_parse_ctx * C, slang_output_ctx * O, - slang_fully_specified_type * type) -{ - if (!parse_layout_qualifiers(C, &type->layout)) - RETURN0; - - if (!parse_type_variant(C, &type->variant)) - RETURN0; - - if (!parse_type_centroid(C, &type->centroid)) - RETURN0; - - if (!parse_type_qualifier(C, &type->qualifier)) - RETURN0; - - if (!parse_varying_qualifier(C, type)) - RETURN0; - - if (!parse_type_precision(C, &type->precision)) - RETURN0; - - if (!parse_type_specifier(C, O, &type->specifier)) - RETURN0; - - if (!parse_type_array_size(C, O, &type->array_len)) - RETURN0; - - if (!O->allow_invariant && type->variant == SLANG_INVARIANT) { - slang_info_log_error(C->L, - "'invariant' keyword not allowed (perhaps set #version 120)"); - RETURN0; - } - - if (!O->allow_centroid && type->centroid == SLANG_CENTROID) { - slang_info_log_error(C->L, - "'centroid' keyword not allowed (perhaps set #version 120)"); - RETURN0; - } - else if (type->centroid == SLANG_CENTROID && - type->qualifier != SLANG_QUAL_VARYING) { - slang_info_log_error(C->L, - "'centroid' keyword only allowed for varying vars"); - RETURN0; - } - - - /* need this? - if (type->qualifier != SLANG_QUAL_VARYING && - type->variant == SLANG_INVARIANT) { - slang_info_log_error(C->L, - "invariant qualifer only allowed for varying vars"); - RETURN0; - } - */ - - if (O->allow_precision) { - if (type->precision == SLANG_PREC_DEFAULT) { - assert(type->specifier.type < TYPE_SPECIFIER_COUNT); - /* use the default precision for this datatype */ - type->precision = O->default_precision[type->specifier.type]; - } - } - else { - /* only default is allowed */ - if (type->precision != SLANG_PREC_DEFAULT) { - slang_info_log_error(C->L, "precision qualifiers not allowed"); - RETURN0; - } - } - - if (!O->allow_array_types && type->array_len >= 0) { - slang_info_log_error(C->L, "first-class array types not allowed"); - RETURN0; - } - - if (type->array_len >= 0) { - /* convert type to array type (ex: convert "int" to "array of int" */ - promote_type_to_array(C, type, type->array_len); - } - - return 1; -} - -/* operation */ -#define OP_END 0 -#define OP_BLOCK_BEGIN_NO_NEW_SCOPE 1 -#define OP_BLOCK_BEGIN_NEW_SCOPE 2 -#define OP_DECLARE 3 -#define OP_ASM 4 -#define OP_BREAK 5 -#define OP_CONTINUE 6 -#define OP_DISCARD 7 -#define OP_RETURN 8 -#define OP_EXPRESSION 9 -#define OP_IF 10 -#define OP_WHILE 11 -#define OP_DO 12 -#define OP_FOR 13 -#define OP_PUSH_VOID 14 -#define OP_PUSH_BOOL 15 -#define OP_PUSH_INT 16 -#define OP_PUSH_FLOAT 17 -#define OP_PUSH_IDENTIFIER 18 -#define OP_SEQUENCE 19 -#define OP_ASSIGN 20 -#define OP_ADDASSIGN 21 -#define OP_SUBASSIGN 22 -#define OP_MULASSIGN 23 -#define OP_DIVASSIGN 24 -/*#define OP_MODASSIGN 25*/ -/*#define OP_LSHASSIGN 26*/ -/*#define OP_RSHASSIGN 27*/ -/*#define OP_ORASSIGN 28*/ -/*#define OP_XORASSIGN 29*/ -/*#define OP_ANDASSIGN 30*/ -#define OP_SELECT 31 -#define OP_LOGICALOR 32 -#define OP_LOGICALXOR 33 -#define OP_LOGICALAND 34 -/*#define OP_BITOR 35*/ -/*#define OP_BITXOR 36*/ -/*#define OP_BITAND 37*/ -#define OP_EQUAL 38 -#define OP_NOTEQUAL 39 -#define OP_LESS 40 -#define OP_GREATER 41 -#define OP_LESSEQUAL 42 -#define OP_GREATEREQUAL 43 -/*#define OP_LSHIFT 44*/ -/*#define OP_RSHIFT 45*/ -#define OP_ADD 46 -#define OP_SUBTRACT 47 -#define OP_MULTIPLY 48 -#define OP_DIVIDE 49 -/*#define OP_MODULUS 50*/ -#define OP_PREINCREMENT 51 -#define OP_PREDECREMENT 52 -#define OP_PLUS 53 -#define OP_MINUS 54 -/*#define OP_COMPLEMENT 55*/ -#define OP_NOT 56 -#define OP_SUBSCRIPT 57 -#define OP_CALL 58 -#define OP_FIELD 59 -#define OP_POSTINCREMENT 60 -#define OP_POSTDECREMENT 61 -#define OP_PRECISION 62 -#define OP_METHOD 63 - - -/** - * When parsing a compound production, this function is used to parse the - * children. - * For example, a while-loop compound will have two children, the - * while condition expression and the loop body. So, this function will - * be called twice to parse those two sub-expressions. - * \param C the parsing context - * \param O the output context - * \param oper the operation we're parsing - * \param statement indicates whether parsing a statement, or expression - * \return 1 if success, 0 if error - */ -static int -parse_child_operation(slang_parse_ctx * C, slang_output_ctx * O, - slang_operation * oper, GLboolean statement) -{ - slang_operation *ch; - - /* grow child array */ - ch = slang_operation_grow(&oper->num_children, &oper->children); - if (statement) - return parse_statement(C, O, ch); - return parse_expression(C, O, ch); -} - -static int parse_declaration(slang_parse_ctx * C, slang_output_ctx * O); - -static int -parse_statement(slang_parse_ctx * C, slang_output_ctx * O, - slang_operation * oper) -{ - int op; - - oper->locals->outer_scope = O->vars; - - op = *C->I++; - switch (op) { - case OP_BLOCK_BEGIN_NO_NEW_SCOPE: - /* parse child statements, do not create new variable scope */ - oper->type = SLANG_OPER_BLOCK_NO_NEW_SCOPE; - while (*C->I != OP_END) - if (!parse_child_operation(C, O, oper, GL_TRUE)) - RETURN0; - C->I++; - break; - case OP_BLOCK_BEGIN_NEW_SCOPE: - /* parse child statements, create new variable scope */ - { - slang_output_ctx o = *O; - - oper->type = SLANG_OPER_BLOCK_NEW_SCOPE; - o.vars = oper->locals; - while (*C->I != OP_END) - if (!parse_child_operation(C, &o, oper, GL_TRUE)) - RETURN0; - C->I++; - } - break; - case OP_DECLARE: - /* local variable declaration, individual declarators are stored as - * children identifiers - */ - oper->type = SLANG_OPER_BLOCK_NO_NEW_SCOPE; - { - const unsigned int first_var = O->vars->num_variables; - - /* parse the declaration, note that there can be zero or more - * than one declarators - */ - if (!parse_declaration(C, O)) - RETURN0; - if (first_var < O->vars->num_variables) { - const unsigned int num_vars = O->vars->num_variables - first_var; - unsigned int i; - assert(oper->num_children == 0); - oper->num_children = num_vars; - oper->children = slang_operation_new(num_vars); - if (oper->children == NULL) { - slang_info_log_memory(C->L); - RETURN0; - } - for (i = first_var; i < O->vars->num_variables; i++) { - slang_operation *o = &oper->children[i - first_var]; - slang_variable *var = O->vars->variables[i]; - o->type = SLANG_OPER_VARIABLE_DECL; - o->locals->outer_scope = O->vars; - o->a_id = var->a_name; - - /* new/someday... - calculate_var_size(C, O, var); - */ - - if (!legal_identifier(o->a_id)) { - slang_info_log_error(C->L, "illegal variable name '%s'", - (char *) o->a_id); - RETURN0; - } - } - } - } - break; - case OP_ASM: - /* the __asm statement, parse the mnemonic and all its arguments - * as expressions - */ - oper->type = SLANG_OPER_ASM; - oper->a_id = parse_identifier(C); - if (oper->a_id == SLANG_ATOM_NULL) - RETURN0; - while (*C->I != OP_END) { - if (!parse_child_operation(C, O, oper, GL_FALSE)) - RETURN0; - } - C->I++; - break; - case OP_BREAK: - oper->type = SLANG_OPER_BREAK; - break; - case OP_CONTINUE: - oper->type = SLANG_OPER_CONTINUE; - break; - case OP_DISCARD: - oper->type = SLANG_OPER_DISCARD; - break; - case OP_RETURN: - oper->type = SLANG_OPER_RETURN; - if (!parse_child_operation(C, O, oper, GL_FALSE)) - RETURN0; - break; - case OP_EXPRESSION: - oper->type = SLANG_OPER_EXPRESSION; - if (!parse_child_operation(C, O, oper, GL_FALSE)) - RETURN0; - break; - case OP_IF: - oper->type = SLANG_OPER_IF; - if (!parse_child_operation(C, O, oper, GL_FALSE)) - RETURN0; - if (!parse_child_operation(C, O, oper, GL_TRUE)) - RETURN0; - if (!parse_child_operation(C, O, oper, GL_TRUE)) - RETURN0; - break; - case OP_WHILE: - { - slang_output_ctx o = *O; - - oper->type = SLANG_OPER_WHILE; - o.vars = oper->locals; - if (!parse_child_operation(C, &o, oper, GL_TRUE)) - RETURN0; - if (!parse_child_operation(C, &o, oper, GL_TRUE)) - RETURN0; - } - break; - case OP_DO: - oper->type = SLANG_OPER_DO; - if (!parse_child_operation(C, O, oper, GL_TRUE)) - RETURN0; - if (!parse_child_operation(C, O, oper, GL_FALSE)) - RETURN0; - break; - case OP_FOR: - { - slang_output_ctx o = *O; - - oper->type = SLANG_OPER_FOR; - o.vars = oper->locals; - if (!parse_child_operation(C, &o, oper, GL_TRUE)) - RETURN0; - if (!parse_child_operation(C, &o, oper, GL_TRUE)) - RETURN0; - if (!parse_child_operation(C, &o, oper, GL_FALSE)) - RETURN0; - if (!parse_child_operation(C, &o, oper, GL_TRUE)) - RETURN0; - } - break; - case OP_PRECISION: - { - /* set default precision for a type in this scope */ - /* ignored at this time */ - int prec_qual = *C->I++; - int datatype = *C->I++; - (void) prec_qual; - (void) datatype; - } - break; - default: - /*printf("Unexpected operation %d\n", op);*/ - RETURN0; - } - return 1; -} - -static int -handle_nary_expression(slang_parse_ctx * C, slang_operation * op, - slang_operation ** ops, unsigned int *total_ops, - unsigned int n) -{ - unsigned int i; - - op->children = slang_operation_new(n); - if (op->children == NULL) { - slang_info_log_memory(C->L); - RETURN0; - } - op->num_children = n; - - for (i = 0; i < n; i++) { - slang_operation_destruct(&op->children[i]); - op->children[i] = (*ops)[*total_ops - (n + 1 - i)]; - } - - (*ops)[*total_ops - (n + 1)] = (*ops)[*total_ops - 1]; - *total_ops -= n; - - *ops = (slang_operation *) - _slang_realloc(*ops, - (*total_ops + n) * sizeof(slang_operation), - *total_ops * sizeof(slang_operation)); - if (*ops == NULL) { - slang_info_log_memory(C->L); - RETURN0; - } - return 1; -} - -static int -is_constructor_name(const char *name, slang_atom a_name, - slang_struct_scope * structs) -{ - if (slang_type_specifier_type_from_string(name) != SLANG_SPEC_VOID) - return 1; - return slang_struct_scope_find(structs, a_name, 1) != NULL; -} - -#define FUNCTION_CALL_NONARRAY 0 -#define FUNCTION_CALL_ARRAY 1 - -static int -parse_expression(slang_parse_ctx * C, slang_output_ctx * O, - slang_operation * oper) -{ - slang_operation *ops = NULL; - unsigned int num_ops = 0; - int number; - - while (*C->I != OP_END) { - slang_operation *op; - const unsigned int op_code = *C->I++; - - /* allocate default operation, becomes a no-op if not used */ - ops = (slang_operation *) - _slang_realloc(ops, - num_ops * sizeof(slang_operation), - (num_ops + 1) * sizeof(slang_operation)); - if (ops == NULL) { - slang_info_log_memory(C->L); - RETURN0; - } - op = &ops[num_ops]; - if (!slang_operation_construct(op)) { - slang_info_log_memory(C->L); - RETURN0; - } - num_ops++; - op->locals->outer_scope = O->vars; - - switch (op_code) { - case OP_PUSH_VOID: - op->type = SLANG_OPER_VOID; - break; - case OP_PUSH_BOOL: - op->type = SLANG_OPER_LITERAL_BOOL; - if (!parse_number(C, &number)) - RETURN0; - op->literal[0] = - op->literal[1] = - op->literal[2] = - op->literal[3] = (GLfloat) number; - op->literal_size = 1; - break; - case OP_PUSH_INT: - op->type = SLANG_OPER_LITERAL_INT; - if (!parse_number(C, &number)) - RETURN0; - op->literal[0] = - op->literal[1] = - op->literal[2] = - op->literal[3] = (GLfloat) number; - op->literal_size = 1; - break; - case OP_PUSH_FLOAT: - op->type = SLANG_OPER_LITERAL_FLOAT; - if (!parse_float(C, &op->literal[0])) - RETURN0; - op->literal[1] = - op->literal[2] = - op->literal[3] = op->literal[0]; - op->literal_size = 1; - break; - case OP_PUSH_IDENTIFIER: - op->type = SLANG_OPER_IDENTIFIER; - op->a_id = parse_identifier(C); - if (op->a_id == SLANG_ATOM_NULL) - RETURN0; - break; - case OP_SEQUENCE: - op->type = SLANG_OPER_SEQUENCE; - if (!handle_nary_expression(C, op, &ops, &num_ops, 2)) - RETURN0; - break; - case OP_ASSIGN: - op->type = SLANG_OPER_ASSIGN; - if (!handle_nary_expression(C, op, &ops, &num_ops, 2)) - RETURN0; - break; - case OP_ADDASSIGN: - op->type = SLANG_OPER_ADDASSIGN; - if (!handle_nary_expression(C, op, &ops, &num_ops, 2)) - RETURN0; - break; - case OP_SUBASSIGN: - op->type = SLANG_OPER_SUBASSIGN; - if (!handle_nary_expression(C, op, &ops, &num_ops, 2)) - RETURN0; - break; - case OP_MULASSIGN: - op->type = SLANG_OPER_MULASSIGN; - if (!handle_nary_expression(C, op, &ops, &num_ops, 2)) - RETURN0; - break; - case OP_DIVASSIGN: - op->type = SLANG_OPER_DIVASSIGN; - if (!handle_nary_expression(C, op, &ops, &num_ops, 2)) - RETURN0; - break; - /*case OP_MODASSIGN: */ - /*case OP_LSHASSIGN: */ - /*case OP_RSHASSIGN: */ - /*case OP_ORASSIGN: */ - /*case OP_XORASSIGN: */ - /*case OP_ANDASSIGN: */ - case OP_SELECT: - op->type = SLANG_OPER_SELECT; - if (!handle_nary_expression(C, op, &ops, &num_ops, 3)) - RETURN0; - break; - case OP_LOGICALOR: - op->type = SLANG_OPER_LOGICALOR; - if (!handle_nary_expression(C, op, &ops, &num_ops, 2)) - RETURN0; - break; - case OP_LOGICALXOR: - op->type = SLANG_OPER_LOGICALXOR; - if (!handle_nary_expression(C, op, &ops, &num_ops, 2)) - RETURN0; - break; - case OP_LOGICALAND: - op->type = SLANG_OPER_LOGICALAND; - if (!handle_nary_expression(C, op, &ops, &num_ops, 2)) - RETURN0; - break; - /*case OP_BITOR: */ - /*case OP_BITXOR: */ - /*case OP_BITAND: */ - case OP_EQUAL: - op->type = SLANG_OPER_EQUAL; - if (!handle_nary_expression(C, op, &ops, &num_ops, 2)) - RETURN0; - break; - case OP_NOTEQUAL: - op->type = SLANG_OPER_NOTEQUAL; - if (!handle_nary_expression(C, op, &ops, &num_ops, 2)) - RETURN0; - break; - case OP_LESS: - op->type = SLANG_OPER_LESS; - if (!handle_nary_expression(C, op, &ops, &num_ops, 2)) - RETURN0; - break; - case OP_GREATER: - op->type = SLANG_OPER_GREATER; - if (!handle_nary_expression(C, op, &ops, &num_ops, 2)) - RETURN0; - break; - case OP_LESSEQUAL: - op->type = SLANG_OPER_LESSEQUAL; - if (!handle_nary_expression(C, op, &ops, &num_ops, 2)) - RETURN0; - break; - case OP_GREATEREQUAL: - op->type = SLANG_OPER_GREATEREQUAL; - if (!handle_nary_expression(C, op, &ops, &num_ops, 2)) - RETURN0; - break; - /*case OP_LSHIFT: */ - /*case OP_RSHIFT: */ - case OP_ADD: - op->type = SLANG_OPER_ADD; - if (!handle_nary_expression(C, op, &ops, &num_ops, 2)) - RETURN0; - break; - case OP_SUBTRACT: - op->type = SLANG_OPER_SUBTRACT; - if (!handle_nary_expression(C, op, &ops, &num_ops, 2)) - RETURN0; - break; - case OP_MULTIPLY: - op->type = SLANG_OPER_MULTIPLY; - if (!handle_nary_expression(C, op, &ops, &num_ops, 2)) - RETURN0; - break; - case OP_DIVIDE: - op->type = SLANG_OPER_DIVIDE; - if (!handle_nary_expression(C, op, &ops, &num_ops, 2)) - RETURN0; - break; - /*case OP_MODULUS: */ - case OP_PREINCREMENT: - op->type = SLANG_OPER_PREINCREMENT; - if (!handle_nary_expression(C, op, &ops, &num_ops, 1)) - RETURN0; - break; - case OP_PREDECREMENT: - op->type = SLANG_OPER_PREDECREMENT; - if (!handle_nary_expression(C, op, &ops, &num_ops, 1)) - RETURN0; - break; - case OP_PLUS: - op->type = SLANG_OPER_PLUS; - if (!handle_nary_expression(C, op, &ops, &num_ops, 1)) - RETURN0; - break; - case OP_MINUS: - op->type = SLANG_OPER_MINUS; - if (!handle_nary_expression(C, op, &ops, &num_ops, 1)) - RETURN0; - break; - case OP_NOT: - op->type = SLANG_OPER_NOT; - if (!handle_nary_expression(C, op, &ops, &num_ops, 1)) - RETURN0; - break; - /*case OP_COMPLEMENT: */ - case OP_SUBSCRIPT: - op->type = SLANG_OPER_SUBSCRIPT; - if (!handle_nary_expression(C, op, &ops, &num_ops, 2)) - RETURN0; - break; - case OP_METHOD: - op->type = SLANG_OPER_METHOD; - op->a_obj = parse_identifier(C); - if (op->a_obj == SLANG_ATOM_NULL) - RETURN0; - - op->a_id = parse_identifier(C); - if (op->a_id == SLANG_ATOM_NULL) - RETURN0; - - assert(*C->I == OP_END); - C->I++; - - while (*C->I != OP_END) - if (!parse_child_operation(C, O, op, GL_FALSE)) - RETURN0; - C->I++; -#if 0 - /* don't lookup the method (not yet anyway) */ - if (!C->parsing_builtin - && !slang_function_scope_find_by_name(O->funs, op->a_id, 1)) { - const char *id; - - id = slang_atom_pool_id(C->atoms, op->a_id); - if (!is_constructor_name(id, op->a_id, O->structs)) { - slang_info_log_error(C->L, "%s: undeclared function name.", id); - RETURN0; - } - } -#endif - break; - case OP_CALL: - { - GLboolean array_constructor = GL_FALSE; - GLint array_constructor_size = 0; - - op->type = SLANG_OPER_CALL; - op->a_id = parse_identifier(C); - if (op->a_id == SLANG_ATOM_NULL) - RETURN0; - switch (*C->I++) { - case FUNCTION_CALL_NONARRAY: - /* Nothing to do. */ - break; - case FUNCTION_CALL_ARRAY: - /* Calling an array constructor. For example: - * float[3](1.1, 2.2, 3.3); - */ - if (!O->allow_array_types) { - slang_info_log_error(C->L, - "array constructors not allowed " - "in this GLSL version"); - RETURN0; - } - else { - /* parse the array constructor size */ - slang_operation array_size; - array_constructor = GL_TRUE; - slang_operation_construct(&array_size); - if (!parse_expression(C, O, &array_size)) { - slang_operation_destruct(&array_size); - return GL_FALSE; - } - if (array_size.type != SLANG_OPER_LITERAL_INT) { - slang_info_log_error(C->L, - "constructor array size is not an integer"); - slang_operation_destruct(&array_size); - RETURN0; - } - array_constructor_size = (int) array_size.literal[0]; - op->array_constructor = GL_TRUE; - slang_operation_destruct(&array_size); - } - break; - default: - assert(0); - RETURN0; - } - while (*C->I != OP_END) - if (!parse_child_operation(C, O, op, GL_FALSE)) - RETURN0; - C->I++; - - if (array_constructor && - array_constructor_size != op->num_children) { - slang_info_log_error(C->L, "number of parameters to array" - " constructor does not match array size"); - RETURN0; - } - - if (!C->parsing_builtin - && !slang_function_scope_find_by_name(O->funs, op->a_id, 1)) { - const char *id; - - id = slang_atom_pool_id(C->atoms, op->a_id); - if (!is_constructor_name(id, op->a_id, O->structs)) { - slang_info_log_error(C->L, "%s: undeclared function name.", id); - RETURN0; - } - } - } - break; - case OP_FIELD: - op->type = SLANG_OPER_FIELD; - op->a_id = parse_identifier(C); - if (op->a_id == SLANG_ATOM_NULL) - RETURN0; - if (!handle_nary_expression(C, op, &ops, &num_ops, 1)) - RETURN0; - break; - case OP_POSTINCREMENT: - op->type = SLANG_OPER_POSTINCREMENT; - if (!handle_nary_expression(C, op, &ops, &num_ops, 1)) - RETURN0; - break; - case OP_POSTDECREMENT: - op->type = SLANG_OPER_POSTDECREMENT; - if (!handle_nary_expression(C, op, &ops, &num_ops, 1)) - RETURN0; - break; - default: - RETURN0; - } - } - C->I++; - - slang_operation_destruct(oper); - *oper = *ops; /* struct copy */ - _slang_free(ops); - - return 1; -} - -/* function parameter array presence */ -#define PARAMETER_ARRAY_NOT_PRESENT 0 -#define PARAMETER_ARRAY_PRESENT 1 - -static int -parse_parameter_declaration(slang_parse_ctx * C, slang_output_ctx * O, - slang_variable * param) -{ - int param_qual, precision_qual; - - /* parse and validate the parameter's type qualifiers (there can be - * two at most) because not all combinations are valid - */ - if (!parse_type_qualifier(C, ¶m->type.qualifier)) - RETURN0; - - param_qual = *C->I++; - switch (param_qual) { - case PARAM_QUALIFIER_IN: - if (param->type.qualifier != SLANG_QUAL_CONST - && param->type.qualifier != SLANG_QUAL_NONE) { - slang_info_log_error(C->L, "Invalid type qualifier."); - RETURN0; - } - break; - case PARAM_QUALIFIER_OUT: - if (param->type.qualifier == SLANG_QUAL_NONE) - param->type.qualifier = SLANG_QUAL_OUT; - else { - slang_info_log_error(C->L, "Invalid type qualifier."); - RETURN0; - } - break; - case PARAM_QUALIFIER_INOUT: - if (param->type.qualifier == SLANG_QUAL_NONE) - param->type.qualifier = SLANG_QUAL_INOUT; - else { - slang_info_log_error(C->L, "Invalid type qualifier."); - RETURN0; - } - break; - case PARAM_QUALIFIER_NONE: - /* like IN but doesn't throw error */ - break; - default: - RETURN0; - } - - /* parse precision qualifier (lowp, mediump, highp */ - precision_qual = *C->I++; - /* ignored at this time */ - (void) precision_qual; - - /* parse parameter's type specifier and name */ - if (!parse_type_specifier(C, O, ¶m->type.specifier)) - RETURN0; - if (!parse_type_array_size(C, O, ¶m->type.array_len)) - RETURN0; - param->a_name = parse_identifier(C); - if (param->a_name == SLANG_ATOM_NULL) - RETURN0; - - /* first-class array - */ - if (param->type.array_len >= 0) { - slang_type_specifier p; - - slang_type_specifier_ctr(&p); - if (!slang_type_specifier_copy(&p, ¶m->type.specifier)) { - slang_type_specifier_dtr(&p); - RETURN0; - } - if (!convert_to_array(C, param, &p)) { - slang_type_specifier_dtr(&p); - RETURN0; - } - slang_type_specifier_dtr(&p); - param->array_len = param->type.array_len; - } - - /* if the parameter is an array, parse its size (the size must be - * explicitly defined - */ - if (*C->I++ == PARAMETER_ARRAY_PRESENT) { - slang_type_specifier p; - - if (param->type.array_len >= 0) { - slang_info_log_error(C->L, "multi-dimensional arrays not allowed"); - RETURN0; - } - slang_type_specifier_ctr(&p); - if (!slang_type_specifier_copy(&p, ¶m->type.specifier)) { - slang_type_specifier_dtr(&p); - RETURN0; - } - if (!convert_to_array(C, param, &p)) { - slang_type_specifier_dtr(&p); - RETURN0; - } - slang_type_specifier_dtr(&p); - if (!parse_array_len(C, O, ¶m->array_len)) - RETURN0; - } - -#if 0 - /* calculate the parameter size */ - if (!calculate_var_size(C, O, param)) - RETURN0; -#endif - /* TODO: allocate the local address here? */ - return 1; -} - -/* function type */ -#define FUNCTION_ORDINARY 0 -#define FUNCTION_CONSTRUCTOR 1 -#define FUNCTION_OPERATOR 2 - -/* function parameter */ -#define PARAMETER_NONE 0 -#define PARAMETER_NEXT 1 - -/* operator type */ -#define OPERATOR_ADDASSIGN 1 -#define OPERATOR_SUBASSIGN 2 -#define OPERATOR_MULASSIGN 3 -#define OPERATOR_DIVASSIGN 4 -/*#define OPERATOR_MODASSIGN 5*/ -/*#define OPERATOR_LSHASSIGN 6*/ -/*#define OPERATOR_RSHASSIGN 7*/ -/*#define OPERATOR_ANDASSIGN 8*/ -/*#define OPERATOR_XORASSIGN 9*/ -/*#define OPERATOR_ORASSIGN 10*/ -#define OPERATOR_LOGICALXOR 11 -/*#define OPERATOR_BITOR 12*/ -/*#define OPERATOR_BITXOR 13*/ -/*#define OPERATOR_BITAND 14*/ -#define OPERATOR_LESS 15 -#define OPERATOR_GREATER 16 -#define OPERATOR_LESSEQUAL 17 -#define OPERATOR_GREATEREQUAL 18 -/*#define OPERATOR_LSHIFT 19*/ -/*#define OPERATOR_RSHIFT 20*/ -#define OPERATOR_MULTIPLY 21 -#define OPERATOR_DIVIDE 22 -/*#define OPERATOR_MODULUS 23*/ -#define OPERATOR_INCREMENT 24 -#define OPERATOR_DECREMENT 25 -#define OPERATOR_PLUS 26 -#define OPERATOR_MINUS 27 -/*#define OPERATOR_COMPLEMENT 28*/ -#define OPERATOR_NOT 29 - -static const struct -{ - unsigned int o_code; - const char *o_name; -} operator_names[] = { - {OPERATOR_INCREMENT, "++"}, - {OPERATOR_ADDASSIGN, "+="}, - {OPERATOR_PLUS, "+"}, - {OPERATOR_DECREMENT, "--"}, - {OPERATOR_SUBASSIGN, "-="}, - {OPERATOR_MINUS, "-"}, - {OPERATOR_NOT, "!"}, - {OPERATOR_MULASSIGN, "*="}, - {OPERATOR_MULTIPLY, "*"}, - {OPERATOR_DIVASSIGN, "/="}, - {OPERATOR_DIVIDE, "/"}, - {OPERATOR_LESSEQUAL, "<="}, - /*{ OPERATOR_LSHASSIGN, "<<=" }, */ - /*{ OPERATOR_LSHIFT, "<<" }, */ - {OPERATOR_LESS, "<"}, - {OPERATOR_GREATEREQUAL, ">="}, - /*{ OPERATOR_RSHASSIGN, ">>=" }, */ - /*{ OPERATOR_RSHIFT, ">>" }, */ - {OPERATOR_GREATER, ">"}, - /*{ OPERATOR_MODASSIGN, "%=" }, */ - /*{ OPERATOR_MODULUS, "%" }, */ - /*{ OPERATOR_ANDASSIGN, "&=" }, */ - /*{ OPERATOR_BITAND, "&" }, */ - /*{ OPERATOR_ORASSIGN, "|=" }, */ - /*{ OPERATOR_BITOR, "|" }, */ - /*{ OPERATOR_COMPLEMENT, "~" }, */ - /*{ OPERATOR_XORASSIGN, "^=" }, */ - {OPERATOR_LOGICALXOR, "^^"}, - /*{ OPERATOR_BITXOR, "^" } */ -}; - -static slang_atom -parse_operator_name(slang_parse_ctx * C) -{ - unsigned int i; - - for (i = 0; i < sizeof(operator_names) / sizeof(*operator_names); i++) { - if (operator_names[i].o_code == (unsigned int) (*C->I)) { - slang_atom atom = - slang_atom_pool_atom(C->atoms, operator_names[i].o_name); - if (atom == SLANG_ATOM_NULL) { - slang_info_log_memory(C->L); - RETURN0; - } - C->I++; - return atom; - } - } - RETURN0; -} - - -static int -parse_function_prototype(slang_parse_ctx * C, slang_output_ctx * O, - slang_function * func) -{ - GLuint functype; - /* parse function type and name */ - if (!parse_fully_specified_type(C, O, &func->header.type)) - RETURN0; - - functype = *C->I++; - switch (functype) { - case FUNCTION_ORDINARY: - func->kind = SLANG_FUNC_ORDINARY; - func->header.a_name = parse_identifier(C); - if (func->header.a_name == SLANG_ATOM_NULL) - RETURN0; - break; - case FUNCTION_CONSTRUCTOR: - func->kind = SLANG_FUNC_CONSTRUCTOR; - if (func->header.type.specifier.type == SLANG_SPEC_STRUCT) - RETURN0; - func->header.a_name = - slang_atom_pool_atom(C->atoms, - slang_type_specifier_type_to_string - (func->header.type.specifier.type)); - if (func->header.a_name == SLANG_ATOM_NULL) { - slang_info_log_memory(C->L); - RETURN0; - } - break; - case FUNCTION_OPERATOR: - func->kind = SLANG_FUNC_OPERATOR; - func->header.a_name = parse_operator_name(C); - if (func->header.a_name == SLANG_ATOM_NULL) - RETURN0; - break; - default: - RETURN0; - } - - if (!legal_identifier(func->header.a_name)) { - slang_info_log_error(C->L, "illegal function name '%s'", - (char *) func->header.a_name); - RETURN0; - } - - /* parse function parameters */ - while (*C->I++ == PARAMETER_NEXT) { - slang_variable *p = slang_variable_scope_grow(func->parameters); - if (!p) { - slang_info_log_memory(C->L); - RETURN0; - } - if (!parse_parameter_declaration(C, O, p)) - RETURN0; - } - - /* if the function returns a value, append a hidden __retVal 'out' - * parameter that corresponds to the return value. - */ - if (_slang_function_has_return_value(func)) { - slang_variable *p = slang_variable_scope_grow(func->parameters); - slang_atom a_retVal = slang_atom_pool_atom(C->atoms, "__retVal"); - assert(a_retVal); - p->a_name = a_retVal; - p->type = func->header.type; - p->type.qualifier = SLANG_QUAL_OUT; - } - - /* function formal parameters and local variables share the same - * scope, so save the information about param count in a seperate - * place also link the scope to the global variable scope so when a - * given identifier is not found here, the search process continues - * in the global space - */ - func->param_count = func->parameters->num_variables; - func->parameters->outer_scope = O->vars; - - return 1; -} - -static int -parse_function_definition(slang_parse_ctx * C, slang_output_ctx * O, - slang_function * func) -{ - slang_output_ctx o = *O; - - if (!parse_function_prototype(C, O, func)) - RETURN0; - - /* create function's body operation */ - func->body = (slang_operation *) _slang_alloc(sizeof(slang_operation)); - if (func->body == NULL) { - slang_info_log_memory(C->L); - RETURN0; - } - if (!slang_operation_construct(func->body)) { - _slang_free(func->body); - func->body = NULL; - slang_info_log_memory(C->L); - RETURN0; - } - - /* to parse the body the parse context is modified in order to - * capture parsed variables into function's local variable scope - */ - C->global_scope = GL_FALSE; - o.vars = func->parameters; - if (!parse_statement(C, &o, func->body)) - RETURN0; - - C->global_scope = GL_TRUE; - return 1; -} - -static GLboolean -initialize_global(slang_assemble_ctx * A, slang_variable * var) -{ - slang_operation op_id, op_assign; - GLboolean result; - - /* construct the left side of assignment */ - if (!slang_operation_construct(&op_id)) - return GL_FALSE; - op_id.type = SLANG_OPER_IDENTIFIER; - op_id.a_id = var->a_name; - - /* put the variable into operation's scope */ - op_id.locals->variables = - (slang_variable **) _slang_alloc(sizeof(slang_variable *)); - if (op_id.locals->variables == NULL) { - slang_operation_destruct(&op_id); - return GL_FALSE; - } - op_id.locals->num_variables = 1; - op_id.locals->variables[0] = var; - - /* construct the assignment expression */ - if (!slang_operation_construct(&op_assign)) { - op_id.locals->num_variables = 0; - slang_operation_destruct(&op_id); - return GL_FALSE; - } - op_assign.type = SLANG_OPER_ASSIGN; - op_assign.children = - (slang_operation *) _slang_alloc(2 * sizeof(slang_operation)); - if (op_assign.children == NULL) { - slang_operation_destruct(&op_assign); - op_id.locals->num_variables = 0; - slang_operation_destruct(&op_id); - return GL_FALSE; - } - op_assign.num_children = 2; - op_assign.children[0] = op_id; - op_assign.children[1] = *var->initializer; - - result = 1; - - /* carefully destroy the operations */ - op_assign.num_children = 0; - _slang_free(op_assign.children); - op_assign.children = NULL; - slang_operation_destruct(&op_assign); - op_id.locals->num_variables = 0; - slang_operation_destruct(&op_id); - - if (!result) - return GL_FALSE; - - return GL_TRUE; -} - -/* init declarator list */ -#define DECLARATOR_NONE 0 -#define DECLARATOR_NEXT 1 - -/* variable declaration */ -#define VARIABLE_NONE 0 -#define VARIABLE_IDENTIFIER 1 -#define VARIABLE_INITIALIZER 2 -#define VARIABLE_ARRAY_EXPLICIT 3 -#define VARIABLE_ARRAY_UNKNOWN 4 - - -/** - * Check if it's OK to re-declare a variable with the given new type. - * This happens when applying layout qualifiers to gl_FragCoord or - * (re)setting an array size. - * If redeclaration is OK, return a pointer to the incoming variable - * updated with new type info. Else return NULL; - */ -static slang_variable * -redeclare_variable(slang_variable *var, - const slang_fully_specified_type *type) -{ - if (slang_fully_specified_types_compatible(&var->type, type)) { - /* replace orig var layout with new layout */ - var->type.layout = type->layout; - - /* XXX there may be other type updates in the future here */ - - return var; - } - else - return NULL; -} - - -/** - * Parse the initializer for a variable declaration. - */ -static int -parse_init_declarator(slang_parse_ctx * C, slang_output_ctx * O, - const slang_fully_specified_type * type) -{ - GET_CURRENT_CONTEXT(ctx); /* a hack */ - slang_variable *var = NULL, *prevDecl; - slang_atom a_name; - - /* empty init declatator (without name, e.g. "float ;") */ - if (*C->I++ == VARIABLE_NONE) - return 1; - - a_name = parse_identifier(C); - - /* check if name is already in this scope */ - prevDecl = _slang_variable_locate(O->vars, a_name, C->global_scope); - if (prevDecl) { - /* A var with this name has already been declared. - * Check if redeclaring the var with a different type/layout is legal. - */ - if (C->global_scope) { - var = redeclare_variable(prevDecl, type); - } - if (!var) { - slang_info_log_error(C->L, - "declaration of '%s' conflicts with previous declaration", - (char *) a_name); - RETURN0; - } - } - - if (!var) { - /* make room for a new variable and initialize it */ - var = slang_variable_scope_grow(O->vars); - if (!var) { - slang_info_log_memory(C->L); - RETURN0; - } - - /* copy the declarator type qualifier/etc info, parse the identifier */ - var->type.qualifier = type->qualifier; - var->type.centroid = type->centroid; - var->type.precision = type->precision; - var->type.specifier = type->specifier;/*new*/ - var->type.variant = type->variant; - var->type.layout = type->layout; - var->type.array_len = type->array_len; - var->type.varying_kind = type->varying_kind; - var->a_name = a_name; - if (var->a_name == SLANG_ATOM_NULL) - RETURN0; - } - - switch (*C->I++) { - case VARIABLE_NONE: - /* simple variable declarator - just copy the specifier */ - if (!slang_type_specifier_copy(&var->type.specifier, &type->specifier)) - RETURN0; - break; - case VARIABLE_INITIALIZER: - /* initialized variable - copy the specifier and parse the expression */ - if (0 && type->array_len >= 0) { - /* The type was something like "float[4]" */ - convert_to_array(C, var, &type->specifier); - var->array_len = type->array_len; - } - else { - if (!slang_type_specifier_copy(&var->type.specifier, &type->specifier)) - RETURN0; - } - var->initializer = - (slang_operation *) _slang_alloc(sizeof(slang_operation)); - if (var->initializer == NULL) { - slang_info_log_memory(C->L); - RETURN0; - } - if (!slang_operation_construct(var->initializer)) { - _slang_free(var->initializer); - var->initializer = NULL; - slang_info_log_memory(C->L); - RETURN0; - } - if (!parse_expression(C, O, var->initializer)) - RETURN0; - break; - case VARIABLE_ARRAY_UNKNOWN: - /* unsized array - mark it as array and copy the specifier to - * the array element - */ - if (type->array_len >= 0) { - slang_info_log_error(C->L, "multi-dimensional arrays not allowed"); - RETURN0; - } - if (!convert_to_array(C, var, &type->specifier)) - return GL_FALSE; - break; - case VARIABLE_ARRAY_EXPLICIT: - if (type->array_len >= 0) { - /* the user is trying to do something like: float[2] x[3]; */ - slang_info_log_error(C->L, "multi-dimensional arrays not allowed"); - RETURN0; - } - if (!convert_to_array(C, var, &type->specifier)) - return GL_FALSE; - if (!parse_array_len(C, O, &var->array_len)) - return GL_FALSE; - break; - default: - RETURN0; - } - - /* allocate global address space for a variable with a known size */ - if (C->global_scope - && !(var->type.specifier.type == SLANG_SPEC_ARRAY - && var->array_len == 0)) { - if (!calculate_var_size(C, O, var)) - return GL_FALSE; - } - - /* emit code for global var decl */ - if (C->global_scope) { - slang_assemble_ctx A; - memset(&A, 0, sizeof(slang_assemble_ctx)); - A.allow_uniform_initializers = C->version > 110; - A.atoms = C->atoms; - A.space.funcs = O->funs; - A.space.structs = O->structs; - A.space.vars = O->vars; - A.program = O->program; - A.pragmas = O->pragmas; - A.vartable = O->vartable; - A.log = C->L; - A.curFuncEndLabel = NULL; - A.EmitContReturn = ctx->Shader.EmitContReturn; - if (!_slang_codegen_global_variable(&A, var, C->type)) - RETURN0; - } - - /* initialize global variable */ - if (C->global_scope) { - if (var->initializer != NULL) { - slang_assemble_ctx A; - memset(&A, 0, sizeof(slang_assemble_ctx)); - A.allow_uniform_initializers = C->version > 110; - A.atoms = C->atoms; - A.space.funcs = O->funs; - A.space.structs = O->structs; - A.space.vars = O->vars; - if (!initialize_global(&A, var)) - RETURN0; - } - } - - if (var->type.qualifier == SLANG_QUAL_FIXEDINPUT && - var->a_name == slang_atom_pool_atom(C->atoms, "gl_FragCoord")) { - /* set the program's PixelCenterInteger, OriginUpperLeft fields */ - struct gl_fragment_program *fragProg = - (struct gl_fragment_program *) O->program; - - if (var->type.layout & SLANG_LAYOUT_UPPER_LEFT_BIT) { - fragProg->OriginUpperLeft = GL_TRUE; - } - if (var->type.layout & SLANG_LAYOUT_PIXEL_CENTER_INTEGER_BIT) { - fragProg->PixelCenterInteger = GL_TRUE; - } - } - - return 1; -} - -/** - * Parse a list of variable declarations. Each variable may have an - * initializer. - */ -static int -parse_init_declarator_list(slang_parse_ctx * C, slang_output_ctx * O) -{ - slang_fully_specified_type type; - - /* parse the fully specified type, common to all declarators */ - if (!slang_fully_specified_type_construct(&type)) - RETURN0; - if (!parse_fully_specified_type(C, O, &type)) { - slang_fully_specified_type_destruct(&type); - RETURN0; - } - - /* parse declarators, pass-in the parsed type */ - do { - if (!parse_init_declarator(C, O, &type)) { - slang_fully_specified_type_destruct(&type); - RETURN0; - } - } - while (*C->I++ == DECLARATOR_NEXT); - - slang_fully_specified_type_destruct(&type); - return 1; -} - - -/** - * Parse a function definition or declaration. - * \param C parsing context - * \param O output context - * \param definition if non-zero expect a definition, else a declaration - * \param parsed_func_ret returns the parsed function - * \return GL_TRUE if success, GL_FALSE if failure - */ -static GLboolean -parse_function(slang_parse_ctx * C, slang_output_ctx * O, int definition, - slang_function ** parsed_func_ret) -{ - slang_function parsed_func, *found_func; - - /* parse function definition/declaration */ - if (!slang_function_construct(&parsed_func)) - return GL_FALSE; - if (definition) { - if (!parse_function_definition(C, O, &parsed_func)) { - slang_function_destruct(&parsed_func); - return GL_FALSE; - } - } - else { - if (!parse_function_prototype(C, O, &parsed_func)) { - slang_function_destruct(&parsed_func); - return GL_FALSE; - } - } - - /* find a function with a prototype matching the parsed one - only - * the current scope is being searched to allow built-in function - * overriding - */ - found_func = slang_function_scope_find(O->funs, &parsed_func, 0); - if (found_func == NULL) { - /* New function, add it to the function list */ - O->funs->functions = - (slang_function *) _slang_realloc(O->funs->functions, - O->funs->num_functions - * sizeof(slang_function), - (O->funs->num_functions + 1) - * sizeof(slang_function)); - if (O->funs->functions == NULL) { - /* Make sure that there are no functions marked, as the - * allocation is currently NULL, in order to avoid - * a potental segfault as we clean up later. - */ - O->funs->num_functions = 0; - - slang_info_log_memory(C->L); - slang_function_destruct(&parsed_func); - return GL_FALSE; - } - O->funs->functions[O->funs->num_functions] = parsed_func; - O->funs->num_functions++; - - /* return the newly parsed function */ - *parsed_func_ret = &O->funs->functions[O->funs->num_functions - 1]; - } - else { - /* previously defined or declared */ - /* TODO: check function return type qualifiers and specifiers */ - if (definition) { - if (found_func->body != NULL) { - slang_info_log_error(C->L, "%s: function already has a body.", - slang_atom_pool_id(C->atoms, - parsed_func.header. - a_name)); - slang_function_destruct(&parsed_func); - return GL_FALSE; - } - - /* destroy the existing function declaration and replace it - * with the new one - */ - slang_function_destruct(found_func); - *found_func = parsed_func; - } - else { - /* another declaration of the same function prototype - ignore it */ - slang_function_destruct(&parsed_func); - } - - /* return the found function */ - *parsed_func_ret = found_func; - } - - return GL_TRUE; -} - -/* declaration */ -#define DECLARATION_FUNCTION_PROTOTYPE 1 -#define DECLARATION_INIT_DECLARATOR_LIST 2 - -static int -parse_declaration(slang_parse_ctx * C, slang_output_ctx * O) -{ - switch (*C->I++) { - case DECLARATION_INIT_DECLARATOR_LIST: - if (!parse_init_declarator_list(C, O)) - RETURN0; - break; - case DECLARATION_FUNCTION_PROTOTYPE: - { - slang_function *dummy_func; - - if (!parse_function(C, O, 0, &dummy_func)) - RETURN0; - } - break; - default: - RETURN0; - } - return 1; -} - -static int -parse_default_precision(slang_parse_ctx * C, slang_output_ctx * O) -{ - int precision, type; - - if (!O->allow_precision) { - slang_info_log_error(C->L, "syntax error at \"precision\""); - RETURN0; - } - - precision = *C->I++; - switch (precision) { - case PRECISION_LOW: - case PRECISION_MEDIUM: - case PRECISION_HIGH: - /* OK */ - break; - default: - _mesa_problem(NULL, "unexpected precision %d at %s:%d\n", - precision, __FILE__, __LINE__); - RETURN0; - } - - type = *C->I++; - switch (type) { - case TYPE_SPECIFIER_FLOAT: - case TYPE_SPECIFIER_INT: - case TYPE_SPECIFIER_SAMPLER1D: - case TYPE_SPECIFIER_SAMPLER2D: - case TYPE_SPECIFIER_SAMPLER3D: - case TYPE_SPECIFIER_SAMPLERCUBE: - case TYPE_SPECIFIER_SAMPLER1DSHADOW: - case TYPE_SPECIFIER_SAMPLER2DSHADOW: - case TYPE_SPECIFIER_SAMPLER2DRECT: - case TYPE_SPECIFIER_SAMPLER2DRECTSHADOW: - case TYPE_SPECIFIER_SAMPLER_1D_ARRAY: - case TYPE_SPECIFIER_SAMPLER_2D_ARRAY: - case TYPE_SPECIFIER_SAMPLER_1D_ARRAY_SHADOW: - case TYPE_SPECIFIER_SAMPLER_2D_ARRAY_SHADOW: - /* OK */ - break; - default: - _mesa_problem(NULL, "unexpected type %d at %s:%d\n", - type, __FILE__, __LINE__); - RETURN0; - } - - assert(type < TYPE_SPECIFIER_COUNT); - O->default_precision[type] = precision; - - return 1; -} - - -/** - * Initialize the default precision for all types. - * XXX this info isn't used yet. - */ -static void -init_default_precision(slang_output_ctx *O, slang_unit_type type) -{ - GET_CURRENT_CONTEXT(ctx); - GLuint i; - for (i = 0; i < TYPE_SPECIFIER_COUNT; i++) { -#if FEATURE_es2_glsl - if (ctx->API == API_OPENGLES2) - O->default_precision[i] = PRECISION_LOW; - else - O->default_precision[i] = PRECISION_HIGH; -#else - (void) ctx; - O->default_precision[i] = PRECISION_HIGH; -#endif - } - - if (type == SLANG_UNIT_VERTEX_SHADER || type == SLANG_UNIT_GEOMETRY_SHADER) { - O->default_precision[TYPE_SPECIFIER_FLOAT] = PRECISION_HIGH; - O->default_precision[TYPE_SPECIFIER_INT] = PRECISION_HIGH; - } - else { - O->default_precision[TYPE_SPECIFIER_INT] = PRECISION_MEDIUM; - } -} - - -static int -parse_invariant(slang_parse_ctx * C, slang_output_ctx * O) -{ - if (O->allow_invariant) { - slang_atom *a = parse_identifier(C); - /* XXX not doing anything with this var yet */ - /*printf("ID: %s\n", (char*) a);*/ - return a ? 1 : 0; - } - else { - slang_info_log_error(C->L, "syntax error at \"invariant\""); - RETURN0; - } -} - - -/* external declaration or default precision specifier */ -#define EXTERNAL_NULL 0 -#define EXTERNAL_FUNCTION_DEFINITION 1 -#define EXTERNAL_DECLARATION 2 -#define DEFAULT_PRECISION 3 -#define INVARIANT_STMT 4 - - -static GLboolean -parse_code_unit(slang_parse_ctx * C, slang_code_unit * unit, - struct gl_shader *shader) -{ - GET_CURRENT_CONTEXT(ctx); - slang_output_ctx o; - GLboolean success; - GLuint maxRegs; - slang_function *mainFunc = NULL; - - if (unit->type == SLANG_UNIT_FRAGMENT_BUILTIN || - unit->type == SLANG_UNIT_FRAGMENT_SHADER) { - maxRegs = ctx->Const.FragmentProgram.MaxTemps; - } - else if (unit->type == SLANG_UNIT_VERTEX_BUILTIN || - unit->type == SLANG_UNIT_VERTEX_SHADER) { - maxRegs = ctx->Const.VertexProgram.MaxTemps; - } else { - assert(unit->type == SLANG_UNIT_GEOMETRY_BUILTIN || - unit->type == SLANG_UNIT_GEOMETRY_SHADER); - maxRegs = ctx->Const.GeometryProgram.MaxTemps; - } - - /* setup output context */ - o.funs = &unit->funs; - o.structs = &unit->structs; - o.vars = &unit->vars; - o.program = shader ? shader->Program : NULL; - o.pragmas = shader ? &shader->Pragmas : NULL; - o.vartable = _slang_new_var_table(maxRegs); - _slang_push_var_table(o.vartable); - - /* allow 'invariant' keyword? */ -#if FEATURE_es2_glsl - o.allow_invariant = - (ctx->API == API_OPENGLES2 || C->version >= 120) ? GL_TRUE : GL_FALSE; -#else - o.allow_invariant = (C->version >= 120) ? GL_TRUE : GL_FALSE; -#endif - - /* allow 'centroid' keyword? */ - o.allow_centroid = (C->version >= 120) ? GL_TRUE : GL_FALSE; - - /* allow 'lowp/mediump/highp' keywords? */ -#if FEATURE_es2_glsl - o.allow_precision = - (ctx->API == API_OPENGLES2 || C->version >= 120) ? GL_TRUE : GL_FALSE; -#else - o.allow_precision = (C->version >= 120) ? GL_TRUE : GL_FALSE; -#endif - init_default_precision(&o, unit->type); - - /* allow 'float[]' keyword? */ - o.allow_array_types = (C->version >= 120) ? GL_TRUE : GL_FALSE; - - /* parse individual functions and declarations */ - while (*C->I != EXTERNAL_NULL) { - switch (*C->I++) { - case EXTERNAL_FUNCTION_DEFINITION: - { - slang_function *func; - success = parse_function(C, &o, 1, &func); - if (success && strcmp((char *) func->header.a_name, "main") == 0) { - /* found main() */ - mainFunc = func; - } - } - break; - case EXTERNAL_DECLARATION: - success = parse_declaration(C, &o); - break; - case DEFAULT_PRECISION: - success = parse_default_precision(C, &o); - break; - case INVARIANT_STMT: - success = parse_invariant(C, &o); - break; - default: - success = GL_FALSE; - } - - if (!success) { - /* xxx free codegen */ - _slang_pop_var_table(o.vartable); - return GL_FALSE; - } - } - C->I++; - - if (mainFunc) { - /* assemble (generate code) for main() */ - slang_assemble_ctx A; - memset(&A, 0, sizeof(slang_assemble_ctx)); - A.atoms = C->atoms; - A.space.funcs = o.funs; - A.space.structs = o.structs; - A.space.vars = o.vars; - A.program = o.program; - A.pragmas = &shader->Pragmas; - A.vartable = o.vartable; - A.EmitContReturn = ctx->Shader.EmitContReturn; - A.log = C->L; - A.allow_uniform_initializers = C->version > 110; - - /* main() takes no parameters */ - if (mainFunc->param_count > 0) { - slang_info_log_error(A.log, "main() takes no arguments"); - return GL_FALSE; - } - - _slang_codegen_function(&A, mainFunc); - - shader->Main = GL_TRUE; /* this shader defines main() */ - - shader->UnresolvedRefs = A.UnresolvedRefs; - } - - _slang_pop_var_table(o.vartable); - _slang_delete_var_table(o.vartable); - - return GL_TRUE; -} - -static GLboolean -compile_binary(const unsigned char * prod, slang_code_unit * unit, - GLuint version, - slang_unit_type type, slang_info_log * infolog, - slang_code_unit * builtin, slang_code_unit * downlink, - struct gl_shader *shader) -{ - slang_parse_ctx C; - - unit->type = type; - - /* setup parse context */ - C.I = prod; - C.L = infolog; - C.parsing_builtin = (builtin == NULL); - C.global_scope = GL_TRUE; - C.atoms = &unit->object->atompool; - C.type = type; - C.version = version; - - if (!check_revision(&C)) - return GL_FALSE; - - if (downlink != NULL) { - unit->vars.outer_scope = &downlink->vars; - unit->funs.outer_scope = &downlink->funs; - unit->structs.outer_scope = &downlink->structs; - } - - /* parse translation unit */ - return parse_code_unit(&C, unit, shader); -} - -static GLboolean -compile_with_grammar(const char *source, - slang_code_unit *unit, - slang_unit_type type, - slang_info_log *infolog, - slang_code_unit *builtin, - struct gl_shader *shader, - struct gl_sl_pragmas *pragmas, - unsigned int shader_type, - unsigned int parsing_builtin) -{ - GET_CURRENT_CONTEXT(ctx); - struct sl_pp_purify_options options; - struct sl_pp_context *context; - unsigned char *prod; - GLuint size; - unsigned int version; - unsigned int maxVersion; - int result; - char errmsg[200] = ""; - - assert(shader_type == 1 || shader_type == 2); - - memset(&options, 0, sizeof(options)); - - context = sl_pp_context_create(source, &options); - if (!context) { - slang_info_log_error(infolog, "out of memory"); - return GL_FALSE; - } - - if (sl_pp_version(context, &version)) { - slang_info_log_error(infolog, "%s", sl_pp_context_error_message(context)); - sl_pp_context_destroy(context); - return GL_FALSE; - } - - if (sl_pp_context_add_extension(context, "GL_ARB_draw_buffers") || - sl_pp_context_add_extension(context, "GL_ARB_texture_rectangle")) { - slang_info_log_error(infolog, "%s", sl_pp_context_error_message(context)); - sl_pp_context_destroy(context); - return GL_FALSE; - } - - if (type == SLANG_UNIT_FRAGMENT_SHADER) { - sl_pp_context_add_extension(context, "GL_ARB_fragment_coord_conventions"); - } - - -#if FEATURE_es2_glsl - if (ctx->API == API_OPENGLES2) { - if (sl_pp_context_add_predefined(context, "GL_ES", "1") || - sl_pp_context_add_predefined(context, "GL_FRAGMENT_PRECISION_HIGH", "1")) { - slang_info_log_error(infolog, "%s", sl_pp_context_error_message(context)); - sl_pp_context_destroy(context); - return GL_FALSE; - } - } -#else - (void) ctx; -#endif - -#if FEATURE_ARB_shading_language_120 - maxVersion = 120; -#elif FEATURE_es2_glsl - maxVersion = 100; -#else - maxVersion = 110; -#endif - - if (version > maxVersion || - (version != 100 && version != 110 && version != 120)) { - slang_info_log_error(infolog, - "language version %.2f is not supported.", - version * 0.01); - sl_pp_context_destroy(context); - return GL_FALSE; - } - - /* Finally check the syntax and generate its binary representation. */ - result = sl_cl_compile(context, - shader_type, - parsing_builtin, - &prod, - &size, - errmsg, - sizeof(errmsg)); - - sl_pp_context_destroy(context); - - if (result) { - /*GLint pos;*/ - - slang_info_log_error(infolog, errmsg); - /* syntax error (possibly in library code) */ -#if 0 - { - int line, col; - char *s; - s = (char *) _mesa_find_line_column((const GLubyte *) source, - (const GLubyte *) source + pos, - &line, &col); - printf("Error on line %d, col %d: %s\n", line, col, s); - } -#endif - return GL_FALSE; - } - - /* Syntax is okay - translate it to internal representation. */ - if (!compile_binary(prod, unit, version, type, infolog, builtin, - &builtin[SLANG_BUILTIN_TOTAL - 1], - shader)) { - free(prod); - return GL_FALSE; - } - free(prod); - return GL_TRUE; -} - -static const unsigned char slang_core_gc[] = { -#include "library/slang_core_gc.h" -}; - -static const unsigned char slang_120_core_gc[] = { -#include "library/slang_120_core_gc.h" -}; - -static const unsigned char slang_120_fragment_gc[] = { -#include "library/slang_builtin_120_fragment_gc.h" -}; - -static const unsigned char slang_common_builtin_gc[] = { -#include "library/slang_common_builtin_gc.h" -}; - -static const unsigned char slang_fragment_builtin_gc[] = { -#include "library/slang_fragment_builtin_gc.h" -}; - -static const unsigned char slang_vertex_builtin_gc[] = { -#include "library/slang_vertex_builtin_gc.h" -}; - -static const unsigned char slang_geometry_builtin_gc[] = { -#include "library/slang_geometry_builtin_gc.h" -}; - -static GLboolean -compile_object(const char *source, - slang_code_object *object, - slang_unit_type type, - slang_info_log *infolog, - struct gl_shader *shader, - struct gl_sl_pragmas *pragmas) -{ - slang_code_unit *builtins = NULL; - GLuint base_version = 110; - unsigned int shader_type; - unsigned int parsing_builtin; - - /* set shader type - the syntax is slightly different for different shaders */ - if (type == SLANG_UNIT_FRAGMENT_SHADER || type == SLANG_UNIT_FRAGMENT_BUILTIN) { - shader_type = 1; - } else { - shader_type = 2; - } - - /* enable language extensions */ - parsing_builtin = 1; - - /* if parsing user-specified shader, load built-in library */ - if (type == SLANG_UNIT_FRAGMENT_SHADER || type == SLANG_UNIT_VERTEX_SHADER || - type == SLANG_UNIT_GEOMETRY_SHADER) { - /* compile core functionality first */ - if (!compile_binary(slang_core_gc, - &object->builtin[SLANG_BUILTIN_CORE], - base_version, - SLANG_UNIT_FRAGMENT_BUILTIN, infolog, - NULL, NULL, NULL)) - return GL_FALSE; - -#if FEATURE_ARB_shading_language_120 - if (!compile_binary(slang_120_core_gc, - &object->builtin[SLANG_BUILTIN_120_CORE], - 120, - SLANG_UNIT_FRAGMENT_BUILTIN, infolog, - NULL, &object->builtin[SLANG_BUILTIN_CORE], NULL)) - return GL_FALSE; -#endif - - /* compile common functions and variables, link to core */ - if (!compile_binary(slang_common_builtin_gc, - &object->builtin[SLANG_BUILTIN_COMMON], -#if FEATURE_ARB_shading_language_120 - 120, -#else - base_version, -#endif - SLANG_UNIT_FRAGMENT_BUILTIN, infolog, NULL, -#if FEATURE_ARB_shading_language_120 - &object->builtin[SLANG_BUILTIN_120_CORE], -#else - &object->builtin[SLANG_BUILTIN_CORE], -#endif - NULL)) - return GL_FALSE; - - /* compile target-specific functions and variables, link to common */ - if (type == SLANG_UNIT_FRAGMENT_SHADER) { - if (!compile_binary(slang_fragment_builtin_gc, - &object->builtin[SLANG_BUILTIN_TARGET], - base_version, - SLANG_UNIT_FRAGMENT_BUILTIN, infolog, NULL, - &object->builtin[SLANG_BUILTIN_COMMON], NULL)) - return GL_FALSE; -#if FEATURE_ARB_shading_language_120 - if (!compile_binary(slang_120_fragment_gc, - &object->builtin[SLANG_BUILTIN_TARGET], - 120, - SLANG_UNIT_FRAGMENT_BUILTIN, infolog, NULL, - &object->builtin[SLANG_BUILTIN_COMMON], NULL)) - return GL_FALSE; -#endif - } - else if (type == SLANG_UNIT_VERTEX_SHADER) { - if (!compile_binary(slang_vertex_builtin_gc, - &object->builtin[SLANG_BUILTIN_TARGET], - base_version, - SLANG_UNIT_VERTEX_BUILTIN, infolog, NULL, - &object->builtin[SLANG_BUILTIN_COMMON], NULL)) - return GL_FALSE; - } -#if FEATURE_ARB_geometry_shader4 - else if (type == SLANG_UNIT_GEOMETRY_SHADER) { - if (!compile_binary(slang_geometry_builtin_gc, - &object->builtin[SLANG_BUILTIN_TARGET], - base_version, - SLANG_UNIT_GEOMETRY_BUILTIN, infolog, NULL, - &object->builtin[SLANG_BUILTIN_COMMON], NULL)) - return GL_FALSE; - } -#endif - - /* disable language extensions */ - parsing_builtin = 0; - - builtins = object->builtin; - } - - /* compile the actual shader - pass-in built-in library for external shader */ - return compile_with_grammar(source, - &object->unit, - type, - infolog, - builtins, - shader, - pragmas, - shader_type, - parsing_builtin); -} - - -GLboolean -_slang_compile(GLcontext *ctx, struct gl_shader *shader) -{ - GLboolean success; - slang_info_log info_log; - slang_code_object obj; - slang_unit_type type; - GLenum progTarget; - - if (shader->Type == GL_VERTEX_SHADER) { - type = SLANG_UNIT_VERTEX_SHADER; - } - else if (shader->Type == GL_FRAGMENT_SHADER) { - type = SLANG_UNIT_FRAGMENT_SHADER; - } else { - assert(shader->Type == GL_GEOMETRY_SHADER_ARB); - type = SLANG_UNIT_GEOMETRY_SHADER; - } - - if (!shader->Source) - return GL_FALSE; - - ctx->Shader.MemPool = _slang_new_mempool(1024*1024); - - shader->Main = GL_FALSE; - - /* free the shader's old instructions, etc */ - _mesa_reference_program(ctx, &shader->Program, NULL); - - /* allocate new GPU program, parameter lists, etc. */ - if (shader->Type == GL_VERTEX_SHADER) - progTarget = GL_VERTEX_PROGRAM_ARB; - else if (shader->Type == GL_FRAGMENT_SHADER) - progTarget = GL_FRAGMENT_PROGRAM_ARB; - else - progTarget = MESA_GEOMETRY_PROGRAM; - shader->Program = ctx->Driver.NewProgram(ctx, progTarget, 1); - shader->Program->Parameters = _mesa_new_parameter_list(); - shader->Program->Varying = _mesa_new_parameter_list(); - shader->Program->Attributes = _mesa_new_parameter_list(); - - slang_info_log_construct(&info_log); - _slang_code_object_ctr(&obj); - - success = compile_object(shader->Source, - &obj, - type, - &info_log, - shader, - &shader->Pragmas); - - /* free shader's prev info log */ - if (shader->InfoLog) { - free(shader->InfoLog); - shader->InfoLog = NULL; - } - - if (info_log.text) { - /* copy info-log string to shader object */ - shader->InfoLog = _mesa_strdup(info_log.text); - } - - if (info_log.error_flag) { - success = GL_FALSE; - } - - slang_info_log_destruct(&info_log); - _slang_code_object_dtr(&obj); - - _slang_delete_mempool((slang_mempool *) ctx->Shader.MemPool); - ctx->Shader.MemPool = NULL; - - /* remove any reads of output registers */ -#if 0 - printf("Pre-remove output reads:\n"); - _mesa_print_program(shader->Program); -#endif - _mesa_remove_output_reads(shader->Program, PROGRAM_OUTPUT); - if (shader->Type == GL_VERTEX_SHADER) { - /* and remove writes to varying vars in vertex programs */ - _mesa_remove_output_reads(shader->Program, PROGRAM_VARYING); - } -#if 0 - printf("Post-remove output reads:\n"); - _mesa_print_program(shader->Program); -#endif - - shader->CompileStatus = success; - - if (success) { - if (shader->Pragmas.Optimize && - (ctx->Shader.Flags & GLSL_NO_OPT) == 0) { - _mesa_optimize_program(ctx, shader->Program); - } - if ((ctx->Shader.Flags & GLSL_NOP_VERT) && - shader->Program->Target == GL_VERTEX_PROGRAM_ARB) { - _mesa_nop_vertex_program(ctx, - (struct gl_vertex_program *) shader->Program); - } - if ((ctx->Shader.Flags & GLSL_NOP_FRAG) && - shader->Program->Target == GL_FRAGMENT_PROGRAM_ARB) { - _mesa_nop_fragment_program(ctx, - (struct gl_fragment_program *) shader->Program); - } - } - - if (ctx->Shader.Flags & GLSL_LOG) { - _mesa_write_shader_to_file(shader); - } - - return success; -} - diff --git a/src/mesa/slang/slang_compile.h b/src/mesa/slang/slang_compile.h deleted file mode 100644 index 6061f878e7..0000000000 --- a/src/mesa/slang/slang_compile.h +++ /dev/null @@ -1,103 +0,0 @@ -/* - * Mesa 3-D graphics library - * Version: 6.5 - * - * Copyright (C) 2005-2006 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. - */ - -#if !defined SLANG_COMPILE_H -#define SLANG_COMPILE_H - -#include "main/glheader.h" -#include "main/mtypes.h" -#include "slang_compile_function.h" -#include "slang_compile_struct.h" -#include "slang_compile_variable.h" -#include "slang_utility.h" - -struct slang_code_object_; - -#if defined __cplusplus -extern "C" { -#endif - -typedef struct slang_name_space_ -{ - struct slang_function_scope_ *funcs; - struct slang_struct_scope_ *structs; - struct slang_variable_scope_ *vars; -} slang_name_space; - -typedef enum slang_unit_type_ -{ - SLANG_UNIT_FRAGMENT_SHADER, - SLANG_UNIT_VERTEX_SHADER, - SLANG_UNIT_GEOMETRY_SHADER, - SLANG_UNIT_FRAGMENT_BUILTIN, - SLANG_UNIT_VERTEX_BUILTIN, - SLANG_UNIT_GEOMETRY_BUILTIN -} slang_unit_type; - - -typedef struct slang_code_unit_ -{ - slang_variable_scope vars; - slang_function_scope funs; - slang_struct_scope structs; - slang_unit_type type; - struct slang_code_object_ *object; -} slang_code_unit; - - -extern GLvoid -_slang_code_unit_ctr (slang_code_unit *, struct slang_code_object_ *); - -extern GLvoid -_slang_code_unit_dtr (slang_code_unit *); - -#define SLANG_BUILTIN_CORE 0 -#define SLANG_BUILTIN_120_CORE 1 -#define SLANG_BUILTIN_COMMON 2 -#define SLANG_BUILTIN_TARGET 3 - -#define SLANG_BUILTIN_TOTAL 4 - -typedef struct slang_code_object_ -{ - slang_code_unit builtin[SLANG_BUILTIN_TOTAL]; - slang_code_unit unit; - slang_atom_pool atompool; -} slang_code_object; - -extern GLvoid -_slang_code_object_ctr (slang_code_object *); - -extern GLvoid -_slang_code_object_dtr (slang_code_object *); - -extern GLboolean -_slang_compile (GLcontext *ctx, struct gl_shader *shader); - -#ifdef __cplusplus -} -#endif - -#endif - diff --git a/src/mesa/slang/slang_compile_function.c b/src/mesa/slang/slang_compile_function.c deleted file mode 100644 index 4dd885176d..0000000000 --- a/src/mesa/slang/slang_compile_function.c +++ /dev/null @@ -1,262 +0,0 @@ -/* - * Mesa 3-D graphics library - * Version: 6.5 - * - * Copyright (C) 2005-2006 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 slang_compile_function.c - * slang front-end compiler - * \author Michal Krol - */ - -#include "main/imports.h" -#include "slang_compile.h" -#include "slang_mem.h" - - -int -slang_function_construct(slang_function * func) -{ - func->kind = SLANG_FUNC_ORDINARY; - if (!slang_variable_construct(&func->header)) - return 0; - - func->parameters = (slang_variable_scope *) - _slang_alloc(sizeof(slang_variable_scope)); - if (func->parameters == NULL) { - slang_variable_destruct(&func->header); - return 0; - } - - _slang_variable_scope_ctr(func->parameters); - func->param_count = 0; - func->body = NULL; - return 1; -} - -void -slang_function_destruct(slang_function * func) -{ - slang_variable_destruct(&func->header); - slang_variable_scope_destruct(func->parameters); - _slang_free(func->parameters); - if (func->body != NULL) { - slang_operation_destruct(func->body); - _slang_free(func->body); - } -} - - -slang_function * -slang_function_new(slang_function_kind kind) -{ - slang_function *fun = (slang_function *) - _slang_alloc(sizeof(slang_function)); - if (fun) { - slang_function_construct(fun); - fun->kind = kind; - } - return fun; -} - - -/* - * slang_function_scope - */ - -GLvoid -_slang_function_scope_ctr(slang_function_scope * self) -{ - self->functions = NULL; - self->num_functions = 0; - self->outer_scope = NULL; -} - -void -slang_function_scope_destruct(slang_function_scope * scope) -{ - unsigned int i; - - for (i = 0; i < scope->num_functions; i++) - slang_function_destruct(scope->functions + i); - _slang_free(scope->functions); -} - - -/** - * Does this function have a non-void return value? - */ -GLboolean -_slang_function_has_return_value(const slang_function *fun) -{ - return fun->header.type.specifier.type != SLANG_SPEC_VOID; -} - - -/** - * Search a list of functions for a particular function by name. - * \param funcs the list of functions to search - * \param a_name the name to search for - * \param all_scopes if non-zero, search containing scopes too. - * \return pointer to found function, or NULL. - */ -int -slang_function_scope_find_by_name(slang_function_scope * funcs, - slang_atom a_name, int all_scopes) -{ - unsigned int i; - - for (i = 0; i < funcs->num_functions; i++) - if (a_name == funcs->functions[i].header.a_name) - return 1; - if (all_scopes && funcs->outer_scope != NULL) - return slang_function_scope_find_by_name(funcs->outer_scope, a_name, 1); - return 0; -} - - -/** - * Search a list of functions for a particular function (for implementing - * function calls. Matching is done by first comparing the function's name, - * then the function's parameter list. - * - * \param funcs the list of functions to search - * \param fun the function to search for - * \param all_scopes if non-zero, search containing scopes too. - * \return pointer to found function, or NULL. - */ -slang_function * -slang_function_scope_find(slang_function_scope * funcs, slang_function * fun, - int all_scopes) -{ - unsigned int i; - - for (i = 0; i < funcs->num_functions; i++) { - slang_function *f = &funcs->functions[i]; - const GLuint haveRetValue = 0; -#if 0 - = (f->header.type.specifier.type != SLANG_SPEC_VOID); -#endif - unsigned int j; - - /* - printf("Compare name %s to %s (ret %u, %d, %d)\n", - (char *) fun->header.a_name, (char *) f->header.a_name, - haveRetValue, - fun->param_count, f->param_count); - */ - - if (fun->header.a_name != f->header.a_name) - continue; - if (fun->param_count != f->param_count) - continue; - for (j = haveRetValue; j < fun->param_count; j++) { - if (!slang_type_specifier_equal - (&fun->parameters->variables[j]->type.specifier, - &f->parameters->variables[j]->type.specifier)) - break; - } - if (j == fun->param_count) { - /* - printf("Found match\n"); - */ - return f; - } - } - /* - printf("Not found\n"); - */ - if (all_scopes && funcs->outer_scope != NULL) - return slang_function_scope_find(funcs->outer_scope, fun, 1); - return NULL; -} - - -/** - * Lookup a function according to name and parameter count/types. - */ -slang_function * -_slang_function_locate(const slang_function_scope * funcs, slang_atom a_name, - slang_operation * args, GLuint num_args, - const slang_name_space * space, slang_atom_pool * atoms, - slang_info_log *log, GLboolean *error) -{ - slang_typeinfo arg_ti[100]; - GLuint i; - - *error = GL_FALSE; - - /* determine type of each argument */ - assert(num_args < 100); - for (i = 0; i < num_args; i++) { - if (!slang_typeinfo_construct(&arg_ti[i])) - return NULL; - if (!_slang_typeof_operation(&args[i], space, &arg_ti[i], atoms, log)) { - return NULL; - } - } - - /* loop over function scopes */ - while (funcs) { - - /* look for function with matching name and argument/param types */ - for (i = 0; i < funcs->num_functions; i++) { - slang_function *f = &funcs->functions[i]; - const GLuint haveRetValue = _slang_function_has_return_value(f); - GLuint j; - - if (a_name != f->header.a_name) - continue; - if (f->param_count - haveRetValue != num_args) - continue; - - /* compare parameter / argument types */ - for (j = 0; j < num_args; j++) { - if (!slang_type_specifier_compatible(&arg_ti[j].spec, - &f->parameters->variables[j]->type.specifier)) { - /* param/arg types don't match */ - break; - } - - /* "out" and "inout" formal parameter requires the actual - * argument to be an l-value. - */ - if (!arg_ti[j].can_be_referenced && - (f->parameters->variables[j]->type.qualifier == SLANG_QUAL_OUT || - f->parameters->variables[j]->type.qualifier == SLANG_QUAL_INOUT)) { - /* param is not an lvalue! */ - *error = GL_TRUE; - return NULL; - } - } - - if (j == num_args) { - /* name and args match! */ - return f; - } - } - - funcs = funcs->outer_scope; - } - - return NULL; -} diff --git a/src/mesa/slang/slang_compile_function.h b/src/mesa/slang/slang_compile_function.h deleted file mode 100644 index 0eced3ca1a..0000000000 --- a/src/mesa/slang/slang_compile_function.h +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Mesa 3-D graphics library - * Version: 6.5.2 - * - * Copyright (C) 2005-2006 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 SLANG_COMPILE_FUNCTION_H -#define SLANG_COMPILE_FUNCTION_H - -#include "main/glheader.h" -#include "slang_compile_operation.h" -#include "slang_compile_variable.h" -#include "slang_log.h" -#include "slang_utility.h" - -struct slang_name_space_; -struct slang_operation_; - -/** - * Types of functions. - */ -typedef enum slang_function_kind_ -{ - SLANG_FUNC_ORDINARY, - SLANG_FUNC_CONSTRUCTOR, - SLANG_FUNC_OPERATOR -} slang_function_kind; - - -/** - * Description of a compiled shader function. - */ -typedef struct slang_function_ -{ - slang_function_kind kind; - slang_variable header; /**< The function's name and return type */ - slang_variable_scope *parameters; /**< formal parameters AND local vars */ - unsigned int param_count; /**< number of formal params (no locals) */ - slang_operation *body; /**< The instruction tree */ -} slang_function; - -extern int slang_function_construct(slang_function *); -extern void slang_function_destruct(slang_function *); -extern slang_function *slang_function_new(slang_function_kind kind); - -extern GLboolean -_slang_function_has_return_value(const slang_function *fun); - - -/** - * Basically, a list of compiled functions. - */ -typedef struct slang_function_scope_ -{ - slang_function *functions; - GLuint num_functions; - struct slang_function_scope_ *outer_scope; -} slang_function_scope; - - -extern GLvoid -_slang_function_scope_ctr(slang_function_scope *); - -extern void -slang_function_scope_destruct(slang_function_scope *); - -extern int -slang_function_scope_find_by_name(slang_function_scope *, slang_atom, int); - -extern slang_function * -slang_function_scope_find(slang_function_scope *, slang_function *, int); - -extern struct slang_function_ * -_slang_function_locate(const struct slang_function_scope_ *funcs, - slang_atom name, struct slang_operation_ *params, - GLuint num_params, - const struct slang_name_space_ *space, - slang_atom_pool *atoms, slang_info_log *log, - GLboolean *error); - - -#endif /* SLANG_COMPILE_FUNCTION_H */ diff --git a/src/mesa/slang/slang_compile_operation.c b/src/mesa/slang/slang_compile_operation.c deleted file mode 100644 index 5441d60df5..0000000000 --- a/src/mesa/slang/slang_compile_operation.c +++ /dev/null @@ -1,334 +0,0 @@ -/* - * Mesa 3-D graphics library - * Version: 6.5.2 - * - * Copyright (C) 2005-2006 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 slang_compile_operation.c - * slang front-end compiler - * \author Michal Krol - */ - -#include "main/imports.h" -#include "slang_compile.h" -#include "slang_mem.h" - - -/** - * Init a slang_operation object - */ -GLboolean -slang_operation_construct(slang_operation * oper) -{ - oper->type = SLANG_OPER_NONE; - oper->children = NULL; - oper->num_children = 0; - oper->literal[0] = 0.0; - oper->literal_size = 1; - oper->array_constructor = GL_FALSE; - oper->a_id = SLANG_ATOM_NULL; - oper->a_obj = SLANG_ATOM_NULL; - oper->locals = _slang_variable_scope_new(NULL); - if (oper->locals == NULL) - return GL_FALSE; - _slang_variable_scope_ctr(oper->locals); - oper->fun = NULL; - oper->var = NULL; - oper->label = NULL; - return GL_TRUE; -} - -void -slang_operation_destruct(slang_operation * oper) -{ - GLuint i; - - for (i = 0; i < oper->num_children; i++) - slang_operation_destruct(oper->children + i); - _slang_free(oper->children); - slang_variable_scope_destruct(oper->locals); - _slang_free(oper->locals); - oper->children = NULL; - oper->num_children = 0; - oper->locals = NULL; -} - - -/** - * Recursively traverse 'oper', replacing occurances of 'oldScope' with - * 'newScope' in the oper->locals->outer_scope field. - */ -void -slang_replace_scope(slang_operation *oper, - slang_variable_scope *oldScope, - slang_variable_scope *newScope) -{ - GLuint i; - - if (oper->locals != newScope && - oper->locals->outer_scope == oldScope) { - /* found. replace old w/ new */ - oper->locals->outer_scope = newScope; - } - - if (oper->type == SLANG_OPER_VARIABLE_DECL) { - /* search/replace in the initializer */ - slang_variable *var; - var = _slang_variable_locate(oper->locals, oper->a_id, GL_TRUE); - if (var && var->initializer) { - slang_replace_scope(var->initializer, oldScope, newScope); - } - } - - /* search/replace in children */ - for (i = 0; i < oper->num_children; i++) { - slang_replace_scope(&oper->children[i], oldScope, newScope); - } -} - - -/** - * Recursively copy a slang_operation node. - * \param x copy target - * \param y copy source - * \return GL_TRUE for success, GL_FALSE if failure - */ -GLboolean -slang_operation_copy(slang_operation * x, const slang_operation * y) -{ - slang_operation z; - GLuint i; - - if (!slang_operation_construct(&z)) - return GL_FALSE; - z.type = y->type; - if (y->num_children > 0) { - z.children = (slang_operation *) - _slang_alloc(y->num_children * sizeof(slang_operation)); - if (z.children == NULL) { - slang_operation_destruct(&z); - return GL_FALSE; - } - } - for (z.num_children = 0; z.num_children < y->num_children; - z.num_children++) { - if (!slang_operation_construct(&z.children[z.num_children])) { - slang_operation_destruct(&z); - return GL_FALSE; - } - } - for (i = 0; i < z.num_children; i++) { - if (!slang_operation_copy(&z.children[i], &y->children[i])) { - slang_operation_destruct(&z); - return GL_FALSE; - } - } - z.literal[0] = y->literal[0]; - z.literal[1] = y->literal[1]; - z.literal[2] = y->literal[2]; - z.literal[3] = y->literal[3]; - z.literal_size = y->literal_size; - assert(y->literal_size >= 1); - assert(y->literal_size <= 4); - z.a_id = y->a_id; - if (y->locals) { - if (!slang_variable_scope_copy(z.locals, y->locals)) { - slang_operation_destruct(&z); - return GL_FALSE; - } - } - - /* update scoping for children */ - for (i = 0; i < y->num_children; i++) { - if (y->children[i].locals && - y->children[i].locals->outer_scope == y->locals) { - z.children[i].locals->outer_scope = z.locals; - } - } - -#if 0 - z.var = y->var; - z.fun = y->fun; -#endif - slang_operation_destruct(x); - *x = z; - - /* If this operation declares a new scope, we need to make sure - * all children point to it, not the original operation's scope! - */ - if (x->type == SLANG_OPER_BLOCK_NEW_SCOPE || - x->type == SLANG_OPER_WHILE || - x->type == SLANG_OPER_FOR) { - slang_replace_scope(x, y->locals, x->locals); - } - - return GL_TRUE; -} - - -slang_operation * -slang_operation_new(GLuint count) -{ - slang_operation *ops - = (slang_operation *) _slang_alloc(count * sizeof(slang_operation)); - assert(count > 0); - if (ops) { - GLuint i; - for (i = 0; i < count; i++) - slang_operation_construct(ops + i); - } - return ops; -} - - -/** - * Delete operation and all children - */ -void -slang_operation_delete(slang_operation *oper) -{ - slang_operation_destruct(oper); - _slang_free(oper); -} - - -void -slang_operation_free_children(slang_operation *oper) -{ - GLuint i; - for (i = 0; i < slang_oper_num_children(oper); i++) { - slang_operation *child = slang_oper_child(oper, i); - slang_operation_destruct(child); - } - _slang_free(oper->children); - oper->children = NULL; - oper->num_children = 0; -} - - -slang_operation * -slang_operation_grow(GLuint *numChildren, slang_operation **children) -{ - slang_operation *ops; - - ops = (slang_operation *) - _slang_realloc(*children, - *numChildren * sizeof(slang_operation), - (*numChildren + 1) * sizeof(slang_operation)); - if (ops) { - slang_operation *newOp = ops + *numChildren; - if (!slang_operation_construct(newOp)) { - _slang_free(ops); - *children = NULL; - return NULL; - } - *children = ops; - (*numChildren)++; - return newOp; - } - return NULL; -} - -/** - * Insert a new slang_operation into an array. - * \param numElements pointer to current array size (in/out) - * \param array address of the array (in/out) - * \param pos position to insert new element - * \return pointer to the new operation/element - */ -slang_operation * -slang_operation_insert(GLuint *numElements, slang_operation **array, - GLuint pos) -{ - slang_operation *ops; - - assert(pos <= *numElements); - - ops = (slang_operation *) - _slang_alloc((*numElements + 1) * sizeof(slang_operation)); - if (ops) { - slang_operation *newOp; - newOp = ops + pos; - if (pos > 0) - memcpy(ops, *array, pos * sizeof(slang_operation)); - if (pos < *numElements) - memcpy(newOp + 1, (*array) + pos, - (*numElements - pos) * sizeof(slang_operation)); - - if (!slang_operation_construct(newOp)) { - _slang_free(ops); - *numElements = 0; - *array = NULL; - return NULL; - } - if (*array) - _slang_free(*array); - *array = ops; - (*numElements)++; - return newOp; - } - return NULL; -} - - -/** - * Add/insert new child into given node at given position. - * \return pointer to the new child node - */ -slang_operation * -slang_operation_insert_child(slang_operation *oper, GLuint pos) -{ - slang_operation *newOp; - - newOp = slang_operation_insert(&oper->num_children, - &oper->children, - pos); - if (newOp) { - newOp->locals->outer_scope = oper->locals; - } - - return newOp; -} - - -void -_slang_operation_swap(slang_operation *oper0, slang_operation *oper1) -{ - slang_operation tmp = *oper0; - *oper0 = *oper1; - *oper1 = tmp; -} - - -void -slang_operation_add_children(slang_operation *oper, GLuint num_children) -{ - GLuint i; - assert(oper->num_children == 0); - assert(oper->children == NULL); - oper->num_children = num_children; - oper->children = slang_operation_new(num_children); - for (i = 0; i < num_children; i++) { - oper->children[i].locals = _slang_variable_scope_new(oper->locals); - } -} - diff --git a/src/mesa/slang/slang_compile_operation.h b/src/mesa/slang/slang_compile_operation.h deleted file mode 100644 index b32573e022..0000000000 --- a/src/mesa/slang/slang_compile_operation.h +++ /dev/null @@ -1,230 +0,0 @@ -/* - * Mesa 3-D graphics library - * Version: 6.5.2 - * - * Copyright (C) 2005-2006 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 SLANG_COMPILE_OPERATION_H -#define SLANG_COMPILE_OPERATION_H - - -#include "main/compiler.h" -#include "main/glheader.h" -#include "slang_compile_variable.h" -#include "slang_utility.h" - -/** - * Types of slang operations. - * These are the types of the AST (abstract syntax tree) nodes. - * [foo] indicates a sub-tree or reference to another type of node - */ -typedef enum slang_operation_type_ -{ - SLANG_OPER_NONE, - SLANG_OPER_BLOCK_NO_NEW_SCOPE, /* "{" sequence "}" */ - SLANG_OPER_BLOCK_NEW_SCOPE, /* "{" sequence "}" */ - SLANG_OPER_VARIABLE_DECL, /* [type] [var] or [var] = [expr] */ - SLANG_OPER_ASM, - SLANG_OPER_BREAK, /* "break" statement */ - SLANG_OPER_CONTINUE, /* "continue" statement */ - SLANG_OPER_DISCARD, /* "discard" (kill fragment) statement */ - SLANG_OPER_RETURN, /* "return" [expr] */ - SLANG_OPER_RETURN_INLINED, /* "return" [expr] from inlined function */ - SLANG_OPER_LABEL, /* a jump target */ - SLANG_OPER_EXPRESSION, /* [expr] */ - SLANG_OPER_IF, /* "if" [0] then [1] else [2] */ - SLANG_OPER_WHILE, /* "while" [cond] [body] */ - SLANG_OPER_DO, /* "do" [body] "while" [cond] */ - SLANG_OPER_FOR, /* "for" [init] [while] [incr] [body] */ - SLANG_OPER_VOID, /* nop */ - SLANG_OPER_LITERAL_BOOL, /* "true" or "false" */ - SLANG_OPER_LITERAL_INT, /* integer literal */ - SLANG_OPER_LITERAL_FLOAT, /* float literal */ - SLANG_OPER_IDENTIFIER, /* var name, func name, etc */ - SLANG_OPER_SEQUENCE, /* [expr] "," [expr] "," etc */ - SLANG_OPER_ASSIGN, /* [var] "=" [expr] */ - SLANG_OPER_ADDASSIGN, /* [var] "+=" [expr] */ - SLANG_OPER_SUBASSIGN, /* [var] "-=" [expr] */ - SLANG_OPER_MULASSIGN, /* [var] "*=" [expr] */ - SLANG_OPER_DIVASSIGN, /* [var] "/=" [expr] */ - /*SLANG_OPER_MODASSIGN, */ - /*SLANG_OPER_LSHASSIGN, */ - /*SLANG_OPER_RSHASSIGN, */ - /*SLANG_OPER_ORASSIGN, */ - /*SLANG_OPER_XORASSIGN, */ - /*SLANG_OPER_ANDASSIGN, */ - SLANG_OPER_SELECT, /* [expr] "?" [expr] ":" [expr] */ - SLANG_OPER_LOGICALOR, /* [expr] "||" [expr] */ - SLANG_OPER_LOGICALXOR, /* [expr] "^^" [expr] */ - SLANG_OPER_LOGICALAND, /* [expr] "&&" [expr] */ - /*SLANG_OPER_BITOR, */ - /*SLANG_OPER_BITXOR, */ - /*SLANG_OPER_BITAND, */ - SLANG_OPER_EQUAL, /* [expr] "==" [expr] */ - SLANG_OPER_NOTEQUAL, /* [expr] "!=" [expr] */ - SLANG_OPER_LESS, /* [expr] "<" [expr] */ - SLANG_OPER_GREATER, /* [expr] ">" [expr] */ - SLANG_OPER_LESSEQUAL, /* [expr] "<=" [expr] */ - SLANG_OPER_GREATEREQUAL, /* [expr] ">=" [expr] */ - /*SLANG_OPER_LSHIFT, */ - /*SLANG_OPER_RSHIFT, */ - SLANG_OPER_ADD, /* [expr] "+" [expr] */ - SLANG_OPER_SUBTRACT, /* [expr] "-" [expr] */ - SLANG_OPER_MULTIPLY, /* [expr] "*" [expr] */ - SLANG_OPER_DIVIDE, /* [expr] "/" [expr] */ - /*SLANG_OPER_MODULUS, */ - SLANG_OPER_PREINCREMENT, /* "++" [var] */ - SLANG_OPER_PREDECREMENT, /* "--" [var] */ - SLANG_OPER_PLUS, /* "-" [expr] */ - SLANG_OPER_MINUS, /* "+" [expr] */ - /*SLANG_OPER_COMPLEMENT, */ - SLANG_OPER_NOT, /* "!" [expr] */ - SLANG_OPER_SUBSCRIPT, /* [expr] "[" [expr] "]" */ - SLANG_OPER_CALL, /* [func name] [param] [param] [...] */ - SLANG_OPER_NON_INLINED_CALL, /* a real function call */ - SLANG_OPER_METHOD, /* method call, such as v.length() */ - SLANG_OPER_FIELD, /* i.e.: ".next" or ".xzy" or ".xxx" etc */ - SLANG_OPER_POSTINCREMENT, /* [var] "++" */ - SLANG_OPER_POSTDECREMENT /* [var] "--" */ -} slang_operation_type; - - -/** - * A slang_operation is basically a compiled instruction (such as assignment, - * a while-loop, a conditional, a multiply, a function call, etc). - * The AST (abstract syntax tree) is built from these nodes. - * NOTE: This structure could have been implemented as a union of simpler - * structs which would correspond to the operation types above. - */ -typedef struct slang_operation_ -{ - slang_operation_type type; - struct slang_operation_ *children; - GLuint num_children; - GLfloat literal[4]; /**< Used for float, int and bool values */ - GLuint literal_size; /**< 1, 2, 3, or 4 */ - slang_atom a_id; /**< type: asm, identifier, call, field */ - slang_atom a_obj; /**< object in a method call */ - slang_variable_scope *locals; /**< local vars for scope */ - struct slang_function_ *fun; /**< If type == SLANG_OPER_CALL */ - struct slang_variable_ *var; /**< If type == slang_oper_identier */ - struct slang_label_ *label; /**< If type == SLANG_OPER_LABEL */ - /** If type==SLANG_OPER_CALL and we're calling an array constructor, - * for which there's no real function, we need to have a flag to - * indicate such. num_children indicates number of elements. - */ - GLboolean array_constructor; -} slang_operation; - - -extern GLboolean -slang_operation_construct(slang_operation *); - -extern void -slang_operation_destruct(slang_operation *); - -extern void -slang_replace_scope(slang_operation *oper, - slang_variable_scope *oldScope, - slang_variable_scope *newScope); - -extern GLboolean -slang_operation_copy(slang_operation *, const slang_operation *); - -extern slang_operation * -slang_operation_new(GLuint count); - -extern void -slang_operation_delete(slang_operation *oper); - -extern void -slang_operation_free_children(slang_operation *oper); - -extern slang_operation * -slang_operation_grow(GLuint *numChildren, slang_operation **children); - -extern slang_operation * -slang_operation_insert(GLuint *numChildren, slang_operation **children, - GLuint pos); - -extern slang_operation * -slang_operation_insert_child(slang_operation *oper, GLuint pos); - -extern void -_slang_operation_swap(slang_operation *oper0, slang_operation *oper1); - - -extern void -slang_operation_add_children(slang_operation *oper, GLuint num_children); - - -/** Return number of children of given node */ -static INLINE GLuint -slang_oper_num_children(const slang_operation *oper) -{ - return oper->num_children; -} - -/** Return child of given operation node */ -static INLINE slang_operation * -slang_oper_child(slang_operation *oper, GLuint child) -{ - assert(child < oper->num_children); - return &oper->children[child]; -} - - -/** Return child of given operation node, const version */ -static INLINE const slang_operation * -slang_oper_child_const(const slang_operation *oper, GLuint child) -{ - assert(child < oper->num_children); - return &oper->children[child]; -} - - -/** Init oper to a boolean literal. */ -static INLINE void -slang_operation_literal_bool(slang_operation *oper, GLboolean value) -{ - oper->type = SLANG_OPER_LITERAL_BOOL; - oper->literal[0] = - oper->literal[1] = - oper->literal[2] = - oper->literal[3] = (float) value; - oper->literal_size = 1; -} - - -/** Init oper to an int literal. */ -static INLINE void -slang_operation_literal_int(slang_operation *oper, GLint value) -{ - oper->type = SLANG_OPER_LITERAL_INT; - oper->literal[0] = - oper->literal[1] = - oper->literal[2] = - oper->literal[3] = (float) value; - oper->literal_size = 1; -} - - -#endif /* SLANG_COMPILE_OPERATION_H */ diff --git a/src/mesa/slang/slang_compile_struct.c b/src/mesa/slang/slang_compile_struct.c deleted file mode 100644 index e6c38730d7..0000000000 --- a/src/mesa/slang/slang_compile_struct.c +++ /dev/null @@ -1,174 +0,0 @@ -/* - * Mesa 3-D graphics library - * Version: 6.5.3 - * - * Copyright (C) 2005-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. - */ - -/** - * \file slang_compile_struct.c - * slang front-end compiler - * \author Michal Krol - */ - -#include "main/imports.h" -#include "slang_mem.h" -#include "slang_compile.h" - - -GLvoid -_slang_struct_scope_ctr(slang_struct_scope * self) -{ - self->structs = NULL; - self->num_structs = 0; - self->outer_scope = NULL; -} - -void -slang_struct_scope_destruct(slang_struct_scope * scope) -{ - GLuint i; - - for (i = 0; i < scope->num_structs; i++) - slang_struct_destruct(scope->structs + i); - _slang_free(scope->structs); - /* do not free scope->outer_scope */ -} - -int -slang_struct_scope_copy(slang_struct_scope * x, const slang_struct_scope * y) -{ - slang_struct_scope z; - GLuint i; - - _slang_struct_scope_ctr(&z); - z.structs = (slang_struct *) - _slang_alloc(y->num_structs * sizeof(slang_struct)); - if (z.structs == NULL) { - slang_struct_scope_destruct(&z); - return 0; - } - for (z.num_structs = 0; z.num_structs < y->num_structs; z.num_structs++) - if (!slang_struct_construct(&z.structs[z.num_structs])) { - slang_struct_scope_destruct(&z); - return 0; - } - for (i = 0; i < z.num_structs; i++) - if (!slang_struct_copy(&z.structs[i], &y->structs[i])) { - slang_struct_scope_destruct(&z); - return 0; - } - z.outer_scope = y->outer_scope; - slang_struct_scope_destruct(x); - *x = z; - return 1; -} - -slang_struct * -slang_struct_scope_find(slang_struct_scope * stru, slang_atom a_name, - int all_scopes) -{ - GLuint i; - - for (i = 0; i < stru->num_structs; i++) - if (a_name == stru->structs[i].a_name) - return &stru->structs[i]; - if (all_scopes && stru->outer_scope != NULL) - return slang_struct_scope_find(stru->outer_scope, a_name, 1); - return NULL; -} - -/* slang_struct */ - -int -slang_struct_construct(slang_struct * stru) -{ - stru->a_name = SLANG_ATOM_NULL; - stru->fields = (slang_variable_scope *) - _slang_alloc(sizeof(slang_variable_scope)); - if (stru->fields == NULL) - return 0; - _slang_variable_scope_ctr(stru->fields); - - stru->structs = - (slang_struct_scope *) _slang_alloc(sizeof(slang_struct_scope)); - if (stru->structs == NULL) { - slang_variable_scope_destruct(stru->fields); - _slang_free(stru->fields); - return 0; - } - _slang_struct_scope_ctr(stru->structs); - stru->constructor = NULL; - return 1; -} - -void -slang_struct_destruct(slang_struct * stru) -{ - slang_variable_scope_destruct(stru->fields); - _slang_free(stru->fields); - slang_struct_scope_destruct(stru->structs); - _slang_free(stru->structs); -} - -int -slang_struct_copy(slang_struct * x, const slang_struct * y) -{ - slang_struct z; - - if (!slang_struct_construct(&z)) - return 0; - z.a_name = y->a_name; - if (!slang_variable_scope_copy(z.fields, y->fields)) { - slang_struct_destruct(&z); - return 0; - } - if (!slang_struct_scope_copy(z.structs, y->structs)) { - slang_struct_destruct(&z); - return 0; - } - slang_struct_destruct(x); - *x = z; - return 1; -} - -int -slang_struct_equal(const slang_struct * x, const slang_struct * y) -{ - GLuint i; - - if (x->fields->num_variables != y->fields->num_variables) - return 0; - - for (i = 0; i < x->fields->num_variables; i++) { - const slang_variable *varx = x->fields->variables[i]; - const slang_variable *vary = y->fields->variables[i]; - - if (varx->a_name != vary->a_name) - return 0; - if (!slang_type_specifier_equal(&varx->type.specifier, - &vary->type.specifier)) - return 0; - if (varx->type.specifier.type == SLANG_SPEC_ARRAY) - if (varx->array_len != vary->array_len) - return GL_FALSE; - } - return 1; -} diff --git a/src/mesa/slang/slang_compile_struct.h b/src/mesa/slang/slang_compile_struct.h deleted file mode 100644 index 7be6f204e1..0000000000 --- a/src/mesa/slang/slang_compile_struct.h +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Mesa 3-D graphics library - * Version: 6.5 - * - * Copyright (C) 2005-2006 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. - */ - -#if !defined SLANG_COMPILE_STRUCT_H -#define SLANG_COMPILE_STRUCT_H - -#if defined __cplusplus -extern "C" { -#endif - -#include "main/glheader.h" -#include "slang_utility.h" - -struct slang_function_; - -typedef struct slang_struct_scope_ -{ - struct slang_struct_ *structs; - GLuint num_structs; - struct slang_struct_scope_ *outer_scope; -} slang_struct_scope; - -extern GLvoid -_slang_struct_scope_ctr (slang_struct_scope *); - -void slang_struct_scope_destruct (slang_struct_scope *); -int slang_struct_scope_copy (slang_struct_scope *, const slang_struct_scope *); -struct slang_struct_ *slang_struct_scope_find (slang_struct_scope *, slang_atom, int); - -typedef struct slang_struct_ -{ - slang_atom a_name; - struct slang_variable_scope_ *fields; - slang_struct_scope *structs; - struct slang_function_ *constructor; -} slang_struct; - -int slang_struct_construct (slang_struct *); -void slang_struct_destruct (slang_struct *); -int slang_struct_copy (slang_struct *, const slang_struct *); -int slang_struct_equal (const slang_struct *, const slang_struct *); - -#ifdef __cplusplus -} -#endif - -#endif - diff --git a/src/mesa/slang/slang_compile_variable.c b/src/mesa/slang/slang_compile_variable.c deleted file mode 100644 index 23c08a9039..0000000000 --- a/src/mesa/slang/slang_compile_variable.c +++ /dev/null @@ -1,247 +0,0 @@ -/* - * Mesa 3-D graphics library - * Version: 6.5.3 - * - * Copyright (C) 2005-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. - */ - -/** - * \file slang_compile_variable.c - * slang front-end compiler - * \author Michal Krol - */ - -#include "main/imports.h" -#include "slang_compile.h" -#include "slang_mem.h" - - -static slang_variable * -slang_variable_new(void) -{ - slang_variable *v = (slang_variable *) _slang_alloc(sizeof(slang_variable)); - if (v) { - if (!slang_variable_construct(v)) { - _slang_free(v); - v = NULL; - } - } - return v; -} - - -static void -slang_variable_delete(slang_variable * var) -{ - slang_variable_destruct(var); - _slang_free(var); -} - - -/* - * slang_variable_scope - */ - -slang_variable_scope * -_slang_variable_scope_new(slang_variable_scope *parent) -{ - slang_variable_scope *s; - s = (slang_variable_scope *) _slang_alloc(sizeof(slang_variable_scope)); - if (s) - s->outer_scope = parent; - return s; -} - - -GLvoid -_slang_variable_scope_ctr(slang_variable_scope * self) -{ - self->variables = NULL; - self->num_variables = 0; - self->outer_scope = NULL; -} - -void -slang_variable_scope_destruct(slang_variable_scope * scope) -{ - unsigned int i; - - if (!scope) - return; - for (i = 0; i < scope->num_variables; i++) { - if (scope->variables[i]) - slang_variable_delete(scope->variables[i]); - } - _slang_free(scope->variables); - /* do not free scope->outer_scope */ -} - -int -slang_variable_scope_copy(slang_variable_scope * x, - const slang_variable_scope * y) -{ - slang_variable_scope z; - unsigned int i; - - _slang_variable_scope_ctr(&z); - z.variables = (slang_variable **) - _slang_alloc(y->num_variables * sizeof(slang_variable *)); - if (z.variables == NULL) { - slang_variable_scope_destruct(&z); - return 0; - } - for (z.num_variables = 0; z.num_variables < y->num_variables; - z.num_variables++) { - z.variables[z.num_variables] = slang_variable_new(); - if (!z.variables[z.num_variables]) { - slang_variable_scope_destruct(&z); - return 0; - } - } - for (i = 0; i < z.num_variables; i++) { - if (!slang_variable_copy(z.variables[i], y->variables[i])) { - slang_variable_scope_destruct(&z); - return 0; - } - } - z.outer_scope = y->outer_scope; - slang_variable_scope_destruct(x); - *x = z; - return 1; -} - - -/** - * Grow the variable list by one. - * \return pointer to space for the new variable (will be initialized) - */ -slang_variable * -slang_variable_scope_grow(slang_variable_scope *scope) -{ - const int n = scope->num_variables; - scope->variables = (slang_variable **) - _slang_realloc(scope->variables, - n * sizeof(slang_variable *), - (n + 1) * sizeof(slang_variable *)); - if (!scope->variables) - return NULL; - - scope->num_variables++; - - scope->variables[n] = slang_variable_new(); - if (!scope->variables[n]) - return NULL; - - return scope->variables[n]; -} - - - -/* slang_variable */ - -int -slang_variable_construct(slang_variable * var) -{ - if (!slang_fully_specified_type_construct(&var->type)) - return 0; - var->a_name = SLANG_ATOM_NULL; - var->array_len = 0; - var->initializer = NULL; - var->size = 0; - var->isTemp = GL_FALSE; - var->store = NULL; - var->declared = 0; - return 1; -} - - -void -slang_variable_destruct(slang_variable * var) -{ - slang_fully_specified_type_destruct(&var->type); - if (var->initializer != NULL) { - slang_operation_destruct(var->initializer); - _slang_free(var->initializer); - } -#if 0 - if (var->aux) { - free(var->aux); - } -#endif -} - - -int -slang_variable_copy(slang_variable * x, const slang_variable * y) -{ - slang_variable z; - - if (!slang_variable_construct(&z)) - return 0; - if (!slang_fully_specified_type_copy(&z.type, &y->type)) { - slang_variable_destruct(&z); - return 0; - } - z.a_name = y->a_name; - z.array_len = y->array_len; - if (y->initializer != NULL) { - z.initializer - = (slang_operation *) _slang_alloc(sizeof(slang_operation)); - if (z.initializer == NULL) { - slang_variable_destruct(&z); - return 0; - } - if (!slang_operation_construct(z.initializer)) { - _slang_free(z.initializer); - slang_variable_destruct(&z); - return 0; - } - if (!slang_operation_copy(z.initializer, y->initializer)) { - slang_variable_destruct(&z); - return 0; - } - } - z.size = y->size; - slang_variable_destruct(x); - *x = z; - return 1; -} - - -/** - * Search for named variable in given scope. - * \param all if true, search parent scopes too. - */ -slang_variable * -_slang_variable_locate(const slang_variable_scope * scope, - const slang_atom a_name, GLboolean all) -{ - while (scope) { - GLuint i; - for (i = 0; i < scope->num_variables; i++) - if (a_name == scope->variables[i]->a_name) - return scope->variables[i]; - if (all) - scope = scope->outer_scope; - else - scope = NULL; - } - return NULL; -} diff --git a/src/mesa/slang/slang_compile_variable.h b/src/mesa/slang/slang_compile_variable.h deleted file mode 100644 index 48dc6efca4..0000000000 --- a/src/mesa/slang/slang_compile_variable.h +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Mesa 3-D graphics library - * Version: 6.5.2 - * - * Copyright (C) 2005-2006 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 SLANG_COMPILE_VARIABLE_H -#define SLANG_COMPILE_VARIABLE_H - - -#include "main/glheader.h" -#include "slang_typeinfo.h" -#include "slang_utility.h" - - -/** - * A shading language program variable. - */ -typedef struct slang_variable_ -{ - slang_fully_specified_type type; /**< Variable's data type */ - slang_atom a_name; /**< The variable's name (char *) */ - GLuint array_len; /**< only if type == SLANG_SPEC_ARRAy */ - struct slang_operation_ *initializer; /**< Optional initializer code */ - GLuint size; /**< Variable's size in bytes */ - GLboolean is_global; - GLboolean isTemp; /**< a named temporary (__resultTmp) */ - GLboolean declared; /**< has the var been declared? */ - struct slang_ir_storage_ *store; /**< Storage for this var */ -} slang_variable; - - -/** - * Basically a list of variables, with a pointer to the parent scope. - */ -typedef struct slang_variable_scope_ -{ - slang_variable **variables; /**< Array [num_variables] of ptrs to vars */ - GLuint num_variables; - struct slang_variable_scope_ *outer_scope; -} slang_variable_scope; - - -extern slang_variable_scope * -_slang_variable_scope_new(slang_variable_scope *parent); - -extern GLvoid -_slang_variable_scope_ctr(slang_variable_scope *); - -extern void -slang_variable_scope_destruct(slang_variable_scope *); - -extern int -slang_variable_scope_copy(slang_variable_scope *, - const slang_variable_scope *); - -extern slang_variable * -slang_variable_scope_grow(slang_variable_scope *); - -extern int -slang_variable_construct(slang_variable *); - -extern void -slang_variable_destruct(slang_variable *); - -extern int -slang_variable_copy(slang_variable *, const slang_variable *); - -extern slang_variable * -_slang_variable_locate(const slang_variable_scope *, const slang_atom a_name, - GLboolean all); - - -#endif /* SLANG_COMPILE_VARIABLE_H */ diff --git a/src/mesa/slang/slang_emit.c b/src/mesa/slang/slang_emit.c deleted file mode 100644 index a9aa6fe1c3..0000000000 --- a/src/mesa/slang/slang_emit.c +++ /dev/null @@ -1,2686 +0,0 @@ -/* - * Mesa 3-D graphics library - * - * Copyright (C) 2005-2008 Brian Paul All Rights Reserved. - * Copyright (C) 2008 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 slang_emit.c - * Emit program instructions (PI code) from IR trees. - * \author Brian Paul - */ - -/*** - *** NOTES - *** - *** To emit GPU instructions, we basically just do an in-order traversal - *** of the IR tree. - ***/ - - -#include "main/imports.h" -#include "main/context.h" -#include "program/program.h" -#include "program/prog_instruction.h" -#include "program/prog_parameter.h" -#include "program/prog_print.h" -#include "slang_builtin.h" -#include "slang_emit.h" -#include "slang_mem.h" - - -#define PEEPHOLE_OPTIMIZATIONS 1 -#define ANNOTATE 0 - - -typedef struct -{ - slang_info_log *log; - slang_var_table *vt; - struct gl_program *prog; - struct gl_program **Subroutines; - GLuint NumSubroutines; - - GLuint MaxInstructions; /**< size of prog->Instructions[] buffer */ - - GLboolean UnresolvedFunctions; - - /* code-gen options */ - GLboolean EmitHighLevelInstructions; - GLboolean EmitCondCodes; - GLboolean EmitComments; - GLboolean EmitBeginEndSub; /* XXX TEMPORARY */ -} slang_emit_info; - - - -static struct gl_program * -new_subroutine(slang_emit_info *emitInfo, GLuint *id) -{ - GET_CURRENT_CONTEXT(ctx); - const GLuint n = emitInfo->NumSubroutines; - - emitInfo->Subroutines = (struct gl_program **) - _mesa_realloc(emitInfo->Subroutines, - n * sizeof(struct gl_program *), - (n + 1) * sizeof(struct gl_program *)); - emitInfo->Subroutines[n] = ctx->Driver.NewProgram(ctx, emitInfo->prog->Target, 0); - emitInfo->Subroutines[n]->Parameters = emitInfo->prog->Parameters; - emitInfo->NumSubroutines++; - *id = n; - return emitInfo->Subroutines[n]; -} - - -/** - * Convert a writemask to a swizzle. Used for testing cond codes because - * we only want to test the cond code component(s) that was set by the - * previous instruction. - */ -static GLuint -writemask_to_swizzle(GLuint writemask) -{ - if (writemask == WRITEMASK_X) - return SWIZZLE_XXXX; - if (writemask == WRITEMASK_Y) - return SWIZZLE_YYYY; - if (writemask == WRITEMASK_Z) - return SWIZZLE_ZZZZ; - if (writemask == WRITEMASK_W) - return SWIZZLE_WWWW; - return SWIZZLE_XYZW; /* shouldn't be hit */ -} - - -/** - * Convert a swizzle mask to a writemask. - * Note that the slang_ir_storage->Swizzle field can represent either a - * swizzle mask or a writemask, depending on how it's used. For example, - * when we parse "direction.yz" alone, we don't know whether .yz is a - * writemask or a swizzle. In this case, we encode ".yz" in store->Swizzle - * as a swizzle mask (.yz?? actually). Later, if direction.yz is used as - * an R-value, we use store->Swizzle as-is. Otherwise, if direction.yz is - * used as an L-value, we convert it to a writemask. - */ -static GLuint -swizzle_to_writemask(GLuint swizzle) -{ - GLuint i, writemask = 0x0; - for (i = 0; i < 4; i++) { - GLuint swz = GET_SWZ(swizzle, i); - if (swz <= SWIZZLE_W) { - writemask |= (1 << swz); - } - } - return writemask; -} - - -/** - * Swizzle a swizzle (function composition). - * That is, return swz2(swz1), or said another way: swz1.szw2 - * Example: swizzle_swizzle(".zwxx", ".xxyw") yields ".zzwx" - */ -GLuint -_slang_swizzle_swizzle(GLuint swz1, GLuint swz2) -{ - GLuint i, swz, s[4]; - for (i = 0; i < 4; i++) { - GLuint c = GET_SWZ(swz2, i); - if (c <= SWIZZLE_W) - s[i] = GET_SWZ(swz1, c); - else - s[i] = c; - } - swz = MAKE_SWIZZLE4(s[0], s[1], s[2], s[3]); - return swz; -} - - -/** - * Return the default swizzle mask for accessing a variable of the - * given size (in floats). If size = 1, comp is used to identify - * which component [0..3] of the register holds the variable. - */ -GLuint -_slang_var_swizzle(GLint size, GLint comp) -{ - switch (size) { - case 1: - return MAKE_SWIZZLE4(comp, SWIZZLE_NIL, SWIZZLE_NIL, SWIZZLE_NIL); - case 2: - return MAKE_SWIZZLE4(SWIZZLE_X, SWIZZLE_Y, SWIZZLE_NIL, SWIZZLE_NIL); - case 3: - return MAKE_SWIZZLE4(SWIZZLE_X, SWIZZLE_Y, SWIZZLE_Z, SWIZZLE_NIL); - default: - return SWIZZLE_XYZW; - } -} - - - -/** - * Allocate storage for the given node (if it hasn't already been allocated). - * - * Typically this is temporary storage for an intermediate result (such as - * for a multiply or add, etc). - * - * If n->Store does not exist it will be created and will be of the size - * specified by defaultSize. - */ -static GLboolean -alloc_node_storage(slang_emit_info *emitInfo, slang_ir_node *n, - GLint defaultSize) -{ - assert(!n->Var); - if (!n->Store) { - assert(defaultSize > 0); - n->Store = _slang_new_ir_storage(PROGRAM_TEMPORARY, -1, defaultSize); - if (!n->Store) { - return GL_FALSE; - } - } - - /* now allocate actual register(s). I.e. set n->Store->Index >= 0 */ - if (n->Store->Index < 0) { - if (!_slang_alloc_temp(emitInfo->vt, n->Store)) { - slang_info_log_error(emitInfo->log, - "Ran out of registers, too many temporaries"); - _slang_free(n->Store); - n->Store = NULL; - return GL_FALSE; - } - } - return GL_TRUE; -} - - -/** - * Free temporary storage, if n->Store is, in fact, temp storage. - * Otherwise, no-op. - */ -static void -free_node_storage(slang_var_table *vt, slang_ir_node *n) -{ - if (n->Store->File == PROGRAM_TEMPORARY && - n->Store->Index >= 0 && - n->Opcode != IR_SWIZZLE) { - if (_slang_is_temp(vt, n->Store)) { - _slang_free_temp(vt, n->Store); - n->Store->Index = -1; - n->Store = NULL; /* XXX this may not be needed */ - } - } -} - - -/** - * Helper function to allocate a short-term temporary. - * Free it with _slang_free_temp(). - */ -static GLboolean -alloc_local_temp(slang_emit_info *emitInfo, slang_ir_storage *temp, GLint size) -{ - assert(size >= 1); - assert(size <= 4); - memset(temp, 0, sizeof(*temp)); - temp->Size = size; - temp->File = PROGRAM_TEMPORARY; - temp->Index = -1; - return _slang_alloc_temp(emitInfo->vt, temp); -} - - -/** - * Remove any SWIZZLE_NIL terms from given swizzle mask. - * For a swizzle like .z??? generate .zzzz (replicate single component). - * Else, for .wx?? generate .wxzw (insert default component for the position). - */ -static GLuint -fix_swizzle(GLuint swizzle) -{ - GLuint c0 = GET_SWZ(swizzle, 0), - c1 = GET_SWZ(swizzle, 1), - c2 = GET_SWZ(swizzle, 2), - c3 = GET_SWZ(swizzle, 3); - if (c1 == SWIZZLE_NIL && c2 == SWIZZLE_NIL && c3 == SWIZZLE_NIL) { - /* smear first component across all positions */ - c1 = c2 = c3 = c0; - } - else { - /* insert default swizzle components */ - if (c0 == SWIZZLE_NIL) - c0 = SWIZZLE_X; - if (c1 == SWIZZLE_NIL) - c1 = SWIZZLE_Y; - if (c2 == SWIZZLE_NIL) - c2 = SWIZZLE_Z; - if (c3 == SWIZZLE_NIL) - c3 = SWIZZLE_W; - } - return MAKE_SWIZZLE4(c0, c1, c2, c3); -} - - - -/** - * Convert IR storage to an instruction dst register. - */ -static void -storage_to_dst_reg(struct prog_dst_register *dst, const slang_ir_storage *st) -{ - const GLboolean relAddr = st->RelAddr; - const GLint size = st->Size; - GLint index = st->Index; - GLuint swizzle = st->Swizzle; - - assert(index >= 0); - /* if this is storage relative to some parent storage, walk up the tree */ - while (st->Parent) { - st = st->Parent; - assert(st->Index >= 0); - index += st->Index; - swizzle = _slang_swizzle_swizzle(st->Swizzle, swizzle); - } - - assert(st->File != PROGRAM_UNDEFINED); - dst->File = st->File; - - assert(index >= 0); - dst->Index = index; - - assert(size >= 1); - assert(size <= 4); - - if (swizzle != SWIZZLE_XYZW) { - dst->WriteMask = swizzle_to_writemask(swizzle); - } - else { - switch (size) { - case 1: - dst->WriteMask = WRITEMASK_X << GET_SWZ(st->Swizzle, 0); - break; - case 2: - dst->WriteMask = WRITEMASK_XY; - break; - case 3: - dst->WriteMask = WRITEMASK_XYZ; - break; - case 4: - dst->WriteMask = WRITEMASK_XYZW; - break; - default: - ; /* error would have been caught above */ - } - } - - dst->RelAddr = relAddr; -} - - -/** - * Convert IR storage to an instruction src register. - */ -static void -storage_to_src_reg(struct prog_src_register *src, const slang_ir_storage *st) -{ - const GLboolean relAddr = st->RelAddr; - GLint index = st->Index; - GLuint swizzle = st->Swizzle; - - /* if this is storage relative to some parent storage, walk up the tree */ - assert(index >= 0); - while (st->Parent) { - st = st->Parent; - if (st->Index < 0) { - /* an error should have been reported already */ - return; - } - assert(st->Index >= 0); - index += st->Index; - swizzle = _slang_swizzle_swizzle(fix_swizzle(st->Swizzle), swizzle); - } - - assert(st->File >= 0); -#if 1 /* XXX temporary */ - if (st->File == PROGRAM_UNDEFINED) { - slang_ir_storage *st0 = (slang_ir_storage *) st; - st0->File = PROGRAM_TEMPORARY; - } -#endif - assert(st->File < PROGRAM_FILE_MAX); - src->File = st->File; - - assert(index >= 0); - src->Index = index; - - swizzle = fix_swizzle(swizzle); - assert(GET_SWZ(swizzle, 0) <= SWIZZLE_W); - assert(GET_SWZ(swizzle, 1) <= SWIZZLE_W); - assert(GET_SWZ(swizzle, 2) <= SWIZZLE_W); - assert(GET_SWZ(swizzle, 3) <= SWIZZLE_W); - src->Swizzle = swizzle; - - src->HasIndex2 = st->Is2D; - src->Index2 = st->Index2; - - src->RelAddr = relAddr; -} - - -/* - * Setup storage pointing to a scalar constant/literal. - */ -static void -constant_to_storage(slang_emit_info *emitInfo, - GLfloat val, - slang_ir_storage *store) -{ - GLuint swizzle; - GLint reg; - GLfloat value[4]; - - value[0] = val; - reg = _mesa_add_unnamed_constant(emitInfo->prog->Parameters, - value, 1, &swizzle); - - memset(store, 0, sizeof(*store)); - store->File = PROGRAM_CONSTANT; - store->Index = reg; - store->Swizzle = swizzle; -} - - -/** - * Add new instruction at end of given program. - * \param prog the program to append instruction onto - * \param opcode opcode for the new instruction - * \return pointer to the new instruction - */ -static struct prog_instruction * -new_instruction(slang_emit_info *emitInfo, gl_inst_opcode opcode) -{ - struct gl_program *prog = emitInfo->prog; - struct prog_instruction *inst; - -#if 0 - /* print prev inst */ - if (prog->NumInstructions > 0) { - _mesa_print_instruction(prog->Instructions + prog->NumInstructions - 1); - } -#endif - assert(prog->NumInstructions <= emitInfo->MaxInstructions); - - if (prog->NumInstructions == emitInfo->MaxInstructions) { - /* grow the instruction buffer */ - emitInfo->MaxInstructions += 20; - prog->Instructions = - _mesa_realloc_instructions(prog->Instructions, - prog->NumInstructions, - emitInfo->MaxInstructions); - if (!prog->Instructions) { - return NULL; - } - } - - inst = prog->Instructions + prog->NumInstructions; - prog->NumInstructions++; - _mesa_init_instructions(inst, 1); - inst->Opcode = opcode; - inst->BranchTarget = -1; /* invalid */ - /* - printf("New inst %d: %p %s\n", prog->NumInstructions-1,(void*)inst, - _mesa_opcode_string(inst->Opcode)); - */ - return inst; -} - - -static struct prog_instruction * -emit_arl_load(slang_emit_info *emitInfo, - gl_register_file file, GLint index, GLuint swizzle) -{ - struct prog_instruction *inst = new_instruction(emitInfo, OPCODE_ARL); - if (inst) { - inst->SrcReg[0].File = file; - inst->SrcReg[0].Index = index; - inst->SrcReg[0].Swizzle = fix_swizzle(swizzle); - inst->DstReg.File = PROGRAM_ADDRESS; - inst->DstReg.Index = 0; - inst->DstReg.WriteMask = WRITEMASK_X; - } - return inst; -} - - -/** - * Emit a new instruction with given opcode, operands. - * At this point the instruction may have multiple indirect register - * loads/stores. We convert those into ARL loads and address-relative - * operands. See comments inside. - * At some point in the future we could directly emit indirectly addressed - * registers in Mesa GPU instructions. - */ -static struct prog_instruction * -emit_instruction(slang_emit_info *emitInfo, - gl_inst_opcode opcode, - const slang_ir_storage *dst, - const slang_ir_storage *src0, - const slang_ir_storage *src1, - const slang_ir_storage *src2) -{ - struct prog_instruction *inst; - GLuint numIndirect = 0; - const slang_ir_storage *src[3]; - slang_ir_storage newSrc[3], newDst; - GLuint i; - GLboolean isTemp[3]; - - isTemp[0] = isTemp[1] = isTemp[2] = GL_FALSE; - - src[0] = src0; - src[1] = src1; - src[2] = src2; - - /* count up how many operands are indirect loads */ - for (i = 0; i < 3; i++) { - if (src[i] && src[i]->IsIndirect) - numIndirect++; - } - if (dst && dst->IsIndirect) - numIndirect++; - - /* Take special steps for indirect register loads. - * If we had multiple address registers this would be simpler. - * For example, this GLSL code: - * x[i] = y[j] + z[k]; - * would translate into something like: - * ARL ADDR.x, i; - * ARL ADDR.y, j; - * ARL ADDR.z, k; - * ADD TEMP[ADDR.x+5], TEMP[ADDR.y+9], TEMP[ADDR.z+4]; - * But since we currently only have one address register we have to do this: - * ARL ADDR.x, i; - * MOV t1, TEMP[ADDR.x+9]; - * ARL ADDR.x, j; - * MOV t2, TEMP[ADDR.x+4]; - * ARL ADDR.x, k; - * ADD TEMP[ADDR.x+5], t1, t2; - * The code here figures this out... - */ - if (numIndirect > 0) { - for (i = 0; i < 3; i++) { - if (src[i] && src[i]->IsIndirect) { - /* load the ARL register with the indirect register */ - emit_arl_load(emitInfo, - src[i]->IndirectFile, - src[i]->IndirectIndex, - src[i]->IndirectSwizzle); - - if (numIndirect > 1) { - /* Need to load src[i] into a temporary register */ - slang_ir_storage srcRelAddr; - alloc_local_temp(emitInfo, &newSrc[i], src[i]->Size); - isTemp[i] = GL_TRUE; - - /* set RelAddr flag on src register */ - srcRelAddr = *src[i]; - srcRelAddr.RelAddr = GL_TRUE; - srcRelAddr.IsIndirect = GL_FALSE; /* not really needed */ - - /* MOV newSrc, srcRelAddr; */ - inst = emit_instruction(emitInfo, - OPCODE_MOV, - &newSrc[i], - &srcRelAddr, - NULL, - NULL); - if (!inst) { - return NULL; - } - - src[i] = &newSrc[i]; - } - else { - /* just rewrite the src[i] storage to be ARL-relative */ - newSrc[i] = *src[i]; - newSrc[i].RelAddr = GL_TRUE; - newSrc[i].IsIndirect = GL_FALSE; /* not really needed */ - src[i] = &newSrc[i]; - } - } - } - } - - /* Take special steps for indirect dest register write */ - if (dst && dst->IsIndirect) { - /* load the ARL register with the indirect register */ - emit_arl_load(emitInfo, - dst->IndirectFile, - dst->IndirectIndex, - dst->IndirectSwizzle); - newDst = *dst; - newDst.RelAddr = GL_TRUE; - newDst.IsIndirect = GL_FALSE; - dst = &newDst; - } - - /* OK, emit the instruction and its dst, src regs */ - inst = new_instruction(emitInfo, opcode); - if (!inst) - return NULL; - - if (dst) - storage_to_dst_reg(&inst->DstReg, dst); - - for (i = 0; i < 3; i++) { - if (src[i]) - storage_to_src_reg(&inst->SrcReg[i], src[i]); - } - - /* Free any temp registers that we allocated above */ - for (i = 0; i < 3; i++) { - if (isTemp[i]) - _slang_free_temp(emitInfo->vt, &newSrc[i]); - } - - return inst; -} - - - -/** - * Put a comment on the given instruction. - */ -static void -inst_comment(struct prog_instruction *inst, const char *comment) -{ - if (inst) - inst->Comment = _mesa_strdup(comment); -} - - - -/** - * Return pointer to last instruction in program. - */ -static struct prog_instruction * -prev_instruction(slang_emit_info *emitInfo) -{ - struct gl_program *prog = emitInfo->prog; - if (prog->NumInstructions == 0) - return NULL; - else - return prog->Instructions + prog->NumInstructions - 1; -} - - -static struct prog_instruction * -emit(slang_emit_info *emitInfo, slang_ir_node *n); - - -/** - * Return an annotation string for given node's storage. - */ -static char * -storage_annotation(const slang_ir_node *n, const struct gl_program *prog) -{ -#if ANNOTATE - const slang_ir_storage *st = n->Store; - static char s[100] = ""; - - if (!st) - return _mesa_strdup(""); - - switch (st->File) { - case PROGRAM_CONSTANT: - if (st->Index >= 0) { - const GLfloat *val = prog->Parameters->ParameterValues[st->Index]; - if (st->Swizzle == SWIZZLE_NOOP) - _mesa_snprintf(s, sizeof(s), "{%g, %g, %g, %g}", val[0], val[1], val[2], val[3]); - else { - _mesa_snprintf(s, sizeof(s), "%g", val[GET_SWZ(st->Swizzle, 0)]); - } - } - break; - case PROGRAM_TEMPORARY: - if (n->Var) - _mesa_snprintf(s, sizeof(s), "%s", (char *) n->Var->a_name); - else - _mesa_snprintf(s, sizeof(s), "t[%d]", st->Index); - break; - case PROGRAM_STATE_VAR: - case PROGRAM_UNIFORM: - _mesa_snprintf(s, sizeof(s), "%s", prog->Parameters->Parameters[st->Index].Name); - break; - case PROGRAM_VARYING: - _mesa_snprintf(s, sizeof(s), "%s", prog->Varying->Parameters[st->Index].Name); - break; - case PROGRAM_INPUT: - _mesa_snprintf(s, sizeof(s), "input[%d]", st->Index); - break; - case PROGRAM_OUTPUT: - _mesa_snprintf(s, sizeof(s), "output[%d]", st->Index); - break; - default: - s[0] = 0; - } - return _mesa_strdup(s); -#else - return NULL; -#endif -} - - -/** - * Return an annotation string for an instruction. - */ -static char * -instruction_annotation(gl_inst_opcode opcode, char *dstAnnot, - char *srcAnnot0, char *srcAnnot1, char *srcAnnot2) -{ -#if ANNOTATE - const char *operator; - char *s; - int len = 50; - - if (dstAnnot) - len += strlen(dstAnnot); - else - dstAnnot = _mesa_strdup(""); - - if (srcAnnot0) - len += strlen(srcAnnot0); - else - srcAnnot0 = _mesa_strdup(""); - - if (srcAnnot1) - len += strlen(srcAnnot1); - else - srcAnnot1 = _mesa_strdup(""); - - if (srcAnnot2) - len += strlen(srcAnnot2); - else - srcAnnot2 = _mesa_strdup(""); - - switch (opcode) { - case OPCODE_ADD: - operator = "+"; - break; - case OPCODE_SUB: - operator = "-"; - break; - case OPCODE_MUL: - operator = "*"; - break; - case OPCODE_DP2: - operator = "DP2"; - break; - case OPCODE_DP3: - operator = "DP3"; - break; - case OPCODE_DP4: - operator = "DP4"; - break; - case OPCODE_XPD: - operator = "XPD"; - break; - case OPCODE_RSQ: - operator = "RSQ"; - break; - case OPCODE_SGT: - operator = ">"; - break; - default: - operator = ","; - } - - s = (char *) malloc(len); - _mesa_snprintf(s, len, "%s = %s %s %s %s", dstAnnot, - srcAnnot0, operator, srcAnnot1, srcAnnot2); - - free(dstAnnot); - free(srcAnnot0); - free(srcAnnot1); - free(srcAnnot2); - - return s; -#else - return NULL; -#endif -} - - -/** - * Emit an instruction that's just a comment. - */ -static struct prog_instruction * -emit_comment(slang_emit_info *emitInfo, const char *comment) -{ - struct prog_instruction *inst = new_instruction(emitInfo, OPCODE_NOP); - if (inst) { - inst_comment(inst, comment); - } - return inst; -} - - -/** - * Generate code for a simple arithmetic instruction. - * Either 1, 2 or 3 operands. - */ -static struct prog_instruction * -emit_arith(slang_emit_info *emitInfo, slang_ir_node *n) -{ - const slang_ir_info *info = _slang_ir_info(n->Opcode); - struct prog_instruction *inst; - GLuint i; - - assert(info); - assert(info->InstOpcode != OPCODE_NOP); - -#if PEEPHOLE_OPTIMIZATIONS - /* Look for MAD opportunity */ - if (info->NumParams == 2 && - n->Opcode == IR_ADD && n->Children[0]->Opcode == IR_MUL) { - /* found pattern IR_ADD(IR_MUL(A, B), C) */ - emit(emitInfo, n->Children[0]->Children[0]); /* A */ - emit(emitInfo, n->Children[0]->Children[1]); /* B */ - emit(emitInfo, n->Children[1]); /* C */ - if (!alloc_node_storage(emitInfo, n, -1)) { /* dest */ - return NULL; - } - - inst = emit_instruction(emitInfo, - OPCODE_MAD, - n->Store, - n->Children[0]->Children[0]->Store, - n->Children[0]->Children[1]->Store, - n->Children[1]->Store); - - free_node_storage(emitInfo->vt, n->Children[0]->Children[0]); - free_node_storage(emitInfo->vt, n->Children[0]->Children[1]); - free_node_storage(emitInfo->vt, n->Children[1]); - return inst; - } - - if (info->NumParams == 2 && - n->Opcode == IR_ADD && n->Children[1]->Opcode == IR_MUL) { - /* found pattern IR_ADD(A, IR_MUL(B, C)) */ - emit(emitInfo, n->Children[0]); /* A */ - emit(emitInfo, n->Children[1]->Children[0]); /* B */ - emit(emitInfo, n->Children[1]->Children[1]); /* C */ - if (!alloc_node_storage(emitInfo, n, -1)) { /* dest */ - return NULL; - } - - inst = emit_instruction(emitInfo, - OPCODE_MAD, - n->Store, - n->Children[1]->Children[0]->Store, - n->Children[1]->Children[1]->Store, - n->Children[0]->Store); - - free_node_storage(emitInfo->vt, n->Children[1]->Children[0]); - free_node_storage(emitInfo->vt, n->Children[1]->Children[1]); - free_node_storage(emitInfo->vt, n->Children[0]); - return inst; - } -#endif - - /* gen code for children, may involve temp allocation */ - for (i = 0; i < info->NumParams; i++) { - emit(emitInfo, n->Children[i]); - if (!n->Children[i] || !n->Children[i]->Store) { - /* error recovery */ - return NULL; - } - } - - /* result storage */ - if (!alloc_node_storage(emitInfo, n, -1)) { - return NULL; - } - - inst = emit_instruction(emitInfo, - info->InstOpcode, - n->Store, /* dest */ - (info->NumParams > 0 ? n->Children[0]->Store : NULL), - (info->NumParams > 1 ? n->Children[1]->Store : NULL), - (info->NumParams > 2 ? n->Children[2]->Store : NULL) - ); - - /* free temps */ - for (i = 0; i < info->NumParams; i++) - free_node_storage(emitInfo->vt, n->Children[i]); - - return inst; -} - - -/** - * Emit code for == and != operators. These could normally be handled - * by emit_arith() except we need to be able to handle structure comparisons. - */ -static struct prog_instruction * -emit_compare(slang_emit_info *emitInfo, slang_ir_node *n) -{ - struct prog_instruction *inst = NULL; - GLint size; - - assert(n->Opcode == IR_EQUAL || n->Opcode == IR_NOTEQUAL); - - /* gen code for children */ - emit(emitInfo, n->Children[0]); - emit(emitInfo, n->Children[1]); - - if (n->Children[0]->Store->Size != n->Children[1]->Store->Size) { - /* XXX this error should have been caught in slang_codegen.c */ - slang_info_log_error(emitInfo->log, "invalid operands to == or !="); - n->Store = NULL; - return NULL; - } - - /* final result is 1 bool */ - if (!alloc_node_storage(emitInfo, n, 1)) - return NULL; - - size = n->Children[0]->Store->Size; - - if (size == 1) { - gl_inst_opcode opcode = n->Opcode == IR_EQUAL ? OPCODE_SEQ : OPCODE_SNE; - inst = emit_instruction(emitInfo, - opcode, - n->Store, /* dest */ - n->Children[0]->Store, - n->Children[1]->Store, - NULL); - } - else if (size <= 4) { - /* compare two vectors. - * Unfortunately, there's no instruction to compare vectors and - * return a scalar result. Do it with some compare and dot product - * instructions... - */ - GLuint swizzle; - gl_inst_opcode dotOp; - slang_ir_storage tempStore; - - if (!alloc_local_temp(emitInfo, &tempStore, 4)) { - n->Store = NULL; - return NULL; - /* out of temps */ - } - - if (size == 4) { - dotOp = OPCODE_DP4; - swizzle = SWIZZLE_XYZW; - } - else if (size == 3) { - dotOp = OPCODE_DP3; - swizzle = SWIZZLE_XYZW; - } - else { - assert(size == 2); - dotOp = OPCODE_DP3; /* XXX use OPCODE_DP2 eventually */ - swizzle = MAKE_SWIZZLE4(SWIZZLE_X, SWIZZLE_Y, SWIZZLE_Y, SWIZZLE_Y); - } - - /* Compute inequality (temp = (A != B)) */ - inst = emit_instruction(emitInfo, - OPCODE_SNE, - &tempStore, - n->Children[0]->Store, - n->Children[1]->Store, - NULL); - if (!inst) { - return NULL; - } - inst_comment(inst, "Compare values"); - - /* Compute val = DOT(temp, temp) (reduction) */ - inst = emit_instruction(emitInfo, - dotOp, - n->Store, - &tempStore, - &tempStore, - NULL); - if (!inst) { - return NULL; - } - inst->SrcReg[0].Swizzle = inst->SrcReg[1].Swizzle = swizzle; /*override*/ - inst_comment(inst, "Reduce vec to bool"); - - _slang_free_temp(emitInfo->vt, &tempStore); /* free temp */ - - if (n->Opcode == IR_EQUAL) { - /* compute val = !val.x with SEQ val, val, 0; */ - slang_ir_storage zero; - constant_to_storage(emitInfo, 0.0, &zero); - inst = emit_instruction(emitInfo, - OPCODE_SEQ, - n->Store, /* dest */ - n->Store, - &zero, - NULL); - if (!inst) { - return NULL; - } - inst_comment(inst, "Invert true/false"); - } - } - else { - /* size > 4, struct or array compare. - * XXX this won't work reliably for structs with padding!! - */ - GLint i, num = (n->Children[0]->Store->Size + 3) / 4; - slang_ir_storage accTemp, sneTemp; - - if (!alloc_local_temp(emitInfo, &accTemp, 4)) - return NULL; - - if (!alloc_local_temp(emitInfo, &sneTemp, 4)) - return NULL; - - for (i = 0; i < num; i++) { - slang_ir_storage srcStore0 = *n->Children[0]->Store; - slang_ir_storage srcStore1 = *n->Children[1]->Store; - srcStore0.Index += i; - srcStore1.Index += i; - - if (i == 0) { - /* SNE accTemp, left[i], right[i] */ - inst = emit_instruction(emitInfo, OPCODE_SNE, - &accTemp, /* dest */ - &srcStore0, - &srcStore1, - NULL); - if (!inst) { - return NULL; - } - inst_comment(inst, "Begin struct/array comparison"); - } - else { - /* SNE sneTemp, left[i], right[i] */ - inst = emit_instruction(emitInfo, OPCODE_SNE, - &sneTemp, /* dest */ - &srcStore0, - &srcStore1, - NULL); - if (!inst) { - return NULL; - } - /* ADD accTemp, accTemp, sneTemp; # like logical-OR */ - inst = emit_instruction(emitInfo, OPCODE_ADD, - &accTemp, /* dest */ - &accTemp, - &sneTemp, - NULL); - if (!inst) { - return NULL; - } - } - } - - /* compute accTemp.x || accTemp.y || accTemp.z || accTemp.w with DOT4 */ - inst = emit_instruction(emitInfo, OPCODE_DP4, - n->Store, - &accTemp, - &accTemp, - NULL); - if (!inst) { - return NULL; - } - inst_comment(inst, "End struct/array comparison"); - - if (n->Opcode == IR_EQUAL) { - /* compute tmp.x = !tmp.x via tmp.x = (tmp.x == 0) */ - slang_ir_storage zero; - constant_to_storage(emitInfo, 0.0, &zero); - inst = emit_instruction(emitInfo, OPCODE_SEQ, - n->Store, /* dest */ - n->Store, - &zero, - NULL); - if (!inst) { - return NULL; - } - inst_comment(inst, "Invert true/false"); - } - - _slang_free_temp(emitInfo->vt, &accTemp); - _slang_free_temp(emitInfo->vt, &sneTemp); - } - - /* free temps */ - free_node_storage(emitInfo->vt, n->Children[0]); - free_node_storage(emitInfo->vt, n->Children[1]); - - return inst; -} - - - -/** - * Generate code for an IR_CLAMP instruction. - */ -static struct prog_instruction * -emit_clamp(slang_emit_info *emitInfo, slang_ir_node *n) -{ - struct prog_instruction *inst; - slang_ir_node tmpNode; - - assert(n->Opcode == IR_CLAMP); - /* ch[0] = value - * ch[1] = min limit - * ch[2] = max limit - */ - - inst = emit(emitInfo, n->Children[0]); - - /* If lower limit == 0.0 and upper limit == 1.0, - * set prev instruction's SaturateMode field to SATURATE_ZERO_ONE. - * Else, - * emit OPCODE_MIN, OPCODE_MAX sequence. - */ -#if 0 - /* XXX this isn't quite finished yet */ - if (n->Children[1]->Opcode == IR_FLOAT && - n->Children[1]->Value[0] == 0.0 && - n->Children[1]->Value[1] == 0.0 && - n->Children[1]->Value[2] == 0.0 && - n->Children[1]->Value[3] == 0.0 && - n->Children[2]->Opcode == IR_FLOAT && - n->Children[2]->Value[0] == 1.0 && - n->Children[2]->Value[1] == 1.0 && - n->Children[2]->Value[2] == 1.0 && - n->Children[2]->Value[3] == 1.0) { - if (!inst) { - inst = prev_instruction(prog); - } - if (inst && inst->Opcode != OPCODE_NOP) { - /* and prev instruction's DstReg matches n->Children[0]->Store */ - inst->SaturateMode = SATURATE_ZERO_ONE; - n->Store = n->Children[0]->Store; - return inst; - } - } -#else - (void) inst; -#endif - - if (!alloc_node_storage(emitInfo, n, n->Children[0]->Store->Size)) - return NULL; - - emit(emitInfo, n->Children[1]); - emit(emitInfo, n->Children[2]); - - /* Some GPUs don't allow reading from output registers. So if the - * dest for this clamp() is an output reg, we can't use that reg for - * the intermediate result. Use a temp register instead. - */ - memset(&tmpNode, 0, sizeof(tmpNode)); - if (!alloc_node_storage(emitInfo, &tmpNode, n->Store->Size)) { - return NULL; - } - - /* tmp = max(ch[0], ch[1]) */ - inst = emit_instruction(emitInfo, OPCODE_MAX, - tmpNode.Store, /* dest */ - n->Children[0]->Store, - n->Children[1]->Store, - NULL); - if (!inst) { - return NULL; - } - - /* n->dest = min(tmp, ch[2]) */ - inst = emit_instruction(emitInfo, OPCODE_MIN, - n->Store, /* dest */ - tmpNode.Store, - n->Children[2]->Store, - NULL); - - free_node_storage(emitInfo->vt, &tmpNode); - - return inst; -} - - -static struct prog_instruction * -emit_negation(slang_emit_info *emitInfo, slang_ir_node *n) -{ - /* Implement as MOV dst, -src; */ - /* XXX we could look at the previous instruction and in some circumstances - * modify it to accomplish the negation. - */ - struct prog_instruction *inst; - - emit(emitInfo, n->Children[0]); - - if (!alloc_node_storage(emitInfo, n, n->Children[0]->Store->Size)) - return NULL; - - inst = emit_instruction(emitInfo, - OPCODE_MOV, - n->Store, /* dest */ - n->Children[0]->Store, - NULL, - NULL); - if (inst) { - inst->SrcReg[0].Negate = NEGATE_XYZW; - } - return inst; -} - - -static struct prog_instruction * -emit_label(slang_emit_info *emitInfo, const slang_ir_node *n) -{ - assert(n->Label); -#if 0 - /* XXX this fails in loop tail code - investigate someday */ - assert(_slang_label_get_location(n->Label) < 0); - _slang_label_set_location(n->Label, emitInfo->prog->NumInstructions, - emitInfo->prog); -#else - if (_slang_label_get_location(n->Label) < 0) - _slang_label_set_location(n->Label, emitInfo->prog->NumInstructions, - emitInfo->prog); -#endif - return NULL; -} - - -/** - * Emit code for a function call. - * Note that for each time a function is called, we emit the function's - * body code again because the set of available registers may be different. - */ -static struct prog_instruction * -emit_fcall(slang_emit_info *emitInfo, slang_ir_node *n) -{ - struct gl_program *progSave; - struct prog_instruction *inst; - GLuint subroutineId; - GLuint maxInstSave; - - assert(n->Opcode == IR_CALL); - assert(n->Label); - - /* save/push cur program */ - maxInstSave = emitInfo->MaxInstructions; - progSave = emitInfo->prog; - - emitInfo->prog = new_subroutine(emitInfo, &subroutineId); - emitInfo->MaxInstructions = emitInfo->prog->NumInstructions; - - _slang_label_set_location(n->Label, emitInfo->prog->NumInstructions, - emitInfo->prog); - - if (emitInfo->EmitBeginEndSub) { - /* BGNSUB isn't a real instruction. - * We require a label (i.e. "foobar:") though, if we're going to - * print the program in the NV format. The BNGSUB instruction is - * really just a NOP to attach the label to. - */ - inst = new_instruction(emitInfo, OPCODE_BGNSUB); - if (!inst) { - return NULL; - } - inst_comment(inst, n->Label->Name); - } - - /* body of function: */ - emit(emitInfo, n->Children[0]); - n->Store = n->Children[0]->Store; - - /* add RET instruction now, if needed */ - inst = prev_instruction(emitInfo); - if (inst && inst->Opcode != OPCODE_RET) { - inst = new_instruction(emitInfo, OPCODE_RET); - if (!inst) { - return NULL; - } - } - - if (emitInfo->EmitBeginEndSub) { - inst = new_instruction(emitInfo, OPCODE_ENDSUB); - if (!inst) { - return NULL; - } - inst_comment(inst, n->Label->Name); - } - - /* pop/restore cur program */ - emitInfo->prog = progSave; - emitInfo->MaxInstructions = maxInstSave; - - /* emit the function call */ - inst = new_instruction(emitInfo, OPCODE_CAL); - if (!inst) { - return NULL; - } - /* The branch target is just the subroutine number (changed later) */ - inst->BranchTarget = subroutineId; - inst_comment(inst, n->Label->Name); - assert(inst->BranchTarget >= 0); - - return inst; -} - - -/** - * Emit code for a 'return' statement. - */ -static struct prog_instruction * -emit_return(slang_emit_info *emitInfo, slang_ir_node *n) -{ - struct prog_instruction *inst; - assert(n); - assert(n->Opcode == IR_RETURN); - assert(n->Label); - inst = new_instruction(emitInfo, OPCODE_RET); - if (inst) { - inst->DstReg.CondMask = COND_TR; /* always return */ - } - return inst; -} - - -static struct prog_instruction * -emit_kill(slang_emit_info *emitInfo) -{ - struct gl_fragment_program *fp; - struct prog_instruction *inst; - /* NV-KILL - discard fragment depending on condition code. - * Note that ARB-KILL depends on sign of vector operand. - */ - inst = new_instruction(emitInfo, OPCODE_KIL_NV); - if (!inst) { - return NULL; - } - inst->DstReg.CondMask = COND_TR; /* always kill */ - - assert(emitInfo->prog->Target == GL_FRAGMENT_PROGRAM_ARB); - fp = (struct gl_fragment_program *) emitInfo->prog; - fp->UsesKill = GL_TRUE; - - return inst; -} - - -static struct prog_instruction * -emit_tex(slang_emit_info *emitInfo, slang_ir_node *n) -{ - struct prog_instruction *inst; - gl_inst_opcode opcode; - GLboolean shadow = GL_FALSE; - - switch (n->Opcode) { - case IR_TEX: - opcode = OPCODE_TEX; - break; - case IR_TEX_SH: - opcode = OPCODE_TEX; - shadow = GL_TRUE; - break; - case IR_TEXB: - opcode = OPCODE_TXB; - break; - case IR_TEXB_SH: - opcode = OPCODE_TXB; - shadow = GL_TRUE; - break; - case IR_TEXP: - opcode = OPCODE_TXP; - break; - case IR_TEXP_SH: - opcode = OPCODE_TXP; - shadow = GL_TRUE; - break; - default: - _mesa_problem(NULL, "Bad IR TEX code"); - return NULL; - } - - if (n->Children[0]->Opcode == IR_ELEMENT) { - /* array is the sampler (a uniform which'll indicate the texture unit) */ - assert(n->Children[0]->Children[0]->Store); - assert(n->Children[0]->Children[0]->Store->File == PROGRAM_SAMPLER); - - emit(emitInfo, n->Children[0]); - - n->Children[0]->Var = n->Children[0]->Children[0]->Var; - } else { - /* this is the sampler (a uniform which'll indicate the texture unit) */ - assert(n->Children[0]->Store); - assert(n->Children[0]->Store->File == PROGRAM_SAMPLER); - } - - /* emit code for the texcoord operand */ - (void) emit(emitInfo, n->Children[1]); - - /* alloc storage for result of texture fetch */ - if (!alloc_node_storage(emitInfo, n, 4)) - return NULL; - - /* emit TEX instruction; Child[1] is the texcoord */ - inst = emit_instruction(emitInfo, - opcode, - n->Store, - n->Children[1]->Store, - NULL, - NULL); - if (!inst) { - return NULL; - } - - inst->TexShadow = shadow; - - /* Store->Index is the uniform/sampler index */ - assert(n->Children[0]->Store->Index >= 0); - inst->TexSrcUnit = n->Children[0]->Store->Index; - inst->TexSrcTarget = n->Children[0]->Store->TexTarget; - - /* mark the sampler as being used */ - _mesa_use_uniform(emitInfo->prog->Parameters, - (char *) n->Children[0]->Var->a_name); - - return inst; -} - - -/** - * Assignment/copy - */ -static struct prog_instruction * -emit_copy(slang_emit_info *emitInfo, slang_ir_node *n) -{ - struct prog_instruction *inst; - - assert(n->Opcode == IR_COPY); - - /* lhs */ - emit(emitInfo, n->Children[0]); - if (!n->Children[0]->Store || n->Children[0]->Store->Index < 0) { - /* an error should have been already recorded */ - return NULL; - } - - /* rhs */ - assert(n->Children[1]); - inst = emit(emitInfo, n->Children[1]); - - if (!n->Children[1]->Store || n->Children[1]->Store->Index < 0) { - if (!emitInfo->log->text && !emitInfo->UnresolvedFunctions) { - /* XXX this error should have been caught in slang_codegen.c */ - slang_info_log_error(emitInfo->log, "invalid assignment"); - } - return NULL; - } - - assert(n->Children[1]->Store->Index >= 0); - - /*assert(n->Children[0]->Store->Size == n->Children[1]->Store->Size);*/ - - n->Store = n->Children[0]->Store; - - if (n->Store->File == PROGRAM_SAMPLER) { - /* no code generated for sampler assignments, - * just copy the sampler index/target at compile time. - */ - n->Store->Index = n->Children[1]->Store->Index; - n->Store->TexTarget = n->Children[1]->Store->TexTarget; - return NULL; - } - -#if PEEPHOLE_OPTIMIZATIONS - if (inst && - (n->Children[1]->Opcode != IR_SWIZZLE) && - _slang_is_temp(emitInfo->vt, n->Children[1]->Store) && - (inst->DstReg.File == n->Children[1]->Store->File) && - (inst->DstReg.Index == n->Children[1]->Store->Index) && - !n->Children[0]->Store->IsIndirect && - n->Children[0]->Store->Size <= 4) { - /* Peephole optimization: - * The Right-Hand-Side has its results in a temporary place. - * Modify the RHS (and the prev instruction) to store its results - * in the destination specified by n->Children[0]. - * Then, this MOVE is a no-op. - * Ex: - * MUL tmp, x, y; - * MOV a, tmp; - * becomes: - * MUL a, x, y; - */ - - /* fixup the previous instruction (which stored the RHS result) */ - assert(n->Children[0]->Store->Index >= 0); - storage_to_dst_reg(&inst->DstReg, n->Children[0]->Store); - return inst; - } - else -#endif - { - if (n->Children[0]->Store->Size > 4) { - /* move matrix/struct etc (block of registers) */ - slang_ir_storage dstStore = *n->Children[0]->Store; - slang_ir_storage srcStore = *n->Children[1]->Store; - GLint size = srcStore.Size; - ASSERT(n->Children[1]->Store->Swizzle == SWIZZLE_NOOP); - dstStore.Size = 4; - srcStore.Size = 4; - while (size >= 4) { - inst = emit_instruction(emitInfo, OPCODE_MOV, - &dstStore, - &srcStore, - NULL, - NULL); - if (!inst) { - return NULL; - } - inst_comment(inst, "IR_COPY block"); - srcStore.Index++; - dstStore.Index++; - size -= 4; - } - } - else { - /* single register move */ - char *srcAnnot, *dstAnnot; - assert(n->Children[0]->Store->Index >= 0); - inst = emit_instruction(emitInfo, OPCODE_MOV, - n->Children[0]->Store, /* dest */ - n->Children[1]->Store, - NULL, - NULL); - if (!inst) { - return NULL; - } - dstAnnot = storage_annotation(n->Children[0], emitInfo->prog); - srcAnnot = storage_annotation(n->Children[1], emitInfo->prog); - inst->Comment = instruction_annotation(inst->Opcode, dstAnnot, - srcAnnot, NULL, NULL); - } - free_node_storage(emitInfo->vt, n->Children[1]); - return inst; - } -} - - -/** - * An IR_COND node wraps a boolean expression which is used by an - * IF or WHILE test. This is where we'll set condition codes, if needed. - */ -static struct prog_instruction * -emit_cond(slang_emit_info *emitInfo, slang_ir_node *n) -{ - struct prog_instruction *inst; - - assert(n->Opcode == IR_COND); - - if (!n->Children[0]) - return NULL; - - /* emit code for the expression */ - inst = emit(emitInfo, n->Children[0]); - - if (!n->Children[0]->Store) { - /* error recovery */ - return NULL; - } - - assert(n->Children[0]->Store); - /*assert(n->Children[0]->Store->Size == 1);*/ - - if (emitInfo->EmitCondCodes) { - if (inst && - n->Children[0]->Store && - inst->DstReg.File == n->Children[0]->Store->File && - inst->DstReg.Index == n->Children[0]->Store->Index) { - /* The previous instruction wrote to the register who's value - * we're testing. Just fix that instruction so that the - * condition codes are computed. - */ - inst->CondUpdate = GL_TRUE; - n->Store = n->Children[0]->Store; - return inst; - } - else { - /* This'll happen for things like "if (i) ..." where no code - * is normally generated for the expression "i". - * Generate a move instruction just to set condition codes. - */ - if (!alloc_node_storage(emitInfo, n, 1)) - return NULL; - inst = emit_instruction(emitInfo, OPCODE_MOV, - n->Store, /* dest */ - n->Children[0]->Store, - NULL, - NULL); - if (!inst) { - return NULL; - } - inst->CondUpdate = GL_TRUE; - inst_comment(inst, "COND expr"); - _slang_free_temp(emitInfo->vt, n->Store); - return inst; - } - } - else { - /* No-op: the boolean result of the expression is in a regular reg */ - n->Store = n->Children[0]->Store; - return inst; - } -} - - -/** - * Logical-NOT - */ -static struct prog_instruction * -emit_not(slang_emit_info *emitInfo, slang_ir_node *n) -{ - static const struct { - gl_inst_opcode op, opNot; - } operators[] = { - { OPCODE_SLT, OPCODE_SGE }, - { OPCODE_SLE, OPCODE_SGT }, - { OPCODE_SGT, OPCODE_SLE }, - { OPCODE_SGE, OPCODE_SLT }, - { OPCODE_SEQ, OPCODE_SNE }, - { OPCODE_SNE, OPCODE_SEQ }, - { 0, 0 } - }; - struct prog_instruction *inst; - slang_ir_storage zero; - GLuint i; - - /* child expr */ - inst = emit(emitInfo, n->Children[0]); - -#if PEEPHOLE_OPTIMIZATIONS - if (inst) { - /* if the prev instruction was a comparison instruction, invert it */ - for (i = 0; operators[i].op; i++) { - if (inst->Opcode == operators[i].op) { - inst->Opcode = operators[i].opNot; - n->Store = n->Children[0]->Store; - return inst; - } - } - } -#endif - - /* else, invert using SEQ (v = v == 0) */ - if (!alloc_node_storage(emitInfo, n, n->Children[0]->Store->Size)) - return NULL; - - constant_to_storage(emitInfo, 0.0, &zero); - inst = emit_instruction(emitInfo, - OPCODE_SEQ, - n->Store, - n->Children[0]->Store, - &zero, - NULL); - if (!inst) { - return NULL; - } - inst_comment(inst, "NOT"); - - free_node_storage(emitInfo->vt, n->Children[0]); - - return inst; -} - - -static struct prog_instruction * -emit_if(slang_emit_info *emitInfo, slang_ir_node *n) -{ - struct gl_program *prog = emitInfo->prog; - GLuint ifInstLoc, elseInstLoc = 0; - GLuint condWritemask = 0; - - /* emit condition expression code */ - { - struct prog_instruction *inst; - inst = emit(emitInfo, n->Children[0]); - if (emitInfo->EmitCondCodes) { - if (!inst) { - /* error recovery */ - return NULL; - } - condWritemask = inst->DstReg.WriteMask; - } - } - - if (!n->Children[0]->Store) - return NULL; - -#if 0 - assert(n->Children[0]->Store->Size == 1); /* a bool! */ -#endif - - ifInstLoc = prog->NumInstructions; - if (emitInfo->EmitHighLevelInstructions) { - if (emitInfo->EmitCondCodes) { - /* IF condcode THEN ... */ - struct prog_instruction *ifInst = new_instruction(emitInfo, OPCODE_IF); - if (!ifInst) { - return NULL; - } - ifInst->DstReg.CondMask = COND_NE; /* if cond is non-zero */ - /* only test the cond code (1 of 4) that was updated by the - * previous instruction. - */ - ifInst->DstReg.CondSwizzle = writemask_to_swizzle(condWritemask); - } - else { - struct prog_instruction *inst; - - /* IF src[0] THEN ... */ - inst = emit_instruction(emitInfo, OPCODE_IF, - NULL, /* dst */ - n->Children[0]->Store, /* op0 */ - NULL, - NULL); - if (!inst) { - return NULL; - } - } - } - else { - /* conditional jump to else, or endif */ - struct prog_instruction *ifInst = new_instruction(emitInfo, OPCODE_BRA); - if (!ifInst) { - return NULL; - } - ifInst->DstReg.CondMask = COND_EQ; /* BRA if cond is zero */ - inst_comment(ifInst, "if zero"); - ifInst->DstReg.CondSwizzle = writemask_to_swizzle(condWritemask); - } - - /* if body */ - emit(emitInfo, n->Children[1]); - - if (n->Children[2]) { - /* have else body */ - elseInstLoc = prog->NumInstructions; - if (emitInfo->EmitHighLevelInstructions) { - struct prog_instruction *inst = new_instruction(emitInfo, OPCODE_ELSE); - if (!inst) { - return NULL; - } - prog->Instructions[ifInstLoc].BranchTarget = prog->NumInstructions - 1; - } - else { - /* jump to endif instruction */ - struct prog_instruction *inst = new_instruction(emitInfo, OPCODE_BRA); - if (!inst) { - return NULL; - } - inst_comment(inst, "else"); - inst->DstReg.CondMask = COND_TR; /* always branch */ - prog->Instructions[ifInstLoc].BranchTarget = prog->NumInstructions; - } - emit(emitInfo, n->Children[2]); - } - else { - /* no else body */ - prog->Instructions[ifInstLoc].BranchTarget = prog->NumInstructions; - } - - if (emitInfo->EmitHighLevelInstructions) { - struct prog_instruction *inst = new_instruction(emitInfo, OPCODE_ENDIF); - if (!inst) { - return NULL; - } - } - - if (elseInstLoc) { - /* point ELSE instruction BranchTarget at ENDIF */ - if (emitInfo->EmitHighLevelInstructions) { - prog->Instructions[elseInstLoc].BranchTarget = prog->NumInstructions - 1; - } - else { - prog->Instructions[elseInstLoc].BranchTarget = prog->NumInstructions; - } - } - return NULL; -} - - -static struct prog_instruction * -emit_loop(slang_emit_info *emitInfo, slang_ir_node *n) -{ - struct gl_program *prog = emitInfo->prog; - struct prog_instruction *endInst; - GLuint beginInstLoc, tailInstLoc, endInstLoc; - slang_ir_node *ir; - - /* emit OPCODE_BGNLOOP */ - beginInstLoc = prog->NumInstructions; - if (emitInfo->EmitHighLevelInstructions) { - struct prog_instruction *inst = new_instruction(emitInfo, OPCODE_BGNLOOP); - if (!inst) { - return NULL; - } - } - - /* body */ - emit(emitInfo, n->Children[0]); - - /* tail */ - tailInstLoc = prog->NumInstructions; - if (n->Children[1]) { - if (emitInfo->EmitComments) - emit_comment(emitInfo, "Loop tail code:"); - emit(emitInfo, n->Children[1]); - } - - endInstLoc = prog->NumInstructions; - if (emitInfo->EmitHighLevelInstructions) { - /* emit OPCODE_ENDLOOP */ - endInst = new_instruction(emitInfo, OPCODE_ENDLOOP); - if (!endInst) { - return NULL; - } - } - else { - /* emit unconditional BRA-nch */ - endInst = new_instruction(emitInfo, OPCODE_BRA); - if (!endInst) { - return NULL; - } - endInst->DstReg.CondMask = COND_TR; /* always true */ - } - /* ENDLOOP's BranchTarget points to the BGNLOOP inst */ - endInst->BranchTarget = beginInstLoc; - - if (emitInfo->EmitHighLevelInstructions) { - /* BGNLOOP's BranchTarget points to the ENDLOOP inst */ - prog->Instructions[beginInstLoc].BranchTarget = prog->NumInstructions -1; - } - - /* Done emitting loop code. Now walk over the loop's linked list of - * BREAK and CONT nodes, filling in their BranchTarget fields (which - * will point to the corresponding ENDLOOP instruction. - */ - for (ir = n->List; ir; ir = ir->List) { - struct prog_instruction *inst = prog->Instructions + ir->InstLocation; - assert(inst->BranchTarget < 0); - if (ir->Opcode == IR_BREAK || - ir->Opcode == IR_BREAK_IF_TRUE) { - assert(inst->Opcode == OPCODE_BRK || - inst->Opcode == OPCODE_BRA); - /* go to instruction at end of loop */ - if (emitInfo->EmitHighLevelInstructions) { - inst->BranchTarget = endInstLoc; - } - else { - inst->BranchTarget = endInstLoc + 1; - } - } - else { - assert(ir->Opcode == IR_CONT || - ir->Opcode == IR_CONT_IF_TRUE); - assert(inst->Opcode == OPCODE_CONT || - inst->Opcode == OPCODE_BRA); - /* go to instruction at tail of loop */ - inst->BranchTarget = endInstLoc; - } - } - return NULL; -} - - -/** - * Unconditional "continue" or "break" statement. - * Either OPCODE_CONT, OPCODE_BRK or OPCODE_BRA will be emitted. - */ -static struct prog_instruction * -emit_cont_break(slang_emit_info *emitInfo, slang_ir_node *n) -{ - gl_inst_opcode opcode; - struct prog_instruction *inst; - - if (n->Opcode == IR_CONT) { - /* we need to execute the loop's tail code before doing CONT */ - assert(n->Parent); - assert(n->Parent->Opcode == IR_LOOP); - if (n->Parent->Children[1]) { - /* emit tail code */ - if (emitInfo->EmitComments) { - emit_comment(emitInfo, "continue - tail code:"); - } - emit(emitInfo, n->Parent->Children[1]); - } - } - - /* opcode selection */ - if (emitInfo->EmitHighLevelInstructions) { - opcode = (n->Opcode == IR_CONT) ? OPCODE_CONT : OPCODE_BRK; - } - else { - opcode = OPCODE_BRA; - } - n->InstLocation = emitInfo->prog->NumInstructions; - inst = new_instruction(emitInfo, opcode); - if (inst) { - inst->DstReg.CondMask = COND_TR; /* always true */ - } - return inst; -} - - -/** - * Conditional "continue" or "break" statement. - * Either OPCODE_CONT, OPCODE_BRK or OPCODE_BRA will be emitted. - */ -static struct prog_instruction * -emit_cont_break_if_true(slang_emit_info *emitInfo, slang_ir_node *n) -{ - struct prog_instruction *inst; - - assert(n->Opcode == IR_CONT_IF_TRUE || - n->Opcode == IR_BREAK_IF_TRUE); - - /* evaluate condition expr, setting cond codes */ - inst = emit(emitInfo, n->Children[0]); - if (emitInfo->EmitCondCodes) { - assert(inst); - inst->CondUpdate = GL_TRUE; - } - - n->InstLocation = emitInfo->prog->NumInstructions; - - /* opcode selection */ - if (emitInfo->EmitHighLevelInstructions) { - const gl_inst_opcode opcode - = (n->Opcode == IR_CONT_IF_TRUE) ? OPCODE_CONT : OPCODE_BRK; - if (emitInfo->EmitCondCodes) { - /* Get the writemask from the previous instruction which set - * the condcodes. Use that writemask as the CondSwizzle. - */ - const GLuint condWritemask = inst->DstReg.WriteMask; - inst = new_instruction(emitInfo, opcode); - if (inst) { - inst->DstReg.CondMask = COND_NE; - inst->DstReg.CondSwizzle = writemask_to_swizzle(condWritemask); - } - return inst; - } - else { - /* IF reg - * BRK/CONT; - * ENDIF - */ - GLint ifInstLoc; - ifInstLoc = emitInfo->prog->NumInstructions; - inst = emit_instruction(emitInfo, OPCODE_IF, - NULL, /* dest */ - n->Children[0]->Store, - NULL, - NULL); - if (!inst) { - return NULL; - } - n->InstLocation = emitInfo->prog->NumInstructions; - - inst = new_instruction(emitInfo, opcode); - if (!inst) { - return NULL; - } - inst = new_instruction(emitInfo, OPCODE_ENDIF); - if (!inst) { - return NULL; - } - - emitInfo->prog->Instructions[ifInstLoc].BranchTarget - = emitInfo->prog->NumInstructions - 1; - return inst; - } - } - else { - const GLuint condWritemask = inst->DstReg.WriteMask; - assert(emitInfo->EmitCondCodes); - inst = new_instruction(emitInfo, OPCODE_BRA); - if (inst) { - inst->DstReg.CondMask = COND_NE; - inst->DstReg.CondSwizzle = writemask_to_swizzle(condWritemask); - } - return inst; - } -} - - -/** - * Return the size of a swizzle mask given that some swizzle components - * may be NIL/undefined. For example: - * swizzle_size(".zzxx") = 4 - * swizzle_size(".xy??") = 2 - * swizzle_size(".w???") = 1 - */ -static GLuint -swizzle_size(GLuint swizzle) -{ - GLuint i; - for (i = 0; i < 4; i++) { - if (GET_SWZ(swizzle, i) == SWIZZLE_NIL) - return i; - } - return 4; -} - - -static struct prog_instruction * -emit_swizzle(slang_emit_info *emitInfo, slang_ir_node *n) -{ - struct prog_instruction *inst; - - inst = emit(emitInfo, n->Children[0]); - - if (!n->Store->Parent) { - /* this covers a case such as "(b ? p : q).x" */ - n->Store->Parent = n->Children[0]->Store; - assert(n->Store->Parent); - } - - { - const GLuint swizzle = n->Store->Swizzle; - /* new storage is parent storage with updated Swizzle + Size fields */ - _slang_copy_ir_storage(n->Store, n->Store->Parent); - /* Apply this node's swizzle to parent's storage */ - n->Store->Swizzle = _slang_swizzle_swizzle(n->Store->Swizzle, swizzle); - /* Update size */ - n->Store->Size = swizzle_size(n->Store->Swizzle); - } - - assert(!n->Store->Parent); - assert(n->Store->Index >= 0); - - return inst; -} - - -/** - * Dereference array element: element == array[index] - * This basically involves emitting code for computing the array index - * and updating the node/element's storage info. - */ -static struct prog_instruction * -emit_array_element(slang_emit_info *emitInfo, slang_ir_node *n) -{ - slang_ir_storage *arrayStore, *indexStore; - const int elemSize = n->Store->Size; /* number of floats */ - const GLint elemSizeVec = (elemSize + 3) / 4; /* number of vec4 */ - struct prog_instruction *inst; - - assert(n->Opcode == IR_ELEMENT); - assert(elemSize > 0); - - /* special case for built-in state variables, like light state */ - { - slang_ir_storage *root = n->Store; - assert(!root->Parent); - while (root->Parent) - root = root->Parent; - - if (root->File == PROGRAM_STATE_VAR) { - GLboolean direct; - GLint index = - _slang_alloc_statevar(n, emitInfo->prog->Parameters, &direct); - if (index < 0) { - /* error */ - return NULL; - } - if (direct) { - n->Store->Index = index; - return NULL; /* all done */ - } - } - } - - /* do codegen for array itself */ - emit(emitInfo, n->Children[0]); - arrayStore = n->Children[0]->Store; - - /* The initial array element storage is the array's storage, - * then modified below. - */ - _slang_copy_ir_storage(n->Store, arrayStore); - - - if (n->Children[1]->Opcode == IR_FLOAT) { - /* Constant array index */ - const GLint element = (GLint) n->Children[1]->Value[0]; - - /* this element's storage is the array's storage, plus constant offset */ - n->Store->Index += elemSizeVec * element; - } - else { - /* Variable array index */ - - /* do codegen for array index expression */ - emit(emitInfo, n->Children[1]); - indexStore = n->Children[1]->Store; - - if (indexStore->IsIndirect) { - /* need to put the array index into a temporary since we can't - * directly support a[b[i]] constructs. - */ - - - /*indexStore = tempstore();*/ - } - - - if (elemSize > 4) { - /* need to multiply array index by array element size */ - struct prog_instruction *inst; - slang_ir_storage *indexTemp; - slang_ir_storage elemSizeStore; - - /* allocate 1 float indexTemp */ - indexTemp = _slang_new_ir_storage(PROGRAM_TEMPORARY, -1, 1); - _slang_alloc_temp(emitInfo->vt, indexTemp); - - /* allocate a constant containing the element size */ - constant_to_storage(emitInfo, (float) elemSizeVec, &elemSizeStore); - - /* multiply array index by element size */ - inst = emit_instruction(emitInfo, - OPCODE_MUL, - indexTemp, /* dest */ - indexStore, /* the index */ - &elemSizeStore, - NULL); - if (!inst) { - return NULL; - } - - indexStore = indexTemp; - } - - if (arrayStore->IsIndirect) { - /* ex: in a[i][j], a[i] (the arrayStore) is indirect */ - /* Need to add indexStore to arrayStore->Indirect store */ - slang_ir_storage indirectArray; - slang_ir_storage *indexTemp; - - _slang_init_ir_storage(&indirectArray, - arrayStore->IndirectFile, - arrayStore->IndirectIndex, - 1, - arrayStore->IndirectSwizzle); - - /* allocate 1 float indexTemp */ - indexTemp = _slang_new_ir_storage(PROGRAM_TEMPORARY, -1, 1); - _slang_alloc_temp(emitInfo->vt, indexTemp); - - inst = emit_instruction(emitInfo, - OPCODE_ADD, - indexTemp, /* dest */ - indexStore, /* the index */ - &indirectArray, /* indirect array base */ - NULL); - if (!inst) { - return NULL; - } - - indexStore = indexTemp; - } - - /* update the array element storage info */ - n->Store->IsIndirect = GL_TRUE; - n->Store->IndirectFile = indexStore->File; - n->Store->IndirectIndex = indexStore->Index; - n->Store->IndirectSwizzle = indexStore->Swizzle; - } - - n->Store->Size = elemSize; - n->Store->Swizzle = _slang_var_swizzle(elemSize, 0); - - return NULL; /* no instruction */ -} - - -/** - * Resolve storage for accessing a structure field. - */ -static struct prog_instruction * -emit_struct_field(slang_emit_info *emitInfo, slang_ir_node *n) -{ - slang_ir_storage *root = n->Store; - GLint fieldOffset, fieldSize; - - assert(n->Opcode == IR_FIELD); - - assert(!root->Parent); - while (root->Parent) - root = root->Parent; - - /* If this is the field of a state var, allocate constant/uniform - * storage for it now if we haven't already. - * Note that we allocate storage (uniform/constant slots) for state - * variables here rather than at declaration time so we only allocate - * space for the ones that we actually use! - */ - if (root->File == PROGRAM_STATE_VAR) { - GLboolean direct; - GLint index = _slang_alloc_statevar(n, emitInfo->prog->Parameters, &direct); - if (index < 0) { - slang_info_log_error(emitInfo->log, "Error parsing state variable"); - return NULL; - } - if (direct) { - root->Index = index; - return NULL; /* all done */ - } - } - - /* do codegen for struct */ - emit(emitInfo, n->Children[0]); - assert(n->Children[0]->Store->Index >= 0); - - - fieldOffset = n->Store->Index; - fieldSize = n->Store->Size; - - _slang_copy_ir_storage(n->Store, n->Children[0]->Store); - - n->Store->Index = n->Children[0]->Store->Index + fieldOffset / 4; - n->Store->Size = fieldSize; - - switch (fieldSize) { - case 1: - { - GLint swz = fieldOffset % 4; - n->Store->Swizzle = MAKE_SWIZZLE4(swz, swz, swz, swz); - } - break; - case 2: - n->Store->Swizzle = MAKE_SWIZZLE4(SWIZZLE_X, SWIZZLE_Y, - SWIZZLE_NIL, SWIZZLE_NIL); - break; - case 3: - n->Store->Swizzle = MAKE_SWIZZLE4(SWIZZLE_X, SWIZZLE_Y, - SWIZZLE_Z, SWIZZLE_NIL); - break; - default: - n->Store->Swizzle = SWIZZLE_XYZW; - } - - assert(n->Store->Index >= 0); - - return NULL; /* no instruction */ -} - - -/** - * Emit code for a variable declaration. - * This usually doesn't result in any code generation, but just - * memory allocation. - */ -static struct prog_instruction * -emit_var_decl(slang_emit_info *emitInfo, slang_ir_node *n) -{ - assert(n->Store); - assert(n->Store->File != PROGRAM_UNDEFINED); - assert(n->Store->Size > 0); - /*assert(n->Store->Index < 0);*/ - - if (!n->Var || n->Var->isTemp) { - /* a nameless/temporary variable, will be freed after first use */ - /*NEW*/ - if (n->Store->Index < 0 && !_slang_alloc_temp(emitInfo->vt, n->Store)) { - slang_info_log_error(emitInfo->log, - "Ran out of registers, too many temporaries"); - return NULL; - } - } - else { - /* a regular variable */ - _slang_add_variable(emitInfo->vt, n->Var); - if (!_slang_alloc_var(emitInfo->vt, n->Store)) { - slang_info_log_error(emitInfo->log, - "Ran out of registers, too many variables"); - return NULL; - } - /* - printf("IR_VAR_DECL %s %d store %p\n", - (char*) n->Var->a_name, n->Store->Index, (void*) n->Store); - */ - assert(n->Var->store == n->Store); - } - if (emitInfo->EmitComments) { - /* emit NOP with comment describing the variable's storage location */ - char s[1000]; - _mesa_snprintf(s, sizeof(s), "TEMP[%d]%s = variable %s (size %d)", - n->Store->Index, - _mesa_swizzle_string(n->Store->Swizzle, 0, GL_FALSE), - (n->Var ? (char *) n->Var->a_name : "anonymous"), - n->Store->Size); - emit_comment(emitInfo, s); - } - return NULL; -} - - -/** - * Emit code for a reference to a variable. - * Actually, no code is generated but we may do some memory allocation. - * In particular, state vars (uniforms) are allocated on an as-needed basis. - */ -static struct prog_instruction * -emit_var_ref(slang_emit_info *emitInfo, slang_ir_node *n) -{ - assert(n->Store); - assert(n->Store->File != PROGRAM_UNDEFINED); - - if (n->Store->File == PROGRAM_STATE_VAR && n->Store->Index < 0) { - GLboolean direct; - GLint index = _slang_alloc_statevar(n, emitInfo->prog->Parameters, &direct); - if (index < 0) { - /* error */ - char s[100]; - /* XXX isn't this really an out of memory/resources error? */ - _mesa_snprintf(s, sizeof(s), "Undefined variable '%s'", - (char *) n->Var->a_name); - slang_info_log_error(emitInfo->log, s); - return NULL; - } - - n->Store->Index = index; - } - else if (n->Store->File == PROGRAM_UNIFORM || - n->Store->File == PROGRAM_SAMPLER) { - /* mark var as used */ - _mesa_use_uniform(emitInfo->prog->Parameters, (char *) n->Var->a_name); - } - else if (n->Store->File == PROGRAM_INPUT) { - assert(n->Store->Index >= 0); - /* geometry shaders have the input index in the second - * index */ - if (emitInfo->prog->Target == MESA_GEOMETRY_PROGRAM && - n->Store->Is2D) { - emitInfo->prog->InputsRead |= (1 << n->Store->Index2); - } else - emitInfo->prog->InputsRead |= (1 << n->Store->Index); - } - - if (n->Store->Index < 0) { - /* probably ran out of registers */ - return NULL; - } - assert(n->Store->Size > 0); - - return NULL; -} - - -static struct prog_instruction * -emit(slang_emit_info *emitInfo, slang_ir_node *n) -{ - struct prog_instruction *inst; - if (!n) - return NULL; - - if (emitInfo->log->error_flag) { - return NULL; - } - - if (n->Comment) { - inst = new_instruction(emitInfo, OPCODE_NOP); - if (inst) { - inst->Comment = _mesa_strdup(n->Comment); - } - inst = NULL; - } - - switch (n->Opcode) { - case IR_SEQ: - /* sequence of two sub-trees */ - assert(n->Children[0]); - assert(n->Children[1]); - emit(emitInfo, n->Children[0]); - if (emitInfo->log->error_flag) - return NULL; - inst = emit(emitInfo, n->Children[1]); -#if 0 - assert(!n->Store); -#endif - if (n->Children[1]->Store) - n->Store = n->Children[1]->Store; - else - n->Store = n->Children[0]->Store; - return inst; - - case IR_SCOPE: - /* new variable scope */ - _slang_push_var_table(emitInfo->vt); - inst = emit(emitInfo, n->Children[0]); - _slang_pop_var_table(emitInfo->vt); - n->Store = n->Children[0]->Store; - return inst; - - case IR_VAR_DECL: - /* Variable declaration - allocate a register for it */ - inst = emit_var_decl(emitInfo, n); - return inst; - - case IR_VAR: - /* Reference to a variable - * Storage should have already been resolved/allocated. - */ - return emit_var_ref(emitInfo, n); - - case IR_ELEMENT: - return emit_array_element(emitInfo, n); - case IR_FIELD: - return emit_struct_field(emitInfo, n); - case IR_SWIZZLE: - return emit_swizzle(emitInfo, n); - - /* Simple arithmetic */ - /* unary */ - case IR_MOVE: - case IR_RSQ: - case IR_RCP: - case IR_FLOOR: - case IR_FRAC: - case IR_F_TO_I: - case IR_I_TO_F: - case IR_ABS: - case IR_SIN: - case IR_COS: - case IR_DDX: - case IR_DDY: - case IR_EXP: - case IR_EXP2: - case IR_LOG2: - case IR_NOISE1: - case IR_NOISE2: - case IR_NOISE3: - case IR_NOISE4: - case IR_NRM4: - case IR_NRM3: - /* binary */ - case IR_ADD: - case IR_SUB: - case IR_MUL: - case IR_DOT4: - case IR_DOT3: - case IR_DOT2: - case IR_CROSS: - case IR_MIN: - case IR_MAX: - case IR_SEQUAL: - case IR_SNEQUAL: - case IR_SGE: - case IR_SGT: - case IR_SLE: - case IR_SLT: - case IR_POW: - /* trinary operators */ - case IR_LRP: - case IR_CMP: - return emit_arith(emitInfo, n); - - case IR_EQUAL: - case IR_NOTEQUAL: - return emit_compare(emitInfo, n); - - case IR_CLAMP: - return emit_clamp(emitInfo, n); - case IR_TEX: - case IR_TEXB: - case IR_TEXP: - case IR_TEX_SH: - case IR_TEXB_SH: - case IR_TEXP_SH: - return emit_tex(emitInfo, n); - case IR_NEG: - return emit_negation(emitInfo, n); - case IR_FLOAT: - /* find storage location for this float constant */ - n->Store->Index = _mesa_add_unnamed_constant(emitInfo->prog->Parameters, - n->Value, - n->Store->Size, - &n->Store->Swizzle); - if (n->Store->Index < 0) { - slang_info_log_error(emitInfo->log, "Ran out of space for constants"); - return NULL; - } - return NULL; - - case IR_COPY: - return emit_copy(emitInfo, n); - - case IR_COND: - return emit_cond(emitInfo, n); - - case IR_NOT: - return emit_not(emitInfo, n); - - case IR_LABEL: - return emit_label(emitInfo, n); - - case IR_KILL: - return emit_kill(emitInfo); - - case IR_CALL: - /* new variable scope for subroutines/function calls */ - _slang_push_var_table(emitInfo->vt); - inst = emit_fcall(emitInfo, n); - _slang_pop_var_table(emitInfo->vt); - return inst; - - case IR_IF: - return emit_if(emitInfo, n); - - case IR_LOOP: - return emit_loop(emitInfo, n); - case IR_BREAK_IF_TRUE: - case IR_CONT_IF_TRUE: - return emit_cont_break_if_true(emitInfo, n); - case IR_BREAK: - /* fall-through */ - case IR_CONT: - return emit_cont_break(emitInfo, n); - - case IR_BEGIN_SUB: - return new_instruction(emitInfo, OPCODE_BGNSUB); - case IR_END_SUB: - return new_instruction(emitInfo, OPCODE_ENDSUB); - case IR_RETURN: - return emit_return(emitInfo, n); - - case IR_NOP: - return NULL; - - case IR_EMIT_VERTEX: - return new_instruction(emitInfo, OPCODE_EMIT_VERTEX); - case IR_END_PRIMITIVE: - return new_instruction(emitInfo, OPCODE_END_PRIMITIVE); - - default: - _mesa_problem(NULL, "Unexpected IR opcode in emit()\n"); - } - return NULL; -} - - -/** - * After code generation, any subroutines will be in separate program - * objects. This function appends all the subroutines onto the main - * program and resolves the linking of all the branch/call instructions. - * XXX this logic should really be part of the linking process... - */ -static void -_slang_resolve_subroutines(slang_emit_info *emitInfo) -{ - GET_CURRENT_CONTEXT(ctx); - struct gl_program *mainP = emitInfo->prog; - GLuint *subroutineLoc, i, total; - - subroutineLoc - = (GLuint *) malloc(emitInfo->NumSubroutines * sizeof(GLuint)); - - /* total number of instructions */ - total = mainP->NumInstructions; - for (i = 0; i < emitInfo->NumSubroutines; i++) { - subroutineLoc[i] = total; - total += emitInfo->Subroutines[i]->NumInstructions; - } - - /* adjust BranchTargets within the functions */ - for (i = 0; i < emitInfo->NumSubroutines; i++) { - struct gl_program *sub = emitInfo->Subroutines[i]; - GLuint j; - for (j = 0; j < sub->NumInstructions; j++) { - struct prog_instruction *inst = sub->Instructions + j; - if (inst->Opcode != OPCODE_CAL && inst->BranchTarget >= 0) { - inst->BranchTarget += subroutineLoc[i]; - } - } - } - - /* append subroutines' instructions after main's instructions */ - mainP->Instructions = _mesa_realloc_instructions(mainP->Instructions, - mainP->NumInstructions, - total); - mainP->NumInstructions = total; - for (i = 0; i < emitInfo->NumSubroutines; i++) { - struct gl_program *sub = emitInfo->Subroutines[i]; - _mesa_copy_instructions(mainP->Instructions + subroutineLoc[i], - sub->Instructions, - sub->NumInstructions); - /* delete subroutine code */ - sub->Parameters = NULL; /* prevent double-free */ - _mesa_reference_program(ctx, &emitInfo->Subroutines[i], NULL); - } - - /* free subroutine list */ - if (emitInfo->Subroutines) { - free(emitInfo->Subroutines); - emitInfo->Subroutines = NULL; - } - emitInfo->NumSubroutines = 0; - - /* Examine CAL instructions. - * At this point, the BranchTarget field of the CAL instruction is - * the number/id of the subroutine to call (an index into the - * emitInfo->Subroutines list). - * Translate that into an actual instruction location now. - */ - for (i = 0; i < mainP->NumInstructions; i++) { - struct prog_instruction *inst = mainP->Instructions + i; - if (inst->Opcode == OPCODE_CAL) { - const GLuint f = inst->BranchTarget; - inst->BranchTarget = subroutineLoc[f]; - } - } - - free(subroutineLoc); -} - - - -/** - * Convert the IR tree into GPU instructions. - * \param n root of IR tree - * \param vt variable table - * \param prog program to put GPU instructions into - * \param pragmas controls codegen options - * \param withEnd if true, emit END opcode at end - * \param log log for emitting errors/warnings/info - */ -GLboolean -_slang_emit_code(slang_ir_node *n, slang_var_table *vt, - struct gl_program *prog, - const struct gl_sl_pragmas *pragmas, - GLboolean withEnd, - slang_info_log *log) -{ - GET_CURRENT_CONTEXT(ctx); - GLboolean success; - slang_emit_info emitInfo; - GLuint maxUniforms; - - emitInfo.log = log; - emitInfo.vt = vt; - emitInfo.prog = prog; - emitInfo.Subroutines = NULL; - emitInfo.NumSubroutines = 0; - emitInfo.MaxInstructions = prog->NumInstructions; - - emitInfo.EmitHighLevelInstructions = ctx->Shader.EmitHighLevelInstructions; - emitInfo.EmitCondCodes = ctx->Shader.EmitCondCodes; - emitInfo.EmitComments = ctx->Shader.EmitComments || pragmas->Debug; - emitInfo.EmitBeginEndSub = GL_TRUE; - - if (!emitInfo.EmitCondCodes) { - emitInfo.EmitHighLevelInstructions = GL_TRUE; - } - - /* Check uniform/constant limits */ - if (prog->Target == GL_FRAGMENT_PROGRAM_ARB) { - maxUniforms = ctx->Const.FragmentProgram.MaxUniformComponents / 4; - } - else if (prog->Target == GL_VERTEX_PROGRAM_ARB) { - maxUniforms = ctx->Const.VertexProgram.MaxUniformComponents / 4; - } else { - assert(prog->Target == MESA_GEOMETRY_PROGRAM); - maxUniforms = ctx->Const.GeometryProgram.MaxUniformComponents / 4; - } - if (prog->Parameters->NumParameters > maxUniforms) { - slang_info_log_error(log, "Constant/uniform register limit exceeded " - "(max=%u vec4)", maxUniforms); - - return GL_FALSE; - } - - (void) emit(&emitInfo, n); - - /* finish up by adding the END opcode to program */ - if (withEnd) { - struct prog_instruction *inst; - inst = new_instruction(&emitInfo, OPCODE_END); - if (!inst) { - return GL_FALSE; - } - } - - _slang_resolve_subroutines(&emitInfo); - - success = GL_TRUE; - -#if 0 - printf("*********** End emit code (%u inst):\n", prog->NumInstructions); - _mesa_print_program(prog); - _mesa_print_program_parameters(ctx,prog); -#endif - - return success; -} diff --git a/src/mesa/slang/slang_emit.h b/src/mesa/slang/slang_emit.h deleted file mode 100644 index f93d6b00d6..0000000000 --- a/src/mesa/slang/slang_emit.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Mesa 3-D graphics library - * Version: 7.1 - * - * Copyright (C) 2005-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. - */ - -#ifndef SLANG_EMIT_H -#define SLANG_EMIT_H - -#include "main/glheader.h" -#include "slang_ir.h" -#include "slang_vartable.h" - - -extern GLuint -_slang_swizzle_swizzle(GLuint swz1, GLuint swz2); - - -extern GLuint -_slang_var_swizzle(GLint size, GLint comp); - - -extern GLboolean -_slang_emit_code(slang_ir_node *n, slang_var_table *vartable, - struct gl_program *prog, - const struct gl_sl_pragmas *pragmas, - GLboolean withEnd, - slang_info_log *log); - - -#endif /* SLANG_EMIT_H */ diff --git a/src/mesa/slang/slang_ir.c b/src/mesa/slang/slang_ir.c deleted file mode 100644 index 078c9369a8..0000000000 --- a/src/mesa/slang/slang_ir.c +++ /dev/null @@ -1,534 +0,0 @@ -/* - * Mesa 3-D graphics library - * - * Copyright (C) 2005-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. - */ - - -#include "main/imports.h" -#include "main/context.h" -#include "slang_ir.h" -#include "slang_mem.h" -#include "program/prog_instruction.h" -#include "program/prog_print.h" - - -static const slang_ir_info IrInfo[] = { - /* binary ops */ - { IR_ADD, "IR_ADD", OPCODE_ADD, 4, 2 }, - { IR_SUB, "IR_SUB", OPCODE_SUB, 4, 2 }, - { IR_MUL, "IR_MUL", OPCODE_MUL, 4, 2 }, - { IR_DIV, "IR_DIV", OPCODE_NOP, 0, 2 }, /* XXX broke */ - { IR_DOT4, "IR_DOT4", OPCODE_DP4, 1, 2 }, - { IR_DOT3, "IR_DOT3", OPCODE_DP3, 1, 2 }, - { IR_DOT2, "IR_DOT2", OPCODE_DP2, 1, 2 }, - { IR_NRM4, "IR_NRM4", OPCODE_NRM4, 1, 1 }, - { IR_NRM3, "IR_NRM3", OPCODE_NRM3, 1, 1 }, - { IR_CROSS, "IR_CROSS", OPCODE_XPD, 3, 2 }, - { IR_LRP, "IR_LRP", OPCODE_LRP, 4, 3 }, - { IR_MIN, "IR_MIN", OPCODE_MIN, 4, 2 }, - { IR_MAX, "IR_MAX", OPCODE_MAX, 4, 2 }, - { IR_CLAMP, "IR_CLAMP", OPCODE_NOP, 4, 3 }, /* special case: emit_clamp() */ - { IR_SEQUAL, "IR_SEQUAL", OPCODE_SEQ, 4, 2 }, - { IR_SNEQUAL, "IR_SNEQUAL", OPCODE_SNE, 4, 2 }, - { IR_SGE, "IR_SGE", OPCODE_SGE, 4, 2 }, - { IR_SGT, "IR_SGT", OPCODE_SGT, 4, 2 }, - { IR_SLE, "IR_SLE", OPCODE_SLE, 4, 2 }, - { IR_SLT, "IR_SLT", OPCODE_SLT, 4, 2 }, - { IR_POW, "IR_POW", OPCODE_POW, 1, 2 }, - { IR_EQUAL, "IR_EQUAL", OPCODE_NOP, 1, 2 }, - { IR_NOTEQUAL, "IR_NOTEQUAL", OPCODE_NOP, 1, 2 }, - - /* unary ops */ - { IR_MOVE, "IR_MOVE", OPCODE_MOV, 4, 1 }, - { IR_I_TO_F, "IR_I_TO_F", OPCODE_MOV, 4, 1 }, /* int[4] to float[4] */ - { IR_F_TO_I, "IR_F_TO_I", OPCODE_TRUNC, 4, 1 }, - { IR_EXP, "IR_EXP", OPCODE_EXP, 1, 1 }, - { IR_EXP2, "IR_EXP2", OPCODE_EX2, 1, 1 }, - { IR_LOG2, "IR_LOG2", OPCODE_LG2, 1, 1 }, - { IR_RSQ, "IR_RSQ", OPCODE_RSQ, 1, 1 }, - { IR_RCP, "IR_RCP", OPCODE_RCP, 1, 1 }, - { IR_FLOOR, "IR_FLOOR", OPCODE_FLR, 4, 1 }, - { IR_FRAC, "IR_FRAC", OPCODE_FRC, 4, 1 }, - { IR_ABS, "IR_ABS", OPCODE_ABS, 4, 1 }, - { IR_NEG, "IR_NEG", OPCODE_NOP, 4, 1 }, /* special case: emit_negation() */ - { IR_DDX, "IR_DDX", OPCODE_DDX, 4, 1 }, - { IR_DDY, "IR_DDY", OPCODE_DDY, 4, 1 }, - { IR_SIN, "IR_SIN", OPCODE_SIN, 1, 1 }, - { IR_COS, "IR_COS", OPCODE_COS, 1, 1 }, - { IR_NOISE1, "IR_NOISE1", OPCODE_NOISE1, 1, 1 }, - { IR_NOISE2, "IR_NOISE2", OPCODE_NOISE2, 1, 1 }, - { IR_NOISE3, "IR_NOISE3", OPCODE_NOISE3, 1, 1 }, - { IR_NOISE4, "IR_NOISE4", OPCODE_NOISE4, 1, 1 }, - - /* other */ - { IR_CMP, "IR_CMP", OPCODE_CMP, 4, 3 }, /* compare/select */ - { IR_SEQ, "IR_SEQ", OPCODE_NOP, 0, 0 }, - { IR_SCOPE, "IR_SCOPE", OPCODE_NOP, 0, 0 }, - { IR_LABEL, "IR_LABEL", OPCODE_NOP, 0, 0 }, - { IR_IF, "IR_IF", OPCODE_NOP, 0, 0 }, - { IR_KILL, "IR_KILL", OPCODE_NOP, 0, 0 }, - { IR_COND, "IR_COND", OPCODE_NOP, 0, 0 }, - { IR_CALL, "IR_CALL", OPCODE_NOP, 0, 0 }, - { IR_COPY, "IR_COPY", OPCODE_NOP, 0, 1 }, - { IR_NOT, "IR_NOT", OPCODE_NOP, 1, 1 }, - { IR_VAR, "IR_VAR", OPCODE_NOP, 0, 0 }, - { IR_VAR_DECL, "IR_VAR_DECL", OPCODE_NOP, 0, 0 }, - { IR_TEX, "IR_TEX", OPCODE_TEX, 4, 1 }, - { IR_TEXB, "IR_TEXB", OPCODE_TXB, 4, 1 }, - { IR_TEXP, "IR_TEXP", OPCODE_TXP, 4, 1 }, - { IR_TEX_SH, "IR_TEX_SH", OPCODE_TEX, 4, 1 }, - { IR_TEXB_SH, "IR_TEXB_SH", OPCODE_TXB, 4, 1 }, - { IR_TEXP_SH, "IR_TEXP_SH", OPCODE_TXP, 4, 1 }, - { IR_FLOAT, "IR_FLOAT", OPCODE_NOP, 0, 0 }, /* float literal */ - { IR_FIELD, "IR_FIELD", OPCODE_NOP, 0, 0 }, - { IR_ELEMENT, "IR_ELEMENT", OPCODE_NOP, 0, 0 }, - { IR_SWIZZLE, "IR_SWIZZLE", OPCODE_NOP, 0, 0 }, - { IR_NOP, "IR_NOP", OPCODE_NOP, 0, 0 }, - { IR_EMIT_VERTEX, "IR_EMIT_VERTEX", OPCODE_EMIT_VERTEX, 0, 0 }, - { IR_END_PRIMITIVE, "IR_END_PRIMITIVE", OPCODE_END_PRIMITIVE, 0, 0 }, - { 0, NULL, 0, 0, 0 } -}; - - -const slang_ir_info * -_slang_ir_info(slang_ir_opcode opcode) -{ - GLuint i; - for (i = 0; IrInfo[i].IrName; i++) { - if (IrInfo[i].IrOpcode == opcode) { - return IrInfo + i; - } - } - return NULL; -} - - -void -_slang_init_ir_storage(slang_ir_storage *st, - gl_register_file file, GLint index, GLint size, - GLuint swizzle) -{ - st->File = file; - st->Index = index; - st->Size = size; - st->Swizzle = swizzle; - st->Parent = NULL; - st->IsIndirect = GL_FALSE; - st->Is2D = GL_FALSE; - st->Index2 = 0; -} - - -/** - * Return a new slang_ir_storage object. - */ -slang_ir_storage * -_slang_new_ir_storage(gl_register_file file, GLint index, GLint size) -{ - slang_ir_storage *st; - st = (slang_ir_storage *) _slang_alloc(sizeof(slang_ir_storage)); - if (st) { - st->File = file; - st->Index = index; - st->Size = size; - st->Swizzle = SWIZZLE_NOOP; - st->Parent = NULL; - st->IsIndirect = GL_FALSE; - st->Is2D = GL_FALSE; - st->Index2 = 0; - } - return st; -} - - -/** - * Return a new slang_ir_storage object. - */ -slang_ir_storage * -_slang_new_ir_storage_swz(gl_register_file file, GLint index, GLint size, - GLuint swizzle) -{ - slang_ir_storage *st; - st = (slang_ir_storage *) _slang_alloc(sizeof(slang_ir_storage)); - if (st) { - st->File = file; - st->Index = index; - st->Size = size; - st->Swizzle = swizzle; - st->Parent = NULL; - st->IsIndirect = GL_FALSE; - st->Is2D = GL_FALSE; - st->Index2 = 0; - } - return st; -} - -/** - * Return a new slang_ir_storage object. - */ -slang_ir_storage * -_slang_new_ir_storage_2d(gl_register_file file, - GLint index, GLint index2, - GLint size, GLuint swizzle) -{ - slang_ir_storage *st; - st = (slang_ir_storage *) _slang_alloc(sizeof(slang_ir_storage)); - if (st) { - st->File = file; - st->Index = index; - st->Size = size; - st->Swizzle = swizzle; - st->Parent = NULL; - st->IsIndirect = GL_FALSE; - st->Is2D = GL_TRUE; - st->Index2 = index2; - } - return st; -} - - - -/** - * Return a new slang_ir_storage object. - */ -slang_ir_storage * -_slang_new_ir_storage_relative(GLint index, GLint size, - slang_ir_storage *parent) -{ - slang_ir_storage *st; - st = (slang_ir_storage *) _slang_alloc(sizeof(slang_ir_storage)); - if (st) { - st->File = PROGRAM_UNDEFINED; - st->Index = index; - st->Size = size; - st->Swizzle = SWIZZLE_NOOP; - st->Parent = parent; - st->IsIndirect = GL_FALSE; - st->Is2D = GL_FALSE; - st->Index2 = 0; - } - return st; -} - - -slang_ir_storage * -_slang_new_ir_storage_indirect(gl_register_file file, - GLint index, - GLint size, - gl_register_file indirectFile, - GLint indirectIndex, - GLuint indirectSwizzle) -{ - slang_ir_storage *st; - st = (slang_ir_storage *) _slang_alloc(sizeof(slang_ir_storage)); - if (st) { - st->File = file; - st->Index = index; - st->Size = size; - st->Swizzle = SWIZZLE_NOOP; - st->IsIndirect = GL_TRUE; - st->IndirectFile = indirectFile; - st->IndirectIndex = indirectIndex; - st->IndirectSwizzle = indirectSwizzle; - st->Is2D = GL_FALSE; - st->Index2 = 0; - } - return st; -} - - -/** - * Allocate IR storage for a texture sampler. - * \param sampNum the sampler number/index - * \param texTarget one of TEXTURE_x_INDEX values - * \param size number of samplers (in case of sampler array) - */ -slang_ir_storage * -_slang_new_ir_storage_sampler(GLint sampNum, GLuint texTarget, GLint size) -{ - slang_ir_storage *st; - assert(texTarget < NUM_TEXTURE_TARGETS); - st = _slang_new_ir_storage(PROGRAM_SAMPLER, sampNum, size); - if (st) { - st->TexTarget = texTarget; - } - return st; -} - - - -/* XXX temporary function */ -void -_slang_copy_ir_storage(slang_ir_storage *dst, const slang_ir_storage *src) -{ - *dst = *src; - dst->Parent = NULL; -} - - - -static const char * -_slang_ir_name(slang_ir_opcode opcode) -{ - return _slang_ir_info(opcode)->IrName; -} - - - -#if 0 /* no longer needed with mempool */ -/** - * Since many IR nodes might point to the same IR storage info, we need - * to be careful when deleting things. - * Before deleting an IR tree, traverse it and do refcounting on the - * IR storage nodes. Use the refcount info during delete to free things - * properly. - */ -static void -_slang_refcount_storage(slang_ir_node *n) -{ - GLuint i; - if (!n) - return; - if (n->Store) - n->Store->RefCount++; - for (i = 0; i < 3; i++) - _slang_refcount_storage(n->Children[i]); -} -#endif - - -static void -_slang_free_ir(slang_ir_node *n) -{ - GLuint i; - if (!n) - return; - -#if 0 - if (n->Store) { - n->Store->RefCount--; - if (n->Store->RefCount == 0) { - _slang_free(n->Store); - n->Store = NULL; - } - } -#endif - - for (i = 0; i < 3; i++) - _slang_free_ir(n->Children[i]); - /* Do not free n->List since it's a child elsewhere */ - _slang_free(n); -} - - -/** - * Recursively free an IR tree. - */ -void -_slang_free_ir_tree(slang_ir_node *n) -{ -#if 0 - _slang_refcount_storage(n); -#endif - _slang_free_ir(n); -} - - -static const char * -storage_string(const slang_ir_storage *st) -{ - static const char *files[] = { - "TEMP", - "LOCAL_PARAM", - "ENV_PARAM", - "STATE", - "INPUT", - "OUTPUT", - "NAMED_PARAM", - "CONSTANT", - "UNIFORM", - "VARYING", - "WRITE_ONLY", - "ADDRESS", - "SAMPLER", - "UNDEFINED" - }; - static char s[100]; - assert(Elements(files) == PROGRAM_FILE_MAX); -#if 0 - if (st->Size == 1) - _mesa_snprintf(s, "%s[%d]", files[st->File], st->Index); - else - _mesa_snprintf(s, "%s[%d..%d]", files[st->File], st->Index, - st->Index + st->Size - 1); -#endif - assert(st->File < (GLint) (sizeof(files) / sizeof(files[0]))); - _mesa_snprintf(s, sizeof(s), "%s[%d]", files[st->File], st->Index); - return s; -} - - -static void -spaces(int n) -{ - while (n-- > 0) { - printf(" "); - } -} - - -void -_slang_print_ir_tree(const slang_ir_node *n, int indent) -{ -#define IND 0 - - if (!n) - return; -#if !IND - if (n->Opcode != IR_SEQ) -#else - printf("%3d:", indent); -#endif - spaces(indent); - - switch (n->Opcode) { - case IR_SEQ: -#if IND - printf("SEQ at %p\n", (void*) n); -#endif - assert(n->Children[0]); - assert(n->Children[1]); - _slang_print_ir_tree(n->Children[0], indent + IND); - _slang_print_ir_tree(n->Children[1], indent + IND); - break; - case IR_SCOPE: - printf("NEW SCOPE\n"); - assert(!n->Children[1]); - _slang_print_ir_tree(n->Children[0], indent + 3); - break; - case IR_COPY: - printf("COPY\n"); - _slang_print_ir_tree(n->Children[0], indent+3); - _slang_print_ir_tree(n->Children[1], indent+3); - break; - case IR_LABEL: - printf("LABEL: %s\n", n->Label->Name); - break; - case IR_COND: - printf("COND\n"); - _slang_print_ir_tree(n->Children[0], indent + 3); - break; - - case IR_IF: - printf("IF \n"); - _slang_print_ir_tree(n->Children[0], indent+3); - spaces(indent); - printf("THEN\n"); - _slang_print_ir_tree(n->Children[1], indent+3); - if (n->Children[2]) { - spaces(indent); - printf("ELSE\n"); - _slang_print_ir_tree(n->Children[2], indent+3); - } - spaces(indent); - printf("ENDIF\n"); - break; - - case IR_BEGIN_SUB: - printf("BEGIN_SUB\n"); - break; - case IR_END_SUB: - printf("END_SUB\n"); - break; - case IR_RETURN: - printf("RETURN\n"); - break; - case IR_CALL: - printf("CALL %s\n", n->Label->Name); - break; - - case IR_LOOP: - printf("LOOP\n"); - _slang_print_ir_tree(n->Children[0], indent+3); - if (n->Children[1]) { - spaces(indent); - printf("TAIL:\n"); - _slang_print_ir_tree(n->Children[1], indent+3); - } - spaces(indent); - printf("ENDLOOP\n"); - break; - case IR_CONT: - printf("CONT\n"); - break; - case IR_BREAK: - printf("BREAK\n"); - break; - case IR_BREAK_IF_TRUE: - printf("BREAK_IF_TRUE\n"); - _slang_print_ir_tree(n->Children[0], indent+3); - break; - case IR_CONT_IF_TRUE: - printf("CONT_IF_TRUE\n"); - _slang_print_ir_tree(n->Children[0], indent+3); - break; - - case IR_VAR: - printf("VAR %s%s at %s store %p\n", - (n->Var ? (char *) n->Var->a_name : "TEMP"), - _mesa_swizzle_string(n->Store->Swizzle, 0, 0), - storage_string(n->Store), (void*) n->Store); - break; - case IR_VAR_DECL: - printf("VAR_DECL %s (%p) at %s store %p\n", - (n->Var ? (char *) n->Var->a_name : "TEMP"), - (void*) n->Var, storage_string(n->Store), - (void*) n->Store); - break; - case IR_FIELD: - printf("FIELD %s of\n", n->Field); - _slang_print_ir_tree(n->Children[0], indent+3); - break; - case IR_FLOAT: - printf("FLOAT %g %g %g %g\n", - n->Value[0], n->Value[1], n->Value[2], n->Value[3]); - break; - case IR_I_TO_F: - printf("INT_TO_FLOAT\n"); - _slang_print_ir_tree(n->Children[0], indent+3); - break; - case IR_F_TO_I: - printf("FLOAT_TO_INT\n"); - _slang_print_ir_tree(n->Children[0], indent+3); - break; - case IR_SWIZZLE: - printf("SWIZZLE %s of (store %p) \n", - _mesa_swizzle_string(n->Store->Swizzle, 0, 0), (void*) n->Store); - _slang_print_ir_tree(n->Children[0], indent + 3); - break; - default: - printf("%s (%p, %p) (store %p)\n", _slang_ir_name(n->Opcode), - (void*) n->Children[0], (void*) n->Children[1], (void*) n->Store); - _slang_print_ir_tree(n->Children[0], indent+3); - _slang_print_ir_tree(n->Children[1], indent+3); - } -} diff --git a/src/mesa/slang/slang_ir.h b/src/mesa/slang/slang_ir.h deleted file mode 100644 index a010efcb34..0000000000 --- a/src/mesa/slang/slang_ir.h +++ /dev/null @@ -1,293 +0,0 @@ -/* - * Mesa 3-D graphics library - * - * Copyright (C) 2005-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 slang_ir.h - * Mesa GLSL Intermediate Representation tree types and constants. - * \author Brian Paul - */ - - -#ifndef SLANG_IR_H -#define SLANG_IR_H - - -#include "main/glheader.h" -#include "main/mtypes.h" -#include "program/prog_instruction.h" -#include "slang_compile_variable.h" -#include "slang_label.h" - - -/** - * Intermediate Representation opcodes - */ -typedef enum -{ - IR_NOP = 0, - IR_SEQ, /* sequence (eval left, then right) */ - IR_SCOPE, /* new variable scope (one child) */ - - IR_LABEL, /* target of a jump or cjump */ - - IR_COND, /* conditional expression/predicate */ - - IR_IF, /* high-level IF/then/else */ - /* Children[0] = conditional expression */ - /* Children[1] = if-true part */ - /* Children[2] = if-else part, or NULL */ - - IR_BEGIN_SUB, /* begin subroutine */ - IR_END_SUB, /* end subroutine */ - IR_RETURN, /* return from subroutine */ - IR_CALL, /* call subroutine */ - - IR_LOOP, /* high-level loop-begin / loop-end */ - /* Children[0] = loop body */ - /* Children[1] = loop tail code, or NULL */ - - IR_CONT, /* continue loop */ - /* n->Parent = ptr to parent IR_LOOP Node */ - IR_BREAK, /* break loop */ - - IR_BREAK_IF_TRUE, /**< Children[0] = the condition expression */ - IR_CONT_IF_TRUE, - - IR_COPY, /**< assignment/copy */ - IR_MOVE, /**< assembly MOV instruction */ - - /* vector ops: */ - IR_ADD, /**< assembly ADD instruction */ - IR_SUB, - IR_MUL, - IR_DIV, - IR_DOT4, - IR_DOT3, - IR_DOT2, - IR_NRM4, - IR_NRM3, - IR_CROSS, /* vec3 cross product */ - IR_LRP, - IR_CLAMP, - IR_MIN, - IR_MAX, - IR_CMP, /* = (op0 < 0) ? op1 : op2 */ - IR_SEQUAL, /* Set if args are equal (vector) */ - IR_SNEQUAL, /* Set if args are not equal (vector) */ - IR_SGE, /* Set if greater or equal (vector) */ - IR_SGT, /* Set if greater than (vector) */ - IR_SLE, /* Set if less or equal (vector) */ - IR_SLT, /* Set if less than (vector) */ - IR_POW, /* x^y */ - IR_EXP, /* e^x */ - IR_EXP2, /* 2^x */ - IR_LOG2, /* log base 2 */ - IR_RSQ, /* 1/sqrt() */ - IR_RCP, /* reciprocol */ - IR_FLOOR, - IR_FRAC, - IR_ABS, /* absolute value */ - IR_NEG, /* negate */ - IR_DDX, /* derivative w.r.t. X */ - IR_DDY, /* derivative w.r.t. Y */ - IR_SIN, /* sine */ - IR_COS, /* cosine */ - IR_NOISE1, /* noise(x) */ - IR_NOISE2, /* noise(x, y) */ - IR_NOISE3, /* noise(x, y, z) */ - IR_NOISE4, /* noise(x, y, z, w) */ - - IR_EQUAL, /* boolean equality */ - IR_NOTEQUAL,/* boolean inequality */ - IR_NOT, /* boolean not */ - - IR_VAR, /* variable reference */ - IR_VAR_DECL,/* var declaration */ - - IR_ELEMENT, /* array element */ - IR_FIELD, /* struct field */ - IR_SWIZZLE, /* swizzled storage access */ - - IR_TEX, /* texture lookup */ - IR_TEXB, /* texture lookup with LOD bias */ - IR_TEXP, /* texture lookup with projection */ - - IR_TEX_SH, /* texture lookup, shadow compare */ - IR_TEXB_SH, /* texture lookup with LOD bias, shadow compare */ - IR_TEXP_SH, /* texture lookup with projection, shadow compare */ - - IR_FLOAT, - IR_I_TO_F, /* int[4] to float[4] conversion */ - IR_F_TO_I, /* float[4] to int[4] conversion */ - - IR_KILL, /* fragment kill/discard */ - - IR_EMIT_VERTEX, /* geometry shader: emit vertex */ - IR_END_PRIMITIVE /* geometry shader: end primitive */ -} slang_ir_opcode; - - -/** - * Describes where data/variables are stored in the various register files. - * - * In the simple case, the File, Index and Size fields indicate where - * a variable is stored. For example, a vec3 variable may be stored - * as (File=PROGRAM_TEMPORARY, Index=6, Size=3). Or, File[Index]. - * Or, a program input like color may be stored as - * (File=PROGRAM_INPUT,Index=3,Size=4); - * - * For single-float values, the Swizzle field indicates which component - * of the vector contains the float. - * - * If IsIndirect is set, the storage is accessed through an indirect - * register lookup. The value in question will be located at: - * File[Index + IndirectFile[IndirectIndex]] - * - * This is primary used for indexing arrays. For example, consider this - * GLSL code: - * uniform int i; - * float a[10]; - * float x = a[i]; - * - * here, storage for a[i] would be described by (File=PROGRAM_TEMPORAY, - * Index=aPos, IndirectFile=PROGRAM_UNIFORM, IndirectIndex=iPos), which - * would mean TEMP[aPos + UNIFORM[iPos]] - */ -struct slang_ir_storage_ -{ - gl_register_file File; /**< PROGRAM_TEMPORARY, PROGRAM_INPUT, etc */ - GLint Index; /**< -1 means unallocated */ - GLint Size; /**< number of floats or ints */ - GLuint Swizzle; /**< Swizzle AND writemask info */ - GLint RefCount; /**< Used during IR tree delete */ - - GLboolean RelAddr; /* we'll remove this eventually */ - - GLboolean IsIndirect; - gl_register_file IndirectFile; - GLint IndirectIndex; - GLuint IndirectSwizzle; - GLuint TexTarget; /**< If File==PROGRAM_SAMPLER, one of TEXTURE_x_INDEX */ - - /* Is the register two-dimensional and - * if so what's the second index */ - GLboolean Is2D; - GLint Index2; - - /** If Parent is non-null, Index is relative to parent. - * The other fields are ignored. - */ - struct slang_ir_storage_ *Parent; -}; - -typedef struct slang_ir_storage_ slang_ir_storage; - - -/** - * Intermediate Representation (IR) tree node - * Basically a binary tree, but IR_LRP and IR_CLAMP have three children. - */ -typedef struct slang_ir_node_ -{ - slang_ir_opcode Opcode; - struct slang_ir_node_ *Children[3]; - slang_ir_storage *Store; /**< location of result of this operation */ - GLint InstLocation; /**< Location of instruction emitted for this node */ - - /** special fields depending on Opcode: */ - const char *Field; /**< If Opcode == IR_FIELD */ - GLfloat Value[4]; /**< If Opcode == IR_FLOAT */ - slang_variable *Var; /**< If Opcode == IR_VAR or IR_VAR_DECL */ - struct slang_ir_node_ *List; /**< For various linked lists */ - struct slang_ir_node_ *Parent; /**< Pointer to logical parent (ie. loop) */ - slang_label *Label; /**< Used for branches */ - const char *Comment; /**< If Opcode == IR_COMMENT */ -} slang_ir_node; - - - -/** - * Assembly and IR info - */ -typedef struct -{ - slang_ir_opcode IrOpcode; - const char *IrName; - gl_inst_opcode InstOpcode; - GLuint ResultSize, NumParams; -} slang_ir_info; - - - -extern const slang_ir_info * -_slang_ir_info(slang_ir_opcode opcode); - - -extern void -_slang_init_ir_storage(slang_ir_storage *st, - gl_register_file file, GLint index, GLint size, - GLuint swizzle); - -extern slang_ir_storage * -_slang_new_ir_storage(gl_register_file file, GLint index, GLint size); - - -extern slang_ir_storage * -_slang_new_ir_storage_swz(gl_register_file file, GLint index, GLint size, - GLuint swizzle); - -extern slang_ir_storage * -_slang_new_ir_storage_2d(gl_register_file file, GLint index, GLint index2d, - GLint size, GLuint swizzle); - -extern slang_ir_storage * -_slang_new_ir_storage_relative(GLint index, GLint size, - slang_ir_storage *parent); - - -extern slang_ir_storage * -_slang_new_ir_storage_indirect(gl_register_file file, - GLint index, - GLint size, - gl_register_file indirectFile, - GLint indirectIndex, - GLuint indirectSwizzle); - -extern slang_ir_storage * -_slang_new_ir_storage_sampler(GLint sampNum, GLuint texTarget, GLint size); - - -extern void -_slang_copy_ir_storage(slang_ir_storage *dst, const slang_ir_storage *src); - - -extern void -_slang_free_ir_tree(slang_ir_node *n); - - -extern void -_slang_print_ir_tree(const slang_ir_node *n, int indent); - - -#endif /* SLANG_IR_H */ diff --git a/src/mesa/slang/slang_label.c b/src/mesa/slang/slang_label.c deleted file mode 100644 index a161139800..0000000000 --- a/src/mesa/slang/slang_label.c +++ /dev/null @@ -1,107 +0,0 @@ - - -/** - * Functions for managing instruction labels. - * Basically, this is used to manage the problem of forward branches where - * we have a branch instruciton but don't know the target address yet. - */ - - -#include "main/imports.h" -#include "main/mtypes.h" -#include "program/prog_instruction.h" -#include "slang_label.h" -#include "slang_mem.h" - - - -slang_label * -_slang_label_new(const char *name) -{ - slang_label *l = (slang_label *) _slang_alloc(sizeof(slang_label)); - if (l) { - l->Name = _slang_strdup(name); - l->Location = -1; - } - return l; -} - -/** - * As above, but suffix the name with a unique number. - */ -slang_label * -_slang_label_new_unique(const char *name) -{ - static int id = 1; - slang_label *l = (slang_label *) _slang_alloc(sizeof(slang_label)); - if (l) { - l->Name = (char *) _slang_alloc(strlen(name) + 10); - if (!l->Name) { - free(l); - return NULL; - } - _mesa_snprintf(l->Name, strlen(name) + 10, "%s_%d", name, id); - id++; - l->Location = -1; - } - return l; -} - -void -_slang_label_delete(slang_label *l) -{ - if (l->Name) { - _slang_free(l->Name); - l->Name = NULL; - } - if (l->References) { - _slang_free(l->References); - l->References = NULL; - } - _slang_free(l); -} - - -void -_slang_label_add_reference(slang_label *l, GLuint inst) -{ - const GLuint oldSize = l->NumReferences * sizeof(GLuint); - assert(l->Location < 0); - l->References = _slang_realloc(l->References, - oldSize, oldSize + sizeof(GLuint)); - if (l->References) { - l->References[l->NumReferences] = inst; - l->NumReferences++; - } -} - - -GLint -_slang_label_get_location(const slang_label *l) -{ - return l->Location; -} - - -void -_slang_label_set_location(slang_label *l, GLint location, - struct gl_program *prog) -{ - GLuint i; - - assert(l->Location < 0); - assert(location >= 0); - - l->Location = location; - - /* for the instructions that were waiting to learn the label's location: */ - for (i = 0; i < l->NumReferences; i++) { - const GLuint j = l->References[i]; - prog->Instructions[j].BranchTarget = location; - } - - if (l->References) { - _slang_free(l->References); - l->References = NULL; - } -} diff --git a/src/mesa/slang/slang_label.h b/src/mesa/slang/slang_label.h deleted file mode 100644 index b0cff3a8e8..0000000000 --- a/src/mesa/slang/slang_label.h +++ /dev/null @@ -1,44 +0,0 @@ -#ifndef SLANG_LABEL_H -#define SLANG_LABEL_H 1 - -#include "main/glheader.h" - -struct gl_program; - -struct slang_label_ -{ - char *Name; - GLint Location; - /** - * List of instruction references (numbered starting at zero) which need - * their BranchTarget field filled in with the location eventually - * assigned to the label. - */ - GLuint NumReferences; - GLuint *References; /** Array [NumReferences] */ -}; - -typedef struct slang_label_ slang_label; - - -extern slang_label * -_slang_label_new(const char *name); - -extern slang_label * -_slang_label_new_unique(const char *name); - -extern void -_slang_label_delete(slang_label *l); - -extern void -_slang_label_add_reference(slang_label *l, GLuint inst); - -extern GLint -_slang_label_get_location(const slang_label *l); - -extern void -_slang_label_set_location(slang_label *l, GLint location, - struct gl_program *prog); - - -#endif /* SLANG_LABEL_H */ diff --git a/src/mesa/slang/slang_link.c b/src/mesa/slang/slang_link.c deleted file mode 100644 index 28ad0b74e8..0000000000 --- a/src/mesa/slang/slang_link.c +++ /dev/null @@ -1,1288 +0,0 @@ -/* - * Mesa 3-D graphics library - * Version: 7.3 - * - * Copyright (C) 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 slang_link.c - * GLSL linker - * \author Brian Paul - */ - -#include "main/imports.h" -#include "main/context.h" -#include "main/macros.h" -#include "main/shaderapi.h" -#include "main/shaderobj.h" -#include "main/uniforms.h" -#include "program/program.h" -#include "program/prog_instruction.h" -#include "program/prog_parameter.h" -#include "program/prog_print.h" -#include "program/prog_statevars.h" -#include "program/prog_uniform.h" -#include "slang_builtin.h" -#include "slang_compile.h" -#include "slang_link.h" - - -/** cast wrapper */ -static struct gl_vertex_program * -vertex_program(struct gl_program *prog) -{ - assert(prog->Target == GL_VERTEX_PROGRAM_ARB); - return (struct gl_vertex_program *) prog; -} - - -/** cast wrapper */ -static struct gl_fragment_program * -fragment_program(struct gl_program *prog) -{ - assert(prog->Target == GL_FRAGMENT_PROGRAM_ARB); - return (struct gl_fragment_program *) prog; -} - -static struct gl_geometry_program * -geometry_program(struct gl_program *prog) -{ - assert(prog->Target == MESA_GEOMETRY_PROGRAM); - return (struct gl_geometry_program *)prog; -} - -/** - * Record a linking error. - */ -static void -link_error(struct gl_shader_program *shProg, const char *msg) -{ - if (shProg->InfoLog) { - free(shProg->InfoLog); - } - shProg->InfoLog = _mesa_strdup(msg); - shProg->LinkStatus = GL_FALSE; -} - - - -/** - * Check if the given bit is either set or clear in both bitfields. - */ -static GLboolean -bits_agree(GLbitfield flags1, GLbitfield flags2, GLbitfield bit) -{ - return (flags1 & bit) == (flags2 & bit); -} - - -/** - * Examine the outputs/varyings written by the vertex shader and - * append the names of those outputs onto the Varyings list. - * This will only capture the pre-defined/built-in varyings like - * gl_Position, not user-defined varyings. - */ -static void -update_varying_var_list(GLcontext *ctx, struct gl_shader_program *shProg) -{ - if (shProg->VertexProgram) { - GLbitfield64 written = shProg->VertexProgram->Base.OutputsWritten; - GLuint i; - for (i = 0; written && i < VERT_RESULT_MAX; i++) { - if (written & BITFIELD64_BIT(i)) { - const char *name = _slang_vertex_output_name(i); - if (name) - _mesa_add_varying(shProg->Varying, name, 1, GL_FLOAT_VEC4, 0x0); - written &= ~BITFIELD64_BIT(i); - } - } - } - if (shProg->GeometryProgram) { - GLbitfield64 written = shProg->GeometryProgram->Base.OutputsWritten; - GLuint i; - for (i = 0; written && i < GEOM_RESULT_MAX; i++) { - if (written & BITFIELD64_BIT(i)) { - const char *name = _slang_geometry_output_name(i); - if (name) - _mesa_add_varying(shProg->Varying, name, 1, GL_FLOAT_VEC4, 0x0); - written &= ~BITFIELD64_BIT(i); - } - } - } -} - - -/** - * Do link error checking related to transform feedback. - */ -static GLboolean -link_transform_feedback(GLcontext *ctx, struct gl_shader_program *shProg) -{ - GLbitfield varyingMask; - GLuint totalComps, maxComps, i; - - if (shProg->TransformFeedback.NumVarying == 0) { - /* nothing to do */ - return GL_TRUE; - } - - /* Check that there's a vertex shader */ - if (shProg->TransformFeedback.NumVarying > 0 && - !shProg->VertexProgram) { - link_error(shProg, "Transform feedback without vertex shader"); - return GL_FALSE; - } - - /* Check that all named variables exist, and that none are duplicated. - * Also, build a count of the number of varying components to feedback. - */ - totalComps = 0; - varyingMask = 0x0; - for (i = 0; i < shProg->TransformFeedback.NumVarying; i++) { - const GLchar *name = shProg->TransformFeedback.VaryingNames[i]; - GLint v = _mesa_lookup_parameter_index(shProg->Varying, -1, name); - struct gl_program_parameter *p; - - if (v < 0) { - char msg[100]; - _mesa_snprintf(msg, sizeof(msg), - "vertex shader does not emit %s", name); - link_error(shProg, msg); - return GL_FALSE; - } - - assert(v < MAX_VARYING); - - /* already seen this varying name? */ - if (varyingMask & (1 << v)) { - char msg[100]; - _mesa_snprintf(msg, sizeof(msg), - "duplicated transform feedback varying name: %s", - name); - link_error(shProg, msg); - return GL_FALSE; - } - - varyingMask |= (1 << v); - - p = &shProg->Varying->Parameters[v]; - - totalComps += _mesa_sizeof_glsl_type(p->DataType); - } - - if (shProg->TransformFeedback.BufferMode == GL_INTERLEAVED_ATTRIBS) - maxComps = ctx->Const.MaxTransformFeedbackInterleavedComponents; - else - maxComps = ctx->Const.MaxTransformFeedbackSeparateComponents; - - /* check max varying components against the limit */ - if (totalComps > maxComps) { - char msg[100]; - _mesa_snprintf(msg, sizeof(msg), - "Too many feedback components: %u, max is %u", - totalComps, maxComps); - link_error(shProg, msg); - return GL_FALSE; - } - - return GL_TRUE; -} - - -/** - * Linking varying vars involves rearranging varying vars so that the - * vertex program's output varyings matches the order of the fragment - * program's input varyings. - * We'll then rewrite instructions to replace PROGRAM_VARYING with either - * PROGRAM_INPUT or PROGRAM_OUTPUT depending on whether it's a vertex or - * fragment shader. - * This is also where we set program Input/OutputFlags to indicate - * which inputs are centroid-sampled, invariant, etc. - */ -static GLboolean -link_varying_vars(GLcontext *ctx, - struct gl_shader_program *shProg, struct gl_program *prog) -{ - GLuint *map, i, firstSrcVarying, firstDstVarying, newSrcFile, newDstFile; - GLbitfield *inOutFlags = NULL; - - map = (GLuint *) malloc(prog->Varying->NumParameters * sizeof(GLuint)); - if (!map) - return GL_FALSE; - - /* Varying variables are treated like other vertex program outputs - * (and like other fragment program inputs). The position of the - * first varying differs for vertex/fragment programs... - * Also, replace File=PROGRAM_VARYING with File=PROGRAM_INPUT/OUTPUT. - */ - if (prog->Target == GL_VERTEX_PROGRAM_ARB) { - firstSrcVarying = firstDstVarying = VERT_RESULT_VAR0; - newSrcFile = newDstFile = PROGRAM_OUTPUT; - inOutFlags = prog->OutputFlags; - } - else if (prog->Target == MESA_GEOMETRY_PROGRAM) { - firstSrcVarying = GEOM_ATTRIB_VAR0; - newSrcFile = PROGRAM_INPUT; - firstDstVarying = GEOM_RESULT_VAR0; - newDstFile = PROGRAM_OUTPUT; - } - else { - assert(prog->Target == GL_FRAGMENT_PROGRAM_ARB); - firstSrcVarying = firstDstVarying = FRAG_ATTRIB_VAR0; - newSrcFile = newDstFile = PROGRAM_INPUT; - inOutFlags = prog->InputFlags; - } - - for (i = 0; i < prog->Varying->NumParameters; i++) { - /* see if this varying is in the linked varying list */ - const struct gl_program_parameter *var = prog->Varying->Parameters + i; - GLint j = _mesa_lookup_parameter_index(shProg->Varying, -1, var->Name); - if (j >= 0) { - /* varying is already in list, do some error checking */ - const struct gl_program_parameter *v = - &shProg->Varying->Parameters[j]; - if (var->Size != v->Size) { - link_error(shProg, "mismatched varying variable types"); - free(map); - return GL_FALSE; - } - if (!bits_agree(var->Flags, v->Flags, PROG_PARAM_BIT_CENTROID)) { - char msg[100]; - _mesa_snprintf(msg, sizeof(msg), - "centroid modifier mismatch for '%s'", var->Name); - link_error(shProg, msg); - free(map); - return GL_FALSE; - } - if (!bits_agree(var->Flags, v->Flags, PROG_PARAM_BIT_INVARIANT)) { - char msg[100]; - _mesa_snprintf(msg, sizeof(msg), - "invariant modifier mismatch for '%s'", var->Name); - link_error(shProg, msg); - free(map); - return GL_FALSE; - } - } - else { - /* not already in linked list */ - j = _mesa_add_varying(shProg->Varying, var->Name, var->Size, - var->DataType, var->Flags); - } - - if (shProg->Varying->NumParameters > ctx->Const.MaxVarying) { - link_error(shProg, "Too many varying variables"); - free(map); - return GL_FALSE; - } - - /* Map varying[i] to varying[j]. - * Note: the loop here takes care of arrays or large (sz>4) vars. - */ - { - GLint sz = var->Size; - while (sz > 0) { - inOutFlags[firstDstVarying + j] = var->Flags; - /*printf("Link varying from %d to %d\n", i, j);*/ - map[i++] = j++; - sz -= 4; - } - i--; /* go back one */ - } - } - - - /* OK, now scan the program/shader instructions looking for varying vars, - * replacing the old index with the new index. - */ - for (i = 0; i < prog->NumInstructions; i++) { - struct prog_instruction *inst = prog->Instructions + i; - GLuint j; - - if (inst->DstReg.File == PROGRAM_VARYING) { - inst->DstReg.File = newDstFile; - inst->DstReg.Index = map[ inst->DstReg.Index ] + firstDstVarying; - } - - for (j = 0; j < 3; j++) { - if (inst->SrcReg[j].File == PROGRAM_VARYING) { - inst->SrcReg[j].File = newSrcFile; - inst->SrcReg[j].Index = map[ inst->SrcReg[j].Index ] + firstSrcVarying; - } - } - } - - free(map); - - /* these will get recomputed before linking is completed */ - prog->InputsRead = 0x0; - prog->OutputsWritten = 0x0; - - return GL_TRUE; -} - - -/** - * Build the shProg->Uniforms list. - * This is basically a list/index of all uniforms found in either/both of - * the vertex and fragment shaders. - * - * About uniforms: - * Each uniform has two indexes, one that points into the vertex - * program's parameter array and another that points into the fragment - * program's parameter array. When the user changes a uniform's value - * we have to change the value in the vertex and/or fragment program's - * parameter array. - * - * This function will be called twice to set up the two uniform->parameter - * mappings. - * - * If a uniform is only present in the vertex program OR fragment program - * then the fragment/vertex parameter index, respectively, will be -1. - */ -static GLboolean -link_uniform_vars(GLcontext *ctx, - struct gl_shader_program *shProg, - struct gl_program *prog, - GLuint *numSamplers) -{ - GLuint samplerMap[200]; /* max number of samplers declared, not used */ - GLuint i; - - for (i = 0; i < prog->Parameters->NumParameters; i++) { - const struct gl_program_parameter *p = prog->Parameters->Parameters + i; - - /* - * XXX FIX NEEDED HERE - * We should also be adding a uniform if p->Type == PROGRAM_STATE_VAR. - * For example, modelview matrix, light pos, etc. - * Also, we need to update the state-var name-generator code to - * generate GLSL-style names, like "gl_LightSource[0].position". - * Furthermore, we'll need to fix the state-var's size/datatype info. - */ - - if ((p->Type == PROGRAM_UNIFORM || p->Type == PROGRAM_SAMPLER) - && p->Used) { - /* add this uniform, indexing into the target's Parameters list */ - struct gl_uniform *uniform = - _mesa_append_uniform(shProg->Uniforms, p->Name, prog->Target, i); - if (uniform) - uniform->Initialized = p->Initialized; - } - - /* The samplerMap[] table we build here is used to remap/re-index - * sampler references by TEX instructions. - */ - if (p->Type == PROGRAM_SAMPLER && p->Used) { - /* Allocate a new sampler index */ - GLuint oldSampNum = (GLuint) prog->Parameters->ParameterValues[i][0]; - GLuint newSampNum = *numSamplers; - if (newSampNum >= ctx->Const.MaxTextureImageUnits) { - char s[100]; - _mesa_snprintf(s, sizeof(s), - "Too many texture samplers (%u, max is %u)", - newSampNum, ctx->Const.MaxTextureImageUnits); - link_error(shProg, s); - return GL_FALSE; - } - /* save old->new mapping in the table */ - if (oldSampNum < Elements(samplerMap)) - samplerMap[oldSampNum] = newSampNum; - /* update parameter's sampler index */ - prog->Parameters->ParameterValues[i][0] = (GLfloat) newSampNum; - (*numSamplers)++; - } - } - - /* OK, now scan the program/shader instructions looking for texture - * instructions using sampler vars. Replace old sampler indexes with - * new ones. - */ - prog->SamplersUsed = 0x0; - for (i = 0; i < prog->NumInstructions; i++) { - struct prog_instruction *inst = prog->Instructions + i; - if (_mesa_is_tex_instruction(inst->Opcode)) { - /* here, inst->TexSrcUnit is really the sampler unit */ - const GLint oldSampNum = inst->TexSrcUnit; - -#if 0 - printf("====== remap sampler from %d to %d\n", - inst->TexSrcUnit, samplerMap[ inst->TexSrcUnit ]); -#endif - - if (oldSampNum < Elements(samplerMap)) { - const GLuint newSampNum = samplerMap[oldSampNum]; - inst->TexSrcUnit = newSampNum; - prog->SamplerTargets[newSampNum] = inst->TexSrcTarget; - prog->SamplersUsed |= (1 << newSampNum); - if (inst->TexShadow) { - prog->ShadowSamplers |= (1 << newSampNum); - } - } - } - } - - return GL_TRUE; -} - - -/** - * Resolve binding of generic vertex attributes. - * For example, if the vertex shader declared "attribute vec4 foobar" we'll - * allocate a generic vertex attribute for "foobar" and plug that value into - * the vertex program instructions. - * But if the user called glBindAttributeLocation(), those bindings will - * have priority. - */ -static GLboolean -_slang_resolve_attributes(struct gl_shader_program *shProg, - const struct gl_program *origProg, - struct gl_program *linkedProg) -{ - GLint attribMap[MAX_VERTEX_GENERIC_ATTRIBS]; - GLuint i, j; - GLbitfield usedAttributes; /* generics only, not legacy attributes */ - GLbitfield inputsRead = 0x0; - - assert(origProg != linkedProg); - assert(origProg->Target == GL_VERTEX_PROGRAM_ARB); - assert(linkedProg->Target == GL_VERTEX_PROGRAM_ARB); - - if (!shProg->Attributes) - shProg->Attributes = _mesa_new_parameter_list(); - - if (linkedProg->Attributes) { - _mesa_free_parameter_list(linkedProg->Attributes); - } - linkedProg->Attributes = _mesa_new_parameter_list(); - - - /* Build a bitmask indicating which attribute indexes have been - * explicitly bound by the user with glBindAttributeLocation(). - */ - usedAttributes = 0x0; - for (i = 0; i < shProg->Attributes->NumParameters; i++) { - GLint attr = shProg->Attributes->Parameters[i].StateIndexes[0]; - usedAttributes |= (1 << attr); - } - - /* If gl_Vertex is used, that actually counts against the limit - * on generic vertex attributes. This avoids the ambiguity of - * whether glVertexAttrib4fv(0, v) sets legacy attribute 0 (vert pos) - * or generic attribute[0]. If gl_Vertex is used, we want the former. - */ - if (origProg->InputsRead & VERT_BIT_POS) { - usedAttributes |= 0x1; - } - - /* initialize the generic attribute map entries to -1 */ - for (i = 0; i < MAX_VERTEX_GENERIC_ATTRIBS; i++) { - attribMap[i] = -1; - } - - /* - * Scan program for generic attribute references - */ - for (i = 0; i < linkedProg->NumInstructions; i++) { - struct prog_instruction *inst = linkedProg->Instructions + i; - for (j = 0; j < 3; j++) { - if (inst->SrcReg[j].File == PROGRAM_INPUT) { - inputsRead |= (1 << inst->SrcReg[j].Index); - } - - if (inst->SrcReg[j].File == PROGRAM_INPUT && - inst->SrcReg[j].Index >= VERT_ATTRIB_GENERIC0) { - /* - * OK, we've found a generic vertex attribute reference. - */ - const GLint k = inst->SrcReg[j].Index - VERT_ATTRIB_GENERIC0; - - GLint attr = attribMap[k]; - - if (attr < 0) { - /* Need to figure out attribute mapping now. - */ - const char *name = origProg->Attributes->Parameters[k].Name; - const GLint size = origProg->Attributes->Parameters[k].Size; - const GLenum type =origProg->Attributes->Parameters[k].DataType; - GLint index; - - /* See if there's a user-defined attribute binding for - * this name. - */ - index = _mesa_lookup_parameter_index(shProg->Attributes, - -1, name); - if (index >= 0) { - /* Found a user-defined binding */ - attr = shProg->Attributes->Parameters[index].StateIndexes[0]; - } - else { - /* No user-defined binding, choose our own attribute number. - * Start at 1 since generic attribute 0 always aliases - * glVertex/position. - */ - for (attr = 0; attr < MAX_VERTEX_GENERIC_ATTRIBS; attr++) { - if (((1 << attr) & usedAttributes) == 0) - break; - } - if (attr == MAX_VERTEX_GENERIC_ATTRIBS) { - link_error(shProg, "Too many vertex attributes"); - return GL_FALSE; - } - - /* mark this attribute as used */ - usedAttributes |= (1 << attr); - } - - attribMap[k] = attr; - - /* Save the final name->attrib binding so it can be queried - * with glGetAttributeLocation(). - */ - _mesa_add_attribute(linkedProg->Attributes, name, - size, type, attr); - } - - assert(attr >= 0); - - /* update the instruction's src reg */ - inst->SrcReg[j].Index = VERT_ATTRIB_GENERIC0 + attr; - } - } - } - - /* Handle pre-defined attributes here (gl_Vertex, gl_Normal, etc). - * When the user queries the active attributes we need to include both - * the user-defined attributes and the built-in ones. - */ - for (i = VERT_ATTRIB_POS; i < VERT_ATTRIB_GENERIC0; i++) { - if (inputsRead & (1 << i)) { - _mesa_add_attribute(linkedProg->Attributes, - _slang_vert_attrib_name(i), - 4, /* size in floats */ - _slang_vert_attrib_type(i), - -1 /* attrib/input */); - } - } - - return GL_TRUE; -} - - -/** - * Scan program instructions to update the program's NumTemporaries field. - * Note: this implemenation relies on the code generator allocating - * temps in increasing order (0, 1, 2, ... ). - */ -static void -_slang_count_temporaries(struct gl_program *prog) -{ - GLuint i, j; - GLint maxIndex = -1; - - for (i = 0; i < prog->NumInstructions; i++) { - const struct prog_instruction *inst = prog->Instructions + i; - const GLuint numSrc = _mesa_num_inst_src_regs(inst->Opcode); - for (j = 0; j < numSrc; j++) { - if (inst->SrcReg[j].File == PROGRAM_TEMPORARY) { - if (maxIndex < inst->SrcReg[j].Index) - maxIndex = inst->SrcReg[j].Index; - } - if (inst->DstReg.File == PROGRAM_TEMPORARY) { - if (maxIndex < (GLint) inst->DstReg.Index) - maxIndex = inst->DstReg.Index; - } - } - } - - prog->NumTemporaries = (GLuint) (maxIndex + 1); -} - - -/** - * If an input attribute is indexed with relative addressing we have - * to compute a gl_program::InputsRead bitmask which reflects the fact - * that any input may be referenced by array element. Ex: gl_TexCoord[i]. - * This function computes the bitmask of potentially read inputs. - */ -static GLbitfield -get_inputs_read_mask(GLenum target, GLuint index, GLboolean relAddr) -{ - GLbitfield mask; - - mask = 1 << index; - - if (relAddr) { - if (target == GL_VERTEX_PROGRAM_ARB) { - switch (index) { - case VERT_ATTRIB_TEX0: - mask = ((1U << (VERT_ATTRIB_TEX7 + 1)) - 1) - - ((1U << VERT_ATTRIB_TEX0) - 1); - break; - case VERT_ATTRIB_GENERIC0: - /* different code to avoid uint overflow */ - mask = ~0x0U - ((1U << VERT_ATTRIB_GENERIC0) - 1); - break; - default: - ; /* a non-array input attribute */ - } - } - else if (target == GL_FRAGMENT_PROGRAM_ARB) { - switch (index) { - case FRAG_ATTRIB_TEX0: - mask = ((1U << (FRAG_ATTRIB_TEX7 + 1)) - 1) - - ((1U << FRAG_ATTRIB_TEX0) - 1); - break; - case FRAG_ATTRIB_VAR0: - mask = ((1U << (FRAG_ATTRIB_VAR0 + MAX_VARYING)) - 1) - - ((1U << FRAG_ATTRIB_VAR0) - 1); - break; - default: - ; /* a non-array input attribute */ - } - } - else if (target == MESA_GEOMETRY_PROGRAM) { - switch (index) { - case GEOM_ATTRIB_VAR0: - mask = ((1ULL << (GEOM_ATTRIB_VAR0 + MAX_VARYING)) - 1) - - ((1ULL << GEOM_ATTRIB_VAR0) - 1); - break; - default: - ; /* a non-array input attribute */ - } - } - else { - assert(0 && "bad program target"); - } - } - else { - } - - return mask; -} - - -/** - * If an output attribute is indexed with relative addressing we have - * to compute a gl_program::OutputsWritten bitmask which reflects the fact - * that any output may be referenced by array element. Ex: gl_TexCoord[i]. - * This function computes the bitmask of potentially written outputs. - */ -static GLbitfield64 -get_outputs_written_mask(GLenum target, GLuint index, GLboolean relAddr) -{ - GLbitfield64 mask; - - mask = BITFIELD64_BIT(index); - - if (relAddr) { - if (target == GL_VERTEX_PROGRAM_ARB) { - switch (index) { - case VERT_RESULT_TEX0: - mask = BITFIELD64_RANGE(VERT_RESULT_TEX0, - (VERT_RESULT_TEX0 - + MAX_TEXTURE_COORD_UNITS - 1)); - break; - case VERT_RESULT_VAR0: - mask = BITFIELD64_RANGE(VERT_RESULT_VAR0, - (VERT_RESULT_VAR0 + MAX_VARYING - 1)); - break; - default: - ; /* a non-array output attribute */ - } - } - else if (target == GL_FRAGMENT_PROGRAM_ARB) { - switch (index) { - case FRAG_RESULT_DATA0: - mask = BITFIELD64_RANGE(FRAG_RESULT_DATA0, - (FRAG_RESULT_DATA0 - + MAX_DRAW_BUFFERS - 1)); - break; - default: - ; /* a non-array output attribute */ - } - } - else if (target == MESA_GEOMETRY_PROGRAM) { - switch (index) { - case GEOM_RESULT_TEX0: - mask = BITFIELD64_RANGE(GEOM_RESULT_TEX0, - (GEOM_RESULT_TEX0 - + MAX_TEXTURE_COORD_UNITS - 1)); - break; - case GEOM_RESULT_VAR0: - mask = BITFIELD64_RANGE(GEOM_RESULT_VAR0, - (GEOM_RESULT_VAR0 + MAX_VARYING - 1)); - break; - default: - ; /* a non-array output attribute */ - } - } - else { - assert(0 && "bad program target"); - } - } - - return mask; -} - - -/** - * Scan program instructions to update the program's InputsRead and - * OutputsWritten fields. - */ -static void -_slang_update_inputs_outputs(struct gl_program *prog) -{ - GLuint i, j; - GLuint maxAddrReg = 0; - - prog->InputsRead = 0x0; - prog->OutputsWritten = 0x0; - - prog->IndirectRegisterFiles = 0x0; - - for (i = 0; i < prog->NumInstructions; i++) { - const struct prog_instruction *inst = prog->Instructions + i; - const GLuint numSrc = _mesa_num_inst_src_regs(inst->Opcode); - for (j = 0; j < numSrc; j++) { - if (inst->SrcReg[j].File == PROGRAM_INPUT) { - if (prog->Target == MESA_GEOMETRY_PROGRAM && - inst->SrcReg[j].HasIndex2) - prog->InputsRead |= get_inputs_read_mask(prog->Target, - inst->SrcReg[j].Index2, - inst->SrcReg[j].RelAddr2); - else - prog->InputsRead |= get_inputs_read_mask(prog->Target, - inst->SrcReg[j].Index, - inst->SrcReg[j].RelAddr); - } - else if (inst->SrcReg[j].File == PROGRAM_ADDRESS) { - maxAddrReg = MAX2(maxAddrReg, (GLuint) (inst->SrcReg[j].Index + 1)); - } - - if (inst->SrcReg[j].RelAddr) - prog->IndirectRegisterFiles |= (1 << inst->SrcReg[j].File); - } - - if (inst->DstReg.File == PROGRAM_OUTPUT) { - prog->OutputsWritten |= get_outputs_written_mask(prog->Target, - inst->DstReg.Index, - inst->DstReg.RelAddr); - } - else if (inst->DstReg.File == PROGRAM_ADDRESS) { - maxAddrReg = MAX2(maxAddrReg, inst->DstReg.Index + 1); - } - if (inst->DstReg.RelAddr) - prog->IndirectRegisterFiles |= (1 << inst->DstReg.File); - } - prog->NumAddressRegs = maxAddrReg; -} - - - -/** - * Remove extra #version directives from the concatenated source string. - * Disable the extra ones by converting first two chars to //, a comment. - * This is a bit of hack to work around a preprocessor bug that only - * allows one #version directive per source. - */ -static void -remove_extra_version_directives(GLchar *source) -{ - GLuint verCount = 0; - while (1) { - char *ver = strstr(source, "#version"); - if (ver) { - verCount++; - if (verCount > 1) { - ver[0] = '/'; - ver[1] = '/'; - } - source += 8; - } - else { - break; - } - } -} - -/* Returns the number of vertices per geometry shader - * input primitive. - * XXX: duplicated in Gallium in u_vertices_per_prim - * method. Once Mesa core will start using Gallium - * this should be removed - */ -static int -vertices_per_prim(int prim) -{ - switch (prim) { - case GL_POINTS: - return 1; - case GL_LINES: - return 2; - case GL_TRIANGLES: - return 3; - case GL_LINES_ADJACENCY_ARB: - return 4; - case GL_TRIANGLES_ADJACENCY_ARB: - return 6; - default: - ASSERT(!"Bad primitive"); - return 3; - } -} - -/** - * Return a new shader whose source code is the concatenation of - * all the shader sources of the given type. - */ -static struct gl_shader * -concat_shaders(struct gl_shader_program *shProg, GLenum shaderType) -{ - struct gl_shader *newShader; - const struct gl_shader *firstShader = NULL; - GLuint *shaderLengths; - GLchar *source; - GLuint totalLen = 0, len = 0; - GLuint i; - - shaderLengths = (GLuint *)malloc(shProg->NumShaders * sizeof(GLuint)); - if (!shaderLengths) { - return NULL; - } - - /* compute total size of new shader source code */ - for (i = 0; i < shProg->NumShaders; i++) { - const struct gl_shader *shader = shProg->Shaders[i]; - if (shader->Type == shaderType) { - shaderLengths[i] = strlen(shader->Source); - totalLen += shaderLengths[i]; - if (!firstShader) - firstShader = shader; - } - } - - if (totalLen == 0) { - free(shaderLengths); - return NULL; - } - - /* Geometry shader will inject definition of - * const int gl_VerticesIn */ - if (shaderType == GL_GEOMETRY_SHADER_ARB) { - totalLen += 32; - } - - source = (GLchar *) malloc(totalLen + 1); - if (!source) { - free(shaderLengths); - return NULL; - } - - /* concatenate shaders */ - for (i = 0; i < shProg->NumShaders; i++) { - const struct gl_shader *shader = shProg->Shaders[i]; - if (shader->Type == shaderType) { - memcpy(source + len, shader->Source, shaderLengths[i]); - len += shaderLengths[i]; - } - } - /* if it's geometry shader we need to inject definition - * of "const int gl_VerticesIn = X;" where X is the number - * of vertices per input primitive - */ - if (shaderType == GL_GEOMETRY_SHADER_ARB) { - GLchar gs_pre[32]; - GLuint num_verts = vertices_per_prim(shProg->Geom.InputType); - _mesa_snprintf(gs_pre, 31, - "const int gl_VerticesIn = %d;\n", num_verts); - memcpy(source + len, gs_pre, strlen(gs_pre)); - len += strlen(gs_pre); - } - source[len] = '\0'; - /* - printf("---NEW CONCATENATED SHADER---:\n%s\n------------\n", source); - */ - - free(shaderLengths); - - remove_extra_version_directives(source); - - newShader = CALLOC_STRUCT(gl_shader); - if (!newShader) { - free(source); - return NULL; - } - - newShader->Type = shaderType; - newShader->Source = source; - newShader->Pragmas = firstShader->Pragmas; - - return newShader; -} - -/** - * Search the shader program's list of shaders to find the one that - * defines main(). - * This will involve shader concatenation and recompilation if needed. - */ -static struct gl_shader * -get_main_shader(GLcontext *ctx, - struct gl_shader_program *shProg, GLenum type) -{ - struct gl_shader *shader = NULL; - GLuint i; - - /* - * Look for a shader that defines main() and has no unresolved references. - */ - for (i = 0; i < shProg->NumShaders; i++) { - shader = shProg->Shaders[i]; - if (shader->Type == type && - shader->Main && - !shader->UnresolvedRefs) { - /* All set! */ - return shader; - } - } - - /* - * There must have been unresolved references during the original - * compilation. Try concatenating all the shaders of the given type - * and recompile that. - */ - shader = concat_shaders(shProg, type); - - if (shader) { - _slang_compile(ctx, shader); - - /* Finally, check if recompiling failed */ - if (!shader->CompileStatus || - !shader->Main || - shader->UnresolvedRefs) { - link_error(shProg, "Unresolved symbols"); - ctx->Driver.DeleteShader(ctx, shader); - return NULL; - } - } - - return shader; -} - - -/** - * Shader linker. Currently: - * - * 1. The last attached vertex shader and fragment shader are linked. - * 2. Varying vars in the two shaders are combined so their locations - * agree between the vertex and fragment stages. They're treated as - * vertex program output attribs and as fragment program input attribs. - * 3. The vertex and fragment programs are cloned and modified to update - * src/dst register references so they use the new, linked varying - * storage locations. - */ -void -_slang_link(GLcontext *ctx, - GLhandleARB programObj, - struct gl_shader_program *shProg) -{ - const struct gl_vertex_program *vertProg = NULL; - const struct gl_fragment_program *fragProg = NULL; - const struct gl_geometry_program *geomProg = NULL; - GLboolean vertNotify = GL_TRUE, fragNotify = GL_TRUE, geomNotify = GL_TRUE; - GLuint numSamplers = 0; - GLuint i; - - _mesa_clear_shader_program_data(ctx, shProg); - - /* Initialize LinkStatus to "success". Will be cleared if error. */ - shProg->LinkStatus = GL_TRUE; - - /* check that all programs compiled successfully */ - for (i = 0; i < shProg->NumShaders; i++) { - if (!shProg->Shaders[i]->CompileStatus) { - link_error(shProg, "linking with uncompiled shader\n"); - return; - } - } - - shProg->Uniforms = _mesa_new_uniform_list(); - shProg->Varying = _mesa_new_parameter_list(); - - /* - * Find the vertex and fragment shaders which define main() - */ - { - struct gl_shader *vertShader, *fragShader, *geomShader; - vertShader = get_main_shader(ctx, shProg, GL_VERTEX_SHADER); - geomShader = get_main_shader(ctx, shProg, GL_GEOMETRY_SHADER_ARB); - fragShader = get_main_shader(ctx, shProg, GL_FRAGMENT_SHADER); - - if (vertShader) - vertProg = vertex_program(vertShader->Program); - if (geomShader) - geomProg = geometry_program(geomShader->Program); - if (fragShader) - fragProg = fragment_program(fragShader->Program); - if (!shProg->LinkStatus) - return; - } - -#if FEATURE_es2_glsl - /* must have both a vertex and fragment program for ES2 */ - if (ctx->API == API_OPENGLES2) { - if (!vertProg) { - link_error(shProg, "missing vertex shader\n"); - return; - } - if (!fragProg) { - link_error(shProg, "missing fragment shader\n"); - return; - } - } -#endif - - /* - * Make copies of the vertex/fragment programs now since we'll be - * changing src/dst registers after merging the uniforms and varying vars. - */ - _mesa_reference_vertprog(ctx, &shProg->VertexProgram, NULL); - if (vertProg) { - struct gl_vertex_program *linked_vprog = - _mesa_clone_vertex_program(ctx, vertProg); - shProg->VertexProgram = linked_vprog; /* refcount OK */ - /* vertex program ID not significant; just set Id for debugging purposes */ - shProg->VertexProgram->Base.Id = shProg->Name; - ASSERT(shProg->VertexProgram->Base.RefCount == 1); - } - _mesa_reference_geomprog(ctx, &shProg->GeometryProgram, NULL); - if (geomProg) { - struct gl_geometry_program *linked_gprog = - _mesa_clone_geometry_program(ctx, geomProg); - shProg->GeometryProgram = linked_gprog; /* refcount OK */ - shProg->GeometryProgram->Base.Id = shProg->Name; - ASSERT(shProg->GeometryProgram->Base.RefCount == 1); - } - _mesa_reference_fragprog(ctx, &shProg->FragmentProgram, NULL); - if (fragProg) { - struct gl_fragment_program *linked_fprog = - _mesa_clone_fragment_program(ctx, fragProg); - shProg->FragmentProgram = linked_fprog; /* refcount OK */ - /* vertex program ID not significant; just set Id for debugging purposes */ - shProg->FragmentProgram->Base.Id = shProg->Name; - ASSERT(shProg->FragmentProgram->Base.RefCount == 1); - } - - /* link varying vars */ - if (shProg->VertexProgram) { - if (!link_varying_vars(ctx, shProg, &shProg->VertexProgram->Base)) - return; - } - if (shProg->GeometryProgram) { - if (!link_varying_vars(ctx, shProg, &shProg->GeometryProgram->Base)) - return; - } - if (shProg->FragmentProgram) { - if (!link_varying_vars(ctx, shProg, &shProg->FragmentProgram->Base)) - return; - } - - /* link uniform vars */ - if (shProg->VertexProgram) { - if (!link_uniform_vars(ctx, shProg, &shProg->VertexProgram->Base, - &numSamplers)) { - return; - } - } - if (shProg->GeometryProgram) { - if (!link_uniform_vars(ctx, shProg, &shProg->GeometryProgram->Base, - &numSamplers)) { - return; - } - } - if (shProg->FragmentProgram) { - if (!link_uniform_vars(ctx, shProg, &shProg->FragmentProgram->Base, - &numSamplers)) { - return; - } - } - - /*_mesa_print_uniforms(shProg->Uniforms);*/ - - if (shProg->VertexProgram) { - if (!_slang_resolve_attributes(shProg, &vertProg->Base, - &shProg->VertexProgram->Base)) { - return; - } - } - - if (shProg->VertexProgram) { - _slang_update_inputs_outputs(&shProg->VertexProgram->Base); - _slang_count_temporaries(&shProg->VertexProgram->Base); - if (!(shProg->VertexProgram->Base.OutputsWritten - & BITFIELD64_BIT(VERT_RESULT_HPOS))) { - /* the vertex program did not compute a vertex position */ - link_error(shProg, - "gl_Position was not written by vertex shader\n"); - return; - } - } - if (shProg->GeometryProgram) { - if (!shProg->VertexProgram) { - link_error(shProg, - "Geometry shader without a vertex shader is illegal!\n"); - return; - } - if (shProg->Geom.VerticesOut == 0) { - link_error(shProg, - "GEOMETRY_VERTICES_OUT is zero\n"); - return; - } - - _slang_count_temporaries(&shProg->GeometryProgram->Base); - _slang_update_inputs_outputs(&shProg->GeometryProgram->Base); - } - if (shProg->FragmentProgram) { - _slang_count_temporaries(&shProg->FragmentProgram->Base); - _slang_update_inputs_outputs(&shProg->FragmentProgram->Base); - } - - /* Check that all the varying vars needed by the fragment shader are - * actually produced by the vertex shader. - */ - if (shProg->FragmentProgram) { - const GLbitfield varyingRead - = shProg->FragmentProgram->Base.InputsRead >> FRAG_ATTRIB_VAR0; - const GLbitfield64 varyingWritten = shProg->VertexProgram ? - shProg->VertexProgram->Base.OutputsWritten >> VERT_RESULT_VAR0 : 0x0; - if ((varyingRead & varyingWritten) != varyingRead) { - link_error(shProg, - "Fragment program using varying vars not written by vertex shader\n"); - return; - } - } - - /* check that gl_FragColor and gl_FragData are not both written to */ - if (shProg->FragmentProgram) { - const GLbitfield64 outputsWritten = - shProg->FragmentProgram->Base.OutputsWritten; - if ((outputsWritten & BITFIELD64_BIT(FRAG_RESULT_COLOR)) && - (outputsWritten >= BITFIELD64_BIT(FRAG_RESULT_DATA0))) { - link_error(shProg, "Fragment program cannot write both gl_FragColor" - " and gl_FragData[].\n"); - return; - } - } - - update_varying_var_list(ctx, shProg); - - /* checks related to transform feedback */ - if (!link_transform_feedback(ctx, shProg)) { - return; - } - - if (fragProg && shProg->FragmentProgram) { - /* Compute initial program's TexturesUsed info */ - _mesa_update_shader_textures_used(&shProg->FragmentProgram->Base); - - /* notify driver that a new fragment program has been compiled/linked */ - vertNotify = ctx->Driver.ProgramStringNotify(ctx, GL_FRAGMENT_PROGRAM_ARB, - &shProg->FragmentProgram->Base); - if (ctx->Shader.Flags & GLSL_DUMP) { - fprintf(stderr, "Mesa pre-link fragment program:\n"); - _mesa_print_program(&fragProg->Base); - _mesa_print_program_parameters(ctx, &fragProg->Base); - - fprintf(stderr, "Mesa post-link fragment program:\n"); - _mesa_print_program(&shProg->FragmentProgram->Base); - _mesa_print_program_parameters(ctx, &shProg->FragmentProgram->Base); - } - } - - if (geomProg && shProg->GeometryProgram) { - /* Compute initial program's TexturesUsed info */ - _mesa_update_shader_textures_used(&shProg->GeometryProgram->Base); - - /* Copy some per-shader-program fields to per-shader object */ - shProg->GeometryProgram->VerticesOut = shProg->Geom.VerticesOut; - shProg->GeometryProgram->InputType = shProg->Geom.InputType; - shProg->GeometryProgram->OutputType = shProg->Geom.OutputType; - - /* notify driver that a new fragment program has been compiled/linked */ - geomNotify = ctx->Driver.ProgramStringNotify(ctx, MESA_GEOMETRY_PROGRAM, - &shProg->GeometryProgram->Base); - if (ctx->Shader.Flags & GLSL_DUMP) { - fprintf(stderr, "Mesa pre-link geometry program:\n"); - _mesa_print_program(&geomProg->Base); - _mesa_print_program_parameters(ctx, &geomProg->Base); - - fprintf(stderr, "Mesa post-link geometry program:\n"); - _mesa_print_program(&shProg->GeometryProgram->Base); - _mesa_print_program_parameters(ctx, &shProg->GeometryProgram->Base); - } - } - - if (vertProg && shProg->VertexProgram) { - /* Compute initial program's TexturesUsed info */ - _mesa_update_shader_textures_used(&shProg->VertexProgram->Base); - - /* notify driver that a new vertex program has been compiled/linked */ - fragNotify = ctx->Driver.ProgramStringNotify(ctx, GL_VERTEX_PROGRAM_ARB, - &shProg->VertexProgram->Base); - if (ctx->Shader.Flags & GLSL_DUMP) { - fprintf(stderr, "Mesa pre-link vertex program:\n"); - _mesa_print_program(&vertProg->Base); - _mesa_print_program_parameters(ctx, &vertProg->Base); - - fprintf(stderr, "Mesa post-link vertex program:\n"); - _mesa_print_program(&shProg->VertexProgram->Base); - _mesa_print_program_parameters(ctx, &shProg->VertexProgram->Base); - } - } - - /* Debug: */ - if (0) { - if (shProg->VertexProgram) - _mesa_postprocess_program(ctx, &shProg->VertexProgram->Base); - if (shProg->FragmentProgram) - _mesa_postprocess_program(ctx, &shProg->FragmentProgram->Base); - } - - if (ctx->Shader.Flags & GLSL_DUMP) { - fprintf(stderr, "Varying vars:\n"); - _mesa_print_parameter_list(shProg->Varying); - if (shProg->InfoLog) { - fprintf(stderr, "Info Log: %s\n", shProg->InfoLog); - } - } - - if (!vertNotify || !fragNotify || !geomNotify) { - /* driver rejected one/both of the vertex/fragment programs */ - if (!shProg->InfoLog) { - link_error(shProg, - "Vertex, geometry and/or fragment program rejected by driver\n"); - } - } - else { - shProg->LinkStatus = (shProg->VertexProgram || shProg->FragmentProgram); - } -} - diff --git a/src/mesa/slang/slang_link.h b/src/mesa/slang/slang_link.h deleted file mode 100644 index 3e9fa2d743..0000000000 --- a/src/mesa/slang/slang_link.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Mesa 3-D graphics library - * Version: 7.2 - * - * Copyright (C) 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. - */ - -#ifndef SLANG_LINK_H -#define SLANG_LINK_H 1 - -#include "main/mtypes.h" - - -extern void -_slang_link(GLcontext *ctx, GLhandleARB h, - struct gl_shader_program *shProg); - - -#endif - diff --git a/src/mesa/slang/slang_log.c b/src/mesa/slang/slang_log.c deleted file mode 100644 index 9ff21417bc..0000000000 --- a/src/mesa/slang/slang_log.c +++ /dev/null @@ -1,133 +0,0 @@ -/* - * Mesa 3-D graphics library - * Version: 7.3 - * - * Copyright (C) 2005-2007 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. - */ - -#include "main/imports.h" -#include "slang_log.h" -#include "slang_utility.h" - - - -static char *out_of_memory = "Error: Out of memory.\n"; - -void -slang_info_log_construct(slang_info_log * log) -{ - log->text = NULL; - log->dont_free_text = GL_FALSE; - log->error_flag = GL_FALSE; -} - -void -slang_info_log_destruct(slang_info_log * log) -{ - if (!log->dont_free_text) - free(log->text); -} - -static int -slang_info_log_message(slang_info_log * log, const char *prefix, - const char *msg) -{ - GLuint size; - - if (log->dont_free_text) - return 0; - size = slang_string_length(msg) + 2; - if (prefix != NULL) - size += slang_string_length(prefix) + 2; - if (log->text != NULL) { - GLuint old_len = slang_string_length(log->text); - log->text = (char *) - _mesa_realloc(log->text, old_len + 1, old_len + size); - } - else { - log->text = (char *) (malloc(size)); - if (log->text != NULL) - log->text[0] = '\0'; - } - if (log->text == NULL) - return 0; - if (prefix != NULL) { - slang_string_concat(log->text, prefix); - slang_string_concat(log->text, ": "); - } - slang_string_concat(log->text, msg); - slang_string_concat(log->text, "\n"); - - return 1; -} - -int -slang_info_log_print(slang_info_log * log, const char *msg, ...) -{ - va_list va; - char buf[1024]; - - va_start(va, msg); - vsprintf(buf, msg, va); - va_end(va); - return slang_info_log_message(log, NULL, buf); -} - -int -slang_info_log_error(slang_info_log * log, const char *msg, ...) -{ - va_list va; - char buf[1024]; - - va_start(va, msg); - vsprintf(buf, msg, va); - va_end(va); - log->error_flag = GL_TRUE; - if (slang_info_log_message(log, "Error", buf)) - return 1; - slang_info_log_memory(log); - return 0; -} - -int -slang_info_log_warning(slang_info_log * log, const char *msg, ...) -{ - va_list va; - char buf[1024]; - - va_start(va, msg); - vsprintf(buf, msg, va); - va_end(va); - if (slang_info_log_message(log, "Warning", buf)) - return 1; - slang_info_log_memory(log); - return 0; -} - -void -slang_info_log_memory(slang_info_log * log) -{ - if (!slang_info_log_message(log, "Error", "Out of memory.")) { - log->dont_free_text = GL_TRUE; - log->error_flag = GL_TRUE; - log->text = out_of_memory; - } -} diff --git a/src/mesa/slang/slang_log.h b/src/mesa/slang/slang_log.h deleted file mode 100644 index 544a26654e..0000000000 --- a/src/mesa/slang/slang_log.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Mesa 3-D graphics library - * Version: 6.5.3 - * - * Copyright (C) 2005-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 SLANG_LOG_H -#define SLANG_LOG_H - - -#include "main/glheader.h" - -typedef struct slang_info_log_ -{ - char *text; - GLboolean dont_free_text; - GLboolean error_flag; -} slang_info_log; - - -extern void -slang_info_log_construct(slang_info_log *); - -extern void -slang_info_log_destruct(slang_info_log *); - -extern int -slang_info_log_print(slang_info_log *, const char *, ...); - -extern int -slang_info_log_error(slang_info_log *, const char *, ...); - -extern int -slang_info_log_warning(slang_info_log *, const char *, ...); - -extern void -slang_info_log_memory(slang_info_log *); - - -#endif /* SLANG_LOG_H */ diff --git a/src/mesa/slang/slang_mem.c b/src/mesa/slang/slang_mem.c deleted file mode 100644 index 5eaa7c4427..0000000000 --- a/src/mesa/slang/slang_mem.c +++ /dev/null @@ -1,243 +0,0 @@ -/* - * Mesa 3-D graphics library - * Version: 6.5.3 - * - * Copyright (C) 2005-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. - */ - -/** - * \file slang_mem.c - * - * Memory manager for GLSL compiler. The general idea is to do all - * allocations out of a large pool then just free the pool when done - * compiling to avoid intricate malloc/free tracking and memory leaks. - * - * \author Brian Paul - */ - -#include "main/context.h" -#include "main/macros.h" -#include "slang_mem.h" - - -#define GRANULARITY 8 -#define ROUND_UP(B) ( ((B) + (GRANULARITY - 1)) & ~(GRANULARITY - 1) ) - - -/** If 1, use conventional malloc/free. Helpful for debugging */ -#define USE_MALLOC_FREE 0 - - -struct slang_mempool_ -{ - GLuint Size, Used, Count, Largest; - char *Data; - struct slang_mempool_ *Next; -}; - - -slang_mempool * -_slang_new_mempool(GLuint initialSize) -{ - slang_mempool *pool = (slang_mempool *) calloc(1, sizeof(slang_mempool)); - if (pool) { - pool->Data = (char *) calloc(1, initialSize); - /*printf("ALLOC MEMPOOL %d at %p\n", initialSize, pool->Data);*/ - if (!pool->Data) { - free(pool); - return NULL; - } - pool->Size = initialSize; - pool->Used = 0; - } - return pool; -} - - -void -_slang_delete_mempool(slang_mempool *pool) -{ - GLuint total = 0; - while (pool) { - slang_mempool *next = pool->Next; - /* - printf("DELETE MEMPOOL %u / %u count=%u largest=%u\n", - pool->Used, pool->Size, pool->Count, pool->Largest); - */ - total += pool->Used; - free(pool->Data); - free(pool); - pool = next; - } - /*printf("TOTAL ALLOCATED: %u\n", total);*/ -} - - -#ifdef DEBUG -static void -check_zero(const char *addr, GLuint n) -{ - GLuint i; - for (i = 0; i < n; i++) { - assert(addr[i]==0); - } -} -#endif - - -#ifdef DEBUG -static GLboolean -is_valid_address(const slang_mempool *pool, void *addr) -{ - while (pool) { - if ((char *) addr >= pool->Data && - (char *) addr < pool->Data + pool->Used) - return GL_TRUE; - - pool = pool->Next; - } - return GL_FALSE; -} -#endif - - -/** - * Alloc 'bytes' from shader mempool. - */ -void * -_slang_alloc(GLuint bytes) -{ -#if USE_MALLOC_FREE - return calloc(1, bytes); -#else - slang_mempool *pool; - GET_CURRENT_CONTEXT(ctx); - pool = (slang_mempool *) ctx->Shader.MemPool; - - if (bytes == 0) - bytes = 1; - - while (pool) { - if (pool->Used + bytes <= pool->Size) { - /* found room */ - void *addr = (void *) (pool->Data + pool->Used); -#ifdef DEBUG - check_zero((char*) addr, bytes); -#endif - pool->Used += ROUND_UP(bytes); - pool->Largest = MAX2(pool->Largest, bytes); - pool->Count++; - /*printf("alloc %u Used %u\n", bytes, pool->Used);*/ - return addr; - } - else if (pool->Next) { - /* try next block */ - pool = pool->Next; - } - else { - /* alloc new pool */ - const GLuint sz = MAX2(bytes, pool->Size); - pool->Next = _slang_new_mempool(sz); - if (!pool->Next) { - /* we're _really_ out of memory */ - return NULL; - } - else { - pool = pool->Next; - pool->Largest = bytes; - pool->Count++; - pool->Used = ROUND_UP(bytes); -#ifdef DEBUG - check_zero((char*) pool->Data, bytes); -#endif - return (void *) pool->Data; - } - } - } - return NULL; -#endif -} - - -void * -_slang_realloc(void *oldBuffer, GLuint oldSize, GLuint newSize) -{ -#if USE_MALLOC_FREE - return _mesa_realloc(oldBuffer, oldSize, newSize); -#else - GET_CURRENT_CONTEXT(ctx); - slang_mempool *pool = (slang_mempool *) ctx->Shader.MemPool; - (void) pool; - - if (newSize < oldSize) { - return oldBuffer; - } - else { - const GLuint copySize = (oldSize < newSize) ? oldSize : newSize; - void *newBuffer = _slang_alloc(newSize); - - if (oldBuffer) - ASSERT(is_valid_address(pool, oldBuffer)); - - if (newBuffer && oldBuffer && copySize > 0) - memcpy(newBuffer, oldBuffer, copySize); - - return newBuffer; - } -#endif -} - - -/** - * Clone string, storing in current mempool. - */ -char * -_slang_strdup(const char *s) -{ - if (s) { - size_t l = strlen(s); - char *s2 = (char *) _slang_alloc(l + 1); - if (s2) - strcpy(s2, s); - return s2; - } - else { - return NULL; - } -} - - -/** - * Don't actually free memory, but mark it (for debugging). - */ -void -_slang_free(void *addr) -{ -#if USE_MALLOC_FREE - free(addr); -#else - if (addr) { - GET_CURRENT_CONTEXT(ctx); - slang_mempool *pool = (slang_mempool *) ctx->Shader.MemPool; - (void) pool; - ASSERT(is_valid_address(pool, addr)); - } -#endif -} diff --git a/src/mesa/slang/slang_mem.h b/src/mesa/slang/slang_mem.h deleted file mode 100644 index 0f06df3c0c..0000000000 --- a/src/mesa/slang/slang_mem.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Mesa 3-D graphics library - * Version: 6.5.3 - * - * Copyright (C) 2005-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 SLANG_MEM_H -#define SLANG_MEM_H - - -#include "main/glheader.h" - - -typedef struct slang_mempool_ slang_mempool; - - -extern slang_mempool * -_slang_new_mempool(GLuint initialSize); - -extern void -_slang_delete_mempool(slang_mempool *pool); - -extern void * -_slang_alloc(GLuint bytes); - -extern void * -_slang_realloc(void *oldBuffer, GLuint oldSize, GLuint newSize); - -extern char * -_slang_strdup(const char *s); - -extern void -_slang_free(void *addr); - - -#endif diff --git a/src/mesa/slang/slang_print.c b/src/mesa/slang/slang_print.c deleted file mode 100644 index 6b34f395fd..0000000000 --- a/src/mesa/slang/slang_print.c +++ /dev/null @@ -1,883 +0,0 @@ - -/** - * Dump/print a slang_operation tree - */ - - -#include "main/imports.h" -#include "slang_compile.h" -#include "slang_print.h" - - -static void -spaces(int n) -{ - while (n--) - printf(" "); -} - - -static void -print_type(const slang_fully_specified_type *t) -{ - switch (t->qualifier) { - case SLANG_QUAL_NONE: - /*printf("");*/ - break; - case SLANG_QUAL_CONST: - printf("const "); - break; - case SLANG_QUAL_ATTRIBUTE: - printf("attrib "); - break; - case SLANG_QUAL_VARYING: - printf("varying "); - break; - case SLANG_QUAL_UNIFORM: - printf("uniform "); - break; - case SLANG_QUAL_OUT: - printf("output "); - break; - case SLANG_QUAL_INOUT: - printf("inout "); - break; - case SLANG_QUAL_FIXEDOUTPUT: - printf("fixedoutput"); - break; - case SLANG_QUAL_FIXEDINPUT: - printf("fixedinput"); - break; - default: - printf("unknown qualifer!"); - } - - switch (t->specifier.type) { - case SLANG_SPEC_VOID: - printf("void"); - break; - case SLANG_SPEC_BOOL: - printf("bool"); - break; - case SLANG_SPEC_BVEC2: - printf("bvec2"); - break; - case SLANG_SPEC_BVEC3: - printf("bvec3"); - break; - case SLANG_SPEC_BVEC4: - printf("bvec4"); - break; - case SLANG_SPEC_INT: - printf("int"); - break; - case SLANG_SPEC_IVEC2: - printf("ivec2"); - break; - case SLANG_SPEC_IVEC3: - printf("ivec3"); - break; - case SLANG_SPEC_IVEC4: - printf("ivec4"); - break; - case SLANG_SPEC_FLOAT: - printf("float"); - break; - case SLANG_SPEC_VEC2: - printf("vec2"); - break; - case SLANG_SPEC_VEC3: - printf("vec3"); - break; - case SLANG_SPEC_VEC4: - printf("vec4"); - break; - case SLANG_SPEC_MAT2: - printf("mat2"); - break; - case SLANG_SPEC_MAT3: - printf("mat3"); - break; - case SLANG_SPEC_MAT4: - printf("mat4"); - break; - case SLANG_SPEC_MAT23: - printf("mat2x3"); - break; - case SLANG_SPEC_MAT32: - printf("mat3x2"); - break; - case SLANG_SPEC_MAT24: - printf("mat2x4"); - break; - case SLANG_SPEC_MAT42: - printf("mat4x2"); - break; - case SLANG_SPEC_MAT34: - printf("mat3x4"); - break; - case SLANG_SPEC_MAT43: - printf("mat4x3"); - break; - case SLANG_SPEC_SAMPLER_1D: - printf("sampler1D"); - break; - case SLANG_SPEC_SAMPLER_2D: - printf("sampler2D"); - break; - case SLANG_SPEC_SAMPLER_3D: - printf("sampler3D"); - break; - case SLANG_SPEC_SAMPLER_CUBE: - printf("samplerCube"); - break; - case SLANG_SPEC_SAMPLER_1D_SHADOW: - printf("sampler1DShadow"); - break; - case SLANG_SPEC_SAMPLER_2D_SHADOW: - printf("sampler2DShadow"); - break; - case SLANG_SPEC_STRUCT: - printf("struct"); - break; - case SLANG_SPEC_ARRAY: - printf("array"); - break; - default: - printf("unknown type"); - } - /*printf("\n");*/ -} - - -static void -print_variable(const slang_variable *v, int indent) -{ - spaces(indent); - printf("VAR "); - print_type(&v->type); - printf(" %s (at %p)", (char *) v->a_name, (void *) v); - if (v->initializer) { - printf(" :=\n"); - slang_print_tree(v->initializer, indent + 3); - } - else { - printf(";\n"); - } -} - - -static void -print_binary(const slang_operation *op, const char *oper, int indent) -{ - assert(op->num_children == 2); -#if 0 - printf("binary at %p locals=%p outer=%p\n", - (void *) op, - (void *) op->locals, - (void *) op->locals->outer_scope); -#endif - slang_print_tree(&op->children[0], indent + 3); - spaces(indent); - printf("%s at %p locals=%p outer=%p\n", - oper, (void *) op, (void *) op->locals, - (void *) op->locals->outer_scope); - slang_print_tree(&op->children[1], indent + 3); -} - - -static void -print_generic2(const slang_operation *op, const char *oper, - const char *s, int indent) -{ - GLuint i; - if (oper) { - spaces(indent); - printf("%s %s at %p locals=%p outer=%p\n", - oper, s, (void *) op, (void *) op->locals, - (void *) op->locals->outer_scope); - } - for (i = 0; i < op->num_children; i++) { - spaces(indent); - printf("//child %u of %u:\n", i, op->num_children); - slang_print_tree(&op->children[i], indent); - } -} - -static void -print_generic(const slang_operation *op, const char *oper, int indent) -{ - print_generic2(op, oper, "", indent); -} - - -static const slang_variable_scope * -find_scope(const slang_variable_scope *s, slang_atom name) -{ - GLuint i; - for (i = 0; i < s->num_variables; i++) { - if (s->variables[i]->a_name == name) - return s; - } - if (s->outer_scope) - return find_scope(s->outer_scope, name); - else - return NULL; -} - -static const slang_variable * -find_var(const slang_variable_scope *s, slang_atom name) -{ - GLuint i; - for (i = 0; i < s->num_variables; i++) { - if (s->variables[i]->a_name == name) - return s->variables[i]; - } - if (s->outer_scope) - return find_var(s->outer_scope, name); - else - return NULL; -} - - -void -slang_print_tree(const slang_operation *op, int indent) -{ - GLuint i; - - switch (op->type) { - - case SLANG_OPER_NONE: - spaces(indent); - printf("SLANG_OPER_NONE\n"); - break; - - case SLANG_OPER_BLOCK_NO_NEW_SCOPE: - spaces(indent); - printf("{ locals=%p outer=%p\n", (void*)op->locals, (void*)op->locals->outer_scope); - print_generic(op, NULL, indent+3); - spaces(indent); - printf("}\n"); - break; - - case SLANG_OPER_BLOCK_NEW_SCOPE: - case SLANG_OPER_NON_INLINED_CALL: - spaces(indent); - printf("{{ // new scope locals=%p outer=%p: ", - (void *) op->locals, - (void *) op->locals->outer_scope); - for (i = 0; i < op->locals->num_variables; i++) { - printf("%s ", (char *) op->locals->variables[i]->a_name); - } - printf("\n"); - print_generic(op, NULL, indent+3); - spaces(indent); - printf("}}\n"); - break; - - case SLANG_OPER_VARIABLE_DECL: - assert(op->num_children == 0 || op->num_children == 1); - { - slang_variable *v; - v = _slang_variable_locate(op->locals, op->a_id, GL_TRUE); - if (v) { - const slang_variable_scope *scope; - spaces(indent); - printf("DECL (locals=%p outer=%p) ", (void*)op->locals, (void*) op->locals->outer_scope); - print_type(&v->type); - printf(" %s (%p)", (char *) op->a_id, - (void *) find_var(op->locals, op->a_id)); - - scope = find_scope(op->locals, op->a_id); - printf(" (in scope %p) ", (void *) scope); - assert(scope); - if (op->num_children == 1) { - printf(" :=\n"); - slang_print_tree(&op->children[0], indent + 3); - } - else if (v->initializer) { - printf(" := INITIALIZER\n"); - slang_print_tree(v->initializer, indent + 3); - } - else { - printf(";\n"); - } - /* - spaces(indent); - printf("TYPE: "); - print_type(&v->type); - spaces(indent); - printf("ADDR: %d size: %d\n", v->address, v->size); - */ - } - else { - spaces(indent); - printf("DECL %s (anonymous variable!!!!)\n", (char *) op->a_id); - } - } - break; - - case SLANG_OPER_ASM: - spaces(indent); - printf("ASM: %s at %p locals=%p outer=%p\n", - (char *) op->a_id, - (void *) op, - (void *) op->locals, - (void *) op->locals->outer_scope); - print_generic(op, "ASM", indent+3); - break; - - case SLANG_OPER_BREAK: - spaces(indent); - printf("BREAK\n"); - break; - - case SLANG_OPER_CONTINUE: - spaces(indent); - printf("CONTINUE\n"); - break; - - case SLANG_OPER_DISCARD: - spaces(indent); - printf("DISCARD\n"); - break; - - case SLANG_OPER_RETURN: - spaces(indent); - printf("RETURN\n"); - if (op->num_children > 0) - slang_print_tree(&op->children[0], indent + 3); - break; - - case SLANG_OPER_RETURN_INLINED: - spaces(indent); - printf("RETURN_INLINED\n"); - if (op->num_children > 0) - slang_print_tree(&op->children[0], indent + 3); - break; - - case SLANG_OPER_LABEL: - spaces(indent); - printf("LABEL %s\n", (char *) op->a_id); - break; - - case SLANG_OPER_EXPRESSION: - spaces(indent); - printf("EXPR: locals=%p outer=%p\n", - (void *) op->locals, - (void *) op->locals->outer_scope); - /*print_generic(op, "SLANG_OPER_EXPRESSION", indent);*/ - slang_print_tree(&op->children[0], indent + 3); - break; - - case SLANG_OPER_IF: - spaces(indent); - printf("IF\n"); - slang_print_tree(&op->children[0], indent + 3); - spaces(indent); - printf("THEN\n"); - slang_print_tree(&op->children[1], indent + 3); - spaces(indent); - printf("ELSE\n"); - slang_print_tree(&op->children[2], indent + 3); - spaces(indent); - printf("ENDIF\n"); - break; - - case SLANG_OPER_WHILE: - assert(op->num_children == 2); - spaces(indent); - printf("WHILE LOOP: locals = %p\n", (void *) op->locals); - indent += 3; - spaces(indent); - printf("WHILE cond:\n"); - slang_print_tree(&op->children[0], indent + 3); - spaces(indent); - printf("WHILE body:\n"); - slang_print_tree(&op->children[1], indent + 3); - indent -= 3; - spaces(indent); - printf("END WHILE LOOP\n"); - break; - - case SLANG_OPER_DO: - spaces(indent); - printf("DO LOOP: locals = %p\n", (void *) op->locals); - indent += 3; - spaces(indent); - printf("DO body:\n"); - slang_print_tree(&op->children[0], indent + 3); - spaces(indent); - printf("DO cond:\n"); - slang_print_tree(&op->children[1], indent + 3); - indent -= 3; - spaces(indent); - printf("END DO LOOP\n"); - break; - - case SLANG_OPER_FOR: - spaces(indent); - printf("FOR LOOP: locals = %p\n", (void *) op->locals); - indent += 3; - spaces(indent); - printf("FOR init:\n"); - slang_print_tree(&op->children[0], indent + 3); - spaces(indent); - printf("FOR condition:\n"); - slang_print_tree(&op->children[1], indent + 3); - spaces(indent); - printf("FOR step:\n"); - slang_print_tree(&op->children[2], indent + 3); - spaces(indent); - printf("FOR body:\n"); - slang_print_tree(&op->children[3], indent + 3); - indent -= 3; - spaces(indent); - printf("ENDFOR\n"); - /* - print_generic(op, "FOR", indent + 3); - */ - break; - - case SLANG_OPER_VOID: - spaces(indent); - printf("(oper-void)\n"); - break; - - case SLANG_OPER_LITERAL_BOOL: - spaces(indent); - printf("LITERAL ("); - for (i = 0; i < op->literal_size; i++) - printf("%s ", op->literal[0] ? "TRUE" : "FALSE"); - printf(")\n"); - - break; - - case SLANG_OPER_LITERAL_INT: - spaces(indent); - printf("LITERAL ("); - for (i = 0; i < op->literal_size; i++) - printf("%d ", (int) op->literal[i]); - printf(")\n"); - break; - - case SLANG_OPER_LITERAL_FLOAT: - spaces(indent); - printf("LITERAL ("); - for (i = 0; i < op->literal_size; i++) - printf("%f ", op->literal[i]); - printf(")\n"); - break; - - case SLANG_OPER_IDENTIFIER: - { - const slang_variable_scope *scope; - spaces(indent); - if (op->var && op->var->a_name) { - scope = find_scope(op->locals, op->var->a_name); - printf("VAR %s (in scope %p)\n", (char *) op->var->a_name, - (void *) scope); - assert(scope); - } - else { - scope = find_scope(op->locals, op->a_id); - printf("VAR' %s (in scope %p) locals=%p outer=%p\n", - (char *) op->a_id, - (void *) scope, - (void *) op->locals, - (void *) op->locals->outer_scope); - /*assert(scope);*/ - } - } - break; - - case SLANG_OPER_SEQUENCE: - print_generic(op, "COMMA-SEQ", indent+3); - break; - - case SLANG_OPER_ASSIGN: - spaces(indent); - printf("ASSIGNMENT locals=%p outer=%p\n", - (void *) op->locals, - (void *) op->locals->outer_scope); - print_binary(op, ":=", indent); - break; - - case SLANG_OPER_ADDASSIGN: - spaces(indent); - printf("ASSIGN\n"); - print_binary(op, "+=", indent); - break; - - case SLANG_OPER_SUBASSIGN: - spaces(indent); - printf("ASSIGN\n"); - print_binary(op, "-=", indent); - break; - - case SLANG_OPER_MULASSIGN: - spaces(indent); - printf("ASSIGN\n"); - print_binary(op, "*=", indent); - break; - - case SLANG_OPER_DIVASSIGN: - spaces(indent); - printf("ASSIGN\n"); - print_binary(op, "/=", indent); - break; - - /*SLANG_OPER_MODASSIGN,*/ - /*SLANG_OPER_LSHASSIGN,*/ - /*SLANG_OPER_RSHASSIGN,*/ - /*SLANG_OPER_ORASSIGN,*/ - /*SLANG_OPER_XORASSIGN,*/ - /*SLANG_OPER_ANDASSIGN,*/ - case SLANG_OPER_SELECT: - spaces(indent); - printf("SLANG_OPER_SELECT n=%d\n", op->num_children); - assert(op->num_children == 3); - slang_print_tree(&op->children[0], indent+3); - spaces(indent); - printf("?\n"); - slang_print_tree(&op->children[1], indent+3); - spaces(indent); - printf(":\n"); - slang_print_tree(&op->children[2], indent+3); - break; - - case SLANG_OPER_LOGICALOR: - print_binary(op, "||", indent); - break; - - case SLANG_OPER_LOGICALXOR: - print_binary(op, "^^", indent); - break; - - case SLANG_OPER_LOGICALAND: - print_binary(op, "&&", indent); - break; - - /*SLANG_OPER_BITOR*/ - /*SLANG_OPER_BITXOR*/ - /*SLANG_OPER_BITAND*/ - case SLANG_OPER_EQUAL: - print_binary(op, "==", indent); - break; - - case SLANG_OPER_NOTEQUAL: - print_binary(op, "!=", indent); - break; - - case SLANG_OPER_LESS: - print_binary(op, "<", indent); - break; - - case SLANG_OPER_GREATER: - print_binary(op, ">", indent); - break; - - case SLANG_OPER_LESSEQUAL: - print_binary(op, "<=", indent); - break; - - case SLANG_OPER_GREATEREQUAL: - print_binary(op, ">=", indent); - break; - - /*SLANG_OPER_LSHIFT*/ - /*SLANG_OPER_RSHIFT*/ - case SLANG_OPER_ADD: - print_binary(op, "+", indent); - break; - - case SLANG_OPER_SUBTRACT: - print_binary(op, "-", indent); - break; - - case SLANG_OPER_MULTIPLY: - print_binary(op, "*", indent); - break; - - case SLANG_OPER_DIVIDE: - print_binary(op, "/", indent); - break; - - /*SLANG_OPER_MODULUS*/ - case SLANG_OPER_PREINCREMENT: - spaces(indent); - printf("PRE++\n"); - slang_print_tree(&op->children[0], indent+3); - break; - - case SLANG_OPER_PREDECREMENT: - spaces(indent); - printf("PRE--\n"); - slang_print_tree(&op->children[0], indent+3); - break; - - case SLANG_OPER_PLUS: - spaces(indent); - printf("SLANG_OPER_PLUS\n"); - break; - - case SLANG_OPER_MINUS: - spaces(indent); - printf("SLANG_OPER_MINUS\n"); - break; - - /*SLANG_OPER_COMPLEMENT*/ - case SLANG_OPER_NOT: - spaces(indent); - printf("NOT\n"); - slang_print_tree(&op->children[0], indent+3); - break; - - case SLANG_OPER_SUBSCRIPT: - spaces(indent); - printf("SLANG_OPER_SUBSCRIPT locals=%p outer=%p\n", - (void *) op->locals, - (void *) op->locals->outer_scope); - print_generic(op, NULL, indent+3); - break; - - case SLANG_OPER_CALL: -#if 0 - slang_function *fun - = _slang_function_locate(A->space.funcs, oper->a_id, - oper->children, - oper->num_children, &A->space, A->atoms); -#endif - spaces(indent); - printf("CALL %s(\n", (char *) op->a_id); - for (i = 0; i < op->num_children; i++) { - slang_print_tree(&op->children[i], indent+3); - if (i + 1 < op->num_children) { - spaces(indent + 3); - printf(",\n"); - } - } - spaces(indent); - printf(")\n"); - break; - - case SLANG_OPER_METHOD: - spaces(indent); - printf("METHOD CALL %s.%s\n", (char *) op->a_obj, (char *) op->a_id); - break; - - case SLANG_OPER_FIELD: - spaces(indent); - printf("FIELD %s of\n", (char*) op->a_id); - slang_print_tree(&op->children[0], indent+3); - break; - - case SLANG_OPER_POSTINCREMENT: - spaces(indent); - printf("POST++\n"); - slang_print_tree(&op->children[0], indent+3); - break; - - case SLANG_OPER_POSTDECREMENT: - spaces(indent); - printf("POST--\n"); - slang_print_tree(&op->children[0], indent+3); - break; - - default: - printf("unknown op->type %d\n", (int) op->type); - } - -} - - - -void -slang_print_function(const slang_function *f, GLboolean body) -{ - GLuint i; - -#if 0 - if (strcmp((char *) f->header.a_name, "main") != 0) - return; -#endif - - printf("FUNCTION %s ( scope=%p\n", - (char *) f->header.a_name, (void *) f->parameters); - - for (i = 0; i < f->param_count; i++) { - print_variable(f->parameters->variables[i], 3); - } - - printf(") param scope = %p\n", (void *) f->parameters); - - if (body && f->body) - slang_print_tree(f->body, 0); -} - - - - - -const char * -slang_type_qual_string(slang_type_qualifier q) -{ - switch (q) { - case SLANG_QUAL_NONE: - return "none"; - case SLANG_QUAL_CONST: - return "const"; - case SLANG_QUAL_ATTRIBUTE: - return "attribute"; - case SLANG_QUAL_VARYING: - return "varying"; - case SLANG_QUAL_UNIFORM: - return "uniform"; - case SLANG_QUAL_OUT: - return "out"; - case SLANG_QUAL_INOUT: - return "inout"; - case SLANG_QUAL_FIXEDOUTPUT: - return "fixedoutput"; - case SLANG_QUAL_FIXEDINPUT: - return "fixedinputk"; - default: - return "qual?"; - } -} - - -static const char * -slang_type_string(slang_type_specifier_type t) -{ - switch (t) { - case SLANG_SPEC_VOID: - return "void"; - case SLANG_SPEC_BOOL: - return "bool"; - case SLANG_SPEC_BVEC2: - return "bvec2"; - case SLANG_SPEC_BVEC3: - return "bvec3"; - case SLANG_SPEC_BVEC4: - return "bvec4"; - case SLANG_SPEC_INT: - return "int"; - case SLANG_SPEC_IVEC2: - return "ivec2"; - case SLANG_SPEC_IVEC3: - return "ivec3"; - case SLANG_SPEC_IVEC4: - return "ivec4"; - case SLANG_SPEC_FLOAT: - return "float"; - case SLANG_SPEC_VEC2: - return "vec2"; - case SLANG_SPEC_VEC3: - return "vec3"; - case SLANG_SPEC_VEC4: - return "vec4"; - case SLANG_SPEC_MAT2: - return "mat2"; - case SLANG_SPEC_MAT3: - return "mat3"; - case SLANG_SPEC_MAT4: - return "mat4"; - case SLANG_SPEC_SAMPLER_1D: - return "sampler1D"; - case SLANG_SPEC_SAMPLER_2D: - return "sampler2D"; - case SLANG_SPEC_SAMPLER_3D: - return "sampler3D"; - case SLANG_SPEC_SAMPLER_CUBE: - return "samplerCube"; - case SLANG_SPEC_SAMPLER_1D_SHADOW: - return "sampler1DShadow"; - case SLANG_SPEC_SAMPLER_2D_SHADOW: - return "sampler2DShadow"; - case SLANG_SPEC_SAMPLER_RECT: - return "sampler2DRect"; - case SLANG_SPEC_SAMPLER_RECT_SHADOW: - return "sampler2DRectShadow"; - case SLANG_SPEC_STRUCT: - return "struct"; - case SLANG_SPEC_ARRAY: - return "array"; - default: - return "type?"; - } -} - - -static const char * -slang_fq_type_string(const slang_fully_specified_type *t) -{ - static char str[1000]; - _mesa_snprintf(str, sizeof(str), "%s %s", slang_type_qual_string(t->qualifier), - slang_type_string(t->specifier.type)); - return str; -} - - -void -slang_print_type(const slang_fully_specified_type *t) -{ - printf("%s %s", slang_type_qual_string(t->qualifier), - slang_type_string(t->specifier.type)); -} - - -#if 0 -static char * -slang_var_string(const slang_variable *v) -{ - static char str[1000]; - _mesa_snprintf(str, sizeof(str), "%s : %s", - (char *) v->a_name, - slang_fq_type_string(&v->type)); - return str; -} -#endif - - -void -slang_print_variable(const slang_variable *v) -{ - printf("Name: %s\n", (char *) v->a_name); - printf("Type: %s\n", slang_fq_type_string(&v->type)); -} - - -void -_slang_print_var_scope(const slang_variable_scope *vars, int indent) -{ - GLuint i; - - spaces(indent); - printf("Var scope %p %d vars:\n", (void *) vars, vars->num_variables); - for (i = 0; i < vars->num_variables; i++) { - spaces(indent + 3); - printf("%s (at %p)\n", (char *) vars->variables[i]->a_name, (void*) (vars->variables + i)); - } - spaces(indent + 3); - printf("outer_scope = %p\n", (void*) vars->outer_scope); - - if (vars->outer_scope) { - /*spaces(indent + 3);*/ - _slang_print_var_scope(vars->outer_scope, indent + 3); - } -} - - - -int -slang_checksum_tree(const slang_operation *op) -{ - int s = op->num_children; - GLuint i; - - for (i = 0; i < op->num_children; i++) { - s += slang_checksum_tree(&op->children[i]); - } - return s; -} diff --git a/src/mesa/slang/slang_print.h b/src/mesa/slang/slang_print.h deleted file mode 100644 index 99da304143..0000000000 --- a/src/mesa/slang/slang_print.h +++ /dev/null @@ -1,35 +0,0 @@ - - -#ifndef SLANG_PRINT -#define SLANG_PRINT - -#include "main/glheader.h" -#include "slang_compile_function.h" -#include "slang_compile_operation.h" -#include "slang_compile_variable.h" -#include "slang_typeinfo.h" - -extern void -slang_print_function(const slang_function *f, GLboolean body); - -extern void -slang_print_tree(const slang_operation *op, int indent); - -extern const char * -slang_type_qual_string(slang_type_qualifier q); - -extern void -slang_print_type(const slang_fully_specified_type *t); - -extern void -slang_print_variable(const slang_variable *v); - -extern void -_slang_print_var_scope(const slang_variable_scope *s, int indent); - - -extern int -slang_checksum_tree(const slang_operation *op); - -#endif /* SLANG_PRINT */ - diff --git a/src/mesa/slang/slang_simplify.c b/src/mesa/slang/slang_simplify.c deleted file mode 100644 index 13b9ca3c87..0000000000 --- a/src/mesa/slang/slang_simplify.c +++ /dev/null @@ -1,527 +0,0 @@ -/* - * Mesa 3-D graphics library - * Version: 7.1 - * - * Copyright (C) 2005-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. - */ - -/** - * Functions for constant folding, built-in constant lookup, and function - * call casting. - */ - - -#include "main/imports.h" -#include "main/macros.h" -#include "main/get.h" -#include "slang_compile.h" -#include "slang_codegen.h" -#include "slang_simplify.h" -#include "slang_print.h" - - -#ifndef GL_MAX_FRAGMENT_UNIFORM_VECTORS -#define GL_MAX_FRAGMENT_UNIFORM_VECTORS 0x8DFD -#endif -#ifndef GL_MAX_VERTEX_UNIFORM_VECTORS -#define GL_MAX_VERTEX_UNIFORM_VECTORS 0x8DFB -#endif -#ifndef GL_MAX_VARYING_VECTORS -#define GL_MAX_VARYING_VECTORS 0x8DFC -#endif - - -/** - * Lookup the value of named constant, such as gl_MaxLights. - * \return value of constant, or -1 if unknown - */ -GLint -_slang_lookup_constant(const char *name) -{ - struct constant_info { - const char *Name; - const GLenum Token; - }; - static const struct constant_info info[] = { - { "gl_MaxClipPlanes", GL_MAX_CLIP_PLANES }, - { "gl_MaxCombinedTextureImageUnits", GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS }, - { "gl_MaxDrawBuffers", GL_MAX_DRAW_BUFFERS }, - { "gl_MaxFragmentUniformComponents", GL_MAX_FRAGMENT_UNIFORM_COMPONENTS }, - { "gl_MaxLights", GL_MAX_LIGHTS }, - { "gl_MaxTextureUnits", GL_MAX_TEXTURE_UNITS }, - { "gl_MaxTextureCoords", GL_MAX_TEXTURE_COORDS }, - { "gl_MaxVertexAttribs", GL_MAX_VERTEX_ATTRIBS }, - { "gl_MaxVertexUniformComponents", GL_MAX_VERTEX_UNIFORM_COMPONENTS }, - { "gl_MaxVaryingFloats", GL_MAX_VARYING_FLOATS }, - { "gl_MaxVertexTextureImageUnits", GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS }, - { "gl_MaxTextureImageUnits", GL_MAX_TEXTURE_IMAGE_UNITS }, -#if FEATURE_es2_glsl - { "gl_MaxVertexUniformVectors", GL_MAX_VERTEX_UNIFORM_VECTORS }, - { "gl_MaxVaryingVectors", GL_MAX_VARYING_VECTORS }, - { "gl_MaxFragmentUniformVectors", GL_MAX_FRAGMENT_UNIFORM_VECTORS }, -#endif - { NULL, 0 } - }; - GLuint i; - - for (i = 0; info[i].Name; i++) { - if (strcmp(info[i].Name, name) == 0) { - /* found */ - GLint values[16]; - values[0] = -1; - _mesa_GetIntegerv(info[i].Token, values); - ASSERT(values[0] >= 0); /* sanity check that glGetFloatv worked */ - return values[0]; - } - } - return -1; -} - - -static slang_operation_type -literal_type(slang_operation_type t1, slang_operation_type t2) -{ - if (t1 == SLANG_OPER_LITERAL_FLOAT || t2 == SLANG_OPER_LITERAL_FLOAT) - return SLANG_OPER_LITERAL_FLOAT; - else - return SLANG_OPER_LITERAL_INT; -} - - -/** - * Recursively traverse an AST tree, applying simplifications wherever - * possible. - * At the least, we do constant folding. We need to do that much so that - * compile-time expressions can be evaluated for things like array - * declarations. I.e.: float foo[3 + 5]; - */ -void -_slang_simplify(slang_operation *oper, - const slang_name_space * space, - slang_atom_pool * atoms) -{ - GLboolean isFloat[4]; - GLboolean isBool[4]; - GLuint i, n; - - if (oper->type == SLANG_OPER_IDENTIFIER) { - /* see if it's a named constant */ - GLint value = _slang_lookup_constant((char *) oper->a_id); - /*printf("value[%s] = %d\n", (char*) oper->a_id, value);*/ - if (value >= 0) { - oper->literal[0] = - oper->literal[1] = - oper->literal[2] = - oper->literal[3] = (GLfloat) value; - oper->type = SLANG_OPER_LITERAL_INT; - return; - } - /* look for user-defined constant */ - { - slang_variable *var; - var = _slang_variable_locate(oper->locals, oper->a_id, GL_TRUE); - if (var) { - if (var->type.qualifier == SLANG_QUAL_CONST && - var->initializer && - (var->initializer->type == SLANG_OPER_LITERAL_INT || - var->initializer->type == SLANG_OPER_LITERAL_FLOAT)) { - oper->literal[0] = var->initializer->literal[0]; - oper->literal[1] = var->initializer->literal[1]; - oper->literal[2] = var->initializer->literal[2]; - oper->literal[3] = var->initializer->literal[3]; - oper->literal_size = var->initializer->literal_size; - oper->type = var->initializer->type; - /* - printf("value[%s] = %f\n", - (char*) oper->a_id, oper->literal[0]); - */ - return; - } - } - } - } - - /* first, simplify children */ - for (i = 0; i < oper->num_children; i++) { - _slang_simplify(&oper->children[i], space, atoms); - } - - /* examine children */ - n = MIN2(oper->num_children, 4); - for (i = 0; i < n; i++) { - isFloat[i] = (oper->children[i].type == SLANG_OPER_LITERAL_FLOAT || - oper->children[i].type == SLANG_OPER_LITERAL_INT); - isBool[i] = (oper->children[i].type == SLANG_OPER_LITERAL_BOOL); - } - - if (oper->num_children == 2 && isFloat[0] && isFloat[1]) { - /* probably simple arithmetic */ - switch (oper->type) { - case SLANG_OPER_ADD: - for (i = 0; i < 4; i++) { - oper->literal[i] - = oper->children[0].literal[i] + oper->children[1].literal[i]; - } - oper->literal_size = oper->children[0].literal_size; - oper->type = literal_type(oper->children[0].type, - oper->children[1].type); - slang_operation_destruct(oper); /* frees unused children */ - return; - case SLANG_OPER_SUBTRACT: - for (i = 0; i < 4; i++) { - oper->literal[i] - = oper->children[0].literal[i] - oper->children[1].literal[i]; - } - oper->literal_size = oper->children[0].literal_size; - oper->type = literal_type(oper->children[0].type, - oper->children[1].type); - slang_operation_destruct(oper); - return; - case SLANG_OPER_MULTIPLY: - for (i = 0; i < 4; i++) { - oper->literal[i] - = oper->children[0].literal[i] * oper->children[1].literal[i]; - } - oper->literal_size = oper->children[0].literal_size; - oper->type = literal_type(oper->children[0].type, - oper->children[1].type); - slang_operation_destruct(oper); - return; - case SLANG_OPER_DIVIDE: - for (i = 0; i < 4; i++) { - oper->literal[i] - = oper->children[0].literal[i] / oper->children[1].literal[i]; - } - oper->literal_size = oper->children[0].literal_size; - oper->type = literal_type(oper->children[0].type, - oper->children[1].type); - slang_operation_destruct(oper); - return; - default: - ; /* nothing */ - } - } - - if (oper->num_children == 1 && isFloat[0]) { - switch (oper->type) { - case SLANG_OPER_MINUS: - for (i = 0; i < 4; i++) { - oper->literal[i] = -oper->children[0].literal[i]; - } - oper->literal_size = oper->children[0].literal_size; - slang_operation_destruct(oper); - oper->type = SLANG_OPER_LITERAL_FLOAT; - return; - case SLANG_OPER_PLUS: - COPY_4V(oper->literal, oper->children[0].literal); - oper->literal_size = oper->children[0].literal_size; - slang_operation_destruct(oper); - oper->type = SLANG_OPER_LITERAL_FLOAT; - return; - default: - ; /* nothing */ - } - } - - if (oper->num_children == 2 && isBool[0] && isBool[1]) { - /* simple boolean expression */ - switch (oper->type) { - case SLANG_OPER_LOGICALAND: - for (i = 0; i < 4; i++) { - const GLint a = oper->children[0].literal[i] ? 1 : 0; - const GLint b = oper->children[1].literal[i] ? 1 : 0; - oper->literal[i] = (GLfloat) (a && b); - } - oper->literal_size = oper->children[0].literal_size; - slang_operation_destruct(oper); - oper->type = SLANG_OPER_LITERAL_BOOL; - return; - case SLANG_OPER_LOGICALOR: - for (i = 0; i < 4; i++) { - const GLint a = oper->children[0].literal[i] ? 1 : 0; - const GLint b = oper->children[1].literal[i] ? 1 : 0; - oper->literal[i] = (GLfloat) (a || b); - } - oper->literal_size = oper->children[0].literal_size; - slang_operation_destruct(oper); - oper->type = SLANG_OPER_LITERAL_BOOL; - return; - case SLANG_OPER_LOGICALXOR: - for (i = 0; i < 4; i++) { - const GLint a = oper->children[0].literal[i] ? 1 : 0; - const GLint b = oper->children[1].literal[i] ? 1 : 0; - oper->literal[i] = (GLfloat) (a ^ b); - } - oper->literal_size = oper->children[0].literal_size; - slang_operation_destruct(oper); - oper->type = SLANG_OPER_LITERAL_BOOL; - return; - default: - ; /* nothing */ - } - } - - if (oper->num_children == 4 - && isFloat[0] && isFloat[1] && isFloat[2] && isFloat[3]) { - /* vec4(flt, flt, flt, flt) constructor */ - if (oper->type == SLANG_OPER_CALL) { - if (strcmp((char *) oper->a_id, "vec4") == 0) { - oper->literal[0] = oper->children[0].literal[0]; - oper->literal[1] = oper->children[1].literal[0]; - oper->literal[2] = oper->children[2].literal[0]; - oper->literal[3] = oper->children[3].literal[0]; - oper->literal_size = 4; - slang_operation_destruct(oper); - oper->type = SLANG_OPER_LITERAL_FLOAT; - return; - } - } - } - - if (oper->num_children == 3 && isFloat[0] && isFloat[1] && isFloat[2]) { - /* vec3(flt, flt, flt) constructor */ - if (oper->type == SLANG_OPER_CALL) { - if (strcmp((char *) oper->a_id, "vec3") == 0) { - oper->literal[0] = oper->children[0].literal[0]; - oper->literal[1] = oper->children[1].literal[0]; - oper->literal[2] = oper->children[2].literal[0]; - oper->literal[3] = oper->literal[2]; - oper->literal_size = 3; - slang_operation_destruct(oper); - oper->type = SLANG_OPER_LITERAL_FLOAT; - return; - } - } - } - - if (oper->num_children == 2 && isFloat[0] && isFloat[1]) { - /* vec2(flt, flt) constructor */ - if (oper->type == SLANG_OPER_CALL) { - if (strcmp((char *) oper->a_id, "vec2") == 0) { - oper->literal[0] = oper->children[0].literal[0]; - oper->literal[1] = oper->children[1].literal[0]; - oper->literal[2] = oper->literal[1]; - oper->literal[3] = oper->literal[1]; - oper->literal_size = 2; - slang_operation_destruct(oper); /* XXX oper->locals goes NULL! */ - oper->type = SLANG_OPER_LITERAL_FLOAT; - assert(oper->num_children == 0); - return; - } - } - } - - if (oper->num_children == 1 && isFloat[0]) { - /* vec2/3/4(flt, flt) constructor */ - if (oper->type == SLANG_OPER_CALL) { - const char *func = (const char *) oper->a_id; - if (strncmp(func, "vec", 3) == 0 && func[3] >= '2' && func[3] <= '4') { - oper->literal[0] = - oper->literal[1] = - oper->literal[2] = - oper->literal[3] = oper->children[0].literal[0]; - oper->literal_size = func[3] - '0'; - assert(oper->literal_size >= 2); - assert(oper->literal_size <= 4); - slang_operation_destruct(oper); /* XXX oper->locals goes NULL! */ - oper->type = SLANG_OPER_LITERAL_FLOAT; - assert(oper->num_children == 0); - return; - } - } - } -} - - - -/** - * Insert casts to try to adapt actual parameters to formal parameters for a - * function call when an exact match for the parameter types is not found. - * Example: - * void foo(int i, bool b) {} - * x = foo(3.15, 9); - * Gets translated into: - * x = foo(int(3.15), bool(9)) - */ -GLboolean -_slang_cast_func_params(slang_operation *callOper, const slang_function *fun, - const slang_name_space * space, - slang_atom_pool * atoms, slang_info_log *log) -{ - const GLboolean haveRetValue = _slang_function_has_return_value(fun); - const int numParams = fun->param_count - haveRetValue; - int i; - int dbg = 0; - - if (dbg) - printf("Adapt call of %d args to func %s (%d params)\n", - callOper->num_children, (char*) fun->header.a_name, numParams); - - for (i = 0; i < numParams; i++) { - slang_typeinfo argType; - slang_variable *paramVar = fun->parameters->variables[i]; - - /* Get type of arg[i] */ - if (!slang_typeinfo_construct(&argType)) - return GL_FALSE; - if (!_slang_typeof_operation(&callOper->children[i], space, - &argType, atoms, log)) { - slang_typeinfo_destruct(&argType); - return GL_FALSE; - } - - /* see if arg type matches parameter type */ - if (!slang_type_specifier_equal(&argType.spec, - ¶mVar->type.specifier)) { - /* need to adapt arg type to match param type */ - const char *constructorName = - slang_type_specifier_type_to_string(paramVar->type.specifier.type); - slang_operation *child = slang_operation_new(1); - - if (dbg) - printf("Need to adapt types of arg %d\n", i); - - slang_operation_copy(child, &callOper->children[i]); - child->locals->outer_scope = callOper->children[i].locals; - -#if 0 - if (_slang_sizeof_type_specifier(&argType.spec) > - _slang_sizeof_type_specifier(¶mVar->type.specifier)) { - } -#endif - - callOper->children[i].type = SLANG_OPER_CALL; - callOper->children[i].a_id = slang_atom_pool_atom(atoms, constructorName); - callOper->children[i].num_children = 1; - callOper->children[i].children = child; - } - - slang_typeinfo_destruct(&argType); - } - - if (dbg) { - printf("===== New call to %s with cast arguments ===============\n", - (char*) fun->header.a_name); - slang_print_tree(callOper, 5); - } - - return GL_TRUE; -} - - -/** - * Adapt the arguments for a function call to match the parameters of - * the given function. - * This is for: - * 1. converting/casting argument types to match parameters - * 2. breaking up vector/matrix types into individual components to - * satisfy constructors. - */ -GLboolean -_slang_adapt_call(slang_operation *callOper, const slang_function *fun, - const slang_name_space * space, - slang_atom_pool * atoms, slang_info_log *log) -{ - const GLboolean haveRetValue = _slang_function_has_return_value(fun); - const int numParams = fun->param_count - haveRetValue; - int i; - int dbg = 0; - - if (dbg) - printf("Adapt %d args to %d parameters for %s\n", - callOper->num_children, numParams, (char *) fun->header.a_name); - - /* Only try adapting for constructors */ - if (fun->kind != SLANG_FUNC_CONSTRUCTOR) - return GL_FALSE; - - if (callOper->num_children != numParams) { - /* number of arguments doesn't match number of parameters */ - - /* For constructor calls, we can try to unroll vector/matrix args - * into individual floats/ints and try to match the function params. - */ - for (i = 0; i < numParams; i++) { - slang_typeinfo argType; - GLint argSz, j; - - /* Get type of arg[i] */ - if (!slang_typeinfo_construct(&argType)) - return GL_FALSE; - if (!_slang_typeof_operation(&callOper->children[i], space, - &argType, atoms, log)) { - slang_typeinfo_destruct(&argType); - return GL_FALSE; - } - - /* - paramSz = _slang_sizeof_type_specifier(¶mVar->type.specifier); - assert(paramSz == 1); - */ - argSz = _slang_sizeof_type_specifier(&argType.spec); - if (argSz > 1) { - slang_operation origArg; - /* break up arg[i] into components */ - if (dbg) - printf("Break up arg %d from 1 to %d elements\n", i, argSz); - - slang_operation_construct(&origArg); - slang_operation_copy(&origArg, &callOper->children[i]); - - /* insert argSz-1 new children/args */ - for (j = 0; j < argSz - 1; j++) { - (void) slang_operation_insert(&callOper->num_children, - &callOper->children, i); - } - - /* replace arg[i+j] with subscript/index oper */ - for (j = 0; j < argSz; j++) { - callOper->children[i + j].type = SLANG_OPER_SUBSCRIPT; - callOper->children[i + j].locals = _slang_variable_scope_new(callOper->locals); - callOper->children[i + j].num_children = 2; - callOper->children[i + j].children = slang_operation_new(2); - slang_operation_copy(&callOper->children[i + j].children[0], - &origArg); - callOper->children[i + j].children[1].type - = SLANG_OPER_LITERAL_INT; - callOper->children[i + j].children[1].literal[0] = (GLfloat) j; - } - } - } - } - - if (callOper->num_children < (GLuint) numParams) { - /* still not enough args for all params */ - return GL_FALSE; - } - else if (callOper->num_children > (GLuint) numParams) { - /* now too many arguments */ - /* just truncate */ - callOper->num_children = (GLuint) numParams; - } - - if (dbg) { - printf("===== New call to %s with adapted arguments ===============\n", - (char*) fun->header.a_name); - slang_print_tree(callOper, 5); - } - - return GL_TRUE; -} diff --git a/src/mesa/slang/slang_simplify.h b/src/mesa/slang/slang_simplify.h deleted file mode 100644 index 37fb938d4f..0000000000 --- a/src/mesa/slang/slang_simplify.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Mesa 3-D graphics library - * Version: 7.1 - * - * Copyright (C) 2005-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. - */ - -#ifndef SLANG_SIMPLIFY_H -#define SLANG_SIMPLIFY_H - - -#include "main/glheader.h" -#include "slang_compile.h" -#include "slang_compile_function.h" -#include "slang_compile_operation.h" -#include "slang_log.h" -#include "slang_utility.h" - -extern GLint -_slang_lookup_constant(const char *name); - - -extern void -_slang_simplify(slang_operation *oper, - const slang_name_space * space, - slang_atom_pool * atoms); - - -extern GLboolean -_slang_cast_func_params(slang_operation *callOper, const slang_function *fun, - const slang_name_space * space, - slang_atom_pool * atoms, slang_info_log *log); - -extern GLboolean -_slang_adapt_call(slang_operation *callOper, const slang_function *fun, - const slang_name_space * space, - slang_atom_pool * atoms, slang_info_log *log); - - -#endif /* SLANG_SIMPLIFY_H */ diff --git a/src/mesa/slang/slang_storage.c b/src/mesa/slang/slang_storage.c deleted file mode 100644 index 656e15670d..0000000000 --- a/src/mesa/slang/slang_storage.c +++ /dev/null @@ -1,321 +0,0 @@ -/* - * Mesa 3-D graphics library - * Version: 6.5 - * - * Copyright (C) 2005-2006 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 slang_storage.c - * slang variable storage - * \author Michal Krol - */ - -#include "main/imports.h" -#include "slang_storage.h" -#include "slang_mem.h" - -/* slang_storage_array */ - -GLboolean -slang_storage_array_construct(slang_storage_array * arr) -{ - arr->type = SLANG_STORE_AGGREGATE; - arr->aggregate = NULL; - arr->length = 0; - return GL_TRUE; -} - -GLvoid -slang_storage_array_destruct(slang_storage_array * arr) -{ - if (arr->aggregate != NULL) { - slang_storage_aggregate_destruct(arr->aggregate); - _slang_free(arr->aggregate); - } -} - -/* slang_storage_aggregate */ - -GLboolean -slang_storage_aggregate_construct(slang_storage_aggregate * agg) -{ - agg->arrays = NULL; - agg->count = 0; - return GL_TRUE; -} - -GLvoid -slang_storage_aggregate_destruct(slang_storage_aggregate * agg) -{ - GLuint i; - - for (i = 0; i < agg->count; i++) - slang_storage_array_destruct(agg->arrays + i); - _slang_free(agg->arrays); -} - -static slang_storage_array * -slang_storage_aggregate_push_new(slang_storage_aggregate * agg) -{ - slang_storage_array *arr = NULL; - - agg->arrays = (slang_storage_array *) - _slang_realloc(agg->arrays, - agg->count * sizeof(slang_storage_array), - (agg->count + 1) * sizeof(slang_storage_array)); - if (agg->arrays != NULL) { - arr = agg->arrays + agg->count; - if (!slang_storage_array_construct(arr)) - return NULL; - agg->count++; - } - return arr; -} - -/* _slang_aggregate_variable() */ - -static GLboolean -aggregate_vector(slang_storage_aggregate * agg, slang_storage_type basic_type, - GLuint row_count) -{ - slang_storage_array *arr = slang_storage_aggregate_push_new(agg); - if (arr == NULL) - return GL_FALSE; - arr->type = basic_type; - arr->length = row_count; - return GL_TRUE; -} - -static GLboolean -aggregate_matrix(slang_storage_aggregate * agg, slang_storage_type basic_type, - GLuint columns, GLuint rows) -{ - slang_storage_array *arr = slang_storage_aggregate_push_new(agg); - if (arr == NULL) - return GL_FALSE; - arr->type = SLANG_STORE_AGGREGATE; - arr->length = columns; - arr->aggregate = (slang_storage_aggregate *) - _slang_alloc(sizeof(slang_storage_aggregate)); - if (arr->aggregate == NULL) - return GL_FALSE; - if (!slang_storage_aggregate_construct(arr->aggregate)) { - _slang_free(arr->aggregate); - arr->aggregate = NULL; - return GL_FALSE; - } - if (!aggregate_vector(arr->aggregate, basic_type, rows)) - return GL_FALSE; - return GL_TRUE; -} - - -static GLboolean -aggregate_variables(slang_storage_aggregate * agg, - slang_variable_scope * vars, slang_function_scope * funcs, - slang_struct_scope * structs, - slang_variable_scope * globals, - slang_atom_pool * atoms) -{ - GLuint i; - - for (i = 0; i < vars->num_variables; i++) - if (!_slang_aggregate_variable(agg, &vars->variables[i]->type.specifier, - vars->variables[i]->array_len, funcs, - structs, globals, atoms)) - return GL_FALSE; - return GL_TRUE; -} - - -GLboolean -_slang_aggregate_variable(slang_storage_aggregate * agg, - slang_type_specifier * spec, GLuint array_len, - slang_function_scope * funcs, - slang_struct_scope * structs, - slang_variable_scope * vars, - slang_atom_pool * atoms) -{ - switch (spec->type) { - case SLANG_SPEC_BOOL: - return aggregate_vector(agg, SLANG_STORE_BOOL, 1); - case SLANG_SPEC_BVEC2: - return aggregate_vector(agg, SLANG_STORE_BOOL, 2); - case SLANG_SPEC_BVEC3: - return aggregate_vector(agg, SLANG_STORE_BOOL, 3); - case SLANG_SPEC_BVEC4: - return aggregate_vector(agg, SLANG_STORE_BOOL, 4); - case SLANG_SPEC_INT: - return aggregate_vector(agg, SLANG_STORE_INT, 1); - case SLANG_SPEC_IVEC2: - return aggregate_vector(agg, SLANG_STORE_INT, 2); - case SLANG_SPEC_IVEC3: - return aggregate_vector(agg, SLANG_STORE_INT, 3); - case SLANG_SPEC_IVEC4: - return aggregate_vector(agg, SLANG_STORE_INT, 4); - case SLANG_SPEC_FLOAT: - return aggregate_vector(agg, SLANG_STORE_FLOAT, 1); - case SLANG_SPEC_VEC2: - return aggregate_vector(agg, SLANG_STORE_FLOAT, 2); - case SLANG_SPEC_VEC3: - return aggregate_vector(agg, SLANG_STORE_FLOAT, 3); - case SLANG_SPEC_VEC4: - return aggregate_vector(agg, SLANG_STORE_FLOAT, 4); - case SLANG_SPEC_MAT2: - return aggregate_matrix(agg, SLANG_STORE_FLOAT, 2, 2); - case SLANG_SPEC_MAT3: - return aggregate_matrix(agg, SLANG_STORE_FLOAT, 3, 3); - case SLANG_SPEC_MAT4: - return aggregate_matrix(agg, SLANG_STORE_FLOAT, 4, 4); - - case SLANG_SPEC_MAT23: - return aggregate_matrix(agg, SLANG_STORE_FLOAT, 2, 3); - case SLANG_SPEC_MAT32: - return aggregate_matrix(agg, SLANG_STORE_FLOAT, 3, 2); - case SLANG_SPEC_MAT24: - return aggregate_matrix(agg, SLANG_STORE_FLOAT, 2, 4); - case SLANG_SPEC_MAT42: - return aggregate_matrix(agg, SLANG_STORE_FLOAT, 4, 2); - case SLANG_SPEC_MAT34: - return aggregate_matrix(agg, SLANG_STORE_FLOAT, 3, 4); - case SLANG_SPEC_MAT43: - return aggregate_matrix(agg, SLANG_STORE_FLOAT, 4, 3); - - case SLANG_SPEC_SAMPLER_1D: - case SLANG_SPEC_SAMPLER_2D: - case SLANG_SPEC_SAMPLER_3D: - case SLANG_SPEC_SAMPLER_CUBE: - case SLANG_SPEC_SAMPLER_1D_SHADOW: - case SLANG_SPEC_SAMPLER_2D_SHADOW: - case SLANG_SPEC_SAMPLER_RECT: - case SLANG_SPEC_SAMPLER_RECT_SHADOW: - case SLANG_SPEC_SAMPLER_1D_ARRAY: - case SLANG_SPEC_SAMPLER_2D_ARRAY: - case SLANG_SPEC_SAMPLER_1D_ARRAY_SHADOW: - case SLANG_SPEC_SAMPLER_2D_ARRAY_SHADOW: - - return aggregate_vector(agg, SLANG_STORE_INT, 1); - case SLANG_SPEC_STRUCT: - return aggregate_variables(agg, spec->_struct->fields, funcs, structs, - vars, atoms); - case SLANG_SPEC_ARRAY: - { - slang_storage_array *arr; - - arr = slang_storage_aggregate_push_new(agg); - if (arr == NULL) - return GL_FALSE; - arr->type = SLANG_STORE_AGGREGATE; - arr->aggregate = (slang_storage_aggregate *) - _slang_alloc(sizeof(slang_storage_aggregate)); - if (arr->aggregate == NULL) - return GL_FALSE; - if (!slang_storage_aggregate_construct(arr->aggregate)) { - _slang_free(arr->aggregate); - arr->aggregate = NULL; - return GL_FALSE; - } - if (!_slang_aggregate_variable(arr->aggregate, spec->_array, 0, - funcs, structs, vars, atoms)) - return GL_FALSE; - arr->length = array_len; - /* TODO: check if 0 < arr->length <= 65535 */ - } - return GL_TRUE; - default: - return GL_FALSE; - } -} - - -GLuint -_slang_sizeof_type(slang_storage_type type) -{ - if (type == SLANG_STORE_AGGREGATE) - return 0; - if (type == SLANG_STORE_VEC4) - return 4 * sizeof(GLfloat); - return sizeof(GLfloat); -} - - -GLuint -_slang_sizeof_aggregate(const slang_storage_aggregate * agg) -{ - GLuint i, size = 0; - - for (i = 0; i < agg->count; i++) { - slang_storage_array *arr = &agg->arrays[i]; - GLuint element_size; - - if (arr->type == SLANG_STORE_AGGREGATE) - element_size = _slang_sizeof_aggregate(arr->aggregate); - else - element_size = _slang_sizeof_type(arr->type); - size += element_size * arr->length; - } - return size; -} - - -#if 0 -GLboolean -_slang_flatten_aggregate(slang_storage_aggregate * flat, - const slang_storage_aggregate * agg) -{ - GLuint i; - - for (i = 0; i < agg->count; i++) { - GLuint j; - - for (j = 0; j < agg->arrays[i].length; j++) { - if (agg->arrays[i].type == SLANG_STORE_AGGREGATE) { - if (!_slang_flatten_aggregate(flat, agg->arrays[i].aggregate)) - return GL_FALSE; - } - else { - GLuint k, count; - slang_storage_type type; - - if (agg->arrays[i].type == SLANG_STORE_VEC4) { - count = 4; - type = SLANG_STORE_FLOAT; - } - else { - count = 1; - type = agg->arrays[i].type; - } - - for (k = 0; k < count; k++) { - slang_storage_array *arr; - - arr = slang_storage_aggregate_push_new(flat); - if (arr == NULL) - return GL_FALSE; - arr->type = type; - arr->length = 1; - } - } - } - } - return GL_TRUE; -} -#endif diff --git a/src/mesa/slang/slang_storage.h b/src/mesa/slang/slang_storage.h deleted file mode 100644 index de1f1841a3..0000000000 --- a/src/mesa/slang/slang_storage.h +++ /dev/null @@ -1,144 +0,0 @@ -/* - * Mesa 3-D graphics library - * Version: 6.5 - * - * Copyright (C) 2005-2006 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 SLANG_STORAGE_H -#define SLANG_STORAGE_H - -#include "main/glheader.h" -#include "slang_compile_function.h" -#include "slang_compile_struct.h" -#include "slang_compile_variable.h" -#include "slang_typeinfo.h" -#include "slang_utility.h" - - -/* - * Program variable data storage is kept completely transparent to the - * front-end compiler. It is up to the back-end how the data is - * actually allocated. The slang_storage_type enum provides the basic - * information about how the memory is interpreted. This abstract - * piece of memory is called a data slot. A data slot of a particular - * type has a fixed size. - * - * For now, only the three basic types are supported, that is bool, - * int and float. Other built-in types like vector or matrix can - * easily be decomposed into a series of basic types. - * - * If the vec4 module is enabled, 4-component vectors of floats are - * used when possible. 4x4 matrices are constructed of 4 vec4 slots. - */ -typedef enum slang_storage_type_ -{ - /* core */ - SLANG_STORE_AGGREGATE, - SLANG_STORE_BOOL, - SLANG_STORE_INT, - SLANG_STORE_FLOAT, - /* vec4 */ - SLANG_STORE_VEC4 -} slang_storage_type; - - -/** - * The slang_storage_array structure groups data slots of the same - * type into an array. This array has a fixed length. Arrays are - * required to have a size equal to the sum of sizes of its - * elements. They are also required to support indirect - * addressing. That is, if B references first data slot in the array, - * S is the size of the data slot and I is the integral index that is - * not known at compile time, B+I*S references I-th data slot. - * - * This structure is also used to break down built-in data types that - * are not supported directly. Vectors, like vec3, are constructed - * from arrays of their basic types. Matrices are formed of an array - * of column vectors, which are in turn processed as other vectors. - */ -typedef struct slang_storage_array_ -{ - slang_storage_type type; - struct slang_storage_aggregate_ *aggregate; - GLuint length; -} slang_storage_array; - -GLboolean slang_storage_array_construct (slang_storage_array *); -GLvoid slang_storage_array_destruct (slang_storage_array *); - - -/** - * The slang_storage_aggregate structure relaxes the indirect - * addressing requirement for slang_storage_array - * structure. Aggregates are always accessed statically - its member - * addresses are well-known at compile time. For example, user-defined - * types are implemented as aggregates. Aggregates can collect data of - * a different type. - */ -typedef struct slang_storage_aggregate_ -{ - slang_storage_array *arrays; - GLuint count; -} slang_storage_aggregate; - -GLboolean slang_storage_aggregate_construct (slang_storage_aggregate *); -GLvoid slang_storage_aggregate_destruct (slang_storage_aggregate *); - - -extern GLboolean -_slang_aggregate_variable(slang_storage_aggregate *agg, - slang_type_specifier *spec, - GLuint array_len, - slang_function_scope *funcs, - slang_struct_scope *structs, - slang_variable_scope *vars, - slang_atom_pool *atoms); - -/* - * Returns the size (in machine units) of the given storage type. - * It is an error to pass-in SLANG_STORE_AGGREGATE. - * Returns 0 on error. - */ -extern GLuint -_slang_sizeof_type (slang_storage_type); - - -/** - * Returns total size (in machine units) of the given aggregate. - * Returns 0 on error. - */ -extern GLuint -_slang_sizeof_aggregate (const slang_storage_aggregate *); - - -#if 0 -/** - * Converts structured aggregate to a flat one, with arrays of generic - * type being one-element long. Returns GL_TRUE on success. Returns - * GL_FALSE otherwise. - */ -extern GLboolean -_slang_flatten_aggregate (slang_storage_aggregate *, - const slang_storage_aggregate *); - -#endif - -#endif /* SLANG_STORAGE_H */ diff --git a/src/mesa/slang/slang_typeinfo.c b/src/mesa/slang/slang_typeinfo.c deleted file mode 100644 index d039a12e98..0000000000 --- a/src/mesa/slang/slang_typeinfo.c +++ /dev/null @@ -1,1177 +0,0 @@ -/* - * Mesa 3-D graphics library - * Version: 6.5 - * - * Copyright (C) 2005-2006 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 slang_typeinfo.c - * slang type info - * \author Michal Krol - */ - -#include "main/imports.h" -#include "program/prog_instruction.h" -#include "slang_typeinfo.h" -#include "slang_compile.h" -#include "slang_log.h" -#include "slang_mem.h" - - -/** - * Checks if a field selector is a general swizzle (an r-value swizzle - * with replicated components or an l-value swizzle mask) for a - * vector. Returns GL_TRUE if this is the case, is filled with - * swizzle information. Returns GL_FALSE otherwise. - */ -GLboolean -_slang_is_swizzle(const char *field, GLuint rows, slang_swizzle * swz) -{ - GLuint i; - GLboolean xyzw = GL_FALSE, rgba = GL_FALSE, stpq = GL_FALSE; - - /* init to undefined. - * We rely on undefined/nil values to distinguish between - * regular swizzles and writemasks. - * For example, the swizzle ".xNNN" is the writemask ".x". - * That's different than the swizzle ".xxxx". - */ - for (i = 0; i < 4; i++) - swz->swizzle[i] = SWIZZLE_NIL; - - /* the swizzle can be at most 4-component long */ - swz->num_components = slang_string_length(field); - if (swz->num_components > 4) - return GL_FALSE; - - for (i = 0; i < swz->num_components; i++) { - /* mark which swizzle group is used */ - switch (field[i]) { - case 'x': - case 'y': - case 'z': - case 'w': - xyzw = GL_TRUE; - break; - case 'r': - case 'g': - case 'b': - case 'a': - rgba = GL_TRUE; - break; - case 's': - case 't': - case 'p': - case 'q': - stpq = GL_TRUE; - break; - default: - return GL_FALSE; - } - - /* collect swizzle component */ - switch (field[i]) { - case 'x': - case 'r': - case 's': - swz->swizzle[i] = 0; - break; - case 'y': - case 'g': - case 't': - swz->swizzle[i] = 1; - break; - case 'z': - case 'b': - case 'p': - swz->swizzle[i] = 2; - break; - case 'w': - case 'a': - case 'q': - swz->swizzle[i] = 3; - break; - } - - /* check if the component is valid for given vector's row count */ - if (rows <= swz->swizzle[i]) - return GL_FALSE; - } - - /* only one swizzle group can be used */ - if ((xyzw && rgba) || (xyzw && stpq) || (rgba && stpq)) - return GL_FALSE; - - return GL_TRUE; -} - - - -/** - * Checks if a general swizzle is an l-value swizzle - these swizzles - * do not have duplicated fields. Returns GL_TRUE if this is a - * swizzle mask. Returns GL_FALSE otherwise - */ -static GLboolean -_slang_is_swizzle_mask(const slang_swizzle * swz, GLuint rows) -{ - GLuint i, c = 0; - - /* the swizzle may not be longer than the vector dim */ - if (swz->num_components > rows) - return GL_FALSE; - - /* the swizzle components cannot be duplicated */ - for (i = 0; i < swz->num_components; i++) { - if ((c & (1 << swz->swizzle[i])) != 0) - return GL_FALSE; - c |= 1 << swz->swizzle[i]; - } - - return GL_TRUE; -} - - -/** - * Combines (multiplies) two swizzles to form single swizzle. - * Example: "vec.wzyx.yx" --> "vec.zw". - */ -static void -_slang_multiply_swizzles(slang_swizzle * dst, const slang_swizzle * left, - const slang_swizzle * right) -{ - GLuint i; - - dst->num_components = right->num_components; - for (i = 0; i < right->num_components; i++) - dst->swizzle[i] = left->swizzle[right->swizzle[i]]; -} - - -typedef struct -{ - const char *name; - slang_type_specifier_type type; -} type_specifier_type_name; - -static const type_specifier_type_name type_specifier_type_names[] = { - {"void", SLANG_SPEC_VOID}, - {"bool", SLANG_SPEC_BOOL}, - {"bvec2", SLANG_SPEC_BVEC2}, - {"bvec3", SLANG_SPEC_BVEC3}, - {"bvec4", SLANG_SPEC_BVEC4}, - {"int", SLANG_SPEC_INT}, - {"ivec2", SLANG_SPEC_IVEC2}, - {"ivec3", SLANG_SPEC_IVEC3}, - {"ivec4", SLANG_SPEC_IVEC4}, - {"float", SLANG_SPEC_FLOAT}, - {"vec2", SLANG_SPEC_VEC2}, - {"vec3", SLANG_SPEC_VEC3}, - {"vec4", SLANG_SPEC_VEC4}, - {"mat2", SLANG_SPEC_MAT2}, - {"mat3", SLANG_SPEC_MAT3}, - {"mat4", SLANG_SPEC_MAT4}, - {"mat2x3", SLANG_SPEC_MAT23}, - {"mat3x2", SLANG_SPEC_MAT32}, - {"mat2x4", SLANG_SPEC_MAT24}, - {"mat4x2", SLANG_SPEC_MAT42}, - {"mat3x4", SLANG_SPEC_MAT34}, - {"mat4x3", SLANG_SPEC_MAT43}, - {"sampler1D", SLANG_SPEC_SAMPLER_1D}, - {"sampler2D", SLANG_SPEC_SAMPLER_2D}, - {"sampler3D", SLANG_SPEC_SAMPLER_3D}, - {"samplerCube", SLANG_SPEC_SAMPLER_CUBE}, - {"sampler1DShadow", SLANG_SPEC_SAMPLER_1D_SHADOW}, - {"sampler2DShadow", SLANG_SPEC_SAMPLER_2D_SHADOW}, - {"sampler2DRect", SLANG_SPEC_SAMPLER_RECT}, - {"sampler2DRectShadow", SLANG_SPEC_SAMPLER_RECT_SHADOW}, - {"sampler1DArray", SLANG_SPEC_SAMPLER_1D_ARRAY}, - {"sampler2DArray", SLANG_SPEC_SAMPLER_2D_ARRAY}, - {"sampler1DArrayShadow", SLANG_SPEC_SAMPLER_1D_ARRAY_SHADOW}, - {"sampler2DArrayShadow", SLANG_SPEC_SAMPLER_2D_ARRAY_SHADOW}, - {NULL, SLANG_SPEC_VOID} -}; - -slang_type_specifier_type -slang_type_specifier_type_from_string(const char *name) -{ - const type_specifier_type_name *p = type_specifier_type_names; - while (p->name != NULL) { - if (slang_string_compare(p->name, name) == 0) - break; - p++; - } - return p->type; -} - -const char * -slang_type_specifier_type_to_string(slang_type_specifier_type type) -{ - const type_specifier_type_name *p = type_specifier_type_names; - while (p->name != NULL) { - if (p->type == type) - break; - p++; - } - return p->name; -} - -/* slang_fully_specified_type */ - -int -slang_fully_specified_type_construct(slang_fully_specified_type * type) -{ - type->qualifier = SLANG_QUAL_NONE; - slang_type_specifier_ctr(&type->specifier); - return 1; -} - -void -slang_fully_specified_type_destruct(slang_fully_specified_type * type) -{ - slang_type_specifier_dtr(&type->specifier); -} - -int -slang_fully_specified_type_copy(slang_fully_specified_type * x, - const slang_fully_specified_type * y) -{ - slang_fully_specified_type z; - - if (!slang_fully_specified_type_construct(&z)) - return 0; - z.qualifier = y->qualifier; - z.precision = y->precision; - z.variant = y->variant; - z.centroid = y->centroid; - z.layout = y->layout; - z.array_len = y->array_len; - if (!slang_type_specifier_copy(&z.specifier, &y->specifier)) { - slang_fully_specified_type_destruct(&z); - return 0; - } - slang_fully_specified_type_destruct(x); - *x = z; - return 1; -} - - -/** - * Test if two fully specified types are compatible. This is a bit - * looser than testing for equality. We don't check the precision, - * variant, centroid, etc. information. - * XXX this may need some tweaking. - */ -GLboolean -slang_fully_specified_types_compatible(const slang_fully_specified_type * x, - const slang_fully_specified_type * y) -{ - if (!slang_type_specifier_equal(&x->specifier, &y->specifier)) - return GL_FALSE; - - if (x->qualifier == SLANG_QUAL_FIXEDINPUT && - y->qualifier == SLANG_QUAL_VARYING) - ; /* ok */ - else if (x->qualifier != y->qualifier) - return GL_FALSE; - - /* Note: don't compare precision, variant, centroid */ - - /* XXX array length? */ - - return GL_TRUE; -} - - -GLvoid -slang_type_specifier_ctr(slang_type_specifier * self) -{ - self->type = SLANG_SPEC_VOID; - self->_struct = NULL; - self->_array = NULL; -} - -GLvoid -slang_type_specifier_dtr(slang_type_specifier * self) -{ - if (self->_struct != NULL) { - slang_struct_destruct(self->_struct); - _slang_free(self->_struct); - } - if (self->_array != NULL) { - slang_type_specifier_dtr(self->_array); - _slang_free(self->_array); - } -} - -slang_type_specifier * -slang_type_specifier_new(slang_type_specifier_type type, - struct slang_struct_ *_struct, - struct slang_type_specifier_ *_array) -{ - slang_type_specifier *spec = - (slang_type_specifier *) _slang_alloc(sizeof(slang_type_specifier)); - if (spec) { - spec->type = type; - spec->_struct = _struct; - spec->_array = _array; - } - return spec; -} - -GLboolean -slang_type_specifier_copy(slang_type_specifier * x, - const slang_type_specifier * y) -{ - slang_type_specifier z; - - slang_type_specifier_ctr(&z); - z.type = y->type; - if (z.type == SLANG_SPEC_STRUCT) { - z._struct = (slang_struct *) _slang_alloc(sizeof(slang_struct)); - if (z._struct == NULL) { - slang_type_specifier_dtr(&z); - return GL_FALSE; - } - if (!slang_struct_construct(z._struct)) { - _slang_free(z._struct); - slang_type_specifier_dtr(&z); - return GL_FALSE; - } - if (!slang_struct_copy(z._struct, y->_struct)) { - slang_type_specifier_dtr(&z); - return GL_FALSE; - } - } - else if (z.type == SLANG_SPEC_ARRAY) { - z._array = (slang_type_specifier *) - _slang_alloc(sizeof(slang_type_specifier)); - if (z._array == NULL) { - slang_type_specifier_dtr(&z); - return GL_FALSE; - } - slang_type_specifier_ctr(z._array); - if (!slang_type_specifier_copy(z._array, y->_array)) { - slang_type_specifier_dtr(&z); - return GL_FALSE; - } - } - slang_type_specifier_dtr(x); - *x = z; - return GL_TRUE; -} - - -/** - * Test if two types are equal. - */ -GLboolean -slang_type_specifier_equal(const slang_type_specifier * x, - const slang_type_specifier * y) -{ - if (x->type != y->type) - return GL_FALSE; - if (x->type == SLANG_SPEC_STRUCT) - return slang_struct_equal(x->_struct, y->_struct); - if (x->type == SLANG_SPEC_ARRAY) - return slang_type_specifier_equal(x->_array, y->_array); - return GL_TRUE; -} - - -/** - * As above, but allow float/int casting. - */ -GLboolean -slang_type_specifier_compatible(const slang_type_specifier * x, - const slang_type_specifier * y) -{ - /* special case: float == int */ - if (x->type == SLANG_SPEC_INT && y->type == SLANG_SPEC_FLOAT) { - return GL_TRUE; - } - /* XXX may need to add bool/int compatibility, etc */ - - if (x->type != y->type) - return GL_FALSE; - if (x->type == SLANG_SPEC_STRUCT) - return slang_struct_equal(x->_struct, y->_struct); - if (x->type == SLANG_SPEC_ARRAY) - return slang_type_specifier_compatible(x->_array, y->_array); - return GL_TRUE; -} - - -GLboolean -slang_typeinfo_construct(slang_typeinfo * ti) -{ - memset(ti, 0, sizeof(*ti)); - slang_type_specifier_ctr(&ti->spec); - ti->array_len = 0; - return GL_TRUE; -} - -GLvoid -slang_typeinfo_destruct(slang_typeinfo * ti) -{ - slang_type_specifier_dtr(&ti->spec); -} - - - -/** - * Determine the return type of a function. - * \param a_name the function name - * \param param function parameters (overloading) - * \param num_params number of parameters to function - * \param space namespace to search - * \param spec returns the type - * \param funFound returns pointer to the function, or NULL if not found. - * \return GL_TRUE for success, GL_FALSE if failure (bad function name) - */ -static GLboolean -_slang_typeof_function(slang_atom a_name, - slang_operation * params, GLuint num_params, - const slang_name_space * space, - slang_type_specifier * spec, - slang_function **funFound, - slang_atom_pool *atoms, slang_info_log *log) -{ - GLboolean error; - - *funFound = _slang_function_locate(space->funcs, a_name, params, - num_params, space, atoms, log, &error); - if (error) - return GL_FALSE; - - if (!*funFound) - return GL_TRUE; /* yes, not false */ - - return slang_type_specifier_copy(spec, &(*funFound)->header.type.specifier); -} - - -/** - * Determine the type of a math function. - * \param name name of the operator, one of +,-,*,/ or unary - - * \param params array of function parameters - * \param num_params number of parameters - * \param space namespace to use - * \param spec returns the function's type - * \param atoms atom pool - * \return GL_TRUE for success, GL_FALSE if failure - */ -static GLboolean -typeof_math_call(const char *name, slang_operation *call, - const slang_name_space * space, - slang_type_specifier * spec, - slang_atom_pool * atoms, - slang_info_log *log) -{ - if (call->fun) { - /* we've previously resolved this function call */ - slang_type_specifier_copy(spec, &call->fun->header.type.specifier); - return GL_TRUE; - } - else { - slang_atom atom; - slang_function *fun; - - /* number of params: */ - assert(call->num_children == 1 || call->num_children == 2); - - atom = slang_atom_pool_atom(atoms, name); - if (!_slang_typeof_function(atom, call->children, call->num_children, - space, spec, &fun, atoms, log)) - return GL_FALSE; - - if (fun) { - /* Save pointer to save time in future */ - call->fun = fun; - return GL_TRUE; - } - return GL_FALSE; - } -} - - -/** - * Determine the return type of an operation. - * \param op the operation node - * \param space the namespace to use - * \param ti the returned type - * \param atoms atom pool - * \return GL_TRUE for success, GL_FALSE if failure - */ -GLboolean -_slang_typeof_operation(slang_operation * op, - const slang_name_space * space, - slang_typeinfo * ti, - slang_atom_pool * atoms, - slang_info_log *log) -{ - ti->can_be_referenced = GL_FALSE; - ti->is_swizzled = GL_FALSE; - - switch (op->type) { - case SLANG_OPER_BLOCK_NO_NEW_SCOPE: - case SLANG_OPER_BLOCK_NEW_SCOPE: - case SLANG_OPER_ASM: - case SLANG_OPER_BREAK: - case SLANG_OPER_CONTINUE: - case SLANG_OPER_DISCARD: - case SLANG_OPER_RETURN: - case SLANG_OPER_IF: - case SLANG_OPER_WHILE: - case SLANG_OPER_DO: - case SLANG_OPER_FOR: - case SLANG_OPER_VOID: - ti->spec.type = SLANG_SPEC_VOID; - break; - case SLANG_OPER_EXPRESSION: - case SLANG_OPER_ASSIGN: - case SLANG_OPER_ADDASSIGN: - case SLANG_OPER_SUBASSIGN: - case SLANG_OPER_MULASSIGN: - case SLANG_OPER_DIVASSIGN: - case SLANG_OPER_PREINCREMENT: - case SLANG_OPER_PREDECREMENT: - if (!_slang_typeof_operation(op->children, space, ti, atoms, log)) - return GL_FALSE; - break; - case SLANG_OPER_LITERAL_BOOL: - if (op->literal_size == 1) - ti->spec.type = SLANG_SPEC_BOOL; - else if (op->literal_size == 2) - ti->spec.type = SLANG_SPEC_BVEC2; - else if (op->literal_size == 3) - ti->spec.type = SLANG_SPEC_BVEC3; - else if (op->literal_size == 4) - ti->spec.type = SLANG_SPEC_BVEC4; - else { - _mesa_problem(NULL, - "Unexpected bool literal_size %d in _slang_typeof_operation()", - op->literal_size); - ti->spec.type = SLANG_SPEC_BOOL; - } - break; - case SLANG_OPER_LOGICALOR: - case SLANG_OPER_LOGICALXOR: - case SLANG_OPER_LOGICALAND: - case SLANG_OPER_EQUAL: - case SLANG_OPER_NOTEQUAL: - case SLANG_OPER_LESS: - case SLANG_OPER_GREATER: - case SLANG_OPER_LESSEQUAL: - case SLANG_OPER_GREATEREQUAL: - case SLANG_OPER_NOT: - ti->spec.type = SLANG_SPEC_BOOL; - break; - case SLANG_OPER_LITERAL_INT: - if (op->literal_size == 1) - ti->spec.type = SLANG_SPEC_INT; - else if (op->literal_size == 2) - ti->spec.type = SLANG_SPEC_IVEC2; - else if (op->literal_size == 3) - ti->spec.type = SLANG_SPEC_IVEC3; - else if (op->literal_size == 4) - ti->spec.type = SLANG_SPEC_IVEC4; - else { - _mesa_problem(NULL, - "Unexpected int literal_size %d in _slang_typeof_operation()", - op->literal_size); - ti->spec.type = SLANG_SPEC_INT; - } - break; - case SLANG_OPER_LITERAL_FLOAT: - if (op->literal_size == 1) - ti->spec.type = SLANG_SPEC_FLOAT; - else if (op->literal_size == 2) - ti->spec.type = SLANG_SPEC_VEC2; - else if (op->literal_size == 3) - ti->spec.type = SLANG_SPEC_VEC3; - else if (op->literal_size == 4) - ti->spec.type = SLANG_SPEC_VEC4; - else { - _mesa_problem(NULL, - "Unexpected float literal_size %d in _slang_typeof_operation()", - op->literal_size); - ti->spec.type = SLANG_SPEC_FLOAT; - } - break; - case SLANG_OPER_IDENTIFIER: - case SLANG_OPER_VARIABLE_DECL: - { - slang_variable *var; - var = _slang_variable_locate(op->locals, op->a_id, GL_TRUE); - if (!var) { - slang_info_log_error(log, "undefined variable '%s'", - (char *) op->a_id); - return GL_FALSE; - } - if (!slang_type_specifier_copy(&ti->spec, &var->type.specifier)) { - slang_info_log_memory(log); - return GL_FALSE; - } - ti->can_be_referenced = GL_TRUE; - if (var->type.specifier.type == SLANG_SPEC_ARRAY && - var->type.array_len >= 1) { - /* the datatype is an array, ex: float[3] x; */ - ti->array_len = var->type.array_len; - } - else { - /* the variable is an array, ex: float x[3]; */ - ti->array_len = var->array_len; - } - } - break; - case SLANG_OPER_SEQUENCE: - /* TODO: check [0] and [1] if they match */ - if (!_slang_typeof_operation(&op->children[1], space, ti, atoms, log)) { - return GL_FALSE; - } - ti->can_be_referenced = GL_FALSE; - ti->is_swizzled = GL_FALSE; - break; - /*case SLANG_OPER_MODASSIGN: */ - /*case SLANG_OPER_LSHASSIGN: */ - /*case SLANG_OPER_RSHASSIGN: */ - /*case SLANG_OPER_ORASSIGN: */ - /*case SLANG_OPER_XORASSIGN: */ - /*case SLANG_OPER_ANDASSIGN: */ - case SLANG_OPER_SELECT: - /* TODO: check [1] and [2] if they match */ - if (!_slang_typeof_operation(&op->children[1], space, ti, atoms, log)) { - return GL_FALSE; - } - ti->can_be_referenced = GL_FALSE; - ti->is_swizzled = GL_FALSE; - break; - /*case SLANG_OPER_BITOR: */ - /*case SLANG_OPER_BITXOR: */ - /*case SLANG_OPER_BITAND: */ - /*case SLANG_OPER_LSHIFT: */ - /*case SLANG_OPER_RSHIFT: */ - case SLANG_OPER_ADD: - assert(op->num_children == 2); - if (!typeof_math_call("+", op, space, &ti->spec, atoms, log)) - return GL_FALSE; - break; - case SLANG_OPER_SUBTRACT: - assert(op->num_children == 2); - if (!typeof_math_call("-", op, space, &ti->spec, atoms, log)) - return GL_FALSE; - break; - case SLANG_OPER_MULTIPLY: - assert(op->num_children == 2); - if (!typeof_math_call("*", op, space, &ti->spec, atoms, log)) - return GL_FALSE; - break; - case SLANG_OPER_DIVIDE: - assert(op->num_children == 2); - if (!typeof_math_call("/", op, space, &ti->spec, atoms, log)) - return GL_FALSE; - break; - /*case SLANG_OPER_MODULUS: */ - case SLANG_OPER_PLUS: - if (!_slang_typeof_operation(op->children, space, ti, atoms, log)) - return GL_FALSE; - ti->can_be_referenced = GL_FALSE; - ti->is_swizzled = GL_FALSE; - break; - case SLANG_OPER_MINUS: - assert(op->num_children == 1); - if (!typeof_math_call("-", op, space, &ti->spec, atoms, log)) - return GL_FALSE; - break; - /*case SLANG_OPER_COMPLEMENT: */ - case SLANG_OPER_SUBSCRIPT: - { - slang_typeinfo _ti; - - if (!slang_typeinfo_construct(&_ti)) - return GL_FALSE; - if (!_slang_typeof_operation(op->children, space, &_ti, atoms, log)) { - slang_typeinfo_destruct(&_ti); - return GL_FALSE; - } - ti->can_be_referenced = _ti.can_be_referenced; - if (_ti.spec.type == SLANG_SPEC_ARRAY) { - if (!slang_type_specifier_copy(&ti->spec, _ti.spec._array)) { - slang_typeinfo_destruct(&_ti); - return GL_FALSE; - } - } - else { - if (!_slang_type_is_vector(_ti.spec.type) - && !_slang_type_is_matrix(_ti.spec.type)) { - slang_typeinfo_destruct(&_ti); - slang_info_log_error(log, "cannot index a non-array type"); - return GL_FALSE; - } - ti->spec.type = _slang_type_base(_ti.spec.type); - } - slang_typeinfo_destruct(&_ti); - } - break; - case SLANG_OPER_CALL: - if (op->array_constructor) { - /* build array typeinfo */ - ti->spec.type = SLANG_SPEC_ARRAY; - ti->spec._array = (slang_type_specifier *) - _slang_alloc(sizeof(slang_type_specifier)); - slang_type_specifier_ctr(ti->spec._array); - - ti->spec._array->type = - slang_type_specifier_type_from_string((char *) op->a_id); - ti->array_len = op->num_children; - } - else if (op->fun) { - /* we've resolved this call before */ - slang_type_specifier_copy(&ti->spec, &op->fun->header.type.specifier); - } - else { - slang_function *fun; - if (!_slang_typeof_function(op->a_id, op->children, op->num_children, - space, &ti->spec, &fun, atoms, log)) - return GL_FALSE; - if (fun) { - /* save result for future use */ - op->fun = fun; - } - else { - slang_struct *s = - slang_struct_scope_find(space->structs, op->a_id, GL_TRUE); - if (s) { - /* struct initializer */ - ti->spec.type = SLANG_SPEC_STRUCT; - ti->spec._struct = - (slang_struct *) _slang_alloc(sizeof(slang_struct)); - if (ti->spec._struct == NULL) - return GL_FALSE; - if (!slang_struct_construct(ti->spec._struct)) { - _slang_free(ti->spec._struct); - ti->spec._struct = NULL; - return GL_FALSE; - } - if (!slang_struct_copy(ti->spec._struct, s)) - return GL_FALSE; - } - else { - /* float, int, vec4, mat3, etc. constructor? */ - const char *name; - slang_type_specifier_type type; - - name = slang_atom_pool_id(atoms, op->a_id); - type = slang_type_specifier_type_from_string(name); - if (type == SLANG_SPEC_VOID) { - slang_info_log_error(log, "undefined function '%s'", name); - return GL_FALSE; - } - ti->spec.type = type; - } - } - } - break; - case SLANG_OPER_METHOD: - /* at this time, GLSL 1.20 only has one method: array.length() - * which returns an integer. - */ - ti->spec.type = SLANG_SPEC_INT; - break; - case SLANG_OPER_FIELD: - { - slang_typeinfo _ti; - - if (!slang_typeinfo_construct(&_ti)) - return GL_FALSE; - if (!_slang_typeof_operation(op->children, space, &_ti, atoms, log)) { - slang_typeinfo_destruct(&_ti); - return GL_FALSE; - } - if (_ti.spec.type == SLANG_SPEC_STRUCT) { - slang_variable *field; - - field = _slang_variable_locate(_ti.spec._struct->fields, op->a_id, - GL_FALSE); - if (field == NULL) { - slang_typeinfo_destruct(&_ti); - return GL_FALSE; - } - if (!slang_type_specifier_copy(&ti->spec, &field->type.specifier)) { - slang_typeinfo_destruct(&_ti); - return GL_FALSE; - } - ti->can_be_referenced = _ti.can_be_referenced; - ti->array_len = field->array_len; - } - else { - GLuint rows; - const char *swizzle; - slang_type_specifier_type base; - - /* determine the swizzle of the field expression */ - if (!_slang_type_is_vector(_ti.spec.type)) { - slang_typeinfo_destruct(&_ti); - slang_info_log_error(log, "Can't swizzle scalar expression"); - return GL_FALSE; - } - rows = _slang_type_dim(_ti.spec.type); - swizzle = slang_atom_pool_id(atoms, op->a_id); - if (!_slang_is_swizzle(swizzle, rows, &ti->swz)) { - slang_typeinfo_destruct(&_ti); - slang_info_log_error(log, "bad swizzle '%s'", swizzle); - return GL_FALSE; - } - ti->is_swizzled = GL_TRUE; - ti->can_be_referenced = _ti.can_be_referenced - && _slang_is_swizzle_mask(&ti->swz, rows); - if (_ti.is_swizzled) { - slang_swizzle swz; - - /* swizzle the swizzle */ - _slang_multiply_swizzles(&swz, &_ti.swz, &ti->swz); - ti->swz = swz; - } - base = _slang_type_base(_ti.spec.type); - switch (ti->swz.num_components) { - case 1: - ti->spec.type = base; - break; - case 2: - switch (base) { - case SLANG_SPEC_FLOAT: - ti->spec.type = SLANG_SPEC_VEC2; - break; - case SLANG_SPEC_INT: - ti->spec.type = SLANG_SPEC_IVEC2; - break; - case SLANG_SPEC_BOOL: - ti->spec.type = SLANG_SPEC_BVEC2; - break; - default: - break; - } - break; - case 3: - switch (base) { - case SLANG_SPEC_FLOAT: - ti->spec.type = SLANG_SPEC_VEC3; - break; - case SLANG_SPEC_INT: - ti->spec.type = SLANG_SPEC_IVEC3; - break; - case SLANG_SPEC_BOOL: - ti->spec.type = SLANG_SPEC_BVEC3; - break; - default: - break; - } - break; - case 4: - switch (base) { - case SLANG_SPEC_FLOAT: - ti->spec.type = SLANG_SPEC_VEC4; - break; - case SLANG_SPEC_INT: - ti->spec.type = SLANG_SPEC_IVEC4; - break; - case SLANG_SPEC_BOOL: - ti->spec.type = SLANG_SPEC_BVEC4; - break; - default: - break; - } - break; - default: - break; - } - } - slang_typeinfo_destruct(&_ti); - } - break; - case SLANG_OPER_POSTINCREMENT: - case SLANG_OPER_POSTDECREMENT: - if (!_slang_typeof_operation(op->children, space, ti, atoms, log)) - return GL_FALSE; - ti->can_be_referenced = GL_FALSE; - ti->is_swizzled = GL_FALSE; - break; - default: - return GL_FALSE; - } - - return GL_TRUE; -} - - -/** - * Determine if a type is a matrix. - * \return GL_TRUE if is a matrix, GL_FALSE otherwise. - */ -GLboolean -_slang_type_is_matrix(slang_type_specifier_type ty) -{ - switch (ty) { - case SLANG_SPEC_MAT2: - case SLANG_SPEC_MAT3: - case SLANG_SPEC_MAT4: - case SLANG_SPEC_MAT23: - case SLANG_SPEC_MAT32: - case SLANG_SPEC_MAT24: - case SLANG_SPEC_MAT42: - case SLANG_SPEC_MAT34: - case SLANG_SPEC_MAT43: - return GL_TRUE; - default: - return GL_FALSE; - } -} - - -/** - * Determine if a type is a vector. - * \return GL_TRUE if is a vector, GL_FALSE otherwise. - */ -GLboolean -_slang_type_is_vector(slang_type_specifier_type ty) -{ - switch (ty) { - case SLANG_SPEC_VEC2: - case SLANG_SPEC_VEC3: - case SLANG_SPEC_VEC4: - case SLANG_SPEC_IVEC2: - case SLANG_SPEC_IVEC3: - case SLANG_SPEC_IVEC4: - case SLANG_SPEC_BVEC2: - case SLANG_SPEC_BVEC3: - case SLANG_SPEC_BVEC4: - return GL_TRUE; - default: - return GL_FALSE; - } -} - - -/** - * Determine if a type is a float, float vector or float matrix. - * \return GL_TRUE if so, GL_FALSE otherwise - */ -GLboolean -_slang_type_is_float_vec_mat(slang_type_specifier_type ty) -{ - switch (ty) { - case SLANG_SPEC_FLOAT: - case SLANG_SPEC_VEC2: - case SLANG_SPEC_VEC3: - case SLANG_SPEC_VEC4: - case SLANG_SPEC_MAT2: - case SLANG_SPEC_MAT3: - case SLANG_SPEC_MAT4: - case SLANG_SPEC_MAT23: - case SLANG_SPEC_MAT32: - case SLANG_SPEC_MAT24: - case SLANG_SPEC_MAT42: - case SLANG_SPEC_MAT34: - case SLANG_SPEC_MAT43: - return GL_TRUE; - default: - return GL_FALSE; - } -} - - -/** - * Given a vector type, return the type of the vector's elements. - * For a matrix, return the type of the columns. - */ -slang_type_specifier_type -_slang_type_base(slang_type_specifier_type ty) -{ - switch (ty) { - case SLANG_SPEC_FLOAT: - case SLANG_SPEC_VEC2: - case SLANG_SPEC_VEC3: - case SLANG_SPEC_VEC4: - return SLANG_SPEC_FLOAT; - case SLANG_SPEC_INT: - case SLANG_SPEC_IVEC2: - case SLANG_SPEC_IVEC3: - case SLANG_SPEC_IVEC4: - return SLANG_SPEC_INT; - case SLANG_SPEC_BOOL: - case SLANG_SPEC_BVEC2: - case SLANG_SPEC_BVEC3: - case SLANG_SPEC_BVEC4: - return SLANG_SPEC_BOOL; - case SLANG_SPEC_MAT2: - return SLANG_SPEC_VEC2; - case SLANG_SPEC_MAT3: - return SLANG_SPEC_VEC3; - case SLANG_SPEC_MAT4: - return SLANG_SPEC_VEC4; - case SLANG_SPEC_MAT23: - return SLANG_SPEC_VEC3; - case SLANG_SPEC_MAT32: - return SLANG_SPEC_VEC2; - case SLANG_SPEC_MAT24: - return SLANG_SPEC_VEC4; - case SLANG_SPEC_MAT42: - return SLANG_SPEC_VEC2; - case SLANG_SPEC_MAT34: - return SLANG_SPEC_VEC4; - case SLANG_SPEC_MAT43: - return SLANG_SPEC_VEC3; - default: - return SLANG_SPEC_VOID; - } -} - - -/** - * Return the dimensionality of a vector, or for a matrix, return number - * of columns. - */ -GLuint -_slang_type_dim(slang_type_specifier_type ty) -{ - switch (ty) { - case SLANG_SPEC_FLOAT: - case SLANG_SPEC_INT: - case SLANG_SPEC_BOOL: - return 1; - case SLANG_SPEC_VEC2: - case SLANG_SPEC_IVEC2: - case SLANG_SPEC_BVEC2: - case SLANG_SPEC_MAT2: - return 2; - case SLANG_SPEC_VEC3: - case SLANG_SPEC_IVEC3: - case SLANG_SPEC_BVEC3: - case SLANG_SPEC_MAT3: - return 3; - case SLANG_SPEC_VEC4: - case SLANG_SPEC_IVEC4: - case SLANG_SPEC_BVEC4: - case SLANG_SPEC_MAT4: - return 4; - - case SLANG_SPEC_MAT23: - return 2; - case SLANG_SPEC_MAT32: - return 3; - case SLANG_SPEC_MAT24: - return 2; - case SLANG_SPEC_MAT42: - return 4; - case SLANG_SPEC_MAT34: - return 3; - case SLANG_SPEC_MAT43: - return 4; - - default: - return 0; - } -} - - -/** - * Return the GL_* type that corresponds to a SLANG_SPEC_* type. - */ -GLenum -_slang_gltype_from_specifier(const slang_type_specifier *type) -{ - switch (type->type) { - case SLANG_SPEC_BOOL: - return GL_BOOL; - case SLANG_SPEC_BVEC2: - return GL_BOOL_VEC2; - case SLANG_SPEC_BVEC3: - return GL_BOOL_VEC3; - case SLANG_SPEC_BVEC4: - return GL_BOOL_VEC4; - case SLANG_SPEC_INT: - return GL_INT; - case SLANG_SPEC_IVEC2: - return GL_INT_VEC2; - case SLANG_SPEC_IVEC3: - return GL_INT_VEC3; - case SLANG_SPEC_IVEC4: - return GL_INT_VEC4; - case SLANG_SPEC_FLOAT: - return GL_FLOAT; - case SLANG_SPEC_VEC2: - return GL_FLOAT_VEC2; - case SLANG_SPEC_VEC3: - return GL_FLOAT_VEC3; - case SLANG_SPEC_VEC4: - return GL_FLOAT_VEC4; - case SLANG_SPEC_MAT2: - return GL_FLOAT_MAT2; - case SLANG_SPEC_MAT3: - return GL_FLOAT_MAT3; - case SLANG_SPEC_MAT4: - return GL_FLOAT_MAT4; - case SLANG_SPEC_MAT23: - return GL_FLOAT_MAT2x3; - case SLANG_SPEC_MAT32: - return GL_FLOAT_MAT3x2; - case SLANG_SPEC_MAT24: - return GL_FLOAT_MAT2x4; - case SLANG_SPEC_MAT42: - return GL_FLOAT_MAT4x2; - case SLANG_SPEC_MAT34: - return GL_FLOAT_MAT3x4; - case SLANG_SPEC_MAT43: - return GL_FLOAT_MAT4x3; - case SLANG_SPEC_SAMPLER_1D: - return GL_SAMPLER_1D; - case SLANG_SPEC_SAMPLER_2D: - return GL_SAMPLER_2D; - case SLANG_SPEC_SAMPLER_3D: - return GL_SAMPLER_3D; - case SLANG_SPEC_SAMPLER_CUBE: - return GL_SAMPLER_CUBE; - case SLANG_SPEC_SAMPLER_1D_SHADOW: - return GL_SAMPLER_1D_SHADOW; - case SLANG_SPEC_SAMPLER_2D_SHADOW: - return GL_SAMPLER_2D_SHADOW; - case SLANG_SPEC_SAMPLER_RECT: - return GL_SAMPLER_2D_RECT_ARB; - case SLANG_SPEC_SAMPLER_RECT_SHADOW: - return GL_SAMPLER_2D_RECT_SHADOW_ARB; - case SLANG_SPEC_SAMPLER_1D_ARRAY: - return GL_SAMPLER_1D_ARRAY_EXT; - case SLANG_SPEC_SAMPLER_2D_ARRAY: - return GL_SAMPLER_2D_ARRAY_EXT; - case SLANG_SPEC_SAMPLER_1D_ARRAY_SHADOW: - return GL_SAMPLER_1D_ARRAY_SHADOW_EXT; - case SLANG_SPEC_SAMPLER_2D_ARRAY_SHADOW: - return GL_SAMPLER_2D_ARRAY_SHADOW_EXT; - case SLANG_SPEC_ARRAY: - return _slang_gltype_from_specifier(type->_array); - case SLANG_SPEC_STRUCT: - /* fall-through */ - default: - return GL_NONE; - } -} - diff --git a/src/mesa/slang/slang_typeinfo.h b/src/mesa/slang/slang_typeinfo.h deleted file mode 100644 index 5ddfe9612c..0000000000 --- a/src/mesa/slang/slang_typeinfo.h +++ /dev/null @@ -1,263 +0,0 @@ -/* - * Mesa 3-D graphics library - * Version: 6.5 - * - * Copyright (C) 2005-2006 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 SLANG_TYPEINFO_H -#define SLANG_TYPEINFO_H 1 - -#include "main/glheader.h" -#include "slang_log.h" -#include "slang_utility.h" - - -struct slang_operation_; - -struct slang_name_space_; - - - -/** - * Holds complete information about vector swizzle - the - * array contains vector component source indices, where 0 is "x", 1 - * is "y", 2 is "z" and 3 is "w". - * Example: "xwz" --> { 3, { 0, 3, 2, not used } }. - */ -typedef struct slang_swizzle_ -{ - GLuint num_components; - GLuint swizzle[4]; -} slang_swizzle; - -extern GLboolean -_slang_is_swizzle(const char *field, GLuint rows, slang_swizzle *swz); - - -typedef enum slang_type_variant_ -{ - SLANG_VARIANT, /* the default */ - SLANG_INVARIANT /* indicates the "invariant" keyword */ -} slang_type_variant; - - -typedef enum slang_type_centroid_ -{ - SLANG_CENTER, /* the default */ - SLANG_CENTROID /* indicates the "centroid" keyword */ -} slang_type_centroid; - - -/** - * These only apply to gl_FragCoord, but other layout qualifiers may - * appear in the future. - */ -typedef enum slang_layout_qualifier_ -{ - SLANG_LAYOUT_NONE = 0x0, - SLANG_LAYOUT_UPPER_LEFT_BIT = 0x1, - SLANG_LAYOUT_PIXEL_CENTER_INTEGER_BIT = 0x2 -} slang_layout_qualifier; - - -typedef enum slang_type_qualifier_ -{ - SLANG_QUAL_NONE, - SLANG_QUAL_CONST, - SLANG_QUAL_ATTRIBUTE, - SLANG_QUAL_VARYING, - SLANG_QUAL_UNIFORM, - SLANG_QUAL_OUT, - SLANG_QUAL_INOUT, - SLANG_QUAL_FIXEDOUTPUT, /* internal */ - SLANG_QUAL_FIXEDINPUT /* internal */ -} slang_type_qualifier; - -typedef enum slang_varying_kind_ -{ - SLANG_VARYING_IN, - SLANG_VARYING_OUT, -} slang_varying_kind; - -typedef enum slang_type_precision_ -{ - SLANG_PREC_DEFAULT, - SLANG_PREC_LOW, - SLANG_PREC_MEDIUM, - SLANG_PREC_HIGH -} slang_type_precision; - - -/** - * The basic shading language types (float, vec4, mat3, etc) - */ -typedef enum slang_type_specifier_type_ -{ - SLANG_SPEC_VOID, - SLANG_SPEC_BOOL, - SLANG_SPEC_BVEC2, - SLANG_SPEC_BVEC3, - SLANG_SPEC_BVEC4, - SLANG_SPEC_INT, - SLANG_SPEC_IVEC2, - SLANG_SPEC_IVEC3, - SLANG_SPEC_IVEC4, - SLANG_SPEC_FLOAT, - SLANG_SPEC_VEC2, - SLANG_SPEC_VEC3, - SLANG_SPEC_VEC4, - SLANG_SPEC_MAT2, - SLANG_SPEC_MAT3, - SLANG_SPEC_MAT4, - SLANG_SPEC_MAT23, - SLANG_SPEC_MAT32, - SLANG_SPEC_MAT24, - SLANG_SPEC_MAT42, - SLANG_SPEC_MAT34, - SLANG_SPEC_MAT43, - SLANG_SPEC_SAMPLER_1D, - SLANG_SPEC_SAMPLER_2D, - SLANG_SPEC_SAMPLER_3D, - SLANG_SPEC_SAMPLER_CUBE, - SLANG_SPEC_SAMPLER_RECT, - SLANG_SPEC_SAMPLER_1D_SHADOW, - SLANG_SPEC_SAMPLER_2D_SHADOW, - SLANG_SPEC_SAMPLER_RECT_SHADOW, - SLANG_SPEC_SAMPLER_1D_ARRAY, - SLANG_SPEC_SAMPLER_2D_ARRAY, - SLANG_SPEC_SAMPLER_1D_ARRAY_SHADOW, - SLANG_SPEC_SAMPLER_2D_ARRAY_SHADOW, - SLANG_SPEC_STRUCT, - SLANG_SPEC_ARRAY -} slang_type_specifier_type; - - -extern slang_type_specifier_type -slang_type_specifier_type_from_string(const char *); - -extern const char * -slang_type_specifier_type_to_string(slang_type_specifier_type); - - -/** - * Describes more sophisticated types, like structs and arrays. - */ -typedef struct slang_type_specifier_ -{ - slang_type_specifier_type type; - struct slang_struct_ *_struct; /**< if type == SLANG_SPEC_STRUCT */ - struct slang_type_specifier_ *_array; /**< if type == SLANG_SPEC_ARRAY */ -} slang_type_specifier; - - -extern GLvoid -slang_type_specifier_ctr(slang_type_specifier *); - -extern GLvoid -slang_type_specifier_dtr(slang_type_specifier *); - -extern slang_type_specifier * -slang_type_specifier_new(slang_type_specifier_type type, - struct slang_struct_ *_struct, - struct slang_type_specifier_ *_array); - - -extern GLboolean -slang_type_specifier_copy(slang_type_specifier *, const slang_type_specifier *); - -extern GLboolean -slang_type_specifier_equal(const slang_type_specifier *, - const slang_type_specifier *); - - -extern GLboolean -slang_type_specifier_compatible(const slang_type_specifier *x, - const slang_type_specifier *y); - - -typedef struct slang_fully_specified_type_ -{ - slang_type_qualifier qualifier; - slang_type_specifier specifier; - slang_type_precision precision; - slang_type_variant variant; - slang_type_centroid centroid; - slang_layout_qualifier layout; - GLint array_len; /**< -1 if not an array type */ - slang_varying_kind varying_kind; -} slang_fully_specified_type; - -extern int -slang_fully_specified_type_construct(slang_fully_specified_type *); - -extern void -slang_fully_specified_type_destruct(slang_fully_specified_type *); - -extern int -slang_fully_specified_type_copy(slang_fully_specified_type *, - const slang_fully_specified_type *); - -GLboolean -slang_fully_specified_types_compatible(const slang_fully_specified_type * x, - const slang_fully_specified_type * y); - - -typedef struct slang_typeinfo_ -{ - GLboolean can_be_referenced; - GLboolean is_swizzled; - slang_swizzle swz; - slang_type_specifier spec; - GLuint array_len; -} slang_typeinfo; - -extern GLboolean -slang_typeinfo_construct(slang_typeinfo *); - -extern GLvoid -slang_typeinfo_destruct(slang_typeinfo *); - - -extern GLboolean -_slang_typeof_operation(struct slang_operation_ *, - const struct slang_name_space_ *, - slang_typeinfo *, slang_atom_pool *, - slang_info_log *log); - -extern GLboolean -_slang_type_is_matrix(slang_type_specifier_type); - -extern GLboolean -_slang_type_is_vector(slang_type_specifier_type); - -extern GLboolean -_slang_type_is_float_vec_mat(slang_type_specifier_type); - -extern slang_type_specifier_type -_slang_type_base(slang_type_specifier_type); - -extern GLuint -_slang_type_dim(slang_type_specifier_type); - -extern GLenum -_slang_gltype_from_specifier(const slang_type_specifier *type); - -#endif diff --git a/src/mesa/slang/slang_utility.c b/src/mesa/slang/slang_utility.c deleted file mode 100644 index c1d57409a4..0000000000 --- a/src/mesa/slang/slang_utility.c +++ /dev/null @@ -1,228 +0,0 @@ -/* - * Mesa 3-D graphics library - * Version: 6.5.3 - * - * Copyright (C) 2005-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. - */ - -/** - * \file slang_utility.c - * slang utilities - * \author Michal Krol - */ - -#include "main/imports.h" -#include "slang_utility.h" -#include "slang_mem.h" - -char * -slang_string_concat (char *dst, const char *src) -{ - return strcpy (dst + strlen (dst), src); -} - - -/* slang_string */ - -GLvoid -slang_string_init (slang_string *self) -{ - self->data = NULL; - self->capacity = 0; - self->length = 0; - self->fail = GL_FALSE; -} - -GLvoid -slang_string_free (slang_string *self) -{ - if (self->data != NULL) - free(self->data); -} - -GLvoid -slang_string_reset (slang_string *self) -{ - self->length = 0; - self->fail = GL_FALSE; -} - -static GLboolean -grow (slang_string *self, GLuint size) -{ - if (self->fail) - return GL_FALSE; - if (size > self->capacity) { - /* do not overflow 32-bit range */ - assert (size < 0x80000000); - - self->data = (char *) (_mesa_realloc (self->data, self->capacity, size * 2)); - self->capacity = size * 2; - if (self->data == NULL) { - self->capacity = 0; - self->fail = GL_TRUE; - return GL_FALSE; - } - } - return GL_TRUE; -} - -GLvoid -slang_string_push (slang_string *self, const slang_string *str) -{ - if (str->fail) { - self->fail = GL_TRUE; - return; - } - if (grow (self, self->length + str->length)) { - memcpy (&self->data[self->length], str->data, str->length); - self->length += str->length; - } -} - -GLvoid -slang_string_pushc (slang_string *self, const char c) -{ - if (grow (self, self->length + 1)) { - self->data[self->length] = c; - self->length++; - } -} - -GLvoid -slang_string_pushs (slang_string *self, const char *cstr, GLuint len) -{ - if (grow (self, self->length + len)) { - memcpy (&self->data[self->length], cstr, len); - self->length += len; - } -} - -GLvoid -slang_string_pushi (slang_string *self, GLint i) -{ - char buffer[12]; - - _mesa_snprintf (buffer, sizeof(buffer), "%d", i); - slang_string_pushs (self, buffer, strlen (buffer)); -} - -const char * -slang_string_cstr (slang_string *self) -{ - if (grow (self, self->length + 1)) - self->data[self->length] = '\0'; - return self->data; -} - -/* slang_atom_pool */ - -void -slang_atom_pool_construct(slang_atom_pool * pool) -{ - GLuint i; - - for (i = 0; i < SLANG_ATOM_POOL_SIZE; i++) - pool->entries[i] = NULL; -} - -void -slang_atom_pool_destruct (slang_atom_pool * pool) -{ - GLuint i; - - for (i = 0; i < SLANG_ATOM_POOL_SIZE; i++) { - slang_atom_entry * entry; - - entry = pool->entries[i]; - while (entry != NULL) { - slang_atom_entry *next = entry->next; - _slang_free(entry->id); - _slang_free(entry); - entry = next; - } - } -} - -/* - * Search the atom pool for an atom with a given name. - * If atom is not found, create and add it to the pool. - * Returns ATOM_NULL if the atom was not found and the function failed - * to create a new atom. - */ -slang_atom -slang_atom_pool_atom(slang_atom_pool * pool, const char * id) -{ - GLuint hash; - const char * p = id; - slang_atom_entry ** entry; - - /* Hash a given string to a number in the range [0, ATOM_POOL_SIZE). */ - hash = 0; - while (*p != '\0') { - GLuint g; - - hash = (hash << 4) + (GLuint) (*p++); - g = hash & 0xf0000000; - if (g != 0) - hash ^= g >> 24; - hash &= ~g; - } - hash %= SLANG_ATOM_POOL_SIZE; - - /* Now the hash points to a linked list of atoms with names that - * have the same hash value. Search the linked list for a given - * name. - */ - entry = &pool->entries[hash]; - while (*entry != NULL) { - /* If the same, return the associated atom. */ - if (slang_string_compare((**entry).id, id) == 0) - return (slang_atom) (**entry).id; - /* Grab the next atom in the linked list. */ - entry = &(**entry).next; - } - - /* Okay, we have not found an atom. Create a new entry for it. - * Note that the points to the last entry's field. - */ - *entry = (slang_atom_entry *) _slang_alloc(sizeof(slang_atom_entry)); - if (*entry == NULL) - return SLANG_ATOM_NULL; - - /* Initialize a new entry. Because we'll need the actual name of - * the atom, we use the pointer to this string as an actual atom's - * value. - */ - (**entry).next = NULL; - (**entry).id = _slang_strdup(id); - if ((**entry).id == NULL) - return SLANG_ATOM_NULL; - return (slang_atom) (**entry).id; -} - -/** - * Return the name of a given atom. - */ -const char * -slang_atom_pool_id(slang_atom_pool * pool, slang_atom atom) -{ - return (const char *) (atom); -} diff --git a/src/mesa/slang/slang_utility.h b/src/mesa/slang/slang_utility.h deleted file mode 100644 index cb9b6d2aaa..0000000000 --- a/src/mesa/slang/slang_utility.h +++ /dev/null @@ -1,102 +0,0 @@ -/* - * Mesa 3-D graphics library - * Version: 6.5.3 - * - * Copyright (C) 2005-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 SLANG_UTILITY_H -#define SLANG_UTILITY_H - - -#include "main/glheader.h" - -/* Compile-time assertions. If the expression is zero, try to declare an - * array of size [-1] to cause compilation error. - */ -#define static_assert(expr) do { int _array[(expr) ? 1 : -1]; (void) _array[0]; } while (0) - - -#define slang_string_compare(str1, str2) strcmp (str1, str2) -#define slang_string_copy(dst, src) strcpy (dst, src) -#define slang_string_length(str) strlen (str) - -char *slang_string_concat (char *, const char *); - -/* slang_string */ - -typedef struct -{ - char *data; - GLuint length; - GLuint capacity; - GLboolean fail; -} slang_string; - -GLvoid -slang_string_init (slang_string *); - -GLvoid -slang_string_free (slang_string *); - -GLvoid -slang_string_reset (slang_string *); - -GLvoid -slang_string_push (slang_string *, const slang_string *); - -GLvoid -slang_string_pushc (slang_string *, const char); - -GLvoid -slang_string_pushs (slang_string *, const char *, GLuint); - -GLvoid -slang_string_pushi (slang_string *, GLint); - -const char * -slang_string_cstr (slang_string *); - -/* slang_atom */ - -typedef GLvoid *slang_atom; - -#define SLANG_ATOM_NULL ((slang_atom) 0) - -typedef struct slang_atom_entry_ -{ - char *id; - struct slang_atom_entry_ *next; -} slang_atom_entry; - -#define SLANG_ATOM_POOL_SIZE 1023 - -typedef struct slang_atom_pool_ -{ - slang_atom_entry *entries[SLANG_ATOM_POOL_SIZE]; -} slang_atom_pool; - -GLvoid slang_atom_pool_construct (slang_atom_pool *); -GLvoid slang_atom_pool_destruct (slang_atom_pool *); -slang_atom slang_atom_pool_atom (slang_atom_pool *, const char *); -const char *slang_atom_pool_id (slang_atom_pool *, slang_atom); - - -#endif diff --git a/src/mesa/slang/slang_vartable.c b/src/mesa/slang/slang_vartable.c deleted file mode 100644 index 8371631578..0000000000 --- a/src/mesa/slang/slang_vartable.c +++ /dev/null @@ -1,362 +0,0 @@ - -#include "main/imports.h" -#include "program/program.h" -#include "program/prog_print.h" -#include "slang_compile.h" -#include "slang_compile_variable.h" -#include "slang_emit.h" -#include "slang_mem.h" -#include "slang_vartable.h" -#include "slang_ir.h" - - -static int dbg = 0; - - -typedef enum { - FREE, - VAR, - TEMP -} TempState; - - -/** - * Variable/register info for one variable scope. - */ -struct table -{ - int Level; - int NumVars; - slang_variable **Vars; /* array [NumVars] */ - - TempState Temps[MAX_PROGRAM_TEMPS * 4]; /* per-component state */ - int ValSize[MAX_PROGRAM_TEMPS * 4]; /**< For debug only */ - - struct table *Parent; /** Parent scope table */ -}; - - -/** - * A variable table is a stack of tables, one per scope. - */ -struct slang_var_table_ -{ - GLint CurLevel; - GLuint MaxRegisters; - struct table *Top; /**< Table at top of stack */ -}; - - - -slang_var_table * -_slang_new_var_table(GLuint maxRegisters) -{ - slang_var_table *vt - = (slang_var_table *) _slang_alloc(sizeof(slang_var_table)); - if (vt) { - vt->MaxRegisters = maxRegisters; - } - return vt; -} - - -void -_slang_delete_var_table(slang_var_table *vt) -{ - if (vt->Top) { - _mesa_problem(NULL, "non-empty var table in _slang_delete_var_table()"); - return; - } - _slang_free(vt); -} - - - -/** - * Create new table on top of vartable stack. - * Used when we enter a {} block. - */ -void -_slang_push_var_table(slang_var_table *vt) -{ - struct table *t = (struct table *) _slang_alloc(sizeof(struct table)); - if (t) { - t->Level = vt->CurLevel++; - t->Parent = vt->Top; - if (t->Parent) { - /* copy the info indicating which temp regs are in use */ - memcpy(t->Temps, t->Parent->Temps, sizeof(t->Temps)); - memcpy(t->ValSize, t->Parent->ValSize, sizeof(t->ValSize)); - } - vt->Top = t; - if (dbg) printf("Pushing level %d\n", t->Level); - } -} - - -/** - * Pop top entry from variable table. - * Used when we leave a {} block. - */ -void -_slang_pop_var_table(slang_var_table *vt) -{ - struct table *t = vt->Top; - int i; - - if (dbg) printf("Popping level %d\n", t->Level); - - /* free the storage allocated for each variable */ - for (i = 0; i < t->NumVars; i++) { - slang_ir_storage *store = t->Vars[i]->store; - GLint j; - GLuint comp; - if (dbg) printf(" Free var %s, size %d at %d.%s\n", - (char*) t->Vars[i]->a_name, store->Size, - store->Index, - _mesa_swizzle_string(store->Swizzle, 0, 0)); - - if (store->File == PROGRAM_SAMPLER) { - /* samplers have no storage */ - continue; - } - - if (store->Size == 1) - comp = GET_SWZ(store->Swizzle, 0); - else - comp = 0; - - /* store->Index may be -1 if we run out of registers */ - if (store->Index >= 0) { - for (j = 0; j < store->Size; j++) { - assert(t->Temps[store->Index * 4 + j + comp] == VAR); - t->Temps[store->Index * 4 + j + comp] = FREE; - } - } - store->Index = -1; - } - if (t->Parent) { - /* just verify that any remaining allocations in this scope - * were for temps - */ - for (i = 0; i < (int) vt->MaxRegisters * 4; i++) { - if (t->Temps[i] != FREE && t->Parent->Temps[i] == FREE) { - if (dbg) printf(" Free reg %d\n", i/4); - assert(t->Temps[i] == TEMP); - } - } - } - - if (t->Vars) { - _slang_free(t->Vars); - t->Vars = NULL; - } - - vt->Top = t->Parent; - _slang_free(t); - vt->CurLevel--; -} - - -/** - * Add a new variable to the given var/symbol table. - */ -void -_slang_add_variable(slang_var_table *vt, slang_variable *v) -{ - struct table *t; - assert(vt); - t = vt->Top; - assert(t); - if (dbg) printf("Adding var %s, store %p\n", (char *) v->a_name, (void *) v->store); - t->Vars = (slang_variable **) - _slang_realloc(t->Vars, - t->NumVars * sizeof(slang_variable *), - (t->NumVars + 1) * sizeof(slang_variable *)); - t->Vars[t->NumVars] = v; - t->NumVars++; -} - - -/** - * Look for variable by name in given table. - * If not found, Parent table will be searched. - */ -slang_variable * -_slang_find_variable(const slang_var_table *vt, slang_atom name) -{ - struct table *t = vt->Top; - while (1) { - int i; - for (i = 0; i < t->NumVars; i++) { - if (t->Vars[i]->a_name == name) - return t->Vars[i]; - } - if (t->Parent) - t = t->Parent; - else - return NULL; - } -} - - -/** - * Allocation helper. - * \param size var size in floats - * \return position for var, measured in floats - */ -static GLint -alloc_reg(slang_var_table *vt, GLint size, GLboolean isTemp) -{ - struct table *t = vt->Top; - /* if size == 1, allocate anywhere, else, pos must be multiple of 4 */ - const GLuint step = (size == 1) ? 1 : 4; - GLuint i, j; - assert(size > 0); /* number of floats */ - - for (i = 0; i <= vt->MaxRegisters * 4 - size; i += step) { - GLuint found = 0; - for (j = 0; j < (GLuint) size; j++) { - assert(i + j < 4 * MAX_PROGRAM_TEMPS); - if (i + j < vt->MaxRegisters * 4 && t->Temps[i + j] == FREE) { - found++; - } - else { - break; - } - } - if (found == size) { - /* found block of size free regs */ - if (size > 1) - assert(i % 4 == 0); - for (j = 0; j < (GLuint) size; j++) { - assert(i + j < 4 * MAX_PROGRAM_TEMPS); - t->Temps[i + j] = isTemp ? TEMP : VAR; - } - assert(i < MAX_PROGRAM_TEMPS * 4); - t->ValSize[i] = size; - return i; - } - } - - /* if we get here, we ran out of registers */ - return -1; -} - - -/** - * Allocate temp register(s) for storing a variable. - * \param size size needed, in floats - * \param swizzle returns swizzle mask for accessing var in register - * \return register allocated, or -1 - */ -GLboolean -_slang_alloc_var(slang_var_table *vt, slang_ir_storage *store) -{ - struct table *t = vt->Top; - int i; - - if (store->File == PROGRAM_SAMPLER) { - /* don't really allocate storage */ - store->Index = 0; - return GL_TRUE; - } - - i = alloc_reg(vt, store->Size, GL_FALSE); - if (i < 0) - return GL_FALSE; - - store->Index = i / 4; - store->Swizzle = _slang_var_swizzle(store->Size, i % 4); - - if (dbg) - printf("Alloc var storage sz %d at %d.%s (level %d) store %p\n", - store->Size, store->Index, - _mesa_swizzle_string(store->Swizzle, 0, 0), - t->Level, - (void*) store); - - return GL_TRUE; -} - - - -/** - * Allocate temp register(s) for storing an unnamed intermediate value. - */ -GLboolean -_slang_alloc_temp(slang_var_table *vt, slang_ir_storage *store) -{ - struct table *t = vt->Top; - const int i = alloc_reg(vt, store->Size, GL_TRUE); - if (i < 0) - return GL_FALSE; - - assert(store->Index < 0); - - store->Index = i / 4; - store->Swizzle = _slang_var_swizzle(store->Size, i % 4); - - if (dbg) printf("Alloc temp sz %d at %d.%s (level %d) store %p\n", - store->Size, store->Index, - _mesa_swizzle_string(store->Swizzle, 0, 0), t->Level, - (void *) store); - - return GL_TRUE; -} - - -void -_slang_free_temp(slang_var_table *vt, slang_ir_storage *store) -{ - struct table *t = vt->Top; - GLuint i; - GLint r = store->Index; - assert(store->Size > 0); - assert(r >= 0); - assert((GLuint)r + store->Size <= vt->MaxRegisters * 4); - if (dbg) printf("Free temp sz %d at %d.%s (level %d) store %p\n", - store->Size, r, - _mesa_swizzle_string(store->Swizzle, 0, 0), - t->Level, (void *) store); - if (store->Size == 1) { - const GLuint comp = GET_SWZ(store->Swizzle, 0); - /* we can actually fail some of these assertions because of the - * troublesome IR_SWIZZLE handling. - */ -#if 0 - assert(store->Swizzle == MAKE_SWIZZLE4(comp, comp, comp, comp)); - assert(comp < 4); - assert(t->ValSize[r * 4 + comp] == 1); -#endif - assert(t->Temps[r * 4 + comp] == TEMP); - t->Temps[r * 4 + comp] = FREE; - } - else { - /*assert(store->Swizzle == SWIZZLE_NOOP);*/ - assert(t->ValSize[r*4] == store->Size); - for (i = 0; i < (GLuint) store->Size; i++) { - assert(t->Temps[r * 4 + i] == TEMP); - t->Temps[r * 4 + i] = FREE; - } - } -} - - -GLboolean -_slang_is_temp(const slang_var_table *vt, const slang_ir_storage *store) -{ - struct table *t = vt->Top; - GLuint comp; - assert(store->Index >= 0); - assert(store->Index < (int) vt->MaxRegisters); - if (store->Swizzle == SWIZZLE_NOOP) - comp = 0; - else - comp = GET_SWZ(store->Swizzle, 0); - - if (t->Temps[store->Index * 4 + comp] == TEMP) - return GL_TRUE; - else - return GL_FALSE; -} diff --git a/src/mesa/slang/slang_vartable.h b/src/mesa/slang/slang_vartable.h deleted file mode 100644 index 97945b89d0..0000000000 --- a/src/mesa/slang/slang_vartable.h +++ /dev/null @@ -1,45 +0,0 @@ - -#ifndef SLANG_VARTABLE_H -#define SLANG_VARTABLE_H - -#include "main/glheader.h" -#include "slang_utility.h" - -struct slang_ir_storage_; - -typedef struct slang_var_table_ slang_var_table; - -struct slang_variable_; - -extern slang_var_table * -_slang_new_var_table(GLuint maxRegisters); - -extern void -_slang_delete_var_table(slang_var_table *vt); - -extern void -_slang_push_var_table(slang_var_table *parent); - -extern void -_slang_pop_var_table(slang_var_table *t); - -extern void -_slang_add_variable(slang_var_table *t, struct slang_variable_ *v); - -extern struct slang_variable_ * -_slang_find_variable(const slang_var_table *t, slang_atom name); - -extern GLboolean -_slang_alloc_var(slang_var_table *t, struct slang_ir_storage_ *store); - -extern GLboolean -_slang_alloc_temp(slang_var_table *t, struct slang_ir_storage_ *store); - -extern void -_slang_free_temp(slang_var_table *t, struct slang_ir_storage_ *store); - -extern GLboolean -_slang_is_temp(const slang_var_table *t, const struct slang_ir_storage_ *store); - - -#endif /* SLANG_VARTABLE_H */ -- cgit v1.2.3 From 5482eaba6ecd4a581377336b6409019adf67869e Mon Sep 17 00:00:00 2001 From: Nick Bowler Date: Thu, 19 Aug 2010 12:19:55 -0400 Subject: mesa: Fix GetUniformLocation while compiling display lists. This function was apparently missing from the display list dispatch table, causing the generic no-op function to be called instead. To make matters worse, the no-op function is indistinguishable from a successful call to GetUniformLocation. GL specifies that GetUniformLocation is executed immediately when compiling display lists. Fixes fdo bug 29622. Signed-off-by: Nick Bowler --- src/mesa/main/dlist.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/main/dlist.c b/src/mesa/main/dlist.c index 727414d529..5042e14a54 100644 --- a/src/mesa/main/dlist.c +++ b/src/mesa/main/dlist.c @@ -6070,8 +6070,15 @@ exec_GetAttribLocationARB(GLuint program, const GLchar *name) FLUSH_VERTICES(ctx, 0); return CALL_GetAttribLocationARB(ctx->Exec, (program, name)); } -/* XXX more shader functions needed here */ +static GLint GLAPIENTRY +exec_GetUniformLocationARB(GLuint program, const GLchar *name) +{ + GET_CURRENT_CONTEXT(ctx); + FLUSH_VERTICES(ctx, 0); + return CALL_GetUniformLocationARB(ctx->Exec, (program, name)); +} +/* XXX more shader functions needed here */ #if FEATURE_EXT_framebuffer_blit @@ -9491,6 +9498,7 @@ _mesa_create_save_table(void) /* ARB 30/31/32. GL_ARB_shader_objects, GL_ARB_vertex/fragment_shader */ SET_BindAttribLocationARB(table, exec_BindAttribLocationARB); SET_GetAttribLocationARB(table, exec_GetAttribLocationARB); + SET_GetUniformLocationARB(table, exec_GetUniformLocationARB); /* XXX additional functions need to be implemented here! */ /* 299. GL_EXT_blend_equation_separate */ -- cgit v1.2.3 From 27e6552a8fb0fd49be84fbaf9504e8371033db23 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Fri, 20 Aug 2010 12:36:34 -0700 Subject: intel: Don't try to do work for BufferSubData with a size of 0. If we hit the linear blit path, we'd come up with a pitch of 0, then divide by zero. Fixes vbo-subdata-zero, made for bug #28931 (warsow). --- src/mesa/drivers/dri/intel/intel_buffer_objects.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src') diff --git a/src/mesa/drivers/dri/intel/intel_buffer_objects.c b/src/mesa/drivers/dri/intel/intel_buffer_objects.c index 8ab41f8d27..117d4daf3b 100644 --- a/src/mesa/drivers/dri/intel/intel_buffer_objects.c +++ b/src/mesa/drivers/dri/intel/intel_buffer_objects.c @@ -202,6 +202,9 @@ intel_bufferobj_subdata(GLcontext * ctx, struct intel_context *intel = intel_context(ctx); struct intel_buffer_object *intel_obj = intel_buffer_object(obj); + if (size == 0) + return; + assert(intel_obj); if (intel_obj->region) @@ -426,6 +429,9 @@ intel_bufferobj_flush_mapped_range(GLcontext *ctx, GLenum target, if (intel_obj->range_map_buffer == NULL) return; + if (length == 0) + return; + temp_bo = drm_intel_bo_alloc(intel->bufmgr, "range map flush", length, 64); drm_intel_bo_subdata(temp_bo, 0, length, intel_obj->range_map_buffer); -- cgit v1.2.3 From c108a7927d1dad9e0f641a0ec5a7387fb2626156 Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Wed, 18 Aug 2010 12:52:55 +0200 Subject: glsl: add missing sceneColor field to gl_{Front, Back}LightModelProduct According to both GLSL 1.20 and 4.0, these are a struct with one field called "sceneColor". Fixes a crash on loading in FlightGear. --- src/mesa/program/ir_to_mesa.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp index fafc6200be..1fbf574bc8 100644 --- a/src/mesa/program/ir_to_mesa.cpp +++ b/src/mesa/program/ir_to_mesa.cpp @@ -1079,9 +1079,9 @@ static const struct { {"gl_LightModel", NULL, {STATE_LIGHTMODEL_AMBIENT, 0}, SWIZZLE_XYZW, false}, - {"gl_FrontLightModelProduct", NULL, + {"gl_FrontLightModelProduct", "sceneColor", {STATE_LIGHTMODEL_SCENECOLOR, 0}, SWIZZLE_XYZW, false}, - {"gl_BackLightModelProduct", NULL, + {"gl_BackLightModelProduct", "sceneColor", {STATE_LIGHTMODEL_SCENECOLOR, 1}, SWIZZLE_XYZW, false}, {"gl_FrontLightProduct", "ambient", -- cgit v1.2.3 From fc76d7276393a4617f9898214bc397bb65634b02 Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Wed, 18 Aug 2010 12:52:56 +0200 Subject: glsl: don't crash if a field is specified for a non-struct uniform This was triggered by the previous bug, but is a separate problem in the general sense. --- src/mesa/program/ir_to_mesa.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp index 1fbf574bc8..fe2d8982d0 100644 --- a/src/mesa/program/ir_to_mesa.cpp +++ b/src/mesa/program/ir_to_mesa.cpp @@ -1145,7 +1145,7 @@ get_builtin_uniform_reg(struct gl_program *prog, if (!field && statevars[i].field) { assert(!"FINISHME: whole-structure state var dereference"); } - if (field && strcmp(statevars[i].field, field) != 0) + if (field && (!statevars[i].field || strcmp(statevars[i].field, field) != 0)) continue; break; } -- cgit v1.2.3 From c3e3793c325e36366165a5d1403a8c406ff200db Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Wed, 18 Aug 2010 12:52:57 +0200 Subject: glsl: add missing ambient field to gl_LightModel Again, this is a one-element struct that was incorrectly missing the field. --- src/mesa/program/ir_to_mesa.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp index fe2d8982d0..58324944fe 100644 --- a/src/mesa/program/ir_to_mesa.cpp +++ b/src/mesa/program/ir_to_mesa.cpp @@ -1076,7 +1076,7 @@ static const struct { {"gl_LightSource", "quadraticAttenuation", {STATE_LIGHT, 0, STATE_ATTENUATION}, SWIZZLE_ZZZZ, true}, - {"gl_LightModel", NULL, + {"gl_LightModel", "ambient", {STATE_LIGHTMODEL_AMBIENT, 0}, SWIZZLE_XYZW, false}, {"gl_FrontLightModelProduct", "sceneColor", -- cgit v1.2.3 From d6cc7191daa249463b20e2965dc1006288539b1e Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Fri, 20 Aug 2010 12:57:21 -0700 Subject: glsl: Remove bogus "ambient" field from vec4 gl_TextureEnvColor. --- src/mesa/program/ir_to_mesa.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp index 58324944fe..9fdeaa9be3 100644 --- a/src/mesa/program/ir_to_mesa.cpp +++ b/src/mesa/program/ir_to_mesa.cpp @@ -1098,7 +1098,7 @@ static const struct { {"gl_BackLightProduct", "specular", {STATE_LIGHTPROD, 0, 1, STATE_SPECULAR}, SWIZZLE_XYZW, true}, - {"gl_TextureEnvColor", "ambient", + {"gl_TextureEnvColor", NULL, {STATE_TEXENV_COLOR, 0}, SWIZZLE_XYZW, true}, {"gl_EyePlaneS", NULL, -- cgit v1.2.3 From 7f80041efae5be95ef53b8164e67027d234f9574 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Fri, 20 Aug 2010 13:06:02 -0700 Subject: Delete more vestiges of the old shader compiler. --- src/glsl/apps/.gitignore | 5 - src/glsl/apps/Makefile | 43 ------ src/glsl/apps/compile.c | 198 ------------------------ src/glsl/apps/process.c | 388 ----------------------------------------------- src/glsl/apps/purify.c | 112 -------------- src/glsl/apps/tokenise.c | 340 ----------------------------------------- src/glsl/apps/version.c | 121 --------------- src/mesa/SConscript | 24 --- src/mesa/sources.mak | 21 --- 9 files changed, 1252 deletions(-) delete mode 100644 src/glsl/apps/.gitignore delete mode 100644 src/glsl/apps/Makefile delete mode 100644 src/glsl/apps/compile.c delete mode 100644 src/glsl/apps/process.c delete mode 100644 src/glsl/apps/purify.c delete mode 100644 src/glsl/apps/tokenise.c delete mode 100644 src/glsl/apps/version.c (limited to 'src') diff --git a/src/glsl/apps/.gitignore b/src/glsl/apps/.gitignore deleted file mode 100644 index 7e011ce7a1..0000000000 --- a/src/glsl/apps/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -compile -process -purify -tokenise -version diff --git a/src/glsl/apps/Makefile b/src/glsl/apps/Makefile deleted file mode 100644 index 39a0df7fea..0000000000 --- a/src/glsl/apps/Makefile +++ /dev/null @@ -1,43 +0,0 @@ -# src/glsl/apps/Makefile - -TOP = ../../.. - -include $(TOP)/configs/current - -LIBS = \ - $(TOP)/src/glsl/pp/libglslpp.a \ - $(TOP)/src/glsl/cl/libglslcl.a - -SOURCES = \ - compile.c \ - process.c \ - purify.c \ - tokenise.c \ - version.c - -APPS = $(SOURCES:%.c=%) - -INCLUDES = -I. - - -##### RULES ##### - -.SUFFIXES: -.SUFFIXES: .c - -.c: - $(APP_CC) $(INCLUDES) $(CFLAGS) $(LDFLAGS) $< $(LIBS) -o $@ - -.c.o: - $(APP_CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) $< -o $@ - - -##### TARGETS ##### - -default: $(APPS) - -install: - -clean: - -rm -f $(APPS) - -rm -f *.o diff --git a/src/glsl/apps/compile.c b/src/glsl/apps/compile.c deleted file mode 100644 index 5114fc9d0b..0000000000 --- a/src/glsl/apps/compile.c +++ /dev/null @@ -1,198 +0,0 @@ -/************************************************************************** - * - * Copyright 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, 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 TUNGSTEN GRAPHICS AND/OR ITS 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. - * - **************************************************************************/ - -#include -#include -#include -#include -#include "../pp/sl_pp_public.h" -#include "../pp/sl_pp_purify.h" -#include "../cl/sl_cl_parse.h" - - -static void -usage(void) -{ - printf("Usage:\n"); - printf(" compile fragment|vertex|geometry \n"); -} - -int -main(int argc, - char *argv[]) -{ - FILE *in; - long size; - char *inbuf; - struct sl_pp_purify_options options; - char errmsg[100] = ""; - struct sl_pp_context *context; - unsigned int version; - FILE *out; - unsigned char *outbytes; - unsigned int cboutbytes; - unsigned int shader_type; - - if (argc != 4) { - usage(); - return 1; - } - - if (!strcmp(argv[1], "fragment")) { - shader_type = 1; - } else if (!strcmp(argv[1], "vertex")) { - shader_type = 2; - } else if (!strcmp(argv[1], "geometry")) { - shader_type = 3; - } else { - usage(); - return 1; - } - - in = fopen(argv[2], "rb"); - if (!in) { - printf("Could not open `%s' for read.\n", argv[2]); - usage(); - return 1; - } - - fseek(in, 0, SEEK_END); - size = ftell(in); - assert(size != -1); - if (size == -1) { - return 1; - } - fseek(in, 0, SEEK_SET); - - out = fopen(argv[3], "w"); - if (!out) { - fclose(in); - printf("Could not open `%s' for write.\n", argv[3]); - usage(); - return 1; - } - - inbuf = malloc(size + 1); - if (!inbuf) { - fprintf(out, "$OOMERROR\n"); - - fclose(out); - fclose(in); - printf("Out of memory.\n"); - return 0; - } - - if (fread(inbuf, 1, size, in) != size) { - fprintf(out, "$READERROR\n"); - - free(inbuf); - fclose(out); - fclose(in); - printf("Could not read from `%s'.\n", argv[2]); - return 0; - } - inbuf[size] = '\0'; - - fclose(in); - - memset(&options, 0, sizeof(options)); - - context = sl_pp_context_create(inbuf, &options); - if (!context) { - fprintf(out, "$CONTEXERROR\n"); - - free(inbuf); - fclose(out); - printf("Could not create parse context.\n"); - return 0; - } - - if (sl_pp_version(context, &version)) { - fprintf(out, "$ERROR: `%s'\n", sl_pp_context_error_message(context)); - - printf("Error: %s\n", sl_pp_context_error_message(context)); - sl_pp_context_destroy(context); - free(inbuf); - fclose(out); - return 0; - } - - if (sl_pp_context_add_extension(context, "GL_ARB_draw_buffers") || - sl_pp_context_add_extension(context, "GL_ARB_texture_rectangle")) { - fprintf(out, "$ERROR: `%s'\n", sl_pp_context_error_message(context)); - - printf("Error: %s\n", sl_pp_context_error_message(context)); - sl_pp_context_destroy(context); - free(inbuf); - fclose(out); - return 0; - } - - if (sl_cl_compile(context, shader_type, 1, &outbytes, &cboutbytes, errmsg, sizeof(errmsg)) == 0) { - unsigned int i; - unsigned int line = 0; - - fprintf(out, "\n/* DO NOT EDIT - THIS FILE IS AUTOMATICALLY GENERATED FROM THE FOLLOWING FILE: */"); - fprintf(out, "\n/* %s */", argv[2]); - fprintf(out, "\n\n"); - - for (i = 0; i < cboutbytes; i++) { - unsigned int a; - - if (outbytes[i] < 10) { - a = 1; - } else if (outbytes[i] < 100) { - a = 2; - } else { - a = 3; - } - if (i < cboutbytes - 1) { - a++; - } - if (line + a >= 100) { - fprintf (out, "\n"); - line = 0; - } - line += a; - fprintf (out, "%u", outbytes[i]); - if (i < cboutbytes - 1) { - fprintf (out, ","); - } - } - fprintf (out, "\n"); - free(outbytes); - } else { - fprintf(out, "$SYNTAXERROR: `%s'\n", errmsg); - - printf("Error: %s\n", errmsg); - } - - sl_pp_context_destroy(context); - free(inbuf); - fclose(out); - return 0; -} diff --git a/src/glsl/apps/process.c b/src/glsl/apps/process.c deleted file mode 100644 index 6d5ce6eea3..0000000000 --- a/src/glsl/apps/process.c +++ /dev/null @@ -1,388 +0,0 @@ -/************************************************************************** - * - * Copyright 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, 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 TUNGSTEN GRAPHICS AND/OR ITS 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. - * - **************************************************************************/ - -#include -#include -#include -#include -#include "../pp/sl_pp_public.h" -#include "../pp/sl_pp_purify.h" -#include "../pp/sl_pp_token.h" - - -int -main(int argc, - char *argv[]) -{ - FILE *in; - long size; - char *inbuf; - struct sl_pp_purify_options options; - struct sl_pp_context *context; - unsigned int version; - struct sl_pp_token_info *outtokens; - FILE *out; - unsigned int i; - - if (argc != 3) { - printf("Usage: process infile outfile\n"); - return 1; - } - - in = fopen(argv[1], "rb"); - if (!in) { - return 1; - } - - fseek(in, 0, SEEK_END); - size = ftell(in); - assert(size != -1); - if (size == -1) { - return 1; - } - fseek(in, 0, SEEK_SET); - - out = fopen(argv[2], "wb"); - if (!out) { - fclose(in); - return 1; - } - - inbuf = malloc(size + 1); - if (!inbuf) { - fprintf(out, "$OOMERROR\n"); - - fclose(out); - fclose(in); - return 1; - } - - if (fread(inbuf, 1, size, in) != size) { - fprintf(out, "$READERROR\n"); - - free(inbuf); - fclose(out); - fclose(in); - return 1; - } - inbuf[size] = '\0'; - - fclose(in); - - memset(&options, 0, sizeof(options)); - - context = sl_pp_context_create(inbuf, &options); - if (!context) { - fprintf(out, "$CONTEXERROR\n"); - - free(inbuf); - fclose(out); - return 1; - } - - if (sl_pp_version(context, &version)) { - fprintf(out, "$ERROR: `%s'\n", sl_pp_context_error_message(context)); - - sl_pp_context_destroy(context); - free(inbuf); - fclose(out); - return -1; - } - - if (sl_pp_context_add_extension(context, "GL_ARB_draw_buffers") || - sl_pp_context_add_extension(context, "GL_ARB_texture_rectangle")) { - fprintf(out, "$ERROR: `%s'\n", sl_pp_context_error_message(context)); - - printf("Error: %s\n", sl_pp_context_error_message(context)); - sl_pp_context_destroy(context); - free(inbuf); - fclose(out); - return 0; - } - - if (sl_pp_context_add_predefined(context, "__GLSL_PP_PREDEFINED_MACRO_TEST", "1")) { - fprintf(out, "$ERROR: `%s'\n", sl_pp_context_error_message(context)); - - printf("Error: %s\n", sl_pp_context_error_message(context)); - sl_pp_context_destroy(context); - free(inbuf); - fclose(out); - return 0; - } - - if (sl_pp_process(context, &outtokens)) { - fprintf(out, "$ERROR: `%s'\n", sl_pp_context_error_message(context)); - - sl_pp_context_destroy(context); - free(inbuf); - fclose(out); - return -1; - } - - free(inbuf); - - for (i = 0; outtokens[i].token != SL_PP_EOF; i++) { - switch (outtokens[i].token) { - case SL_PP_NEWLINE: - fprintf(out, "\n"); - break; - - case SL_PP_COMMA: - fprintf(out, ", "); - break; - - case SL_PP_SEMICOLON: - fprintf(out, "; "); - break; - - case SL_PP_LBRACE: - fprintf(out, "{ "); - break; - - case SL_PP_RBRACE: - fprintf(out, "} "); - break; - - case SL_PP_LPAREN: - fprintf(out, "( "); - break; - - case SL_PP_RPAREN: - fprintf(out, ") "); - break; - - case SL_PP_LBRACKET: - fprintf(out, "[ "); - break; - - case SL_PP_RBRACKET: - fprintf(out, "] "); - break; - - case SL_PP_DOT: - fprintf(out, ". "); - break; - - case SL_PP_INCREMENT: - fprintf(out, "++ "); - break; - - case SL_PP_ADDASSIGN: - fprintf(out, "+= "); - break; - - case SL_PP_PLUS: - fprintf(out, "+ "); - break; - - case SL_PP_DECREMENT: - fprintf(out, "-- "); - break; - - case SL_PP_SUBASSIGN: - fprintf(out, "-= "); - break; - - case SL_PP_MINUS: - fprintf(out, "- "); - break; - - case SL_PP_BITNOT: - fprintf(out, "~ "); - break; - - case SL_PP_NOTEQUAL: - fprintf(out, "!= "); - break; - - case SL_PP_NOT: - fprintf(out, "! "); - break; - - case SL_PP_MULASSIGN: - fprintf(out, "*= "); - break; - - case SL_PP_STAR: - fprintf(out, "* "); - break; - - case SL_PP_DIVASSIGN: - fprintf(out, "/= "); - break; - - case SL_PP_SLASH: - fprintf(out, "/ "); - break; - - case SL_PP_MODASSIGN: - fprintf(out, "%%= "); - break; - - case SL_PP_MODULO: - fprintf(out, "%% "); - break; - - case SL_PP_LSHIFTASSIGN: - fprintf(out, "<<= "); - break; - - case SL_PP_LSHIFT: - fprintf(out, "<< "); - break; - - case SL_PP_LESSEQUAL: - fprintf(out, "<= "); - break; - - case SL_PP_LESS: - fprintf(out, "< "); - break; - - case SL_PP_RSHIFTASSIGN: - fprintf(out, ">>= "); - break; - - case SL_PP_RSHIFT: - fprintf(out, ">> "); - break; - - case SL_PP_GREATEREQUAL: - fprintf(out, ">= "); - break; - - case SL_PP_GREATER: - fprintf(out, "> "); - break; - - case SL_PP_EQUAL: - fprintf(out, "== "); - break; - - case SL_PP_ASSIGN: - fprintf(out, "= "); - break; - - case SL_PP_AND: - fprintf(out, "&& "); - break; - - case SL_PP_BITANDASSIGN: - fprintf(out, "&= "); - break; - - case SL_PP_BITAND: - fprintf(out, "& "); - break; - - case SL_PP_XOR: - fprintf(out, "^^ "); - break; - - case SL_PP_BITXORASSIGN: - fprintf(out, "^= "); - break; - - case SL_PP_BITXOR: - fprintf(out, "^ "); - break; - - case SL_PP_OR: - fprintf(out, "|| "); - break; - - case SL_PP_BITORASSIGN: - fprintf(out, "|= "); - break; - - case SL_PP_BITOR: - fprintf(out, "| "); - break; - - case SL_PP_QUESTION: - fprintf(out, "? "); - break; - - case SL_PP_COLON: - fprintf(out, ": "); - break; - - case SL_PP_IDENTIFIER: - fprintf(out, "%s ", sl_pp_context_cstr(context, outtokens[i].data.identifier)); - break; - - case SL_PP_UINT: - fprintf(out, "%s ", sl_pp_context_cstr(context, outtokens[i].data._uint)); - break; - - case SL_PP_FLOAT: - fprintf(out, "%s ", sl_pp_context_cstr(context, outtokens[i].data._float)); - break; - - case SL_PP_OTHER: - fprintf(out, "%c", outtokens[i].data.other); - break; - - case SL_PP_PRAGMA_OPTIMIZE: - fprintf(out, "#pragma optimize(%s)", outtokens[i].data.pragma ? "on" : "off"); - break; - - case SL_PP_PRAGMA_DEBUG: - fprintf(out, "#pragma debug(%s)", outtokens[i].data.pragma ? "on" : "off"); - break; - - case SL_PP_EXTENSION_REQUIRE: - fprintf(out, "#extension %s : require", sl_pp_context_cstr(context, outtokens[i].data.extension)); - break; - - case SL_PP_EXTENSION_ENABLE: - fprintf(out, "#extension %s : enable", sl_pp_context_cstr(context, outtokens[i].data.extension)); - break; - - case SL_PP_EXTENSION_WARN: - fprintf(out, "#extension %s : warn", sl_pp_context_cstr(context, outtokens[i].data.extension)); - break; - - case SL_PP_EXTENSION_DISABLE: - fprintf(out, "#extension %s : disable", sl_pp_context_cstr(context, outtokens[i].data.extension)); - break; - - case SL_PP_LINE: - fprintf(out, "#line %u %u", outtokens[i].data.line.lineno, outtokens[i].data.line.fileno); - break; - - default: - assert(0); - } - } - - sl_pp_context_destroy(context); - free(outtokens); - fclose(out); - - return 0; -} diff --git a/src/glsl/apps/purify.c b/src/glsl/apps/purify.c deleted file mode 100644 index e3fca59ab4..0000000000 --- a/src/glsl/apps/purify.c +++ /dev/null @@ -1,112 +0,0 @@ -/************************************************************************** - * - * Copyright 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, 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 TUNGSTEN GRAPHICS AND/OR ITS 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. - * - **************************************************************************/ - -#include -#include -#include -#include -#include "../pp/sl_pp_public.h" -#include "../pp/sl_pp_purify.h" - - -int -main(int argc, - char *argv[]) -{ - FILE *in; - long size; - char *inbuf; - struct sl_pp_purify_options options; - char *outbuf; - char errmsg[100] = ""; - unsigned int errline = 0; - FILE *out; - - if (argc != 3) { - printf("Usage: purify infile outfile\n"); - return 1; - } - - in = fopen(argv[1], "rb"); - if (!in) { - return 1; - } - - fseek(in, 0, SEEK_END); - size = ftell(in); - assert(size != -1); - if (size == -1) { - return 1; - } - fseek(in, 0, SEEK_SET); - - out = fopen(argv[2], "wb"); - if (!out) { - fclose(in); - return 1; - } - - inbuf = malloc(size + 1); - if (!inbuf) { - fprintf(out, "$OOMERROR\n"); - - fclose(out); - fclose(in); - return 1; - } - - if (fread(inbuf, 1, size, in) != size) { - fprintf(out, "$READERROR\n"); - - free(inbuf); - fclose(out); - fclose(in); - return 1; - } - inbuf[size] = '\0'; - - fclose(in); - - memset(&options, 0, sizeof(options)); - - if (sl_pp_purify(inbuf, &options, &outbuf, errmsg, sizeof(errmsg), &errline)) { - fprintf(out, "$PURIFYERROR %u: %s\n", errline, errmsg); - - free(inbuf); - fclose(out); - return 1; - } - - free(inbuf); - - fwrite(outbuf, 1, strlen(outbuf), out); - - free(outbuf); - fclose(out); - - return 0; -} diff --git a/src/glsl/apps/tokenise.c b/src/glsl/apps/tokenise.c deleted file mode 100644 index 3d68334bed..0000000000 --- a/src/glsl/apps/tokenise.c +++ /dev/null @@ -1,340 +0,0 @@ -/************************************************************************** - * - * Copyright 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, 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 TUNGSTEN GRAPHICS AND/OR ITS 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. - * - **************************************************************************/ - -#include -#include -#include -#include -#include "../pp/sl_pp_public.h" -#include "../pp/sl_pp_purify.h" -#include "../pp/sl_pp_token.h" - - -int -main(int argc, - char *argv[]) -{ - FILE *in; - long size; - char *inbuf; - struct sl_pp_purify_options options; - struct sl_pp_context *context; - struct sl_pp_token_info *tokens; - FILE *out; - unsigned int i; - - if (argc != 3) { - printf("Usage: tokenize infile outfile\n"); - return 1; - } - - in = fopen(argv[1], "rb"); - if (!in) { - return 1; - } - - fseek(in, 0, SEEK_END); - size = ftell(in); - assert(size != -1); - if (size == -1) { - return 1; - } - fseek(in, 0, SEEK_SET); - - out = fopen(argv[2], "wb"); - if (!out) { - fclose(in); - return 1; - } - - inbuf = malloc(size + 1); - if (!inbuf) { - fprintf(out, "$OOMERROR\n"); - - fclose(out); - fclose(in); - return 1; - } - - if (fread(inbuf, 1, size, in) != size) { - fprintf(out, "$READERROR\n"); - - free(inbuf); - fclose(out); - fclose(in); - return 1; - } - inbuf[size] = '\0'; - - fclose(in); - - memset(&options, 0, sizeof(options)); - - context = sl_pp_context_create(inbuf, &options); - if (!context) { - fprintf(out, "$CONTEXERROR\n"); - - free(inbuf); - fclose(out); - return 1; - } - - if (sl_pp_tokenise(context, &tokens)) { - fprintf(out, "$ERROR: `%s'\n", sl_pp_context_error_message(context)); - - sl_pp_context_destroy(context); - free(inbuf); - fclose(out); - return 1; - } - - free(inbuf); - - for (i = 0; tokens[i].token != SL_PP_EOF; i++) { - switch (tokens[i].token) { - case SL_PP_WHITESPACE: - break; - - case SL_PP_NEWLINE: - fprintf(out, "\n"); - break; - - case SL_PP_HASH: - fprintf(out, "# "); - break; - - case SL_PP_COMMA: - fprintf(out, ", "); - break; - - case SL_PP_SEMICOLON: - fprintf(out, "; "); - break; - - case SL_PP_LBRACE: - fprintf(out, "{ "); - break; - - case SL_PP_RBRACE: - fprintf(out, "} "); - break; - - case SL_PP_LPAREN: - fprintf(out, "( "); - break; - - case SL_PP_RPAREN: - fprintf(out, ") "); - break; - - case SL_PP_LBRACKET: - fprintf(out, "[ "); - break; - - case SL_PP_RBRACKET: - fprintf(out, "] "); - break; - - case SL_PP_DOT: - fprintf(out, ". "); - break; - - case SL_PP_INCREMENT: - fprintf(out, "++ "); - break; - - case SL_PP_ADDASSIGN: - fprintf(out, "+= "); - break; - - case SL_PP_PLUS: - fprintf(out, "+ "); - break; - - case SL_PP_DECREMENT: - fprintf(out, "-- "); - break; - - case SL_PP_SUBASSIGN: - fprintf(out, "-= "); - break; - - case SL_PP_MINUS: - fprintf(out, "- "); - break; - - case SL_PP_BITNOT: - fprintf(out, "~ "); - break; - - case SL_PP_NOTEQUAL: - fprintf(out, "!= "); - break; - - case SL_PP_NOT: - fprintf(out, "! "); - break; - - case SL_PP_MULASSIGN: - fprintf(out, "*= "); - break; - - case SL_PP_STAR: - fprintf(out, "* "); - break; - - case SL_PP_DIVASSIGN: - fprintf(out, "/= "); - break; - - case SL_PP_SLASH: - fprintf(out, "/ "); - break; - - case SL_PP_MODASSIGN: - fprintf(out, "%%= "); - break; - - case SL_PP_MODULO: - fprintf(out, "%% "); - break; - - case SL_PP_LSHIFTASSIGN: - fprintf(out, "<<= "); - break; - - case SL_PP_LSHIFT: - fprintf(out, "<< "); - break; - - case SL_PP_LESSEQUAL: - fprintf(out, "<= "); - break; - - case SL_PP_LESS: - fprintf(out, "< "); - break; - - case SL_PP_RSHIFTASSIGN: - fprintf(out, ">>= "); - break; - - case SL_PP_RSHIFT: - fprintf(out, ">> "); - break; - - case SL_PP_GREATEREQUAL: - fprintf(out, ">= "); - break; - - case SL_PP_GREATER: - fprintf(out, "> "); - break; - - case SL_PP_EQUAL: - fprintf(out, "== "); - break; - - case SL_PP_ASSIGN: - fprintf(out, "= "); - break; - - case SL_PP_AND: - fprintf(out, "&& "); - break; - - case SL_PP_BITANDASSIGN: - fprintf(out, "&= "); - break; - - case SL_PP_BITAND: - fprintf(out, "& "); - break; - - case SL_PP_XOR: - fprintf(out, "^^ "); - break; - - case SL_PP_BITXORASSIGN: - fprintf(out, "^= "); - break; - - case SL_PP_BITXOR: - fprintf(out, "^ "); - break; - - case SL_PP_OR: - fprintf(out, "|| "); - break; - - case SL_PP_BITORASSIGN: - fprintf(out, "|= "); - break; - - case SL_PP_BITOR: - fprintf(out, "| "); - break; - - case SL_PP_QUESTION: - fprintf(out, "? "); - break; - - case SL_PP_COLON: - fprintf(out, ": "); - break; - - case SL_PP_IDENTIFIER: - fprintf(out, "%s ", sl_pp_context_cstr(context, tokens[i].data.identifier)); - break; - - case SL_PP_UINT: - fprintf(out, "(%s) ", sl_pp_context_cstr(context, tokens[i].data._uint)); - break; - - case SL_PP_FLOAT: - fprintf(out, "(%s) ", sl_pp_context_cstr(context, tokens[i].data._float)); - break; - - case SL_PP_OTHER: - if (tokens[i].data.other == '\'') { - fprintf(out, "'\\'' "); - } else { - fprintf(out, "'%c' ", tokens[i].data.other); - } - break; - - default: - assert(0); - } - } - - sl_pp_context_destroy(context); - free(tokens); - fclose(out); - - return 0; -} diff --git a/src/glsl/apps/version.c b/src/glsl/apps/version.c deleted file mode 100644 index 8506f35ba1..0000000000 --- a/src/glsl/apps/version.c +++ /dev/null @@ -1,121 +0,0 @@ -/************************************************************************** - * - * Copyright 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, 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 TUNGSTEN GRAPHICS AND/OR ITS 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. - * - **************************************************************************/ - -#include -#include -#include -#include -#include "../pp/sl_pp_public.h" -#include "../pp/sl_pp_purify.h" - - -int -main(int argc, - char *argv[]) -{ - FILE *in; - long size; - char *inbuf; - struct sl_pp_purify_options options; - struct sl_pp_context *context; - unsigned int version; - FILE *out; - - if (argc != 3) { - printf("Usage: version infile outfile\n"); - return 1; - } - - in = fopen(argv[1], "rb"); - if (!in) { - return 1; - } - - fseek(in, 0, SEEK_END); - size = ftell(in); - assert(size != -1); - if (size == -1) { - return 1; - } - fseek(in, 0, SEEK_SET); - - out = fopen(argv[2], "wb"); - if (!out) { - fclose(in); - return 1; - } - - inbuf = malloc(size + 1); - if (!inbuf) { - fprintf(out, "$OOMERROR\n"); - - fclose(out); - fclose(in); - return 1; - } - - if (fread(inbuf, 1, size, in) != size) { - fprintf(out, "$READERROR\n"); - - free(inbuf); - fclose(out); - fclose(in); - return 1; - } - inbuf[size] = '\0'; - - fclose(in); - - memset(&options, 0, sizeof(options)); - - context = sl_pp_context_create(inbuf, &options); - if (!context) { - fprintf(out, "$CONTEXERROR\n"); - - free(inbuf); - fclose(out); - return 1; - } - - if (sl_pp_version(context, &version)) { - fprintf(out, "$ERROR: `%s'\n", sl_pp_context_error_message(context)); - - sl_pp_context_destroy(context); - free(inbuf); - fclose(out); - return -1; - } - - sl_pp_context_destroy(context); - free(inbuf); - - fprintf(out, "%u\n", version); - - fclose(out); - - return 0; -} diff --git a/src/mesa/SConscript b/src/mesa/SConscript index 41fa0645fe..28598f4a17 100644 --- a/src/mesa/SConscript +++ b/src/mesa/SConscript @@ -227,28 +227,6 @@ if env['platform'] != 'winddk': 'program/symbol_table.c', ] - slang_sources = [ - 'slang/slang_builtin.c', - 'slang/slang_codegen.c', - 'slang/slang_compile.c', - 'slang/slang_compile_function.c', - 'slang/slang_compile_operation.c', - 'slang/slang_compile_struct.c', - 'slang/slang_compile_variable.c', - 'slang/slang_emit.c', - 'slang/slang_ir.c', - 'slang/slang_label.c', - 'slang/slang_link.c', - 'slang/slang_log.c', - 'slang/slang_mem.c', - 'slang/slang_print.c', - 'slang/slang_simplify.c', - 'slang/slang_storage.c', - 'slang/slang_typeinfo.c', - 'slang/slang_vartable.c', - 'slang/slang_utility.c', - ] - mesa_sources = ( main_sources + math_sources + @@ -333,8 +311,6 @@ if env['platform'] != 'winddk': # build dir) to the include path env.Append(CPPPATH = [matypes[0].dir]) - #SConscript('slang/library/SConscript') - # # Libraries # diff --git a/src/mesa/sources.mak b/src/mesa/sources.mak index 373f1b50d0..9156024d47 100644 --- a/src/mesa/sources.mak +++ b/src/mesa/sources.mak @@ -253,27 +253,6 @@ PROGRAM_SOURCES = \ SHADER_CXX_SOURCES = \ program/ir_to_mesa.cpp -SLANG_SOURCES = \ - slang/slang_builtin.c \ - slang/slang_codegen.c \ - slang/slang_compile.c \ - slang/slang_compile_function.c \ - slang/slang_compile_operation.c \ - slang/slang_compile_struct.c \ - slang/slang_compile_variable.c \ - slang/slang_emit.c \ - slang/slang_ir.c \ - slang/slang_label.c \ - slang/slang_link.c \ - slang/slang_log.c \ - slang/slang_mem.c \ - slang/slang_print.c \ - slang/slang_simplify.c \ - slang/slang_storage.c \ - slang/slang_typeinfo.c \ - slang/slang_vartable.c \ - slang/slang_utility.c - ASM_C_SOURCES = \ x86/common_x86.c \ x86/x86_xform.c \ -- cgit v1.2.3 From 9960200d5eef97e38d5565cfc1775e3d8f7800a2 Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Sat, 21 Aug 2010 00:39:31 +0200 Subject: p_compiler: add replacement va_copy This might technically not always be correct, because va_copy might be a function, or a system might not have va_copy, and not work with assignment. Hopefully this is never the case. Without configure tests, it doesn't seem possible to do better. --- src/gallium/include/pipe/p_compiler.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src') diff --git a/src/gallium/include/pipe/p_compiler.h b/src/gallium/include/pipe/p_compiler.h index 1fa3ec8300..0a5be43f6b 100644 --- a/src/gallium/include/pipe/p_compiler.h +++ b/src/gallium/include/pipe/p_compiler.h @@ -79,6 +79,14 @@ typedef unsigned char boolean; #define FALSE false #endif +#ifndef va_copy +#ifdef __va_copy +#define va_copy(dest, src) __va_copy((dest), (src)) +#else +#define va_copy(dest, src) (dest) = (src) +#endif +#endif + /* Function inlining */ #ifndef INLINE # ifdef __cplusplus -- cgit v1.2.3 From 132b9439e287f1febbb49362671743a5b90e303c Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Sat, 21 Aug 2010 00:39:48 +0200 Subject: os_stream: fix bugs in allocation path --- src/gallium/auxiliary/os/os_stream.c | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-) (limited to 'src') diff --git a/src/gallium/auxiliary/os/os_stream.c b/src/gallium/auxiliary/os/os_stream.c index 2d4e1852ba..7b9c17c5fa 100644 --- a/src/gallium/auxiliary/os/os_stream.c +++ b/src/gallium/auxiliary/os/os_stream.c @@ -9,28 +9,20 @@ os_default_stream_vprintf (struct os_stream* stream, const char *format, va_list { char buf[1024]; int retval; - - retval = util_vsnprintf(buf, sizeof(buf), format, ap); + va_list ap2; + va_copy(ap2, ap); + retval = util_vsnprintf(buf, sizeof(buf), format, ap2); + va_end(ap2); if(retval <= 0) {} else if(retval < sizeof(buf)) stream->write(stream, buf, retval); else { - int alloc = sizeof(buf); - char* str = NULL; - for(;;) - { - alloc += alloc; - if(str) - FREE(str); - str = MALLOC(alloc); - if(!str) - return -1; - - retval = util_vsnprintf(str, alloc, format, ap); - } while(retval >= alloc); - + char* str = MALLOC(retval + 1); + if(!str) + return -1; + retval = util_vsnprintf(str, retval + 1, format, ap); if(retval > 0) stream->write(stream, str, retval); FREE(str); -- cgit v1.2.3 From b7004350fac622ce4b45a31773ac7b0c186e66d6 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 8 Jul 2010 13:16:40 -0700 Subject: i965: Fix DP write channel ordering on Sandybridge. The SIMD16 message no longer has the goofy interleaved format that made Compr4 compression necessary before. --- src/mesa/drivers/dri/i965/brw_wm_emit.c | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_wm_emit.c b/src/mesa/drivers/dri/i965/brw_wm_emit.c index f01fffbd5c..f2ace7d13d 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_emit.c +++ b/src/mesa/drivers/dri/i965/brw_wm_emit.c @@ -1294,6 +1294,7 @@ void emit_fb_write(struct brw_wm_compile *c, { struct brw_compile *p = &c->func; struct brw_context *brw = p->brw; + struct intel_context *intel = &brw->intel; GLuint nr = 2; GLuint channel; @@ -1308,8 +1309,30 @@ void emit_fb_write(struct brw_wm_compile *c, brw_push_insn_state(p); for (channel = 0; channel < 4; channel++) { - if (c->dispatch_width == 16 && brw->has_compr4) { - /* By setting the high bit of the MRF register number, we indicate + if (intel->gen >= 6) { + /* gen6 SIMD16 single source DP write looks like: + * m + 0: r0 + * m + 1: r1 + * m + 2: g0 + * m + 3: g1 + * m + 4: b0 + * m + 5: b1 + * m + 6: a0 + * m + 7: a1 + */ + brw_MOV(p, brw_message_reg(nr + channel * 2), arg0[channel]); + } else if (c->dispatch_width == 16 && brw->has_compr4) { + /* pre-gen6 SIMD16 single source DP write looks like: + * m + 0: r0 + * m + 1: g0 + * m + 2: b0 + * m + 3: a0 + * m + 4: r1 + * m + 5: g1 + * m + 6: b1 + * m + 7: a1 + * + * By setting the high bit of the MRF register number, we indicate * that we want COMPR4 mode - instead of doing the usual destination * + 1 for the second half we get destination + 4. */ -- cgit v1.2.3 From 0e2d0cc577270f86691d6bb84a50d11e3a6d0754 Mon Sep 17 00:00:00 2001 From: Zhenyu Wang Date: Fri, 20 Aug 2010 14:28:39 -0700 Subject: i965: Adjust disasm of subreg numbers to be in units of the register type. This makes reading the code easier when matching up to the specs, which also use this format. --- src/mesa/drivers/dri/i965/brw_disasm.c | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_disasm.c b/src/mesa/drivers/dri/i965/brw_disasm.c index c148dbc087..6a87babffd 100644 --- a/src/mesa/drivers/dri/i965/brw_disasm.c +++ b/src/mesa/drivers/dri/i965/brw_disasm.c @@ -236,6 +236,16 @@ char *reg_encoding[8] = { [7] = "F" }; +int reg_type_size[8] = { + [0] = 4, + [1] = 4, + [2] = 2, + [3] = 2, + [4] = 1, + [5] = 1, + [7] = 4 +}; + char *imm_encoding[8] = { [0] = "UD", [1] = "D", @@ -482,7 +492,8 @@ static int dest (FILE *file, struct brw_instruction *inst) if (err == -1) return 0; if (inst->bits1.da1.dest_subreg_nr) - format (file, ".%d", inst->bits1.da1.dest_subreg_nr); + format (file, ".%d", inst->bits1.da1.dest_subreg_nr / + reg_type_size[inst->bits1.da1.dest_reg_type]); format (file, "<%d>", inst->bits1.da1.dest_horiz_stride); err |= control (file, "dest reg encoding", reg_encoding, inst->bits1.da1.dest_reg_type, NULL); } @@ -490,7 +501,8 @@ static int dest (FILE *file, struct brw_instruction *inst) { string (file, "g[a0"); if (inst->bits1.ia1.dest_subreg_nr) - format (file, ".%d", inst->bits1.ia1.dest_subreg_nr); + format (file, ".%d", inst->bits1.ia1.dest_subreg_nr / + reg_type_size[inst->bits1.ia1.dest_reg_type]); if (inst->bits1.ia1.dest_indirect_offset) format (file, " %d", inst->bits1.ia1.dest_indirect_offset); string (file, "]"); @@ -506,7 +518,8 @@ static int dest (FILE *file, struct brw_instruction *inst) if (err == -1) return 0; if (inst->bits1.da16.dest_subreg_nr) - format (file, ".%d", inst->bits1.da16.dest_subreg_nr); + format (file, ".%d", inst->bits1.da16.dest_subreg_nr / + reg_type_size[inst->bits1.da16.dest_reg_type]); string (file, "<1>"); err |= control (file, "writemask", writemask, inst->bits1.da16.dest_writemask, NULL); err |= control (file, "dest reg encoding", reg_encoding, inst->bits1.da16.dest_reg_type, NULL); @@ -547,7 +560,7 @@ static int src_da1 (FILE *file, GLuint type, GLuint _reg_file, if (err == -1) return 0; if (sub_reg_num) - format (file, ".%d", sub_reg_num); + format (file, ".%d", sub_reg_num / reg_type_size[type]); /* use formal style like spec */ src_align1_region (file, _vert_stride, _width, _horiz_stride); err |= control (file, "src reg encoding", reg_encoding, type, NULL); return err; @@ -601,11 +614,12 @@ static int src_da16 (FILE *file, if (err == -1) return 0; if (_subreg_nr) - format (file, ".%d", _subreg_nr); + /* bit4 for subreg number byte addressing. Make this same meaning as + in da1 case, so output looks consistent. */ + format (file, ".%d", 16 / reg_type_size[_reg_type]); string (file, "<"); err |= control (file, "vert stride", vert_stride, _vert_stride, NULL); string (file, ",4,1>"); - err |= control (file, "src da16 reg type", reg_encoding, _reg_type, NULL); /* * Three kinds of swizzle display: * identity - nothing printed -- cgit v1.2.3 From da1502494b63fcd65bc60f50e59241164481f8b3 Mon Sep 17 00:00:00 2001 From: Zhenyu Wang Date: Fri, 20 Aug 2010 14:32:44 -0700 Subject: i965: Sandybridge doesn't have Compr4 mode, since it's not needed any more. --- src/mesa/drivers/dri/i965/brw_context.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_context.c b/src/mesa/drivers/dri/i965/brw_context.c index 6d064b822e..408fa0aeea 100644 --- a/src/mesa/drivers/dri/i965/brw_context.c +++ b/src/mesa/drivers/dri/i965/brw_context.c @@ -144,7 +144,8 @@ GLboolean brwCreateContext( int api, brw->CMD_VF_STATISTICS = CMD_VF_STATISTICS_GM45; brw->CMD_PIPELINE_SELECT = CMD_PIPELINE_SELECT_GM45; brw->has_surface_tile_offset = GL_TRUE; - brw->has_compr4 = GL_TRUE; + if (intel->gen < 6) + brw->has_compr4 = GL_TRUE; brw->has_aa_line_parameters = GL_TRUE; brw->has_pln = GL_TRUE; } else { -- cgit v1.2.3 From ffb5095d56c0f58a35e12d40bb4ffc869e4071bd Mon Sep 17 00:00:00 2001 From: Zhenyu Wang Date: Fri, 20 Aug 2010 14:36:46 -0700 Subject: i965: Mention the mlen and rlen for URB reads. --- src/mesa/drivers/dri/i965/brw_disasm.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_disasm.c b/src/mesa/drivers/dri/i965/brw_disasm.c index 6a87babffd..5e5db3264b 100644 --- a/src/mesa/drivers/dri/i965/brw_disasm.c +++ b/src/mesa/drivers/dri/i965/brw_disasm.c @@ -949,6 +949,11 @@ int brw_disasm (FILE *file, struct brw_instruction *inst, int gen) inst->bits3.urb.used, &space); err |= control (file, "urb complete", urb_complete, inst->bits3.urb.complete, &space); + if (gen >= 5) { + format (file, " mlen %d, rlen %d\n", + inst->bits3.urb_gen5.msg_length, + inst->bits3.urb_gen5.response_length); + } break; case BRW_MESSAGE_TARGET_THREAD_SPAWNER: break; -- cgit v1.2.3 From 93ba0055c325007656c14ba38302e21be3dc599f Mon Sep 17 00:00:00 2001 From: Zhenyu Wang Date: Fri, 20 Aug 2010 14:37:19 -0700 Subject: i965: Add AccWrCtl support on Sandybridge. Whenever the accumulator results are needed, this bit must be set. --- src/mesa/drivers/dri/i965/brw_disasm.c | 7 +++++++ src/mesa/drivers/dri/i965/brw_eu.c | 6 ++++++ src/mesa/drivers/dri/i965/brw_eu.h | 1 + src/mesa/drivers/dri/i965/brw_structs.h | 5 +++-- src/mesa/drivers/dri/i965/brw_vs_emit.c | 3 +++ 5 files changed, 20 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_disasm.c b/src/mesa/drivers/dri/i965/brw_disasm.c index 5e5db3264b..b54638058b 100644 --- a/src/mesa/drivers/dri/i965/brw_disasm.c +++ b/src/mesa/drivers/dri/i965/brw_disasm.c @@ -159,6 +159,11 @@ char *saturate[2] = { [1] = ".sat" }; +char *accwr[2] = { + [0] = "", + [1] = "AccWrEnable" +}; + char *exec_size[8] = { [0] = "1", [1] = "2", @@ -993,6 +998,8 @@ int brw_disasm (FILE *file, struct brw_instruction *inst, int gen) inst->header.compression_control, &space); } err |= control (file, "thread control", thread_ctrl, inst->header.thread_control, &space); + if (gen >= 6) + err |= control (file, "acc write control", accwr, inst->header.acc_wr_control, &space); if (inst->header.opcode == BRW_OPCODE_SEND) err |= control (file, "end of thread", end_of_thread, inst->bits3.generic.end_of_thread, &space); diff --git a/src/mesa/drivers/dri/i965/brw_eu.c b/src/mesa/drivers/dri/i965/brw_eu.c index 4e7c1226ad..2ff39e8e64 100644 --- a/src/mesa/drivers/dri/i965/brw_eu.c +++ b/src/mesa/drivers/dri/i965/brw_eu.c @@ -85,6 +85,12 @@ void brw_set_saturate( struct brw_compile *p, GLuint value ) p->current->header.saturate = value; } +void brw_set_acc_write_control(struct brw_compile *p, GLuint value) +{ + if (p->brw->intel.gen >= 6) + p->current->header.acc_wr_control = value; +} + void brw_push_insn_state( struct brw_compile *p ) { assert(p->current != &p->stack[BRW_EU_MAX_INSN_STACK-1]); diff --git a/src/mesa/drivers/dri/i965/brw_eu.h b/src/mesa/drivers/dri/i965/brw_eu.h index d15a8f9008..1ead4455d3 100644 --- a/src/mesa/drivers/dri/i965/brw_eu.h +++ b/src/mesa/drivers/dri/i965/brw_eu.h @@ -770,6 +770,7 @@ void brw_set_compression_control( struct brw_compile *p, GLboolean control ); void brw_set_predicate_control_flag_value( struct brw_compile *p, GLuint value ); void brw_set_predicate_control( struct brw_compile *p, GLuint pc ); void brw_set_conditionalmod( struct brw_compile *p, GLuint conditional ); +void brw_set_acc_write_control(struct brw_compile *p, GLuint value); void brw_init_compile( struct brw_context *, struct brw_compile *p ); const GLuint *brw_get_program( struct brw_compile *p, GLuint *sz ); diff --git a/src/mesa/drivers/dri/i965/brw_structs.h b/src/mesa/drivers/dri/i965/brw_structs.h index 2fde42a706..1d6018fa36 100644 --- a/src/mesa/drivers/dri/i965/brw_structs.h +++ b/src/mesa/drivers/dri/i965/brw_structs.h @@ -1305,13 +1305,14 @@ struct brw_instruction GLuint access_mode:1; GLuint mask_control:1; GLuint dependency_control:2; - GLuint compression_control:2; + GLuint compression_control:2; /* gen6: quater control */ GLuint thread_control:2; GLuint predicate_control:4; GLuint predicate_inverse:1; GLuint execution_size:3; GLuint destreg__conditionalmod:4; /* destreg - send, conditionalmod - others */ - GLuint pad0:2; + GLuint acc_wr_control:1; + GLuint cmpt_control:1; GLuint debug_control:1; GLuint saturate:1; } header; diff --git a/src/mesa/drivers/dri/i965/brw_vs_emit.c b/src/mesa/drivers/dri/i965/brw_vs_emit.c index 18eb845ed8..2f4653fbda 100644 --- a/src/mesa/drivers/dri/i965/brw_vs_emit.c +++ b/src/mesa/drivers/dri/i965/brw_vs_emit.c @@ -1397,6 +1397,7 @@ static void emit_vertex_write( struct brw_vs_compile *c) * of zeros followed by two sets of NDC coordinates: */ brw_set_access_mode(p, BRW_ALIGN_1); + brw_set_acc_write_control(p, 0); /* The VUE layout is documented in Volume 2a. */ if (intel->gen >= 6) { @@ -1578,6 +1579,8 @@ void brw_vs_emit(struct brw_vs_compile *c ) brw_set_access_mode(p, BRW_ALIGN_16); if_depth_in_loop[loop_depth] = 0; + brw_set_acc_write_control(p, 1); + for (insn = 0; insn < nr_insns; insn++) { GLuint i; struct prog_instruction *inst = &c->vp->program.Base.Instructions[insn]; -- cgit v1.2.3 From 35c127362f7b0c186923934f34148de319093cbf Mon Sep 17 00:00:00 2001 From: Zhenyu Wang Date: Fri, 20 Aug 2010 14:38:56 -0700 Subject: i965: Set the maximum number of threads on Sandybridge. --- src/mesa/drivers/dri/i965/brw_context.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_context.c b/src/mesa/drivers/dri/i965/brw_context.c index 408fa0aeea..d2b20165f9 100644 --- a/src/mesa/drivers/dri/i965/brw_context.c +++ b/src/mesa/drivers/dri/i965/brw_context.c @@ -154,7 +154,11 @@ GLboolean brwCreateContext( int api, } /* WM maximum threads is number of EUs times number of threads per EU. */ - if (intel->gen == 5) { + if (intel->gen >= 6) { + brw->urb.size = 1024; + brw->vs_max_threads = 60; + brw->wm_max_threads = 80; + } else if (intel->gen == 5) { brw->urb.size = 1024; brw->vs_max_threads = 72; brw->wm_max_threads = 12 * 6; -- cgit v1.2.3 From 3ce2eccbfb925a3af0b91a89a9f7a3603fa45d2d Mon Sep 17 00:00:00 2001 From: Zhenyu Wang Date: Fri, 20 Aug 2010 15:01:11 -0700 Subject: i965: Set the destination horiz stride even for da16, as SNB seems to need it. --- src/mesa/drivers/dri/i965/brw_eu_emit.c | 4 ++++ src/mesa/drivers/dri/i965/brw_structs.h | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_eu_emit.c b/src/mesa/drivers/dri/i965/brw_eu_emit.c index 0d5d17f501..523f119f43 100644 --- a/src/mesa/drivers/dri/i965/brw_eu_emit.c +++ b/src/mesa/drivers/dri/i965/brw_eu_emit.c @@ -75,6 +75,8 @@ static void brw_set_dest( struct brw_instruction *insn, else { insn->bits1.da16.dest_subreg_nr = dest.subnr / 16; insn->bits1.da16.dest_writemask = dest.dw1.bits.writemask; + /* even ignored in da16, still need to set as '01' */ + insn->bits1.da16.dest_horiz_stride = 1; } } else { @@ -90,6 +92,8 @@ static void brw_set_dest( struct brw_instruction *insn, } else { insn->bits1.ia16.dest_indirect_offset = dest.dw1.bits.indirect_offset; + /* even ignored in da16, still need to set as '01' */ + insn->bits1.ia16.dest_horiz_stride = 1; } } diff --git a/src/mesa/drivers/dri/i965/brw_structs.h b/src/mesa/drivers/dri/i965/brw_structs.h index 1d6018fa36..cdd2998627 100644 --- a/src/mesa/drivers/dri/i965/brw_structs.h +++ b/src/mesa/drivers/dri/i965/brw_structs.h @@ -1360,7 +1360,7 @@ struct brw_instruction GLuint dest_writemask:4; GLuint dest_subreg_nr:1; GLuint dest_reg_nr:8; - GLuint pad1:2; + GLuint dest_horiz_stride:2; GLuint dest_address_mode:1; } da16; @@ -1374,7 +1374,7 @@ struct brw_instruction GLuint dest_writemask:4; GLint dest_indirect_offset:6; GLuint dest_subreg_nr:3; - GLuint pad1:2; + GLuint dest_horiz_stride:2; GLuint dest_address_mode:1; } ia16; } bits1; -- cgit v1.2.3 From 5266c0a0c82de625ccac57e7559f57399f761e9e Mon Sep 17 00:00:00 2001 From: Zhenyu Wang Date: Fri, 20 Aug 2010 15:02:19 -0700 Subject: i965: Add support for FB writes on Sandybridge. --- src/mesa/drivers/dri/i965/brw_eu_emit.c | 52 ++++++++++++++++++++++++++------- src/mesa/drivers/dri/i965/brw_wm_emit.c | 34 +++++++++++++++++++-- 2 files changed, 74 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_eu_emit.c b/src/mesa/drivers/dri/i965/brw_eu_emit.c index 523f119f43..c9b4770fd9 100644 --- a/src/mesa/drivers/dri/i965/brw_eu_emit.c +++ b/src/mesa/drivers/dri/i965/brw_eu_emit.c @@ -372,9 +372,23 @@ static void brw_set_dp_write_message( struct brw_context *brw, GLuint send_commit_msg) { struct intel_context *intel = &brw->intel; - brw_set_src1(insn, brw_imm_d(0)); + brw_set_src1(insn, brw_imm_ud(0)); - if (intel->gen == 5) { + if (intel->gen >= 6) { + insn->bits3.dp_render_cache.binding_table_index = binding_table_index; + insn->bits3.dp_render_cache.msg_control = msg_control; + insn->bits3.dp_render_cache.pixel_scoreboard_clear = pixel_scoreboard_clear; + insn->bits3.dp_render_cache.msg_type = msg_type; + insn->bits3.dp_render_cache.send_commit_msg = send_commit_msg; + insn->bits3.dp_render_cache.header_present = 0; /* XXX */ + insn->bits3.dp_render_cache.response_length = response_length; + insn->bits3.dp_render_cache.msg_length = msg_length; + insn->bits3.dp_render_cache.end_of_thread = end_of_thread; + insn->header.destreg__conditionalmod = BRW_MESSAGE_TARGET_DATAPORT_WRITE; + /* XXX really need below? */ + insn->bits2.send_gen5.sfid = BRW_MESSAGE_TARGET_DATAPORT_WRITE; + insn->bits2.send_gen5.end_of_thread = end_of_thread; + } else if (intel->gen == 5) { insn->bits3.dp_write_gen5.binding_table_index = binding_table_index; insn->bits3.dp_write_gen5.msg_control = msg_control; insn->bits3.dp_write_gen5.pixel_scoreboard_clear = pixel_scoreboard_clear; @@ -1344,22 +1358,40 @@ void brw_fb_WRITE(struct brw_compile *p, GLuint response_length, GLboolean eot) { - struct brw_instruction *insn = next_insn(p, BRW_OPCODE_SEND); - + struct intel_context *intel = &p->brw->intel; + struct brw_instruction *insn; + GLuint msg_control, msg_type; + + insn = next_insn(p, BRW_OPCODE_SEND); insn->header.predicate_control = 0; /* XXX */ - insn->header.compression_control = BRW_COMPRESSION_NONE; - insn->header.destreg__conditionalmod = msg_reg_nr; - + insn->header.compression_control = BRW_COMPRESSION_NONE; + + if (intel->gen >= 6) { + /* headerless version, just submit color payload */ + src0 = brw_message_reg(msg_reg_nr); + + if (msg_length >= 8) + msg_control = BRW_DATAPORT_RENDER_TARGET_WRITE_SIMD16_SINGLE_SOURCE; + else + msg_control = BRW_DATAPORT_RENDER_TARGET_WRITE_SIMD8_SINGLE_SOURCE_SUBSPAN01; + msg_type = BRW_DATAPORT_WRITE_MESSAGE_RENDER_TARGET_WRITE_GEN6; + } else { + insn->header.destreg__conditionalmod = msg_reg_nr; + + msg_control = BRW_DATAPORT_RENDER_TARGET_WRITE_SIMD16_SINGLE_SOURCE; + msg_type = BRW_DATAPORT_WRITE_MESSAGE_RENDER_TARGET_WRITE; + } + brw_set_dest(insn, dest); brw_set_src0(insn, src0); brw_set_dp_write_message(p->brw, insn, binding_table_index, - BRW_DATAPORT_RENDER_TARGET_WRITE_SIMD16_SINGLE_SOURCE, /* msg_control */ - BRW_DATAPORT_WRITE_MESSAGE_RENDER_TARGET_WRITE, /* msg_type */ + msg_control, + msg_type, msg_length, 1, /* pixel scoreboard */ - response_length, + response_length, eot, 0 /* send_commit_msg */); } diff --git a/src/mesa/drivers/dri/i965/brw_wm_emit.c b/src/mesa/drivers/dri/i965/brw_wm_emit.c index f2ace7d13d..78de2ceda9 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_emit.c +++ b/src/mesa/drivers/dri/i965/brw_wm_emit.c @@ -1230,6 +1230,7 @@ static void fire_fb_write( struct brw_wm_compile *c, GLuint eot ) { struct brw_compile *p = &c->func; + struct intel_context *intel = &p->brw->intel; struct brw_reg dst; if (c->dispatch_width == 16) @@ -1240,6 +1241,7 @@ static void fire_fb_write( struct brw_wm_compile *c, /* Pass through control information: */ /* mov (8) m1.0<1>:ud r1.0<8;8,1>:ud { Align1 NoMask } */ + if (intel->gen < 6) /* gen6, use headerless for fb write */ { brw_push_insn_state(p); brw_set_mask_control(p, BRW_MASK_DISABLE); /* ? */ @@ -1297,6 +1299,8 @@ void emit_fb_write(struct brw_wm_compile *c, struct intel_context *intel = &brw->intel; GLuint nr = 2; GLuint channel; + int step = 0; + int base_reg; /* For gen6 fb write with no header, starting from color payload directly!. */ /* Reserve a space for AA - may not be needed: */ @@ -1308,6 +1312,11 @@ void emit_fb_write(struct brw_wm_compile *c, */ brw_push_insn_state(p); + if (intel->gen >= 6) + base_reg = nr; + else + base_reg = 0; + for (channel = 0; channel < 4; channel++) { if (intel->gen >= 6) { /* gen6 SIMD16 single source DP write looks like: @@ -1339,6 +1348,16 @@ void emit_fb_write(struct brw_wm_compile *c, brw_MOV(p, brw_message_reg(nr + channel + BRW_MRF_COMPR4), arg0[channel]); + } else if (intel->gen >= 6) { + brw_set_compression_control(p, BRW_COMPRESSION_NONE); + brw_MOV(p, brw_message_reg(nr + channel + step), arg0[channel]); + if (c->dispatch_width == 16) { + brw_set_compression_control(p, BRW_COMPRESSION_NONE); + brw_MOV(p, + brw_message_reg(nr + channel + step + 1), + sechalf(arg0[channel])); + ++step; + } } else { /* mov (8) m2.0<1>:ud r28.0<8;8,1>:ud { Align1 } */ /* mov (8) m6.0<1>:ud r29.0<8;8,1>:ud { Align1 SecHalf } */ @@ -1357,7 +1376,18 @@ void emit_fb_write(struct brw_wm_compile *c, } /* skip over the regs populated above: */ - nr += 8; + if (intel->gen < 6) { + nr += 8; /* XXX: always uses SIMD16 write currently. */ + } else { + if (c->dispatch_width == 16) + nr += 8; + else + nr += 4; + + /* Subtract off the message header, since we send headerless. */ + nr -= 2; + } + brw_pop_insn_state(p); if (c->key.source_depth_to_render_target) @@ -1394,7 +1424,7 @@ void emit_fb_write(struct brw_wm_compile *c, if (c->key.aa_dest_stencil_reg) emit_aa(c, arg1, 2); - fire_fb_write(c, 0, nr, target, eot); + fire_fb_write(c, base_reg, nr, target, eot); } else { struct brw_reg v1_null_ud = vec1(retype(brw_null_reg(), BRW_REGISTER_TYPE_UD)); -- cgit v1.2.3 From e6ec500e19f455237828f4f3955f888ad0b56382 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Fri, 20 Aug 2010 15:32:17 -0700 Subject: i965: Also use the SIMD8 FB writes for SIMD8 mode on non-SNB. --- src/mesa/drivers/dri/i965/brw_eu.h | 1 + src/mesa/drivers/dri/i965/brw_eu_emit.c | 13 +++++++------ src/mesa/drivers/dri/i965/brw_wm_emit.c | 21 ++++++++++----------- 3 files changed, 18 insertions(+), 17 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_eu.h b/src/mesa/drivers/dri/i965/brw_eu.h index 1ead4455d3..6e9e210cf1 100644 --- a/src/mesa/drivers/dri/i965/brw_eu.h +++ b/src/mesa/drivers/dri/i965/brw_eu.h @@ -845,6 +845,7 @@ void brw_ff_sync(struct brw_compile *p, GLboolean eot); void brw_fb_WRITE(struct brw_compile *p, + int dispatch_width, struct brw_reg dest, GLuint msg_reg_nr, struct brw_reg src0, diff --git a/src/mesa/drivers/dri/i965/brw_eu_emit.c b/src/mesa/drivers/dri/i965/brw_eu_emit.c index c9b4770fd9..a6ca030afe 100644 --- a/src/mesa/drivers/dri/i965/brw_eu_emit.c +++ b/src/mesa/drivers/dri/i965/brw_eu_emit.c @@ -1350,6 +1350,7 @@ void brw_dp_READ_4_vs_relative(struct brw_compile *p, void brw_fb_WRITE(struct brw_compile *p, + int dispatch_width, struct brw_reg dest, GLuint msg_reg_nr, struct brw_reg src0, @@ -1370,18 +1371,18 @@ void brw_fb_WRITE(struct brw_compile *p, /* headerless version, just submit color payload */ src0 = brw_message_reg(msg_reg_nr); - if (msg_length >= 8) - msg_control = BRW_DATAPORT_RENDER_TARGET_WRITE_SIMD16_SINGLE_SOURCE; - else - msg_control = BRW_DATAPORT_RENDER_TARGET_WRITE_SIMD8_SINGLE_SOURCE_SUBSPAN01; msg_type = BRW_DATAPORT_WRITE_MESSAGE_RENDER_TARGET_WRITE_GEN6; } else { insn->header.destreg__conditionalmod = msg_reg_nr; - msg_control = BRW_DATAPORT_RENDER_TARGET_WRITE_SIMD16_SINGLE_SOURCE; - msg_type = BRW_DATAPORT_WRITE_MESSAGE_RENDER_TARGET_WRITE; + msg_type = BRW_DATAPORT_WRITE_MESSAGE_RENDER_TARGET_WRITE; } + if (dispatch_width == 16) + msg_control = BRW_DATAPORT_RENDER_TARGET_WRITE_SIMD16_SINGLE_SOURCE; + else + msg_control = BRW_DATAPORT_RENDER_TARGET_WRITE_SIMD8_SINGLE_SOURCE_SUBSPAN01; + brw_set_dest(insn, dest); brw_set_src0(insn, src0); brw_set_dp_write_message(p->brw, diff --git a/src/mesa/drivers/dri/i965/brw_wm_emit.c b/src/mesa/drivers/dri/i965/brw_wm_emit.c index 78de2ceda9..5c07108eb8 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_emit.c +++ b/src/mesa/drivers/dri/i965/brw_wm_emit.c @@ -1255,6 +1255,7 @@ static void fire_fb_write( struct brw_wm_compile *c, /* Send framebuffer write message: */ /* send (16) null.0<1>:uw m0 r0.0<8;8,1>:uw 0x85a04000:ud { Align1 EOT } */ brw_fb_WRITE(p, + c->dispatch_width, dst, base_reg, retype(brw_vec8_grf(0, 0), BRW_REGISTER_TYPE_UW), @@ -1376,17 +1377,10 @@ void emit_fb_write(struct brw_wm_compile *c, } /* skip over the regs populated above: */ - if (intel->gen < 6) { - nr += 8; /* XXX: always uses SIMD16 write currently. */ - } else { - if (c->dispatch_width == 16) - nr += 8; - else - nr += 4; - - /* Subtract off the message header, since we send headerless. */ - nr -= 2; - } + if (c->dispatch_width == 16) + nr += 8; + else + nr += 4; brw_pop_insn_state(p); @@ -1420,6 +1414,11 @@ void emit_fb_write(struct brw_wm_compile *c, nr += 2; } + if (intel->gen >= 6) { + /* Subtract off the message header, since we send headerless. */ + nr -= 2; + } + if (!c->key.runtime_check_aads_emit) { if (c->key.aa_dest_stencil_reg) emit_aa(c, arg1, 2); -- cgit v1.2.3 From 501c9dc62774a73c080d500a1eab773b0da9577e Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 16 Aug 2010 18:35:04 -0700 Subject: i965: Rename nr_depth_regs to nr_payload_regs. Only 8 out of the up to 13 regs are for source/dest depth, so the name wasn't particularly appropriate. Note that this doesn't count the constant or URB payload regs. Also, don't pre-divide by 2, so it's actually a number of registers. --- src/mesa/drivers/dri/i965/brw_wm.h | 2 +- src/mesa/drivers/dri/i965/brw_wm_glsl.c | 6 +++--- src/mesa/drivers/dri/i965/brw_wm_iz.c | 2 +- src/mesa/drivers/dri/i965/brw_wm_pass0.c | 2 +- src/mesa/drivers/dri/i965/brw_wm_pass2.c | 4 ++-- 5 files changed, 8 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_wm.h b/src/mesa/drivers/dri/i965/brw_wm.h index 40f51c21c9..34f2d0c3d0 100644 --- a/src/mesa/drivers/dri/i965/brw_wm.h +++ b/src/mesa/drivers/dri/i965/brw_wm.h @@ -61,7 +61,7 @@ struct brw_wm_prog_key { GLuint source_depth_reg:3; GLuint aa_dest_stencil_reg:3; GLuint dest_depth_reg:3; - GLuint nr_depth_regs:3; + GLuint nr_payload_regs:4; GLuint computes_depth:1; /* could be derived from program string */ GLuint source_depth_to_render_target:1; GLuint flat_shade:1; diff --git a/src/mesa/drivers/dri/i965/brw_wm_glsl.c b/src/mesa/drivers/dri/i965/brw_wm_glsl.c index f13b0aaf95..7a31b9a837 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_glsl.c +++ b/src/mesa/drivers/dri/i965/brw_wm_glsl.c @@ -303,13 +303,13 @@ static void prealloc_reg(struct brw_wm_compile *c) c->first_free_grf = 0; for (i = 0; i < 4; i++) { - if (i < c->key.nr_depth_regs) + if (i < (c->key.nr_payload_regs + 1) / 2) reg = brw_vec8_grf(i * 2, 0); else reg = brw_vec8_grf(0, 0); set_reg(c, PROGRAM_PAYLOAD, PAYLOAD_DEPTH, i, reg); } - reg_index += 2 * c->key.nr_depth_regs; + reg_index += c->key.nr_payload_regs; /* constants */ { @@ -380,7 +380,7 @@ static void prealloc_reg(struct brw_wm_compile *c) } } - c->prog_data.first_curbe_grf = c->key.nr_depth_regs * 2; + c->prog_data.first_curbe_grf = c->key.nr_payload_regs; c->prog_data.urb_read_length = urb_read_length; c->prog_data.curb_read_length = c->nr_creg; c->emit_mask_reg = brw_uw1_reg(BRW_GENERAL_REGISTER_FILE, reg_index, 0); diff --git a/src/mesa/drivers/dri/i965/brw_wm_iz.c b/src/mesa/drivers/dri/i965/brw_wm_iz.c index 5e399ac62a..8505ef1951 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_iz.c +++ b/src/mesa/drivers/dri/i965/brw_wm_iz.c @@ -152,6 +152,6 @@ void brw_wm_lookup_iz( GLuint line_aa, reg+=2; } - key->nr_depth_regs = (reg+1)/2; + key->nr_payload_regs = reg; } diff --git a/src/mesa/drivers/dri/i965/brw_wm_pass0.c b/src/mesa/drivers/dri/i965/brw_wm_pass0.c index 05de85a957..8fc960b445 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_pass0.c +++ b/src/mesa/drivers/dri/i965/brw_wm_pass0.c @@ -379,7 +379,7 @@ static void pass0_init_payload( struct brw_wm_compile *c ) GLuint i; for (i = 0; i < 4; i++) { - GLuint j = i >= c->key.nr_depth_regs ? 0 : i; + GLuint j = i >= (c->key.nr_payload_regs + 1) / 2 ? 0 : i; pass0_set_fpreg_value( c, PROGRAM_PAYLOAD, PAYLOAD_DEPTH, i, &c->payload.depth[j] ); } diff --git a/src/mesa/drivers/dri/i965/brw_wm_pass2.c b/src/mesa/drivers/dri/i965/brw_wm_pass2.c index 31303febf0..0499506ec0 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_pass2.c +++ b/src/mesa/drivers/dri/i965/brw_wm_pass2.c @@ -76,7 +76,7 @@ static void init_registers( struct brw_wm_compile *c ) for (j = 0; j < c->grf_limit; j++) c->pass2_grf[j].nextuse = BRW_WM_MAX_INSN; - for (j = 0; j < c->key.nr_depth_regs; j++) + for (j = 0; j < (c->key.nr_payload_regs + 1) / 2; j++) prealloc_reg(c, &c->payload.depth[j], i++); for (j = 0; j < c->nr_creg; j++) @@ -101,7 +101,7 @@ static void init_registers( struct brw_wm_compile *c ) assert(nr_interp_regs >= 1); - c->prog_data.first_curbe_grf = c->key.nr_depth_regs * 2; + c->prog_data.first_curbe_grf = c->key.nr_payload_regs; c->prog_data.urb_read_length = nr_interp_regs * 2; c->prog_data.curb_read_length = c->nr_creg * 2; -- cgit v1.2.3 From 0eac4b8740d4434037677166f2339e894d4ebac4 Mon Sep 17 00:00:00 2001 From: richard Date: Fri, 20 Aug 2010 19:09:25 -0400 Subject: evergreen : initial support driver code. --- src/mesa/drivers/dri/r600/Makefile | 9 + src/mesa/drivers/dri/r600/evergreen_chip.c | 1290 ++++++++++++++ src/mesa/drivers/dri/r600/evergreen_chip.h | 516 ++++++ src/mesa/drivers/dri/r600/evergreen_context.c | 109 ++ src/mesa/drivers/dri/r600/evergreen_context.h | 38 + src/mesa/drivers/dri/r600/evergreen_diff.h | 335 ++++ src/mesa/drivers/dri/r600/evergreen_fragprog.c | 808 +++++++++ src/mesa/drivers/dri/r600/evergreen_fragprog.h | 75 + src/mesa/drivers/dri/r600/evergreen_ioctl.c | 53 + src/mesa/drivers/dri/r600/evergreen_ioctl.h | 36 + src/mesa/drivers/dri/r600/evergreen_off.h | 881 +++++++++ src/mesa/drivers/dri/r600/evergreen_oglprog.c | 193 ++ src/mesa/drivers/dri/r600/evergreen_oglprog.h | 33 + src/mesa/drivers/dri/r600/evergreen_render.c | 937 ++++++++++ src/mesa/drivers/dri/r600/evergreen_sq.h | 735 ++++++++ src/mesa/drivers/dri/r600/evergreen_state.c | 1879 ++++++++++++++++++++ src/mesa/drivers/dri/r600/evergreen_state.h | 47 + src/mesa/drivers/dri/r600/evergreen_tex.c | 1551 ++++++++++++++++ src/mesa/drivers/dri/r600/evergreen_tex.h | 38 + src/mesa/drivers/dri/r600/evergreen_vertprog.c | 729 ++++++++ src/mesa/drivers/dri/r600/evergreen_vertprog.h | 107 ++ src/mesa/drivers/dri/r600/r600_cmdbuf.c | 9 +- src/mesa/drivers/dri/r600/r600_cmdbuf.h | 40 + src/mesa/drivers/dri/r600/r600_context.c | 89 +- src/mesa/drivers/dri/r600/r600_context.h | 50 + src/mesa/drivers/dri/r600/r600_emit.c | 66 + src/mesa/drivers/dri/r600/r600_emit.h | 10 + src/mesa/drivers/dri/r600/r600_texstate.c | 26 + src/mesa/drivers/dri/r600/r700_assembler.c | 1588 +++++++++++++++-- src/mesa/drivers/dri/r600/r700_assembler.h | 28 +- src/mesa/drivers/dri/r600/r700_chip.c | 122 +- src/mesa/drivers/dri/r600/r700_chip.h | 7 + src/mesa/drivers/dri/r600/r700_fragprog.c | 33 + src/mesa/drivers/dri/r600/r700_fragprog.h | 5 + src/mesa/drivers/dri/r600/r700_oglprog.c | 21 + src/mesa/drivers/dri/r600/r700_state.c | 16 +- src/mesa/drivers/dri/r600/r700_vertprog.c | 55 +- src/mesa/drivers/dri/r600/r700_vertprog.h | 5 + src/mesa/drivers/dri/radeon/radeon_chipset.h | 47 + .../drivers/dri/radeon/radeon_common_context.h | 2 + src/mesa/drivers/dri/radeon/radeon_screen.c | 57 +- 41 files changed, 12426 insertions(+), 249 deletions(-) create mode 100644 src/mesa/drivers/dri/r600/evergreen_chip.c create mode 100644 src/mesa/drivers/dri/r600/evergreen_chip.h create mode 100644 src/mesa/drivers/dri/r600/evergreen_context.c create mode 100644 src/mesa/drivers/dri/r600/evergreen_context.h create mode 100644 src/mesa/drivers/dri/r600/evergreen_diff.h create mode 100644 src/mesa/drivers/dri/r600/evergreen_fragprog.c create mode 100644 src/mesa/drivers/dri/r600/evergreen_fragprog.h create mode 100644 src/mesa/drivers/dri/r600/evergreen_ioctl.c create mode 100644 src/mesa/drivers/dri/r600/evergreen_ioctl.h create mode 100644 src/mesa/drivers/dri/r600/evergreen_off.h create mode 100644 src/mesa/drivers/dri/r600/evergreen_oglprog.c create mode 100644 src/mesa/drivers/dri/r600/evergreen_oglprog.h create mode 100644 src/mesa/drivers/dri/r600/evergreen_render.c create mode 100644 src/mesa/drivers/dri/r600/evergreen_sq.h create mode 100644 src/mesa/drivers/dri/r600/evergreen_state.c create mode 100644 src/mesa/drivers/dri/r600/evergreen_state.h create mode 100644 src/mesa/drivers/dri/r600/evergreen_tex.c create mode 100644 src/mesa/drivers/dri/r600/evergreen_tex.h create mode 100644 src/mesa/drivers/dri/r600/evergreen_vertprog.c create mode 100644 src/mesa/drivers/dri/r600/evergreen_vertprog.h (limited to 'src') diff --git a/src/mesa/drivers/dri/r600/Makefile b/src/mesa/drivers/dri/r600/Makefile index 17915621ee..03c17540e0 100644 --- a/src/mesa/drivers/dri/r600/Makefile +++ b/src/mesa/drivers/dri/r600/Makefile @@ -59,6 +59,15 @@ DRIVER_SOURCES = \ r600_texstate.c \ r600_blit.c \ r700_debug.c \ + evergreen_context.c \ + evergreen_state.c \ + evergreen_tex.c \ + evergreen_ioctl.c \ + evergreen_render.c \ + evergreen_chip.c \ + evergreen_vertprog.c \ + evergreen_fragprog.c \ + evergreen_oglprog.c \ $(RADEON_COMMON_SOURCES) \ $(EGL_SOURCES) \ $(CS_SOURCES) diff --git a/src/mesa/drivers/dri/r600/evergreen_chip.c b/src/mesa/drivers/dri/r600/evergreen_chip.c new file mode 100644 index 0000000000..adf2a723c4 --- /dev/null +++ b/src/mesa/drivers/dri/r600/evergreen_chip.c @@ -0,0 +1,1290 @@ +/* + * Copyright (C) 2008-2010 Advanced Micro Devices, Inc. + * + * 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 + * THE COPYRIGHT HOLDER(S) 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. + */ + +/* + * Authors: + * Richard Li , + */ + +#include "main/imports.h" +#include "main/glheader.h" +#include "main/simple_list.h" + +#include "r600_context.h" +#include "r600_cmdbuf.h" + +#include "evergreen_tex.h" +#include "evergreen_chip.h" +#include "evergreen_off.h" +#include "evergreen_diff.h" +#include "evergreen_fragprog.h" +#include "evergreen_vertprog.h" + +#include "radeon_mipmap_tree.h" + +void evergreenCreateChip(context_t *context) +{ + EVERGREEN_CHIP_CONTEXT * evergreen = + (EVERGREEN_CHIP_CONTEXT*) CALLOC(sizeof(EVERGREEN_CHIP_CONTEXT)); + + context->pChip = (void*)evergreen; +} + +#define EVERGREEN_ALLOC_STATE( ATOM, CHK, SZ, EMIT ) \ +do { \ + context->evergreen_atoms.ATOM.cmd_size = (SZ); \ + context->evergreen_atoms.ATOM.cmd = NULL; \ + context->evergreen_atoms.ATOM.name = #ATOM; \ + context->evergreen_atoms.ATOM.idx = 0; \ + context->evergreen_atoms.ATOM.check = check_##CHK; \ + context->evergreen_atoms.ATOM.dirty = GL_FALSE; \ + context->evergreen_atoms.ATOM.emit = (EMIT); \ + context->radeon.hw.max_state_size += (SZ); \ + insert_at_tail(&context->radeon.hw.atomlist, &context->evergreen_atoms.ATOM); \ +} while (0) + +/* +static void evergreen_init_query_stateobj(radeonContextPtr radeon, int SZ) +{ + radeon->query.queryobj.cmd_size = (SZ); + radeon->query.queryobj.cmd = NULL; + radeon->query.queryobj.name = "queryobj"; + radeon->query.queryobj.idx = 0; + radeon->query.queryobj.check = check_queryobj; + radeon->query.queryobj.dirty = GL_FALSE; + radeon->query.queryobj.emit = r700SendQueryBegin; + radeon->hw.max_state_size += (SZ); + insert_at_tail(&radeon->hw.atomlist, &radeon->query.queryobj); +} +*/ + +static int check_always(GLcontext *ctx, struct radeon_state_atom *atom) +{ + return atom->cmd_size; +} + +static void evergreenSendTexState(GLcontext *ctx, struct radeon_state_atom *atom) +{ + context_t *context = EVERGREEN_CONTEXT(ctx); + EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); + + struct evergreen_vertex_program *vp = context->selected_vp; + + struct radeon_bo *bo = NULL; + unsigned int i; + unsigned int nBorderSet = 0; + BATCH_LOCALS(&context->radeon); + + radeon_print(RADEON_STATE, RADEON_VERBOSE, "%s\n", __func__); + + for (i = 0; i < R700_TEXTURE_NUMBERUNITS; i++) { + if (ctx->Texture.Unit[i]._ReallyEnabled) { + radeonTexObj *t = evergreen->textures[i]; + + if (t) { + /* Tex resource */ + if (!t->image_override) { + bo = t->mt->bo; + } else { + bo = t->bo; + } + if (bo) + { + radeon_bo_unmap(bo); + + r700SyncSurf(context, bo, + RADEON_GEM_DOMAIN_GTT|RADEON_GEM_DOMAIN_VRAM, + 0, TC_ACTION_ENA_bit); + + BEGIN_BATCH_NO_AUTOSTATE(10 + 4); + R600_OUT_BATCH(CP_PACKET3(R600_IT_SET_RESOURCE, 8)); + + if( (1<r700AsmCode.unVetTexBits ) + { /* vs texture */ + R600_OUT_BATCH((i + VERT_ATTRIB_MAX + EG_SQ_FETCH_RESOURCE_VS_OFFSET) * FETCH_RESOURCE_STRIDE); + } + else + { + R600_OUT_BATCH(i * EG_FETCH_RESOURCE_STRIDE); + } + + R600_OUT_BATCH(evergreen->textures[i]->SQ_TEX_RESOURCE0); + R600_OUT_BATCH(evergreen->textures[i]->SQ_TEX_RESOURCE1); + R600_OUT_BATCH(evergreen->textures[i]->SQ_TEX_RESOURCE2); + R600_OUT_BATCH(evergreen->textures[i]->SQ_TEX_RESOURCE3); + R600_OUT_BATCH(evergreen->textures[i]->SQ_TEX_RESOURCE4); + R600_OUT_BATCH(evergreen->textures[i]->SQ_TEX_RESOURCE5); + R600_OUT_BATCH(evergreen->textures[i]->SQ_TEX_RESOURCE6); + R600_OUT_BATCH(evergreen->textures[i]->SQ_TEX_RESOURCE7); + + R600_OUT_BATCH_RELOC(evergreen->textures[i]->SQ_TEX_RESOURCE2, + bo, + evergreen->textures[i]->SQ_TEX_RESOURCE2, + RADEON_GEM_DOMAIN_GTT|RADEON_GEM_DOMAIN_VRAM, 0, 0); + R600_OUT_BATCH_RELOC(evergreen->textures[i]->SQ_TEX_RESOURCE3, + bo, + evergreen->textures[i]->SQ_TEX_RESOURCE3, + RADEON_GEM_DOMAIN_GTT|RADEON_GEM_DOMAIN_VRAM, 0, 0); + END_BATCH(); + COMMIT_BATCH(); + } + /* Tex sampler */ + BEGIN_BATCH_NO_AUTOSTATE(5); + R600_OUT_BATCH(CP_PACKET3(R600_IT_SET_SAMPLER, 3)); + + if( (1<r700AsmCode.unVetTexBits ) + { /* vs texture */ + R600_OUT_BATCH((i+SQ_TEX_SAMPLER_VS_OFFSET) * 3); + } + else + { + R600_OUT_BATCH(i * 3); + } + R600_OUT_BATCH(evergreen->textures[i]->SQ_TEX_SAMPLER0); + R600_OUT_BATCH(evergreen->textures[i]->SQ_TEX_SAMPLER1); + R600_OUT_BATCH(evergreen->textures[i]->SQ_TEX_SAMPLER2); + + END_BATCH(); + COMMIT_BATCH(); + + /* Tex border color */ + if(0 == nBorderSet) + { + BEGIN_BATCH_NO_AUTOSTATE(2 + 4); + R600_OUT_BATCH_REGSEQ(EG_TD_PS_BORDER_COLOR_RED, 4); + R600_OUT_BATCH(evergreen->textures[i]->TD_PS_SAMPLER0_BORDER_RED); + R600_OUT_BATCH(evergreen->textures[i]->TD_PS_SAMPLER0_BORDER_GREEN); + R600_OUT_BATCH(evergreen->textures[i]->TD_PS_SAMPLER0_BORDER_BLUE); + R600_OUT_BATCH(evergreen->textures[i]->TD_PS_SAMPLER0_BORDER_ALPHA); + END_BATCH(); + COMMIT_BATCH(); + + nBorderSet = 1; + } + } + } + } +} + +static int check_evergreen_tx(GLcontext *ctx, struct radeon_state_atom *atom) +{ + context_t *context = EVERGREEN_CONTEXT(ctx); + unsigned int i, count = 0; + EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); + + for (i = 0; i < R700_TEXTURE_NUMBERUNITS; i++) { + if (ctx->Texture.Unit[i]._ReallyEnabled) { + radeonTexObj *t = evergreen->textures[i]; + if (t) + count++; + } + } + radeon_print(RADEON_STATE, RADEON_TRACE, "%s %d\n", __func__, count); + return count * 37 + 6; +} + +static void evergreenSendSQConfig(GLcontext *ctx, struct radeon_state_atom *atom) +{ + context_t *context = EVERGREEN_CONTEXT(ctx); + EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); + BATCH_LOCALS(&context->radeon); + radeon_print(RADEON_STATE, RADEON_VERBOSE, "%s\n", __func__); + + BEGIN_BATCH_NO_AUTOSTATE(19); + //6 + EVERGREEN_OUT_BATCH_REGVAL(EG_SPI_CONFIG_CNTL, evergreen->evergreen_config.SPI_CONFIG_CNTL.u32All); + EVERGREEN_OUT_BATCH_REGVAL(EG_SPI_CONFIG_CNTL_1, evergreen->evergreen_config.SPI_CONFIG_CNTL_1.u32All); + //6 + EVERGREEN_OUT_BATCH_REGSEQ(EG_SQ_CONFIG, 4); + R600_OUT_BATCH(evergreen->evergreen_config.SQ_CONFIG.u32All); + R600_OUT_BATCH(evergreen->evergreen_config.SQ_GPR_RESOURCE_MGMT_1.u32All); + R600_OUT_BATCH(evergreen->evergreen_config.SQ_GPR_RESOURCE_MGMT_2.u32All); + R600_OUT_BATCH(evergreen->evergreen_config.SQ_GPR_RESOURCE_MGMT_3.u32All); + //7 + EVERGREEN_OUT_BATCH_REGSEQ(EG_SQ_THREAD_RESOURCE_MGMT, 5); + R600_OUT_BATCH(evergreen->evergreen_config.SQ_THREAD_RESOURCE_MGMT.u32All); + R600_OUT_BATCH(evergreen->evergreen_config.SQ_THREAD_RESOURCE_MGMT_2.u32All); + R600_OUT_BATCH(evergreen->evergreen_config.SQ_STACK_RESOURCE_MGMT_1.u32All); + R600_OUT_BATCH(evergreen->evergreen_config.SQ_STACK_RESOURCE_MGMT_2.u32All); + R600_OUT_BATCH(evergreen->evergreen_config.SQ_STACK_RESOURCE_MGMT_3.u32All); + + END_BATCH(); + + COMMIT_BATCH(); +} + +extern int evergreen_getTypeSize(GLenum type); +static void evergreenSetupVTXConstants(GLcontext * ctx, + void * pAos, + StreamDesc * pStreamDesc) +{ + context_t *context = EVERGREEN_CONTEXT(ctx); + struct radeon_aos * paos = (struct radeon_aos *)pAos; + unsigned int nVBsize; + BATCH_LOCALS(&context->radeon); + + unsigned int uSQ_VTX_CONSTANT_WORD0_0; + unsigned int uSQ_VTX_CONSTANT_WORD1_0; + unsigned int uSQ_VTX_CONSTANT_WORD2_0 = 0; + unsigned int uSQ_VTX_CONSTANT_WORD3_0 = 0; + unsigned int uSQ_VTX_CONSTANT_WORD7_0 = 0; + + if (!paos->bo) + return; + + r700SyncSurf(context, paos->bo, RADEON_GEM_DOMAIN_GTT, 0, VC_ACTION_ENA_bit); + + if(0 == pStreamDesc->stride) + { + nVBsize = paos->count * pStreamDesc->size * getTypeSize(pStreamDesc->type); + } + else + { + nVBsize = (paos->count - 1) * pStreamDesc->stride + + pStreamDesc->size * getTypeSize(pStreamDesc->type); + } + + //uSQ_VTX_CONSTANT_WORD0_0 + uSQ_VTX_CONSTANT_WORD0_0 = paos->offset; + + //uSQ_VTX_CONSTANT_WORD1_0 + uSQ_VTX_CONSTANT_WORD1_0 = nVBsize; + + //uSQ_VTX_CONSTANT_WORD2_0 + SETfield(uSQ_VTX_CONSTANT_WORD2_0, + pStreamDesc->stride, + SQ_VTX_CONSTANT_WORD2_0__STRIDE_shift, + SQ_VTX_CONSTANT_WORD2_0__STRIDE_mask); + SETfield(uSQ_VTX_CONSTANT_WORD2_0, GetSurfaceFormat(pStreamDesc->type, pStreamDesc->size, NULL), + SQ_VTX_CONSTANT_WORD2_0__DATA_FORMAT_shift, + SQ_VTX_CONSTANT_WORD2_0__DATA_FORMAT_mask); // TODO : trace back api for initial data type, not only GL_FLOAT + SETfield(uSQ_VTX_CONSTANT_WORD2_0, 0, BASE_ADDRESS_HI_shift, BASE_ADDRESS_HI_mask); // TODO + if(GL_TRUE == pStreamDesc->normalize) + { + SETfield(uSQ_VTX_CONSTANT_WORD2_0, SQ_NUM_FORMAT_NORM, + SQ_VTX_CONSTANT_WORD2_0__NUM_FORMAT_ALL_shift, SQ_VTX_CONSTANT_WORD2_0__NUM_FORMAT_ALL_mask); + } + else + { + SETfield(uSQ_VTX_CONSTANT_WORD2_0, SQ_NUM_FORMAT_SCALED, + SQ_VTX_CONSTANT_WORD2_0__NUM_FORMAT_ALL_shift, SQ_VTX_CONSTANT_WORD2_0__NUM_FORMAT_ALL_mask); + } + if(1 == pStreamDesc->_signed) + { + SETbit(uSQ_VTX_CONSTANT_WORD2_0, SQ_VTX_CONSTANT_WORD2_0__FORMAT_COMP_ALL_bit); + } + + //uSQ_VTX_CONSTANT_WORD3_0 + SETfield(uSQ_VTX_CONSTANT_WORD3_0, SQ_SEL_X, + EG_SQ_VTX_CONSTANT_WORD3_0__DST_SEL_X_shift, + EG_SQ_VTX_CONSTANT_WORD3_0__DST_SEL_X_mask); + SETfield(uSQ_VTX_CONSTANT_WORD3_0, SQ_SEL_Y, + EG_SQ_VTX_CONSTANT_WORD3_0__DST_SEL_Y_shift, + EG_SQ_VTX_CONSTANT_WORD3_0__DST_SEL_Y_mask); + SETfield(uSQ_VTX_CONSTANT_WORD3_0, SQ_SEL_Z, + EG_SQ_VTX_CONSTANT_WORD3_0__DST_SEL_Z_shift, + EG_SQ_VTX_CONSTANT_WORD3_0__DST_SEL_Z_mask); + SETfield(uSQ_VTX_CONSTANT_WORD3_0, SQ_SEL_W, + EG_SQ_VTX_CONSTANT_WORD3_0__DST_SEL_W_shift, + EG_SQ_VTX_CONSTANT_WORD3_0__DST_SEL_W_mask); + + //uSQ_VTX_CONSTANT_WORD7_0 + SETfield(uSQ_VTX_CONSTANT_WORD7_0, SQ_TEX_VTX_VALID_BUFFER, + SQ_TEX_RESOURCE_WORD6_0__TYPE_shift, SQ_TEX_RESOURCE_WORD6_0__TYPE_mask); + + BEGIN_BATCH_NO_AUTOSTATE(10 + 2); + + R600_OUT_BATCH(CP_PACKET3(R600_IT_SET_RESOURCE, 8)); + R600_OUT_BATCH((pStreamDesc->element + EG_SQ_FETCH_RESOURCE_VS_OFFSET) * EG_FETCH_RESOURCE_STRIDE); + R600_OUT_BATCH(uSQ_VTX_CONSTANT_WORD0_0); + R600_OUT_BATCH(uSQ_VTX_CONSTANT_WORD1_0); + R600_OUT_BATCH(uSQ_VTX_CONSTANT_WORD2_0); + R600_OUT_BATCH(uSQ_VTX_CONSTANT_WORD3_0); + R600_OUT_BATCH(0); + R600_OUT_BATCH(0); + R600_OUT_BATCH(0); + R600_OUT_BATCH(uSQ_VTX_CONSTANT_WORD7_0); + R600_OUT_BATCH_RELOC(uSQ_VTX_CONSTANT_WORD0_0, + paos->bo, + uSQ_VTX_CONSTANT_WORD0_0, + RADEON_GEM_DOMAIN_GTT, 0, 0); + END_BATCH(); + + COMMIT_BATCH(); +} + +static int check_evergreen_vtx(GLcontext *ctx, struct radeon_state_atom *atom) +{ + context_t *context = EVERGREEN_CONTEXT(ctx); + int count = context->radeon.tcl.aos_count * 12; + + if (count) + count += 6; + + radeon_print(RADEON_STATE, RADEON_TRACE, "%s %d\n", __func__, count); + return count; +} + +static void evergreenSendVTX(GLcontext *ctx, struct radeon_state_atom *atom) +{ + context_t *context = EVERGREEN_CONTEXT(ctx); + struct evergreen_vertex_program *vp = (struct evergreen_vertex_program *)(context->selected_vp); + unsigned int i, j = 0; + BATCH_LOCALS(&context->radeon); + radeon_print(RADEON_STATE, RADEON_VERBOSE, "%s\n", __func__); + + if (context->radeon.tcl.aos_count == 0) + return; + + BEGIN_BATCH_NO_AUTOSTATE(6); + R600_OUT_BATCH(CP_PACKET3(R600_IT_SET_CTL_CONST, 1)); + R600_OUT_BATCH(mmSQ_VTX_BASE_VTX_LOC - ASIC_CTL_CONST_BASE_INDEX); + R600_OUT_BATCH(0); + + R600_OUT_BATCH(CP_PACKET3(R600_IT_SET_CTL_CONST, 1)); + R600_OUT_BATCH(mmSQ_VTX_START_INST_LOC - ASIC_CTL_CONST_BASE_INDEX); + R600_OUT_BATCH(0); + END_BATCH(); + COMMIT_BATCH(); + + for(i=0; imesa_program->Base.InputsRead & (1 << i)) + { + evergreenSetupVTXConstants(ctx, + (void*)(&context->radeon.tcl.aos[j]), + &(context->stream_desc[j])); + j++; + } + } +} +static void evergreenSendPA(GLcontext *ctx, struct radeon_state_atom *atom) +{ + context_t *context = EVERGREEN_CONTEXT(ctx); + EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); + BATCH_LOCALS(&context->radeon); + radeon_print(RADEON_STATE, RADEON_VERBOSE, "%s\n", __func__); + int id = 0; + + BEGIN_BATCH_NO_AUTOSTATE(3); + EVERGREEN_OUT_BATCH_REGVAL(EG_PA_SU_HARDWARE_SCREEN_OFFSET, 0); + END_BATCH(); + + BEGIN_BATCH_NO_AUTOSTATE(22); + EVERGREEN_OUT_BATCH_REGSEQ(EG_PA_SC_SCREEN_SCISSOR_TL, 2); + R600_OUT_BATCH(evergreen->PA_SC_SCREEN_SCISSOR_TL.u32All); + R600_OUT_BATCH(evergreen->PA_SC_SCREEN_SCISSOR_BR.u32All); + + EVERGREEN_OUT_BATCH_REGSEQ(EG_PA_SC_WINDOW_OFFSET, 12); + R600_OUT_BATCH(evergreen->PA_SC_WINDOW_OFFSET.u32All); + R600_OUT_BATCH(evergreen->PA_SC_WINDOW_SCISSOR_TL.u32All); + R600_OUT_BATCH(evergreen->PA_SC_WINDOW_SCISSOR_BR.u32All); + R600_OUT_BATCH(evergreen->PA_SC_CLIPRECT_RULE.u32All); + R600_OUT_BATCH(evergreen->PA_SC_CLIPRECT_0_TL.u32All); + R600_OUT_BATCH(evergreen->PA_SC_CLIPRECT_0_BR.u32All); + R600_OUT_BATCH(evergreen->PA_SC_CLIPRECT_1_TL.u32All); + R600_OUT_BATCH(evergreen->PA_SC_CLIPRECT_1_BR.u32All); + R600_OUT_BATCH(evergreen->PA_SC_CLIPRECT_2_TL.u32All); + R600_OUT_BATCH(evergreen->PA_SC_CLIPRECT_2_BR.u32All); + R600_OUT_BATCH(evergreen->PA_SC_CLIPRECT_3_TL.u32All); + R600_OUT_BATCH(evergreen->PA_SC_CLIPRECT_3_BR.u32All); + + EVERGREEN_OUT_BATCH_REGSEQ(EG_PA_SC_GENERIC_SCISSOR_TL, 2); + R600_OUT_BATCH(evergreen->PA_SC_GENERIC_SCISSOR_TL.u32All); + R600_OUT_BATCH(evergreen->PA_SC_GENERIC_SCISSOR_BR.u32All); + END_BATCH(); + + BEGIN_BATCH_NO_AUTOSTATE(3); + EVERGREEN_OUT_BATCH_REGVAL(EG_PA_SC_EDGERULE, evergreen->PA_SC_EDGERULE.u32All); + END_BATCH(); + + + BEGIN_BATCH_NO_AUTOSTATE(18); + EVERGREEN_OUT_BATCH_REGSEQ(EG_PA_SC_VPORT_SCISSOR_0_TL, 4); + R600_OUT_BATCH(evergreen->viewport[id].PA_SC_VPORT_SCISSOR_0_TL.u32All); + R600_OUT_BATCH(evergreen->viewport[id].PA_SC_VPORT_SCISSOR_0_BR.u32All); + R600_OUT_BATCH(evergreen->viewport[id].PA_SC_VPORT_SCISSOR_0_TL.u32All); + R600_OUT_BATCH(evergreen->viewport[id].PA_SC_VPORT_SCISSOR_0_BR.u32All); + + EVERGREEN_OUT_BATCH_REGSEQ(EG_PA_SC_VPORT_ZMIN_0, 2); + R600_OUT_BATCH(evergreen->viewport[id].PA_SC_VPORT_ZMIN_0.u32All); + R600_OUT_BATCH(evergreen->viewport[id].PA_SC_VPORT_ZMAX_0.u32All); + + EVERGREEN_OUT_BATCH_REGSEQ(EG_PA_CL_VPORT_XSCALE, 6); + R600_OUT_BATCH(evergreen->viewport[id].PA_CL_VPORT_XSCALE.u32All); + R600_OUT_BATCH(evergreen->viewport[id].PA_CL_VPORT_XOFFSET.u32All); + R600_OUT_BATCH(evergreen->viewport[id].PA_CL_VPORT_YSCALE.u32All); + R600_OUT_BATCH(evergreen->viewport[id].PA_CL_VPORT_YOFFSET.u32All); + R600_OUT_BATCH(evergreen->viewport[id].PA_CL_VPORT_ZSCALE.u32All); + R600_OUT_BATCH(evergreen->viewport[id].PA_CL_VPORT_ZOFFSET.u32All); + END_BATCH(); + + + for (id = 0; id < EVERGREEN_MAX_UCP; id++) { + if (evergreen->ucp[id].enabled) { + BEGIN_BATCH_NO_AUTOSTATE(6); + EVERGREEN_OUT_BATCH_REGSEQ(EG_PA_CL_UCP_0_X + (4 * id), 4); + R600_OUT_BATCH(evergreen->ucp[id].PA_CL_UCP_0_X.u32All); + R600_OUT_BATCH(evergreen->ucp[id].PA_CL_UCP_0_Y.u32All); + R600_OUT_BATCH(evergreen->ucp[id].PA_CL_UCP_0_Z.u32All); + R600_OUT_BATCH(evergreen->ucp[id].PA_CL_UCP_0_W.u32All); + END_BATCH(); + } + } + + BEGIN_BATCH_NO_AUTOSTATE(42); + EVERGREEN_OUT_BATCH_REGSEQ(EG_PA_CL_CLIP_CNTL, 5); + R600_OUT_BATCH(evergreen->PA_CL_CLIP_CNTL.u32All); + R600_OUT_BATCH(evergreen->PA_SU_SC_MODE_CNTL.u32All); + R600_OUT_BATCH(evergreen->PA_CL_VTE_CNTL.u32All); + R600_OUT_BATCH(evergreen->PA_CL_VS_OUT_CNTL.u32All); + R600_OUT_BATCH(evergreen->PA_CL_NANINF_CNTL.u32All); + + EVERGREEN_OUT_BATCH_REGSEQ(EG_PA_SU_POINT_SIZE, 3); + R600_OUT_BATCH(evergreen->PA_SU_POINT_SIZE.u32All); + R600_OUT_BATCH(evergreen->PA_SU_POINT_MINMAX.u32All); + R600_OUT_BATCH(evergreen->PA_SU_LINE_CNTL.u32All); + + EVERGREEN_OUT_BATCH_REGSEQ(EG_PA_SC_MODE_CNTL_0, 2); + R600_OUT_BATCH(evergreen->PA_SC_MODE_CNTL_0.u32All); + R600_OUT_BATCH(evergreen->PA_SC_MODE_CNTL_1.u32All); + + EVERGREEN_OUT_BATCH_REGSEQ(EG_PA_SU_POLY_OFFSET_DB_FMT_CNTL, 6); + R600_OUT_BATCH(evergreen->PA_SU_POLY_OFFSET_DB_FMT_CNTL.u32All); + R600_OUT_BATCH(evergreen->PA_SU_POLY_OFFSET_CLAMP.u32All); + R600_OUT_BATCH(evergreen->PA_SU_POLY_OFFSET_FRONT_SCALE.u32All); + R600_OUT_BATCH(evergreen->PA_SU_POLY_OFFSET_FRONT_OFFSET.u32All); + R600_OUT_BATCH(evergreen->PA_SU_POLY_OFFSET_BACK_SCALE.u32All); + R600_OUT_BATCH(evergreen->PA_SU_POLY_OFFSET_BACK_OFFSET.u32All); + + EVERGREEN_OUT_BATCH_REGSEQ(EG_PA_SC_LINE_CNTL, 16); + R600_OUT_BATCH(evergreen->PA_SC_LINE_CNTL.u32All); + R600_OUT_BATCH(evergreen->PA_SC_AA_CONFIG.u32All); + R600_OUT_BATCH(evergreen->PA_SU_VTX_CNTL.u32All); + R600_OUT_BATCH(evergreen->PA_CL_GB_VERT_CLIP_ADJ.u32All); + R600_OUT_BATCH(evergreen->PA_CL_GB_VERT_DISC_ADJ.u32All); + R600_OUT_BATCH(evergreen->PA_CL_GB_HORZ_CLIP_ADJ.u32All); + R600_OUT_BATCH(evergreen->PA_CL_GB_HORZ_DISC_ADJ.u32All); + R600_OUT_BATCH(evergreen->PA_SC_AA_SAMPLE_LOCS_0.u32All); + R600_OUT_BATCH(evergreen->PA_SC_AA_SAMPLE_LOCS_1.u32All); + R600_OUT_BATCH(evergreen->PA_SC_AA_SAMPLE_LOCS_2.u32All); + R600_OUT_BATCH(evergreen->PA_SC_AA_SAMPLE_LOCS_3.u32All); + R600_OUT_BATCH(evergreen->PA_SC_AA_SAMPLE_LOCS_4.u32All); + R600_OUT_BATCH(evergreen->PA_SC_AA_SAMPLE_LOCS_5.u32All); + R600_OUT_BATCH(evergreen->PA_SC_AA_SAMPLE_LOCS_6.u32All); + R600_OUT_BATCH(evergreen->PA_SC_AA_SAMPLE_LOCS_7.u32All); + R600_OUT_BATCH(evergreen->PA_SC_AA_MASK.u32All); + + END_BATCH(); + + COMMIT_BATCH(); +} +static void evergreenSendTP(GLcontext *ctx, struct radeon_state_atom *atom) +{ + /* + context_t *context = EVERGREEN_CONTEXT(ctx); + EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); + BATCH_LOCALS(&context->radeon); + radeon_print(RADEON_STATE, RADEON_VERBOSE, "%s\n", __func__); + + COMMIT_BATCH(); + */ +} + +static void evergreenSendPSresource(GLcontext *ctx) +{ + context_t *context = EVERGREEN_CONTEXT(ctx); + EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); + struct radeon_bo * pbo; + + struct radeon_bo * pbo_const; + + BATCH_LOCALS(&context->radeon); + radeon_print(RADEON_STATE, RADEON_VERBOSE, "%s\n", __func__); + + pbo = (struct radeon_bo *)evergreenGetActiveFpShaderBo(GL_CONTEXT(context)); + + if (!pbo) + return; + + r700SyncSurf(context, pbo, RADEON_GEM_DOMAIN_GTT, 0, SH_ACTION_ENA_bit); + + BEGIN_BATCH_NO_AUTOSTATE(3 + 2); + EVERGREEN_OUT_BATCH_REGSEQ(EG_SQ_PGM_START_PS, 1); + R600_OUT_BATCH(evergreen->ps.SQ_PGM_START_PS.u32All); + R600_OUT_BATCH_RELOC(evergreen->ps.SQ_PGM_START_PS.u32All, + pbo, + evergreen->ps.SQ_PGM_START_PS.u32All, + RADEON_GEM_DOMAIN_GTT, 0, 0); + END_BATCH(); + + BEGIN_BATCH_NO_AUTOSTATE(3); + EVERGREEN_OUT_BATCH_REGVAL(EG_SQ_LOOP_CONST_0, 0x01000FFF); + END_BATCH(); + + pbo_const = (struct radeon_bo *)(context->fp_Constbo); + + if(NULL != pbo_const) + { + r700SyncSurf(context, pbo_const, RADEON_GEM_DOMAIN_GTT, 0, SH_ACTION_ENA_bit); + + BEGIN_BATCH_NO_AUTOSTATE(3); + + if(evergreen->ps.num_consts < 4) + { + EVERGREEN_OUT_BATCH_REGVAL(EG_SQ_ALU_CONST_BUFFER_SIZE_PS_0, 1); + } + else + { + EVERGREEN_OUT_BATCH_REGVAL(EG_SQ_ALU_CONST_BUFFER_SIZE_PS_0, (evergreen->ps.num_consts * 4)/16 ); + } + + END_BATCH(); + + BEGIN_BATCH_NO_AUTOSTATE(3 + 2); + EVERGREEN_OUT_BATCH_REGSEQ(EG_SQ_ALU_CONST_CACHE_PS_0, 1); + R600_OUT_BATCH(context->fp_bo_offset >> 8); + R600_OUT_BATCH_RELOC(0, + pbo_const, + 0, + RADEON_GEM_DOMAIN_GTT, 0, 0); + END_BATCH(); + } + + COMMIT_BATCH(); +} + +static void evergreenSendVSresource(GLcontext *ctx, struct radeon_state_atom *atom) +{ + context_t *context = EVERGREEN_CONTEXT(ctx); + EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); + struct radeon_bo * pbo; + + struct radeon_bo * pbo_const; + + BATCH_LOCALS(&context->radeon); + radeon_print(RADEON_STATE, RADEON_VERBOSE, "%s\n", __func__); + + pbo = (struct radeon_bo *)evergreenGetActiveVpShaderBo(GL_CONTEXT(context)); + + if (!pbo) + return; + + r700SyncSurf(context, pbo, RADEON_GEM_DOMAIN_GTT, 0, SH_ACTION_ENA_bit); + + BEGIN_BATCH_NO_AUTOSTATE(3 + 2); + EVERGREEN_OUT_BATCH_REGSEQ(EG_SQ_PGM_START_VS, 1); + R600_OUT_BATCH(evergreen->vs.SQ_PGM_START_VS.u32All); + R600_OUT_BATCH_RELOC(evergreen->vs.SQ_PGM_START_VS.u32All, + pbo, + evergreen->vs.SQ_PGM_START_VS.u32All, + RADEON_GEM_DOMAIN_GTT, 0, 0); + END_BATCH(); + + BEGIN_BATCH_NO_AUTOSTATE(3); + EVERGREEN_OUT_BATCH_REGVAL((EG_SQ_LOOP_CONST_0 + 32*1), 0x0100000F); //consts == 1 + //EVERGREEN_OUT_BATCH_REGVAL((EG_SQ_LOOP_CONST_0 + (SQ_LOOP_CONST_vs<2)), 0x0100000F); + END_BATCH(); + + pbo_const = (struct radeon_bo *)(context->vp_Constbo); + + if(NULL != pbo_const) + { + r700SyncSurf(context, pbo_const, RADEON_GEM_DOMAIN_GTT, 0, SH_ACTION_ENA_bit); + + BEGIN_BATCH_NO_AUTOSTATE(3); + + if(evergreen->vs.num_consts < 4) + { + EVERGREEN_OUT_BATCH_REGVAL(EG_SQ_ALU_CONST_BUFFER_SIZE_VS_0, 1); + } + else + { + EVERGREEN_OUT_BATCH_REGVAL(EG_SQ_ALU_CONST_BUFFER_SIZE_VS_0, (evergreen->vs.num_consts * 4)/16 ); + } + + END_BATCH(); + + BEGIN_BATCH_NO_AUTOSTATE(3 + 2); + EVERGREEN_OUT_BATCH_REGSEQ(EG_SQ_ALU_CONST_CACHE_VS_0, 1); + R600_OUT_BATCH(context->vp_bo_offset >> 8); + R600_OUT_BATCH_RELOC(0, + pbo_const, + 0, + RADEON_GEM_DOMAIN_GTT, 0, 0); + END_BATCH(); + } + + COMMIT_BATCH(); +} + +static void evergreenSendSQ(GLcontext *ctx, struct radeon_state_atom *atom) +{ + context_t *context = EVERGREEN_CONTEXT(ctx); + EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); + BATCH_LOCALS(&context->radeon); + radeon_print(RADEON_STATE, RADEON_VERBOSE, "%s\n", __func__); + + evergreenSendPSresource(ctx); //16 entries now + + BEGIN_BATCH_NO_AUTOSTATE(77); + + //34 + EVERGREEN_OUT_BATCH_REGSEQ(EG_SQ_VTX_SEMANTIC_0, 32); + R600_OUT_BATCH(evergreen->SQ_VTX_SEMANTIC_0.u32All); //// // = 0x28380, // SAME + R600_OUT_BATCH(evergreen->SQ_VTX_SEMANTIC_1.u32All); //// // = 0x28384, // SAME + R600_OUT_BATCH(evergreen->SQ_VTX_SEMANTIC_2.u32All); //// // = 0x28388, // SAME + R600_OUT_BATCH(evergreen->SQ_VTX_SEMANTIC_3.u32All); //// // = 0x2838C, // SAME + R600_OUT_BATCH(evergreen->SQ_VTX_SEMANTIC_4.u32All); //// // = 0x28390, // SAME + R600_OUT_BATCH(evergreen->SQ_VTX_SEMANTIC_5.u32All); //// // = 0x28394, // SAME + R600_OUT_BATCH(evergreen->SQ_VTX_SEMANTIC_6.u32All); //// // = 0x28398, // SAME + R600_OUT_BATCH(evergreen->SQ_VTX_SEMANTIC_7.u32All); //// // = 0x2839C, // SAME + R600_OUT_BATCH(evergreen->SQ_VTX_SEMANTIC_8.u32All); //// // = 0x283A0, // SAME + R600_OUT_BATCH(evergreen->SQ_VTX_SEMANTIC_9.u32All); //// // = 0x283A4, // SAME + R600_OUT_BATCH(evergreen->SQ_VTX_SEMANTIC_10.u32All); //// // = 0x283A8, // SAME + R600_OUT_BATCH(evergreen->SQ_VTX_SEMANTIC_11.u32All); //// // = 0x283AC, // SAME + R600_OUT_BATCH(evergreen->SQ_VTX_SEMANTIC_12.u32All); //// // = 0x283B0, // SAME + R600_OUT_BATCH(evergreen->SQ_VTX_SEMANTIC_13.u32All); //// // = 0x283B4, // SAME + R600_OUT_BATCH(evergreen->SQ_VTX_SEMANTIC_14.u32All); //// // = 0x283B8, // SAME + R600_OUT_BATCH(evergreen->SQ_VTX_SEMANTIC_15.u32All); //// // = 0x283BC, // SAME + R600_OUT_BATCH(evergreen->SQ_VTX_SEMANTIC_16.u32All); //// // = 0x283C0, // SAME + R600_OUT_BATCH(evergreen->SQ_VTX_SEMANTIC_17.u32All); //// // = 0x283C4, // SAME + R600_OUT_BATCH(evergreen->SQ_VTX_SEMANTIC_18.u32All); //// // = 0x283C8, // SAME + R600_OUT_BATCH(evergreen->SQ_VTX_SEMANTIC_19.u32All); //// // = 0x283CC, // SAME + R600_OUT_BATCH(evergreen->SQ_VTX_SEMANTIC_20.u32All); //// // = 0x283D0, // SAME + R600_OUT_BATCH(evergreen->SQ_VTX_SEMANTIC_21.u32All); //// // = 0x283D4, // SAME + R600_OUT_BATCH(evergreen->SQ_VTX_SEMANTIC_22.u32All); //// // = 0x283D8, // SAME + R600_OUT_BATCH(evergreen->SQ_VTX_SEMANTIC_23.u32All); //// // = 0x283DC, // SAME + R600_OUT_BATCH(evergreen->SQ_VTX_SEMANTIC_24.u32All); //// // = 0x283E0, // SAME + R600_OUT_BATCH(evergreen->SQ_VTX_SEMANTIC_25.u32All); //// // = 0x283E4, // SAME + R600_OUT_BATCH(evergreen->SQ_VTX_SEMANTIC_26.u32All); //// // = 0x283E8, // SAME + R600_OUT_BATCH(evergreen->SQ_VTX_SEMANTIC_27.u32All); //// // = 0x283EC, // SAME + R600_OUT_BATCH(evergreen->SQ_VTX_SEMANTIC_28.u32All); //// // = 0x283F0, // SAME + R600_OUT_BATCH(evergreen->SQ_VTX_SEMANTIC_29.u32All); //// // = 0x283F4, // SAME + R600_OUT_BATCH(evergreen->SQ_VTX_SEMANTIC_30.u32All); //// // = 0x283F8, // SAME + R600_OUT_BATCH(evergreen->SQ_VTX_SEMANTIC_31.u32All); //// // = 0x283FC, // SAME + + + //3 + EVERGREEN_OUT_BATCH_REGSEQ(EG_SQ_DYN_GPR_RESOURCE_LIMIT_1, 1); + R600_OUT_BATCH(evergreen->SQ_DYN_GPR_RESOURCE_LIMIT_1.u32All);//// // = 0x28838, // + + //5 + EVERGREEN_OUT_BATCH_REGSEQ(EG_SQ_PGM_RESOURCES_PS, 3); + R600_OUT_BATCH(evergreen->SQ_PGM_RESOURCES_PS.u32All); //// // = 0x28844, // DIFF 0x28850 + R600_OUT_BATCH(evergreen->SQ_PGM_RESOURCES_2_PS.u32All); //// // = 0x28848, // + R600_OUT_BATCH(evergreen->SQ_PGM_EXPORTS_PS.u32All); //// // = 0x2884C, // SAME 0x28854 + + //4 + EVERGREEN_OUT_BATCH_REGSEQ(EG_SQ_PGM_RESOURCES_VS, 2); + R600_OUT_BATCH(evergreen->SQ_PGM_RESOURCES_VS.u32All);//// // = 0x28860, // DIFF 0x28868 + R600_OUT_BATCH(evergreen->SQ_PGM_RESOURCES_2_VS.u32All); //// // = 0x28864, // + + //5 + EVERGREEN_OUT_BATCH_REGSEQ(EG_SQ_PGM_RESOURCES_GS, 2); + /* + R600_OUT_BATCH(evergreen->SQ_PGM_START_GS.u32All); //// // = 0x28874, // SAME 0x2886C + */ + R600_OUT_BATCH(evergreen->SQ_PGM_RESOURCES_GS.u32All); //// // = 0x28878, // DIFF 0x2887C + R600_OUT_BATCH(evergreen->SQ_PGM_RESOURCES_2_GS.u32All); //// // = 0x2887C, // + + //5 + EVERGREEN_OUT_BATCH_REGSEQ(EG_SQ_PGM_RESOURCES_ES, 2); + /* + R600_OUT_BATCH(evergreen->SQ_PGM_START_ES.u32All); //// // = 0x2888C, // SAME 0x28880 + */ + R600_OUT_BATCH(evergreen->SQ_PGM_RESOURCES_ES.u32All); //// // = 0x28890, // DIFF + R600_OUT_BATCH(evergreen->SQ_PGM_RESOURCES_2_ES.u32All); //// // = 0x28894, // + + //4 + EVERGREEN_OUT_BATCH_REGSEQ(EG_SQ_PGM_RESOURCES_FS, 1); + /* + R600_OUT_BATCH(evergreen->SQ_PGM_START_FS.u32All); //// // = 0x288A4, // SAME 0x28894 + */ + R600_OUT_BATCH(evergreen->SQ_PGM_RESOURCES_FS.u32All); //// // = 0x288A8, // DIFF 0x288A4 + + //3 + EVERGREEN_OUT_BATCH_REGSEQ(EG_SQ_PGM_RESOURCES_2_HS, 1); + R600_OUT_BATCH(evergreen->SQ_PGM_RESOURCES_2_HS.u32All);//// // = 0x288C0, // + + //3 + EVERGREEN_OUT_BATCH_REGSEQ(EG_SQ_PGM_RESOURCES_2_LS, 1); + R600_OUT_BATCH(evergreen->SQ_PGM_RESOURCES_2_LS.u32All); //// // = 0x288D8, // + + //3 + EVERGREEN_OUT_BATCH_REGSEQ(EG_SQ_LDS_ALLOC_PS, 1); + R600_OUT_BATCH(evergreen->SQ_LDS_ALLOC_PS.u32All); //// // = 0x288EC, // + + //8 + EVERGREEN_OUT_BATCH_REGSEQ(EG_SQ_ESGS_RING_ITEMSIZE, 6); + R600_OUT_BATCH(evergreen->SQ_ESGS_RING_ITEMSIZE.u32All); //// // = 0x28900, // SAME 0x288A8 + R600_OUT_BATCH(evergreen->SQ_GSVS_RING_ITEMSIZE.u32All); //// // = 0x28904, // SAME 0x288AC + R600_OUT_BATCH(evergreen->SQ_ESTMP_RING_ITEMSIZE.u32All); //// // = 0x28908, // SAME 0x288B0 + R600_OUT_BATCH(evergreen->SQ_GSTMP_RING_ITEMSIZE.u32All); //// // = 0x2890C, // SAME 0x288B4 + R600_OUT_BATCH(evergreen->SQ_VSTMP_RING_ITEMSIZE.u32All); //// // = 0x28910, // SAME 0x288B8 + R600_OUT_BATCH(evergreen->SQ_PSTMP_RING_ITEMSIZE.u32All); //// // = 0x28914, // SAME 0x288BC + + //3 + EVERGREEN_OUT_BATCH_REGSEQ(EG_SQ_GS_VERT_ITEMSIZE, 1); + R600_OUT_BATCH(evergreen->SQ_GS_VERT_ITEMSIZE.u32All); //// // = 0x2891C, // SAME 0x288C8 + + END_BATCH(); + + COMMIT_BATCH(); + +} +static void evergreenSendSPI(GLcontext *ctx, struct radeon_state_atom *atom) +{ + context_t *context = EVERGREEN_CONTEXT(ctx); + EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); + BATCH_LOCALS(&context->radeon); + radeon_print(RADEON_STATE, RADEON_VERBOSE, "%s\n", __func__); + + BEGIN_BATCH_NO_AUTOSTATE(59); + + EVERGREEN_OUT_BATCH_REGSEQ(EG_SPI_VS_OUT_ID_0, 10); + R600_OUT_BATCH(evergreen->SPI_VS_OUT_ID_0.u32All); + R600_OUT_BATCH(evergreen->SPI_VS_OUT_ID_1.u32All); + R600_OUT_BATCH(evergreen->SPI_VS_OUT_ID_2.u32All); + R600_OUT_BATCH(evergreen->SPI_VS_OUT_ID_3.u32All); + R600_OUT_BATCH(evergreen->SPI_VS_OUT_ID_4.u32All); + R600_OUT_BATCH(evergreen->SPI_VS_OUT_ID_5.u32All); + R600_OUT_BATCH(evergreen->SPI_VS_OUT_ID_6.u32All); + R600_OUT_BATCH(evergreen->SPI_VS_OUT_ID_7.u32All); + R600_OUT_BATCH(evergreen->SPI_VS_OUT_ID_8.u32All); + R600_OUT_BATCH(evergreen->SPI_VS_OUT_ID_9.u32All); + + EVERGREEN_OUT_BATCH_REGSEQ(EG_SPI_PS_INPUT_CNTL_0, 45); + R600_OUT_BATCH(evergreen->SPI_PS_INPUT_CNTL[0].u32All); + R600_OUT_BATCH(evergreen->SPI_PS_INPUT_CNTL[1].u32All); + R600_OUT_BATCH(evergreen->SPI_PS_INPUT_CNTL[2].u32All); + R600_OUT_BATCH(evergreen->SPI_PS_INPUT_CNTL[3].u32All); + R600_OUT_BATCH(evergreen->SPI_PS_INPUT_CNTL[4].u32All); + R600_OUT_BATCH(evergreen->SPI_PS_INPUT_CNTL[5].u32All); + R600_OUT_BATCH(evergreen->SPI_PS_INPUT_CNTL[6].u32All); + R600_OUT_BATCH(evergreen->SPI_PS_INPUT_CNTL[7].u32All); + R600_OUT_BATCH(evergreen->SPI_PS_INPUT_CNTL[8].u32All); + R600_OUT_BATCH(evergreen->SPI_PS_INPUT_CNTL[9].u32All); + R600_OUT_BATCH(evergreen->SPI_PS_INPUT_CNTL[10].u32All); + R600_OUT_BATCH(evergreen->SPI_PS_INPUT_CNTL[11].u32All); + R600_OUT_BATCH(evergreen->SPI_PS_INPUT_CNTL[12].u32All); + R600_OUT_BATCH(evergreen->SPI_PS_INPUT_CNTL[13].u32All); + R600_OUT_BATCH(evergreen->SPI_PS_INPUT_CNTL[14].u32All); + R600_OUT_BATCH(evergreen->SPI_PS_INPUT_CNTL[15].u32All); + R600_OUT_BATCH(evergreen->SPI_PS_INPUT_CNTL[16].u32All); + R600_OUT_BATCH(evergreen->SPI_PS_INPUT_CNTL[17].u32All); + R600_OUT_BATCH(evergreen->SPI_PS_INPUT_CNTL[18].u32All); + R600_OUT_BATCH(evergreen->SPI_PS_INPUT_CNTL[19].u32All); + R600_OUT_BATCH(evergreen->SPI_PS_INPUT_CNTL[20].u32All); + R600_OUT_BATCH(evergreen->SPI_PS_INPUT_CNTL[21].u32All); + R600_OUT_BATCH(evergreen->SPI_PS_INPUT_CNTL[22].u32All); + R600_OUT_BATCH(evergreen->SPI_PS_INPUT_CNTL[23].u32All); + R600_OUT_BATCH(evergreen->SPI_PS_INPUT_CNTL[24].u32All); + R600_OUT_BATCH(evergreen->SPI_PS_INPUT_CNTL[25].u32All); + R600_OUT_BATCH(evergreen->SPI_PS_INPUT_CNTL[26].u32All); + R600_OUT_BATCH(evergreen->SPI_PS_INPUT_CNTL[27].u32All); + R600_OUT_BATCH(evergreen->SPI_PS_INPUT_CNTL[28].u32All); + R600_OUT_BATCH(evergreen->SPI_PS_INPUT_CNTL[29].u32All); + R600_OUT_BATCH(evergreen->SPI_PS_INPUT_CNTL[30].u32All); + R600_OUT_BATCH(evergreen->SPI_PS_INPUT_CNTL[31].u32All); + R600_OUT_BATCH(evergreen->SPI_VS_OUT_CONFIG.u32All); + R600_OUT_BATCH(evergreen->SPI_THREAD_GROUPING.u32All); + R600_OUT_BATCH(evergreen->SPI_PS_IN_CONTROL_0.u32All); + R600_OUT_BATCH(evergreen->SPI_PS_IN_CONTROL_1.u32All); + R600_OUT_BATCH(evergreen->SPI_INTERP_CONTROL_0.u32All); + R600_OUT_BATCH(evergreen->SPI_INPUT_Z.u32All); + R600_OUT_BATCH(evergreen->SPI_FOG_CNTL.u32All); + R600_OUT_BATCH(evergreen->SPI_BARYC_CNTL.u32All); + R600_OUT_BATCH(evergreen->SPI_PS_IN_CONTROL_2.u32All); + R600_OUT_BATCH(evergreen->SPI_COMPUTE_INPUT_CNTL.u32All); + R600_OUT_BATCH(evergreen->SPI_COMPUTE_NUM_THREAD_X.u32All); + R600_OUT_BATCH(evergreen->SPI_COMPUTE_NUM_THREAD_Y.u32All); + R600_OUT_BATCH(evergreen->SPI_COMPUTE_NUM_THREAD_Z.u32All); + + END_BATCH(); + + COMMIT_BATCH(); +} +static void evergreenSendSX(GLcontext *ctx, struct radeon_state_atom *atom) +{ + context_t *context = EVERGREEN_CONTEXT(ctx); + EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); + BATCH_LOCALS(&context->radeon); + radeon_print(RADEON_STATE, RADEON_VERBOSE, "%s\n", __func__); + + BEGIN_BATCH_NO_AUTOSTATE(9); + + EVERGREEN_OUT_BATCH_REGVAL(EG_SX_MISC, evergreen->SX_MISC.u32All); + EVERGREEN_OUT_BATCH_REGVAL(EG_SX_ALPHA_TEST_CONTROL, evergreen->SX_ALPHA_TEST_CONTROL.u32All); + EVERGREEN_OUT_BATCH_REGVAL(EG_SX_ALPHA_REF, evergreen->SX_ALPHA_REF.u32All); + + END_BATCH(); + + COMMIT_BATCH(); +} + +static void evergreenSetDepthTarget(context_t *context) +{ + EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); + struct radeon_renderbuffer *rrb; + unsigned int nPitchInPixel; + + rrb = radeon_get_depthbuffer(&context->radeon); + if (!rrb) + { + return; + } + + EVERGREEN_STATECHANGE(context, db); + + evergreen->DB_DEPTH_SIZE.u32All = 0; + + SETfield(evergreen->DB_DEPTH_SIZE.u32All, (nPitchInPixel/8)-1, + EG_DB_DEPTH_SIZE__PITCH_TILE_MAX_shift, + EG_DB_DEPTH_SIZE__PITCH_TILE_MAX_mask); + SETfield(evergreen->DB_DEPTH_SIZE.u32All, (context->radeon.radeonScreen->driScreen->fbHeight/8)-1, + EG_DB_DEPTH_SIZE__HEIGHT_TILE_MAX_shift, + EG_DB_DEPTH_SIZE__HEIGHT_TILE_MAX_mask); + evergreen->DB_DEPTH_SLICE.u32All = ( (nPitchInPixel * context->radeon.radeonScreen->driScreen->fbHeight)/64 )-1; + + if(4 == rrb->cpp) + { + SETfield(evergreen->DB_Z_INFO.u32All, DEPTH_8_24, + EG_DB_Z_INFO__FORMAT_shift, + EG_DB_Z_INFO__FORMAT_mask); + } + else + { + SETfield(evergreen->DB_Z_INFO.u32All, DEPTH_16, + EG_DB_Z_INFO__FORMAT_shift, + EG_DB_Z_INFO__FORMAT_mask); + } + SETfield(evergreen->DB_Z_INFO.u32All, ARRAY_1D_TILED_THIN1, + EG_DB_Z_INFO__ARRAY_MODE_shift, + EG_DB_Z_INFO__ARRAY_MODE_mask); +} + +static void evergreenSendDB(GLcontext *ctx, struct radeon_state_atom *atom) +{ + context_t *context = EVERGREEN_CONTEXT(ctx); + EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); + struct radeon_renderbuffer *rrb; + BATCH_LOCALS(&context->radeon); + radeon_print(RADEON_STATE, RADEON_VERBOSE, "%s\n", __func__); + + evergreenSetDepthTarget(context); + + //8 + BEGIN_BATCH_NO_AUTOSTATE(7); + EVERGREEN_OUT_BATCH_REGSEQ(EG_DB_RENDER_CONTROL, 5); + R600_OUT_BATCH(evergreen->DB_RENDER_CONTROL.u32All); + R600_OUT_BATCH(evergreen->DB_COUNT_CONTROL.u32All); + R600_OUT_BATCH(evergreen->DB_DEPTH_VIEW.u32All); + R600_OUT_BATCH(evergreen->DB_RENDER_OVERRIDE.u32All); + R600_OUT_BATCH(evergreen->DB_RENDER_OVERRIDE2.u32All); + /* + R600_OUT_BATCH(evergreen->DB_HTILE_DATA_BASE.u32All); + */ + END_BATCH(); + + //4 + BEGIN_BATCH_NO_AUTOSTATE(4); + EVERGREEN_OUT_BATCH_REGSEQ(EG_DB_STENCIL_CLEAR, 2); + R600_OUT_BATCH(evergreen->DB_STENCIL_CLEAR.u32All); + R600_OUT_BATCH(evergreen->DB_DEPTH_CLEAR.u32All); + END_BATCH(); + + //4 + BEGIN_BATCH_NO_AUTOSTATE(4); + EVERGREEN_OUT_BATCH_REGSEQ(EG_DB_DEPTH_SIZE, 2); + R600_OUT_BATCH(evergreen->DB_DEPTH_SIZE.u32All); + R600_OUT_BATCH(evergreen->DB_DEPTH_SLICE.u32All); + END_BATCH(); + + //3 + BEGIN_BATCH_NO_AUTOSTATE(3); + EVERGREEN_OUT_BATCH_REGVAL(EG_DB_DEPTH_CONTROL, evergreen->DB_DEPTH_CONTROL.u32All); + END_BATCH(); + + //3 + BEGIN_BATCH_NO_AUTOSTATE(3); + EVERGREEN_OUT_BATCH_REGVAL(EG_DB_SHADER_CONTROL, evergreen->DB_SHADER_CONTROL.u32All); + END_BATCH(); + + //5 + BEGIN_BATCH_NO_AUTOSTATE(5); + EVERGREEN_OUT_BATCH_REGSEQ(EG_DB_SRESULTS_COMPARE_STATE0, 3); + R600_OUT_BATCH(evergreen->DB_SRESULTS_COMPARE_STATE0.u32All); + R600_OUT_BATCH(evergreen->DB_SRESULTS_COMPARE_STATE1.u32All); + R600_OUT_BATCH(evergreen->DB_PRELOAD_CONTROL.u32All); + END_BATCH(); + + //3 + BEGIN_BATCH_NO_AUTOSTATE(3); + EVERGREEN_OUT_BATCH_REGVAL(EG_DB_ALPHA_TO_MASK, evergreen->DB_ALPHA_TO_MASK.u32All); + END_BATCH(); + + rrb = radeon_get_depthbuffer(&context->radeon); + if( (rrb != NULL) && (rrb->bo != NULL) ) + { + //5 + BEGIN_BATCH_NO_AUTOSTATE(3 + 2); + EVERGREEN_OUT_BATCH_REGVAL(EG_DB_Z_INFO, evergreen->DB_Z_INFO.u32All); + R600_OUT_BATCH_RELOC(evergreen->DB_Z_INFO.u32All, + rrb->bo, + evergreen->DB_Z_INFO.u32All, + 0, RADEON_GEM_DOMAIN_VRAM, 0); + END_BATCH(); + + //5 + if((evergreen->DB_DEPTH_CONTROL.u32All & Z_ENABLE_bit) > 0) + { + BEGIN_BATCH_NO_AUTOSTATE(3 + 2); + EVERGREEN_OUT_BATCH_REGVAL(EG_DB_Z_READ_BASE, evergreen->DB_Z_READ_BASE.u32All); + R600_OUT_BATCH_RELOC(evergreen->DB_Z_READ_BASE.u32All, + rrb->bo, + evergreen->DB_Z_READ_BASE.u32All, + 0, RADEON_GEM_DOMAIN_VRAM, 0); + END_BATCH(); + } + //5 + if((evergreen->DB_DEPTH_CONTROL.u32All & Z_WRITE_ENABLE_bit) > 0) + { + BEGIN_BATCH_NO_AUTOSTATE(3 + 2); + EVERGREEN_OUT_BATCH_REGVAL(EG_DB_Z_WRITE_BASE, evergreen->DB_Z_READ_BASE.u32All); + R600_OUT_BATCH_RELOC(evergreen->DB_Z_WRITE_BASE.u32All, + rrb->bo, + evergreen->DB_Z_WRITE_BASE.u32All, + 0, RADEON_GEM_DOMAIN_VRAM, 0); + END_BATCH(); + } + } +/* + if (ctx->DrawBuffer) + { + rrb = radeon_get_renderbuffer(ctx->DrawBuffer, BUFFER_STENCIL); + + if((rrb != NULL) && (rrb->bo != NULL)) + { + //5 + BEGIN_BATCH_NO_AUTOSTATE(3 + 2); + EVERGREEN_OUT_BATCH_REGVAL(EG_DB_STENCIL_INFO, evergreen->DB_Z_INFO.u32All); + R600_OUT_BATCH_RELOC(evergreen->DB_STENCIL_INFO.u32All, + rrb->bo, + evergreen->DB_STENCIL_INFO.u32All, + 0, RADEON_GEM_DOMAIN_VRAM, 0); + END_BATCH(); + + //10 + if((evergreen->DB_DEPTH_CONTROL.u32All & STENCIL_ENABLE_bit) > 0) + { + BEGIN_BATCH_NO_AUTOSTATE(3 + 2); + EVERGREEN_OUT_BATCH_REGVAL(EG_DB_STENCIL_READ_BASE, evergreen->DB_STENCIL_READ_BASE.u32All); + R600_OUT_BATCH_RELOC(evergreen->DB_STENCIL_READ_BASE.u32All, + rrb->bo, + evergreen->DB_STENCIL_READ_BASE.u32All, + 0, RADEON_GEM_DOMAIN_VRAM, 0); + END_BATCH(); + + BEGIN_BATCH_NO_AUTOSTATE(3 + 2); + EVERGREEN_OUT_BATCH_REGVAL(EG_DB_STENCIL_WRITE_BASE, evergreen->DB_STENCIL_WRITE_BASE.u32All); + R600_OUT_BATCH_RELOC(evergreen->DB_STENCIL_WRITE_BASE.u32All, + rrb->bo, + evergreen->DB_STENCIL_WRITE_BASE.u32All, + 0, RADEON_GEM_DOMAIN_VRAM, 0); + END_BATCH(); + } + } + } +*/ + COMMIT_BATCH(); +} + +static void evergreenSetRenderTarget(context_t *context, int id) +{ + EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); + + struct radeon_renderbuffer *rrb; + unsigned int nPitchInPixel; + + rrb = radeon_get_colorbuffer(&context->radeon); + if (!rrb || !rrb->bo) { + return; + } + + EVERGREEN_STATECHANGE(context, cb); + + /* addr */ + evergreen->render_target[id].CB_COLOR0_BASE.u32All = context->radeon.state.color.draw_offset / 256; + + /* pitch */ + nPitchInPixel = rrb->pitch/rrb->cpp; + + SETfield(evergreen->render_target[id].CB_COLOR0_PITCH.u32All, (nPitchInPixel/8)-1, + EG_CB_COLOR0_PITCH__TILE_MAX_shift, + EG_CB_COLOR0_PITCH__TILE_MAX_mask); + + /* skice */ + SETfield(evergreen->render_target[id].CB_COLOR0_SLICE.u32All, + //( (nPitchInPixel * context->radeon.radeonScreen->driScreen->fbHeight)/64 )-1, + ( (nPitchInPixel * 240)/64 )-1, + EG_CB_COLOR0_SLICE__TILE_MAX_shift, + EG_CB_COLOR0_SLICE__TILE_MAX_mask); + + /* CB_COLOR0_ATTRIB */ /* TODO : for z clear, this should be set to 0 */ + SETbit(evergreen->render_target[id].CB_COLOR0_ATTRIB.u32All, + EG_CB_COLOR0_ATTRIB__NON_DISP_TILING_ORDER_bit); + + /* CB_COLOR0_INFO */ + SETfield(evergreen->render_target[id].CB_COLOR0_INFO.u32All, + ENDIAN_NONE, + EG_CB_COLOR0_INFO__ENDIAN_shift, + EG_CB_COLOR0_INFO__ENDIAN_mask); + SETfield(evergreen->render_target[id].CB_COLOR0_INFO.u32All, + ARRAY_LINEAR_GENERAL, + EG_CB_COLOR0_INFO__ARRAY_MODE_shift, + EG_CB_COLOR0_INFO__ARRAY_MODE_mask); + if(4 == rrb->cpp) + { + SETfield(evergreen->render_target[id].CB_COLOR0_INFO.u32All, + COLOR_8_8_8_8, + EG_CB_COLOR0_INFO__FORMAT_shift, + EG_CB_COLOR0_INFO__FORMAT_mask); + SETfield(evergreen->render_target[id].CB_COLOR0_INFO.u32All, + SWAP_ALT, //SWAP_STD + EG_CB_COLOR0_INFO__COMP_SWAP_shift, + EG_CB_COLOR0_INFO__COMP_SWAP_mask); + } + else + { + SETfield(evergreen->render_target[id].CB_COLOR0_INFO.u32All, + COLOR_5_6_5, + EG_CB_COLOR0_INFO__FORMAT_shift, + EG_CB_COLOR0_INFO__FORMAT_mask); + SETfield(evergreen->render_target[id].CB_COLOR0_INFO.u32All, + SWAP_ALT_REV, + EG_CB_COLOR0_INFO__COMP_SWAP_shift, + EG_CB_COLOR0_INFO__COMP_SWAP_mask); + } + SETfield(evergreen->render_target[id].CB_COLOR0_INFO.u32All, + 1, + EG_CB_COLOR0_INFO__SOURCE_FORMAT_shift, + EG_CB_COLOR0_INFO__SOURCE_FORMAT_mask); + SETbit(evergreen->render_target[id].CB_COLOR0_INFO.u32All, + EG_CB_COLOR0_INFO__BLEND_CLAMP_bit); + SETfield(evergreen->render_target[id].CB_COLOR0_INFO.u32All, + NUMBER_UNORM, + EG_CB_COLOR0_INFO__NUMBER_TYPE_shift, + EG_CB_COLOR0_INFO__NUMBER_TYPE_mask); + + evergreen->render_target[id].CB_COLOR0_VIEW.u32All = 0; + evergreen->render_target[id].CB_COLOR0_CMASK.u32All = 0; + evergreen->render_target[id].CB_COLOR0_FMASK.u32All = 0; + evergreen->render_target[id].CB_COLOR0_FMASK_SLICE.u32All = 0; + + evergreen->render_target[id].enabled = GL_TRUE; +} + +static void evergreenSendCB(GLcontext *ctx, struct radeon_state_atom *atom) +{ + context_t *context = EVERGREEN_CONTEXT(ctx); + EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); + struct radeon_renderbuffer *rrb; + BATCH_LOCALS(&context->radeon); + int id = 0; + radeon_print(RADEON_STATE, RADEON_VERBOSE, "%s\n", __func__); + + rrb = radeon_get_colorbuffer(&context->radeon); + if (!rrb || !rrb->bo) { + return; + } + + evergreenSetRenderTarget(context, 0); + + if (!evergreen->render_target[id].enabled) + return; + + BEGIN_BATCH_NO_AUTOSTATE(3 + 2); + EVERGREEN_OUT_BATCH_REGSEQ(EG_CB_COLOR0_BASE + (4 * id), 1); + R600_OUT_BATCH(evergreen->render_target[id].CB_COLOR0_BASE.u32All); + R600_OUT_BATCH_RELOC(evergreen->render_target[id].CB_COLOR0_BASE.u32All, + rrb->bo, + evergreen->render_target[id].CB_COLOR0_BASE.u32All, + 0, RADEON_GEM_DOMAIN_VRAM, 0); + END_BATCH(); + + BEGIN_BATCH_NO_AUTOSTATE(3 + 2); + EVERGREEN_OUT_BATCH_REGVAL(EG_CB_COLOR0_INFO, evergreen->render_target[id].CB_COLOR0_INFO.u32All); + R600_OUT_BATCH_RELOC(evergreen->render_target[id].CB_COLOR0_INFO.u32All, + rrb->bo, + evergreen->render_target[id].CB_COLOR0_INFO.u32All, + 0, RADEON_GEM_DOMAIN_VRAM, 0); + END_BATCH(); + + BEGIN_BATCH_NO_AUTOSTATE(5); + EVERGREEN_OUT_BATCH_REGSEQ(EG_CB_COLOR0_PITCH, 3); + R600_OUT_BATCH(evergreen->render_target[id].CB_COLOR0_PITCH.u32All); + R600_OUT_BATCH(evergreen->render_target[id].CB_COLOR0_SLICE.u32All); + R600_OUT_BATCH(evergreen->render_target[id].CB_COLOR0_VIEW.u32All); + END_BATCH(); + + BEGIN_BATCH_NO_AUTOSTATE(4); + EVERGREEN_OUT_BATCH_REGSEQ(EG_CB_COLOR0_ATTRIB, 2); + R600_OUT_BATCH(evergreen->render_target[id].CB_COLOR0_ATTRIB.u32All); + R600_OUT_BATCH(evergreen->render_target[id].CB_COLOR0_DIM.u32All); + /* + R600_OUT_BATCH(evergreen->render_target[id].CB_COLOR0_CMASK.u32All); + R600_OUT_BATCH(evergreen->render_target[id].CB_COLOR0_CMASK_SLICE.u32All); + R600_OUT_BATCH(evergreen->render_target[id].CB_COLOR0_FMASK.u32All); + R600_OUT_BATCH(evergreen->render_target[id].CB_COLOR0_FMASK_SLICE.u32All); + */ + END_BATCH(); + + BEGIN_BATCH_NO_AUTOSTATE(4); + EVERGREEN_OUT_BATCH_REGSEQ(EG_CB_TARGET_MASK, 2); + R600_OUT_BATCH(evergreen->CB_TARGET_MASK.u32All); + R600_OUT_BATCH(evergreen->CB_SHADER_MASK.u32All); + END_BATCH(); + + BEGIN_BATCH_NO_AUTOSTATE(5); + EVERGREEN_OUT_BATCH_REGSEQ(EG_CB_BLEND_RED, 3); + R600_OUT_BATCH(evergreen->CB_BLEND_RED.u32All); + R600_OUT_BATCH(evergreen->CB_BLEND_GREEN.u32All); + R600_OUT_BATCH(evergreen->CB_BLEND_BLUE.u32All); + END_BATCH(); + + BEGIN_BATCH_NO_AUTOSTATE(9); + EVERGREEN_OUT_BATCH_REGVAL(EG_CB_BLEND_ALPHA, evergreen->CB_BLEND_ALPHA.u32All); + EVERGREEN_OUT_BATCH_REGVAL(EG_CB_BLEND0_CONTROL, evergreen->CB_BLEND0_CONTROL.u32All); + EVERGREEN_OUT_BATCH_REGVAL(EG_CB_COLOR_CONTROL, evergreen->CB_COLOR_CONTROL.u32All); + END_BATCH(); + + COMMIT_BATCH(); +} +static void evergreenSendCP(GLcontext *ctx, struct radeon_state_atom *atom) +{ + context_t *context = EVERGREEN_CONTEXT(ctx); + BATCH_LOCALS(&context->radeon); + radeon_print(RADEON_STATE, RADEON_VERBOSE, "%s\n", __func__); + + //first to send + //r700Start3D + BEGIN_BATCH_NO_AUTOSTATE(3); + R600_OUT_BATCH(CP_PACKET3(R600_IT_CONTEXT_CONTROL, 1)); //IT_CONTEXT_CONTROL 0x28 + R600_OUT_BATCH(0x80000000); + R600_OUT_BATCH(0x80000000); + END_BATCH(); + + COMMIT_BATCH(); +} +static void evergreenSendVGT(GLcontext *ctx, struct radeon_state_atom *atom) +{ + context_t *context = EVERGREEN_CONTEXT(ctx); + EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); + BATCH_LOCALS(&context->radeon); + radeon_print(RADEON_STATE, RADEON_VERBOSE, "%s\n", __func__); + +/* moved to draw: + VGT_DRAW_INITIATOR + VGT_INDEX_TYPE + VGT_PRIMITIVE_TYPE +*/ + BEGIN_BATCH_NO_AUTOSTATE(5); + EVERGREEN_OUT_BATCH_REGSEQ(EG_VGT_MAX_VTX_INDX, 3); + R600_OUT_BATCH(evergreen->VGT_MAX_VTX_INDX.u32All); + R600_OUT_BATCH(evergreen->VGT_MIN_VTX_INDX.u32All); + R600_OUT_BATCH(evergreen->VGT_INDX_OFFSET.u32All); + END_BATCH(); + + BEGIN_BATCH_NO_AUTOSTATE(6); + EVERGREEN_OUT_BATCH_REGVAL(EG_VGT_OUTPUT_PATH_CNTL, evergreen->VGT_OUTPUT_PATH_CNTL.u32All); + + EVERGREEN_OUT_BATCH_REGVAL(EG_VGT_GS_MODE, evergreen->VGT_GS_MODE.u32All); + END_BATCH(); + + BEGIN_BATCH_NO_AUTOSTATE(3); + EVERGREEN_OUT_BATCH_REGSEQ(EG_VGT_PRIMITIVEID_EN, 1); + R600_OUT_BATCH(evergreen->VGT_PRIMITIVEID_EN.u32All); + END_BATCH(); + + BEGIN_BATCH_NO_AUTOSTATE(4); + EVERGREEN_OUT_BATCH_REGSEQ(EG_VGT_INSTANCE_STEP_RATE_0, 2); + R600_OUT_BATCH(evergreen->VGT_INSTANCE_STEP_RATE_0.u32All); + R600_OUT_BATCH(evergreen->VGT_INSTANCE_STEP_RATE_1.u32All); + END_BATCH(); + + BEGIN_BATCH_NO_AUTOSTATE(4); + EVERGREEN_OUT_BATCH_REGSEQ(EG_VGT_REUSE_OFF, 2); + R600_OUT_BATCH(evergreen->VGT_REUSE_OFF.u32All); + R600_OUT_BATCH(evergreen->VGT_VTX_CNT_EN.u32All); + END_BATCH(); + + BEGIN_BATCH_NO_AUTOSTATE(3); + EVERGREEN_OUT_BATCH_REGVAL(EG_VGT_SHADER_STAGES_EN, evergreen->VGT_SHADER_STAGES_EN.u32All); + END_BATCH(); + + BEGIN_BATCH_NO_AUTOSTATE(4); + EVERGREEN_OUT_BATCH_REGSEQ(EG_VGT_STRMOUT_CONFIG, 2); + R600_OUT_BATCH(evergreen->VGT_STRMOUT_CONFIG.u32All); + R600_OUT_BATCH(evergreen->VGT_STRMOUT_BUFFER_CONFIG.u32All); + END_BATCH(); + + COMMIT_BATCH(); +} + +static void evergreenSendTIMESTAMP(GLcontext *ctx, struct radeon_state_atom *atom) +{ + context_t *context = EVERGREEN_CONTEXT(ctx); + BATCH_LOCALS(&context->radeon); + radeon_print(RADEON_STATE, RADEON_VERBOSE, "%s\n", __func__); +} + +void evergreenInitAtoms(context_t *context) +{ + radeon_print(RADEON_STATE, RADEON_NORMAL, "%s %p\n", __func__, context); + context->radeon.hw.max_state_size = 10 + 5 + 14 + 3; /* start 3d, idle, cb/db flush, 3 for time stamp */ + + /* Setup the atom linked list */ + make_empty_list(&context->radeon.hw.atomlist); + context->radeon.hw.atomlist.name = "atom-list"; + + EVERGREEN_ALLOC_STATE(init, always, 19, evergreenSendSQConfig); + + //make sure send first + EVERGREEN_ALLOC_STATE(cp, always, 3, evergreenSendCP); + + EVERGREEN_ALLOC_STATE(vtx, evergreen_vtx, (6 + (VERT_ATTRIB_MAX * 12)), evergreenSendVTX); + EVERGREEN_ALLOC_STATE(pa, always, 124, evergreenSendPA); + EVERGREEN_ALLOC_STATE(tp, always, 0, evergreenSendTP); + EVERGREEN_ALLOC_STATE(sq, always, 86, evergreenSendSQ); /* 85 */ + EVERGREEN_ALLOC_STATE(vs, always, 16, evergreenSendVSresource); + EVERGREEN_ALLOC_STATE(spi, always, 59, evergreenSendSPI); + EVERGREEN_ALLOC_STATE(sx, always, 9, evergreenSendSX); + EVERGREEN_ALLOC_STATE(tx, evergreen_tx, (R700_TEXTURE_NUMBERUNITS * (21+5) + 6), evergreenSendTexState); /* 21 for resource, 5 for sampler */ + EVERGREEN_ALLOC_STATE(db, always, 60, evergreenSendDB); + EVERGREEN_ALLOC_STATE(cb, always, 35, evergreenSendCB); + EVERGREEN_ALLOC_STATE(vgt, always, 29, evergreenSendVGT); + EVERGREEN_ALLOC_STATE(timestamp, always, 3, evergreenSendTIMESTAMP); + + //evergreen_init_query_stateobj(&context->radeon, 6 * 2); + + context->radeon.hw.is_dirty = GL_TRUE; + context->radeon.hw.all_dirty = GL_TRUE; +} diff --git a/src/mesa/drivers/dri/r600/evergreen_chip.h b/src/mesa/drivers/dri/r600/evergreen_chip.h new file mode 100644 index 0000000000..2ea5cd213c --- /dev/null +++ b/src/mesa/drivers/dri/r600/evergreen_chip.h @@ -0,0 +1,516 @@ +/* + * Copyright (C) 2008-2010 Advanced Micro Devices, Inc. + * + * 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 + * THE COPYRIGHT HOLDER(S) 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. + */ + +/* + * Authors: + * Richard Li , + */ + +#ifndef _EVERGREEN_CHIP_H_ +#define _EVERGREEN_CHIP_H_ + +#include "r700_chip.h" + +#define EVERGREEN_MAX_DX9_CONSTS 256 +#define EVERGREEN_MAX_SHADER_EXPORTS 32 +#define EVERGREEN_MAX_VIEWPORTS 16 + +typedef struct _EVERGREEN_VIEWPORT_STATE +{ + union UINT_FLOAT PA_SC_VPORT_SCISSOR_0_TL; ////0,1 // = 0x28250, // DIFF + union UINT_FLOAT PA_SC_VPORT_SCISSOR_0_BR; ////0,1 // = 0x28254, // DIFF + union UINT_FLOAT PA_SC_VPORT_ZMIN_0; ////0 // = 0x282D0, // SAME + union UINT_FLOAT PA_SC_VPORT_ZMAX_0; ////0 // = 0x282D4, // SAME + union UINT_FLOAT PA_CL_VPORT_XSCALE; //// // = 0x2843C, // SAME + union UINT_FLOAT PA_CL_VPORT_XOFFSET; //// // = 0x28440, // SAME + union UINT_FLOAT PA_CL_VPORT_YSCALE; //// // = 0x28444, // SAME + union UINT_FLOAT PA_CL_VPORT_YOFFSET; //// // = 0x28448, // SAME + union UINT_FLOAT PA_CL_VPORT_ZSCALE; //// // = 0x2844C, // SAME + union UINT_FLOAT PA_CL_VPORT_ZOFFSET; //// // = 0x28450, // SAME + GLboolean enabled; + GLboolean dirty; +} EVERGREEN_VIEWPORT_STATE; + +#define EVERGREEN_MAX_UCP 6 + +typedef struct _EVERGREEN_UCP_STATE +{ + union UINT_FLOAT PA_CL_UCP_0_X; // = 0x285BC, // SAME 0x28E20 + union UINT_FLOAT PA_CL_UCP_0_Y; // = 0x285C0, // SAME 0x28E24 + union UINT_FLOAT PA_CL_UCP_0_Z; // = 0x285C4, // SAME 0x28E28 + union UINT_FLOAT PA_CL_UCP_0_W; // = 0x285C8, // SAME 0x28E2C + GLboolean enabled; + GLboolean dirty; +} EVERGREEN_UCP_STATE; + +#define EVERGREEN_MAX_RENDER_TARGETS 12 + +typedef struct _EVERGREEN_RENDER_TARGET_STATE +{ + union UINT_FLOAT CB_COLOR0_BASE; ////0 // = 0x28C60, // SAME 0x28040 + union UINT_FLOAT CB_COLOR0_PITCH; ////0 // = 0x28C64, // + union UINT_FLOAT CB_COLOR0_SLICE; ////0 // = 0x28C68, // + union UINT_FLOAT CB_COLOR0_VIEW; ////0 // = 0x28C6C, // SAME 0x28080 + union UINT_FLOAT CB_COLOR0_INFO; ////0,1,2,3,4,5,6,78,9,10,11 // = 0x28C70, // DIFF 0x280A0 + union UINT_FLOAT CB_COLOR0_ATTRIB; ////0 // = 0x28C74, // + union UINT_FLOAT CB_COLOR0_DIM; // = 0x28C78, // + union UINT_FLOAT CB_COLOR0_CMASK; ////0 // = 0x28C7C, // + union UINT_FLOAT CB_COLOR0_CMASK_SLICE; ////0 // = 0x28C80, // + union UINT_FLOAT CB_COLOR0_FMASK; ////0 // = 0x28C84, // + union UINT_FLOAT CB_COLOR0_FMASK_SLICE; ////0 // = 0x28C88, // + union UINT_FLOAT CB_COLOR0_CLEAR_WORD0; // = 0x28C8C, // + union UINT_FLOAT CB_COLOR0_CLEAR_WORD1; // = 0x28C90, // + union UINT_FLOAT CB_COLOR0_CLEAR_WORD2; // = 0x28C94, // + union UINT_FLOAT CB_COLOR0_CLEAR_WORD3; // = 0x28C98, // + GLboolean enabled; + GLboolean dirty; +} EVERGREEN_RENDER_TARGET_STATE; + +typedef struct _EVERGREEN_CONFIG +{ + union UINT_FLOAT SPI_CONFIG_CNTL; // = 0x9100, // DIFF + union UINT_FLOAT SPI_CONFIG_CNTL_1; // = 0x913C, // DIFF + union UINT_FLOAT CP_PERFMON_CNTL; // = 0x87FC, // SAME + union UINT_FLOAT SQ_MS_FIFO_SIZES; // = 0x8CF0, // SAME + + union UINT_FLOAT SQ_CONFIG; // = 0x8C00, // DIFF + union UINT_FLOAT SQ_GPR_RESOURCE_MGMT_1; // = 0x8C04, // SAME + union UINT_FLOAT SQ_GPR_RESOURCE_MGMT_2; // = 0x8C08, // SAME + union UINT_FLOAT SQ_GPR_RESOURCE_MGMT_3; // = 0x8C0C, // + + union UINT_FLOAT SQ_THREAD_RESOURCE_MGMT; // = 0x8C18, // SAME 0x8C0C + union UINT_FLOAT SQ_THREAD_RESOURCE_MGMT_2; // = 0x8C1C, // + union UINT_FLOAT SQ_STACK_RESOURCE_MGMT_1; // = 0x8C20, // SAME 0x8C10 + union UINT_FLOAT SQ_STACK_RESOURCE_MGMT_2; // = 0x8C24, // SAME 0x8C14 + union UINT_FLOAT SQ_STACK_RESOURCE_MGMT_3; // = 0x8C28, // + + union UINT_FLOAT SQ_DYN_GPR_CNTL_PS_FLUSH_REQ; // = 0x8D8C, // DIFF + union UINT_FLOAT SQ_LDS_RESOURCE_MGMT; // = 0x8E2C, // + union UINT_FLOAT VGT_CACHE_INVALIDATION; // = 0x88C4, // DIFF + union UINT_FLOAT VGT_GS_VERTEX_REUSE; // = 0x88D4, // SAME + union UINT_FLOAT PA_SC_FORCE_EOV_MAX_CNTS; // = 0x8B24, // SAME + union UINT_FLOAT PA_SC_LINE_STIPPLE_STATE; // = 0x8B10, // SAME + union UINT_FLOAT PA_CL_ENHANCE; // = 0x8A14, // SAME +} EVERGREEN_CONFIG; + +typedef struct _EVERGREEN_PS_RES +{ + union UINT_FLOAT SQ_PGM_START_PS; //// // = 0x28840, // SAME + GLboolean dirty; + + union UINT_FLOAT SQ_ALU_CONST_CACHE_PS_0; // = 0x28940, // SAME + union UINT_FLOAT SQ_ALU_CONST_CACHE_PS_1; // = 0x28944, // SAME + union UINT_FLOAT SQ_ALU_CONST_CACHE_PS_2; // = 0x28948, // SAME + union UINT_FLOAT SQ_ALU_CONST_CACHE_PS_3; // = 0x2894C, // SAME + union UINT_FLOAT SQ_ALU_CONST_CACHE_PS_4; // = 0x28950, // SAME + union UINT_FLOAT SQ_ALU_CONST_CACHE_PS_5; // = 0x28954, // SAME + union UINT_FLOAT SQ_ALU_CONST_CACHE_PS_6; // = 0x28958, // SAME + union UINT_FLOAT SQ_ALU_CONST_CACHE_PS_7; // = 0x2895C, // SAME + union UINT_FLOAT SQ_ALU_CONST_CACHE_PS_8; // = 0x28960, // SAME + union UINT_FLOAT SQ_ALU_CONST_CACHE_PS_9; // = 0x28964, // SAME + union UINT_FLOAT SQ_ALU_CONST_CACHE_PS_10; // = 0x28968, // SAME + union UINT_FLOAT SQ_ALU_CONST_CACHE_PS_11; // = 0x2896C, // SAME + union UINT_FLOAT SQ_ALU_CONST_CACHE_PS_12; // = 0x28970, // SAME + union UINT_FLOAT SQ_ALU_CONST_CACHE_PS_13; // = 0x28974, // SAME + union UINT_FLOAT SQ_ALU_CONST_CACHE_PS_14; // = 0x28978, // SAME + union UINT_FLOAT SQ_ALU_CONST_CACHE_PS_15; // = 0x2897C, // SAME + + int num_consts; + union UINT_FLOAT consts[EVERGREEN_MAX_DX9_CONSTS][4]; +} EVERGREEN_PS_RES; + +typedef struct _EVERGREEN_VS_RES +{ + union UINT_FLOAT SQ_PGM_START_VS; //// // = 0x2885C, // SAME 0x28858 + union UINT_FLOAT SQ_ALU_CONST_BUFFER_SIZE_VS_0; //// // = 0x28180, //? + union UINT_FLOAT SQ_ALU_CONST_CACHE_VS_0; //// // = 0x28980, // SAME + + union UINT_FLOAT SQ_ALU_CONST_CACHE_VS_1; // = 0x28984, // SAME + union UINT_FLOAT SQ_ALU_CONST_CACHE_VS_2; // = 0x28988, // SAME + union UINT_FLOAT SQ_ALU_CONST_CACHE_VS_3; // = 0x2898C, // SAME + union UINT_FLOAT SQ_ALU_CONST_CACHE_VS_4; // = 0x28990, // SAME + union UINT_FLOAT SQ_ALU_CONST_CACHE_VS_5; // = 0x28994, // SAME + union UINT_FLOAT SQ_ALU_CONST_CACHE_VS_6; // = 0x28998, // SAME + union UINT_FLOAT SQ_ALU_CONST_CACHE_VS_7; // = 0x2899C, // SAME + union UINT_FLOAT SQ_ALU_CONST_CACHE_VS_8; // = 0x289A0, // SAME + union UINT_FLOAT SQ_ALU_CONST_CACHE_VS_9; // = 0x289A4, // SAME + union UINT_FLOAT SQ_ALU_CONST_CACHE_VS_10; // = 0x289A8, // SAME + union UINT_FLOAT SQ_ALU_CONST_CACHE_VS_11; // = 0x289AC, // SAME + union UINT_FLOAT SQ_ALU_CONST_CACHE_VS_12; // = 0x289B0, // SAME + union UINT_FLOAT SQ_ALU_CONST_CACHE_VS_13; // = 0x289B4, // SAME + union UINT_FLOAT SQ_ALU_CONST_CACHE_VS_14; // = 0x289B8, // SAME + union UINT_FLOAT SQ_ALU_CONST_CACHE_VS_15; // = 0x289BC, // SAME + + GLboolean dirty; + int num_consts; + union UINT_FLOAT consts[EVERGREEN_MAX_DX9_CONSTS][4]; +} EVERGREEN_VS_RES; + +typedef struct _EVERGREEN_CHIP_CONTEXT +{ +/* Registers from PA block: */ + union UINT_FLOAT PA_SC_SCREEN_SCISSOR_TL; //// // = 0x28030, // DIFF + union UINT_FLOAT PA_SC_SCREEN_SCISSOR_BR; //// // = 0x28034, // DIFF + union UINT_FLOAT PA_SC_WINDOW_OFFSET; //// // = 0x28200, // DIFF + union UINT_FLOAT PA_SC_WINDOW_SCISSOR_TL; //// // = 0x28204, // DIFF + union UINT_FLOAT PA_SC_WINDOW_SCISSOR_BR; //// // = 0x28208, // DIFF + union UINT_FLOAT PA_SC_CLIPRECT_RULE; //// // = 0x2820C, // SAME + union UINT_FLOAT PA_SC_CLIPRECT_0_TL; //// // = 0x28210, // DIFF + union UINT_FLOAT PA_SC_CLIPRECT_0_BR; //// // = 0x28214, // DIFF + union UINT_FLOAT PA_SC_CLIPRECT_1_TL; //// // = 0x28218, // DIFF + union UINT_FLOAT PA_SC_CLIPRECT_1_BR; //// // = 0x2821C, // DIFF + union UINT_FLOAT PA_SC_CLIPRECT_2_TL; //// // = 0x28220, // DIFF + union UINT_FLOAT PA_SC_CLIPRECT_2_BR; //// // = 0x28224, // DIFF + union UINT_FLOAT PA_SC_CLIPRECT_3_TL; //// // = 0x28228, // DIFF + union UINT_FLOAT PA_SC_CLIPRECT_3_BR; //// // = 0x2822C, // DIFF + union UINT_FLOAT PA_SC_EDGERULE; // = 0x28230, // SAME + union UINT_FLOAT PA_SU_HARDWARE_SCREEN_OFFSET; // = 0x28234, // + union UINT_FLOAT PA_SC_GENERIC_SCISSOR_TL; //// // = 0x28240, // DIFF + union UINT_FLOAT PA_SC_GENERIC_SCISSOR_BR; //// // = 0x28244, // DIFF + + EVERGREEN_VIEWPORT_STATE viewport[EVERGREEN_MAX_VIEWPORTS]; + EVERGREEN_UCP_STATE ucp[EVERGREEN_MAX_UCP]; + + union UINT_FLOAT PA_CL_POINT_X_RAD; // = 0x287D4, // SAME 0x28E10 + union UINT_FLOAT PA_CL_POINT_Y_RAD; // = 0x287D8, // SAME 0x28E14 + union UINT_FLOAT PA_CL_POINT_SIZE; // = 0x287DC, // SAME 0x28E18 + union UINT_FLOAT PA_CL_POINT_CULL_RAD; // = 0x287E0, // SAME 0x28E1C + union UINT_FLOAT PA_CL_CLIP_CNTL; //// // = 0x28810, // SAME + union UINT_FLOAT PA_SU_SC_MODE_CNTL; //// // = 0x28814, // SAME + union UINT_FLOAT PA_CL_VTE_CNTL; //// // = 0x28818, // SAME + union UINT_FLOAT PA_CL_VS_OUT_CNTL; //// // = 0x2881C, // SAME + union UINT_FLOAT PA_CL_NANINF_CNTL; //// // = 0x28820, // SAME + union UINT_FLOAT PA_SU_LINE_STIPPLE_CNTL; // = 0x28824, // + union UINT_FLOAT PA_SU_LINE_STIPPLE_SCALE; // = 0x28828, // + union UINT_FLOAT PA_SU_PRIM_FILTER_CNTL; // = 0x2882C, // + union UINT_FLOAT PA_SU_POINT_SIZE; //// // = 0x28A00, // SAME + union UINT_FLOAT PA_SU_POINT_MINMAX; //// // = 0x28A04, // SAME + union UINT_FLOAT PA_SU_LINE_CNTL; //// // = 0x28A08, // SAME + union UINT_FLOAT PA_SC_LINE_STIPPLE; // = 0x28A0C, // SAME + union UINT_FLOAT PA_SC_MODE_CNTL_0; //// // = 0x28A48, // + union UINT_FLOAT PA_SC_MODE_CNTL_1; //// // = 0x28A4C, // + union UINT_FLOAT PA_SU_POLY_OFFSET_DB_FMT_CNTL; //// // = 0x28B78, // SAME 0x28DF8 + union UINT_FLOAT PA_SU_POLY_OFFSET_CLAMP; //// // = 0x28B7C, // SAME 0x28DFC + union UINT_FLOAT PA_SU_POLY_OFFSET_FRONT_SCALE;//// // = 0x28B80, // SAME 0x28E00 + union UINT_FLOAT PA_SU_POLY_OFFSET_FRONT_OFFSET; //// // = 0x28B84, // SAME 0x28E04 + union UINT_FLOAT PA_SU_POLY_OFFSET_BACK_SCALE; //// // = 0x28B88, // SAME 0x28E08 + union UINT_FLOAT PA_SU_POLY_OFFSET_BACK_OFFSET; //// // = 0x28B8C, // SAME 0x28E0C + union UINT_FLOAT PA_SC_LINE_CNTL; //// // = 0x28C00, // DIFF + union UINT_FLOAT PA_SC_AA_CONFIG; //// // = 0x28C04, // SAME + union UINT_FLOAT PA_SU_VTX_CNTL; //// // = 0x28C08, // SAME + union UINT_FLOAT PA_CL_GB_VERT_CLIP_ADJ; //// // = 0x28C0C, // SAME + union UINT_FLOAT PA_CL_GB_VERT_DISC_ADJ; //// // = 0x28C10, // SAME + union UINT_FLOAT PA_CL_GB_HORZ_CLIP_ADJ; //// // = 0x28C14, // SAME + union UINT_FLOAT PA_CL_GB_HORZ_DISC_ADJ; //// // = 0x28C18, // SAME + union UINT_FLOAT PA_SC_AA_SAMPLE_LOCS_0; //// // = 0x28C1C, // + union UINT_FLOAT PA_SC_AA_SAMPLE_LOCS_1; //// // = 0x28C20, // + union UINT_FLOAT PA_SC_AA_SAMPLE_LOCS_2; //// // = 0x28C24, // + union UINT_FLOAT PA_SC_AA_SAMPLE_LOCS_3; //// // = 0x28C28, // + union UINT_FLOAT PA_SC_AA_SAMPLE_LOCS_4; //// // = 0x28C2C, // + union UINT_FLOAT PA_SC_AA_SAMPLE_LOCS_5; //// // = 0x28C30, // + union UINT_FLOAT PA_SC_AA_SAMPLE_LOCS_6; //// // = 0x28C34, // + union UINT_FLOAT PA_SC_AA_SAMPLE_LOCS_7; //// // = 0x28C38, // + union UINT_FLOAT PA_SC_AA_MASK; //// // = 0x28C3C, // SAME 0x28C48 + +/* Registers from VGT block: */ + union UINT_FLOAT VGT_INDEX_TYPE; // = 0x895C, // SAME + union UINT_FLOAT VGT_PRIMITIVE_TYPE; // = 0x8958, // SAME + union UINT_FLOAT VGT_MAX_VTX_INDX; //// // = 0x28400, // SAME + union UINT_FLOAT VGT_MIN_VTX_INDX; //// // = 0x28404, // SAME + union UINT_FLOAT VGT_INDX_OFFSET; //// // = 0x28408, // SAME + union UINT_FLOAT VGT_MULTI_PRIM_IB_RESET_INDX; // = 0x2840C, // SAME + + union UINT_FLOAT VGT_DRAW_INITIATOR; // = 0x287F0, // SAME + union UINT_FLOAT VGT_IMMED_DATA; // = 0x287F4, // SAME + + union UINT_FLOAT VGT_OUTPUT_PATH_CNTL; //// // = 0x28A10, // DIFF + union UINT_FLOAT VGT_HOS_CNTL; // = 0x28A14, // SAME + union UINT_FLOAT VGT_HOS_MAX_TESS_LEVEL; // = 0x28A18, // SAME + union UINT_FLOAT VGT_HOS_MIN_TESS_LEVEL; // = 0x28A1C, // SAME + union UINT_FLOAT VGT_HOS_REUSE_DEPTH; // = 0x28A20, // SAME + union UINT_FLOAT VGT_GROUP_PRIM_TYPE; // = 0x28A24, // SAME + union UINT_FLOAT VGT_GROUP_FIRST_DECR; // = 0x28A28, // SAME + union UINT_FLOAT VGT_GROUP_DECR; // = 0x28A2C, // SAME + union UINT_FLOAT VGT_GROUP_VECT_0_CNTL; // = 0x28A30, // SAME + union UINT_FLOAT VGT_GROUP_VECT_1_CNTL; // = 0x28A34, // SAME + union UINT_FLOAT VGT_GROUP_VECT_0_FMT_CNTL; // = 0x28A38, // SAME + union UINT_FLOAT VGT_GROUP_VECT_1_FMT_CNTL; // = 0x28A3C, // SAME + union UINT_FLOAT VGT_GS_MODE; //// // = 0x28A40, // DIFF + + union UINT_FLOAT VGT_PRIMITIVEID_EN; //// // = 0x28A84, // SAME + union UINT_FLOAT VGT_DMA_NUM_INSTANCES; //// // = 0x28A88, // SAME + union UINT_FLOAT VGT_EVENT_INITIATOR; // = 0x28A90, // SAME + union UINT_FLOAT VGT_MULTI_PRIM_IB_RESET_EN; // = 0x28A94, // SAME + union UINT_FLOAT VGT_INSTANCE_STEP_RATE_0; //// // = 0x28AA0, // SAME + union UINT_FLOAT VGT_INSTANCE_STEP_RATE_1; //// // = 0x28AA4, // SAME + union UINT_FLOAT VGT_REUSE_OFF; //// // = 0x28AB4, // SAME + union UINT_FLOAT VGT_VTX_CNT_EN; //// // = 0x28AB8, // SAME + + union UINT_FLOAT VGT_SHADER_STAGES_EN; //// // = 0x28B54, // + + union UINT_FLOAT VGT_STRMOUT_CONFIG; //// // = 0x28B94, // + union UINT_FLOAT VGT_STRMOUT_BUFFER_CONFIG; //// // = 0x28B98, // + union UINT_FLOAT VGT_VERTEX_REUSE_BLOCK_CNTL;//// // = 0x28C58, // SAME + union UINT_FLOAT VGT_OUT_DEALLOC_CNTL; //// // = 0x28C5C, // SAME + +/* Registers from SQ block: */ + union UINT_FLOAT SQ_VTX_SEMANTIC_0; //// // = 0x28380, // SAME + union UINT_FLOAT SQ_VTX_SEMANTIC_1; //// // = 0x28384, // SAME + union UINT_FLOAT SQ_VTX_SEMANTIC_2; //// // = 0x28388, // SAME + union UINT_FLOAT SQ_VTX_SEMANTIC_3; //// // = 0x2838C, // SAME + union UINT_FLOAT SQ_VTX_SEMANTIC_4; //// // = 0x28390, // SAME + union UINT_FLOAT SQ_VTX_SEMANTIC_5; //// // = 0x28394, // SAME + union UINT_FLOAT SQ_VTX_SEMANTIC_6; //// // = 0x28398, // SAME + union UINT_FLOAT SQ_VTX_SEMANTIC_7; //// // = 0x2839C, // SAME + union UINT_FLOAT SQ_VTX_SEMANTIC_8; //// // = 0x283A0, // SAME + union UINT_FLOAT SQ_VTX_SEMANTIC_9; //// // = 0x283A4, // SAME + union UINT_FLOAT SQ_VTX_SEMANTIC_10; //// // = 0x283A8, // SAME + union UINT_FLOAT SQ_VTX_SEMANTIC_11; //// // = 0x283AC, // SAME + union UINT_FLOAT SQ_VTX_SEMANTIC_12; //// // = 0x283B0, // SAME + union UINT_FLOAT SQ_VTX_SEMANTIC_13; //// // = 0x283B4, // SAME + union UINT_FLOAT SQ_VTX_SEMANTIC_14; //// // = 0x283B8, // SAME + union UINT_FLOAT SQ_VTX_SEMANTIC_15; //// // = 0x283BC, // SAME + union UINT_FLOAT SQ_VTX_SEMANTIC_16; //// // = 0x283C0, // SAME + union UINT_FLOAT SQ_VTX_SEMANTIC_17; //// // = 0x283C4, // SAME + union UINT_FLOAT SQ_VTX_SEMANTIC_18; //// // = 0x283C8, // SAME + union UINT_FLOAT SQ_VTX_SEMANTIC_19; //// // = 0x283CC, // SAME + union UINT_FLOAT SQ_VTX_SEMANTIC_20; //// // = 0x283D0, // SAME + union UINT_FLOAT SQ_VTX_SEMANTIC_21; //// // = 0x283D4, // SAME + union UINT_FLOAT SQ_VTX_SEMANTIC_22; //// // = 0x283D8, // SAME + union UINT_FLOAT SQ_VTX_SEMANTIC_23; //// // = 0x283DC, // SAME + union UINT_FLOAT SQ_VTX_SEMANTIC_24; //// // = 0x283E0, // SAME + union UINT_FLOAT SQ_VTX_SEMANTIC_25; //// // = 0x283E4, // SAME + union UINT_FLOAT SQ_VTX_SEMANTIC_26; //// // = 0x283E8, // SAME + union UINT_FLOAT SQ_VTX_SEMANTIC_27; //// // = 0x283EC, // SAME + union UINT_FLOAT SQ_VTX_SEMANTIC_28; //// // = 0x283F0, // SAME + union UINT_FLOAT SQ_VTX_SEMANTIC_29; //// // = 0x283F4, // SAME + union UINT_FLOAT SQ_VTX_SEMANTIC_30; //// // = 0x283F8, // SAME + union UINT_FLOAT SQ_VTX_SEMANTIC_31; //// // = 0x283FC, // SAME + union UINT_FLOAT SQ_DYN_GPR_RESOURCE_LIMIT_1;//// // = 0x28838, // + + union UINT_FLOAT SQ_PGM_RESOURCES_PS; //// // = 0x28844, // DIFF 0x28850 + union UINT_FLOAT SQ_PGM_RESOURCES_2_PS; //// // = 0x28848, // + union UINT_FLOAT SQ_PGM_EXPORTS_PS; //// // = 0x2884C, // SAME 0x28854 + + union UINT_FLOAT SQ_PGM_RESOURCES_VS;//// // = 0x28860, // DIFF 0x28868 + union UINT_FLOAT SQ_PGM_RESOURCES_2_VS; //// // = 0x28864, // + union UINT_FLOAT SQ_PGM_START_GS; //// // = 0x28874, // SAME 0x2886C + union UINT_FLOAT SQ_PGM_RESOURCES_GS; //// // = 0x28878, // DIFF 0x2887C + union UINT_FLOAT SQ_PGM_RESOURCES_2_GS; //// // = 0x2887C, // + union UINT_FLOAT SQ_PGM_START_ES; //// // = 0x2888C, // SAME 0x28880 + union UINT_FLOAT SQ_PGM_RESOURCES_ES; //// // = 0x28890, // DIFF + union UINT_FLOAT SQ_PGM_RESOURCES_2_ES; //// // = 0x28894, // + union UINT_FLOAT SQ_PGM_START_FS; //// // = 0x288A4, // SAME 0x28894 + union UINT_FLOAT SQ_PGM_RESOURCES_FS; //// // = 0x288A8, // DIFF 0x288A4 + union UINT_FLOAT SQ_PGM_START_HS; // = 0x288B8, // + union UINT_FLOAT SQ_PGM_RESOURCES_HS; // = 0x288BC, // + union UINT_FLOAT SQ_PGM_RESOURCES_2_HS;//// // = 0x288C0, // + union UINT_FLOAT SQ_PGM_START_LS; // = 0x288D0, // + union UINT_FLOAT SQ_PGM_RESOURCES_LS; // = 0x288D4, // + union UINT_FLOAT SQ_PGM_RESOURCES_2_LS; //// // = 0x288D8, // + union UINT_FLOAT SQ_LDS_ALLOC_PS; //// // = 0x288EC, // + union UINT_FLOAT SQ_ESGS_RING_ITEMSIZE; //// // = 0x28900, // SAME 0x288A8 + union UINT_FLOAT SQ_GSVS_RING_ITEMSIZE; //// // = 0x28904, // SAME 0x288AC + union UINT_FLOAT SQ_ESTMP_RING_ITEMSIZE; //// // = 0x28908, // SAME 0x288B0 + union UINT_FLOAT SQ_GSTMP_RING_ITEMSIZE; //// // = 0x2890C, // SAME 0x288B4 + union UINT_FLOAT SQ_VSTMP_RING_ITEMSIZE; //// // = 0x28910, // SAME 0x288B8 + union UINT_FLOAT SQ_PSTMP_RING_ITEMSIZE; //// // = 0x28914, // SAME 0x288BC + union UINT_FLOAT SQ_GS_VERT_ITEMSIZE; //// // = 0x2891C, // SAME 0x288C8 + union UINT_FLOAT SQ_GS_VERT_ITEMSIZE_1; // = 0x28920, // + union UINT_FLOAT SQ_GS_VERT_ITEMSIZE_2; // = 0x28924, // + union UINT_FLOAT SQ_GS_VERT_ITEMSIZE_3; // = 0x28928, // + + union UINT_FLOAT SQ_ALU_CONST_CACHE_GS_0; // = 0x289C0, // SAME + union UINT_FLOAT SQ_ALU_CONST_CACHE_GS_1; // = 0x289C4, // SAME + union UINT_FLOAT SQ_ALU_CONST_CACHE_GS_2; // = 0x289C8, // SAME + union UINT_FLOAT SQ_ALU_CONST_CACHE_GS_3; // = 0x289CC, // SAME + union UINT_FLOAT SQ_ALU_CONST_CACHE_GS_4; // = 0x289D0, // SAME + union UINT_FLOAT SQ_ALU_CONST_CACHE_GS_5; // = 0x289D4, // SAME + union UINT_FLOAT SQ_ALU_CONST_CACHE_GS_6; // = 0x289D8, // SAME + union UINT_FLOAT SQ_ALU_CONST_CACHE_GS_7; // = 0x289DC, // SAME + union UINT_FLOAT SQ_ALU_CONST_CACHE_GS_8; // = 0x289E0, // SAME + union UINT_FLOAT SQ_ALU_CONST_CACHE_GS_9; // = 0x289E4, // SAME + union UINT_FLOAT SQ_ALU_CONST_CACHE_GS_10; // = 0x289E8, // SAME + union UINT_FLOAT SQ_ALU_CONST_CACHE_GS_11; // = 0x289EC, // SAME + union UINT_FLOAT SQ_ALU_CONST_CACHE_GS_12; // = 0x289F0, // SAME + union UINT_FLOAT SQ_ALU_CONST_CACHE_GS_13; // = 0x289F4, // SAME + union UINT_FLOAT SQ_ALU_CONST_CACHE_GS_14; // = 0x289F8, // SAME + union UINT_FLOAT SQ_ALU_CONST_CACHE_GS_15; // = 0x289FC, // SAME + union UINT_FLOAT SQ_ALU_CONST_CACHE_HS_0; // = 0x28F00, // + union UINT_FLOAT SQ_ALU_CONST_CACHE_HS_1; // = 0x28F04, // + union UINT_FLOAT SQ_ALU_CONST_CACHE_HS_2; // = 0x28F08, // + union UINT_FLOAT SQ_ALU_CONST_CACHE_HS_3; // = 0x28F0C, // + union UINT_FLOAT SQ_ALU_CONST_CACHE_HS_4; // = 0x28F10, // + union UINT_FLOAT SQ_ALU_CONST_CACHE_HS_5; // = 0x28F14, // + union UINT_FLOAT SQ_ALU_CONST_CACHE_HS_6; // = 0x28F18, // + union UINT_FLOAT SQ_ALU_CONST_CACHE_HS_7; // = 0x28F1C, // + union UINT_FLOAT SQ_ALU_CONST_CACHE_HS_8; // = 0x28F20, // + union UINT_FLOAT SQ_ALU_CONST_CACHE_HS_9; // = 0x28F24, // + union UINT_FLOAT SQ_ALU_CONST_CACHE_HS_10; // = 0x28F28, // + union UINT_FLOAT SQ_ALU_CONST_CACHE_HS_11; // = 0x28F2C, // + union UINT_FLOAT SQ_ALU_CONST_CACHE_HS_12; // = 0x28F30, // + union UINT_FLOAT SQ_ALU_CONST_CACHE_HS_13; // = 0x28F34, // + union UINT_FLOAT SQ_ALU_CONST_CACHE_HS_14; // = 0x28F38, // + union UINT_FLOAT SQ_ALU_CONST_CACHE_HS_15; // = 0x28F3C, // + union UINT_FLOAT SQ_ALU_CONST_CACHE_LS_0; // = 0x28F40, // + union UINT_FLOAT SQ_ALU_CONST_CACHE_LS_1; // = 0x28F44, // + union UINT_FLOAT SQ_ALU_CONST_CACHE_LS_2; // = 0x28F48, // + union UINT_FLOAT SQ_ALU_CONST_CACHE_LS_3; // = 0x28F4C, // + union UINT_FLOAT SQ_ALU_CONST_CACHE_LS_4; // = 0x28F50, // + union UINT_FLOAT SQ_ALU_CONST_CACHE_LS_5; // = 0x28F54, // + union UINT_FLOAT SQ_ALU_CONST_CACHE_LS_6; // = 0x28F58, // + union UINT_FLOAT SQ_ALU_CONST_CACHE_LS_7; // = 0x28F5C, // + union UINT_FLOAT SQ_ALU_CONST_CACHE_LS_8; // = 0x28F60, // + union UINT_FLOAT SQ_ALU_CONST_CACHE_LS_9; // = 0x28F64, // + union UINT_FLOAT SQ_ALU_CONST_CACHE_LS_10; // = 0x28F68, // + union UINT_FLOAT SQ_ALU_CONST_CACHE_LS_11; // = 0x28F6C, // + union UINT_FLOAT SQ_ALU_CONST_CACHE_LS_12; // = 0x28F70, // + union UINT_FLOAT SQ_ALU_CONST_CACHE_LS_13; // = 0x28F74, // + union UINT_FLOAT SQ_ALU_CONST_CACHE_LS_14; // = 0x28F78, // + union UINT_FLOAT SQ_ALU_CONST_CACHE_LS_15; // = 0x28F7C, // + union UINT_FLOAT SQ_ALU_CONST_BUFFER_SIZE_HS_0; // = 0x28F80, // + union UINT_FLOAT SQ_ALU_CONST_BUFFER_SIZE_HS_1; // = 0x28F84, // + union UINT_FLOAT SQ_ALU_CONST_BUFFER_SIZE_HS_2; // = 0x28F88, // + union UINT_FLOAT SQ_ALU_CONST_BUFFER_SIZE_HS_3; // = 0x28F8C, // + union UINT_FLOAT SQ_ALU_CONST_BUFFER_SIZE_HS_4; // = 0x28F90, // + union UINT_FLOAT SQ_ALU_CONST_BUFFER_SIZE_HS_5; // = 0x28F94, // + union UINT_FLOAT SQ_ALU_CONST_BUFFER_SIZE_HS_6; // = 0x28F98, // + union UINT_FLOAT SQ_ALU_CONST_BUFFER_SIZE_HS_7; // = 0x28F9C, // + union UINT_FLOAT SQ_ALU_CONST_BUFFER_SIZE_HS_8; // = 0x28FA0, // + union UINT_FLOAT SQ_ALU_CONST_BUFFER_SIZE_HS_9; // = 0x28FA4, // + union UINT_FLOAT SQ_ALU_CONST_BUFFER_SIZE_HS_10; // = 0x28FA8, // + union UINT_FLOAT SQ_ALU_CONST_BUFFER_SIZE_HS_11; // = 0x28FAC, // + union UINT_FLOAT SQ_ALU_CONST_BUFFER_SIZE_HS_12; // = 0x28FB0, // + union UINT_FLOAT SQ_ALU_CONST_BUFFER_SIZE_HS_13; // = 0x28FB4, // + union UINT_FLOAT SQ_ALU_CONST_BUFFER_SIZE_HS_14; // = 0x28FB8, // + union UINT_FLOAT SQ_ALU_CONST_BUFFER_SIZE_HS_15; // = 0x28FBC, // + union UINT_FLOAT SQ_ALU_CONST_BUFFER_SIZE_LS_0; // = 0x28FC0, // + union UINT_FLOAT SQ_ALU_CONST_BUFFER_SIZE_LS_1; // = 0x28FC4, // + union UINT_FLOAT SQ_ALU_CONST_BUFFER_SIZE_LS_2; // = 0x28FC8, // + union UINT_FLOAT SQ_ALU_CONST_BUFFER_SIZE_LS_3; // = 0x28FCC, // + union UINT_FLOAT SQ_ALU_CONST_BUFFER_SIZE_LS_4; // = 0x28FD0, // + union UINT_FLOAT SQ_ALU_CONST_BUFFER_SIZE_LS_5; // = 0x28FD4, // + union UINT_FLOAT SQ_ALU_CONST_BUFFER_SIZE_LS_6; // = 0x28FD8, // + union UINT_FLOAT SQ_ALU_CONST_BUFFER_SIZE_LS_7; // = 0x28FDC, // + union UINT_FLOAT SQ_ALU_CONST_BUFFER_SIZE_LS_8; // = 0x28FE0, // + union UINT_FLOAT SQ_ALU_CONST_BUFFER_SIZE_LS_9; // = 0x28FE4, // + union UINT_FLOAT SQ_ALU_CONST_BUFFER_SIZE_LS_10; // = 0x28FE8, // + union UINT_FLOAT SQ_ALU_CONST_BUFFER_SIZE_LS_11; // = 0x28FEC, // + union UINT_FLOAT SQ_ALU_CONST_BUFFER_SIZE_LS_12; // = 0x28FF0, // + union UINT_FLOAT SQ_ALU_CONST_BUFFER_SIZE_LS_13; // = 0x28FF4, // + union UINT_FLOAT SQ_ALU_CONST_BUFFER_SIZE_LS_14; // = 0x28FF8, // + union UINT_FLOAT SQ_ALU_CONST_BUFFER_SIZE_LS_15; // = 0x28FFC, // + + EVERGREEN_PS_RES ps; + EVERGREEN_VS_RES vs; + +/* Registers from SPI block: */ + union UINT_FLOAT SPI_VS_OUT_ID_0; //// // = 0x2861C, // SAME 0x28614 + union UINT_FLOAT SPI_VS_OUT_ID_1; //// // = 0x28620, // SAME 0x28618 + union UINT_FLOAT SPI_VS_OUT_ID_2; //// // = 0x28624, // SAME 0x2861C + union UINT_FLOAT SPI_VS_OUT_ID_3; //// // = 0x28628, // SAME 0x28620 + union UINT_FLOAT SPI_VS_OUT_ID_4; //// // = 0x2862C, // SAME 0x28624 + union UINT_FLOAT SPI_VS_OUT_ID_5; //// // = 0x28630, // SAME 0x28628 + union UINT_FLOAT SPI_VS_OUT_ID_6; //// // = 0x28634, // SAME 0x2862C + union UINT_FLOAT SPI_VS_OUT_ID_7; //// // = 0x28638, // SAME 0x28630 + union UINT_FLOAT SPI_VS_OUT_ID_8; //// // = 0x2863C, // SAME 0x28634 + union UINT_FLOAT SPI_VS_OUT_ID_9; //// // = 0x28640, // SAME 0x28638 + union UINT_FLOAT SPI_PS_INPUT_CNTL[32]; //// // = 0x28644, // SAME + + union UINT_FLOAT SPI_VS_OUT_CONFIG; //// // = 0x286C4, // SAME + union UINT_FLOAT SPI_THREAD_GROUPING; //// // = 0x286C8, // DIFF + union UINT_FLOAT SPI_PS_IN_CONTROL_0; //// // = 0x286CC, // SAME + union UINT_FLOAT SPI_PS_IN_CONTROL_1; //// // = 0x286D0, // SAME + union UINT_FLOAT SPI_INTERP_CONTROL_0; //// // = 0x286D4, // SAME + union UINT_FLOAT SPI_INPUT_Z; //// // = 0x286D8, // SAME + union UINT_FLOAT SPI_FOG_CNTL; //// // = 0x286DC, // SAME + union UINT_FLOAT SPI_BARYC_CNTL; //// // = 0x286E0, // + union UINT_FLOAT SPI_PS_IN_CONTROL_2; //// // = 0x286E4, // + union UINT_FLOAT SPI_COMPUTE_INPUT_CNTL; // = 0x286E8, // + union UINT_FLOAT SPI_COMPUTE_NUM_THREAD_X; // = 0x286EC, // + union UINT_FLOAT SPI_COMPUTE_NUM_THREAD_Y; // = 0x286F0, // + union UINT_FLOAT SPI_COMPUTE_NUM_THREAD_Z; // = 0x286F4, // + +/* Registers from SX block: */ + union UINT_FLOAT SX_MISC; // = 0x28350, // SAME + union UINT_FLOAT SX_SURFACE_SYNC; // = 0x28354, // DIFF + union UINT_FLOAT SX_ALPHA_TEST_CONTROL; //// // = 0x28410, // SAME + union UINT_FLOAT SX_ALPHA_REF; // = 0x28438, // SAME + +/* Registers from DB block: */ + union UINT_FLOAT DB_RENDER_CONTROL; //// // = 0x28000, // DIFF 0x28D0C + union UINT_FLOAT DB_COUNT_CONTROL; //// // = 0x28004, // + union UINT_FLOAT DB_DEPTH_VIEW; //// // = 0x28008, // DIFF 0x28004 + union UINT_FLOAT DB_RENDER_OVERRIDE; //// // = 0x2800C, // DIFF 0x28D10 + union UINT_FLOAT DB_RENDER_OVERRIDE2; //// // = 0x28010, // + union UINT_FLOAT DB_HTILE_DATA_BASE; //// // = 0x28014, // SAME + union UINT_FLOAT DB_STENCIL_CLEAR; //// // = 0x28028, // SAME + union UINT_FLOAT DB_DEPTH_CLEAR; //// // = 0x2802C, // SAME + union UINT_FLOAT DB_Z_INFO; //// // = 0x28040, // + union UINT_FLOAT DB_STENCIL_INFO; //// // = 0x28044, // + union UINT_FLOAT DB_Z_READ_BASE; //// // = 0x28048, // + union UINT_FLOAT DB_STENCIL_READ_BASE;//// // = 0x2804C, // + union UINT_FLOAT DB_Z_WRITE_BASE; //// // = 0x28050, // + union UINT_FLOAT DB_STENCIL_WRITE_BASE; //// // = 0x28054, // + union UINT_FLOAT DB_DEPTH_SIZE; //// // = 0x28058, // DIFF 0x28000 + union UINT_FLOAT DB_DEPTH_SLICE; //// // = 0x2805C, // + union UINT_FLOAT DB_STENCILREFMASK; // = 0x28430, // SAME + union UINT_FLOAT DB_STENCILREFMASK_BF; // = 0x28434, // SAME + union UINT_FLOAT DB_DEPTH_CONTROL; //// // = 0x28800, // SAME + union UINT_FLOAT DB_SHADER_CONTROL;//// // = 0x2880C, // DIFF + union UINT_FLOAT DB_HTILE_SURFACE; //// // = 0x28ABC, // SAME 0x28D24 + union UINT_FLOAT DB_SRESULTS_COMPARE_STATE0; //// // = 0x28AC0, // SAME 0x28D28 + union UINT_FLOAT DB_SRESULTS_COMPARE_STATE1; //// // = 0x28AC4, // SAME 0x28D2C + union UINT_FLOAT DB_PRELOAD_CONTROL; //// // = 0x28AC8, // SAME 0x28D30 + union UINT_FLOAT DB_ALPHA_TO_MASK; //// // = 0x28B70, // SAME 0x28D44 + +/* Registers from CB block: */ + union UINT_FLOAT CB_TARGET_MASK; //// // = 0x28238, // SAME + union UINT_FLOAT CB_SHADER_MASK; //// // = 0x2823C, // SAME + union UINT_FLOAT CB_BLEND_RED; //// // = 0x28414, // SAME + union UINT_FLOAT CB_BLEND_GREEN; //// // = 0x28418, // SAME + union UINT_FLOAT CB_BLEND_BLUE; //// // = 0x2841C, // SAME + union UINT_FLOAT CB_BLEND_ALPHA; //// // = 0x28420, // SAME + union UINT_FLOAT CB_BLEND0_CONTROL; //// // = 0x28780, // DIFF + union UINT_FLOAT CB_BLEND1_CONTROL; // = 0x28784, // DIFF + union UINT_FLOAT CB_BLEND2_CONTROL; // = 0x28788, // DIFF + union UINT_FLOAT CB_BLEND3_CONTROL; // = 0x2878C, // DIFF + union UINT_FLOAT CB_BLEND4_CONTROL; // = 0x28790, // DIFF + union UINT_FLOAT CB_BLEND5_CONTROL; // = 0x28794, // DIFF + union UINT_FLOAT CB_BLEND6_CONTROL; // = 0x28798, // DIFF + union UINT_FLOAT CB_BLEND7_CONTROL; // = 0x2879C, // DIFF + union UINT_FLOAT CB_COLOR_CONTROL; //// // = 0x28808, // DIFF + union UINT_FLOAT CB_CLRCMP_CONTROL; //// // = 0x28C40, // SAME 0x28C30 + union UINT_FLOAT CB_CLRCMP_SRC; //// // = 0x28C44, // SAME 0x28C34 + union UINT_FLOAT CB_CLRCMP_DST; //// // = 0x28C48, // SAME 0x28C38 + union UINT_FLOAT CB_CLRCMP_MSK; //// // = 0x28C4C, // SAME 0x28C3C + + EVERGREEN_RENDER_TARGET_STATE render_target[EVERGREEN_MAX_RENDER_TARGETS]; + + radeonTexObj* textures[R700_TEXTURE_NUMBERUNITS]; + + EVERGREEN_CONFIG evergreen_config; + + GLboolean bEnablePerspective; + +} EVERGREEN_CHIP_CONTEXT; + +#endif /* _EVERGREEN_CHIP_H_ */ \ No newline at end of file diff --git a/src/mesa/drivers/dri/r600/evergreen_context.c b/src/mesa/drivers/dri/r600/evergreen_context.c new file mode 100644 index 0000000000..0ec7e3a238 --- /dev/null +++ b/src/mesa/drivers/dri/r600/evergreen_context.c @@ -0,0 +1,109 @@ +/* + * Copyright (C) 2008-2010 Advanced Micro Devices, Inc. + * + * 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 + * THE COPYRIGHT HOLDER(S) 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. + */ + +/* + * Authors: + * Richard Li , + */ + +#include "main/glheader.h" +#include "main/api_arrayelt.h" +#include "main/context.h" +#include "main/simple_list.h" +#include "main/imports.h" +#include "main/extensions.h" +#include "main/bufferobj.h" +#include "main/texobj.h" + +#include "radeon_common_context.h" +#include "evergreen_context.h" +#include "evergreen_state.h" +#include "r600_blit.h" + +#include "utils.h" + +static void evergreen_get_lock(radeonContextPtr rmesa) +{ + drm_radeon_sarea_t *sarea = rmesa->sarea; + + if (sarea->ctx_owner != rmesa->dri.hwContext) { + sarea->ctx_owner = rmesa->dri.hwContext; + if (!rmesa->radeonScreen->kernel_mm) + radeon_bo_legacy_texture_age(rmesa->radeonScreen->bom); + } +} + +static void evergreen_vtbl_emit_cs_header(struct radeon_cs *cs, radeonContextPtr rmesa) +{ + /* please flush pipe do all pending work */ + /* to be enabled */ +} + +static void evergreen_vtbl_pre_emit_atoms(radeonContextPtr radeon) +{ + //TODO apr.01 + //r700Start3D((context_t *)radeon); +} + +static void evergreen_fallback(GLcontext *ctx, GLuint bit, GLboolean mode) +{ + context_t *context = EVERGREEN_CONTEXT(ctx); + if (mode) + context->radeon.Fallback |= bit; + else + context->radeon.Fallback &= ~bit; +} + +static void evergreen_emit_query_finish(radeonContextPtr radeon) +{ + //TODO apr.01 + //context_t *context = (context_t*) radeon; + //BATCH_LOCALS(&context->radeon); + + struct radeon_query_object *query = radeon->query.current; + + //BEGIN_BATCH_NO_AUTOSTATE(4 + 2); + //R600_OUT_BATCH(CP_PACKET3(R600_IT_EVENT_WRITE, 2)); + //R600_OUT_BATCH(ZPASS_DONE); + //R600_OUT_BATCH(query->curr_offset + 8); /* hw writes qwords */ + //R600_OUT_BATCH(0x00000000); + //R600_OUT_BATCH_RELOC(VGT_EVENT_INITIATOR, query->bo, 0, 0, RADEON_GEM_DOMAIN_GTT, 0); + //END_BATCH(); + //assert(query->curr_offset < RADEON_QUERY_PAGE_SIZE); + query->emitted_begin = GL_FALSE; +} + +void evergreen_init_vtbl(radeonContextPtr radeon) +{ + radeon->vtbl.get_lock = evergreen_get_lock; + radeon->vtbl.update_viewport_offset = evergreenUpdateViewportOffset; + radeon->vtbl.emit_cs_header = evergreen_vtbl_emit_cs_header; + radeon->vtbl.swtcl_flush = NULL; + radeon->vtbl.pre_emit_atoms = evergreen_vtbl_pre_emit_atoms; + radeon->vtbl.fallback = evergreen_fallback; + radeon->vtbl.emit_query_finish = evergreen_emit_query_finish; + radeon->vtbl.check_blit = r600_check_blit; + radeon->vtbl.blit = r600_blit; + radeon->vtbl.is_format_renderable = radeonIsFormatRenderable; +} + + + diff --git a/src/mesa/drivers/dri/r600/evergreen_context.h b/src/mesa/drivers/dri/r600/evergreen_context.h new file mode 100644 index 0000000000..4e50999c98 --- /dev/null +++ b/src/mesa/drivers/dri/r600/evergreen_context.h @@ -0,0 +1,38 @@ +/* + * Copyright (C) 2008-2010 Advanced Micro Devices, Inc. + * + * 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 + * THE COPYRIGHT HOLDER(S) 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. + */ + +/* + * Authors: + * Richard Li , + */ + +#ifndef _EVERGREEN_CONTEXT_H_ +#define _EVERGREEN_CONTEXT_H_ + +extern void evergreen_init_vtbl(radeonContextPtr radeon); + +#endif //_EVERGREEN_CONTEXT_H_ + + + + + + diff --git a/src/mesa/drivers/dri/r600/evergreen_diff.h b/src/mesa/drivers/dri/r600/evergreen_diff.h new file mode 100644 index 0000000000..c3a5fd0a38 --- /dev/null +++ b/src/mesa/drivers/dri/r600/evergreen_diff.h @@ -0,0 +1,335 @@ +/* + * Copyright (C) 2008-2010 Advanced Micro Devices, Inc. + * + * 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 + * THE COPYRIGHT HOLDER(S) 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. + */ + +/* + * Authors: + * Richard Li , + */ + +#ifndef _EVERGREEN_DIFF_H_ +#define _EVERGREEN_DIFF_H_ + +enum { + /* CB_BLEND_CONTROL */ + EG_CB_BLENDX_CONTROL_ENABLE_bit = 1 << 30, + /* PA_SC_SCREEN_SCISSOR_TL */ + EG_PA_SC_SCREEN_SCISSOR_TL__TL_X_mask = 0xffff << 0, + EG_PA_SC_SCREEN_SCISSOR_TL__TL_Y_mask = 0xffff << 16, + /* PA_SC_SCREEN_SCISSOR_BR */ + EG_PA_SC_SCREEN_SCISSOR_BR__BR_X_mask = 0xffff << 0, + EG_PA_SC_SCREEN_SCISSOR_BR__BR_Y_mask = 0xffff << 16, + /* PA_SC_WINDOW_SCISSOR_TL */ + EG_PA_SC_WINDOW_SCISSOR_TL__TL_X_mask = 0x7fff << 0, + EG_PA_SC_WINDOW_SCISSOR_TL__TL_Y_mask = 0x7fff << 16, + /* PA_SC_WINDOW_SCISSOR_BR */ + EG_PA_SC_WINDOW_SCISSOR_BR__BR_X_mask = 0x7fff << 0, + EG_PA_SC_WINDOW_SCISSOR_BR__BR_Y_mask = 0x7fff << 16, + /* PA_SC_CLIPRECT_0_TL */ + EG_PA_SC_CLIPRECT_0_TL__TL_X_mask = 0x7fff << 0, + EG_PA_SC_CLIPRECT_0_TL__TL_Y_mask = 0x7fff << 16, + /* PA_SC_CLIPRECT_0_BR */ + EG_PA_SC_CLIPRECT_0_BR__BR_X_mask = 0x7fff << 0, + EG_PA_SC_CLIPRECT_0_BR__BR_Y_mask = 0x7fff << 16, + /* PA_SC_GENERIC_SCISSOR_TL */ + EG_PA_SC_GENERIC_SCISSOR_TL__TL_X_mask = 0x7fff << 0, + EG_PA_SC_GENERIC_SCISSOR_TL__TL_Y_mask = 0x7fff << 16, + /* PA_SC_GENERIC_SCISSOR_BR */ + EG_PA_SC_GENERIC_SCISSOR_BR__BR_X_mask = 0x7fff << 0, + EG_PA_SC_GENERIC_SCISSOR_BR__BR_Y_mask = 0x7fff << 16, + /* PA_SC_VPORT_SCISSOR_0_TL */ + EG_PA_SC_VPORT_SCISSOR_0_TL__TL_X_mask = 0x7fff << 0, + EG_PA_SC_VPORT_SCISSOR_0_TL__TL_Y_mask = 0x7fff << 16, + /* PA_SC_VPORT_SCISSOR_0_BR */ + EG_PA_SC_VPORT_SCISSOR_0_BR__BR_X_mask = 0x7fff << 0, + EG_PA_SC_VPORT_SCISSOR_0_BR__BR_Y_mask = 0x7fff << 16, + /* PA_SC_WINDOW_OFFSET */ + EG_PA_SC_WINDOW_OFFSET__WINDOW_X_OFFSET_shift = 0, + EG_PA_SC_WINDOW_OFFSET__WINDOW_X_OFFSET_mask = 0xffff << 0, + EG_PA_SC_WINDOW_OFFSET__WINDOW_Y_OFFSET_shift = 16, + EG_PA_SC_WINDOW_OFFSET__WINDOW_Y_OFFSET_mask = 0xffff << 16, + /* SPI_BARYC_CNTL */ + EG_SPI_BARYC_CNTL__PERSP_CENTROID_ENA_shift = 4, + EG_SPI_BARYC_CNTL__PERSP_CENTROID_ENA_mask = 0x3 << 4, + EG_SPI_BARYC_CNTL__LINEAR_CENTROID_ENA_shift = 20, + EG_SPI_BARYC_CNTL__LINEAR_CENTROID_ENA_mask = 0x3 << 20, + /* DB_SHADER_CONTROL */ + EG_DB_SHADER_CONTROL__DUAL_EXPORT_ENABLE_bit = 1 << 9, + + /* DB_Z_INFO */ + EG_DB_Z_INFO__FORMAT_shift = 0, //2; + EG_DB_Z_INFO__FORMAT_mask = 0x3, + //2; + EG_DB_Z_INFO__ARRAY_MODE_shift = 4, //4; + EG_DB_Z_INFO__ARRAY_MODE_mask = 0xf << 4, + EG_DB_Z_INFO__TILE_SPLIT_shift = 8, //3; + EG_DB_Z_INFO__TILE_SPLIT_mask = 0x7 << 8, + //1; + EG_DB_Z_INFO__NUM_BANKS_shift = 12, //2; + EG_DB_Z_INFO__NUM_BANKS_mask = 0x3 << 12, + //2; + EG_DB_Z_INFO__BANK_WIDTH_shift = 16, //2; + EG_DB_Z_INFO__BANK_WIDTH_mask = 0x3 << 16, + //2; + EG_DB_Z_INFO__BANK_HEIGHT_shift = 20, //2; + EG_DB_Z_INFO__BANK_HEIGHT_mask = 0x3 << 20, + + EG_Z_INVALID = 0x00000000, + EG_Z_16 = 0x00000001, + EG_Z_24 = 0x00000002, + EG_Z_32_FLOAT = 0x00000003, + EG_ADDR_SURF_TILE_SPLIT_256B = 0x00000002, + EG_ADDR_SURF_8_BANK = 0x00000002, + EG_ADDR_SURF_BANK_WIDTH_1 = 0x00000000, + EG_ADDR_SURF_BANK_HEIGHT_1 = 0x00000000, + /* DB_STENCIL_INFO */ + EG_DB_STENCIL_INFO__FORMAT_bit = 1, //1; + //7; + EG_DB_STENCIL_INFO__TILE_SPLIT_shift = 8, //3; + EG_DB_STENCIL_INFO__TILE_SPLIT_mask = 0x7 << 8, + + /* DB_DEPTH_SIZE */ + EG_DB_DEPTH_SIZE__PITCH_TILE_MAX_shift = 0, // 11; + EG_DB_DEPTH_SIZE__PITCH_TILE_MAX_mask = 0x7ff, + EG_DB_DEPTH_SIZE__HEIGHT_TILE_MAX_shift = 11, // 11; + EG_DB_DEPTH_SIZE__HEIGHT_TILE_MAX_mask = 0x7ff << 11, + + /* DB_COUNT_CONTROL */ + EG_DB_COUNT_CONTROL__ZPASS_INCREMENT_DISABLE_shift = 0, //1 + EG_DB_COUNT_CONTROL__ZPASS_INCREMENT_DISABLE_bit = 1, + EG_DB_COUNT_CONTROL__PERFECT_ZPASS_COUNTS_shift = 1, //1 + EG_DB_COUNT_CONTROL__PERFECT_ZPASS_COUNTS_bit = 1 << 1, + + /* CB_COLOR_CONTROL */ + //3; + EG_CB_COLOR_CONTROL__DEGAMMA_ENABLE_bit = 1 << 3,//1; + EG_CB_COLOR_CONTROL__MODE_shift = 4, //3; + EG_CB_COLOR_CONTROL__MODE_mask = 0x7 << 4, + //9; + EG_CB_COLOR_CONTROL__ROP3_shift = 16, //8; + EG_CB_COLOR_CONTROL__ROP3_mask = 0xff << 16, + EG_CB_NORMAL = 0x00000001, + + /* CB_COLOR0_INFO */ + EG_CB_COLOR0_INFO__ENDIAN_shift = 0, //2; + EG_CB_COLOR0_INFO__ENDIAN_mask = 0x3, + EG_CB_COLOR0_INFO__FORMAT_shift = 2, //6; + EG_CB_COLOR0_INFO__FORMAT_mask = 0x3f << 2, + EG_CB_COLOR0_INFO__ARRAY_MODE_shift = 8, //4; + EG_CB_COLOR0_INFO__ARRAY_MODE_mask = 0xf << 8, + EG_CB_COLOR0_INFO__NUMBER_TYPE_shift = 12, //3; + EG_CB_COLOR0_INFO__NUMBER_TYPE_mask = 0x7 << 12, + EG_CB_COLOR0_INFO__COMP_SWAP_shift = 15, //2; + EG_CB_COLOR0_INFO__COMP_SWAP_mask = 0x3 << 15, + EG_CB_COLOR0_INFO__FAST_CLEAR_bit = 1 << 17,//1; + EG_CB_COLOR0_INFO__COMPRESSION_bit = 1 << 18,//1; + EG_CB_COLOR0_INFO__BLEND_CLAMP_bit = 1 << 19,//1; + EG_CB_COLOR0_INFO__BLEND_BYPASS_bit = 1 << 20,//1; + EG_CB_COLOR0_INFO__SIMPLE_FLOAT_bit = 1 << 21,//1; + EG_CB_COLOR0_INFO__ROUND_MODE_bit = 1 << 22,//1; + EG_CB_COLOR0_INFO__TILE_COMPACT_bit = 1 << 23,//1; + EG_CB_COLOR0_INFO__SOURCE_FORMAT_shift = 24, //2; + EG_CB_COLOR0_INFO__SOURCE_FORMAT_mask = 0x3 << 24, + EG_CB_COLOR0_INFO__RAT_bit = 1 << 26,//1; + EG_CB_COLOR0_INFO__RESOURCE_TYPE_shift = 27, //3; + EG_CB_COLOR0_INFO__RESOURCE_TYPE_mask = 0x7 << 27, + + /* CB_COLOR0_ATTRIB */ + EG_CB_COLOR0_ATTRIB__NON_DISP_TILING_ORDER_shift = 4, + EG_CB_COLOR0_ATTRIB__NON_DISP_TILING_ORDER_bit = 1 << 4, + + /* SPI_CONFIG_CNTL_1 */ + EG_SPI_CONFIG_CNTL_1__VTX_DONE_DELAY_shift = 0, + EG_SPI_CONFIG_CNTL_1__VTX_DONE_DELAY_mask = 0xf, + /* SQ_MS_FIFO_SIZES */ + EG_SQ_MS_FIFO_SIZES__CACHE_FIFO_SIZE_shift = 0, + EG_SQ_MS_FIFO_SIZES__CACHE_FIFO_SIZE_mask = 0xff, + EG_SQ_MS_FIFO_SIZES__FETCH_FIFO_HIWATER_shift = 8, + EG_SQ_MS_FIFO_SIZES__FETCH_FIFO_HIWATER_mask = 0x1f << 8, + EG_SQ_MS_FIFO_SIZES__DONE_FIFO_HIWATER_shift = 16, + EG_SQ_MS_FIFO_SIZES__DONE_FIFO_HIWATER_mask = 0xff << 16, + EG_SQ_MS_FIFO_SIZES__ALU_UPDATE_FIFO_HIWATER_shift = 24, + EG_SQ_MS_FIFO_SIZES__ALU_UPDATE_FIFO_HIWATER_mask = 0x1f << 24, + /* SQ_CONFIG */ + EG_SQ_CONFIG__VC_ENABLE_bit = 1, + EG_SQ_CONFIG__EXPORT_SRC_C_bit = 1 << 1, + EG_SQ_CONFIG__PS_PRIO_shift = 24, + EG_SQ_CONFIG__PS_PRIO_mask = 0x3 << 24, + EG_SQ_CONFIG__VS_PRIO_shift = 26, + EG_SQ_CONFIG__VS_PRIO_mask = 0x3 << 26, + EG_SQ_CONFIG__GS_PRIO_shift = 28, + EG_SQ_CONFIG__GS_PRIO_mask = 0x3 << 28, + EG_SQ_CONFIG__ES_PRIO_shift = 30, + EG_SQ_CONFIG__ES_PRIO_mask = 0x3 << 30, + /* PA_SC_FORCE_EOV_MAX_CNTS */ + EG_PA_SC_FORCE_EOV_MAX_CNTS__FORCE_EOV_MAX_CLK_CNT_shift = 0, + EG_PA_SC_FORCE_EOV_MAX_CNTS__FORCE_EOV_MAX_CLK_CNT_mask = 0x3fff, + EG_PA_SC_FORCE_EOV_MAX_CNTS__FORCE_EOV_MAX_REZ_CNT_shift = 16, + EG_PA_SC_FORCE_EOV_MAX_CNTS__FORCE_EOV_MAX_REZ_CNT_mask = 0x3fff << 16, + /* VGT_CACHE_INVALIDATION */ + EG_VGT_CACHE_INVALIDATION__CACHE_INVALIDATION_shift = 0, + EG_VGT_CACHE_INVALIDATION__CACHE_INVALIDATION_mask = 0x3, + /* CB_COLOR0_PITCH */ + EG_CB_COLOR0_PITCH__TILE_MAX_shift = 0, + EG_CB_COLOR0_PITCH__TILE_MAX_mask = 0x7ff, + /* CB_COLOR0_SLICE */ + EG_CB_COLOR0_SLICE__TILE_MAX_shift = 0, + EG_CB_COLOR0_SLICE__TILE_MAX_mask = 0x3fffff, + /* SQ_VTX_CONSTANT_WORD3_0 */ + EG_SQ_VTX_CONSTANT_WORD3_0__UNCACHED_shift = 2, + EG_SQ_VTX_CONSTANT_WORD3_0__UNCACHED_bit = 1 << 2, + + EG_SQ_VTX_CONSTANT_WORD3_0__DST_SEL_X_shift = 3, + EG_SQ_VTX_CONSTANT_WORD3_0__DST_SEL_X_mask = 0x7 << 3, + + EG_SQ_VTX_CONSTANT_WORD3_0__DST_SEL_Y_shift = 6, + EG_SQ_VTX_CONSTANT_WORD3_0__DST_SEL_Y_mask = 0x7 << 6, + + EG_SQ_VTX_CONSTANT_WORD3_0__DST_SEL_Z_shift = 9, + EG_SQ_VTX_CONSTANT_WORD3_0__DST_SEL_Z_mask = 0x7 << 9, + + EG_SQ_VTX_CONSTANT_WORD3_0__DST_SEL_W_shift = 12, + EG_SQ_VTX_CONSTANT_WORD3_0__DST_SEL_W_mask = 0x7 << 12, + /* SQ_VTX_CONSTANT_WORD4_0 */ + EG_SQ_VTX_CONSTANT_WORD4_0__NUM_ELEMENTS_shift = 0, + EG_SQ_VTX_CONSTANT_WORD4_0__NUM_ELEMENTS_mask = 0xFFFFFFFF, + /* SQ_VTX_CONSTANT_WORD7_0 */ + EG_SQ_VTX_CONSTANT_WORD7_0__TYPE_shift = 30, + EG_SQ_VTX_CONSTANT_WORD7_0__TYPE_mask = 0x3 << 30, + /* SQ_TEX_SAMPLER_WORD0_0 */ + EG_SQ_TEX_SAMPLER_WORD0_0__CLAMP_X_shift = 0, // 3; + EG_SQ_TEX_SAMPLER_WORD0_0__CLAMP_X_mask = 0x7, + EG_SQ_TEX_SAMPLER_WORD0_0__CLAMP_Y_shift = 3, // 3; + EG_SQ_TEX_SAMPLER_WORD0_0__CLAMP_Y_mask = 0x7 << 3, + EG_SQ_TEX_SAMPLER_WORD0_0__CLAMP_Z_shift = 6, // 3; + EG_SQ_TEX_SAMPLER_WORD0_0__CLAMP_Z_mask = 0x7 << 6, + EG_SQ_TEX_SAMPLER_WORD0_0__XY_MAG_FILTER_shift = 9, // 2; + EG_SQ_TEX_SAMPLER_WORD0_0__XY_MAG_FILTER_mask = 0x3 << 9, + EG_SQ_TEX_SAMPLER_WORD0_0__XY_MIN_FILTER_shift = 11, // 2; + EG_SQ_TEX_SAMPLER_WORD0_0__XY_MIN_FILTER_mask = 0x3 << 11, + EG_SQ_TEX_SAMPLER_WORD0_0__Z_FILTER_shift = 13, // 2; + EG_SQ_TEX_SAMPLER_WORD0_0__Z_FILTER_mask = 0x3 << 13, + EG_SQ_TEX_SAMPLER_WORD0_0__MIP_FILTER_shift = 15, // 2; + EG_SQ_TEX_SAMPLER_WORD0_0__MIP_FILTER_mask = 0x3 << 15, + EG_SQ_TEX_SAMPLER_WORD0_0__MAX_ANISO_RATIO_shift = 17, // 3; + EG_SQ_TEX_SAMPLER_WORD0_0__MAX_ANISO_RATIO_mask = 0x7 << 17, + EG_SQ_TEX_SAMPLER_WORD0_0__BORDER_COLOR_TYPE_shift = 20,//2; + EG_SQ_TEX_SAMPLER_WORD0_0__BORDER_COLOR_TYPE_mask = 0x3 << 20, + EG_SQ_TEX_SAMPLER_WORD0_0__DCF_shift = 22, // 3; + EG_SQ_TEX_SAMPLER_WORD0_0__DCF_mask = 0x7 << 22, + EG_SQ_TEX_SAMPLER_WORD0_0__CHROMA_KEY_shift = 25, // 2; + EG_SQ_TEX_SAMPLER_WORD0_0__CHROMA_KEY_mask = 0x3 << 25, + EG_SQ_TEX_SAMPLER_WORD0_0__ANISO_THRESHOLD_shift = 27, // 3; + EG_SQ_TEX_SAMPLER_WORD0_0__ANISO_THRESHOLD_mask = 0x7 << 27, + EG_SQ_TEX_SAMPLER_WORD0_0__Reserved_shift = 30, // 2 + EG_SQ_TEX_SAMPLER_WORD0_0__Reserved_mask = 0x3 << 30, + /* SQ_TEX_SAMPLER_WORD1_0 */ + EG_SQ_TEX_SAMPLER_WORD1_0__MIN_LOD_shift = 0, // 12; + EG_SQ_TEX_SAMPLER_WORD1_0__MIN_LOD_mask = 0xfff, + EG_SQ_TEX_SAMPLER_WORD1_0__MAX_LOD_shift = 12,// 12; + EG_SQ_TEX_SAMPLER_WORD1_0__MAX_LOD_mask = 0xfff << 12, + /* SQ_TEX_SAMPLER_WORD2_0 */ + EG_SQ_TEX_SAMPLER_WORD2_0__LOD_BIAS_shift = 0, //14; + EG_SQ_TEX_SAMPLER_WORD2_0__LOD_BIAS_mask = 0x3fff, + EG_SQ_TEX_SAMPLER_WORD2_0__LOD_BIAS_SEC_shift = 14,//6; + EG_SQ_TEX_SAMPLER_WORD2_0__LOD_BIAS_SEC_mask = 0x3f << 14, + EG_SQ_TEX_SAMPLER_WORD2_0__MC_COORD_TRUNCATE_shift = 20,//1; + EG_SQ_TEX_SAMPLER_WORD2_0__MC_COORD_TRUNCATE_bit = 1 << 20, + EG_SQ_TEX_SAMPLER_WORD2_0__FORCE_DEGAMMA_shift = 21,//1; + EG_SQ_TEX_SAMPLER_WORD2_0__FORCE_DEGAMMA_bit = 1 << 21, + EG_SQ_TEX_SAMPLER_WORD2_0__ANISO_BIAS_shift = 22,//6; + EG_SQ_TEX_SAMPLER_WORD2_0__ANISO_BIAS_mask = 0x3f << 22, + EG_SQ_TEX_SAMPLER_WORD2_0__TRUNCATE_COORD_shift = 28,//1; + EG_SQ_TEX_SAMPLER_WORD2_0__TRUNCATE_COORD_bit = 1 << 28, + EG_SQ_TEX_SAMPLER_WORD2_0__DISABLE_CUBE_WRAP_shift = 29,//1; + EG_SQ_TEX_SAMPLER_WORD2_0__DISABLE_CUBE_WRAP_bit = 1 << 29, + EG_SQ_TEX_SAMPLER_WORD2_0__Reserved_shift = 30,//1; + EG_SQ_TEX_SAMPLER_WORD2_0__Reserved_bit = 1 << 30, + EG_SQ_TEX_SAMPLER_WORD2_0__TYPE_shift = 31,//1; + EG_SQ_TEX_SAMPLER_WORD2_0__TYPE_bit = 1 << 31, + /* SQ_TEX_RESOURCE_WORD0_0 */ + EG_SQ_TEX_RESOURCE_WORD0_0__DIM_shift = 0, // 3; + EG_SQ_TEX_RESOURCE_WORD0_0__DIM_mask = 0x7, + EG_SQ_TEX_RESOURCE_WORD0_0__ISET_shift = 3, // 1; + EG_SQ_TEX_RESOURCE_WORD0_0__ISET_bit = 1 << 3, + EG_SQ_TEX_RESOURCE_WORD0_0__Reserve_shift = 4, // 1; + EG_SQ_TEX_RESOURCE_WORD0_0__Reserve_bit = 1 << 4, + EG_SQ_TEX_RESOURCE_WORD0_0__NDTO_shift = 5, // 1; + EG_SQ_TEX_RESOURCE_WORD0_0__NDTO_bit = 1 << 5, + EG_SQ_TEX_RESOURCE_WORD0_0__PITCH_shift = 6, // 12; + EG_SQ_TEX_RESOURCE_WORD0_0__PITCH_mask = 0xfff << 6, + EG_SQ_TEX_RESOURCE_WORD0_0__TEX_WIDTH_shift = 18,// 14; + EG_SQ_TEX_RESOURCE_WORD0_0__TEX_WIDTH_mask = 0x3fff << 18, + /* SQ_TEX_RESOURCE_WORD1_0 */ + EG_SQ_TEX_RESOURCE_WORD1_0__TEX_HEIGHT_shift = 0, // 14; + EG_SQ_TEX_RESOURCE_WORD1_0__TEX_HEIGHT_mask = 0x3fff, + EG_SQ_TEX_RESOURCE_WORD1_0__TEX_DEPTH_shift = 14,// 13; + EG_SQ_TEX_RESOURCE_WORD1_0__TEX_DEPTH_mask = 0x1fff << 14, + EG_SQ_TEX_RESOURCE_WORD1_0__Reserved_shift = 27,// 1; + EG_SQ_TEX_RESOURCE_WORD1_0__Reserved_bit = 1 << 27, + EG_SQ_TEX_RESOURCE_WORD1_0__ARRAY_MODE_shift = 28,// 4; + EG_SQ_TEX_RESOURCE_WORD1_0__ARRAY_MODE_mask = 0xf << 28, + /* SQ_TEX_RESOURCE_WORD6_0 */ + EG_SQ_TEX_RESOURCE_WORD6_0__MAX_ANISO_RATIO_shift = 0, //: 3; + EG_SQ_TEX_RESOURCE_WORD6_0__MAX_ANISO_RATIO_mask = 0x7, + EG_SQ_TEX_RESOURCE_WORD6_0__INTERLACED_shift = 6, //1; + EG_SQ_TEX_RESOURCE_WORD6_0__INTERLACED_bit = 1 << 6, + EG_SQ_TEX_RESOURCE_WORD6_0__MIN_LOD_shift = 8, //12; + EG_SQ_TEX_RESOURCE_WORD6_0__MIN_LOD_mask = 0xfff << 8, + EG_SQ_TEX_RESOURCE_WORD6_0__TILE_SPLIT_shift = 29,// 3; + EG_SQ_TEX_RESOURCE_WORD6_0__TILE_SPLIT_mask = 0x7 << 29, + /* SQ_TEX_RESOURCE_WORD7_0 */ + EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_shift = 0, // 6; + EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_mask = 0x3f, + EG_SQ_TEX_RESOURCE_WORD7_0__MACRO_TILE_ASPECT_shift = 6, // 2; + EG_SQ_TEX_RESOURCE_WORD7_0__MACRO_TILE_ASPECT_mask = 0x3 << 6, + EG_SQ_TEX_RESOURCE_WORD7_0__BANK_WIDTH_shift = 8, // 2; + EG_SQ_TEX_RESOURCE_WORD7_0__BANK_WIDTH_mask = 0x3 << 8, + EG_SQ_TEX_RESOURCE_WORD7_0__BANK_HEIGHT_shift = 10,// 2; + EG_SQ_TEX_RESOURCE_WORD7_0__BANK_HEIGHT_mask = 0x3 << 10, + EG_SQ_TEX_RESOURCE_WORD7_0__DEPTH_SAMPLE_ORDER_shift = 15,// 1; + EG_SQ_TEX_RESOURCE_WORD7_0__DEPTH_SAMPLE_ORDER_bit = 1 << 15, + EG_SQ_TEX_RESOURCE_WORD7_0__NUM_BANKS_shift = 16,// 2; + EG_SQ_TEX_RESOURCE_WORD7_0__NUM_BANKS_mask = 0x3 << 16, + EG_SQ_TEX_RESOURCE_WORD7_0__TYPE_shift = 30,// 2; + EG_SQ_TEX_RESOURCE_WORD7_0__TYPE_mask = 0x3 << 30, +}; + +/* */ + +#define EG_SQ_FETCH_RESOURCE_COUNT 0x00000400 +#define EG_SQ_TEX_SAMPLER_COUNT 0x0000006c +#define EG_SQ_LOOP_CONST_COUNT 0x000000c0 + +#define EG_SET_RESOURCE_OFFSET 0x30000 +#define EG_SET_RESOURCE_END 0x30400 //r600 := offset + 0x4000 + +#define EG_SET_LOOP_CONST_OFFSET 0x3A200 +#define EG_SET_LOOP_CONST_END 0x3A26C //r600 := offset + 0x180 + + +#define EG_SQ_FETCH_RESOURCE_VS_OFFSET 0x000000b0 +#define EG_FETCH_RESOURCE_STRIDE 8 + +#define EG_SET_BOOL_CONST_OFFSET 0x3A500 +#define EG_SET_BOOL_CONST_END 0x3A506 + + +#endif //_EVERGREEN_DIFF_H_ diff --git a/src/mesa/drivers/dri/r600/evergreen_fragprog.c b/src/mesa/drivers/dri/r600/evergreen_fragprog.c new file mode 100644 index 0000000000..9cf06b398a --- /dev/null +++ b/src/mesa/drivers/dri/r600/evergreen_fragprog.c @@ -0,0 +1,808 @@ +/* + * Copyright (C) 2008-2009 Advanced Micro Devices, Inc. + * + * 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 + * THE COPYRIGHT HOLDER(S) 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. + */ + +/* + * Authors: + * Richard Li , + * CooperYuan , + */ + +#include +#include +#include +#include +#include + +#include "main/imports.h" + +#include "program/prog_parameter.h" +#include "program/prog_statevars.h" +#include "program/program.h" + +#include "r600_context.h" +#include "r600_cmdbuf.h" + +#include "evergreen_vertprog.h" +#include "evergreen_fragprog.h" + +#include "r700_debug.h" + +void evergreen_insert_wpos_code(GLcontext *ctx, struct gl_fragment_program *fprog) +{ + static const gl_state_index winstate[STATE_LENGTH] + = { STATE_INTERNAL, STATE_FB_SIZE, 0, 0, 0}; + struct prog_instruction *newInst, *inst; + GLint win_size; /* state reference */ + GLuint wpos_temp; /* temp register */ + int i, j; + + /* PARAM win_size = STATE_FB_SIZE */ + win_size = _mesa_add_state_reference(fprog->Base.Parameters, winstate); + + wpos_temp = fprog->Base.NumTemporaries++; + + /* scan program where WPOS is used and replace with wpos_temp */ + inst = fprog->Base.Instructions; + for (i = 0; i < fprog->Base.NumInstructions; i++) { + for (j=0; j < 3; j++) { + if(inst->SrcReg[j].File == PROGRAM_INPUT && + inst->SrcReg[j].Index == FRAG_ATTRIB_WPOS) { + inst->SrcReg[j].File = PROGRAM_TEMPORARY; + inst->SrcReg[j].Index = wpos_temp; + } + } + inst++; + } + + _mesa_insert_instructions(&(fprog->Base), 0, 1); + + newInst = fprog->Base.Instructions; + /* invert wpos.y + * wpos_temp.xyzw = wpos.x-yzw + winsize.0y00 */ + newInst[0].Opcode = OPCODE_ADD; + newInst[0].DstReg.File = PROGRAM_TEMPORARY; + newInst[0].DstReg.Index = wpos_temp; + newInst[0].DstReg.WriteMask = WRITEMASK_XYZW; + + newInst[0].SrcReg[0].File = PROGRAM_INPUT; + newInst[0].SrcReg[0].Index = FRAG_ATTRIB_WPOS; + newInst[0].SrcReg[0].Swizzle = SWIZZLE_XYZW; + newInst[0].SrcReg[0].Negate = NEGATE_Y; + + newInst[0].SrcReg[1].File = PROGRAM_STATE_VAR; + newInst[0].SrcReg[1].Index = win_size; + newInst[0].SrcReg[1].Swizzle = MAKE_SWIZZLE4(SWIZZLE_ZERO, SWIZZLE_Y, SWIZZLE_ZERO, SWIZZLE_ZERO); + +} + +//TODO : Validate FP input with VP output. +void evergreen_Map_Fragment_Program(r700_AssemblerBase *pAsm, + struct gl_fragment_program *mesa_fp, + GLcontext *ctx) +{ + unsigned int unBit; + unsigned int i; + GLuint ui; + + /* match fp inputs with vp exports. */ + struct evergreen_vertex_program_cont *vpc = + (struct evergreen_vertex_program_cont *)ctx->VertexProgram._Current; + GLbitfield OutputsWritten = vpc->mesa_program.Base.OutputsWritten; + + pAsm->number_used_registers = 0; + +//Input mapping : mesa_fp->Base.InputsRead set the flag, set in + //The flags parsed in parse_attrib_binding. FRAG_ATTRIB_COLx, FRAG_ATTRIB_TEXx, ... + //MUST match order in Map_Vertex_Output + unBit = 1 << FRAG_ATTRIB_WPOS; + if(mesa_fp->Base.InputsRead & unBit) + { + pAsm->uiFP_AttributeMap[FRAG_ATTRIB_WPOS] = pAsm->number_used_registers++; + } + + unBit = 1 << VERT_RESULT_COL0; + if(OutputsWritten & unBit) + { + pAsm->uiFP_AttributeMap[FRAG_ATTRIB_COL0] = pAsm->number_used_registers++; + } + + unBit = 1 << VERT_RESULT_COL1; + if(OutputsWritten & unBit) + { + pAsm->uiFP_AttributeMap[FRAG_ATTRIB_COL1] = pAsm->number_used_registers++; + } + + unBit = 1 << VERT_RESULT_FOGC; + if(OutputsWritten & unBit) + { + pAsm->uiFP_AttributeMap[FRAG_ATTRIB_FOGC] = pAsm->number_used_registers++; + } + + for(i=0; i<8; i++) + { + unBit = 1 << (VERT_RESULT_TEX0 + i); + if(OutputsWritten & unBit) + { + pAsm->uiFP_AttributeMap[FRAG_ATTRIB_TEX0 + i] = pAsm->number_used_registers++; + } + } + +/* order has been taken care of */ +#if 1 + for(i=VERT_RESULT_VAR0; iuiFP_AttributeMap[i-VERT_RESULT_VAR0+FRAG_ATTRIB_VAR0] = pAsm->number_used_registers++; + } + } +#else + if( (mesa_fp->Base.InputsRead >> FRAG_ATTRIB_VAR0) > 0 ) + { + struct evergreen_vertex_program_cont *vpc = + (struct evergreen_vertex_program_cont *)ctx->VertexProgram._Current; + struct gl_program_parameter_list * VsVarying = vpc->mesa_program.Base.Varying; + struct gl_program_parameter_list * PsVarying = mesa_fp->Base.Varying; + struct gl_program_parameter * pVsParam; + struct gl_program_parameter * pPsParam; + GLuint j, k; + GLuint unMaxVarying = 0; + + for(i=0; iNumParameters; i++) + { + pAsm->uiFP_AttributeMap[i + FRAG_ATTRIB_VAR0] = 0; + } + + for(i=FRAG_ATTRIB_VAR0; iBase.InputsRead & unBit) + { + j = i - FRAG_ATTRIB_VAR0; + pPsParam = PsVarying->Parameters + j; + + for(k=0; kNumParameters; k++) + { + pVsParam = VsVarying->Parameters + k; + + if( strcmp(pPsParam->Name, pVsParam->Name) == 0) + { + pAsm->uiFP_AttributeMap[i] = pAsm->number_used_registers + k; + if(k > unMaxVarying) + { + unMaxVarying = k; + } + break; + } + } + } + } + + pAsm->number_used_registers += unMaxVarying + 1; + } +#endif + unBit = 1 << FRAG_ATTRIB_FACE; + if(mesa_fp->Base.InputsRead & unBit) + { + pAsm->uiFP_AttributeMap[FRAG_ATTRIB_FACE] = pAsm->number_used_registers++; + } + + unBit = 1 << FRAG_ATTRIB_PNTC; + if(mesa_fp->Base.InputsRead & unBit) + { + pAsm->uiFP_AttributeMap[FRAG_ATTRIB_PNTC] = pAsm->number_used_registers++; + } + + pAsm->uIIns = pAsm->number_used_registers; + +/* Map temporary registers (GPRs) */ + pAsm->starting_temp_register_number = pAsm->number_used_registers; + + if(mesa_fp->Base.NumNativeTemporaries >= mesa_fp->Base.NumTemporaries) + { + pAsm->number_used_registers += mesa_fp->Base.NumNativeTemporaries; + } + else + { + pAsm->number_used_registers += mesa_fp->Base.NumTemporaries; + } + +/* Output mapping */ + pAsm->number_of_exports = 0; + pAsm->number_of_colorandz_exports = 0; /* don't include stencil and mask out. */ + pAsm->starting_export_register_number = pAsm->number_used_registers; + unBit = 1 << FRAG_RESULT_COLOR; + if(mesa_fp->Base.OutputsWritten & unBit) + { + pAsm->uiFP_OutputMap[FRAG_RESULT_COLOR] = pAsm->number_used_registers++; + pAsm->number_of_exports++; + pAsm->number_of_colorandz_exports++; + } + unBit = 1 << FRAG_RESULT_DEPTH; + if(mesa_fp->Base.OutputsWritten & unBit) + { + pAsm->depth_export_register_number = pAsm->number_used_registers; + pAsm->uiFP_OutputMap[FRAG_RESULT_DEPTH] = pAsm->number_used_registers++; + pAsm->number_of_exports++; + pAsm->number_of_colorandz_exports++; + pAsm->pR700Shader->depthIsExported = 1; + } + + pAsm->pucOutMask = (unsigned char*) MALLOC(pAsm->number_of_exports); + for(ui=0; uinumber_of_exports; ui++) + { + pAsm->pucOutMask[ui] = 0x0; + } + + pAsm->flag_reg_index = pAsm->number_used_registers++; + + pAsm->uFirstHelpReg = pAsm->number_used_registers; +} + +GLboolean evergreen_Find_Instruction_Dependencies_fp(struct evergreen_fragment_program *fp, + struct gl_fragment_program *mesa_fp) +{ + GLuint i, j; + GLint * puiTEMPwrites; + GLint * puiTEMPreads; + struct prog_instruction * pILInst; + InstDeps *pInstDeps; + struct prog_instruction * texcoord_DepInst; + GLint nDepInstID; + + puiTEMPwrites = (GLint*) MALLOC(sizeof(GLuint)*mesa_fp->Base.NumTemporaries); + puiTEMPreads = (GLint*) MALLOC(sizeof(GLuint)*mesa_fp->Base.NumTemporaries); + + for(i=0; iBase.NumTemporaries; i++) + { + puiTEMPwrites[i] = -1; + puiTEMPreads[i] = -1; + } + + pInstDeps = (InstDeps*)MALLOC(sizeof(InstDeps)*mesa_fp->Base.NumInstructions); + + for(i=0; iBase.NumInstructions; i++) + { + pInstDeps[i].nDstDep = -1; + pILInst = &(mesa_fp->Base.Instructions[i]); + + //Dst + if(pILInst->DstReg.File == PROGRAM_TEMPORARY) + { + //Set lastwrite for the temp + puiTEMPwrites[pILInst->DstReg.Index] = i; + } + + //Src + for(j=0; j<3; j++) + { + if(pILInst->SrcReg[j].File == PROGRAM_TEMPORARY) + { + //Set dep. + pInstDeps[i].nSrcDeps[j] = puiTEMPwrites[pILInst->SrcReg[j].Index]; + //Set first read + if(puiTEMPreads[pILInst->SrcReg[j].Index] < 0 ) + { + puiTEMPreads[pILInst->SrcReg[j].Index] = i; + } + } + else + { + pInstDeps[i].nSrcDeps[j] = -1; + } + } + } + + fp->r700AsmCode.pInstDeps = pInstDeps; + + //Find dep for tex inst + for(i=0; iBase.NumInstructions; i++) + { + pILInst = &(mesa_fp->Base.Instructions[i]); + + if(GL_TRUE == IsTex(pILInst->Opcode)) + { //src0 is the tex coord register, src1 is texunit, src2 is textype + nDepInstID = pInstDeps[i].nSrcDeps[0]; + if(nDepInstID >= 0) + { + texcoord_DepInst = &(mesa_fp->Base.Instructions[nDepInstID]); + if(GL_TRUE == IsAlu(texcoord_DepInst->Opcode) ) + { + pInstDeps[nDepInstID].nDstDep = i; + pInstDeps[i].nDstDep = i; + } + else if(GL_TRUE == IsTex(texcoord_DepInst->Opcode) ) + { + pInstDeps[i].nDstDep = i; + } + else + { //... other deps? + } + } + // make sure that we dont overwrite src used earlier + nDepInstID = puiTEMPreads[pILInst->DstReg.Index]; + if(nDepInstID < i) + { + pInstDeps[i].nDstDep = puiTEMPreads[pILInst->DstReg.Index]; + texcoord_DepInst = &(mesa_fp->Base.Instructions[nDepInstID]); + if(GL_TRUE == IsAlu(texcoord_DepInst->Opcode) ) + { + pInstDeps[nDepInstID].nDstDep = i; + } + + } + + } + } + + FREE(puiTEMPwrites); + FREE(puiTEMPreads); + + return GL_TRUE; +} + +GLboolean evergreenTranslateFragmentShader(struct evergreen_fragment_program *fp, + struct gl_fragment_program *mesa_fp, + GLcontext *ctx) +{ + GLuint number_of_colors_exported; + GLboolean z_enabled = GL_FALSE; + GLuint unBit, shadow_unit; + int i; + struct prog_instruction *inst; + gl_state_index shadow_ambient[STATE_LENGTH] + = { STATE_INTERNAL, STATE_SHADOW_AMBIENT, 0, 0, 0}; + + //Init_Program + Init_r700_AssemblerBase( SPT_FP, &(fp->r700AsmCode), &(fp->r700Shader) ); + + fp->constbo0 = NULL; + fp->r700AsmCode.bUseMemConstant = GL_TRUE; + fp->r700AsmCode.unAsic = 8; + + if(mesa_fp->Base.InputsRead & FRAG_BIT_WPOS) + { + evergreen_insert_wpos_code(ctx, mesa_fp); + } + + /* add/map consts for ARB_shadow_ambient */ + if(mesa_fp->Base.ShadowSamplers) + { + inst = mesa_fp->Base.Instructions; + for (i = 0; i < mesa_fp->Base.NumInstructions; i++) + { + if(inst->TexShadow == 1) + { + shadow_unit = inst->TexSrcUnit; + shadow_ambient[2] = shadow_unit; + fp->r700AsmCode.shadow_regs[shadow_unit] = + _mesa_add_state_reference(mesa_fp->Base.Parameters, shadow_ambient); + } + inst++; + } + } + + evergreen_Map_Fragment_Program(&(fp->r700AsmCode), mesa_fp, ctx); + + if( GL_FALSE == evergreen_Find_Instruction_Dependencies_fp(fp, mesa_fp) ) + { + return GL_FALSE; + } + + InitShaderProgram(&(fp->r700AsmCode)); + + for(i=0; i < MAX_SAMPLERS; i++) + { + fp->r700AsmCode.SamplerUnits[i] = fp->mesa_program.Base.SamplerUnits[i]; + } + + fp->r700AsmCode.unCurNumILInsts = mesa_fp->Base.NumInstructions; + + if( GL_FALSE == AssembleInstr(0, + 0, + mesa_fp->Base.NumInstructions, + &(mesa_fp->Base.Instructions[0]), + &(fp->r700AsmCode)) ) + { + return GL_FALSE; + } + + if(GL_FALSE == Process_Fragment_Exports(&(fp->r700AsmCode), mesa_fp->Base.OutputsWritten) ) + { + return GL_FALSE; + } + + if( GL_FALSE == RelocProgram(&(fp->r700AsmCode), &(mesa_fp->Base)) ) + { + return GL_FALSE; + } + + fp->r700Shader.nRegs = (fp->r700AsmCode.number_used_registers == 0) ? 0 + : (fp->r700AsmCode.number_used_registers - 1); + + fp->r700Shader.nParamExports = fp->r700AsmCode.number_of_exports; + + number_of_colors_exported = fp->r700AsmCode.number_of_colorandz_exports; + + unBit = 1 << FRAG_RESULT_DEPTH; + if(mesa_fp->Base.OutputsWritten & unBit) + { + z_enabled = GL_TRUE; + number_of_colors_exported--; + } + + /* illegal to set this to 0 */ + if(number_of_colors_exported || z_enabled) + { + fp->r700Shader.exportMode = number_of_colors_exported << 1 | z_enabled; + } + else + { + fp->r700Shader.exportMode = (1 << 1); + } + + fp->translated = GL_TRUE; + + return GL_TRUE; +} + +void evergreenSelectFragmentShader(GLcontext *ctx) +{ + context_t *context = EVERGREEN_CONTEXT(ctx); + struct evergreen_fragment_program *fp = (struct evergreen_fragment_program *) + (ctx->FragmentProgram._Current); + if (context->radeon.radeonScreen->chip_family < CHIP_FAMILY_RV770) + { + fp->r700AsmCode.bR6xx = 1; + } + + if (GL_FALSE == fp->translated) + evergreenTranslateFragmentShader(fp, &(fp->mesa_program), ctx); +} + +void * evergreenGetActiveFpShaderBo(GLcontext * ctx) +{ + struct evergreen_fragment_program *fp = (struct evergreen_fragment_program *) + (ctx->FragmentProgram._Current); + + return fp->shaderbo; +} + +void * evergreenGetActiveFpShaderConstBo(GLcontext * ctx) +{ + struct evergreen_fragment_program *fp = (struct evergreen_fragment_program *) + (ctx->FragmentProgram._Current); + + return fp->constbo0; +} + +GLboolean evergreenSetupFragmentProgram(GLcontext * ctx) +{ + context_t *context = EVERGREEN_CONTEXT(ctx); + EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); + struct evergreen_fragment_program *fp = (struct evergreen_fragment_program *) + (ctx->FragmentProgram._Current); + r700_AssemblerBase *pAsm = &(fp->r700AsmCode); + struct gl_fragment_program *mesa_fp = &(fp->mesa_program); + struct gl_program_parameter_list *paramList; + unsigned int unNumParamData; + unsigned int ui, i; + unsigned int unNumOfReg; + unsigned int unBit; + GLuint exportCount; + GLboolean point_sprite = GL_FALSE; + + if(GL_FALSE == fp->loaded) + { + if(fp->r700Shader.bNeedsAssembly == GL_TRUE) + { + Assemble( &(fp->r700Shader) ); + } + + r600EmitShader(ctx, + &(fp->shaderbo), + (GLvoid *)(fp->r700Shader.pProgram), + fp->r700Shader.uShaderBinaryDWORDSize, + "FS"); + + fp->loaded = GL_TRUE; + } + + /* TODO : enable this after MemUse fixed *= + (context->chipobj.MemUse)(context, fp->shadercode.buf->id); + */ + + EVERGREEN_STATECHANGE(context, sq); + + evergreen->SQ_PGM_RESOURCES_PS.u32All = 0; + SETbit(evergreen->SQ_PGM_RESOURCES_PS.u32All, PGM_RESOURCES__PRIME_CACHE_ON_DRAW_bit); + + evergreen->ps.SQ_ALU_CONST_CACHE_PS_0.u32All = 0; + evergreen->ps.SQ_PGM_START_PS.u32All = 0; + + EVERGREEN_STATECHANGE(context, spi); + + unNumOfReg = fp->r700Shader.nRegs + 1; + + ui = (evergreen->SPI_PS_IN_CONTROL_0.u32All & NUM_INTERP_mask) / (1 << NUM_INTERP_shift); + + /* PS uses fragment.position */ + if (mesa_fp->Base.InputsRead & (1 << FRAG_ATTRIB_WPOS)) + { + ui += 1; + SETfield(evergreen->SPI_PS_IN_CONTROL_0.u32All, ui, NUM_INTERP_shift, NUM_INTERP_mask); + SETfield(evergreen->SPI_PS_IN_CONTROL_0.u32All, CENTERS_ONLY, BARYC_SAMPLE_CNTL_shift, BARYC_SAMPLE_CNTL_mask); + SETbit(evergreen->SPI_PS_IN_CONTROL_0.u32All, POSITION_ENA_bit); + SETbit(evergreen->SPI_INPUT_Z.u32All, PROVIDE_Z_TO_SPI_bit); + } + else + { + CLEARbit(evergreen->SPI_PS_IN_CONTROL_0.u32All, POSITION_ENA_bit); + CLEARbit(evergreen->SPI_INPUT_Z.u32All, PROVIDE_Z_TO_SPI_bit); + } + + if (mesa_fp->Base.InputsRead & (1 << FRAG_ATTRIB_FACE)) + { + ui += 1; + SETfield(evergreen->SPI_PS_IN_CONTROL_0.u32All, ui, NUM_INTERP_shift, NUM_INTERP_mask); + SETbit(evergreen->SPI_PS_IN_CONTROL_1.u32All, FRONT_FACE_ENA_bit); + SETbit(evergreen->SPI_PS_IN_CONTROL_1.u32All, FRONT_FACE_ALL_BITS_bit); + SETfield(evergreen->SPI_PS_IN_CONTROL_1.u32All, pAsm->uiFP_AttributeMap[FRAG_ATTRIB_FACE], FRONT_FACE_ADDR_shift, FRONT_FACE_ADDR_mask); + } + else + { + CLEARbit(evergreen->SPI_PS_IN_CONTROL_1.u32All, FRONT_FACE_ENA_bit); + } + + /* see if we need any point_sprite replacements */ + for (i = VERT_RESULT_TEX0; i<= VERT_RESULT_TEX7; i++) + { + if(ctx->Point.CoordReplace[i - VERT_RESULT_TEX0] == GL_TRUE) + point_sprite = GL_TRUE; + } + + if ((mesa_fp->Base.InputsRead & (1 << FRAG_ATTRIB_PNTC)) || point_sprite) + { + /* for FRAG_ATTRIB_PNTC we need to increase num_interp */ + if(mesa_fp->Base.InputsRead & (1 << FRAG_ATTRIB_PNTC)) + { + ui++; + SETfield(evergreen->SPI_PS_IN_CONTROL_0.u32All, ui, NUM_INTERP_shift, NUM_INTERP_mask); + } + SETbit(evergreen->SPI_INTERP_CONTROL_0.u32All, PNT_SPRITE_ENA_bit); + SETfield(evergreen->SPI_INTERP_CONTROL_0.u32All, SPI_PNT_SPRITE_SEL_S, PNT_SPRITE_OVRD_X_shift, PNT_SPRITE_OVRD_X_mask); + SETfield(evergreen->SPI_INTERP_CONTROL_0.u32All, SPI_PNT_SPRITE_SEL_T, PNT_SPRITE_OVRD_Y_shift, PNT_SPRITE_OVRD_Y_mask); + SETfield(evergreen->SPI_INTERP_CONTROL_0.u32All, SPI_PNT_SPRITE_SEL_0, PNT_SPRITE_OVRD_Z_shift, PNT_SPRITE_OVRD_Z_mask); + SETfield(evergreen->SPI_INTERP_CONTROL_0.u32All, SPI_PNT_SPRITE_SEL_1, PNT_SPRITE_OVRD_W_shift, PNT_SPRITE_OVRD_W_mask); + if(ctx->Point.SpriteOrigin == GL_LOWER_LEFT) + SETbit(evergreen->SPI_INTERP_CONTROL_0.u32All, PNT_SPRITE_TOP_1_bit); + else + CLEARbit(evergreen->SPI_INTERP_CONTROL_0.u32All, PNT_SPRITE_TOP_1_bit); + } + else + { + CLEARbit(evergreen->SPI_INTERP_CONTROL_0.u32All, PNT_SPRITE_ENA_bit); + } + + + ui = (unNumOfReg < ui) ? ui : unNumOfReg; + + SETfield(evergreen->SQ_PGM_RESOURCES_PS.u32All, ui, NUM_GPRS_shift, NUM_GPRS_mask); + + CLEARbit(evergreen->SQ_PGM_RESOURCES_PS.u32All, UNCACHED_FIRST_INST_bit); + + if(fp->r700Shader.uStackSize) /* we don't use branch for now, it should be zero. */ + { + SETfield(evergreen->SQ_PGM_RESOURCES_PS.u32All, fp->r700Shader.uStackSize, + STACK_SIZE_shift, STACK_SIZE_mask); + } + + SETfield(evergreen->SQ_PGM_EXPORTS_PS.u32All, fp->r700Shader.exportMode, + EXPORT_MODE_shift, EXPORT_MODE_mask); + + // emit ps input map + struct evergreen_vertex_program_cont *vpc = + (struct evergreen_vertex_program_cont *)ctx->VertexProgram._Current; + GLbitfield OutputsWritten = vpc->mesa_program.Base.OutputsWritten; + + for(ui = 0; ui < EVERGREEN_MAX_SHADER_EXPORTS; ui++) + evergreen->SPI_PS_INPUT_CNTL[ui].u32All = 0; + + unBit = 1 << FRAG_ATTRIB_WPOS; + if(mesa_fp->Base.InputsRead & unBit) + { + ui = pAsm->uiFP_AttributeMap[FRAG_ATTRIB_WPOS]; + SETbit(evergreen->SPI_PS_INPUT_CNTL[ui].u32All, SEL_CENTROID_bit); + SETfield(evergreen->SPI_PS_INPUT_CNTL[ui].u32All, ui, + SEMANTIC_shift, SEMANTIC_mask); + if (evergreen->SPI_INTERP_CONTROL_0.u32All & FLAT_SHADE_ENA_bit) + SETbit(evergreen->SPI_PS_INPUT_CNTL[ui].u32All, FLAT_SHADE_bit); + else + CLEARbit(evergreen->SPI_PS_INPUT_CNTL[ui].u32All, FLAT_SHADE_bit); + } + + unBit = 1 << VERT_RESULT_COL0; + if(OutputsWritten & unBit) + { + ui = pAsm->uiFP_AttributeMap[FRAG_ATTRIB_COL0]; + SETbit(evergreen->SPI_PS_INPUT_CNTL[ui].u32All, SEL_CENTROID_bit); + SETfield(evergreen->SPI_PS_INPUT_CNTL[ui].u32All, ui, + SEMANTIC_shift, SEMANTIC_mask); + if (evergreen->SPI_INTERP_CONTROL_0.u32All & FLAT_SHADE_ENA_bit) + SETbit(evergreen->SPI_PS_INPUT_CNTL[ui].u32All, FLAT_SHADE_bit); + else + CLEARbit(evergreen->SPI_PS_INPUT_CNTL[ui].u32All, FLAT_SHADE_bit); + } + + unBit = 1 << VERT_RESULT_COL1; + if(OutputsWritten & unBit) + { + ui = pAsm->uiFP_AttributeMap[FRAG_ATTRIB_COL1]; + SETbit(evergreen->SPI_PS_INPUT_CNTL[ui].u32All, SEL_CENTROID_bit); + SETfield(evergreen->SPI_PS_INPUT_CNTL[ui].u32All, ui, + SEMANTIC_shift, SEMANTIC_mask); + if (evergreen->SPI_INTERP_CONTROL_0.u32All & FLAT_SHADE_ENA_bit) + SETbit(evergreen->SPI_PS_INPUT_CNTL[ui].u32All, FLAT_SHADE_bit); + else + CLEARbit(evergreen->SPI_PS_INPUT_CNTL[ui].u32All, FLAT_SHADE_bit); + } + + unBit = 1 << VERT_RESULT_FOGC; + if(OutputsWritten & unBit) + { + ui = pAsm->uiFP_AttributeMap[FRAG_ATTRIB_FOGC]; + SETbit(evergreen->SPI_PS_INPUT_CNTL[ui].u32All, SEL_CENTROID_bit); + SETfield(evergreen->SPI_PS_INPUT_CNTL[ui].u32All, ui, + SEMANTIC_shift, SEMANTIC_mask); + if (evergreen->SPI_INTERP_CONTROL_0.u32All & FLAT_SHADE_ENA_bit) + SETbit(evergreen->SPI_PS_INPUT_CNTL[ui].u32All, FLAT_SHADE_bit); + else + CLEARbit(evergreen->SPI_PS_INPUT_CNTL[ui].u32All, FLAT_SHADE_bit); + } + + for(i=0; i<8; i++) + { + unBit = 1 << (VERT_RESULT_TEX0 + i); + if(OutputsWritten & unBit) + { + ui = pAsm->uiFP_AttributeMap[FRAG_ATTRIB_TEX0 + i]; + SETbit(evergreen->SPI_PS_INPUT_CNTL[ui].u32All, SEL_CENTROID_bit); + SETfield(evergreen->SPI_PS_INPUT_CNTL[ui].u32All, ui, + SEMANTIC_shift, SEMANTIC_mask); + CLEARbit(evergreen->SPI_PS_INPUT_CNTL[ui].u32All, FLAT_SHADE_bit); + /* ARB_point_sprite */ + if(ctx->Point.CoordReplace[i] == GL_TRUE) + { + SETbit(evergreen->SPI_PS_INPUT_CNTL[ui].u32All, PT_SPRITE_TEX_bit); + } + } + } + + unBit = 1 << FRAG_ATTRIB_FACE; + if(mesa_fp->Base.InputsRead & unBit) + { + ui = pAsm->uiFP_AttributeMap[FRAG_ATTRIB_FACE]; + SETbit(evergreen->SPI_PS_INPUT_CNTL[ui].u32All, SEL_CENTROID_bit); + SETfield(evergreen->SPI_PS_INPUT_CNTL[ui].u32All, ui, + SEMANTIC_shift, SEMANTIC_mask); + if (evergreen->SPI_INTERP_CONTROL_0.u32All & FLAT_SHADE_ENA_bit) + SETbit(evergreen->SPI_PS_INPUT_CNTL[ui].u32All, FLAT_SHADE_bit); + else + CLEARbit(evergreen->SPI_PS_INPUT_CNTL[ui].u32All, FLAT_SHADE_bit); + } + unBit = 1 << FRAG_ATTRIB_PNTC; + if(mesa_fp->Base.InputsRead & unBit) + { + ui = pAsm->uiFP_AttributeMap[FRAG_ATTRIB_PNTC]; + SETbit(evergreen->SPI_PS_INPUT_CNTL[ui].u32All, SEL_CENTROID_bit); + SETfield(evergreen->SPI_PS_INPUT_CNTL[ui].u32All, ui, + SEMANTIC_shift, SEMANTIC_mask); + if (evergreen->SPI_INTERP_CONTROL_0.u32All & FLAT_SHADE_ENA_bit) + SETbit(evergreen->SPI_PS_INPUT_CNTL[ui].u32All, FLAT_SHADE_bit); + else + CLEARbit(evergreen->SPI_PS_INPUT_CNTL[ui].u32All, FLAT_SHADE_bit); + SETbit(evergreen->SPI_PS_INPUT_CNTL[ui].u32All, PT_SPRITE_TEX_bit); + } + + + + + for(i=VERT_RESULT_VAR0; iuiFP_AttributeMap[i-VERT_RESULT_VAR0+FRAG_ATTRIB_VAR0]; + SETbit(evergreen->SPI_PS_INPUT_CNTL[ui].u32All, SEL_CENTROID_bit); + SETfield(evergreen->SPI_PS_INPUT_CNTL[ui].u32All, ui, + SEMANTIC_shift, SEMANTIC_mask); + if (evergreen->SPI_INTERP_CONTROL_0.u32All & FLAT_SHADE_ENA_bit) + SETbit(evergreen->SPI_PS_INPUT_CNTL[ui].u32All, FLAT_SHADE_bit); + else + CLEARbit(evergreen->SPI_PS_INPUT_CNTL[ui].u32All, FLAT_SHADE_bit); + } + } + + exportCount = (evergreen->SQ_PGM_EXPORTS_PS.u32All & EXPORT_MODE_mask) / (1 << EXPORT_MODE_shift); + + /* sent out shader constants. */ + paramList = fp->mesa_program.Base.Parameters; + + if(NULL != paramList) + { + _mesa_load_state_parameters(ctx, paramList); + + if (paramList->NumParameters > EVERGREEN_MAX_DX9_CONSTS) + return GL_FALSE; + + EVERGREEN_STATECHANGE(context, sq); + + evergreen->ps.num_consts = paramList->NumParameters; + + unNumParamData = paramList->NumParameters; + + for(ui=0; uips.consts[ui][0].f32All = paramList->ParameterValues[ui][0]; + evergreen->ps.consts[ui][1].f32All = paramList->ParameterValues[ui][1]; + evergreen->ps.consts[ui][2].f32All = paramList->ParameterValues[ui][2]; + evergreen->ps.consts[ui][3].f32All = paramList->ParameterValues[ui][3]; + } + + /* Load fp constants to gpu */ + if(unNumParamData > 0) + { + radeonAllocDmaRegion(&context->radeon, + &context->fp_Constbo, + &context->fp_bo_offset, + 256, + 256); + r600EmitShaderConsts(ctx, + context->fp_Constbo, + context->fp_bo_offset, + (GLvoid *)&(evergreen->ps.consts[0][0]), + unNumParamData * 4 * 4); + } + } else + evergreen->ps.num_consts = 0; + + COMPILED_SUB * pCompiledSub; + GLuint uj; + GLuint unConstOffset = evergreen->ps.num_consts; + for(ui=0; uiunNumPresub; ui++) + { + pCompiledSub = pAsm->presubs[ui].pCompiledSub; + + evergreen->ps.num_consts += pCompiledSub->NumParameters; + + for(uj=0; ujNumParameters; uj++) + { + evergreen->ps.consts[uj + unConstOffset][0].f32All = pCompiledSub->ParameterValues[uj][0]; + evergreen->ps.consts[uj + unConstOffset][1].f32All = pCompiledSub->ParameterValues[uj][1]; + evergreen->ps.consts[uj + unConstOffset][2].f32All = pCompiledSub->ParameterValues[uj][2]; + evergreen->ps.consts[uj + unConstOffset][3].f32All = pCompiledSub->ParameterValues[uj][3]; + } + unConstOffset += pCompiledSub->NumParameters; + } + + return GL_TRUE; +} + diff --git a/src/mesa/drivers/dri/r600/evergreen_fragprog.h b/src/mesa/drivers/dri/r600/evergreen_fragprog.h new file mode 100644 index 0000000000..0547d1f63d --- /dev/null +++ b/src/mesa/drivers/dri/r600/evergreen_fragprog.h @@ -0,0 +1,75 @@ +/* + * Copyright (C) 2008-2009 Advanced Micro Devices, Inc. + * + * 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 + * THE COPYRIGHT HOLDER(S) 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. + */ + +/* + * Authors: + * Richard Li , + */ + +#ifndef _EVERGREEN_FRAGPROG_H_ +#define _EVERGREEN_FRAGPROG_H_ + +#include "r600_context.h" +#include "r700_assembler.h" + +struct evergreen_fragment_program +{ + struct gl_fragment_program mesa_program; + + r700_AssemblerBase r700AsmCode; + R700_Shader r700Shader; + + GLboolean translated; + GLboolean loaded; + GLboolean error; + + void * shaderbo; + + GLuint k0used; + void * constbo0; + + GLboolean WritesDepth; + GLuint optimization; +}; + +/* Internal */ +void evergreen_insert_wpos_code(GLcontext *ctx, struct gl_fragment_program *fprog); + +void evergreen_Map_Fragment_Program(r700_AssemblerBase *pAsm, + struct gl_fragment_program *mesa_fp, + GLcontext *ctx); +GLboolean evergreen_Find_Instruction_Dependencies_fp(struct evergreen_fragment_program *fp, + struct gl_fragment_program *mesa_fp); + +GLboolean evergreenTranslateFragmentShader(struct evergreen_fragment_program *fp, + struct gl_fragment_program *mesa_vp, + GLcontext *ctx); + +/* Interface */ +extern void evergreenSelectFragmentShader(GLcontext *ctx); + +extern GLboolean evergreenSetupFragmentProgram(GLcontext * ctx); + +extern void * evergreenGetActiveFpShaderBo(GLcontext * ctx); + +extern void * evergreenGetActiveFpShaderConstBo(GLcontext * ctx); + +#endif /*_EVERGREEN_FRAGPROG_H_*/ diff --git a/src/mesa/drivers/dri/r600/evergreen_ioctl.c b/src/mesa/drivers/dri/r600/evergreen_ioctl.c new file mode 100644 index 0000000000..5c1270790d --- /dev/null +++ b/src/mesa/drivers/dri/r600/evergreen_ioctl.c @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2008-2009 Advanced Micro Devices, Inc. + * + * 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 + * THE COPYRIGHT HOLDER(S) 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. + */ + +/* + * Authors: + * Richard Li , + */ + +#include +#include + +#include "main/glheader.h" +#include "main/imports.h" +#include "main/macros.h" +#include "main/context.h" +#include "main/simple_list.h" + +#include "radeon_common.h" +#include "r600_context.h" + +#include "evergreen_ioctl.h" + +#include "r700_clear.h" + +void evergreenClear(GLcontext * ctx, GLbitfield mask) +{ + r700Clear(ctx, mask); +} + +void evergreenInitIoctlFuncs(struct dd_function_table *functions) +{ + functions->Clear = evergreenClear; + functions->Finish = radeonFinish; + functions->Flush = radeonFlush; +} diff --git a/src/mesa/drivers/dri/r600/evergreen_ioctl.h b/src/mesa/drivers/dri/r600/evergreen_ioctl.h new file mode 100644 index 0000000000..3c663a7083 --- /dev/null +++ b/src/mesa/drivers/dri/r600/evergreen_ioctl.h @@ -0,0 +1,36 @@ +/* + * Copyright (C) 2008-2010 Advanced Micro Devices, Inc. + * + * 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 + * THE COPYRIGHT HOLDER(S) 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. + */ + +/* + * Authors: + * Richard Li , + */ + +#ifndef _EVERGREEN_IOCTL_H_ +#define _EVERGREEN_IOCTL_H_ + +#include "r600_context.h" +#include "radeon_drm.h" + +extern void evergreenClear(GLcontext * ctx, GLbitfield mask); +extern void evergreenInitIoctlFuncs(struct dd_function_table *functions); + +#endif /* _EVERGREEN_IOCTL_H_ */ diff --git a/src/mesa/drivers/dri/r600/evergreen_off.h b/src/mesa/drivers/dri/r600/evergreen_off.h new file mode 100644 index 0000000000..8c250699ec --- /dev/null +++ b/src/mesa/drivers/dri/r600/evergreen_off.h @@ -0,0 +1,881 @@ +/* + * Copyright (C) 2008-2010 Advanced Micro Devices, Inc. + * + * 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 + * THE COPYRIGHT HOLDER(S) 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. + */ + +/* + * Authors: + * Richard Li , + */ + +#ifndef _EVERGREEN_OFF_H_ +#define _EVERGREEN_OFF_H_ + +enum +{ +/* Registers from PA block: */ + EG_PA_SC_SCREEN_SCISSOR_TL = 0x28030, // DIFF + EG_PA_SC_SCREEN_SCISSOR_BR = 0x28034, // DIFF + EG_PA_SC_WINDOW_OFFSET = 0x28200, // DIFF + EG_PA_SC_WINDOW_SCISSOR_TL = 0x28204, // DIFF + EG_PA_SC_WINDOW_SCISSOR_BR = 0x28208, // DIFF + EG_PA_SC_CLIPRECT_RULE = 0x2820C, // SAME + EG_PA_SC_CLIPRECT_0_TL = 0x28210, // DIFF + EG_PA_SC_CLIPRECT_0_BR = 0x28214, // DIFF + EG_PA_SC_CLIPRECT_1_TL = 0x28218, // DIFF + EG_PA_SC_CLIPRECT_1_BR = 0x2821C, // DIFF + EG_PA_SC_CLIPRECT_2_TL = 0x28220, // DIFF + EG_PA_SC_CLIPRECT_2_BR = 0x28224, // DIFF + EG_PA_SC_CLIPRECT_3_TL = 0x28228, // DIFF + EG_PA_SC_CLIPRECT_3_BR = 0x2822C, // DIFF + EG_PA_SC_EDGERULE = 0x28230, // SAME + EG_PA_SU_HARDWARE_SCREEN_OFFSET = 0x28234, // + EG_PA_SC_GENERIC_SCISSOR_TL = 0x28240, // DIFF + EG_PA_SC_GENERIC_SCISSOR_BR = 0x28244, // DIFF + EG_PA_SC_VPORT_SCISSOR_0_TL = 0x28250, // DIFF + EG_PA_SC_VPORT_SCISSOR_0_BR = 0x28254, // DIFF + EG_PA_SC_VPORT_SCISSOR_1_TL = 0x28258, // DIFF + EG_PA_SC_VPORT_SCISSOR_1_BR = 0x2825C, // DIFF + EG_PA_SC_VPORT_SCISSOR_2_TL = 0x28260, // DIFF + EG_PA_SC_VPORT_SCISSOR_2_BR = 0x28264, // DIFF + EG_PA_SC_VPORT_SCISSOR_3_TL = 0x28268, // DIFF + EG_PA_SC_VPORT_SCISSOR_3_BR = 0x2826C, // DIFF + EG_PA_SC_VPORT_SCISSOR_4_TL = 0x28270, // DIFF + EG_PA_SC_VPORT_SCISSOR_4_BR = 0x28274, // DIFF + EG_PA_SC_VPORT_SCISSOR_5_TL = 0x28278, // DIFF + EG_PA_SC_VPORT_SCISSOR_5_BR = 0x2827C, // DIFF + EG_PA_SC_VPORT_SCISSOR_6_TL = 0x28280, // DIFF + EG_PA_SC_VPORT_SCISSOR_6_BR = 0x28284, // DIFF + EG_PA_SC_VPORT_SCISSOR_7_TL = 0x28288, // DIFF + EG_PA_SC_VPORT_SCISSOR_7_BR = 0x2828C, // DIFF + EG_PA_SC_VPORT_SCISSOR_8_TL = 0x28290, // DIFF + EG_PA_SC_VPORT_SCISSOR_8_BR = 0x28294, // DIFF + EG_PA_SC_VPORT_SCISSOR_9_TL = 0x28298, // DIFF + EG_PA_SC_VPORT_SCISSOR_9_BR = 0x2829C, // DIFF + EG_PA_SC_VPORT_SCISSOR_10_TL = 0x282A0, // DIFF + EG_PA_SC_VPORT_SCISSOR_10_BR = 0x282A4, // DIFF + EG_PA_SC_VPORT_SCISSOR_11_TL = 0x282A8, // DIFF + EG_PA_SC_VPORT_SCISSOR_11_BR = 0x282AC, // DIFF + EG_PA_SC_VPORT_SCISSOR_12_TL = 0x282B0, // DIFF + EG_PA_SC_VPORT_SCISSOR_12_BR = 0x282B4, // DIFF + EG_PA_SC_VPORT_SCISSOR_13_TL = 0x282B8, // DIFF + EG_PA_SC_VPORT_SCISSOR_13_BR = 0x282BC, // DIFF + EG_PA_SC_VPORT_SCISSOR_14_TL = 0x282C0, // DIFF + EG_PA_SC_VPORT_SCISSOR_14_BR = 0x282C4, // DIFF + EG_PA_SC_VPORT_SCISSOR_15_TL = 0x282C8, // DIFF + EG_PA_SC_VPORT_SCISSOR_15_BR = 0x282CC, // DIFF + EG_PA_SC_VPORT_ZMIN_0 = 0x282D0, // SAME + EG_PA_SC_VPORT_ZMAX_0 = 0x282D4, // SAME + EG_PA_SC_VPORT_ZMIN_1 = 0x282D8, // SAME + EG_PA_SC_VPORT_ZMAX_1 = 0x282DC, // SAME + EG_PA_SC_VPORT_ZMIN_2 = 0x282E0, // SAME + EG_PA_SC_VPORT_ZMAX_2 = 0x282E4, // SAME + EG_PA_SC_VPORT_ZMIN_3 = 0x282E8, // SAME + EG_PA_SC_VPORT_ZMAX_3 = 0x282EC, // SAME + EG_PA_SC_VPORT_ZMIN_4 = 0x282F0, // SAME + EG_PA_SC_VPORT_ZMAX_4 = 0x282F4, // SAME + EG_PA_SC_VPORT_ZMIN_5 = 0x282F8, // SAME + EG_PA_SC_VPORT_ZMAX_5 = 0x282FC, // SAME + EG_PA_SC_VPORT_ZMIN_6 = 0x28300, // SAME + EG_PA_SC_VPORT_ZMAX_6 = 0x28304, // SAME + EG_PA_SC_VPORT_ZMIN_7 = 0x28308, // SAME + EG_PA_SC_VPORT_ZMAX_7 = 0x2830C, // SAME + EG_PA_SC_VPORT_ZMIN_8 = 0x28310, // SAME + EG_PA_SC_VPORT_ZMAX_8 = 0x28314, // SAME + EG_PA_SC_VPORT_ZMIN_9 = 0x28318, // SAME + EG_PA_SC_VPORT_ZMAX_9 = 0x2831C, // SAME + EG_PA_SC_VPORT_ZMIN_10 = 0x28320, // SAME + EG_PA_SC_VPORT_ZMAX_10 = 0x28324, // SAME + EG_PA_SC_VPORT_ZMIN_11 = 0x28328, // SAME + EG_PA_SC_VPORT_ZMAX_11 = 0x2832C, // SAME + EG_PA_SC_VPORT_ZMIN_12 = 0x28330, // SAME + EG_PA_SC_VPORT_ZMAX_12 = 0x28334, // SAME + EG_PA_SC_VPORT_ZMIN_13 = 0x28338, // SAME + EG_PA_SC_VPORT_ZMAX_13 = 0x2833C, // SAME + EG_PA_SC_VPORT_ZMIN_14 = 0x28340, // SAME + EG_PA_SC_VPORT_ZMAX_14 = 0x28344, // SAME + EG_PA_SC_VPORT_ZMIN_15 = 0x28348, // SAME + EG_PA_SC_VPORT_ZMAX_15 = 0x2834C, // SAME + EG_PA_CL_VPORT_XSCALE = 0x2843C, // SAME + EG_PA_CL_VPORT_XOFFSET = 0x28440, // SAME + EG_PA_CL_VPORT_YSCALE = 0x28444, // SAME + EG_PA_CL_VPORT_YOFFSET = 0x28448, // SAME + EG_PA_CL_VPORT_ZSCALE = 0x2844C, // SAME + EG_PA_CL_VPORT_ZOFFSET = 0x28450, // SAME + EG_PA_CL_VPORT_XSCALE_1 = 0x28454, // SAME + EG_PA_CL_VPORT_XOFFSET_1 = 0x28458, // SAME + EG_PA_CL_VPORT_YSCALE_1 = 0x2845C, // SAME + EG_PA_CL_VPORT_YOFFSET_1 = 0x28460, // SAME + EG_PA_CL_VPORT_ZSCALE_1 = 0x28464, // SAME + EG_PA_CL_VPORT_ZOFFSET_1 = 0x28468, // SAME + EG_PA_CL_VPORT_XSCALE_2 = 0x2846C, // SAME + EG_PA_CL_VPORT_XOFFSET_2 = 0x28470, // SAME + EG_PA_CL_VPORT_YSCALE_2 = 0x28474, // SAME + EG_PA_CL_VPORT_YOFFSET_2 = 0x28478, // SAME + EG_PA_CL_VPORT_ZSCALE_2 = 0x2847C, // SAME + EG_PA_CL_VPORT_ZOFFSET_2 = 0x28480, // SAME + EG_PA_CL_VPORT_XSCALE_3 = 0x28484, // SAME + EG_PA_CL_VPORT_XOFFSET_3 = 0x28488, // SAME + EG_PA_CL_VPORT_YSCALE_3 = 0x2848C, // SAME + EG_PA_CL_VPORT_YOFFSET_3 = 0x28490, // SAME + EG_PA_CL_VPORT_ZSCALE_3 = 0x28494, // SAME + EG_PA_CL_VPORT_ZOFFSET_3 = 0x28498, // SAME + EG_PA_CL_VPORT_XSCALE_4 = 0x2849C, // SAME + EG_PA_CL_VPORT_XOFFSET_4 = 0x284A0, // SAME + EG_PA_CL_VPORT_YSCALE_4 = 0x284A4, // SAME + EG_PA_CL_VPORT_YOFFSET_4 = 0x284A8, // SAME + EG_PA_CL_VPORT_ZSCALE_4 = 0x284AC, // SAME + EG_PA_CL_VPORT_ZOFFSET_4 = 0x284B0, // SAME + EG_PA_CL_VPORT_XSCALE_5 = 0x284B4, // SAME + EG_PA_CL_VPORT_XOFFSET_5 = 0x284B8, // SAME + EG_PA_CL_VPORT_YSCALE_5 = 0x284BC, // SAME + EG_PA_CL_VPORT_YOFFSET_5 = 0x284C0, // SAME + EG_PA_CL_VPORT_ZSCALE_5 = 0x284C4, // SAME + EG_PA_CL_VPORT_ZOFFSET_5 = 0x284C8, // SAME + EG_PA_CL_VPORT_XSCALE_6 = 0x284CC, // SAME + EG_PA_CL_VPORT_XOFFSET_6 = 0x284D0, // SAME + EG_PA_CL_VPORT_YSCALE_6 = 0x284D4, // SAME + EG_PA_CL_VPORT_YOFFSET_6 = 0x284D8, // SAME + EG_PA_CL_VPORT_ZSCALE_6 = 0x284DC, // SAME + EG_PA_CL_VPORT_ZOFFSET_6 = 0x284E0, // SAME + EG_PA_CL_VPORT_XSCALE_7 = 0x284E4, // SAME + EG_PA_CL_VPORT_XOFFSET_7 = 0x284E8, // SAME + EG_PA_CL_VPORT_YSCALE_7 = 0x284EC, // SAME + EG_PA_CL_VPORT_YOFFSET_7 = 0x284F0, // SAME + EG_PA_CL_VPORT_ZSCALE_7 = 0x284F4, // SAME + EG_PA_CL_VPORT_ZOFFSET_7 = 0x284F8, // SAME + EG_PA_CL_VPORT_XSCALE_8 = 0x284FC, // SAME + EG_PA_CL_VPORT_XOFFSET_8 = 0x28500, // SAME + EG_PA_CL_VPORT_YSCALE_8 = 0x28504, // SAME + EG_PA_CL_VPORT_YOFFSET_8 = 0x28508, // SAME + EG_PA_CL_VPORT_ZSCALE_8 = 0x2850C, // SAME + EG_PA_CL_VPORT_ZOFFSET_8 = 0x28510, // SAME + EG_PA_CL_VPORT_XSCALE_9 = 0x28514, // SAME + EG_PA_CL_VPORT_XOFFSET_9 = 0x28518, // SAME + EG_PA_CL_VPORT_YSCALE_9 = 0x2851C, // SAME + EG_PA_CL_VPORT_YOFFSET_9 = 0x28520, // SAME + EG_PA_CL_VPORT_ZSCALE_9 = 0x28524, // SAME + EG_PA_CL_VPORT_ZOFFSET_9 = 0x28528, // SAME + EG_PA_CL_VPORT_XSCALE_10 = 0x2852C, // SAME + EG_PA_CL_VPORT_XOFFSET_10 = 0x28530, // SAME + EG_PA_CL_VPORT_YSCALE_10 = 0x28534, // SAME + EG_PA_CL_VPORT_YOFFSET_10 = 0x28538, // SAME + EG_PA_CL_VPORT_ZSCALE_10 = 0x2853C, // SAME + EG_PA_CL_VPORT_ZOFFSET_10 = 0x28540, // SAME + EG_PA_CL_VPORT_XSCALE_11 = 0x28544, // SAME + EG_PA_CL_VPORT_XOFFSET_11 = 0x28548, // SAME + EG_PA_CL_VPORT_YSCALE_11 = 0x2854C, // SAME + EG_PA_CL_VPORT_YOFFSET_11 = 0x28550, // SAME + EG_PA_CL_VPORT_ZSCALE_11 = 0x28554, // SAME + EG_PA_CL_VPORT_ZOFFSET_11 = 0x28558, // SAME + EG_PA_CL_VPORT_XSCALE_12 = 0x2855C, // SAME + EG_PA_CL_VPORT_XOFFSET_12 = 0x28560, // SAME + EG_PA_CL_VPORT_YSCALE_12 = 0x28564, // SAME + EG_PA_CL_VPORT_YOFFSET_12 = 0x28568, // SAME + EG_PA_CL_VPORT_ZSCALE_12 = 0x2856C, // SAME + EG_PA_CL_VPORT_ZOFFSET_12 = 0x28570, // SAME + EG_PA_CL_VPORT_XSCALE_13 = 0x28574, // SAME + EG_PA_CL_VPORT_XOFFSET_13 = 0x28578, // SAME + EG_PA_CL_VPORT_YSCALE_13 = 0x2857C, // SAME + EG_PA_CL_VPORT_YOFFSET_13 = 0x28580, // SAME + EG_PA_CL_VPORT_ZSCALE_13 = 0x28584, // SAME + EG_PA_CL_VPORT_ZOFFSET_13 = 0x28588, // SAME + EG_PA_CL_VPORT_XSCALE_14 = 0x2858C, // SAME + EG_PA_CL_VPORT_XOFFSET_14 = 0x28590, // SAME + EG_PA_CL_VPORT_YSCALE_14 = 0x28594, // SAME + EG_PA_CL_VPORT_YOFFSET_14 = 0x28598, // SAME + EG_PA_CL_VPORT_ZSCALE_14 = 0x2859C, // SAME + EG_PA_CL_VPORT_ZOFFSET_14 = 0x285A0, // SAME + EG_PA_CL_VPORT_XSCALE_15 = 0x285A4, // SAME + EG_PA_CL_VPORT_XOFFSET_15 = 0x285A8, // SAME + EG_PA_CL_VPORT_YSCALE_15 = 0x285AC, // SAME + EG_PA_CL_VPORT_YOFFSET_15 = 0x285B0, // SAME + EG_PA_CL_VPORT_ZSCALE_15 = 0x285B4, // SAME + EG_PA_CL_VPORT_ZOFFSET_15 = 0x285B8, // SAME + EG_PA_CL_UCP_0_X = 0x285BC, // SAME 0x28E20 + EG_PA_CL_UCP_0_Y = 0x285C0, // SAME 0x28E24 + EG_PA_CL_UCP_0_Z = 0x285C4, // SAME 0x28E28 + EG_PA_CL_UCP_0_W = 0x285C8, // SAME 0x28E2C + EG_PA_CL_UCP_1_X = 0x285CC, // SAME 0x28E30 + EG_PA_CL_UCP_1_Y = 0x285D0, // SAME 0x28E34 + EG_PA_CL_UCP_1_Z = 0x285D4, // SAME 0x28E38 + EG_PA_CL_UCP_1_W = 0x285D8, // SAME 0x28E3C + EG_PA_CL_UCP_2_X = 0x285DC, // SAME 0x28E40 + EG_PA_CL_UCP_2_Y = 0x285E0, // SAME 0x28E44 + EG_PA_CL_UCP_2_Z = 0x285E4, // SAME 0x28E48 + EG_PA_CL_UCP_2_W = 0x285E8, // SAME 0x28E4C + EG_PA_CL_UCP_3_X = 0x285EC, // SAME 0x28E50 + EG_PA_CL_UCP_3_Y = 0x285F0, // SAME 0x28E54 + EG_PA_CL_UCP_3_Z = 0x285F4, // SAME 0x28E58 + EG_PA_CL_UCP_3_W = 0x285F8, // SAME 0x28E5C + EG_PA_CL_UCP_4_X = 0x285FC, // SAME 0x28E60 + EG_PA_CL_UCP_4_Y = 0x28600, // SAME 0x28E64 + EG_PA_CL_UCP_4_Z = 0x28604, // SAME 0x28E68 + EG_PA_CL_UCP_4_W = 0x28608, // SAME 0x28E6C + EG_PA_CL_UCP_5_X = 0x2860C, // SAME 0x28E70 + EG_PA_CL_UCP_5_Y = 0x28610, // SAME 0x28E74 + EG_PA_CL_UCP_5_Z = 0x28614, // SAME 0x28E78 + EG_PA_CL_UCP_5_W = 0x28618, // SAME 0x28E7C + EG_PA_CL_POINT_X_RAD = 0x287D4, // SAME 0x28E10 + EG_PA_CL_POINT_Y_RAD = 0x287D8, // SAME 0x28E14 + EG_PA_CL_POINT_SIZE = 0x287DC, // SAME 0x28E18 + EG_PA_CL_POINT_CULL_RAD = 0x287E0, // SAME 0x28E1C + EG_PA_CL_CLIP_CNTL = 0x28810, // SAME + EG_PA_SU_SC_MODE_CNTL = 0x28814, // SAME + EG_PA_CL_VTE_CNTL = 0x28818, // SAME + EG_PA_CL_VS_OUT_CNTL = 0x2881C, // SAME + EG_PA_CL_NANINF_CNTL = 0x28820, // SAME + EG_PA_SU_LINE_STIPPLE_CNTL = 0x28824, // + EG_PA_SU_LINE_STIPPLE_SCALE = 0x28828, // + EG_PA_SU_PRIM_FILTER_CNTL = 0x2882C, // + EG_PA_SU_POINT_SIZE = 0x28A00, // SAME + EG_PA_SU_POINT_MINMAX = 0x28A04, // SAME + EG_PA_SU_LINE_CNTL = 0x28A08, // SAME + EG_PA_SC_LINE_STIPPLE = 0x28A0C, // SAME + EG_PA_SC_MODE_CNTL_0 = 0x28A48, // + EG_PA_SC_MODE_CNTL_1 = 0x28A4C, // + EG_PA_SU_POLY_OFFSET_DB_FMT_CNTL = 0x28B78, // SAME 0x28DF8 + EG_PA_SU_POLY_OFFSET_CLAMP = 0x28B7C, // SAME 0x28DFC + EG_PA_SU_POLY_OFFSET_FRONT_SCALE = 0x28B80, // SAME 0x28E00 + EG_PA_SU_POLY_OFFSET_FRONT_OFFSET = 0x28B84, // SAME 0x28E04 + EG_PA_SU_POLY_OFFSET_BACK_SCALE = 0x28B88, // SAME 0x28E08 + EG_PA_SU_POLY_OFFSET_BACK_OFFSET = 0x28B8C, // SAME 0x28E0C + EG_PA_SC_LINE_CNTL = 0x28C00, // DIFF + EG_PA_SC_AA_CONFIG = 0x28C04, // SAME + EG_PA_SU_VTX_CNTL = 0x28C08, // SAME + EG_PA_CL_GB_VERT_CLIP_ADJ = 0x28C0C, // SAME + EG_PA_CL_GB_VERT_DISC_ADJ = 0x28C10, // SAME + EG_PA_CL_GB_HORZ_CLIP_ADJ = 0x28C14, // SAME + EG_PA_CL_GB_HORZ_DISC_ADJ = 0x28C18, // SAME + EG_PA_SC_AA_SAMPLE_LOCS_0 = 0x28C1C, // + EG_PA_SC_AA_SAMPLE_LOCS_1 = 0x28C20, // + EG_PA_SC_AA_SAMPLE_LOCS_2 = 0x28C24, // + EG_PA_SC_AA_SAMPLE_LOCS_3 = 0x28C28, // + EG_PA_SC_AA_SAMPLE_LOCS_4 = 0x28C2C, // + EG_PA_SC_AA_SAMPLE_LOCS_5 = 0x28C30, // + EG_PA_SC_AA_SAMPLE_LOCS_6 = 0x28C34, // + EG_PA_SC_AA_SAMPLE_LOCS_7 = 0x28C38, // + EG_PA_SC_AA_MASK = 0x28C3C, // SAME 0x28C48 + +/* Registers from VGT block: */ + EG_VGT_INDEX_TYPE = 0x895C, //? config space + EG_VGT_PRIMITIVE_TYPE = 0x8958, //? config space + + EG_VGT_MAX_VTX_INDX = 0x28400, // SAME + EG_VGT_MIN_VTX_INDX = 0x28404, // SAME + EG_VGT_INDX_OFFSET = 0x28408, // SAME + EG_VGT_MULTI_PRIM_IB_RESET_INDX = 0x2840C, // SAME + EG_CS_COPY_STATE = 0x287CC, // + EG_GFX_COPY_STATE = 0x287D0, // SAME + EG_VGT_DMA_BASE_HI = 0x287E4, // SAME + EG_VGT_DMA_BASE = 0x287E8, // SAME + EG_VGT_DRAW_INITIATOR = 0x287F0, // SAME + EG_VGT_IMMED_DATA = 0x287F4, // SAME + EG_VGT_EVENT_ADDRESS_REG = 0x287F8, // SAME + EG_VGT_OUTPUT_PATH_CNTL = 0x28A10, // DIFF + EG_VGT_HOS_CNTL = 0x28A14, // SAME + EG_VGT_HOS_MAX_TESS_LEVEL = 0x28A18, // SAME + EG_VGT_HOS_MIN_TESS_LEVEL = 0x28A1C, // SAME + EG_VGT_HOS_REUSE_DEPTH = 0x28A20, // SAME + EG_VGT_GROUP_PRIM_TYPE = 0x28A24, // SAME + EG_VGT_GROUP_FIRST_DECR = 0x28A28, // SAME + EG_VGT_GROUP_DECR = 0x28A2C, // SAME + EG_VGT_GROUP_VECT_0_CNTL = 0x28A30, // SAME + EG_VGT_GROUP_VECT_1_CNTL = 0x28A34, // SAME + EG_VGT_GROUP_VECT_0_FMT_CNTL = 0x28A38, // SAME + EG_VGT_GROUP_VECT_1_FMT_CNTL = 0x28A3C, // SAME + EG_VGT_GS_MODE = 0x28A40, // DIFF + EG_VGT_ENHANCE = 0x28A50, // DIFF + EG_VGT_GS_PER_ES = 0x28A54, // DIFF 0x88C8 + EG_VGT_ES_PER_GS = 0x28A58, // DIFF 0x88CC + EG_VGT_GS_PER_VS = 0x28A5C, // SAME 0x88E8 + EG_VGT_GS_OUT_PRIM_TYPE = 0x28A6C, // SAME + EG_VGT_DMA_SIZE = 0x28A74, // SAME + EG_VGT_DMA_MAX_SIZE = 0x28A78, // SAME + EG_VGT_DMA_INDEX_TYPE = 0x28A7C, // SAME + EG_VGT_PRIMITIVEID_EN = 0x28A84, // SAME + EG_VGT_DMA_NUM_INSTANCES = 0x28A88, // SAME + EG_VGT_EVENT_INITIATOR = 0x28A90, // SAME + EG_VGT_MULTI_PRIM_IB_RESET_EN = 0x28A94, // SAME + EG_VGT_INSTANCE_STEP_RATE_0 = 0x28AA0, // SAME + EG_VGT_INSTANCE_STEP_RATE_1 = 0x28AA4, // SAME + EG_VGT_REUSE_OFF = 0x28AB4, // SAME + EG_VGT_VTX_CNT_EN = 0x28AB8, // SAME + EG_VGT_STRMOUT_BUFFER_SIZE_0 = 0x28AD0, // SAME + EG_VGT_STRMOUT_VTX_STRIDE_0 = 0x28AD4, // SAME + EG_VGT_STRMOUT_BUFFER_BASE_0 = 0x28AD8, // SAME + EG_VGT_STRMOUT_BUFFER_OFFSET_0 = 0x28ADC, // SAME + EG_VGT_STRMOUT_BUFFER_SIZE_1 = 0x28AE0, // SAME + EG_VGT_STRMOUT_VTX_STRIDE_1 = 0x28AE4, // SAME + EG_VGT_STRMOUT_BUFFER_BASE_1 = 0x28AE8, // SAME + EG_VGT_STRMOUT_BUFFER_OFFSET_1 = 0x28AEC, // SAME + EG_VGT_STRMOUT_BUFFER_SIZE_2 = 0x28AF0, // SAME + EG_VGT_STRMOUT_VTX_STRIDE_2 = 0x28AF4, // SAME + EG_VGT_STRMOUT_BUFFER_BASE_2 = 0x28AF8, // SAME + EG_VGT_STRMOUT_BUFFER_OFFSET_2 = 0x28AFC, // SAME + EG_VGT_STRMOUT_BUFFER_SIZE_3 = 0x28B00, // SAME + EG_VGT_STRMOUT_VTX_STRIDE_3 = 0x28B04, // SAME + EG_VGT_STRMOUT_BUFFER_BASE_3 = 0x28B08, // SAME + EG_VGT_STRMOUT_BUFFER_OFFSET_3 = 0x28B0C, // SAME + EG_VGT_STRMOUT_BASE_OFFSET_0 = 0x28B10, // SAME + EG_VGT_STRMOUT_BASE_OFFSET_1 = 0x28B14, // SAME + EG_VGT_STRMOUT_BASE_OFFSET_2 = 0x28B18, // SAME + EG_VGT_STRMOUT_BASE_OFFSET_3 = 0x28B1C, // SAME + EG_VGT_STRMOUT_DRAW_OPAQUE_OFFSET = 0x28B28, // SAME + EG_VGT_STRMOUT_DRAW_OPAQUE_BUFFER_FILLED_SIZE = 0x28B2C, // SAME + EG_VGT_STRMOUT_DRAW_OPAQUE_VERTEX_STRIDE = 0x28B30, // DIFF + EG_VGT_GS_MAX_VERT_OUT = 0x28B38, // SAME + EG_VGT_STRMOUT_BASE_OFFSET_HI_0 = 0x28B44, // SAME + EG_VGT_STRMOUT_BASE_OFFSET_HI_1 = 0x28B48, // SAME + EG_VGT_STRMOUT_BASE_OFFSET_HI_2 = 0x28B4C, // SAME + EG_VGT_STRMOUT_BASE_OFFSET_HI_3 = 0x28B50, // SAME + EG_VGT_SHADER_STAGES_EN = 0x28B54, // + EG_VGT_LS_HS_CONFIG = 0x28B58, // + EG_VGT_LS_SIZE = 0x28B5C, // + EG_VGT_HS_SIZE = 0x28B60, // + EG_VGT_LS_HS_ALLOC = 0x28B64, // + EG_VGT_HS_PATCH_CONST = 0x28B68, // + EG_VGT_TF_PARAM = 0x28B6C, // + EG_VGT_DISPATCH_INITIATOR = 0x28B74, // + EG_VGT_GS_INSTANCE_CNT = 0x28B90, // + EG_VGT_STRMOUT_CONFIG = 0x28B94, // + EG_VGT_STRMOUT_BUFFER_CONFIG = 0x28B98, // + EG_VGT_VERTEX_REUSE_BLOCK_CNTL = 0x28C58, // SAME + EG_VGT_OUT_DEALLOC_CNTL = 0x28C5C, // SAME + +/* Registers from TP block: */ + EG_GDS_ADDR_BASE = 0x28720, // + EG_GDS_ADDR_SIZE = 0x28724, // + EG_GDS_ORDERED_WAVE_PER_SE = 0x28728, // + EG_GDS_APPEND_CONSUME_UAV0 = 0x2872C, // + EG_GDS_APPEND_CONSUME_UAV1 = 0x28730, // + EG_GDS_APPEND_CONSUME_UAV2 = 0x28734, // + EG_GDS_APPEND_CONSUME_UAV3 = 0x28738, // + EG_GDS_APPEND_CONSUME_UAV4 = 0x2873C, // + EG_GDS_APPEND_CONSUME_UAV5 = 0x28740, // + EG_GDS_APPEND_CONSUME_UAV6 = 0x28744, // + EG_GDS_APPEND_CONSUME_UAV7 = 0x28748, // + EG_GDS_APPEND_CONSUME_UAV8 = 0x2874C, // + EG_GDS_APPEND_CONSUME_UAV9 = 0x28750, // + EG_GDS_APPEND_CONSUME_UAV10 = 0x28754, // + EG_GDS_APPEND_CONSUME_UAV11 = 0x28758, // + +/* Registers from SQ block: */ + EG_SQ_LOOP_CONST_0 = 0x3A200, // 0x3E200 + EG_SQ_ALU_CONST_BUFFER_SIZE_VS_0 = 0x28180, // ? + EG_SQ_VTX_SEMANTIC_0 = 0x28380, // SAME + EG_SQ_VTX_SEMANTIC_1 = 0x28384, // SAME + EG_SQ_VTX_SEMANTIC_2 = 0x28388, // SAME + EG_SQ_VTX_SEMANTIC_3 = 0x2838C, // SAME + EG_SQ_VTX_SEMANTIC_4 = 0x28390, // SAME + EG_SQ_VTX_SEMANTIC_5 = 0x28394, // SAME + EG_SQ_VTX_SEMANTIC_6 = 0x28398, // SAME + EG_SQ_VTX_SEMANTIC_7 = 0x2839C, // SAME + EG_SQ_VTX_SEMANTIC_8 = 0x283A0, // SAME + EG_SQ_VTX_SEMANTIC_9 = 0x283A4, // SAME + EG_SQ_VTX_SEMANTIC_10 = 0x283A8, // SAME + EG_SQ_VTX_SEMANTIC_11 = 0x283AC, // SAME + EG_SQ_VTX_SEMANTIC_12 = 0x283B0, // SAME + EG_SQ_VTX_SEMANTIC_13 = 0x283B4, // SAME + EG_SQ_VTX_SEMANTIC_14 = 0x283B8, // SAME + EG_SQ_VTX_SEMANTIC_15 = 0x283BC, // SAME + EG_SQ_VTX_SEMANTIC_16 = 0x283C0, // SAME + EG_SQ_VTX_SEMANTIC_17 = 0x283C4, // SAME + EG_SQ_VTX_SEMANTIC_18 = 0x283C8, // SAME + EG_SQ_VTX_SEMANTIC_19 = 0x283CC, // SAME + EG_SQ_VTX_SEMANTIC_20 = 0x283D0, // SAME + EG_SQ_VTX_SEMANTIC_21 = 0x283D4, // SAME + EG_SQ_VTX_SEMANTIC_22 = 0x283D8, // SAME + EG_SQ_VTX_SEMANTIC_23 = 0x283DC, // SAME + EG_SQ_VTX_SEMANTIC_24 = 0x283E0, // SAME + EG_SQ_VTX_SEMANTIC_25 = 0x283E4, // SAME + EG_SQ_VTX_SEMANTIC_26 = 0x283E8, // SAME + EG_SQ_VTX_SEMANTIC_27 = 0x283EC, // SAME + EG_SQ_VTX_SEMANTIC_28 = 0x283F0, // SAME + EG_SQ_VTX_SEMANTIC_29 = 0x283F4, // SAME + EG_SQ_VTX_SEMANTIC_30 = 0x283F8, // SAME + EG_SQ_VTX_SEMANTIC_31 = 0x283FC, // SAME + EG_SQ_LSTMP_RING_ITEMSIZE = 0x28830, // + EG_SQ_HSTMP_RING_ITEMSIZE = 0x28834, // + EG_SQ_DYN_GPR_RESOURCE_LIMIT_1 = 0x28838, // + EG_SQ_PGM_START_PS = 0x28840, // SAME + EG_SQ_PGM_RESOURCES_PS = 0x28844, // DIFF 0x28850 + EG_SQ_PGM_RESOURCES_2_PS = 0x28848, // + EG_SQ_PGM_EXPORTS_PS = 0x2884C, // SAME 0x28854 + EG_SQ_PGM_START_VS = 0x2885C, // SAME 0x28858 + EG_SQ_PGM_RESOURCES_VS = 0x28860, // DIFF 0x28868 + EG_SQ_PGM_RESOURCES_2_VS = 0x28864, // + EG_SQ_PGM_START_GS = 0x28874, // SAME 0x2886C + EG_SQ_PGM_RESOURCES_GS = 0x28878, // DIFF 0x2887C + EG_SQ_PGM_RESOURCES_2_GS = 0x2887C, // + EG_SQ_PGM_START_ES = 0x2888C, // SAME 0x28880 + EG_SQ_PGM_RESOURCES_ES = 0x28890, // DIFF + EG_SQ_PGM_RESOURCES_2_ES = 0x28894, // + EG_SQ_PGM_START_FS = 0x288A4, // SAME 0x28894 + EG_SQ_PGM_RESOURCES_FS = 0x288A8, // DIFF 0x288A4 + EG_SQ_PGM_START_HS = 0x288B8, // + EG_SQ_PGM_RESOURCES_HS = 0x288BC, // + EG_SQ_PGM_RESOURCES_2_HS = 0x288C0, // + EG_SQ_PGM_START_LS = 0x288D0, // + EG_SQ_PGM_RESOURCES_LS = 0x288D4, // + EG_SQ_PGM_RESOURCES_2_LS = 0x288D8, // + EG_SQ_THREAD_TRACE_USERDATA = 0x288DC, // + EG_SQ_LDS_ALLOC = 0x288E8, // + EG_SQ_LDS_ALLOC_PS = 0x288EC, // + EG_SQ_VTX_SEMANTIC_CLEAR = 0x288F0, // SAME 0x288E0 + EG_SQ_THREAD_TRACE_CTRL = 0x288F8, // + EG_SQ_ESGS_RING_ITEMSIZE = 0x28900, // SAME 0x288A8 + EG_SQ_GSVS_RING_ITEMSIZE = 0x28904, // SAME 0x288AC + EG_SQ_ESTMP_RING_ITEMSIZE = 0x28908, // SAME 0x288B0 + EG_SQ_GSTMP_RING_ITEMSIZE = 0x2890C, // SAME 0x288B4 + EG_SQ_VSTMP_RING_ITEMSIZE = 0x28910, // SAME 0x288B8 + EG_SQ_PSTMP_RING_ITEMSIZE = 0x28914, // SAME 0x288BC + EG_SQ_GS_VERT_ITEMSIZE = 0x2891C, // SAME 0x288C8 + EG_SQ_GS_VERT_ITEMSIZE_1 = 0x28920, // + EG_SQ_GS_VERT_ITEMSIZE_2 = 0x28924, // + EG_SQ_GS_VERT_ITEMSIZE_3 = 0x28928, // + EG_SQ_GSVS_RING_OFFSET_1 = 0x2892C, // + EG_SQ_GSVS_RING_OFFSET_2 = 0x28930, // + EG_SQ_GSVS_RING_OFFSET_3 = 0x28934, // + EG_SQ_ALU_CONST_CACHE_PS_0 = 0x28940, // SAME + EG_SQ_ALU_CONST_CACHE_PS_1 = 0x28944, // SAME + EG_SQ_ALU_CONST_CACHE_PS_2 = 0x28948, // SAME + EG_SQ_ALU_CONST_CACHE_PS_3 = 0x2894C, // SAME + EG_SQ_ALU_CONST_CACHE_PS_4 = 0x28950, // SAME + EG_SQ_ALU_CONST_CACHE_PS_5 = 0x28954, // SAME + EG_SQ_ALU_CONST_CACHE_PS_6 = 0x28958, // SAME + EG_SQ_ALU_CONST_CACHE_PS_7 = 0x2895C, // SAME + EG_SQ_ALU_CONST_CACHE_PS_8 = 0x28960, // SAME + EG_SQ_ALU_CONST_CACHE_PS_9 = 0x28964, // SAME + EG_SQ_ALU_CONST_CACHE_PS_10 = 0x28968, // SAME + EG_SQ_ALU_CONST_CACHE_PS_11 = 0x2896C, // SAME + EG_SQ_ALU_CONST_CACHE_PS_12 = 0x28970, // SAME + EG_SQ_ALU_CONST_CACHE_PS_13 = 0x28974, // SAME + EG_SQ_ALU_CONST_CACHE_PS_14 = 0x28978, // SAME + EG_SQ_ALU_CONST_CACHE_PS_15 = 0x2897C, // SAME + EG_SQ_ALU_CONST_CACHE_VS_0 = 0x28980, // SAME + EG_SQ_ALU_CONST_CACHE_VS_1 = 0x28984, // SAME + EG_SQ_ALU_CONST_CACHE_VS_2 = 0x28988, // SAME + EG_SQ_ALU_CONST_CACHE_VS_3 = 0x2898C, // SAME + EG_SQ_ALU_CONST_CACHE_VS_4 = 0x28990, // SAME + EG_SQ_ALU_CONST_CACHE_VS_5 = 0x28994, // SAME + EG_SQ_ALU_CONST_CACHE_VS_6 = 0x28998, // SAME + EG_SQ_ALU_CONST_CACHE_VS_7 = 0x2899C, // SAME + EG_SQ_ALU_CONST_CACHE_VS_8 = 0x289A0, // SAME + EG_SQ_ALU_CONST_CACHE_VS_9 = 0x289A4, // SAME + EG_SQ_ALU_CONST_CACHE_VS_10 = 0x289A8, // SAME + EG_SQ_ALU_CONST_CACHE_VS_11 = 0x289AC, // SAME + EG_SQ_ALU_CONST_CACHE_VS_12 = 0x289B0, // SAME + EG_SQ_ALU_CONST_CACHE_VS_13 = 0x289B4, // SAME + EG_SQ_ALU_CONST_CACHE_VS_14 = 0x289B8, // SAME + EG_SQ_ALU_CONST_CACHE_VS_15 = 0x289BC, // SAME + EG_SQ_ALU_CONST_CACHE_GS_0 = 0x289C0, // SAME + EG_SQ_ALU_CONST_CACHE_GS_1 = 0x289C4, // SAME + EG_SQ_ALU_CONST_CACHE_GS_2 = 0x289C8, // SAME + EG_SQ_ALU_CONST_CACHE_GS_3 = 0x289CC, // SAME + EG_SQ_ALU_CONST_CACHE_GS_4 = 0x289D0, // SAME + EG_SQ_ALU_CONST_CACHE_GS_5 = 0x289D4, // SAME + EG_SQ_ALU_CONST_CACHE_GS_6 = 0x289D8, // SAME + EG_SQ_ALU_CONST_CACHE_GS_7 = 0x289DC, // SAME + EG_SQ_ALU_CONST_CACHE_GS_8 = 0x289E0, // SAME + EG_SQ_ALU_CONST_CACHE_GS_9 = 0x289E4, // SAME + EG_SQ_ALU_CONST_CACHE_GS_10 = 0x289E8, // SAME + EG_SQ_ALU_CONST_CACHE_GS_11 = 0x289EC, // SAME + EG_SQ_ALU_CONST_CACHE_GS_12 = 0x289F0, // SAME + EG_SQ_ALU_CONST_CACHE_GS_13 = 0x289F4, // SAME + EG_SQ_ALU_CONST_CACHE_GS_14 = 0x289F8, // SAME + EG_SQ_ALU_CONST_CACHE_GS_15 = 0x289FC, // SAME + EG_SQ_ALU_CONST_CACHE_HS_0 = 0x28F00, // + EG_SQ_ALU_CONST_CACHE_HS_1 = 0x28F04, // + EG_SQ_ALU_CONST_CACHE_HS_2 = 0x28F08, // + EG_SQ_ALU_CONST_CACHE_HS_3 = 0x28F0C, // + EG_SQ_ALU_CONST_CACHE_HS_4 = 0x28F10, // + EG_SQ_ALU_CONST_CACHE_HS_5 = 0x28F14, // + EG_SQ_ALU_CONST_CACHE_HS_6 = 0x28F18, // + EG_SQ_ALU_CONST_CACHE_HS_7 = 0x28F1C, // + EG_SQ_ALU_CONST_CACHE_HS_8 = 0x28F20, // + EG_SQ_ALU_CONST_CACHE_HS_9 = 0x28F24, // + EG_SQ_ALU_CONST_CACHE_HS_10 = 0x28F28, // + EG_SQ_ALU_CONST_CACHE_HS_11 = 0x28F2C, // + EG_SQ_ALU_CONST_CACHE_HS_12 = 0x28F30, // + EG_SQ_ALU_CONST_CACHE_HS_13 = 0x28F34, // + EG_SQ_ALU_CONST_CACHE_HS_14 = 0x28F38, // + EG_SQ_ALU_CONST_CACHE_HS_15 = 0x28F3C, // + EG_SQ_ALU_CONST_CACHE_LS_0 = 0x28F40, // + EG_SQ_ALU_CONST_CACHE_LS_1 = 0x28F44, // + EG_SQ_ALU_CONST_CACHE_LS_2 = 0x28F48, // + EG_SQ_ALU_CONST_CACHE_LS_3 = 0x28F4C, // + EG_SQ_ALU_CONST_CACHE_LS_4 = 0x28F50, // + EG_SQ_ALU_CONST_CACHE_LS_5 = 0x28F54, // + EG_SQ_ALU_CONST_CACHE_LS_6 = 0x28F58, // + EG_SQ_ALU_CONST_CACHE_LS_7 = 0x28F5C, // + EG_SQ_ALU_CONST_CACHE_LS_8 = 0x28F60, // + EG_SQ_ALU_CONST_CACHE_LS_9 = 0x28F64, // + EG_SQ_ALU_CONST_CACHE_LS_10 = 0x28F68, // + EG_SQ_ALU_CONST_CACHE_LS_11 = 0x28F6C, // + EG_SQ_ALU_CONST_CACHE_LS_12 = 0x28F70, // + EG_SQ_ALU_CONST_CACHE_LS_13 = 0x28F74, // + EG_SQ_ALU_CONST_CACHE_LS_14 = 0x28F78, // + EG_SQ_ALU_CONST_CACHE_LS_15 = 0x28F7C, // + EG_SQ_ALU_CONST_BUFFER_SIZE_PS_0 = 0x28140, + EG_SQ_ALU_CONST_BUFFER_SIZE_HS_0 = 0x28F80, // + EG_SQ_ALU_CONST_BUFFER_SIZE_HS_1 = 0x28F84, // + EG_SQ_ALU_CONST_BUFFER_SIZE_HS_2 = 0x28F88, // + EG_SQ_ALU_CONST_BUFFER_SIZE_HS_3 = 0x28F8C, // + EG_SQ_ALU_CONST_BUFFER_SIZE_HS_4 = 0x28F90, // + EG_SQ_ALU_CONST_BUFFER_SIZE_HS_5 = 0x28F94, // + EG_SQ_ALU_CONST_BUFFER_SIZE_HS_6 = 0x28F98, // + EG_SQ_ALU_CONST_BUFFER_SIZE_HS_7 = 0x28F9C, // + EG_SQ_ALU_CONST_BUFFER_SIZE_HS_8 = 0x28FA0, // + EG_SQ_ALU_CONST_BUFFER_SIZE_HS_9 = 0x28FA4, // + EG_SQ_ALU_CONST_BUFFER_SIZE_HS_10 = 0x28FA8, // + EG_SQ_ALU_CONST_BUFFER_SIZE_HS_11 = 0x28FAC, // + EG_SQ_ALU_CONST_BUFFER_SIZE_HS_12 = 0x28FB0, // + EG_SQ_ALU_CONST_BUFFER_SIZE_HS_13 = 0x28FB4, // + EG_SQ_ALU_CONST_BUFFER_SIZE_HS_14 = 0x28FB8, // + EG_SQ_ALU_CONST_BUFFER_SIZE_HS_15 = 0x28FBC, // + EG_SQ_ALU_CONST_BUFFER_SIZE_LS_0 = 0x28FC0, // + EG_SQ_ALU_CONST_BUFFER_SIZE_LS_1 = 0x28FC4, // + EG_SQ_ALU_CONST_BUFFER_SIZE_LS_2 = 0x28FC8, // + EG_SQ_ALU_CONST_BUFFER_SIZE_LS_3 = 0x28FCC, // + EG_SQ_ALU_CONST_BUFFER_SIZE_LS_4 = 0x28FD0, // + EG_SQ_ALU_CONST_BUFFER_SIZE_LS_5 = 0x28FD4, // + EG_SQ_ALU_CONST_BUFFER_SIZE_LS_6 = 0x28FD8, // + EG_SQ_ALU_CONST_BUFFER_SIZE_LS_7 = 0x28FDC, // + EG_SQ_ALU_CONST_BUFFER_SIZE_LS_8 = 0x28FE0, // + EG_SQ_ALU_CONST_BUFFER_SIZE_LS_9 = 0x28FE4, // + EG_SQ_ALU_CONST_BUFFER_SIZE_LS_10 = 0x28FE8, // + EG_SQ_ALU_CONST_BUFFER_SIZE_LS_11 = 0x28FEC, // + EG_SQ_ALU_CONST_BUFFER_SIZE_LS_12 = 0x28FF0, // + EG_SQ_ALU_CONST_BUFFER_SIZE_LS_13 = 0x28FF4, // + EG_SQ_ALU_CONST_BUFFER_SIZE_LS_14 = 0x28FF8, // + EG_SQ_ALU_CONST_BUFFER_SIZE_LS_15 = 0x28FFC, // + +/* Registers from SPI block: */ + EG_SPI_VS_OUT_ID_0 = 0x2861C, // SAME 0x28614 + EG_SPI_VS_OUT_ID_1 = 0x28620, // SAME 0x28618 + EG_SPI_VS_OUT_ID_2 = 0x28624, // SAME 0x2861C + EG_SPI_VS_OUT_ID_3 = 0x28628, // SAME 0x28620 + EG_SPI_VS_OUT_ID_4 = 0x2862C, // SAME 0x28624 + EG_SPI_VS_OUT_ID_5 = 0x28630, // SAME 0x28628 + EG_SPI_VS_OUT_ID_6 = 0x28634, // SAME 0x2862C + EG_SPI_VS_OUT_ID_7 = 0x28638, // SAME 0x28630 + EG_SPI_VS_OUT_ID_8 = 0x2863C, // SAME 0x28634 + EG_SPI_VS_OUT_ID_9 = 0x28640, // SAME 0x28638 + EG_SPI_PS_INPUT_CNTL_0 = 0x28644, // SAME + EG_SPI_PS_INPUT_CNTL_1 = 0x28648, // SAME + EG_SPI_PS_INPUT_CNTL_2 = 0x2864C, // SAME + EG_SPI_PS_INPUT_CNTL_3 = 0x28650, // SAME + EG_SPI_PS_INPUT_CNTL_4 = 0x28654, // SAME + EG_SPI_PS_INPUT_CNTL_5 = 0x28658, // SAME + EG_SPI_PS_INPUT_CNTL_6 = 0x2865C, // SAME + EG_SPI_PS_INPUT_CNTL_7 = 0x28660, // SAME + EG_SPI_PS_INPUT_CNTL_8 = 0x28664, // SAME + EG_SPI_PS_INPUT_CNTL_9 = 0x28668, // SAME + EG_SPI_PS_INPUT_CNTL_10 = 0x2866C, // SAME + EG_SPI_PS_INPUT_CNTL_11 = 0x28670, // SAME + EG_SPI_PS_INPUT_CNTL_12 = 0x28674, // SAME + EG_SPI_PS_INPUT_CNTL_13 = 0x28678, // SAME + EG_SPI_PS_INPUT_CNTL_14 = 0x2867C, // SAME + EG_SPI_PS_INPUT_CNTL_15 = 0x28680, // SAME + EG_SPI_PS_INPUT_CNTL_16 = 0x28684, // SAME + EG_SPI_PS_INPUT_CNTL_17 = 0x28688, // SAME + EG_SPI_PS_INPUT_CNTL_18 = 0x2868C, // SAME + EG_SPI_PS_INPUT_CNTL_19 = 0x28690, // SAME + EG_SPI_PS_INPUT_CNTL_20 = 0x28694, // SAME + EG_SPI_PS_INPUT_CNTL_21 = 0x28698, // SAME + EG_SPI_PS_INPUT_CNTL_22 = 0x2869C, // SAME + EG_SPI_PS_INPUT_CNTL_23 = 0x286A0, // SAME + EG_SPI_PS_INPUT_CNTL_24 = 0x286A4, // SAME + EG_SPI_PS_INPUT_CNTL_25 = 0x286A8, // SAME + EG_SPI_PS_INPUT_CNTL_26 = 0x286AC, // SAME + EG_SPI_PS_INPUT_CNTL_27 = 0x286B0, // SAME + EG_SPI_PS_INPUT_CNTL_28 = 0x286B4, // SAME + EG_SPI_PS_INPUT_CNTL_29 = 0x286B8, // SAME + EG_SPI_PS_INPUT_CNTL_30 = 0x286BC, // SAME + EG_SPI_PS_INPUT_CNTL_31 = 0x286C0, // SAME + EG_SPI_VS_OUT_CONFIG = 0x286C4, // SAME + EG_SPI_THREAD_GROUPING = 0x286C8, // DIFF + EG_SPI_PS_IN_CONTROL_0 = 0x286CC, // SAME + EG_SPI_PS_IN_CONTROL_1 = 0x286D0, // SAME + EG_SPI_INTERP_CONTROL_0 = 0x286D4, // SAME + EG_SPI_INPUT_Z = 0x286D8, // SAME + EG_SPI_FOG_CNTL = 0x286DC, // SAME + EG_SPI_BARYC_CNTL = 0x286E0, // + EG_SPI_PS_IN_CONTROL_2 = 0x286E4, // + EG_SPI_COMPUTE_INPUT_CNTL = 0x286E8, // + EG_SPI_COMPUTE_NUM_THREAD_X = 0x286EC, // + EG_SPI_COMPUTE_NUM_THREAD_Y = 0x286F0, // + EG_SPI_COMPUTE_NUM_THREAD_Z = 0x286F4, // + +/* Registers from SX block: */ + EG_SX_MISC = 0x28350, // SAME + EG_SX_SURFACE_SYNC = 0x28354, // DIFF + EG_SX_ALPHA_TEST_CONTROL = 0x28410, // SAME + EG_SX_ALPHA_REF = 0x28438, // SAME + +/* Registers from DB block: */ + EG_DB_RENDER_CONTROL = 0x28000, // DIFF 0x28D0C + EG_DB_COUNT_CONTROL = 0x28004, // + EG_DB_DEPTH_VIEW = 0x28008, // DIFF 0x28004 + EG_DB_RENDER_OVERRIDE = 0x2800C, // DIFF 0x28D10 + EG_DB_RENDER_OVERRIDE2 = 0x28010, // + EG_DB_HTILE_DATA_BASE = 0x28014, // SAME + + EG_DB_STENCIL_CLEAR = 0x28028, // SAME + EG_DB_DEPTH_CLEAR = 0x2802C, // SAME + + EG_DB_Z_INFO = 0x28040, // + EG_DB_STENCIL_INFO = 0x28044, // + EG_DB_Z_READ_BASE = 0x28048, // + EG_DB_STENCIL_READ_BASE = 0x2804C, // + EG_DB_Z_WRITE_BASE = 0x28050, // + EG_DB_STENCIL_WRITE_BASE = 0x28054, // + EG_DB_DEPTH_SIZE = 0x28058, // DIFF 0x28000 + EG_DB_DEPTH_SLICE = 0x2805C, // + + EG_DB_STENCILREFMASK = 0x28430, // SAME + EG_DB_STENCILREFMASK_BF = 0x28434, // SAME + EG_DB_DEPTH_CONTROL = 0x28800, // SAME + EG_DB_SHADER_CONTROL = 0x2880C, // DIFF + EG_DB_HTILE_SURFACE = 0x28ABC, // SAME 0x28D24 + EG_DB_SRESULTS_COMPARE_STATE0 = 0x28AC0, // SAME 0x28D28 + EG_DB_SRESULTS_COMPARE_STATE1 = 0x28AC4, // SAME 0x28D2C + EG_DB_PRELOAD_CONTROL = 0x28AC8, // SAME 0x28D30 + EG_DB_ALPHA_TO_MASK = 0x28B70, // SAME 0x28D44 + +/* Registers from CB block: */ + EG_CB_TARGET_MASK = 0x28238, // SAME + EG_CB_SHADER_MASK = 0x2823C, // SAME + EG_CB_BLEND_RED = 0x28414, // SAME + EG_CB_BLEND_GREEN = 0x28418, // SAME + EG_CB_BLEND_BLUE = 0x2841C, // SAME + EG_CB_BLEND_ALPHA = 0x28420, // SAME + EG_CB_BLEND0_CONTROL = 0x28780, // DIFF + EG_CB_BLEND1_CONTROL = 0x28784, // DIFF + EG_CB_BLEND2_CONTROL = 0x28788, // DIFF + EG_CB_BLEND3_CONTROL = 0x2878C, // DIFF + EG_CB_BLEND4_CONTROL = 0x28790, // DIFF + EG_CB_BLEND5_CONTROL = 0x28794, // DIFF + EG_CB_BLEND6_CONTROL = 0x28798, // DIFF + EG_CB_BLEND7_CONTROL = 0x2879C, // DIFF + EG_CB_COLOR_CONTROL = 0x28808, // DIFF + EG_CB_IMMED0_BASE = 0x28B9C, // + EG_CB_IMMED1_BASE = 0x28BA0, // + EG_CB_IMMED2_BASE = 0x28BA4, // + EG_CB_IMMED3_BASE = 0x28BA8, // + EG_CB_IMMED4_BASE = 0x28BAC, // + EG_CB_IMMED5_BASE = 0x28BB0, // + EG_CB_IMMED6_BASE = 0x28BB4, // + EG_CB_IMMED7_BASE = 0x28BB8, // + EG_CB_IMMED8_BASE = 0x28BBC, // + EG_CB_IMMED9_BASE = 0x28BC0, // + EG_CB_IMMED10_BASE = 0x28BC4, // + EG_CB_IMMED11_BASE = 0x28BC8, // + EG_CB_CLRCMP_CONTROL = 0x28C40, // SAME 0x28C30 + EG_CB_CLRCMP_SRC = 0x28C44, // SAME 0x28C34 + EG_CB_CLRCMP_DST = 0x28C48, // SAME 0x28C38 + EG_CB_CLRCMP_MSK = 0x28C4C, // SAME 0x28C3C + EG_CB_COLOR0_BASE = 0x28C60, // SAME 0x28040 + EG_CB_COLOR0_PITCH = 0x28C64, // + EG_CB_COLOR0_SLICE = 0x28C68, // + EG_CB_COLOR0_VIEW = 0x28C6C, // SAME 0x28080 + EG_CB_COLOR0_INFO = 0x28C70, // DIFF 0x280A0 + EG_CB_COLOR0_ATTRIB = 0x28C74, // + EG_CB_COLOR0_DIM = 0x28C78, // + EG_CB_COLOR0_CMASK = 0x28C7C, // + EG_CB_COLOR0_CMASK_SLICE = 0x28C80, // + EG_CB_COLOR0_FMASK = 0x28C84, // + EG_CB_COLOR0_FMASK_SLICE = 0x28C88, // + EG_CB_COLOR0_CLEAR_WORD0 = 0x28C8C, // + EG_CB_COLOR0_CLEAR_WORD1 = 0x28C90, // + EG_CB_COLOR0_CLEAR_WORD2 = 0x28C94, // + EG_CB_COLOR0_CLEAR_WORD3 = 0x28C98, // + EG_CB_COLOR1_BASE = 0x28C9C, // SAME 0x28044 + EG_CB_COLOR1_PITCH = 0x28CA0, // + EG_CB_COLOR1_SLICE = 0x28CA4, // + EG_CB_COLOR1_VIEW = 0x28CA8, // SAME 0x28084 + EG_CB_COLOR1_INFO = 0x28CAC, // DIFF 0x280A4 + EG_CB_COLOR1_ATTRIB = 0x28CB0, // + EG_CB_COLOR1_DIM = 0x28CB4, // + EG_CB_COLOR1_CMASK = 0x28CB8, // + EG_CB_COLOR1_CMASK_SLICE = 0x28CBC, // + EG_CB_COLOR1_FMASK = 0x28CC0, // + EG_CB_COLOR1_FMASK_SLICE = 0x28CC4, // + EG_CB_COLOR1_CLEAR_WORD0 = 0x28CC8, // + EG_CB_COLOR1_CLEAR_WORD1 = 0x28CCC, // + EG_CB_COLOR1_CLEAR_WORD2 = 0x28CD0, // + EG_CB_COLOR1_CLEAR_WORD3 = 0x28CD4, // + EG_CB_COLOR2_BASE = 0x28CD8, // SAME 0x28048 + EG_CB_COLOR2_PITCH = 0x28CDC, // + EG_CB_COLOR2_SLICE = 0x28CE0, // + EG_CB_COLOR2_VIEW = 0x28CE4, // SAME 0x28088 + EG_CB_COLOR2_INFO = 0x28CE8, // DIFF 0x280A8 + EG_CB_COLOR2_ATTRIB = 0x28CEC, // + EG_CB_COLOR2_DIM = 0x28CF0, // + EG_CB_COLOR2_CMASK = 0x28CF4, // + EG_CB_COLOR2_CMASK_SLICE = 0x28CF8, // + EG_CB_COLOR2_FMASK = 0x28CFC, // + EG_CB_COLOR2_FMASK_SLICE = 0x28D00, // + EG_CB_COLOR2_CLEAR_WORD0 = 0x28D04, // + EG_CB_COLOR2_CLEAR_WORD1 = 0x28D08, // + EG_CB_COLOR2_CLEAR_WORD2 = 0x28D0C, // + EG_CB_COLOR2_CLEAR_WORD3 = 0x28D10, // + EG_CB_COLOR3_BASE = 0x28D14, // SAME 0x2804C + EG_CB_COLOR3_PITCH = 0x28D18, // + EG_CB_COLOR3_SLICE = 0x28D1C, // + EG_CB_COLOR3_VIEW = 0x28D20, // SAME 0x2808C + EG_CB_COLOR3_INFO = 0x28D24, // DIFF 0x280AC + EG_CB_COLOR3_ATTRIB = 0x28D28, // + EG_CB_COLOR3_DIM = 0x28D2C, // + EG_CB_COLOR3_CMASK = 0x28D30, // + EG_CB_COLOR3_CMASK_SLICE = 0x28D34, // + EG_CB_COLOR3_FMASK = 0x28D38, // + EG_CB_COLOR3_FMASK_SLICE = 0x28D3C, // + EG_CB_COLOR3_CLEAR_WORD0 = 0x28D40, // + EG_CB_COLOR3_CLEAR_WORD1 = 0x28D44, // + EG_CB_COLOR3_CLEAR_WORD2 = 0x28D48, // + EG_CB_COLOR3_CLEAR_WORD3 = 0x28D4C, // + EG_CB_COLOR4_BASE = 0x28D50, // SAME 0x28050 + EG_CB_COLOR4_PITCH = 0x28D54, // + EG_CB_COLOR4_SLICE = 0x28D58, // + EG_CB_COLOR4_VIEW = 0x28D5C, // SAME 0x28090 + EG_CB_COLOR4_INFO = 0x28D60, // DIFF 0x280B0 + EG_CB_COLOR4_ATTRIB = 0x28D64, // + EG_CB_COLOR4_DIM = 0x28D68, // + EG_CB_COLOR4_CMASK = 0x28D6C, // + EG_CB_COLOR4_CMASK_SLICE = 0x28D70, // + EG_CB_COLOR4_FMASK = 0x28D74, // + EG_CB_COLOR4_FMASK_SLICE = 0x28D78, // + EG_CB_COLOR4_CLEAR_WORD0 = 0x28D7C, // + EG_CB_COLOR4_CLEAR_WORD1 = 0x28D80, // + EG_CB_COLOR4_CLEAR_WORD2 = 0x28D84, // + EG_CB_COLOR4_CLEAR_WORD3 = 0x28D88, // + EG_CB_COLOR5_BASE = 0x28D8C, // SAME 0x28054 + EG_CB_COLOR5_PITCH = 0x28D90, // + EG_CB_COLOR5_SLICE = 0x28D94, // + EG_CB_COLOR5_VIEW = 0x28D98, // SAME 0x28094 + EG_CB_COLOR5_INFO = 0x28D9C, // DIFF 0x280B4 + EG_CB_COLOR5_ATTRIB = 0x28DA0, // + EG_CB_COLOR5_DIM = 0x28DA4, // + EG_CB_COLOR5_CMASK = 0x28DA8, // + EG_CB_COLOR5_CMASK_SLICE = 0x28DAC, // + EG_CB_COLOR5_FMASK = 0x28DB0, // + EG_CB_COLOR5_FMASK_SLICE = 0x28DB4, // + EG_CB_COLOR5_CLEAR_WORD0 = 0x28DB8, // + EG_CB_COLOR5_CLEAR_WORD1 = 0x28DBC, // + EG_CB_COLOR5_CLEAR_WORD2 = 0x28DC0, // + EG_CB_COLOR5_CLEAR_WORD3 = 0x28DC4, // + EG_CB_COLOR6_BASE = 0x28DC8, // SAME 0x28058 + EG_CB_COLOR6_PITCH = 0x28DCC, // + EG_CB_COLOR6_SLICE = 0x28DD0, // + EG_CB_COLOR6_VIEW = 0x28DD4, // SAME 0x28098 + EG_CB_COLOR6_INFO = 0x28DD8, // DIFF 0x280B8 + EG_CB_COLOR6_ATTRIB = 0x28DDC, // + EG_CB_COLOR6_DIM = 0x28DE0, // + EG_CB_COLOR6_CMASK = 0x28DE4, // + EG_CB_COLOR6_CMASK_SLICE = 0x28DE8, // + EG_CB_COLOR6_FMASK = 0x28DEC, // + EG_CB_COLOR6_FMASK_SLICE = 0x28DF0, // + EG_CB_COLOR6_CLEAR_WORD0 = 0x28DF4, // + EG_CB_COLOR6_CLEAR_WORD1 = 0x28DF8, // + EG_CB_COLOR6_CLEAR_WORD2 = 0x28DFC, // + EG_CB_COLOR6_CLEAR_WORD3 = 0x28E00, // + EG_CB_COLOR7_BASE = 0x28E04, // SAME 0x2805C + EG_CB_COLOR7_PITCH = 0x28E08, // + EG_CB_COLOR7_SLICE = 0x28E0C, // + EG_CB_COLOR7_VIEW = 0x28E10, // SAME 0x2809C + EG_CB_COLOR7_INFO = 0x28E14, // DIFF 0x280BC + EG_CB_COLOR7_ATTRIB = 0x28E18, // + EG_CB_COLOR7_DIM = 0x28E1C, // + EG_CB_COLOR7_CMASK = 0x28E20, // + EG_CB_COLOR7_CMASK_SLICE = 0x28E24, // + EG_CB_COLOR7_FMASK = 0x28E28, // + EG_CB_COLOR7_FMASK_SLICE = 0x28E2C, // + EG_CB_COLOR7_CLEAR_WORD0 = 0x28E30, // + EG_CB_COLOR7_CLEAR_WORD1 = 0x28E34, // + EG_CB_COLOR7_CLEAR_WORD2 = 0x28E38, // + EG_CB_COLOR7_CLEAR_WORD3 = 0x28E3C, // + EG_CB_COLOR8_BASE = 0x28E40, // + EG_CB_COLOR8_PITCH = 0x28E44, // + EG_CB_COLOR8_SLICE = 0x28E48, // + EG_CB_COLOR8_VIEW = 0x28E4C, // + EG_CB_COLOR8_INFO = 0x28E50, // + EG_CB_COLOR8_ATTRIB = 0x28E54, // + EG_CB_COLOR8_DIM = 0x28E58, // + EG_CB_COLOR9_BASE = 0x28E5C, // + EG_CB_COLOR9_PITCH = 0x28E60, // + EG_CB_COLOR9_SLICE = 0x28E64, // + EG_CB_COLOR9_VIEW = 0x28E68, // + EG_CB_COLOR9_INFO = 0x28E6C, // + EG_CB_COLOR9_ATTRIB = 0x28E70, // + EG_CB_COLOR9_DIM = 0x28E74, // + EG_CB_COLOR10_BASE = 0x28E78, // + EG_CB_COLOR10_PITCH = 0x28E7C, // + EG_CB_COLOR10_SLICE = 0x28E80, // + EG_CB_COLOR10_VIEW = 0x28E84, // + EG_CB_COLOR10_INFO = 0x28E88, // + EG_CB_COLOR10_ATTRIB = 0x28E8C, // + EG_CB_COLOR10_DIM = 0x28E90, // + EG_CB_COLOR11_BASE = 0x28E94, // + EG_CB_COLOR11_PITCH = 0x28E98, // + EG_CB_COLOR11_SLICE = 0x28E9C, // + EG_CB_COLOR11_VIEW = 0x28EA0, // + EG_CB_COLOR11_INFO = 0x28EA4, // + EG_CB_COLOR11_ATTRIB = 0x28EA8, // + EG_CB_COLOR11_DIM = 0x28EAC, // + +/* Registers from CP block: */ + EG_COHER_DEST_BASE_0 = 0x28248, // SAME + EG_COHER_DEST_BASE_1 = 0x2824C, // SAME + EG_CP_PERFMON_CNTX_CNTL = 0x28358, // + +/* Config: */ + EG_SPI_CONFIG_CNTL = 0x9100, // DIFF + EG_SPI_CONFIG_CNTL_1 = 0x913C, // DIFF + EG_CP_PERFMON_CNTL = 0x87FC, // SAME + EG_SQ_MS_FIFO_SIZES = 0x8CF0, // SAME + EG_SQ_CONFIG = 0x8C00, // DIFF + EG_SQ_GPR_RESOURCE_MGMT_1 = 0x8C04, // SAME + EG_SQ_GPR_RESOURCE_MGMT_2 = 0x8C08, // SAME + EG_SQ_THREAD_RESOURCE_MGMT = 0x8C18, // SAME 0x8C0C, + EG_SQ_STACK_RESOURCE_MGMT_1 = 0x8C20, // SAME 0x8C10, + EG_SQ_STACK_RESOURCE_MGMT_2 = 0x8C24, // SAME 0x8C14, + EG_SQ_DYN_GPR_CNTL_PS_FLUSH_REQ = 0x8D8C, // DIFF + EG_SQ_LDS_RESOURCE_MGMT = 0x8E2C, // + EG_SQ_GPR_RESOURCE_MGMT_3 = 0x8C0C, // + EG_SQ_STACK_RESOURCE_MGMT_3 = 0x8C28, // + EG_SQ_THREAD_RESOURCE_MGMT_2 = 0x8C1C, // + EG_VGT_CACHE_INVALIDATION = 0x88C4, // DIFF + EG_VGT_GS_VERTEX_REUSE = 0x88D4, // SAME + EG_PA_SC_FORCE_EOV_MAX_CNTS = 0x8B24, // SAME + EG_PA_SC_LINE_STIPPLE_STATE = 0x8B10, // SAME + EG_PA_CL_ENHANCE = 0x8A14, // SAME + +/* Tex border color */ + EG_TD_PS_BORDER_COLOR_RED = 0xA404, + EG_TD_PS_BORDER_COLOR_GREEN = 0xA408, + EG_TD_PS_BORDER_COLOR_BLUE = 0xA40C, + EG_TD_PS_BORDER_COLOR_ALPHA = 0xA410, + +/* const */ + EG_SQ_VTX_CONSTANT_WORD0_0 = 0x30000, // 0x38000 +}; + +#endif /* _EVERGREEN_OFF_H_ */ \ No newline at end of file diff --git a/src/mesa/drivers/dri/r600/evergreen_oglprog.c b/src/mesa/drivers/dri/r600/evergreen_oglprog.c new file mode 100644 index 0000000000..9fe523234c --- /dev/null +++ b/src/mesa/drivers/dri/r600/evergreen_oglprog.c @@ -0,0 +1,193 @@ +/* + * Copyright (C) 2008-2009 Advanced Micro Devices, Inc. + * + * 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 + * THE COPYRIGHT HOLDER(S) 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. + */ + +/* + * Authors: + * Richard Li , + */ + +#include + +#include "main/glheader.h" +#include "main/imports.h" +#include "program/program.h" + +#include "tnl/tnl.h" + +#include "r600_context.h" +#include "r600_emit.h" + +#include "evergreen_oglprog.h" +#include "evergreen_fragprog.h" +#include "evergreen_vertprog.h" + + +static void evergreen_freeVertProgCache(GLcontext *ctx, struct r700_vertex_program_cont *cache) +{ + struct evergreen_vertex_program *tmp, *vp = cache->progs; + + while (vp) { + tmp = vp->next; + /* Release DMA region */ + r600DeleteShader(ctx, vp->shaderbo); + + if(NULL != vp->constbo0) + { + r600DeleteShader(ctx, vp->constbo0); + } + + /* Clean up */ + Clean_Up_Assembler(&(vp->r700AsmCode)); + Clean_Up_Shader(&(vp->r700Shader)); + + _mesa_reference_vertprog(ctx, &vp->mesa_program, NULL); + free(vp); + vp = tmp; + } +} + +static struct gl_program *evergreenNewProgram(GLcontext * ctx, + GLenum target, + GLuint id) +{ + struct gl_program *pProgram = NULL; + + struct evergreen_vertex_program_cont *vpc; + struct evergreen_fragment_program *fp; + + radeon_print(RADEON_SHADER, RADEON_VERBOSE, + "%s %u, %u\n", __func__, target, id); + + switch (target) + { + case GL_VERTEX_STATE_PROGRAM_NV: + case GL_VERTEX_PROGRAM_ARB: + vpc = CALLOC_STRUCT(evergreen_vertex_program_cont); + pProgram = _mesa_init_vertex_program(ctx, + &vpc->mesa_program, + target, + id); + + break; + case GL_FRAGMENT_PROGRAM_NV: + case GL_FRAGMENT_PROGRAM_ARB: + fp = CALLOC_STRUCT(evergreen_fragment_program); + pProgram = _mesa_init_fragment_program(ctx, + &fp->mesa_program, + target, + id); + fp->translated = GL_FALSE; + fp->loaded = GL_FALSE; + + fp->shaderbo = NULL; + + fp->constbo0 = NULL; + + break; + default: + _mesa_problem(ctx, "Bad target in evergreenNewProgram"); + } + + return pProgram; +} + +static void evergreenDeleteProgram(GLcontext * ctx, struct gl_program *prog) +{ + struct evergreen_vertex_program_cont *vpc = (struct evergreen_vertex_program_cont *)prog; + struct evergreen_fragment_program * fp; + + radeon_print(RADEON_SHADER, RADEON_VERBOSE, + "%s %p\n", __func__, prog); + + switch (prog->Target) + { + case GL_VERTEX_STATE_PROGRAM_NV: + case GL_VERTEX_PROGRAM_ARB: + evergreen_freeVertProgCache(ctx, vpc); + break; + case GL_FRAGMENT_PROGRAM_NV: + case GL_FRAGMENT_PROGRAM_ARB: + fp = (struct evergreen_fragment_program*)prog; + /* Release DMA region */ + + r600DeleteShader(ctx, fp->shaderbo); + + if(NULL != fp->constbo0) + { + r600DeleteShader(ctx, fp->constbo0); + } + + /* Clean up */ + Clean_Up_Assembler(&(fp->r700AsmCode)); + Clean_Up_Shader(&(fp->r700Shader)); + break; + default: + _mesa_problem(ctx, "Bad target in evergreenNewProgram"); + } + + _mesa_delete_program(ctx, prog); +} + +static GLboolean +evergreenProgramStringNotify(GLcontext * ctx, GLenum target, struct gl_program *prog) +{ + struct evergreen_vertex_program_cont *vpc = (struct evergreen_vertex_program_cont *)prog; + struct evergreen_fragment_program * fp = (struct evergreen_fragment_program*)prog; + + switch (target) { + case GL_VERTEX_PROGRAM_ARB: + evergreen_freeVertProgCache(ctx, vpc); + vpc->progs = NULL; + break; + case GL_FRAGMENT_PROGRAM_ARB: + r600DeleteShader(ctx, fp->shaderbo); + + if(NULL != fp->constbo0) + { + r600DeleteShader(ctx, fp->constbo0); + fp->constbo0 = NULL; + } + + Clean_Up_Assembler(&(fp->r700AsmCode)); + Clean_Up_Shader(&(fp->r700Shader)); + fp->translated = GL_FALSE; + fp->loaded = GL_FALSE; + fp->shaderbo = NULL; + break; + } + + /* XXX check if program is legal, within limits */ + return GL_TRUE; +} + +static GLboolean evergreenIsProgramNative(GLcontext * ctx, GLenum target, struct gl_program *prog) +{ + + return GL_TRUE; +} + +void evergreenInitShaderFuncs(struct dd_function_table *functions) +{ + functions->NewProgram = evergreenNewProgram; + functions->DeleteProgram = evergreenDeleteProgram; + functions->ProgramStringNotify = evergreenProgramStringNotify; + functions->IsProgramNative = evergreenIsProgramNative; +} diff --git a/src/mesa/drivers/dri/r600/evergreen_oglprog.h b/src/mesa/drivers/dri/r600/evergreen_oglprog.h new file mode 100644 index 0000000000..1cf3e79d05 --- /dev/null +++ b/src/mesa/drivers/dri/r600/evergreen_oglprog.h @@ -0,0 +1,33 @@ +/* + * Copyright (C) 2008-2009 Advanced Micro Devices, Inc. + * + * 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 + * THE COPYRIGHT HOLDER(S) 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. + */ + +/* + * Authors: + * Richard Li , + */ + +#ifndef _EVERGREEN_OGLPROG_H_ +#define _EVERGREEN_OGLPROG_H_ +#include "r600_context.h" + +extern void evergreenInitShaderFuncs(struct dd_function_table *functions); + +#endif /*_EVERGREEN_OGLPROG_H_*/ diff --git a/src/mesa/drivers/dri/r600/evergreen_render.c b/src/mesa/drivers/dri/r600/evergreen_render.c new file mode 100644 index 0000000000..29b304e846 --- /dev/null +++ b/src/mesa/drivers/dri/r600/evergreen_render.c @@ -0,0 +1,937 @@ +/* + * Copyright (C) 2008-2010 Advanced Micro Devices, Inc. + * + * 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 + * THE COPYRIGHT HOLDER(S) 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. + */ + +/* + * Authors: + * Richard Li , + */ + +#include "main/glheader.h" +#include "main/state.h" +#include "main/imports.h" +#include "main/enums.h" +#include "main/macros.h" +#include "main/context.h" +#include "main/dd.h" +#include "main/simple_list.h" +#include "main/api_arrayelt.h" +#include "swrast/swrast.h" +#include "swrast_setup/swrast_setup.h" +#include "vbo/vbo.h" + +#include "tnl/tnl.h" +#include "tnl/t_vp_build.h" +#include "tnl/t_context.h" +#include "tnl/t_vertex.h" +#include "vbo/vbo_context.h" + +#include "r600_context.h" +#include "r600_cmdbuf.h" + +#include "evergreen_vertprog.h" + +#include "evergreen_state.h" +#include "evergreen_tex.h" +#include "evergreen_off.h" + +#include "radeon_buffer_objects.h" +#include "radeon_common_context.h" + +static unsigned int evergreenPrimitiveType(int prim) //same +{ + switch (prim & PRIM_MODE_MASK) + { + case GL_POINTS: + return DI_PT_POINTLIST; + break; + case GL_LINES: + return DI_PT_LINELIST; + break; + case GL_LINE_STRIP: + return DI_PT_LINESTRIP; + break; + case GL_LINE_LOOP: + return DI_PT_LINELOOP; + break; + case GL_TRIANGLES: + return DI_PT_TRILIST; + break; + case GL_TRIANGLE_STRIP: + return DI_PT_TRISTRIP; + break; + case GL_TRIANGLE_FAN: + return DI_PT_TRIFAN; + break; + case GL_QUADS: + return DI_PT_QUADLIST; + break; + case GL_QUAD_STRIP: + return DI_PT_QUADSTRIP; + break; + case GL_POLYGON: + return DI_PT_POLYGON; + break; + default: + assert(0); + return -1; + break; + } +} + +static int evergreenNumVerts(int num_verts, int prim) //same +{ + int verts_off = 0; + + switch (prim & PRIM_MODE_MASK) { + case GL_POINTS: + verts_off = 0; + break; + case GL_LINES: + verts_off = num_verts % 2; + break; + case GL_LINE_STRIP: + if (num_verts < 2) + verts_off = num_verts; + break; + case GL_LINE_LOOP: + if (num_verts < 2) + verts_off = num_verts; + break; + case GL_TRIANGLES: + verts_off = num_verts % 3; + break; + case GL_TRIANGLE_STRIP: + if (num_verts < 3) + verts_off = num_verts; + break; + case GL_TRIANGLE_FAN: + if (num_verts < 3) + verts_off = num_verts; + break; + case GL_QUADS: + verts_off = num_verts % 4; + break; + case GL_QUAD_STRIP: + if (num_verts < 4) + verts_off = num_verts; + else + verts_off = num_verts % 2; + break; + case GL_POLYGON: + if (num_verts < 3) + verts_off = num_verts; + break; + default: + assert(0); + return -1; + break; + } + + return num_verts - verts_off; +} + +static void evergreenRunRenderPrimitive(GLcontext * ctx, int start, int end, int prim) //same +{ + context_t *context = EVERGREEN_CONTEXT(ctx); + BATCH_LOCALS(&context->radeon); + int type, total_emit; + int num_indices; + uint32_t vgt_draw_initiator = 0; + uint32_t vgt_index_type = 0; + uint32_t vgt_primitive_type = 0; + uint32_t vgt_num_indices = 0; + + type = evergreenPrimitiveType(prim); + num_indices = evergreenNumVerts(end - start, prim); + + radeon_print(RADEON_RENDER, RADEON_TRACE, + "%s type %x num_indices %d\n", + __func__, type, num_indices); + + if (type < 0 || num_indices <= 0) + return; + + SETfield(vgt_primitive_type, type, + VGT_PRIMITIVE_TYPE__PRIM_TYPE_shift, VGT_PRIMITIVE_TYPE__PRIM_TYPE_mask); + + SETfield(vgt_index_type, DI_INDEX_SIZE_32_BIT, INDEX_TYPE_shift, INDEX_TYPE_mask); + + if(GL_TRUE != context->ind_buf.is_32bit) + { + SETfield(vgt_index_type, DI_INDEX_SIZE_16_BIT, INDEX_TYPE_shift, INDEX_TYPE_mask); + } + + vgt_num_indices = num_indices; + SETfield(vgt_draw_initiator, DI_SRC_SEL_DMA, SOURCE_SELECT_shift, SOURCE_SELECT_mask); + SETfield(vgt_draw_initiator, DI_MAJOR_MODE_0, MAJOR_MODE_shift, MAJOR_MODE_mask); + + total_emit = 3 /* VGT_PRIMITIVE_TYPE */ + + 2 /* VGT_INDEX_TYPE */ + + 2 /* NUM_INSTANCES */ + + 5 + 2; /* DRAW_INDEX */ + + BEGIN_BATCH_NO_AUTOSTATE(total_emit); + // prim + R600_OUT_BATCH_REGSEQ(VGT_PRIMITIVE_TYPE, 1); + R600_OUT_BATCH(vgt_primitive_type); + // index type + R600_OUT_BATCH(CP_PACKET3(R600_IT_INDEX_TYPE, 0)); + R600_OUT_BATCH(vgt_index_type); + // num instances + R600_OUT_BATCH(CP_PACKET3(R600_IT_NUM_INSTANCES, 0)); + R600_OUT_BATCH(1); + // draw packet + R600_OUT_BATCH(CP_PACKET3(R600_IT_DRAW_INDEX, 3)); + R600_OUT_BATCH(context->ind_buf.bo_offset); + R600_OUT_BATCH(0); + R600_OUT_BATCH(vgt_num_indices); + R600_OUT_BATCH(vgt_draw_initiator); + R600_OUT_BATCH_RELOC(context->ind_buf.bo_offset, + context->ind_buf.bo, + context->ind_buf.bo_offset, + RADEON_GEM_DOMAIN_GTT, 0, 0); + END_BATCH(); + COMMIT_BATCH(); +} + +static void evergreenRunRenderPrimitiveImmediate(GLcontext * ctx, int start, int end, int prim) //same +{ + context_t *context = EVERGREEN_CONTEXT(ctx); + BATCH_LOCALS(&context->radeon); + int type, i; + uint32_t num_indices, total_emit = 0; + uint32_t vgt_draw_initiator = 0; + uint32_t vgt_index_type = 0; + uint32_t vgt_primitive_type = 0; + uint32_t vgt_num_indices = 0; + + type = evergreenPrimitiveType(prim); + num_indices = evergreenNumVerts(end - start, prim); + + radeon_print(RADEON_RENDER, RADEON_TRACE, + "%s type %x num_indices %d\n", + __func__, type, num_indices); + + if (type < 0 || num_indices <= 0) + return; + + SETfield(vgt_primitive_type, type, + VGT_PRIMITIVE_TYPE__PRIM_TYPE_shift, VGT_PRIMITIVE_TYPE__PRIM_TYPE_mask); + + if (num_indices > 0xffff) + { + SETfield(vgt_index_type, DI_INDEX_SIZE_32_BIT, INDEX_TYPE_shift, INDEX_TYPE_mask); + } + else + { + SETfield(vgt_index_type, DI_INDEX_SIZE_16_BIT, INDEX_TYPE_shift, INDEX_TYPE_mask); + } + + vgt_num_indices = num_indices; + SETfield(vgt_draw_initiator, DI_MAJOR_MODE_0, MAJOR_MODE_shift, MAJOR_MODE_mask); + + if (start == 0) + { + SETfield(vgt_draw_initiator, DI_SRC_SEL_AUTO_INDEX, SOURCE_SELECT_shift, SOURCE_SELECT_mask); + } + else + { + if (num_indices > 0xffff) + { + total_emit += num_indices; + } + else + { + total_emit += (num_indices + 1) / 2; + } + SETfield(vgt_draw_initiator, DI_SRC_SEL_IMMEDIATE, SOURCE_SELECT_shift, SOURCE_SELECT_mask); + } + + total_emit += 3 /* VGT_PRIMITIVE_TYPE */ + + 2 /* VGT_INDEX_TYPE */ + + 2 /* NUM_INSTANCES */ + + 3; /* DRAW */ + + BEGIN_BATCH_NO_AUTOSTATE(total_emit); + // prim + R600_OUT_BATCH_REGSEQ(VGT_PRIMITIVE_TYPE, 1); + R600_OUT_BATCH(vgt_primitive_type); + // index type + R600_OUT_BATCH(CP_PACKET3(R600_IT_INDEX_TYPE, 0)); + R600_OUT_BATCH(vgt_index_type); + // num instances + R600_OUT_BATCH(CP_PACKET3(R600_IT_NUM_INSTANCES, 0)); + R600_OUT_BATCH(1); + // draw packet + if(start == 0) + { + R600_OUT_BATCH(CP_PACKET3(R600_IT_DRAW_INDEX_AUTO, 1)); + R600_OUT_BATCH(vgt_num_indices); + R600_OUT_BATCH(vgt_draw_initiator); + } + else + { + if (num_indices > 0xffff) + { + R600_OUT_BATCH(CP_PACKET3(R600_IT_DRAW_INDEX_IMMD, (num_indices + 1))); + R600_OUT_BATCH(vgt_num_indices); + R600_OUT_BATCH(vgt_draw_initiator); + for (i = start; i < (start + num_indices); i++) + { + R600_OUT_BATCH(i); + } + } + else + { + R600_OUT_BATCH(CP_PACKET3(R600_IT_DRAW_INDEX_IMMD, (((num_indices + 1) / 2) + 1))); + R600_OUT_BATCH(vgt_num_indices); + R600_OUT_BATCH(vgt_draw_initiator); + for (i = start; i < (start + num_indices); i += 2) + { + if ((i + 1) == (start + num_indices)) + { + R600_OUT_BATCH(i); + } + else + { + R600_OUT_BATCH(((i + 1) << 16) | (i)); + } + } + } + } + + END_BATCH(); + COMMIT_BATCH(); +} + +#define CONVERT( TYPE, MACRO ) do { \ + GLuint i, j, sz; \ + sz = input->Size; \ + if (input->Normalized) { \ + for (i = 0; i < count; i++) { \ + const TYPE *in = (TYPE *)src_ptr; \ + for (j = 0; j < sz; j++) { \ + *dst_ptr++ = MACRO(*in); \ + in++; \ + } \ + src_ptr += stride; \ + } \ + } else { \ + for (i = 0; i < count; i++) { \ + const TYPE *in = (TYPE *)src_ptr; \ + for (j = 0; j < sz; j++) { \ + *dst_ptr++ = (GLfloat)(*in); \ + in++; \ + } \ + src_ptr += stride; \ + } \ + } \ +} while (0) + +/** + * Convert attribute data type to float + * If the attribute uses named buffer object replace the bo with newly allocated bo + */ +static void evergreenConvertAttrib(GLcontext *ctx, int count, + const struct gl_client_array *input, + struct StreamDesc *attr) +{ + context_t *context = R700_CONTEXT(ctx); + const GLvoid *src_ptr; + GLboolean mapped_named_bo = GL_FALSE; + GLfloat *dst_ptr; + GLuint stride; + + stride = (input->StrideB == 0) ? evergreen_getTypeSize(input->Type) * input->Size : input->StrideB; + + /* Convert value for first element only */ + if (input->StrideB == 0) + { + count = 1; + } + + if (input->BufferObj->Name) + { + if (!input->BufferObj->Pointer) + { + ctx->Driver.MapBuffer(ctx, GL_ARRAY_BUFFER, GL_READ_ONLY_ARB, input->BufferObj); + mapped_named_bo = GL_TRUE; + } + + src_ptr = ADD_POINTERS(input->BufferObj->Pointer, input->Ptr); + } + else + { + src_ptr = input->Ptr; + } + + radeonAllocDmaRegion(&context->radeon, &attr->bo, &attr->bo_offset, + sizeof(GLfloat) * input->Size * count, 32); + + radeon_bo_map(attr->bo, 1); + + dst_ptr = (GLfloat *)ADD_POINTERS(attr->bo->ptr, attr->bo_offset); + + assert(src_ptr != NULL); + + switch (input->Type) + { + case GL_DOUBLE: + CONVERT(GLdouble, (GLfloat)); + break; + case GL_UNSIGNED_INT: + CONVERT(GLuint, UINT_TO_FLOAT); + break; + case GL_INT: + CONVERT(GLint, INT_TO_FLOAT); + break; + case GL_UNSIGNED_SHORT: + CONVERT(GLushort, USHORT_TO_FLOAT); + break; + case GL_SHORT: + CONVERT(GLshort, SHORT_TO_FLOAT); + break; + case GL_UNSIGNED_BYTE: + assert(input->Format != GL_BGRA); + CONVERT(GLubyte, UBYTE_TO_FLOAT); + break; + case GL_BYTE: + CONVERT(GLbyte, BYTE_TO_FLOAT); + break; + default: + assert(0); + break; + } + + radeon_bo_unmap(attr->bo); + + if (mapped_named_bo) + { + ctx->Driver.UnmapBuffer(ctx, GL_ARRAY_BUFFER, input->BufferObj); + } +} + +static void evergreenFixupIndexBuffer(GLcontext *ctx, const struct _mesa_index_buffer *mesa_ind_buf) +{ + context_t *context = EVERGREEN_CONTEXT(ctx); + GLvoid *src_ptr; + GLuint *out; + int i; + GLboolean mapped_named_bo = GL_FALSE; + + if (mesa_ind_buf->obj->Name && !mesa_ind_buf->obj->Pointer) + { + ctx->Driver.MapBuffer(ctx, GL_ELEMENT_ARRAY_BUFFER, GL_READ_ONLY_ARB, mesa_ind_buf->obj); + mapped_named_bo = GL_TRUE; + assert(mesa_ind_buf->obj->Pointer != NULL); + } + src_ptr = ADD_POINTERS(mesa_ind_buf->obj->Pointer, mesa_ind_buf->ptr); + + if (mesa_ind_buf->type == GL_UNSIGNED_BYTE) + { + GLuint size = sizeof(GLushort) * ((mesa_ind_buf->count + 1) & ~1); + GLubyte *in = (GLubyte *)src_ptr; + + radeonAllocDmaRegion(&context->radeon, &context->ind_buf.bo, + &context->ind_buf.bo_offset, size, 4); + + radeon_bo_map(context->ind_buf.bo, 1); + assert(context->ind_buf.bo->ptr != NULL); + out = (GLuint *)ADD_POINTERS(context->ind_buf.bo->ptr, context->ind_buf.bo_offset); + + for (i = 0; i + 1 < mesa_ind_buf->count; i += 2) + { + *out++ = in[i] | in[i + 1] << 16; + } + + if (i < mesa_ind_buf->count) + { + *out++ = in[i]; + } + + radeon_bo_unmap(context->ind_buf.bo); +#if MESA_BIG_ENDIAN + } + else + { /* if (mesa_ind_buf->type == GL_UNSIGNED_SHORT) */ + GLushort *in = (GLushort *)src_ptr; + GLuint size = sizeof(GLushort) * ((mesa_ind_buf->count + 1) & ~1); + + radeonAllocDmaRegion(&context->radeon, &context->ind_buf.bo, + &context->ind_buf.bo_offset, size, 4); + + radeon_bo_map(context->ind_buf.bo, 1); + assert(context->ind_buf.bo->ptr != NULL); + out = (GLuint *)ADD_POINTERS(context->ind_buf.bo->ptr, context->ind_buf.bo_offset); + + for (i = 0; i + 1 < mesa_ind_buf->count; i += 2) + { + *out++ = in[i] | in[i + 1] << 16; + } + + if (i < mesa_ind_buf->count) + { + *out++ = in[i]; + } + radeon_bo_unmap(context->ind_buf.bo); +#endif + } + + context->ind_buf.is_32bit = GL_FALSE; + context->ind_buf.count = mesa_ind_buf->count; + + if (mapped_named_bo) + { + ctx->Driver.UnmapBuffer(ctx, GL_ELEMENT_ARRAY_BUFFER, mesa_ind_buf->obj); + } +} + +static GLboolean evergreen_check_fallbacks(GLcontext *ctx) //same +{ + if (ctx->RenderMode != GL_RENDER) + return GL_TRUE; + + return GL_FALSE; +} + +/* start 3d, idle, cb/db flush */ +#define PRE_EMIT_STATE_BUFSZ 5 + 5 + 14 + +static GLuint evergreenPredictRenderSize(GLcontext* ctx, + const struct _mesa_prim *prim, + const struct _mesa_index_buffer *ib, + GLuint nr_prims) +{ + context_t *context = EVERGREEN_CONTEXT(ctx); + GLboolean flushed; + GLuint dwords, i; + GLuint state_size; + + dwords = PRE_EMIT_STATE_BUFSZ; + if (ib) + dwords += nr_prims * 14; + else { + for (i = 0; i < nr_prims; ++i) + { + if (prim[i].start == 0) + dwords += 10; + else if (prim[i].count > 0xffff) + dwords += prim[i].count + 10; + else + dwords += ((prim[i].count + 1) / 2) + 10; + } + } + + state_size = radeonCountStateEmitSize(&context->radeon); + flushed = rcommonEnsureCmdBufSpace(&context->radeon, + dwords + state_size, + __FUNCTION__); + if (flushed) + dwords += radeonCountStateEmitSize(&context->radeon); + else + dwords += state_size; + + radeon_print(RADEON_RENDER, RADEON_VERBOSE, "%s: total prediction size is %d.\n", __FUNCTION__, dwords); + return dwords; + +} + +static void evergreenSetupIndexBuffer(GLcontext *ctx, const struct _mesa_index_buffer *mesa_ind_buf) +{ + context_t *context = EVERGREEN_CONTEXT(ctx); + + if (!mesa_ind_buf) { + context->ind_buf.bo = NULL; + return; + } + +#if MESA_BIG_ENDIAN + if (mesa_ind_buf->type == GL_UNSIGNED_INT) +#else + if (mesa_ind_buf->type != GL_UNSIGNED_BYTE) +#endif + { + const GLvoid *src_ptr; + GLvoid *dst_ptr; + GLboolean mapped_named_bo = GL_FALSE; + + if (mesa_ind_buf->obj->Name && !mesa_ind_buf->obj->Pointer) + { + ctx->Driver.MapBuffer(ctx, GL_ELEMENT_ARRAY_BUFFER, GL_READ_ONLY_ARB, mesa_ind_buf->obj); + assert(mesa_ind_buf->obj->Pointer != NULL); + mapped_named_bo = GL_TRUE; + } + + src_ptr = ADD_POINTERS(mesa_ind_buf->obj->Pointer, mesa_ind_buf->ptr); + + const GLuint size = mesa_ind_buf->count * getTypeSize(mesa_ind_buf->type); + + radeonAllocDmaRegion(&context->radeon, &context->ind_buf.bo, + &context->ind_buf.bo_offset, size, 4); + radeon_bo_map(context->ind_buf.bo, 1); + assert(context->ind_buf.bo->ptr != NULL); + dst_ptr = ADD_POINTERS(context->ind_buf.bo->ptr, context->ind_buf.bo_offset); + + memcpy(dst_ptr, src_ptr, size); + + radeon_bo_unmap(context->ind_buf.bo); + context->ind_buf.is_32bit = (mesa_ind_buf->type == GL_UNSIGNED_INT); + context->ind_buf.count = mesa_ind_buf->count; + + if (mapped_named_bo) + { + ctx->Driver.UnmapBuffer(ctx, GL_ELEMENT_ARRAY_BUFFER, mesa_ind_buf->obj); + } + } + else + { + evergreenFixupIndexBuffer(ctx, mesa_ind_buf); + } +} + +static void evergreenAlignDataToDword(GLcontext *ctx, + const struct gl_client_array *input, + int count, + struct StreamDesc *attr) +{ + context_t *context = EVERGREEN_CONTEXT(ctx); + const int dst_stride = (input->StrideB + 3) & ~3; + const int size = getTypeSize(input->Type) * input->Size * count; + GLboolean mapped_named_bo = GL_FALSE; + + radeonAllocDmaRegion(&context->radeon, &attr->bo, &attr->bo_offset, size, 32); + + radeon_bo_map(attr->bo, 1); + + if (!input->BufferObj->Pointer) + { + ctx->Driver.MapBuffer(ctx, GL_ARRAY_BUFFER, GL_READ_ONLY_ARB, input->BufferObj); + mapped_named_bo = GL_TRUE; + } + + { + GLvoid *src_ptr = ADD_POINTERS(input->BufferObj->Pointer, input->Ptr); + GLvoid *dst_ptr = ADD_POINTERS(attr->bo->ptr, attr->bo_offset); + int i; + + for (i = 0; i < count; ++i) + { + memcpy(dst_ptr, src_ptr, input->StrideB); + src_ptr += input->StrideB; + dst_ptr += dst_stride; + } + } + + radeon_bo_unmap(attr->bo); + if (mapped_named_bo) + { + ctx->Driver.UnmapBuffer(ctx, GL_ARRAY_BUFFER, input->BufferObj); + } + + attr->stride = dst_stride; +} + +static void evergreenSetupStreams(GLcontext *ctx, const struct gl_client_array *input[], int count) +{ + context_t *context = EVERGREEN_CONTEXT(ctx); + GLuint stride; + int ret; + int i, index; + + EVERGREEN_STATECHANGE(context, vtx); + + for(index = 0; index < context->nNumActiveAos; index++) + { + struct radeon_aos *aos = &context->radeon.tcl.aos[index]; + i = context->stream_desc[index].element; + + stride = (input[i]->StrideB == 0) ? getTypeSize(input[i]->Type) * input[i]->Size : input[i]->StrideB; + + if (input[i]->Type == GL_DOUBLE || input[i]->Type == GL_UNSIGNED_INT || input[i]->Type == GL_INT || +#if MESA_BIG_ENDIAN + getTypeSize(input[i]->Type) != 4 || +#endif + stride < 4) + { + evergreenConvertAttrib(ctx, count, input[i], &context->stream_desc[index]); + } + else + { + if (input[i]->BufferObj->Name) + { + if (stride % 4 != 0) + { + assert(((intptr_t) input[i]->Ptr) % input[i]->StrideB == 0); + evergreenAlignDataToDword(ctx, input[i], count, &context->stream_desc[index]); + context->stream_desc[index].is_named_bo = GL_FALSE; + } + else + { + context->stream_desc[index].stride = input[i]->StrideB; + context->stream_desc[index].bo_offset = (intptr_t) input[i]->Ptr; + context->stream_desc[index].bo = get_radeon_buffer_object(input[i]->BufferObj)->bo; + context->stream_desc[index].is_named_bo = GL_TRUE; + } + } + else + { + int size; + int local_count = count; + uint32_t *dst; + + if (input[i]->StrideB == 0) + { + size = getTypeSize(input[i]->Type) * input[i]->Size; + local_count = 1; + } + else + { + size = getTypeSize(input[i]->Type) * input[i]->Size * local_count; + } + + radeonAllocDmaRegion(&context->radeon, &context->stream_desc[index].bo, + &context->stream_desc[index].bo_offset, size, 32); + + radeon_bo_map(context->stream_desc[index].bo, 1); + assert(context->stream_desc[index].bo->ptr != NULL); + + + dst = (uint32_t *)ADD_POINTERS(context->stream_desc[index].bo->ptr, + context->stream_desc[index].bo_offset); + + switch (context->stream_desc[index].dwords) + { + case 1: + radeonEmitVec4(dst, input[i]->Ptr, input[i]->StrideB, local_count); + break; + case 2: + radeonEmitVec8(dst, input[i]->Ptr, input[i]->StrideB, local_count); + break; + case 3: + radeonEmitVec12(dst, input[i]->Ptr, input[i]->StrideB, local_count); + break; + case 4: + radeonEmitVec16(dst, input[i]->Ptr, input[i]->StrideB, local_count); + break; + default: + assert(0); + break; + } + + radeon_bo_unmap(context->stream_desc[index].bo); + } + } + + aos->count = context->stream_desc[index].stride == 0 ? 1 : count; + aos->stride = context->stream_desc[index].stride / sizeof(float); + aos->components = context->stream_desc[index].dwords; + aos->bo = context->stream_desc[index].bo; + aos->offset = context->stream_desc[index].bo_offset; + + if(context->stream_desc[index].is_named_bo) + { + radeon_cs_space_add_persistent_bo(context->radeon.cmdbuf.cs, + context->stream_desc[index].bo, + RADEON_GEM_DOMAIN_GTT, 0); + } + } + + ret = radeon_cs_space_check_with_bo(context->radeon.cmdbuf.cs, + first_elem(&context->radeon.dma.reserved)->bo, + RADEON_GEM_DOMAIN_GTT, 0); +} + +static void evergreenFreeData(GLcontext *ctx) +{ + /* Need to zero tcl.aos[n].bo and tcl.elt_dma_bo + * to prevent double unref in radeonReleaseArrays + * called during context destroy + */ + context_t *context = EVERGREEN_CONTEXT(ctx); + + int i; + + for (i = 0; i < context->nNumActiveAos; i++) + { + if (!context->stream_desc[i].is_named_bo) + { + radeon_bo_unref(context->stream_desc[i].bo); + } + context->radeon.tcl.aos[i].bo = NULL; + } + + if(context->vp_Constbo != NULL) + { + radeon_bo_unref(context->vp_Constbo); + context->vp_Constbo = NULL; + } + if(context->fp_Constbo != NULL) + { + radeon_bo_unref(context->fp_Constbo); + context->fp_Constbo = NULL; + } + + if (context->ind_buf.bo != NULL) + { + radeon_bo_unref(context->ind_buf.bo); + } +} + +static GLboolean evergreenTryDrawPrims(GLcontext *ctx, + const struct gl_client_array *arrays[], + const struct _mesa_prim *prim, + GLuint nr_prims, + const struct _mesa_index_buffer *ib, + GLuint min_index, + GLuint max_index ) +{ + context_t *context = EVERGREEN_CONTEXT(ctx); + radeonContextPtr radeon = &context->radeon; + GLuint i, id = 0; + struct radeon_renderbuffer *rrb; + + if (ctx->NewState) + _mesa_update_state( ctx ); + + if (evergreen_check_fallbacks(ctx)) + return GL_FALSE; + + _tnl_UpdateFixedFunctionProgram(ctx); + evergreenSetVertexFormat(ctx, arrays, max_index + 1); + + + /* shaders need to be updated before buffers are validated */ + evergreenUpdateShaders(ctx); + if (!evergreenValidateBuffers(ctx)) + return GL_FALSE; + + /* always emit CB base to prevent + * lock ups on some chips. + */ + EVERGREEN_STATECHANGE(context, cb); + /* mark vtx as dirty since it changes per-draw */ + EVERGREEN_STATECHANGE(context, vtx); + + evergreenSetScissor(context); + + evergreenSetupVertexProgram(ctx); + evergreenSetupFragmentProgram(ctx); + evergreenUpdateShaderStates(ctx); + + GLuint emit_end = evergreenPredictRenderSize(ctx, prim, ib, nr_prims) + + context->radeon.cmdbuf.cs->cdw; + + evergreenSetupIndexBuffer(ctx, ib); + + evergreenSetupStreams(ctx, arrays, max_index + 1); + + radeonEmitState(radeon); + + radeon_debug_add_indent(); + + for (i = 0; i < nr_prims; ++i) + { +/* richard test disable */ +#if 0 + if (context->ind_buf.bo) + evergreenRunRenderPrimitive(ctx, + prim[i].start, + prim[i].start + prim[i].count, + prim[i].mode); + else +#endif //0 +//------------- + evergreenRunRenderPrimitiveImmediate(ctx, + prim[i].start, + prim[i].start + prim[i].count, + prim[i].mode); + } + + radeon_debug_remove_indent(); + + /* Flush render op cached for last several quads. */ + /* XXX drm should handle this in fence submit */ + + //evergreeWaitForIdleClean(context); + + rrb = radeon_get_colorbuffer(&context->radeon); + if (rrb && rrb->bo) + r700SyncSurf(context, rrb->bo, 0, RADEON_GEM_DOMAIN_VRAM, + CB_ACTION_ENA_bit | (1 << (id + 6))); + + rrb = radeon_get_depthbuffer(&context->radeon); + if (rrb && rrb->bo) + r700SyncSurf(context, rrb->bo, 0, RADEON_GEM_DOMAIN_VRAM, + DB_ACTION_ENA_bit | DB_DEST_BASE_ENA_bit); + + evergreenFreeData(ctx); + + if (emit_end < context->radeon.cmdbuf.cs->cdw) + { + WARN_ONCE("Rendering was %d commands larger than predicted size." + " We might overflow command buffer.\n", context->radeon.cmdbuf.cs->cdw - emit_end); + } + + return GL_TRUE; +} + +static void evergreenDrawPrims(GLcontext *ctx, + const struct gl_client_array *arrays[], + const struct _mesa_prim *prim, + GLuint nr_prims, + const struct _mesa_index_buffer *ib, + GLboolean index_bounds_valid, + GLuint min_index, + GLuint max_index) +{ + GLboolean retval = GL_FALSE; + + /* This check should get folded into just the places that + * min/max index are really needed. + */ + if (!index_bounds_valid) { + vbo_get_minmax_index(ctx, prim, ib, &min_index, &max_index); + } + + if (min_index) { + vbo_rebase_prims( ctx, arrays, prim, nr_prims, ib, min_index, max_index, evergreenDrawPrims ); + return; + } + + /* Make an attempt at drawing */ + retval = evergreenTryDrawPrims(ctx, arrays, prim, nr_prims, ib, min_index, max_index); + + /* If failed run tnl pipeline - it should take care of fallbacks */ + if (!retval) { + _swsetup_Wakeup(ctx); + _tnl_draw_prims(ctx, arrays, prim, nr_prims, ib, min_index, max_index); + } +} + +void evergreenInitDraw(GLcontext *ctx) +{ + struct vbo_context *vbo = vbo_context(ctx); + + /* to be enabled */ + vbo->draw_prims = evergreenDrawPrims; +} + + diff --git a/src/mesa/drivers/dri/r600/evergreen_sq.h b/src/mesa/drivers/dri/r600/evergreen_sq.h new file mode 100644 index 0000000000..b1a536e76f --- /dev/null +++ b/src/mesa/drivers/dri/r600/evergreen_sq.h @@ -0,0 +1,735 @@ +/* + * Copyright (C) 2008-2010 Advanced Micro Devices, Inc. + * + * 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 + * THE COPYRIGHT HOLDER(S) 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. + */ + +/* + * Authors: + * Richard Li , + */ + +#ifndef _EVERGREEN_SQ_H_ +#define _EVERGREEN_SQ_H_ + +enum{ +//CF + EG_CF_WORD0__ADDR_shift = 0, + EG_CF_WORD0__ADDR_mask = 0xFFFFFF, + EG_CF_WORD0__JUMPTABLE_SEL_shift = 24, + EG_CF_WORD0__JUMPTABLE_SEL_mask = 0x7 << 24, + + EG_CF_WORD1__POP_COUNT_shift = 0, //3 bits + EG_CF_WORD1__POP_COUNT_mask = 0x7, + EG_CF_WORD1__CF_CONST_shift = 3, //5 bits + EG_CF_WORD1__CF_CONST_mask = 0x1F << 3, + EG_CF_WORD1__COND_shift = 8, //2 bits + EG_CF_WORD1__COND_mask = 0x3 << 8, + EG_CF_WORD1__COUNT_shift = 10,//6 bits + EG_CF_WORD1__COUNT_mask = 0x3F << 10, + EG_CF_WORD1__reserved_shift = 16,//4 bits + EG_CF_WORD1__VPM_shift = 20,//1 bit + EG_CF_WORD1__VPM_bit = 1 << 20, + EG_CF_WORD1__EOP_shift = 21,//1 bit + EG_CF_WORD1__EOP_bit = 1 << 21, + EG_CF_WORD1__CF_INST_shift = 22,//8 bits + EG_CF_WORD1__CF_INST_mask = 0xFF << 22, + EG_CF_WORD1__WQM_shift = 30,//1 bit + EG_CF_WORD1__WQM_bit = 1 << 30, + EG_CF_WORD1__BARRIER_shift = 31,//1 bit + EG_CF_WORD1__BARRIER_bit = 1 << 31, + + EG_CF_INST_NOP = 0, + EG_CF_INST_TC = 1, + EG_CF_INST_VC = 2, + EG_CF_INST_GDS = 3, + EG_CF_INST_LOOP_START = 4, + EG_CF_INST_LOOP_END = 5, + EG_CF_INST_LOOP_START_DX10 = 6, + EG_CF_INST_LOOP_START_NO_AL = 7, + EG_CF_INST_LOOP_CONTINUE = 8, + EG_CF_INST_LOOP_BREAK = 9, + EG_CF_INST_JUMP = 10, + EG_CF_INST_PUSH = 11, + EG_CF_INST_Reserved_12 = 12, + EG_CF_INST_ELSE = 13, + EG_CF_INST_POP = 14, + EG_CF_INST_Reserved_15 = 15, + EG_CF_INST_Reserved_16 = 16, + EG_CF_INST_Reserved_17 = 17, + EG_CF_INST_CALL = 18, + EG_CF_INST_CALL_FS = 19, + EG_CF_INST_RETURN = 20, + EG_CF_INST_EMIT_VERTEX = 21, + EG_CF_INST_EMIT_CUT_VERTEX = 22, + EG_CF_INST_CUT_VERTEX = 23, + EG_CF_INST_KILL = 24, + EG_CF_INST_Reserved_25 = 25, + EG_CF_INST_WAIT_ACK = 26, + EG_CF_INST_TC_ACK = 27, + EG_CF_INST_VC_ACK = 28, + EG_CF_INST_JUMPTABLE = 29, + EG_CF_INST_GLOBAL_WAVE_SYNC = 30, + EG_CF_INST_HALT = 31, + +//TEX + EG_TEX_WORD0__TEX_INST_shift = 0, //5 bits + EG_TEX_WORD0__TEX_INST_mask = 0x1F, + EG_TEX_WORD0__INST_MOD_shift = 5, //2 bits + EG_TEX_WORD0__INST_MOD_mask = 0x3 << 5, + EG_TEX_WORD0__FWQ_shift = 7, //1 bit + EG_TEX_WORD0__FWQ_bit = 1 << 7, + EG_TEX_WORD0__RESOURCE_ID_shift = 8, //8 bits + EG_TEX_WORD0__RESOURCE_ID_mask = 0xFF << 8, + EG_TEX_WORD0__SRC_GPR_shift = 16,//7 bits + EG_TEX_WORD0__SRC_GPR_mask = 0x7F << 16, + EG_TEX_WORD0__SRC_REL_shift = 23,//1 bit + EG_TEX_WORD0__SRC_REL_bit = 1 << 23, + EG_TEX_WORD0__ALT_CONST_shift = 24,//1 bit + EG_TEX_WORD0__ALT_CONST_bit = 1 << 24, + EG_TEX_WORD0__RIM_shift = 25,//2 bits + EG_TEX_WORD0__RIM_mask = 0x3 << 25, + EG_TEX_WORD0__SIM_shift = 27,//2 bits + EG_TEX_WORD0__SIM_mask = 0x3 << 27, + EG_TEX_WORD0__Reserved_shift = 29,//3 bits + EG_TEX_WORD0__Reserved_mask = 0x7 << 29, + + EG_TEX_INST_Reserved_0 = 0, + EG_TEX_INST_Reserved_1 = 1, + EG_TEX_INST_Reserved_2 = 2, + EG_TEX_INST_LD = 3, + EG_TEX_INST_GET_TEXTURE_RESINFO = 4, + EG_TEX_INST_GET_NUMBER_OF_SAMPLES= 5, + EG_TEX_INST_GET_COMP_TEX_LOD = 6, + EG_TEX_INST_GET_GRADIENTS_H = 7, + EG_TEX_INST_GET_GRADIENTS_V = 8, + EG_TEX_INST_SET_TEXTURE_OFFSETS = 9, + EG_TEX_INST_KEEP_GRADIENTS = 10, + EG_TEX_INST_SET_GRADIENTS_H = 11, + EG_TEX_INST_SET_GRADIENTS_V = 12, + EG_TEX_INST_Reserved_13 = 13, + EG_TEX_INST_Reserved_14 = 14, + EG_TEX_INST_Reserved_15 = 15, + EG_TEX_INST_SAMPLE = 16, + EG_TEX_INST_SAMPLE_L = 17, + EG_TEX_INST_SAMPLE_LB = 18, + EG_TEX_INST_SAMPLE_LZ = 19, + EG_TEX_INST_SAMPLE_G = 20, + EG_TEX_INST_GATHER4 = 21, + EG_TEX_INST_SAMPLE_G_LB = 22, + EG_TEX_INST_GATHER4_O = 23, + EG_TEX_INST_SAMPLE_C = 24, + EG_TEX_INST_SAMPLE_C_L = 25, + EG_TEX_INST_SAMPLE_C_LB = 26, + EG_TEX_INST_SAMPLE_C_LZ = 27, + EG_TEX_INST_SAMPLE_C_G = 28, + EG_TEX_INST_GATHER4_C = 29, + EG_TEX_INST_SAMPLE_C_G_LB = 30, + EG_TEX_INST_GATHER4_C_O = 31, + + EG_TEX_WORD1__DST_GPR_shift = 0, //7 bits + EG_TEX_WORD1__DST_GPR_mask = 0x7F, + EG_TEX_WORD1__DST_REL_shift = 7, //1 bit + EG_TEX_WORD1__DST_REL_bit = 1 << 7, + EG_TEX_WORD1__Reserved_shift = 8, //1 bit + EG_TEX_WORD1__Reserved_bit = 1 << 8, + EG_TEX_WORD1__DST_SEL_X_shift = 9, //3 bits + EG_TEX_WORD1__DST_SEL_X_mask = 0x7 << 9, + EG_TEX_WORD1__DST_SEL_Y_shift = 12,//3 bits + EG_TEX_WORD1__DST_SEL_Y_mask = 0x7 << 12, + EG_TEX_WORD1__DST_SEL_Z_shift = 15,//3 bits + EG_TEX_WORD1__DST_SEL_Z_mask = 0x7 << 15, + EG_TEX_WORD1__DST_SEL_W_shift = 18,//3 bits + EG_TEX_WORD1__DST_SEL_W_mask = 0x7 << 18, + EG_TEX_WORD1__LOD_BIAS_shift = 21,//7 bits + EG_TEX_WORD1__LOD_BIAS_mask = 0x7F << 21, + EG_TEX_WORD1__COORD_TYPE_X_shift = 28,//1 bit + EG_TEX_WORD1__COORD_TYPE_X_bit = 1 << 28, + EG_TEX_WORD1__COORD_TYPE_Y_shift = 29,//1 bit + EG_TEX_WORD1__COORD_TYPE_Y_bit = 1 << 29, + EG_TEX_WORD1__COORD_TYPE_Z_shift = 30,//1 bit + EG_TEX_WORD1__COORD_TYPE_Z_bit = 1 << 30, + EG_TEX_WORD1__COORD_TYPE_W_shift = 31,//1 bit + EG_TEX_WORD1__COORD_TYPE_W_bit = 1 << 31, + + EG_TEX_WORD2__OFFSET_X_shift = 0, //5 bits + EG_TEX_WORD2__OFFSET_X_mask = 0x1F, + EG_TEX_WORD2__OFFSET_Y_shift = 5, //5 bits + EG_TEX_WORD2__OFFSET_Y_mask = 0x1F << 5, + EG_TEX_WORD2__OFFSET_Z_shift = 10,//5 bits + EG_TEX_WORD2__OFFSET_Z_mask = 0x1F << 10, + EG_TEX_WORD2__SAMPLER_ID_shift = 15,//5 bits + EG_TEX_WORD2__SAMPLER_ID_mask = 0x1F << 15, + EG_TEX_WORD2__SRC_SEL_X_shift = 20,//3 bits + EG_TEX_WORD2__SRC_SEL_X_mask = 0x7 << 20, + EG_TEX_WORD2__SRC_SEL_Y_shift = 23,//3 bits + EG_TEX_WORD2__SRC_SEL_Y_mask = 0x7 << 23, + EG_TEX_WORD2__SRC_SEL_Z_shift = 26,//3 bits + EG_TEX_WORD2__SRC_SEL_Z_mask = 0x7 << 26, + EG_TEX_WORD2__SRC_SEL_W_shift = 29,//3 bits + EG_TEX_WORD2__SRC_SEL_W_mask = 0x7 << 29, + +//VTX + EG_VTX_WORD0__VC_INST_shift = 0, //5 bits + EG_VTX_WORD0__VC_INST_mask = 0x1F, + EG_VTX_WORD0__FETCH_TYPE_shift = 5, //2 bits + EG_VTX_WORD0__FETCH_TYPE_mask = 0x3 << 5, + EG_VTX_WORD0__FWQ_shift = 7, //1 bit + EG_VTX_WORD0__FWQ_bit = 1 << 7, + EG_VTX_WORD0__BUFFER_ID_shift = 8, //8 bits + EG_VTX_WORD0__BUFFER_ID_mask = 0xFF << 8, + EG_VTX_WORD0__SRC_GPR_shift = 16,//7 bits + EG_VTX_WORD0__SRC_GPR_mask = 0x7F << 16, + EG_VTX_WORD0__SRC_REL_shift = 23,//1 bit + EG_VTX_WORD0__SRC_REL_bit = 1 << 23, + EG_VTX_WORD0__SRC_SEL_X_shift = 24,//2 bits + EG_VTX_WORD0__SRC_SEL_X_mask = 0x3 << 24, + EG_VTX_WORD0__MFC_shift = 26,//6 bits + EG_VTX_WORD0__MFC_mask = 0x3F << 26, + + EG_VC_INST_FETCH = 0, + EG_VC_INST_SEMANTIC = 1, + EG_VC_INST_Reserved_2 = 2, + EG_VC_INST_Reserved_3 = 3, + EG_VC_INST_Reserved_4 = 4, + EG_VC_INST_Reserved_5 = 5, + EG_VC_INST_Reserved_6 = 6, + EG_VC_INST_Reserved_7 = 7, + EG_VC_INST_Reserved_8 = 8, + EG_VC_INST_Reserved_9 = 9, + EG_VC_INST_Reserved_10 = 10, + EG_VC_INST_Reserved_11 = 11, + EG_VC_INST_Reserved_12 = 12, + EG_VC_INST_Reserved_13 = 13, + EG_VC_INST_GET_BUFFER_RESINFO = 14, + + EG_VTX_FETCH_VERTEX_DATA = 0, + EG_VTX_FETCH_INSTANCE_DATA = 1, + EG_VTX_FETCH_NO_INDEX_OFFSET = 2, + + EG_VTX_WORD1_SEM__SEMANTIC_ID_shift = 0, //8 bits + EG_VTX_WORD1_SEM__SEMANTIC_ID_mask = 0xFF, + EG_VTX_WORD1_GPR__DST_GPR_shift = 0, //7 bits + EG_VTX_WORD1_GPR__DST_GPR_mask = 0x7F, + EG_VTX_WORD1_GPR__DST_REL_shift = 7, //1 bit + EG_VTX_WORD1_GPR__DST_REL_bit = 1 << 7, + EG_VTX_WORD1__Reserved_shift = 8, //1 bit + EG_VTX_WORD1__Reserved_bit = 1 << 8, + EG_VTX_WORD1__DST_SEL_X_shift = 9, //3 bits + EG_VTX_WORD1__DST_SEL_X_mask = 0x7 << 9, + EG_VTX_WORD1__DST_SEL_Y_shift = 12,//3 bits + EG_VTX_WORD1__DST_SEL_Y_mask = 0x7 << 12, + EG_VTX_WORD1__DST_SEL_Z_shift = 15,//3 bits + EG_VTX_WORD1__DST_SEL_Z_mask = 0x7 << 15, + EG_VTX_WORD1__DST_SEL_W_shift = 18,//3 bits + EG_VTX_WORD1__DST_SEL_W_mask = 0x7 << 18, + EG_VTX_WORD1__UCF_shift = 21,//1 bit + EG_VTX_WORD1__UCF_bit = 1 << 21, + EG_VTX_WORD1__DATA_FORMAT_shift = 22,//6 bits + EG_VTX_WORD1__DATA_FORMAT_mask = 0x3F << 22, + EG_VTX_WORD1__NFA_shift = 28,//2 bits + EG_VTX_WORD1__NFA_mask = 0x3 << 28, + EG_VTX_WORD1__FCA_shift = 30,//1 bit + EG_VTX_WORD1__FCA_bit = 1 << 30, + EG_VTX_WORD1__SMA_shift = 31,//1 bit + EG_VTX_WORD1__SMA_bit = 1 << 31, + + EG_VTX_WORD2__OFFSET_shift = 0, //16 bits + EG_VTX_WORD2__OFFSET_mask = 0xFFFF, + EG_VTX_WORD2__ENDIAN_SWAP_shift = 16,//2 bits + EG_VTX_WORD2__ENDIAN_SWAP_mask = 0x3 << 16, + EG_VTX_WORD2__CBNS_shift = 18,//1 bit + EG_VTX_WORD2__CBNS_bit = 1 << 18, + EG_VTX_WORD2__MEGA_FETCH_shift = 19,//1 bit + EG_VTX_WORD2__MEGA_FETCH_mask = 1 << 19, + EG_VTX_WORD2__ALT_CONST_shift = 20,//1 bit + EG_VTX_WORD2__ALT_CONST_mask = 1 << 20, + EG_VTX_WORD2__BIM_shift = 21,//2 bits + EG_VTX_WORD2__BIM_mask = 0x3 << 21, + EG_VTX_WORD2__Reserved_shift = 23,//9 bits + EG_VTX_WORD2__Reserved_mask = 0x1FF << 23, + +//CF_ALU + EG_CF_ALU_WORD0__ADDR_shift = 0, //22 bits + EG_CF_ALU_WORD0__ADDR_mask = 0x3FFFFF, + EG_CF_ALU_WORD0__KCACHE_BANK0_shift = 22,//4 bits + EG_CF_ALU_WORD0__KCACHE_BANK0_mask = 0xF << 22, + EG_CF_ALU_WORD0__KCACHE_BANK1_shift = 26,//4 bits + EG_CF_ALU_WORD0__KCACHE_BANK1_mask = 0xF << 26, + EG_CF_ALU_WORD0__KCACHE_MODE0_shift = 30,//2 bits + EG_CF_ALU_WORD0__KCACHE_MODE0_mask = 0x3 << 30, + + EG_CF_ALU_WORD1__KCACHE_MODE1_shift = 0, //2 bits + EG_CF_ALU_WORD1__KCACHE_MODE1_mask = 0x3, + EG_CF_ALU_WORD1__KCACHE_ADDR0_shift = 2, //8 bits + EG_CF_ALU_WORD1__KCACHE_ADDR0_mask = 0xFF << 2, + EG_CF_ALU_WORD1__KCACHE_ADDR1_shift = 10, //8 bits + EG_CF_ALU_WORD1__KCACHE_ADDR1_mask = 0xFF << 10, + EG_CF_ALU_WORD1__COUNT_shift = 18, //7 bits + EG_CF_ALU_WORD1__COUNT_mask = 0x7F << 18, + EG_CF_ALU_WORD1__ALT_CONST_shift = 25, //1 bit + EG_CF_ALU_WORD1__ALT_CONST_bit = 1 << 25, + EG_CF_ALU_WORD1__CF_INST_shift = 26, //4 bits + EG_CF_ALU_WORD1__CF_INST_mask = 0xF << 26, + EG_CF_ALU_WORD1__WQM_shift = 30, //1 bit + EG_CF_ALU_WORD1__WQM_bit = 1 << 30, + EG_CF_ALU_WORD1__BARRIER_shift = 31, //1 bit + EG_CF_ALU_WORD1__BARRIER_bit = 1 << 31, + + EG_CF_INST_ALU = 8, + EG_CF_INST_ALU_PUSH_BEFORE = 9, + EG_CF_INST_ALU_POP_AFTER = 10, + EG_CF_INST_ALU_POP2_AFTER = 11, + EG_CF_INST_ALU_EXTENDED = 12, + EG_CF_INST_ALU_CONTINUE = 13, + EG_CF_INST_ALU_BREAK = 14, + EG_CF_INST_ALU_ELSE_AFTER = 15, + + EG_CF_ALU_WORD0_EXT__Reserved0_shift = 0, //4 bits + EG_CF_ALU_WORD0_EXT__Reserved0_mask = 0xF, + EG_CF_ALU_WORD0_EXT__KBIM0_shift = 4, //2 bits + EG_CF_ALU_WORD0_EXT__KBIM0_mask = 0x3 << 4, + EG_CF_ALU_WORD0_EXT__KBIM1_shift = 6, //2 bits + EG_CF_ALU_WORD0_EXT__KBIM1_mask = 0x3 << 6, + EG_CF_ALU_WORD0_EXT__KBIM2_shift = 8, //2 bits + EG_CF_ALU_WORD0_EXT__KBIM2_mask = 0x3 << 8, + EG_CF_ALU_WORD0_EXT__KBIM3_shift = 10,//2 bits + EG_CF_ALU_WORD0_EXT__KBIM3_mask = 0x3 << 10, + EG_CF_ALU_WORD0_EXT__Reserved12_shift = 12,//10 bits + EG_CF_ALU_WORD0_EXT__Reserved12_mask = 0x3FF << 12, + EG_CF_ALU_WORD0_EXT__KCACHE_BANK2_shift = 22,//4 bits + EG_CF_ALU_WORD0_EXT__KCACHE_BANK2_mask = 0xF << 22, + EG_CF_ALU_WORD0_EXT__KCACHE_BANK3_shift = 26,//4 bits + EG_CF_ALU_WORD0_EXT__KCACHE_BANK3_mask = 0xF << 26, + EG_CF_ALU_WORD0_EXT__KCACHE_MODE2_shift = 30,//2 btis + EG_CF_ALU_WORD0_EXT__KCACHE_MODE2_mask = 0x3 << 30, + + EG_CF_ALU_WORD1_EXT__KCACHE_MODE3_shift = 0, //2 bits + EG_CF_ALU_WORD1_EXT__KCACHE_MODE3_mask = 0x3, + EG_CF_ALU_WORD1_EXT__KCACHE_ADDR2_shift = 2, //8 bits + EG_CF_ALU_WORD1_EXT__KCACHE_ADDR2_mask = 0xFF << 2, + EG_CF_ALU_WORD1_EXT__KCACHE_ADDR3_shift = 10, //8 bits + EG_CF_ALU_WORD1_EXT__KCACHE_ADDR3_mask = 0xFF << 10, + EG_CF_ALU_WORD1_EXT__Reserved18_shift = 18, //8 bits + EG_CF_ALU_WORD1_EXT__Reserved18_mask = 0xFF << 18, + EG_CF_ALU_WORD1_EXT__CF_INST_shift = 26, //4 bits + EG_CF_ALU_WORD1_EXT__CF_INST_mask = 0xF << 26, + EG_CF_ALU_WORD1_EXT__Reserved30_shift = 30, //1 bit + EG_CF_ALU_WORD1_EXT__Reserved30_bit = 1 << 30, + EG_CF_ALU_WORD1_EXT__BARRIER_shift = 31, //1 bit + EG_CF_ALU_WORD1_EXT__BARRIER_bit = 1 << 31, + +//ALU + EG_ALU_WORD0__SRC0_SEL_shift = 0, //9 bits + EG_ALU_WORD0__SRC0_SEL_mask = 0x1FF, + EG_ALU_WORD0__SRC1_SEL_shift = 13,//9 bits + EG_ALU_WORD0__SRC1_SEL_mask = 0x1FF << 13, + EG_ALU_WORD0__SRC0_REL_shift = 9, //1 bit + EG_ALU_WORD0__SRC0_REL_bit = 1 << 9, + EG_ALU_WORD0__SRC1_REL_shift = 22,//1 bit + EG_ALU_WORD0__SRC1_REL_bit = 1 << 22, + EG_ALU_WORD0__SRC0_CHAN_shift = 10,//2 bits + EG_ALU_WORD0__SRC0_CHAN_mask = 0x3 << 10, + EG_ALU_WORD0__SRC1_CHAN_shift = 23,//2 bits + EG_ALU_WORD0__SRC1_CHAN_mask = 0x3 << 23, + EG_ALU_WORD0__SRC0_NEG_shift = 12,//1 bit + EG_ALU_WORD0__SRC0_NEG_bit = 1 << 12, + EG_ALU_WORD0__SRC1_NEG_shift = 25,//1 bit + EG_ALU_WORD0__SRC1_NEG_bit = 1 << 25, + EG_ALU_WORD0__INDEX_MODE_shift = 26,//3 bits + EG_ALU_WORD0__INDEX_MODE_mask = 0x7 << 26, + EG_ALU_WORD0__PRED_SEL_shift = 29,//2 bits + EG_ALU_WORD0__PRED_SEL_mask = 0x3 << 29, + EG_ALU_WORD0__LAST_shift = 31,//1 bit + EG_ALU_WORD0__LAST_bit = 1 << 31, + + EG_ALU_WORD1_OP2__SRC0_ABS_shift = 0, //1 bit + EG_ALU_WORD1_OP2__SRC0_ABS_bit = 1, + EG_ALU_WORD1_OP2__SRC1_ABS_shift = 1, //1 bit + EG_ALU_WORD1_OP2__SRC1_ABS_bit = 1 << 1, + EG_ALU_WORD1_OP2__UEM_shift = 2, //1 bit + EG_ALU_WORD1_OP2__UEM_bit = 1 << 2, + EG_ALU_WORD1_OP2__UPDATE_PRED_shift = 3, //1 bit + EG_ALU_WORD1_OP2__UPDATE_PRED_bit = 1 << 3, + EG_ALU_WORD1_OP2__WRITE_MASK_shift = 4, //1 bit + EG_ALU_WORD1_OP2__WRITE_MASK_bit = 1 << 4, + EG_ALU_WORD1_OP2__OMOD_shift = 5, //2 bits + EG_ALU_WORD1_OP2__OMOD_mask = 0x3 << 5, + EG_ALU_WORD1_OP2__ALU_INST_shift = 7, //11 bits + EG_ALU_WORD1_OP2__ALU_INST_mask = 0x7FF << 7, + + EG_ALU_WORD1__BANK_SWIZZLE_shift = 18,//3 bits + EG_ALU_WORD1__BANK_SWIZZLE_mask = 0x7 << 18, + EG_ALU_WORD1__DST_GPR_shift = 21,//7 bits + EG_ALU_WORD1__DST_GPR_mask = 0x7F << 21, + EG_ALU_WORD1__DST_REL_shift = 28,//1 bit + EG_ALU_WORD1__DST_REL_mask = 1 << 28, + EG_ALU_WORD1__DST_CHAN_shift = 29,//2 bits + EG_ALU_WORD1__DST_CHAN_mask = 0x3 << 29, + EG_ALU_WORD1__CLAMP_shift = 31,//1 bits + EG_ALU_WORD1__CLAMP_mask = 1 << 31, + + EG_ALU_WORD1_OP3__SRC2_SEL_shift = 0, //9 bits + EG_ALU_WORD1_OP3__SRC2_SEL_mask = 0x1FF, + EG_ALU_WORD1_OP3__SRC2_REL_shift = 9, //1 bit + EG_ALU_WORD1_OP3__SRC2_REL_bit = 1 << 9, + EG_ALU_WORD1_OP3__SRC2_CHAN_shift = 10,//2 bits + EG_ALU_WORD1_OP3__SRC2_CHAN_mask = 0x3 << 10, + EG_ALU_WORD1_OP3__SRC2_NEG_shift = 12,//1 bit + EG_ALU_WORD1_OP3__SRC2_NEG_bit = 1 << 12, + EG_ALU_WORD1_OP3__ALU_INST_shift = 13,//5 bits + EG_ALU_WORD1_OP3__ALU_INST_mask = 0x1F << 13, + + EG_OP3_INST_BFE_UINT = 4, + EG_OP3_INST_BFE_INT = 5, + EG_OP3_INST_BFI_INT = 6, + EG_OP3_INST_FMA = 7, + EG_OP3_INST_CNDNE_64 = 9, + EG_OP3_INST_FMA_64 = 10, + EG_OP3_INST_LERP_UINT = 11, + EG_OP3_INST_BIT_ALIGN_INT = 12, + EG_OP3_INST_BYTE_ALIGN_INT = 13, + EG_OP3_INST_SAD_ACCUM_UINT = 14, + EG_OP3_INST_SAD_ACCUM_HI_UINT = 15, + EG_OP3_INST_MULADD_UINT24 = 16, + EG_OP3_INST_LDS_IDX_OP = 17, + EG_OP3_INST_MULADD = 20, + EG_OP3_INST_MULADD_M2 = 21, + EG_OP3_INST_MULADD_M4 = 22, + EG_OP3_INST_MULADD_D2 = 23, + EG_OP3_INST_MULADD_IEEE = 24, + EG_OP3_INST_CNDE = 25, + EG_OP3_INST_CNDGT = 26, + EG_OP3_INST_CNDGE = 27, + EG_OP3_INST_CNDE_INT = 28, + EG_OP3_INST_CMNDGT_INT = 29, + EG_OP3_INST_CMNDGE_INT = 30, + EG_OP3_INST_MUL_LIT = 31, + + EG_OP2_INST_ADD = 0, + EG_OP2_INST_MUL = 1, + EG_OP2_INST_MUL_IEEE = 2, + EG_OP2_INST_MAX = 3, + EG_OP2_INST_MIN = 4, + EG_OP2_INST_MAX_DX10 = 5, + EG_OP2_INST_MIN_DX10 = 6, + EG_OP2_INST_SETE = 8, + EG_OP2_INST_SETGT = 9, + EG_OP2_INST_SETGE = 10, + EG_OP2_INST_SETNE = 11, + EG_OP2_INST_SETE_DX10 = 12, + EG_OP2_INST_SETGT_DX10 = 13, + EG_OP2_INST_SETGE_DX10 = 14, + EG_OP2_INST_SETNE_DX10 = 15, + EG_OP2_INST_FRACT = 16, + EG_OP2_INST_TRUNC = 17, + EG_OP2_INST_CEIL = 18, + EG_OP2_INST_RNDNE = 19, + EG_OP2_INST_FLOOR = 20, + EG_OP2_INST_ASHR_INT = 21, + EG_OP2_INST_LSHR_INT = 22, + EG_OP2_INST_LSHL_INT = 23, + EG_OP2_INST_MOV = 25, + EG_OP2_INST_NOP = 26, + EG_OP2_INST_MUL_64 = 27, + EG_OP2_INST_FLT64_TO_FLT32 = 28, + EG_OP2_INST_FLT32_TO_FLT64 = 29, + EG_OP2_INST_PRED_SETGT_UINT = 30, + EG_OP2_INST_PRED_SETGE_UINT = 31, + EG_OP2_INST_PRED_SETE = 32, + EG_OP2_INST_PRED_SETGT = 33, + EG_OP2_INST_PRED_SETGE = 34, + EG_OP2_INST_PRED_SETNE = 35, + EG_OP2_INST_PRED_SET_INV = 36, + EG_OP2_INST_PRED_SET_POP = 37, + EG_OP2_INST_PRED_SET_CLR = 38, + EG_OP2_INST_PRED_SET_RESTORE = 39, + EG_OP2_INST_PRED_SETE_PUSH = 40, + EG_OP2_INST_PRED_SETGT_PUSH = 41, + EG_OP2_INST_PRED_SETGE_PUSH = 42, + EG_OP2_INST_PRED_SETNE_PUSH = 43, + EG_OP2_INST_KILLE = 44, + EG_OP2_INST_KILLGT = 45, + EG_OP2_INST_KILLGE = 46, + EG_OP2_INST_KILLNE = 47, + EG_OP2_INST_AND_INT = 48, + EG_OP2_INST_OR_INT = 49, + EG_OP2_INST_XOR_INT = 50, + EG_OP2_INST_NOT_INT = 51, + EG_OP2_INST_ADD_INT = 52, + EG_OP2_INST_SUB_INT = 53, + EG_OP2_INST_MAX_INT = 54, + EG_OP2_INST_MIN_INT = 55, + EG_OP2_INST_MAX_UINT = 56, + EG_OP2_INST_MIN_UINT = 57, + EG_OP2_INST_SETE_INT = 58, + EG_OP2_INST_SETGT_INT = 59, + EG_OP2_INST_SETGE_INT = 60, + EG_OP2_INST_SETNE_INT = 61, + EG_OP2_INST_SETGT_UINT = 62, + EG_OP2_INST_SETGE_UINT = 63, + EG_OP2_INST_KILLGT_UINT = 64, + EG_OP2_INST_KILLGE_UINT = 65, + EG_OP2_INST_PREDE_INT = 66, + EG_OP2_INST_PRED_SETGT_INT = 67, + EG_OP2_INST_PRED_SETGE_INT = 68, + EG_OP2_INST_PRED_SETNE_INT = 69, + EG_OP2_INST_KILLE_INT = 70, + EG_OP2_INST_KILLGT_INT = 71, + EG_OP2_INST_KILLGE_INT = 72, + EG_OP2_INST_KILLNE_INT = 73, + EG_OP2_INST_PRED_SETE_PUSH_INT = 74, + EG_OP2_INST_PRED_SETGT_PUSH_INT = 75, + EG_OP2_INST_PRED_SETGE_PUSH_INT = 76, + EG_OP2_INST_PRED_SETNE_PUSH_INT = 77, + EG_OP2_INST_PRED_SETLT_PUSH_INT = 78, + EG_OP2_INST_PRED_SETLE_PUSH_INT = 79, + EG_OP2_INST_FLT_TO_INT = 80, + EG_OP2_INST_BFREV_INT = 81, + EG_OP2_INST_ADDC_UINT = 82, + EG_OP2_INST_SUBB_UINT = 83, + EG_OP2_INST_GROUP_BARRIER = 84, + EG_OP2_INST_GROUP_SEQ_BEGIN = 85, + EG_OP2_INST_GROUP_SEQ_END = 86, + EG_OP2_INST_SET_MODE = 87, + EG_OP2_INST_SET_CF_IDX0 = 88, + EG_OP2_INST_SET_CF_IDX1 = 89, + EG_OP2_INST_SET_LDS_SIZE = 90, + EG_OP2_INST_EXP_IEEE = 129, + EG_OP2_INST_LOG_CLAMPED = 130, + EG_OP2_INST_LOG_IEEE = 131, + EG_OP2_INST_RECIP_CLAMPED = 132, + EG_OP2_INST_RECIP_FF = 133, + EG_OP2_INST_RECIP_IEEE = 134, + EG_OP2_INST_RECIPSQRT_CLAMPED = 135, + EG_OP2_INST_RECIPSQRT_FF = 136, + EG_OP2_INST_RECIPSQRT_IEEE = 137, + EG_OP2_INST_SQRT_IEEE = 138, + EG_OP2_INST_SIN = 141, + EG_OP2_INST_COS = 142, + EG_OP2_INST_MULLO_INT = 143, + EG_OP2_INST_MULHI_INT = 144, + EG_OP2_INST_MULLO_UINT = 145, + EG_OP2_INST_MULHI_UINT = 146, + EG_OP2_INST_RECIP_INT = 147, + EG_OP2_INST_RECIP_UINT = 148, + EG_OP2_INST_RECIP_64 = 149, + EG_OP2_INST_RECIP_CLAMPED_64 = 150, + EG_OP2_INST_RECIPSQRT_64 = 151, + EG_OP2_INST_RECIPSQRT_CLAMPED_64 = 152, + EG_OP2_INST_SQRT_64 = 153, + EG_OP2_INST_FLT_TO_UINT = 154, + EG_OP2_INST_INT_TO_FLT = 155, + EG_OP2_INST_UINT_TO_FLT = 156, + EG_OP2_INST_BFM_INT = 160, + EG_OP2_INST_FLT32_TO_FLT16 = 162, + EG_OP2_INST_FLT16_TO_FLT32 = 163, + EG_OP2_INST_UBYTE0_FLT = 164, + EG_OP2_INST_UBYTE1_FLT = 165, + EG_OP2_INST_UBYTE2_FLT = 166, + EG_OP2_INST_UBYTE3_FLT = 167, + EG_OP2_INST_BCNT_INT = 170, + EG_OP2_INST_FFBH_UINT = 171, + EG_OP2_INST_FFBL_INT = 172, + EG_OP2_INST_FFBH_INT = 173, + EG_OP2_INST_FLT_TO_UINT4 = 174, + EG_OP2_INST_DOT_IEEE = 175, + EG_OP2_INST_FLT_TO_INT_RPI = 176, + EG_OP2_INST_FLT_TO_INT_FLOOR = 177, + EG_OP2_INST_MULHI_UINT24 = 178, + EG_OP2_INST_MBCNT_32HI_INT = 179, + EG_OP2_INST_OFFSET_TO_FLT = 180, + EG_OP2_INST_MUL_UINT24 = 181, + EG_OP2_INST_BCNT_ACCUM_PREV_INT = 182, + EG_OP2_INST_MBCNT_32LO_ACCUM_PREV_INT = 183, + EG_OP2_INST_SETE_64 = 184, + EG_OP2_INST_SETNE_64 = 185, + EG_OP2_INST_SETGT_64 = 186, + EG_OP2_INST_SETGE_64 = 187, + EG_OP2_INST_MIN_64 = 188, + EG_OP2_INST_MAX_64 = 189, + EG_OP2_INST_DOT4 = 190, + EG_OP2_INST_DOT4_IEEE = 191, + EG_OP2_INST_CUBE = 192, + EG_OP2_INST_MAX4 = 193, + EG_OP2_INST_FREXP_64 = 196, + EG_OP2_INST_LDEXP_64 = 197, + EG_OP2_INST_FRACT_64 = 198, + EG_OP2_INST_PRED_SETGT_64 = 199, + EG_OP2_INST_PRED_SETE_64 = 200, + EG_OP2_INST_PRED_SETGE_64 = 201, + EG_OP2_INST_MUL_64_2 = 202, //same as prev? + EG_OP2_INST_ADD_64 = 203, + EG_OP2_INST_MOVA_INT = 204, + EG_OP2_INST_FLT64_TO_FLT32_2 = 205, //same as prev? + EG_OP2_INST_FLT32_TO_FLT64_2 = 206, //same as prev? + EG_OP2_INST_SAD_ACCUM_PREV_UINT = 207, + EG_OP2_INST_DOT = 208, + EG_OP2_INST_MUL_PREV = 209, + EG_OP2_INST_MUL_IEEE_PREV = 210, + EG_OP2_INST_ADD_PREV = 211, + EG_OP2_INST_MULADD_PREV = 212, + EG_OP2_INST_MULADD_IEEE_PREV = 213, + EG_OP2_INST_INTERP_XY = 214, + EG_OP2_INST_INTERP_ZW = 215, + EG_OP2_INST_INTERP_X = 216, + EG_OP2_INST_INTERP_Z = 217, + EG_OP2_INST_STORE_FLAGS = 218, + EG_OP2_INST_LOAD_STORE_FLAGS = 219, + EG_OP2_INST_LDS_1A = 220, + EG_OP2_INST_LDS_1A1D = 221, + EG_OP2_INST_LDS_2A = 223, + EG_OP2_INST_INTERP_LOAD_P0 = 224, + EG_OP2_INST_INTERP_LOAD_P10 = 225, + EG_OP2_INST_INTERP_LOAD_P20 = 226, + + EG_SRC_SEL__GPR_start = 0, + EG_SRC_SEL__GPR_end = 127, + EG_SRC_SEL__KCONST_BANK0_start = 128, + EG_SRC_SEL__KCONST_BANK0_end = 159, + EG_SRC_SEL__KCONST_BANK1_start = 160, + EG_SRC_SEL__KCONST_BANK1_end = 191, + EG_SRC_SEL__INLINE_satrt = 192, + EG_SRC_SEL__INLINE_end = 255, + EG_SRC_SEL__KCONST_BANK2_start = 256, + EG_SRC_SEL__KCONST_BANK2_end = 287, + EG_SRC_SEL__KCONST_BANK3_start = 288, + EG_SRC_SEL__KCONST_BANK3_end = 319, + EG_SRC_SEL__ALU_SRC_LDS_OQ_A = 219, + EG_SRC_SEL__ALU_SRC_LDS_OQ_B = 220, + EG_SRC_SEL__ALU_SRC_LDS_OQ_A_POP = 221, + EG_SRC_SEL__ALU_SRC_LDS_OQ_B_POP = 222, + EG_SRC_SEL__ALU_SRC_LDS_DIRECT_A = 223, + EG_SRC_SEL__ALU_SRC_LDS_DIRECT_B = 224, + EG_SRC_SEL__ALU_SRC_TIME_HI = 227, + EG_SRC_SEL__ALU_SRC_TIME_LO = 228, + EG_SRC_SEL__ALU_SRC_MASK_HI = 229, + EG_SRC_SEL__ALU_SRC_MASK_LO = 230, + EG_SRC_SEL__ALU_SRC_HW_WAVE_ID = 231, + EG_SRC_SEL__ALU_SRC_SIMD_ID = 232, + EG_SRC_SEL__ALU_SRC_SE_ID = 233, + EG_SRC_SEL__ALU_SRC_HW_THREADGRP_ID = 234, + EG_SRC_SEL__ALU_SRC_WAVE_ID_IN_GRP = 235, + EG_SRC_SEL__ALU_SRC_NUM_THREADGRP_WAVES = 236, + EG_SRC_SEL__ALU_SRC_HW_ALU_ODD = 237, + EG_SRC_SEL__ALU_SRC_LOOP_IDX = 238, + EG_SRC_SEL__ALU_SRC_PARAM_BASE_ADDR = 240, + EG_SRC_SEL__ALU_SRC_NEW_PRIM_MASK = 241, + EG_SRC_SEL__ALU_SRC_PRIM_MASK_HI = 242, + EG_SRC_SEL__ALU_SRC_PRIM_MASK_LO = 243, + EG_SRC_SEL__ALU_SRC_1_DBL_L = 244, + EG_SRC_SEL__ALU_SRC_1_DBL_M = 245, + EG_SRC_SEL__ALU_SRC_0_5_DBL_L = 246, + EG_SRC_SEL__ALU_SRC_0_5_DBL_M = 247, + EG_SRC_SEL__ALU_SRC_0 = 248, + EG_SRC_SEL__ALU_SRC_1 = 249, + EG_SRC_SEL__ALU_SRC_1_INT = 250, + EG_SRC_SEL__ALU_SRC_M_1_INT = 251, + EG_SRC_SEL__ALU_SRC_0_5 = 252, + EG_SRC_SEL__ALU_SRC_LITERAL = 253, + EG_SRC_SEL__ALU_SRC_PV = 254, + EG_SRC_SEL__ALU_SRC_PS = 255, + +//ALLOC_EXPORT + EG_CF_ALLOC_EXPORT_WORD0__ARRAY_BASE_shift = 0, //13 bits + EG_CF_ALLOC_EXPORT_WORD0__ARRAY_BASE_mask = 0x1FFF, + EG_CF_ALLOC_EXPORT_WORD0__TYPE_shift = 13,//2 bits + EG_CF_ALLOC_EXPORT_WORD0__TYPE_mask = 0x3 << 13, + EG_CF_ALLOC_EXPORT_WORD0__RW_GPR_shift = 15,//7 bits + EG_CF_ALLOC_EXPORT_WORD0__RW_GPR_mask = 0x7F << 15, + EG_CF_ALLOC_EXPORT_WORD0__RW_REL_shift = 22,//1 bit + EG_CF_ALLOC_EXPORT_WORD0__RW_REL_bit = 1 << 22, + EG_CF_ALLOC_EXPORT_WORD0__INDEX_GPR_shift = 23,//7 bits + EG_CF_ALLOC_EXPORT_WORD0__INDEX_GPR_mask = 0x7F << 23, + EG_CF_ALLOC_EXPORT_WORD0__ELEM_SIZE_shift = 30,//2 bits + EG_CF_ALLOC_EXPORT_WORD0__ELEM_SIZE_mask = 0x3 << 30, + + EG_CF_ALLOC_EXPORT_WORD1_BUF__ARRAY_SIZE_shift = 0, //12 bits + EG_CF_ALLOC_EXPORT_WORD1_BUF__ARRAY_SIZE_mask = 0xFFF, + EG_CF_ALLOC_EXPORT_WORD1_BUF__COMP_MASK_shift = 12, //4 bits + EG_CF_ALLOC_EXPORT_WORD1_BUF__COMP_MASK_mask = 0xF << 12, + + EG_CF_ALLOC_EXPORT_WORD1_SWIZ__SEL_X_shift = 0, //3 bits + EG_CF_ALLOC_EXPORT_WORD1_SWIZ__SEL_X_mask = 0x7, + EG_CF_ALLOC_EXPORT_WORD1_SWIZ__SEL_Y_shift = 3, //3 bits + EG_CF_ALLOC_EXPORT_WORD1_SWIZ__SEL_Y_mask = 0x7 << 3, + EG_CF_ALLOC_EXPORT_WORD1_SWIZ__SEL_Z_shift = 6, //3 bits + EG_CF_ALLOC_EXPORT_WORD1_SWIZ__SEL_Z_mask = 0x7 << 6, + EG_CF_ALLOC_EXPORT_WORD1_SWIZ__SEL_W_shift = 9, //3 bits + EG_CF_ALLOC_EXPORT_WORD1_SWIZ__SEL_W_mask = 0x7 << 9, + EG_CF_ALLOC_EXPORT_WORD1_SWIZ__Resreve_shift = 12,//4 bits + EG_CF_ALLOC_EXPORT_WORD1_SWIZ__Resreve_mask = 0xF << 12, + + EG_CF_ALLOC_EXPORT_WORD1__BURST_COUNT_shift = 16, //4 bits + EG_CF_ALLOC_EXPORT_WORD1__BURST_COUNT_mask = 0xF << 16, + EG_CF_ALLOC_EXPORT_WORD1__VPM_shift = 20, //1 bit + EG_CF_ALLOC_EXPORT_WORD1__VPM_bit = 1 << 20, + EG_CF_ALLOC_EXPORT_WORD1__EOP_shift = 21, //1 bit + EG_CF_ALLOC_EXPORT_WORD1__EOP_bit = 1 << 21, + EG_CF_ALLOC_EXPORT_WORD1__CF_INST_shift = 22, //8 bits + EG_CF_ALLOC_EXPORT_WORD1__CF_INST_mask = 0xFF << 22, + EG_CF_ALLOC_EXPORT_WORD1__MARK_shift = 30, //1 bit + EG_CF_ALLOC_EXPORT_WORD1__MARK_bit = 1 << 30, + EG_CF_ALLOC_EXPORT_WORD1__BARRIER_shift = 31, //1 bit + EG_CF_ALLOC_EXPORT_WORD1__BARRIER_bit = 1 << 31, + + EG_CF_INST_MEM_STREAM0_BUF0 = 64 , + EG_CF_INST_MEM_STREAM0_BUF1 = 65, + EG_CF_INST_MEM_STREAM0_BUF2 = 66, + EG_CF_INST_MEM_STREAM0_BUF3 = 67, + EG_CF_INST_MEM_STREAM1_BUF0 = 68, + EG_CF_INST_MEM_STREAM1_BUF1 = 69, + EG_CF_INST_MEM_STREAM1_BUF2 = 70, + EG_CF_INST_MEM_STREAM1_BUF3 = 71, + EG_CF_INST_MEM_STREAM2_BUF0 = 72, + EG_CF_INST_MEM_STREAM2_BUF1 = 73, + EG_CF_INST_MEM_STREAM2_BUF2 = 74, + EG_CF_INST_MEM_STREAM2_BUF3 = 75, + EG_CF_INST_MEM_STREAM3_BUF0 = 76, + EG_CF_INST_MEM_STREAM3_BUF1 = 77, + EG_CF_INST_MEM_STREAM3_BUF2 = 78, + EG_CF_INST_MEM_STREAM3_BUF3 = 79, + EG_CF_INST_MEM_WR_SCRATCH = 80, + EG_CF_INST_MEM_RING = 82, + EG_CF_INST_EXPORT = 83, + EG_CF_INST_EXPORT_DONE = 84, + EG_CF_INST_MEM_EXPORT = 85, + EG_CF_INST_MEM_RAT = 86, + EG_CF_INST_MEM_RAT_CACHELESS = 87, + EG_CF_INST_MEM_RING1 = 88, + EG_CF_INST_MEM_RING2 = 89, + EG_CF_INST_MEM_RING3 = 90, + EG_CF_INST_MEM_EXPORT_COMBINED = 91, + EG_CF_INST_MEM_RAT_COMBINED_CACHELESS = 92, + + EG_EXPORT_PIXEL = 0, + EG_EXPORT_WRITE = 0, + EG_EXPORT_POS = 1, + EG_EXPORT_WRITE_IND = 1, + EG_EXPORT_PARAM = 2, + EG_EXPORT_WRITE_ACK = 2, + EG_EXPORT_WRITE_IND_ACK = 3, + + /* PS interp param source */ + EG_ALU_SRC_PARAM_BASE = 0x000001c0, + EG_ALU_SRC_PARAM_SIZE = 0x00000021, +}; + +#endif //_EVERGREEN_SQ_H_ + + diff --git a/src/mesa/drivers/dri/r600/evergreen_state.c b/src/mesa/drivers/dri/r600/evergreen_state.c new file mode 100644 index 0000000000..49ee525492 --- /dev/null +++ b/src/mesa/drivers/dri/r600/evergreen_state.c @@ -0,0 +1,1879 @@ +/* + * Copyright (C) 2008-2009 Advanced Micro Devices, Inc. + * + * 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 + * THE COPYRIGHT HOLDER(S) 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. + */ + +/* + * Authors: + * Richard Li , + */ + +#include "main/glheader.h" +#include "main/mtypes.h" +#include "main/imports.h" +#include "main/enums.h" +#include "main/macros.h" +#include "main/context.h" +#include "main/dd.h" +#include "main/simple_list.h" + +#include "tnl/tnl.h" +#include "tnl/t_pipeline.h" +#include "swrast/swrast.h" +#include "swrast_setup/swrast_setup.h" +#include "main/api_arrayelt.h" +#include "main/framebuffer.h" +#include "drivers/common/meta.h" +#include "program/prog_parameter.h" +#include "program/prog_statevars.h" + +#include "vbo/vbo.h" + +#include "r600_context.h" + +#include "evergreen_state.h" +#include "evergreen_diff.h" +#include "evergreen_vertprog.h" +#include "evergreen_fragprog.h" +#include "evergreen_tex.h" + +void evergreenUpdateStateParameters(GLcontext * ctx, GLuint new_state); //same + +void evergreenUpdateShaders(GLcontext * ctx) +{ + context_t *context = EVERGREEN_CONTEXT(ctx); + + /* should only happenen once, just after context is created */ + /* TODO: shouldn't we fallback to sw here? */ + if (!ctx->FragmentProgram._Current) { + fprintf(stderr, "No ctx->FragmentProgram._Current!!\n"); + return; + } + + evergreenSelectFragmentShader(ctx); + + evergreenSelectVertexShader(ctx); + evergreenUpdateStateParameters(ctx, _NEW_PROGRAM | _NEW_PROGRAM_CONSTANTS); + context->radeon.NewGLState = 0; +} + +void evergreeUpdateShaders(GLcontext * ctx) +{ + context_t *context = R700_CONTEXT(ctx); + + /* should only happenen once, just after context is created */ + /* TODO: shouldn't we fallback to sw here? */ + if (!ctx->FragmentProgram._Current) { + fprintf(stderr, "No ctx->FragmentProgram._Current!!\n"); + return; + } + + evergreenSelectFragmentShader(ctx); + + evergreenSelectVertexShader(ctx); + evergreenUpdateStateParameters(ctx, _NEW_PROGRAM | _NEW_PROGRAM_CONSTANTS); + context->radeon.NewGLState = 0; +} + +/* + * To correctly position primitives: + */ +void evergreenUpdateViewportOffset(GLcontext * ctx) //------------------ +{ + context_t *context = R700_CONTEXT(ctx); + EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); + __DRIdrawable *dPriv = radeon_get_drawable(&context->radeon); + GLfloat xoffset = (GLfloat) dPriv->x; + GLfloat yoffset = (GLfloat) dPriv->y + dPriv->h; + const GLfloat *v = ctx->Viewport._WindowMap.m; + int id = 0; + + GLfloat tx = v[MAT_TX] + xoffset; + GLfloat ty = (-v[MAT_TY]) + yoffset; + + if (evergreen->viewport[id].PA_CL_VPORT_XOFFSET.f32All != tx || + evergreen->viewport[id].PA_CL_VPORT_YOFFSET.f32All != ty) { + /* Note: this should also modify whatever data the context reset + * code uses... + */ + EVERGREEN_STATECHANGE(context, pa); + evergreen->viewport[id].PA_CL_VPORT_XOFFSET.f32All = tx; + evergreen->viewport[id].PA_CL_VPORT_YOFFSET.f32All = ty; + } + + radeonUpdateScissor(ctx); +} + +void evergreenUpdateStateParameters(GLcontext * ctx, GLuint new_state) //same +{ + struct evergreen_fragment_program *fp = + (struct evergreen_fragment_program *)ctx->FragmentProgram._Current; + struct gl_program_parameter_list *paramList; + + if (!(new_state & (_NEW_BUFFERS | _NEW_PROGRAM | _NEW_PROGRAM_CONSTANTS))) + return; + + if (!ctx->FragmentProgram._Current || !fp) + return; + + paramList = ctx->FragmentProgram._Current->Base.Parameters; + + if (!paramList) + return; + + _mesa_load_state_parameters(ctx, paramList); + +} + +/** + * Called by Mesa after an internal state update. + */ +static void evergreenInvalidateState(GLcontext * ctx, GLuint new_state) //same +{ + context_t *context = EVERGREEN_CONTEXT(ctx); + + EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); + + _swrast_InvalidateState(ctx, new_state); + _swsetup_InvalidateState(ctx, new_state); + _vbo_InvalidateState(ctx, new_state); + _tnl_InvalidateState(ctx, new_state); + _ae_invalidate_state(ctx, new_state); + + if (new_state & _NEW_BUFFERS) { + _mesa_update_framebuffer(ctx); + /* this updates the DrawBuffer's Width/Height if it's a FBO */ + _mesa_update_draw_buffer_bounds(ctx); + + EVERGREEN_STATECHANGE(context, cb); + EVERGREEN_STATECHANGE(context, db); + } + + if (new_state & (_NEW_LIGHT)) { + EVERGREEN_STATECHANGE(context, pa); + if (ctx->Light.ProvokingVertex == GL_LAST_VERTEX_CONVENTION) + SETbit(evergreen->PA_SU_SC_MODE_CNTL.u32All, PROVOKING_VTX_LAST_bit); + else + CLEARbit(evergreen->PA_SU_SC_MODE_CNTL.u32All, PROVOKING_VTX_LAST_bit); + } + + evergreenUpdateStateParameters(ctx, new_state); + + EVERGREEN_STATECHANGE(context, pa); + EVERGREEN_STATECHANGE(context, spi); + + if(GL_TRUE == evergreen->bEnablePerspective) + { + /* Do scale XY and Z by 1/W0 for perspective correction on pos. For orthogonal case, set both to one. */ + CLEARbit(evergreen->PA_CL_VTE_CNTL.u32All, VTX_XY_FMT_bit); + CLEARbit(evergreen->PA_CL_VTE_CNTL.u32All, VTX_Z_FMT_bit); + + SETbit(evergreen->PA_CL_VTE_CNTL.u32All, VTX_W0_FMT_bit); + + SETbit(evergreen->SPI_PS_IN_CONTROL_0.u32All, PERSP_GRADIENT_ENA_bit); + CLEARbit(evergreen->SPI_PS_IN_CONTROL_0.u32All, LINEAR_GRADIENT_ENA_bit); + + SETfield(evergreen->SPI_BARYC_CNTL.u32All, 1, + EG_SPI_BARYC_CNTL__PERSP_CENTROID_ENA_shift, + EG_SPI_BARYC_CNTL__PERSP_CENTROID_ENA_mask); + } + else + { + /* For orthogonal case. */ + SETbit(evergreen->PA_CL_VTE_CNTL.u32All, VTX_XY_FMT_bit); + SETbit(evergreen->PA_CL_VTE_CNTL.u32All, VTX_Z_FMT_bit); + + SETbit(evergreen->PA_CL_VTE_CNTL.u32All, VTX_W0_FMT_bit); + + CLEARbit(evergreen->SPI_PS_IN_CONTROL_0.u32All, PERSP_GRADIENT_ENA_bit); + SETbit(evergreen->SPI_PS_IN_CONTROL_0.u32All, LINEAR_GRADIENT_ENA_bit); + + SETfield(evergreen->SPI_BARYC_CNTL.u32All, 1, + EG_SPI_BARYC_CNTL__LINEAR_CENTROID_ENA_shift, + EG_SPI_BARYC_CNTL__LINEAR_CENTROID_ENA_mask); + } + + context->radeon.NewGLState |= new_state; +} + +static void evergreenSetAlphaState(GLcontext * ctx) //same +{ + context_t *context = EVERGREEN_CONTEXT(ctx); + EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); + uint32_t alpha_func = REF_ALWAYS; + GLboolean really_enabled = ctx->Color.AlphaEnabled; + + EVERGREEN_STATECHANGE(context, sx); + + switch (ctx->Color.AlphaFunc) { + case GL_NEVER: + alpha_func = REF_NEVER; + break; + case GL_LESS: + alpha_func = REF_LESS; + break; + case GL_EQUAL: + alpha_func = REF_EQUAL; + break; + case GL_LEQUAL: + alpha_func = REF_LEQUAL; + break; + case GL_GREATER: + alpha_func = REF_GREATER; + break; + case GL_NOTEQUAL: + alpha_func = REF_NOTEQUAL; + break; + case GL_GEQUAL: + alpha_func = REF_GEQUAL; + break; + case GL_ALWAYS: + /*alpha_func = REF_ALWAYS; */ + really_enabled = GL_FALSE; + break; + } + + if (really_enabled) { + SETfield(evergreen->SX_ALPHA_TEST_CONTROL.u32All, alpha_func, + ALPHA_FUNC_shift, ALPHA_FUNC_mask); + SETbit(evergreen->SX_ALPHA_TEST_CONTROL.u32All, ALPHA_TEST_ENABLE_bit); + evergreen->SX_ALPHA_REF.f32All = ctx->Color.AlphaRef; + } else { + CLEARbit(evergreen->SX_ALPHA_TEST_CONTROL.u32All, ALPHA_TEST_ENABLE_bit); + } +} + +static void evergreenAlphaFunc(GLcontext * ctx, GLenum func, GLfloat ref) //same +{ + (void)func; + (void)ref; + evergreenSetAlphaState(ctx); +} + +static void evergreenBlendColor(GLcontext * ctx, const GLfloat cf[4]) //same +{ + context_t *context = EVERGREEN_CONTEXT(ctx); + EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); + + EVERGREEN_STATECHANGE(context, cb); + + evergreen->CB_BLEND_RED.f32All = cf[0]; + evergreen->CB_BLEND_GREEN.f32All = cf[1]; + evergreen->CB_BLEND_BLUE.f32All = cf[2]; + evergreen->CB_BLEND_ALPHA.f32All = cf[3]; +} + +static int evergreenblend_factor(GLenum factor, GLboolean is_src) //same +{ + switch (factor) { + case GL_ZERO: + return BLEND_ZERO; + break; + case GL_ONE: + return BLEND_ONE; + break; + case GL_DST_COLOR: + return BLEND_DST_COLOR; + break; + case GL_ONE_MINUS_DST_COLOR: + return BLEND_ONE_MINUS_DST_COLOR; + break; + case GL_SRC_COLOR: + return BLEND_SRC_COLOR; + break; + case GL_ONE_MINUS_SRC_COLOR: + return BLEND_ONE_MINUS_SRC_COLOR; + break; + case GL_SRC_ALPHA: + return BLEND_SRC_ALPHA; + break; + case GL_ONE_MINUS_SRC_ALPHA: + return BLEND_ONE_MINUS_SRC_ALPHA; + break; + case GL_DST_ALPHA: + return BLEND_DST_ALPHA; + break; + case GL_ONE_MINUS_DST_ALPHA: + return BLEND_ONE_MINUS_DST_ALPHA; + break; + case GL_SRC_ALPHA_SATURATE: + return (is_src) ? BLEND_SRC_ALPHA_SATURATE : BLEND_ZERO; + break; + case GL_CONSTANT_COLOR: + return BLEND_CONSTANT_COLOR; + break; + case GL_ONE_MINUS_CONSTANT_COLOR: + return BLEND_ONE_MINUS_CONSTANT_COLOR; + break; + case GL_CONSTANT_ALPHA: + return BLEND_CONSTANT_ALPHA; + break; + case GL_ONE_MINUS_CONSTANT_ALPHA: + return BLEND_ONE_MINUS_CONSTANT_ALPHA; + break; + default: + fprintf(stderr, "unknown blend factor %x\n", factor); + return (is_src) ? BLEND_ONE : BLEND_ZERO; + break; + } +} + +static void evergreenSetBlendState(GLcontext * ctx) //diff : CB_COLOR_CONTROL, CB_BLEND0_CONTROL bits +{ + context_t *context = EVERGREEN_CONTEXT(ctx); + EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); + int id = 0; + uint32_t blend_reg = 0, eqn, eqnA; + + EVERGREEN_STATECHANGE(context, cb); + + if (RGBA_LOGICOP_ENABLED(ctx) || !ctx->Color.BlendEnabled) { + SETfield(blend_reg, + BLEND_ONE, COLOR_SRCBLEND_shift, COLOR_SRCBLEND_mask); + SETfield(blend_reg, + BLEND_ZERO, COLOR_DESTBLEND_shift, COLOR_DESTBLEND_mask); + SETfield(blend_reg, + COMB_DST_PLUS_SRC, COLOR_COMB_FCN_shift, COLOR_COMB_FCN_mask); + SETfield(blend_reg, + BLEND_ONE, ALPHA_SRCBLEND_shift, ALPHA_SRCBLEND_mask); + SETfield(blend_reg, + BLEND_ZERO, ALPHA_DESTBLEND_shift, ALPHA_DESTBLEND_mask); + SETfield(blend_reg, + COMB_DST_PLUS_SRC, ALPHA_COMB_FCN_shift, ALPHA_COMB_FCN_mask); + //if (context->radeon.radeonScreen->chip_family == CHIP_FAMILY_R600) + // evergreen->CB_BLEND_CONTROL.u32All = blend_reg; + //else + evergreen->CB_BLEND0_CONTROL.u32All = blend_reg; + return; + } + + SETfield(blend_reg, + evergreenblend_factor(ctx->Color.BlendSrcRGB, GL_TRUE), + COLOR_SRCBLEND_shift, COLOR_SRCBLEND_mask); + SETfield(blend_reg, + evergreenblend_factor(ctx->Color.BlendDstRGB, GL_FALSE), + COLOR_DESTBLEND_shift, COLOR_DESTBLEND_mask); + + switch (ctx->Color.BlendEquationRGB) { + case GL_FUNC_ADD: + eqn = COMB_DST_PLUS_SRC; + break; + case GL_FUNC_SUBTRACT: + eqn = COMB_SRC_MINUS_DST; + break; + case GL_FUNC_REVERSE_SUBTRACT: + eqn = COMB_DST_MINUS_SRC; + break; + case GL_MIN: + eqn = COMB_MIN_DST_SRC; + SETfield(blend_reg, + BLEND_ONE, + COLOR_SRCBLEND_shift, COLOR_SRCBLEND_mask); + SETfield(blend_reg, + BLEND_ONE, + COLOR_DESTBLEND_shift, COLOR_DESTBLEND_mask); + break; + case GL_MAX: + eqn = COMB_MAX_DST_SRC; + SETfield(blend_reg, + BLEND_ONE, + COLOR_SRCBLEND_shift, COLOR_SRCBLEND_mask); + SETfield(blend_reg, + BLEND_ONE, + COLOR_DESTBLEND_shift, COLOR_DESTBLEND_mask); + break; + + default: + fprintf(stderr, + "[%s:%u] Invalid RGB blend equation (0x%04x).\n", + __FUNCTION__, __LINE__, ctx->Color.BlendEquationRGB); + return; + } + SETfield(blend_reg, + eqn, COLOR_COMB_FCN_shift, COLOR_COMB_FCN_mask); + + SETfield(blend_reg, + evergreenblend_factor(ctx->Color.BlendSrcA, GL_TRUE), + ALPHA_SRCBLEND_shift, ALPHA_SRCBLEND_mask); + SETfield(blend_reg, + evergreenblend_factor(ctx->Color.BlendDstA, GL_FALSE), + ALPHA_DESTBLEND_shift, ALPHA_DESTBLEND_mask); + + switch (ctx->Color.BlendEquationA) { + case GL_FUNC_ADD: + eqnA = COMB_DST_PLUS_SRC; + break; + case GL_FUNC_SUBTRACT: + eqnA = COMB_SRC_MINUS_DST; + break; + case GL_FUNC_REVERSE_SUBTRACT: + eqnA = COMB_DST_MINUS_SRC; + break; + case GL_MIN: + eqnA = COMB_MIN_DST_SRC; + SETfield(blend_reg, + BLEND_ONE, + ALPHA_SRCBLEND_shift, ALPHA_SRCBLEND_mask); + SETfield(blend_reg, + BLEND_ONE, + ALPHA_DESTBLEND_shift, ALPHA_DESTBLEND_mask); + break; + case GL_MAX: + eqnA = COMB_MAX_DST_SRC; + SETfield(blend_reg, + BLEND_ONE, + ALPHA_SRCBLEND_shift, ALPHA_SRCBLEND_mask); + SETfield(blend_reg, + BLEND_ONE, + ALPHA_DESTBLEND_shift, ALPHA_DESTBLEND_mask); + break; + default: + fprintf(stderr, + "[%s:%u] Invalid A blend equation (0x%04x).\n", + __FUNCTION__, __LINE__, ctx->Color.BlendEquationA); + return; + } + + SETfield(blend_reg, + eqnA, ALPHA_COMB_FCN_shift, ALPHA_COMB_FCN_mask); + + SETbit(blend_reg, SEPARATE_ALPHA_BLEND_bit); + + SETbit(blend_reg, EG_CB_BLENDX_CONTROL_ENABLE_bit); + + evergreen->CB_BLEND0_CONTROL.u32All = blend_reg; +} + +static void evergreenBlendEquationSeparate(GLcontext * ctx, + GLenum modeRGB, GLenum modeA) //same +{ + evergreenSetBlendState(ctx); +} + +static void evergreenBlendFuncSeparate(GLcontext * ctx, + GLenum sfactorRGB, GLenum dfactorRGB, + GLenum sfactorA, GLenum dfactorA) //same +{ + evergreenSetBlendState(ctx); +} + +static GLuint evergreen_translate_logicop(GLenum logicop) //same +{ + switch (logicop) { + case GL_CLEAR: + return 0x00; + case GL_SET: + return 0xff; + case GL_COPY: + return 0xcc; + case GL_COPY_INVERTED: + return 0x33; + case GL_NOOP: + return 0xaa; + case GL_INVERT: + return 0x55; + case GL_AND: + return 0x88; + case GL_NAND: + return 0x77; + case GL_OR: + return 0xee; + case GL_NOR: + return 0x11; + case GL_XOR: + return 0x66; + case GL_EQUIV: + return 0x99; + case GL_AND_REVERSE: + return 0x44; + case GL_AND_INVERTED: + return 0x22; + case GL_OR_REVERSE: + return 0xdd; + case GL_OR_INVERTED: + return 0xbb; + default: + fprintf(stderr, "unknown blend logic operation %x\n", logicop); + return 0xcc; + } +} + +static void evergreenSetLogicOpState(GLcontext *ctx) //diff : CB_COLOR_CONTROL.ROP3 is actually same bits. +{ + context_t *context = EVERGREEN_CONTEXT(ctx); + EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); + + EVERGREEN_STATECHANGE(context, cb); + + if (RGBA_LOGICOP_ENABLED(ctx)) + SETfield(evergreen->CB_COLOR_CONTROL.u32All, + evergreen_translate_logicop(ctx->Color.LogicOp), + EG_CB_COLOR_CONTROL__ROP3_shift, + EG_CB_COLOR_CONTROL__ROP3_mask); + else + SETfield(evergreen->CB_COLOR_CONTROL.u32All, 0xCC, + EG_CB_COLOR_CONTROL__ROP3_shift, + EG_CB_COLOR_CONTROL__ROP3_mask); +} + +static void evergreenClipPlane( GLcontext *ctx, GLenum plane, const GLfloat *eq ) //same , but PA_CL_UCP_0_ offset diff +{ + context_t *context = EVERGREEN_CONTEXT(ctx); + EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); + GLint p; + GLint *ip; + + p = (GLint) plane - (GLint) GL_CLIP_PLANE0; + ip = (GLint *)ctx->Transform._ClipUserPlane[p]; + + EVERGREEN_STATECHANGE(context, pa); + + evergreen->ucp[p].PA_CL_UCP_0_X.u32All = ip[0]; + evergreen->ucp[p].PA_CL_UCP_0_Y.u32All = ip[1]; + evergreen->ucp[p].PA_CL_UCP_0_Z.u32All = ip[2]; + evergreen->ucp[p].PA_CL_UCP_0_W.u32All = ip[3]; +} + +static void evergreenSetClipPlaneState(GLcontext * ctx, GLenum cap, GLboolean state) //diff in func calls +{ + context_t *context = EVERGREEN_CONTEXT(ctx); + EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); + GLuint p; + + p = cap - GL_CLIP_PLANE0; + + EVERGREEN_STATECHANGE(context, pa); + + if (state) { + evergreen->PA_CL_CLIP_CNTL.u32All |= (UCP_ENA_0_bit << p); + evergreen->ucp[p].enabled = GL_TRUE; + evergreenClipPlane(ctx, cap, NULL); + } else { + evergreen->PA_CL_CLIP_CNTL.u32All &= ~(UCP_ENA_0_bit << p); + evergreen->ucp[p].enabled = GL_FALSE; + } +} + +static void evergreenSetDBRenderState(GLcontext * ctx) +{ + context_t *context = EVERGREEN_CONTEXT(ctx); + EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); + struct evergreen_fragment_program *fp = + (struct evergreen_fragment_program *)(ctx->FragmentProgram._Current); + + EVERGREEN_STATECHANGE(context, db); + + SETbit(evergreen->DB_SHADER_CONTROL.u32All, + DUAL_EXPORT_ENABLE_bit); + SETfield(evergreen->DB_SHADER_CONTROL.u32All, EARLY_Z_THEN_LATE_Z, + Z_ORDER_shift, + Z_ORDER_mask); + /* XXX need to enable htile for hiz/s */ + SETfield(evergreen->DB_RENDER_OVERRIDE.u32All, FORCE_DISABLE, + FORCE_HIZ_ENABLE_shift, + FORCE_HIZ_ENABLE_mask); + SETfield(evergreen->DB_RENDER_OVERRIDE.u32All, FORCE_DISABLE, + FORCE_HIS_ENABLE0_shift, + FORCE_HIS_ENABLE0_mask); + SETfield(evergreen->DB_RENDER_OVERRIDE.u32All, FORCE_DISABLE, + FORCE_HIS_ENABLE1_shift, + FORCE_HIS_ENABLE1_mask); + + if (context->radeon.query.current) + { + SETbit(evergreen->DB_RENDER_OVERRIDE.u32All, NOOP_CULL_DISABLE_bit); + SETbit(evergreen->DB_COUNT_CONTROL.u32All, + EG_DB_COUNT_CONTROL__PERFECT_ZPASS_COUNTS_bit); + } + else + { + CLEARbit(evergreen->DB_RENDER_OVERRIDE.u32All, NOOP_CULL_DISABLE_bit); + CLEARbit(evergreen->DB_COUNT_CONTROL.u32All, + EG_DB_COUNT_CONTROL__PERFECT_ZPASS_COUNTS_bit); + } + + if (fp) + { + if (fp->r700Shader.killIsUsed) + { + SETbit(evergreen->DB_SHADER_CONTROL.u32All, KILL_ENABLE_bit); + } + else + { + CLEARbit(evergreen->DB_SHADER_CONTROL.u32All, KILL_ENABLE_bit); + } + + if (fp->r700Shader.depthIsExported) + { + SETbit(evergreen->DB_SHADER_CONTROL.u32All, Z_EXPORT_ENABLE_bit); + } + else + { + CLEARbit(evergreen->DB_SHADER_CONTROL.u32All, Z_EXPORT_ENABLE_bit); + } + } +} + +void evergreenUpdateShaderStates(GLcontext * ctx) +{ + evergreenSetDBRenderState(ctx); + evergreenUpdateTextureState(ctx); +} + +static void evergreenSetDepthState(GLcontext * ctx) //same +{ + context_t *context = EVERGREEN_CONTEXT(ctx); + EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); + + EVERGREEN_STATECHANGE(context, db); + + if (ctx->Depth.Test) + { + SETbit(evergreen->DB_DEPTH_CONTROL.u32All, Z_ENABLE_bit); + if (ctx->Depth.Mask) + { + SETbit(evergreen->DB_DEPTH_CONTROL.u32All, Z_WRITE_ENABLE_bit); + } + else + { + CLEARbit(evergreen->DB_DEPTH_CONTROL.u32All, Z_WRITE_ENABLE_bit); + } + + switch (ctx->Depth.Func) + { + case GL_NEVER: + SETfield(evergreen->DB_DEPTH_CONTROL.u32All, FRAG_NEVER, + ZFUNC_shift, ZFUNC_mask); + break; + case GL_LESS: + SETfield(evergreen->DB_DEPTH_CONTROL.u32All, FRAG_LESS, + ZFUNC_shift, ZFUNC_mask); + break; + case GL_EQUAL: + SETfield(evergreen->DB_DEPTH_CONTROL.u32All, FRAG_EQUAL, + ZFUNC_shift, ZFUNC_mask); + break; + case GL_LEQUAL: + SETfield(evergreen->DB_DEPTH_CONTROL.u32All, FRAG_LEQUAL, + ZFUNC_shift, ZFUNC_mask); + break; + case GL_GREATER: + SETfield(evergreen->DB_DEPTH_CONTROL.u32All, FRAG_GREATER, + ZFUNC_shift, ZFUNC_mask); + break; + case GL_NOTEQUAL: + SETfield(evergreen->DB_DEPTH_CONTROL.u32All, FRAG_NOTEQUAL, + ZFUNC_shift, ZFUNC_mask); + break; + case GL_GEQUAL: + SETfield(evergreen->DB_DEPTH_CONTROL.u32All, FRAG_GEQUAL, + ZFUNC_shift, ZFUNC_mask); + break; + case GL_ALWAYS: + SETfield(evergreen->DB_DEPTH_CONTROL.u32All, FRAG_ALWAYS, + ZFUNC_shift, ZFUNC_mask); + break; + default: + SETfield(evergreen->DB_DEPTH_CONTROL.u32All, FRAG_ALWAYS, + ZFUNC_shift, ZFUNC_mask); + break; + } + } + else + { + CLEARbit(evergreen->DB_DEPTH_CONTROL.u32All, Z_ENABLE_bit); + CLEARbit(evergreen->DB_DEPTH_CONTROL.u32All, Z_WRITE_ENABLE_bit); + } +} + +static void evergreenSetStencilState(GLcontext * ctx, GLboolean state) //same +{ + context_t *context = EVERGREEN_CONTEXT(ctx); + EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); + GLboolean hw_stencil = GL_FALSE; + + if (ctx->DrawBuffer) { + struct radeon_renderbuffer *rrbStencil + = radeon_get_renderbuffer(ctx->DrawBuffer, BUFFER_STENCIL); + hw_stencil = (rrbStencil && rrbStencil->bo); + } + + if (hw_stencil) { + EVERGREEN_STATECHANGE(context, db); + if (state) { + SETbit(evergreen->DB_DEPTH_CONTROL.u32All, STENCIL_ENABLE_bit); + SETbit(evergreen->DB_DEPTH_CONTROL.u32All, BACKFACE_ENABLE_bit); + } else + CLEARbit(evergreen->DB_DEPTH_CONTROL.u32All, STENCIL_ENABLE_bit); + } +} + +static void evergreenUpdateCulling(GLcontext * ctx) //same +{ + context_t *context = EVERGREEN_CONTEXT(ctx); + EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); + + EVERGREEN_STATECHANGE(context, pa); + + CLEARbit(evergreen->PA_SU_SC_MODE_CNTL.u32All, FACE_bit); + CLEARbit(evergreen->PA_SU_SC_MODE_CNTL.u32All, CULL_FRONT_bit); + CLEARbit(evergreen->PA_SU_SC_MODE_CNTL.u32All, CULL_BACK_bit); + + if (ctx->Polygon.CullFlag) + { + switch (ctx->Polygon.CullFaceMode) + { + case GL_FRONT: + SETbit(evergreen->PA_SU_SC_MODE_CNTL.u32All, CULL_FRONT_bit); + CLEARbit(evergreen->PA_SU_SC_MODE_CNTL.u32All, CULL_BACK_bit); + break; + case GL_BACK: + CLEARbit(evergreen->PA_SU_SC_MODE_CNTL.u32All, CULL_FRONT_bit); + SETbit(evergreen->PA_SU_SC_MODE_CNTL.u32All, CULL_BACK_bit); + break; + case GL_FRONT_AND_BACK: + SETbit(evergreen->PA_SU_SC_MODE_CNTL.u32All, CULL_FRONT_bit); + SETbit(evergreen->PA_SU_SC_MODE_CNTL.u32All, CULL_BACK_bit); + break; + default: + CLEARbit(evergreen->PA_SU_SC_MODE_CNTL.u32All, CULL_FRONT_bit); + CLEARbit(evergreen->PA_SU_SC_MODE_CNTL.u32All, CULL_BACK_bit); + break; + } + } + + switch (ctx->Polygon.FrontFace) + { + case GL_CW: + SETbit(evergreen->PA_SU_SC_MODE_CNTL.u32All, FACE_bit); + break; + case GL_CCW: + CLEARbit(evergreen->PA_SU_SC_MODE_CNTL.u32All, FACE_bit); + break; + default: + CLEARbit(evergreen->PA_SU_SC_MODE_CNTL.u32All, FACE_bit); /* default: ccw */ + break; + } + + /* Winding is inverted when rendering to FBO */ + if (ctx->DrawBuffer && ctx->DrawBuffer->Name) + evergreen->PA_SU_SC_MODE_CNTL.u32All ^= FACE_bit; +} + +static void evergreenSetPolygonOffsetState(GLcontext * ctx, GLboolean state) //same +{ + context_t *context = EVERGREEN_CONTEXT(ctx); + EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); + + EVERGREEN_STATECHANGE(context, pa); + + if (state) { + SETbit(evergreen->PA_SU_SC_MODE_CNTL.u32All, POLY_OFFSET_FRONT_ENABLE_bit); + SETbit(evergreen->PA_SU_SC_MODE_CNTL.u32All, POLY_OFFSET_BACK_ENABLE_bit); + SETbit(evergreen->PA_SU_SC_MODE_CNTL.u32All, POLY_OFFSET_PARA_ENABLE_bit); + } else { + CLEARbit(evergreen->PA_SU_SC_MODE_CNTL.u32All, POLY_OFFSET_FRONT_ENABLE_bit); + CLEARbit(evergreen->PA_SU_SC_MODE_CNTL.u32All, POLY_OFFSET_BACK_ENABLE_bit); + CLEARbit(evergreen->PA_SU_SC_MODE_CNTL.u32All, POLY_OFFSET_PARA_ENABLE_bit); + } +} + +static void evergreenUpdateLineStipple(GLcontext * ctx) //diff +{ + /* TODO */ +} + +void evergreenSetScissor(context_t *context) //diff +{ + EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); + unsigned x1, y1, x2, y2; + int id = 0; + struct radeon_renderbuffer *rrb; + + rrb = radeon_get_colorbuffer(&context->radeon); + if (!rrb || !rrb->bo) { + return; + } + if (context->radeon.state.scissor.enabled) { + x1 = context->radeon.state.scissor.rect.x1; + y1 = context->radeon.state.scissor.rect.y1; + x2 = context->radeon.state.scissor.rect.x2; + y2 = context->radeon.state.scissor.rect.y2; + /* r600 has exclusive BR scissors */ + if (context->radeon.radeonScreen->kernel_mm) { + x2++; + y2++; + } + } else { + if (context->radeon.radeonScreen->driScreen->dri2.enabled) { + x1 = 0; + y1 = 0; + x2 = rrb->base.Width; + y2 = rrb->base.Height; + } else { + x1 = rrb->dPriv->x; + y1 = rrb->dPriv->y; + x2 = rrb->dPriv->x + rrb->dPriv->w; + y2 = rrb->dPriv->y + rrb->dPriv->h; + } + } + + EVERGREEN_STATECHANGE(context, pa); + + /* screen */ + /* TODO : check WINDOW_OFFSET_DISABLE */ + //SETbit(evergreen->PA_SC_SCREEN_SCISSOR_TL.u32All, WINDOW_OFFSET_DISABLE_bit); + SETfield(evergreen->PA_SC_SCREEN_SCISSOR_TL.u32All, x1, + PA_SC_SCREEN_SCISSOR_TL__TL_X_shift, EG_PA_SC_SCREEN_SCISSOR_TL__TL_X_mask); + SETfield(evergreen->PA_SC_SCREEN_SCISSOR_TL.u32All, y1, + PA_SC_SCREEN_SCISSOR_TL__TL_Y_shift, EG_PA_SC_SCREEN_SCISSOR_TL__TL_Y_mask); + + SETfield(evergreen->PA_SC_SCREEN_SCISSOR_BR.u32All, x2, + PA_SC_SCREEN_SCISSOR_BR__BR_X_shift, EG_PA_SC_SCREEN_SCISSOR_BR__BR_X_mask); + SETfield(evergreen->PA_SC_SCREEN_SCISSOR_BR.u32All, y2, + PA_SC_SCREEN_SCISSOR_BR__BR_Y_shift, EG_PA_SC_SCREEN_SCISSOR_BR__BR_Y_mask); + + /* window */ + SETbit(evergreen->PA_SC_WINDOW_SCISSOR_TL.u32All, WINDOW_OFFSET_DISABLE_bit); + SETfield(evergreen->PA_SC_WINDOW_SCISSOR_TL.u32All, x1, + PA_SC_WINDOW_SCISSOR_TL__TL_X_shift, EG_PA_SC_WINDOW_SCISSOR_TL__TL_X_mask); + SETfield(evergreen->PA_SC_WINDOW_SCISSOR_TL.u32All, y1, + PA_SC_WINDOW_SCISSOR_TL__TL_Y_shift, EG_PA_SC_WINDOW_SCISSOR_TL__TL_Y_mask); + + SETfield(evergreen->PA_SC_WINDOW_SCISSOR_BR.u32All, x2, + PA_SC_WINDOW_SCISSOR_BR__BR_X_shift, EG_PA_SC_WINDOW_SCISSOR_BR__BR_X_mask); + SETfield(evergreen->PA_SC_WINDOW_SCISSOR_BR.u32All, y2, + PA_SC_WINDOW_SCISSOR_BR__BR_Y_shift, EG_PA_SC_WINDOW_SCISSOR_BR__BR_Y_mask); + + + SETfield(evergreen->PA_SC_CLIPRECT_0_TL.u32All, x1, + PA_SC_CLIPRECT_0_TL__TL_X_shift, EG_PA_SC_CLIPRECT_0_TL__TL_X_mask); + SETfield(evergreen->PA_SC_CLIPRECT_0_TL.u32All, y1, + PA_SC_CLIPRECT_0_TL__TL_Y_shift, EG_PA_SC_CLIPRECT_0_TL__TL_Y_mask); + SETfield(evergreen->PA_SC_CLIPRECT_0_BR.u32All, x2, + PA_SC_CLIPRECT_0_BR__BR_X_shift, EG_PA_SC_CLIPRECT_0_BR__BR_X_mask); + SETfield(evergreen->PA_SC_CLIPRECT_0_BR.u32All, y2, + PA_SC_CLIPRECT_0_BR__BR_Y_shift, EG_PA_SC_CLIPRECT_0_BR__BR_Y_mask); + + evergreen->PA_SC_CLIPRECT_1_TL.u32All = evergreen->PA_SC_CLIPRECT_0_TL.u32All; + evergreen->PA_SC_CLIPRECT_1_BR.u32All = evergreen->PA_SC_CLIPRECT_0_BR.u32All; + evergreen->PA_SC_CLIPRECT_2_TL.u32All = evergreen->PA_SC_CLIPRECT_0_TL.u32All; + evergreen->PA_SC_CLIPRECT_2_BR.u32All = evergreen->PA_SC_CLIPRECT_0_BR.u32All; + evergreen->PA_SC_CLIPRECT_3_TL.u32All = evergreen->PA_SC_CLIPRECT_0_TL.u32All; + evergreen->PA_SC_CLIPRECT_3_BR.u32All = evergreen->PA_SC_CLIPRECT_0_BR.u32All; + + /* more....2d clip */ + SETbit(evergreen->PA_SC_GENERIC_SCISSOR_TL.u32All, WINDOW_OFFSET_DISABLE_bit); + SETfield(evergreen->PA_SC_GENERIC_SCISSOR_TL.u32All, x1, + PA_SC_GENERIC_SCISSOR_TL__TL_X_shift, EG_PA_SC_GENERIC_SCISSOR_TL__TL_X_mask); + SETfield(evergreen->PA_SC_GENERIC_SCISSOR_TL.u32All, y1, + PA_SC_GENERIC_SCISSOR_TL__TL_Y_shift, EG_PA_SC_GENERIC_SCISSOR_TL__TL_Y_mask); + SETfield(evergreen->PA_SC_GENERIC_SCISSOR_BR.u32All, x2, + PA_SC_GENERIC_SCISSOR_BR__BR_X_shift, EG_PA_SC_GENERIC_SCISSOR_BR__BR_X_mask); + SETfield(evergreen->PA_SC_GENERIC_SCISSOR_BR.u32All, y2, + PA_SC_GENERIC_SCISSOR_BR__BR_Y_shift, EG_PA_SC_GENERIC_SCISSOR_BR__BR_Y_mask); + + SETbit(evergreen->viewport[id].PA_SC_VPORT_SCISSOR_0_TL.u32All, WINDOW_OFFSET_DISABLE_bit); + SETfield(evergreen->viewport[id].PA_SC_VPORT_SCISSOR_0_TL.u32All, x1, + PA_SC_VPORT_SCISSOR_0_TL__TL_X_shift, EG_PA_SC_VPORT_SCISSOR_0_TL__TL_X_mask); + SETfield(evergreen->viewport[id].PA_SC_VPORT_SCISSOR_0_TL.u32All, y1, + PA_SC_VPORT_SCISSOR_0_TL__TL_Y_shift, EG_PA_SC_VPORT_SCISSOR_0_TL__TL_Y_mask); + SETfield(evergreen->viewport[id].PA_SC_VPORT_SCISSOR_0_BR.u32All, x2, + PA_SC_VPORT_SCISSOR_0_BR__BR_X_shift, EG_PA_SC_VPORT_SCISSOR_0_BR__BR_X_mask); + SETfield(evergreen->viewport[id].PA_SC_VPORT_SCISSOR_0_BR.u32All, y2, + PA_SC_VPORT_SCISSOR_0_BR__BR_Y_shift, EG_PA_SC_VPORT_SCISSOR_0_BR__BR_Y_mask); + + id = 1; + SETbit(evergreen->viewport[id].PA_SC_VPORT_SCISSOR_0_TL.u32All, WINDOW_OFFSET_DISABLE_bit); + SETfield(evergreen->viewport[id].PA_SC_VPORT_SCISSOR_0_TL.u32All, x1, + PA_SC_VPORT_SCISSOR_0_TL__TL_X_shift, EG_PA_SC_VPORT_SCISSOR_0_TL__TL_X_mask); + SETfield(evergreen->viewport[id].PA_SC_VPORT_SCISSOR_0_TL.u32All, y1, + PA_SC_VPORT_SCISSOR_0_TL__TL_Y_shift, EG_PA_SC_VPORT_SCISSOR_0_TL__TL_Y_mask); + SETfield(evergreen->viewport[id].PA_SC_VPORT_SCISSOR_0_BR.u32All, x2, + PA_SC_VPORT_SCISSOR_0_BR__BR_X_shift, EG_PA_SC_VPORT_SCISSOR_0_BR__BR_X_mask); + SETfield(evergreen->viewport[id].PA_SC_VPORT_SCISSOR_0_BR.u32All, y2, + PA_SC_VPORT_SCISSOR_0_BR__BR_Y_shift, EG_PA_SC_VPORT_SCISSOR_0_BR__BR_Y_mask); + + evergreen->viewport[id].enabled = GL_TRUE; +} + +static void evergreenUpdateWindow(GLcontext * ctx, int id) //diff in calling evergreenSetScissor +{ + context_t *context = EVERGREEN_CONTEXT(ctx); + EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); + __DRIdrawable *dPriv = radeon_get_drawable(&context->radeon); + GLfloat xoffset = dPriv ? (GLfloat) dPriv->x : 0; + GLfloat yoffset = dPriv ? (GLfloat) dPriv->y + dPriv->h : 0; + const GLfloat *v = ctx->Viewport._WindowMap.m; + const GLfloat depthScale = 1.0F / ctx->DrawBuffer->_DepthMaxF; + const GLboolean render_to_fbo = (ctx->DrawBuffer->Name != 0); + GLfloat y_scale, y_bias; + + if (render_to_fbo) { + y_scale = 1.0; + y_bias = 0; + } else { + y_scale = -1.0; + y_bias = yoffset; + } + + GLfloat sx = v[MAT_SX]; + GLfloat tx = v[MAT_TX] + xoffset; + GLfloat sy = v[MAT_SY] * y_scale; + GLfloat ty = (v[MAT_TY] * y_scale) + y_bias; + GLfloat sz = v[MAT_SZ] * depthScale; + GLfloat tz = v[MAT_TZ] * depthScale; + + EVERGREEN_STATECHANGE(context, pa); + + + evergreen->viewport[id].PA_CL_VPORT_XSCALE.f32All = sx; + evergreen->viewport[id].PA_CL_VPORT_XOFFSET.f32All = tx; + + evergreen->viewport[id].PA_CL_VPORT_YSCALE.f32All = sy; + evergreen->viewport[id].PA_CL_VPORT_YOFFSET.f32All = ty; + + evergreen->viewport[id].PA_CL_VPORT_ZSCALE.f32All = sz; + evergreen->viewport[id].PA_CL_VPORT_ZOFFSET.f32All = tz; + + if (ctx->Transform.DepthClamp) { + evergreen->viewport[id].PA_SC_VPORT_ZMIN_0.f32All = MIN2(ctx->Viewport.Near, ctx->Viewport.Far); + evergreen->viewport[id].PA_SC_VPORT_ZMAX_0.f32All = MAX2(ctx->Viewport.Near, ctx->Viewport.Far); + SETbit(evergreen->PA_CL_CLIP_CNTL.u32All, ZCLIP_NEAR_DISABLE_bit); + SETbit(evergreen->PA_CL_CLIP_CNTL.u32All, ZCLIP_FAR_DISABLE_bit); + } else { + evergreen->viewport[id].PA_SC_VPORT_ZMIN_0.f32All = 0.0; + evergreen->viewport[id].PA_SC_VPORT_ZMAX_0.f32All = 1.0; + CLEARbit(evergreen->PA_CL_CLIP_CNTL.u32All, ZCLIP_NEAR_DISABLE_bit); + CLEARbit(evergreen->PA_CL_CLIP_CNTL.u32All, ZCLIP_FAR_DISABLE_bit); + } + + evergreen->viewport[id].enabled = GL_TRUE; + + evergreenSetScissor(context); +} + +static void evergreenEnable(GLcontext * ctx, GLenum cap, GLboolean state) //diff in func calls +{ + context_t *context = EVERGREEN_CONTEXT(ctx); + + switch (cap) { + case GL_TEXTURE_1D: + case GL_TEXTURE_2D: + case GL_TEXTURE_3D: + /* empty */ + break; + case GL_FOG: + /* empty */ + break; + case GL_ALPHA_TEST: + evergreenSetAlphaState(ctx); + break; + case GL_COLOR_LOGIC_OP: + evergreenSetLogicOpState(ctx); + /* fall-through, because logic op overrides blending */ + case GL_BLEND: + evergreenSetBlendState(ctx); + break; + case GL_CLIP_PLANE0: + case GL_CLIP_PLANE1: + case GL_CLIP_PLANE2: + case GL_CLIP_PLANE3: + case GL_CLIP_PLANE4: + case GL_CLIP_PLANE5: + evergreenSetClipPlaneState(ctx, cap, state); + break; + case GL_DEPTH_TEST: + evergreenSetDepthState(ctx); + break; + case GL_STENCIL_TEST: + evergreenSetStencilState(ctx, state); + break; + case GL_CULL_FACE: + evergreenUpdateCulling(ctx); + break; + case GL_POLYGON_OFFSET_POINT: + case GL_POLYGON_OFFSET_LINE: + case GL_POLYGON_OFFSET_FILL: + evergreenSetPolygonOffsetState(ctx, state); + break; + case GL_SCISSOR_TEST: + radeon_firevertices(&context->radeon); + context->radeon.state.scissor.enabled = state; + radeonUpdateScissor(ctx); + break; + case GL_LINE_STIPPLE: + evergreenUpdateLineStipple(ctx); + break; + case GL_DEPTH_CLAMP: + evergreenUpdateWindow(ctx, 0); + break; + default: + break; + } + +} + +static void evergreenColorMask(GLcontext * ctx, + GLboolean r, GLboolean g, GLboolean b, GLboolean a) //same +{ + context_t *context = EVERGREEN_CONTEXT(ctx); + EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); + unsigned int mask = ((r ? 1 : 0) | + (g ? 2 : 0) | + (b ? 4 : 0) | + (a ? 8 : 0)); + + if (mask != evergreen->CB_TARGET_MASK.u32All) { + EVERGREEN_STATECHANGE(context, cb); + SETfield(evergreen->CB_TARGET_MASK.u32All, mask, TARGET0_ENABLE_shift, TARGET0_ENABLE_mask); + } +} + +static void evergreenDepthFunc(GLcontext * ctx, GLenum func) //same +{ + evergreenSetDepthState(ctx); +} + +static void evergreenDepthMask(GLcontext * ctx, GLboolean mask) //same +{ + evergreenSetDepthState(ctx); +} + +static void evergreenCullFace(GLcontext * ctx, GLenum mode) //same +{ + evergreenUpdateCulling(ctx); +} + +static void evergreenFogfv(GLcontext * ctx, GLenum pname, const GLfloat * param) //same +{ +} + +static void evergreenUpdatePolygonMode(GLcontext * ctx) //same +{ + context_t *context = EVERGREEN_CONTEXT(ctx); + EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); + + EVERGREEN_STATECHANGE(context, pa); + + SETfield(evergreen->PA_SU_SC_MODE_CNTL.u32All, X_DISABLE_POLY_MODE, POLY_MODE_shift, POLY_MODE_mask); + + /* Only do something if a polygon mode is wanted, default is GL_FILL */ + if (ctx->Polygon.FrontMode != GL_FILL || + ctx->Polygon.BackMode != GL_FILL) { + GLenum f, b; + + /* Handle GL_CW (clock wise and GL_CCW (counter clock wise) + * correctly by selecting the correct front and back face + */ + f = ctx->Polygon.FrontMode; + b = ctx->Polygon.BackMode; + + /* Enable polygon mode */ + SETfield(evergreen->PA_SU_SC_MODE_CNTL.u32All, X_DUAL_MODE, POLY_MODE_shift, POLY_MODE_mask); + + switch (f) { + case GL_LINE: + SETfield(evergreen->PA_SU_SC_MODE_CNTL.u32All, X_DRAW_LINES, + POLYMODE_FRONT_PTYPE_shift, POLYMODE_FRONT_PTYPE_mask); + break; + case GL_POINT: + SETfield(evergreen->PA_SU_SC_MODE_CNTL.u32All, X_DRAW_POINTS, + POLYMODE_FRONT_PTYPE_shift, POLYMODE_FRONT_PTYPE_mask); + break; + case GL_FILL: + SETfield(evergreen->PA_SU_SC_MODE_CNTL.u32All, X_DRAW_TRIANGLES, + POLYMODE_FRONT_PTYPE_shift, POLYMODE_FRONT_PTYPE_mask); + break; + } + + switch (b) { + case GL_LINE: + SETfield(evergreen->PA_SU_SC_MODE_CNTL.u32All, X_DRAW_LINES, + POLYMODE_BACK_PTYPE_shift, POLYMODE_BACK_PTYPE_mask); + break; + case GL_POINT: + SETfield(evergreen->PA_SU_SC_MODE_CNTL.u32All, X_DRAW_POINTS, + POLYMODE_BACK_PTYPE_shift, POLYMODE_BACK_PTYPE_mask); + break; + case GL_FILL: + SETfield(evergreen->PA_SU_SC_MODE_CNTL.u32All, X_DRAW_TRIANGLES, + POLYMODE_BACK_PTYPE_shift, POLYMODE_BACK_PTYPE_mask); + break; + } + } +} + +static void evergreenFrontFace(GLcontext * ctx, GLenum mode) //same +{ + evergreenUpdateCulling(ctx); + evergreenUpdatePolygonMode(ctx); +} + +static void evergreenShadeModel(GLcontext * ctx, GLenum mode) //same +{ + context_t *context = EVERGREEN_CONTEXT(ctx); + EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); + + EVERGREEN_STATECHANGE(context, spi); + + /* also need to set/clear FLAT_SHADE bit per param in SPI_PS_INPUT_CNTL_[0-31] */ + switch (mode) { + case GL_FLAT: + SETbit(evergreen->SPI_INTERP_CONTROL_0.u32All, FLAT_SHADE_ENA_bit); + break; + case GL_SMOOTH: + CLEARbit(evergreen->SPI_INTERP_CONTROL_0.u32All, FLAT_SHADE_ENA_bit); + break; + default: + return; + } +} + +static void evergreenLogicOpcode(GLcontext *ctx, GLenum logicop) //diff +{ + if (RGBA_LOGICOP_ENABLED(ctx)) + evergreenSetLogicOpState(ctx); +} + +static void evergreenPointSize(GLcontext * ctx, GLfloat size) //same +{ + context_t *context = EVERGREEN_CONTEXT(ctx); + EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); + + EVERGREEN_STATECHANGE(context, pa); + + /* We need to clamp to user defined range here, because + * the HW clamping happens only for per vertex point size. */ + size = CLAMP(size, ctx->Point.MinSize, ctx->Point.MaxSize); + + /* same size limits for AA, non-AA points */ + size = CLAMP(size, ctx->Const.MinPointSize, ctx->Const.MaxPointSize); + + /* format is 12.4 fixed point */ + SETfield(evergreen->PA_SU_POINT_SIZE.u32All, (int)(size * 8.0), + PA_SU_POINT_SIZE__HEIGHT_shift, PA_SU_POINT_SIZE__HEIGHT_mask); + SETfield(evergreen->PA_SU_POINT_SIZE.u32All, (int)(size * 8.0), + PA_SU_POINT_SIZE__WIDTH_shift, PA_SU_POINT_SIZE__WIDTH_mask); + +} + +static void evergreenPointParameter(GLcontext * ctx, GLenum pname, const GLfloat * param) //same +{ + context_t *context = EVERGREEN_CONTEXT(ctx); + EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); + + EVERGREEN_STATECHANGE(context, pa); + + /* format is 12.4 fixed point */ + switch (pname) { + case GL_POINT_SIZE_MIN: + SETfield(evergreen->PA_SU_POINT_MINMAX.u32All, (int)(ctx->Point.MinSize * 8.0), + MIN_SIZE_shift, MIN_SIZE_mask); + evergreenPointSize(ctx, ctx->Point.Size); + break; + case GL_POINT_SIZE_MAX: + SETfield(evergreen->PA_SU_POINT_MINMAX.u32All, (int)(ctx->Point.MaxSize * 8.0), + MAX_SIZE_shift, MAX_SIZE_mask); + evergreenPointSize(ctx, ctx->Point.Size); + break; + case GL_POINT_DISTANCE_ATTENUATION: + break; + case GL_POINT_FADE_THRESHOLD_SIZE: + break; + default: + break; + } +} + +static int evergreen_translate_stencil_func(int func) //same +{ + switch (func) { + case GL_NEVER: + return REF_NEVER; + case GL_LESS: + return REF_LESS; + case GL_EQUAL: + return REF_EQUAL; + case GL_LEQUAL: + return REF_LEQUAL; + case GL_GREATER: + return REF_GREATER; + case GL_NOTEQUAL: + return REF_NOTEQUAL; + case GL_GEQUAL: + return REF_GEQUAL; + case GL_ALWAYS: + return REF_ALWAYS; + } + return 0; +} + +static void evergreenStencilFuncSeparate(GLcontext * ctx, GLenum face, + GLenum func, GLint ref, GLuint mask) //same +{ + context_t *context = EVERGREEN_CONTEXT(ctx); + EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); + const unsigned back = ctx->Stencil._BackFace; + + + EVERGREEN_STATECHANGE(context, db); + + //front + SETfield(evergreen->DB_STENCILREFMASK.u32All, ctx->Stencil.Ref[0], + STENCILREF_shift, STENCILREF_mask); + SETfield(evergreen->DB_STENCILREFMASK.u32All, ctx->Stencil.ValueMask[0], + STENCILMASK_shift, STENCILMASK_mask); + + SETfield(evergreen->DB_DEPTH_CONTROL.u32All, evergreen_translate_stencil_func(ctx->Stencil.Function[0]), + STENCILFUNC_shift, STENCILFUNC_mask); + + //back + SETfield(evergreen->DB_STENCILREFMASK_BF.u32All, ctx->Stencil.Ref[back], + STENCILREF_BF_shift, STENCILREF_BF_mask); + SETfield(evergreen->DB_STENCILREFMASK_BF.u32All, ctx->Stencil.ValueMask[back], + STENCILMASK_BF_shift, STENCILMASK_BF_mask); + + SETfield(evergreen->DB_DEPTH_CONTROL.u32All, evergreen_translate_stencil_func(ctx->Stencil.Function[back]), + STENCILFUNC_BF_shift, STENCILFUNC_BF_mask); +} + +static void evergreenStencilMaskSeparate(GLcontext * ctx, GLenum face, GLuint mask) //same +{ + context_t *context = EVERGREEN_CONTEXT(ctx); + EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); + const unsigned back = ctx->Stencil._BackFace; + + EVERGREEN_STATECHANGE(context, db); + + // front + SETfield(evergreen->DB_STENCILREFMASK.u32All, ctx->Stencil.WriteMask[0], + STENCILWRITEMASK_shift, STENCILWRITEMASK_mask); + + // back + SETfield(evergreen->DB_STENCILREFMASK_BF.u32All, ctx->Stencil.WriteMask[back], + STENCILWRITEMASK_BF_shift, STENCILWRITEMASK_BF_mask); + +} + +static int evergreen_translate_stencil_op(int op) //same +{ + switch (op) { + case GL_KEEP: + return STENCIL_KEEP; + case GL_ZERO: + return STENCIL_ZERO; + case GL_REPLACE: + return STENCIL_REPLACE; + case GL_INCR: + return STENCIL_INCR_CLAMP; + case GL_DECR: + return STENCIL_DECR_CLAMP; + case GL_INCR_WRAP_EXT: + return STENCIL_INCR_WRAP; + case GL_DECR_WRAP_EXT: + return STENCIL_DECR_WRAP; + case GL_INVERT: + return STENCIL_INVERT; + default: + WARN_ONCE("Do not know how to translate stencil op"); + return STENCIL_KEEP; + } + return 0; +} + +static void evergreenStencilOpSeparate(GLcontext * ctx, GLenum face, + GLenum fail, GLenum zfail, GLenum zpass) //same +{ + context_t *context = EVERGREEN_CONTEXT(ctx); + EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); + const unsigned back = ctx->Stencil._BackFace; + + EVERGREEN_STATECHANGE(context, db); + + SETfield(evergreen->DB_DEPTH_CONTROL.u32All, evergreen_translate_stencil_op(ctx->Stencil.FailFunc[0]), + STENCILFAIL_shift, STENCILFAIL_mask); + SETfield(evergreen->DB_DEPTH_CONTROL.u32All, evergreen_translate_stencil_op(ctx->Stencil.ZFailFunc[0]), + STENCILZFAIL_shift, STENCILZFAIL_mask); + SETfield(evergreen->DB_DEPTH_CONTROL.u32All, evergreen_translate_stencil_op(ctx->Stencil.ZPassFunc[0]), + STENCILZPASS_shift, STENCILZPASS_mask); + + SETfield(evergreen->DB_DEPTH_CONTROL.u32All, evergreen_translate_stencil_op(ctx->Stencil.FailFunc[back]), + STENCILFAIL_BF_shift, STENCILFAIL_BF_mask); + SETfield(evergreen->DB_DEPTH_CONTROL.u32All, evergreen_translate_stencil_op(ctx->Stencil.ZFailFunc[back]), + STENCILZFAIL_BF_shift, STENCILZFAIL_BF_mask); + SETfield(evergreen->DB_DEPTH_CONTROL.u32All, evergreen_translate_stencil_op(ctx->Stencil.ZPassFunc[back]), + STENCILZPASS_BF_shift, STENCILZPASS_BF_mask); +} + +static void evergreenViewport(GLcontext * ctx, + GLint x, + GLint y, + GLsizei width, + GLsizei height) //diff in evergreenUpdateWindow +{ + evergreenUpdateWindow(ctx, 0); + + radeon_viewport(ctx, x, y, width, height); +} + +static void evergreenDepthRange(GLcontext * ctx, GLclampd nearval, GLclampd farval) //diff in evergreenUpdateWindow +{ + evergreenUpdateWindow(ctx, 0); +} + +static void evergreenLineWidth(GLcontext * ctx, GLfloat widthf) //same +{ + context_t *context = EVERGREEN_CONTEXT(ctx); + EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); + uint32_t lineWidth = (uint32_t)((widthf * 0.5) * (1 << 4)); + + EVERGREEN_STATECHANGE(context, pa); + + if (lineWidth > 0xFFFF) + lineWidth = 0xFFFF; + SETfield(evergreen->PA_SU_LINE_CNTL.u32All,(uint16_t)lineWidth, + PA_SU_LINE_CNTL__WIDTH_shift, PA_SU_LINE_CNTL__WIDTH_mask); +} + +static void evergreenLineStipple(GLcontext *ctx, GLint factor, GLushort pattern) //same +{ + context_t *context = EVERGREEN_CONTEXT(ctx); + EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); + + EVERGREEN_STATECHANGE(context, pa); + + SETfield(evergreen->PA_SC_LINE_STIPPLE.u32All, pattern, LINE_PATTERN_shift, LINE_PATTERN_mask); + SETfield(evergreen->PA_SC_LINE_STIPPLE.u32All, (factor-1), REPEAT_COUNT_shift, REPEAT_COUNT_mask); + SETfield(evergreen->PA_SC_LINE_STIPPLE.u32All, 1, AUTO_RESET_CNTL_shift, AUTO_RESET_CNTL_mask); +} + +static void evergreenPolygonOffset(GLcontext * ctx, GLfloat factor, GLfloat units) //diff : + //all register here offset diff, bits same +{ + context_t *context = EVERGREEN_CONTEXT(ctx); + EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); + GLfloat constant = units; + GLchar depth = 0; + + EVERGREEN_STATECHANGE(context, pa); + + switch (ctx->Visual.depthBits) { + case 16: + constant *= 4.0; + depth = -16; + break; + case 24: + constant *= 2.0; + depth = -24; + break; + } + + factor *= 12.0; + SETfield(evergreen->PA_SU_POLY_OFFSET_DB_FMT_CNTL.u32All, depth, + POLY_OFFSET_NEG_NUM_DB_BITS_shift, POLY_OFFSET_NEG_NUM_DB_BITS_mask); + //evergreen->PA_SU_POLY_OFFSET_CLAMP.f32All = constant; //??? + evergreen->PA_SU_POLY_OFFSET_FRONT_SCALE.f32All = factor; + evergreen->PA_SU_POLY_OFFSET_FRONT_OFFSET.f32All = constant; + evergreen->PA_SU_POLY_OFFSET_BACK_SCALE.f32All = factor; + evergreen->PA_SU_POLY_OFFSET_BACK_OFFSET.f32All = constant; +} + +static void evergreenPolygonMode(GLcontext * ctx, GLenum face, GLenum mode) //same +{ + (void)face; + (void)mode; + + evergreenUpdatePolygonMode(ctx); +} + +static void evergreenRenderMode(GLcontext * ctx, GLenum mode) //same +{ +} + +//TODO : move to kernel. +static void evergreenInitSQConfig(GLcontext * ctx) +{ + context_t *context = EVERGREEN_CONTEXT(ctx); + EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); + + uint32_t uSqNumCfInsts, uMaxGPRs, uMaxThreads, uMaxStackEntries, uPSThreadCount, uOtherThreadCount; + uint32_t NUM_PS_GPRS, NUM_VS_GPRS, NUM_GS_GPRS, NUM_ES_GPRS, NUM_HS_GPRS, NUM_LS_GPRS, NUM_CLAUSE_TEMP_GPRS; + GLboolean bVC_ENABLE = GL_TRUE; + + R600_STATECHANGE(context, sq); + + switch (context->radeon.radeonScreen->chip_family) + { + case CHIP_FAMILY_CEDAR: + uSqNumCfInsts = 1; + bVC_ENABLE = GL_FALSE; + uMaxGPRs = 256; + uPSThreadCount = 96; + uMaxThreads = 192; + uMaxStackEntries = 256; + break; + case CHIP_FAMILY_REDWOOD: + uSqNumCfInsts = 2; + bVC_ENABLE = GL_TRUE; + uMaxGPRs = 256; + uPSThreadCount = 128; + uMaxThreads = 248; + uMaxStackEntries = 256; + break; + case CHIP_FAMILY_JUNIPER: + uSqNumCfInsts = 2; + bVC_ENABLE = GL_TRUE; + uMaxGPRs = 256; + uPSThreadCount = 128; + uMaxThreads = 248; + uMaxStackEntries = 512; + break; + case CHIP_FAMILY_CYPRESS: + uSqNumCfInsts = 2; + bVC_ENABLE = GL_TRUE; + uMaxGPRs = 256; + uPSThreadCount = 128; + uMaxThreads = 248; + uMaxStackEntries = 512; + break; + case CHIP_FAMILY_HEMLOCK: + uSqNumCfInsts = 2;//? + bVC_ENABLE = GL_TRUE; + uMaxGPRs = 256; + uPSThreadCount = 128; + uMaxThreads = 248; + uMaxStackEntries = 512; + break; + default: + uSqNumCfInsts = 2; + bVC_ENABLE = GL_TRUE; + uMaxGPRs = 256; + uPSThreadCount = 128; + uMaxThreads = 248; + uMaxStackEntries = 512; + break; + } + + evergreen->evergreen_config.SQ_DYN_GPR_CNTL_PS_FLUSH_REQ.u32All = 0; + + evergreen->evergreen_config.SPI_CONFIG_CNTL.u32All = 0; + evergreen->evergreen_config.SPI_CONFIG_CNTL_1.u32All = 0; + SETfield(evergreen->evergreen_config.SPI_CONFIG_CNTL_1.u32All, 4, + EG_SPI_CONFIG_CNTL_1__VTX_DONE_DELAY_shift, + EG_SPI_CONFIG_CNTL_1__VTX_DONE_DELAY_mask); + + evergreen->evergreen_config.CP_PERFMON_CNTL.u32All = 0; + + evergreen->evergreen_config.SQ_MS_FIFO_SIZES.u32All = 0; + SETfield(evergreen->evergreen_config.SQ_MS_FIFO_SIZES.u32All, 16 * uSqNumCfInsts, + EG_SQ_MS_FIFO_SIZES__CACHE_FIFO_SIZE_shift, + EG_SQ_MS_FIFO_SIZES__CACHE_FIFO_SIZE_mask); + SETfield(evergreen->evergreen_config.SQ_MS_FIFO_SIZES.u32All, 0x4, + EG_SQ_MS_FIFO_SIZES__FETCH_FIFO_HIWATER_shift, + EG_SQ_MS_FIFO_SIZES__FETCH_FIFO_HIWATER_mask); + SETfield(evergreen->evergreen_config.SQ_MS_FIFO_SIZES.u32All, 0xE0, + EG_SQ_MS_FIFO_SIZES__DONE_FIFO_HIWATER_shift, + EG_SQ_MS_FIFO_SIZES__DONE_FIFO_HIWATER_mask); + SETfield(evergreen->evergreen_config.SQ_MS_FIFO_SIZES.u32All, 0x8, + EG_SQ_MS_FIFO_SIZES__ALU_UPDATE_FIFO_HIWATER_shift, + EG_SQ_MS_FIFO_SIZES__ALU_UPDATE_FIFO_HIWATER_mask); + + if(bVC_ENABLE == GL_TRUE) + { + SETbit(evergreen->evergreen_config.SQ_CONFIG.u32All, + EG_SQ_CONFIG__VC_ENABLE_bit); + } + else + { + CLEARbit(evergreen->evergreen_config.SQ_CONFIG.u32All, + EG_SQ_CONFIG__VC_ENABLE_bit); + } + SETbit(evergreen->evergreen_config.SQ_CONFIG.u32All, + EG_SQ_CONFIG__EXPORT_SRC_C_bit); + SETfield(evergreen->evergreen_config.SQ_CONFIG.u32All, 0, + EG_SQ_CONFIG__PS_PRIO_shift, + EG_SQ_CONFIG__PS_PRIO_mask); + SETfield(evergreen->evergreen_config.SQ_CONFIG.u32All, 1, + EG_SQ_CONFIG__VS_PRIO_shift, + EG_SQ_CONFIG__VS_PRIO_mask); + SETfield(evergreen->evergreen_config.SQ_CONFIG.u32All, 2, + EG_SQ_CONFIG__GS_PRIO_shift, + EG_SQ_CONFIG__GS_PRIO_mask); + SETfield(evergreen->evergreen_config.SQ_CONFIG.u32All, 3, + EG_SQ_CONFIG__ES_PRIO_shift, + EG_SQ_CONFIG__ES_PRIO_mask); + + NUM_CLAUSE_TEMP_GPRS = 4; + NUM_PS_GPRS = ((uMaxGPRs-(4*2))*12/32); // 93 + NUM_VS_GPRS = ((uMaxGPRs-(4*2))*6/32); // 46 + NUM_GS_GPRS = ((uMaxGPRs-(4*2))*4/32); // 31 + NUM_ES_GPRS = ((uMaxGPRs-(4*2))*4/32); // 31 + NUM_HS_GPRS = ((uMaxGPRs-(4*2))*3/32); // 23 + NUM_LS_GPRS = ((uMaxGPRs-(4*2))*3/32); // 23 + + evergreen->evergreen_config.SQ_GPR_RESOURCE_MGMT_1.u32All = 0; + evergreen->evergreen_config.SQ_GPR_RESOURCE_MGMT_2.u32All = 0; + evergreen->evergreen_config.SQ_GPR_RESOURCE_MGMT_3.u32All = 0; + + SETfield(evergreen->evergreen_config.SQ_GPR_RESOURCE_MGMT_1.u32All, NUM_PS_GPRS, + NUM_PS_GPRS_shift, NUM_PS_GPRS_mask); + SETfield(evergreen->evergreen_config.SQ_GPR_RESOURCE_MGMT_1.u32All, NUM_VS_GPRS, + NUM_VS_GPRS_shift, NUM_VS_GPRS_mask); + SETfield(evergreen->evergreen_config.SQ_GPR_RESOURCE_MGMT_1.u32All, NUM_CLAUSE_TEMP_GPRS, + NUM_CLAUSE_TEMP_GPRS_shift, NUM_CLAUSE_TEMP_GPRS_mask); + SETfield(evergreen->evergreen_config.SQ_GPR_RESOURCE_MGMT_2.u32All, NUM_GS_GPRS, + NUM_GS_GPRS_shift, NUM_GS_GPRS_mask); + SETfield(evergreen->evergreen_config.SQ_GPR_RESOURCE_MGMT_2.u32All, NUM_ES_GPRS, + NUM_ES_GPRS_shift, NUM_ES_GPRS_mask); + SETfield(evergreen->evergreen_config.SQ_GPR_RESOURCE_MGMT_3.u32All, NUM_HS_GPRS, + NUM_PS_GPRS_shift, NUM_PS_GPRS_mask); + SETfield(evergreen->evergreen_config.SQ_GPR_RESOURCE_MGMT_3.u32All, NUM_LS_GPRS, + NUM_VS_GPRS_shift, NUM_VS_GPRS_mask); + + uOtherThreadCount = (((uMaxThreads-uPSThreadCount)/6)/8)*8; + evergreen->evergreen_config.SQ_THREAD_RESOURCE_MGMT.u32All = 0; + evergreen->evergreen_config.SQ_THREAD_RESOURCE_MGMT_2.u32All = 0; + SETfield(evergreen->evergreen_config.SQ_THREAD_RESOURCE_MGMT.u32All, uPSThreadCount, + NUM_PS_THREADS_shift, NUM_PS_THREADS_mask); + SETfield(evergreen->evergreen_config.SQ_THREAD_RESOURCE_MGMT.u32All, uOtherThreadCount, + NUM_VS_THREADS_shift, NUM_VS_THREADS_mask); + SETfield(evergreen->evergreen_config.SQ_THREAD_RESOURCE_MGMT.u32All, uOtherThreadCount, + NUM_GS_THREADS_shift, NUM_GS_THREADS_mask); + SETfield(evergreen->evergreen_config.SQ_THREAD_RESOURCE_MGMT.u32All, uOtherThreadCount, + NUM_ES_THREADS_shift, NUM_ES_THREADS_mask); + SETfield(evergreen->evergreen_config.SQ_THREAD_RESOURCE_MGMT_2.u32All, uOtherThreadCount, + NUM_PS_THREADS_shift, NUM_PS_THREADS_mask); + SETfield(evergreen->evergreen_config.SQ_THREAD_RESOURCE_MGMT_2.u32All, uOtherThreadCount, + NUM_VS_THREADS_shift, NUM_VS_THREADS_mask); + + uMaxStackEntries = ((uMaxStackEntries*1)/6); + evergreen->evergreen_config.SQ_STACK_RESOURCE_MGMT_1.u32All = 0; + evergreen->evergreen_config.SQ_STACK_RESOURCE_MGMT_2.u32All = 0; + evergreen->evergreen_config.SQ_STACK_RESOURCE_MGMT_3.u32All = 0; + SETfield(evergreen->evergreen_config.SQ_STACK_RESOURCE_MGMT_1.u32All, uMaxStackEntries, + NUM_PS_STACK_ENTRIES_shift, NUM_PS_STACK_ENTRIES_mask); + SETfield(evergreen->evergreen_config.SQ_STACK_RESOURCE_MGMT_1.u32All, uMaxStackEntries, + NUM_VS_STACK_ENTRIES_shift, NUM_VS_STACK_ENTRIES_mask); + SETfield(evergreen->evergreen_config.SQ_STACK_RESOURCE_MGMT_2.u32All, uMaxStackEntries, + NUM_GS_STACK_ENTRIES_shift, NUM_GS_STACK_ENTRIES_mask); + SETfield(evergreen->evergreen_config.SQ_STACK_RESOURCE_MGMT_2.u32All, uMaxStackEntries, + NUM_ES_STACK_ENTRIES_shift, NUM_ES_STACK_ENTRIES_mask); + SETfield(evergreen->evergreen_config.SQ_STACK_RESOURCE_MGMT_3.u32All, uMaxStackEntries, + NUM_PS_STACK_ENTRIES_shift, NUM_PS_STACK_ENTRIES_mask); + SETfield(evergreen->evergreen_config.SQ_STACK_RESOURCE_MGMT_3.u32All, uMaxStackEntries, + NUM_VS_STACK_ENTRIES_shift, NUM_VS_STACK_ENTRIES_mask); + + evergreen->evergreen_config.PA_SC_FORCE_EOV_MAX_CNTS.u32All = 0; + SETfield(evergreen->evergreen_config.PA_SC_FORCE_EOV_MAX_CNTS.u32All, 4095, + EG_PA_SC_FORCE_EOV_MAX_CNTS__FORCE_EOV_MAX_CLK_CNT_shift, + EG_PA_SC_FORCE_EOV_MAX_CNTS__FORCE_EOV_MAX_CLK_CNT_mask); + SETfield(evergreen->evergreen_config.PA_SC_FORCE_EOV_MAX_CNTS.u32All, 255, + EG_PA_SC_FORCE_EOV_MAX_CNTS__FORCE_EOV_MAX_REZ_CNT_shift, + EG_PA_SC_FORCE_EOV_MAX_CNTS__FORCE_EOV_MAX_REZ_CNT_mask); + + evergreen->evergreen_config.VGT_CACHE_INVALIDATION.u32All = 0; + SETfield(evergreen->evergreen_config.VGT_CACHE_INVALIDATION.u32All, 2, + EG_VGT_CACHE_INVALIDATION__CACHE_INVALIDATION_shift, + EG_VGT_CACHE_INVALIDATION__CACHE_INVALIDATION_mask); + + evergreen->evergreen_config.VGT_GS_VERTEX_REUSE.u32All = 0; + SETfield(evergreen->evergreen_config.VGT_GS_VERTEX_REUSE.u32All, 16, + VERT_REUSE_shift, + VERT_REUSE_mask); + + evergreen->evergreen_config.PA_SC_LINE_STIPPLE_STATE.u32All = 0; + + evergreen->evergreen_config.PA_CL_ENHANCE.u32All = 0; + SETbit(evergreen->evergreen_config.PA_CL_ENHANCE.u32All, + CLIP_VTX_REORDER_ENA_bit); + SETfield(evergreen->evergreen_config.PA_CL_ENHANCE.u32All, 3, + NUM_CLIP_SEQ_shift, + NUM_CLIP_SEQ_mask); +} + +void evergreenInitState(GLcontext * ctx) //diff +{ + context_t *context = R700_CONTEXT(ctx); + EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); + + int id = 0; + + //calloc should have done this + memset(evergreen, 0, sizeof(EVERGREEN_CHIP_CONTEXT)); + + // Disable window clipping and offset: + SETfield(evergreen->PA_SC_WINDOW_OFFSET.u32All, 0, + EG_PA_SC_WINDOW_OFFSET__WINDOW_X_OFFSET_shift, EG_PA_SC_WINDOW_OFFSET__WINDOW_X_OFFSET_mask); + SETfield(evergreen->PA_SC_WINDOW_OFFSET.u32All, 0, + EG_PA_SC_WINDOW_OFFSET__WINDOW_Y_OFFSET_shift, EG_PA_SC_WINDOW_OFFSET__WINDOW_Y_OFFSET_mask); + + SETbit(evergreen->PA_SC_WINDOW_SCISSOR_TL.u32All, WINDOW_OFFSET_DISABLE_bit); + + evergreen->PA_SC_CLIPRECT_RULE.u32All = 0x0000FFFF; + + evergreen->PA_SC_EDGERULE.u32All = 0xAAAAAAAA; + + // Set up Z min/max: + evergreen->viewport[id].PA_SC_VPORT_ZMIN_0.f32All = 0.0; + evergreen->viewport[id].PA_SC_VPORT_ZMAX_0.f32All = 1.0; + + SETfield(evergreen->CB_TARGET_MASK.u32All, 0xF, TARGET0_ENABLE_shift, TARGET0_ENABLE_mask); + SETfield(evergreen->CB_SHADER_MASK.u32All, 0xF, OUTPUT0_ENABLE_shift, OUTPUT0_ENABLE_mask); + + SETfield(evergreen->SPI_BARYC_CNTL.u32All, 1, + EG_SPI_BARYC_CNTL__PERSP_CENTROID_ENA_shift, + EG_SPI_BARYC_CNTL__PERSP_CENTROID_ENA_mask); + SETfield(evergreen->SPI_BARYC_CNTL.u32All, 1, + EG_SPI_BARYC_CNTL__LINEAR_CENTROID_ENA_shift, + EG_SPI_BARYC_CNTL__LINEAR_CENTROID_ENA_mask); + + // Turn off vgt reuse: + evergreen->VGT_REUSE_OFF.u32All = 0; + SETbit(evergreen->VGT_REUSE_OFF.u32All, REUSE_OFF_bit); + + // Specify offsetting and clamp values for vertices: + evergreen->VGT_MAX_VTX_INDX.u32All = 0xFFFFFF; + evergreen->VGT_MIN_VTX_INDX.u32All = 0; + evergreen->VGT_INDX_OFFSET.u32All = 0; + + evergreen->VGT_DMA_NUM_INSTANCES.u32All = 1; + + // Do not alpha blend: + SETfield(evergreen->SX_ALPHA_TEST_CONTROL.u32All, REF_NEVER, + ALPHA_FUNC_shift, ALPHA_FUNC_mask); + CLEARbit(evergreen->SX_ALPHA_TEST_CONTROL.u32All, ALPHA_TEST_ENABLE_bit); + + evergreen->SPI_VS_OUT_ID_0.u32All = 0x03020100; + evergreen->SPI_VS_OUT_ID_1.u32All = 0x07060504; + + evergreen->SPI_PS_INPUT_CNTL[0].u32All = 0x00000800; + evergreen->SPI_PS_INPUT_CNTL[1].u32All = 0x00000801; + evergreen->SPI_PS_INPUT_CNTL[2].u32All = 0x00000802; + + + // Depth buffer currently disabled: + evergreen->DB_DEPTH_CONTROL.u32All = 0; + SETbit(evergreen->DB_DEPTH_CONTROL.u32All, Z_WRITE_ENABLE_bit); + SETfield(evergreen->DB_DEPTH_CONTROL.u32All, FRAG_ALWAYS, + ZFUNC_shift, ZFUNC_mask); + + evergreen->DB_Z_READ_BASE.u32All = 0; + evergreen->DB_Z_WRITE_BASE.u32All = 0; + + evergreen->DB_DEPTH_CLEAR.f32All = 1.0; + + evergreen->DB_DEPTH_VIEW.u32All = 0; + + evergreen->DB_SHADER_CONTROL.u32All = 0; + SETbit(evergreen->DB_SHADER_CONTROL.u32All, EG_DB_SHADER_CONTROL__DUAL_EXPORT_ENABLE_bit); + + evergreen->DB_Z_INFO.u32All = 0; + SETfield(evergreen->DB_Z_INFO.u32All , ARRAY_1D_TILED_THIN1, + EG_DB_Z_INFO__ARRAY_MODE_shift, EG_DB_Z_INFO__ARRAY_MODE_mask); + SETfield(evergreen->DB_Z_INFO.u32All , EG_Z_24, + EG_DB_Z_INFO__FORMAT_shift, EG_DB_Z_INFO__FORMAT_mask); + SETfield(evergreen->DB_Z_INFO.u32All , EG_ADDR_SURF_TILE_SPLIT_256B, + EG_DB_Z_INFO__TILE_SPLIT_shift, EG_DB_Z_INFO__TILE_SPLIT_mask); + SETfield(evergreen->DB_Z_INFO.u32All , EG_ADDR_SURF_8_BANK, + EG_DB_Z_INFO__NUM_BANKS_shift, EG_DB_Z_INFO__NUM_BANKS_mask); + SETfield(evergreen->DB_Z_INFO.u32All , EG_ADDR_SURF_BANK_WIDTH_1, + EG_DB_Z_INFO__BANK_WIDTH_shift, EG_DB_Z_INFO__BANK_WIDTH_mask); + SETfield(evergreen->DB_Z_INFO.u32All , EG_ADDR_SURF_BANK_HEIGHT_1, + EG_DB_Z_INFO__BANK_HEIGHT_shift, EG_DB_Z_INFO__BANK_HEIGHT_mask); + + evergreen->DB_STENCIL_INFO.u32All = 0; + CLEARbit(evergreen->DB_STENCIL_INFO.u32All, EG_DB_STENCIL_INFO__FORMAT_bit); + SETfield(evergreen->DB_STENCIL_INFO.u32All, EG_ADDR_SURF_TILE_SPLIT_256B, + EG_DB_STENCIL_INFO__TILE_SPLIT_shift, EG_DB_STENCIL_INFO__TILE_SPLIT_mask); + + evergreen->DB_RENDER_CONTROL.u32All = 0; + + evergreen->DB_RENDER_OVERRIDE.u32All = 0; + SETfield(evergreen->DB_RENDER_OVERRIDE.u32All, FORCE_DISABLE, FORCE_HIZ_ENABLE_shift, FORCE_HIZ_ENABLE_mask); + SETfield(evergreen->DB_RENDER_OVERRIDE.u32All, FORCE_DISABLE, FORCE_HIS_ENABLE0_shift, FORCE_HIS_ENABLE0_mask); + SETfield(evergreen->DB_RENDER_OVERRIDE.u32All, FORCE_DISABLE, FORCE_HIS_ENABLE1_shift, FORCE_HIS_ENABLE1_mask); + + // Disable ROP3 modes by setting src to dst copy: + SETfield(evergreen->CB_COLOR_CONTROL.u32All, 0xCC, + EG_CB_COLOR_CONTROL__ROP3_shift, + EG_CB_COLOR_CONTROL__ROP3_mask); + SETfield(evergreen->CB_COLOR_CONTROL.u32All, EG_CB_NORMAL, + EG_CB_COLOR_CONTROL__MODE_shift, + EG_CB_COLOR_CONTROL__MODE_mask); + + SETfield(evergreen->CB_BLEND0_CONTROL.u32All, + BLEND_ONE, COLOR_SRCBLEND_shift, COLOR_SRCBLEND_mask); + + SETfield(evergreen->CB_BLEND0_CONTROL.u32All, + BLEND_ONE, ALPHA_SRCBLEND_shift, ALPHA_SRCBLEND_mask); + + //evergreen->PA_CL_CLIP_CNTL.CLIP_DISABLE = 1; + + SETbit(evergreen->PA_CL_CLIP_CNTL.u32All, DX_LINEAR_ATTR_CLIP_ENA_bit); + + // Set up the culling control register: + SETfield(evergreen->PA_SU_SC_MODE_CNTL.u32All, 2, + POLYMODE_FRONT_PTYPE_shift, POLYMODE_FRONT_PTYPE_mask); // draw using triangles + SETfield(evergreen->PA_SU_SC_MODE_CNTL.u32All, 2, + POLYMODE_BACK_PTYPE_shift, POLYMODE_BACK_PTYPE_mask); // draw using triangles + + // Do scale XY or X by 1/W0. eg: + evergreen->bEnablePerspective = GL_TRUE; + + CLEARbit(evergreen->PA_CL_VTE_CNTL.u32All, VTX_XY_FMT_bit); + CLEARbit(evergreen->PA_CL_VTE_CNTL.u32All, VTX_Z_FMT_bit); + SETbit(evergreen->PA_CL_VTE_CNTL.u32All, VTX_W0_FMT_bit); + + // Enable viewport scaling for all three axis: + SETbit(evergreen->PA_CL_VTE_CNTL.u32All, VPORT_X_SCALE_ENA_bit); + SETbit(evergreen->PA_CL_VTE_CNTL.u32All, VPORT_X_OFFSET_ENA_bit); + SETbit(evergreen->PA_CL_VTE_CNTL.u32All, VPORT_Y_SCALE_ENA_bit); + SETbit(evergreen->PA_CL_VTE_CNTL.u32All, VPORT_Y_OFFSET_ENA_bit); + SETbit(evergreen->PA_CL_VTE_CNTL.u32All, VPORT_Z_SCALE_ENA_bit); + SETbit(evergreen->PA_CL_VTE_CNTL.u32All, VPORT_Z_OFFSET_ENA_bit); + + // Set up point sizes and min/max values: + SETfield(evergreen->PA_SU_POINT_SIZE.u32All, 0x8, + PA_SU_POINT_SIZE__HEIGHT_shift, PA_SU_POINT_SIZE__HEIGHT_mask); + SETfield(evergreen->PA_SU_POINT_SIZE.u32All, 0x8, + PA_SU_POINT_SIZE__WIDTH_shift, PA_SU_POINT_SIZE__WIDTH_mask); + CLEARfield(evergreen->PA_SU_POINT_MINMAX.u32All, MIN_SIZE_mask); + SETfield(evergreen->PA_SU_POINT_MINMAX.u32All, 0x8000, MAX_SIZE_shift, MAX_SIZE_mask); + SETfield(evergreen->PA_SU_LINE_CNTL.u32All,0x8, + PA_SU_LINE_CNTL__WIDTH_shift, PA_SU_LINE_CNTL__WIDTH_mask); + + // Set up line control: + evergreen->PA_SC_LINE_CNTL.u32All = 0; + CLEARbit(evergreen->PA_SC_LINE_CNTL.u32All, EXPAND_LINE_WIDTH_bit); + SETbit(evergreen->PA_SC_LINE_CNTL.u32All, LAST_PIXEL_bit); + + // Set up vertex control: + evergreen->PA_SU_VTX_CNTL.u32All = 0; + CLEARfield(evergreen->PA_SU_VTX_CNTL.u32All, QUANT_MODE_mask); + SETbit(evergreen->PA_SU_VTX_CNTL.u32All, PIX_CENTER_bit); + SETfield(evergreen->PA_SU_VTX_CNTL.u32All, X_ROUND_TO_EVEN, + PA_SU_VTX_CNTL__ROUND_MODE_shift, PA_SU_VTX_CNTL__ROUND_MODE_mask); + + // to 1.0 = no guard band: + evergreen->PA_CL_GB_VERT_CLIP_ADJ.u32All = 0x3F800000; // 1.0 + evergreen->PA_CL_GB_VERT_DISC_ADJ.u32All = 0x3F800000; // 1.0 + evergreen->PA_CL_GB_HORZ_CLIP_ADJ.u32All = 0x3F800000; // 1.0 + evergreen->PA_CL_GB_HORZ_DISC_ADJ.u32All = 0x3F800000; // 1.0 + + // Diable color compares: + SETfield(evergreen->CB_CLRCMP_CONTROL.u32All, CLRCMP_DRAW_ALWAYS, + CLRCMP_FCN_SRC_shift, CLRCMP_FCN_SRC_mask); + SETfield(evergreen->CB_CLRCMP_CONTROL.u32All, CLRCMP_DRAW_ALWAYS, + CLRCMP_FCN_DST_shift, CLRCMP_FCN_DST_mask); + SETfield(evergreen->CB_CLRCMP_CONTROL.u32All, CLRCMP_SEL_SRC, + CLRCMP_FCN_SEL_shift, CLRCMP_FCN_SEL_mask); + + // Zero out source: + evergreen->CB_CLRCMP_SRC.u32All = 0x00000000; + + // Put a compare color in for error checking: + evergreen->CB_CLRCMP_DST.u32All = 0x000000FF; + + // Set up color compare mask: + evergreen->CB_CLRCMP_MSK.u32All = 0xFFFFFFFF; + + // Enable all samples for multi-sample anti-aliasing: + evergreen->PA_SC_AA_MASK.u32All = 0xFFFFFFFF; + // Turn off AA: + evergreen->PA_SC_AA_CONFIG.u32All = 0; + + SETfield(evergreen->VGT_OUT_DEALLOC_CNTL.u32All, 16, + DEALLOC_DIST_shift, DEALLOC_DIST_mask); + SETfield(evergreen->VGT_VERTEX_REUSE_BLOCK_CNTL.u32All, 14, + VTX_REUSE_DEPTH_shift, VTX_REUSE_DEPTH_mask); + + evergreen->SX_MISC.u32All = 0; + + SETfield(evergreen->render_target[id].CB_COLOR0_INFO.u32All, 1, + EG_CB_COLOR0_INFO__SOURCE_FORMAT_shift, EG_CB_COLOR0_INFO__SOURCE_FORMAT_mask); + SETbit(evergreen->render_target[id].CB_COLOR0_INFO.u32All, EG_CB_COLOR0_INFO__BLEND_CLAMP_bit); + SETfield(evergreen->render_target[id].CB_COLOR0_INFO.u32All, 0, + EG_CB_COLOR0_INFO__NUMBER_TYPE_shift, EG_CB_COLOR0_INFO__NUMBER_TYPE_mask); + + SETfield(evergreen->render_target[id].CB_COLOR0_INFO.u32All, SWAP_STD, + EG_CB_COLOR0_INFO__COMP_SWAP_shift, EG_CB_COLOR0_INFO__COMP_SWAP_mask); + + evergreen->render_target[id].CB_COLOR0_VIEW.u32All = 0; + evergreen->render_target[id].CB_COLOR0_CMASK.u32All = 0; + evergreen->render_target[id].CB_COLOR0_FMASK.u32All = 0; + evergreen->render_target[id].CB_COLOR0_FMASK_SLICE.u32All = 0; + + evergreenInitSQConfig(ctx); + + context->radeon.hw.all_dirty = GL_TRUE; +} + +void evergreenInitStateFuncs(radeonContextPtr radeon, struct dd_function_table *functions) +{ + functions->UpdateState = evergreenInvalidateState; + functions->AlphaFunc = evergreenAlphaFunc; + functions->BlendColor = evergreenBlendColor; + functions->BlendEquationSeparate = evergreenBlendEquationSeparate; + functions->BlendFuncSeparate = evergreenBlendFuncSeparate; + functions->Enable = evergreenEnable; + functions->ColorMask = evergreenColorMask; + functions->DepthFunc = evergreenDepthFunc; + functions->DepthMask = evergreenDepthMask; + functions->CullFace = evergreenCullFace; + functions->Fogfv = evergreenFogfv; + functions->FrontFace = evergreenFrontFace; + functions->ShadeModel = evergreenShadeModel; + functions->LogicOpcode = evergreenLogicOpcode; + + /* ARB_point_parameters */ + functions->PointParameterfv = evergreenPointParameter; + + /* Stencil related */ + functions->StencilFuncSeparate = evergreenStencilFuncSeparate; + functions->StencilMaskSeparate = evergreenStencilMaskSeparate; + functions->StencilOpSeparate = evergreenStencilOpSeparate; + + /* Viewport related */ + functions->Viewport = evergreenViewport; + functions->DepthRange = evergreenDepthRange; + functions->PointSize = evergreenPointSize; + functions->LineWidth = evergreenLineWidth; + functions->LineStipple = evergreenLineStipple; + + functions->PolygonOffset = evergreenPolygonOffset; + functions->PolygonMode = evergreenPolygonMode; + + functions->RenderMode = evergreenRenderMode; + + functions->ClipPlane = evergreenClipPlane; + + functions->Scissor = radeonScissor; + + functions->DrawBuffer = radeonDrawBuffer; + functions->ReadBuffer = radeonReadBuffer; + + if (radeon->radeonScreen->kernel_mm) { + functions->CopyPixels = _mesa_meta_CopyPixels; + functions->DrawPixels = _mesa_meta_DrawPixels; + functions->ReadPixels = radeonReadPixels; + } +} + + diff --git a/src/mesa/drivers/dri/r600/evergreen_state.h b/src/mesa/drivers/dri/r600/evergreen_state.h new file mode 100644 index 0000000000..ffdb56b38a --- /dev/null +++ b/src/mesa/drivers/dri/r600/evergreen_state.h @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2008-2009 Advanced Micro Devices, Inc. + * + * 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 + * THE COPYRIGHT HOLDER(S) 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. + */ + +/* + * Authors: + * Richard Li , + */ + +#ifndef _EVERGREEN_STATE_H_ +#define _EVERGREEN_STATE_H_ + +#include "main/mtypes.h" + +#include "r600_context.h" + +extern void evergreenUpdateStateParameters(GLcontext * ctx, GLuint new_state); +extern void evergreenUpdateShaders(GLcontext * ctx); +extern void evergreenUpdateShaderStates(GLcontext * ctx); + +extern void evergreeUpdateShaders(GLcontext * ctx); + +extern void evergreenUpdateViewportOffset(GLcontext * ctx); + +extern void evergreenInitState(GLcontext * ctx); +extern void evergreenInitStateFuncs (radeonContextPtr radeon, struct dd_function_table *functions); + +extern void evergreenSetScissor(context_t *context); + +#endif /* _EVERGREEN_STATE_H_ */ diff --git a/src/mesa/drivers/dri/r600/evergreen_tex.c b/src/mesa/drivers/dri/r600/evergreen_tex.c new file mode 100644 index 0000000000..8b42045ebb --- /dev/null +++ b/src/mesa/drivers/dri/r600/evergreen_tex.c @@ -0,0 +1,1551 @@ +/* + * Copyright (C) 2008-2010 Advanced Micro Devices, Inc. + * + * 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 + * THE COPYRIGHT HOLDER(S) 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. + */ + +/* + * Authors: + * Richard Li , + */ + +#include "main/glheader.h" +#include "main/imports.h" +#include "main/colormac.h" +#include "main/context.h" +#include "main/enums.h" +#include "main/image.h" +#include "main/teximage.h" +#include "main/mipmap.h" +#include "main/simple_list.h" +#include "main/texstore.h" +#include "main/texobj.h" + +#include "texmem.h" + +#include "r600_context.h" +#include "radeon_mipmap_tree.h" +#include "evergreen_diff.h" +#include "evergreen_tex.h" +#include "evergreen_fragprog.h" +#include "evergreen_vertprog.h" + +#include "r600_tex.h" + +static unsigned int evergreen_translate_wrap_mode(GLenum wrapmode) +{ + switch(wrapmode) { + case GL_REPEAT: return SQ_TEX_WRAP; + case GL_CLAMP: return SQ_TEX_CLAMP_HALF_BORDER; + case GL_CLAMP_TO_EDGE: return SQ_TEX_CLAMP_LAST_TEXEL; + case GL_CLAMP_TO_BORDER: return SQ_TEX_CLAMP_BORDER; + case GL_MIRRORED_REPEAT: return SQ_TEX_MIRROR; + case GL_MIRROR_CLAMP_EXT: return SQ_TEX_MIRROR_ONCE_HALF_BORDER; + case GL_MIRROR_CLAMP_TO_EDGE_EXT: return SQ_TEX_MIRROR_ONCE_LAST_TEXEL; + case GL_MIRROR_CLAMP_TO_BORDER_EXT: return SQ_TEX_MIRROR_ONCE_BORDER; + default: + radeon_error("bad wrap mode in %s", __FUNCTION__); + return 0; + } +} + +static GLboolean evergreenGetTexFormat(struct gl_texture_object *tObj, gl_format mesa_format) +{ + radeonTexObj *t = radeon_tex_obj(tObj); + + CLEARfield(t->SQ_TEX_RESOURCE4, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); + CLEARfield(t->SQ_TEX_RESOURCE4, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); + CLEARfield(t->SQ_TEX_RESOURCE4, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); + CLEARfield(t->SQ_TEX_RESOURCE4, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); + CLEARbit(t->SQ_TEX_RESOURCE4, SQ_TEX_RESOURCE_WORD4_0__FORCE_DEGAMMA_bit); + + SETfield(t->SQ_TEX_RESOURCE4, SQ_FORMAT_COMP_UNSIGNED, + FORMAT_COMP_X_shift, + FORMAT_COMP_X_mask); + SETfield(t->SQ_TEX_RESOURCE4, SQ_FORMAT_COMP_UNSIGNED, + FORMAT_COMP_Y_shift, + FORMAT_COMP_Y_mask); + SETfield(t->SQ_TEX_RESOURCE4, SQ_FORMAT_COMP_UNSIGNED, + FORMAT_COMP_Z_shift, + FORMAT_COMP_Z_mask); + SETfield(t->SQ_TEX_RESOURCE4, SQ_FORMAT_COMP_UNSIGNED, + FORMAT_COMP_W_shift, + FORMAT_COMP_W_mask); + + SETfield(t->SQ_TEX_RESOURCE1, ARRAY_LINEAR_GENERAL, + EG_SQ_TEX_RESOURCE_WORD1_0__ARRAY_MODE_shift, + EG_SQ_TEX_RESOURCE_WORD1_0__ARRAY_MODE_mask); + + switch (mesa_format) /* This is mesa format. */ + { + case MESA_FORMAT_RGBA8888: + case MESA_FORMAT_SIGNED_RGBA8888: + SETfield(t->SQ_TEX_RESOURCE7, FMT_8_8_8_8, + EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_shift, + EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_mask); + + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_W, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Z, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Y, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); + if (mesa_format == MESA_FORMAT_SIGNED_RGBA8888) { + SETfield(t->SQ_TEX_RESOURCE4, SQ_FORMAT_COMP_SIGNED, + FORMAT_COMP_X_shift, FORMAT_COMP_X_mask); + SETfield(t->SQ_TEX_RESOURCE4, SQ_FORMAT_COMP_SIGNED, + FORMAT_COMP_Y_shift, FORMAT_COMP_Y_mask); + SETfield(t->SQ_TEX_RESOURCE4, SQ_FORMAT_COMP_SIGNED, + FORMAT_COMP_Z_shift, FORMAT_COMP_Z_mask); + SETfield(t->SQ_TEX_RESOURCE4, SQ_FORMAT_COMP_SIGNED, + FORMAT_COMP_W_shift, FORMAT_COMP_W_mask); + } + break; + case MESA_FORMAT_RGBA8888_REV: + case MESA_FORMAT_SIGNED_RGBA8888_REV: + SETfield(t->SQ_TEX_RESOURCE7, FMT_8_8_8_8, + EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_shift, + EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_mask); + + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Y, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Z, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_W, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); + if (mesa_format == MESA_FORMAT_SIGNED_RGBA8888_REV) { + SETfield(t->SQ_TEX_RESOURCE4, SQ_FORMAT_COMP_SIGNED, + FORMAT_COMP_X_shift, FORMAT_COMP_X_mask); + SETfield(t->SQ_TEX_RESOURCE4, SQ_FORMAT_COMP_SIGNED, + FORMAT_COMP_Y_shift, FORMAT_COMP_Y_mask); + SETfield(t->SQ_TEX_RESOURCE4, SQ_FORMAT_COMP_SIGNED, + FORMAT_COMP_Z_shift, FORMAT_COMP_Z_mask); + SETfield(t->SQ_TEX_RESOURCE4, SQ_FORMAT_COMP_SIGNED, + FORMAT_COMP_W_shift, FORMAT_COMP_W_mask); + } + break; + case MESA_FORMAT_ARGB8888: + SETfield(t->SQ_TEX_RESOURCE7, FMT_8_8_8_8, + EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_shift, + EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_mask); + + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Z, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Y, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_W, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); + break; + case MESA_FORMAT_XRGB8888: + SETfield(t->SQ_TEX_RESOURCE7, FMT_8_8_8_8, + EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_shift, + EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_mask); + + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Z, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Y, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_1, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); + break; + case MESA_FORMAT_XRGB8888_REV: + SETfield(t->SQ_TEX_RESOURCE7, FMT_8_8_8_8, + EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_shift, + EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_mask); + + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_1, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Z, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_W, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); + break; + case MESA_FORMAT_ARGB8888_REV: + SETfield(t->SQ_TEX_RESOURCE7, FMT_8_8_8_8, + EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_shift, + EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_mask); + + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Y, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Z, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_W, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); + break; + case MESA_FORMAT_RGB888: + SETfield(t->SQ_TEX_RESOURCE7, FMT_8_8_8, + EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_shift, + EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_mask); + + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Z, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Y, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_1, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); + break; + case MESA_FORMAT_RGB565: + SETfield(t->SQ_TEX_RESOURCE7, FMT_5_6_5, + EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_shift, + EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_mask); + + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Z, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Y, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_1, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); + break; + case MESA_FORMAT_RGB565_REV: + SETfield(t->SQ_TEX_RESOURCE7, FMT_5_6_5, + EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_shift, + EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_mask); + + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Y, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Z, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_1, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); + break; + case MESA_FORMAT_ARGB4444: + SETfield(t->SQ_TEX_RESOURCE7, FMT_4_4_4_4, + EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_shift, + EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_mask); + + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Z, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Y, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_W, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); + break; + case MESA_FORMAT_ARGB4444_REV: + SETfield(t->SQ_TEX_RESOURCE7, FMT_4_4_4_4, + EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_shift, + EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_mask); + + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Y, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Z, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_W, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); + break; + case MESA_FORMAT_ARGB1555: + SETfield(t->SQ_TEX_RESOURCE7, FMT_1_5_5_5, + EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_shift, + EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_mask); + + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Z, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Y, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_W, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); + break; + case MESA_FORMAT_ARGB1555_REV: + SETfield(t->SQ_TEX_RESOURCE7, FMT_1_5_5_5, + EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_shift, + EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_mask); + + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Y, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Z, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_W, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); + break; + case MESA_FORMAT_AL88: + case MESA_FORMAT_AL88_REV: /* TODO : Check this. */ + SETfield(t->SQ_TEX_RESOURCE7, FMT_8_8, + EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_shift, + EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_mask); + + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Y, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); + break; + case MESA_FORMAT_RGB332: + SETfield(t->SQ_TEX_RESOURCE7, FMT_3_3_2, + EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_shift, + EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_mask); + + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Z, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Y, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_1, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); + break; + case MESA_FORMAT_A8: /* ZERO, ZERO, ZERO, X */ + SETfield(t->SQ_TEX_RESOURCE7, FMT_8, + EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_shift, + EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_mask); + + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_0, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_0, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_0, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); + break; + case MESA_FORMAT_L8: /* X, X, X, ONE */ + SETfield(t->SQ_TEX_RESOURCE7, FMT_8, + EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_shift, + EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_mask); + + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_1, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); + break; + case MESA_FORMAT_I8: /* X, X, X, X */ + case MESA_FORMAT_CI8: + SETfield(t->SQ_TEX_RESOURCE7, FMT_8, + EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_shift, + EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_mask); + + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); + break; + case MESA_FORMAT_RGB_DXT1: /* not supported yet */ + case MESA_FORMAT_RGBA_DXT1: /* not supported yet */ + case MESA_FORMAT_RGBA_DXT3: /* not supported yet */ + case MESA_FORMAT_RGBA_DXT5: /* not supported yet */ + return GL_FALSE; + + case MESA_FORMAT_RGBA_FLOAT32: + SETfield(t->SQ_TEX_RESOURCE7, FMT_32_32_32_32_FLOAT, + EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_shift, + EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_mask); + + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Y, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Z, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_W, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); + break; + case MESA_FORMAT_RGBA_FLOAT16: + SETfield(t->SQ_TEX_RESOURCE7, FMT_16_16_16_16_FLOAT, + EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_shift, + EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_mask); + + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Y, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Z, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_W, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); + break; + case MESA_FORMAT_RGB_FLOAT32: /* X, Y, Z, ONE */ + SETfield(t->SQ_TEX_RESOURCE7, FMT_32_32_32_FLOAT, + EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_shift, + EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_mask); + + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Y, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Z, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_1, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); + break; + case MESA_FORMAT_RGB_FLOAT16: + SETfield(t->SQ_TEX_RESOURCE7, FMT_16_16_16_FLOAT, + EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_shift, + EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_mask); + + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Y, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Z, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_1, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); + break; + case MESA_FORMAT_ALPHA_FLOAT32: /* ZERO, ZERO, ZERO, X */ + SETfield(t->SQ_TEX_RESOURCE7, FMT_32_FLOAT, + EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_shift, + EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_mask); + + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_0, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_0, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_0, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); + break; + case MESA_FORMAT_ALPHA_FLOAT16: /* ZERO, ZERO, ZERO, X */ + SETfield(t->SQ_TEX_RESOURCE7, FMT_16_FLOAT, + EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_shift, + EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_mask); + + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_0, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_0, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_0, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); + break; + case MESA_FORMAT_LUMINANCE_FLOAT32: /* X, X, X, ONE */ + SETfield(t->SQ_TEX_RESOURCE7, FMT_32_FLOAT, + EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_shift, + EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_mask); + + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_1, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); + break; + case MESA_FORMAT_LUMINANCE_FLOAT16: /* X, X, X, ONE */ + SETfield(t->SQ_TEX_RESOURCE7, FMT_16_FLOAT, + EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_shift, + EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_mask); + + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_1, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); + break; + case MESA_FORMAT_LUMINANCE_ALPHA_FLOAT32: + SETfield(t->SQ_TEX_RESOURCE7, FMT_32_32_FLOAT, + EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_shift, + EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_mask); + + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Y, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); + break; + case MESA_FORMAT_LUMINANCE_ALPHA_FLOAT16: + SETfield(t->SQ_TEX_RESOURCE7, FMT_16_16_FLOAT, + EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_shift, + EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_mask); + + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Y, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); + break; + case MESA_FORMAT_INTENSITY_FLOAT32: /* X, X, X, X */ + SETfield(t->SQ_TEX_RESOURCE7, FMT_32_FLOAT, + EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_shift, + EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_mask); + + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); + break; + case MESA_FORMAT_INTENSITY_FLOAT16: /* X, X, X, X */ + SETfield(t->SQ_TEX_RESOURCE7, FMT_16_FLOAT, + EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_shift, + EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_mask); + + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); + break; + case MESA_FORMAT_Z16: + case MESA_FORMAT_X8_Z24: + case MESA_FORMAT_S8_Z24: + case MESA_FORMAT_Z24_S8: + case MESA_FORMAT_Z32: + case MESA_FORMAT_S8: + CLEARbit(t->SQ_TEX_RESOURCE0, EG_SQ_TEX_RESOURCE_WORD0_0__NDTO_bit); + SETfield(t->SQ_TEX_RESOURCE1, ARRAY_1D_TILED_THIN1, + EG_SQ_TEX_RESOURCE_WORD1_0__ARRAY_MODE_shift, + EG_SQ_TEX_RESOURCE_WORD1_0__ARRAY_MODE_mask); + switch (mesa_format) { + case MESA_FORMAT_Z16: + SETfield(t->SQ_TEX_RESOURCE7, FMT_16, + EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_shift, + EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_mask); + break; + case MESA_FORMAT_X8_Z24: + case MESA_FORMAT_S8_Z24: + SETfield(t->SQ_TEX_RESOURCE7, FMT_8_24, + EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_shift, + EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_mask); + break; + case MESA_FORMAT_Z24_S8: + SETfield(t->SQ_TEX_RESOURCE7, FMT_24_8, + EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_shift, + EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_mask); + break; + case MESA_FORMAT_Z32: + SETfield(t->SQ_TEX_RESOURCE7, FMT_32, + EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_shift, + EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_mask); + break; + case MESA_FORMAT_S8: + SETfield(t->SQ_TEX_RESOURCE7, FMT_8, + EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_shift, + EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_mask); + break; + default: + break; + }; + switch (tObj->DepthMode) { + case GL_LUMINANCE: /* X, X, X, ONE */ + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_1, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); + break; + case GL_INTENSITY: /* X, X, X, X */ + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); + break; + case GL_ALPHA: /* ZERO, ZERO, ZERO, X */ + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_0, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_0, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_0, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); + break; + default: + return GL_FALSE; + } + break; + /* EXT_texture_sRGB */ + case MESA_FORMAT_SRGBA8: + SETfield(t->SQ_TEX_RESOURCE7, FMT_8_8_8_8, + EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_shift, + EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_mask); + + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_W, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Z, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Y, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); + SETbit(t->SQ_TEX_RESOURCE4, SQ_TEX_RESOURCE_WORD4_0__FORCE_DEGAMMA_bit); + break; + case MESA_FORMAT_SLA8: + SETfield(t->SQ_TEX_RESOURCE7, FMT_8_8, + EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_shift, + EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_mask); + + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Y, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); + SETbit(t->SQ_TEX_RESOURCE4, SQ_TEX_RESOURCE_WORD4_0__FORCE_DEGAMMA_bit); + break; + case MESA_FORMAT_SL8: /* X, X, X, ONE */ + SETfield(t->SQ_TEX_RESOURCE7, FMT_8, + EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_shift, + EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_mask); + + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_1, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); + SETbit(t->SQ_TEX_RESOURCE4, SQ_TEX_RESOURCE_WORD4_0__FORCE_DEGAMMA_bit); + break; + default: + /* Not supported format */ + return GL_FALSE; + }; + + return GL_TRUE; +} + +static GLuint evergreen_translate_shadow_func(GLenum func) +{ + switch (func) { + case GL_NEVER: + return SQ_TEX_DEPTH_COMPARE_NEVER; + case GL_LESS: + return SQ_TEX_DEPTH_COMPARE_LESS; + case GL_LEQUAL: + return SQ_TEX_DEPTH_COMPARE_LESSEQUAL; + case GL_GREATER: + return SQ_TEX_DEPTH_COMPARE_GREATER; + case GL_GEQUAL: + return SQ_TEX_DEPTH_COMPARE_GREATEREQUAL; + case GL_NOTEQUAL: + return SQ_TEX_DEPTH_COMPARE_NOTEQUAL; + case GL_EQUAL: + return SQ_TEX_DEPTH_COMPARE_EQUAL; + case GL_ALWAYS: + return SQ_TEX_DEPTH_COMPARE_ALWAYS; + default: + WARN_ONCE("Unknown shadow compare function! %d", func); + return 0; + } +} + +static void evergreenUpdateTexWrap(radeonTexObjPtr t) +{ + struct gl_texture_object *tObj = &t->base; + + SETfield(t->SQ_TEX_SAMPLER0, evergreen_translate_wrap_mode(tObj->WrapS), + EG_SQ_TEX_SAMPLER_WORD0_0__CLAMP_X_shift, + EG_SQ_TEX_SAMPLER_WORD0_0__CLAMP_X_mask); + + if (tObj->Target != GL_TEXTURE_1D) + { + SETfield(t->SQ_TEX_SAMPLER0, evergreen_translate_wrap_mode(tObj->WrapT), + EG_SQ_TEX_SAMPLER_WORD0_0__CLAMP_Y_shift, + EG_SQ_TEX_SAMPLER_WORD0_0__CLAMP_Y_mask); + + if (tObj->Target == GL_TEXTURE_3D) + SETfield(t->SQ_TEX_SAMPLER0, evergreen_translate_wrap_mode(tObj->WrapR), + EG_SQ_TEX_SAMPLER_WORD0_0__CLAMP_Z_shift, + EG_SQ_TEX_SAMPLER_WORD0_0__CLAMP_Z_mask); + } +} + +static void evergreenSetTexDefaultState(radeonTexObjPtr t) +{ + /* Init text object to default states. */ + t->SQ_TEX_RESOURCE0 = 0; + t->SQ_TEX_RESOURCE1 = 0; + t->SQ_TEX_RESOURCE2 = 0; + t->SQ_TEX_RESOURCE3 = 0; + t->SQ_TEX_RESOURCE4 = 0; + t->SQ_TEX_RESOURCE5 = 0; + t->SQ_TEX_RESOURCE6 = 0; + t->SQ_TEX_RESOURCE7 = 0; + + SETfield(t->SQ_TEX_RESOURCE0, SQ_TEX_DIM_2D, + EG_SQ_TEX_RESOURCE_WORD0_0__DIM_shift, + EG_SQ_TEX_RESOURCE_WORD0_0__DIM_mask); + + CLEARbit(t->SQ_TEX_RESOURCE0, EG_SQ_TEX_RESOURCE_WORD0_0__NDTO_bit); + + SETfield(t->SQ_TEX_RESOURCE1, ARRAY_LINEAR_GENERAL, + EG_SQ_TEX_RESOURCE_WORD1_0__ARRAY_MODE_shift, + EG_SQ_TEX_RESOURCE_WORD1_0__ARRAY_MODE_mask); + + SETfield(t->SQ_TEX_RESOURCE4, SQ_FORMAT_COMP_UNSIGNED, + FORMAT_COMP_X_shift, FORMAT_COMP_X_mask); + SETfield(t->SQ_TEX_RESOURCE4, SQ_FORMAT_COMP_UNSIGNED, + FORMAT_COMP_Y_shift, FORMAT_COMP_Y_mask); + SETfield(t->SQ_TEX_RESOURCE4, SQ_FORMAT_COMP_UNSIGNED, + FORMAT_COMP_Z_shift, FORMAT_COMP_Z_mask); + SETfield(t->SQ_TEX_RESOURCE4, SQ_FORMAT_COMP_UNSIGNED, + FORMAT_COMP_W_shift, FORMAT_COMP_W_mask); + SETfield(t->SQ_TEX_RESOURCE4, SQ_NUM_FORMAT_NORM, + SQ_TEX_RESOURCE_WORD4_0__NUM_FORMAT_ALL_shift, SQ_TEX_RESOURCE_WORD4_0__NUM_FORMAT_ALL_mask); + CLEARbit(t->SQ_TEX_RESOURCE4, SQ_TEX_RESOURCE_WORD4_0__SRF_MODE_ALL_bit); + CLEARbit(t->SQ_TEX_RESOURCE4, SQ_TEX_RESOURCE_WORD4_0__FORCE_DEGAMMA_bit); + SETfield(t->SQ_TEX_RESOURCE4, SQ_ENDIAN_NONE, + SQ_TEX_RESOURCE_WORD4_0__ENDIAN_SWAP_shift, SQ_TEX_RESOURCE_WORD4_0__ENDIAN_SWAP_mask); + + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Y, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Z, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_W, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); + SETfield(t->SQ_TEX_RESOURCE4, 0, + BASE_LEVEL_shift, + BASE_LEVEL_mask); /* mip-maps */ + + SETfield(t->SQ_TEX_RESOURCE7, FMT_8_8_8_8, + EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_shift, + EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_mask); + SETfield(t->SQ_TEX_RESOURCE7, SQ_TEX_VTX_VALID_TEXTURE, + EG_SQ_TEX_RESOURCE_WORD7_0__TYPE_shift, + EG_SQ_TEX_RESOURCE_WORD7_0__TYPE_mask); + + /* Initialize sampler registers */ + t->SQ_TEX_SAMPLER0 = 0; + SETfield(t->SQ_TEX_SAMPLER0, SQ_TEX_WRAP, + EG_SQ_TEX_SAMPLER_WORD0_0__CLAMP_X_shift, + EG_SQ_TEX_SAMPLER_WORD0_0__CLAMP_X_mask); + SETfield(t->SQ_TEX_SAMPLER0, SQ_TEX_WRAP, + EG_SQ_TEX_SAMPLER_WORD0_0__CLAMP_X_shift, + EG_SQ_TEX_SAMPLER_WORD0_0__CLAMP_X_mask); + SETfield(t->SQ_TEX_SAMPLER0, SQ_TEX_WRAP, + EG_SQ_TEX_SAMPLER_WORD0_0__CLAMP_X_shift, + EG_SQ_TEX_SAMPLER_WORD0_0__CLAMP_X_mask); + SETfield(t->SQ_TEX_SAMPLER0, SQ_TEX_XY_FILTER_POINT, + EG_SQ_TEX_SAMPLER_WORD0_0__XY_MAG_FILTER_shift, + EG_SQ_TEX_SAMPLER_WORD0_0__XY_MAG_FILTER_mask); + SETfield(t->SQ_TEX_SAMPLER0, SQ_TEX_XY_FILTER_POINT, + EG_SQ_TEX_SAMPLER_WORD0_0__XY_MIN_FILTER_shift, + EG_SQ_TEX_SAMPLER_WORD0_0__XY_MIN_FILTER_mask); + SETfield(t->SQ_TEX_SAMPLER0, SQ_TEX_Z_FILTER_NONE, + EG_SQ_TEX_SAMPLER_WORD0_0__Z_FILTER_shift, + EG_SQ_TEX_SAMPLER_WORD0_0__Z_FILTER_mask); + SETfield(t->SQ_TEX_SAMPLER0, SQ_TEX_Z_FILTER_NONE, + EG_SQ_TEX_SAMPLER_WORD0_0__MIP_FILTER_shift, + EG_SQ_TEX_SAMPLER_WORD0_0__MIP_FILTER_mask); + SETfield(t->SQ_TEX_SAMPLER0, SQ_TEX_BORDER_COLOR_TRANS_BLACK, + EG_SQ_TEX_SAMPLER_WORD0_0__BORDER_COLOR_TYPE_shift, + EG_SQ_TEX_SAMPLER_WORD0_0__BORDER_COLOR_TYPE_mask); + + t->SQ_TEX_SAMPLER1 = 0; + SETfield(t->SQ_TEX_SAMPLER1, 0x7ff, + EG_SQ_TEX_SAMPLER_WORD1_0__MAX_LOD_shift, + EG_SQ_TEX_SAMPLER_WORD1_0__MAX_LOD_mask); + + t->SQ_TEX_SAMPLER2 = 0; + SETbit(t->SQ_TEX_SAMPLER2, EG_SQ_TEX_SAMPLER_WORD2_0__TYPE_bit); +} + +static void evergreenSetTexFilter(radeonTexObjPtr t, GLenum minf, GLenum magf, GLfloat anisotropy) +{ + /* Force revalidation to account for switches from/to mipmapping. */ + t->validated = GL_FALSE; + + /* Note that EXT_texture_filter_anisotropic is extremely vague about + * how anisotropic filtering interacts with the "normal" filter modes. + * When anisotropic filtering is enabled, we override min and mag + * filter settings completely. This includes driconf's settings. + */ + if (anisotropy >= 2.0 && (minf != GL_NEAREST) && (magf != GL_NEAREST)) { + /*t->pp_txfilter |= R300_TX_MAG_FILTER_ANISO + | R300_TX_MIN_FILTER_ANISO + | R300_TX_MIN_FILTER_MIP_LINEAR + | aniso_filter(anisotropy);*/ + radeon_print(RADEON_TEXTURE, RADEON_NORMAL, "Using maximum anisotropy of %f\n", anisotropy); + return; + } + + switch (minf) + { + case GL_NEAREST: + SETfield(t->SQ_TEX_SAMPLER0, TEX_XYFilter_Point, + EG_SQ_TEX_SAMPLER_WORD0_0__XY_MIN_FILTER_shift, + EG_SQ_TEX_SAMPLER_WORD0_0__XY_MIN_FILTER_mask); + SETfield(t->SQ_TEX_SAMPLER0, TEX_MipFilter_None, + EG_SQ_TEX_SAMPLER_WORD0_0__MIP_FILTER_shift, + EG_SQ_TEX_SAMPLER_WORD0_0__MIP_FILTER_mask); + break; + case GL_LINEAR: + SETfield(t->SQ_TEX_SAMPLER0, TEX_XYFilter_Linear, + EG_SQ_TEX_SAMPLER_WORD0_0__XY_MIN_FILTER_shift, + EG_SQ_TEX_SAMPLER_WORD0_0__XY_MIN_FILTER_mask); + SETfield(t->SQ_TEX_SAMPLER0, TEX_MipFilter_None, + EG_SQ_TEX_SAMPLER_WORD0_0__MIP_FILTER_shift, + EG_SQ_TEX_SAMPLER_WORD0_0__MIP_FILTER_mask); + break; + case GL_NEAREST_MIPMAP_NEAREST: + SETfield(t->SQ_TEX_SAMPLER0, TEX_XYFilter_Point, + EG_SQ_TEX_SAMPLER_WORD0_0__XY_MIN_FILTER_shift, + EG_SQ_TEX_SAMPLER_WORD0_0__XY_MIN_FILTER_mask); + SETfield(t->SQ_TEX_SAMPLER0, TEX_MipFilter_Point, + EG_SQ_TEX_SAMPLER_WORD0_0__MIP_FILTER_shift, + EG_SQ_TEX_SAMPLER_WORD0_0__MIP_FILTER_mask); + break; + case GL_NEAREST_MIPMAP_LINEAR: + SETfield(t->SQ_TEX_SAMPLER0, TEX_XYFilter_Point, + EG_SQ_TEX_SAMPLER_WORD0_0__XY_MIN_FILTER_shift, + EG_SQ_TEX_SAMPLER_WORD0_0__XY_MIN_FILTER_mask); + SETfield(t->SQ_TEX_SAMPLER0, TEX_MipFilter_Linear, + EG_SQ_TEX_SAMPLER_WORD0_0__MIP_FILTER_shift, + EG_SQ_TEX_SAMPLER_WORD0_0__MIP_FILTER_mask); + break; + case GL_LINEAR_MIPMAP_NEAREST: + SETfield(t->SQ_TEX_SAMPLER0, TEX_XYFilter_Linear, + EG_SQ_TEX_SAMPLER_WORD0_0__XY_MIN_FILTER_shift, + EG_SQ_TEX_SAMPLER_WORD0_0__XY_MIN_FILTER_mask); + SETfield(t->SQ_TEX_SAMPLER0, TEX_MipFilter_Point, + EG_SQ_TEX_SAMPLER_WORD0_0__MIP_FILTER_shift, + EG_SQ_TEX_SAMPLER_WORD0_0__MIP_FILTER_mask); + break; + case GL_LINEAR_MIPMAP_LINEAR: + SETfield(t->SQ_TEX_SAMPLER0, TEX_XYFilter_Linear, + EG_SQ_TEX_SAMPLER_WORD0_0__XY_MIN_FILTER_shift, + EG_SQ_TEX_SAMPLER_WORD0_0__XY_MIN_FILTER_mask); + SETfield(t->SQ_TEX_SAMPLER0, TEX_MipFilter_Linear, + EG_SQ_TEX_SAMPLER_WORD0_0__MIP_FILTER_shift, + EG_SQ_TEX_SAMPLER_WORD0_0__MIP_FILTER_mask); + break; + } + + /* Note we don't have 3D mipmaps so only use the mag filter setting + * to set the 3D texture filter mode. + */ + switch (magf) + { + case GL_NEAREST: + SETfield(t->SQ_TEX_SAMPLER0, TEX_XYFilter_Point, + EG_SQ_TEX_SAMPLER_WORD0_0__XY_MAG_FILTER_shift, + EG_SQ_TEX_SAMPLER_WORD0_0__XY_MAG_FILTER_mask); + break; + case GL_LINEAR: + SETfield(t->SQ_TEX_SAMPLER0, TEX_XYFilter_Linear, + EG_SQ_TEX_SAMPLER_WORD0_0__XY_MAG_FILTER_shift, + EG_SQ_TEX_SAMPLER_WORD0_0__XY_MAG_FILTER_mask); + break; + } +} + +static void evergreenSetTexBorderColor(radeonTexObjPtr t, const GLfloat color[4]) +{ + t->TD_PS_SAMPLER0_BORDER_ALPHA = *((uint32_t*)&(color[3])); + t->TD_PS_SAMPLER0_BORDER_RED = *((uint32_t*)&(color[2])); + t->TD_PS_SAMPLER0_BORDER_GREEN = *((uint32_t*)&(color[1])); + t->TD_PS_SAMPLER0_BORDER_BLUE = *((uint32_t*)&(color[0])); + + SETfield(t->SQ_TEX_SAMPLER0, SQ_TEX_BORDER_COLOR_REGISTER, + EG_SQ_TEX_SAMPLER_WORD0_0__BORDER_COLOR_TYPE_shift, + EG_SQ_TEX_SAMPLER_WORD0_0__BORDER_COLOR_TYPE_mask); +} + +static void evergreenSetDepthTexMode(struct gl_texture_object *tObj) +{ + radeonTexObjPtr t; + + if (!tObj) + return; + + t = radeon_tex_obj(tObj); + + if(!evergreenGetTexFormat(tObj, tObj->Image[0][tObj->BaseLevel]->TexFormat)) + t->validated = GL_FALSE; +} + +static INLINE uint32_t +EG_S_FIXED(float value, uint32_t frac_bits) +{ + return value * (1 << frac_bits); +} + +static GLboolean evergreen_setup_hardware_state(GLcontext * ctx, struct gl_texture_object *texObj, int unit) +{ + context_t *context = EVERGREEN_CONTEXT(ctx); + radeonTexObj *t = radeon_tex_obj(texObj); + const struct gl_texture_image *firstImage; + GLuint uTexelPitch, row_align; + + if (context->radeon.radeonScreen->driScreen->dri2.enabled && + t->image_override && + t->bo) + return GL_TRUE; + + firstImage = t->base.Image[0][t->minLod]; + + if (!t->image_override) { + if (!evergreenGetTexFormat(texObj, firstImage->TexFormat)) { + radeon_warning("unsupported texture format in %s\n", + __FUNCTION__); + return GL_FALSE; + } + } + + switch (texObj->Target) + { + case GL_TEXTURE_1D: + SETfield(t->SQ_TEX_RESOURCE0, SQ_TEX_DIM_1D, + EG_SQ_TEX_RESOURCE_WORD0_0__DIM_shift, + EG_SQ_TEX_RESOURCE_WORD0_0__DIM_mask); + SETfield(t->SQ_TEX_RESOURCE1, 0, + EG_SQ_TEX_RESOURCE_WORD1_0__TEX_DEPTH_shift, + EG_SQ_TEX_RESOURCE_WORD1_0__TEX_DEPTH_mask); + break; + case GL_TEXTURE_2D: + case GL_TEXTURE_RECTANGLE_NV: + SETfield(t->SQ_TEX_RESOURCE0, SQ_TEX_DIM_2D, + EG_SQ_TEX_RESOURCE_WORD0_0__DIM_shift, + EG_SQ_TEX_RESOURCE_WORD0_0__DIM_mask); + SETfield(t->SQ_TEX_RESOURCE1, 0, + EG_SQ_TEX_RESOURCE_WORD1_0__TEX_DEPTH_shift, + EG_SQ_TEX_RESOURCE_WORD1_0__TEX_DEPTH_mask); + break; + case GL_TEXTURE_3D: + SETfield(t->SQ_TEX_RESOURCE0, SQ_TEX_DIM_3D, + EG_SQ_TEX_RESOURCE_WORD0_0__DIM_shift, + EG_SQ_TEX_RESOURCE_WORD0_0__DIM_mask); + SETfield(t->SQ_TEX_RESOURCE1, (firstImage->Depth - 1), // ??? + EG_SQ_TEX_RESOURCE_WORD1_0__TEX_DEPTH_shift, + EG_SQ_TEX_RESOURCE_WORD1_0__TEX_DEPTH_mask); + break; + case GL_TEXTURE_CUBE_MAP: + SETfield(t->SQ_TEX_RESOURCE0, SQ_TEX_DIM_CUBEMAP, + EG_SQ_TEX_RESOURCE_WORD0_0__DIM_shift, + EG_SQ_TEX_RESOURCE_WORD0_0__DIM_mask); + SETfield(t->SQ_TEX_RESOURCE1, 0, + EG_SQ_TEX_RESOURCE_WORD1_0__TEX_DEPTH_shift, + EG_SQ_TEX_RESOURCE_WORD1_0__TEX_DEPTH_mask); + break; + default: + radeon_error("unexpected texture target type in %s\n", __FUNCTION__); + return GL_FALSE; + } + + row_align = context->radeon.texture_row_align - 1; + uTexelPitch = (_mesa_format_row_stride(firstImage->TexFormat, firstImage->Width) + row_align) & ~row_align; + uTexelPitch = uTexelPitch / _mesa_get_format_bytes(firstImage->TexFormat); + uTexelPitch = (uTexelPitch + R700_TEXEL_PITCH_ALIGNMENT_MASK) + & ~R700_TEXEL_PITCH_ALIGNMENT_MASK; + + /* min pitch is 8 */ + if (uTexelPitch < 8) + uTexelPitch = 8; + + SETfield(t->SQ_TEX_RESOURCE0, (uTexelPitch/8)-1, + EG_SQ_TEX_RESOURCE_WORD0_0__PITCH_shift, + EG_SQ_TEX_RESOURCE_WORD0_0__PITCH_mask); + SETfield(t->SQ_TEX_RESOURCE0, firstImage->Width - 1, + EG_SQ_TEX_RESOURCE_WORD0_0__TEX_WIDTH_shift, + EG_SQ_TEX_RESOURCE_WORD0_0__TEX_WIDTH_mask); + SETfield(t->SQ_TEX_RESOURCE1, firstImage->Height - 1, + EG_SQ_TEX_RESOURCE_WORD1_0__TEX_HEIGHT_shift, + EG_SQ_TEX_RESOURCE_WORD1_0__TEX_HEIGHT_mask); + + t->SQ_TEX_RESOURCE2 = get_base_teximage_offset(t) / 256; + + t->SQ_TEX_RESOURCE3 = radeon_miptree_image_offset(t->mt, 0, t->minLod + 1) / 256; + + SETfield(t->SQ_TEX_RESOURCE4, 0, BASE_LEVEL_shift, BASE_LEVEL_mask); + SETfield(t->SQ_TEX_RESOURCE5, t->maxLod - t->minLod, LAST_LEVEL_shift, LAST_LEVEL_mask); + + SETfield(t->SQ_TEX_SAMPLER1, + EG_S_FIXED(CLAMP(t->base.MinLod - t->minLod, 0, 15), 6), + EG_SQ_TEX_SAMPLER_WORD1_0__MIN_LOD_shift, + EG_SQ_TEX_SAMPLER_WORD1_0__MIN_LOD_mask); + SETfield(t->SQ_TEX_SAMPLER1, + EG_S_FIXED(CLAMP(t->base.MaxLod - t->minLod, 0, 15), 6), + EG_SQ_TEX_SAMPLER_WORD1_0__MAX_LOD_shift, + EG_SQ_TEX_SAMPLER_WORD1_0__MAX_LOD_mask); + SETfield(t->SQ_TEX_SAMPLER2, + EG_S_FIXED(CLAMP(ctx->Texture.Unit[unit].LodBias + t->base.LodBias, -16, 16), 6), + EG_SQ_TEX_SAMPLER_WORD2_0__LOD_BIAS_shift, + EG_SQ_TEX_SAMPLER_WORD2_0__LOD_BIAS_mask); + + if(texObj->CompareMode == GL_COMPARE_R_TO_TEXTURE_ARB) + { + SETfield(t->SQ_TEX_SAMPLER0, evergreen_translate_shadow_func(texObj->CompareFunc), + EG_SQ_TEX_SAMPLER_WORD0_0__DCF_shift, + EG_SQ_TEX_SAMPLER_WORD0_0__DCF_mask); + } + else + { + CLEARfield(t->SQ_TEX_SAMPLER0, EG_SQ_TEX_SAMPLER_WORD0_0__DCF_mask); + } + + return GL_TRUE; +} + +void evergreenSetTexOffset(__DRIcontext * pDRICtx, GLint texname, + unsigned long long offset, GLint depth, GLuint pitch) +{ + context_t *rmesa = pDRICtx->driverPrivate; + struct gl_texture_object *tObj = + _mesa_lookup_texture(rmesa->radeon.glCtx, texname); + radeonTexObjPtr t = radeon_tex_obj(tObj); + const struct gl_texture_image *firstImage; + uint32_t pitch_val, size, row_align; + + if (!tObj) + return; + + t->image_override = GL_TRUE; + + if (!offset) + return; + + firstImage = t->base.Image[0][t->minLod]; + row_align = rmesa->radeon.texture_row_align - 1; + size = ((_mesa_format_row_stride(firstImage->TexFormat, firstImage->Width) + row_align) & ~row_align) * firstImage->Height; + if (t->bo) { + radeon_bo_unref(t->bo); + t->bo = NULL; + } + t->bo = radeon_legacy_bo_alloc_fake(rmesa->radeon.radeonScreen->bom, size, offset); + t->override_offset = offset; + pitch_val = pitch; + switch (depth) { + case 32: + SETfield(t->SQ_TEX_RESOURCE7, FMT_8_8_8_8, + EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_shift, + EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_mask); + + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Z, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Y, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_W, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); + pitch_val /= 4; + break; + case 24: + default: + SETfield(t->SQ_TEX_RESOURCE7, FMT_8_8_8_8, + EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_shift, + EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_mask); + + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Z, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Y, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_1, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); + pitch_val /= 4; + break; + case 16: + SETfield(t->SQ_TEX_RESOURCE7, FMT_5_6_5, + EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_shift, + EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_mask); + + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Z, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Y, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_1, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); + pitch_val /= 2; + break; + } + + pitch_val = (pitch_val + R700_TEXEL_PITCH_ALIGNMENT_MASK) + & ~R700_TEXEL_PITCH_ALIGNMENT_MASK; + + /* min pitch is 8 */ + if (pitch_val < 8) + pitch_val = 8; + + SETfield(t->SQ_TEX_RESOURCE0, (pitch_val/8)-1, + EG_SQ_TEX_RESOURCE_WORD0_0__PITCH_shift, + EG_SQ_TEX_RESOURCE_WORD0_0__PITCH_mask); +} + +void evergreenSetTexBuffer(__DRIcontext *pDRICtx, GLint target, GLint glx_texture_format, __DRIdrawable *dPriv) +{ + struct gl_texture_unit *texUnit; + struct gl_texture_object *texObj; + struct gl_texture_image *texImage; + struct radeon_renderbuffer *rb; + radeon_texture_image *rImage; + radeonContextPtr radeon; + context_t *rmesa; + struct radeon_framebuffer *rfb; + radeonTexObjPtr t; + uint32_t pitch_val; + uint32_t internalFormat, type, format; + + type = GL_BGRA; + format = GL_UNSIGNED_BYTE; + internalFormat = (glx_texture_format == __DRI_TEXTURE_FORMAT_RGB ? 3 : 4); + + radeon = pDRICtx->driverPrivate; + rmesa = pDRICtx->driverPrivate; + + rfb = dPriv->driverPrivate; + texUnit = &radeon->glCtx->Texture.Unit[radeon->glCtx->Texture.CurrentUnit]; + texObj = _mesa_select_tex_object(radeon->glCtx, texUnit, target); + texImage = _mesa_get_tex_image(radeon->glCtx, texObj, target, 0); + + rImage = get_radeon_texture_image(texImage); + t = radeon_tex_obj(texObj); + if (t == NULL) { + return; + } + + radeon_update_renderbuffers(pDRICtx, dPriv, GL_TRUE); + rb = rfb->color_rb[0]; + if (rb->bo == NULL) { + /* Failed to BO for the buffer */ + return; + } + + _mesa_lock_texture(radeon->glCtx, texObj); + if (t->bo) { + radeon_bo_unref(t->bo); + t->bo = NULL; + } + if (rImage->bo) { + radeon_bo_unref(rImage->bo); + rImage->bo = NULL; + } + + radeon_miptree_unreference(&t->mt); + radeon_miptree_unreference(&rImage->mt); + + _mesa_init_teximage_fields(radeon->glCtx, target, texImage, + rb->base.Width, rb->base.Height, 1, 0, rb->cpp); + texImage->RowStride = rb->pitch / rb->cpp; + + rImage->bo = rb->bo; + radeon_bo_ref(rImage->bo); + t->bo = rb->bo; + radeon_bo_ref(t->bo); + t->image_override = GL_TRUE; + t->override_offset = 0; + pitch_val = rb->pitch; + switch (rb->cpp) { + case 4: + if (glx_texture_format == __DRI_TEXTURE_FORMAT_RGB) { + SETfield(t->SQ_TEX_RESOURCE7, FMT_8_8_8_8, + EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_shift, + EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_mask); + + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Z, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Y, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_1, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); + } else { + SETfield(t->SQ_TEX_RESOURCE7, FMT_8_8_8_8, + EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_shift, + EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_mask); + + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Z, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Y, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_W, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); + } + pitch_val /= 4; + break; + case 3: + default: + // FMT_8_8_8 ??? + SETfield(t->SQ_TEX_RESOURCE7, FMT_8_8_8_8, + EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_shift, + EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_mask); + + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_W, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Z, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Y, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_1, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); + pitch_val /= 4; + break; + case 2: + SETfield(t->SQ_TEX_RESOURCE7, FMT_5_6_5, + EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_shift, + EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_mask); + + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Z, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Y, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); + SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_1, + SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); + pitch_val /= 2; + break; + } + + pitch_val = (pitch_val + R700_TEXEL_PITCH_ALIGNMENT_MASK) + & ~R700_TEXEL_PITCH_ALIGNMENT_MASK; + + /* min pitch is 8 */ + if (pitch_val < 8) + pitch_val = 8; + + SETfield(t->SQ_TEX_RESOURCE0, (pitch_val/8)-1, + EG_SQ_TEX_RESOURCE_WORD0_0__PITCH_shift, + EG_SQ_TEX_RESOURCE_WORD0_0__PITCH_mask); + SETfield(t->SQ_TEX_RESOURCE0, rb->base.Width - 1, + EG_SQ_TEX_RESOURCE_WORD0_0__TEX_WIDTH_shift, + EG_SQ_TEX_RESOURCE_WORD0_0__TEX_WIDTH_mask); + SETfield(t->SQ_TEX_RESOURCE1, rb->base.Height - 1, + EG_SQ_TEX_RESOURCE_WORD1_0__TEX_HEIGHT_shift, + EG_SQ_TEX_RESOURCE_WORD1_0__TEX_HEIGHT_mask); + + t->validated = GL_TRUE; + _mesa_unlock_texture(radeon->glCtx, texObj); + return; +} + +void evergreenUpdateTextureState(GLcontext * ctx) +{ + context_t *context = EVERGREEN_CONTEXT(ctx); + EVERGREEN_CHIP_CONTEXT * evergreen = GET_EVERGREEN_CHIP(context); + struct gl_texture_unit *texUnit; + struct radeon_tex_obj *t; + GLuint unit; + + EVERGREEN_STATECHANGE(context, tx); + + for (unit = 0; unit < R700_MAX_TEXTURE_UNITS; unit++) { + texUnit = &ctx->Texture.Unit[unit]; + t = radeon_tex_obj(ctx->Texture.Unit[unit]._Current); + evergreen->textures[unit] = NULL; + if (texUnit->_ReallyEnabled) { + if (!t) + continue; + evergreen->textures[unit] = t; + } + } +} + +static GLboolean evergreen_validate_texture(GLcontext * ctx, struct gl_texture_object *texObj, int unit) +{ + radeonTexObj *t = radeon_tex_obj(texObj); + + if (!radeon_validate_texture_miptree(ctx, texObj)) + return GL_FALSE; + + /* Configure the hardware registers (more precisely, the cached version + * of the hardware registers). */ + if (!evergreen_setup_hardware_state(ctx, texObj, unit)) + return GL_FALSE; + + t->validated = GL_TRUE; + return GL_TRUE; +} + +GLboolean evergreenValidateBuffers(GLcontext * ctx) +{ + context_t *rmesa = EVERGREEN_CONTEXT(ctx); + struct radeon_renderbuffer *rrb; + struct radeon_bo *pbo; + int i; + int ret; + + radeon_cs_space_reset_bos(rmesa->radeon.cmdbuf.cs); + + rrb = radeon_get_colorbuffer(&rmesa->radeon); + /* color buffer */ + if (rrb && rrb->bo) { + radeon_cs_space_add_persistent_bo(rmesa->radeon.cmdbuf.cs, + rrb->bo, 0, + RADEON_GEM_DOMAIN_VRAM); + } + + /* depth buffer */ + rrb = radeon_get_depthbuffer(&rmesa->radeon); + if (rrb && rrb->bo) { + radeon_cs_space_add_persistent_bo(rmesa->radeon.cmdbuf.cs, + rrb->bo, 0, + RADEON_GEM_DOMAIN_VRAM); + } + + for (i = 0; i < ctx->Const.MaxTextureImageUnits; ++i) { + radeonTexObj *t; + + if (!ctx->Texture.Unit[i]._ReallyEnabled) + continue; + + if (!evergreen_validate_texture(ctx, ctx->Texture.Unit[i]._Current, i)) { + radeon_warning("failed to validate texture for unit %d.\n", i); + } + t = radeon_tex_obj(ctx->Texture.Unit[i]._Current); + if (t->image_override && t->bo) + radeon_cs_space_add_persistent_bo(rmesa->radeon.cmdbuf.cs, + t->bo, + RADEON_GEM_DOMAIN_GTT | RADEON_GEM_DOMAIN_VRAM, 0); + else if (t->mt->bo) + radeon_cs_space_add_persistent_bo(rmesa->radeon.cmdbuf.cs, + t->mt->bo, + RADEON_GEM_DOMAIN_GTT | RADEON_GEM_DOMAIN_VRAM, 0); + } + + pbo = (struct radeon_bo *)evergreenGetActiveFpShaderBo(ctx); + if (pbo) { + radeon_cs_space_add_persistent_bo(rmesa->radeon.cmdbuf.cs, pbo, + RADEON_GEM_DOMAIN_GTT, 0); + } + + pbo = (struct radeon_bo *)evergreenGetActiveVpShaderBo(ctx); + if (pbo) { + radeon_cs_space_add_persistent_bo(rmesa->radeon.cmdbuf.cs, pbo, + RADEON_GEM_DOMAIN_GTT, 0); + } + + pbo = (struct radeon_bo *)evergreenGetActiveFpShaderConstBo(ctx); + if (pbo) { + radeon_cs_space_add_persistent_bo(rmesa->radeon.cmdbuf.cs, pbo, + RADEON_GEM_DOMAIN_GTT, 0); + } + + pbo = (struct radeon_bo *)evergreenGetActiveVpShaderConstBo(ctx); + if (pbo) { + radeon_cs_space_add_persistent_bo(rmesa->radeon.cmdbuf.cs, pbo, + RADEON_GEM_DOMAIN_GTT, 0); + } + + ret = radeon_cs_space_check_with_bo(rmesa->radeon.cmdbuf.cs, first_elem(&rmesa->radeon.dma.reserved)->bo, RADEON_GEM_DOMAIN_GTT, 0); + if (ret) + return GL_FALSE; + return GL_TRUE; +} + +static struct gl_texture_object *evergreenNewTextureObject(GLcontext * ctx, + GLuint name, + GLenum target) +{ + context_t* rmesa = EVERGREEN_CONTEXT(ctx); + radeonTexObj * t = CALLOC_STRUCT(radeon_tex_obj); + + + radeon_print(RADEON_STATE | RADEON_TEXTURE, RADEON_NORMAL, + "%s( %p (target = %s) )\n", __FUNCTION__, + t, _mesa_lookup_enum_by_nr(target)); + + _mesa_initialize_texture_object(&t->base, name, target); + t->base.MaxAnisotropy = rmesa->radeon.initialMaxAnisotropy; + + evergreenSetTexDefaultState(t); + evergreenUpdateTexWrap(t); + evergreenSetTexFilter(t, t->base.MinFilter, t->base.MagFilter, t->base.MaxAnisotropy); + evergreenSetTexBorderColor(t, t->base.BorderColor.f); + + return &t->base; +} + +static void evergreenDeleteTexture(GLcontext * ctx, struct gl_texture_object *texObj) +{ + context_t * rmesa = EVERGREEN_CONTEXT(ctx); + EVERGREEN_CHIP_CONTEXT * evergreen = GET_EVERGREEN_CHIP(rmesa); + radeonTexObj* t = radeon_tex_obj(texObj); + + radeon_print(RADEON_STATE | RADEON_TEXTURE, RADEON_NORMAL, + "%s( %p (target = %s) )\n", __FUNCTION__, + (void *)texObj, + _mesa_lookup_enum_by_nr(texObj->Target)); + + if (rmesa) { + int i; + radeon_firevertices(&rmesa->radeon); + + for(i = 0; i < R700_MAX_TEXTURE_UNITS; ++i) + if (evergreen->textures[i] == t) + evergreen->textures[i] = 0; + } + + if (t->bo) { + radeon_bo_unref(t->bo); + t->bo = NULL; + } + + radeon_miptree_unreference(&t->mt); + + _mesa_delete_texture_object(ctx, texObj); +} + +static void evergreenTexParameter(GLcontext * ctx, GLenum target, + struct gl_texture_object *texObj, + GLenum pname, const GLfloat * params) +{ + radeonTexObj* t = radeon_tex_obj(texObj); + GLenum baseFormat; + + radeon_print(RADEON_STATE | RADEON_TEXTURE, RADEON_VERBOSE, + "%s( %s )\n", __FUNCTION__, + _mesa_lookup_enum_by_nr(pname)); + + switch (pname) { + case GL_TEXTURE_MIN_FILTER: + case GL_TEXTURE_MAG_FILTER: + case GL_TEXTURE_MAX_ANISOTROPY_EXT: + evergreenSetTexFilter(t, texObj->MinFilter, texObj->MagFilter, texObj->MaxAnisotropy); + break; + + case GL_TEXTURE_WRAP_S: + case GL_TEXTURE_WRAP_T: + case GL_TEXTURE_WRAP_R: + evergreenUpdateTexWrap(t); + break; + + case GL_TEXTURE_BORDER_COLOR: + evergreenSetTexBorderColor(t, texObj->BorderColor.f); + break; + + case GL_TEXTURE_BASE_LEVEL: + case GL_TEXTURE_MAX_LEVEL: + case GL_TEXTURE_MIN_LOD: + case GL_TEXTURE_MAX_LOD: + t->validated = GL_FALSE; + break; + + case GL_DEPTH_TEXTURE_MODE: + if (!texObj->Image[0][texObj->BaseLevel]) + return; + baseFormat = texObj->Image[0][texObj->BaseLevel]->_BaseFormat; + if (baseFormat == GL_DEPTH_COMPONENT || + baseFormat == GL_DEPTH_STENCIL) { + evergreenSetDepthTexMode(texObj); + break; + } else { + /* If the texture isn't a depth texture, changing this + * state won't cause any changes to the hardware. + * Don't force a flush of texture state. + */ + return; + } + + default: + return; + } +} + +void evergreenInitTextureFuncs(radeonContextPtr radeon, struct dd_function_table *functions) +{ + /* Note: we only plug in the functions we implement in the driver + * since _mesa_init_driver_functions() was already called. + */ + functions->NewTextureImage = radeonNewTextureImage; + functions->FreeTexImageData = radeonFreeTexImageData; + functions->MapTexture = radeonMapTexture; + functions->UnmapTexture = radeonUnmapTexture; + + functions->ChooseTextureFormat = radeonChooseTextureFormat_mesa; + functions->TexImage1D = radeonTexImage1D; + functions->TexImage2D = radeonTexImage2D; + functions->TexImage3D = radeonTexImage3D; + functions->TexSubImage1D = radeonTexSubImage1D; + functions->TexSubImage2D = radeonTexSubImage2D; + functions->TexSubImage3D = radeonTexSubImage3D; + functions->GetTexImage = radeonGetTexImage; + functions->GetCompressedTexImage = radeonGetCompressedTexImage; + functions->NewTextureObject = evergreenNewTextureObject; + functions->DeleteTexture = evergreenDeleteTexture; + functions->IsTextureResident = driIsTextureResident; + + functions->TexParameter = evergreenTexParameter; + + functions->CompressedTexImage2D = radeonCompressedTexImage2D; + functions->CompressedTexSubImage2D = radeonCompressedTexSubImage2D; + + if (radeon->radeonScreen->kernel_mm) { + functions->CopyTexImage2D = radeonCopyTexImage2D; + functions->CopyTexSubImage2D = radeonCopyTexSubImage2D; + } + + functions->GenerateMipmap = radeonGenerateMipmap; + + driInitTextureFormats(); +} diff --git a/src/mesa/drivers/dri/r600/evergreen_tex.h b/src/mesa/drivers/dri/r600/evergreen_tex.h new file mode 100644 index 0000000000..b43508a9ea --- /dev/null +++ b/src/mesa/drivers/dri/r600/evergreen_tex.h @@ -0,0 +1,38 @@ +/* + * Copyright (C) 2008-2010 Advanced Micro Devices, Inc. + * + * 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 + * THE COPYRIGHT HOLDER(S) 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. + */ + +/* + * Authors: + * Richard Li , + */ + +#ifndef _EVERGREEN_TEX_H_ +#define _EVERGREEN_TEX_H_ + +extern GLboolean evergreenValidateBuffers(GLcontext * ctx); + +extern void evergreenUpdateTextureState(GLcontext * ctx); +extern void evergreenInitTextureFuncs(radeonContextPtr radeon, struct dd_function_table *functions); +extern void evergreenSetTexOffset(__DRIcontext * pDRICtx, GLint texname, + unsigned long long offset, GLint depth, GLuint pitch); +extern void evergreenSetTexBuffer(__DRIcontext *pDRICtx, GLint target, GLint glx_texture_format, __DRIdrawable *dPriv); + +#endif /* _EVERGREEN_TEX_H_ */ diff --git a/src/mesa/drivers/dri/r600/evergreen_vertprog.c b/src/mesa/drivers/dri/r600/evergreen_vertprog.c new file mode 100644 index 0000000000..38f3c61ddb --- /dev/null +++ b/src/mesa/drivers/dri/r600/evergreen_vertprog.c @@ -0,0 +1,729 @@ +/* + * Copyright (C) 2008-2009 Advanced Micro Devices, Inc. + * + * 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 + * THE COPYRIGHT HOLDER(S) 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. + */ + +/* + * Authors: + * Richard Li , + */ + + +#include +#include +#include +#include +#include + +#include "main/imports.h" +#include "main/mtypes.h" + +#include "tnl/t_context.h" +#include "program/program.h" +#include "program/prog_parameter.h" +#include "program/prog_statevars.h" + +#include "radeon_debug.h" +#include "r600_context.h" +#include "r600_cmdbuf.h" +#include "program/programopt.h" + +#include "r700_debug.h" +#include "evergreen_vertprog.h" + +unsigned int evergreen_Map_Vertex_Output(r700_AssemblerBase *pAsm, + struct gl_vertex_program *mesa_vp, + unsigned int unStart) +{ + unsigned int i; + unsigned int unBit; + unsigned int unTotal = unStart; + + //!!!!!!! THE ORDER MATCH FS INPUT + + unBit = 1 << VERT_RESULT_HPOS; + if(mesa_vp->Base.OutputsWritten & unBit) + { + pAsm->ucVP_OutputMap[VERT_RESULT_HPOS] = unTotal++; + } + + unBit = 1 << VERT_RESULT_COL0; + if(mesa_vp->Base.OutputsWritten & unBit) + { + pAsm->ucVP_OutputMap[VERT_RESULT_COL0] = unTotal++; + } + + unBit = 1 << VERT_RESULT_COL1; + if(mesa_vp->Base.OutputsWritten & unBit) + { + pAsm->ucVP_OutputMap[VERT_RESULT_COL1] = unTotal++; + } + + //TODO : dealing back face. + unBit = 1 << VERT_RESULT_BFC0; + if(mesa_vp->Base.OutputsWritten & unBit) + { + pAsm->ucVP_OutputMap[VERT_RESULT_BFC0] = unTotal++; + } + + unBit = 1 << VERT_RESULT_BFC1; + if(mesa_vp->Base.OutputsWritten & unBit) + { + pAsm->ucVP_OutputMap[VERT_RESULT_BFC1] = unTotal++; + } + + //TODO : dealing fog. + unBit = 1 << VERT_RESULT_FOGC; + if(mesa_vp->Base.OutputsWritten & unBit) + { + pAsm->ucVP_OutputMap[VERT_RESULT_FOGC] = unTotal++; + } + + //TODO : dealing point size. + unBit = 1 << VERT_RESULT_PSIZ; + if(mesa_vp->Base.OutputsWritten & unBit) + { + pAsm->ucVP_OutputMap[VERT_RESULT_PSIZ] = unTotal++; + } + + for(i=0; i<8; i++) + { + unBit = 1 << (VERT_RESULT_TEX0 + i); + if(mesa_vp->Base.OutputsWritten & unBit) + { + pAsm->ucVP_OutputMap[VERT_RESULT_TEX0 + i] = unTotal++; + } + } + + for(i=VERT_RESULT_VAR0; iBase.OutputsWritten & unBit) + { + pAsm->ucVP_OutputMap[i] = unTotal++; + } + } + + return (unTotal - unStart); +} + +unsigned int evergreen_Map_Vertex_Input(r700_AssemblerBase *pAsm, + struct gl_vertex_program *mesa_vp, + unsigned int unStart) +{ + int i; + unsigned int unBit; + unsigned int unTotal = unStart; + for(i=0; iBase.InputsRead & unBit) + { + pAsm->ucVP_AttributeMap[i] = unTotal++; + } + } + return (unTotal - unStart); +} + +GLboolean evergreen_Process_Vertex_Program_Vfetch_Instructions( + struct evergreen_vertex_program *vp, + struct gl_vertex_program *mesa_vp) +{ + int i; + unsigned int unBit; + VTX_FETCH_METHOD vtxFetchMethod; + vtxFetchMethod.bEnableMini = GL_FALSE; + vtxFetchMethod.mega_fetch_remainder = 0; + + for(i=0; iBase.InputsRead & unBit) + { + assemble_vfetch_instruction(&vp->r700AsmCode, + i, + vp->r700AsmCode.ucVP_AttributeMap[i], + vp->aos_desc[i].size, + vp->aos_desc[i].type, + &vtxFetchMethod); + } + } + + return GL_TRUE; +} + +GLboolean evergreen_Process_Vertex_Program_Vfetch_Instructions2( + GLcontext *ctx, + struct evergreen_vertex_program *vp, + struct gl_vertex_program *mesa_vp) +{ + int i; + context_t *context = R700_CONTEXT(ctx); + + VTX_FETCH_METHOD vtxFetchMethod; + vtxFetchMethod.bEnableMini = GL_FALSE; + vtxFetchMethod.mega_fetch_remainder = 0; + + for(i=0; inNumActiveAos; i++) + { + EG_assemble_vfetch_instruction(&vp->r700AsmCode, + vp->r700AsmCode.ucVP_AttributeMap[context->stream_desc[i].element], + context->stream_desc[i].type, + context->stream_desc[i].size, + context->stream_desc[i].element, + context->stream_desc[i]._signed, + context->stream_desc[i].normalize, + context->stream_desc[i].format, + &vtxFetchMethod); + } + + return GL_TRUE; +} + +void evergreen_Map_Vertex_Program(GLcontext *ctx, + struct evergreen_vertex_program *vp, + struct gl_vertex_program *mesa_vp) +{ + GLuint ui; + r700_AssemblerBase *pAsm = &(vp->r700AsmCode); + unsigned int num_inputs; + + // R0 will always be used for index into vertex buffer + pAsm->number_used_registers = 1; + pAsm->starting_vfetch_register_number = pAsm->number_used_registers; + + // Map Inputs: Add 1 to mapping since R0 is used for index + num_inputs = evergreen_Map_Vertex_Input(pAsm, mesa_vp, pAsm->number_used_registers); + pAsm->number_used_registers += num_inputs; + + // Create VFETCH instructions for inputs + if (GL_TRUE != evergreen_Process_Vertex_Program_Vfetch_Instructions2(ctx, vp, mesa_vp) ) + { + radeon_error("Calling evergreen_Process_Vertex_Program_Vfetch_Instructions2 return error. \n"); + return; + } + + // Map Outputs + pAsm->number_of_exports = evergreen_Map_Vertex_Output(pAsm, mesa_vp, pAsm->number_used_registers); + + pAsm->starting_export_register_number = pAsm->number_used_registers; + + pAsm->number_used_registers += pAsm->number_of_exports; + + pAsm->pucOutMask = (unsigned char*) MALLOC(pAsm->number_of_exports); + + for(ui=0; uinumber_of_exports; ui++) + { + pAsm->pucOutMask[ui] = 0x0; + } + + /* Map temporary registers (GPRs) */ + pAsm->starting_temp_register_number = pAsm->number_used_registers; + + if(mesa_vp->Base.NumNativeTemporaries >= mesa_vp->Base.NumTemporaries) + { /* arb uses NumNativeTemporaries */ + pAsm->number_used_registers += mesa_vp->Base.NumNativeTemporaries; + } + else + { /* fix func t_vp uses NumTemporaries */ + pAsm->number_used_registers += mesa_vp->Base.NumTemporaries; + } + + pAsm->flag_reg_index = pAsm->number_used_registers++; + + pAsm->uFirstHelpReg = pAsm->number_used_registers; +} + +GLboolean evergreen_Find_Instruction_Dependencies_vp(struct evergreen_vertex_program *vp, + struct gl_vertex_program *mesa_vp) +{ + GLuint i, j; + GLint * puiTEMPwrites; + struct prog_instruction *pILInst; + InstDeps *pInstDeps; + + puiTEMPwrites = (GLint*) MALLOC(sizeof(GLuint)*mesa_vp->Base.NumTemporaries); + for(i=0; iBase.NumTemporaries; i++) + { + puiTEMPwrites[i] = -1; + } + + pInstDeps = (InstDeps*)MALLOC(sizeof(InstDeps)*mesa_vp->Base.NumInstructions); + + for(i=0; iBase.NumInstructions; i++) + { + pInstDeps[i].nDstDep = -1; + pILInst = &(mesa_vp->Base.Instructions[i]); + + //Dst + if(pILInst->DstReg.File == PROGRAM_TEMPORARY) + { + //Set lastwrite for the temp + puiTEMPwrites[pILInst->DstReg.Index] = i; + } + + //Src + for(j=0; j<3; j++) + { + if(pILInst->SrcReg[j].File == PROGRAM_TEMPORARY) + { + //Set dep. + pInstDeps[i].nSrcDeps[j] = puiTEMPwrites[pILInst->SrcReg[j].Index]; + } + else + { + pInstDeps[i].nSrcDeps[j] = -1; + } + } + } + + vp->r700AsmCode.pInstDeps = pInstDeps; + + FREE(puiTEMPwrites); + + return GL_TRUE; +} + +struct evergreen_vertex_program* evergreenTranslateVertexShader(GLcontext *ctx, + struct gl_vertex_program *mesa_vp) +{ + context_t *context = EVERGREEN_CONTEXT(ctx); + + struct evergreen_vertex_program *vp; + unsigned int i; + + vp = calloc(1, sizeof(*vp)); + vp->mesa_program = _mesa_clone_vertex_program(ctx, mesa_vp); + + vp->constbo0 = NULL; + + if (mesa_vp->IsPositionInvariant) + { + _mesa_insert_mvp_code(ctx, vp->mesa_program); + } + + for(i=0; inNumActiveAos; i++) + { + vp->aos_desc[i].size = context->stream_desc[i].size; + vp->aos_desc[i].stride = context->stream_desc[i].stride; + vp->aos_desc[i].type = context->stream_desc[i].type; + vp->aos_desc[i].format = context->stream_desc[i].format; + } + + if (context->radeon.radeonScreen->chip_family < CHIP_FAMILY_RV770) + { + vp->r700AsmCode.bR6xx = 1; + } + + //Init_Program + Init_r700_AssemblerBase(SPT_VP, &(vp->r700AsmCode), &(vp->r700Shader) ); + + vp->r700AsmCode.bUseMemConstant = GL_TRUE; + vp->r700AsmCode.unAsic = 8; + + evergreen_Map_Vertex_Program(ctx, vp, vp->mesa_program ); + + if(GL_FALSE == evergreen_Find_Instruction_Dependencies_vp(vp, vp->mesa_program)) + { + return NULL; + } + + InitShaderProgram(&(vp->r700AsmCode)); + + for(i=0; i < MAX_SAMPLERS; i++) + { + vp->r700AsmCode.SamplerUnits[i] = vp->mesa_program->Base.SamplerUnits[i]; + } + + vp->r700AsmCode.unCurNumILInsts = vp->mesa_program->Base.NumInstructions; + + if(GL_FALSE == AssembleInstr(0, + 0, + vp->mesa_program->Base.NumInstructions, + &(vp->mesa_program->Base.Instructions[0]), + &(vp->r700AsmCode)) ) + { + return NULL; + } + + if(GL_FALSE == Process_Vertex_Exports(&(vp->r700AsmCode), vp->mesa_program->Base.OutputsWritten) ) + { + return NULL; + } + + if( GL_FALSE == RelocProgram(&(vp->r700AsmCode), &(vp->mesa_program->Base)) ) + { + return GL_FALSE; + } + + vp->r700Shader.nRegs = (vp->r700AsmCode.number_used_registers == 0) ? 0 + : (vp->r700AsmCode.number_used_registers - 1); + + vp->r700Shader.nParamExports = vp->r700AsmCode.number_of_exports; + + vp->translated = GL_TRUE; + + return vp; +} + +void evergreenSelectVertexShader(GLcontext *ctx) +{ + context_t *context = EVERGREEN_CONTEXT(ctx); + struct evergreen_vertex_program_cont *vpc; + struct evergreen_vertex_program *vp; + unsigned int i; + GLboolean match; + GLbitfield InputsRead; + + vpc = (struct evergreen_vertex_program_cont *)ctx->VertexProgram._Current; + + InputsRead = vpc->mesa_program.Base.InputsRead; + if (vpc->mesa_program.IsPositionInvariant) + { + InputsRead |= VERT_BIT_POS; + } + + for (vp = vpc->progs; vp; vp = vp->next) + { + match = GL_TRUE; + for(i=0; inNumActiveAos; i++) + { + if (vp->aos_desc[i].size != context->stream_desc[i].size || + vp->aos_desc[i].format != context->stream_desc[i].format) + { + match = GL_FALSE; + break; + } + } + if (match) + { + context->selected_vp = vp; + return; + } + } + + vp = evergreenTranslateVertexShader(ctx, &(vpc->mesa_program)); + if(!vp) + { + radeon_error("Failed to translate vertex shader. \n"); + return; + } + vp->next = vpc->progs; + vpc->progs = vp; + context->selected_vp = vp; + return; +} + +int evergreen_getTypeSize(GLenum type) +{ + switch (type) + { + case GL_DOUBLE: + return sizeof(GLdouble); + case GL_FLOAT: + return sizeof(GLfloat); + case GL_INT: + return sizeof(GLint); + case GL_UNSIGNED_INT: + return sizeof(GLuint); + case GL_SHORT: + return sizeof(GLshort); + case GL_UNSIGNED_SHORT: + return sizeof(GLushort); + case GL_BYTE: + return sizeof(GLbyte); + case GL_UNSIGNED_BYTE: + return sizeof(GLubyte); + default: + assert(0); + return 0; + } +} + +static void evergreenTranslateAttrib(GLcontext *ctx, GLuint unLoc, int count, const struct gl_client_array *input) +{ + context_t *context = EVERGREEN_CONTEXT(ctx); + + StreamDesc * pStreamDesc = &(context->stream_desc[context->nNumActiveAos]); + + GLuint stride; + + stride = (input->StrideB == 0) ? evergreen_getTypeSize(input->Type) * input->Size + : input->StrideB; + + if (input->Type == GL_DOUBLE || input->Type == GL_UNSIGNED_INT || input->Type == GL_INT || +#if MESA_BIG_ENDIAN + evergreen_getTypeSize(input->Type) != 4 || +#endif + stride < 4) + { + pStreamDesc->type = GL_FLOAT; + + if (input->StrideB == 0) + { + pStreamDesc->stride = 0; + } + else + { + pStreamDesc->stride = sizeof(GLfloat) * input->Size; + } + pStreamDesc->dwords = input->Size; + pStreamDesc->is_named_bo = GL_FALSE; + } + else + { + pStreamDesc->type = input->Type; + pStreamDesc->dwords = (evergreen_getTypeSize(input->Type) * input->Size + 3)/ 4; + if (!input->BufferObj->Name) + { + if (input->StrideB == 0) + { + pStreamDesc->stride = 0; + } + else + { + pStreamDesc->stride = (evergreen_getTypeSize(pStreamDesc->type) * input->Size + 3) & ~3; + } + + pStreamDesc->is_named_bo = GL_FALSE; + } + } + + pStreamDesc->size = input->Size; + pStreamDesc->dst_loc = context->nNumActiveAos; + pStreamDesc->element = unLoc; + pStreamDesc->format = input->Format; + + switch (pStreamDesc->type) + { //GetSurfaceFormat + case GL_FLOAT: + pStreamDesc->_signed = 0; + pStreamDesc->normalize = GL_FALSE; + break; + case GL_SHORT: + pStreamDesc->_signed = 1; + pStreamDesc->normalize = input->Normalized; + break; + case GL_BYTE: + pStreamDesc->_signed = 1; + pStreamDesc->normalize = input->Normalized; + break; + case GL_UNSIGNED_SHORT: + pStreamDesc->_signed = 0; + pStreamDesc->normalize = input->Normalized; + break; + case GL_UNSIGNED_BYTE: + pStreamDesc->_signed = 0; + pStreamDesc->normalize = input->Normalized; + break; + default: + case GL_INT: + case GL_UNSIGNED_INT: + case GL_DOUBLE: + assert(0); + break; + } + context->nNumActiveAos++; +} + +void evergreenSetVertexFormat(GLcontext *ctx, const struct gl_client_array *arrays[], int count) +{ + context_t *context = EVERGREEN_CONTEXT(ctx); + struct evergreen_vertex_program *vpc + = (struct evergreen_vertex_program *)ctx->VertexProgram._Current; + + struct gl_vertex_program * mesa_vp = (struct gl_vertex_program *)&(vpc->mesa_program); + unsigned int unLoc = 0; + unsigned int unBit = mesa_vp->Base.InputsRead; + context->nNumActiveAos = 0; + + if (mesa_vp->IsPositionInvariant) + { + unBit |= VERT_BIT_POS; + } + + while(unBit) + { + if(unBit & 1) + { + evergreenTranslateAttrib(ctx, unLoc, count, arrays[unLoc]); + } + + unBit >>= 1; + ++unLoc; + } + context->radeon.tcl.aos_count = context->nNumActiveAos; +} + +void * evergreenGetActiveVpShaderBo(GLcontext * ctx) +{ + context_t *context = EVERGREEN_CONTEXT(ctx); + struct evergreen_vertex_program *vp = context->selected_vp;; + + if (vp) + return vp->shaderbo; + else + return NULL; +} + +void * evergreenGetActiveVpShaderConstBo(GLcontext * ctx) +{ + context_t *context = EVERGREEN_CONTEXT(ctx); + struct evergreen_vertex_program *vp = context->selected_vp;; + + if (vp) + return vp->constbo0; + else + return NULL; +} + +GLboolean evergreenSetupVertexProgram(GLcontext * ctx) +{ + context_t *context = EVERGREEN_CONTEXT(ctx); + EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); + struct evergreen_vertex_program *vp = context->selected_vp; + + struct gl_program_parameter_list *paramList; + unsigned int unNumParamData; + unsigned int ui; + + if(GL_FALSE == vp->loaded) + { + if(vp->r700Shader.bNeedsAssembly == GL_TRUE) + { + Assemble( &(vp->r700Shader) ); + } + + /* Load vp to gpu */ + r600EmitShader(ctx, + &(vp->shaderbo), + (GLvoid *)(vp->r700Shader.pProgram), + vp->r700Shader.uShaderBinaryDWORDSize, + "VS"); + + vp->loaded = GL_TRUE; + } + + EVERGREEN_STATECHANGE(context, vs); + + /* TODO : enable this after MemUse fixed *= + (context->chipobj.MemUse)(context, vp->shadercode.buf->id); + */ + + evergreen->SQ_PGM_RESOURCES_VS.u32All = 0; + SETbit(evergreen->SQ_PGM_RESOURCES_VS.u32All, PGM_RESOURCES__PRIME_CACHE_ON_DRAW_bit); + + evergreen->vs.SQ_ALU_CONST_CACHE_VS_0.u32All = 0; /* set from buffer object. */ + + evergreen->vs.SQ_PGM_START_VS.u32All = 0; + + SETfield(evergreen->SQ_PGM_RESOURCES_VS.u32All, vp->r700Shader.nRegs + 1, + NUM_GPRS_shift, NUM_GPRS_mask); + + if(vp->r700Shader.uStackSize) /* we don't use branch for now, it should be zero. */ + { + SETfield(evergreen->SQ_PGM_RESOURCES_VS.u32All, vp->r700Shader.uStackSize, + STACK_SIZE_shift, STACK_SIZE_mask); + } + + EVERGREEN_STATECHANGE(context, spi); + + SETfield(evergreen->SPI_VS_OUT_CONFIG.u32All, + vp->r700Shader.nParamExports ? (vp->r700Shader.nParamExports - 1) : 0, + VS_EXPORT_COUNT_shift, VS_EXPORT_COUNT_mask); + SETfield(evergreen->SPI_PS_IN_CONTROL_0.u32All, vp->r700Shader.nParamExports, + NUM_INTERP_shift, NUM_INTERP_mask); + + /* + SETbit(evergreen->SPI_PS_IN_CONTROL_0.u32All, PERSP_GRADIENT_ENA_bit); + CLEARbit(evergreen->SPI_PS_IN_CONTROL_0.u32All, LINEAR_GRADIENT_ENA_bit); + */ + + /* sent out shader constants. */ + paramList = vp->mesa_program->Base.Parameters; + + if(NULL != paramList) { + /* vp->mesa_program was cloned, not updated by glsl shader api. */ + /* _mesa_reference_program has already checked glsl shProg is ok and set ctx->VertexProgem._Current */ + /* so, use ctx->VertexProgem._Current */ + struct gl_program_parameter_list *paramListOrginal = + ctx->VertexProgram._Current->Base.Parameters; + + _mesa_load_state_parameters(ctx, paramList); + + if (paramList->NumParameters > EVERGREEN_MAX_DX9_CONSTS) + return GL_FALSE; + + EVERGREEN_STATECHANGE(context, vs); + + evergreen->vs.num_consts = paramList->NumParameters; + + unNumParamData = paramList->NumParameters; + + for(ui=0; uiParameters[ui].Type == PROGRAM_UNIFORM) + { + evergreen->vs.consts[ui][0].f32All = paramListOrginal->ParameterValues[ui][0]; + evergreen->vs.consts[ui][1].f32All = paramListOrginal->ParameterValues[ui][1]; + evergreen->vs.consts[ui][2].f32All = paramListOrginal->ParameterValues[ui][2]; + evergreen->vs.consts[ui][3].f32All = paramListOrginal->ParameterValues[ui][3]; + } + else + { + evergreen->vs.consts[ui][0].f32All = paramList->ParameterValues[ui][0]; + evergreen->vs.consts[ui][1].f32All = paramList->ParameterValues[ui][1]; + evergreen->vs.consts[ui][2].f32All = paramList->ParameterValues[ui][2]; + evergreen->vs.consts[ui][3].f32All = paramList->ParameterValues[ui][3]; + } + } + + radeonAllocDmaRegion(&context->radeon, + &context->vp_Constbo, + &context->vp_bo_offset, + 256, + 256); + r600EmitShaderConsts(ctx, + context->vp_Constbo, + context->vp_bo_offset, + (GLvoid *)&(evergreen->vs.consts[0][0]), + unNumParamData * 4 * 4); + } else + evergreen->vs.num_consts = 0; + + COMPILED_SUB * pCompiledSub; + GLuint uj; + GLuint unConstOffset = evergreen->vs.num_consts; + for(ui=0; uir700AsmCode.unNumPresub; ui++) + { + pCompiledSub = vp->r700AsmCode.presubs[ui].pCompiledSub; + + evergreen->vs.num_consts += pCompiledSub->NumParameters; + + for(uj=0; ujNumParameters; uj++) + { + evergreen->vs.consts[uj + unConstOffset][0].f32All = pCompiledSub->ParameterValues[uj][0]; + evergreen->vs.consts[uj + unConstOffset][1].f32All = pCompiledSub->ParameterValues[uj][1]; + evergreen->vs.consts[uj + unConstOffset][2].f32All = pCompiledSub->ParameterValues[uj][2]; + evergreen->vs.consts[uj + unConstOffset][3].f32All = pCompiledSub->ParameterValues[uj][3]; + } + unConstOffset += pCompiledSub->NumParameters; + } + + return GL_TRUE; +} diff --git a/src/mesa/drivers/dri/r600/evergreen_vertprog.h b/src/mesa/drivers/dri/r600/evergreen_vertprog.h new file mode 100644 index 0000000000..4c2626de77 --- /dev/null +++ b/src/mesa/drivers/dri/r600/evergreen_vertprog.h @@ -0,0 +1,107 @@ +/* + * Copyright (C) 2008-2009 Advanced Micro Devices, Inc. + * + * 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 + * THE COPYRIGHT HOLDER(S) 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. + */ + +/* + * Authors: + * Richard Li , + */ + + +#ifndef _EVERGREEN_VERTPROG_H_ +#define _EVERGREEN_VERTPROG_H_ + +#include "main/glheader.h" +#include "main/mtypes.h" + +#include "r700_shader.h" +#include "r700_assembler.h" + +typedef struct evergreenArrayDesc //TEMP +{ + GLint size; //number of data element + GLenum type; //data element type + GLsizei stride; + GLenum format; //GL_RGBA or GL_BGRA +} evergreenArrayDesc; + +struct evergreen_vertex_program +{ + struct gl_vertex_program *mesa_program; /* Must be first */ + + struct evergreen_vertex_program *next; + + r700_AssemblerBase r700AsmCode; + R700_Shader r700Shader; + + GLboolean translated; + GLboolean loaded; + + void * shaderbo; + + GLuint K0used; + void * constbo0; + + evergreenArrayDesc aos_desc[VERT_ATTRIB_MAX]; +}; + +struct evergreen_vertex_program_cont +{ + struct gl_vertex_program mesa_program; + + struct evergreen_vertex_program *progs; +}; + +//Internal +unsigned int evergreen_Map_Vertex_Output(r700_AssemblerBase *pAsm, + struct gl_vertex_program *mesa_vp, + unsigned int unStart); +unsigned int evergreen_Map_Vertex_Input(r700_AssemblerBase *pAsm, + struct gl_vertex_program *mesa_vp, + unsigned int unStart); +GLboolean evergreen_Process_Vertex_Program_Vfetch_Instructions( + struct evergreen_vertex_program *vp, + struct gl_vertex_program *mesa_vp); +GLboolean evergreen_Process_Vertex_Program_Vfetch_Instructions2( + GLcontext *ctx, + struct evergreen_vertex_program *vp, + struct gl_vertex_program *mesa_vp); +void evergreen_Map_Vertex_Program(GLcontext *ctx, + struct evergreen_vertex_program *vp, + struct gl_vertex_program *mesa_vp); +GLboolean evergreen_Find_Instruction_Dependencies_vp(struct evergreen_vertex_program *vp, + struct gl_vertex_program *mesa_vp); + +struct evergreen_vertex_program* evergreenTranslateVertexShader(GLcontext *ctx, + struct gl_vertex_program *mesa_vp); + +/* Interface */ +extern void evergreenSelectVertexShader(GLcontext *ctx); +extern void evergreenSetVertexFormat(GLcontext *ctx, const struct gl_client_array *arrays[], int count); + +extern GLboolean evergreenSetupVertexProgram(GLcontext * ctx); + +extern void * evergreenGetActiveVpShaderBo(GLcontext * ctx); + +extern void * evergreenGetActiveVpShaderConstBo(GLcontext * ctx); + +extern int evergreen_getTypeSize(GLenum type); + +#endif /* _EVERGREEN_VERTPROG_H_ */ diff --git a/src/mesa/drivers/dri/r600/r600_cmdbuf.c b/src/mesa/drivers/dri/r600/r600_cmdbuf.c index 8013553f67..b3331fc8b8 100644 --- a/src/mesa/drivers/dri/r600/r600_cmdbuf.c +++ b/src/mesa/drivers/dri/r600/r600_cmdbuf.c @@ -473,7 +473,14 @@ void r600InitCmdBuf(context_t *r600) /* from rcommonInitCmdBuf */ radeonContextPtr rmesa = &r600->radeon; GLuint size; - r600InitAtoms(r600); + if(r600->radeon.radeonScreen->chip_family >= CHIP_FAMILY_CEDAR) + { + evergreenInitAtoms(r600); + } + else + { + r600InitAtoms(r600); + } /* Initialize command buffer */ size = 256 * driQueryOptioni(&rmesa->optionCache, diff --git a/src/mesa/drivers/dri/r600/r600_cmdbuf.h b/src/mesa/drivers/dri/r600/r600_cmdbuf.h index 78fccd0b60..f102ba6d6b 100644 --- a/src/mesa/drivers/dri/r600/r600_cmdbuf.h +++ b/src/mesa/drivers/dri/r600/r600_cmdbuf.h @@ -190,6 +190,46 @@ do { \ #define R600_OUT_BATCH_REGSEQ(reg, count) \ R600_OUT_BATCH_REGS((reg), (count)) +/* evergreen */ +#define EVERGREEN_OUT_BATCH_REGS(reg, num) \ +do { \ + if ((reg) >= R600_SET_CONFIG_REG_OFFSET && (reg) < R600_SET_CONFIG_REG_END) { \ + R600_OUT_BATCH(CP_PACKET3(R600_IT_SET_CONFIG_REG, (num))); \ + R600_OUT_BATCH(((reg) - R600_SET_CONFIG_REG_OFFSET) >> 2); \ + } else if ((reg) >= R600_SET_CONTEXT_REG_OFFSET && (reg) < R600_SET_CONTEXT_REG_END) { \ + R600_OUT_BATCH(CP_PACKET3(R600_IT_SET_CONTEXT_REG, (num))); \ + R600_OUT_BATCH(((reg) - R600_SET_CONTEXT_REG_OFFSET) >> 2); \ + } else if ((reg) >= EG_SET_RESOURCE_OFFSET && (reg) < EG_SET_RESOURCE_END) { \ + R600_OUT_BATCH(CP_PACKET3(R600_IT_SET_RESOURCE, (num))); \ + R600_OUT_BATCH(((reg) - EG_SET_RESOURCE_OFFSET) >> 2); \ + } else if ((reg) >= EG_SET_LOOP_CONST_OFFSET && (reg) < EG_SET_LOOP_CONST_END) { \ + R600_OUT_BATCH(CP_PACKET3(R600_IT_SET_LOOP_CONST, (num))); \ + R600_OUT_BATCH(((reg) - EG_SET_LOOP_CONST_OFFSET) >> 2); \ + } else if ((reg) >= R600_SET_SAMPLER_OFFSET && (reg) < R600_SET_SAMPLER_END) { \ + R600_OUT_BATCH(CP_PACKET3(R600_IT_SET_SAMPLER, (num))); \ + R600_OUT_BATCH(((reg) - R600_SET_SAMPLER_OFFSET) >> 2); \ + } else if ((reg) >= R600_SET_CTL_CONST_OFFSET && (reg) < R600_SET_CTL_CONST_END) { \ + R600_OUT_BATCH(CP_PACKET3(R600_IT_SET_CTL_CONST, (num))); \ + R600_OUT_BATCH(((reg) - R600_SET_CTL_CONST_OFFSET) >> 2); \ + } else if ((reg) >= EG_SET_BOOL_CONST_OFFSET && (reg) < EG_SET_BOOL_CONST_END) { \ + R600_OUT_BATCH(CP_PACKET3(R600_IT_SET_BOOL_CONST, (num))); \ + R600_OUT_BATCH(((reg) - EG_SET_BOOL_CONST_OFFSET) >> 2); \ + } else { \ + R600_OUT_BATCH(CP_PACKET0((reg), (num))); \ + } \ +} while (0) + +/** Single register write to command buffer; requires 3 dwords for most things. */ +#define EVERGREEN_OUT_BATCH_REGVAL(reg, val) \ + EVERGREEN_OUT_BATCH_REGS((reg), 1); \ + R600_OUT_BATCH((val)) + +/** Continuous register range write to command buffer; requires 1 dword, + * expects count dwords afterwards for register contents. */ +#define EVERGREEN_OUT_BATCH_REGSEQ(reg, count) \ + EVERGREEN_OUT_BATCH_REGS((reg), (count)) + + extern void r600InitCmdBuf(context_t *r600); #endif /* __R600_CMDBUF_H__ */ diff --git a/src/mesa/drivers/dri/r600/r600_context.c b/src/mesa/drivers/dri/r600/r600_context.c index 389b0412ba..bb959e7d2d 100644 --- a/src/mesa/drivers/dri/r600/r600_context.c +++ b/src/mesa/drivers/dri/r600/r600_context.c @@ -66,6 +66,11 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "r700_state.h" #include "r700_ioctl.h" +#include "evergreen_context.h" +#include "evergreen_state.h" +#include "evergreen_tex.h" +#include "evergreen_ioctl.h" +#include "evergreen_oglprog.h" #include "utils.h" @@ -247,6 +252,19 @@ static void r600_init_vtbl(radeonContextPtr radeon) static void r600InitConstValues(GLcontext *ctx, radeonScreenPtr screen) { + context_t *context = R700_CONTEXT(ctx); + R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw); + + if( (context->radeon.radeonScreen->chip_family >= CHIP_FAMILY_CEDAR) + &&(context->radeon.radeonScreen->chip_family <= CHIP_FAMILY_HEMLOCK) ) + { + r700->bShaderUseMemConstant = GL_TRUE; + } + else + { + r700->bShaderUseMemConstant = GL_FALSE; + } + ctx->Const.MaxTextureImageUnits = 16; /* 8 per clause on r6xx, 16 on r7xx * but I think mesa only supports 8 at the moment @@ -381,18 +399,45 @@ GLboolean r600CreateContext(gl_api api, r600ParseOptions(r600, screen); r600->radeon.radeonScreen = screen; - r600_init_vtbl(&r600->radeon); + if(screen->chip_family >= CHIP_FAMILY_CEDAR) + { + evergreen_init_vtbl(&r600->radeon); + } + else + { + r600_init_vtbl(&r600->radeon); + } + /* Init default driver functions then plug in our R600-specific functions * (the texture functions are especially important) */ _mesa_init_driver_functions(&functions); - r700InitStateFuncs(&r600->radeon, &functions); - r600InitTextureFuncs(&r600->radeon, &functions); - r700InitShaderFuncs(&functions); + if(screen->chip_family >= CHIP_FAMILY_CEDAR) + { + evergreenCreateChip(r600); + evergreenInitStateFuncs(&r600->radeon, &functions); + evergreenInitTextureFuncs(&r600->radeon, &functions); + evergreenInitShaderFuncs(&functions); + } + else + { + r700InitStateFuncs(&r600->radeon, &functions); + r600InitTextureFuncs(&r600->radeon, &functions); + r700InitShaderFuncs(&functions); + } + radeonInitQueryObjFunctions(&functions); - r700InitIoctlFuncs(&functions); + + if(screen->chip_family >= CHIP_FAMILY_CEDAR) + { + evergreenInitIoctlFuncs(&functions); + } + else + { + r700InitIoctlFuncs(&functions); + } radeonInitBufferObjectFuncs(&functions); if (!radeonInitContext(&r600->radeon, &functions, @@ -435,16 +480,46 @@ GLboolean r600CreateContext(gl_api api, radeon_init_debug(); - r700InitDraw(ctx); + if(screen->chip_family >= CHIP_FAMILY_CEDAR) + { + evergreenInitDraw(ctx); + } + else + { + r700InitDraw(ctx); + } radeon_fbo_init(&r600->radeon); radeonInitSpanFuncs( ctx ); r600InitCmdBuf(r600); - r700InitState(r600->radeon.glCtx); + + if(screen->chip_family >= CHIP_FAMILY_CEDAR) + { + evergreenInitState(r600->radeon.glCtx); + } + else + { + r700InitState(r600->radeon.glCtx); + } r600InitGLExtensions(ctx); return GL_TRUE; } +void r600DestroyContext(__DRIcontext *driContextPriv ) +{ + void *pChip; + context_t *context = (context_t *) driContextPriv->driverPrivate; + + assert(context); + + pChip = context->pChip; + + /* destroy context first, free pChip, in case there are things flush to asic. */ + radeonDestroyContext(driContextPriv); + + FREE(pChip); +} + diff --git a/src/mesa/drivers/dri/r600/r600_context.h b/src/mesa/drivers/dri/r600/r600_context.h index 063dd7c49a..6a83196648 100644 --- a/src/mesa/drivers/dri/r600/r600_context.h +++ b/src/mesa/drivers/dri/r600/r600_context.h @@ -53,6 +53,8 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "r700_oglprog.h" #include "r700_vertprog.h" +#include "evergreen_chip.h" + struct r600_context; typedef struct r600_context context_t; @@ -63,6 +65,10 @@ typedef struct r600_context context_t; #include "tnl_dd/t_dd_vertex.h" #undef TAG +#define FORCE_CF_TEX_BARRIER 1 + +/* #define GENERATE_SHADER_FOR_2D 1 */ + #define R600_FALLBACK_NONE 0 #define R600_FALLBACK_TCL 1 #define R600_FALLBACK_RAST 2 @@ -103,6 +109,24 @@ struct r600_hw_state { struct radeon_state_atom tx_brdr_clr; }; +struct evergreen_hw_state { + struct radeon_state_atom one_time_init; + struct radeon_state_atom init; + struct radeon_state_atom pa; + struct radeon_state_atom vgt; + struct radeon_state_atom tp; + struct radeon_state_atom sq; + struct radeon_state_atom vs; + struct radeon_state_atom spi; + struct radeon_state_atom sx; + struct radeon_state_atom tx; + struct radeon_state_atom db; + struct radeon_state_atom cb; + struct radeon_state_atom vtx; + struct radeon_state_atom cp; + struct radeon_state_atom timestamp; +}; + typedef struct StreamDesc { GLint size; //number of data element @@ -141,6 +165,9 @@ struct r600_context { struct r600_hw_state atoms; + struct evergreen_hw_state evergreen_atoms; + void * pChip; + struct r700_vertex_program *selected_vp; /* Vertex buffers @@ -150,16 +177,29 @@ struct r600_context { struct r700_index_buffer ind_buf; struct radeon_bo *blit_bo; GLboolean blit_bo_loaded; + + /* Shader const buffer */ + struct radeon_bo * vp_Constbo; + int vp_bo_offset; + struct radeon_bo * fp_Constbo; + int fp_bo_offset; }; +#define EVERGREEN_CONTEXT(ctx) ((context_t *)(ctx->DriverCtx)) + #define R700_CONTEXT(ctx) ((context_t *)(ctx->DriverCtx)) #define GL_CONTEXT(context) ((GLcontext *)(context->radeon.glCtx)) +#define GET_EVERGREEN_CHIP(context) ((EVERGREEN_CHIP_CONTEXT*)(context->pChip)) + extern GLboolean r600CreateContext(gl_api api, const __GLcontextModes * glVisual, __DRIcontext * driContextPriv, void *sharedContextPrivate); +extern void r600DestroyContext(__DRIcontext *driContextPriv ); +extern void evergreenCreateChip(context_t *context); + #define R700_CONTEXT_STATES(context) ((R700_CHIP_CONTEXT *)(&context->hw)) #define R600_NEWPRIM( rmesa ) \ @@ -175,6 +215,13 @@ do { \ r600->radeon.hw.is_dirty = GL_TRUE; \ } while(0) +#define EVERGREEN_STATECHANGE(r600, ATOM) \ +do { \ + R600_NEWPRIM(r600); \ + r600->evergreen_atoms.ATOM.dirty = GL_TRUE; \ + r600->radeon.hw.is_dirty = GL_TRUE; \ +} while(0) + extern GLboolean r700SyncSurf(context_t *context, struct radeon_bo *pbo, uint32_t read_domain, @@ -187,6 +234,9 @@ extern void r700Start3D(context_t *context); extern void r600InitAtoms(context_t *context); extern void r700InitDraw(GLcontext *ctx); +extern void evergreenInitAtoms(context_t *context); +extern void evergreenInitDraw(GLcontext *ctx); + #define RADEON_D_CAPTURE 0 #define RADEON_D_PLAYBACK 1 #define RADEON_D_PLAYBACK_RAW 2 diff --git a/src/mesa/drivers/dri/r600/r600_emit.c b/src/mesa/drivers/dri/r600/r600_emit.c index 1eb89a5305..4814cb1453 100644 --- a/src/mesa/drivers/dri/r600/r600_emit.c +++ b/src/mesa/drivers/dri/r600/r600_emit.c @@ -49,6 +49,72 @@ void r600EmitCacheFlush(context_t *rmesa) { } +GLboolean r600AllocShaderConsts(GLcontext * ctx, + void ** constbo, + int sizeinBYTE, + char * szShaderUsage) +{ + radeonContextPtr radeonctx = RADEON_CONTEXT(ctx); + struct radeon_bo * pbo; + uint32_t *out; + + if(sizeinBYTE < 64) /* SQ_ALU_CONST_BUFFER_SIZE need 64 bytes at least to be non 0 */ + { + sizeinBYTE = 64; + } + +shader_again_alloc: + pbo = radeon_bo_open(radeonctx->radeonScreen->bom, + 0, + sizeinBYTE, + 256, + RADEON_GEM_DOMAIN_GTT, + 0); + + radeon_print(RADEON_SHADER, RADEON_NORMAL, "%s %p size %d: %s\n", __func__, pbo, sizeinBYTE, szShaderUsage); + + if (!pbo) { + radeon_print(RADEON_MEMORY | RADEON_CS, RADEON_IMPORTANT, "No memory for buffer object. Flushing command buffer.\n"); + rcommonFlushCmdBuf(radeonctx, __FUNCTION__); + goto shader_again_alloc; + } + + radeon_cs_space_add_persistent_bo(radeonctx->cmdbuf.cs, + pbo, + RADEON_GEM_DOMAIN_GTT, 0); + + if (radeon_cs_space_check_with_bo(radeonctx->cmdbuf.cs, + pbo, + RADEON_GEM_DOMAIN_GTT, 0)) { + radeon_error("failure to revalidate BOs - badness\n"); + return GL_FALSE; + } + + *constbo = (void*)pbo; + + return GL_TRUE; +} +GLboolean r600EmitShaderConsts(GLcontext * ctx, + void * constbo, + int bo_offset, + GLvoid * data, + int sizeinBYTE) +{ + struct radeon_bo * pbo = (struct radeon_bo *)constbo; + uint8_t *out; + + radeon_bo_map(pbo, 1); + + out = (uint8_t*)(pbo->ptr); + out = (uint8_t*)ADD_POINTERS(pbo->ptr, bo_offset); + + memcpy(out, data, sizeinBYTE); + + radeon_bo_unmap(pbo); + + return GL_TRUE; +} + GLboolean r600EmitShader(GLcontext * ctx, void ** shaderbo, GLvoid * data, diff --git a/src/mesa/drivers/dri/r600/r600_emit.h b/src/mesa/drivers/dri/r600/r600_emit.h index 661774d11e..259561539f 100644 --- a/src/mesa/drivers/dri/r600/r600_emit.h +++ b/src/mesa/drivers/dri/r600/r600_emit.h @@ -52,4 +52,14 @@ extern GLboolean r600EmitShader(GLcontext * ctx, extern GLboolean r600DeleteShader(GLcontext * ctx, void * shaderbo); +extern GLboolean r600AllocShaderConsts(GLcontext * ctx, + void ** constbo, + int sizeinBYTE, + char * szShaderUsage); +GLboolean r600EmitShaderConsts(GLcontext * ctx, + void * constbo, + int bo_offset, + GLvoid * data, + int sizeinBYTE); + #endif diff --git a/src/mesa/drivers/dri/r600/r600_texstate.c b/src/mesa/drivers/dri/r600/r600_texstate.c index ba3690b70e..fd928cfe5d 100644 --- a/src/mesa/drivers/dri/r600/r600_texstate.c +++ b/src/mesa/drivers/dri/r600/r600_texstate.c @@ -50,6 +50,8 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "r700_fragprog.h" #include "r700_vertprog.h" +#include "evergreen_tex.h" + void r600UpdateTextureState(GLcontext * ctx); void r600UpdateTextureState(GLcontext * ctx) @@ -878,6 +880,18 @@ GLboolean r600ValidateBuffers(GLcontext * ctx) RADEON_GEM_DOMAIN_GTT, 0); } + pbo = (struct radeon_bo *)r700GetActiveFpShaderConstBo(ctx); + if (pbo) { + radeon_cs_space_add_persistent_bo(rmesa->radeon.cmdbuf.cs, pbo, + RADEON_GEM_DOMAIN_GTT, 0); + } + + pbo = (struct radeon_bo *)r700GetActiveVpShaderConstBo(ctx); + if (pbo) { + radeon_cs_space_add_persistent_bo(rmesa->radeon.cmdbuf.cs, pbo, + RADEON_GEM_DOMAIN_GTT, 0); + } + ret = radeon_cs_space_check_with_bo(rmesa->radeon.cmdbuf.cs, first_elem(&rmesa->radeon.dma.reserved)->bo, RADEON_GEM_DOMAIN_GTT, 0); if (ret) return GL_FALSE; @@ -897,6 +911,12 @@ void r600SetTexOffset(__DRIcontext * pDRICtx, GLint texname, if (!tObj) return; + if(rmesa->radeon.radeonScreen->chip_family >= CHIP_FAMILY_CEDAR) + { + evergreenSetTexOffset(pDRICtx, texname, offset, depth, pitch); + return; + } + t->image_override = GL_TRUE; if (!offset) @@ -989,6 +1009,12 @@ void r600SetTexBuffer2(__DRIcontext *pDRICtx, GLint target, GLint glx_texture_fo radeon = pDRICtx->driverPrivate; rmesa = pDRICtx->driverPrivate; + if(rmesa->radeon.radeonScreen->chip_family >= CHIP_FAMILY_CEDAR) + { + evergreenSetTexBuffer(pDRICtx, target, glx_texture_format, dPriv); + return; + } + rfb = dPriv->driverPrivate; texUnit = &radeon->glCtx->Texture.Unit[radeon->glCtx->Texture.CurrentUnit]; texObj = _mesa_select_tex_object(radeon->glCtx, texUnit, target); diff --git a/src/mesa/drivers/dri/r600/r700_assembler.c b/src/mesa/drivers/dri/r600/r700_assembler.c index 247617408c..fbd8c45d25 100644 --- a/src/mesa/drivers/dri/r600/r700_assembler.c +++ b/src/mesa/drivers/dri/r600/r700_assembler.c @@ -38,6 +38,7 @@ #include "r600_context.h" #include "r700_assembler.h" +#include "evergreen_sq.h" #define USE_CF_FOR_CONTINUE_BREAK 1 #define USE_CF_FOR_POP_AFTER 1 @@ -258,6 +259,18 @@ GLboolean is_reduction_opcode(PVSDWORD* dest) return GL_FALSE; } +GLboolean EG_is_reduction_opcode(PVSDWORD* dest) +{ + if (dest->dst.op3 == 0) + { + if ( (dest->dst.opcode == EG_OP2_INST_DOT4 || dest->dst.opcode == EG_OP2_INST_DOT4_IEEE || dest->dst.opcode == EG_OP2_INST_CUBE) ) + { + return GL_TRUE; + } + } + return GL_FALSE; +} + GLuint GetSurfaceFormat(GLenum eType, GLuint nChannels, GLuint * pClient_size) { GLuint format = FMT_INVALID; @@ -423,6 +436,60 @@ unsigned int r700GetNumOperands(GLuint opcode, GLuint nIsOp3) return 3; } +unsigned int EG_GetNumOperands(GLuint opcode, GLuint nIsOp3) +{ + if(nIsOp3 > 0) + { + return 3; + } + + switch (opcode) + { + case EG_OP2_INST_ADD: + case EG_OP2_INST_KILLE: + case EG_OP2_INST_KILLGT: + case EG_OP2_INST_KILLGE: + case EG_OP2_INST_KILLNE: + case EG_OP2_INST_MUL: + case EG_OP2_INST_MAX: + case EG_OP2_INST_MIN: + //case EG_OP2_INST_MAX_DX10: + //case EG_OP2_INST_MIN_DX10: + case EG_OP2_INST_SETE: + case EG_OP2_INST_SETNE: + case EG_OP2_INST_SETGT: + case EG_OP2_INST_SETGE: + case EG_OP2_INST_PRED_SETE: + case EG_OP2_INST_PRED_SETGT: + case EG_OP2_INST_PRED_SETGE: + case EG_OP2_INST_PRED_SETNE: + case EG_OP2_INST_DOT4: + case EG_OP2_INST_DOT4_IEEE: + case EG_OP2_INST_CUBE: + return 2; + + case EG_OP2_INST_MOV: + //case SQ_OP2_INST_MOVA_FLOOR: + case EG_OP2_INST_FRACT: + case EG_OP2_INST_FLOOR: + case EG_OP2_INST_TRUNC: + case EG_OP2_INST_EXP_IEEE: + case EG_OP2_INST_LOG_CLAMPED: + case EG_OP2_INST_LOG_IEEE: + case EG_OP2_INST_RECIP_IEEE: + case EG_OP2_INST_RECIPSQRT_IEEE: + case EG_OP2_INST_FLT_TO_INT: + case EG_OP2_INST_SIN: + case EG_OP2_INST_COS: + return 1; + + default: radeon_error( + "Need instruction operand number for %x.\n", opcode); + }; + + return 3; +} + int Init_r700_AssemblerBase(SHADER_PIPE_TYPE spt, r700_AssemblerBase* pAsm, R700_Shader* pShader) { GLuint i; @@ -718,21 +785,55 @@ GLboolean add_vfetch_instruction(r700_AssemblerBase* pAsm, return GL_FALSE; } - pAsm->cf_current_vtx_clause_ptr->m_Word1.f.pop_count = 0x0; - pAsm->cf_current_vtx_clause_ptr->m_Word1.f.cf_const = 0x0; - pAsm->cf_current_vtx_clause_ptr->m_Word1.f.cond = SQ_CF_COND_ACTIVE; - pAsm->cf_current_vtx_clause_ptr->m_Word1.f.count = 0x0; - pAsm->cf_current_vtx_clause_ptr->m_Word1.f.end_of_program = 0x0; - pAsm->cf_current_vtx_clause_ptr->m_Word1.f.valid_pixel_mode = 0x0; - pAsm->cf_current_vtx_clause_ptr->m_Word1.f.cf_inst = SQ_CF_INST_VTX; - pAsm->cf_current_vtx_clause_ptr->m_Word1.f.whole_quad_mode = 0x0; - pAsm->cf_current_vtx_clause_ptr->m_Word1.f.barrier = 0x1; + if(8 == pAsm->unAsic) + { + SETfield(pAsm->cf_current_vtx_clause_ptr->m_Word1.val, EG_CF_INST_VC, + EG_CF_WORD1__CF_INST_shift, EG_CF_WORD1__CF_INST_mask); + SETfield(pAsm->cf_current_vtx_clause_ptr->m_Word1.val, 0, + EG_CF_WORD1__POP_COUNT_shift, EG_CF_WORD1__POP_COUNT_mask); + SETfield(pAsm->cf_current_vtx_clause_ptr->m_Word1.val, 0, + EG_CF_WORD1__CF_CONST_shift, EG_CF_WORD1__CF_CONST_mask); + SETfield(pAsm->cf_current_vtx_clause_ptr->m_Word1.val, SQ_CF_COND_ACTIVE, + EG_CF_WORD1__COND_shift, EG_CF_WORD1__COND_mask); + SETfield(pAsm->cf_current_vtx_clause_ptr->m_Word1.val, 0, + EG_CF_WORD1__COUNT_shift, EG_CF_WORD1__COUNT_mask); + SETfield(pAsm->cf_current_vtx_clause_ptr->m_Word1.val, 0, + EG_CF_WORD1__VPM_shift, EG_CF_WORD1__VPM_bit); + SETfield(pAsm->cf_current_vtx_clause_ptr->m_Word1.val, 0, + EG_CF_WORD1__EOP_shift, EG_CF_WORD1__EOP_bit); + SETfield(pAsm->cf_current_vtx_clause_ptr->m_Word1.val, 0, + EG_CF_WORD1__WQM_shift, EG_CF_WORD1__WQM_bit); + SETfield(pAsm->cf_current_vtx_clause_ptr->m_Word1.val, 1, + EG_CF_WORD1__BARRIER_shift, EG_CF_WORD1__BARRIER_bit); + } + else + { + pAsm->cf_current_vtx_clause_ptr->m_Word1.f.pop_count = 0x0; + pAsm->cf_current_vtx_clause_ptr->m_Word1.f.cf_const = 0x0; + pAsm->cf_current_vtx_clause_ptr->m_Word1.f.cond = SQ_CF_COND_ACTIVE; + pAsm->cf_current_vtx_clause_ptr->m_Word1.f.count = 0x0; + pAsm->cf_current_vtx_clause_ptr->m_Word1.f.end_of_program = 0x0; + pAsm->cf_current_vtx_clause_ptr->m_Word1.f.valid_pixel_mode = 0x0; + pAsm->cf_current_vtx_clause_ptr->m_Word1.f.cf_inst = SQ_CF_INST_VTX; + pAsm->cf_current_vtx_clause_ptr->m_Word1.f.whole_quad_mode = 0x0; + pAsm->cf_current_vtx_clause_ptr->m_Word1.f.barrier = 0x1; + } LinkVertexInstruction(pAsm->cf_current_vtx_clause_ptr, vertex_instruction_ptr ); } else { - pAsm->cf_current_vtx_clause_ptr->m_Word1.f.count++; + if(8 == pAsm->unAsic) + { + unsigned int count = GETbits(pAsm->cf_current_vtx_clause_ptr->m_Word1.val, + EG_CF_WORD1__COUNT_shift, EG_CF_WORD1__COUNT_mask) + 1; + SETfield(pAsm->cf_current_vtx_clause_ptr->m_Word1.val, count, + EG_CF_WORD1__COUNT_shift, EG_CF_WORD1__COUNT_mask); + } + else + { + pAsm->cf_current_vtx_clause_ptr->m_Word1.f.count++; + } } AddVTXInstruction(pAsm->pR700Shader, vertex_instruction_ptr); @@ -767,20 +868,59 @@ GLboolean add_tex_instruction(r700_AssemblerBase* pAsm, radeon_error("Could not allocate a new TEX CF instruction.\n"); return GL_FALSE; } - - pAsm->cf_current_tex_clause_ptr->m_Word1.f.pop_count = 0x0; - pAsm->cf_current_tex_clause_ptr->m_Word1.f.cf_const = 0x0; - pAsm->cf_current_tex_clause_ptr->m_Word1.f.cond = SQ_CF_COND_ACTIVE; - pAsm->cf_current_tex_clause_ptr->m_Word1.f.end_of_program = 0x0; - pAsm->cf_current_tex_clause_ptr->m_Word1.f.valid_pixel_mode = 0x0; - pAsm->cf_current_tex_clause_ptr->m_Word1.f.cf_inst = SQ_CF_INST_TEX; - pAsm->cf_current_tex_clause_ptr->m_Word1.f.whole_quad_mode = 0x0; - pAsm->cf_current_tex_clause_ptr->m_Word1.f.barrier = 0x0; //0x1; + if(8 == pAsm->unAsic) + { + SETfield(pAsm->cf_current_tex_clause_ptr->m_Word1.val, EG_CF_INST_TC, + EG_CF_WORD1__CF_INST_shift, EG_CF_WORD1__CF_INST_mask); + SETfield(pAsm->cf_current_tex_clause_ptr->m_Word1.val, 0, + EG_CF_WORD1__POP_COUNT_shift, EG_CF_WORD1__POP_COUNT_mask); + SETfield(pAsm->cf_current_tex_clause_ptr->m_Word1.val, 0, + EG_CF_WORD1__CF_CONST_shift, EG_CF_WORD1__CF_CONST_mask); + SETfield(pAsm->cf_current_tex_clause_ptr->m_Word1.val, SQ_CF_COND_ACTIVE, + EG_CF_WORD1__COND_shift, EG_CF_WORD1__COND_mask); + SETfield(pAsm->cf_current_tex_clause_ptr->m_Word1.val, 0, + EG_CF_WORD1__COUNT_shift, EG_CF_WORD1__COUNT_mask); + SETfield(pAsm->cf_current_tex_clause_ptr->m_Word1.val, 0, + EG_CF_WORD1__VPM_shift, EG_CF_WORD1__VPM_bit); + SETfield(pAsm->cf_current_tex_clause_ptr->m_Word1.val, 0, + EG_CF_WORD1__EOP_shift, EG_CF_WORD1__EOP_bit); + SETfield(pAsm->cf_current_tex_clause_ptr->m_Word1.val, 0, + EG_CF_WORD1__WQM_shift, EG_CF_WORD1__WQM_bit); +#ifdef FORCE_CF_TEX_BARRIER + SETfield(pAsm->cf_current_tex_clause_ptr->m_Word1.val, 1, + EG_CF_WORD1__BARRIER_shift, EG_CF_WORD1__BARRIER_bit); +#else + SETfield(pAsm->cf_current_tex_clause_ptr->m_Word1.val, 0, + EG_CF_WORD1__BARRIER_shift, EG_CF_WORD1__BARRIER_bit); +#endif + } + else + { + pAsm->cf_current_tex_clause_ptr->m_Word1.f.pop_count = 0x0; + pAsm->cf_current_tex_clause_ptr->m_Word1.f.cf_const = 0x0; + pAsm->cf_current_tex_clause_ptr->m_Word1.f.cond = SQ_CF_COND_ACTIVE; + + pAsm->cf_current_tex_clause_ptr->m_Word1.f.end_of_program = 0x0; + pAsm->cf_current_tex_clause_ptr->m_Word1.f.valid_pixel_mode = 0x0; + pAsm->cf_current_tex_clause_ptr->m_Word1.f.cf_inst = SQ_CF_INST_TEX; + pAsm->cf_current_tex_clause_ptr->m_Word1.f.whole_quad_mode = 0x0; + pAsm->cf_current_tex_clause_ptr->m_Word1.f.barrier = 0x0; //0x1; + } } else - { - pAsm->cf_current_tex_clause_ptr->m_Word1.f.count++; + { + if(8 == pAsm->unAsic) + { + unsigned int count = GETbits(pAsm->cf_current_tex_clause_ptr->m_Word1.val, + EG_CF_WORD1__COUNT_shift, EG_CF_WORD1__COUNT_mask) + 1; + SETfield(pAsm->cf_current_vtx_clause_ptr->m_Word1.val, count, + EG_CF_WORD1__COUNT_shift, EG_CF_WORD1__COUNT_mask); + } + else + { + pAsm->cf_current_tex_clause_ptr->m_Word1.f.count++; + } } // If this clause constains any TEX instruction that is dependent on a previous instruction, @@ -891,6 +1031,188 @@ GLboolean assemble_vfetch_instruction(r700_AssemblerBase* pAsm, return GL_TRUE; } +GLboolean EG_assemble_vfetch_instruction(r700_AssemblerBase* pAsm, + GLuint destination_register, + GLenum type, + GLint size, + GLubyte element, + GLuint _signed, + GLboolean normalize, + GLenum format, + VTX_FETCH_METHOD * pFetchMethod) +{ + GLuint client_size_inbyte; + GLuint data_format; + GLuint mega_fetch_count; + GLuint is_mega_fetch_flag; + + GLuint dst_sel_x, dst_sel_y, dst_sel_z, dst_sel_w; + + R700VertexGenericFetch* vfetch_instruction_ptr; + R700VertexGenericFetch* assembled_vfetch_instruction_ptr + = pAsm->vfetch_instruction_ptr_array[element]; + + if (assembled_vfetch_instruction_ptr == NULL) + { + vfetch_instruction_ptr = (R700VertexGenericFetch*) CALLOC_STRUCT(R700VertexGenericFetch); + if (vfetch_instruction_ptr == NULL) + { + return GL_FALSE; + } + Init_R700VertexGenericFetch(vfetch_instruction_ptr); + } + else + { + vfetch_instruction_ptr = assembled_vfetch_instruction_ptr; + } + + data_format = GetSurfaceFormat(type, size, &client_size_inbyte); + + if(GL_TRUE == pFetchMethod->bEnableMini) //More conditions here + { + //TODO : mini fetch + mega_fetch_count = 0; + is_mega_fetch_flag = 0; + } + else + { + mega_fetch_count = MEGA_FETCH_BYTES - 1; + is_mega_fetch_flag = 0x1; + pFetchMethod->mega_fetch_remainder = MEGA_FETCH_BYTES - client_size_inbyte; + } + + SETfield(vfetch_instruction_ptr->m_Word0.val, EG_VC_INST_FETCH, + EG_VTX_WORD0__VC_INST_shift, + EG_VTX_WORD0__VC_INST_mask); + SETfield(vfetch_instruction_ptr->m_Word0.val, EG_VTX_FETCH_VERTEX_DATA, + EG_VTX_WORD0__FETCH_TYPE_shift, + EG_VTX_WORD0__FETCH_TYPE_mask); + CLEARbit(vfetch_instruction_ptr->m_Word0.val, + EG_VTX_WORD0__FWQ_bit); + SETfield(vfetch_instruction_ptr->m_Word0.val, element, + EG_VTX_WORD0__BUFFER_ID_shift, + EG_VTX_WORD0__BUFFER_ID_mask); + SETfield(vfetch_instruction_ptr->m_Word0.val, 0x0, + EG_VTX_WORD0__SRC_GPR_shift, + EG_VTX_WORD0__SRC_GPR_mask); + SETfield(vfetch_instruction_ptr->m_Word0.val, SQ_ABSOLUTE, + EG_VTX_WORD0__SRC_REL_shift, + EG_VTX_WORD0__SRC_REL_bit); + SETfield(vfetch_instruction_ptr->m_Word0.val, SQ_SEL_X, + EG_VTX_WORD0__SRC_SEL_X_shift, + EG_VTX_WORD0__SRC_SEL_X_mask); + SETfield(vfetch_instruction_ptr->m_Word0.val, mega_fetch_count, + EG_VTX_WORD0__MFC_shift, + EG_VTX_WORD0__MFC_mask); + + if(format == GL_BGRA) + { + dst_sel_x = (size < 1) ? SQ_SEL_0 : SQ_SEL_Z; + dst_sel_y = (size < 2) ? SQ_SEL_0 : SQ_SEL_Y; + dst_sel_z = (size < 3) ? SQ_SEL_0 : SQ_SEL_X; + dst_sel_w = (size < 4) ? SQ_SEL_1 : SQ_SEL_W; + } + else + { + dst_sel_x = (size < 1) ? SQ_SEL_0 : SQ_SEL_X; + dst_sel_y = (size < 2) ? SQ_SEL_0 : SQ_SEL_Y; + dst_sel_z = (size < 3) ? SQ_SEL_0 : SQ_SEL_Z; + dst_sel_w = (size < 4) ? SQ_SEL_1 : SQ_SEL_W; + + } + SETfield(vfetch_instruction_ptr->m_Word1.val, dst_sel_x, + EG_VTX_WORD1__DST_SEL_X_shift, + EG_VTX_WORD1__DST_SEL_X_mask); + SETfield(vfetch_instruction_ptr->m_Word1.val, dst_sel_y, + EG_VTX_WORD1__DST_SEL_Y_shift, + EG_VTX_WORD1__DST_SEL_Y_mask); + SETfield(vfetch_instruction_ptr->m_Word1.val, dst_sel_z, + EG_VTX_WORD1__DST_SEL_Z_shift, + EG_VTX_WORD1__DST_SEL_Z_mask); + SETfield(vfetch_instruction_ptr->m_Word1.val, dst_sel_w, + EG_VTX_WORD1__DST_SEL_W_shift, + EG_VTX_WORD1__DST_SEL_W_mask); + + SETfield(vfetch_instruction_ptr->m_Word1.val, 0, /* use format here, in r6/r7, format used set in const, need to use same */ + EG_VTX_WORD1__UCF_shift, + EG_VTX_WORD1__UCF_bit); + SETfield(vfetch_instruction_ptr->m_Word1.val, data_format, + EG_VTX_WORD1__DATA_FORMAT_shift, + EG_VTX_WORD1__DATA_FORMAT_mask); +#ifdef TEST_VFETCH + SETfield(vfetch_instruction_ptr->m_Word1.val, SQ_FORMAT_COMP_SIGNED, + EG_VTX_WORD1__FCA_shift, + EG_VTX_WORD1__FCA_bit); +#else + if(1 == _signed) + { + SETfield(vfetch_instruction_ptr->m_Word1.val, SQ_FORMAT_COMP_SIGNED, + EG_VTX_WORD1__FCA_shift, + EG_VTX_WORD1__FCA_bit); + } + else + { + SETfield(vfetch_instruction_ptr->m_Word1.val, SQ_FORMAT_COMP_UNSIGNED, + EG_VTX_WORD1__FCA_shift, + EG_VTX_WORD1__FCA_bit); + } +#endif /* TEST_VFETCH */ + + if(GL_TRUE == normalize) + { + SETfield(vfetch_instruction_ptr->m_Word1.val, SQ_NUM_FORMAT_NORM, + EG_VTX_WORD1__NFA_shift, + EG_VTX_WORD1__NFA_mask); + } + else + { + SETfield(vfetch_instruction_ptr->m_Word1.val, SQ_NUM_FORMAT_SCALED, + EG_VTX_WORD1__NFA_shift, + EG_VTX_WORD1__NFA_mask); + } + + /* Destination register */ + SETfield(vfetch_instruction_ptr->m_Word1.val, destination_register, + EG_VTX_WORD1_GPR__DST_GPR_shift, + EG_VTX_WORD1_GPR__DST_GPR_mask); + SETfield(vfetch_instruction_ptr->m_Word1.val, SQ_ABSOLUTE, + EG_VTX_WORD1_GPR__DST_REL_shift, + EG_VTX_WORD1_GPR__DST_REL_bit); + + + SETfield(vfetch_instruction_ptr->m_Word2.val, 0, + EG_VTX_WORD2__OFFSET_shift, + EG_VTX_WORD2__OFFSET_mask); + SETfield(vfetch_instruction_ptr->m_Word2.val, SQ_ENDIAN_NONE, + EG_VTX_WORD2__ENDIAN_SWAP_shift, + EG_VTX_WORD2__ENDIAN_SWAP_mask); + SETfield(vfetch_instruction_ptr->m_Word2.val, 0, + EG_VTX_WORD2__CBNS_shift, + EG_VTX_WORD2__CBNS_bit); + SETfield(vfetch_instruction_ptr->m_Word2.val, is_mega_fetch_flag, + EG_VTX_WORD2__MEGA_FETCH_shift, + EG_VTX_WORD2__MEGA_FETCH_mask); + + if (assembled_vfetch_instruction_ptr == NULL) + { + if ( GL_FALSE == add_vfetch_instruction(pAsm, (R700VertexInstruction *)vfetch_instruction_ptr) ) + { + return GL_FALSE; + } + + if (pAsm->vfetch_instruction_ptr_array[element] != NULL) + { + return GL_FALSE; + } + else + { + pAsm->vfetch_instruction_ptr_array[element] = vfetch_instruction_ptr; + } + } + + return GL_TRUE; +} + GLboolean assemble_vfetch_instruction2(r700_AssemblerBase* pAsm, GLuint destination_register, GLenum type, @@ -1619,19 +1941,68 @@ GLboolean assemble_tex_instruction(r700_AssemblerBase *pAsm, GLboolean normalize texture_coordinate_source = &(pAsm->S[0].src); texture_unit_source = &(pAsm->S[1].src); - tex_instruction_ptr->m_Word0.f.tex_inst = pAsm->D.dst.opcode; - tex_instruction_ptr->m_Word0.f.bc_frac_mode = 0x0; - tex_instruction_ptr->m_Word0.f.fetch_whole_quad = 0x0; - tex_instruction_ptr->m_Word0.f.alt_const = 0; - - if(SPT_VP == pAsm->currentShaderType) + if(8 == pAsm->unAsic) /* evergreen */ { - tex_instruction_ptr->m_Word0.f.resource_id = texture_unit_source->reg + VERT_ATTRIB_MAX; - pAsm->unVetTexBits |= 1 << texture_unit_source->reg; + + SETfield(tex_instruction_ptr->m_Word0.val, pAsm->D.dst.opcode, + EG_TEX_WORD0__TEX_INST_shift, + EG_TEX_WORD0__TEX_INST_mask); + + if( (SQ_TEX_INST_GET_GRADIENTS_H == pAsm->D.dst.opcode) + ||(SQ_TEX_INST_GET_GRADIENTS_V == pAsm->D.dst.opcode) ) + { + /* Use fine texel derivative calculation rather than use quad derivative */ + SETfield(tex_instruction_ptr->m_Word0.val, 1, + EG_TEX_WORD0__INST_MOD_shift, + EG_TEX_WORD0__INST_MOD_mask); + } + else + { + SETfield(tex_instruction_ptr->m_Word0.val, 0, + EG_TEX_WORD0__INST_MOD_shift, + EG_TEX_WORD0__INST_MOD_mask); + } + + CLEARbit(tex_instruction_ptr->m_Word0.val, EG_TEX_WORD0__FWQ_bit); + + if(SPT_VP == pAsm->currentShaderType) + { + SETfield(tex_instruction_ptr->m_Word0.val, (texture_unit_source->reg + VERT_ATTRIB_MAX), + EG_TEX_WORD0__RESOURCE_ID_shift, + EG_TEX_WORD0__RESOURCE_ID_mask); + pAsm->unVetTexBits |= 1 << texture_unit_source->reg; + } + else + { + SETfield(tex_instruction_ptr->m_Word0.val, texture_unit_source->reg, + EG_TEX_WORD0__RESOURCE_ID_shift, + EG_TEX_WORD0__RESOURCE_ID_mask); + } + + CLEARbit(tex_instruction_ptr->m_Word0.val, EG_TEX_WORD0__ALT_CONST_bit); + SETfield(tex_instruction_ptr->m_Word0.val, 0, + EG_TEX_WORD0__RIM_shift, + EG_TEX_WORD0__RIM_mask); + SETfield(tex_instruction_ptr->m_Word0.val, 0, + EG_TEX_WORD0__SIM_shift, + EG_TEX_WORD0__SIM_mask); } else { - tex_instruction_ptr->m_Word0.f.resource_id = texture_unit_source->reg; + tex_instruction_ptr->m_Word0.f.tex_inst = pAsm->D.dst.opcode; + tex_instruction_ptr->m_Word0.f.bc_frac_mode = 0x0; + tex_instruction_ptr->m_Word0.f.fetch_whole_quad = 0x0; + tex_instruction_ptr->m_Word0.f.alt_const = 0; + + if(SPT_VP == pAsm->currentShaderType) + { + tex_instruction_ptr->m_Word0.f.resource_id = texture_unit_source->reg + VERT_ATTRIB_MAX; + pAsm->unVetTexBits |= 1 << texture_unit_source->reg; + } + else + { + tex_instruction_ptr->m_Word0.f.resource_id = texture_unit_source->reg; + } } tex_instruction_ptr->m_Word1.f.lod_bias = 0x0; @@ -1657,8 +2028,20 @@ GLboolean assemble_tex_instruction(r700_AssemblerBase *pAsm, GLboolean normalize if ( (pAsm->D.dst.rtype == DST_REG_TEMPORARY) || (pAsm->D.dst.rtype == DST_REG_OUT) ) { - tex_instruction_ptr->m_Word0.f.src_gpr = texture_coordinate_source->reg; - tex_instruction_ptr->m_Word0.f.src_rel = SQ_ABSOLUTE; + if(8 == pAsm->unAsic) /* evergreen */ + { + SETfield(tex_instruction_ptr->m_Word0.val, texture_coordinate_source->reg, + EG_TEX_WORD0__SRC_GPR_shift, + EG_TEX_WORD0__SRC_GPR_mask); + SETfield(tex_instruction_ptr->m_Word0.val, SQ_ABSOLUTE, + EG_TEX_WORD0__SRC_REL_shift, + EG_TEX_WORD0__SRC_REL_bit); + } + else + { + tex_instruction_ptr->m_Word0.f.src_gpr = texture_coordinate_source->reg; + tex_instruction_ptr->m_Word0.f.src_rel = SQ_ABSOLUTE; + } tex_instruction_ptr->m_Word1.f.dst_gpr = pAsm->D.dst.reg; tex_instruction_ptr->m_Word1.f.dst_rel = SQ_ABSOLUTE; @@ -1709,7 +2092,8 @@ void initialize(r700_AssemblerBase *pAsm) GLboolean assemble_alu_src(R700ALUInstruction* alu_instruction_ptr, int source_index, PVSSRC* pSource, - BITS scalar_channel_index) + BITS scalar_channel_index, + r700_AssemblerBase *pAsm) { BITS src_sel; BITS src_rel; @@ -1765,7 +2149,16 @@ GLboolean assemble_alu_src(R700ALUInstruction* alu_instruction_ptr, } else if (pSource->rtype == SRC_REG_CONSTANT) { - src_sel = pSource->reg + CFILE_REGISTER_OFFSET; + /* TODO : 4 const buffers */ + if(GL_TRUE == pAsm->bUseMemConstant) + { + src_sel = pSource->reg + SQ_ALU_SRC_KCACHE0_BASE; + pAsm->kcacheUsed = SQ_ALU_SRC_KCACHE0_BASE; + } + else + { + src_sel = pSource->reg + CFILE_REGISTER_OFFSET; + } } else if (pSource->rtype == SRC_REC_LITERAL) { @@ -1915,6 +2308,17 @@ GLboolean add_alu_instruction(r700_AssemblerBase* pAsm, pAsm->cf_current_alu_clause_ptr->m_Word1.f.count += (GetInstructionSize(alu_instruction_ptr->m_ShaderInstType) / 2); } + /* TODO : handle 4 bufs */ + if( (pAsm->kcacheUsed > 0) && (GL_TRUE == pAsm->bUseMemConstant) ) + { + pAsm->cf_current_alu_clause_ptr->m_Word0.f.kcache_bank0 = 0x0; + pAsm->cf_current_alu_clause_ptr->m_Word0.f.kcache_bank1 = 0x0; + pAsm->cf_current_alu_clause_ptr->m_Word0.f.kcache_mode0 = SQ_CF_KCACHE_LOCK_2; + pAsm->cf_current_alu_clause_ptr->m_Word1.f.kcache_mode1 = SQ_CF_KCACHE_NOP; + pAsm->cf_current_alu_clause_ptr->m_Word1.f.kcache_addr0 = 0x0; + pAsm->cf_current_alu_clause_ptr->m_Word1.f.kcache_addr1 = 0x0; + } + // If this clause constains any instruction that is forward dependent on a TEX instruction, // set the whole_quad_mode for this clause if ( pAsm->pInstDeps[pAsm->uiCurInst].nDstDep > (-1) ) @@ -1938,6 +2342,80 @@ GLboolean add_alu_instruction(r700_AssemblerBase* pAsm, return GL_TRUE; } +GLboolean EG_add_ps_interp(r700_AssemblerBase* pAsm) +{ + R700ALUInstruction * alu_instruction_ptr = NULL; + + int ui; + unsigned int uj; + unsigned int unWord0Temp = 0x380C00; + unsigned int unWord1Temp = 0x146B10; //SQ_SEL_X + + if(pAsm->uIIns > 0) + { + for(ui=(pAsm->uIIns-1); ui>=0; ui--) + { + for(uj=0; uj<8; uj++) + { + alu_instruction_ptr = (R700ALUInstruction*) CALLOC_STRUCT(R700ALUInstruction); + Init_R700ALUInstruction(alu_instruction_ptr); + alu_instruction_ptr->m_Word0.val = unWord0Temp; + alu_instruction_ptr->m_Word1.val = unWord1Temp; + + if(uj < 4) + { + SETfield(alu_instruction_ptr->m_Word1.val, EG_OP2_INST_INTERP_ZW, + EG_ALU_WORD1_OP2__ALU_INST_shift, EG_ALU_WORD1_OP2__ALU_INST_mask); + } + else + { + SETfield(alu_instruction_ptr->m_Word1.val, EG_OP2_INST_INTERP_XY, + EG_ALU_WORD1_OP2__ALU_INST_shift, EG_ALU_WORD1_OP2__ALU_INST_mask); + } + if( (uj > 1) && (uj < 6) ) + { + SETfield(alu_instruction_ptr->m_Word1.val, 1, + EG_ALU_WORD1_OP2__WRITE_MASK_shift, EG_ALU_WORD1_OP2__WRITE_MASK_bit); + } + else + { + SETfield(alu_instruction_ptr->m_Word1.val, 0, + EG_ALU_WORD1_OP2__WRITE_MASK_shift, EG_ALU_WORD1_OP2__WRITE_MASK_bit); + } + if( (uj > 1) && (uj < 6) ) + { + SETfield(alu_instruction_ptr->m_Word1.val, ui, + EG_ALU_WORD1__DST_GPR_shift, EG_ALU_WORD1__DST_GPR_mask); + } + else + { + SETfield(alu_instruction_ptr->m_Word1.val, 111, + EG_ALU_WORD1__DST_GPR_shift, EG_ALU_WORD1__DST_GPR_mask); + } + + SETfield(alu_instruction_ptr->m_Word1.val, (uj % 4), + EG_ALU_WORD1__DST_CHAN_shift, EG_ALU_WORD1__DST_CHAN_mask); + SETfield(alu_instruction_ptr->m_Word0.val, (1 - (uj % 2)), + EG_ALU_WORD0__SRC0_CHAN_shift, EG_ALU_WORD0__SRC0_CHAN_mask); + SETfield(alu_instruction_ptr->m_Word0.val, (EG_ALU_SRC_PARAM_BASE + ui), + EG_ALU_WORD0__SRC1_SEL_shift, EG_ALU_WORD0__SRC1_SEL_mask); + if(3 == (uj % 4)) + { + SETfield(alu_instruction_ptr->m_Word0.val, 1, + EG_ALU_WORD0__LAST_shift, EG_ALU_WORD0__LAST_bit); + } + + if(GL_FALSE == add_alu_instruction(pAsm, alu_instruction_ptr, 4) ) + { + return GL_FALSE; + } + } + } + } + + return GL_TRUE; +} + void get_src_properties(R700ALUInstruction* alu_instruction_ptr, int source_index, BITS* psrc_sel, @@ -2188,8 +2666,16 @@ GLboolean check_scalar(r700_AssemblerBase* pAsm, BITS src_neg [3] = {0,0,0}; GLuint swizzle_key; + GLuint number_of_operands; - GLuint number_of_operands = r700GetNumOperands(pAsm->D.dst.opcode, pAsm->D.dst.op3); + if(8 == pAsm->unAsic) + { + number_of_operands = EG_GetNumOperands(pAsm->D.dst.opcode, pAsm->D.dst.op3); + } + else + { + number_of_operands = r700GetNumOperands(pAsm->D.dst.opcode, pAsm->D.dst.op3); + } for (src=0; srcD.dst.opcode, pAsm->D.dst.op3); + if(8 == pAsm->unAsic) + { + number_of_operands = EG_GetNumOperands(pAsm->D.dst.opcode, pAsm->D.dst.op3); + } + else + { + number_of_operands = r700GetNumOperands(pAsm->D.dst.opcode, pAsm->D.dst.op3); + } for (src=0; srcunAsic) + { + uNumSrc = EG_GetNumOperands(pAsm->D.dst.opcode, pAsm->D.dst.op3); + } + else + { + uNumSrc = r700GetNumOperands(pAsm->D.dst.opcode, pAsm->D.dst.op3); + } - GLuint uNumSrc = r700GetNumOperands(pAsm->D.dst.opcode, pAsm->D.dst.op3); //GLuint channel_swizzle, j; //GLuint chan_counter[4] = {0, 0, 0, 0}; //PVSSRC * pSource[3]; - GLboolean bSplitInst = GL_FALSE; + bSplitInst = GL_FALSE; + pAsm->kcacheUsed = 0; if (1 == pAsm->D.dst.math) { @@ -2462,7 +2967,8 @@ GLboolean assemble_alu_instruction(r700_AssemblerBase *pAsm) if (GL_FALSE == assemble_alu_src(alu_instruction_ptr, current_source_index, pcurrent_source, - scalar_channel_index) ) + scalar_channel_index, + pAsm) ) { return GL_FALSE; } @@ -2476,7 +2982,8 @@ GLboolean assemble_alu_instruction(r700_AssemblerBase *pAsm) if (GL_FALSE == assemble_alu_src(alu_instruction_ptr, current_source_index, pcurrent_source, - scalar_channel_index) ) + scalar_channel_index, + pAsm) ) { return GL_FALSE; } @@ -2559,7 +3066,8 @@ GLboolean assemble_alu_instruction(r700_AssemblerBase *pAsm) if ( GL_FALSE == assemble_alu_src(alu_instruction_ptr, current_source_index, pcurrent_source, - scalar_channel_index) ) + scalar_channel_index, + pAsm) ) { return GL_FALSE; } @@ -3000,7 +3508,14 @@ GLboolean assemble_DOT(r700_AssemblerBase *pAsm) return GL_FALSE; } - pAsm->D.dst.opcode = SQ_OP2_INST_DOT4; + if(8 == pAsm->unAsic) + { + pAsm->D.dst.opcode = EG_OP2_INST_DOT4; + } + else + { + pAsm->D.dst.opcode = SQ_OP2_INST_DOT4; + } if( GL_FALSE == assemble_dst(pAsm) ) { @@ -3082,6 +3597,11 @@ GLboolean assemble_DST(r700_AssemblerBase *pAsm) GLboolean assemble_EX2(r700_AssemblerBase *pAsm) { + if(8 == pAsm->unAsic) + { + return assemble_math_function(pAsm, EG_OP2_INST_EXP_IEEE); + } + return assemble_math_function(pAsm, SQ_OP2_INST_EXP_IEEE); } @@ -3114,7 +3634,14 @@ GLboolean assemble_EXP(r700_AssemblerBase *pAsm) return GL_FALSE; } - pAsm->D.dst.opcode = SQ_OP2_INST_EXP_IEEE; + if(8 == pAsm->unAsic) + { + pAsm->D.dst.opcode = EG_OP2_INST_EXP_IEEE; + } + else + { + pAsm->D.dst.opcode = SQ_OP2_INST_EXP_IEEE; + } pAsm->D.dst.math = 1; if( GL_FALSE == assemble_dst(pAsm) ) @@ -3163,7 +3690,14 @@ GLboolean assemble_EXP(r700_AssemblerBase *pAsm) // EX2 dst.z, a.x if ((pAsm->pILInst->DstReg.WriteMask >> 2) & 0x1) { - pAsm->D.dst.opcode = SQ_OP2_INST_EXP_IEEE; + if(8 == pAsm->unAsic) + { + pAsm->D.dst.opcode = EG_OP2_INST_EXP_IEEE; + } + else + { + pAsm->D.dst.opcode = SQ_OP2_INST_EXP_IEEE; + } pAsm->D.dst.math = 1; if( GL_FALSE == assemble_dst(pAsm) ) @@ -3238,6 +3772,11 @@ GLboolean assemble_FLR(r700_AssemblerBase *pAsm) GLboolean assemble_FLR_INT(r700_AssemblerBase *pAsm) { + if(8 == pAsm->unAsic) + { + return assemble_math_function(pAsm, EG_OP2_INST_FLT_TO_INT); + } + return assemble_math_function(pAsm, SQ_OP2_INST_FLT_TO_INT); } @@ -3320,6 +3859,11 @@ GLboolean assemble_KIL(r700_AssemblerBase *pAsm, GLuint opcode) GLboolean assemble_LG2(r700_AssemblerBase *pAsm) { + if(8 == pAsm->unAsic) + { + return assemble_math_function(pAsm, EG_OP2_INST_LOG_IEEE); + } + return assemble_math_function(pAsm, SQ_OP2_INST_LOG_IEEE); } @@ -3359,7 +3903,14 @@ GLboolean assemble_LRP(r700_AssemblerBase *pAsm) return GL_FALSE; } - pAsm->D.dst.opcode = SQ_OP3_INST_MULADD; + if(8 == pAsm->unAsic) + { + pAsm->D.dst.opcode = EG_OP3_INST_MULADD; + } + else + { + pAsm->D.dst.opcode = SQ_OP3_INST_MULADD; + } pAsm->D.dst.op3 = 1; pAsm->D.dst.rtype = DST_REG_TEMPORARY; @@ -3457,7 +4008,14 @@ GLboolean assemble_LOG(r700_AssemblerBase *pAsm) // LG2 tmp2.x, tmp1.x // FLOOR tmp3.x, tmp2.x - pAsm->D.dst.opcode = SQ_OP2_INST_LOG_IEEE; + if(8 == pAsm->unAsic) + { + pAsm->D.dst.opcode = EG_OP2_INST_LOG_IEEE; + } + else + { + pAsm->D.dst.opcode = SQ_OP2_INST_LOG_IEEE; + } pAsm->D.dst.math = 1; setaddrmode_PVSDST(&(pAsm->D.dst), ADDR_ABSOLUTE); @@ -3548,7 +4106,14 @@ GLboolean assemble_LOG(r700_AssemblerBase *pAsm) return GL_FALSE; } - pAsm->D.dst.opcode = SQ_OP2_INST_EXP_IEEE; + if(8 == pAsm->unAsic) + { + pAsm->D.dst.opcode = EG_OP2_INST_EXP_IEEE; + } + else + { + pAsm->D.dst.opcode = SQ_OP2_INST_EXP_IEEE; + } pAsm->D.dst.math = 1; if( GL_FALSE == assemble_dst(pAsm) ) @@ -3630,7 +4195,14 @@ GLboolean assemble_MAD(struct r700_AssemblerBase *pAsm) return GL_FALSE; } - pAsm->D.dst.opcode = SQ_OP3_INST_MULADD; + if(8 == pAsm->unAsic) + { + pAsm->D.dst.opcode = EG_OP3_INST_MULADD; + } + else + { + pAsm->D.dst.opcode = SQ_OP3_INST_MULADD; + } pAsm->D.dst.op3 = 1; tmp = (-1); @@ -3798,7 +4370,14 @@ GLboolean assemble_LIT(r700_AssemblerBase *pAsm) swizzleagain_PVSSRC(&(pAsm->S[0].src), SQ_SEL_Y, SQ_SEL_Y, SQ_SEL_Y, SQ_SEL_Y); /* dst.z = log(src.y) */ - pAsm->D.dst.opcode = SQ_OP2_INST_LOG_CLAMPED; + if(8 == pAsm->unAsic) + { + pAsm->D.dst.opcode = EG_OP2_INST_LOG_CLAMPED; + } + else + { + pAsm->D.dst.opcode = SQ_OP2_INST_LOG_CLAMPED; + } pAsm->D.dst.math = 1; pAsm->D.dst.rtype = dstType; pAsm->D.dst.reg = dstReg; @@ -3862,7 +4441,14 @@ GLboolean assemble_LIT(r700_AssemblerBase *pAsm) } /* dst.z = exp(tmp.x) */ - pAsm->D.dst.opcode = SQ_OP2_INST_EXP_IEEE; + if(8 == pAsm->unAsic) + { + pAsm->D.dst.opcode = EG_OP2_INST_EXP_IEEE; + } + else + { + pAsm->D.dst.opcode = SQ_OP2_INST_EXP_IEEE; + } pAsm->D.dst.math = 1; pAsm->D.dst.rtype = dstType; pAsm->D.dst.reg = dstReg; @@ -4017,7 +4603,14 @@ GLboolean assemble_POW(r700_AssemblerBase *pAsm) tmp = gethelpr(pAsm); // LG2 tmp.x, a.swizzle - pAsm->D.dst.opcode = SQ_OP2_INST_LOG_IEEE; + if(8 == pAsm->unAsic) + { + pAsm->D.dst.opcode = EG_OP2_INST_LOG_IEEE; + } + else + { + pAsm->D.dst.opcode = SQ_OP2_INST_LOG_IEEE; + } pAsm->D.dst.math = 1; setaddrmode_PVSDST(&(pAsm->D.dst), ADDR_ABSOLUTE); @@ -4061,7 +4654,14 @@ GLboolean assemble_POW(r700_AssemblerBase *pAsm) // EX2 dst.mask, tmp.x // EX2 tmp.x, tmp.x - pAsm->D.dst.opcode = SQ_OP2_INST_EXP_IEEE; + if(8 == pAsm->unAsic) + { + pAsm->D.dst.opcode = EG_OP2_INST_EXP_IEEE; + } + else + { + pAsm->D.dst.opcode = SQ_OP2_INST_EXP_IEEE; + } pAsm->D.dst.math = 1; setaddrmode_PVSDST(&(pAsm->D.dst), ADDR_ABSOLUTE); @@ -4105,11 +4705,21 @@ GLboolean assemble_POW(r700_AssemblerBase *pAsm) GLboolean assemble_RCP(r700_AssemblerBase *pAsm) { + if(8 == pAsm->unAsic) + { + return assemble_math_function(pAsm, EG_OP2_INST_RECIP_IEEE); + } + return assemble_math_function(pAsm, SQ_OP2_INST_RECIP_IEEE); } GLboolean assemble_RSQ(r700_AssemblerBase *pAsm) { + if(8 == pAsm->unAsic) + { + return assemble_math_function(pAsm, EG_OP2_INST_RECIPSQRT_IEEE); + } + return assemble_math_function(pAsm, SQ_OP2_INST_RECIPSQRT_IEEE); } @@ -4195,7 +4805,14 @@ GLboolean assemble_SCS(r700_AssemblerBase *pAsm) } // COS dst.x, a.x - pAsm->D.dst.opcode = SQ_OP2_INST_COS; + if(8 == pAsm->unAsic) + { + pAsm->D.dst.opcode = EG_OP2_INST_COS; + } + else + { + pAsm->D.dst.opcode = SQ_OP2_INST_COS; + } pAsm->D.dst.math = 1; assemble_dst(pAsm); @@ -4214,7 +4831,14 @@ GLboolean assemble_SCS(r700_AssemblerBase *pAsm) } // SIN dst.y, a.x - pAsm->D.dst.opcode = SQ_OP2_INST_SIN; + if(8 == pAsm->unAsic) + { + pAsm->D.dst.opcode = EG_OP2_INST_SIN; + } + else + { + pAsm->D.dst.opcode = SQ_OP2_INST_SIN; + } pAsm->D.dst.math = 1; assemble_dst(pAsm); @@ -4466,7 +5090,14 @@ GLboolean assemble_TEX(r700_AssemblerBase *pAsm) if (pAsm->pILInst[pAsm->uiCurInst].Opcode == OPCODE_TXP) { GLuint tmp = gethelpr(pAsm); - pAsm->D.dst.opcode = SQ_OP2_INST_RECIP_IEEE; + if(8 == pAsm->unAsic) + { + pAsm->D.dst.opcode = EG_OP2_INST_RECIP_IEEE; + } + else + { + pAsm->D.dst.opcode = SQ_OP2_INST_RECIP_IEEE; + } pAsm->D.dst.math = 1; setaddrmode_PVSDST(&(pAsm->D.dst), ADDR_ABSOLUTE); pAsm->D.dst.rtype = DST_REG_TEMPORARY; @@ -4516,7 +5147,14 @@ GLboolean assemble_TEX(r700_AssemblerBase *pAsm) GLuint tmp2 = gethelpr(pAsm); /* tmp1.xyzw = CUBE(R0.zzxy, R0.yxzz) */ - pAsm->D.dst.opcode = SQ_OP2_INST_CUBE; + if(8 == pAsm->unAsic) + { + pAsm->D.dst.opcode = EG_OP2_INST_CUBE; + } + else + { + pAsm->D.dst.opcode = SQ_OP2_INST_CUBE; + } setaddrmode_PVSDST(&(pAsm->D.dst), ADDR_ABSOLUTE); pAsm->D.dst.rtype = DST_REG_TEMPORARY; pAsm->D.dst.reg = tmp1; @@ -4541,7 +5179,14 @@ GLboolean assemble_TEX(r700_AssemblerBase *pAsm) } /* tmp1.z = RCP_e(|tmp1.z|) */ - pAsm->D.dst.opcode = SQ_OP2_INST_RECIP_IEEE; + if(8 == pAsm->unAsic) + { + pAsm->D.dst.opcode = EG_OP2_INST_RECIP_IEEE; + } + else + { + pAsm->D.dst.opcode = SQ_OP2_INST_RECIP_IEEE; + } pAsm->D.dst.math = 1; setaddrmode_PVSDST(&(pAsm->D.dst), ADDR_ABSOLUTE); pAsm->D.dst.rtype = DST_REG_TEMPORARY; @@ -4560,7 +5205,14 @@ GLboolean assemble_TEX(r700_AssemblerBase *pAsm) * MULADD R0.y, R0.y, PS1, (0x3FC00000, 1.5f).x * muladd has no writemask, have to use another temp */ - pAsm->D.dst.opcode = SQ_OP3_INST_MULADD; + if(8 == pAsm->unAsic) + { + pAsm->D.dst.opcode = EG_OP3_INST_MULADD; + } + else + { + pAsm->D.dst.opcode = SQ_OP3_INST_MULADD; + } pAsm->D.dst.op3 = 1; setaddrmode_PVSDST(&(pAsm->D.dst), ADDR_ABSOLUTE); pAsm->D.dst.rtype = DST_REG_TEMPORARY; @@ -4747,7 +5399,14 @@ GLboolean assemble_XPD(r700_AssemblerBase *pAsm) return GL_FALSE; } - pAsm->D.dst.opcode = SQ_OP3_INST_MULADD; + if(8 == pAsm->unAsic) + { + pAsm->D.dst.opcode = EG_OP3_INST_MULADD; + } + else + { + pAsm->D.dst.opcode = SQ_OP3_INST_MULADD; + } pAsm->D.dst.op3 = 1; if(0xF != pAsm->pILInst[pAsm->uiCurInst].DstReg.WriteMask) @@ -4904,16 +5563,49 @@ GLboolean jumpToOffest(r700_AssemblerBase *pAsm, GLuint pops, GLint offset) return GL_FALSE; } - pAsm->cf_current_cf_clause_ptr->m_Word1.f.pop_count = pops; - pAsm->cf_current_cf_clause_ptr->m_Word1.f.cf_const = 0x0; - pAsm->cf_current_cf_clause_ptr->m_Word1.f.cond = SQ_CF_COND_ACTIVE; + if(8 == pAsm->unAsic) + { + SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, + EG_CF_INST_JUMP, + EG_CF_WORD1__CF_INST_shift, EG_CF_WORD1__CF_INST_mask); + SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, + pops, + EG_CF_WORD1__POP_COUNT_shift, EG_CF_WORD1__POP_COUNT_mask); + SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, + 0, + EG_CF_WORD1__CF_CONST_shift, EG_CF_WORD1__CF_CONST_mask); + SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, + SQ_CF_COND_ACTIVE, + EG_CF_WORD1__COND_shift, EG_CF_WORD1__COND_mask); + SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, + 0, + EG_CF_WORD1__COUNT_shift, EG_CF_WORD1__COUNT_mask); + SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, + 0, + EG_CF_WORD1__VPM_shift, EG_CF_WORD1__VPM_bit); + SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, + 0, + EG_CF_WORD1__EOP_shift, EG_CF_WORD1__EOP_bit); + SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, + 0, + EG_CF_WORD1__WQM_shift, EG_CF_WORD1__WQM_bit); + SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, + 1, + EG_CF_WORD1__BARRIER_shift, EG_CF_WORD1__BARRIER_bit); + } + else + { + pAsm->cf_current_cf_clause_ptr->m_Word1.f.pop_count = pops; + pAsm->cf_current_cf_clause_ptr->m_Word1.f.cf_const = 0x0; + pAsm->cf_current_cf_clause_ptr->m_Word1.f.cond = SQ_CF_COND_ACTIVE; - pAsm->cf_current_cf_clause_ptr->m_Word1.f.end_of_program = 0x0; - pAsm->cf_current_cf_clause_ptr->m_Word1.f.valid_pixel_mode = 0x0; - pAsm->cf_current_cf_clause_ptr->m_Word1.f.cf_inst = SQ_CF_INST_JUMP; - pAsm->cf_current_cf_clause_ptr->m_Word1.f.whole_quad_mode = 0x0; + pAsm->cf_current_cf_clause_ptr->m_Word1.f.end_of_program = 0x0; + pAsm->cf_current_cf_clause_ptr->m_Word1.f.valid_pixel_mode = 0x0; + pAsm->cf_current_cf_clause_ptr->m_Word1.f.cf_inst = SQ_CF_INST_JUMP; + pAsm->cf_current_cf_clause_ptr->m_Word1.f.whole_quad_mode = 0x0; - pAsm->cf_current_cf_clause_ptr->m_Word1.f.barrier = 0x1; + pAsm->cf_current_cf_clause_ptr->m_Word1.f.barrier = 0x1; + } pAsm->cf_current_cf_clause_ptr->m_Word0.f.addr = pAsm->cf_current_cf_clause_ptr->m_uIndex + offset; @@ -4927,17 +5619,50 @@ GLboolean pops(r700_AssemblerBase *pAsm, GLuint pops) return GL_FALSE; } - pAsm->cf_current_cf_clause_ptr->m_Word1.f.pop_count = pops; - pAsm->cf_current_cf_clause_ptr->m_Word1.f.cf_const = 0x0; - pAsm->cf_current_cf_clause_ptr->m_Word1.f.cond = SQ_CF_COND_ACTIVE; + if(8 == pAsm->unAsic) + { + SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, + EG_CF_INST_POP, + EG_CF_WORD1__CF_INST_shift, EG_CF_WORD1__CF_INST_mask); + SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, + pops, + EG_CF_WORD1__POP_COUNT_shift, EG_CF_WORD1__POP_COUNT_mask); + SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, + 0, + EG_CF_WORD1__CF_CONST_shift, EG_CF_WORD1__CF_CONST_mask); + SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, + SQ_CF_COND_ACTIVE, + EG_CF_WORD1__COND_shift, EG_CF_WORD1__COND_mask); + SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, + 0, + EG_CF_WORD1__EOP_shift, EG_CF_WORD1__EOP_bit); + SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, + 0, + EG_CF_WORD1__VPM_shift, EG_CF_WORD1__VPM_bit); + SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, + 0, + EG_CF_WORD1__WQM_shift, EG_CF_WORD1__WQM_bit); + SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, + 1, + EG_CF_WORD1__BARRIER_shift, EG_CF_WORD1__BARRIER_bit); + SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, + 0, + EG_CF_WORD1__COUNT_shift, EG_CF_WORD1__COUNT_mask); + } + else + { + pAsm->cf_current_cf_clause_ptr->m_Word1.f.pop_count = pops; + pAsm->cf_current_cf_clause_ptr->m_Word1.f.cf_const = 0x0; + pAsm->cf_current_cf_clause_ptr->m_Word1.f.cond = SQ_CF_COND_ACTIVE; - pAsm->cf_current_cf_clause_ptr->m_Word1.f.end_of_program = 0x0; - pAsm->cf_current_cf_clause_ptr->m_Word1.f.valid_pixel_mode = 0x0; - pAsm->cf_current_cf_clause_ptr->m_Word1.f.cf_inst = SQ_CF_INST_POP; + pAsm->cf_current_cf_clause_ptr->m_Word1.f.end_of_program = 0x0; + pAsm->cf_current_cf_clause_ptr->m_Word1.f.valid_pixel_mode = 0x0; + pAsm->cf_current_cf_clause_ptr->m_Word1.f.cf_inst = SQ_CF_INST_POP; - pAsm->cf_current_cf_clause_ptr->m_Word1.f.whole_quad_mode = 0x0; + pAsm->cf_current_cf_clause_ptr->m_Word1.f.whole_quad_mode = 0x0; - pAsm->cf_current_cf_clause_ptr->m_Word1.f.barrier = 0x1; + pAsm->cf_current_cf_clause_ptr->m_Word1.f.barrier = 0x1; + } pAsm->cf_current_cf_clause_ptr->m_Word0.f.addr = pAsm->cf_current_cf_clause_ptr->m_uIndex + 1; return GL_TRUE; @@ -4955,23 +5680,66 @@ GLboolean assemble_IF(r700_AssemblerBase *pAsm, GLboolean bHasElse) return GL_FALSE; } - if(GL_TRUE != bHasElse) - { - pAsm->cf_current_cf_clause_ptr->m_Word1.f.pop_count = 1; + if(8 == pAsm->unAsic) + { + if(GL_TRUE != bHasElse) + { + SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, + 1, + EG_CF_WORD1__POP_COUNT_shift, EG_CF_WORD1__POP_COUNT_mask); + } + else + { + SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, + 0, + EG_CF_WORD1__POP_COUNT_shift, EG_CF_WORD1__POP_COUNT_mask); + } + + SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, + EG_CF_INST_JUMP, + EG_CF_WORD1__CF_INST_shift, EG_CF_WORD1__CF_INST_mask); + SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, + 0, + EG_CF_WORD1__CF_CONST_shift, EG_CF_WORD1__CF_CONST_mask); + SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, + SQ_CF_COND_ACTIVE, + EG_CF_WORD1__COND_shift, EG_CF_WORD1__COND_mask); + SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, + 0, + EG_CF_WORD1__EOP_shift, EG_CF_WORD1__EOP_bit); + SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, + 0, + EG_CF_WORD1__VPM_shift, EG_CF_WORD1__VPM_bit); + SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, + 0, + EG_CF_WORD1__WQM_shift, EG_CF_WORD1__WQM_bit); + SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, + 1, + EG_CF_WORD1__BARRIER_shift, EG_CF_WORD1__BARRIER_bit); + SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, + 0, + EG_CF_WORD1__COUNT_shift, EG_CF_WORD1__COUNT_mask); } else { - pAsm->cf_current_cf_clause_ptr->m_Word1.f.pop_count = 0; - } - pAsm->cf_current_cf_clause_ptr->m_Word1.f.cf_const = 0x0; - pAsm->cf_current_cf_clause_ptr->m_Word1.f.cond = SQ_CF_COND_ACTIVE; + if(GL_TRUE != bHasElse) + { + pAsm->cf_current_cf_clause_ptr->m_Word1.f.pop_count = 1; + } + else + { + pAsm->cf_current_cf_clause_ptr->m_Word1.f.pop_count = 0; + } + pAsm->cf_current_cf_clause_ptr->m_Word1.f.cf_const = 0x0; + pAsm->cf_current_cf_clause_ptr->m_Word1.f.cond = SQ_CF_COND_ACTIVE; - pAsm->cf_current_cf_clause_ptr->m_Word1.f.end_of_program = 0x0; - pAsm->cf_current_cf_clause_ptr->m_Word1.f.valid_pixel_mode = 0x0; - pAsm->cf_current_cf_clause_ptr->m_Word1.f.cf_inst = SQ_CF_INST_JUMP; - pAsm->cf_current_cf_clause_ptr->m_Word1.f.whole_quad_mode = 0x0; + pAsm->cf_current_cf_clause_ptr->m_Word1.f.end_of_program = 0x0; + pAsm->cf_current_cf_clause_ptr->m_Word1.f.valid_pixel_mode = 0x0; + pAsm->cf_current_cf_clause_ptr->m_Word1.f.cf_inst = SQ_CF_INST_JUMP; + pAsm->cf_current_cf_clause_ptr->m_Word1.f.whole_quad_mode = 0x0; - pAsm->cf_current_cf_clause_ptr->m_Word1.f.barrier = 0x1; + pAsm->cf_current_cf_clause_ptr->m_Word1.f.barrier = 0x1; + } pAsm->FCSP++; pAsm->fc_stack[pAsm->FCSP].type = FC_IF; @@ -4998,16 +5766,49 @@ GLboolean assemble_ELSE(r700_AssemblerBase *pAsm) return GL_FALSE; } - pAsm->cf_current_cf_clause_ptr->m_Word1.f.pop_count = 1; /// - pAsm->cf_current_cf_clause_ptr->m_Word1.f.cf_const = 0x0; - pAsm->cf_current_cf_clause_ptr->m_Word1.f.cond = SQ_CF_COND_ACTIVE; + if(8 == pAsm->unAsic) + { + SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, + 1, + EG_CF_WORD1__POP_COUNT_shift, EG_CF_WORD1__POP_COUNT_mask); + SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, + EG_CF_INST_ELSE, + EG_CF_WORD1__CF_INST_shift, EG_CF_WORD1__CF_INST_mask); + SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, + 0, + EG_CF_WORD1__CF_CONST_shift, EG_CF_WORD1__CF_CONST_mask); + SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, + SQ_CF_COND_ACTIVE, + EG_CF_WORD1__COND_shift, EG_CF_WORD1__COND_mask); + SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, + 0, + EG_CF_WORD1__EOP_shift, EG_CF_WORD1__EOP_bit); + SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, + 0, + EG_CF_WORD1__VPM_shift, EG_CF_WORD1__VPM_bit); + SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, + 0, + EG_CF_WORD1__WQM_shift, EG_CF_WORD1__WQM_bit); + SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, + 1, + EG_CF_WORD1__BARRIER_shift, EG_CF_WORD1__BARRIER_bit); + SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, + 0, + EG_CF_WORD1__COUNT_shift, EG_CF_WORD1__COUNT_mask); + } + else + { + pAsm->cf_current_cf_clause_ptr->m_Word1.f.pop_count = 1; /// + pAsm->cf_current_cf_clause_ptr->m_Word1.f.cf_const = 0x0; + pAsm->cf_current_cf_clause_ptr->m_Word1.f.cond = SQ_CF_COND_ACTIVE; - pAsm->cf_current_cf_clause_ptr->m_Word1.f.end_of_program = 0x0; - pAsm->cf_current_cf_clause_ptr->m_Word1.f.valid_pixel_mode = 0x0; - pAsm->cf_current_cf_clause_ptr->m_Word1.f.cf_inst = SQ_CF_INST_ELSE; - pAsm->cf_current_cf_clause_ptr->m_Word1.f.whole_quad_mode = 0x0; + pAsm->cf_current_cf_clause_ptr->m_Word1.f.end_of_program = 0x0; + pAsm->cf_current_cf_clause_ptr->m_Word1.f.valid_pixel_mode = 0x0; + pAsm->cf_current_cf_clause_ptr->m_Word1.f.cf_inst = SQ_CF_INST_ELSE; + pAsm->cf_current_cf_clause_ptr->m_Word1.f.whole_quad_mode = 0x0; - pAsm->cf_current_cf_clause_ptr->m_Word1.f.barrier = 0x1; + pAsm->cf_current_cf_clause_ptr->m_Word1.f.barrier = 0x1; + } pAsm->fc_stack[pAsm->FCSP].mid = (R700ControlFlowGenericClause **)_mesa_realloc( (void *)pAsm->fc_stack[pAsm->FCSP].mid, 0, @@ -5067,17 +5868,49 @@ GLboolean assemble_BGNLOOP(r700_AssemblerBase *pAsm) return GL_FALSE; } - - pAsm->cf_current_cf_clause_ptr->m_Word1.f.pop_count = 0; - pAsm->cf_current_cf_clause_ptr->m_Word1.f.cf_const = 0x0; - pAsm->cf_current_cf_clause_ptr->m_Word1.f.cond = SQ_CF_COND_ACTIVE; + if(8 == pAsm->unAsic) + { + SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, + 0, + EG_CF_WORD1__POP_COUNT_shift, EG_CF_WORD1__POP_COUNT_mask); + SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, + EG_CF_INST_LOOP_START_NO_AL, + EG_CF_WORD1__CF_INST_shift, EG_CF_WORD1__CF_INST_mask); + SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, + 0, + EG_CF_WORD1__CF_CONST_shift, EG_CF_WORD1__CF_CONST_mask); + SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, + SQ_CF_COND_ACTIVE, + EG_CF_WORD1__COND_shift, EG_CF_WORD1__COND_mask); + SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, + 0, + EG_CF_WORD1__EOP_shift, EG_CF_WORD1__EOP_bit); + SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, + 0, + EG_CF_WORD1__VPM_shift, EG_CF_WORD1__VPM_bit); + SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, + 0, + EG_CF_WORD1__WQM_shift, EG_CF_WORD1__WQM_bit); + SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, + 1, + EG_CF_WORD1__BARRIER_shift, EG_CF_WORD1__BARRIER_bit); + SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, + 0, + EG_CF_WORD1__COUNT_shift, EG_CF_WORD1__COUNT_mask); + } + else + { + pAsm->cf_current_cf_clause_ptr->m_Word1.f.pop_count = 0; + pAsm->cf_current_cf_clause_ptr->m_Word1.f.cf_const = 0x0; + pAsm->cf_current_cf_clause_ptr->m_Word1.f.cond = SQ_CF_COND_ACTIVE; - pAsm->cf_current_cf_clause_ptr->m_Word1.f.end_of_program = 0x0; - pAsm->cf_current_cf_clause_ptr->m_Word1.f.valid_pixel_mode = 0x0; - pAsm->cf_current_cf_clause_ptr->m_Word1.f.cf_inst = SQ_CF_INST_LOOP_START_NO_AL; - pAsm->cf_current_cf_clause_ptr->m_Word1.f.whole_quad_mode = 0x0; + pAsm->cf_current_cf_clause_ptr->m_Word1.f.end_of_program = 0x0; + pAsm->cf_current_cf_clause_ptr->m_Word1.f.valid_pixel_mode = 0x0; + pAsm->cf_current_cf_clause_ptr->m_Word1.f.cf_inst = SQ_CF_INST_LOOP_START_NO_AL; + pAsm->cf_current_cf_clause_ptr->m_Word1.f.whole_quad_mode = 0x0; - pAsm->cf_current_cf_clause_ptr->m_Word1.f.barrier = 0x1; + pAsm->cf_current_cf_clause_ptr->m_Word1.f.barrier = 0x1; + } pAsm->FCSP++; pAsm->fc_stack[pAsm->FCSP].type = FC_LOOP; @@ -5118,18 +5951,50 @@ GLboolean assemble_BRK(r700_AssemblerBase *pAsm) return GL_FALSE; } - - pAsm->cf_current_cf_clause_ptr->m_Word1.f.pop_count = 1; - pAsm->cf_current_cf_clause_ptr->m_Word1.f.cf_const = 0x0; - pAsm->cf_current_cf_clause_ptr->m_Word1.f.cond = SQ_CF_COND_ACTIVE; + if(8 == pAsm->unAsic) + { + SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, + 1, + EG_CF_WORD1__POP_COUNT_shift, EG_CF_WORD1__POP_COUNT_mask); + SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, + EG_CF_INST_LOOP_BREAK, + EG_CF_WORD1__CF_INST_shift, EG_CF_WORD1__CF_INST_mask); + SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, + 0, + EG_CF_WORD1__CF_CONST_shift, EG_CF_WORD1__CF_CONST_mask); + SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, + SQ_CF_COND_ACTIVE, + EG_CF_WORD1__COND_shift, EG_CF_WORD1__COND_mask); + SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, + 0, + EG_CF_WORD1__EOP_shift, EG_CF_WORD1__EOP_bit); + SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, + 0, + EG_CF_WORD1__VPM_shift, EG_CF_WORD1__VPM_bit); + SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, + 0, + EG_CF_WORD1__WQM_shift, EG_CF_WORD1__WQM_bit); + SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, + 1, + EG_CF_WORD1__BARRIER_shift, EG_CF_WORD1__BARRIER_bit); + SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, + 0, + EG_CF_WORD1__COUNT_shift, EG_CF_WORD1__COUNT_mask); + } + else + { + pAsm->cf_current_cf_clause_ptr->m_Word1.f.pop_count = 1; + pAsm->cf_current_cf_clause_ptr->m_Word1.f.cf_const = 0x0; + pAsm->cf_current_cf_clause_ptr->m_Word1.f.cond = SQ_CF_COND_ACTIVE; - pAsm->cf_current_cf_clause_ptr->m_Word1.f.end_of_program = 0x0; - pAsm->cf_current_cf_clause_ptr->m_Word1.f.valid_pixel_mode = 0x0; - pAsm->cf_current_cf_clause_ptr->m_Word1.f.cf_inst = SQ_CF_INST_LOOP_BREAK; + pAsm->cf_current_cf_clause_ptr->m_Word1.f.end_of_program = 0x0; + pAsm->cf_current_cf_clause_ptr->m_Word1.f.valid_pixel_mode = 0x0; + pAsm->cf_current_cf_clause_ptr->m_Word1.f.cf_inst = SQ_CF_INST_LOOP_BREAK; - pAsm->cf_current_cf_clause_ptr->m_Word1.f.whole_quad_mode = 0x0; + pAsm->cf_current_cf_clause_ptr->m_Word1.f.whole_quad_mode = 0x0; - pAsm->cf_current_cf_clause_ptr->m_Word1.f.barrier = 0x1; + pAsm->cf_current_cf_clause_ptr->m_Word1.f.barrier = 0x1; + } pAsm->fc_stack[unFCSP].mid = (R700ControlFlowGenericClause **)_mesa_realloc( (void *)pAsm->fc_stack[unFCSP].mid, @@ -5143,18 +6008,52 @@ GLboolean assemble_BRK(r700_AssemblerBase *pAsm) return GL_FALSE; } - pAsm->cf_current_cf_clause_ptr->m_Word1.f.pop_count = 1; - pAsm->cf_current_cf_clause_ptr->m_Word1.f.cf_const = 0x0; - pAsm->cf_current_cf_clause_ptr->m_Word1.f.cond = SQ_CF_COND_ACTIVE; + if(8 == pAsm->unAsic) + { + SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, + 1, + EG_CF_WORD1__POP_COUNT_shift, EG_CF_WORD1__POP_COUNT_mask); + SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, + EG_CF_INST_POP, + EG_CF_WORD1__CF_INST_shift, EG_CF_WORD1__CF_INST_mask); + SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, + 0, + EG_CF_WORD1__CF_CONST_shift, EG_CF_WORD1__CF_CONST_mask); + SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, + SQ_CF_COND_ACTIVE, + EG_CF_WORD1__COND_shift, EG_CF_WORD1__COND_mask); + SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, + 0, + EG_CF_WORD1__EOP_shift, EG_CF_WORD1__EOP_bit); + SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, + 0, + EG_CF_WORD1__VPM_shift, EG_CF_WORD1__VPM_bit); + SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, + 0, + EG_CF_WORD1__WQM_shift, EG_CF_WORD1__WQM_bit); + SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, + 1, + EG_CF_WORD1__BARRIER_shift, EG_CF_WORD1__BARRIER_bit); + SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, + 0, + EG_CF_WORD1__COUNT_shift, EG_CF_WORD1__COUNT_mask); + } + else + { + pAsm->cf_current_cf_clause_ptr->m_Word1.f.pop_count = 1; + pAsm->cf_current_cf_clause_ptr->m_Word1.f.cf_const = 0x0; + pAsm->cf_current_cf_clause_ptr->m_Word1.f.cond = SQ_CF_COND_ACTIVE; - pAsm->cf_current_cf_clause_ptr->m_Word1.f.end_of_program = 0x0; - pAsm->cf_current_cf_clause_ptr->m_Word1.f.valid_pixel_mode = 0x0; - pAsm->cf_current_cf_clause_ptr->m_Word1.f.cf_inst = SQ_CF_INST_POP; + pAsm->cf_current_cf_clause_ptr->m_Word1.f.end_of_program = 0x0; + pAsm->cf_current_cf_clause_ptr->m_Word1.f.valid_pixel_mode = 0x0; + pAsm->cf_current_cf_clause_ptr->m_Word1.f.cf_inst = SQ_CF_INST_POP; - pAsm->cf_current_cf_clause_ptr->m_Word1.f.whole_quad_mode = 0x0; + pAsm->cf_current_cf_clause_ptr->m_Word1.f.whole_quad_mode = 0x0; - pAsm->cf_current_cf_clause_ptr->m_Word1.f.barrier = 0x1; - pAsm->cf_current_cf_clause_ptr->m_Word0.f.addr = pAsm->cf_current_cf_clause_ptr->m_uIndex + 1; + pAsm->cf_current_cf_clause_ptr->m_Word1.f.barrier = 0x1; + } + + pAsm->cf_current_cf_clause_ptr->m_Word0.f.addr = pAsm->cf_current_cf_clause_ptr->m_uIndex + 1; checkStackDepth(pAsm, FC_PUSH_VPM, GL_TRUE); @@ -5188,18 +6087,50 @@ GLboolean assemble_CONT(r700_AssemblerBase *pAsm) return GL_FALSE; } - - pAsm->cf_current_cf_clause_ptr->m_Word1.f.pop_count = 1; - pAsm->cf_current_cf_clause_ptr->m_Word1.f.cf_const = 0x0; - pAsm->cf_current_cf_clause_ptr->m_Word1.f.cond = SQ_CF_COND_ACTIVE; + if(8 == pAsm->unAsic) + { + SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, + 1, + EG_CF_WORD1__POP_COUNT_shift, EG_CF_WORD1__POP_COUNT_mask); + SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, + EG_CF_INST_LOOP_CONTINUE, + EG_CF_WORD1__CF_INST_shift, EG_CF_WORD1__CF_INST_mask); + SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, + 0, + EG_CF_WORD1__CF_CONST_shift, EG_CF_WORD1__CF_CONST_mask); + SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, + SQ_CF_COND_ACTIVE, + EG_CF_WORD1__COND_shift, EG_CF_WORD1__COND_mask); + SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, + 0, + EG_CF_WORD1__EOP_shift, EG_CF_WORD1__EOP_bit); + SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, + 0, + EG_CF_WORD1__VPM_shift, EG_CF_WORD1__VPM_bit); + SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, + 0, + EG_CF_WORD1__WQM_shift, EG_CF_WORD1__WQM_bit); + SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, + 1, + EG_CF_WORD1__BARRIER_shift, EG_CF_WORD1__BARRIER_bit); + SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, + 0, + EG_CF_WORD1__COUNT_shift, EG_CF_WORD1__COUNT_mask); + } + else + { + pAsm->cf_current_cf_clause_ptr->m_Word1.f.pop_count = 1; + pAsm->cf_current_cf_clause_ptr->m_Word1.f.cf_const = 0x0; + pAsm->cf_current_cf_clause_ptr->m_Word1.f.cond = SQ_CF_COND_ACTIVE; - pAsm->cf_current_cf_clause_ptr->m_Word1.f.end_of_program = 0x0; - pAsm->cf_current_cf_clause_ptr->m_Word1.f.valid_pixel_mode = 0x0; - pAsm->cf_current_cf_clause_ptr->m_Word1.f.cf_inst = SQ_CF_INST_LOOP_CONTINUE; + pAsm->cf_current_cf_clause_ptr->m_Word1.f.end_of_program = 0x0; + pAsm->cf_current_cf_clause_ptr->m_Word1.f.valid_pixel_mode = 0x0; + pAsm->cf_current_cf_clause_ptr->m_Word1.f.cf_inst = SQ_CF_INST_LOOP_CONTINUE; - pAsm->cf_current_cf_clause_ptr->m_Word1.f.whole_quad_mode = 0x0; + pAsm->cf_current_cf_clause_ptr->m_Word1.f.whole_quad_mode = 0x0; - pAsm->cf_current_cf_clause_ptr->m_Word1.f.barrier = 0x1; + pAsm->cf_current_cf_clause_ptr->m_Word1.f.barrier = 0x1; + } pAsm->fc_stack[unFCSP].mid = (R700ControlFlowGenericClause **)_mesa_realloc( (void *)pAsm->fc_stack[unFCSP].mid, @@ -5213,17 +6144,51 @@ GLboolean assemble_CONT(r700_AssemblerBase *pAsm) return GL_FALSE; } - pAsm->cf_current_cf_clause_ptr->m_Word1.f.pop_count = 1; - pAsm->cf_current_cf_clause_ptr->m_Word1.f.cf_const = 0x0; - pAsm->cf_current_cf_clause_ptr->m_Word1.f.cond = SQ_CF_COND_ACTIVE; + if(8 == pAsm->unAsic) + { + SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, + 1, + EG_CF_WORD1__POP_COUNT_shift, EG_CF_WORD1__POP_COUNT_mask); + SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, + EG_CF_INST_POP, + EG_CF_WORD1__CF_INST_shift, EG_CF_WORD1__CF_INST_mask); + SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, + 0, + EG_CF_WORD1__CF_CONST_shift, EG_CF_WORD1__CF_CONST_mask); + SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, + SQ_CF_COND_ACTIVE, + EG_CF_WORD1__COND_shift, EG_CF_WORD1__COND_mask); + SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, + 0, + EG_CF_WORD1__EOP_shift, EG_CF_WORD1__EOP_bit); + SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, + 0, + EG_CF_WORD1__VPM_shift, EG_CF_WORD1__VPM_bit); + SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, + 0, + EG_CF_WORD1__WQM_shift, EG_CF_WORD1__WQM_bit); + SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, + 1, + EG_CF_WORD1__BARRIER_shift, EG_CF_WORD1__BARRIER_bit); + SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, + 0, + EG_CF_WORD1__COUNT_shift, EG_CF_WORD1__COUNT_mask); + } + else + { + pAsm->cf_current_cf_clause_ptr->m_Word1.f.pop_count = 1; + pAsm->cf_current_cf_clause_ptr->m_Word1.f.cf_const = 0x0; + pAsm->cf_current_cf_clause_ptr->m_Word1.f.cond = SQ_CF_COND_ACTIVE; - pAsm->cf_current_cf_clause_ptr->m_Word1.f.end_of_program = 0x0; - pAsm->cf_current_cf_clause_ptr->m_Word1.f.valid_pixel_mode = 0x0; - pAsm->cf_current_cf_clause_ptr->m_Word1.f.cf_inst = SQ_CF_INST_POP; + pAsm->cf_current_cf_clause_ptr->m_Word1.f.end_of_program = 0x0; + pAsm->cf_current_cf_clause_ptr->m_Word1.f.valid_pixel_mode = 0x0; + pAsm->cf_current_cf_clause_ptr->m_Word1.f.cf_inst = SQ_CF_INST_POP; - pAsm->cf_current_cf_clause_ptr->m_Word1.f.whole_quad_mode = 0x0; + pAsm->cf_current_cf_clause_ptr->m_Word1.f.whole_quad_mode = 0x0; + + pAsm->cf_current_cf_clause_ptr->m_Word1.f.barrier = 0x1; + } - pAsm->cf_current_cf_clause_ptr->m_Word1.f.barrier = 0x1; pAsm->cf_current_cf_clause_ptr->m_Word0.f.addr = pAsm->cf_current_cf_clause_ptr->m_uIndex + 1; checkStackDepth(pAsm, FC_PUSH_VPM, GL_TRUE); @@ -5242,17 +6207,49 @@ GLboolean assemble_ENDLOOP(r700_AssemblerBase *pAsm) return GL_FALSE; } - - pAsm->cf_current_cf_clause_ptr->m_Word1.f.pop_count = 0; - pAsm->cf_current_cf_clause_ptr->m_Word1.f.cf_const = 0x0; - pAsm->cf_current_cf_clause_ptr->m_Word1.f.cond = SQ_CF_COND_ACTIVE; + if(8 == pAsm->unAsic) + { + SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, + 0, + EG_CF_WORD1__POP_COUNT_shift, EG_CF_WORD1__POP_COUNT_mask); + SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, + EG_CF_INST_LOOP_END, + EG_CF_WORD1__CF_INST_shift, EG_CF_WORD1__CF_INST_mask); + SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, + 0, + EG_CF_WORD1__CF_CONST_shift, EG_CF_WORD1__CF_CONST_mask); + SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, + SQ_CF_COND_ACTIVE, + EG_CF_WORD1__COND_shift, EG_CF_WORD1__COND_mask); + SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, + 0, + EG_CF_WORD1__EOP_shift, EG_CF_WORD1__EOP_bit); + SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, + 0, + EG_CF_WORD1__VPM_shift, EG_CF_WORD1__VPM_bit); + SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, + 0, + EG_CF_WORD1__WQM_shift, EG_CF_WORD1__WQM_bit); + SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, + 1, + EG_CF_WORD1__BARRIER_shift, EG_CF_WORD1__BARRIER_bit); + SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, + 0, + EG_CF_WORD1__COUNT_shift, EG_CF_WORD1__COUNT_mask); + } + else + { + pAsm->cf_current_cf_clause_ptr->m_Word1.f.pop_count = 0; + pAsm->cf_current_cf_clause_ptr->m_Word1.f.cf_const = 0x0; + pAsm->cf_current_cf_clause_ptr->m_Word1.f.cond = SQ_CF_COND_ACTIVE; - pAsm->cf_current_cf_clause_ptr->m_Word1.f.end_of_program = 0x0; - pAsm->cf_current_cf_clause_ptr->m_Word1.f.valid_pixel_mode = 0x0; - pAsm->cf_current_cf_clause_ptr->m_Word1.f.cf_inst = SQ_CF_INST_LOOP_END; - pAsm->cf_current_cf_clause_ptr->m_Word1.f.whole_quad_mode = 0x0; + pAsm->cf_current_cf_clause_ptr->m_Word1.f.end_of_program = 0x0; + pAsm->cf_current_cf_clause_ptr->m_Word1.f.valid_pixel_mode = 0x0; + pAsm->cf_current_cf_clause_ptr->m_Word1.f.cf_inst = SQ_CF_INST_LOOP_END; + pAsm->cf_current_cf_clause_ptr->m_Word1.f.whole_quad_mode = 0x0; - pAsm->cf_current_cf_clause_ptr->m_Word1.f.barrier = 0x1; + pAsm->cf_current_cf_clause_ptr->m_Word1.f.barrier = 0x1; + } pAsm->cf_current_cf_clause_ptr->m_Word0.f.addr = pAsm->fc_stack[pAsm->FCSP].first->m_uIndex + 1; pAsm->fc_stack[pAsm->FCSP].first->m_Word0.f.addr = pAsm->cf_current_cf_clause_ptr->m_uIndex + 1; @@ -5314,17 +6311,51 @@ void add_return_inst(r700_AssemblerBase *pAsm) { return; } - //pAsm->cf_current_cf_clause_ptr->m_Word1.f.pop_count = 1; - pAsm->cf_current_cf_clause_ptr->m_Word1.f.pop_count = 0; - pAsm->cf_current_cf_clause_ptr->m_Word1.f.cf_const = 0x0; - pAsm->cf_current_cf_clause_ptr->m_Word1.f.cond = SQ_CF_COND_ACTIVE; - pAsm->cf_current_cf_clause_ptr->m_Word1.f.end_of_program = 0x0; - pAsm->cf_current_cf_clause_ptr->m_Word1.f.valid_pixel_mode = 0x0; - pAsm->cf_current_cf_clause_ptr->m_Word1.f.cf_inst = SQ_CF_INST_RETURN; - pAsm->cf_current_cf_clause_ptr->m_Word1.f.whole_quad_mode = 0x0; + if(8 == pAsm->unAsic) + { + SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, + 0, + EG_CF_WORD1__POP_COUNT_shift, EG_CF_WORD1__POP_COUNT_mask); + SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, + EG_CF_INST_RETURN, + EG_CF_WORD1__CF_INST_shift, EG_CF_WORD1__CF_INST_mask); + SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, + 0, + EG_CF_WORD1__CF_CONST_shift, EG_CF_WORD1__CF_CONST_mask); + SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, + SQ_CF_COND_ACTIVE, + EG_CF_WORD1__COND_shift, EG_CF_WORD1__COND_mask); + SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, + 0, + EG_CF_WORD1__EOP_shift, EG_CF_WORD1__EOP_bit); + SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, + 0, + EG_CF_WORD1__VPM_shift, EG_CF_WORD1__VPM_bit); + SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, + 0, + EG_CF_WORD1__WQM_shift, EG_CF_WORD1__WQM_bit); + SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, + 1, + EG_CF_WORD1__BARRIER_shift, EG_CF_WORD1__BARRIER_bit); + SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, + 0, + EG_CF_WORD1__COUNT_shift, EG_CF_WORD1__COUNT_mask); + } + else + { + //pAsm->cf_current_cf_clause_ptr->m_Word1.f.pop_count = 1; + pAsm->cf_current_cf_clause_ptr->m_Word1.f.pop_count = 0; + pAsm->cf_current_cf_clause_ptr->m_Word1.f.cf_const = 0x0; + pAsm->cf_current_cf_clause_ptr->m_Word1.f.cond = SQ_CF_COND_ACTIVE; + + pAsm->cf_current_cf_clause_ptr->m_Word1.f.end_of_program = 0x0; + pAsm->cf_current_cf_clause_ptr->m_Word1.f.valid_pixel_mode = 0x0; + pAsm->cf_current_cf_clause_ptr->m_Word1.f.cf_inst = SQ_CF_INST_RETURN; + pAsm->cf_current_cf_clause_ptr->m_Word1.f.whole_quad_mode = 0x0; - pAsm->cf_current_cf_clause_ptr->m_Word1.f.barrier = 0x1; + pAsm->cf_current_cf_clause_ptr->m_Word1.f.barrier = 0x1; + } } GLboolean assemble_BGNSUB(r700_AssemblerBase *pAsm, GLint nILindex, GLuint uiIL_Shift) @@ -5447,17 +6478,50 @@ GLboolean assemble_CAL(r700_AssemblerBase *pAsm, return GL_FALSE; } - pAsm->cf_current_cf_clause_ptr->m_Word1.f.call_count = 1; - pAsm->cf_current_cf_clause_ptr->m_Word1.f.pop_count = 0; - pAsm->cf_current_cf_clause_ptr->m_Word1.f.cf_const = 0x0; - pAsm->cf_current_cf_clause_ptr->m_Word1.f.cond = SQ_CF_COND_ACTIVE; + if(8 == pAsm->unAsic) + { + SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, + 0, + EG_CF_WORD1__POP_COUNT_shift, EG_CF_WORD1__POP_COUNT_mask); + SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, + EG_CF_INST_CALL, + EG_CF_WORD1__CF_INST_shift, EG_CF_WORD1__CF_INST_mask); + SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, + 0, + EG_CF_WORD1__CF_CONST_shift, EG_CF_WORD1__CF_CONST_mask); + SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, + SQ_CF_COND_ACTIVE, + EG_CF_WORD1__COND_shift, EG_CF_WORD1__COND_mask); + SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, + 0, + EG_CF_WORD1__EOP_shift, EG_CF_WORD1__EOP_bit); + SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, + 0, + EG_CF_WORD1__VPM_shift, EG_CF_WORD1__VPM_bit); + SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, + 0, + EG_CF_WORD1__WQM_shift, EG_CF_WORD1__WQM_bit); + SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, + 1, + EG_CF_WORD1__BARRIER_shift, EG_CF_WORD1__BARRIER_bit); + SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, + 1, + EG_CF_WORD1__COUNT_shift, EG_CF_WORD1__COUNT_mask); + } + else + { + pAsm->cf_current_cf_clause_ptr->m_Word1.f.call_count = 1; + pAsm->cf_current_cf_clause_ptr->m_Word1.f.pop_count = 0; + pAsm->cf_current_cf_clause_ptr->m_Word1.f.cf_const = 0x0; + pAsm->cf_current_cf_clause_ptr->m_Word1.f.cond = SQ_CF_COND_ACTIVE; - pAsm->cf_current_cf_clause_ptr->m_Word1.f.end_of_program = 0x0; - pAsm->cf_current_cf_clause_ptr->m_Word1.f.valid_pixel_mode = 0x0; - pAsm->cf_current_cf_clause_ptr->m_Word1.f.cf_inst = SQ_CF_INST_CALL; - pAsm->cf_current_cf_clause_ptr->m_Word1.f.whole_quad_mode = 0x0; + pAsm->cf_current_cf_clause_ptr->m_Word1.f.end_of_program = 0x0; + pAsm->cf_current_cf_clause_ptr->m_Word1.f.valid_pixel_mode = 0x0; + pAsm->cf_current_cf_clause_ptr->m_Word1.f.cf_inst = SQ_CF_INST_CALL; + pAsm->cf_current_cf_clause_ptr->m_Word1.f.whole_quad_mode = 0x0; - pAsm->cf_current_cf_clause_ptr->m_Word1.f.barrier = 0x1; + pAsm->cf_current_cf_clause_ptr->m_Word1.f.barrier = 0x1; + } /* Put in caller */ if( (pAsm->unCallerArrayPointer + 1) > pAsm->unCallerArraySize ) @@ -5658,16 +6722,49 @@ GLboolean breakLoopOnFlag(r700_AssemblerBase *pAsm, GLuint unFCSP) return GL_FALSE; } - pAsm->cf_current_cf_clause_ptr->m_Word1.f.pop_count = 1; - pAsm->cf_current_cf_clause_ptr->m_Word1.f.cf_const = 0x0; - pAsm->cf_current_cf_clause_ptr->m_Word1.f.cond = SQ_CF_COND_ACTIVE; + if(8 == pAsm->unAsic) + { + SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, + 1, + EG_CF_WORD1__POP_COUNT_shift, EG_CF_WORD1__POP_COUNT_mask); + SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, + EG_CF_INST_LOOP_BREAK, + EG_CF_WORD1__CF_INST_shift, EG_CF_WORD1__CF_INST_mask); + SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, + 0, + EG_CF_WORD1__CF_CONST_shift, EG_CF_WORD1__CF_CONST_mask); + SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, + SQ_CF_COND_ACTIVE, + EG_CF_WORD1__COND_shift, EG_CF_WORD1__COND_mask); + SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, + 0, + EG_CF_WORD1__EOP_shift, EG_CF_WORD1__EOP_bit); + SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, + 0, + EG_CF_WORD1__VPM_shift, EG_CF_WORD1__VPM_bit); + SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, + 0, + EG_CF_WORD1__WQM_shift, EG_CF_WORD1__WQM_bit); + SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, + 1, + EG_CF_WORD1__BARRIER_shift, EG_CF_WORD1__BARRIER_bit); + SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, + 1, + EG_CF_WORD1__COUNT_shift, EG_CF_WORD1__COUNT_mask); + } + else + { + pAsm->cf_current_cf_clause_ptr->m_Word1.f.pop_count = 1; + pAsm->cf_current_cf_clause_ptr->m_Word1.f.cf_const = 0x0; + pAsm->cf_current_cf_clause_ptr->m_Word1.f.cond = SQ_CF_COND_ACTIVE; - pAsm->cf_current_cf_clause_ptr->m_Word1.f.end_of_program = 0x0; - pAsm->cf_current_cf_clause_ptr->m_Word1.f.valid_pixel_mode = 0x0; - pAsm->cf_current_cf_clause_ptr->m_Word1.f.cf_inst = SQ_CF_INST_LOOP_BREAK; - pAsm->cf_current_cf_clause_ptr->m_Word1.f.whole_quad_mode = 0x0; + pAsm->cf_current_cf_clause_ptr->m_Word1.f.end_of_program = 0x0; + pAsm->cf_current_cf_clause_ptr->m_Word1.f.valid_pixel_mode = 0x0; + pAsm->cf_current_cf_clause_ptr->m_Word1.f.cf_inst = SQ_CF_INST_LOOP_BREAK; + pAsm->cf_current_cf_clause_ptr->m_Word1.f.whole_quad_mode = 0x0; - pAsm->cf_current_cf_clause_ptr->m_Word1.f.barrier = 0x1; + pAsm->cf_current_cf_clause_ptr->m_Word1.f.barrier = 0x1; + } pAsm->fc_stack[unFCSP].mid = (R700ControlFlowGenericClause **)_mesa_realloc( (void *)pAsm->fc_stack[unFCSP].mid, @@ -5756,8 +6853,16 @@ GLboolean AssembleInstr(GLuint uiFirstInst, return GL_FALSE; break; case OPCODE_COS: - if ( GL_FALSE == assemble_TRIG(pR700AsmCode, SQ_OP2_INST_COS) ) - return GL_FALSE; + if(8 == pR700AsmCode->unAsic) + { + if ( GL_FALSE == assemble_TRIG(pR700AsmCode, EG_OP2_INST_COS) ) + return GL_FALSE; + } + else + { + if ( GL_FALSE == assemble_TRIG(pR700AsmCode, SQ_OP2_INST_COS) ) + return GL_FALSE; + } break; case OPCODE_DP2: @@ -5874,8 +6979,16 @@ GLboolean AssembleInstr(GLuint uiFirstInst, return GL_FALSE; break; case OPCODE_SIN: - if ( GL_FALSE == assemble_TRIG(pR700AsmCode, SQ_OP2_INST_SIN) ) - return GL_FALSE; + if(8 == pR700AsmCode->unAsic) + { + if ( GL_FALSE == assemble_TRIG(pR700AsmCode, EG_OP2_INST_SIN) ) + return GL_FALSE; + } + else + { + if ( GL_FALSE == assemble_TRIG(pR700AsmCode, SQ_OP2_INST_SIN) ) + return GL_FALSE; + } break; case OPCODE_SCS: if ( GL_FALSE == assemble_SCS(pR700AsmCode) ) @@ -6103,7 +7216,15 @@ GLboolean AssembleInstr(GLuint uiFirstInst, GLboolean InitShaderProgram(r700_AssemblerBase * pAsm) { +#ifndef GENERATE_SHADER_FOR_2D setRetInLoopFlag(pAsm, SQ_SEL_0); +#endif + + if((SPT_FP == pAsm->currentShaderType) && (8 == pAsm->unAsic)) + { + EG_add_ps_interp(pAsm); + } + pAsm->alu_x_opcode = SQ_CF_INST_ALU; return GL_TRUE; } @@ -6126,6 +7247,7 @@ GLboolean RelocProgram(r700_AssemblerBase * pAsm, struct gl_program * pILProg) plstCFmain = pAsm->CALLSTACK[0].plstCFInstructions_local; +#ifndef GENERATE_SHADER_FOR_2D /* remove flags init if they are not used */ if((pAsm->unCFflags & HAS_LOOPRET) == 0) { @@ -6156,6 +7278,7 @@ GLboolean RelocProgram(r700_AssemblerBase * pAsm, struct gl_program * pILProg) pInst = pInst->pNextInst; }; } +#endif /* GENERATE_SHADER_FOR_2D */ if(pAsm->CALLSTACK[0].max > 0) { @@ -6262,13 +7385,20 @@ GLboolean RelocProgram(r700_AssemblerBase * pAsm, struct gl_program * pILProg) } else { - if(pAsm->bR6xx) + if(8 == pAsm->unAsic) { - uNumSrc = r700GetNumOperands(pALU->m_Word1_OP2.f6.alu_inst, 0); + uNumSrc = EG_GetNumOperands(pALU->m_Word1_OP2.f.alu_inst, 0); } else { - uNumSrc = r700GetNumOperands(pALU->m_Word1_OP2.f.alu_inst, 0); + if(pAsm->bR6xx) + { + uNumSrc = r700GetNumOperands(pALU->m_Word1_OP2.f6.alu_inst, 0); + } + else + { + uNumSrc = r700GetNumOperands(pALU->m_Word1_OP2.f.alu_inst, 0); + } } if(2 == uNumSrc) { /* 2 srcs */ @@ -6559,12 +7689,42 @@ GLboolean Process_Export(r700_AssemblerBase* pAsm, pAsm->cf_current_export_clause_ptr->m_Word0.f.index_gpr = 0x0; pAsm->cf_current_export_clause_ptr->m_Word0.f.elem_size = 0x3; - pAsm->cf_current_export_clause_ptr->m_Word1.f.burst_count = (export_count - 1); - pAsm->cf_current_export_clause_ptr->m_Word1.f.end_of_program = 0x0; - pAsm->cf_current_export_clause_ptr->m_Word1.f.valid_pixel_mode = 0x0; - pAsm->cf_current_export_clause_ptr->m_Word1.f.cf_inst = SQ_CF_INST_EXPORT; // _DONE - pAsm->cf_current_export_clause_ptr->m_Word1.f.whole_quad_mode = 0x0; - pAsm->cf_current_export_clause_ptr->m_Word1.f.barrier = 0x1; + if(8 == pAsm->unAsic) + { + SETfield(pAsm->cf_current_export_clause_ptr->m_Word1.val, + (export_count - 1), + EG_CF_ALLOC_EXPORT_WORD1__BURST_COUNT_shift, + EG_CF_ALLOC_EXPORT_WORD1__BURST_COUNT_mask); + SETfield(pAsm->cf_current_export_clause_ptr->m_Word1.val, + 0, + EG_CF_ALLOC_EXPORT_WORD1__EOP_shift, + EG_CF_ALLOC_EXPORT_WORD1__EOP_bit); + SETfield(pAsm->cf_current_export_clause_ptr->m_Word1.val, + 0, + EG_CF_ALLOC_EXPORT_WORD1__VPM_shift, + EG_CF_ALLOC_EXPORT_WORD1__VPM_bit); + SETfield(pAsm->cf_current_export_clause_ptr->m_Word1.val, + EG_CF_INST_EXPORT, + EG_CF_WORD1__CF_INST_shift, + EG_CF_WORD1__CF_INST_mask); + SETfield(pAsm->cf_current_export_clause_ptr->m_Word1.val, + 0, + EG_CF_ALLOC_EXPORT_WORD1__MARK_shift, + EG_CF_ALLOC_EXPORT_WORD1__MARK_bit); + SETfield(pAsm->cf_current_export_clause_ptr->m_Word1.val, + 1, + EG_CF_ALLOC_EXPORT_WORD1__BARRIER_shift, + EG_CF_ALLOC_EXPORT_WORD1__BARRIER_bit); + } + else + { + pAsm->cf_current_export_clause_ptr->m_Word1.f.burst_count = (export_count - 1); + pAsm->cf_current_export_clause_ptr->m_Word1.f.end_of_program = 0x0; + pAsm->cf_current_export_clause_ptr->m_Word1.f.valid_pixel_mode = 0x0; + pAsm->cf_current_export_clause_ptr->m_Word1.f.cf_inst = SQ_CF_INST_EXPORT; // _DONE + pAsm->cf_current_export_clause_ptr->m_Word1.f.whole_quad_mode = 0x0; + pAsm->cf_current_export_clause_ptr->m_Word1.f.barrier = 0x1; + } if (export_count == 1) { @@ -6692,8 +7852,22 @@ GLboolean Process_Fragment_Exports(r700_AssemblerBase *pR700AsmCode, if(pR700AsmCode->cf_last_export_ptr != NULL) { - pR700AsmCode->cf_last_export_ptr->m_Word1.f.cf_inst = SQ_CF_INST_EXPORT_DONE; - pR700AsmCode->cf_last_export_ptr->m_Word1.f.end_of_program = 0x1; + if(8 == pR700AsmCode->unAsic) + { + SETfield(pR700AsmCode->cf_last_export_ptr->m_Word1.val, + 1, + EG_CF_ALLOC_EXPORT_WORD1__EOP_shift, + EG_CF_ALLOC_EXPORT_WORD1__EOP_bit); + SETfield(pR700AsmCode->cf_last_export_ptr->m_Word1.val, + EG_CF_INST_EXPORT_DONE, + EG_CF_WORD1__CF_INST_shift, + EG_CF_WORD1__CF_INST_mask); + } + else + { + pR700AsmCode->cf_last_export_ptr->m_Word1.f.cf_inst = SQ_CF_INST_EXPORT_DONE; + pR700AsmCode->cf_last_export_ptr->m_Word1.f.end_of_program = 0x1; + } } return GL_TRUE; @@ -6739,7 +7913,17 @@ GLboolean Process_Vertex_Exports(r700_AssemblerBase *pR700AsmCode, export_count--; } - pR700AsmCode->cf_last_export_ptr->m_Word1.f.cf_inst = SQ_CF_INST_EXPORT_DONE; + if(8 == pR700AsmCode->unAsic) + { + SETfield(pR700AsmCode->cf_last_export_ptr->m_Word1.val, + EG_CF_INST_EXPORT_DONE, + EG_CF_WORD1__CF_INST_shift, + EG_CF_WORD1__CF_INST_mask); + } + else + { + pR700AsmCode->cf_last_export_ptr->m_Word1.f.cf_inst = SQ_CF_INST_EXPORT_DONE; + } pR700AsmCode->number_of_exports = export_count; @@ -6834,7 +8018,17 @@ GLboolean Process_Vertex_Exports(r700_AssemblerBase *pR700AsmCode, // At least one param should be exported if (export_count) { - pR700AsmCode->cf_last_export_ptr->m_Word1.f.cf_inst = SQ_CF_INST_EXPORT_DONE; + if(8 == pR700AsmCode->unAsic) + { + SETfield(pR700AsmCode->cf_last_export_ptr->m_Word1.val, + EG_CF_INST_EXPORT_DONE, + EG_CF_WORD1__CF_INST_shift, + EG_CF_WORD1__CF_INST_mask); + } + else + { + pR700AsmCode->cf_last_export_ptr->m_Word1.f.cf_inst = SQ_CF_INST_EXPORT_DONE; + } } else { @@ -6852,7 +8046,17 @@ GLboolean Process_Vertex_Exports(r700_AssemblerBase *pR700AsmCode, pR700AsmCode->cf_last_export_ptr->m_Word1_SWIZ.f.sel_y = SQ_SEL_0; pR700AsmCode->cf_last_export_ptr->m_Word1_SWIZ.f.sel_z = SQ_SEL_0; pR700AsmCode->cf_last_export_ptr->m_Word1_SWIZ.f.sel_w = SQ_SEL_1; - pR700AsmCode->cf_last_export_ptr->m_Word1.f.cf_inst = SQ_CF_INST_EXPORT_DONE; + if(8 == pR700AsmCode->unAsic) + { + SETfield(pR700AsmCode->cf_last_export_ptr->m_Word1.val, + EG_CF_INST_EXPORT_DONE, + EG_CF_WORD1__CF_INST_shift, + EG_CF_WORD1__CF_INST_mask); + } + else + { + pR700AsmCode->cf_last_export_ptr->m_Word1.f.cf_inst = SQ_CF_INST_EXPORT_DONE; + } } pR700AsmCode->cf_last_export_ptr->m_Word1.f.end_of_program = 0x1; diff --git a/src/mesa/drivers/dri/r600/r700_assembler.h b/src/mesa/drivers/dri/r600/r700_assembler.h index f00f4da847..d357b0e3ec 100644 --- a/src/mesa/drivers/dri/r600/r700_assembler.h +++ b/src/mesa/drivers/dri/r600/r700_assembler.h @@ -464,6 +464,10 @@ typedef struct r700_AssemblerBase GLuint uiCurInst; GLubyte SamplerUnits[MAX_SAMPLERS]; GLboolean bR6xx; + + /* TODO : merge bR6xx */ + GLuint unAsic; + /* helper to decide which type of instruction to assemble */ GLboolean is_tex; /* we inserted helper intructions and need barrier on next TEX ins */ @@ -489,6 +493,9 @@ typedef struct r700_AssemblerBase GLuint shadow_regs[R700_MAX_TEXTURE_UNITS]; + GLboolean bUseMemConstant; + GLuint kcacheUsed; + } r700_AssemblerBase; //Internal use @@ -512,6 +519,8 @@ GLuint GetSurfaceFormat(GLenum eType, GLuint nChannels, GLuint * pClient_size); unsigned int r700GetNumOperands(GLuint opcode, GLuint nIsOp3); +unsigned int EG_GetNumOperands(GLuint opcode, GLuint nIsOp3); + GLboolean IsTex(gl_inst_opcode Opcode); GLboolean IsAlu(gl_inst_opcode Opcode); int check_current_clause(r700_AssemblerBase* pAsm, @@ -535,6 +544,18 @@ GLboolean assemble_vfetch_instruction2(r700_AssemblerBase* pAsm, GLboolean normalize, GLenum format, VTX_FETCH_METHOD * pFetchMethod); + +GLboolean EG_assemble_vfetch_instruction(r700_AssemblerBase* pAsm, + GLuint destination_register, + GLenum type, + GLint size, + GLubyte element, + GLuint _signed, + GLboolean normalize, + GLenum format, + VTX_FETCH_METHOD * pFetchMethod); +//----------------------- + GLboolean cleanup_vfetch_instructions(r700_AssemblerBase* pAsm); GLuint gethelpr(r700_AssemblerBase* pAsm); void resethelpr(r700_AssemblerBase* pAsm); @@ -553,8 +574,10 @@ GLboolean assemble_tex_instruction(r700_AssemblerBase *pAsm, GLboolean normalize void initialize(r700_AssemblerBase *pAsm); GLboolean assemble_alu_src(R700ALUInstruction* alu_instruction_ptr, int source_index, - PVSSRC* pSource, - BITS scalar_channel_index); + PVSSRC* pSource, + BITS scalar_channel_index, + r700_AssemblerBase *pAsm); + GLboolean add_alu_instruction(r700_AssemblerBase* pAsm, R700ALUInstruction* alu_instruction_ptr, GLuint contiguous_slots_needed); @@ -664,6 +687,7 @@ GLboolean callPreSub(r700_AssemblerBase* pAsm, COMPILED_SUB * pCompiledSub, GLshort uOutReg, GLshort uNumValidSrc); +GLboolean EG_add_ps_interp(r700_AssemblerBase* pAsm); //Interface GLboolean AssembleInstr(GLuint uiFirstInst, diff --git a/src/mesa/drivers/dri/r600/r700_chip.c b/src/mesa/drivers/dri/r600/r700_chip.c index bf8063391a..d17884f722 100644 --- a/src/mesa/drivers/dri/r600/r700_chip.c +++ b/src/mesa/drivers/dri/r600/r700_chip.c @@ -721,6 +721,7 @@ static void r700SendPSState(GLcontext *ctx, struct radeon_state_atom *atom) context_t *context = R700_CONTEXT(ctx); R700_CHIP_CONTEXT *r700 = R700_CONTEXT_STATES(context); struct radeon_bo * pbo; + struct radeon_bo * pbo_const; BATCH_LOCALS(&context->radeon); radeon_print(RADEON_STATE, RADEON_VERBOSE, "%s\n", __func__); @@ -750,6 +751,9 @@ static void r700SendPSState(GLcontext *ctx, struct radeon_state_atom *atom) R600_OUT_BATCH_REGVAL(SQ_LOOP_CONST_0, 0x01000FFF); END_BATCH(); + pbo_const = (struct radeon_bo *)r700GetActiveFpShaderConstBo(GL_CONTEXT(context)); + //TODO : set up shader const + COMMIT_BATCH(); } @@ -759,13 +763,14 @@ static void r700SendVSState(GLcontext *ctx, struct radeon_state_atom *atom) context_t *context = R700_CONTEXT(ctx); R700_CHIP_CONTEXT *r700 = R700_CONTEXT_STATES(context); struct radeon_bo * pbo; + struct radeon_bo * pbo_const; BATCH_LOCALS(&context->radeon); radeon_print(RADEON_STATE, RADEON_VERBOSE, "%s\n", __func__); pbo = (struct radeon_bo *)r700GetActiveVpShaderBo(GL_CONTEXT(context)); if (!pbo) - return; + return; r700SyncSurf(context, pbo, RADEON_GEM_DOMAIN_GTT, 0, SH_ACTION_ENA_bit); @@ -788,6 +793,29 @@ static void r700SendVSState(GLcontext *ctx, struct radeon_state_atom *atom) //R600_OUT_BATCH_REGVAL((SQ_LOOP_CONST_0 + (SQ_LOOP_CONST_vs<2)), 0x0100000F); END_BATCH(); + /* TODO : handle 4 bufs */ + if(GL_TRUE == r700->bShaderUseMemConstant) + { + pbo_const = (struct radeon_bo *)r700GetActiveVpShaderConstBo(GL_CONTEXT(context)); + if(NULL != pbo_const) + { + r700SyncSurf(context, pbo_const, RADEON_GEM_DOMAIN_GTT, 0, SH_ACTION_ENA_bit); /* TODO : Check kc bit. */ + + BEGIN_BATCH_NO_AUTOSTATE(3); + R600_OUT_BATCH_REGVAL(SQ_ALU_CONST_BUFFER_SIZE_VS_0, (r700->vs.num_consts * 4)/16 ); + END_BATCH(); + + BEGIN_BATCH_NO_AUTOSTATE(3 + 2); + R600_OUT_BATCH_REGSEQ(SQ_ALU_CONST_CACHE_VS_0, 1); + R600_OUT_BATCH(r700->vs.SQ_ALU_CONST_CACHE_VS_0.u32All); + R600_OUT_BATCH_RELOC(r700->vs.SQ_ALU_CONST_CACHE_VS_0.u32All, + pbo_const, + r700->vs.SQ_ALU_CONST_CACHE_VS_0.u32All, + RADEON_GEM_DOMAIN_GTT, 0, 0); + END_BATCH(); + } + } + COMMIT_BATCH(); } @@ -1558,45 +1586,55 @@ static void r600_init_query_stateobj(radeonContextPtr radeon, int SZ) void r600InitAtoms(context_t *context) { - radeon_print(RADEON_STATE, RADEON_NORMAL, "%s %p\n", __func__, context); - context->radeon.hw.max_state_size = 10 + 5 + 14; /* start 3d, idle, cb/db flush */ - - /* Setup the atom linked list */ - make_empty_list(&context->radeon.hw.atomlist); - context->radeon.hw.atomlist.name = "atom-list"; - - ALLOC_STATE(sq, always, 34, r700SendSQConfig); - ALLOC_STATE(db, always, 17, r700SendDBState); - ALLOC_STATE(stencil, always, 4, r700SendStencilState); - ALLOC_STATE(db_target, always, 16, r700SendDepthTargetState); - ALLOC_STATE(sc, always, 15, r700SendSCState); - ALLOC_STATE(scissor, always, 22, r700SendScissorState); - ALLOC_STATE(aa, always, 12, r700SendAAState); - ALLOC_STATE(cl, always, 12, r700SendCLState); - ALLOC_STATE(gb, always, 6, r700SendGBState); - ALLOC_STATE(ucp, ucp, (R700_MAX_UCP * 6), r700SendUCPState); - ALLOC_STATE(su, always, 9, r700SendSUState); - ALLOC_STATE(poly, always, 10, r700SendPolyState); - ALLOC_STATE(cb, cb, 18, r700SendCBState); - ALLOC_STATE(clrcmp, always, 6, r700SendCBCLRCMPState); - ALLOC_STATE(cb_target, always, 31, r700SendRenderTargetState); - ALLOC_STATE(blnd, blnd, (6 + (R700_MAX_RENDER_TARGETS * 3)), r700SendCBBlendState); - ALLOC_STATE(blnd_clr, always, 6, r700SendCBBlendColorState); - ALLOC_STATE(sx, always, 9, r700SendSXState); - ALLOC_STATE(vgt, always, 41, r700SendVGTState); - ALLOC_STATE(spi, always, (59 + R700_MAX_SHADER_EXPORTS), r700SendSPIState); - ALLOC_STATE(vpt, always, 16, r700SendViewportState); - ALLOC_STATE(fs, always, 18, r700SendFSState); - ALLOC_STATE(vs, always, 21, r700SendVSState); - ALLOC_STATE(ps, always, 24, r700SendPSState); - ALLOC_STATE(vs_consts, vs_consts, (2 + (R700_MAX_DX9_CONSTS * 4)), r700SendVSConsts); - ALLOC_STATE(ps_consts, ps_consts, (2 + (R700_MAX_DX9_CONSTS * 4)), r700SendPSConsts); - ALLOC_STATE(vtx, vtx, (VERT_ATTRIB_MAX * 18), r700SendVTXState); - ALLOC_STATE(tx, tx, (R700_TEXTURE_NUMBERUNITS * 20), r700SendTexState); - ALLOC_STATE(tx_smplr, tx, (R700_TEXTURE_NUMBERUNITS * 5), r700SendTexSamplerState); - ALLOC_STATE(tx_brdr_clr, tx, (R700_TEXTURE_NUMBERUNITS * 6), r700SendTexBorderColorState); - r600_init_query_stateobj(&context->radeon, 6 * 2); - - context->radeon.hw.is_dirty = GL_TRUE; - context->radeon.hw.all_dirty = GL_TRUE; + R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw); + radeon_print(RADEON_STATE, RADEON_NORMAL, "%s %p\n", __func__, context); + context->radeon.hw.max_state_size = 10 + 5 + 14; /* start 3d, idle, cb/db flush */ + + /* Setup the atom linked list */ + make_empty_list(&context->radeon.hw.atomlist); + context->radeon.hw.atomlist.name = "atom-list"; + + ALLOC_STATE(sq, always, 34, r700SendSQConfig); + ALLOC_STATE(db, always, 17, r700SendDBState); + ALLOC_STATE(stencil, always, 4, r700SendStencilState); + ALLOC_STATE(db_target, always, 16, r700SendDepthTargetState); + ALLOC_STATE(sc, always, 15, r700SendSCState); + ALLOC_STATE(scissor, always, 22, r700SendScissorState); + ALLOC_STATE(aa, always, 12, r700SendAAState); + ALLOC_STATE(cl, always, 12, r700SendCLState); + ALLOC_STATE(gb, always, 6, r700SendGBState); + ALLOC_STATE(ucp, ucp, (R700_MAX_UCP * 6), r700SendUCPState); + ALLOC_STATE(su, always, 9, r700SendSUState); + ALLOC_STATE(poly, always, 10, r700SendPolyState); + ALLOC_STATE(cb, cb, 18, r700SendCBState); + ALLOC_STATE(clrcmp, always, 6, r700SendCBCLRCMPState); + ALLOC_STATE(cb_target, always, 31, r700SendRenderTargetState); + ALLOC_STATE(blnd, blnd, (6 + (R700_MAX_RENDER_TARGETS * 3)), r700SendCBBlendState); + ALLOC_STATE(blnd_clr, always, 6, r700SendCBBlendColorState); + ALLOC_STATE(sx, always, 9, r700SendSXState); + ALLOC_STATE(vgt, always, 41, r700SendVGTState); + ALLOC_STATE(spi, always, (59 + R700_MAX_SHADER_EXPORTS), r700SendSPIState); + ALLOC_STATE(vpt, always, 16, r700SendViewportState); + ALLOC_STATE(fs, always, 18, r700SendFSState); + if(GL_TRUE == r700->bShaderUseMemConstant) + { + ALLOC_STATE(vs, always, 36, r700SendVSState); + ALLOC_STATE(ps, always, 24, r700SendPSState); /* TODO : not imp yet, fix later. */ + } + else + { + ALLOC_STATE(vs, always, 21, r700SendVSState); + ALLOC_STATE(ps, always, 24, r700SendPSState); + ALLOC_STATE(vs_consts, vs_consts, (2 + (R700_MAX_DX9_CONSTS * 4)), r700SendVSConsts); + ALLOC_STATE(ps_consts, ps_consts, (2 + (R700_MAX_DX9_CONSTS * 4)), r700SendPSConsts); + } + + ALLOC_STATE(vtx, vtx, (VERT_ATTRIB_MAX * 18), r700SendVTXState); + ALLOC_STATE(tx, tx, (R700_TEXTURE_NUMBERUNITS * 20), r700SendTexState); + ALLOC_STATE(tx_smplr, tx, (R700_TEXTURE_NUMBERUNITS * 5), r700SendTexSamplerState); + ALLOC_STATE(tx_brdr_clr, tx, (R700_TEXTURE_NUMBERUNITS * 6), r700SendTexBorderColorState); + r600_init_query_stateobj(&context->radeon, 6 * 2); + + context->radeon.hw.is_dirty = GL_TRUE; + context->radeon.hw.all_dirty = GL_TRUE; } diff --git a/src/mesa/drivers/dri/r600/r700_chip.h b/src/mesa/drivers/dri/r600/r700_chip.h index 0b6b72f850..ebf1840a79 100644 --- a/src/mesa/drivers/dri/r600/r700_chip.h +++ b/src/mesa/drivers/dri/r600/r700_chip.h @@ -43,6 +43,8 @@ #define SETbit(x, bit) ( (x) |= (bit) ) #define CLEARbit(x, bit) ( (x) &= ~(bit) ) +#define GETbits(x, shift, mask) ( ((x) & (mask)) >> (shift) ) + #define R700_TEXTURE_NUMBERUNITS 16 #define R700_MAX_RENDER_TARGETS 8 #define R700_MAX_VIEWPORTS 16 @@ -238,6 +240,9 @@ typedef struct _VS_STATE_STRUCT union UINT_FLOAT SQ_PGM_CF_OFFSET_VS ; /* 0xA234 */ GLboolean dirty; int num_consts; + + union UINT_FLOAT SQ_ALU_CONST_CACHE_VS_0; + union UINT_FLOAT consts[R700_MAX_DX9_CONSTS][4]; } VS_STATE_STRUCT; @@ -499,6 +504,8 @@ typedef struct _R700_CHIP_CONTEXT GLboolean bEnablePerspective; + GLboolean bShaderUseMemConstant; + } R700_CHIP_CONTEXT; #endif /* _R700_CHIP_H_ */ diff --git a/src/mesa/drivers/dri/r600/r700_fragprog.c b/src/mesa/drivers/dri/r600/r700_fragprog.c index f9d84b6ed6..6fdd93a330 100644 --- a/src/mesa/drivers/dri/r600/r700_fragprog.c +++ b/src/mesa/drivers/dri/r600/r700_fragprog.c @@ -362,6 +362,9 @@ GLboolean r700TranslateFragmentShader(struct r700_fragment_program *fp, struct gl_fragment_program *mesa_fp, GLcontext *ctx) { + context_t *context = R700_CONTEXT(ctx); + R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw); + GLuint number_of_colors_exported; GLboolean z_enabled = GL_FALSE; GLuint unBit, shadow_unit; @@ -373,6 +376,17 @@ GLboolean r700TranslateFragmentShader(struct r700_fragment_program *fp, //Init_Program Init_r700_AssemblerBase( SPT_FP, &(fp->r700AsmCode), &(fp->r700Shader) ); + if(GL_TRUE == r700->bShaderUseMemConstant) + { + fp->r700AsmCode.bUseMemConstant = GL_TRUE; + } + else + { + fp->r700AsmCode.bUseMemConstant = GL_FALSE; + } + + fp->r700AsmCode.unAsic = 7; + if(mesa_fp->Base.InputsRead & FRAG_BIT_WPOS) { insert_wpos_code(ctx, mesa_fp); @@ -481,6 +495,14 @@ void * r700GetActiveFpShaderBo(GLcontext * ctx) return fp->shaderbo; } +void * r700GetActiveFpShaderConstBo(GLcontext * ctx) +{ + struct r700_fragment_program *fp = (struct r700_fragment_program *) + (ctx->FragmentProgram._Current); + + return fp->constbo0; +} + GLboolean r700SetupFragmentProgram(GLcontext * ctx) { context_t *context = R700_CONTEXT(ctx); @@ -768,6 +790,17 @@ GLboolean r700SetupFragmentProgram(GLcontext * ctx) r700->ps.consts[ui][2].f32All = paramList->ParameterValues[ui][2]; r700->ps.consts[ui][3].f32All = paramList->ParameterValues[ui][3]; } + + /* Load fp constants to gpu */ + if( (GL_TRUE == r700->bShaderUseMemConstant) && (unNumParamData > 0) ) + { + r600EmitShader(ctx, + &(fp->constbo0), + (GLvoid *)&(paramList->ParameterValues[0][0]), + unNumParamData * 4, + "FS Const"); + } + } else r700->ps.num_consts = 0; diff --git a/src/mesa/drivers/dri/r600/r700_fragprog.h b/src/mesa/drivers/dri/r600/r700_fragprog.h index 39c59c9201..aaa6043d5d 100644 --- a/src/mesa/drivers/dri/r600/r700_fragprog.h +++ b/src/mesa/drivers/dri/r600/r700_fragprog.h @@ -43,6 +43,9 @@ struct r700_fragment_program void * shaderbo; + GLuint k0used; + void * constbo0; + GLboolean WritesDepth; GLuint optimization; }; @@ -67,4 +70,6 @@ extern GLboolean r700SetupFragmentProgram(GLcontext * ctx); extern void * r700GetActiveFpShaderBo(GLcontext * ctx); +extern void * r700GetActiveFpShaderConstBo(GLcontext * ctx); + #endif /*_R700_FRAGPROG_H_*/ diff --git a/src/mesa/drivers/dri/r600/r700_oglprog.c b/src/mesa/drivers/dri/r600/r700_oglprog.c index 8351792511..e0c9179004 100644 --- a/src/mesa/drivers/dri/r600/r700_oglprog.c +++ b/src/mesa/drivers/dri/r600/r700_oglprog.c @@ -48,6 +48,12 @@ static void freeVertProgCache(GLcontext *ctx, struct r700_vertex_program_cont *c tmp = vp->next; /* Release DMA region */ r600DeleteShader(ctx, vp->shaderbo); + + if(NULL != vp->constbo0) + { + r600DeleteShader(ctx, vp->constbo0); + } + /* Clean up */ Clean_Up_Assembler(&(vp->r700AsmCode)); Clean_Up_Shader(&(vp->r700Shader)); @@ -79,6 +85,7 @@ static struct gl_program *r700NewProgram(GLcontext * ctx, &vpc->mesa_program, target, id); + break; case GL_FRAGMENT_PROGRAM_NV: case GL_FRAGMENT_PROGRAM_ARB: @@ -92,6 +99,8 @@ static struct gl_program *r700NewProgram(GLcontext * ctx, fp->shaderbo = NULL; + fp->constbo0 = NULL; + break; default: _mesa_problem(ctx, "Bad target in r700NewProgram"); @@ -121,6 +130,11 @@ static void r700DeleteProgram(GLcontext * ctx, struct gl_program *prog) r600DeleteShader(ctx, fp->shaderbo); + if(NULL != fp->constbo0) + { + r600DeleteShader(ctx, fp->constbo0); + } + /* Clean up */ Clean_Up_Assembler(&(fp->r700AsmCode)); Clean_Up_Shader(&(fp->r700Shader)); @@ -145,6 +159,13 @@ r700ProgramStringNotify(GLcontext * ctx, GLenum target, struct gl_program *prog) break; case GL_FRAGMENT_PROGRAM_ARB: r600DeleteShader(ctx, fp->shaderbo); + + if(NULL != fp->constbo0) + { + r600DeleteShader(ctx, fp->constbo0); + fp->constbo0 = NULL; + } + Clean_Up_Assembler(&(fp->r700AsmCode)); Clean_Up_Shader(&(fp->r700Shader)); fp->translated = GL_FALSE; diff --git a/src/mesa/drivers/dri/r600/r700_state.c b/src/mesa/drivers/dri/r600/r700_state.c index 5ea8918611..925b4ffe6d 100644 --- a/src/mesa/drivers/dri/r600/r700_state.c +++ b/src/mesa/drivers/dri/r600/r700_state.c @@ -1580,7 +1580,16 @@ static void r700InitSQConfig(GLcontext * ctx) CLEARbit(r700->sq_config.SQ_CONFIG.u32All, VC_ENABLE_bit); else SETbit(r700->sq_config.SQ_CONFIG.u32All, VC_ENABLE_bit); - SETbit(r700->sq_config.SQ_CONFIG.u32All, DX9_CONSTS_bit); + + if(GL_TRUE == r700->bShaderUseMemConstant) + { + CLEARbit(r700->sq_config.SQ_CONFIG.u32All, DX9_CONSTS_bit); + } + else + { + SETbit(r700->sq_config.SQ_CONFIG.u32All, DX9_CONSTS_bit); + } + SETbit(r700->sq_config.SQ_CONFIG.u32All, ALU_INST_PREFER_VECTOR_bit); SETfield(r700->sq_config.SQ_CONFIG.u32All, ps_prio, PS_PRIO_shift, PS_PRIO_mask); SETfield(r700->sq_config.SQ_CONFIG.u32All, vs_prio, VS_PRIO_shift, VS_PRIO_mask); @@ -1689,8 +1698,9 @@ void r700InitState(GLcontext * ctx) //------------------- SETbit(r700->PA_SC_MODE_CNTL.u32All, FORCE_EOV_CNTDWN_ENABLE_bit); } - /* Do scale XY and Z by 1/W0. */ - r700->bEnablePerspective = GL_TRUE; + /* Do scale XY and Z by 1/W0. */ + r700->bEnablePerspective = GL_TRUE; + CLEARbit(r700->PA_CL_VTE_CNTL.u32All, VTX_XY_FMT_bit); CLEARbit(r700->PA_CL_VTE_CNTL.u32All, VTX_Z_FMT_bit); SETbit(r700->PA_CL_VTE_CNTL.u32All, VTX_W0_FMT_bit); diff --git a/src/mesa/drivers/dri/r600/r700_vertprog.c b/src/mesa/drivers/dri/r600/r700_vertprog.c index 6a2a09eaf1..7ed4b7d238 100644 --- a/src/mesa/drivers/dri/r600/r700_vertprog.c +++ b/src/mesa/drivers/dri/r600/r700_vertprog.c @@ -305,12 +305,17 @@ struct r700_vertex_program* r700TranslateVertexShader(GLcontext *ctx, struct gl_vertex_program *mesa_vp) { context_t *context = R700_CONTEXT(ctx); + + R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw); + struct r700_vertex_program *vp; unsigned int i; vp = calloc(1, sizeof(*vp)); vp->mesa_program = _mesa_clone_vertex_program(ctx, mesa_vp); + vp->constbo0 = NULL; + if (mesa_vp->IsPositionInvariant) { _mesa_insert_mvp_code(ctx, vp->mesa_program); @@ -331,6 +336,18 @@ struct r700_vertex_program* r700TranslateVertexShader(GLcontext *ctx, //Init_Program Init_r700_AssemblerBase(SPT_VP, &(vp->r700AsmCode), &(vp->r700Shader) ); + + if(GL_TRUE == r700->bShaderUseMemConstant) + { + vp->r700AsmCode.bUseMemConstant = GL_TRUE; + } + else + { + vp->r700AsmCode.bUseMemConstant = GL_FALSE; + } + + vp->r700AsmCode.unAsic = 7; + Map_Vertex_Program(ctx, vp, vp->mesa_program ); if(GL_FALSE == Find_Instruction_Dependencies_vp(vp, vp->mesa_program)) @@ -576,6 +593,17 @@ void * r700GetActiveVpShaderBo(GLcontext * ctx) return NULL; } +void * r700GetActiveVpShaderConstBo(GLcontext * ctx) +{ + context_t *context = R700_CONTEXT(ctx); + struct r700_vertex_program *vp = context->selected_vp;; + + if (vp) + return vp->constbo0; + else + return NULL; +} + GLboolean r700SetupVertexProgram(GLcontext * ctx) { context_t *context = R700_CONTEXT(ctx); @@ -600,6 +628,19 @@ GLboolean r700SetupVertexProgram(GLcontext * ctx) vp->r700Shader.uShaderBinaryDWORDSize, "VS"); + if(GL_TRUE == r700->bShaderUseMemConstant) + { + paramList = vp->mesa_program->Base.Parameters; + if(NULL != paramList) + { + unNumParamData = paramList->NumParameters; + r600AllocShaderConsts(ctx, + &(vp->constbo0), + unNumParamData *4*4, + "VSCON"); + } + } + vp->loaded = GL_TRUE; } @@ -616,7 +657,9 @@ GLboolean r700SetupVertexProgram(GLcontext * ctx) r700->vs.SQ_PGM_RESOURCES_VS.u32All = 0; SETbit(r700->vs.SQ_PGM_RESOURCES_VS.u32All, PGM_RESOURCES__PRIME_CACHE_ON_DRAW_bit); - r700->vs.SQ_PGM_START_VS.u32All = 0; /* set from buffer object. */ + r700->vs.SQ_ALU_CONST_CACHE_VS_0.u32All = 0; /* set from buffer object. */ + + r700->vs.SQ_PGM_START_VS.u32All = 0; SETfield(r700->vs.SQ_PGM_RESOURCES_VS.u32All, vp->r700Shader.nRegs + 1, NUM_GPRS_shift, NUM_GPRS_mask); @@ -687,6 +730,16 @@ GLboolean r700SetupVertexProgram(GLcontext * ctx) r700->vs.consts[ui][3].f32All = paramList->ParameterValues[ui][3]; } } + + /* Load vp constants to gpu */ + if(GL_TRUE == r700->bShaderUseMemConstant) + { + r600EmitShaderConsts(ctx, + vp->constbo0, + 0, + (GLvoid *)&(r700->vs.consts[0][0]), + unNumParamData * 4 * 4); + } } else r700->vs.num_consts = 0; diff --git a/src/mesa/drivers/dri/r600/r700_vertprog.h b/src/mesa/drivers/dri/r600/r700_vertprog.h index 645c9ac84a..9acdc8e350 100644 --- a/src/mesa/drivers/dri/r600/r700_vertprog.h +++ b/src/mesa/drivers/dri/r600/r700_vertprog.h @@ -56,6 +56,9 @@ struct r700_vertex_program void * shaderbo; + GLuint K0used; + void * constbo0; + ArrayDesc aos_desc[VERT_ATTRIB_MAX]; }; @@ -97,6 +100,8 @@ extern GLboolean r700SetupVertexProgram(GLcontext * ctx); extern void * r700GetActiveVpShaderBo(GLcontext * ctx); +extern void * r700GetActiveVpShaderConstBo(GLcontext * ctx); + extern int getTypeSize(GLenum type); #endif /* _R700_VERTPROG_H_ */ diff --git a/src/mesa/drivers/dri/radeon/radeon_chipset.h b/src/mesa/drivers/dri/radeon/radeon_chipset.h index 7d54fabebb..8efaa5b8e3 100644 --- a/src/mesa/drivers/dri/radeon/radeon_chipset.h +++ b/src/mesa/drivers/dri/radeon/radeon_chipset.h @@ -400,6 +400,46 @@ #define PCI_CHIP_RV740_94B5 0x94B5 #define PCI_CHIP_RV740_94B9 0x94B9 +#define PCI_CHIP_CEDAR_68E0 0x68E0 +#define PCI_CHIP_CEDAR_68E1 0x68E1 +#define PCI_CHIP_CEDAR_68E4 0x68E4 +#define PCI_CHIP_CEDAR_68E5 0x68E5 +#define PCI_CHIP_CEDAR_68E8 0x68E8 +#define PCI_CHIP_CEDAR_68E9 0x68E9 +#define PCI_CHIP_CEDAR_68F1 0x68F1 +#define PCI_CHIP_CEDAR_68F8 0x68F8 +#define PCI_CHIP_CEDAR_68F9 0x68F9 +#define PCI_CHIP_CEDAR_68FE 0x68FE + +#define PCI_CHIP_REDWOOD_68C0 0x68C0 +#define PCI_CHIP_REDWOOD_68C1 0x68C1 +#define PCI_CHIP_REDWOOD_68C8 0x68C8 +#define PCI_CHIP_REDWOOD_68C9 0x68C9 +#define PCI_CHIP_REDWOOD_68D8 0x68D8 +#define PCI_CHIP_REDWOOD_68D9 0x68D9 +#define PCI_CHIP_REDWOOD_68DA 0x68DA +#define PCI_CHIP_REDWOOD_68DE 0x68DE + +#define PCI_CHIP_JUNIPER_68A0 0x68A0 +#define PCI_CHIP_JUNIPER_68A1 0x68A1 +#define PCI_CHIP_JUNIPER_68A8 0x68A8 +#define PCI_CHIP_JUNIPER_68A9 0x68A9 +#define PCI_CHIP_JUNIPER_68B0 0x68B0 +#define PCI_CHIP_JUNIPER_68B8 0x68B8 +#define PCI_CHIP_JUNIPER_68B9 0x68B9 +#define PCI_CHIP_JUNIPER_68BE 0x68BE + +#define PCI_CHIP_CYPRESS_6880 0x6880 +#define PCI_CHIP_CYPRESS_6888 0x6888 +#define PCI_CHIP_CYPRESS_6889 0x6889 +#define PCI_CHIP_CYPRESS_688A 0x688A +#define PCI_CHIP_CYPRESS_6898 0x6898 +#define PCI_CHIP_CYPRESS_6899 0x6899 +#define PCI_CHIP_CYPRESS_689E 0x689E + +#define PCI_CHIP_HEMLOCK_689C 0x689C +#define PCI_CHIP_HEMLOCK_689D 0x689D + enum { CHIP_FAMILY_R100, CHIP_FAMILY_RV100, @@ -438,6 +478,13 @@ enum { CHIP_FAMILY_RV730, CHIP_FAMILY_RV710, CHIP_FAMILY_RV740, + + CHIP_FAMILY_CEDAR, + CHIP_FAMILY_REDWOOD, + CHIP_FAMILY_JUNIPER, + CHIP_FAMILY_CYPRESS, + CHIP_FAMILY_HEMLOCK, + CHIP_FAMILY_LAST }; diff --git a/src/mesa/drivers/dri/radeon/radeon_common_context.h b/src/mesa/drivers/dri/radeon/radeon_common_context.h index f06e5fdf24..024e31f8ec 100644 --- a/src/mesa/drivers/dri/radeon/radeon_common_context.h +++ b/src/mesa/drivers/dri/radeon/radeon_common_context.h @@ -244,6 +244,8 @@ struct radeon_tex_obj { GLuint SQ_TEX_RESOURCE5; GLuint SQ_TEX_RESOURCE6; + GLuint SQ_TEX_RESOURCE7; + GLuint SQ_TEX_SAMPLER0; GLuint SQ_TEX_SAMPLER1; GLuint SQ_TEX_SAMPLER2; diff --git a/src/mesa/drivers/dri/radeon/radeon_screen.c b/src/mesa/drivers/dri/radeon/radeon_screen.c index fa97a19302..2ea77e56c7 100644 --- a/src/mesa/drivers/dri/radeon/radeon_screen.c +++ b/src/mesa/drivers/dri/radeon/radeon_screen.c @@ -916,6 +916,61 @@ static int radeon_set_screen_flags(radeonScreenPtr screen, int device_id) screen->chip_flags = RADEON_CHIPSET_TCL; break; + case PCI_CHIP_CEDAR_68E0: + case PCI_CHIP_CEDAR_68E1: + case PCI_CHIP_CEDAR_68E4: + case PCI_CHIP_CEDAR_68E5: + case PCI_CHIP_CEDAR_68E8: + case PCI_CHIP_CEDAR_68E9: + case PCI_CHIP_CEDAR_68F1: + case PCI_CHIP_CEDAR_68F8: + case PCI_CHIP_CEDAR_68F9: + case PCI_CHIP_CEDAR_68FE: + screen->chip_family = CHIP_FAMILY_CEDAR; + screen->chip_flags = RADEON_CHIPSET_TCL; + break; + + case PCI_CHIP_REDWOOD_68C0: + case PCI_CHIP_REDWOOD_68C1: + case PCI_CHIP_REDWOOD_68C8: + case PCI_CHIP_REDWOOD_68C9: + case PCI_CHIP_REDWOOD_68D8: + case PCI_CHIP_REDWOOD_68D9: + case PCI_CHIP_REDWOOD_68DA: + case PCI_CHIP_REDWOOD_68DE: + screen->chip_family = CHIP_FAMILY_REDWOOD; + screen->chip_flags = RADEON_CHIPSET_TCL; + break; + + case PCI_CHIP_JUNIPER_68A0: + case PCI_CHIP_JUNIPER_68A1: + case PCI_CHIP_JUNIPER_68A8: + case PCI_CHIP_JUNIPER_68A9: + case PCI_CHIP_JUNIPER_68B0: + case PCI_CHIP_JUNIPER_68B8: + case PCI_CHIP_JUNIPER_68B9: + case PCI_CHIP_JUNIPER_68BE: + screen->chip_family = CHIP_FAMILY_JUNIPER; + screen->chip_flags = RADEON_CHIPSET_TCL; + break; + + case PCI_CHIP_CYPRESS_6880: + case PCI_CHIP_CYPRESS_6888: + case PCI_CHIP_CYPRESS_6889: + case PCI_CHIP_CYPRESS_688A: + case PCI_CHIP_CYPRESS_6898: + case PCI_CHIP_CYPRESS_6899: + case PCI_CHIP_CYPRESS_689E: + screen->chip_family = CHIP_FAMILY_CYPRESS; + screen->chip_flags = RADEON_CHIPSET_TCL; + break; + + case PCI_CHIP_HEMLOCK_689C: + case PCI_CHIP_HEMLOCK_689D: + screen->chip_family = CHIP_FAMILY_HEMLOCK; + screen->chip_flags = RADEON_CHIPSET_TCL; + break; + default: fprintf(stderr, "unknown chip id 0x%x, can't guess.\n", device_id); @@ -1116,7 +1171,7 @@ radeonCreateScreen( __DRIscreen *sPriv ) } } else - { + { screen->fbLocation = (temp & 0xffff) << 16; } } -- cgit v1.2.3 From 760451baaec42bced6ade5026546ed3759495d70 Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Sat, 21 Aug 2010 11:50:22 +0800 Subject: glapi: Move public function/variable declarations to glapi.h. glapi defines an interface that is used by DRI drivers. It must not be changed in an ABI incompatible way. This commit moves all functions/variables belong to the interface to glapi.h. Instead of including u_current.h from glapi.h, u_current.h now includes glapi.h. --- src/mapi/glapi/glapi.h | 99 ++++++++++++++++++++++++++++++++++++++++------ src/mapi/glapi/glapi_nop.c | 11 +----- src/mapi/glapi/glthread.c | 2 +- src/mapi/glapi/glthread.h | 5 +-- src/mapi/mapi/u_current.h | 37 ++++++++--------- 5 files changed, 107 insertions(+), 47 deletions(-) (limited to 'src') diff --git a/src/mapi/glapi/glapi.h b/src/mapi/glapi/glapi.h index a74884d595..1f18bf00fd 100644 --- a/src/mapi/glapi/glapi.h +++ b/src/mapi/glapi/glapi.h @@ -44,10 +44,11 @@ #ifndef _GLAPI_H #define _GLAPI_H -#ifndef MAPI_GLAPI_CURRENT -#define MAPI_GLAPI_CURRENT -#endif +#define _GLAPI_EXPORT PUBLIC + + +/* Is this needed? It is incomplete anyway. */ #ifdef USE_MGL_NAMESPACE #define _glapi_set_dispatch _mglapi_set_dispatch #define _glapi_get_dispatch _mglapi_get_dispatch @@ -57,32 +58,106 @@ #define _glapi_Context _mglapi_Context #endif -#include "mapi/u_current.h" #include "glapi/glthread.h" typedef void (*_glapi_proc)(void); +struct _glapi_table; + + +#if defined (GLX_USE_TLS) + +_GLAPI_EXPORT extern __thread struct _glapi_table * _glapi_tls_Dispatch + __attribute__((tls_model("initial-exec"))); + +_GLAPI_EXPORT extern __thread void * _glapi_tls_Context + __attribute__((tls_model("initial-exec"))); + +_GLAPI_EXPORT extern const struct _glapi_table *_glapi_Dispatch; +_GLAPI_EXPORT extern const void *_glapi_Context; + +# define GET_DISPATCH() _glapi_tls_Dispatch +# define GET_CURRENT_CONTEXT(C) GLcontext *C = (GLcontext *) _glapi_tls_Context + +#else + +_GLAPI_EXPORT extern struct _glapi_table *_glapi_Dispatch; +_GLAPI_EXPORT extern void *_glapi_Context; + +# ifdef THREADS + +# define GET_DISPATCH() \ + (likely(_glapi_Dispatch) ? _glapi_Dispatch : _glapi_get_dispatch()) + +# define GET_CURRENT_CONTEXT(C) GLcontext *C = (GLcontext *) \ + (likely(_glapi_Context) ? _glapi_Context : _glapi_get_context()) + +# else + +# define GET_DISPATCH() _glapi_Dispatch +# define GET_CURRENT_CONTEXT(C) GLcontext *C = (GLcontext *) _glapi_Context + +# endif + +#endif /* defined (GLX_USE_TLS) */ + + +void +_glapi_destroy_multithread(void); -#define GET_DISPATCH() ((struct _glapi_table *) u_current_get()) -#define GET_CURRENT_CONTEXT(C) GLcontext *C = (GLcontext *) u_current_get_user() -PUBLIC unsigned int +_GLAPI_EXPORT void +_glapi_check_multithread(void); + + +_GLAPI_EXPORT void +_glapi_set_context(void *context); + + +_GLAPI_EXPORT void * +_glapi_get_context(void); + + +_GLAPI_EXPORT void +_glapi_set_dispatch(struct _glapi_table *dispatch); + + +_GLAPI_EXPORT struct _glapi_table * +_glapi_get_dispatch(void); + + +_GLAPI_EXPORT unsigned int _glapi_get_dispatch_table_size(void); -PUBLIC int +_GLAPI_EXPORT int _glapi_add_dispatch( const char * const * function_names, const char * parameter_signature ); -PUBLIC int +_GLAPI_EXPORT int _glapi_get_proc_offset(const char *funcName); -PUBLIC _glapi_proc +_GLAPI_EXPORT _glapi_proc _glapi_get_proc_address(const char *funcName); -PUBLIC const char * +_GLAPI_EXPORT const char * _glapi_get_proc_name(unsigned int offset); -#endif +_GLAPI_EXPORT unsigned long +_glthread_GetID(void); + + +/* + * These stubs are kept so that the old DRI drivers still load. + */ +_GLAPI_EXPORT void +_glapi_noop_enable_warnings(unsigned char enable); + + +_GLAPI_EXPORT void +_glapi_set_warning_func(_glapi_proc func); + + +#endif /* _GLAPI_H */ diff --git a/src/mapi/glapi/glapi_nop.c b/src/mapi/glapi/glapi_nop.c index 9709551ee7..df46ca8c89 100644 --- a/src/mapi/glapi/glapi_nop.c +++ b/src/mapi/glapi/glapi_nop.c @@ -49,17 +49,8 @@ #include "glapi/glapi.h" -/* - * These stubs are kept so that the old DRI drivers still load. - */ -PUBLIC void -_glapi_noop_enable_warnings(GLboolean enable); - -PUBLIC void -_glapi_set_warning_func(_glapi_proc func); - void -_glapi_noop_enable_warnings(GLboolean enable) +_glapi_noop_enable_warnings(unsigned char enable) { } diff --git a/src/mapi/glapi/glthread.c b/src/mapi/glapi/glthread.c index 9dbc0e9a56..00915380f9 100644 --- a/src/mapi/glapi/glthread.c +++ b/src/mapi/glapi/glthread.c @@ -1,4 +1,4 @@ -#include "glthread.h" +#include "glapi/glapi.h" unsigned long _glthread_GetID(void) diff --git a/src/mapi/glapi/glthread.h b/src/mapi/glapi/glthread.h index 54292706ac..fc4ece7c33 100644 --- a/src/mapi/glapi/glthread.h +++ b/src/mapi/glapi/glthread.h @@ -17,7 +17,4 @@ typedef struct u_tsd _glthread_TSD; typedef u_mutex _glthread_Mutex; -PUBLIC unsigned long -_glthread_GetID(void); - -#endif /* THREADS_H */ +#endif /* GLTHREAD_H */ diff --git a/src/mapi/mapi/u_current.h b/src/mapi/mapi/u_current.h index a6256f5b51..a6bd9f0838 100644 --- a/src/mapi/mapi/u_current.h +++ b/src/mapi/mapi/u_current.h @@ -4,49 +4,44 @@ #include "u_compiler.h" #ifdef MAPI_GLAPI_CURRENT -#define GLAPI_EXPORT PUBLIC -#else -#define GLAPI_EXPORT -#endif -/* - * Unlike other utility functions, we need to keep the old names (_glapi_*) for - * ABI compatibility. The desired functions are wrappers to the old ones. - */ +#include "glapi/glapi.h" + +#else /* MAPI_GLAPI_CURRENT */ struct _glapi_table; #ifdef GLX_USE_TLS -GLAPI_EXPORT extern __thread struct _glapi_table *_glapi_tls_Dispatch +extern __thread struct _glapi_table *_glapi_tls_Dispatch __attribute__((tls_model("initial-exec"))); -GLAPI_EXPORT extern __thread void *_glapi_tls_Context +extern __thread void *_glapi_tls_Context __attribute__((tls_model("initial-exec"))); -GLAPI_EXPORT extern const struct _glapi_table *_glapi_Dispatch; -GLAPI_EXPORT extern const void *_glapi_Context; +extern const struct _glapi_table *_glapi_Dispatch; +extern const void *_glapi_Context; #else /* GLX_USE_TLS */ -GLAPI_EXPORT extern struct _glapi_table *_glapi_Dispatch; -GLAPI_EXPORT extern void *_glapi_Context; +extern struct _glapi_table *_glapi_Dispatch; +extern void *_glapi_Context; #endif /* GLX_USE_TLS */ -GLAPI_EXPORT void +void _glapi_check_multithread(void); -GLAPI_EXPORT void +void _glapi_set_context(void *context); -GLAPI_EXPORT void * +void * _glapi_get_context(void); -GLAPI_EXPORT void +void _glapi_set_dispatch(struct _glapi_table *dispatch); -GLAPI_EXPORT struct _glapi_table * +struct _glapi_table * _glapi_get_dispatch(void); void @@ -90,4 +85,6 @@ u_current_get_user(void) #endif } -#endif /* GLX_USE_TLS */ +#endif /* MAPI_GLAPI_CURRENT */ + +#endif /* _U_CURRENT_H_ */ -- cgit v1.2.3 From df98423f24bca147b36076e39fe53f42028052ef Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Sat, 21 Aug 2010 12:10:02 +0800 Subject: mapi: Prefix functions in u_current.h by u_current. That is, replace the old _glapi_* names by new names that start with u_current_. When MAPI_GLAPI_CURRENT is defined, u_current.h defines rename macros to restore the old names. That is done for ABI compatibility. --- src/mapi/mapi/entry_x86-64_tls.h | 4 +- src/mapi/mapi/entry_x86_tls.h | 2 +- src/mapi/mapi/entry_x86_tsd.h | 4 +- src/mapi/mapi/u_current.c | 93 +++++++++++++++++++++------------------- src/mapi/mapi/u_current.h | 70 +++++++++++++++++------------- 5 files changed, 94 insertions(+), 79 deletions(-) (limited to 'src') diff --git a/src/mapi/mapi/entry_x86-64_tls.h b/src/mapi/mapi/entry_x86-64_tls.h index d4c9907b89..0f6e8125e8 100644 --- a/src/mapi/mapi/entry_x86-64_tls.h +++ b/src/mapi/mapi/entry_x86-64_tls.h @@ -33,7 +33,7 @@ __asm__(".text"); __asm__("x86_64_current_tls:\n\t" - "movq _glapi_tls_Dispatch@GOTTPOFF(%rip), %rax\n\t" + "movq u_current_table_tls@GOTTPOFF(%rip), %rax\n\t" "ret"); #define STUB_ASM_ENTRY(func) \ @@ -43,7 +43,7 @@ __asm__("x86_64_current_tls:\n\t" func ":" #define STUB_ASM_CODE(slot) \ - "movq _glapi_tls_Dispatch@GOTTPOFF(%rip), %rax\n\t" \ + "movq u_current_table_tls@GOTTPOFF(%rip), %rax\n\t" \ "movq %fs:(%rax), %r11\n\t" \ "jmp *(8 * " slot ")(%r11)" diff --git a/src/mapi/mapi/entry_x86_tls.h b/src/mapi/mapi/entry_x86_tls.h index de0498181d..ff2b9575f6 100644 --- a/src/mapi/mapi/entry_x86_tls.h +++ b/src/mapi/mapi/entry_x86_tls.h @@ -37,7 +37,7 @@ __asm__("x86_current_tls:\n\t" "1:\n\t" "popl %eax\n\t" "addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %eax\n\t" - "movl _glapi_tls_Dispatch@GOTNTPOFF(%eax), %eax\n\t" + "movl u_current_table_tls@GOTNTPOFF(%eax), %eax\n\t" "ret"); #ifndef GLX_X86_READONLY_TEXT diff --git a/src/mapi/mapi/entry_x86_tsd.h b/src/mapi/mapi/entry_x86_tsd.h index d31e0676f0..fbf4ec5497 100644 --- a/src/mapi/mapi/entry_x86_tsd.h +++ b/src/mapi/mapi/entry_x86_tsd.h @@ -41,12 +41,12 @@ __asm__(".text"); func ":" #define STUB_ASM_CODE(slot) \ - "movl _glapi_Dispatch, %eax\n\t" \ + "movl u_current_table, %eax\n\t" \ "testl %eax, %eax\n\t" \ "je 1f\n\t" \ "jmp *(4 * " slot ")(%eax)\n" \ "1:\n\t" \ - "call _glapi_get_dispatch\n\t" \ + "call u_current_get_internal\n\t"\ "jmp *(4 * " slot ")(%eax)" #define MAPI_TMP_STUB_ASM_GCC diff --git a/src/mapi/mapi/u_current.c b/src/mapi/mapi/u_current.c index 91547c4830..ed9ccfe229 100644 --- a/src/mapi/mapi/u_current.c +++ b/src/mapi/mapi/u_current.c @@ -99,25 +99,25 @@ extern void (*__glapi_noop_table[])(void); /*@{*/ #if defined(GLX_USE_TLS) -__thread struct _glapi_table *_glapi_tls_Dispatch +__thread struct mapi_table *u_current_table_tls __attribute__((tls_model("initial-exec"))) - = (struct _glapi_table *) table_noop_array; + = (struct mapi_table *) table_noop_array; -__thread void * _glapi_tls_Context +__thread void *u_current_user_tls __attribute__((tls_model("initial-exec"))); -const struct _glapi_table *_glapi_Dispatch; -const void *_glapi_Context; +const struct mapi_table *u_current_table; +const void *u_current_user; #else -struct _glapi_table *_glapi_Dispatch = - (struct _glapi_table *) table_noop_array; -void *_glapi_Context; +struct mapi_table *u_current_table = + (struct mapi_table *) table_noop_array; +void *u_current_user; #ifdef THREADS -struct u_tsd _gl_DispatchTSD; -static struct u_tsd ContextTSD; +struct u_tsd u_current_table_tsd; +static struct u_tsd u_current_user_tsd; static int ThreadSafe; #endif /* THREADS */ @@ -126,11 +126,11 @@ static int ThreadSafe; void -_glapi_destroy_multithread(void) +u_current_destroy(void) { #if defined(THREADS) && defined(WIN32_THREADS) - u_tsd_destroy(&_gl_DispatchTSD); - u_tsd_destroy(&ContextTSD); + u_tsd_destroy(&u_current_table_tsd); + u_tsd_destroy(&u_current_user_tsd); #endif } @@ -138,10 +138,10 @@ _glapi_destroy_multithread(void) #if defined(THREADS) && !defined(GLX_USE_TLS) static void -_glapi_init_multithread(void) +u_current_init_tsd(void) { - u_tsd_init(&_gl_DispatchTSD); - u_tsd_init(&ContextTSD); + u_tsd_init(&u_current_table_tsd); + u_tsd_init(&u_current_user_tsd); } /** @@ -162,7 +162,7 @@ u_mutex_declare_static(ThreadCheckMutex); * in order to test if multiple threads are being used. */ void -_glapi_check_multithread(void) +u_current_init(void) { static unsigned long knownID; static int firstCall = 1; @@ -172,15 +172,15 @@ _glapi_check_multithread(void) CHECK_MULTITHREAD_LOCK(); if (firstCall) { - _glapi_init_multithread(); + u_current_init_tsd(); knownID = u_thread_self(); firstCall = 0; } else if (knownID != u_thread_self()) { ThreadSafe = 1; - _glapi_set_dispatch(NULL); - _glapi_set_context(NULL); + u_current_set_internal(NULL); + u_current_set_user_internal(NULL); } CHECK_MULTITHREAD_UNLOCK(); } @@ -188,7 +188,7 @@ _glapi_check_multithread(void) #else void -_glapi_check_multithread(void) +u_current_init(void) { } @@ -202,15 +202,17 @@ _glapi_check_multithread(void) * void from the real context pointer type. */ void -_glapi_set_context(void *context) +u_current_set_user_internal(void *ptr) { + u_current_init(); + #if defined(GLX_USE_TLS) - _glapi_tls_Context = context; + u_current_user_tls = ptr; #elif defined(THREADS) - u_tsd_set(&ContextTSD, context); - _glapi_Context = (ThreadSafe) ? NULL : context; + u_tsd_set(&u_current_user_tsd, ptr); + u_current_user = (ThreadSafe) ? NULL : ptr; #else - _glapi_Context = context; + u_current_user = ptr; #endif } @@ -220,16 +222,16 @@ _glapi_set_context(void *context) * void to the real context pointer type. */ void * -_glapi_get_context(void) +u_current_get_user_internal(void) { #if defined(GLX_USE_TLS) - return _glapi_tls_Context; + return u_current_user_tls; #elif defined(THREADS) return (ThreadSafe) - ? u_tsd_get(&ContextTSD) - : _glapi_Context; + ? u_tsd_get(&u_current_user_tsd) + : u_current_user; #else - return _glapi_Context; + return u_current_user; #endif } @@ -239,36 +241,37 @@ _glapi_get_context(void) * table (__glapi_noop_table). */ void -_glapi_set_dispatch(struct _glapi_table *dispatch) +u_current_set_internal(struct mapi_table *tbl) { + u_current_init(); + stub_init_once(); - if (!dispatch) - dispatch = (struct _glapi_table *) table_noop_array; + if (!tbl) + tbl = (struct mapi_table *) table_noop_array; #if defined(GLX_USE_TLS) - _glapi_tls_Dispatch = dispatch; + u_current_table_tls = tbl; #elif defined(THREADS) - u_tsd_set(&_gl_DispatchTSD, (void *) dispatch); - _glapi_Dispatch = (ThreadSafe) ? NULL : dispatch; + u_tsd_set(&u_current_table_tsd, (void *) tbl); + u_current_table = (ThreadSafe) ? NULL : tbl; #else - _glapi_Dispatch = dispatch; + u_current_table = tbl; #endif } /** * Return pointer to current dispatch table for calling thread. */ -struct _glapi_table * -_glapi_get_dispatch(void) +struct mapi_table * +u_current_get_internal(void) { #if defined(GLX_USE_TLS) - return _glapi_tls_Dispatch; + return u_current_table_tls; #elif defined(THREADS) - return (ThreadSafe) - ? (struct _glapi_table *) u_tsd_get(&_gl_DispatchTSD) - : _glapi_Dispatch; + return (struct mapi_table *) ((ThreadSafe) ? + u_tsd_get(&u_current_table_tsd) : (void *) u_current_table); #else - return _glapi_Dispatch; + return u_current_table; #endif } diff --git a/src/mapi/mapi/u_current.h b/src/mapi/mapi/u_current.h index a6bd9f0838..62e54c6c93 100644 --- a/src/mapi/mapi/u_current.h +++ b/src/mapi/mapi/u_current.h @@ -1,87 +1,99 @@ #ifndef _U_CURRENT_H_ #define _U_CURRENT_H_ -#include "u_compiler.h" - #ifdef MAPI_GLAPI_CURRENT #include "glapi/glapi.h" +/* ugly renames to match glapi.h */ +#define mapi_table _glapi_table + +#define u_current_table_tls _glapi_tls_Dispatch +#define u_current_user_tls _glapi_tls_Context +#define u_current_table _glapi_Dispatch +#define u_current_user _glapi_Context + +#define u_current_destroy _glapi_destroy_multithread +#define u_current_init _glapi_check_multithread +#define u_current_set_internal _glapi_set_dispatch +#define u_current_get_internal _glapi_get_dispatch +#define u_current_set_user_internal _glapi_set_context +#define u_current_get_user_internal _glapi_get_context + +#define u_current_table_tsd _gl_DispatchTSD + #else /* MAPI_GLAPI_CURRENT */ -struct _glapi_table; +#include "u_compiler.h" + +struct mapi_table; #ifdef GLX_USE_TLS -extern __thread struct _glapi_table *_glapi_tls_Dispatch +extern __thread struct mapi_table *u_current_table_tls __attribute__((tls_model("initial-exec"))); -extern __thread void *_glapi_tls_Context +extern __thread void *u_current_user_tls __attribute__((tls_model("initial-exec"))); -extern const struct _glapi_table *_glapi_Dispatch; -extern const void *_glapi_Context; +extern const struct mapi_table *u_current_table; +extern const void *u_current_user; #else /* GLX_USE_TLS */ -extern struct _glapi_table *_glapi_Dispatch; -extern void *_glapi_Context; +extern struct mapi_table *u_current_table; +extern void *u_current_user; #endif /* GLX_USE_TLS */ void -_glapi_check_multithread(void); +u_current_init(void); void -_glapi_set_context(void *context); - -void * -_glapi_get_context(void); +u_current_destroy(void); void -_glapi_set_dispatch(struct _glapi_table *dispatch); +u_current_set_internal(struct mapi_table *tbl); -struct _glapi_table * -_glapi_get_dispatch(void); +struct mapi_table * +u_current_get_internal(void); void -_glapi_destroy_multithread(void); +u_current_set_user_internal(void *ptr); - -struct mapi_table; +void * +u_current_get_user_internal(void); static INLINE void u_current_set(const struct mapi_table *tbl) { - _glapi_check_multithread(); - _glapi_set_dispatch((struct _glapi_table *) tbl); + u_current_set_internal((struct mapi_table *) tbl); } static INLINE const struct mapi_table * u_current_get(void) { #ifdef GLX_USE_TLS - return (const struct mapi_table *) _glapi_tls_Dispatch; + return (const struct mapi_table *) u_current_table_tls; #else - return (const struct mapi_table *) (likely(_glapi_Dispatch) ? - _glapi_Dispatch : _glapi_get_dispatch()); + return (likely(u_current_table) ? + (const struct mapi_table *) u_current_table : u_current_get_internal()); #endif } static INLINE void u_current_set_user(void *ptr) { - _glapi_check_multithread(); - _glapi_set_context(ptr); + u_current_set_internal(ptr); } static INLINE void * u_current_get_user(void) { #ifdef GLX_USE_TLS - return _glapi_tls_Context; + return u_current_user_tls; #else - return likely(_glapi_Context) ? _glapi_Context : _glapi_get_context(); + return likely(u_current_user) ? u_current_user : u_current_get_user_internal(); #endif } -- cgit v1.2.3 From 29cff9ce2e9445d90076a521510310ef63eea435 Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Sat, 21 Aug 2010 13:03:50 +0800 Subject: mapi: Use MAPI_EXPORT to export public functions. mapi.h is included by vgapi and st/vega. On win32, the macro expands to dllexport and dllimport respectively. --- src/mapi/mapi/mapi.h | 22 ++++++++++++++++------ src/mapi/vgapi/SConscript | 1 + 2 files changed, 17 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/mapi/mapi/mapi.h b/src/mapi/mapi/mapi.h index 8832b3dfb6..c7e43e22e9 100644 --- a/src/mapi/mapi/mapi.h +++ b/src/mapi/mapi/mapi.h @@ -31,26 +31,36 @@ #include "u_compiler.h" +#ifdef _WIN32 +#ifdef MAPI_DLL_EXPORTS +#define MAPI_EXPORT __declspec(dllexport) +#else +#define MAPI_EXPORT __declspec(dllimport) +#endif +#else /* _WIN32 */ +#define MAPI_EXPORT PUBLIC +#endif + typedef void (*mapi_proc)(void); struct mapi_table; -PUBLIC void +MAPI_EXPORT void mapi_init(const char *spec); -PUBLIC mapi_proc +MAPI_EXPORT mapi_proc mapi_get_proc_address(const char *name); -PUBLIC struct mapi_table * +MAPI_EXPORT struct mapi_table * mapi_table_create(void); -PUBLIC void +MAPI_EXPORT void mapi_table_destroy(struct mapi_table *tbl); -PUBLIC void +MAPI_EXPORT void mapi_table_fill(struct mapi_table *tbl, const mapi_proc *procs); -PUBLIC void +MAPI_EXPORT void mapi_table_make_current(const struct mapi_table *tbl); #endif /* _MAPI_H_ */ diff --git a/src/mapi/vgapi/SConscript b/src/mapi/vgapi/SConscript index bf51264ab9..20d7f2744d 100644 --- a/src/mapi/vgapi/SConscript +++ b/src/mapi/vgapi/SConscript @@ -18,6 +18,7 @@ if env['platform'] != 'winddk': env.Append(CPPDEFINES = [ 'MAPI_ABI_HEADER=\\"vgapi/vgapi_tmp.h\\"', + 'MAPI_DLL_EXPORTS', 'KHRONOS_DLL_EXPORTS', ]) -- cgit v1.2.3 From f7188ac9ce75638003c916c9d5d42a75365ff1c4 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Sat, 21 Aug 2010 01:13:16 -0700 Subject: generate_builtins.py: Remove unused import sys. --- src/glsl/builtins/tools/generate_builtins.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/glsl/builtins/tools/generate_builtins.py b/src/glsl/builtins/tools/generate_builtins.py index 6c3892269a..d793c28443 100755 --- a/src/glsl/builtins/tools/generate_builtins.py +++ b/src/glsl/builtins/tools/generate_builtins.py @@ -1,7 +1,7 @@ #!/usr/bin/python # -*- coding: UTF-8 -*- -import re, glob, sys +import re, glob from os import path from subprocess import Popen, PIPE -- cgit v1.2.3 From 29dde59ea718f70209788bcc3eaf1c3dd7c2ca69 Mon Sep 17 00:00:00 2001 From: Alex Corscadden Date: Tue, 17 Aug 2010 11:35:29 -0700 Subject: trace: Trace the correct version of the resource when setting the index buffer. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The trace driver was tracing the unwrapped version of the index buffer when setting the index buffer. This caused an assert validating that a resource belonged to the trace driver to fail. Instead, we'll log the unmodified index buffer structure when setting the index buffer. Signed-off-by: José Fonseca --- src/gallium/drivers/trace/tr_context.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/drivers/trace/tr_context.c b/src/gallium/drivers/trace/tr_context.c index 84e5a6a824..5d5bb41d94 100644 --- a/src/gallium/drivers/trace/tr_context.c +++ b/src/gallium/drivers/trace/tr_context.c @@ -1002,7 +1002,7 @@ trace_context_set_index_buffer(struct pipe_context *_pipe, trace_dump_call_begin("pipe_context", "set_index_buffer"); trace_dump_arg(ptr, pipe); - trace_dump_arg(index_buffer, ib); + trace_dump_arg(index_buffer, _ib); pipe->set_index_buffer(pipe, ib); -- cgit v1.2.3 From ce3a07c392fb0532f18dcb2d582b41a3f6bf198c Mon Sep 17 00:00:00 2001 From: Alex Corscadden Date: Tue, 17 Aug 2010 13:45:31 -0700 Subject: trace: Don't immediately destroy the pipe's sampler view in the trace driver. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The trace driver's implementation of sampler_view_destroy was calling directly into the underlying pipe's sampler_view_destroy implementation. This causes problems for pipes that keep references to sampler views even after the state tracker has released them. Instead, we'll simply drop the trace driver's reference to the pipe's sampler view. Signed-off-by: José Fonseca --- src/gallium/drivers/trace/tr_context.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/drivers/trace/tr_context.c b/src/gallium/drivers/trace/tr_context.c index 5d5bb41d94..9e8a23d35c 100644 --- a/src/gallium/drivers/trace/tr_context.c +++ b/src/gallium/drivers/trace/tr_context.c @@ -885,7 +885,7 @@ trace_sampler_view_destroy(struct pipe_context *_pipe, trace_dump_arg(ptr, pipe); trace_dump_arg(ptr, view); - pipe->sampler_view_destroy(pipe, view); + pipe_sampler_view_reference(&tr_view->sampler_view, NULL); trace_dump_call_end(); -- cgit v1.2.3 From 7a40d15e6c6b8ebc971be0e926c7027a85db96a0 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Sat, 21 Aug 2010 10:07:12 +0100 Subject: util: Remove the x86 exception handlers. Unused now that check_os_katmai_support was removed. --- src/gallium/auxiliary/util/u_cpu_detect.c | 55 ------------------------------- 1 file changed, 55 deletions(-) (limited to 'src') diff --git a/src/gallium/auxiliary/util/u_cpu_detect.c b/src/gallium/auxiliary/util/u_cpu_detect.c index b9b9f9257a..f33d6b3461 100644 --- a/src/gallium/auxiliary/util/u_cpu_detect.c +++ b/src/gallium/auxiliary/util/u_cpu_detect.c @@ -83,61 +83,6 @@ static int has_cpuid(void); #endif -#if defined(PIPE_ARCH_X86) - -/* The sigill handlers */ -#if defined(PIPE_OS_LINUX) /*&& defined(_POSIX_SOURCE) && defined(X86_FXSR_MAGIC)*/ -static void -sigill_handler_sse(int signal, struct sigcontext sc) -{ - /* Both the "xorps %%xmm0,%%xmm0" and "divps %xmm0,%%xmm1" - * instructions are 3 bytes long. We must increment the instruction - * pointer manually to avoid repeated execution of the offending - * instruction. - * - * If the SIGILL is caused by a divide-by-zero when unmasked - * exceptions aren't supported, the SIMD FPU status and control - * word will be restored at the end of the test, so we don't need - * to worry about doing it here. Besides, we may not be able to... - */ - sc.eip += 3; - - util_cpu_caps.has_sse=0; -} - -static void -sigfpe_handler_sse(int signal, struct sigcontext sc) -{ - if (sc.fpstate->magic != 0xffff) { - /* Our signal context has the extended FPU state, so reset the - * divide-by-zero exception mask and clear the divide-by-zero - * exception bit. - */ - sc.fpstate->mxcsr |= 0x00000200; - sc.fpstate->mxcsr &= 0xfffffffb; - } else { - /* If we ever get here, we're completely hosed. - */ - } -} -#endif /* PIPE_OS_LINUX && _POSIX_SOURCE && X86_FXSR_MAGIC */ - -#if defined(PIPE_OS_WINDOWS) -static LONG CALLBACK -win32_sig_handler_sse(EXCEPTION_POINTERS* ep) -{ - if(ep->ExceptionRecord->ExceptionCode==EXCEPTION_ILLEGAL_INSTRUCTION){ - ep->ContextRecord->Eip +=3; - util_cpu_caps.has_sse=0; - return EXCEPTION_CONTINUE_EXECUTION; - } - return EXCEPTION_CONTINUE_SEARCH; -} -#endif /* PIPE_OS_WINDOWS */ - -#endif /* PIPE_ARCH_X86 */ - - #if defined(PIPE_ARCH_PPC) && !defined(PIPE_OS_APPLE) static jmp_buf __lv_powerpc_jmpbuf; static volatile sig_atomic_t __lv_powerpc_canjump = 0; -- cgit v1.2.3 From 04c2a22175d7c27ee380f986eece2772eddd6fcc Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Sat, 21 Aug 2010 10:34:42 +0100 Subject: util: Make the reference debuggin code more C++ friendly. C++ doesn't accept function <-> void* conversions without a putting a fight. --- src/gallium/auxiliary/util/u_debug_describe.h | 5 +++++ src/gallium/auxiliary/util/u_debug_refcnt.c | 3 +-- src/gallium/auxiliary/util/u_debug_refcnt.h | 19 +++++++++++++------ src/gallium/auxiliary/util/u_inlines.h | 16 +++++++++++----- 4 files changed, 30 insertions(+), 13 deletions(-) (limited to 'src') diff --git a/src/gallium/auxiliary/util/u_debug_describe.h b/src/gallium/auxiliary/util/u_debug_describe.h index 8c32f02ee5..33587ec879 100644 --- a/src/gallium/auxiliary/util/u_debug_describe.h +++ b/src/gallium/auxiliary/util/u_debug_describe.h @@ -5,6 +5,11 @@ extern "C" { #endif +struct pipe_reference; +struct pipe_resource; +struct pipe_surface; +struct pipe_sampler_view; + /* a 256-byte buffer is necessary and sufficient */ void debug_describe_reference(char* buf, const struct pipe_reference*ptr); void debug_describe_resource(char* buf, const struct pipe_resource *ptr); diff --git a/src/gallium/auxiliary/util/u_debug_refcnt.c b/src/gallium/auxiliary/util/u_debug_refcnt.c index 9d6fca56ab..32e09ae1ae 100644 --- a/src/gallium/auxiliary/util/u_debug_refcnt.c +++ b/src/gallium/auxiliary/util/u_debug_refcnt.c @@ -84,7 +84,7 @@ static void dump_stack(const char* symbols[STACK_LEN]) os_stream_write(stream, "\n", 1); } -void debug_reference_slowpath(const struct pipe_reference* p, void* pget_desc, int change) +void debug_reference_slowpath(const struct pipe_reference* p, debug_reference_descriptor get_desc, int change) { if(debug_refcnt_state < 0) return; @@ -107,7 +107,6 @@ void debug_reference_slowpath(const struct pipe_reference* p, void* pget_desc, i const char* symbols[STACK_LEN]; char buf[1024]; - void (*get_desc)(char*, const struct pipe_reference*) = pget_desc; unsigned i; unsigned refcnt = p->count; unsigned serial; diff --git a/src/gallium/auxiliary/util/u_debug_refcnt.h b/src/gallium/auxiliary/util/u_debug_refcnt.h index ba40999bf2..4c4a18ecf9 100644 --- a/src/gallium/auxiliary/util/u_debug_refcnt.h +++ b/src/gallium/auxiliary/util/u_debug_refcnt.h @@ -15,19 +15,26 @@ extern "C" { #endif +typedef void (*debug_reference_descriptor)(char*, const struct pipe_reference*); + #if defined(DEBUG) && (!defined(PIPE_OS_WINDOWS) || defined(PIPE_SUBSYSTEM_WINDOWS_USER)) + extern int debug_refcnt_state; -void debug_reference_slowpath(const struct pipe_reference* p, void* get_desc, int change); +void debug_reference_slowpath(const struct pipe_reference* p, debug_reference_descriptor get_desc, int change); -static INLINE void debug_reference(const struct pipe_reference* p, void* get_desc, int change) +static INLINE void debug_reference(const struct pipe_reference* p, debug_reference_descriptor get_desc, int change) { - if(debug_refcnt_state >= 0) - debug_reference_slowpath(p, get_desc, change); + if (debug_refcnt_state >= 0) + debug_reference_slowpath(p, get_desc, change); } + #else -static INLINE void debug_reference(const struct pipe_reference* p, void* get_desc, const char* op) -{} + +static INLINE void debug_reference(const struct pipe_reference* p, debug_reference_descriptor get_desc, int change) +{ +} + #endif #ifdef __cplusplus diff --git a/src/gallium/auxiliary/util/u_inlines.h b/src/gallium/auxiliary/util/u_inlines.h index 90b0903e3f..78473bf35a 100644 --- a/src/gallium/auxiliary/util/u_inlines.h +++ b/src/gallium/auxiliary/util/u_inlines.h @@ -69,7 +69,9 @@ pipe_is_referenced(struct pipe_reference *reference) * \return TRUE if the object's refcount hits zero and should be destroyed. */ static INLINE boolean -pipe_reference_described(struct pipe_reference *ptr, struct pipe_reference *reference, void* get_desc) +pipe_reference_described(struct pipe_reference *ptr, + struct pipe_reference *reference, + debug_reference_descriptor get_desc) { boolean destroy = FALSE; @@ -96,7 +98,8 @@ pipe_reference_described(struct pipe_reference *ptr, struct pipe_reference *refe static INLINE boolean pipe_reference(struct pipe_reference *ptr, struct pipe_reference *reference) { - return pipe_reference_described(ptr, reference, debug_describe_reference); + return pipe_reference_described(ptr, reference, + (debug_reference_descriptor)debug_describe_reference); } static INLINE void @@ -104,7 +107,8 @@ pipe_surface_reference(struct pipe_surface **ptr, struct pipe_surface *surf) { struct pipe_surface *old_surf = *ptr; - if (pipe_reference_described(&(*ptr)->reference, &surf->reference, debug_describe_surface)) + if (pipe_reference_described(&(*ptr)->reference, &surf->reference, + (debug_reference_descriptor)debug_describe_surface)) old_surf->texture->screen->tex_surface_destroy(old_surf); *ptr = surf; } @@ -114,7 +118,8 @@ pipe_resource_reference(struct pipe_resource **ptr, struct pipe_resource *tex) { struct pipe_resource *old_tex = *ptr; - if (pipe_reference_described(&(*ptr)->reference, &tex->reference, debug_describe_resource)) + if (pipe_reference_described(&(*ptr)->reference, &tex->reference, + (debug_reference_descriptor)debug_describe_resource)) old_tex->screen->resource_destroy(old_tex->screen, old_tex); *ptr = tex; } @@ -124,7 +129,8 @@ pipe_sampler_view_reference(struct pipe_sampler_view **ptr, struct pipe_sampler_ { struct pipe_sampler_view *old_view = *ptr; - if (pipe_reference_described(&(*ptr)->reference, &view->reference, debug_describe_sampler_view)) + if (pipe_reference_described(&(*ptr)->reference, &view->reference, + (debug_reference_descriptor)debug_describe_sampler_view)) old_view->context->sampler_view_destroy(old_view->context, old_view); *ptr = view; } -- cgit v1.2.3 From a5888d3113f4d1010c38f5925da912f08cfae519 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Sat, 21 Aug 2010 10:34:57 +0100 Subject: mesa: Remove unsused local variable. --- src/mesa/state_tracker/st_cb_drawpixels.c | 1 - 1 file changed, 1 deletion(-) (limited to 'src') diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c b/src/mesa/state_tracker/st_cb_drawpixels.c index d934fdc170..aa8776e716 100644 --- a/src/mesa/state_tracker/st_cb_drawpixels.c +++ b/src/mesa/state_tracker/st_cb_drawpixels.c @@ -302,7 +302,6 @@ alloc_texture(struct st_context *st, GLsizei width, GLsizei height, enum pipe_format texFormat) { struct pipe_context *pipe = st->pipe; - struct pipe_screen *screen = pipe->screen; struct pipe_resource *pt; pt = st_texture_create(st, st->internal_target, texFormat, 0, -- cgit v1.2.3 From 121aa3cfcb106be1ecaae102177bb882bfbce9d9 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Sat, 21 Aug 2010 10:38:22 +0100 Subject: util: Match printf format to silence warning. --- src/gallium/auxiliary/util/u_debug_describe.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/auxiliary/util/u_debug_describe.c b/src/gallium/auxiliary/util/u_debug_describe.c index 5c7808f7ec..343358d0c4 100644 --- a/src/gallium/auxiliary/util/u_debug_describe.c +++ b/src/gallium/auxiliary/util/u_debug_describe.c @@ -13,7 +13,7 @@ void debug_describe_resource(char* buf, const struct pipe_resource *ptr) { if(ptr->target == PIPE_BUFFER) - util_sprintf(buf, "pipe_buffer<%u>", util_format_get_stride(ptr->format, ptr->width0)); + util_sprintf(buf, "pipe_buffer<%u>", (unsigned)util_format_get_stride(ptr->format, ptr->width0)); else if(ptr->target == PIPE_TEXTURE_1D) util_sprintf(buf, "pipe_texture1d<%u,%s,%u>", ptr->width0, util_format_short_name(ptr->format), ptr->last_level); else if(ptr->target == PIPE_TEXTURE_2D) -- cgit v1.2.3 From fa32fde26cbb770c6ffa0a0ead529d511eab1eb1 Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Sat, 21 Aug 2010 12:37:18 +0200 Subject: auxiliary: add copyright headers Thanks to Jose Fonseca for pointing out they were missing. --- src/gallium/auxiliary/os/os_stream.c | 26 ++++++++++++++++++++++++ src/gallium/auxiliary/util/u_debug_describe.c | 26 ++++++++++++++++++++++++ src/gallium/auxiliary/util/u_debug_describe.h | 26 ++++++++++++++++++++++++ src/gallium/auxiliary/util/u_debug_refcnt.c | 26 ++++++++++++++++++++++++ src/gallium/auxiliary/util/u_debug_refcnt.h | 29 ++++++++++++++++++++++----- src/gallium/auxiliary/util/u_dirty_surfaces.h | 26 ++++++++++++++++++++++++ src/gallium/auxiliary/util/u_staging.c | 26 ++++++++++++++++++++++++ src/gallium/auxiliary/util/u_staging.h | 26 ++++++++++++++++++++++++ src/gallium/auxiliary/util/u_surfaces.c | 26 ++++++++++++++++++++++++ src/gallium/auxiliary/util/u_surfaces.h | 26 ++++++++++++++++++++++++ 10 files changed, 258 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/gallium/auxiliary/os/os_stream.c b/src/gallium/auxiliary/os/os_stream.c index 7b9c17c5fa..3c55fc00d9 100644 --- a/src/gallium/auxiliary/os/os_stream.c +++ b/src/gallium/auxiliary/os/os_stream.c @@ -1,3 +1,29 @@ +/************************************************************************** + * + * Copyright 2010 Luca Barbieri + * + * 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 COPYRIGHT OWNER(S) AND/OR ITS 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. + * + **************************************************************************/ + #include "pipe/p_config.h" #include "os_stream.h" diff --git a/src/gallium/auxiliary/util/u_debug_describe.c b/src/gallium/auxiliary/util/u_debug_describe.c index 343358d0c4..52bbf53be3 100644 --- a/src/gallium/auxiliary/util/u_debug_describe.c +++ b/src/gallium/auxiliary/util/u_debug_describe.c @@ -1,3 +1,29 @@ +/************************************************************************** + * + * Copyright 2010 Luca Barbieri + * + * 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 COPYRIGHT OWNER(S) AND/OR ITS 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. + * + **************************************************************************/ + #include #include #include diff --git a/src/gallium/auxiliary/util/u_debug_describe.h b/src/gallium/auxiliary/util/u_debug_describe.h index 33587ec879..26d1f803bf 100644 --- a/src/gallium/auxiliary/util/u_debug_describe.h +++ b/src/gallium/auxiliary/util/u_debug_describe.h @@ -1,3 +1,29 @@ +/************************************************************************** + * + * Copyright 2010 Luca Barbieri + * + * 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 COPYRIGHT OWNER(S) AND/OR ITS 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. + * + **************************************************************************/ + #ifndef U_DEBUG_DESCRIBE_H_ #define U_DEBUG_DESCRIBE_H_ diff --git a/src/gallium/auxiliary/util/u_debug_refcnt.c b/src/gallium/auxiliary/util/u_debug_refcnt.c index 32e09ae1ae..40a26c9c69 100644 --- a/src/gallium/auxiliary/util/u_debug_refcnt.c +++ b/src/gallium/auxiliary/util/u_debug_refcnt.c @@ -1,3 +1,29 @@ +/************************************************************************** + * + * Copyright 2010 Luca Barbieri + * + * 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 COPYRIGHT OWNER(S) AND/OR ITS 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. + * + **************************************************************************/ + #if defined(DEBUG) && (!defined(PIPE_OS_WINDOWS) || defined(PIPE_SUBSYSTEM_WINDOWS_USER)) /* see http://www.mozilla.org/performance/refcnt-balancer.html for what do with the output diff --git a/src/gallium/auxiliary/util/u_debug_refcnt.h b/src/gallium/auxiliary/util/u_debug_refcnt.h index 4c4a18ecf9..bea2d1c478 100644 --- a/src/gallium/auxiliary/util/u_debug_refcnt.h +++ b/src/gallium/auxiliary/util/u_debug_refcnt.h @@ -1,9 +1,28 @@ -/* - * u_debug_refcnt.h +/************************************************************************** * - * Created on: Aug 17, 2010 - * Author: lb - */ + * Copyright 2010 Luca Barbieri + * + * 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 COPYRIGHT OWNER(S) AND/OR ITS 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. + * + **************************************************************************/ #ifndef U_DEBUG_REFCNT_H_ #define U_DEBUG_REFCNT_H_ diff --git a/src/gallium/auxiliary/util/u_dirty_surfaces.h b/src/gallium/auxiliary/util/u_dirty_surfaces.h index 99f260bf96..c157300502 100644 --- a/src/gallium/auxiliary/util/u_dirty_surfaces.h +++ b/src/gallium/auxiliary/util/u_dirty_surfaces.h @@ -1,3 +1,29 @@ +/************************************************************************** + * + * Copyright 2010 Luca Barbieri + * + * 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 COPYRIGHT OWNER(S) AND/OR ITS 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. + * + **************************************************************************/ + #ifndef U_DIRTY_SURFACES_H_ #define U_DIRTY_SURFACES_H_ diff --git a/src/gallium/auxiliary/util/u_staging.c b/src/gallium/auxiliary/util/u_staging.c index 363e1c864b..c5d68f8df8 100644 --- a/src/gallium/auxiliary/util/u_staging.c +++ b/src/gallium/auxiliary/util/u_staging.c @@ -1,3 +1,29 @@ +/************************************************************************** + * + * Copyright 2010 Luca Barbieri + * + * 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 COPYRIGHT OWNER(S) AND/OR ITS 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. + * + **************************************************************************/ + #include "util/u_staging.h" #include "pipe/p_context.h" #include "util/u_memory.h" diff --git a/src/gallium/auxiliary/util/u_staging.h b/src/gallium/auxiliary/util/u_staging.h index 3a9da9b401..1aab78cc88 100644 --- a/src/gallium/auxiliary/util/u_staging.h +++ b/src/gallium/auxiliary/util/u_staging.h @@ -1,3 +1,29 @@ +/************************************************************************** + * + * Copyright 2010 Luca Barbieri + * + * 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 COPYRIGHT OWNER(S) AND/OR ITS 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. + * + **************************************************************************/ + /* Direct3D 10/11 has no concept of transfers. Applications instead * create resources with a STAGING or DYNAMIC usage, copy between them * and the real resource and use Map to map the STAGING/DYNAMIC resource. diff --git a/src/gallium/auxiliary/util/u_surfaces.c b/src/gallium/auxiliary/util/u_surfaces.c index 7733ad24d0..404e121995 100644 --- a/src/gallium/auxiliary/util/u_surfaces.c +++ b/src/gallium/auxiliary/util/u_surfaces.c @@ -1,3 +1,29 @@ +/************************************************************************** + * + * Copyright 2010 Luca Barbieri + * + * 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 COPYRIGHT OWNER(S) AND/OR ITS 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. + * + **************************************************************************/ + #include "u_surfaces.h" #include "util/u_hash_table.h" #include "util/u_inlines.h" diff --git a/src/gallium/auxiliary/util/u_surfaces.h b/src/gallium/auxiliary/util/u_surfaces.h index 46f3ec5d7d..17d8a5d3a5 100644 --- a/src/gallium/auxiliary/util/u_surfaces.h +++ b/src/gallium/auxiliary/util/u_surfaces.h @@ -1,3 +1,29 @@ +/************************************************************************** + * + * Copyright 2010 Luca Barbieri + * + * 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 COPYRIGHT OWNER(S) AND/OR ITS 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. + * + **************************************************************************/ + #ifndef U_SURFACES_H_ #define U_SURFACES_H_ -- cgit v1.2.3 From 061c2a7cb3924f1983554aa1d53b78238196c412 Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Sat, 21 Aug 2010 12:45:39 +0200 Subject: u_debug_describe: add PIPE_TEXTURE_RECT --- src/gallium/auxiliary/util/u_debug_describe.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/gallium/auxiliary/util/u_debug_describe.c b/src/gallium/auxiliary/util/u_debug_describe.c index 52bbf53be3..f21ebd02f5 100644 --- a/src/gallium/auxiliary/util/u_debug_describe.c +++ b/src/gallium/auxiliary/util/u_debug_describe.c @@ -44,6 +44,8 @@ debug_describe_resource(char* buf, const struct pipe_resource *ptr) util_sprintf(buf, "pipe_texture1d<%u,%s,%u>", ptr->width0, util_format_short_name(ptr->format), ptr->last_level); else if(ptr->target == PIPE_TEXTURE_2D) util_sprintf(buf, "pipe_texture2d<%u,%u,%s,%u>", ptr->width0, ptr->height0, util_format_short_name(ptr->format), ptr->last_level); + else if(ptr->target == PIPE_TEXTURE_RECT) + util_sprintf(buf, "pipe_texture_rect<%u,%u,%s>", ptr->width0, ptr->height0, util_format_short_name(ptr->format)); else if(ptr->target == PIPE_TEXTURE_CUBE) util_sprintf(buf, "pipe_texture_cube<%u,%u,%s,%u>", ptr->width0, ptr->height0, util_format_short_name(ptr->format), ptr->last_level); else if(ptr->target == PIPE_TEXTURE_3D) -- cgit v1.2.3 From bed9dff9d94e33d34340183d7cb633869dcb4f90 Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Sat, 21 Aug 2010 12:47:18 +0200 Subject: u_debug_describe: use switch instead of if chain --- src/gallium/auxiliary/util/u_debug_describe.c | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/gallium/auxiliary/util/u_debug_describe.c b/src/gallium/auxiliary/util/u_debug_describe.c index f21ebd02f5..1c90ff3106 100644 --- a/src/gallium/auxiliary/util/u_debug_describe.c +++ b/src/gallium/auxiliary/util/u_debug_describe.c @@ -38,20 +38,30 @@ debug_describe_reference(char* buf, const struct pipe_reference*ptr) void debug_describe_resource(char* buf, const struct pipe_resource *ptr) { - if(ptr->target == PIPE_BUFFER) + switch(ptr->target) + { + case PIPE_BUFFER: util_sprintf(buf, "pipe_buffer<%u>", (unsigned)util_format_get_stride(ptr->format, ptr->width0)); - else if(ptr->target == PIPE_TEXTURE_1D) + break; + case PIPE_TEXTURE_1D: util_sprintf(buf, "pipe_texture1d<%u,%s,%u>", ptr->width0, util_format_short_name(ptr->format), ptr->last_level); - else if(ptr->target == PIPE_TEXTURE_2D) + break; + case PIPE_TEXTURE_2D: util_sprintf(buf, "pipe_texture2d<%u,%u,%s,%u>", ptr->width0, ptr->height0, util_format_short_name(ptr->format), ptr->last_level); - else if(ptr->target == PIPE_TEXTURE_RECT) + break; + case PIPE_TEXTURE_RECT: util_sprintf(buf, "pipe_texture_rect<%u,%u,%s>", ptr->width0, ptr->height0, util_format_short_name(ptr->format)); - else if(ptr->target == PIPE_TEXTURE_CUBE) + break; + case PIPE_TEXTURE_CUBE: util_sprintf(buf, "pipe_texture_cube<%u,%u,%s,%u>", ptr->width0, ptr->height0, util_format_short_name(ptr->format), ptr->last_level); - else if(ptr->target == PIPE_TEXTURE_3D) + break; + case PIPE_TEXTURE_3D: util_sprintf(buf, "pipe_texture3d<%u,%u,%u,%s,%u>", ptr->width0, ptr->height0, ptr->depth0, util_format_short_name(ptr->format), ptr->last_level); - else + break; + default: util_sprintf(buf, "pipe_martian_resource<%u>", ptr->target); + break; + } } void -- cgit v1.2.3 From e6ff995d14085caa447c4e8634bf069c8a94f0ec Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Thu, 25 Feb 2010 13:08:35 +0100 Subject: gallium/auxiliary: add semantic linkage utility code --- src/gallium/auxiliary/Makefile | 1 + src/gallium/auxiliary/util/u_linkage.c | 145 +++++++++++++++++++++++++++++++++ src/gallium/auxiliary/util/u_linkage.h | 65 +++++++++++++++ 3 files changed, 211 insertions(+) create mode 100644 src/gallium/auxiliary/util/u_linkage.c create mode 100644 src/gallium/auxiliary/util/u_linkage.h (limited to 'src') diff --git a/src/gallium/auxiliary/Makefile b/src/gallium/auxiliary/Makefile index 287ee8c29f..a24b038974 100644 --- a/src/gallium/auxiliary/Makefile +++ b/src/gallium/auxiliary/Makefile @@ -123,6 +123,7 @@ C_SOURCES = \ util/u_hash.c \ util/u_keymap.c \ util/u_linear.c \ + util/u_linkage.c \ util/u_network.c \ util/u_math.c \ util/u_mempool.c \ diff --git a/src/gallium/auxiliary/util/u_linkage.c b/src/gallium/auxiliary/util/u_linkage.c new file mode 100644 index 0000000000..cefcb4c9f1 --- /dev/null +++ b/src/gallium/auxiliary/util/u_linkage.c @@ -0,0 +1,145 @@ +/************************************************************************** + * + * Copyright 2010 Luca Barbieri + * + * 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 COPYRIGHT OWNER(S) AND/OR ITS 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. + * + **************************************************************************/ + +#include "util/u_debug.h" +#include "pipe/p_shader_tokens.h" +#include "tgsi/tgsi_parse.h" +#include "tgsi/tgsi_scan.h" +#include "util/u_linkage.h" + +/* we must only record the registers that are actually used, not just declared */ +static INLINE boolean +util_semantic_set_test_and_set(struct util_semantic_set *set, unsigned value) +{ + unsigned mask = 1 << (value % (sizeof(long) * 8)); + unsigned long *p = &set->masks[value / (sizeof(long) * 8)]; + unsigned long v = *p & mask; + *p |= mask; + return !!v; +} + +unsigned +util_semantic_set_from_program_file(struct util_semantic_set *set, const struct tgsi_token *tokens, enum tgsi_file_type file) +{ + struct tgsi_shader_info info; + struct tgsi_parse_context parse; + unsigned count = 0; + ubyte *semantic_name; + ubyte *semantic_index; + + tgsi_scan_shader(tokens, &info); + + if(file == TGSI_FILE_INPUT) + { + semantic_name = info.input_semantic_name; + semantic_index = info.input_semantic_index; + } + else if(file == TGSI_FILE_OUTPUT) + { + semantic_name = info.output_semantic_name; + semantic_index = info.output_semantic_index; + } + else + assert(0); + + tgsi_parse_init(&parse, tokens); + + memset(set->masks, 0, sizeof(set->masks)); + while(!tgsi_parse_end_of_tokens(&parse)) + { + tgsi_parse_token(&parse); + + if(parse.FullToken.Token.Type == TGSI_TOKEN_TYPE_INSTRUCTION) + { + const struct tgsi_full_instruction *finst = &parse.FullToken.FullInstruction; + unsigned i; + for(i = 0; i < finst->Instruction.NumDstRegs; ++i) + { + if(finst->Dst[i].Register.File == file) + { + unsigned idx = finst->Dst[i].Register.Index; + if(semantic_name[idx] == TGSI_SEMANTIC_GENERIC) + { + if(!util_semantic_set_test_and_set(set, semantic_index[idx])) + ++count; + } + } + } + + for(i = 0; i < finst->Instruction.NumSrcRegs; ++i) + { + if(finst->Src[i].Register.File == file) + { + unsigned idx = finst->Src[i].Register.Index; + if(semantic_name[idx] == TGSI_SEMANTIC_GENERIC) + { + if(!util_semantic_set_test_and_set(set, semantic_index[idx])) + ++count; + } + } + } + } + } + tgsi_parse_free(&parse); + + return count; +} + +#define UTIL_SEMANTIC_SET_FOR_EACH(i, set) for(i = 0; i < 256; ++i) if(set->masks[i / (sizeof(long) * 8)] & (1 << (i % (sizeof(long) * 8)))) + +void +util_semantic_layout_from_set(unsigned char *layout, const struct util_semantic_set *set, unsigned efficient_slots, unsigned num_slots) +{ + int first = -1; + int last = -1; + unsigned i; + + memset(layout, 0xff, num_slots); + + UTIL_SEMANTIC_SET_FOR_EACH(i, set) + { + if(first < 0) + first = i; + last = i; + } + + if(last < efficient_slots) + { + UTIL_SEMANTIC_SET_FOR_EACH(i, set) + layout[i] = i; + } + else if((last - first) < efficient_slots) + { + UTIL_SEMANTIC_SET_FOR_EACH(i, set) + layout[i - first] = i; + } + else + { + unsigned idx = 0; + UTIL_SEMANTIC_SET_FOR_EACH(i, set) + layout[idx++] = i; + } +} diff --git a/src/gallium/auxiliary/util/u_linkage.h b/src/gallium/auxiliary/util/u_linkage.h new file mode 100644 index 0000000000..c30b56e6e4 --- /dev/null +++ b/src/gallium/auxiliary/util/u_linkage.h @@ -0,0 +1,65 @@ +/************************************************************************** + * + * Copyright 2010 Luca Barbieri + * + * 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 COPYRIGHT OWNER(S) AND/OR ITS 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. + * + **************************************************************************/ + +#ifndef U_LINKAGE_H_ +#define U_LINKAGE_H_ + +#include "pipe/p_compiler.h" +#include "pipe/p_shader_tokens.h" + +struct util_semantic_set +{ + unsigned long masks[256 / 8 / sizeof(unsigned long)]; +}; + +static INLINE bool +util_semantic_set_contains(struct util_semantic_set *set, unsigned char value) +{ + return !!(set->masks[value / (sizeof(long) * 8)] & (1 << (value / (sizeof(long) * 8)))); +} + +unsigned util_semantic_set_from_program_file(struct util_semantic_set *set, const struct tgsi_token *tokens, enum tgsi_file_type file); + +/* efficient_slots is the number of slots such that hardware performance is + * the same for using that amount, with holes, or less slots but with less + * holes. + * + * num_slots is the size of the layout array and hardware limit instead. + * + * efficient_slots == 0 or efficient_solts == num_slots are typical settings. + */ +void util_semantic_layout_from_set(unsigned char *layout, const struct util_semantic_set *set, unsigned efficient_slots, unsigned num_slots); + +static INLINE void +util_semantic_table_from_layout(unsigned char *table, unsigned char *layout, unsigned char first_slot_value, unsigned char num_slots) +{ + memset(table, 0xff, sizeof(table)); + + for(int i = 0; i < num_slots; ++i) + table[layout[i]] = first_slot_value + i; +} + +#endif /* U_LINKAGE_H_ */ -- cgit v1.2.3 From 95acfd0c8a53738a89fe91cf7643a8563bbe2b4f Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Sat, 7 Aug 2010 02:49:48 +0200 Subject: nvfx: fix format support code for compressed texture A source line was put in the wrong place. --- src/gallium/drivers/nvfx/nvfx_screen.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/drivers/nvfx/nvfx_screen.c b/src/gallium/drivers/nvfx/nvfx_screen.c index f2525ccb38..d354bd166a 100644 --- a/src/gallium/drivers/nvfx/nvfx_screen.c +++ b/src/gallium/drivers/nvfx/nvfx_screen.c @@ -198,7 +198,6 @@ nvfx_screen_surface_format_supported(struct pipe_screen *pscreen, break; } } else { - switch (format) { if (tex_usage & PIPE_BIND_SAMPLER_VIEW) { switch (format) { case PIPE_FORMAT_DXT1_RGB: @@ -210,6 +209,7 @@ nvfx_screen_surface_format_supported(struct pipe_screen *pscreen, break; } } + switch (format) { case PIPE_FORMAT_B8G8R8A8_UNORM: case PIPE_FORMAT_B8G8R8X8_UNORM: case PIPE_FORMAT_B5G5R5A1_UNORM: -- cgit v1.2.3 From e189823eb4427e091e052d65cc9db3d7353f02bf Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Fri, 6 Aug 2010 09:15:00 +0200 Subject: nvfx: reference count bound objects --- src/gallium/drivers/nvfx/nvfx_state.c | 36 ++++++++++++++++++++++++++++------- 1 file changed, 29 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/nvfx/nvfx_state.c b/src/gallium/drivers/nvfx/nvfx_state.c index cd58e439d7..ab7bed0f93 100644 --- a/src/gallium/drivers/nvfx/nvfx_state.c +++ b/src/gallium/drivers/nvfx/nvfx_state.c @@ -1,6 +1,7 @@ #include "pipe/p_state.h" #include "pipe/p_defines.h" #include "util/u_inlines.h" +#include "util/u_framebuffer.h" #include "draw/draw_context.h" @@ -507,7 +508,10 @@ nvfx_set_framebuffer_state(struct pipe_context *pipe, { struct nvfx_context *nvfx = nvfx_context(pipe); - nvfx->framebuffer = *fb; + if(fb) + util_copy_framebuffer_state(&nvfx->framebuffer, fb); + else + util_unreference_framebuffer_state(&nvfx->framebuffer); nvfx->dirty |= NVFX_NEW_FB; } @@ -548,7 +552,17 @@ nvfx_set_vertex_buffers(struct pipe_context *pipe, unsigned count, { struct nvfx_context *nvfx = nvfx_context(pipe); - memcpy(nvfx->vtxbuf, vb, sizeof(*vb) * count); + for(unsigned i = 0; i < count; ++i) + { + pipe_resource_reference(&nvfx->vtxbuf[i].buffer, vb[i].buffer); + nvfx->vtxbuf[i].buffer_offset = vb[i].buffer_offset; + nvfx->vtxbuf[i].max_index = vb[i].max_index; + nvfx->vtxbuf[i].stride = vb[i].stride; + } + + for(unsigned i = count; i < nvfx->vtxbuf_nr; ++i) + pipe_resource_reference(&nvfx->vtxbuf[i].buffer, 0); + nvfx->vtxbuf_nr = count; nvfx->dirty |= NVFX_NEW_ARRAYS; @@ -561,12 +575,20 @@ nvfx_set_index_buffer(struct pipe_context *pipe, { struct nvfx_context *nvfx = nvfx_context(pipe); - if (ib) - memcpy(&nvfx->idxbuf, ib, sizeof(nvfx->idxbuf)); - else - memset(&nvfx->idxbuf, 0, sizeof(nvfx->idxbuf)); - /* TODO make this more like a state */ + + if(ib) + { + pipe_resource_reference(&nvfx->idxbuf.buffer, ib->buffer); + nvfx->idxbuf.index_size = ib->index_size; + nvfx->idxbuf.offset = ib->offset; + } + else + { + pipe_resource_reference(&nvfx->idxbuf.buffer, 0); + nvfx->idxbuf.index_size = 0; + nvfx->idxbuf.offset = 0; + } } static void * -- cgit v1.2.3 From 6a73d99a5236eeb822e9bdd26bd669638cf036c6 Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Mon, 9 Aug 2010 05:05:12 +0200 Subject: nvfx: properly unreference bound objects on context destruction --- src/gallium/drivers/nvfx/nvfx_context.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src') diff --git a/src/gallium/drivers/nvfx/nvfx_context.c b/src/gallium/drivers/nvfx/nvfx_context.c index 7218abff22..3d45f5f0ba 100644 --- a/src/gallium/drivers/nvfx/nvfx_context.c +++ b/src/gallium/drivers/nvfx/nvfx_context.c @@ -1,5 +1,6 @@ #include "draw/draw_context.h" #include "pipe/p_defines.h" +#include "util/u_framebuffer.h" #include "nvfx_context.h" #include "nvfx_screen.h" @@ -31,6 +32,13 @@ nvfx_destroy(struct pipe_context *pipe) { struct nvfx_context *nvfx = nvfx_context(pipe); + for(unsigned i = 0; i < nvfx->vtxbuf_nr; ++i) + pipe_resource_reference(&nvfx->vtxbuf[i].buffer, 0); + pipe_resource_reference(&nvfx->idxbuf.buffer, 0); + util_unreference_framebuffer_state(&nvfx->framebuffer); + for(unsigned i = 0; i < PIPE_MAX_SAMPLERS; ++i) + pipe_sampler_view_reference(&nvfx->fragment_sampler_views[i], 0); + if (nvfx->draw) draw_destroy(nvfx->draw); FREE(nvfx); -- cgit v1.2.3 From 37fa0cf4eaf6e67876a1f6b33389f17f99b02461 Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Tue, 3 Aug 2010 22:50:19 +0200 Subject: nvfx: add linear flag for buffers --- src/gallium/drivers/nvfx/nv04_surface_2d.c | 1 + src/gallium/drivers/nvfx/nv04_surface_2d.h | 2 -- src/gallium/drivers/nvfx/nvfx_buffer.c | 2 ++ src/gallium/drivers/nvfx/nvfx_resource.h | 2 ++ 4 files changed, 5 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/nvfx/nv04_surface_2d.c b/src/gallium/drivers/nvfx/nv04_surface_2d.c index 7acbb505df..cd0f4ce4c9 100644 --- a/src/gallium/drivers/nvfx/nv04_surface_2d.c +++ b/src/gallium/drivers/nvfx/nv04_surface_2d.c @@ -8,6 +8,7 @@ #include "nouveau/nouveau_util.h" #include "nouveau/nouveau_screen.h" #include "nv04_surface_2d.h" +#include "nvfx_resource.h" static INLINE int nv04_surface_format(enum pipe_format format) diff --git a/src/gallium/drivers/nvfx/nv04_surface_2d.h b/src/gallium/drivers/nvfx/nv04_surface_2d.h index 2123c3ed08..b9020dbe96 100644 --- a/src/gallium/drivers/nvfx/nv04_surface_2d.h +++ b/src/gallium/drivers/nvfx/nv04_surface_2d.h @@ -38,6 +38,4 @@ nv04_surface_2d_takedown(struct nv04_surface_2d **); struct nv04_surface* nv04_surface_wrap_for_render(struct pipe_screen *pscreen, struct nv04_surface_2d* eng2d, struct nv04_surface* ns); -#define NVFX_RESOURCE_FLAG_LINEAR (PIPE_RESOURCE_FLAG_DRV_PRIV << 0) - #endif diff --git a/src/gallium/drivers/nvfx/nvfx_buffer.c b/src/gallium/drivers/nvfx/nvfx_buffer.c index 05b824b8f7..4482d9683e 100644 --- a/src/gallium/drivers/nvfx/nvfx_buffer.c +++ b/src/gallium/drivers/nvfx/nvfx_buffer.c @@ -97,6 +97,7 @@ nvfx_buffer_create(struct pipe_screen *pscreen, return NULL; buffer->base = *template; + buffer->base.flags |= NVFX_RESOURCE_FLAG_LINEAR; buffer->vtbl = &nvfx_buffer_vtbl; pipe_reference_init(&buffer->base.reference, 1); buffer->base.screen = pscreen; @@ -132,6 +133,7 @@ nvfx_user_buffer_create(struct pipe_screen *pscreen, pipe_reference_init(&buffer->base.reference, 1); buffer->vtbl = &nvfx_buffer_vtbl; + buffer->base.flags = NVFX_RESOURCE_FLAG_LINEAR; buffer->base.screen = pscreen; buffer->base.format = PIPE_FORMAT_R8_UNORM; buffer->base.usage = PIPE_USAGE_IMMUTABLE; diff --git a/src/gallium/drivers/nvfx/nvfx_resource.h b/src/gallium/drivers/nvfx/nvfx_resource.h index a68c14cf3f..d28bfab961 100644 --- a/src/gallium/drivers/nvfx/nvfx_resource.h +++ b/src/gallium/drivers/nvfx/nvfx_resource.h @@ -20,6 +20,8 @@ struct nvfx_resource { struct nouveau_bo *bo; }; +#define NVFX_RESOURCE_FLAG_LINEAR (PIPE_RESOURCE_FLAG_DRV_PRIV << 0) + #define NVFX_MAX_TEXTURE_LEVELS 16 struct nvfx_miptree { -- cgit v1.2.3 From ac97e8dba654b9b3c5a9459953ce27056bcbb021 Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Sat, 7 Aug 2010 01:56:01 +0200 Subject: nvfx: add nouveau_resource_on_gpu Add a function to get whether a resource is likely on the GPU or not. Currently always returns TRUE. --- src/gallium/drivers/nvfx/nvfx_resource.h | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/drivers/nvfx/nvfx_resource.h b/src/gallium/drivers/nvfx/nvfx_resource.h index d28bfab961..bdbf3dd3d8 100644 --- a/src/gallium/drivers/nvfx/nvfx_resource.h +++ b/src/gallium/drivers/nvfx/nvfx_resource.h @@ -3,9 +3,11 @@ #define NVFX_RESOURCE_H #include "util/u_transfer.h" +#include "util/u_format.h" +#include "util/u_math.h" +#include struct pipe_resource; -struct nouveau_bo; /* This gets further specialized into either buffer or texture @@ -22,6 +24,18 @@ struct nvfx_resource { #define NVFX_RESOURCE_FLAG_LINEAR (PIPE_RESOURCE_FLAG_DRV_PRIV << 0) +static inline int +nvfx_resource_on_gpu(struct pipe_resource* pr) +{ +#if 0 + // a compiler error here means you need to apply libdrm-nouveau-add-domain.patch to libdrm + // TODO: return FALSE if not VRAM and on a PCI-E system + return ((struct nvfx_resource*)pr)->bo->domain & (NOUVEAU_BO_VRAM | NOUVEAU_BO_GART); +#else + return TRUE; +#endif +} + #define NVFX_MAX_TEXTURE_LEVELS 16 struct nvfx_miptree { -- cgit v1.2.3 From ed2930e7e2c064458da33089cff902574008bf30 Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Fri, 15 Jan 2010 10:11:11 +0100 Subject: nvfx: new 2D: rewrite miptree code, adapt transfers Changes: - Disable swizzling on non-RGBA 2D textures, since the current 2D code is mostly broken in those cases. A later patch will fix this. Thanks to Andrew Randrianasulu who reported this. - Fix compressed texture transfers and hack around the current 2D code inability to copy compressed textures by using direct access. Thanks to Andrew Randrianasulu who reported this. This patch rewrites all the miptree layout and transfer code in the nvfx driver. The current code is broken in several ways: 1. 3D textures are laid out first by face, then by level, which is incorrect 2. Cube maps should have 128-byte aligned faces 3. Swizzled textures have a strange alignment test that seems unnecessary 4. We store the image_offsets for each face/slice but they can be easily computed instead 5. "Swizzling" is not supported for compressed formats. They can be "swizzled" but swizzling only means that there are no gaps (pitch is level-dependant) and the layout is still linear 6. Swizzling is not supported for non-RGBA formats. All formats (except possibly depth) can be swizzled according to my testing. The miptree layout is rewritten based on my empirical testing, which I posted in the "miptree findings" mail. The image_offset array is removed, since it can be calculated with a simple multiplication; the only array in the miptree structure is now the one for mipmap level starts, which it seems cannot be easily computed in constant time. Also, we now directly store a nouveau_bo instead of a pipe_buffer in the miptree structure, like nv50 does. Support for render temporaries is removed, and will be readded in a later patch. Note that the current temporary code is broken, because it does not copy the temporary back on render cache flushes. --- src/gallium/drivers/nvfx/nv30_fragtex.c | 6 +- src/gallium/drivers/nvfx/nv40_fragtex.c | 12 +- src/gallium/drivers/nvfx/nvfx_miptree.c | 332 ++++++++++++++----------------- src/gallium/drivers/nvfx/nvfx_resource.h | 48 ++++- src/gallium/drivers/nvfx/nvfx_state_fb.c | 6 +- src/gallium/drivers/nvfx/nvfx_transfer.c | 27 +-- 6 files changed, 207 insertions(+), 224 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/nvfx/nv30_fragtex.c b/src/gallium/drivers/nvfx/nv30_fragtex.c index 0cd70ca104..85489eab28 100644 --- a/src/gallium/drivers/nvfx/nv30_fragtex.c +++ b/src/gallium/drivers/nvfx/nv30_fragtex.c @@ -92,9 +92,9 @@ void nv30_fragtex_set(struct nvfx_context *nvfx, int unit) { struct nvfx_sampler_state *ps = nvfx->tex_sampler[unit]; - struct nvfx_miptree *nv30mt = (struct nvfx_miptree *)nvfx->fragment_sampler_views[unit]->texture; - struct pipe_resource *pt = &nv30mt->base.base; - struct nouveau_bo *bo = nv30mt->base.bo; + struct nvfx_miptree *mt = (struct nvfx_miptree *)nvfx->fragment_sampler_views[unit]->texture; + struct pipe_resource *pt = &mt->base.base; + struct nouveau_bo *bo = mt->base.bo; struct nv30_texture_format *tf; struct nouveau_channel* chan = nvfx->screen->base.channel; uint32_t txf, txs; diff --git a/src/gallium/drivers/nvfx/nv40_fragtex.c b/src/gallium/drivers/nvfx/nv40_fragtex.c index 0d3e90dcb0..45c34c7ffd 100644 --- a/src/gallium/drivers/nvfx/nv40_fragtex.c +++ b/src/gallium/drivers/nvfx/nv40_fragtex.c @@ -111,9 +111,9 @@ nv40_fragtex_set(struct nvfx_context *nvfx, int unit) { struct nouveau_channel* chan = nvfx->screen->base.channel; struct nvfx_sampler_state *ps = nvfx->tex_sampler[unit]; - struct nvfx_miptree *nv40mt = (struct nvfx_miptree *)nvfx->fragment_sampler_views[unit]->texture; - struct nouveau_bo *bo = nv40mt->base.bo; - struct pipe_resource *pt = &nv40mt->base.base; + struct nvfx_miptree *mt = (struct nvfx_miptree *)nvfx->fragment_sampler_views[unit]->texture; + struct nouveau_bo *bo = mt->base.bo; + struct pipe_resource *pt = &mt->base.base; struct nv40_texture_format *tf; uint32_t txf, txs, txp; @@ -149,10 +149,10 @@ nv40_fragtex_set(struct nvfx_context *nvfx, int unit) return; } - if (!(pt->flags & NVFX_RESOURCE_FLAG_LINEAR)) { + if (!mt->linear_pitch) txp = 0; - } else { - txp = nv40mt->level[0].pitch; + else { + txp = mt->linear_pitch; txf |= NV40TCL_TEX_FORMAT_LINEAR; } diff --git a/src/gallium/drivers/nvfx/nvfx_miptree.c b/src/gallium/drivers/nvfx/nvfx_miptree.c index 1fec1ffa42..0b08f88884 100644 --- a/src/gallium/drivers/nvfx/nvfx_miptree.c +++ b/src/gallium/drivers/nvfx/nvfx_miptree.c @@ -2,69 +2,111 @@ #include "pipe/p_defines.h" #include "util/u_inlines.h" #include "util/u_format.h" +#include "util/u_memory.h" #include "util/u_math.h" - +#include "state_tracker/drm_driver.h" +#include "nouveau/nouveau_winsys.h" +#include "nouveau/nouveau_screen.h" +#include "nv04_surface_2d.h" #include "nvfx_context.h" #include "nvfx_resource.h" #include "nvfx_transfer.h" -#include "nv04_surface_2d.h" - -/* Currently using separate implementations for buffers and textures, - * even though gallium has a unified abstraction of these objects. - * Eventually these should be combined, and mechanisms like transfers - * be adapted to work for both buffer and texture uploads. - */ static void -nvfx_miptree_layout(struct nvfx_miptree *mt) +nvfx_miptree_choose_format(struct nvfx_miptree *mt) { struct pipe_resource *pt = &mt->base.base; - uint width = pt->width0; - uint offset = 0; - int nr_faces, l, f; - uint wide_pitch = pt->bind & (PIPE_BIND_SAMPLER_VIEW | - PIPE_BIND_DEPTH_STENCIL | - PIPE_BIND_RENDER_TARGET | - PIPE_BIND_DISPLAY_TARGET | - PIPE_BIND_SCANOUT); - - if (pt->target == PIPE_TEXTURE_CUBE) { - nr_faces = 6; - } else - if (pt->target == PIPE_TEXTURE_3D) { - nr_faces = pt->depth0; - } else { - nr_faces = 1; + unsigned uniform_pitch = 0; + static int no_swizzle = -1; + if(no_swizzle < 0) + no_swizzle = debug_get_bool_option("NOUVEAU_NO_SWIZZLE", FALSE); + + /* Non-uniform pitch textures must be POT */ + if (pt->width0 & (pt->width0 - 1) || + pt->height0 & (pt->height0 - 1) || + pt->depth0 & (pt->depth0 - 1) + ) + uniform_pitch = 1; + + /* All texture formats except compressed ones can be swizzled + * Unsure about depth, let's prevent swizzling for now + */ + if ( + (pt->bind & (PIPE_BIND_SCANOUT | PIPE_BIND_DISPLAY_TARGET)) + || (pt->usage & PIPE_USAGE_DYNAMIC) || (pt->usage & PIPE_USAGE_STAGING) + || util_format_is_depth_or_stencil(pt->format) + || util_format_is_compressed(pt->format) + // disable swizzled textures on NV04-NV20 as our current drivers don't fully support that + // TODO: hardware should support them, fix the drivers and reenable + || nouveau_screen(pt->screen)->device->chipset < 0x30 + || no_swizzle + + // disable swizzling for non-RGBA 2D because our current 2D code can't handle anything + // else correctly, and even that is semi-broken + || pt->target != PIPE_TEXTURE_2D + || (pt->format != PIPE_FORMAT_B8G8R8A8_UNORM && pt->format != PIPE_FORMAT_B8G8R8X8_UNORM) + ) + mt->base.base.flags |= NVFX_RESOURCE_FLAG_LINEAR; + + /* non compressed formats with uniform pitch must be linear, and vice versa */ + if(!util_format_is_s3tc(pt->format) + && (uniform_pitch || mt->base.base.flags & NVFX_RESOURCE_FLAG_LINEAR)) + { + mt->base.base.flags |= NVFX_RESOURCE_FLAG_LINEAR; + uniform_pitch = 1; } - for (l = 0; l <= pt->last_level; l++) { - if (wide_pitch && (pt->flags & NVFX_RESOURCE_FLAG_LINEAR)) - mt->level[l].pitch = align(util_format_get_stride(pt->format, pt->width0), 64); - else - mt->level[l].pitch = util_format_get_stride(pt->format, width); + if(uniform_pitch) + { + mt->linear_pitch = util_format_get_stride(pt->format, pt->width0); + + // TODO: this is only a constraint for rendering and not sampling, apparently + // we may also want this unconditionally + if(pt->bind & (PIPE_BIND_SAMPLER_VIEW | + PIPE_BIND_DEPTH_STENCIL | + PIPE_BIND_RENDER_TARGET | + PIPE_BIND_DISPLAY_TARGET | + PIPE_BIND_SCANOUT)) + mt->linear_pitch = align(mt->linear_pitch, 64); + } + else + mt->linear_pitch = 0; +} - mt->level[l].image_offset = - CALLOC(nr_faces, sizeof(unsigned)); +static unsigned +nvfx_miptree_layout(struct nvfx_miptree *mt) +{ + struct pipe_resource* pt = &mt->base.base; + uint offset = 0; - width = u_minify(width, 1); + if(!nvfx_screen(pt->screen)->is_nv4x) + { + assert(pt->target == PIPE_TEXTURE_RECT + || (util_is_pot(pt->width0) && util_is_pot(pt->height0))); } - for (f = 0; f < nr_faces; f++) { - for (l = 0; l < pt->last_level; l++) { - mt->level[l].image_offset[f] = offset; + for (unsigned l = 0; l <= pt->last_level; l++) + { + unsigned size; + mt->level_offset[l] = offset; + + if(mt->linear_pitch) + size = mt->linear_pitch; + else + size = util_format_get_stride(pt->format, u_minify(pt->width0, l)); + size = util_format_get_2d_size(pt->format, size, u_minify(pt->height0, l)); - if (!(pt->flags & NVFX_RESOURCE_FLAG_LINEAR) && - u_minify(pt->width0, l + 1) > 1 && u_minify(pt->height0, l + 1) > 1) - offset += align(mt->level[l].pitch * u_minify(pt->height0, l), 64); - else - offset += mt->level[l].pitch * u_minify(pt->height0, l); - } + if(pt->target == PIPE_TEXTURE_3D) + size *= u_minify(pt->depth0, l); - mt->level[l].image_offset[f] = offset; - offset += mt->level[l].pitch * u_minify(pt->height0, l); + offset += size; } - mt->total_size = offset; + offset = align(offset, 128); + mt->face_size = offset; + if(mt->base.base.target == PIPE_TEXTURE_CUBE) + offset += 5 * mt->face_size; + return offset; } static boolean @@ -79,7 +121,7 @@ nvfx_miptree_get_handle(struct pipe_screen *pscreen, return nouveau_screen_bo_get_handle(pscreen, mt->base.bo, - mt->level[0].pitch, + mt->linear_pitch, whandle); } @@ -88,15 +130,7 @@ static void nvfx_miptree_destroy(struct pipe_screen *screen, struct pipe_resource *pt) { struct nvfx_miptree *mt = (struct nvfx_miptree *)pt; - int l; - nouveau_screen_bo_release(screen, mt->base.bo); - - for (l = 0; l <= pt->last_level; l++) { - if (mt->level[l].image_offset) - FREE(mt->level[l].image_offset); - } - FREE(mt); } @@ -116,76 +150,50 @@ struct u_resource_vtbl nvfx_miptree_vtbl = u_default_transfer_inline_write /* transfer_inline_write */ }; +static struct nvfx_miptree* +nvfx_miptree_create_skeleton(struct pipe_screen *pscreen, const struct pipe_resource *pt) +{ + struct nvfx_miptree *mt; + + if(pt->width0 > 4096 || pt->height0 > 4096) + return NULL; + + mt = CALLOC_STRUCT(nvfx_miptree); + if (!mt) + return NULL; + + mt->base.base = *pt; + mt->base.vtbl = &nvfx_miptree_vtbl; + pipe_reference_init(&mt->base.base.reference, 1); + mt->base.base.screen = pscreen; + + // set this to the actual capabilities, we use it to decide whether to use the 3D engine for copies + // TODO: is this the correct way to use Gallium? + mt->base.base.bind = pt->bind | PIPE_BIND_RENDER_TARGET | PIPE_BIND_SAMPLER_VIEW | PIPE_BIND_DEPTH_STENCIL; + + // on our current driver (and the driver too), format support does not depend on geometry, so don't bother computing it + // TODO: may want to revisit this + if(!pscreen->is_format_supported(pscreen, pt->format, pt->target, 0, PIPE_BIND_RENDER_TARGET, 0)) + mt->base.base.bind &=~ PIPE_BIND_RENDER_TARGET; + if(!pscreen->is_format_supported(pscreen, pt->format, pt->target, 0, PIPE_BIND_SAMPLER_VIEW, 0)) + mt->base.base.bind &=~ PIPE_BIND_SAMPLER_VIEW; + if(!pscreen->is_format_supported(pscreen, pt->format, pt->target, 0, PIPE_BIND_DEPTH_STENCIL, 0)) + mt->base.base.bind &=~ PIPE_BIND_DEPTH_STENCIL; + + return mt; +} struct pipe_resource * nvfx_miptree_create(struct pipe_screen *pscreen, const struct pipe_resource *pt) { - struct nvfx_miptree *mt; - static int no_swizzle = -1; - if(no_swizzle < 0) - no_swizzle = debug_get_bool_option("NOUVEAU_NO_SWIZZLE", FALSE); - - mt = CALLOC_STRUCT(nvfx_miptree); - if (!mt) - return NULL; - - mt->base.base = *pt; - mt->base.vtbl = &nvfx_miptree_vtbl; - pipe_reference_init(&mt->base.base.reference, 1); - mt->base.base.screen = pscreen; - - /* Swizzled textures must be POT */ - if (pt->width0 & (pt->width0 - 1) || - pt->height0 & (pt->height0 - 1)) - mt->base.base.flags |= NVFX_RESOURCE_FLAG_LINEAR; - else - if (pt->bind & (PIPE_BIND_SCANOUT | - PIPE_BIND_DISPLAY_TARGET | - PIPE_BIND_DEPTH_STENCIL)) - mt->base.base.flags |= NVFX_RESOURCE_FLAG_LINEAR; - else - if (pt->usage == PIPE_USAGE_DYNAMIC) - mt->base.base.flags |= NVFX_RESOURCE_FLAG_LINEAR; - else { - switch (pt->format) { - case PIPE_FORMAT_B5G6R5_UNORM: - case PIPE_FORMAT_L8A8_UNORM: - case PIPE_FORMAT_A8_UNORM: - case PIPE_FORMAT_L8_UNORM: - case PIPE_FORMAT_I8_UNORM: - /* TODO: we can actually swizzle these formats on nv40, we - are just preserving the pre-unification behavior. - The whole 2D code is going to be rewritten anyway. */ - if(nvfx_screen(pscreen)->is_nv4x) { - mt->base.base.flags |= NVFX_RESOURCE_FLAG_LINEAR; - break; - } - /* TODO: Figure out which formats can be swizzled */ - case PIPE_FORMAT_B8G8R8A8_UNORM: - case PIPE_FORMAT_B8G8R8X8_UNORM: - case PIPE_FORMAT_R16_SNORM: - { - if (no_swizzle) - mt->base.base.flags |= NVFX_RESOURCE_FLAG_LINEAR; - break; - } - default: - mt->base.base.flags |= NVFX_RESOURCE_FLAG_LINEAR; - } - } + struct nvfx_miptree* mt = nvfx_miptree_create_skeleton(pscreen, pt); + nvfx_miptree_choose_format(mt); - /* apparently we can't render to swizzled surfaces smaller than 64 bytes, so make them linear. - * If the user did not ask for a render target, they can still render to it, but it will cost them an extra copy. - * This also happens for small mipmaps of large textures. */ - if (pt->bind & PIPE_BIND_RENDER_TARGET && - util_format_get_stride(pt->format, pt->width0) < 64) - mt->base.base.flags |= NVFX_RESOURCE_FLAG_LINEAR; + unsigned size = nvfx_miptree_layout(mt); - nvfx_miptree_layout(mt); + mt->base.bo = nouveau_screen_bo_new(pscreen, 256, pt->usage, pt->bind, size); - mt->base.bo = nouveau_screen_bo_new(pscreen, 256, - pt->usage, pt->bind, mt->total_size); if (!mt->base.bo) { FREE(mt); return NULL; @@ -193,54 +201,28 @@ nvfx_miptree_create(struct pipe_screen *pscreen, const struct pipe_resource *pt) return &mt->base.base; } - - - +// TODO: redo this, just calling miptree_layout struct pipe_resource * -nvfx_miptree_from_handle(struct pipe_screen *pscreen, - const struct pipe_resource *template, - struct winsys_handle *whandle) +nvfx_miptree_from_handle(struct pipe_screen *pscreen, const struct pipe_resource *template, struct winsys_handle *whandle) { - struct nvfx_miptree *mt; - unsigned stride; - - /* Only supports 2D, non-mipmapped textures for the moment */ - if ((template->target != PIPE_TEXTURE_2D && - template->target != PIPE_TEXTURE_RECT) || - template->last_level != 0 || - template->depth0 != 1) - return NULL; - - mt = CALLOC_STRUCT(nvfx_miptree); - if (!mt) - return NULL; - - mt->base.bo = nouveau_screen_bo_from_handle(pscreen, whandle, &stride); - if (mt->base.bo == NULL) { - FREE(mt); - return NULL; - } - - mt->base.base = *template; - mt->base.vtbl = &nvfx_miptree_vtbl; - pipe_reference_init(&mt->base.base.reference, 1); - mt->base.base.screen = pscreen; - mt->level[0].pitch = stride; - mt->level[0].image_offset = CALLOC(1, sizeof(unsigned)); - - /* Assume whoever created this buffer expects it to be linear for now */ - mt->base.base.flags |= NVFX_RESOURCE_FLAG_LINEAR; - - /* XXX: Need to adjust bo refcount?? - */ - /* nouveau_bo_ref(bo, &mt->base.bo); */ - return &mt->base.base; + struct nvfx_miptree* mt = nvfx_miptree_create_skeleton(pscreen, template); + if(whandle->stride) { + mt->linear_pitch = whandle->stride; + mt->base.base.flags |= NVFX_RESOURCE_FLAG_LINEAR; + } else + nvfx_miptree_choose_format(mt); + + nvfx_miptree_layout(mt); + + unsigned stride; + mt->base.bo = nouveau_screen_bo_from_handle(pscreen, whandle, &stride); + if (mt->base.bo == NULL) { + FREE(mt); + return NULL; + } + return &mt->base.base; } - - - - /* Surface helpers, not strictly required to implement the resource vtbl: */ struct pipe_surface * @@ -248,7 +230,6 @@ nvfx_miptree_surface_new(struct pipe_screen *pscreen, struct pipe_resource *pt, unsigned face, unsigned level, unsigned zslice, unsigned flags) { - struct nvfx_miptree *mt = (struct nvfx_miptree *)pt; struct nv04_surface *ns; ns = CALLOC_STRUCT(nv04_surface); @@ -263,33 +244,8 @@ nvfx_miptree_surface_new(struct pipe_screen *pscreen, struct pipe_resource *pt, ns->base.face = face; ns->base.level = level; ns->base.zslice = zslice; - ns->pitch = mt->level[level].pitch; - - if (pt->target == PIPE_TEXTURE_CUBE) { - ns->base.offset = mt->level[level].image_offset[face]; - } else - if (pt->target == PIPE_TEXTURE_3D) { - ns->base.offset = mt->level[level].image_offset[zslice]; - } else { - ns->base.offset = mt->level[level].image_offset[0]; - } - - /* create a linear temporary that we can render into if - * necessary. - * - * Note that ns->pitch is always a multiple of 64 for linear - * surfaces and swizzled surfaces are POT, so ns->pitch & 63 - * is equivalent to (ns->pitch < 64 && swizzled) - */ - - if ((ns->pitch & 63) && - (ns->base.usage & PIPE_BIND_RENDER_TARGET)) - { - struct nv04_surface_2d* eng2d = - ((struct nvfx_screen*)pscreen)->eng2d; - - ns = nv04_surface_wrap_for_render(pscreen, eng2d, ns); - } + ns->pitch = nvfx_subresource_pitch(pt, level); + ns->base.offset = nvfx_subresource_offset(pt, face, level, zslice); return &ns->base; } diff --git a/src/gallium/drivers/nvfx/nvfx_resource.h b/src/gallium/drivers/nvfx/nvfx_resource.h index bdbf3dd3d8..0e24ec2f1f 100644 --- a/src/gallium/drivers/nvfx/nvfx_resource.h +++ b/src/gallium/drivers/nvfx/nvfx_resource.h @@ -39,15 +39,11 @@ nvfx_resource_on_gpu(struct pipe_resource* pr) #define NVFX_MAX_TEXTURE_LEVELS 16 struct nvfx_miptree { - struct nvfx_resource base; - uint total_size; + struct nvfx_resource base; - struct { - uint pitch; - uint *image_offset; - } level[NVFX_MAX_TEXTURE_LEVELS]; - - unsigned image_nr; + unsigned linear_pitch; /* for linear textures, 0 for swizzled and compressed textures with level-dependent minimal pitch */ + unsigned face_size; /* 128-byte aligned face/total size */ + unsigned level_offset[NVFX_MAX_TEXTURE_LEVELS]; }; static INLINE @@ -103,5 +99,41 @@ nvfx_miptree_surface_new(struct pipe_screen *pscreen, struct pipe_resource *pt, unsigned face, unsigned level, unsigned zslice, unsigned flags); +/* only for miptrees, don't use for buffers */ + +/* NOTE: for swizzled 3D textures, this just returns the offset of the mipmap level */ +static inline unsigned +nvfx_subresource_offset(struct pipe_resource* pt, unsigned face, unsigned level, unsigned zslice) +{ + if(pt->target == PIPE_BUFFER) + return 0; + else + { + struct nvfx_miptree *mt = (struct nvfx_miptree *)pt; + + unsigned offset = mt->level_offset[level]; + if (pt->target == PIPE_TEXTURE_CUBE) + offset += mt->face_size * face; + else if (pt->target == PIPE_TEXTURE_3D && mt->linear_pitch) + offset += zslice * util_format_get_2d_size(pt->format, (mt->linear_pitch ? mt->linear_pitch : util_format_get_stride(pt->format, u_minify(pt->width0, level))), u_minify(pt->height0, level)); + return offset; + } +} + +static inline unsigned +nvfx_subresource_pitch(struct pipe_resource* pt, unsigned level) +{ + if(pt->target == PIPE_BUFFER) + return ((struct nvfx_resource*)pt)->bo->size; + else + { + struct nvfx_miptree *mt = (struct nvfx_miptree *)pt; + + if(mt->linear_pitch) + return mt->linear_pitch; + else + return util_format_get_stride(pt->format, u_minify(pt->width0, level)); + } +} #endif diff --git a/src/gallium/drivers/nvfx/nvfx_state_fb.c b/src/gallium/drivers/nvfx/nvfx_state_fb.c index 360e569f77..657e315f06 100644 --- a/src/gallium/drivers/nvfx/nvfx_state_fb.c +++ b/src/gallium/drivers/nvfx/nvfx_state_fb.c @@ -29,7 +29,7 @@ nvfx_state_framebuffer_validate(struct nvfx_context *nvfx) colour_format = fb->cbufs[i]->format; rt_enable |= (NV34TCL_RT_ENABLE_COLOR0 << i); - nvfx->hw_rt[i].bo = nvfx_surface_buffer(fb->cbufs[i]); + nvfx->hw_rt[i].bo = ((struct nvfx_miptree*)fb->cbufs[i]->texture)->base.bo; nvfx->hw_rt[i].offset = fb->cbufs[i]->offset; nvfx->hw_rt[i].pitch = ((struct nv04_surface *)fb->cbufs[i])->pitch; } @@ -42,7 +42,7 @@ nvfx_state_framebuffer_validate(struct nvfx_context *nvfx) if (fb->zsbuf) { zeta_format = fb->zsbuf->format; - nvfx->hw_zeta.bo = nvfx_surface_buffer(fb->zsbuf); + nvfx->hw_zeta.bo = ((struct nvfx_miptree*)fb->zsbuf->texture)->base.bo; nvfx->hw_zeta.offset = fb->zsbuf->offset; nvfx->hw_zeta.pitch = ((struct nv04_surface *)fb->zsbuf)->pitch; } @@ -67,7 +67,7 @@ nvfx_state_framebuffer_validate(struct nvfx_context *nvfx) depth_only = 1; /* Render to depth buffer only */ - if (!(fb->zsbuf->texture->usage & NVFX_RESOURCE_FLAG_LINEAR)) { + if (!(fb->zsbuf->texture->flags & NVFX_RESOURCE_FLAG_LINEAR)) { assert(!(fb->width & (fb->width - 1)) && !(fb->height & (fb->height - 1))); rt_format = NV34TCL_RT_FORMAT_TYPE_SWIZZLED | diff --git a/src/gallium/drivers/nvfx/nvfx_transfer.c b/src/gallium/drivers/nvfx/nvfx_transfer.c index 9ff0a93d30..957e586f81 100644 --- a/src/gallium/drivers/nvfx/nvfx_transfer.c +++ b/src/gallium/drivers/nvfx/nvfx_transfer.c @@ -59,14 +59,9 @@ nvfx_miptree_transfer_new(struct pipe_context *pipe, const struct pipe_box *box) { struct pipe_screen *pscreen = pipe->screen; - struct nvfx_miptree *mt = (struct nvfx_miptree *)pt; struct nvfx_transfer *tx; struct pipe_resource tx_tex_template, *tx_tex; - static int no_transfer = -1; unsigned bind = nvfx_transfer_bind_flags(usage); - if(no_transfer < 0) - no_transfer = debug_get_bool_option("NOUVEAU_NO_TRANSFER", FALSE); - tx = CALLOC_STRUCT(nvfx_transfer); if (!tx) @@ -78,13 +73,13 @@ nvfx_miptree_transfer_new(struct pipe_context *pipe, pipe_resource_reference(&tx->base.resource, pt); tx->base.sr = sr; + tx->base.stride = nvfx_subresource_pitch(pt, sr.level); + tx->base.slice_stride = tx->base.stride * u_minify(pt->height0, sr.level); tx->base.usage = usage; tx->base.box = *box; - tx->base.stride = mt->level[sr.level].pitch; /* Direct access to texture */ - if ((pt->usage == PIPE_USAGE_DYNAMIC || - no_transfer) && + if ((util_format_is_s3tc(pt->format) || pt->usage & PIPE_USAGE_DYNAMIC) && pt->flags & NVFX_RESOURCE_FLAG_LINEAR) { tx->direct = true; @@ -109,7 +104,8 @@ nvfx_miptree_transfer_new(struct pipe_context *pipe, return NULL; } - tx->base.stride = ((struct nvfx_miptree*)tx_tex)->level[0].pitch; + tx->base.stride = ((struct nvfx_miptree*)tx_tex)->linear_pitch; + tx->base.slice_stride = tx->base.stride * box->height; tx->surface = pscreen->get_tex_surface(pscreen, tx_tex, 0, 0, 0, @@ -181,27 +177,26 @@ nvfx_miptree_transfer_del(struct pipe_context *pipe, void * nvfx_miptree_transfer_map(struct pipe_context *pipe, struct pipe_transfer *ptx) { - struct pipe_screen *pscreen = pipe->screen; struct nvfx_transfer *tx = (struct nvfx_transfer *)ptx; struct nv04_surface *ns = (struct nv04_surface *)tx->surface; struct nvfx_miptree *mt = (struct nvfx_miptree *)tx->surface->texture; - uint8_t *map = nouveau_screen_bo_map(pscreen, mt->base.bo, + + uint8_t *map = nouveau_screen_bo_map(pipe->screen, mt->base.bo, nouveau_screen_transfer_flags(ptx->usage)); if(!tx->direct) return map + ns->base.offset; else - return (map + ns->base.offset + - ptx->box.y * ns->pitch + - ptx->box.x * util_format_get_blocksize(ptx->resource->format)); + return map + ns->base.offset + + util_format_get_2d_size(ns->base.format, ns->pitch, ptx->box.y) + + util_format_get_stride(ptx->resource->format, ptx->box.x); } void nvfx_miptree_transfer_unmap(struct pipe_context *pipe, struct pipe_transfer *ptx) { - struct pipe_screen *pscreen = pipe->screen; struct nvfx_transfer *tx = (struct nvfx_transfer *)ptx; struct nvfx_miptree *mt = (struct nvfx_miptree *)tx->surface->texture; - nouveau_screen_bo_unmap(pscreen, mt->base.bo); + nouveau_screen_bo_unmap(pipe->screen, mt->base.bo); } -- cgit v1.2.3 From 23639dc046435716042b68359ac6208d99be82f4 Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Tue, 3 Aug 2010 21:32:42 +0200 Subject: nvfx: new 2D: rewrite transfer code to use staging transfers This greatly simplifies the code, and avoids ad-hoc copy code. Also, these new transfers work for buffers too, even though they are still used for miptrees only. --- src/gallium/drivers/nvfx/nvfx_miptree.c | 9 +- src/gallium/drivers/nvfx/nvfx_transfer.c | 215 ++++++++----------------------- src/gallium/drivers/nvfx/nvfx_transfer.h | 10 +- 3 files changed, 61 insertions(+), 173 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/nvfx/nvfx_miptree.c b/src/gallium/drivers/nvfx/nvfx_miptree.c index 0b08f88884..27bfa24b28 100644 --- a/src/gallium/drivers/nvfx/nvfx_miptree.c +++ b/src/gallium/drivers/nvfx/nvfx_miptree.c @@ -4,6 +4,7 @@ #include "util/u_format.h" #include "util/u_memory.h" #include "util/u_math.h" +#include "util/u_staging.h" #include "state_tracker/drm_driver.h" #include "nouveau/nouveau_winsys.h" #include "nouveau/nouveau_screen.h" @@ -142,11 +143,11 @@ struct u_resource_vtbl nvfx_miptree_vtbl = nvfx_miptree_get_handle, /* get_handle */ nvfx_miptree_destroy, /* resource_destroy */ NULL, /* is_resource_referenced */ - nvfx_miptree_transfer_new, /* get_transfer */ - nvfx_miptree_transfer_del, /* transfer_destroy */ - nvfx_miptree_transfer_map, /* transfer_map */ + nvfx_transfer_new, /* get_transfer */ + util_staging_transfer_destroy, /* transfer_destroy */ + nvfx_transfer_map, /* transfer_map */ u_default_transfer_flush_region, /* transfer_flush_region */ - nvfx_miptree_transfer_unmap, /* transfer_unmap */ + nvfx_transfer_unmap, /* transfer_unmap */ u_default_transfer_inline_write /* transfer_inline_write */ }; diff --git a/src/gallium/drivers/nvfx/nvfx_transfer.c b/src/gallium/drivers/nvfx/nvfx_transfer.c index 957e586f81..e9c3dd7e55 100644 --- a/src/gallium/drivers/nvfx/nvfx_transfer.c +++ b/src/gallium/drivers/nvfx/nvfx_transfer.c @@ -4,199 +4,88 @@ #include "util/u_format.h" #include "util/u_memory.h" #include "util/u_math.h" -#include "nouveau/nouveau_winsys.h" +#include "util/u_staging.h" #include "nvfx_context.h" #include "nvfx_screen.h" #include "nvfx_state.h" #include "nvfx_resource.h" #include "nvfx_transfer.h" -struct nvfx_transfer { - struct pipe_transfer base; - struct pipe_surface *surface; - boolean direct; -}; - -static void -nvfx_compatible_transfer_tex(struct pipe_resource *pt, unsigned width, unsigned height, - unsigned bind, - struct pipe_resource *template) -{ - memset(template, 0, sizeof(struct pipe_resource)); - template->target = pt->target; - template->format = pt->format; - template->width0 = width; - template->height0 = height; - template->depth0 = 1; - template->last_level = 0; - template->nr_samples = pt->nr_samples; - template->bind = bind; - template->usage = PIPE_USAGE_DYNAMIC; - template->flags = NVFX_RESOURCE_FLAG_LINEAR; -} - - -static unsigned nvfx_transfer_bind_flags( unsigned transfer_usage ) +struct nvfx_staging_transfer { - unsigned bind = 0; + struct util_staging_transfer base; -#if 0 - if (transfer_usage & PIPE_TRANSFER_WRITE) - bind |= PIPE_BIND_BLIT_SOURCE; - - if (transfer_usage & PIPE_TRANSFER_READ) - bind |= PIPE_BIND_BLIT_DESTINATION; -#endif - - return bind; -} + unsigned offset; + unsigned map_count; +}; struct pipe_transfer * -nvfx_miptree_transfer_new(struct pipe_context *pipe, +nvfx_transfer_new(struct pipe_context *pipe, struct pipe_resource *pt, struct pipe_subresource sr, unsigned usage, const struct pipe_box *box) { - struct pipe_screen *pscreen = pipe->screen; - struct nvfx_transfer *tx; - struct pipe_resource tx_tex_template, *tx_tex; - unsigned bind = nvfx_transfer_bind_flags(usage); + struct nvfx_staging_transfer* tx; + bool direct = !nvfx_resource_on_gpu(pt) && pt->flags & NVFX_RESOURCE_FLAG_LINEAR; - tx = CALLOC_STRUCT(nvfx_transfer); - if (!tx) + tx = CALLOC_STRUCT(nvfx_staging_transfer); + if(!tx) return NULL; - /* Don't handle 3D transfers yet. - */ - assert(box->depth == 1); - - pipe_resource_reference(&tx->base.resource, pt); - tx->base.sr = sr; - tx->base.stride = nvfx_subresource_pitch(pt, sr.level); - tx->base.slice_stride = tx->base.stride * u_minify(pt->height0, sr.level); - tx->base.usage = usage; - tx->base.box = *box; + util_staging_transfer_init(pipe, pt, sr, usage, box, direct, tx); - /* Direct access to texture */ - if ((util_format_is_s3tc(pt->format) || pt->usage & PIPE_USAGE_DYNAMIC) && - pt->flags & NVFX_RESOURCE_FLAG_LINEAR) + if(pt->target == PIPE_BUFFER) { - tx->direct = true; - - /* XXX: just call the internal nvfx function. - */ - tx->surface = pscreen->get_tex_surface(pscreen, pt, - sr.face, sr.level, - box->z, - bind); - return &tx->base; + tx->base.base.slice_stride = tx->base.base.stride = ((struct nvfx_resource*)tx->base.staging_resource)->bo->size; + if(direct) + tx->offset = util_format_get_stride(pt->format, box->x); + else + tx->offset = 0; } - - tx->direct = false; - - nvfx_compatible_transfer_tex(pt, box->width, box->height, bind, &tx_tex_template); - - tx_tex = pscreen->resource_create(pscreen, &tx_tex_template); - if (!tx_tex) + else { - FREE(tx); - return NULL; + if(direct) + { + tx->base.base.stride = nvfx_subresource_pitch(pt, sr.level); + tx->base.base.slice_stride = tx->base.base.stride * u_minify(pt->height0, sr.level); + tx->offset = nvfx_subresource_offset(pt, sr.face, sr.level, box->z) + + util_format_get_2d_size(pt->format, tx->base.base.stride, box->y) + + util_format_get_stride(pt->format, box->x); + } + else + { + tx->base.base.stride = nvfx_subresource_pitch(tx->base.staging_resource, 0); + tx->base.base.slice_stride = tx->base.base.stride * tx->base.staging_resource->height0; + tx->offset = 0; + } + + assert(tx->base.base.stride); + + return &tx->base.base; } - - tx->base.stride = ((struct nvfx_miptree*)tx_tex)->linear_pitch; - tx->base.slice_stride = tx->base.stride * box->height; - - tx->surface = pscreen->get_tex_surface(pscreen, tx_tex, - 0, 0, 0, - bind); - - pipe_resource_reference(&tx_tex, NULL); - - if (!tx->surface) - { - pipe_surface_reference(&tx->surface, NULL); - FREE(tx); - return NULL; - } - - if (usage & PIPE_TRANSFER_READ) { - struct nvfx_screen *nvscreen = nvfx_screen(pscreen); - struct pipe_surface *src; - - src = pscreen->get_tex_surface(pscreen, pt, - sr.face, sr.level, box->z, - 0 /*PIPE_BIND_BLIT_SOURCE*/); - - /* TODO: Check if SIFM can deal with x,y,w,h when swizzling */ - /* TODO: Check if SIFM can un-swizzle */ - nvscreen->eng2d->copy(nvscreen->eng2d, - tx->surface, 0, 0, - src, - box->x, box->y, - box->width, box->height); - - pipe_surface_reference(&src, NULL); - } - - return &tx->base; -} - -void -nvfx_miptree_transfer_del(struct pipe_context *pipe, - struct pipe_transfer *ptx) -{ - struct nvfx_transfer *tx = (struct nvfx_transfer *)ptx; - - if (!tx->direct && (ptx->usage & PIPE_TRANSFER_WRITE)) { - struct pipe_screen *pscreen = pipe->screen; - struct nvfx_screen *nvscreen = nvfx_screen(pscreen); - struct pipe_surface *dst; - - dst = pscreen->get_tex_surface(pscreen, - ptx->resource, - ptx->sr.face, - ptx->sr.level, - ptx->box.z, - 0 /*PIPE_BIND_BLIT_DESTINATION*/); - - /* TODO: Check if SIFM can deal with x,y,w,h when swizzling */ - nvscreen->eng2d->copy(nvscreen->eng2d, - dst, ptx->box.x, ptx->box.y, - tx->surface, 0, 0, - ptx->box.width, ptx->box.height); - - pipe_surface_reference(&dst, NULL); - } - - pipe_surface_reference(&tx->surface, NULL); - pipe_resource_reference(&ptx->resource, NULL); - FREE(ptx); } void * -nvfx_miptree_transfer_map(struct pipe_context *pipe, struct pipe_transfer *ptx) +nvfx_transfer_map(struct pipe_context *pipe, struct pipe_transfer *ptx) { - struct nvfx_transfer *tx = (struct nvfx_transfer *)ptx; - struct nv04_surface *ns = (struct nv04_surface *)tx->surface; - struct nvfx_miptree *mt = (struct nvfx_miptree *)tx->surface->texture; - - uint8_t *map = nouveau_screen_bo_map(pipe->screen, mt->base.bo, - nouveau_screen_transfer_flags(ptx->usage)); - - if(!tx->direct) - return map + ns->base.offset; - else - return map + ns->base.offset - + util_format_get_2d_size(ns->base.format, ns->pitch, ptx->box.y) - + util_format_get_stride(ptx->resource->format, ptx->box.x); + struct nvfx_staging_transfer *tx = (struct nvfx_staging_transfer *)ptx; + if(!ptx->data) + { + struct nvfx_miptree *mt = (struct nvfx_miptree *)tx->base.staging_resource; + uint8_t *map = nouveau_screen_bo_map(pipe->screen, mt->base.bo, nouveau_screen_transfer_flags(ptx->usage)); + ptx->data = map + tx->offset; + } + ++tx->map_count; + return ptx->data; } void -nvfx_miptree_transfer_unmap(struct pipe_context *pipe, struct pipe_transfer *ptx) +nvfx_transfer_unmap(struct pipe_context *pipe, struct pipe_transfer *ptx) { - struct nvfx_transfer *tx = (struct nvfx_transfer *)ptx; - struct nvfx_miptree *mt = (struct nvfx_miptree *)tx->surface->texture; + struct nvfx_staging_transfer *tx = (struct nvfx_staging_transfer *)ptx; + struct nvfx_miptree *mt = (struct nvfx_miptree *)tx->base.staging_resource; - nouveau_screen_bo_unmap(pipe->screen, mt->base.bo); + if(!--tx->map_count) + nouveau_screen_bo_unmap(pipe->screen, mt->base.bo); } diff --git a/src/gallium/drivers/nvfx/nvfx_transfer.h b/src/gallium/drivers/nvfx/nvfx_transfer.h index 3e3317b2c7..20f20d5b0b 100644 --- a/src/gallium/drivers/nvfx/nvfx_transfer.h +++ b/src/gallium/drivers/nvfx/nvfx_transfer.h @@ -7,19 +7,17 @@ struct pipe_transfer * -nvfx_miptree_transfer_new(struct pipe_context *pcontext, +nvfx_transfer_new(struct pipe_context *pcontext, struct pipe_resource *pt, struct pipe_subresource sr, unsigned usage, const struct pipe_box *box); -void -nvfx_miptree_transfer_del(struct pipe_context *pcontext, - struct pipe_transfer *ptx); + void * -nvfx_miptree_transfer_map(struct pipe_context *pcontext, +nvfx_transfer_map(struct pipe_context *pcontext, struct pipe_transfer *ptx); void -nvfx_miptree_transfer_unmap(struct pipe_context *pcontext, +nvfx_transfer_unmap(struct pipe_context *pcontext, struct pipe_transfer *ptx); -- cgit v1.2.3 From 24a4ea003f14a96ed07fdc4e92a67610655befad Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Tue, 19 Jan 2010 18:51:10 +0100 Subject: nv04-nv40: new 2D: add new Gallium-independent 2D engine This patch add a brand new nv04-nv40 2D engine module. It should correctly implement all operations involving swizzled, and 3D-swizzled surfaces. This code is independent from the Gallium framework and can thus be reused in the DDX and classic Mesa drivers (it's only likely to be useful in the latter, though). Currently, surface_copy and surface_fill are broken for 3D textures, for swizzled source textures and possibly for some misaligned cases The code is based around the new nv04_region structure, which encapsulates the information from pipe_surface needed for the 2D engine and CPU copies. The use of nv04_region makes the code independent of the Gallium framework and allows to transform the nv04_region without clobbering the nv04_region. The existing M2MF, blitter, and SWIZZLED_SURFACE paths have been improved and a new CPU path has been added. There is also support to tell the caller to use the 3D engine. The main feature of the copy/fill setup algorithm is linearization/contiguous-linearization of swizzled surfaces. The idea of linearization is that some swizzled surfaces are laid out like linear ones (1xN, 2xN, Nx1) and can thus be used as such (e.g. useful for copying single pixels). Also, some rectangles (e.g. the whole surface) are contiguous in memory. If both the source and destination rectangles are swizzled but contiguous, then they can be regarded as both linear: this is the idea of "contiguous linearization". This, for instance, allows to use the 2D engine to duplicate the content of a swizzled surface to another swizzled surface, by pretending they are actually linear. After linearization, the result may not be 64-byte aligned. Another transformation is done to enlarge the linear surface so that it becomes 64-byte aligned. This is also used to 64-byte align swizzled texture mipmaps. The inner loop of the CPU path is as optimized as possible without using SSE/SSE2. Future improvements could include SSE/SSE2 support, and possibly a faster coordinate swizzling algorithm (which is however not used in the inner loop). It may be a good idea to autogenerate swizzling code at least for all possible POT 2D texture dimensions (less than 256), maybe for all 3D ones too (less than 4096). Also, it woud be a very good idea to make a copy with the GPU first if the source surface is in uncached memory. --- src/gallium/drivers/nvfx/Makefile | 1 + src/gallium/drivers/nvfx/nv04_2d.c | 1320 ++++++++++++++++++++++++++++++ src/gallium/drivers/nvfx/nv04_2d.h | 87 ++ src/gallium/drivers/nvfx/nv04_2d_loops.h | 70 ++ 4 files changed, 1478 insertions(+) create mode 100644 src/gallium/drivers/nvfx/nv04_2d.c create mode 100644 src/gallium/drivers/nvfx/nv04_2d.h create mode 100644 src/gallium/drivers/nvfx/nv04_2d_loops.h (limited to 'src') diff --git a/src/gallium/drivers/nvfx/Makefile b/src/gallium/drivers/nvfx/Makefile index c1d57ca396..6536343e44 100644 --- a/src/gallium/drivers/nvfx/Makefile +++ b/src/gallium/drivers/nvfx/Makefile @@ -5,6 +5,7 @@ LIBNAME = nvfx C_SOURCES = \ nv04_surface_2d.c \ + nv04_2d.c \ nvfx_buffer.c \ nvfx_context.c \ nvfx_clear.c \ diff --git a/src/gallium/drivers/nvfx/nv04_2d.c b/src/gallium/drivers/nvfx/nv04_2d.c new file mode 100644 index 0000000000..b2f2ae79e1 --- /dev/null +++ b/src/gallium/drivers/nvfx/nv04_2d.c @@ -0,0 +1,1320 @@ +/************************************************************************** + * + * Copyright 2009 Ben Skeggs + * Copyright 2009 Younes Manton + * Copyright 2010 Luca Barbieri + * 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, 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 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 THE COPYRIGHT HOLDERS, AUTHORS + * AND/OR ITS 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. + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + **************************************************************************/ + +/* this code has no Mesa or Gallium dependency and can be reused in the classic Mesa driver or DDX */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "nv04_2d.h" + +/* avoid depending on Mesa/Gallium */ +#ifdef __GNUC__ +#define likely(x) __builtin_expect(!!(x), 1) +#define unlikely(x) __builtin_expect(!!(x), 0) +#else +#define likely(x) !!(x) +#define unlikely(x) !!(x) +#endif + +#define MIN2( A, B ) ( (A)<(B) ? (A) : (B) ) +#define MAX2( A, B ) ( (A)>(B) ? (A) : (B) ) + +struct nv04_2d_context +{ + struct nouveau_notifier *ntfy; + struct nouveau_grobj *surf2d; + struct nouveau_grobj *swzsurf; + struct nouveau_grobj *m2mf; + struct nouveau_grobj *rect; + struct nouveau_grobj *sifm; + struct nouveau_grobj *blit; +}; + +static inline int +align(int value, int alignment) +{ + return (value + alignment - 1) & ~(alignment - 1); +} + +static inline int +util_is_pot(unsigned x) +{ + return (x & (x - 1)) == 0; +} + +/* Integer base-2 logarithm, rounded towards zero. */ +static inline unsigned log2i(unsigned i) +{ + unsigned r = 0; + + if (i & 0xffff0000) { + i >>= 16; + r += 16; + } + if (i & 0x0000ff00) { + i >>= 8; + r += 8; + } + if (i & 0x000000f0) { + i >>= 4; + r += 4; + } + if (i & 0x0000000c) { + i >>= 2; + r += 2; + } + if (i & 0x00000002) { + r += 1; + } + return r; +} + +//#define NV04_REGION_DEBUG + +// Yes, we really want to inline everything, since all the functions are used only once +#if defined(__GNUC__) && defined(DEBUG) +#define inline __attribute__((always_inline)) inline +#endif + +static inline unsigned +nv04_swizzle_bits_square(unsigned x, unsigned y) +{ + unsigned u = (x & 0x001) << 0 | + (x & 0x002) << 1 | + (x & 0x004) << 2 | + (x & 0x008) << 3 | + (x & 0x010) << 4 | + (x & 0x020) << 5 | + (x & 0x040) << 6 | + (x & 0x080) << 7 | + (x & 0x100) << 8 | + (x & 0x200) << 9 | + (x & 0x400) << 10 | + (x & 0x800) << 11; + + unsigned v = (y & 0x001) << 1 | + (y & 0x002) << 2 | + (y & 0x004) << 3 | + (y & 0x008) << 4 | + (y & 0x010) << 5 | + (y & 0x020) << 6 | + (y & 0x040) << 7 | + (y & 0x080) << 8 | + (y & 0x100) << 9 | + (y & 0x200) << 10 | + (y & 0x400) << 11 | + (y & 0x800) << 12; + return v | u; +} + +/* rectangular swizzled textures are linear concatenations of swizzled square tiles */ +static inline unsigned +nv04_swizzle_bits_2d(unsigned x, unsigned y, unsigned w, unsigned h) +{ + if(h <= 1) + return x; + else + { + unsigned s = MIN2(w, h); + unsigned m = s - 1; + return (((x | y) & ~m) * s) | nv04_swizzle_bits_square(x & m, y & m); + } +} + +// general 3D texture case +static inline unsigned +nv04_swizzle_bits(unsigned x, unsigned y, unsigned z, unsigned w, unsigned h, unsigned d) +{ + if(d <= 1) + return nv04_swizzle_bits_2d(x, y, w, h); + else + { + // TODO: autogenerate code for all possible texture sizes (13 * 13 * 13 with dims <= 4096) and do a single indirect call + unsigned v = 0; + w >>= 1; + h >>= 1; + d >>= 1; + for(int i = 0;;) + { + int oldi = i; + if(likely(w)) + { + v |= (x & 1) << i; + x >>= 1; + w >>= 1; + ++i; + } + + if(likely(h)) + { + v |= (y & 1) << i; + y >>= 1; + h >>= 1; + ++i; + } + + if(likely(d)) + { + v |= (z & 1) << i; + z >>= 1; + d >>= 1; + ++i; + } + + if(i == oldi) + break; + } + return v; + } +} + +unsigned +nv04_region_begin(struct nv04_region* rgn, unsigned w, unsigned h) +{ + if(rgn->pitch) + return rgn->pitch * rgn->y + (rgn->x << rgn->bpps); + else + return nv04_swizzle_bits(rgn->x, rgn->y, rgn->z, rgn->w, rgn->h, rgn->d) << rgn->bpps; +} + +unsigned +nv04_region_end(struct nv04_region* rgn, unsigned w, unsigned h) +{ + if(rgn->pitch) + return rgn->pitch * (rgn->y + h - 1) + ((rgn->x + w) << rgn->bpps); + else + return (nv04_swizzle_bits(rgn->x + w - 1, rgn->y + h - 1, rgn->z, rgn->w, rgn->h, rgn->d) + 1) << rgn->bpps; +} + +// *pitch = -1 -> use 3D swizzling for (x, y), *pitch = 0 -> use 2D swizzling, other *pitch -> use linear calculations +// returns 2 if pixel order is 3D-swizzled and 1 if subrect is 2D-swizzled +/* *pitch == -1 ret = 0 -> 3D swizzled subrect + * *pitch == 0 ret = 0 -> 2D swizzled subrect + * *pitch > 0 ret = 0 -> linear subrect + * *pitch > 0 ret = 1 -> linear subrect, but with swizzled 3D data inside + */ + +static inline void +nv04_region_print(struct nv04_region* rgn) +{ + fprintf(stderr, "<%i[%i]> ", rgn->bo->handle, rgn->offset); + if(rgn->pitch) + fprintf(stderr, "lin %i", rgn->pitch); + else + fprintf(stderr, "swz %ix%ix%i", rgn->w, rgn->h, rgn->d); + fprintf(stderr, " (%i, %i, %i)", rgn->x, rgn->y, rgn->z); +} + +static inline void +nv04_region_assert(struct nv04_region* rgn, unsigned w, unsigned h) +{ + unsigned end = rgn->offset + nv04_region_end(rgn, w, h); + + assert(rgn->offset <= (int)rgn->bo->size); + assert(end <= rgn->bo->size); + if(!rgn->pitch) { + assert(util_is_pot(rgn->w)); + assert(util_is_pot(rgn->h)); + } +} + +/* determine if region can be linearized or fake-linearized */ +static inline int +nv04_region_is_contiguous(struct nv04_region* rgn, int w, int h) +{ + if(rgn->pitch) + return rgn->pitch == w << rgn->bpps; + + // redundant, but this is the fast path for the common case + if(w == rgn->w && h == rgn->h && rgn->d <= 1) + return 1; + + // must be POT + if((w & (w - 1)) || (h & (h - 1))) + return 0; + + // must be aligned + if((rgn->x & (w - 1)) || (rgn->y & (h - 1))) + return 0; + + if(rgn->d > 1) + return 0; + + int surf_min = MIN2(rgn->w, rgn->h); + int rect_min = MIN2(w, h); + + if((rect_min == surf_min) || (w == h) || (w == 2 * h)) + return 1; + + return 0; +} + +// double the pitch until it is larger than the alignment, or the height becomes odd or 1 +static inline void +nv04_region_contiguous_shape(struct nv04_region* rgn, int* w, int* h, int align) +{ + while(!(*h & 1) && (*w << rgn->bpps) < (1 << align)) + { + *w <<= 1; + *h >>= 1; + } + + while((*w << rgn->bpps) > 16384 && !(*w & 1)) + { + *w >>= 1; + *h <<= 1; + } + +#ifdef NV04_REGION_DEBUG + fprintf(stderr, "\tCONTIGUOUS %ix%i\n", *w, *h); +#endif +} + +static inline void +nv04_region_linearize_contiguous(struct nv04_region* rgn, unsigned w, unsigned h) +{ + int pos; + if(rgn->pitch) + { + rgn->offset += rgn->y * rgn->pitch + (rgn->x << rgn->bpps); + rgn->x = 0; + rgn->y = 0; + } + else + { + rgn->offset += (rgn->w * rgn->h * rgn->z) << rgn->bpps; + pos = nv04_swizzle_bits(rgn->x, rgn->y, rgn->z, rgn->w, rgn->h, rgn->d); + rgn->x = pos & (w - 1); + rgn->y = pos / w; + } + rgn->pitch = w << rgn->bpps; + +#ifdef NV04_REGION_DEBUG + fprintf(stderr, "\tLINEARIZE "); + nv04_region_print(rgn); + fprintf(stderr, "\n"); +#endif +} + + /* preserve the offset! */ + /* + rgn->pitch = util_format_get_stride(rgn->format, w); + int pos = nv04_swizzle_bits(rgn->x, rgn->y, rgn->z, rgn->w, rgn->h, rgn->d); + rgn->x = pos & (w - 1); + rgn->y = pos & ~(w - 1); + */ + + /* + rgn->offset += + rgn->pitch = util_format_get_stride(rgn->format, w); + rgn->x = 0; + rgn->y = 0; + */ + +/* This code will get used for, and always succeed on: + * - 4x2 1bpp swizzled texture mipmap levels + * - linear regions created by linearization + * + * This code will get used for, and MAY work for: + * - misaligned texture blanket + * - linear surfaces created without wide_pitch (in this case, it will only work if we are lucky) + * + * The general case requires splitting the region in 2. + */ +static inline int +nv04_region_do_align_offset(struct nv04_region* rgn, unsigned w, unsigned h, int shift) +{ + if(rgn->pitch > 0) + { + assert(!(rgn->offset & ((1 << rgn->bpps) - 1))); // fatal! + int delta = rgn->offset & ((1 << shift) - 1); + + if(h <= 1) + { + rgn->x += delta >> rgn->bpps; + rgn->offset -= delta; + rgn->pitch = align((rgn->x + w) << rgn->bpps, 1 << shift); + } + else + { + int newxo = (rgn->x << rgn->bpps) + delta; + int dy = newxo / rgn->pitch; + newxo -= dy * rgn->pitch; + if((newxo + (w << rgn->bpps)) > rgn->pitch) + { + // TODO: split the region into two rectangles (!) if *really* necessary, unless the hardware actually supports "wrapping" rectangles + // this does not happen if the surface is pitch-aligned, which it should always be + assert(0); + return -1; + } + rgn->x = newxo >> rgn->bpps; + rgn->y += dy; + } + } + else + { + // we don't care about the alignment of 3D surfaces since the 2D engine can't use them + if(rgn->d < 0) + return -1; + + int size; + int min = MIN2(rgn->w, rgn->h); + size = min * min << rgn->bpps; + + // this is unfixable, and should not be happening + if(rgn->offset & (size - 1)) + return -1; + + int v = (rgn->offset & ((1 << shift) - 1)) / size; + rgn->offset -= v * size; + + if(rgn->h == min) + { + unsigned w; + rgn->x += rgn->h * v; + w = rgn->w + rgn->h * v; + + while(rgn->w < w) + rgn->w += rgn->w; + } + else + { + unsigned h; + rgn->y += rgn->w * v; + h = rgn->h + rgn->w * v; + + while(rgn->h < h) + rgn->h += rgn->h; + } + } + +#ifdef NV04_REGION_DEBUG + fprintf(stderr, "\tALIGNED "); + nv04_region_print(rgn); + fprintf(stderr, "\n"); +#endif + return 0; +} + +// both pitch and shift +// will leave the region unchanged if it fails +static inline int +nv04_region_align(struct nv04_region* rgn, unsigned w, unsigned h, int shift) +{ + if(rgn->pitch & ((1 << shift) - 1)) + { + if(h == 1) + goto do_align; /* this will fix pitch too in this case */ + else + return -1; + } + + if(rgn->offset & ((1 << shift) - 1)) + { + do_align: + if(nv04_region_do_align_offset(rgn, w, h, shift)) + return -1; + } + return 0; +} + +/* this contains 22 different copy loops after preprocessing. unfortunately, it's necessary */ +void +nv04_region_copy_cpu(struct nv04_region* dst, struct nv04_region* src, int w, int h) +{ + if(dst->bo != src->bo) + { + nouveau_bo_map(dst->bo, NOUVEAU_BO_WR); + nouveau_bo_map(src->bo, NOUVEAU_BO_RD); + } + else + nouveau_bo_map(dst->bo, NOUVEAU_BO_WR | NOUVEAU_BO_RD); + + uint8_t* mdst = dst->bo->map + dst->offset; + uint8_t* msrc = src->bo->map + src->offset; + + int size = w << dst->bpps; + + nv04_region_assert(dst, w, h); + nv04_region_assert(src, w, h); + +#ifdef NV04_REGION_DEBUG + fprintf(stderr, "\tRGN_COPY_CPU [%i, %i: %i] ", w, h, dst->bpps); + for(int i = 0; i < 2; ++i) + { + nv04_region_print(i ? src : dst); + fprintf(stderr, i ? "\n" : " <- "); + } + +// for(int i = 0; i < 16; ++i) +// fprintf(stderr, "%02x ", msrc[i]); +// fprintf(stderr, "\n"); +#endif + + // TODO: support overlapping copies! + if(src->pitch && dst->pitch) + { + mdst += dst->y * dst->pitch + (dst->x << dst->bpps); + msrc += src->y * src->pitch + (src->x << src->bpps); + if(dst->bo != src->bo) + goto simple; + else if(mdst < msrc) + { + if(mdst + size <= msrc) + { +simple: + for(int iy = 0; iy < h; ++iy) + { + assert(mdst + size <= (uint8_t*)dst->bo->map + dst->bo->size); + assert(msrc + size <= (uint8_t*)src->bo->map + src->bo->size); + memcpy(mdst, msrc, size); + msrc += src->pitch; mdst += dst->pitch; + } + } + else + { + for(int iy = 0; iy < h; ++iy) + { + assert(mdst + size <= (uint8_t*)dst->bo->map + dst->bo->size); + assert(msrc + size <= (uint8_t*)src->bo->map + src->bo->size); + memmove(mdst, msrc, size); + msrc += src->pitch; mdst += dst->pitch; + } + } + } + else + { + /* copy backwards so we don't destroy data we have to read yet */ + if(msrc + size <= mdst) + { + for(int iy = h - 1; iy >= 0; --iy) + { + assert(mdst + size <= (uint8_t*)dst->bo->map + dst->bo->size); + assert(msrc + size <= (uint8_t*)src->bo->map + src->bo->size); + memcpy(mdst, msrc, size); + msrc += src->pitch; mdst += dst->pitch; + } + } + else + { + for(int iy = h - 1; iy >= 0; --iy) + { + assert(mdst + size <= (uint8_t*)dst->bo->map + dst->bo->size); + assert(msrc + size <= (uint8_t*)src->bo->map + src->bo->size); + memmove(mdst, msrc, size); + msrc += src->pitch; mdst += dst->pitch; + } + } + } + } + else + { + int* dswx; + int* dswy; + int* sswx; + int* sswy; + + if(!dst->pitch) + { + dswx = alloca(w * sizeof(int)); + for(int ix = 0; ix < w; ++ix) // we are adding, so z cannot be contributed by both + dswx[ix] = nv04_swizzle_bits(dst->x + ix, 0, 0, dst->w, dst->h, dst->d); + dswy = alloca(h * sizeof(int)); + for(int iy = 0; iy < h; ++iy) + dswy[iy] = nv04_swizzle_bits(0, dst->y + iy, dst->z, dst->w, dst->h, dst->d); + } + + if(!src->pitch) + { + sswx = alloca(w * sizeof(int)); + for(int ix = 0; ix < w; ++ix) + sswx[ix] = nv04_swizzle_bits(src->x + ix, 0, 0, src->w, src->h, src->d); + sswy = alloca(h * sizeof(int)); + for(int iy = 0; iy < h; ++iy) + sswy[iy] = nv04_swizzle_bits(0, src->y + iy, src->z, src->w, src->h, src->d); + } + + int dir = 1; + /* do backwards copies for overlapping swizzled surfaces */ + if(dst->pitch == src->pitch && dst->offset == src->offset) + { + if(dst->y > src->y || (dst->y == src->y && dst->x > src->x)) + dir = -1; + } + +#define SWIZZLED_COPY_LOOPS + if(dir == 1) + { + int dir = 1; +#define LOOP_Y for(int iy = 0; iy < h; ++iy) +#define LOOP_X for(int ix = 0; ix < w; ++ix) +#include "nv04_2d_loops.h" +#undef LOOP_X +#undef LOOP_Y + } + else + { + int dir = -1; +#define LOOP_Y for(int iy = h - 1; iy >= 0; --iy) +#define LOOP_X for(int ix = w - 1; ix >= 0; --ix) +#include "nv04_2d_loops.h" +#undef LOOP_X +#undef LOOP_Y + } +#undef SWIZZLED_COPY_LOOP + } + + if(src->bo != dst->bo) + nouveau_bo_unmap(src->bo); + nouveau_bo_unmap(dst->bo); +} + +/* TODO: if the destination is swizzled, we are doing random writes, which causes write combining to fail + * the alternative is to read, modify and copy back, which may or may not be faster + * loading 3D textures is a common case that hits this and could probably benefit from the temporary + */ +void +nv04_region_fill_cpu(struct nv04_region* dst, int w, int h, unsigned value) +{ + uint8_t* mdst = (nouveau_bo_map(dst->bo, NOUVEAU_BO_WR), dst->bo->map + dst->offset); + +#ifdef NV04_REGION_DEBUG + fprintf(stderr, "\tRGN_FILL_CPU "); + nv04_region_print(dst); + fprintf(stderr, "\n"); +#endif + + nv04_region_assert(dst, w, h); + + if(dst->pitch) + { + unsigned size = w << dst->bpps; + +#define FILL(T) do { \ + for(int iy = 0; iy < h; ++iy) \ + { \ + assert((char*)((T*)mdst + w) <= (char*)dst->bo->map + dst->bo->size); \ + for(int ix = 0; ix < w; ++ix) \ + ((T*)mdst)[ix] = (T)value; \ + mdst += dst->pitch; \ + } \ + } while(0) + + mdst += dst->y * dst->pitch + (dst->x << dst->bpps); + + if(dst->bpps == 0) + { +ms: + assert(mdst + size * h <= (uint8_t*)dst->bo->map + dst->bo->size); + if(size == dst->pitch) + memset(mdst, (uint8_t)value, size * h); + else + { + for(int iy = 0; iy < h; ++iy) + { + assert(mdst + size <= (uint8_t*)dst->bo->map + dst->bo->size); + memset(mdst, (uint8_t)value, size); + mdst += dst->pitch; + } + } + } + else if(dst->bpps == 1) + { + if(!((uint8_t)value ^ (uint8_t)(value >> 8))) + goto ms; + + FILL(uint16_t); + } + else if(dst->bpps == 2) + { + if(value == (uint8_t)value * 0x1010101) + goto ms; + FILL(uint32_t); + } + else + assert(0); +#undef FILL + } + else + { + int* dswx; + int* dswy; + + dswx = alloca(w * sizeof(int)); + for(int ix = 0; ix < w; ++ix) + dswx[ix] = nv04_swizzle_bits(dst->x + ix, 0, dst->z, dst->w, dst->h, dst->d); + dswy = alloca(h * sizeof(int)); + for(int iy = 0; iy < h; ++iy) + dswy[iy] = nv04_swizzle_bits(0, dst->y + iy, dst->z, dst->w, dst->h, dst->d); + +#define FILL(T) do { \ + T tvalue = (T)value; \ + for(int iy = 0; iy < h; ++iy) \ + { \ + T* pdst = (T*)mdst + dswy[iy]; \ + for(int ix = 0; ix < w; ++ix) \ + { \ + assert((uint8_t*)&pdst[dswx[ix] + 1] <= (uint8_t*)dst->bo->map + dst->bo->size); \ + pdst[dswx[ix]] = tvalue; \ + } \ + } \ + } while(0) + + if(dst->bpps == 0) + FILL(uint8_t); + else if(dst->bpps == 1) + FILL(uint16_t); + else if(dst->bpps == 2) + FILL(uint32_t); + else + assert(0 && "unhandled bpp"); +#undef FILL + } + + nouveau_bo_unmap(dst->bo); +} + +static void +nv04_region_copy_swizzle(struct nv04_2d_context *ctx, + struct nv04_region* dst, + struct nv04_region* src, + int w, int h, int cs2d_format, int sifm_format) +{ + struct nouveau_channel *chan = ctx->swzsurf->channel; + struct nouveau_grobj *swzsurf = ctx->swzsurf; + struct nouveau_grobj *sifm = ctx->sifm; + /* Max width & height may not be the same on all HW, but must be POT */ + unsigned max_shift = 10; + unsigned cw = 1 << max_shift; + unsigned ch = 1 << max_shift; + unsigned sx = dst->x >> max_shift; + unsigned sy = dst->y >> max_shift; + unsigned ex = (dst->x + w - 1) >> max_shift; + unsigned ey = (dst->y + h - 1) >> max_shift; + unsigned chunks = (ex - sx + 1) * (ey - sy + 1); + if(dst->w < cw) + cw = dst->w; + if(dst->h < ch) + ch = dst->h; + unsigned chunk_size = cw * ch << dst->bpps; + +#ifdef NV04_REGION_DEBUG + fprintf(stderr, "\tRGN_COPY_SWIZZLE [%i, %i: %i] ", w, h, dst->bpps); + for(int i = 0; i < 2; ++i) + { + nv04_region_print(i ? src : dst); + fprintf(stderr, i ? "\n" : " <- "); + } +#endif + + nv04_region_assert(dst, w, h); + nv04_region_assert(src, w, h); + + MARK_RING (chan, 8 + chunks * 17, 2 + chunks * 2); + + BEGIN_RING(chan, swzsurf, NV04_SWIZZLED_SURFACE_DMA_IMAGE, 1); + OUT_RELOCo(chan, dst->bo, + NOUVEAU_BO_VRAM | NOUVEAU_BO_WR); + + BEGIN_RING(chan, swzsurf, NV04_SWIZZLED_SURFACE_FORMAT, 1); + OUT_RING (chan, cs2d_format | + log2i(cw) << NV04_SWIZZLED_SURFACE_FORMAT_BASE_SIZE_U_SHIFT | + log2i(ch) << NV04_SWIZZLED_SURFACE_FORMAT_BASE_SIZE_V_SHIFT); + + BEGIN_RING(chan, sifm, NV03_SCALED_IMAGE_FROM_MEMORY_DMA_IMAGE, 1); + OUT_RELOCo(chan, src->bo, + NOUVEAU_BO_GART | NOUVEAU_BO_VRAM | NOUVEAU_BO_RD); + BEGIN_RING(chan, sifm, NV04_SCALED_IMAGE_FROM_MEMORY_SURFACE, 1); + OUT_RING (chan, swzsurf->handle); + + assert(!(dst->offset & 63)); + + for (int cy = sy; cy <= ey; ++cy) { + int ry = MAX2(0, (int)(dst->y - ch * cy)); + int rh = MIN2((int)ch, (int)(dst->y - ch * cy + h)) - ry; + for (int cx = sx; cx <= ex; ++cx) { + int rx = MAX2(0, (int)(dst->x - cw * cx)); + int rw = MIN2((int)cw, (int)(dst->x - cw * cx + w)) - rx; + + BEGIN_RING(chan, swzsurf, NV04_SWIZZLED_SURFACE_OFFSET, 1); + + unsigned dst_offset = dst->offset + (nv04_swizzle_bits_2d(cx * cw, cy * ch, dst->w, dst->h) << dst->bpps); + assert(dst_offset <= dst->bo->size); + assert(dst_offset + chunk_size <= dst->bo->size); + OUT_RELOCl(chan, dst->bo, dst_offset, + NOUVEAU_BO_VRAM | NOUVEAU_BO_WR); + + BEGIN_RING(chan, sifm, NV05_SCALED_IMAGE_FROM_MEMORY_COLOR_CONVERSION, 9); + OUT_RING (chan, NV05_SCALED_IMAGE_FROM_MEMORY_COLOR_CONVERSION_TRUNCATE); + OUT_RING (chan, sifm_format); + OUT_RING (chan, NV03_SCALED_IMAGE_FROM_MEMORY_OPERATION_SRCCOPY); + OUT_RING (chan, rx | (ry << NV03_SCALED_IMAGE_FROM_MEMORY_CLIP_POINT_Y_SHIFT)); + OUT_RING (chan, rh << NV03_SCALED_IMAGE_FROM_MEMORY_CLIP_SIZE_H_SHIFT | rw); + OUT_RING (chan, rx | (ry << NV03_SCALED_IMAGE_FROM_MEMORY_OUT_POINT_Y_SHIFT)); + OUT_RING (chan, rh << NV03_SCALED_IMAGE_FROM_MEMORY_OUT_SIZE_H_SHIFT | rw); + OUT_RING (chan, 1 << 20); + OUT_RING (chan, 1 << 20); + + BEGIN_RING(chan, sifm, NV03_SCALED_IMAGE_FROM_MEMORY_SIZE, 4); + OUT_RING (chan, rh << NV03_SCALED_IMAGE_FROM_MEMORY_SIZE_H_SHIFT | align(rw, 8)); + OUT_RING (chan, src->pitch | + NV03_SCALED_IMAGE_FROM_MEMORY_FORMAT_ORIGIN_CENTER | + NV03_SCALED_IMAGE_FROM_MEMORY_FORMAT_FILTER_POINT_SAMPLE); + unsigned src_offset = src->offset + (cy * ch + ry + src->y - dst->y) * src->pitch + ((cx * cw + rx + src->x - dst->x) << src->bpps); + assert(src_offset <= src->bo->size); + assert(src_offset + (src->pitch * (rh - 1)) + (rw << src->bpps) <= src->bo->size); + OUT_RELOCl(chan, src->bo, src_offset, + NOUVEAU_BO_GART | NOUVEAU_BO_VRAM | NOUVEAU_BO_RD); + OUT_RING (chan, 0); + } + } +} + +static inline void +nv04_copy_m2mf_begin(struct nv04_2d_context *ctx, struct nouveau_bo* dstbo, struct nouveau_bo* srcbo, unsigned commands) +{ + struct nouveau_channel *chan = ctx->m2mf->channel; + struct nouveau_grobj *m2mf = ctx->m2mf; + MARK_RING (chan, 3 + commands * 9, 2 + commands * 2); + BEGIN_RING(chan, m2mf, NV04_MEMORY_TO_MEMORY_FORMAT_DMA_BUFFER_IN, 2); + OUT_RELOCo(chan, srcbo, + NOUVEAU_BO_GART | NOUVEAU_BO_VRAM | NOUVEAU_BO_RD); + OUT_RELOCo(chan, dstbo, + NOUVEAU_BO_GART | NOUVEAU_BO_VRAM | NOUVEAU_BO_WR); +} + +static inline void +nv04_copy_m2mf_body(struct nv04_2d_context *ctx, struct nouveau_bo* dstbo, int* pdstoff, unsigned dstpitch, struct nouveau_bo* srcbo, int* psrcoff, unsigned srcpitch, unsigned size, unsigned lines) +{ + struct nouveau_channel *chan = ctx->m2mf->channel; + struct nouveau_grobj *m2mf = ctx->m2mf; + +#ifdef NV04_REGION_DEBUG + fprintf(stderr, "\t\t\tCOPY_M2MF_BODY [%i, %i] <%i[%u]> lin %u <- <%i[%u]> lin %u\n", size, lines, dstbo->handle, *pdstoff, dstpitch, srcbo->handle, *psrcoff, srcpitch); +#endif + + BEGIN_RING(chan, m2mf, NV04_MEMORY_TO_MEMORY_FORMAT_OFFSET_IN, 8); + OUT_RELOCl(chan, srcbo, *psrcoff, + NOUVEAU_BO_VRAM | NOUVEAU_BO_GART | NOUVEAU_BO_RD); + OUT_RELOCl(chan, dstbo, *pdstoff, + NOUVEAU_BO_VRAM | NOUVEAU_BO_GART | NOUVEAU_BO_WR); + OUT_RING (chan, srcpitch); + OUT_RING (chan, dstpitch); + OUT_RING (chan, size); + OUT_RING (chan, lines); + OUT_RING (chan, 0x0101); + OUT_RING (chan, 0); + + *psrcoff += srcpitch * lines; + *pdstoff += dstpitch * lines; +} + +static void +nv04_copy_m2mf(struct nv04_2d_context *ctx, + struct nouveau_bo* dstbo, int dstoff, unsigned dstpitch, + struct nouveau_bo* srcbo, int srcoff, unsigned srcpitch, + unsigned size, unsigned h) +{ + unsigned max_pitch = 32767; + unsigned max_lines = 2047; + +#ifdef NV04_REGION_DEBUG + fprintf(stderr, "\t\tCOPY_M2MF [%i, %i] <%i[%i]> lin %u <- <%i[%i]> lin %u\n", size, h, dstbo->handle, dstoff, dstpitch, srcbo->handle, srcoff, srcpitch); +#endif + + if(srcpitch <= max_pitch && dstpitch <= max_pitch) + { + unsigned full_pages = h / max_lines; + unsigned leftover_lines = h - full_pages * max_lines; + + nv04_copy_m2mf_begin(ctx, dstbo, srcbo, full_pages + !!leftover_lines); + + for(unsigned i = 0; i < full_pages; ++i) + nv04_copy_m2mf_body(ctx, dstbo, &dstoff, dstpitch, srcbo, &srcoff, srcpitch, size, max_lines); + + if(leftover_lines) + nv04_copy_m2mf_body(ctx, dstbo, &dstoff, dstpitch, srcbo, &srcoff, srcpitch, size, leftover_lines); + } + else + { + unsigned lines = size / max_pitch; + unsigned leftover = size - lines * max_pitch; + unsigned full_pages = lines / max_lines; + unsigned leftover_lines = lines - full_pages * max_lines; + unsigned srcgap = srcpitch - size; + unsigned dstgap = dstpitch - size; + + nv04_copy_m2mf_begin(ctx, dstbo, srcbo, h * (full_pages + !!leftover_lines + !!leftover)); + + for(unsigned i = 0; i < h; ++i) + { + for(unsigned j = 0; j < full_pages; ++j) + nv04_copy_m2mf_body(ctx, dstbo, &dstoff, max_pitch, srcbo, &srcoff, max_pitch, max_pitch, max_lines); + + if(leftover_lines) + nv04_copy_m2mf_body(ctx, dstbo, &dstoff, max_pitch, srcbo, &srcoff, max_pitch, max_pitch, leftover_lines); + + if(leftover) + nv04_copy_m2mf_body(ctx, dstbo, &dstoff, leftover, srcbo, &srcoff, leftover, leftover, 1); + + srcoff += srcgap; + dstoff += dstgap; + } + } +} + +void +nv04_memcpy(struct nv04_2d_context *ctx, struct nouveau_bo* dstbo, int dstoff, struct nouveau_bo* srcbo, int srcoff, unsigned size) +{ +#ifdef NV04_REGION_DEBUG + fprintf(stderr, "\tMEMCPY [%i] <%i[%i]> <- <%i[%i]>\n", size, dstbo->handle, dstoff, srcbo->handle, srcoff); +#endif + + nv04_copy_m2mf(ctx, dstbo, dstoff, size, srcbo, srcoff, size, size, 1); +} + +static void +nv04_region_copy_m2mf(struct nv04_2d_context *ctx, struct nv04_region *dst, struct nv04_region *src, int w, int h) +{ +#ifdef NV04_REGION_DEBUG + fprintf(stderr, "\tRGN_COPY_M2MF [%i, %i: %i] ", w, h, dst->bpps); + for(int i = 0; i < 2; ++i) + { + nv04_region_print(i ? src : dst); + fprintf(stderr, i ? "\n" : " <- "); + } +#endif + + nv04_region_assert(dst, w, h); + nv04_region_assert(src, w, h); + assert(src->pitch); + assert(dst->pitch); + + nv04_copy_m2mf(ctx, + dst->bo, dst->offset + dst->y * dst->pitch + (dst->x << dst->bpps), dst->pitch, + src->bo, src->offset + src->y * src->pitch + (src->x << src->bpps), src->pitch, + w << src->bpps, h); +} + +static inline void +nv04_region_copy_blit(struct nv04_2d_context *ctx, struct nv04_region* dst, struct nv04_region* src, int w, int h, int format) +{ + struct nouveau_channel *chan = ctx->surf2d->channel; + struct nouveau_grobj *surf2d = ctx->surf2d; + struct nouveau_grobj *blit = ctx->blit; + +#ifdef NV04_REGION_DEBUG + fprintf(stderr, "\tRGN_COPY_BLIT [%i, %i: %i] ", w, h, dst->bpps); + for(int i = 0; i < 2; ++i) + { + nv04_region_print(i ? src : dst); + fprintf(stderr, i ? "\n" : " <- "); + } +#endif + + assert(!(src->pitch & 63) && src->pitch); + assert(!(dst->pitch & 63) && dst->pitch); + nv04_region_assert(dst, w, h); + nv04_region_assert(src, w, h); + + MARK_RING (chan, 12, 4); + BEGIN_RING(chan, surf2d, NV04_CONTEXT_SURFACES_2D_DMA_IMAGE_SOURCE, 2); + OUT_RELOCo(chan, src->bo, NOUVEAU_BO_VRAM | NOUVEAU_BO_RD); + OUT_RELOCo(chan, dst->bo, NOUVEAU_BO_VRAM | NOUVEAU_BO_WR); + BEGIN_RING(chan, surf2d, NV04_CONTEXT_SURFACES_2D_FORMAT, 4); + OUT_RING (chan, format); + OUT_RING (chan, (dst->pitch << 16) | src->pitch); + OUT_RELOCl(chan, src->bo, src->offset, NOUVEAU_BO_VRAM | NOUVEAU_BO_RD); + OUT_RELOCl(chan, dst->bo, dst->offset, NOUVEAU_BO_VRAM | NOUVEAU_BO_WR); + + BEGIN_RING(chan, blit, 0x0300, 3); + OUT_RING (chan, (src->y << 16) | src->x); + OUT_RING (chan, (dst->y << 16) | dst->x); + OUT_RING (chan, ( h << 16) | w); +} + +/* THEOREM: a non-linearizable swizzled destination is always 64 byte aligned, except for 4x2 mipmap levels of swizzled 1bpp surfaces + * HYPOTESIS: + * 1. The first mipmap level is 64-byte-aligned + * PROOF: + * 1. Thus, all mipmaps level with a parent which is 64-byte or more in size are. + * 2. At 1bpp, the smallest levels with a <= 32-byte parent are either Nx1 or 1xN or size <=8, thus 4x2, 2x2 or 2x4 + * 3. Nx1, 1xN, 2x4, 2x2 have all subrects linearizable. 4x2 does not. + * 4. At 2/4bpp or more, the smallest levels with a 32-byte parent are 1xN, Nx1 or 2x2 + * + * However, nv04_region_align handles that. + */ + +// 0 -> done, 1 -> do with 3D engine or CPU, -1 -> do with CPU +// dst and src may be modified, and the possibly modified version should be passed to nv04_region_cpu if necessary +int +nv04_region_copy_2d(struct nv04_2d_context *ctx, struct nv04_region* dst, struct nv04_region* src, + int w, int h, int cs2d_format, int sifm_format, int dst_to_gpu, int src_on_gpu) +{ + assert(src->bpps == dst->bpps); + +#ifdef NV04_REGION_DEBUG + fprintf(stderr, "RGN_COPY%s [%i, %i: %i] ", (cs2d_format >= 0) ? "_2D" : "_NO2D", w, h, dst->bpps); + for(int i = 0; i < 2; ++i) + { + int gpu = i ? src_on_gpu : dst_to_gpu; + nv04_region_print(i ? src : dst); + fprintf(stderr, " %s", gpu ? "gpu" : "cpu"); + fprintf(stderr, i ? "\n" : " <- "); + } +#endif + + // if they are contiguous and either both swizzled or both linear, reshape + if(!dst->pitch == !src->pitch + && nv04_region_is_contiguous(dst, w, h) + && nv04_region_is_contiguous(src, w, h)) + { + nv04_region_contiguous_shape(dst, &w, &h, 6); + nv04_region_linearize_contiguous(dst, w, h); + nv04_region_linearize_contiguous(src, w, h); + } + +#ifdef NV04_REGION_DEBUG + fprintf(stderr, "\tOPT "); + for(int i = 0; i < 2; ++i) + { + nv04_region_print(i ? src : dst); + fprintf(stderr, i ? "\n" : " <- "); + } +#endif + + /* if the destination is not for GPU _and_ source is on CPU, use CPU */ + /* if the destination is not for GPU _or_ source is on CPU, use CPU only if we think it's faster than the GPU */ + /* TODO: benchmark to find out in which cases exactly we should prefer the CPU */ + if((!dst_to_gpu && !src_on_gpu) + || (!dst->pitch && dst->d > 1) + /* 3D swizzled destination are unwritable by the GPU, and 2D swizzled ones are readable only by the 3D engine */ + ) + return -1; + /* there is no known way to read 2D/3D-swizzled surfaces with the 2D engine + * ask the caller to use the 3D engine + * If a format cannot be sampled from the 3D engine there is no point in making it swizzled, so we must not do so + */ + else if(!src->pitch) + { +#ifdef NV04_REGION_DEBUG + fprintf(stderr, "\tCOPY_ENG3D\n"); +#endif + return 1; + } + /* Setup transfer to swizzle the texture to vram if needed */ + else + { + if (!dst->pitch) + { + if(cs2d_format < 0 || sifm_format < 0 || !dst_to_gpu) + { +#ifdef NV04_REGION_DEBUG + fprintf(stderr, "\tCOPY_ENG3D\n"); +#endif + return 1; + } + else + { + assert(!nv04_region_align(dst, w, h, 6)); + + nv04_region_copy_swizzle(ctx, dst, src, w, h, cs2d_format, sifm_format); + return 0; + } + } + else + { + /* NV_CONTEXT_SURFACES_2D has buffer alignment restrictions, fallback + * to NV_MEMORY_TO_MEMORY_FORMAT in this case. + * TODO: is this also true for the source? possibly not + */ + + if ((cs2d_format < 0) + || !dst_to_gpu + || nv04_region_align(src, w, h, 6) + || nv04_region_align(dst, w, h, 6) + ) + nv04_region_copy_m2mf(ctx, dst, src, w, h); + else + nv04_region_copy_blit(ctx, dst, src, w, h, cs2d_format); + + return 0; + } + } +} + +static inline void +nv04_region_fill_gdirect(struct nv04_2d_context *ctx, struct nv04_region* dst, int w, int h, unsigned value) +{ + struct nouveau_channel *chan = ctx->surf2d->channel; + struct nouveau_grobj *surf2d = ctx->surf2d; + struct nouveau_grobj *rect = ctx->rect; + int cs2d_format, gdirect_format; + +#ifdef NV04_REGION_DEBUG + fprintf(stderr, "\tFILL_GDIRECT\n"); +#endif + + assert(!(dst->pitch & 63) && dst->pitch); + nv04_region_assert(dst, w, h); + + if(dst->bpps == 0) + { + gdirect_format = NV04_GDI_RECTANGLE_TEXT_COLOR_FORMAT_A8R8G8B8; + cs2d_format = NV04_CONTEXT_SURFACES_2D_FORMAT_Y8; + } + else if(dst->bpps == 1) + { + gdirect_format = NV04_GDI_RECTANGLE_TEXT_COLOR_FORMAT_A16R5G6B5; + cs2d_format = NV04_CONTEXT_SURFACES_2D_FORMAT_Y16; + } + else if(dst->bpps == 2) + { + gdirect_format = NV04_GDI_RECTANGLE_TEXT_COLOR_FORMAT_A8R8G8B8; + cs2d_format = NV04_CONTEXT_SURFACES_2D_FORMAT_Y32; + } + else + assert(0); + + MARK_RING (chan, 15, 4); + BEGIN_RING(chan, surf2d, NV04_CONTEXT_SURFACES_2D_DMA_IMAGE_SOURCE, 2); + OUT_RELOCo(chan, dst->bo, NOUVEAU_BO_VRAM | NOUVEAU_BO_WR); + OUT_RELOCo(chan, dst->bo, NOUVEAU_BO_VRAM | NOUVEAU_BO_WR); + BEGIN_RING(chan, surf2d, NV04_CONTEXT_SURFACES_2D_FORMAT, 4); + OUT_RING (chan, cs2d_format); + OUT_RING (chan, (dst->pitch << 16) | dst->pitch); + OUT_RELOCl(chan, dst->bo, dst->offset, NOUVEAU_BO_VRAM | NOUVEAU_BO_WR); + OUT_RELOCl(chan, dst->bo, dst->offset, NOUVEAU_BO_VRAM | NOUVEAU_BO_WR); + + BEGIN_RING(chan, rect, NV04_GDI_RECTANGLE_TEXT_COLOR_FORMAT, 1); + OUT_RING (chan, gdirect_format); + BEGIN_RING(chan, rect, NV04_GDI_RECTANGLE_TEXT_COLOR1_A, 1); + OUT_RING (chan, value); + BEGIN_RING(chan, rect, NV04_GDI_RECTANGLE_TEXT_UNCLIPPED_RECTANGLE_POINT(0), 2); + OUT_RING (chan, (dst->x << 16) | dst->y); + OUT_RING (chan, ( w << 16) | h); +} + +int +nv04_region_fill_2d(struct nv04_2d_context *ctx, struct nv04_region *dst, + int w, int h, unsigned value) +{ + if(!w || !h) + return 0; + +#ifdef NV04_REGION_DEBUG + fprintf(stderr, "FILL [%i, %i: %i] ", w, h, dst->bpps); + nv04_region_print(dst); + fprintf(stderr, " <- 0x%x\n", value); +#endif + + if(nv04_region_is_contiguous(dst, w, h)) + { + nv04_region_contiguous_shape(dst, &w, &h, 6); + nv04_region_linearize_contiguous(dst, w, h); + } + + // TODO: maybe do intermediate copies for some cases instead of using the 3D engine/CPU + /* GdiRect doesn't work together with swzsurf, so the 3D engine, or an intermediate copy, is the only option here */ + if(!dst->pitch) + { +#ifdef NV04_REGION_DEBUG + fprintf(stderr, "\tFILL_ENG3D\n"); +#endif + return 1; + } + else if(!nv04_region_align(dst, w, h, 6)) + { + nv04_region_fill_gdirect(ctx, dst, w, h, value); + return 0; + } + else + return -1; +} + + +void +nv04_2d_context_takedown(struct nv04_2d_context *ctx) +{ + nouveau_notifier_free(&ctx->ntfy); + nouveau_grobj_free(&ctx->m2mf); + nouveau_grobj_free(&ctx->surf2d); + nouveau_grobj_free(&ctx->swzsurf); + nouveau_grobj_free(&ctx->rect); + nouveau_grobj_free(&ctx->blit); + nouveau_grobj_free(&ctx->sifm); + + free(ctx); +} + +struct nv04_2d_context * +nv04_2d_context_init(struct nouveau_channel* chan) +{ + struct nv04_2d_context *ctx = calloc(1, sizeof(struct nv04_2d_context)); + unsigned handle = 0x88000000, class; + int ret; + + if (!ctx) + return NULL; + + ret = nouveau_notifier_alloc(chan, handle++, 1, &ctx->ntfy); + if (ret) { + nv04_2d_context_takedown(ctx); + return NULL; + } + + ret = nouveau_grobj_alloc(chan, handle++, 0x0039, &ctx->m2mf); + if (ret) { + nv04_2d_context_takedown(ctx); + return NULL; + } + + BEGIN_RING(chan, ctx->m2mf, NV04_MEMORY_TO_MEMORY_FORMAT_DMA_NOTIFY, 1); + OUT_RING (chan, ctx->ntfy->handle); + + if (chan->device->chipset < 0x10) + class = NV04_CONTEXT_SURFACES_2D; + else + class = NV10_CONTEXT_SURFACES_2D; + + ret = nouveau_grobj_alloc(chan, handle++, class, &ctx->surf2d); + if (ret) { + nv04_2d_context_takedown(ctx); + return NULL; + } + + BEGIN_RING(chan, ctx->surf2d, + NV04_CONTEXT_SURFACES_2D_DMA_IMAGE_SOURCE, 2); + OUT_RING (chan, chan->vram->handle); + OUT_RING (chan, chan->vram->handle); + + if (chan->device->chipset < 0x10) + class = NV04_IMAGE_BLIT; + else + class = NV12_IMAGE_BLIT; + + ret = nouveau_grobj_alloc(chan, handle++, class, &ctx->blit); + if (ret) { + nv04_2d_context_takedown(ctx); + return NULL; + } + + BEGIN_RING(chan, ctx->blit, NV01_IMAGE_BLIT_DMA_NOTIFY, 1); + OUT_RING (chan, ctx->ntfy->handle); + BEGIN_RING(chan, ctx->blit, NV04_IMAGE_BLIT_SURFACE, 1); + OUT_RING (chan, ctx->surf2d->handle); + BEGIN_RING(chan, ctx->blit, NV01_IMAGE_BLIT_OPERATION, 1); + OUT_RING (chan, NV01_IMAGE_BLIT_OPERATION_SRCCOPY); + + ret = nouveau_grobj_alloc(chan, handle++, NV04_GDI_RECTANGLE_TEXT, + &ctx->rect); + if (ret) { + nv04_2d_context_takedown(ctx); + return NULL; + } + + BEGIN_RING(chan, ctx->rect, NV04_GDI_RECTANGLE_TEXT_DMA_NOTIFY, 1); + OUT_RING (chan, ctx->ntfy->handle); + BEGIN_RING(chan, ctx->rect, NV04_GDI_RECTANGLE_TEXT_SURFACE, 1); + OUT_RING (chan, ctx->surf2d->handle); + BEGIN_RING(chan, ctx->rect, NV04_GDI_RECTANGLE_TEXT_OPERATION, 1); + OUT_RING (chan, NV04_GDI_RECTANGLE_TEXT_OPERATION_SRCCOPY); + BEGIN_RING(chan, ctx->rect, + NV04_GDI_RECTANGLE_TEXT_MONOCHROME_FORMAT, 1); + OUT_RING (chan, NV04_GDI_RECTANGLE_TEXT_MONOCHROME_FORMAT_LE); + + switch (chan->device->chipset & 0xf0) { + case 0x00: + case 0x10: + class = NV04_SWIZZLED_SURFACE; + break; + case 0x20: + class = NV20_SWIZZLED_SURFACE; + break; + case 0x30: + class = NV30_SWIZZLED_SURFACE; + break; + case 0x40: + case 0x60: + class = NV40_SWIZZLED_SURFACE; + break; + default: + /* Famous last words: this really can't happen.. */ + assert(0); + break; + } + + ret = nouveau_grobj_alloc(chan, handle++, class, &ctx->swzsurf); + if (ret) { + nv04_2d_context_takedown(ctx); + return NULL; + } + + /* all the Gallium MARK_RING calculations assume no autobinding, so do that now */ + if(ctx->swzsurf->bound == NOUVEAU_GROBJ_UNBOUND) + nouveau_grobj_autobind(ctx->swzsurf); + + switch (chan->device->chipset & 0xf0) { + case 0x10: + case 0x20: + class = NV10_SCALED_IMAGE_FROM_MEMORY; + break; + case 0x30: + class = NV30_SCALED_IMAGE_FROM_MEMORY; + break; + case 0x40: + case 0x60: + class = NV40_SCALED_IMAGE_FROM_MEMORY; + break; + default: + class = NV04_SCALED_IMAGE_FROM_MEMORY; + break; + } + + ret = nouveau_grobj_alloc(chan, handle++, class, &ctx->sifm); + if (ret) { + nv04_2d_context_takedown(ctx); + return NULL; + } + + /* all the Gallium MARK_RING calculations assume no autobinding, so do that now */ + if(ctx->sifm->bound == NOUVEAU_GROBJ_UNBOUND) + nouveau_grobj_autobind(ctx->sifm); + + return ctx; +} diff --git a/src/gallium/drivers/nvfx/nv04_2d.h b/src/gallium/drivers/nvfx/nv04_2d.h new file mode 100644 index 0000000000..e638b8c874 --- /dev/null +++ b/src/gallium/drivers/nvfx/nv04_2d.h @@ -0,0 +1,87 @@ +/************************************************************************** + * + * Copyright 2009 Ben Skeggs + * Copyright 2009 Younes Manton + * Copyright 2010 Luca Barbieri + * 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, 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 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 THE COPYRIGHT HOLDERS, AUTHORS + * AND/OR ITS 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. + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + **************************************************************************/ + +/* this code has no Mesa or Gallium dependency and can be reused in the classic Mesa driver or DDX */ + +#ifndef __NV04_2D_H__ +#define __NV04_2D_H__ + +struct nv04_2d_context; +struct nouveau_channel; +struct nouveau_bo; + +// NOTE: all functions taking this as a parameter will CLOBBER it (except for ->bo) +struct nv04_region { + struct nouveau_bo* bo; + int offset; + unsigned pitch; // 0 -> swizzled + unsigned bpps; // bpp shift (0, 1, 2; 3, 4 for fp/compressed) + unsigned x, y, z; + unsigned w, h, d; +}; + +void +nv04_memcpy(struct nv04_2d_context *ctx, + struct nouveau_bo* dstbo, int dstoff, + struct nouveau_bo* srcbo, int srcoff, + unsigned size); + +unsigned +nv04_region_begin(struct nv04_region* rgn, unsigned w, unsigned h); + +unsigned +nv04_region_end(struct nv04_region* rgn, unsigned w, unsigned h); + +void +nv04_2d_context_takedown(struct nv04_2d_context *pctx); + +struct nv04_2d_context * +nv04_2d_context_init(struct nouveau_channel* chan); + +void +nv04_region_copy_cpu(struct nv04_region* dst, struct nv04_region* src, int w, int h); + +void +nv04_region_fill_cpu(struct nv04_region* dst, int w, int h, unsigned value); + +int +nv04_region_copy_2d(struct nv04_2d_context *ctx, + struct nv04_region* dst, struct nv04_region* src, + int w, int h, + int cs2d_format, int sifm_format, + int dst_to_gpu, int src_on_gpu); + +int +nv04_region_fill_2d(struct nv04_2d_context *ctx, + struct nv04_region *dst, + int w, int h, + unsigned value); + +#endif diff --git a/src/gallium/drivers/nvfx/nv04_2d_loops.h b/src/gallium/drivers/nvfx/nv04_2d_loops.h new file mode 100644 index 0000000000..3a6787c071 --- /dev/null +++ b/src/gallium/drivers/nvfx/nv04_2d_loops.h @@ -0,0 +1,70 @@ +#ifndef T +{ + if(dst->bpps == 0) +#define T uint8_t +#include "nv04_2d_loops.h" +#undef T + else if(dst->bpps == 1) +#define T uint16_t +#include "nv04_2d_loops.h" +#undef T + else if(dst->bpps == 2) +#define T uint32_t +#include "nv04_2d_loops.h" +#undef T + else + assert(0); +} +#else +#ifdef SWIZZLED_COPY_LOOPS +{ + if(!dst->pitch) + { + if(!src->pitch) + { + LOOP_Y + { + T* pdst = (T*)mdst + dswy[iy]; + T* psrc = (T*)msrc + sswy[iy]; + LOOP_X + { + assert((char*)&psrc[sswx[ix] + 1] <= ((char*)src->bo->map + src->bo->size)); + assert((char*)&pdst[dswx[ix] + 1] <= ((char*)dst->bo->map + dst->bo->size)); + pdst[dswx[ix]] = psrc[sswx[ix]]; + } + } + } + else + { + T* psrc = (T*)(msrc + ((dir > 0) ? src->y : (src->y + h - 1)) * src->pitch) + src->x; + LOOP_Y + { + T* pdst = (T*)mdst + dswy[iy]; + LOOP_X + { + assert((char*)&psrc[ix + 1] <= ((char*)src->bo->map + src->bo->size)); + assert((char*)&pdst[dswx[ix] + 1] <= ((char*)dst->bo->map + dst->bo->size)); + pdst[dswx[ix]] = psrc[ix]; + } + psrc = (T*)((char*)psrc + dir * src->pitch); + } + } + } + else + { + T* pdst = (T*)(mdst + ((dir > 0) ? dst->y : (dst->y + h - 1)) * dst->pitch) + dst->x; + LOOP_Y + { + T* psrc = (T*)msrc + sswy[iy]; + LOOP_X + { + assert((char*)&psrc[sswx[ix] + 1] <= ((char*)src->bo->map + src->bo->size)); + assert((char*)&pdst[ix + 1] <= ((char*)dst->bo->map + dst->bo->size)); + pdst[ix] = psrc[sswx[ix]]; + } + pdst = (T*)((char*)pdst + dir * dst->pitch); + } + } +} +#endif +#endif -- cgit v1.2.3 From 9ed0686e8e6157ce38c9fa284cd7399289a2e698 Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Tue, 3 Aug 2010 06:24:22 +0200 Subject: nvfx: new 2D: use new 2D engine in Gallium This patch implements nv04_surface_copy/fill using the new 2D engine module. It supports falling back to the 3D engine using the u_blitter module, which will be added in a later patch. Also adds support for using the 3D engine, reusing the u_blitter module created for r300. This is used for unswizzling and copies between swizzled surfaces. --- src/gallium/drivers/nvfx/Makefile | 1 - src/gallium/drivers/nvfx/nv04_surface_2d.c | 533 ----------------------------- src/gallium/drivers/nvfx/nv04_surface_2d.h | 41 --- src/gallium/drivers/nvfx/nvfx_context.h | 2 + src/gallium/drivers/nvfx/nvfx_miptree.c | 16 +- src/gallium/drivers/nvfx/nvfx_resource.h | 5 + src/gallium/drivers/nvfx/nvfx_screen.c | 6 +- src/gallium/drivers/nvfx/nvfx_screen.h | 10 +- src/gallium/drivers/nvfx/nvfx_state_fb.c | 6 +- src/gallium/drivers/nvfx/nvfx_surface.c | 346 +++++++++++++++++-- 10 files changed, 340 insertions(+), 626 deletions(-) delete mode 100644 src/gallium/drivers/nvfx/nv04_surface_2d.c delete mode 100644 src/gallium/drivers/nvfx/nv04_surface_2d.h (limited to 'src') diff --git a/src/gallium/drivers/nvfx/Makefile b/src/gallium/drivers/nvfx/Makefile index 6536343e44..2834f8984c 100644 --- a/src/gallium/drivers/nvfx/Makefile +++ b/src/gallium/drivers/nvfx/Makefile @@ -4,7 +4,6 @@ include $(TOP)/configs/current LIBNAME = nvfx C_SOURCES = \ - nv04_surface_2d.c \ nv04_2d.c \ nvfx_buffer.c \ nvfx_context.c \ diff --git a/src/gallium/drivers/nvfx/nv04_surface_2d.c b/src/gallium/drivers/nvfx/nv04_surface_2d.c deleted file mode 100644 index cd0f4ce4c9..0000000000 --- a/src/gallium/drivers/nvfx/nv04_surface_2d.c +++ /dev/null @@ -1,533 +0,0 @@ -#include "pipe/p_context.h" -#include "pipe/p_format.h" -#include "util/u_format.h" -#include "util/u_math.h" -#include "util/u_memory.h" - -#include "nouveau/nouveau_winsys.h" -#include "nouveau/nouveau_util.h" -#include "nouveau/nouveau_screen.h" -#include "nv04_surface_2d.h" -#include "nvfx_resource.h" - -static INLINE int -nv04_surface_format(enum pipe_format format) -{ - switch (format) { - case PIPE_FORMAT_A8_UNORM: - case PIPE_FORMAT_L8_UNORM: - case PIPE_FORMAT_I8_UNORM: - return NV04_CONTEXT_SURFACES_2D_FORMAT_Y8; - case PIPE_FORMAT_R16_SNORM: - case PIPE_FORMAT_B5G6R5_UNORM: - case PIPE_FORMAT_Z16_UNORM: - case PIPE_FORMAT_L8A8_UNORM: - return NV04_CONTEXT_SURFACES_2D_FORMAT_R5G6B5; - case PIPE_FORMAT_B8G8R8X8_UNORM: - case PIPE_FORMAT_B8G8R8A8_UNORM: - return NV04_CONTEXT_SURFACES_2D_FORMAT_A8R8G8B8; - case PIPE_FORMAT_S8_USCALED_Z24_UNORM: - case PIPE_FORMAT_X8Z24_UNORM: - return NV04_CONTEXT_SURFACES_2D_FORMAT_Y32; - default: - return -1; - } -} - -static INLINE int -nv04_rect_format(enum pipe_format format) -{ - switch (format) { - case PIPE_FORMAT_A8_UNORM: - return NV04_GDI_RECTANGLE_TEXT_COLOR_FORMAT_A8R8G8B8; - case PIPE_FORMAT_B5G6R5_UNORM: - case PIPE_FORMAT_L8A8_UNORM: - case PIPE_FORMAT_Z16_UNORM: - return NV04_GDI_RECTANGLE_TEXT_COLOR_FORMAT_A16R5G6B5; - case PIPE_FORMAT_B8G8R8X8_UNORM: - case PIPE_FORMAT_B8G8R8A8_UNORM: - case PIPE_FORMAT_S8_USCALED_Z24_UNORM: - case PIPE_FORMAT_X8Z24_UNORM: - return NV04_GDI_RECTANGLE_TEXT_COLOR_FORMAT_A8R8G8B8; - default: - return -1; - } -} - -static INLINE int -nv04_scaled_image_format(enum pipe_format format) -{ - switch (format) { - case PIPE_FORMAT_A8_UNORM: - case PIPE_FORMAT_L8_UNORM: - case PIPE_FORMAT_I8_UNORM: - return NV03_SCALED_IMAGE_FROM_MEMORY_COLOR_FORMAT_Y8; - case PIPE_FORMAT_B5G5R5A1_UNORM: - return NV03_SCALED_IMAGE_FROM_MEMORY_COLOR_FORMAT_A1R5G5B5; - case PIPE_FORMAT_B8G8R8A8_UNORM: - return NV03_SCALED_IMAGE_FROM_MEMORY_COLOR_FORMAT_A8R8G8B8; - case PIPE_FORMAT_B8G8R8X8_UNORM: - return NV03_SCALED_IMAGE_FROM_MEMORY_COLOR_FORMAT_X8R8G8B8; - case PIPE_FORMAT_B5G6R5_UNORM: - case PIPE_FORMAT_R16_SNORM: - case PIPE_FORMAT_L8A8_UNORM: - return NV03_SCALED_IMAGE_FROM_MEMORY_COLOR_FORMAT_R5G6B5; - default: - return -1; - } -} - -static INLINE unsigned -nv04_swizzle_bits_square(unsigned x, unsigned y) -{ - unsigned u = (x & 0x001) << 0 | - (x & 0x002) << 1 | - (x & 0x004) << 2 | - (x & 0x008) << 3 | - (x & 0x010) << 4 | - (x & 0x020) << 5 | - (x & 0x040) << 6 | - (x & 0x080) << 7 | - (x & 0x100) << 8 | - (x & 0x200) << 9 | - (x & 0x400) << 10 | - (x & 0x800) << 11; - - unsigned v = (y & 0x001) << 1 | - (y & 0x002) << 2 | - (y & 0x004) << 3 | - (y & 0x008) << 4 | - (y & 0x010) << 5 | - (y & 0x020) << 6 | - (y & 0x040) << 7 | - (y & 0x080) << 8 | - (y & 0x100) << 9 | - (y & 0x200) << 10 | - (y & 0x400) << 11 | - (y & 0x800) << 12; - return v | u; -} - -/* rectangular swizzled textures are linear concatenations of swizzled square tiles */ -static INLINE unsigned -nv04_swizzle_bits(unsigned x, unsigned y, unsigned w, unsigned h) -{ - unsigned s = MIN2(w, h); - unsigned m = s - 1; - return (((x | y) & ~m) * s) | nv04_swizzle_bits_square(x & m, y & m); -} - -static int -nv04_surface_copy_swizzle(struct nv04_surface_2d *ctx, - struct pipe_surface *dst, int dx, int dy, - struct pipe_surface *src, int sx, int sy, - int w, int h) -{ - struct nouveau_channel *chan = ctx->swzsurf->channel; - struct nouveau_grobj *swzsurf = ctx->swzsurf; - struct nouveau_grobj *sifm = ctx->sifm; - struct nouveau_bo *src_bo = ctx->buf(src); - struct nouveau_bo *dst_bo = ctx->buf(dst); - const unsigned src_pitch = ((struct nv04_surface *)src)->pitch; - /* Max width & height may not be the same on all HW, but must be POT */ - const unsigned max_w = 1024; - const unsigned max_h = 1024; - unsigned sub_w = w > max_w ? max_w : w; - unsigned sub_h = h > max_h ? max_h : h; - unsigned x; - unsigned y; - - /* Swizzled surfaces must be POT */ - assert(util_is_pot(dst->width) && util_is_pot(dst->height)); - - /* If area is too large to copy in one shot we must copy it in POT chunks to meet alignment requirements */ - assert(sub_w == w || util_is_pot(sub_w)); - assert(sub_h == h || util_is_pot(sub_h)); - - MARK_RING (chan, 8 + ((w+sub_w)/sub_w)*((h+sub_h)/sub_h)*17, 2 + - ((w+sub_w)/sub_w)*((h+sub_h)/sub_h)*2); - - BEGIN_RING(chan, swzsurf, NV04_SWIZZLED_SURFACE_DMA_IMAGE, 1); - OUT_RELOCo(chan, dst_bo, - NOUVEAU_BO_VRAM | NOUVEAU_BO_WR); - - BEGIN_RING(chan, swzsurf, NV04_SWIZZLED_SURFACE_FORMAT, 1); - OUT_RING (chan, nv04_surface_format(dst->format) | - log2i(dst->width) << NV04_SWIZZLED_SURFACE_FORMAT_BASE_SIZE_U_SHIFT | - log2i(dst->height) << NV04_SWIZZLED_SURFACE_FORMAT_BASE_SIZE_V_SHIFT); - - BEGIN_RING(chan, sifm, NV03_SCALED_IMAGE_FROM_MEMORY_DMA_IMAGE, 1); - OUT_RELOCo(chan, src_bo, - NOUVEAU_BO_GART | NOUVEAU_BO_VRAM | NOUVEAU_BO_RD); - BEGIN_RING(chan, sifm, NV04_SCALED_IMAGE_FROM_MEMORY_SURFACE, 1); - OUT_RING (chan, swzsurf->handle); - - for (y = 0; y < h; y += sub_h) { - sub_h = MIN2(sub_h, h - y); - - for (x = 0; x < w; x += sub_w) { - sub_w = MIN2(sub_w, w - x); - - assert(!(dst->offset & 63)); - - BEGIN_RING(chan, swzsurf, NV04_SWIZZLED_SURFACE_OFFSET, 1); - OUT_RELOCl(chan, dst_bo, dst->offset, - NOUVEAU_BO_VRAM | NOUVEAU_BO_WR); - - BEGIN_RING(chan, sifm, NV05_SCALED_IMAGE_FROM_MEMORY_COLOR_CONVERSION, 9); - OUT_RING (chan, NV05_SCALED_IMAGE_FROM_MEMORY_COLOR_CONVERSION_TRUNCATE); - OUT_RING (chan, nv04_scaled_image_format(src->format)); - OUT_RING (chan, NV03_SCALED_IMAGE_FROM_MEMORY_OPERATION_SRCCOPY); - OUT_RING (chan, (x + dx) | ((y + dy) << NV03_SCALED_IMAGE_FROM_MEMORY_CLIP_POINT_Y_SHIFT)); - OUT_RING (chan, sub_h << NV03_SCALED_IMAGE_FROM_MEMORY_CLIP_SIZE_H_SHIFT | sub_w); - OUT_RING (chan, (x + dx) | ((y + dy) << NV03_SCALED_IMAGE_FROM_MEMORY_OUT_POINT_Y_SHIFT)); - OUT_RING (chan, sub_h << NV03_SCALED_IMAGE_FROM_MEMORY_OUT_SIZE_H_SHIFT | sub_w); - OUT_RING (chan, 1 << 20); - OUT_RING (chan, 1 << 20); - - BEGIN_RING(chan, sifm, NV03_SCALED_IMAGE_FROM_MEMORY_SIZE, 4); - OUT_RING (chan, sub_h << NV03_SCALED_IMAGE_FROM_MEMORY_SIZE_H_SHIFT | sub_w); - OUT_RING (chan, src_pitch | - NV03_SCALED_IMAGE_FROM_MEMORY_FORMAT_ORIGIN_CENTER | - NV03_SCALED_IMAGE_FROM_MEMORY_FORMAT_FILTER_POINT_SAMPLE); - OUT_RELOCl(chan, src_bo, src->offset + (sy+y) * src_pitch + (sx+x) * util_format_get_blocksize(src->texture->format), - NOUVEAU_BO_GART | NOUVEAU_BO_VRAM | NOUVEAU_BO_RD); - OUT_RING (chan, 0); - } - } - - return 0; -} - -static int -nv04_surface_copy_m2mf(struct nv04_surface_2d *ctx, - struct pipe_surface *dst, int dx, int dy, - struct pipe_surface *src, int sx, int sy, int w, int h) -{ - struct nouveau_channel *chan = ctx->m2mf->channel; - struct nouveau_grobj *m2mf = ctx->m2mf; - struct nouveau_bo *src_bo = ctx->buf(src); - struct nouveau_bo *dst_bo = ctx->buf(dst); - unsigned src_pitch = ((struct nv04_surface *)src)->pitch; - unsigned dst_pitch = ((struct nv04_surface *)dst)->pitch; - unsigned dst_offset = dst->offset + dy * dst_pitch + - dx * util_format_get_blocksize(dst->texture->format); - unsigned src_offset = src->offset + sy * src_pitch + - sx * util_format_get_blocksize(src->texture->format); - - MARK_RING (chan, 3 + ((h / 2047) + 1) * 9, 2 + ((h / 2047) + 1) * 2); - BEGIN_RING(chan, m2mf, NV04_MEMORY_TO_MEMORY_FORMAT_DMA_BUFFER_IN, 2); - OUT_RELOCo(chan, src_bo, - NOUVEAU_BO_GART | NOUVEAU_BO_VRAM | NOUVEAU_BO_RD); - OUT_RELOCo(chan, dst_bo, - NOUVEAU_BO_GART | NOUVEAU_BO_VRAM | NOUVEAU_BO_WR); - - while (h) { - int count = (h > 2047) ? 2047 : h; - - BEGIN_RING(chan, m2mf, NV04_MEMORY_TO_MEMORY_FORMAT_OFFSET_IN, 8); - OUT_RELOCl(chan, src_bo, src_offset, - NOUVEAU_BO_VRAM | NOUVEAU_BO_GART | NOUVEAU_BO_RD); - OUT_RELOCl(chan, dst_bo, dst_offset, - NOUVEAU_BO_VRAM | NOUVEAU_BO_GART | NOUVEAU_BO_WR); - OUT_RING (chan, src_pitch); - OUT_RING (chan, dst_pitch); - OUT_RING (chan, w * util_format_get_blocksize(src->texture->format)); - OUT_RING (chan, count); - OUT_RING (chan, 0x0101); - OUT_RING (chan, 0); - - h -= count; - src_offset += src_pitch * count; - dst_offset += dst_pitch * count; - } - - return 0; -} - -static int -nv04_surface_copy_blit(struct nv04_surface_2d *ctx, struct pipe_surface *dst, - int dx, int dy, struct pipe_surface *src, int sx, int sy, - int w, int h) -{ - struct nouveau_channel *chan = ctx->surf2d->channel; - struct nouveau_grobj *surf2d = ctx->surf2d; - struct nouveau_grobj *blit = ctx->blit; - struct nouveau_bo *src_bo = ctx->buf(src); - struct nouveau_bo *dst_bo = ctx->buf(dst); - unsigned src_pitch = ((struct nv04_surface *)src)->pitch; - unsigned dst_pitch = ((struct nv04_surface *)dst)->pitch; - int format; - - format = nv04_surface_format(dst->format); - if (format < 0) - return 1; - - MARK_RING (chan, 12, 4); - BEGIN_RING(chan, surf2d, NV04_CONTEXT_SURFACES_2D_DMA_IMAGE_SOURCE, 2); - OUT_RELOCo(chan, src_bo, NOUVEAU_BO_VRAM | NOUVEAU_BO_RD); - OUT_RELOCo(chan, dst_bo, NOUVEAU_BO_VRAM | NOUVEAU_BO_WR); - BEGIN_RING(chan, surf2d, NV04_CONTEXT_SURFACES_2D_FORMAT, 4); - OUT_RING (chan, format); - OUT_RING (chan, (dst_pitch << 16) | src_pitch); - OUT_RELOCl(chan, src_bo, src->offset, NOUVEAU_BO_VRAM | NOUVEAU_BO_RD); - OUT_RELOCl(chan, dst_bo, dst->offset, NOUVEAU_BO_VRAM | NOUVEAU_BO_WR); - - BEGIN_RING(chan, blit, 0x0300, 3); - OUT_RING (chan, (sy << 16) | sx); - OUT_RING (chan, (dy << 16) | dx); - OUT_RING (chan, ( h << 16) | w); - - return 0; -} - -static void -nv04_surface_copy(struct nv04_surface_2d *ctx, struct pipe_surface *dst, - int dx, int dy, struct pipe_surface *src, int sx, int sy, - int w, int h) -{ - int src_linear = src->texture->flags & NVFX_RESOURCE_FLAG_LINEAR; - int dst_linear = dst->texture->flags & NVFX_RESOURCE_FLAG_LINEAR; - - assert(src->format == dst->format); - - /* Setup transfer to swizzle the texture to vram if needed */ - if (src_linear && !dst_linear && w > 1 && h > 1) { - nv04_surface_copy_swizzle(ctx, dst, dx, dy, src, sx, sy, w, h); - return; - } - - /* Use M2MF instead of the blitter since it always works - * Any possible performance drop is likely to be not very significant - * and dwarfed anyway by the current buffer management problems - */ - nv04_surface_copy_m2mf(ctx, dst, dx, dy, src, sx, sy, w, h); -} - -static void -nv04_surface_fill(struct nv04_surface_2d *ctx, struct pipe_surface *dst, - int dx, int dy, int w, int h, unsigned value) -{ - struct nouveau_channel *chan = ctx->surf2d->channel; - struct nouveau_grobj *surf2d = ctx->surf2d; - struct nouveau_grobj *rect = ctx->rect; - struct nouveau_bo *dst_bo = ctx->buf(dst); - unsigned dst_pitch = ((struct nv04_surface *)dst)->pitch; - int cs2d_format, gdirect_format; - - cs2d_format = nv04_surface_format(dst->format); - assert(cs2d_format >= 0); - - gdirect_format = nv04_rect_format(dst->format); - assert(gdirect_format >= 0); - - MARK_RING (chan, 16, 4); - BEGIN_RING(chan, surf2d, NV04_CONTEXT_SURFACES_2D_DMA_IMAGE_SOURCE, 2); - OUT_RELOCo(chan, dst_bo, NOUVEAU_BO_VRAM | NOUVEAU_BO_WR); - OUT_RELOCo(chan, dst_bo, NOUVEAU_BO_VRAM | NOUVEAU_BO_WR); - BEGIN_RING(chan, surf2d, NV04_CONTEXT_SURFACES_2D_FORMAT, 4); - OUT_RING (chan, cs2d_format); - OUT_RING (chan, (dst_pitch << 16) | dst_pitch); - OUT_RELOCl(chan, dst_bo, dst->offset, NOUVEAU_BO_VRAM | NOUVEAU_BO_WR); - OUT_RELOCl(chan, dst_bo, dst->offset, NOUVEAU_BO_VRAM | NOUVEAU_BO_WR); - - BEGIN_RING(chan, rect, NV04_GDI_RECTANGLE_TEXT_COLOR_FORMAT, 1); - OUT_RING (chan, gdirect_format); - BEGIN_RING(chan, rect, NV04_GDI_RECTANGLE_TEXT_COLOR1_A, 1); - OUT_RING (chan, value); - BEGIN_RING(chan, rect, - NV04_GDI_RECTANGLE_TEXT_UNCLIPPED_RECTANGLE_POINT(0), 2); - OUT_RING (chan, (dx << 16) | dy); - OUT_RING (chan, ( w << 16) | h); -} - -void -nv04_surface_2d_takedown(struct nv04_surface_2d **pctx) -{ - struct nv04_surface_2d *ctx; - - if (!pctx || !*pctx) - return; - ctx = *pctx; - *pctx = NULL; - - nouveau_notifier_free(&ctx->ntfy); - nouveau_grobj_free(&ctx->m2mf); - nouveau_grobj_free(&ctx->surf2d); - nouveau_grobj_free(&ctx->swzsurf); - nouveau_grobj_free(&ctx->rect); - nouveau_grobj_free(&ctx->blit); - nouveau_grobj_free(&ctx->sifm); - - FREE(ctx); -} - -struct nv04_surface_2d * -nv04_surface_2d_init(struct nouveau_screen *screen) -{ - struct nv04_surface_2d *ctx = CALLOC_STRUCT(nv04_surface_2d); - struct nouveau_channel *chan = screen->channel; - unsigned handle = 0x88000000, class; - int ret; - - if (!ctx) - return NULL; - - ret = nouveau_notifier_alloc(chan, handle++, 1, &ctx->ntfy); - if (ret) { - nv04_surface_2d_takedown(&ctx); - return NULL; - } - - ret = nouveau_grobj_alloc(chan, handle++, 0x0039, &ctx->m2mf); - if (ret) { - nv04_surface_2d_takedown(&ctx); - return NULL; - } - - BEGIN_RING(chan, ctx->m2mf, NV04_MEMORY_TO_MEMORY_FORMAT_DMA_NOTIFY, 1); - OUT_RING (chan, ctx->ntfy->handle); - - if (chan->device->chipset < 0x10) - class = NV04_CONTEXT_SURFACES_2D; - else - class = NV10_CONTEXT_SURFACES_2D; - - ret = nouveau_grobj_alloc(chan, handle++, class, &ctx->surf2d); - if (ret) { - nv04_surface_2d_takedown(&ctx); - return NULL; - } - - BEGIN_RING(chan, ctx->surf2d, - NV04_CONTEXT_SURFACES_2D_DMA_IMAGE_SOURCE, 2); - OUT_RING (chan, chan->vram->handle); - OUT_RING (chan, chan->vram->handle); - - if (chan->device->chipset < 0x10) - class = NV04_IMAGE_BLIT; - else - class = NV12_IMAGE_BLIT; - - ret = nouveau_grobj_alloc(chan, handle++, class, &ctx->blit); - if (ret) { - nv04_surface_2d_takedown(&ctx); - return NULL; - } - - BEGIN_RING(chan, ctx->blit, NV01_IMAGE_BLIT_DMA_NOTIFY, 1); - OUT_RING (chan, ctx->ntfy->handle); - BEGIN_RING(chan, ctx->blit, NV04_IMAGE_BLIT_SURFACE, 1); - OUT_RING (chan, ctx->surf2d->handle); - BEGIN_RING(chan, ctx->blit, NV01_IMAGE_BLIT_OPERATION, 1); - OUT_RING (chan, NV01_IMAGE_BLIT_OPERATION_SRCCOPY); - - ret = nouveau_grobj_alloc(chan, handle++, NV04_GDI_RECTANGLE_TEXT, - &ctx->rect); - if (ret) { - nv04_surface_2d_takedown(&ctx); - return NULL; - } - - BEGIN_RING(chan, ctx->rect, NV04_GDI_RECTANGLE_TEXT_DMA_NOTIFY, 1); - OUT_RING (chan, ctx->ntfy->handle); - BEGIN_RING(chan, ctx->rect, NV04_GDI_RECTANGLE_TEXT_SURFACE, 1); - OUT_RING (chan, ctx->surf2d->handle); - BEGIN_RING(chan, ctx->rect, NV04_GDI_RECTANGLE_TEXT_OPERATION, 1); - OUT_RING (chan, NV04_GDI_RECTANGLE_TEXT_OPERATION_SRCCOPY); - BEGIN_RING(chan, ctx->rect, - NV04_GDI_RECTANGLE_TEXT_MONOCHROME_FORMAT, 1); - OUT_RING (chan, NV04_GDI_RECTANGLE_TEXT_MONOCHROME_FORMAT_LE); - - switch (chan->device->chipset & 0xf0) { - case 0x00: - case 0x10: - class = NV04_SWIZZLED_SURFACE; - break; - case 0x20: - class = NV20_SWIZZLED_SURFACE; - break; - case 0x30: - class = NV30_SWIZZLED_SURFACE; - break; - case 0x40: - case 0x60: - class = NV40_SWIZZLED_SURFACE; - break; - default: - /* Famous last words: this really can't happen.. */ - assert(0); - break; - } - - ret = nouveau_grobj_alloc(chan, handle++, class, &ctx->swzsurf); - if (ret) { - nv04_surface_2d_takedown(&ctx); - return NULL; - } - - switch (chan->device->chipset & 0xf0) { - case 0x10: - case 0x20: - class = NV10_SCALED_IMAGE_FROM_MEMORY; - break; - case 0x30: - class = NV30_SCALED_IMAGE_FROM_MEMORY; - break; - case 0x40: - case 0x60: - class = NV40_SCALED_IMAGE_FROM_MEMORY; - break; - default: - class = NV04_SCALED_IMAGE_FROM_MEMORY; - break; - } - - ret = nouveau_grobj_alloc(chan, handle++, class, &ctx->sifm); - if (ret) { - nv04_surface_2d_takedown(&ctx); - return NULL; - } - - ctx->copy = nv04_surface_copy; - ctx->fill = nv04_surface_fill; - return ctx; -} - -struct nv04_surface* -nv04_surface_wrap_for_render(struct pipe_screen *pscreen, - struct nv04_surface_2d* eng2d, struct nv04_surface* ns) -{ - struct pipe_resource templ; - struct pipe_resource* temp_tex; - struct nv04_surface* temp_ns; - int temp_flags; - - temp_flags = ns->base.usage; - - ns->base.usage = 0; - - memset(&templ, 0, sizeof(templ)); - templ.format = ns->base.texture->format; - templ.target = PIPE_TEXTURE_2D; - templ.width0 = ns->base.width; - templ.height0 = ns->base.height; - templ.depth0 = 1; - templ.last_level = 0; - - // TODO: this is probably wrong and we should specifically handle multisampling somehow once it is implemented - templ.nr_samples = ns->base.texture->nr_samples; - - templ.bind = ns->base.texture->bind | PIPE_BIND_RENDER_TARGET; - - temp_tex = pscreen->resource_create(pscreen, &templ); - temp_ns = (struct nv04_surface*)pscreen->get_tex_surface(pscreen, temp_tex, 0, 0, 0, temp_flags); - temp_ns->backing = ns; - - if(1) /* hmm */ - eng2d->copy(eng2d, &temp_ns->backing->base, - 0, 0, &ns->base, - 0, 0, ns->base.width, ns->base.height); - - return temp_ns; -} diff --git a/src/gallium/drivers/nvfx/nv04_surface_2d.h b/src/gallium/drivers/nvfx/nv04_surface_2d.h deleted file mode 100644 index b9020dbe96..0000000000 --- a/src/gallium/drivers/nvfx/nv04_surface_2d.h +++ /dev/null @@ -1,41 +0,0 @@ -#ifndef __NV04_SURFACE_2D_H__ -#define __NV04_SURFACE_2D_H__ - -#include "pipe/p_state.h" - -struct nouveau_screen; - -struct nv04_surface { - struct pipe_surface base; - unsigned pitch; - struct nv04_surface* backing; -}; - -struct nv04_surface_2d { - struct nouveau_notifier *ntfy; - struct nouveau_grobj *surf2d; - struct nouveau_grobj *swzsurf; - struct nouveau_grobj *m2mf; - struct nouveau_grobj *rect; - struct nouveau_grobj *blit; - struct nouveau_grobj *sifm; - - struct nouveau_bo *(*buf)(struct pipe_surface *); - - void (*copy)(struct nv04_surface_2d *, struct pipe_surface *dst, - int dx, int dy, struct pipe_surface *src, int sx, int sy, - int w, int h); - void (*fill)(struct nv04_surface_2d *, struct pipe_surface *dst, - int dx, int dy, int w, int h, unsigned value); -}; - -struct nv04_surface_2d * -nv04_surface_2d_init(struct nouveau_screen *screen); - -void -nv04_surface_2d_takedown(struct nv04_surface_2d **); - -struct nv04_surface* -nv04_surface_wrap_for_render(struct pipe_screen *pscreen, struct nv04_surface_2d* eng2d, struct nv04_surface* ns); - -#endif diff --git a/src/gallium/drivers/nvfx/nvfx_context.h b/src/gallium/drivers/nvfx/nvfx_context.h index 89f94c10bd..278be94d52 100644 --- a/src/gallium/drivers/nvfx/nvfx_context.h +++ b/src/gallium/drivers/nvfx/nvfx_context.h @@ -13,6 +13,7 @@ #include "util/u_inlines.h" #include "draw/draw_vertex.h" +#include "util/u_blitter.h" #include "nouveau/nouveau_winsys.h" #include "nouveau/nouveau_gldefs.h" @@ -88,6 +89,7 @@ struct nvfx_context { unsigned is_nv4x; /* either 0 or ~0 */ struct draw_context *draw; + struct blitter_context* blitter; /* HW state derived from pipe states */ struct nvfx_state state; diff --git a/src/gallium/drivers/nvfx/nvfx_miptree.c b/src/gallium/drivers/nvfx/nvfx_miptree.c index 27bfa24b28..b8ec726624 100644 --- a/src/gallium/drivers/nvfx/nvfx_miptree.c +++ b/src/gallium/drivers/nvfx/nvfx_miptree.c @@ -8,8 +8,7 @@ #include "state_tracker/drm_driver.h" #include "nouveau/nouveau_winsys.h" #include "nouveau/nouveau_screen.h" -#include "nv04_surface_2d.h" -#include "nvfx_context.h" +#include "nvfx_screen.h" #include "nvfx_resource.h" #include "nvfx_transfer.h" @@ -231,9 +230,9 @@ nvfx_miptree_surface_new(struct pipe_screen *pscreen, struct pipe_resource *pt, unsigned face, unsigned level, unsigned zslice, unsigned flags) { - struct nv04_surface *ns; + struct nvfx_surface *ns; - ns = CALLOC_STRUCT(nv04_surface); + ns = CALLOC_STRUCT(nvfx_surface); if (!ns) return NULL; pipe_resource_reference(&ns->base.texture, pt); @@ -254,15 +253,6 @@ nvfx_miptree_surface_new(struct pipe_screen *pscreen, struct pipe_resource *pt, void nvfx_miptree_surface_del(struct pipe_surface *ps) { - struct nv04_surface* ns = (struct nv04_surface*)ps; - if(ns->backing) - { - struct nvfx_screen* screen = (struct nvfx_screen*)ps->texture->screen; - if(1 /*ns->backing->base.usage & PIPE_BIND_BLIT_DESTINATION*/) - screen->eng2d->copy(screen->eng2d, &ns->backing->base, 0, 0, ps, 0, 0, ns->base.width, ns->base.height); - nvfx_miptree_surface_del(&ns->backing->base); - } - pipe_resource_reference(&ps->texture, NULL); FREE(ps); } diff --git a/src/gallium/drivers/nvfx/nvfx_resource.h b/src/gallium/drivers/nvfx/nvfx_resource.h index 0e24ec2f1f..42d04ebb37 100644 --- a/src/gallium/drivers/nvfx/nvfx_resource.h +++ b/src/gallium/drivers/nvfx/nvfx_resource.h @@ -46,6 +46,11 @@ struct nvfx_miptree { unsigned level_offset[NVFX_MAX_TEXTURE_LEVELS]; }; +struct nvfx_surface { + struct pipe_surface base; + unsigned pitch; +}; + static INLINE struct nvfx_resource *nvfx_resource(struct pipe_resource *resource) { diff --git a/src/gallium/drivers/nvfx/nvfx_screen.c b/src/gallium/drivers/nvfx/nvfx_screen.c index d354bd166a..a1b7c218f1 100644 --- a/src/gallium/drivers/nvfx/nvfx_screen.c +++ b/src/gallium/drivers/nvfx/nvfx_screen.c @@ -233,7 +233,6 @@ nvfx_screen_surface_format_supported(struct pipe_screen *pscreen, return FALSE; } - static void nvfx_screen_destroy(struct pipe_screen *pscreen) { @@ -245,7 +244,7 @@ nvfx_screen_destroy(struct pipe_screen *pscreen) nouveau_notifier_free(&screen->query); nouveau_notifier_free(&screen->sync); nouveau_grobj_free(&screen->eng3d); - nv04_surface_2d_takedown(&screen->eng2d); + nvfx_screen_surface_takedown(pscreen); nouveau_screen_fini(&screen->base); @@ -451,8 +450,7 @@ nvfx_screen_create(struct pipe_winsys *ws, struct nouveau_device *dev) } /* 2D engine setup */ - screen->eng2d = nv04_surface_2d_init(&screen->base); - screen->eng2d->buf = nvfx_surface_buffer; + nvfx_screen_surface_init(pscreen); /* Notifier for sync purposes */ ret = nouveau_notifier_alloc(chan, 0xbeef0301, 1, &screen->sync); diff --git a/src/gallium/drivers/nvfx/nvfx_screen.h b/src/gallium/drivers/nvfx/nvfx_screen.h index 5e1c3945ae..4dedbe9cb4 100644 --- a/src/gallium/drivers/nvfx/nvfx_screen.h +++ b/src/gallium/drivers/nvfx/nvfx_screen.h @@ -3,9 +3,9 @@ #include "util/u_double_list.h" #include "nouveau/nouveau_screen.h" -#include "nv04_surface_2d.h" +#include "nvfx_context.h" -struct nvfx_context; +struct nv04_2d_context; struct nvfx_screen { struct nouveau_screen base; @@ -20,7 +20,6 @@ struct nvfx_screen { unsigned index_buffer_reloc_flags; /* HW graphics objects */ - struct nv04_surface_2d *eng2d; struct nouveau_grobj *eng3d; struct nouveau_notifier *sync; @@ -32,6 +31,8 @@ struct nvfx_screen { /* Vtxprog resources */ struct nouveau_resource *vp_exec_heap; struct nouveau_resource *vp_data_heap; + + struct nv04_2d_context* eng2d; }; static INLINE struct nvfx_screen * @@ -40,4 +41,7 @@ nvfx_screen(struct pipe_screen *screen) return (struct nvfx_screen *)screen; } +int nvfx_screen_surface_init(struct pipe_screen *pscreen); +void nvfx_screen_surface_takedown(struct pipe_screen *pscreen); + #endif diff --git a/src/gallium/drivers/nvfx/nvfx_state_fb.c b/src/gallium/drivers/nvfx/nvfx_state_fb.c index 657e315f06..e111d11627 100644 --- a/src/gallium/drivers/nvfx/nvfx_state_fb.c +++ b/src/gallium/drivers/nvfx/nvfx_state_fb.c @@ -2,8 +2,6 @@ #include "nvfx_resource.h" #include "nouveau/nouveau_util.h" - - void nvfx_state_framebuffer_validate(struct nvfx_context *nvfx) { @@ -31,7 +29,7 @@ nvfx_state_framebuffer_validate(struct nvfx_context *nvfx) rt_enable |= (NV34TCL_RT_ENABLE_COLOR0 << i); nvfx->hw_rt[i].bo = ((struct nvfx_miptree*)fb->cbufs[i]->texture)->base.bo; nvfx->hw_rt[i].offset = fb->cbufs[i]->offset; - nvfx->hw_rt[i].pitch = ((struct nv04_surface *)fb->cbufs[i])->pitch; + nvfx->hw_rt[i].pitch = ((struct nvfx_surface *)fb->cbufs[i])->pitch; } for(; i < 4; ++i) nvfx->hw_rt[i].bo = 0; @@ -44,7 +42,7 @@ nvfx_state_framebuffer_validate(struct nvfx_context *nvfx) zeta_format = fb->zsbuf->format; nvfx->hw_zeta.bo = ((struct nvfx_miptree*)fb->zsbuf->texture)->base.bo; nvfx->hw_zeta.offset = fb->zsbuf->offset; - nvfx->hw_zeta.pitch = ((struct nv04_surface *)fb->zsbuf)->pitch; + nvfx->hw_zeta.pitch = ((struct nvfx_surface *)fb->zsbuf)->pitch; } else nvfx->hw_zeta.bo = 0; diff --git a/src/gallium/drivers/nvfx/nvfx_surface.c b/src/gallium/drivers/nvfx/nvfx_surface.c index a605d2b754..a97f342c64 100644 --- a/src/gallium/drivers/nvfx/nvfx_surface.c +++ b/src/gallium/drivers/nvfx/nvfx_surface.c @@ -26,33 +26,319 @@ * **************************************************************************/ +#include "pipe/p_context.h" +#include "pipe/p_format.h" +#include "util/u_format.h" +#include "util/u_math.h" +#include "util/u_memory.h" +#include "util/u_pack_color.h" +#include "util/u_rect.h" +#include "util/u_blitter.h" + +#include "nouveau/nouveau_winsys.h" +#include "nouveau/nouveau_util.h" +#include "nouveau/nouveau_screen.h" #include "nvfx_context.h" +#include "nvfx_screen.h" #include "nvfx_resource.h" -#include "pipe/p_defines.h" -#include "util/u_inlines.h" -#include "util/u_pack_color.h" +#include "nv04_2d.h" + +#include + +static INLINE void +nvfx_region_set_format(struct nv04_region* rgn, enum pipe_format format) +{ + unsigned bits = util_format_get_blocksizebits(format); + switch(bits) + { + case 8: + rgn->bpps = 0; + break; + case 16: + rgn->bpps = 1; + break; + case 32: + rgn->bpps = 2; + break; + default: + assert(util_is_pot(bits)); + int shift = log2i(bits) - 3; + assert(shift >= 2); + rgn->bpps = 2; + shift -= 2; + + rgn->x = util_format_get_nblocksx(format, rgn->x) << shift; + rgn->y = util_format_get_nblocksy(format, rgn->y); + } +} + +static INLINE void +nvfx_region_fixup_swizzled(struct nv04_region* rgn, unsigned zslice, unsigned width, unsigned height, unsigned depth) +{ + // TODO: move this code to surface creation? + if((depth <= 1) && (height <= 1 || width <= 2)) + rgn->pitch = width << rgn->bpps; + else if(depth > 1 && height <= 2 && width <= 2) + { + rgn->pitch = width << rgn->bpps; + rgn->offset += (zslice * width * height) << rgn->bpps; + } + else + { + rgn->pitch = 0; + rgn->z = zslice; + rgn->w = width; + rgn->h = height; + rgn->d = depth; + } +} + +static INLINE void +nvfx_region_init_for_surface(struct nv04_region* rgn, struct nvfx_surface* surf, unsigned x, unsigned y) +{ + rgn->bo = ((struct nvfx_resource*)surf->base.texture)->bo; + rgn->offset = surf->base.offset; + rgn->pitch = surf->pitch; + rgn->x = x; + rgn->y = y; + rgn->z = 0; + + nvfx_region_set_format(rgn, surf->base.format); + if(!(surf->base.texture->flags & NVFX_RESOURCE_FLAG_LINEAR)) + nvfx_region_fixup_swizzled(rgn, surf->base.zslice, surf->base.width, surf->base.height, u_minify(surf->base.texture->depth0, surf->base.level)); +} + +static INLINE void +nvfx_region_init_for_subresource(struct nv04_region* rgn, struct pipe_resource* pt, struct pipe_subresource sub, unsigned x, unsigned y, unsigned z) +{ + rgn->bo = ((struct nvfx_resource*)pt)->bo; + rgn->offset = nvfx_subresource_offset(pt, sub.face, sub.level, z); + rgn->pitch = nvfx_subresource_pitch(pt, sub.level); + rgn->x = x; + rgn->y = y; + rgn->z = 0; + + nvfx_region_set_format(rgn, pt->format); + if(!(pt->flags & NVFX_RESOURCE_FLAG_LINEAR)) + nvfx_region_fixup_swizzled(rgn, z, u_minify(pt->width0, sub.level), u_minify(pt->height0, sub.level), u_minify(pt->depth0, sub.level)); +} + +// TODO: actually test this for all formats, it's probably wrong for some... + +static INLINE int +nvfx_surface_format(enum pipe_format format) +{ + switch(util_format_get_blocksize(format)) { + case 1: + return NV04_CONTEXT_SURFACES_2D_FORMAT_Y8; + case 2: + //return NV04_CONTEXT_SURFACES_2D_FORMAT_Y16; + return NV04_CONTEXT_SURFACES_2D_FORMAT_R5G6B5; + case 4: + //if(format == PIPE_FORMAT_B8G8R8X8_UNORM || format == PIPE_FORMAT_B8G8R8A8_UNORM) + return NV04_CONTEXT_SURFACES_2D_FORMAT_A8R8G8B8; + //else + // return NV04_CONTEXT_SURFACES_2D_FORMAT_Y32; + default: + return -1; + } +} + +static INLINE int +nv04_scaled_image_format(enum pipe_format format) +{ + switch(util_format_get_blocksize(format)) { + case 1: + return NV03_SCALED_IMAGE_FROM_MEMORY_COLOR_FORMAT_Y8; + case 2: + //if(format == PIPE_FORMAT_B5G5R5A1_UNORM) + // return NV03_SCALED_IMAGE_FROM_MEMORY_COLOR_FORMAT_A1R5G5B5; + //else + return NV03_SCALED_IMAGE_FROM_MEMORY_COLOR_FORMAT_R5G6B5; + case 4: + if(format == PIPE_FORMAT_B8G8R8X8_UNORM) + return NV03_SCALED_IMAGE_FROM_MEMORY_COLOR_FORMAT_X8R8G8B8; + else + return NV03_SCALED_IMAGE_FROM_MEMORY_COLOR_FORMAT_A8R8G8B8; + default: + return -1; + } +} + +static struct blitter_context* +nvfx_get_blitter(struct pipe_context* pipe, int copy) +{ + struct nvfx_context* nvfx = nvfx_context(pipe); + + struct blitter_context* blitter = nvfx->blitter; + if(!blitter) + nvfx->blitter = blitter = util_blitter_create(pipe); + + util_blitter_save_blend(blitter, nvfx->blend); + util_blitter_save_depth_stencil_alpha(blitter, nvfx->zsa); + util_blitter_save_stencil_ref(blitter, &nvfx->stencil_ref); + util_blitter_save_rasterizer(blitter, nvfx->rasterizer); + util_blitter_save_fragment_shader(blitter, nvfx->fragprog); + util_blitter_save_vertex_shader(blitter, nvfx->vertprog); + util_blitter_save_viewport(blitter, &nvfx->viewport); + util_blitter_save_framebuffer(blitter, &nvfx->framebuffer); + util_blitter_save_clip(blitter, &nvfx->clip); + util_blitter_save_vertex_elements(blitter, nvfx->vtxelt); + util_blitter_save_vertex_buffers(blitter, nvfx->vtxbuf_nr, nvfx->vtxbuf); + + if(copy) + { + util_blitter_save_fragment_sampler_states(blitter, nvfx->nr_samplers, (void**)nvfx->tex_sampler); + util_blitter_save_fragment_sampler_views(blitter, nvfx->nr_textures, nvfx->fragment_sampler_views); + } + + return blitter; +} + +static unsigned +nvfx_region_clone(struct nv04_2d_context* ctx, struct nv04_region* rgn, unsigned w, unsigned h, boolean for_read) +{ + unsigned begin = nv04_region_begin(rgn, w, h); + unsigned end = nv04_region_end(rgn, w, h); + unsigned size = end - begin; + struct nouveau_bo* bo = 0; + nouveau_bo_new(rgn->bo->device, NOUVEAU_BO_MAP | NOUVEAU_BO_GART, 256, size, &bo); + + if(for_read || (size > ((w * h) << rgn->bpps))) + nv04_memcpy(ctx, bo, 0, rgn->bo, rgn->offset + begin, size); + + rgn->bo = bo; + rgn->offset = -begin; + return begin; +} static void -nvfx_surface_copy(struct pipe_context *pipe, - struct pipe_resource *dest, struct pipe_subresource subdst, - unsigned destx, unsigned desty, unsigned destz, - struct pipe_resource *src, struct pipe_subresource subsrc, +nvfx_resource_copy_region(struct pipe_context *pipe, + struct pipe_resource *dstr, struct pipe_subresource subdst, + unsigned dstx, unsigned dsty, unsigned dstz, + struct pipe_resource *srcr, struct pipe_subresource subsrc, unsigned srcx, unsigned srcy, unsigned srcz, - unsigned width, unsigned height) + unsigned w, unsigned h) { - struct nvfx_context *nvfx = nvfx_context(pipe); - struct nv04_surface_2d *eng2d = nvfx->screen->eng2d; - struct pipe_surface *ps_dst, *ps_src; + struct nv04_2d_context *ctx = nvfx_screen(pipe->screen)->eng2d; + struct nv04_region dst, src; + + if(!w || !h) + return; + + static int copy_threshold = -1; + if(copy_threshold < 0) + { + copy_threshold = debug_get_num_option("NOUVEAU_COPY_THRESHOLD", 0); + if(copy_threshold < 0) + copy_threshold = 0; + } - ps_src = nvfx_miptree_surface_new(pipe->screen, src, subsrc.face, - subsrc.level, srcz, 0 /* bind flags */); - ps_dst = nvfx_miptree_surface_new(pipe->screen, dest, subdst.face, - subdst.level, destz, 0 /* bindflags */); + int dst_to_gpu = dstr->usage != PIPE_USAGE_DYNAMIC && dstr->usage != PIPE_USAGE_STAGING; + int src_on_gpu = nvfx_resource_on_gpu(srcr); - eng2d->copy(eng2d, ps_dst, destx, desty, ps_src, srcx, srcy, width, height); + nvfx_region_init_for_subresource(&dst, dstr, subdst, dstx, dsty, dstz); + nvfx_region_init_for_subresource(&src, srcr, subsrc, srcx, srcy, srcz); + w = util_format_get_stride(dstr->format, w) >> dst.bpps; + h = util_format_get_nblocksy(dstr->format, h); - nvfx_miptree_surface_del(ps_src); - nvfx_miptree_surface_del(ps_dst); + int ret; + boolean small = (w * h <= copy_threshold); + if((!dst_to_gpu || !src_on_gpu) && small) + ret = -1; /* use the CPU */ + else + ret = nv04_region_copy_2d(ctx, &dst, &src, w, h, + dstr->target == PIPE_BUFFER ? -1 : nvfx_surface_format(dstr->format), + dstr->target == PIPE_BUFFER ? -1 : nv04_scaled_image_format(dstr->format), + dst_to_gpu, src_on_gpu); + if(!ret) + {} + else if(ret > 0 && dstr->bind & PIPE_BIND_RENDER_TARGET && srcr->bind & PIPE_BIND_SAMPLER_VIEW) + { + struct blitter_context* blitter = nvfx_get_blitter(pipe, 1); + util_blitter_copy_region(blitter, dstr, subdst, dstx, dsty, dstz, srcr, subsrc, srcx, srcy, srcz, w, h, TRUE); + } + else + { + struct nv04_region dstt = dst; + struct nv04_region srct = src; + unsigned dstbegin = 0; + + if(!small) + { + if(src_on_gpu) + nvfx_region_clone(ctx, &srct, w, h, TRUE); + + if(dst_to_gpu) + dstbegin = nvfx_region_clone(ctx, &dstt, w, h, FALSE); + } + + nv04_region_copy_cpu(&dstt, &srct, w, h); + + if(srct.bo != src.bo) + nouveau_screen_bo_release(pipe->screen, srct.bo); + + if(dstt.bo != dst.bo) + { + nv04_memcpy(ctx, dst.bo, dst.offset + dstbegin, dstt.bo, 0, dstt.bo->size); + nouveau_screen_bo_release(pipe->screen, dstt.bo); + } + } +} + +static int +nvfx_surface_fill(struct pipe_context* pipe, struct pipe_surface *dsts, + unsigned dx, unsigned dy, unsigned w, unsigned h, unsigned value) +{ + struct nv04_2d_context *ctx = nvfx_screen(pipe->screen)->eng2d; + struct nv04_region dst; + /* Always try to use the GPU right now, if possible + * If the user wanted the surface data on the CPU, he would have cleared with memset */ + + // we don't care about interior pixel order since we set all them to the same value + nvfx_region_init_for_surface(&dst, (struct nvfx_surface*)dsts, dx, dy); + w = util_format_get_stride(dsts->format, w) >> dst.bpps; + h = util_format_get_nblocksy(dsts->format, h); + + int ret = nv04_region_fill_2d(ctx, &dst, w, h, value); + if(ret > 0 && dsts->texture->bind & PIPE_BIND_RENDER_TARGET) + return 1; + else if(ret) + { + struct nv04_region dstt = dst; + unsigned dstbegin = 0; + + if(nvfx_resource_on_gpu(dsts->texture)) + dstbegin = nvfx_region_clone(ctx, &dstt, w, h, FALSE); + + nv04_region_fill_cpu(&dstt, w, h, value); + + if(dstt.bo != dst.bo) + { + nv04_memcpy(ctx, dst.bo, dst.offset + dstbegin, dstt.bo, 0, dstt.bo->size); + nouveau_screen_bo_release(pipe->screen, dstt.bo); + } + } + + return 0; +} + + +void +nvfx_screen_surface_takedown(struct pipe_screen *pscreen) +{ + nv04_2d_context_takedown(nvfx_screen(pscreen)->eng2d); + nvfx_screen(pscreen)->eng2d = 0; +} + +int +nvfx_screen_surface_init(struct pipe_screen *pscreen) +{ + struct nv04_2d_context* ctx = nv04_2d_context_init(nouveau_screen(pscreen)->channel); + if(!ctx) + return -1; + nvfx_screen(pscreen)->eng2d = ctx; + return 0; } static void @@ -62,12 +348,16 @@ nvfx_clear_render_target(struct pipe_context *pipe, unsigned dstx, unsigned dsty, unsigned width, unsigned height) { - struct nvfx_context *nvfx = nvfx_context(pipe); - struct nv04_surface_2d *eng2d = nvfx->screen->eng2d; union util_color uc; util_pack_color(rgba, dst->format, &uc); - eng2d->fill(eng2d, dst, dstx, dsty, width, height, uc.ui); + if(util_format_get_blocksizebits(dst->format) > 32 + || nvfx_surface_fill(pipe, dst, dstx, dsty, width, height, uc.ui)) + { + // TODO: probably should use hardware clear here instead if possible + struct blitter_context* blitter = nvfx_get_blitter(pipe, 0); + util_blitter_clear_render_target(blitter, dst, rgba, dstx, dsty, width, height); + } } static void @@ -79,18 +369,20 @@ nvfx_clear_depth_stencil(struct pipe_context *pipe, unsigned dstx, unsigned dsty, unsigned width, unsigned height) { - struct nvfx_context *nvfx = nvfx_context(pipe); - struct nv04_surface_2d *eng2d = nvfx->screen->eng2d; - - eng2d->fill(eng2d, dst, dstx, dsty, width, height, - util_pack_z_stencil(dst->format, depth, stencil)); + if(util_format_get_blocksizebits(dst->format) > 32 + || nvfx_surface_fill(pipe, dst, dstx, dsty, width, height, util_pack_z_stencil(dst->format, depth, stencil))) + { + // TODO: probably should use hardware clear here instead if possible + struct blitter_context* blitter = nvfx_get_blitter(pipe, 0); + util_blitter_clear_depth_stencil(blitter, dst, clear_flags, depth, stencil, dstx, dsty, width, height); + } } void nvfx_init_surface_functions(struct nvfx_context *nvfx) { - nvfx->pipe.resource_copy_region = nvfx_surface_copy; + nvfx->pipe.resource_copy_region = nvfx_resource_copy_region; nvfx->pipe.clear_render_target = nvfx_clear_render_target; nvfx->pipe.clear_depth_stencil = nvfx_clear_depth_stencil; } -- cgit v1.2.3 From d983701267de0083cc702e460c841741292cc9b8 Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Mon, 18 Jan 2010 23:40:22 +0100 Subject: nvfx: new 2D: enable swizzling for all surfaces Now that the new 2D code is in place, swizzling can be safely enabled. Render temporaries are needed in some cases, so this may degrade nv30 a bit until it gets render temporaries too. --- src/gallium/drivers/nvfx/nvfx_miptree.c | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/nvfx/nvfx_miptree.c b/src/gallium/drivers/nvfx/nvfx_miptree.c index b8ec726624..ffacf8a8e5 100644 --- a/src/gallium/drivers/nvfx/nvfx_miptree.c +++ b/src/gallium/drivers/nvfx/nvfx_miptree.c @@ -19,32 +19,19 @@ nvfx_miptree_choose_format(struct nvfx_miptree *mt) unsigned uniform_pitch = 0; static int no_swizzle = -1; if(no_swizzle < 0) - no_swizzle = debug_get_bool_option("NOUVEAU_NO_SWIZZLE", FALSE); + no_swizzle = debug_get_bool_option("NV40_NO_SWIZZLE", FALSE); /* this will break things on nv30 */ - /* Non-uniform pitch textures must be POT */ - if (pt->width0 & (pt->width0 - 1) || - pt->height0 & (pt->height0 - 1) || - pt->depth0 & (pt->depth0 - 1) + if (!util_is_pot(pt->width0) || + !util_is_pot(pt->height0) || + !util_is_pot(pt->depth0) ) uniform_pitch = 1; - /* All texture formats except compressed ones can be swizzled - * Unsure about depth, let's prevent swizzling for now - */ if ( (pt->bind & (PIPE_BIND_SCANOUT | PIPE_BIND_DISPLAY_TARGET)) || (pt->usage & PIPE_USAGE_DYNAMIC) || (pt->usage & PIPE_USAGE_STAGING) - || util_format_is_depth_or_stencil(pt->format) || util_format_is_compressed(pt->format) - // disable swizzled textures on NV04-NV20 as our current drivers don't fully support that - // TODO: hardware should support them, fix the drivers and reenable - || nouveau_screen(pt->screen)->device->chipset < 0x30 || no_swizzle - - // disable swizzling for non-RGBA 2D because our current 2D code can't handle anything - // else correctly, and even that is semi-broken - || pt->target != PIPE_TEXTURE_2D - || (pt->format != PIPE_FORMAT_B8G8R8A8_UNORM && pt->format != PIPE_FORMAT_B8G8R8X8_UNORM) ) mt->base.base.flags |= NVFX_RESOURCE_FLAG_LINEAR; -- cgit v1.2.3 From 4793f48a19465ad27c3a33d9453a0def78775736 Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Tue, 23 Feb 2010 12:47:45 +0100 Subject: nvfx: new 2D: optimize fragtex format lookup Use an array indexed by the pipe format instead of doing a linear scan. --- src/gallium/drivers/nvfx/nv30_fragtex.c | 30 +++++------------------------- src/gallium/drivers/nvfx/nv40_fragtex.c | 30 +++++------------------------- 2 files changed, 10 insertions(+), 50 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/nvfx/nv30_fragtex.c b/src/gallium/drivers/nvfx/nv30_fragtex.c index 85489eab28..a812d88353 100644 --- a/src/gallium/drivers/nvfx/nv30_fragtex.c +++ b/src/gallium/drivers/nvfx/nv30_fragtex.c @@ -35,9 +35,7 @@ nv30_sampler_state_init(struct pipe_context *pipe, } #define _(m,tf,ts0x,ts0y,ts0z,ts0w,ts1x,ts1y,ts1z,ts1w) \ -{ \ - TRUE, \ - PIPE_FORMAT_##m, \ +[PIPE_FORMAT_##m] = { \ NV34TCL_TX_FORMAT_FORMAT_##tf, \ (NV34TCL_TX_SWIZZLE_S0_X_##ts0x | NV34TCL_TX_SWIZZLE_S0_Y_##ts0y | \ NV34TCL_TX_SWIZZLE_S0_Z_##ts0z | NV34TCL_TX_SWIZZLE_S0_W_##ts0w | \ @@ -46,14 +44,13 @@ nv30_sampler_state_init(struct pipe_context *pipe, } struct nv30_texture_format { - boolean defined; - uint pipe; int format; int swizzle; }; static struct nv30_texture_format -nv30_texture_formats[] = { +nv30_texture_formats[PIPE_FORMAT_COUNT] = { + [0 ... PIPE_FORMAT_COUNT - 1] = {-1, 0}, _(B8G8R8X8_UNORM, A8R8G8B8, S1, S1, S1, ONE, X, Y, Z, W), _(B8G8R8A8_UNORM, A8R8G8B8, S1, S1, S1, S1, X, Y, Z, W), _(B5G5R5A1_UNORM, A1R5G5B5, S1, S1, S1, S1, X, Y, Z, W), @@ -72,22 +69,6 @@ nv30_texture_formats[] = { {}, }; -static struct nv30_texture_format * -nv30_fragtex_format(uint pipe_format) -{ - struct nv30_texture_format *tf = nv30_texture_formats; - - while (tf->defined) { - if (tf->pipe == pipe_format) - return tf; - tf++; - } - - NOUVEAU_ERR("unknown texture format %s\n", util_format_name(pipe_format)); - return NULL; -} - - void nv30_fragtex_set(struct nvfx_context *nvfx, int unit) { @@ -100,9 +81,8 @@ nv30_fragtex_set(struct nvfx_context *nvfx, int unit) uint32_t txf, txs; unsigned tex_flags = NOUVEAU_BO_VRAM | NOUVEAU_BO_GART | NOUVEAU_BO_RD; - tf = nv30_fragtex_format(pt->format); - if (!tf) - return; + tf = &nv30_texture_formats[pt->format]; + assert(tf->format >= 0); txf = tf->format; txf |= ((pt->last_level>0) ? NV34TCL_TX_FORMAT_MIPMAP : 0); diff --git a/src/gallium/drivers/nvfx/nv40_fragtex.c b/src/gallium/drivers/nvfx/nv40_fragtex.c index 45c34c7ffd..87aa7eb1a2 100644 --- a/src/gallium/drivers/nvfx/nv40_fragtex.c +++ b/src/gallium/drivers/nvfx/nv40_fragtex.c @@ -49,9 +49,7 @@ nv40_sampler_state_init(struct pipe_context *pipe, } #define _(m,tf,ts0x,ts0y,ts0z,ts0w,ts1x,ts1y,ts1z,ts1w,sx,sy,sz,sw) \ -{ \ - TRUE, \ - PIPE_FORMAT_##m, \ +[PIPE_FORMAT_##m] = { \ NV40TCL_TEX_FORMAT_FORMAT_##tf, \ (NV34TCL_TX_SWIZZLE_S0_X_##ts0x | NV34TCL_TX_SWIZZLE_S0_Y_##ts0y | \ NV34TCL_TX_SWIZZLE_S0_Z_##ts0z | NV34TCL_TX_SWIZZLE_S0_W_##ts0w | \ @@ -62,15 +60,14 @@ nv40_sampler_state_init(struct pipe_context *pipe, } struct nv40_texture_format { - boolean defined; - uint pipe; int format; int swizzle; int sign; }; static struct nv40_texture_format -nv40_texture_formats[] = { +nv40_texture_formats[PIPE_FORMAT_COUNT] = { + [0 ... PIPE_FORMAT_COUNT - 1] = {-1, 0, 0}, _(B8G8R8X8_UNORM, A8R8G8B8, S1, S1, S1, ONE, X, Y, Z, W, 0, 0, 0, 0), _(B8G8R8A8_UNORM, A8R8G8B8, S1, S1, S1, S1, X, Y, Z, W, 0, 0, 0, 0), _(B5G5R5A1_UNORM, A1R5G5B5, S1, S1, S1, S1, X, Y, Z, W, 0, 0, 0, 0), @@ -90,22 +87,6 @@ nv40_texture_formats[] = { {}, }; -static struct nv40_texture_format * -nv40_fragtex_format(uint pipe_format) -{ - struct nv40_texture_format *tf = nv40_texture_formats; - - while (tf->defined) { - if (tf->pipe == pipe_format) - return tf; - tf++; - } - - NOUVEAU_ERR("unknown texture format %s\n", util_format_name(pipe_format)); - return NULL; -} - - void nv40_fragtex_set(struct nvfx_context *nvfx, int unit) { @@ -119,9 +100,8 @@ nv40_fragtex_set(struct nvfx_context *nvfx, int unit) uint32_t txf, txs, txp; unsigned tex_flags = NOUVEAU_BO_VRAM | NOUVEAU_BO_GART | NOUVEAU_BO_RD; - tf = nv40_fragtex_format(pt->format); - if (!tf) - assert(0); + tf = &nv40_texture_formats[pt->format]; + assert(tf->format >= 0); txf = ps->fmt; txf |= tf->format | 0x8000; -- cgit v1.2.3 From ff74143fcc80b0157875bb0ce4b34a80f92e09c2 Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Thu, 11 Mar 2010 18:06:28 +0100 Subject: nv30: new 2D: support ARB_texture_rectangle This uses nv30's _RECT formats. --- src/gallium/drivers/nvfx/nv30_fragtex.c | 36 +++++++++++++++++++++++++++++++-- src/gallium/drivers/nvfx/nvfx_miptree.c | 3 ++- 2 files changed, 36 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/nvfx/nv30_fragtex.c b/src/gallium/drivers/nvfx/nv30_fragtex.c index a812d88353..fbc69cf44a 100644 --- a/src/gallium/drivers/nvfx/nv30_fragtex.c +++ b/src/gallium/drivers/nvfx/nv30_fragtex.c @@ -37,6 +37,7 @@ nv30_sampler_state_init(struct pipe_context *pipe, #define _(m,tf,ts0x,ts0y,ts0z,ts0w,ts1x,ts1y,ts1z,ts1w) \ [PIPE_FORMAT_##m] = { \ NV34TCL_TX_FORMAT_FORMAT_##tf, \ + NV34TCL_TX_FORMAT_FORMAT_##tf##_RECT, \ (NV34TCL_TX_SWIZZLE_S0_X_##ts0x | NV34TCL_TX_SWIZZLE_S0_Y_##ts0y | \ NV34TCL_TX_SWIZZLE_S0_Z_##ts0z | NV34TCL_TX_SWIZZLE_S0_W_##ts0w | \ NV34TCL_TX_SWIZZLE_S1_X_##ts1x | NV34TCL_TX_SWIZZLE_S1_Y_##ts1y | \ @@ -45,12 +46,17 @@ nv30_sampler_state_init(struct pipe_context *pipe, struct nv30_texture_format { int format; + int rect_format; int swizzle; }; +#define NV34TCL_TX_FORMAT_FORMAT_DXT1_RECT NV34TCL_TX_FORMAT_FORMAT_DXT1 +#define NV34TCL_TX_FORMAT_FORMAT_DXT3_RECT NV34TCL_TX_FORMAT_FORMAT_DXT3 +#define NV34TCL_TX_FORMAT_FORMAT_DXT5_RECT NV34TCL_TX_FORMAT_FORMAT_DXT5 + static struct nv30_texture_format nv30_texture_formats[PIPE_FORMAT_COUNT] = { - [0 ... PIPE_FORMAT_COUNT - 1] = {-1, 0}, + [0 ... PIPE_FORMAT_COUNT - 1] = {-1, 0, 0}, _(B8G8R8X8_UNORM, A8R8G8B8, S1, S1, S1, ONE, X, Y, Z, W), _(B8G8R8A8_UNORM, A8R8G8B8, S1, S1, S1, S1, X, Y, Z, W), _(B5G5R5A1_UNORM, A1R5G5B5, S1, S1, S1, S1, X, Y, Z, W), @@ -80,11 +86,34 @@ nv30_fragtex_set(struct nvfx_context *nvfx, int unit) struct nouveau_channel* chan = nvfx->screen->base.channel; uint32_t txf, txs; unsigned tex_flags = NOUVEAU_BO_VRAM | NOUVEAU_BO_GART | NOUVEAU_BO_RD; + unsigned use_rect; tf = &nv30_texture_formats[pt->format]; assert(tf->format >= 0); - txf = tf->format; + if(pt->height0 <= 1 || util_format_is_compressed(pt->format)) + { + /* in the case of compressed or 1D textures, we can get away with this, + * since the layout is the same + */ + use_rect = ps->fmt; + } + else + { + static int warned = 0; + if(!warned && !ps->fmt != !(pt->flags & NVFX_RESOURCE_FLAG_LINEAR)) { + warned = 1; + fprintf(stderr, + "Unimplemented: coordinate normalization mismatch. Possible reasons:\n" + "1. ARB_texture_non_power_of_two is being used despite the fact it isn't supported\n" + "2. The state tracker is not using the appropriate coordinate normalization\n" + "3. The state tracker is not supported\n"); + } + + use_rect = pt->flags & NVFX_RESOURCE_FLAG_LINEAR; + } + + txf = use_rect ? tf->rect_format : tf->format; txf |= ((pt->last_level>0) ? NV34TCL_TX_FORMAT_MIPMAP : 0); txf |= log2i(pt->width0) << NV34TCL_TX_FORMAT_BASE_SIZE_U_SHIFT; txf |= log2i(pt->height0) << NV34TCL_TX_FORMAT_BASE_SIZE_V_SHIFT; @@ -112,6 +141,9 @@ nv30_fragtex_set(struct nvfx_context *nvfx, int unit) txs = tf->swizzle; + if(use_rect) + txs |= nvfx_subresource_pitch(&mt->base, 0) << NV34TCL_TX_SWIZZLE_RECT_PITCH_SHIFT; + MARK_RING(chan, 9, 2); OUT_RING(chan, RING_3D(NV34TCL_TX_OFFSET(unit), 8)); OUT_RELOC(chan, bo, 0, tex_flags | NOUVEAU_BO_LOW, 0, 0); diff --git a/src/gallium/drivers/nvfx/nvfx_miptree.c b/src/gallium/drivers/nvfx/nvfx_miptree.c index ffacf8a8e5..7deb9d7b9a 100644 --- a/src/gallium/drivers/nvfx/nvfx_miptree.c +++ b/src/gallium/drivers/nvfx/nvfx_miptree.c @@ -23,7 +23,8 @@ nvfx_miptree_choose_format(struct nvfx_miptree *mt) if (!util_is_pot(pt->width0) || !util_is_pot(pt->height0) || - !util_is_pot(pt->depth0) + !util_is_pot(pt->depth0) || + (!nvfx_screen(pt->screen)->is_nv4x && pt->target == PIPE_TEXTURE_RECT) ) uniform_pitch = 1; -- cgit v1.2.3 From 28eb392a853bb43bdc6cfe7ba814f046c39ca7ae Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Tue, 3 Aug 2010 05:47:41 +0200 Subject: nvfx: new 2D: new render temporaries with resources This patch adds support for creating temporary surfaces to allow rendering to surfaces that cannot be rendered to. It uses the _second_ version of the render temporary infrastructure. This is necessary for swizzled 3D textures and small mipmaps of swizzled 2D textures. This version of the patch creates a resource to use as a temporary instead of a raw BO, making the code simpler. --- src/gallium/drivers/nvfx/nvfx_context.c | 4 + src/gallium/drivers/nvfx/nvfx_context.h | 6 +- src/gallium/drivers/nvfx/nvfx_fragtex.c | 4 + src/gallium/drivers/nvfx/nvfx_miptree.c | 51 +++--- src/gallium/drivers/nvfx/nvfx_resource.h | 36 ++++- src/gallium/drivers/nvfx/nvfx_state_emit.c | 81 ++++++++-- src/gallium/drivers/nvfx/nvfx_state_fb.c | 251 ++++++++++++++++++----------- src/gallium/drivers/nvfx/nvfx_surface.c | 121 ++++++++++++-- 8 files changed, 408 insertions(+), 146 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/nvfx/nvfx_context.c b/src/gallium/drivers/nvfx/nvfx_context.c index 3d45f5f0ba..7ab81de7dd 100644 --- a/src/gallium/drivers/nvfx/nvfx_context.c +++ b/src/gallium/drivers/nvfx/nvfx_context.c @@ -15,6 +15,7 @@ nvfx_flush(struct pipe_context *pipe, unsigned flags, struct nouveau_channel *chan = screen->base.channel; struct nouveau_grobj *eng3d = screen->eng3d; + /* XXX: we need to actually be intelligent here */ if (flags & PIPE_FLUSH_TEXTURE_CACHE) { BEGIN_RING(chan, eng3d, 0x1fd8, 1); OUT_RING (chan, 2); @@ -87,5 +88,8 @@ nvfx_create(struct pipe_screen *pscreen, void *priv) /* set these to that we init them on first validation */ nvfx->state.scissor_enabled = ~0; nvfx->state.stipple_enabled = ~0; + + LIST_INITHEAD(&nvfx->render_cache); + return &nvfx->pipe; } diff --git a/src/gallium/drivers/nvfx/nvfx_context.h b/src/gallium/drivers/nvfx/nvfx_context.h index 278be94d52..a6ea913967 100644 --- a/src/gallium/drivers/nvfx/nvfx_context.h +++ b/src/gallium/drivers/nvfx/nvfx_context.h @@ -11,6 +11,7 @@ #include "util/u_memory.h" #include "util/u_math.h" #include "util/u_inlines.h" +#include "util/u_double_list.h" #include "draw/draw_vertex.h" #include "util/u_blitter.h" @@ -67,6 +68,7 @@ struct nvfx_state { unsigned scissor_enabled; unsigned stipple_enabled; unsigned fp_samplers; + unsigned render_temps; }; struct nvfx_vtxelt_state { @@ -90,6 +92,7 @@ struct nvfx_context { struct draw_context *draw; struct blitter_context* blitter; + struct list_head render_cache; /* HW state derived from pipe states */ struct nvfx_state state; @@ -185,7 +188,8 @@ extern void nvfx_draw_elements_swtnl(struct pipe_context *pipe, extern void nvfx_vtxfmt_validate(struct nvfx_context *nvfx); /* nvfx_fb.c */ -extern void nvfx_state_framebuffer_validate(struct nvfx_context *nvfx); +extern int nvfx_framebuffer_prepare(struct nvfx_context *nvfx); +extern void nvfx_framebuffer_validate(struct nvfx_context *nvfx, unsigned prepare_result); void nvfx_framebuffer_relocate(struct nvfx_context *nvfx); diff --git a/src/gallium/drivers/nvfx/nvfx_fragtex.c b/src/gallium/drivers/nvfx/nvfx_fragtex.c index 0b4a434fec..6605745433 100644 --- a/src/gallium/drivers/nvfx/nvfx_fragtex.c +++ b/src/gallium/drivers/nvfx/nvfx_fragtex.c @@ -16,6 +16,10 @@ nvfx_fragtex_validate(struct nvfx_context *nvfx) samplers &= ~(1 << unit); if(nvfx->fragment_sampler_views[unit] && nvfx->tex_sampler[unit]) { + util_dirty_surfaces_use_for_sampling(&nvfx->pipe, + &((struct nvfx_miptree*)nvfx->fragment_sampler_views[unit]->texture)->dirty_surfaces, + nvfx_surface_flush); + if(!nvfx->is_nv4x) nv30_fragtex_set(nvfx, unit); else diff --git a/src/gallium/drivers/nvfx/nvfx_miptree.c b/src/gallium/drivers/nvfx/nvfx_miptree.c index 7deb9d7b9a..530d705e13 100644 --- a/src/gallium/drivers/nvfx/nvfx_miptree.c +++ b/src/gallium/drivers/nvfx/nvfx_miptree.c @@ -11,6 +11,7 @@ #include "nvfx_screen.h" #include "nvfx_resource.h" #include "nvfx_transfer.h" +#include "nv04_2d.h" static void nvfx_miptree_choose_format(struct nvfx_miptree *mt) @@ -114,17 +115,24 @@ nvfx_miptree_get_handle(struct pipe_screen *pscreen, } +static void +nvfx_miptree_surface_final_destroy(struct pipe_surface* ps) +{ + struct nvfx_surface* ns = (struct nvfx_surface*)ps; + pipe_resource_reference(&ps->texture, 0); + pipe_resource_reference((struct pipe_resource**)&ns->temp, 0); + FREE(ps); +} + static void nvfx_miptree_destroy(struct pipe_screen *screen, struct pipe_resource *pt) { struct nvfx_miptree *mt = (struct nvfx_miptree *)pt; + util_surfaces_destroy(&mt->surfaces, pt, nvfx_miptree_surface_final_destroy); nouveau_screen_bo_release(screen, mt->base.bo); FREE(mt); } - - - struct u_resource_vtbl nvfx_miptree_vtbl = { nvfx_miptree_get_handle, /* get_handle */ @@ -152,6 +160,8 @@ nvfx_miptree_create_skeleton(struct pipe_screen *pscreen, const struct pipe_reso mt->base.base = *pt; mt->base.vtbl = &nvfx_miptree_vtbl; + util_dirty_surfaces_init(&mt->dirty_surfaces); + pipe_reference_init(&mt->base.base.reference, 1); mt->base.base.screen = pscreen; @@ -218,29 +228,28 @@ nvfx_miptree_surface_new(struct pipe_screen *pscreen, struct pipe_resource *pt, unsigned face, unsigned level, unsigned zslice, unsigned flags) { + struct nvfx_miptree* mt = (struct nvfx_miptree*)pt; struct nvfx_surface *ns; - ns = CALLOC_STRUCT(nvfx_surface); - if (!ns) - return NULL; - pipe_resource_reference(&ns->base.texture, pt); - ns->base.format = pt->format; - ns->base.width = u_minify(pt->width0, level); - ns->base.height = u_minify(pt->height0, level); - ns->base.usage = flags; - pipe_reference_init(&ns->base.reference, 1); - ns->base.face = face; - ns->base.level = level; - ns->base.zslice = zslice; - ns->pitch = nvfx_subresource_pitch(pt, level); - ns->base.offset = nvfx_subresource_offset(pt, face, level, zslice); - - return &ns->base; + ns = (struct nvfx_surface*)util_surfaces_get(&mt->surfaces, sizeof(struct nvfx_surface), pscreen, pt, face, level, zslice, flags); + if(ns->base.base.offset == ~0) { + util_dirty_surface_init(&ns->base); + ns->pitch = nvfx_subresource_pitch(pt, level); + ns->base.base.offset = nvfx_subresource_offset(pt, face, level, zslice); + } + + return &ns->base.base; } void nvfx_miptree_surface_del(struct pipe_surface *ps) { - pipe_resource_reference(&ps->texture, NULL); - FREE(ps); + struct nvfx_surface* ns = (struct nvfx_surface*)ps; + + if(!ns->temp) + { + util_surfaces_detach(&((struct nvfx_miptree*)ps->texture)->surfaces, ps); + pipe_resource_reference(&ps->texture, 0); + FREE(ps); + } } diff --git a/src/gallium/drivers/nvfx/nvfx_resource.h b/src/gallium/drivers/nvfx/nvfx_resource.h index 42d04ebb37..be1845dd9c 100644 --- a/src/gallium/drivers/nvfx/nvfx_resource.h +++ b/src/gallium/drivers/nvfx/nvfx_resource.h @@ -1,13 +1,16 @@ - #ifndef NVFX_RESOURCE_H #define NVFX_RESOURCE_H #include "util/u_transfer.h" #include "util/u_format.h" #include "util/u_math.h" +#include "util/u_double_list.h" +#include "util/u_surfaces.h" +#include "util/u_dirty_surfaces.h" #include struct pipe_resource; +struct nv04_region; /* This gets further specialized into either buffer or texture @@ -38,17 +41,34 @@ nvfx_resource_on_gpu(struct pipe_resource* pr) #define NVFX_MAX_TEXTURE_LEVELS 16 +/* We have the following invariants for render temporaries + * + * 1. Render temporaries are always linear + * 2. Render temporaries are always up to date + * 3. Currently, render temporaries are destroyed when the resource is used for sampling, but kept for any other use + * + * Also, we do NOT flush temporaries on any pipe->flush(). + * This is fine, as long as scanout targets and shared resources never need temps. + * + * TODO: we may want to also support swizzled temporaries to improve performance in some cases. + */ + struct nvfx_miptree { struct nvfx_resource base; unsigned linear_pitch; /* for linear textures, 0 for swizzled and compressed textures with level-dependent minimal pitch */ unsigned face_size; /* 128-byte aligned face/total size */ unsigned level_offset[NVFX_MAX_TEXTURE_LEVELS]; + + struct util_surfaces surfaces; + struct util_dirty_surfaces dirty_surfaces; }; struct nvfx_surface { - struct pipe_surface base; + struct util_dirty_surface base; unsigned pitch; + + struct nvfx_miptree* temp; }; static INLINE @@ -65,6 +85,12 @@ nvfx_surface_buffer(struct pipe_surface *surf) return mt->bo; } +static INLINE struct util_dirty_surfaces* +nvfx_surface_get_dirty_surfaces(struct pipe_surface* surf) +{ + struct nvfx_miptree *mt = (struct nvfx_miptree *)surf->texture; + return &mt->dirty_surfaces; +} void nvfx_init_resource_functions(struct pipe_context *pipe); @@ -141,4 +167,10 @@ nvfx_subresource_pitch(struct pipe_resource* pt, unsigned level) } } +void +nvfx_surface_create_temp(struct pipe_context* pipe, struct pipe_surface* surf); + +void +nvfx_surface_flush(struct pipe_context* pipe, struct pipe_surface* surf); + #endif diff --git a/src/gallium/drivers/nvfx/nvfx_state_emit.c b/src/gallium/drivers/nvfx/nvfx_state_emit.c index f91ae19ecd..dc70f3de87 100644 --- a/src/gallium/drivers/nvfx/nvfx_state_emit.c +++ b/src/gallium/drivers/nvfx/nvfx_state_emit.c @@ -1,15 +1,48 @@ #include "nvfx_context.h" #include "nvfx_state.h" +#include "nvfx_resource.h" #include "draw/draw_context.h" static boolean nvfx_state_validate_common(struct nvfx_context *nvfx) { struct nouveau_channel* chan = nvfx->screen->base.channel; - unsigned dirty = nvfx->dirty; + unsigned dirty; + int all_swizzled = -1; + boolean flush_tex_cache = FALSE; if(nvfx != nvfx->screen->cur_ctx) - dirty = ~0; + { + nvfx->dirty = ~0; + nvfx->screen->cur_ctx = nvfx; + } + + /* These can trigger use the of 3D engine to copy temporaries. + * That will recurse here and thus dirty all 3D state, so we need to this before anything else, and in a loop.. + * This converges to having clean temps, then binding both fragtexes and framebuffers. + */ + while(nvfx->dirty & (NVFX_NEW_FB | NVFX_NEW_SAMPLER)) + { + if(nvfx->dirty & NVFX_NEW_SAMPLER) + { + nvfx->dirty &=~ NVFX_NEW_SAMPLER; + nvfx_fragtex_validate(nvfx); + + // TODO: only set this if really necessary + flush_tex_cache = TRUE; + } + + if(nvfx->dirty & NVFX_NEW_FB) + { + nvfx->dirty &=~ NVFX_NEW_FB; + all_swizzled = nvfx_framebuffer_prepare(nvfx); + + // TODO: make sure this doesn't happen, i.e. fbs have matching formats + assert(all_swizzled >= 0); + } + } + + dirty = nvfx->dirty; if(nvfx->render_mode == HW) { @@ -35,9 +68,6 @@ nvfx_state_validate_common(struct nvfx_context *nvfx) nvfx_vtxfmt_validate(nvfx); } - if(dirty & NVFX_NEW_FB) - nvfx_state_framebuffer_validate(nvfx); - if(dirty & NVFX_NEW_RAST) sb_emit(chan, nvfx->rasterizer->sb, nvfx->rasterizer->sb_len); @@ -48,10 +78,14 @@ nvfx_state_validate_common(struct nvfx_context *nvfx) nvfx_state_stipple_validate(nvfx); if(dirty & (NVFX_NEW_FRAGPROG | NVFX_NEW_FRAGCONST)) + { nvfx_fragprog_validate(nvfx); + if(dirty & NVFX_NEW_FRAGPROG) + flush_tex_cache = TRUE; // TODO: do we need this? + } - if(dirty & NVFX_NEW_SAMPLER) - nvfx_fragtex_validate(nvfx); + if(all_swizzled >= 0) + nvfx_framebuffer_validate(nvfx, all_swizzled); if(dirty & NVFX_NEW_BLEND) sb_emit(chan, nvfx->blend->sb, nvfx->blend->sb_len); @@ -72,13 +106,17 @@ nvfx_state_validate_common(struct nvfx_context *nvfx) if(dirty & (NVFX_NEW_VIEWPORT | NVFX_NEW_FB)) nvfx_state_viewport_validate(nvfx); - /* TODO: could nv30 need this or something similar too? */ - if((dirty & (NVFX_NEW_FRAGPROG | NVFX_NEW_SAMPLER)) && nvfx->is_nv4x) { - WAIT_RING(chan, 4); - OUT_RING(chan, RING_3D(NV40TCL_TEX_CACHE_CTL, 1)); - OUT_RING(chan, 2); - OUT_RING(chan, RING_3D(NV40TCL_TEX_CACHE_CTL, 1)); - OUT_RING(chan, 1); + if(flush_tex_cache) + { + // TODO: what about nv30? + if(nvfx->is_nv4x) + { + WAIT_RING(chan, 4); + OUT_RING(chan, RING_3D(NV40TCL_TEX_CACHE_CTL, 1)); + OUT_RING(chan, 2); + OUT_RING(chan, RING_3D(NV40TCL_TEX_CACHE_CTL, 1)); + OUT_RING(chan, 1); + } } nvfx->dirty = 0; return TRUE; @@ -99,6 +137,21 @@ nvfx_state_emit(struct nvfx_context *nvfx) ; MARK_RING(chan, max_relocs * 2, max_relocs * 2); nvfx_state_relocate(nvfx); + + unsigned render_temps = nvfx->state.render_temps; + if(render_temps) + { + for(int i = 0; i < nvfx->framebuffer.nr_cbufs; ++i) + { + if(render_temps & (1 << i)) + util_dirty_surface_set_dirty(nvfx_surface_get_dirty_surfaces(nvfx->framebuffer.cbufs[i]), + (struct util_dirty_surface*)nvfx->framebuffer.cbufs[i]); + } + + if(render_temps & 0x80) + util_dirty_surface_set_dirty(nvfx_surface_get_dirty_surfaces(nvfx->framebuffer.zsbuf), + (struct util_dirty_surface*)nvfx->framebuffer.zsbuf); + } } void diff --git a/src/gallium/drivers/nvfx/nvfx_state_fb.c b/src/gallium/drivers/nvfx/nvfx_state_fb.c index e111d11627..80b0f21575 100644 --- a/src/gallium/drivers/nvfx/nvfx_state_fb.c +++ b/src/gallium/drivers/nvfx/nvfx_state_fb.c @@ -1,19 +1,56 @@ #include "nvfx_context.h" #include "nvfx_resource.h" #include "nouveau/nouveau_util.h" +#include "util/u_format.h" -void -nvfx_state_framebuffer_validate(struct nvfx_context *nvfx) +static inline boolean +nvfx_surface_linear_renderable(struct pipe_surface* surf) +{ + return (surf->texture->flags & NVFX_RESOURCE_FLAG_LINEAR) + && !(surf->offset & 63) + && !(((struct nvfx_surface*)surf)->pitch & 63); +} + +static inline boolean +nvfx_surface_swizzled_renderable(struct pipe_framebuffer_state* fb, struct pipe_surface* surf) +{ + /* TODO: return FALSE if we have a format not supporting swizzled rendering (e.g. r8); currently those are not supported at all */ + return !((struct nvfx_miptree*)surf->texture)->linear_pitch + && (surf->texture->target != PIPE_TEXTURE_3D || u_minify(surf->texture->depth0, surf->level) <= 1) + && !(surf->offset & 127) + && (surf->width == fb->width) + && (surf->height == fb->height) + && !((struct nvfx_surface*)surf)->temp; +} + +static boolean +nvfx_surface_get_render_target(struct pipe_surface* surf, int all_swizzled, struct nvfx_render_target* target) +{ + struct nvfx_surface* ns = (struct nvfx_surface*)surf; + if(!ns->temp) + { + target->bo = ((struct nvfx_miptree*)surf->texture)->base.bo; + target->offset = surf->offset; + target->pitch = align(ns->pitch, 64); + assert(target->pitch); + return FALSE; + } + else + { + target->offset = 0; + target->pitch = ns->temp->linear_pitch; + target->bo = ns->temp->base.bo; + assert(target->pitch); + return TRUE; + } +} + +int +nvfx_framebuffer_prepare(struct nvfx_context *nvfx) { struct pipe_framebuffer_state *fb = &nvfx->framebuffer; - struct nouveau_channel *chan = nvfx->screen->base.channel; - uint32_t rt_enable = 0, rt_format = 0; - int i, colour_format = 0, zeta_format = 0; - int depth_only = 0; - unsigned rt_flags = NOUVEAU_BO_RDWR | NOUVEAU_BO_VRAM; - unsigned w = fb->width; - unsigned h = fb->height; - int colour_bits = 32, zeta_bits = 32; + int i, color_format = 0, zeta_format = 0; + int all_swizzled = 1; if(!nvfx->is_nv4x) assert(fb->nr_cbufs <= 2); @@ -21,113 +58,135 @@ nvfx_state_framebuffer_validate(struct nvfx_context *nvfx) assert(fb->nr_cbufs <= 4); for (i = 0; i < fb->nr_cbufs; i++) { - if (colour_format) - assert(colour_format == fb->cbufs[i]->format); - else - colour_format = fb->cbufs[i]->format; - - rt_enable |= (NV34TCL_RT_ENABLE_COLOR0 << i); - nvfx->hw_rt[i].bo = ((struct nvfx_miptree*)fb->cbufs[i]->texture)->base.bo; - nvfx->hw_rt[i].offset = fb->cbufs[i]->offset; - nvfx->hw_rt[i].pitch = ((struct nvfx_surface *)fb->cbufs[i])->pitch; + if (color_format) { + if(color_format != fb->cbufs[i]->format) + return -1; + } else + color_format = fb->cbufs[i]->format; + + if(!nvfx_surface_swizzled_renderable(fb, fb->cbufs[i])) + all_swizzled = 0; } - for(; i < 4; ++i) - nvfx->hw_rt[i].bo = 0; + if (fb->zsbuf) { + /* TODO: return FALSE if we have a format not supporting a depth buffer (e.g. r8); currently those are not supported at all */ + if(!nvfx_surface_swizzled_renderable(fb, fb->zsbuf)) + all_swizzled = 0; + + if(all_swizzled && util_format_get_blocksize(color_format) != util_format_get_blocksize(zeta_format)) + all_swizzled = 0; + } + + for (i = 0; i < fb->nr_cbufs; i++) { + if(!((struct nvfx_surface*)fb->cbufs[i])->temp && !all_swizzled && !nvfx_surface_linear_renderable(fb->cbufs[i])) + nvfx_surface_create_temp(&nvfx->pipe, fb->cbufs[i]); + } + + if(fb->zsbuf) { + if(!((struct nvfx_surface*)fb->zsbuf)->temp && !all_swizzled && !nvfx_surface_linear_renderable(fb->zsbuf)) + nvfx_surface_create_temp(&nvfx->pipe, fb->zsbuf); + } + + return all_swizzled; +} + +void +nvfx_framebuffer_validate(struct nvfx_context *nvfx, unsigned prepare_result) +{ + struct pipe_framebuffer_state *fb = &nvfx->framebuffer; + struct nouveau_channel *chan = nvfx->screen->base.channel; + uint32_t rt_enable, rt_format; + int i; + unsigned rt_flags = NOUVEAU_BO_RDWR | NOUVEAU_BO_VRAM; + unsigned w = fb->width; + unsigned h = fb->height; + + rt_enable = (NV34TCL_RT_ENABLE_COLOR0 << fb->nr_cbufs) - 1; if (rt_enable & (NV34TCL_RT_ENABLE_COLOR1 | NV40TCL_RT_ENABLE_COLOR2 | NV40TCL_RT_ENABLE_COLOR3)) rt_enable |= NV34TCL_RT_ENABLE_MRT; + nvfx->state.render_temps = 0; + + for (i = 0; i < fb->nr_cbufs; i++) + nvfx->state.render_temps |= nvfx_surface_get_render_target(fb->cbufs[i], prepare_result, &nvfx->hw_rt[i]) << i; + + for(; i < 4; ++i) + nvfx->hw_rt[i].bo = 0; + if (fb->zsbuf) { - zeta_format = fb->zsbuf->format; - nvfx->hw_zeta.bo = ((struct nvfx_miptree*)fb->zsbuf->texture)->base.bo; - nvfx->hw_zeta.offset = fb->zsbuf->offset; - nvfx->hw_zeta.pitch = ((struct nvfx_surface *)fb->zsbuf)->pitch; - } - else - nvfx->hw_zeta.bo = 0; - - if (rt_enable & (NV34TCL_RT_ENABLE_COLOR0 | NV34TCL_RT_ENABLE_COLOR1 | - NV40TCL_RT_ENABLE_COLOR2 | NV40TCL_RT_ENABLE_COLOR3)) { - /* Render to at least a colour buffer */ - if (!(fb->cbufs[0]->texture->flags & NVFX_RESOURCE_FLAG_LINEAR)) { - assert(!(fb->width & (fb->width - 1)) && !(fb->height & (fb->height - 1))); - for (i = 1; i < fb->nr_cbufs; i++) - assert(!(fb->cbufs[i]->texture->flags & NVFX_RESOURCE_FLAG_LINEAR)); - - rt_format = NV34TCL_RT_FORMAT_TYPE_SWIZZLED | - (log2i(fb->cbufs[0]->width) << NV34TCL_RT_FORMAT_LOG2_WIDTH_SHIFT) | - (log2i(fb->cbufs[0]->height) << NV34TCL_RT_FORMAT_LOG2_HEIGHT_SHIFT); - } - else - rt_format = NV34TCL_RT_FORMAT_TYPE_LINEAR; - } else if (fb->zsbuf) { - depth_only = 1; - - /* Render to depth buffer only */ - if (!(fb->zsbuf->texture->flags & NVFX_RESOURCE_FLAG_LINEAR)) { - assert(!(fb->width & (fb->width - 1)) && !(fb->height & (fb->height - 1))); - - rt_format = NV34TCL_RT_FORMAT_TYPE_SWIZZLED | - (log2i(fb->zsbuf->width) << NV34TCL_RT_FORMAT_LOG2_WIDTH_SHIFT) | - (log2i(fb->zsbuf->height) << NV34TCL_RT_FORMAT_LOG2_HEIGHT_SHIFT); - } - else - rt_format = NV34TCL_RT_FORMAT_TYPE_LINEAR; - } else { - return; + nvfx->state.render_temps |= nvfx_surface_get_render_target(fb->zsbuf, prepare_result, &nvfx->hw_zeta) << 7; + + assert(util_format_get_stride(fb->zsbuf->format, fb->width) <= nvfx->hw_zeta.pitch); + assert(nvfx->hw_zeta.offset + nvfx->hw_zeta.pitch * fb->height <= nvfx->hw_zeta.bo->size); } - switch (colour_format) { - case PIPE_FORMAT_B8G8R8X8_UNORM: - rt_format |= NV34TCL_RT_FORMAT_COLOR_X8R8G8B8; - break; - case PIPE_FORMAT_B8G8R8A8_UNORM: - case 0: - rt_format |= NV34TCL_RT_FORMAT_COLOR_A8R8G8B8; - break; - case PIPE_FORMAT_B5G6R5_UNORM: + if (prepare_result) { + assert(!(fb->width & (fb->width - 1)) && !(fb->height & (fb->height - 1))); + + rt_format = NV34TCL_RT_FORMAT_TYPE_SWIZZLED | + (log2i(fb->width) << NV34TCL_RT_FORMAT_LOG2_WIDTH_SHIFT) | + (log2i(fb->height) << NV34TCL_RT_FORMAT_LOG2_HEIGHT_SHIFT); + } else + rt_format = NV34TCL_RT_FORMAT_TYPE_LINEAR; + + if(fb->nr_cbufs > 0) { + switch (fb->cbufs[0]->format) { + case PIPE_FORMAT_B8G8R8X8_UNORM: + rt_format |= NV34TCL_RT_FORMAT_COLOR_X8R8G8B8; + break; + case PIPE_FORMAT_B8G8R8A8_UNORM: + case 0: + rt_format |= NV34TCL_RT_FORMAT_COLOR_A8R8G8B8; + break; + case PIPE_FORMAT_B5G6R5_UNORM: + rt_format |= NV34TCL_RT_FORMAT_COLOR_R5G6B5; + break; + default: + assert(0); + } + } else if(fb->zsbuf && util_format_get_blocksize(fb->zsbuf->format) == 2) rt_format |= NV34TCL_RT_FORMAT_COLOR_R5G6B5; - colour_bits = 16; - break; - default: - assert(0); - } + else + rt_format |= NV34TCL_RT_FORMAT_COLOR_A8R8G8B8; - switch (zeta_format) { - case PIPE_FORMAT_Z16_UNORM: + if(fb->zsbuf) { + switch (fb->zsbuf->format) { + case PIPE_FORMAT_Z16_UNORM: + rt_format |= NV34TCL_RT_FORMAT_ZETA_Z16; + break; + case PIPE_FORMAT_S8_USCALED_Z24_UNORM: + case PIPE_FORMAT_X8Z24_UNORM: + case 0: + rt_format |= NV34TCL_RT_FORMAT_ZETA_Z24S8; + break; + default: + assert(0); + } + } else if(fb->nr_cbufs && util_format_get_blocksize(fb->cbufs[0]->format) == 2) rt_format |= NV34TCL_RT_FORMAT_ZETA_Z16; - zeta_bits = 16; - break; - case PIPE_FORMAT_S8_USCALED_Z24_UNORM: - case PIPE_FORMAT_X8Z24_UNORM: - case 0: + else rt_format |= NV34TCL_RT_FORMAT_ZETA_Z24S8; - break; - default: - assert(0); - } - if ((!nvfx->is_nv4x) && colour_bits > zeta_bits) { - /* TODO: does this limitation really exist? - TODO: can it be worked around somehow? */ - assert(0); - } + if ((rt_enable & NV34TCL_RT_ENABLE_COLOR0) || fb->zsbuf) { + struct nvfx_render_target *rt0 = &nvfx->hw_rt[0]; + uint32_t pitch; + + if(!(rt_enable & NV34TCL_RT_ENABLE_COLOR0)) + rt0 = &nvfx->hw_zeta; - if ((rt_enable & NV34TCL_RT_ENABLE_COLOR0) - || ((!nvfx->is_nv4x) && depth_only)) { - struct nvfx_render_target *rt0 = (depth_only ? &nvfx->hw_zeta : &nvfx->hw_rt[0]); - uint32_t pitch = rt0->pitch; + pitch = rt0->pitch; if(!nvfx->is_nv4x) { - if (nvfx->hw_zeta.bo) { + if (nvfx->hw_zeta.bo) pitch |= (nvfx->hw_zeta.pitch << 16); - } else { + else pitch |= (pitch << 16); - } } + //printf("rendering to bo %p [%i] at offset %i with pitch %i\n", rt0->bo, rt0->bo->handle, rt0->offset, pitch); + OUT_RING(chan, RING_3D(NV34TCL_DMA_COLOR0, 1)); OUT_RELOC(chan, rt0->bo, 0, rt_flags | NOUVEAU_BO_OR, @@ -180,7 +239,7 @@ nvfx_state_framebuffer_validate(struct nvfx_context *nvfx) } } - if (zeta_format) { + if (fb->zsbuf) { OUT_RING(chan, RING_3D(NV34TCL_DMA_ZETA, 1)); OUT_RELOC(chan, nvfx->hw_zeta.bo, 0, rt_flags | NOUVEAU_BO_OR, diff --git a/src/gallium/drivers/nvfx/nvfx_surface.c b/src/gallium/drivers/nvfx/nvfx_surface.c index a97f342c64..8208c67f2a 100644 --- a/src/gallium/drivers/nvfx/nvfx_surface.c +++ b/src/gallium/drivers/nvfx/nvfx_surface.c @@ -94,23 +94,44 @@ nvfx_region_fixup_swizzled(struct nv04_region* rgn, unsigned zslice, unsigned wi } static INLINE void -nvfx_region_init_for_surface(struct nv04_region* rgn, struct nvfx_surface* surf, unsigned x, unsigned y) +nvfx_region_init_for_surface(struct nv04_region* rgn, struct nvfx_surface* surf, unsigned x, unsigned y, bool for_write) { - rgn->bo = ((struct nvfx_resource*)surf->base.texture)->bo; - rgn->offset = surf->base.offset; - rgn->pitch = surf->pitch; rgn->x = x; rgn->y = y; rgn->z = 0; + nvfx_region_set_format(rgn, surf->base.base.format); - nvfx_region_set_format(rgn, surf->base.format); - if(!(surf->base.texture->flags & NVFX_RESOURCE_FLAG_LINEAR)) - nvfx_region_fixup_swizzled(rgn, surf->base.zslice, surf->base.width, surf->base.height, u_minify(surf->base.texture->depth0, surf->base.level)); + if(surf->temp) + { + rgn->bo = surf->temp->base.bo; + rgn->offset = 0; + rgn->pitch = surf->temp->linear_pitch; + + if(for_write) + util_dirty_surface_set_dirty(nvfx_surface_get_dirty_surfaces(&surf->base.base), &surf->base); + } else { + rgn->bo = ((struct nvfx_resource*)surf->base.base.texture)->bo; + rgn->offset = surf->base.base.offset; + rgn->pitch = surf->pitch; + + if(!(surf->base.base.texture->flags & NVFX_RESOURCE_FLAG_LINEAR)) + nvfx_region_fixup_swizzled(rgn, surf->base.base.zslice, surf->base.base.width, surf->base.base.height, u_minify(surf->base.base.texture->depth0, surf->base.base.level)); + } } static INLINE void -nvfx_region_init_for_subresource(struct nv04_region* rgn, struct pipe_resource* pt, struct pipe_subresource sub, unsigned x, unsigned y, unsigned z) +nvfx_region_init_for_subresource(struct nv04_region* rgn, struct pipe_resource* pt, struct pipe_subresource sub, unsigned x, unsigned y, unsigned z, bool for_write) { + if(pt->target != PIPE_BUFFER) + { + struct nvfx_surface* ns = (struct nvfx_surface*)util_surfaces_peek(&((struct nvfx_miptree*)pt)->surfaces, pt, sub.face, sub.level, z); + if(ns && util_dirty_surface_is_dirty(&ns->base)) + { + nvfx_region_init_for_surface(rgn, ns, x, y, for_write); + return; + } + } + rgn->bo = ((struct nvfx_resource*)pt)->bo; rgn->offset = nvfx_subresource_offset(pt, sub.face, sub.level, z); rgn->pitch = nvfx_subresource_pitch(pt, sub.level); @@ -165,6 +186,7 @@ nv04_scaled_image_format(enum pipe_format format) } } +// XXX: must save index buffer too! static struct blitter_context* nvfx_get_blitter(struct pipe_context* pipe, int copy) { @@ -237,8 +259,8 @@ nvfx_resource_copy_region(struct pipe_context *pipe, int dst_to_gpu = dstr->usage != PIPE_USAGE_DYNAMIC && dstr->usage != PIPE_USAGE_STAGING; int src_on_gpu = nvfx_resource_on_gpu(srcr); - nvfx_region_init_for_subresource(&dst, dstr, subdst, dstx, dsty, dstz); - nvfx_region_init_for_subresource(&src, srcr, subsrc, srcx, srcy, srcz); + nvfx_region_init_for_subresource(&dst, dstr, subdst, dstx, dsty, dstz, TRUE); + nvfx_region_init_for_subresource(&src, srcr, subsrc, srcx, srcy, srcz, FALSE); w = util_format_get_stride(dstr->format, w) >> dst.bpps; h = util_format_get_nblocksy(dstr->format, h); @@ -293,10 +315,11 @@ nvfx_surface_fill(struct pipe_context* pipe, struct pipe_surface *dsts, struct nv04_2d_context *ctx = nvfx_screen(pipe->screen)->eng2d; struct nv04_region dst; /* Always try to use the GPU right now, if possible - * If the user wanted the surface data on the CPU, he would have cleared with memset */ + * If the user wanted the surface data on the CPU, he would have cleared with memset (hopefully) */ // we don't care about interior pixel order since we set all them to the same value - nvfx_region_init_for_surface(&dst, (struct nvfx_surface*)dsts, dx, dy); + nvfx_region_init_for_surface(&dst, (struct nvfx_surface*)dsts, dx, dy, TRUE); + w = util_format_get_stride(dsts->format, w) >> dst.bpps; h = util_format_get_nblocksy(dsts->format, h); @@ -341,6 +364,80 @@ nvfx_screen_surface_init(struct pipe_screen *pscreen) return 0; } +static void +nvfx_surface_copy_temp(struct pipe_context* pipe, struct pipe_surface* surf, int to_temp) +{ + struct nvfx_surface* ns = (struct nvfx_surface*)surf; + struct pipe_subresource tempsr, surfsr; + struct pipe_resource *idxbuf_buffer; + unsigned idxbuf_format; + + tempsr.face = 0; + tempsr.level = 0; + surfsr.face = surf->face; + surfsr.level = surf->level; + + // TODO: do this properly, in blitter save + idxbuf_buffer = ((struct nvfx_context*)pipe)->idxbuf_buffer; + idxbuf_format = ((struct nvfx_context*)pipe)->idxbuf_format; + + if(to_temp) + nvfx_resource_copy_region(pipe, &ns->temp->base.base, tempsr, 0, 0, 0, surf->texture, surfsr, 0, 0, surf->zslice, surf->width, surf->height); + else + nvfx_resource_copy_region(pipe, surf->texture, surfsr, 0, 0, surf->zslice, &ns->temp->base.base, tempsr, 0, 0, 0, surf->width, surf->height); + + ((struct nvfx_context*)pipe)->idxbuf_buffer = idxbuf_buffer; + ((struct nvfx_context*)pipe)->idxbuf_format = idxbuf_format; +} + +void +nvfx_surface_create_temp(struct pipe_context* pipe, struct pipe_surface* surf) +{ + struct nvfx_surface* ns = (struct nvfx_surface*)surf; + struct pipe_resource template; + memset(&template, 0, sizeof(struct pipe_resource)); + template.target = PIPE_TEXTURE_2D; + template.format = surf->format; + template.width0 = surf->width; + template.height0 = surf->height; + template.depth0 = 1; + template.nr_samples = surf->texture->nr_samples; + template.flags = NVFX_RESOURCE_FLAG_LINEAR; + + ns->temp = (struct nvfx_miptree*)nvfx_miptree_create(pipe->screen, &template); + nvfx_surface_copy_temp(pipe, surf, 1); +} + +void +nvfx_surface_flush(struct pipe_context* pipe, struct pipe_surface* surf) +{ + struct nvfx_context* nvfx = (struct nvfx_context*)pipe; + struct nvfx_surface* ns = (struct nvfx_surface*)surf; + boolean bound = FALSE; + + /* must be done before the copy, otherwise the copy will use the temp as destination */ + util_dirty_surface_set_clean(nvfx_surface_get_dirty_surfaces(surf), &ns->base); + + nvfx_surface_copy_temp(pipe, surf, 0); + + if(nvfx->framebuffer.zsbuf == surf) + bound = TRUE; + else + { + for(unsigned i = 0; i < nvfx->framebuffer.nr_cbufs; ++i) + { + if(nvfx->framebuffer.cbufs[i] == surf) + { + bound = TRUE; + break; + } + } + } + + if(!bound) + pipe_resource_reference((struct pipe_resource**)&ns->temp, 0); +} + static void nvfx_clear_render_target(struct pipe_context *pipe, struct pipe_surface *dst, -- cgit v1.2.3 From 0481ed25c9c35178bf5151c80f4c36ad42b75648 Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Sun, 18 Apr 2010 16:43:19 +0200 Subject: nvfx: new 2D: use a CPU copy for up to 4 pixels, up from 0 Seems a reasonable threshold for now. Significantly speeds up Piglit's 1x1 glReadPixels (but, you know, reading pixels in 1x1 blocks is NOT a good idea, especially if you might be running on a less-than-perfect driver). --- src/gallium/drivers/nvfx/nvfx_surface.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/nvfx/nvfx_surface.c b/src/gallium/drivers/nvfx/nvfx_surface.c index 8208c67f2a..7efdd954b4 100644 --- a/src/gallium/drivers/nvfx/nvfx_surface.c +++ b/src/gallium/drivers/nvfx/nvfx_surface.c @@ -250,11 +250,7 @@ nvfx_resource_copy_region(struct pipe_context *pipe, static int copy_threshold = -1; if(copy_threshold < 0) - { - copy_threshold = debug_get_num_option("NOUVEAU_COPY_THRESHOLD", 0); - if(copy_threshold < 0) - copy_threshold = 0; - } + copy_threshold = debug_get_num_option("NOUVEAU_COPY_THRESHOLD", 4); int dst_to_gpu = dstr->usage != PIPE_USAGE_DYNAMIC && dstr->usage != PIPE_USAGE_STAGING; int src_on_gpu = nvfx_resource_on_gpu(srcr); -- cgit v1.2.3 From 4e2080a86e0cbb93c72bbf4acace53867fac8276 Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Tue, 3 Aug 2010 22:49:19 +0200 Subject: nvfx: new 2D: unify textures and buffers Stop using the vtbl, and use real transfers for buffers too. --- src/gallium/drivers/nvfx/nvfx_buffer.c | 77 +------------------------------- src/gallium/drivers/nvfx/nvfx_miptree.c | 35 +-------------- src/gallium/drivers/nvfx/nvfx_resource.c | 55 ++++++++++++++--------- src/gallium/drivers/nvfx/nvfx_resource.h | 16 +++---- 4 files changed, 46 insertions(+), 137 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/nvfx/nvfx_buffer.c b/src/gallium/drivers/nvfx/nvfx_buffer.c index 4482d9683e..44680e5195 100644 --- a/src/gallium/drivers/nvfx/nvfx_buffer.c +++ b/src/gallium/drivers/nvfx/nvfx_buffer.c @@ -7,13 +7,7 @@ #include "nouveau/nouveau_winsys.h" #include "nvfx_resource.h" - -/* Currently using separate implementations for buffers and textures, - * even though gallium has a unified abstraction of these objects. - * Eventually these should be combined, and mechanisms like transfers - * be adapted to work for both buffer and texture uploads. - */ -static void nvfx_buffer_destroy(struct pipe_screen *pscreen, +void nvfx_buffer_destroy(struct pipe_screen *pscreen, struct pipe_resource *presource) { struct nvfx_resource *buffer = nvfx_resource(presource); @@ -22,70 +16,6 @@ static void nvfx_buffer_destroy(struct pipe_screen *pscreen, FREE(buffer); } - - - -/* Utility functions for transfer create/destroy are hooked in and - * just record the arguments to those functions. - */ -static void * -nvfx_buffer_transfer_map( struct pipe_context *pipe, - struct pipe_transfer *transfer ) -{ - struct nvfx_resource *buffer = nvfx_resource(transfer->resource); - uint8_t *map; - - map = nouveau_screen_bo_map_range( pipe->screen, - buffer->bo, - transfer->box.x, - transfer->box.width, - nouveau_screen_transfer_flags(transfer->usage) ); - if (map == NULL) - return NULL; - - return map + transfer->box.x; -} - - - -static void nvfx_buffer_transfer_flush_region( struct pipe_context *pipe, - struct pipe_transfer *transfer, - const struct pipe_box *box) -{ - struct nvfx_resource *buffer = nvfx_resource(transfer->resource); - - nouveau_screen_bo_map_flush_range(pipe->screen, - buffer->bo, - transfer->box.x + box->x, - box->width); -} - -static void nvfx_buffer_transfer_unmap( struct pipe_context *pipe, - struct pipe_transfer *transfer ) -{ - struct nvfx_resource *buffer = nvfx_resource(transfer->resource); - - nouveau_screen_bo_unmap(pipe->screen, buffer->bo); -} - - - - -struct u_resource_vtbl nvfx_buffer_vtbl = -{ - u_default_resource_get_handle, /* get_handle */ - nvfx_buffer_destroy, /* resource_destroy */ - NULL, /* is_resource_referenced */ - u_default_get_transfer, /* get_transfer */ - u_default_transfer_destroy, /* transfer_destroy */ - nvfx_buffer_transfer_map, /* transfer_map */ - nvfx_buffer_transfer_flush_region, /* transfer_flush_region */ - nvfx_buffer_transfer_unmap, /* transfer_unmap */ - u_default_transfer_inline_write /* transfer_inline_write */ -}; - - - struct pipe_resource * nvfx_buffer_create(struct pipe_screen *pscreen, const struct pipe_resource *template) @@ -98,7 +28,6 @@ nvfx_buffer_create(struct pipe_screen *pscreen, buffer->base = *template; buffer->base.flags |= NVFX_RESOURCE_FLAG_LINEAR; - buffer->vtbl = &nvfx_buffer_vtbl; pipe_reference_init(&buffer->base.reference, 1); buffer->base.screen = pscreen; @@ -132,7 +61,6 @@ nvfx_user_buffer_create(struct pipe_screen *pscreen, return NULL; pipe_reference_init(&buffer->base.reference, 1); - buffer->vtbl = &nvfx_buffer_vtbl; buffer->base.flags = NVFX_RESOURCE_FLAG_LINEAR; buffer->base.screen = pscreen; buffer->base.format = PIPE_FORMAT_R8_UNORM; @@ -145,11 +73,10 @@ nvfx_user_buffer_create(struct pipe_screen *pscreen, buffer->bo = nouveau_screen_bo_user(pscreen, ptr, bytes); if (!buffer->bo) goto fail; - + return &buffer->base; fail: FREE(buffer); return NULL; } - diff --git a/src/gallium/drivers/nvfx/nvfx_miptree.c b/src/gallium/drivers/nvfx/nvfx_miptree.c index 530d705e13..559e832109 100644 --- a/src/gallium/drivers/nvfx/nvfx_miptree.c +++ b/src/gallium/drivers/nvfx/nvfx_miptree.c @@ -98,23 +98,6 @@ nvfx_miptree_layout(struct nvfx_miptree *mt) return offset; } -static boolean -nvfx_miptree_get_handle(struct pipe_screen *pscreen, - struct pipe_resource *ptexture, - struct winsys_handle *whandle) -{ - struct nvfx_miptree* mt = (struct nvfx_miptree*)ptexture; - - if (!mt || !mt->base.bo) - return FALSE; - - return nouveau_screen_bo_get_handle(pscreen, - mt->base.bo, - mt->linear_pitch, - whandle); -} - - static void nvfx_miptree_surface_final_destroy(struct pipe_surface* ps) { @@ -124,7 +107,7 @@ nvfx_miptree_surface_final_destroy(struct pipe_surface* ps) FREE(ps); } -static void +void nvfx_miptree_destroy(struct pipe_screen *screen, struct pipe_resource *pt) { struct nvfx_miptree *mt = (struct nvfx_miptree *)pt; @@ -133,19 +116,6 @@ nvfx_miptree_destroy(struct pipe_screen *screen, struct pipe_resource *pt) FREE(mt); } -struct u_resource_vtbl nvfx_miptree_vtbl = -{ - nvfx_miptree_get_handle, /* get_handle */ - nvfx_miptree_destroy, /* resource_destroy */ - NULL, /* is_resource_referenced */ - nvfx_transfer_new, /* get_transfer */ - util_staging_transfer_destroy, /* transfer_destroy */ - nvfx_transfer_map, /* transfer_map */ - u_default_transfer_flush_region, /* transfer_flush_region */ - nvfx_transfer_unmap, /* transfer_unmap */ - u_default_transfer_inline_write /* transfer_inline_write */ -}; - static struct nvfx_miptree* nvfx_miptree_create_skeleton(struct pipe_screen *pscreen, const struct pipe_resource *pt) { @@ -159,7 +129,6 @@ nvfx_miptree_create_skeleton(struct pipe_screen *pscreen, const struct pipe_reso return NULL; mt->base.base = *pt; - mt->base.vtbl = &nvfx_miptree_vtbl; util_dirty_surfaces_init(&mt->dirty_surfaces); pipe_reference_init(&mt->base.base.reference, 1); @@ -221,8 +190,6 @@ nvfx_miptree_from_handle(struct pipe_screen *pscreen, const struct pipe_resource return &mt->base.base; } -/* Surface helpers, not strictly required to implement the resource vtbl: - */ struct pipe_surface * nvfx_miptree_surface_new(struct pipe_screen *pscreen, struct pipe_resource *pt, unsigned face, unsigned level, unsigned zslice, diff --git a/src/gallium/drivers/nvfx/nvfx_resource.c b/src/gallium/drivers/nvfx/nvfx_resource.c index 10cdeed2a3..1c921b4710 100644 --- a/src/gallium/drivers/nvfx/nvfx_resource.c +++ b/src/gallium/drivers/nvfx/nvfx_resource.c @@ -1,23 +1,16 @@ #include "pipe/p_context.h" +#include "util/u_staging.h" #include "nvfx_resource.h" +#include "nvfx_transfer.h" #include "nouveau/nouveau_screen.h" - -/* This doesn't look quite right - this query is supposed to ask - * whether the particular context has references to the resource in - * any unflushed rendering command buffer, and hence requires a - * pipe->flush() for serializing some modification to that resource. - * - * This seems to be answering the question of whether the resource is - * currently on hardware. - */ static unsigned int nvfx_resource_is_referenced(struct pipe_context *pipe, - struct pipe_resource *resource, + struct pipe_resource *pr, unsigned face, unsigned level) { - return nouveau_reference_flags(nvfx_resource(resource)->bo); + return !!nouveau_reference_flags(nvfx_resource(pr)->bo); } static struct pipe_resource * @@ -30,6 +23,15 @@ nvfx_resource_create(struct pipe_screen *screen, return nvfx_miptree_create(screen, template); } +static void +nvfx_resource_destroy(struct pipe_screen *screen, struct pipe_resource *pr) +{ + if (pr->target == PIPE_BUFFER) + return nvfx_buffer_destroy(screen, pr); + else + return nvfx_miptree_destroy(screen, pr); +} + static struct pipe_resource * nvfx_resource_from_handle(struct pipe_screen * screen, const struct pipe_resource *template, @@ -41,15 +43,28 @@ nvfx_resource_from_handle(struct pipe_screen * screen, return nvfx_miptree_from_handle(screen, template, whandle); } +static boolean +nvfx_resource_get_handle(struct pipe_screen *pscreen, + struct pipe_resource *pr, + struct winsys_handle *whandle) +{ + struct nvfx_resource* res = (struct nvfx_resource*)pr; + + if (!res || !res->bo) + return FALSE; + + return nouveau_screen_bo_get_handle(pscreen, res->bo, nvfx_subresource_pitch(pr, 0), whandle); +} + void nvfx_init_resource_functions(struct pipe_context *pipe) { - pipe->get_transfer = u_get_transfer_vtbl; - pipe->transfer_map = u_transfer_map_vtbl; - pipe->transfer_flush_region = u_transfer_flush_region_vtbl; - pipe->transfer_unmap = u_transfer_unmap_vtbl; - pipe->transfer_destroy = u_transfer_destroy_vtbl; - pipe->transfer_inline_write = u_transfer_inline_write_vtbl; + pipe->get_transfer = nvfx_transfer_new; + pipe->transfer_map = nvfx_transfer_map; + pipe->transfer_flush_region = u_default_transfer_flush_region; + pipe->transfer_unmap = nvfx_transfer_unmap; + pipe->transfer_destroy = util_staging_transfer_destroy; + pipe->transfer_inline_write = u_default_transfer_inline_write; pipe->is_resource_referenced = nvfx_resource_is_referenced; } @@ -58,10 +73,10 @@ nvfx_screen_init_resource_functions(struct pipe_screen *pscreen) { pscreen->resource_create = nvfx_resource_create; pscreen->resource_from_handle = nvfx_resource_from_handle; - pscreen->resource_get_handle = u_resource_get_handle_vtbl; - pscreen->resource_destroy = u_resource_destroy_vtbl; + pscreen->resource_get_handle = nvfx_resource_get_handle; + pscreen->resource_destroy = nvfx_resource_destroy; pscreen->user_buffer_create = nvfx_user_buffer_create; - + pscreen->get_tex_surface = nvfx_miptree_surface_new; pscreen->tex_surface_destroy = nvfx_miptree_surface_del; } diff --git a/src/gallium/drivers/nvfx/nvfx_resource.h b/src/gallium/drivers/nvfx/nvfx_resource.h index be1845dd9c..ff86f6d9cb 100644 --- a/src/gallium/drivers/nvfx/nvfx_resource.h +++ b/src/gallium/drivers/nvfx/nvfx_resource.h @@ -12,16 +12,8 @@ struct pipe_resource; struct nv04_region; - -/* This gets further specialized into either buffer or texture - * structures. In the future we'll want to remove much of that - * distinction, but for now try to keep as close to the existing code - * as possible and use the vtbl struct to choose between the two - * underlying implementations. - */ struct nvfx_resource { struct pipe_resource base; - struct u_resource_vtbl *vtbl; struct nouveau_bo *bo; }; @@ -105,6 +97,10 @@ nvfx_screen_init_resource_functions(struct pipe_screen *pscreen); struct pipe_resource * nvfx_miptree_create(struct pipe_screen *pscreen, const struct pipe_resource *pt); +void +nvfx_miptree_destroy(struct pipe_screen *pscreen, + struct pipe_resource *presource); + struct pipe_resource * nvfx_miptree_from_handle(struct pipe_screen *pscreen, const struct pipe_resource *template, @@ -114,6 +110,10 @@ struct pipe_resource * nvfx_buffer_create(struct pipe_screen *pscreen, const struct pipe_resource *template); +void +nvfx_buffer_destroy(struct pipe_screen *pscreen, + struct pipe_resource *presource); + struct pipe_resource * nvfx_user_buffer_create(struct pipe_screen *screen, void *ptr, -- cgit v1.2.3 From 73b7c6fb336ad3e717f8e961f4e2df761e94cd2f Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Sat, 7 Aug 2010 03:47:25 +0200 Subject: nvfx: refactor sampling code, add support for swizzles and depth tex This is a significant refactoring of the sampling code that: - Moves all generic functions in nvfx_fragtex.c - Adds a driver-specific sampler view structure and uses it to precompute texture setup as it should be done - Unifies a bit more of code between nv30 and nv40 - Adds support for sampler view swizzles - Support for specifying as sampler view format different from the resource one (only trivially) - Support for sampler view specification of first and last level - Support for depth textures on nv30, both for reading depth and for compare - Support for sRGB textures - Unifies the format table between nv30 and nv40 - Expands the format table to include essentially all supportable formats except mixed sign and "autonormal" formats - Fixes the "is format supported" logic, which was quite broken, and makes it use the format table Only tested on nv30 currently. --- src/gallium/drivers/nouveau/nouveau_class.h | 4 + src/gallium/drivers/nvfx/nv30_fragtex.c | 174 +++++++--------- src/gallium/drivers/nvfx/nv40_fragtex.c | 166 ++++++---------- src/gallium/drivers/nvfx/nvfx_context.c | 1 + src/gallium/drivers/nvfx/nvfx_context.h | 12 +- src/gallium/drivers/nvfx/nvfx_fragtex.c | 295 ++++++++++++++++++++++++++++ src/gallium/drivers/nvfx/nvfx_screen.c | 64 +++--- src/gallium/drivers/nvfx/nvfx_state.c | 112 ----------- src/gallium/drivers/nvfx/nvfx_tex.h | 90 ++++++--- 9 files changed, 525 insertions(+), 393 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/nouveau/nouveau_class.h b/src/gallium/drivers/nouveau/nouveau_class.h index adfdd37b1b..685fa00b45 100644 --- a/src/gallium/drivers/nouveau/nouveau_class.h +++ b/src/gallium/drivers/nouveau/nouveau_class.h @@ -6328,6 +6328,10 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #define NV34TCL_TX_FORMAT_FORMAT_R8G8B8_RECT 0x00001e00 #define NV34TCL_TX_FORMAT_FORMAT_A8L8_RECT 0x00002000 #define NV34TCL_TX_FORMAT_FORMAT_DSDT8 0x00002800 +#define NV34TCL_TX_FORMAT_FORMAT_Z24 0x2a00 +#define NV34TCL_TX_FORMAT_FORMAT_Z24_RECT 0x2b00 /* XXX: guess! */ +#define NV34TCL_TX_FORMAT_FORMAT_Z16 0x2c00 +#define NV34TCL_TX_FORMAT_FORMAT_Z16_RECT 0x2d00 /* XXX: guess! */ #define NV34TCL_TX_FORMAT_FORMAT_HILO16 0x00003300 #define NV34TCL_TX_FORMAT_FORMAT_HILO16_RECT 0x00003600 #define NV34TCL_TX_FORMAT_FORMAT_HILO8 0x00004400 diff --git a/src/gallium/drivers/nvfx/nv30_fragtex.c b/src/gallium/drivers/nvfx/nv30_fragtex.c index fbc69cf44a..63c578a0ce 100644 --- a/src/gallium/drivers/nvfx/nv30_fragtex.c +++ b/src/gallium/drivers/nvfx/nv30_fragtex.c @@ -10,88 +10,75 @@ nv30_sampler_state_init(struct pipe_context *pipe, struct nvfx_sampler_state *ps, const struct pipe_sampler_state *cso) { - if (cso->max_anisotropy >= 8) { - ps->en |= NV34TCL_TX_ENABLE_ANISO_8X; - } else - if (cso->max_anisotropy >= 4) { - ps->en |= NV34TCL_TX_ENABLE_ANISO_4X; - } else - if (cso->max_anisotropy >= 2) { - ps->en |= NV34TCL_TX_ENABLE_ANISO_2X; - } + float limit; + if (cso->max_anisotropy >= 2) { - float limit; + if (cso->max_anisotropy >= 8) + ps->en |= NV34TCL_TX_ENABLE_ANISO_8X; + else if (cso->max_anisotropy >= 4) + ps->en |= NV34TCL_TX_ENABLE_ANISO_4X; + else if (cso->max_anisotropy >= 2) + ps->en |= NV34TCL_TX_ENABLE_ANISO_2X; + } - limit = CLAMP(cso->lod_bias, -16.0, 15.0); - ps->filt |= (int)(cso->lod_bias * 256.0) & 0x1fff; + limit = CLAMP(cso->lod_bias, -16.0, 15.0); + ps->filt |= (int)(cso->lod_bias * 256.0) & 0x1fff; - limit = CLAMP(cso->max_lod, 0.0, 15.0); - ps->en |= (int)(limit) << 14 /*NV34TCL_TX_ENABLE_MIPMAP_MAX_LOD_SHIFT*/; + ps->max_lod = (int)CLAMP(cso->max_lod, 0.0, 15.0); + ps->min_lod = (int)CLAMP(cso->min_lod, 0.0, 15.0); - limit = CLAMP(cso->min_lod, 0.0, 15.0); - ps->en |= (int)(limit) << 26 /*NV34TCL_TX_ENABLE_MIPMAP_MIN_LOD_SHIFT*/; - } + ps->en |= NV34TCL_TX_ENABLE_ENABLE; } -#define _(m,tf,ts0x,ts0y,ts0z,ts0w,ts1x,ts1y,ts1z,ts1w) \ -[PIPE_FORMAT_##m] = { \ - NV34TCL_TX_FORMAT_FORMAT_##tf, \ - NV34TCL_TX_FORMAT_FORMAT_##tf##_RECT, \ - (NV34TCL_TX_SWIZZLE_S0_X_##ts0x | NV34TCL_TX_SWIZZLE_S0_Y_##ts0y | \ - NV34TCL_TX_SWIZZLE_S0_Z_##ts0z | NV34TCL_TX_SWIZZLE_S0_W_##ts0w | \ - NV34TCL_TX_SWIZZLE_S1_X_##ts1x | NV34TCL_TX_SWIZZLE_S1_Y_##ts1y | \ - NV34TCL_TX_SWIZZLE_S1_Z_##ts1z | NV34TCL_TX_SWIZZLE_S1_W_##ts1w) \ -} +void +nv30_sampler_view_init(struct pipe_context *pipe, + struct nvfx_sampler_view *sv) +{ + struct pipe_resource* pt = sv->base.texture; + struct nvfx_texture_format *tf = &nvfx_texture_formats[sv->base.format]; + unsigned txf; + unsigned level = pt->target == PIPE_TEXTURE_CUBE ? 0 : sv->base.first_level; + + assert(tf->fmt[0] >= 0); + + txf = sv->u.init_fmt; + txf |= (level != sv->base.last_level ? NV34TCL_TX_FORMAT_MIPMAP : 0); + txf |= log2i(u_minify(pt->width0, level)) << NV34TCL_TX_FORMAT_BASE_SIZE_U_SHIFT; + txf |= log2i(u_minify(pt->height0, level)) << NV34TCL_TX_FORMAT_BASE_SIZE_V_SHIFT; + txf |= log2i(u_minify(pt->depth0, level)) << NV34TCL_TX_FORMAT_BASE_SIZE_W_SHIFT; + txf |= 0x10000; + + sv->u.nv30.fmt[0] = tf->fmt[0] | txf; + sv->u.nv30.fmt[1] = tf->fmt[1] | txf; + sv->u.nv30.fmt[2] = tf->fmt[2] | txf; + sv->u.nv30.fmt[3] = tf->fmt[3] | txf; -struct nv30_texture_format { - int format; - int rect_format; - int swizzle; -}; - -#define NV34TCL_TX_FORMAT_FORMAT_DXT1_RECT NV34TCL_TX_FORMAT_FORMAT_DXT1 -#define NV34TCL_TX_FORMAT_FORMAT_DXT3_RECT NV34TCL_TX_FORMAT_FORMAT_DXT3 -#define NV34TCL_TX_FORMAT_FORMAT_DXT5_RECT NV34TCL_TX_FORMAT_FORMAT_DXT5 - -static struct nv30_texture_format -nv30_texture_formats[PIPE_FORMAT_COUNT] = { - [0 ... PIPE_FORMAT_COUNT - 1] = {-1, 0, 0}, - _(B8G8R8X8_UNORM, A8R8G8B8, S1, S1, S1, ONE, X, Y, Z, W), - _(B8G8R8A8_UNORM, A8R8G8B8, S1, S1, S1, S1, X, Y, Z, W), - _(B5G5R5A1_UNORM, A1R5G5B5, S1, S1, S1, S1, X, Y, Z, W), - _(B4G4R4A4_UNORM, A4R4G4B4, S1, S1, S1, S1, X, Y, Z, W), - _(B5G6R5_UNORM , R5G6B5 , S1, S1, S1, ONE, X, Y, Z, W), - _(L8_UNORM , L8 , S1, S1, S1, ONE, X, X, X, X), - _(A8_UNORM , L8 , ZERO, ZERO, ZERO, S1, X, X, X, X), - _(I8_UNORM , L8 , S1, S1, S1, S1, X, X, X, X), - _(L8A8_UNORM , A8L8 , S1, S1, S1, S1, X, X, X, Y), - _(Z16_UNORM , R5G6B5 , S1, S1, S1, ONE, X, X, X, X), - _(S8_USCALED_Z24_UNORM , A8R8G8B8, S1, S1, S1, ONE, X, X, X, X), - _(DXT1_RGB , DXT1 , S1, S1, S1, ONE, X, Y, Z, W), - _(DXT1_RGBA , DXT1 , S1, S1, S1, S1, X, Y, Z, W), - _(DXT3_RGBA , DXT3 , S1, S1, S1, S1, X, Y, Z, W), - _(DXT5_RGBA , DXT5 , S1, S1, S1, S1, X, Y, Z, W), - {}, -}; + sv->swizzle |= (nvfx_subresource_pitch(pt, 0) << NV34TCL_TX_SWIZZLE_RECT_PITCH_SHIFT); + + if(pt->height0 <= 1 || util_format_is_compressed(sv->base.format)) + sv->u.nv30.rect = -1; + else + sv->u.nv30.rect = !!(pt->flags & NVFX_RESOURCE_FLAG_LINEAR); + + sv->lod_offset = sv->base.first_level - level; + sv->max_lod_limit = sv->base.last_level - level; +} void nv30_fragtex_set(struct nvfx_context *nvfx, int unit) { struct nvfx_sampler_state *ps = nvfx->tex_sampler[unit]; - struct nvfx_miptree *mt = (struct nvfx_miptree *)nvfx->fragment_sampler_views[unit]->texture; - struct pipe_resource *pt = &mt->base.base; - struct nouveau_bo *bo = mt->base.bo; - struct nv30_texture_format *tf; + struct nvfx_sampler_view* sv = (struct nvfx_sampler_view*)nvfx->fragment_sampler_views[unit]; + struct nouveau_bo *bo = ((struct nvfx_miptree *)sv->base.texture)->base.bo; struct nouveau_channel* chan = nvfx->screen->base.channel; - uint32_t txf, txs; + unsigned txf; unsigned tex_flags = NOUVEAU_BO_VRAM | NOUVEAU_BO_GART | NOUVEAU_BO_RD; unsigned use_rect; + unsigned max_lod = MIN2(ps->max_lod + sv->lod_offset, sv->max_lod_limit); + unsigned min_lod = MIN2(ps->min_lod + sv->lod_offset, max_lod) ; - tf = &nv30_texture_formats[pt->format]; - assert(tf->format >= 0); - - if(pt->height0 <= 1 || util_format_is_compressed(pt->format)) + if(sv->u.nv30.rect < 0) { /* in the case of compressed or 1D textures, we can get away with this, * since the layout is the same @@ -100,9 +87,9 @@ nv30_fragtex_set(struct nvfx_context *nvfx, int unit) } else { - static int warned = 0; - if(!warned && !ps->fmt != !(pt->flags & NVFX_RESOURCE_FLAG_LINEAR)) { - warned = 1; + static boolean warned = FALSE; + if( !!ps->fmt != sv->u.nv30.rect && !warned) { + warned = TRUE; fprintf(stderr, "Unimplemented: coordinate normalization mismatch. Possible reasons:\n" "1. ARB_texture_non_power_of_two is being used despite the fact it isn't supported\n" @@ -110,51 +97,22 @@ nv30_fragtex_set(struct nvfx_context *nvfx, int unit) "3. The state tracker is not supported\n"); } - use_rect = pt->flags & NVFX_RESOURCE_FLAG_LINEAR; - } - - txf = use_rect ? tf->rect_format : tf->format; - txf |= ((pt->last_level>0) ? NV34TCL_TX_FORMAT_MIPMAP : 0); - txf |= log2i(pt->width0) << NV34TCL_TX_FORMAT_BASE_SIZE_U_SHIFT; - txf |= log2i(pt->height0) << NV34TCL_TX_FORMAT_BASE_SIZE_V_SHIFT; - txf |= log2i(pt->depth0) << NV34TCL_TX_FORMAT_BASE_SIZE_W_SHIFT; - txf |= NV34TCL_TX_FORMAT_NO_BORDER | 0x10000; - - switch (pt->target) { - case PIPE_TEXTURE_CUBE: - txf |= NV34TCL_TX_FORMAT_CUBIC; - /* fall-through */ - case PIPE_TEXTURE_2D: - case PIPE_TEXTURE_RECT: - txf |= NV34TCL_TX_FORMAT_DIMS_2D; - break; - case PIPE_TEXTURE_3D: - txf |= NV34TCL_TX_FORMAT_DIMS_3D; - break; - case PIPE_TEXTURE_1D: - txf |= NV34TCL_TX_FORMAT_DIMS_1D; - break; - default: - NOUVEAU_ERR("Unknown target %d\n", pt->target); - return; + use_rect = sv->u.nv30.rect; } - txs = tf->swizzle; - - if(use_rect) - txs |= nvfx_subresource_pitch(&mt->base, 0) << NV34TCL_TX_SWIZZLE_RECT_PITCH_SHIFT; + txf = sv->u.nv30.fmt[ps->compare + (use_rect ? 2 : 0)]; MARK_RING(chan, 9, 2); OUT_RING(chan, RING_3D(NV34TCL_TX_OFFSET(unit), 8)); - OUT_RELOC(chan, bo, 0, tex_flags | NOUVEAU_BO_LOW, 0, 0); - OUT_RELOC(chan, bo, txf, tex_flags | NOUVEAU_BO_OR, - NV34TCL_TX_FORMAT_DMA0, NV34TCL_TX_FORMAT_DMA1); - OUT_RING(chan, ps->wrap); - OUT_RING(chan, NV34TCL_TX_ENABLE_ENABLE | ps->en); - OUT_RING(chan, txs); - OUT_RING(chan, ps->filt | 0x2000 /*voodoo*/); - OUT_RING(chan, (pt->width0 << NV34TCL_TX_NPOT_SIZE_W_SHIFT) | - pt->height0); + OUT_RELOC(chan, bo, sv->offset, tex_flags | NOUVEAU_BO_LOW, 0, 0); + OUT_RELOC(chan, bo, txf, + tex_flags | NOUVEAU_BO_OR, + NV34TCL_TX_FORMAT_DMA0, NV34TCL_TX_FORMAT_DMA1); + OUT_RING(chan, (ps->wrap & sv->wrap_mask) | sv->wrap); + OUT_RING(chan, ps->en | (min_lod << NV34TCL_TX_ENABLE_MIPMAP_MIN_LOD_SHIFT) | (max_lod << NV34TCL_TX_ENABLE_MIPMAP_MAX_LOD_SHIFT)); + OUT_RING(chan, sv->swizzle); + OUT_RING(chan, ps->filt | sv->filt); + OUT_RING(chan, sv->npot_size); OUT_RING(chan, ps->bcol); nvfx->hw_txf[unit] = txf; diff --git a/src/gallium/drivers/nvfx/nv40_fragtex.c b/src/gallium/drivers/nvfx/nv40_fragtex.c index 87aa7eb1a2..5fe742f260 100644 --- a/src/gallium/drivers/nvfx/nv40_fragtex.c +++ b/src/gallium/drivers/nvfx/nv40_fragtex.c @@ -8,149 +8,97 @@ nv40_sampler_state_init(struct pipe_context *pipe, struct nvfx_sampler_state *ps, const struct pipe_sampler_state *cso) { + float limit; if (cso->max_anisotropy >= 2) { /* no idea, binary driver sets it, works without it.. meh.. */ ps->wrap |= (1 << 5); - if (cso->max_anisotropy >= 16) { + if (cso->max_anisotropy >= 16) ps->en |= NV40TCL_TEX_ENABLE_ANISO_16X; - } else - if (cso->max_anisotropy >= 12) { + else if (cso->max_anisotropy >= 12) ps->en |= NV40TCL_TEX_ENABLE_ANISO_12X; - } else - if (cso->max_anisotropy >= 10) { + else if (cso->max_anisotropy >= 10) ps->en |= NV40TCL_TEX_ENABLE_ANISO_10X; - } else - if (cso->max_anisotropy >= 8) { + else if (cso->max_anisotropy >= 8) ps->en |= NV40TCL_TEX_ENABLE_ANISO_8X; - } else - if (cso->max_anisotropy >= 6) { + else if (cso->max_anisotropy >= 6) ps->en |= NV40TCL_TEX_ENABLE_ANISO_6X; - } else - if (cso->max_anisotropy >= 4) { + else if (cso->max_anisotropy >= 4) ps->en |= NV40TCL_TEX_ENABLE_ANISO_4X; - } else { + else ps->en |= NV40TCL_TEX_ENABLE_ANISO_2X; - } } - { - float limit; + limit = CLAMP(cso->lod_bias, -16.0, 15.0); + ps->filt |= (int)(cso->lod_bias * 256.0) & 0x1fff; - limit = CLAMP(cso->lod_bias, -16.0, 15.0); - ps->filt |= (int)(cso->lod_bias * 256.0) & 0x1fff; + ps->max_lod = (int)(CLAMP(cso->max_lod, 0.0, 15.0) * 256.0); + ps->min_lod = (int)(CLAMP(cso->min_lod, 0.0, 15.0) * 256.0); - limit = CLAMP(cso->max_lod, 0.0, 15.0); - ps->en |= (int)(limit * 256.0) << 7; + ps->en |= NV40TCL_TEX_ENABLE_ENABLE; +} + +void +nv40_sampler_view_init(struct pipe_context *pipe, + struct nvfx_sampler_view *sv) +{ + struct pipe_resource* pt = sv->base.texture; + struct nvfx_miptree* mt = (struct nvfx_miptree*)pt; + struct nvfx_texture_format *tf = &nvfx_texture_formats[sv->base.format]; + unsigned txf; + unsigned level = pt->target == PIPE_TEXTURE_CUBE ? 0 : sv->base.first_level; + assert(tf->fmt[4] >= 0); + + txf = sv->u.init_fmt; + txf |= 0x8000; + if(pt->target == PIPE_TEXTURE_CUBE) + txf |= ((pt->last_level + 1) << NV40TCL_TEX_FORMAT_MIPMAP_COUNT_SHIFT); + else + txf |= (((sv->base.last_level - sv->base.first_level) + 1) << NV40TCL_TEX_FORMAT_MIPMAP_COUNT_SHIFT); - limit = CLAMP(cso->min_lod, 0.0, 15.0); - ps->en |= (int)(limit * 256.0) << 19; + if (!mt->linear_pitch) + sv->u.nv40.npot_size2 = 0; + else { + sv->u.nv40.npot_size2 = mt->linear_pitch; + txf |= NV40TCL_TEX_FORMAT_LINEAR; } -} -#define _(m,tf,ts0x,ts0y,ts0z,ts0w,ts1x,ts1y,ts1z,ts1w,sx,sy,sz,sw) \ -[PIPE_FORMAT_##m] = { \ - NV40TCL_TEX_FORMAT_FORMAT_##tf, \ - (NV34TCL_TX_SWIZZLE_S0_X_##ts0x | NV34TCL_TX_SWIZZLE_S0_Y_##ts0y | \ - NV34TCL_TX_SWIZZLE_S0_Z_##ts0z | NV34TCL_TX_SWIZZLE_S0_W_##ts0w | \ - NV34TCL_TX_SWIZZLE_S1_X_##ts1x | NV34TCL_TX_SWIZZLE_S1_Y_##ts1y | \ - NV34TCL_TX_SWIZZLE_S1_Z_##ts1z | NV34TCL_TX_SWIZZLE_S1_W_##ts1w), \ - ((NV34TCL_TX_FILTER_SIGNED_RED*sx) | (NV34TCL_TX_FILTER_SIGNED_GREEN*sy) | \ - (NV34TCL_TX_FILTER_SIGNED_BLUE*sz) | (NV34TCL_TX_FILTER_SIGNED_ALPHA*sw)) \ -} + sv->u.nv40.fmt[0] = tf->fmt[4] | txf; + sv->u.nv40.fmt[1] = tf->fmt[5] | txf; -struct nv40_texture_format { - int format; - int swizzle; - int sign; -}; + sv->u.nv40.npot_size2 |= (u_minify(pt->depth0, level) << NV40TCL_TEX_SIZE1_DEPTH_SHIFT); -static struct nv40_texture_format -nv40_texture_formats[PIPE_FORMAT_COUNT] = { - [0 ... PIPE_FORMAT_COUNT - 1] = {-1, 0, 0}, - _(B8G8R8X8_UNORM, A8R8G8B8, S1, S1, S1, ONE, X, Y, Z, W, 0, 0, 0, 0), - _(B8G8R8A8_UNORM, A8R8G8B8, S1, S1, S1, S1, X, Y, Z, W, 0, 0, 0, 0), - _(B5G5R5A1_UNORM, A1R5G5B5, S1, S1, S1, S1, X, Y, Z, W, 0, 0, 0, 0), - _(B4G4R4A4_UNORM, A4R4G4B4, S1, S1, S1, S1, X, Y, Z, W, 0, 0, 0, 0), - _(B5G6R5_UNORM , R5G6B5 , S1, S1, S1, ONE, X, Y, Z, W, 0, 0, 0, 0), - _(L8_UNORM , L8 , S1, S1, S1, ONE, X, X, X, X, 0, 0, 0, 0), - _(A8_UNORM , L8 , ZERO, ZERO, ZERO, S1, X, X, X, X, 0, 0, 0, 0), - _(R16_SNORM , A16 , ZERO, ZERO, S1, ONE, X, X, X, Y, 1, 1, 1, 1), - _(I8_UNORM , L8 , S1, S1, S1, S1, X, X, X, X, 0, 0, 0, 0), - _(L8A8_UNORM , A8L8 , S1, S1, S1, S1, X, X, X, Y, 0, 0, 0, 0), - _(Z16_UNORM , Z16 , S1, S1, S1, ONE, X, X, X, X, 0, 0, 0, 0), - _(S8_USCALED_Z24_UNORM , Z24 , S1, S1, S1, ONE, X, X, X, X, 0, 0, 0, 0), - _(DXT1_RGB , DXT1 , S1, S1, S1, ONE, X, Y, Z, W, 0, 0, 0, 0), - _(DXT1_RGBA , DXT1 , S1, S1, S1, S1, X, Y, Z, W, 0, 0, 0, 0), - _(DXT3_RGBA , DXT3 , S1, S1, S1, S1, X, Y, Z, W, 0, 0, 0, 0), - _(DXT5_RGBA , DXT5 , S1, S1, S1, S1, X, Y, Z, W, 0, 0, 0, 0), - {}, -}; + sv->lod_offset = (sv->base.first_level - level) * 256; + sv->max_lod_limit = (sv->base.last_level - level) * 256; +} void nv40_fragtex_set(struct nvfx_context *nvfx, int unit) { struct nouveau_channel* chan = nvfx->screen->base.channel; struct nvfx_sampler_state *ps = nvfx->tex_sampler[unit]; - struct nvfx_miptree *mt = (struct nvfx_miptree *)nvfx->fragment_sampler_views[unit]->texture; - struct nouveau_bo *bo = mt->base.bo; - struct pipe_resource *pt = &mt->base.base; - struct nv40_texture_format *tf; - - uint32_t txf, txs, txp; + struct nvfx_sampler_view* sv = (struct nvfx_sampler_view*)nvfx->fragment_sampler_views[unit]; + struct nouveau_bo *bo = ((struct nvfx_miptree *)sv->base.texture)->base.bo; unsigned tex_flags = NOUVEAU_BO_VRAM | NOUVEAU_BO_GART | NOUVEAU_BO_RD; + unsigned txf; + unsigned max_lod = MIN2(ps->max_lod + sv->lod_offset, sv->max_lod_limit); + unsigned min_lod = MIN2(ps->min_lod + sv->lod_offset, max_lod); - tf = &nv40_texture_formats[pt->format]; - assert(tf->format >= 0); - - txf = ps->fmt; - txf |= tf->format | 0x8000; - txf |= ((pt->last_level + 1) << NV40TCL_TEX_FORMAT_MIPMAP_COUNT_SHIFT); - - if (1) /* XXX */ - txf |= NV34TCL_TX_FORMAT_NO_BORDER; - - switch (pt->target) { - case PIPE_TEXTURE_CUBE: - txf |= NV34TCL_TX_FORMAT_CUBIC; - /* fall-through */ - case PIPE_TEXTURE_2D: - case PIPE_TEXTURE_RECT: - txf |= NV34TCL_TX_FORMAT_DIMS_2D; - break; - case PIPE_TEXTURE_3D: - txf |= NV34TCL_TX_FORMAT_DIMS_3D; - break; - case PIPE_TEXTURE_1D: - txf |= NV34TCL_TX_FORMAT_DIMS_1D; - break; - default: - NOUVEAU_ERR("Unknown target %d\n", pt->target); - return; - } - - if (!mt->linear_pitch) - txp = 0; - else { - txp = mt->linear_pitch; - txf |= NV40TCL_TEX_FORMAT_LINEAR; - } - - txs = tf->swizzle; + txf = sv->u.nv40.fmt[ps->compare] | ps->fmt; - MARK_RING(chan, 11 + 2 * !unit, 2); + MARK_RING(chan, 11, 2); OUT_RING(chan, RING_3D(NV34TCL_TX_OFFSET(unit), 8)); - OUT_RELOC(chan, bo, 0, tex_flags | NOUVEAU_BO_LOW, 0, 0); + OUT_RELOC(chan, bo, sv->offset, tex_flags | NOUVEAU_BO_LOW, 0, 0); OUT_RELOC(chan, bo, txf, tex_flags | NOUVEAU_BO_OR, NV34TCL_TX_FORMAT_DMA0, NV34TCL_TX_FORMAT_DMA1); - OUT_RING(chan, ps->wrap); - OUT_RING(chan, NV40TCL_TEX_ENABLE_ENABLE | ps->en); - OUT_RING(chan, txs); - OUT_RING(chan, ps->filt | tf->sign | 0x2000 /*voodoo*/); - OUT_RING(chan, (pt->width0 << NV34TCL_TX_NPOT_SIZE_W_SHIFT) | pt->height0); + OUT_RING(chan, (ps->wrap & sv->wrap_mask) | sv->wrap); + OUT_RING(chan, ps->en | (min_lod << 19) | (max_lod << 7)); + OUT_RING(chan, sv->swizzle); + OUT_RING(chan, ps->filt | sv->filt); + OUT_RING(chan, sv->npot_size); OUT_RING(chan, ps->bcol); OUT_RING(chan, RING_3D(NV40TCL_TEX_SIZE1(unit), 1)); - OUT_RING(chan, (pt->depth0 << NV40TCL_TEX_SIZE1_DEPTH_SHIFT) | txp); + OUT_RING(chan, sv->u.nv40.npot_size2); nvfx->hw_txf[unit] = txf; nvfx->hw_samplers |= (1 << unit); diff --git a/src/gallium/drivers/nvfx/nvfx_context.c b/src/gallium/drivers/nvfx/nvfx_context.c index 7ab81de7dd..1980176b23 100644 --- a/src/gallium/drivers/nvfx/nvfx_context.c +++ b/src/gallium/drivers/nvfx/nvfx_context.c @@ -75,6 +75,7 @@ nvfx_create(struct pipe_screen *pscreen, void *priv) nvfx_init_query_functions(nvfx); nvfx_init_surface_functions(nvfx); nvfx_init_state_functions(nvfx); + nvfx_init_sampling_functions(nvfx); nvfx_init_resource_functions(&nvfx->pipe); /* Create, configure, and install fallback swtnl path */ diff --git a/src/gallium/drivers/nvfx/nvfx_context.h b/src/gallium/drivers/nvfx/nvfx_context.h index a6ea913967..bce19df044 100644 --- a/src/gallium/drivers/nvfx/nvfx_context.h +++ b/src/gallium/drivers/nvfx/nvfx_context.h @@ -201,15 +201,20 @@ extern void nvfx_fragprog_relocate(struct nvfx_context *nvfx); /* nvfx_fragtex.c */ +extern void nvfx_init_sampling_functions(struct nvfx_context *nvfx); extern void nvfx_fragtex_validate(struct nvfx_context *nvfx); -extern void -nvfx_fragtex_relocate(struct nvfx_context *nvfx); +extern void nvfx_fragtex_relocate(struct nvfx_context *nvfx); + +struct nvfx_sampler_view; /* nv30_fragtex.c */ extern void nv30_sampler_state_init(struct pipe_context *pipe, struct nvfx_sampler_state *ps, const struct pipe_sampler_state *cso); +extern void +nv30_sampler_view_init(struct pipe_context *pipe, + struct nvfx_sampler_view *sv); extern void nv30_fragtex_set(struct nvfx_context *nvfx, int unit); /* nv40_fragtex.c */ @@ -217,6 +222,9 @@ extern void nv40_sampler_state_init(struct pipe_context *pipe, struct nvfx_sampler_state *ps, const struct pipe_sampler_state *cso); +extern void +nv40_sampler_view_init(struct pipe_context *pipe, + struct nvfx_sampler_view *sv); extern void nv40_fragtex_set(struct nvfx_context *nvfx, int unit); /* nvfx_state.c */ diff --git a/src/gallium/drivers/nvfx/nvfx_fragtex.c b/src/gallium/drivers/nvfx/nvfx_fragtex.c index 6605745433..00c47be76a 100644 --- a/src/gallium/drivers/nvfx/nvfx_fragtex.c +++ b/src/gallium/drivers/nvfx/nvfx_fragtex.c @@ -1,5 +1,177 @@ #include "nvfx_context.h" #include "nvfx_resource.h" +#include "nvfx_tex.h" + +static void * +nvfx_sampler_state_create(struct pipe_context *pipe, + const struct pipe_sampler_state *cso) +{ + struct nvfx_context *nvfx = nvfx_context(pipe); + struct nvfx_sampler_state *ps; + + ps = MALLOC(sizeof(struct nvfx_sampler_state)); + + /* on nv30, we use this as an internal flag */ + ps->fmt = cso->normalized_coords ? 0 : NV40TCL_TEX_FORMAT_RECT; + ps->en = 0; + ps->filt = nvfx_tex_filter(cso) | 0x2000; /*voodoo*/ + ps->wrap = (nvfx_tex_wrap_mode(cso->wrap_s) << NV34TCL_TX_WRAP_S_SHIFT) | + (nvfx_tex_wrap_mode(cso->wrap_t) << NV34TCL_TX_WRAP_T_SHIFT) | + (nvfx_tex_wrap_mode(cso->wrap_r) << NV34TCL_TX_WRAP_R_SHIFT); + ps->compare = FALSE; + + if(cso->compare_mode == PIPE_TEX_COMPARE_R_TO_TEXTURE) + { + ps->wrap |= nvfx_tex_wrap_compare_mode(cso->compare_func); + ps->compare = TRUE; + } + ps->bcol = nvfx_tex_border_color(cso->border_color); + + if(nvfx->is_nv4x) + nv40_sampler_state_init(pipe, ps, cso); + else + nv30_sampler_state_init(pipe, ps, cso); + + return (void *)ps; +} + +static void +nvfx_sampler_state_delete(struct pipe_context *pipe, void *hwcso) +{ + FREE(hwcso); +} + +static void +nvfx_sampler_state_bind(struct pipe_context *pipe, unsigned nr, void **sampler) +{ + struct nvfx_context *nvfx = nvfx_context(pipe); + unsigned unit; + + for (unit = 0; unit < nr; unit++) { + nvfx->tex_sampler[unit] = sampler[unit]; + nvfx->dirty_samplers |= (1 << unit); + } + + for (unit = nr; unit < nvfx->nr_samplers; unit++) { + nvfx->tex_sampler[unit] = NULL; + nvfx->dirty_samplers |= (1 << unit); + } + + nvfx->nr_samplers = nr; + nvfx->dirty |= NVFX_NEW_SAMPLER; +} + +static struct pipe_sampler_view * +nvfx_create_sampler_view(struct pipe_context *pipe, + struct pipe_resource *pt, + const struct pipe_sampler_view *templ) +{ + struct nvfx_context *nvfx = nvfx_context(pipe); + struct nvfx_sampler_view *sv = CALLOC_STRUCT(nvfx_sampler_view); + struct nvfx_texture_format *tf = &nvfx_texture_formats[templ->format]; + unsigned txf; + + if (!sv) + return NULL; + + sv->base = *templ; + sv->base.reference.count = 1; + sv->base.texture = NULL; + pipe_resource_reference(&sv->base.texture, pt); + sv->base.context = pipe; + + txf = NV34TCL_TX_FORMAT_NO_BORDER; + + switch (pt->target) { + case PIPE_TEXTURE_CUBE: + txf |= NV34TCL_TX_FORMAT_CUBIC; + /* fall-through */ + case PIPE_TEXTURE_2D: + case PIPE_TEXTURE_RECT: + txf |= NV34TCL_TX_FORMAT_DIMS_2D; + break; + case PIPE_TEXTURE_3D: + txf |= NV34TCL_TX_FORMAT_DIMS_3D; + break; + case PIPE_TEXTURE_1D: + txf |= NV34TCL_TX_FORMAT_DIMS_1D; + break; + default: + assert(0); + } + sv->u.init_fmt = txf; + + sv->swizzle = 0 + | (tf->src[sv->base.swizzle_r] << NV34TCL_TX_SWIZZLE_S0_Z_SHIFT) + | (tf->src[sv->base.swizzle_g] << NV34TCL_TX_SWIZZLE_S0_Y_SHIFT) + | (tf->src[sv->base.swizzle_b] << NV34TCL_TX_SWIZZLE_S0_X_SHIFT) + | (tf->src[sv->base.swizzle_a] << NV34TCL_TX_SWIZZLE_S0_W_SHIFT) + | (tf->comp[sv->base.swizzle_r] << NV34TCL_TX_SWIZZLE_S1_Z_SHIFT) + | (tf->comp[sv->base.swizzle_g] << NV34TCL_TX_SWIZZLE_S1_Y_SHIFT) + | (tf->comp[sv->base.swizzle_b] << NV34TCL_TX_SWIZZLE_S1_X_SHIFT) + | (tf->comp[sv->base.swizzle_a] << NV34TCL_TX_SWIZZLE_S1_W_SHIFT); + + sv->filt = tf->sign; + sv->wrap = tf->wrap; + sv->wrap_mask = ~0; + + if (pt->target == PIPE_TEXTURE_CUBE) + { + sv->offset = 0; + sv->npot_size = (pt->width0 << NV34TCL_TX_NPOT_SIZE_W_SHIFT) | pt->height0; + } + else + { + sv->offset = nvfx_subresource_offset(pt, 0, sv->base.first_level, 0); + sv->npot_size = (u_minify(pt->width0, sv->base.first_level) << NV34TCL_TX_NPOT_SIZE_W_SHIFT) | u_minify(pt->height0, sv->base.first_level); + + /* apparently, we need to ignore the t coordinate for 1D textures to fix piglit tex1d-2dborder */ + if(pt->target == PIPE_TEXTURE_1D) + { + sv->wrap_mask &=~ NV34TCL_TX_WRAP_T_MASK; + sv->wrap |= NV34TCL_TX_WRAP_T_REPEAT; + } + } + + if(nvfx->is_nv4x) + nv40_sampler_view_init(pipe, sv); + else + nv30_sampler_view_init(pipe, sv); + + return &sv->base; +} + +static void +nvfx_sampler_view_destroy(struct pipe_context *pipe, + struct pipe_sampler_view *view) +{ + pipe_resource_reference(&view->texture, NULL); + FREE(view); +} + +static void +nvfx_set_fragment_sampler_views(struct pipe_context *pipe, + unsigned nr, + struct pipe_sampler_view **views) +{ + struct nvfx_context *nvfx = nvfx_context(pipe); + unsigned unit; + + for (unit = 0; unit < nr; unit++) { + pipe_sampler_view_reference(&nvfx->fragment_sampler_views[unit], + views[unit]); + nvfx->dirty_samplers |= (1 << unit); + } + + for (unit = nr; unit < nvfx->nr_textures; unit++) { + pipe_sampler_view_reference(&nvfx->fragment_sampler_views[unit], + NULL); + nvfx->dirty_samplers |= (1 << unit); + } + + nvfx->nr_textures = nr; + nvfx->dirty |= NVFX_NEW_SAMPLER; +} void nvfx_fragtex_validate(struct nvfx_context *nvfx) @@ -60,3 +232,126 @@ nvfx_fragtex_relocate(struct nvfx_context *nvfx) NV34TCL_TX_FORMAT_DMA0, NV34TCL_TX_FORMAT_DMA1); } } + +void +nvfx_init_sampling_functions(struct nvfx_context *nvfx) +{ + nvfx->pipe.create_sampler_state = nvfx_sampler_state_create; + nvfx->pipe.bind_fragment_sampler_states = nvfx_sampler_state_bind; + nvfx->pipe.delete_sampler_state = nvfx_sampler_state_delete; + nvfx->pipe.set_fragment_sampler_views = nvfx_set_fragment_sampler_views; + nvfx->pipe.create_sampler_view = nvfx_create_sampler_view; + nvfx->pipe.sampler_view_destroy = nvfx_sampler_view_destroy; +} + +#define NV34TCL_TX_FORMAT_FORMAT_DXT1_RECT NV34TCL_TX_FORMAT_FORMAT_DXT1 +#define NV34TCL_TX_FORMAT_FORMAT_DXT3_RECT NV34TCL_TX_FORMAT_FORMAT_DXT3 +#define NV34TCL_TX_FORMAT_FORMAT_DXT5_RECT NV34TCL_TX_FORMAT_FORMAT_DXT5 + +#define NV40TCL_TEX_FORMAT_FORMAT_HILO16 NV40TCL_TEX_FORMAT_FORMAT_A16L16 + +#define NV34TCL_TX_FORMAT_FORMAT_RGBA16F 0x00004a00 +#define NV34TCL_TX_FORMAT_FORMAT_RGBA16F_RECT NV34TCL_TX_FORMAT_FORMAT_RGBA16F +#define NV34TCL_TX_FORMAT_FORMAT_RGBA32F 0x00004b00 +#define NV34TCL_TX_FORMAT_FORMAT_RGBA32F_RECT NV34TCL_TX_FORMAT_FORMAT_RGBA32F +#define NV34TCL_TX_FORMAT_FORMAT_R32F 0x00004c00 +#define NV34TCL_TX_FORMAT_FORMAT_R32F_RECT NV34TCL_TX_FORMAT_FORMAT_R32F + +// TODO: guess! +#define NV40TCL_TEX_FORMAT_FORMAT_R32F 0x00001c00 + +#define SRGB 0x00700000 + +#define __(m,tf,tfc,ts0x,ts0y,ts0z,ts0w,ts1x,ts1y,ts1z,ts1w,sign,wrap) \ +[PIPE_FORMAT_##m] = { \ + {NV34TCL_TX_FORMAT_FORMAT_##tf, \ + NV34TCL_TX_FORMAT_FORMAT_##tfc, \ + NV34TCL_TX_FORMAT_FORMAT_##tf##_RECT, \ + NV34TCL_TX_FORMAT_FORMAT_##tfc##_RECT, \ + NV40TCL_TEX_FORMAT_FORMAT_##tf, \ + NV40TCL_TEX_FORMAT_FORMAT_##tfc}, \ + sign, wrap, \ + {ts0z, ts0y, ts0x, ts0w, 0, 1}, {ts1z, ts1y, ts1x, ts1w, 0, 0} \ +} + +#define _(m,tf,ts0x,ts0y,ts0z,ts0w,ts1x,ts1y,ts1z,ts1w,sign, wrap) \ + __(m,tf,tf,ts0x,ts0y,ts0z,ts0w,ts1x,ts1y,ts1z,ts1w,sign, wrap) + +/* Depth formats works by reading the depth value most significant 8/16 bits. + * We are losing precision, but nVidia loses even more by using A8R8G8B8 instead of HILO16 + * There is no 32-bit integer texture support, so other things are infeasible. + * + * TODO: is it possible to read 16 bits for Z16? A16 doesn't seem to work, either due to normalization or endianness issues + */ + +#define T 2 + +#define X 3 +#define Y 2 +#define Z 1 +#define W 0 + +#define SNORM ((NV34TCL_TX_FILTER_SIGNED_RED) | (NV34TCL_TX_FILTER_SIGNED_GREEN) | (NV34TCL_TX_FILTER_SIGNED_BLUE) | (NV34TCL_TX_FILTER_SIGNED_ALPHA)) +#define UNORM 0 + +struct nvfx_texture_format +nvfx_texture_formats[PIPE_FORMAT_COUNT] = { + [0 ... PIPE_FORMAT_COUNT - 1] = {{-1, -1, -1, -1, -1, -1}}, + _(B8G8R8X8_UNORM, A8R8G8B8, T, T, T, 1, X, Y, Z, W, UNORM, 0), + _(B8G8R8X8_SRGB, A8R8G8B8, T, T, T, 1, X, Y, Z, W, UNORM, SRGB), + _(B8G8R8A8_UNORM, A8R8G8B8, T, T, T, T, X, Y, Z, W, UNORM, 0), + _(B8G8R8A8_SRGB, A8R8G8B8, T, T, T, T, X, Y, Z, W, UNORM, SRGB), + + _(R8G8B8A8_UNORM, A8R8G8B8, T, T, T, T, Z, Y, X, W, UNORM, 0), + _(R8G8B8A8_SRGB, A8R8G8B8, T, T, T, T, Z, Y, X, W, UNORM, SRGB), + _(R8G8B8X8_UNORM, A8R8G8B8, T, T, T, 1, Z, Y, X, W, UNORM, 0), + + _(A8R8G8B8_UNORM, A8R8G8B8, T, T, T, T, W, Z, Y, X, UNORM, 0), + _(A8R8G8B8_SRGB, A8R8G8B8, T, T, T, T, W, Z, Y, X, UNORM, SRGB), + _(A8B8G8R8_UNORM, A8R8G8B8, T, T, T, T, W, X, Y, Z, UNORM, 0), + _(A8B8G8R8_SRGB, A8R8G8B8, T, T, T, T, W, X, Y, Z, UNORM, SRGB), + _(X8R8G8B8_UNORM, A8R8G8B8, T, T, T, 1, W, Z, Y, X, UNORM, 0), + _(X8R8G8B8_SRGB, A8R8G8B8, T, T, T, 1, W, Z, Y, X, UNORM, SRGB), + + _(B5G5R5A1_UNORM, A1R5G5B5, T, T, T, T, X, Y, Z, W, UNORM, 0), + _(B5G5R5X1_UNORM, A1R5G5B5, T, T, T, 1, X, Y, Z, W, UNORM, 0), + + _(B4G4R4A4_UNORM, A4R4G4B4, T, T, T, T, X, Y, Z, W, UNORM, 0), + _(B4G4R4X4_UNORM, A4R4G4B4, T, T, T, 1, X, Y, Z, W, UNORM, 0), + + _(B5G6R5_UNORM, R5G6B5, T, T, T, 1, X, Y, Z, W, UNORM, 0), + + _(R8_UNORM, L8, T, 0, 0, 1, X, X, X, X, UNORM, 0), + _(R8_SNORM, L8, T, 0, 0, 1, X, X, X, X, SNORM, 0), + _(L8_UNORM, L8, T, T, T, 1, X, X, X, X, UNORM, 0), + _(L8_SRGB, L8, T, T, T, 1, X, X, X, X, UNORM, SRGB), + _(A8_UNORM, L8, 0, 0, 0, T, X, X, X, X, UNORM, 0), + _(I8_UNORM, L8, T, T, T, T, X, X, X, X, UNORM, 0), + + _(R8G8_UNORM, A8L8, T, T, T, T, X, X, X, W, UNORM, 0), + _(R8G8_SNORM, A8L8, T, T, T, T, X, X, X, W, SNORM, 0), + _(L8A8_UNORM, A8L8, T, T, T, T, X, X, X, W, UNORM, 0), + _(L8A8_SRGB, A8L8, T, T, T, T, X, X, X, W, UNORM, SRGB), + + _(DXT1_RGB, DXT1, T, T, T, 1, X, Y, Z, W, UNORM, 0), + _(DXT1_SRGB, DXT1, T, T, T, 1, X, Y, Z, W, UNORM, SRGB), + _(DXT1_RGBA, DXT1, T, T, T, T, X, Y, Z, W, UNORM, 0), + _(DXT1_SRGBA, DXT1, T, T, T, T, X, Y, Z, W, UNORM, SRGB), + _(DXT3_RGBA, DXT3, T, T, T, T, X, Y, Z, W, UNORM, 0), + _(DXT3_SRGBA, DXT3, T, T, T, T, X, Y, Z, W, UNORM, SRGB), + _(DXT5_RGBA, DXT5, T, T, T, T, X, Y, Z, W, UNORM, 0), + _(DXT5_SRGBA, DXT5, T, T, T, T, X, Y, Z, W, UNORM, SRGB), + + __(Z16_UNORM, A8L8, Z16, T, T, T, 1, W, W, W, W, UNORM, 0), + __(S8_USCALED_Z24_UNORM,HILO16,Z24, T, T, T, 1, W, W, W, W, UNORM, 0), + __(X8Z24_UNORM, HILO16,Z24, T, T, T, 1, W, W, W, W, UNORM, 0), + + _(R16_UNORM, A16, T, 0, 0, 1, X, X, X, X, UNORM, 0), + _(R16_SNORM, A16, T, 0, 0, 1, X, X, X, X, SNORM, 0), + _(R16G16_UNORM, HILO16, T, T, 0, 1, X, Y, X, X, UNORM, 0), + _(R16G16_SNORM, HILO16, T, T, 0, 1, X, Y, X, X, SNORM, 0), + + _(R16G16B16A16_FLOAT, RGBA16F, T, T, T, T, X, Y, Z, W, UNORM, 0), + _(R32G32B32A32_FLOAT, RGBA32F, T, T, T, T, X, Y, Z, W, UNORM, 0), + _(R32_FLOAT, R32F, T, 0, 0, 1, X, X, X, X, UNORM, 0) +}; diff --git a/src/gallium/drivers/nvfx/nvfx_screen.c b/src/gallium/drivers/nvfx/nvfx_screen.c index a1b7c218f1..a1b8361a9a 100644 --- a/src/gallium/drivers/nvfx/nvfx_screen.c +++ b/src/gallium/drivers/nvfx/nvfx_screen.c @@ -8,6 +8,7 @@ #include "nvfx_context.h" #include "nvfx_screen.h" #include "nvfx_resource.h" +#include "nvfx_tex.h" #define NV30TCL_CHIPSET_3X_MASK 0x00000003 #define NV34TCL_CHIPSET_3X_MASK 0x00000010 @@ -179,58 +180,45 @@ nvfx_screen_surface_format_supported(struct pipe_screen *pscreen, case PIPE_FORMAT_B8G8R8A8_UNORM: case PIPE_FORMAT_B8G8R8X8_UNORM: case PIPE_FORMAT_B5G6R5_UNORM: - return TRUE; - default: break; + default: + return FALSE; } - } else + } + if (tex_usage & PIPE_BIND_DEPTH_STENCIL) { switch (format) { case PIPE_FORMAT_S8_USCALED_Z24_UNORM: case PIPE_FORMAT_X8Z24_UNORM: - return TRUE; + break; case PIPE_FORMAT_Z16_UNORM: /* TODO: this nv30 limitation probably does not exist */ - if (!screen->is_nv4x && front) - return (front->format == PIPE_FORMAT_B5G6R5_UNORM); - return TRUE; - default: + if (!screen->is_nv4x && front && front->format != PIPE_FORMAT_B5G6R5_UNORM) + return FALSE; break; + default: + return FALSE; } - } else { - if (tex_usage & PIPE_BIND_SAMPLER_VIEW) { - switch (format) { - case PIPE_FORMAT_DXT1_RGB: - case PIPE_FORMAT_DXT1_RGBA: - case PIPE_FORMAT_DXT3_RGBA: - case PIPE_FORMAT_DXT5_RGBA: - return util_format_s3tc_enabled; - default: - break; - } + } + + if (tex_usage & PIPE_BIND_SAMPLER_VIEW) { + struct nvfx_texture_format* tf = &nvfx_texture_formats[format]; + if(util_format_is_s3tc(format) && !util_format_s3tc_enabled) + return FALSE; + + if(screen->is_nv4x) + { + if(tf->fmt[4] < 0) + return FALSE; } - switch (format) { - case PIPE_FORMAT_B8G8R8A8_UNORM: - case PIPE_FORMAT_B8G8R8X8_UNORM: - case PIPE_FORMAT_B5G5R5A1_UNORM: - case PIPE_FORMAT_B4G4R4A4_UNORM: - case PIPE_FORMAT_B5G6R5_UNORM: - case PIPE_FORMAT_L8_UNORM: - case PIPE_FORMAT_A8_UNORM: - case PIPE_FORMAT_I8_UNORM: - case PIPE_FORMAT_L8A8_UNORM: - case PIPE_FORMAT_Z16_UNORM: - case PIPE_FORMAT_S8_USCALED_Z24_UNORM: - return TRUE; - /* TODO: does nv30 support this? */ - case PIPE_FORMAT_R16_SNORM: - return !!screen->is_nv4x; - default: - break; + else + { + if(tf->fmt[0] < 0) + return FALSE; } } - return FALSE; + return TRUE; } static void diff --git a/src/gallium/drivers/nvfx/nvfx_state.c b/src/gallium/drivers/nvfx/nvfx_state.c index ab7bed0f93..d459f9a880 100644 --- a/src/gallium/drivers/nvfx/nvfx_state.c +++ b/src/gallium/drivers/nvfx/nvfx_state.c @@ -81,111 +81,6 @@ nvfx_blend_state_delete(struct pipe_context *pipe, void *hwcso) FREE(bso); } -static void * -nvfx_sampler_state_create(struct pipe_context *pipe, - const struct pipe_sampler_state *cso) -{ - struct nvfx_context *nvfx = nvfx_context(pipe); - struct nvfx_sampler_state *ps; - - ps = MALLOC(sizeof(struct nvfx_sampler_state)); - - /* on nv30, we use this as an internal flag */ - ps->fmt = cso->normalized_coords ? 0 : NV40TCL_TEX_FORMAT_RECT; - ps->en = 0; - ps->filt = nvfx_tex_filter(cso); - ps->wrap = (nvfx_tex_wrap_mode(cso->wrap_s) << NV34TCL_TX_WRAP_S_SHIFT) | - (nvfx_tex_wrap_mode(cso->wrap_t) << NV34TCL_TX_WRAP_T_SHIFT) | - (nvfx_tex_wrap_mode(cso->wrap_r) << NV34TCL_TX_WRAP_R_SHIFT) | - nvfx_tex_wrap_compare_mode(cso); - ps->bcol = nvfx_tex_border_color(cso->border_color); - - if(nvfx->is_nv4x) - nv40_sampler_state_init(pipe, ps, cso); - else - nv30_sampler_state_init(pipe, ps, cso); - - return (void *)ps; -} - -static void -nvfx_sampler_state_bind(struct pipe_context *pipe, unsigned nr, void **sampler) -{ - struct nvfx_context *nvfx = nvfx_context(pipe); - unsigned unit; - - for (unit = 0; unit < nr; unit++) { - nvfx->tex_sampler[unit] = sampler[unit]; - nvfx->dirty_samplers |= (1 << unit); - } - - for (unit = nr; unit < nvfx->nr_samplers; unit++) { - nvfx->tex_sampler[unit] = NULL; - nvfx->dirty_samplers |= (1 << unit); - } - - nvfx->nr_samplers = nr; - nvfx->dirty |= NVFX_NEW_SAMPLER; -} - -static void -nvfx_sampler_state_delete(struct pipe_context *pipe, void *hwcso) -{ - FREE(hwcso); -} - -static void -nvfx_set_fragment_sampler_views(struct pipe_context *pipe, - unsigned nr, - struct pipe_sampler_view **views) -{ - struct nvfx_context *nvfx = nvfx_context(pipe); - unsigned unit; - - for (unit = 0; unit < nr; unit++) { - pipe_sampler_view_reference(&nvfx->fragment_sampler_views[unit], - views[unit]); - nvfx->dirty_samplers |= (1 << unit); - } - - for (unit = nr; unit < nvfx->nr_textures; unit++) { - pipe_sampler_view_reference(&nvfx->fragment_sampler_views[unit], - NULL); - nvfx->dirty_samplers |= (1 << unit); - } - - nvfx->nr_textures = nr; - nvfx->dirty |= NVFX_NEW_SAMPLER; -} - - -static struct pipe_sampler_view * -nvfx_create_sampler_view(struct pipe_context *pipe, - struct pipe_resource *texture, - const struct pipe_sampler_view *templ) -{ - struct pipe_sampler_view *view = CALLOC_STRUCT(pipe_sampler_view); - - if (view) { - *view = *templ; - view->reference.count = 1; - view->texture = NULL; - pipe_resource_reference(&view->texture, texture); - view->context = pipe; - } - - return view; -} - - -static void -nvfx_sampler_view_destroy(struct pipe_context *pipe, - struct pipe_sampler_view *view) -{ - pipe_resource_reference(&view->texture, NULL); - FREE(view); -} - static void * nvfx_rasterizer_state_create(struct pipe_context *pipe, const struct pipe_rasterizer_state *cso) @@ -630,13 +525,6 @@ nvfx_init_state_functions(struct nvfx_context *nvfx) nvfx->pipe.bind_blend_state = nvfx_blend_state_bind; nvfx->pipe.delete_blend_state = nvfx_blend_state_delete; - nvfx->pipe.create_sampler_state = nvfx_sampler_state_create; - nvfx->pipe.bind_fragment_sampler_states = nvfx_sampler_state_bind; - nvfx->pipe.delete_sampler_state = nvfx_sampler_state_delete; - nvfx->pipe.set_fragment_sampler_views = nvfx_set_fragment_sampler_views; - nvfx->pipe.create_sampler_view = nvfx_create_sampler_view; - nvfx->pipe.sampler_view_destroy = nvfx_sampler_view_destroy; - nvfx->pipe.create_rasterizer_state = nvfx_rasterizer_state_create; nvfx->pipe.bind_rasterizer_state = nvfx_rasterizer_state_bind; nvfx->pipe.delete_rasterizer_state = nvfx_rasterizer_state_delete; diff --git a/src/gallium/drivers/nvfx/nvfx_tex.h b/src/gallium/drivers/nvfx/nvfx_tex.h index 69187a79e7..34be936a89 100644 --- a/src/gallium/drivers/nvfx/nvfx_tex.h +++ b/src/gallium/drivers/nvfx/nvfx_tex.h @@ -1,6 +1,11 @@ #ifndef NVFX_TEX_H_ #define NVFX_TEX_H_ +#include "util/u_math.h" +#include "pipe/p_defines.h" +#include "pipe/p_state.h" +#include + static inline unsigned nvfx_tex_wrap_mode(unsigned wrap) { unsigned ret; @@ -31,7 +36,7 @@ nvfx_tex_wrap_mode(unsigned wrap) { ret = NV40TCL_TEX_WRAP_S_MIRROR_CLAMP; break; default: - NOUVEAU_ERR("unknown wrap mode: %d\n", wrap); + assert(0); ret = NV34TCL_TX_WRAP_S_REPEAT; break; } @@ -40,31 +45,29 @@ nvfx_tex_wrap_mode(unsigned wrap) { } static inline unsigned -nvfx_tex_wrap_compare_mode(const struct pipe_sampler_state* cso) +nvfx_tex_wrap_compare_mode(unsigned func) { - if (cso->compare_mode == PIPE_TEX_COMPARE_R_TO_TEXTURE) { - switch (cso->compare_func) { - case PIPE_FUNC_NEVER: - return NV34TCL_TX_WRAP_RCOMP_NEVER; - case PIPE_FUNC_GREATER: - return NV34TCL_TX_WRAP_RCOMP_GREATER; - case PIPE_FUNC_EQUAL: - return NV34TCL_TX_WRAP_RCOMP_EQUAL; - case PIPE_FUNC_GEQUAL: - return NV34TCL_TX_WRAP_RCOMP_GEQUAL; - case PIPE_FUNC_LESS: - return NV34TCL_TX_WRAP_RCOMP_LESS; - case PIPE_FUNC_NOTEQUAL: - return NV34TCL_TX_WRAP_RCOMP_NOTEQUAL; - case PIPE_FUNC_LEQUAL: - return NV34TCL_TX_WRAP_RCOMP_LEQUAL; - case PIPE_FUNC_ALWAYS: - return NV34TCL_TX_WRAP_RCOMP_ALWAYS; - default: - break; - } + switch (func) { + case PIPE_FUNC_NEVER: + return NV34TCL_TX_WRAP_RCOMP_NEVER; + case PIPE_FUNC_GREATER: + return NV34TCL_TX_WRAP_RCOMP_GREATER; + case PIPE_FUNC_EQUAL: + return NV34TCL_TX_WRAP_RCOMP_EQUAL; + case PIPE_FUNC_GEQUAL: + return NV34TCL_TX_WRAP_RCOMP_GEQUAL; + case PIPE_FUNC_LESS: + return NV34TCL_TX_WRAP_RCOMP_LESS; + case PIPE_FUNC_NOTEQUAL: + return NV34TCL_TX_WRAP_RCOMP_NOTEQUAL; + case PIPE_FUNC_LEQUAL: + return NV34TCL_TX_WRAP_RCOMP_LEQUAL; + case PIPE_FUNC_ALWAYS: + return NV34TCL_TX_WRAP_RCOMP_ALWAYS; + default: + assert(0); + return 0; } - return 0; } static inline unsigned nvfx_tex_filter(const struct pipe_sampler_state* cso) @@ -128,6 +131,45 @@ struct nvfx_sampler_state { uint32_t en; uint32_t filt; uint32_t bcol; + uint32_t min_lod; + uint32_t max_lod; + boolean compare; +}; + +struct nvfx_sampler_view { + struct pipe_sampler_view base; + int offset; + uint32_t swizzle; + uint32_t npot_size; + uint32_t filt; + uint32_t wrap_mask; + uint32_t wrap; + uint32_t lod_offset; + uint32_t max_lod_limit; + union + { + struct + { + uint32_t fmt[4]; /* nv30 has 4 entries, nv40 one */ + int rect; + } nv30; + struct + { + uint32_t fmt[2]; /* nv30 has 4 entries, nv40 one */ + uint32_t npot_size2; /* nv40 only */ + } nv40; + uint32_t init_fmt; + } u; }; +struct nvfx_texture_format { + int fmt[6]; + unsigned sign; + unsigned wrap; + unsigned char src[6]; + unsigned char comp[6]; +}; + +extern struct nvfx_texture_format nvfx_texture_formats[PIPE_FORMAT_COUNT]; + #endif /* NVFX_TEX_H_ */ -- cgit v1.2.3 From 8eb0fc430a8c1687627156a06faf5762144022f3 Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Sat, 7 Aug 2010 05:39:18 +0200 Subject: nvfx: rewrite draw code and buffer code This is a full rewrite of the drawing and buffer management logic. It offers a lot of improvements: 1. A copy of buffers is now always kept in system memory. This is necessary to allow software processing of them, which is necessary or improves performance in many cases. 2. Support for pushing vertices on the FIFO, with index lookup if necessary. 3. "Smart" draw code that tries to intelligently choose the cheapest way to draw something: whether to use inline vertices or hardware vertex buffer, and whether to use hardware index buffers 4. Support for all vertex formats supported by the hardware 5. Usage of translate to push vertices, supporting all formats that are sensible to use as vertex formats 6. Support for base vertex 7. Usage of Ben Skeggs' primitive splitter originally for nv50, allowing correct splitting of line loops, triangle fans, etc. 8. Support for instancing 9. Precomputation using the vertex elements CSO Thanks to Ben Skeggs for his primitive splitter originally for nv50. Thanks to Christoph Bumiller for his nv50 push code, that was the basis of this work, even though I changed his code dramatically, in particular to replace his ad-hoc vertex data emitter with translate. The changes could also go into nv50 too, but there are substantial differences due to the additional nv50 hardware features. --- src/gallium/drivers/nouveau/nouveau_class.h | 12 +- src/gallium/drivers/nouveau/nouveau_util.h | 91 --- src/gallium/drivers/nvfx/Makefile | 1 + src/gallium/drivers/nvfx/nv30_fragtex.c | 7 +- src/gallium/drivers/nvfx/nvfx_buffer.c | 98 +-- src/gallium/drivers/nvfx/nvfx_context.c | 3 + src/gallium/drivers/nvfx/nvfx_context.h | 99 ++- src/gallium/drivers/nvfx/nvfx_draw.c | 59 +- src/gallium/drivers/nvfx/nvfx_fragprog.c | 7 +- src/gallium/drivers/nvfx/nvfx_push.c | 402 +++++++++++ src/gallium/drivers/nvfx/nvfx_resource.c | 6 - src/gallium/drivers/nvfx/nvfx_resource.h | 91 ++- src/gallium/drivers/nvfx/nvfx_screen.c | 33 +- src/gallium/drivers/nvfx/nvfx_screen.h | 13 + src/gallium/drivers/nvfx/nvfx_state.c | 84 --- src/gallium/drivers/nvfx/nvfx_state_emit.c | 51 +- src/gallium/drivers/nvfx/nvfx_state_fb.c | 5 +- src/gallium/drivers/nvfx/nvfx_surface.c | 23 +- src/gallium/drivers/nvfx/nvfx_transfer.c | 173 ++++- src/gallium/drivers/nvfx/nvfx_vbo.c | 1016 +++++++++++++-------------- src/gallium/drivers/nvfx/nvfx_vertprog.c | 12 +- 21 files changed, 1365 insertions(+), 921 deletions(-) delete mode 100644 src/gallium/drivers/nouveau/nouveau_util.h create mode 100644 src/gallium/drivers/nvfx/nvfx_push.c (limited to 'src') diff --git a/src/gallium/drivers/nouveau/nouveau_class.h b/src/gallium/drivers/nouveau/nouveau_class.h index 685fa00b45..14c11b278a 100644 --- a/src/gallium/drivers/nouveau/nouveau_class.h +++ b/src/gallium/drivers/nouveau/nouveau_class.h @@ -6149,6 +6149,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #define NV34TCL_FP_REG_CONTROL_UNK1_MASK 0xffff0000 #define NV34TCL_FP_REG_CONTROL_UNK0_SHIFT 0 #define NV34TCL_FP_REG_CONTROL_UNK0_MASK 0x0000ffff +#define NV34TCL_EDGEFLAG_ENABLE 0x0000145c #define NV34TCL_VP_CLIP_PLANES_ENABLE 0x00001478 #define NV34TCL_VP_CLIP_PLANES_ENABLE_PLANE0 (1 << 1) #define NV34TCL_VP_CLIP_PLANES_ENABLE_PLANE1 (1 << 5) @@ -6182,10 +6183,13 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #define NV34TCL_VTXFMT__SIZE 0x00000010 #define NV34TCL_VTXFMT_TYPE_SHIFT 0 #define NV34TCL_VTXFMT_TYPE_MASK 0x0000000f -#define NV34TCL_VTXFMT_TYPE_FLOAT 0x00000002 -#define NV34TCL_VTXFMT_TYPE_HALF 0x00000003 -#define NV34TCL_VTXFMT_TYPE_UBYTE 0x00000004 -#define NV34TCL_VTXFMT_TYPE_USHORT 0x00000005 +#define NV34TCL_VTXFMT_TYPE_16_SNORM 0x00000001 +#define NV34TCL_VTXFMT_TYPE_32_FLOAT 0x00000002 +#define NV34TCL_VTXFMT_TYPE_16_FLOAT 0x00000003 +#define NV34TCL_VTXFMT_TYPE_8_UNORM 0x00000004 +#define NV34TCL_VTXFMT_TYPE_16_SSCALED 0x00000005 +#define NV34TCL_VTXFMT_TYPE_11_11_10_SNORM 0x00000006 +#define NV34TCL_VTXFMT_TYPE_8_USCALED 0x00000007 #define NV34TCL_VTXFMT_SIZE_SHIFT 4 #define NV34TCL_VTXFMT_SIZE_MASK 0x000000f0 #define NV34TCL_VTXFMT_STRIDE_SHIFT 8 diff --git a/src/gallium/drivers/nouveau/nouveau_util.h b/src/gallium/drivers/nouveau/nouveau_util.h deleted file mode 100644 index b165f7a611..0000000000 --- a/src/gallium/drivers/nouveau/nouveau_util.h +++ /dev/null @@ -1,91 +0,0 @@ -#ifndef __NOUVEAU_UTIL_H__ -#define __NOUVEAU_UTIL_H__ - -/* Determine how many vertices can be pushed into the command stream. - * Where the remaining space isn't large enough to represent all verices, - * split the buffer at primitive boundaries. - * - * Returns a count of vertices that can be rendered, and an index to - * restart drawing at after a flush. - */ -static INLINE unsigned -nouveau_vbuf_split(unsigned remaining, unsigned overhead, unsigned vpp, - unsigned mode, unsigned start, unsigned count, - unsigned *restart) -{ - int max, adj = 0; - - max = remaining - overhead; - if (max < 0) - return 0; - - max *= vpp; - if (max >= count) - return count; - - switch (mode) { - case PIPE_PRIM_POINTS: - break; - case PIPE_PRIM_LINES: - max = max & 1; - break; - case PIPE_PRIM_TRIANGLES: - max = max - (max % 3); - break; - case PIPE_PRIM_QUADS: - max = max & ~3; - break; - case PIPE_PRIM_LINE_LOOP: - case PIPE_PRIM_LINE_STRIP: - if (max < 2) - max = 0; - adj = 1; - break; - case PIPE_PRIM_POLYGON: - case PIPE_PRIM_TRIANGLE_STRIP: - case PIPE_PRIM_TRIANGLE_FAN: - if (max < 3) - max = 0; - adj = 2; - break; - case PIPE_PRIM_QUAD_STRIP: - if (max < 4) - max = 0; - adj = 3; - break; - default: - assert(0); - } - - *restart = start + max - adj; - return max; -} - -/* Integer base-2 logarithm, rounded towards zero. */ -static INLINE unsigned log2i(unsigned i) -{ - unsigned r = 0; - - if (i & 0xffff0000) { - i >>= 16; - r += 16; - } - if (i & 0x0000ff00) { - i >>= 8; - r += 8; - } - if (i & 0x000000f0) { - i >>= 4; - r += 4; - } - if (i & 0x0000000c) { - i >>= 2; - r += 2; - } - if (i & 0x00000002) { - r += 1; - } - return r; -} - -#endif diff --git a/src/gallium/drivers/nvfx/Makefile b/src/gallium/drivers/nvfx/Makefile index 2834f8984c..6cbbad699e 100644 --- a/src/gallium/drivers/nvfx/Makefile +++ b/src/gallium/drivers/nvfx/Makefile @@ -14,6 +14,7 @@ C_SOURCES = \ nv30_fragtex.c \ nv40_fragtex.c \ nvfx_miptree.c \ + nvfx_push.c \ nvfx_query.c \ nvfx_resource.c \ nvfx_screen.c \ diff --git a/src/gallium/drivers/nvfx/nv30_fragtex.c b/src/gallium/drivers/nvfx/nv30_fragtex.c index 63c578a0ce..db8a8fc4b0 100644 --- a/src/gallium/drivers/nvfx/nv30_fragtex.c +++ b/src/gallium/drivers/nvfx/nv30_fragtex.c @@ -1,7 +1,6 @@ #include "util/u_format.h" #include "nvfx_context.h" -#include "nouveau/nouveau_util.h" #include "nvfx_tex.h" #include "nvfx_resource.h" @@ -44,9 +43,9 @@ nv30_sampler_view_init(struct pipe_context *pipe, txf = sv->u.init_fmt; txf |= (level != sv->base.last_level ? NV34TCL_TX_FORMAT_MIPMAP : 0); - txf |= log2i(u_minify(pt->width0, level)) << NV34TCL_TX_FORMAT_BASE_SIZE_U_SHIFT; - txf |= log2i(u_minify(pt->height0, level)) << NV34TCL_TX_FORMAT_BASE_SIZE_V_SHIFT; - txf |= log2i(u_minify(pt->depth0, level)) << NV34TCL_TX_FORMAT_BASE_SIZE_W_SHIFT; + txf |= util_logbase2(u_minify(pt->width0, level)) << NV34TCL_TX_FORMAT_BASE_SIZE_U_SHIFT; + txf |= util_logbase2(u_minify(pt->height0, level)) << NV34TCL_TX_FORMAT_BASE_SIZE_V_SHIFT; + txf |= util_logbase2(u_minify(pt->depth0, level)) << NV34TCL_TX_FORMAT_BASE_SIZE_W_SHIFT; txf |= 0x10000; sv->u.nv30.fmt[0] = tf->fmt[0] | txf; diff --git a/src/gallium/drivers/nvfx/nvfx_buffer.c b/src/gallium/drivers/nvfx/nvfx_buffer.c index 44680e5195..89bb8570ef 100644 --- a/src/gallium/drivers/nvfx/nvfx_buffer.c +++ b/src/gallium/drivers/nvfx/nvfx_buffer.c @@ -6,13 +6,16 @@ #include "nouveau/nouveau_screen.h" #include "nouveau/nouveau_winsys.h" #include "nvfx_resource.h" +#include "nvfx_screen.h" void nvfx_buffer_destroy(struct pipe_screen *pscreen, struct pipe_resource *presource) { - struct nvfx_resource *buffer = nvfx_resource(presource); + struct nvfx_buffer *buffer = nvfx_buffer(presource); - nouveau_screen_bo_release(pscreen, buffer->bo); + if(!(buffer->base.base.flags & NVFX_RESOURCE_FLAG_USER)) + align_free(buffer->data); + nouveau_screen_bo_release(pscreen, buffer->base.bo); FREE(buffer); } @@ -20,31 +23,22 @@ struct pipe_resource * nvfx_buffer_create(struct pipe_screen *pscreen, const struct pipe_resource *template) { - struct nvfx_resource *buffer; + struct nvfx_screen* screen = nvfx_screen(pscreen); + struct nvfx_buffer* buffer; - buffer = CALLOC_STRUCT(nvfx_resource); + buffer = CALLOC_STRUCT(nvfx_buffer); if (!buffer) return NULL; - buffer->base = *template; - buffer->base.flags |= NVFX_RESOURCE_FLAG_LINEAR; - pipe_reference_init(&buffer->base.reference, 1); - buffer->base.screen = pscreen; + buffer->base.base = *template; + buffer->base.base.flags |= NVFX_RESOURCE_FLAG_LINEAR; + pipe_reference_init(&buffer->base.base.reference, 1); + buffer->base.base.screen = pscreen; + buffer->size = util_format_get_stride(template->format, template->width0); + buffer->bytes_to_draw_until_static = buffer->size * screen->static_reuse_threshold; + buffer->data = align_malloc(buffer->size, 16); - buffer->bo = nouveau_screen_bo_new(pscreen, - 16, - buffer->base.usage, - buffer->base.bind, - buffer->base.width0); - - if (buffer->bo == NULL) - goto fail; - - return &buffer->base; - -fail: - FREE(buffer); - return NULL; + return &buffer->base.base; } @@ -54,29 +48,49 @@ nvfx_user_buffer_create(struct pipe_screen *pscreen, unsigned bytes, unsigned usage) { - struct nvfx_resource *buffer; + struct nvfx_screen* screen = nvfx_screen(pscreen); + struct nvfx_buffer* buffer; - buffer = CALLOC_STRUCT(nvfx_resource); + buffer = CALLOC_STRUCT(nvfx_buffer); if (!buffer) return NULL; - pipe_reference_init(&buffer->base.reference, 1); - buffer->base.flags = NVFX_RESOURCE_FLAG_LINEAR; - buffer->base.screen = pscreen; - buffer->base.format = PIPE_FORMAT_R8_UNORM; - buffer->base.usage = PIPE_USAGE_IMMUTABLE; - buffer->base.bind = usage; - buffer->base.width0 = bytes; - buffer->base.height0 = 1; - buffer->base.depth0 = 1; - - buffer->bo = nouveau_screen_bo_user(pscreen, ptr, bytes); - if (!buffer->bo) - goto fail; - - return &buffer->base; + pipe_reference_init(&buffer->base.base.reference, 1); + buffer->base.base.flags = NVFX_RESOURCE_FLAG_LINEAR | NVFX_RESOURCE_FLAG_USER; + buffer->base.base.screen = pscreen; + buffer->base.base.format = PIPE_FORMAT_R8_UNORM; + buffer->base.base.usage = PIPE_USAGE_IMMUTABLE; + buffer->base.base.bind = usage; + buffer->base.base.width0 = bytes; + buffer->base.base.height0 = 1; + buffer->base.base.depth0 = 1; + buffer->data = ptr; + buffer->size = bytes; + buffer->bytes_to_draw_until_static = bytes * screen->static_reuse_threshold; + buffer->dirty_end = bytes; + + return &buffer->base.base; +} -fail: - FREE(buffer); - return NULL; +void nvfx_buffer_upload(struct nvfx_buffer* buffer) +{ + unsigned dirty = buffer->dirty_end - buffer->dirty_begin; + if(!buffer->base.bo) + { + buffer->base.bo = nouveau_screen_bo_new(buffer->base.base.screen, + 16, + buffer->base.base.usage, + buffer->base.base.bind, + buffer->base.base.width0); + } + + if(dirty) + { + // TODO: may want to use a temporary in some cases + nouveau_bo_map(buffer->base.bo, NOUVEAU_BO_WR + | (buffer->dirty_unsynchronized ? NOUVEAU_BO_NOSYNC : 0)); + memcpy(buffer->base.bo->map + buffer->dirty_begin, buffer->data + buffer->dirty_begin, dirty); + nouveau_bo_unmap(buffer->base.bo); + buffer->dirty_begin = buffer->dirty_end = 0; + } } diff --git a/src/gallium/drivers/nvfx/nvfx_context.c b/src/gallium/drivers/nvfx/nvfx_context.c index 1980176b23..94c854b22b 100644 --- a/src/gallium/drivers/nvfx/nvfx_context.c +++ b/src/gallium/drivers/nvfx/nvfx_context.c @@ -76,7 +76,9 @@ nvfx_create(struct pipe_screen *pscreen, void *priv) nvfx_init_surface_functions(nvfx); nvfx_init_state_functions(nvfx); nvfx_init_sampling_functions(nvfx); + nvfx_init_vbo_functions(nvfx); nvfx_init_resource_functions(&nvfx->pipe); + nvfx_init_transfer_functions(&nvfx->pipe); /* Create, configure, and install fallback swtnl path */ nvfx->draw = draw_create(&nvfx->pipe); @@ -89,6 +91,7 @@ nvfx_create(struct pipe_screen *pscreen, void *priv) /* set these to that we init them on first validation */ nvfx->state.scissor_enabled = ~0; nvfx->state.stipple_enabled = ~0; + nvfx->use_vertex_buffers = -1; LIST_INITHEAD(&nvfx->render_cache); diff --git a/src/gallium/drivers/nvfx/nvfx_context.h b/src/gallium/drivers/nvfx/nvfx_context.h index bce19df044..8899bf991e 100644 --- a/src/gallium/drivers/nvfx/nvfx_context.h +++ b/src/gallium/drivers/nvfx/nvfx_context.h @@ -44,6 +44,7 @@ #define NVFX_NEW_SR (1 << 13) #define NVFX_NEW_VERTCONST (1 << 14) #define NVFX_NEW_FRAGCONST (1 << 15) +#define NVFX_NEW_INDEX (1 << 16) struct nvfx_rasterizer_state { struct pipe_rasterizer_state pipe; @@ -71,9 +72,53 @@ struct nvfx_state { unsigned render_temps; }; +struct nvfx_per_vertex_element { + unsigned idx; + unsigned vertex_buffer_index; + unsigned src_offset; +}; + +struct nvfx_low_frequency_element { + unsigned idx; + unsigned vertex_buffer_index; + unsigned src_offset; + void (*fetch_rgba_float)(float *dst, const uint8_t *src, unsigned i, unsigned j); + unsigned ncomp; +}; + +struct nvfx_per_instance_element { + struct nvfx_low_frequency_element base; + unsigned instance_divisor; +}; + +struct nvfx_per_vertex_buffer_info +{ + unsigned vertex_buffer_index; + unsigned per_vertex_size; +}; + struct nvfx_vtxelt_state { struct pipe_vertex_element pipe[16]; unsigned num_elements; + unsigned vtxfmt[16]; + + unsigned num_per_vertex_buffer_infos; + struct nvfx_per_vertex_buffer_info per_vertex_buffer_info[16]; + + unsigned num_per_vertex; + struct nvfx_per_vertex_element per_vertex[16]; + + unsigned num_per_instance; + struct nvfx_per_instance_element per_instance[16]; + + unsigned num_constant; + struct nvfx_low_frequency_element constant[16]; + + boolean needs_translate; + struct translate* translate; + + unsigned vertex_length; + unsigned max_vertices_per_packet; }; struct nvfx_render_target { @@ -127,8 +172,6 @@ struct nvfx_context { struct pipe_viewport_state viewport; struct pipe_framebuffer_state framebuffer; struct pipe_index_buffer idxbuf; - struct pipe_resource *idxbuf_buffer; - unsigned idxbuf_format; struct nvfx_sampler_state *tex_sampler[PIPE_MAX_SAMPLERS]; struct pipe_sampler_view *fragment_sampler_views[PIPE_MAX_SAMPLERS]; unsigned nr_samplers; @@ -137,8 +180,14 @@ struct nvfx_context { struct pipe_vertex_buffer vtxbuf[PIPE_MAX_ATTRIBS]; unsigned vtxbuf_nr; struct nvfx_vtxelt_state *vtxelt; + int base_vertex; + boolean use_index_buffer; + /* -1 = hardware input setup is outdated + * 0 = hardware input setup is for inline vertices + * 1 = hardware input setup is for hardware vertices + */ + int use_vertex_buffers; - unsigned vbo_bo; unsigned hw_vtxelt_nr; uint8_t hw_samplers; uint32_t hw_txf[8]; @@ -180,11 +229,7 @@ extern void nvfx_clear(struct pipe_context *pipe, unsigned buffers, /* nvfx_draw.c */ extern struct draw_stage *nvfx_draw_render_stage(struct nvfx_context *nvfx); -extern void nvfx_draw_elements_swtnl(struct pipe_context *pipe, - struct pipe_resource *idxbuf, - unsigned ib_size, int ib_bias, - unsigned mode, - unsigned start, unsigned count); +extern void nvfx_draw_vbo_swtnl(struct pipe_context *pipe, const struct pipe_draw_info* info); extern void nvfx_vtxfmt_validate(struct nvfx_context *nvfx); /* nvfx_fb.c */ @@ -245,17 +290,53 @@ extern boolean nvfx_state_validate_swtnl(struct nvfx_context *nvfx); extern void nvfx_state_emit(struct nvfx_context *nvfx); /* nvfx_transfer.c */ -extern void nvfx_init_transfer_functions(struct nvfx_context *nvfx); +extern void nvfx_init_transfer_functions(struct pipe_context *pipe); /* nvfx_vbo.c */ extern boolean nvfx_vbo_validate(struct nvfx_context *nvfx); extern void nvfx_vbo_relocate(struct nvfx_context *nvfx); +extern void nvfx_idxbuf_validate(struct nvfx_context* nvfx); +extern void nvfx_idxbuf_relocate(struct nvfx_context* nvfx); extern void nvfx_draw_vbo(struct pipe_context *pipe, const struct pipe_draw_info *info); +extern void nvfx_init_vbo_functions(struct nvfx_context *nvfx); +extern unsigned nvfx_vertex_formats[]; /* nvfx_vertprog.c */ extern boolean nvfx_vertprog_validate(struct nvfx_context *nvfx); extern void nvfx_vertprog_destroy(struct nvfx_context *, struct nvfx_vertex_program *); +/* nvfx_push.c */ +extern void nvfx_push_vbo(struct pipe_context *pipe, const struct pipe_draw_info *info); + +/* must WAIT_RING(chan, ncomp + 1) or equivalent beforehand! */ +static inline void nvfx_emit_vtx_attr(struct nouveau_channel* chan, unsigned attrib, float* v, unsigned ncomp) +{ + switch (ncomp) { + case 4: + OUT_RING(chan, RING_3D(NV34TCL_VTX_ATTR_4F_X(attrib), 4)); + OUT_RING(chan, fui(v[0])); + OUT_RING(chan, fui(v[1])); + OUT_RING(chan, fui(v[2])); + OUT_RING(chan, fui(v[3])); + break; + case 3: + OUT_RING(chan, RING_3D(NV34TCL_VTX_ATTR_3F_X(attrib), 3)); + OUT_RING(chan, fui(v[0])); + OUT_RING(chan, fui(v[1])); + OUT_RING(chan, fui(v[2])); + break; + case 2: + OUT_RING(chan, RING_3D(NV34TCL_VTX_ATTR_2F_X(attrib), 2)); + OUT_RING(chan, fui(v[0])); + OUT_RING(chan, fui(v[1])); + break; + case 1: + OUT_RING(chan, RING_3D(NV34TCL_VTX_ATTR_1F(attrib), 1)); + OUT_RING(chan, fui(v[0])); + break; + } +} + #endif diff --git a/src/gallium/drivers/nvfx/nvfx_draw.c b/src/gallium/drivers/nvfx/nvfx_draw.c index 22cff370b7..331e28418a 100644 --- a/src/gallium/drivers/nvfx/nvfx_draw.c +++ b/src/gallium/drivers/nvfx/nvfx_draw.c @@ -9,6 +9,7 @@ #include "draw/draw_pipe.h" #include "nvfx_context.h" +#include "nvfx_resource.h" /* Simple, but crappy, swtnl path, hopefully we wont need to hit this very * often at all. Uses "quadro style" vertex submission + a fixed vertex @@ -39,30 +40,21 @@ nvfx_render_vertex(struct nvfx_context *nvfx, const struct vertex_header *v) unsigned idx = nvfx->swtnl.draw[i]; unsigned hw = nvfx->swtnl.hw[i]; + WAIT_RING(chan, 5); switch (nvfx->swtnl.emit[i]) { case EMIT_OMIT: break; case EMIT_1F: - BEGIN_RING(chan, eng3d, NV34TCL_VTX_ATTR_1F(hw), 1); - OUT_RING (chan, fui(v->data[idx][0])); + nvfx_emit_vtx_attr(chan, hw, v->data[idx], 1); break; case EMIT_2F: - BEGIN_RING(chan, eng3d, NV34TCL_VTX_ATTR_2F_X(hw), 2); - OUT_RING (chan, fui(v->data[idx][0])); - OUT_RING (chan, fui(v->data[idx][1])); + nvfx_emit_vtx_attr(chan, hw, v->data[idx], 2); break; case EMIT_3F: - BEGIN_RING(chan, eng3d, NV34TCL_VTX_ATTR_3F_X(hw), 3); - OUT_RING (chan, fui(v->data[idx][0])); - OUT_RING (chan, fui(v->data[idx][1])); - OUT_RING (chan, fui(v->data[idx][2])); + nvfx_emit_vtx_attr(chan, hw, v->data[idx], 3); break; case EMIT_4F: - BEGIN_RING(chan, eng3d, NV34TCL_VTX_ATTR_4F_X(hw), 4); - OUT_RING (chan, fui(v->data[idx][0])); - OUT_RING (chan, fui(v->data[idx][1])); - OUT_RING (chan, fui(v->data[idx][2])); - OUT_RING (chan, fui(v->data[idx][3])); + nvfx_emit_vtx_attr(chan, hw, v->data[idx], 4); break; case 0xff: BEGIN_RING(chan, eng3d, NV34TCL_VTX_ATTR_4F_X(hw), 4); @@ -231,15 +223,9 @@ nvfx_draw_render_stage(struct nvfx_context *nvfx) } void -nvfx_draw_elements_swtnl(struct pipe_context *pipe, - struct pipe_resource *idxbuf, - unsigned idxbuf_size, int idxbuf_bias, - unsigned mode, unsigned start, unsigned count) +nvfx_draw_vbo_swtnl(struct pipe_context *pipe, const struct pipe_draw_info* info) { struct nvfx_context *nvfx = nvfx_context(pipe); - struct pipe_transfer *vb_transfer[PIPE_MAX_ATTRIBS]; - struct pipe_transfer *ib_transfer = NULL; - struct pipe_transfer *cb_transfer = NULL; unsigned i; void *map; @@ -247,18 +233,15 @@ nvfx_draw_elements_swtnl(struct pipe_context *pipe, return; nvfx_state_emit(nvfx); + /* these must be passed without adding the offsets */ for (i = 0; i < nvfx->vtxbuf_nr; i++) { - map = pipe_buffer_map(pipe, nvfx->vtxbuf[i].buffer, - PIPE_TRANSFER_READ, - &vb_transfer[i]); + map = nvfx_buffer(nvfx->vtxbuf[i].buffer)->data; draw_set_mapped_vertex_buffer(nvfx->draw, i, map); } - if (idxbuf) { - map = pipe_buffer_map(pipe, idxbuf, - PIPE_TRANSFER_READ, - &ib_transfer); - draw_set_mapped_element_buffer(nvfx->draw, idxbuf_size, idxbuf_bias, map); + if (info->indexed) { + map = nvfx_buffer(nvfx->idxbuf.buffer)->data + nvfx->idxbuf.offset; + draw_set_mapped_element_buffer_range(nvfx->draw, nvfx->idxbuf.index_size, info->index_bias, info->min_index, info->max_index, map); } else { draw_set_mapped_element_buffer(nvfx->draw, 0, 0, NULL); } @@ -266,28 +249,14 @@ nvfx_draw_elements_swtnl(struct pipe_context *pipe, if (nvfx->constbuf[PIPE_SHADER_VERTEX]) { const unsigned nr = nvfx->constbuf_nr[PIPE_SHADER_VERTEX]; - map = pipe_buffer_map(pipe, - nvfx->constbuf[PIPE_SHADER_VERTEX], - PIPE_TRANSFER_READ, - &cb_transfer); + map = nvfx_buffer(nvfx->constbuf[PIPE_SHADER_VERTEX])->data; draw_set_mapped_constant_buffer(nvfx->draw, PIPE_SHADER_VERTEX, 0, map, nr); } - draw_arrays(nvfx->draw, mode, start, count); - - for (i = 0; i < nvfx->vtxbuf_nr; i++) - pipe_buffer_unmap(pipe, nvfx->vtxbuf[i].buffer, vb_transfer[i]); - - if (idxbuf) - pipe_buffer_unmap(pipe, idxbuf, ib_transfer); - - if (nvfx->constbuf[PIPE_SHADER_VERTEX]) - pipe_buffer_unmap(pipe, nvfx->constbuf[PIPE_SHADER_VERTEX], - cb_transfer); + draw_arrays_instanced(nvfx->draw, info->mode, info->start, info->count, info->start_instance, info->instance_count); draw_flush(nvfx->draw); - pipe->flush(pipe, 0, NULL); } static INLINE void diff --git a/src/gallium/drivers/nvfx/nvfx_fragprog.c b/src/gallium/drivers/nvfx/nvfx_fragprog.c index ee41f03b9b..ae4fe3aa26 100644 --- a/src/gallium/drivers/nvfx/nvfx_fragprog.c +++ b/src/gallium/drivers/nvfx/nvfx_fragprog.c @@ -9,6 +9,7 @@ #include "nvfx_context.h" #include "nvfx_shader.h" +#include "nvfx_resource.h" #define MAX_CONSTS 128 #define MAX_IMM 32 @@ -925,10 +926,7 @@ nvfx_fragprog_validate(struct nvfx_context *nvfx) if(nvfx->constbuf[PIPE_SHADER_FRAGMENT]) { struct pipe_resource* constbuf = nvfx->constbuf[PIPE_SHADER_FRAGMENT]; - // TODO: avoid using transfers, just directly the buffer - struct pipe_transfer* transfer; - // TODO: does this check make any sense, or should we do this unconditionally? - uint32_t* map = pipe_buffer_map(&nvfx->pipe, constbuf, PIPE_TRANSFER_READ, &transfer); + uint32_t* map = (uint32_t*)nvfx_buffer(constbuf)->data; uint32_t* fpmap = (uint32_t*)((char*)fp->fpbo->bo->map + offset); uint32_t* buf = (uint32_t*)((char*)fp->fpbo->insn + offset); int i; @@ -942,7 +940,6 @@ nvfx_fragprog_validate(struct nvfx_context *nvfx) nvfx_fp_memcpy(&fpmap[off], &map[idx], 4 * sizeof(uint32_t)); } } - pipe_buffer_unmap(&nvfx->pipe, constbuf, transfer); } } diff --git a/src/gallium/drivers/nvfx/nvfx_push.c b/src/gallium/drivers/nvfx/nvfx_push.c new file mode 100644 index 0000000000..52e891c667 --- /dev/null +++ b/src/gallium/drivers/nvfx/nvfx_push.c @@ -0,0 +1,402 @@ +#include "pipe/p_context.h" +#include "pipe/p_state.h" +#include "util/u_inlines.h" +#include "util/u_format.h" +#include "util/u_split_prim.h" +#include "translate/translate.h" + +#include "nvfx_context.h" +#include "nvfx_resource.h" + +struct push_context { + struct nouveau_channel* chan; + + void *idxbuf; + int32_t idxbias; + + float edgeflag; + int edgeflag_attr; + + unsigned vertex_length; + unsigned max_vertices_per_packet; + + struct translate* translate; +}; + +static void +emit_edgeflag(void *priv, boolean enabled) +{ + struct push_context* ctx = priv; + struct nouveau_channel *chan = ctx->chan; + + OUT_RING(chan, RING_3D(NV34TCL_EDGEFLAG_ENABLE, 1)); + OUT_RING(chan, enabled ? 1 : 0); +} + +static void +emit_vertices_lookup8(void *priv, unsigned start, unsigned count) +{ + struct push_context *ctx = priv; + uint8_t* elts = (uint8_t*)ctx->idxbuf + start; + + while(count) + { + unsigned push = MIN2(count, ctx->max_vertices_per_packet); + unsigned length = push * ctx->vertex_length; + + OUT_RING(ctx->chan, RING_3D_NI(NV34TCL_VERTEX_DATA, length)); + ctx->translate->run_elts8(ctx->translate, elts, push, 0, ctx->chan->cur); + ctx->chan->cur += length; + + count -= push; + elts += push; + } +} + +static void +emit_vertices_lookup16(void *priv, unsigned start, unsigned count) +{ + struct push_context *ctx = priv; + uint16_t* elts = (uint16_t*)ctx->idxbuf + start; + + while(count) + { + unsigned push = MIN2(count, ctx->max_vertices_per_packet); + unsigned length = push * ctx->vertex_length; + + OUT_RING(ctx->chan, RING_3D_NI(NV34TCL_VERTEX_DATA, length)); + ctx->translate->run_elts16(ctx->translate, elts, push, 0, ctx->chan->cur); + ctx->chan->cur += length; + + count -= push; + elts += push; + } +} + +static void +emit_vertices_lookup32(void *priv, unsigned start, unsigned count) +{ + struct push_context *ctx = priv; + uint32_t* elts = (uint32_t*)ctx->idxbuf + start; + + while(count) + { + unsigned push = MIN2(count, ctx->max_vertices_per_packet); + unsigned length = push * ctx->vertex_length; + + OUT_RING(ctx->chan, RING_3D_NI(NV34TCL_VERTEX_DATA, length)); + ctx->translate->run_elts(ctx->translate, elts, push, 0, ctx->chan->cur); + ctx->chan->cur += length; + + count -= push; + elts += push; + } +} + +static void +emit_vertices(void *priv, unsigned start, unsigned count) +{ + struct push_context *ctx = priv; + + while(count) + { + unsigned push = MIN2(count, ctx->max_vertices_per_packet); + unsigned length = push * ctx->vertex_length; + + OUT_RING(ctx->chan, RING_3D_NI(NV34TCL_VERTEX_DATA, length)); + ctx->translate->run(ctx->translate, start, push, 0, ctx->chan->cur); + ctx->chan->cur += length; + + count -= push; + start += push; + } +} + +static void +emit_ranges(void* priv, unsigned start, unsigned vc, unsigned reg) +{ + struct push_context* ctx = priv; + struct nouveau_channel *chan = ctx->chan; + unsigned nr = (vc & 0xff); + if (nr) { + OUT_RING(chan, RING_3D(reg, 1)); + OUT_RING (chan, ((nr - 1) << 24) | start); + start += nr; + } + + nr = vc >> 8; + while (nr) { + unsigned push = nr > 2047 ? 2047 : nr; + + nr -= push; + + OUT_RING(chan, RING_3D_NI(reg, push)); + while (push--) { + OUT_RING(chan, ((0x100 - 1) << 24) | start); + start += 0x100; + } + } +} + +static void +emit_ib_ranges(void* priv, unsigned start, unsigned vc) +{ + emit_ranges(priv, start, vc, NV34TCL_VB_INDEX_BATCH); +} + +static void +emit_vb_ranges(void* priv, unsigned start, unsigned vc) +{ + emit_ranges(priv, start, vc, NV34TCL_VB_VERTEX_BATCH); +} + +static INLINE void +emit_elt8(void* priv, unsigned start, unsigned vc) +{ + struct push_context* ctx = priv; + struct nouveau_channel *chan = ctx->chan; + uint8_t *elts = (uint8_t *)ctx->idxbuf + start; + int idxbias = ctx->idxbias; + + if (vc & 1) { + OUT_RING(chan, RING_3D(NV34TCL_VB_ELEMENT_U32, 1)); + OUT_RING (chan, elts[0]); + elts++; vc--; + } + + while (vc) { + unsigned i; + unsigned push = MIN2(vc, 2047 * 2); + + OUT_RING(chan, RING_3D_NI(NV34TCL_VB_ELEMENT_U16, push >> 1)); + for (i = 0; i < push; i+=2) + OUT_RING(chan, ((elts[i+1] + idxbias) << 16) | (elts[i] + idxbias)); + + vc -= push; + elts += push; + } +} + +static INLINE void +emit_elt16(void* priv, unsigned start, unsigned vc) +{ + struct push_context* ctx = priv; + struct nouveau_channel *chan = ctx->chan; + uint16_t *elts = (uint16_t *)ctx->idxbuf + start; + int idxbias = ctx->idxbias; + + if (vc & 1) { + OUT_RING(chan, RING_3D(NV34TCL_VB_ELEMENT_U32, 1)); + OUT_RING (chan, elts[0]); + elts++; vc--; + } + + while (vc) { + unsigned i; + unsigned push = MIN2(vc, 2047 * 2); + + OUT_RING(chan, RING_3D_NI(NV34TCL_VB_ELEMENT_U16, push >> 1)); + for (i = 0; i < push; i+=2) + OUT_RING(chan, ((elts[i+1] + idxbias) << 16) | (elts[i] + idxbias)); + + vc -= push; + elts += push; + } +} + +static INLINE void +emit_elt32(void* priv, unsigned start, unsigned vc) +{ + struct push_context* ctx = priv; + struct nouveau_channel *chan = ctx->chan; + uint32_t *elts = (uint32_t *)ctx->idxbuf + start; + int idxbias = ctx->idxbias; + + while (vc) { + unsigned push = MIN2(vc, 2047); + + OUT_RING(chan, RING_3D_NI(NV34TCL_VB_ELEMENT_U32, push)); + assert(AVAIL_RING(chan) >= push); + if(idxbias) + { + for(unsigned i = 0; i < push; ++i) + OUT_RING(chan, elts[i] + idxbias); + } + else + OUT_RINGp(chan, elts, push); + + vc -= push; + elts += push; + } +} + +void +nvfx_push_vbo(struct pipe_context *pipe, const struct pipe_draw_info *info) +{ + struct nvfx_context *nvfx = nvfx_context(pipe); + struct nouveau_channel *chan = nvfx->screen->base.channel; + struct push_context ctx; + struct util_split_prim s; + unsigned instances_left = info->instance_count; + int vtx_value; + unsigned hw_mode = nvgl_primitive(info->mode); + int i; + struct + { + uint8_t* map; + unsigned step; + } per_instance[16]; + unsigned p_overhead = 0 + + 4 /* begin/end */ + + 4; /* potential edgeflag enable/disable */ + + ctx.chan = nvfx->screen->base.channel; + ctx.translate = nvfx->vtxelt->translate; + ctx.idxbuf = NULL; + ctx.vertex_length = nvfx->vtxelt->vertex_length; + ctx.max_vertices_per_packet = nvfx->vtxelt->max_vertices_per_packet; + ctx.edgeflag = 0.5f; + // TODO: figure out if we really want to handle this, and do so in that case + ctx.edgeflag_attr = 0xff; // nvfx->vertprog->cfg.edgeflag_in; + + if(!nvfx->use_vertex_buffers) + { + for(i = 0; i < nvfx->vtxelt->num_per_vertex_buffer_infos; ++i) + { + struct nvfx_per_vertex_buffer_info* vbi = &nvfx->vtxelt->per_vertex_buffer_info[i]; + struct pipe_vertex_buffer *vb = &nvfx->vtxbuf[vbi->vertex_buffer_index]; + uint8_t* data = nvfx_buffer(vb->buffer)->data + vb->buffer_offset; + if(info->indexed) + data += info->index_bias * vb->stride; + ctx.translate->set_buffer(ctx.translate, i, data, vb->stride, ~0); + } + + if(ctx.edgeflag_attr < 16) + vtx_value = -(ctx.vertex_length + 3); /* vertex data and edgeflag header and value */ + else + { + p_overhead += 1; /* initial vertex_data header */ + vtx_value = -ctx.vertex_length; /* vertex data and edgeflag header and value */ + } + + if (info->indexed) { + // XXX: this case and is broken and probably need a new VTX_ATTR push path + if (nvfx->idxbuf.index_size == 1) + s.emit = emit_vertices_lookup8; + else if (nvfx->idxbuf.index_size == 2) + s.emit = emit_vertices_lookup16; + else + s.emit = emit_vertices_lookup32; + } else + s.emit = emit_vertices; + } + else + { + if(!info->indexed || nvfx->use_index_buffer) + { + s.emit = info->indexed ? emit_ib_ranges : emit_vb_ranges; + p_overhead += 3; + vtx_value = 0; + } + else if (nvfx->idxbuf.index_size == 4) + { + s.emit = emit_elt32; + p_overhead += 1; + vtx_value = 8; + } + else + { + s.emit = (nvfx->idxbuf.index_size == 2) ? emit_elt16 : emit_elt8; + p_overhead += 3; + vtx_value = 7; + } + } + + ctx.idxbias = info->index_bias; + if(nvfx->use_vertex_buffers) + ctx.idxbias -= nvfx->base_vertex; + + /* map index buffer, if present */ + if (info->indexed && !nvfx->use_index_buffer) + ctx.idxbuf = nvfx_buffer(nvfx->idxbuf.buffer)->data + nvfx->idxbuf.offset; + + s.priv = &ctx; + s.edge = emit_edgeflag; + + for (i = 0; i < nvfx->vtxelt->num_per_instance; ++i) + { + struct nvfx_per_instance_element *ve = &nvfx->vtxelt->per_instance[i]; + struct pipe_vertex_buffer *vb = &nvfx->vtxbuf[ve->base.vertex_buffer_index]; + float v[4]; + per_instance[i].step = info->start_instance % ve->instance_divisor; + per_instance[i].map = nvfx_buffer(vb->buffer)->data + vb->buffer_offset + ve->base.src_offset; + + nvfx->vtxelt->per_instance[i].base.fetch_rgba_float(v, per_instance[i].map, 0, 0); + + WAIT_RING(chan, 5); + nvfx_emit_vtx_attr(chan, nvfx->vtxelt->per_instance[i].base.idx, v, nvfx->vtxelt->per_instance[i].base.ncomp); + } + + /* per-instance loop */ + while (instances_left--) { + int max_verts; + boolean done; + + util_split_prim_init(&s, info->mode, info->start, info->count); + nvfx_state_emit(nvfx); + for(;;) { + max_verts = AVAIL_RING(chan); + max_verts -= p_overhead; + + /* if vtx_value < 0, each vertex is -vtx_value words long + * otherwise, each vertex is 2^(vtx_value) / 255 words long (this is an approximation) + */ + if(vtx_value < 0) + { + max_verts /= -vtx_value; + max_verts -= (max_verts >> 10); /* vertex data headers */ + } + else + { + if(max_verts >= (1 << 23)) /* avoid overflow here */ + max_verts = (1 << 23); + max_verts = (max_verts * 255) >> vtx_value; + } + + //printf("avail %u max_verts %u\n", AVAIL_RING(chan), max_verts); + + if(max_verts >= 16) + { + OUT_RING(chan, RING_3D(NV34TCL_VERTEX_BEGIN_END, 1)); + OUT_RING(chan, hw_mode); + done = util_split_prim_next(&s, max_verts); + OUT_RING(chan, RING_3D(NV34TCL_VERTEX_BEGIN_END, 1)); + OUT_RING(chan, 0); + + if(done) + break; + } + + FIRE_RING(chan); + nvfx_state_emit(nvfx); + } + + /* set data for the next instance, if any changed */ + for (i = 0; i < nvfx->vtxelt->num_per_instance; ++i) + { + struct nvfx_per_instance_element *ve = &nvfx->vtxelt->per_instance[i]; + struct pipe_vertex_buffer *vb = &nvfx->vtxbuf[ve->base.vertex_buffer_index]; + + if(++per_instance[i].step == ve->instance_divisor) + { + float v[4]; + per_instance[i].map += vb->stride; + per_instance[i].step = 0; + + nvfx->vtxelt->per_instance[i].base.fetch_rgba_float(v, per_instance[i].map, 0, 0); + WAIT_RING(chan, 5); + nvfx_emit_vtx_attr(chan, nvfx->vtxelt->per_instance[i].base.idx, v, nvfx->vtxelt->per_instance[i].base.ncomp); + } + } + } +} diff --git a/src/gallium/drivers/nvfx/nvfx_resource.c b/src/gallium/drivers/nvfx/nvfx_resource.c index 1c921b4710..3a46e0a7a5 100644 --- a/src/gallium/drivers/nvfx/nvfx_resource.c +++ b/src/gallium/drivers/nvfx/nvfx_resource.c @@ -59,12 +59,6 @@ nvfx_resource_get_handle(struct pipe_screen *pscreen, void nvfx_init_resource_functions(struct pipe_context *pipe) { - pipe->get_transfer = nvfx_transfer_new; - pipe->transfer_map = nvfx_transfer_map; - pipe->transfer_flush_region = u_default_transfer_flush_region; - pipe->transfer_unmap = nvfx_transfer_unmap; - pipe->transfer_destroy = util_staging_transfer_destroy; - pipe->transfer_inline_write = u_default_transfer_inline_write; pipe->is_resource_referenced = nvfx_resource_is_referenced; } diff --git a/src/gallium/drivers/nvfx/nvfx_resource.h b/src/gallium/drivers/nvfx/nvfx_resource.h index ff86f6d9cb..583be4de2a 100644 --- a/src/gallium/drivers/nvfx/nvfx_resource.h +++ b/src/gallium/drivers/nvfx/nvfx_resource.h @@ -17,8 +17,23 @@ struct nvfx_resource { struct nouveau_bo *bo; }; +static INLINE +struct nvfx_resource *nvfx_resource(struct pipe_resource *resource) +{ + return (struct nvfx_resource *)resource; +} + #define NVFX_RESOURCE_FLAG_LINEAR (PIPE_RESOURCE_FLAG_DRV_PRIV << 0) +#define NVFX_RESOURCE_FLAG_USER (PIPE_RESOURCE_FLAG_DRV_PRIV << 1) + +/* is resource mapped into the GPU's address space (i.e. VRAM or GART) ? */ +static INLINE boolean +nvfx_resource_mapped_by_gpu(struct pipe_resource *resource) +{ + return nvfx_resource(resource)->bo->handle; +} +/* is resource in VRAM? */ static inline int nvfx_resource_on_gpu(struct pipe_resource* pr) { @@ -63,12 +78,6 @@ struct nvfx_surface { struct nvfx_miptree* temp; }; -static INLINE -struct nvfx_resource *nvfx_resource(struct pipe_resource *resource) -{ - return (struct nvfx_resource *)resource; -} - static INLINE struct nouveau_bo * nvfx_surface_buffer(struct pipe_surface *surf) { @@ -106,22 +115,6 @@ nvfx_miptree_from_handle(struct pipe_screen *pscreen, const struct pipe_resource *template, struct winsys_handle *whandle); -struct pipe_resource * -nvfx_buffer_create(struct pipe_screen *pscreen, - const struct pipe_resource *template); - -void -nvfx_buffer_destroy(struct pipe_screen *pscreen, - struct pipe_resource *presource); - -struct pipe_resource * -nvfx_user_buffer_create(struct pipe_screen *screen, - void *ptr, - unsigned bytes, - unsigned usage); - - - void nvfx_miptree_surface_del(struct pipe_surface *ps); @@ -173,4 +166,58 @@ nvfx_surface_create_temp(struct pipe_context* pipe, struct pipe_surface* surf); void nvfx_surface_flush(struct pipe_context* pipe, struct pipe_surface* surf); +struct nvfx_buffer +{ + struct nvfx_resource base; + uint8_t* data; + unsigned size; + + /* the range of data not yet uploaded to the GPU bo */ + unsigned dirty_begin; + unsigned dirty_end; + + /* whether all transfers were unsynchronized */ + boolean dirty_unsynchronized; + + /* whether it would have been profitable to upload + * the latest updated data to the GPU immediately */ + boolean last_update_static; + + /* how many bytes we need to draw before we deem + * the buffer to be static + */ + long long bytes_to_draw_until_static; +}; + +static inline struct nvfx_buffer* nvfx_buffer(struct pipe_resource* pr) +{ + return (struct nvfx_buffer*)pr; +} + +/* this is an heuristic to determine whether we are better off uploading the + * buffer to the GPU, or just continuing pushing it on the FIFO + */ +static inline boolean nvfx_buffer_seems_static(struct nvfx_buffer* buffer) +{ + return buffer->last_update_static + || buffer->bytes_to_draw_until_static < 0; +} + +struct pipe_resource * +nvfx_buffer_create(struct pipe_screen *pscreen, + const struct pipe_resource *template); + +void +nvfx_buffer_destroy(struct pipe_screen *pscreen, + struct pipe_resource *presource); + +struct pipe_resource * +nvfx_user_buffer_create(struct pipe_screen *screen, + void *ptr, + unsigned bytes, + unsigned usage); + +void +nvfx_buffer_upload(struct nvfx_buffer* buffer); + #endif diff --git a/src/gallium/drivers/nvfx/nvfx_screen.c b/src/gallium/drivers/nvfx/nvfx_screen.c index a1b8361a9a..7e3caf8d2e 100644 --- a/src/gallium/drivers/nvfx/nvfx_screen.c +++ b/src/gallium/drivers/nvfx/nvfx_screen.c @@ -163,11 +163,11 @@ nvfx_screen_get_paramf(struct pipe_screen *pscreen, enum pipe_cap param) } static boolean -nvfx_screen_surface_format_supported(struct pipe_screen *pscreen, +nvfx_screen_is_format_supported(struct pipe_screen *pscreen, enum pipe_format format, enum pipe_texture_target target, unsigned sample_count, - unsigned tex_usage, unsigned geom_flags) + unsigned bind, unsigned geom_flags) { struct nvfx_screen *screen = nvfx_screen(pscreen); struct pipe_surface *front = ((struct nouveau_winsys *) pscreen->winsys)->front; @@ -175,7 +175,7 @@ nvfx_screen_surface_format_supported(struct pipe_screen *pscreen, if (sample_count > 1) return FALSE; - if (tex_usage & PIPE_BIND_RENDER_TARGET) { + if (bind & PIPE_BIND_RENDER_TARGET) { switch (format) { case PIPE_FORMAT_B8G8R8A8_UNORM: case PIPE_FORMAT_B8G8R8X8_UNORM: @@ -186,7 +186,7 @@ nvfx_screen_surface_format_supported(struct pipe_screen *pscreen, } } - if (tex_usage & PIPE_BIND_DEPTH_STENCIL) { + if (bind & PIPE_BIND_DEPTH_STENCIL) { switch (format) { case PIPE_FORMAT_S8_USCALED_Z24_UNORM: case PIPE_FORMAT_X8Z24_UNORM: @@ -201,7 +201,7 @@ nvfx_screen_surface_format_supported(struct pipe_screen *pscreen, } } - if (tex_usage & PIPE_BIND_SAMPLER_VIEW) { + if (bind & PIPE_BIND_SAMPLER_VIEW) { struct nvfx_texture_format* tf = &nvfx_texture_formats[format]; if(util_format_is_s3tc(format) && !util_format_s3tc_enabled) return FALSE; @@ -218,6 +218,22 @@ nvfx_screen_surface_format_supported(struct pipe_screen *pscreen, } } + // note that we do actually support everything through translate + if (bind & PIPE_BIND_VERTEX_BUFFER) { + unsigned type = nvfx_vertex_formats[format]; + if(!type) + return FALSE; + } + + if (bind & PIPE_BIND_INDEX_BUFFER) { + // 8-bit indices supported, but not in hardware index buffer + if(format != PIPE_FORMAT_R16_USCALED && format != PIPE_FORMAT_R32_USCALED) + return FALSE; + } + + if(bind & PIPE_BIND_STREAM_OUTPUT) + return FALSE; + return TRUE; } @@ -387,7 +403,7 @@ nvfx_screen_create(struct pipe_winsys *ws, struct nouveau_device *dev) pscreen->destroy = nvfx_screen_destroy; pscreen->get_param = nvfx_screen_get_param; pscreen->get_paramf = nvfx_screen_get_paramf; - pscreen->is_format_supported = nvfx_screen_surface_format_supported; + pscreen->is_format_supported = nvfx_screen_is_format_supported; pscreen->context_create = nvfx_create; switch (dev->chipset & 0xf0) { @@ -419,6 +435,11 @@ nvfx_screen_create(struct pipe_winsys *ws, struct nouveau_device *dev) } screen->force_swtnl = debug_get_bool_option("NOUVEAU_SWTNL", FALSE); + screen->trace_draw = debug_get_bool_option("NVFX_TRACE_DRAW", FALSE); + + screen->buffer_allocation_cost = debug_get_num_option("NVFX_BUFFER_ALLOCATION_COST", 16384); + screen->inline_cost_per_hardware_cost = atof(debug_get_option("NVFX_INLINE_COST_PER_HARDWARE_COST", "1.0")); + screen->static_reuse_threshold = atof(debug_get_option("NVFX_STATIC_REUSE_THRESHOLD", "2.0")); screen->vertex_buffer_reloc_flags = nvfx_screen_get_vertex_buffer_flags(screen); diff --git a/src/gallium/drivers/nvfx/nvfx_screen.h b/src/gallium/drivers/nvfx/nvfx_screen.h index 4dedbe9cb4..473a112775 100644 --- a/src/gallium/drivers/nvfx/nvfx_screen.h +++ b/src/gallium/drivers/nvfx/nvfx_screen.h @@ -16,6 +16,7 @@ struct nvfx_screen { unsigned is_nv4x; /* either 0 or ~0 */ boolean force_swtnl; + boolean trace_draw; unsigned vertex_buffer_reloc_flags; unsigned index_buffer_reloc_flags; @@ -33,6 +34,18 @@ struct nvfx_screen { struct nouveau_resource *vp_data_heap; struct nv04_2d_context* eng2d; + + /* Once the amount of bytes drawn from the buffer reaches the updated size times this value, + * we will assume that the buffer will be drawn an huge number of times before the + * next modification + */ + float static_reuse_threshold; + + /* Cost of allocating a buffer in terms of the cost of copying a byte to an hardware buffer */ + unsigned buffer_allocation_cost; + + /* inline_cost/hardware_cost conversion ration */ + float inline_cost_per_hardware_cost; }; static INLINE struct nvfx_screen * diff --git a/src/gallium/drivers/nvfx/nvfx_state.c b/src/gallium/drivers/nvfx/nvfx_state.c index d459f9a880..25d29720a8 100644 --- a/src/gallium/drivers/nvfx/nvfx_state.c +++ b/src/gallium/drivers/nvfx/nvfx_state.c @@ -441,83 +441,6 @@ nvfx_set_viewport_state(struct pipe_context *pipe, nvfx->draw_dirty |= NVFX_NEW_VIEWPORT; } -static void -nvfx_set_vertex_buffers(struct pipe_context *pipe, unsigned count, - const struct pipe_vertex_buffer *vb) -{ - struct nvfx_context *nvfx = nvfx_context(pipe); - - for(unsigned i = 0; i < count; ++i) - { - pipe_resource_reference(&nvfx->vtxbuf[i].buffer, vb[i].buffer); - nvfx->vtxbuf[i].buffer_offset = vb[i].buffer_offset; - nvfx->vtxbuf[i].max_index = vb[i].max_index; - nvfx->vtxbuf[i].stride = vb[i].stride; - } - - for(unsigned i = count; i < nvfx->vtxbuf_nr; ++i) - pipe_resource_reference(&nvfx->vtxbuf[i].buffer, 0); - - nvfx->vtxbuf_nr = count; - - nvfx->dirty |= NVFX_NEW_ARRAYS; - nvfx->draw_dirty |= NVFX_NEW_ARRAYS; -} - -static void -nvfx_set_index_buffer(struct pipe_context *pipe, - const struct pipe_index_buffer *ib) -{ - struct nvfx_context *nvfx = nvfx_context(pipe); - - /* TODO make this more like a state */ - - if(ib) - { - pipe_resource_reference(&nvfx->idxbuf.buffer, ib->buffer); - nvfx->idxbuf.index_size = ib->index_size; - nvfx->idxbuf.offset = ib->offset; - } - else - { - pipe_resource_reference(&nvfx->idxbuf.buffer, 0); - nvfx->idxbuf.index_size = 0; - nvfx->idxbuf.offset = 0; - } -} - -static void * -nvfx_vtxelts_state_create(struct pipe_context *pipe, - unsigned num_elements, - const struct pipe_vertex_element *elements) -{ - struct nvfx_vtxelt_state *cso = CALLOC_STRUCT(nvfx_vtxelt_state); - - assert(num_elements < 16); /* not doing fallbacks yet */ - cso->num_elements = num_elements; - memcpy(cso->pipe, elements, num_elements * sizeof(*elements)); - -/* nvfx_vtxelt_construct(cso);*/ - - return (void *)cso; -} - -static void -nvfx_vtxelts_state_delete(struct pipe_context *pipe, void *hwcso) -{ - FREE(hwcso); -} - -static void -nvfx_vtxelts_state_bind(struct pipe_context *pipe, void *hwcso) -{ - struct nvfx_context *nvfx = nvfx_context(pipe); - - nvfx->vtxelt = hwcso; - nvfx->dirty |= NVFX_NEW_ARRAYS; - /*nvfx->draw_dirty |= NVFX_NEW_ARRAYS;*/ -} - void nvfx_init_state_functions(struct nvfx_context *nvfx) { @@ -553,11 +476,4 @@ nvfx_init_state_functions(struct nvfx_context *nvfx) nvfx->pipe.set_polygon_stipple = nvfx_set_polygon_stipple; nvfx->pipe.set_scissor_state = nvfx_set_scissor_state; nvfx->pipe.set_viewport_state = nvfx_set_viewport_state; - - nvfx->pipe.create_vertex_elements_state = nvfx_vtxelts_state_create; - nvfx->pipe.delete_vertex_elements_state = nvfx_vtxelts_state_delete; - nvfx->pipe.bind_vertex_elements_state = nvfx_vtxelts_state_bind; - - nvfx->pipe.set_vertex_buffers = nvfx_set_vertex_buffers; - nvfx->pipe.set_index_buffer = nvfx_set_index_buffer; } diff --git a/src/gallium/drivers/nvfx/nvfx_state_emit.c b/src/gallium/drivers/nvfx/nvfx_state_emit.c index dc70f3de87..b9d1897791 100644 --- a/src/gallium/drivers/nvfx/nvfx_state_emit.c +++ b/src/gallium/drivers/nvfx/nvfx_state_emit.c @@ -8,6 +8,7 @@ nvfx_state_validate_common(struct nvfx_context *nvfx) { struct nouveau_channel* chan = nvfx->screen->base.channel; unsigned dirty; + unsigned still_dirty = 0; int all_swizzled = -1; boolean flush_tex_cache = FALSE; @@ -52,11 +53,19 @@ nvfx_state_validate_common(struct nvfx_context *nvfx) return FALSE; } - if(dirty & (NVFX_NEW_ARRAYS)) + if(dirty & NVFX_NEW_ARRAYS) { if(!nvfx_vbo_validate(nvfx)) return FALSE; } + + if(dirty & NVFX_NEW_INDEX) + { + if(nvfx->use_index_buffer) + nvfx_idxbuf_validate(nvfx); + else + still_dirty = NVFX_NEW_INDEX; + } } else { @@ -64,7 +73,7 @@ nvfx_state_validate_common(struct nvfx_context *nvfx) if(dirty & (NVFX_NEW_VERTPROG | NVFX_NEW_UCP)) nvfx_vertprog_validate(nvfx); - if(dirty & (NVFX_NEW_ARRAYS | NVFX_NEW_FRAGPROG)) + if(dirty & (NVFX_NEW_ARRAYS | NVFX_NEW_INDEX | NVFX_NEW_FRAGPROG)) nvfx_vtxfmt_validate(nvfx); } @@ -118,7 +127,24 @@ nvfx_state_validate_common(struct nvfx_context *nvfx) OUT_RING(chan, 1); } } - nvfx->dirty = 0; + + nvfx->dirty = dirty & still_dirty; + + unsigned render_temps = nvfx->state.render_temps; + if(render_temps) + { + for(int i = 0; i < nvfx->framebuffer.nr_cbufs; ++i) + { + if(render_temps & (1 << i)) + util_dirty_surface_set_dirty(nvfx_surface_get_dirty_surfaces(nvfx->framebuffer.cbufs[i]), + (struct util_dirty_surface*)nvfx->framebuffer.cbufs[i]); + } + + if(render_temps & 0x80) + util_dirty_surface_set_dirty(nvfx_surface_get_dirty_surfaces(nvfx->framebuffer.zsbuf), + (struct util_dirty_surface*)nvfx->framebuffer.zsbuf); + } + return TRUE; } @@ -137,21 +163,6 @@ nvfx_state_emit(struct nvfx_context *nvfx) ; MARK_RING(chan, max_relocs * 2, max_relocs * 2); nvfx_state_relocate(nvfx); - - unsigned render_temps = nvfx->state.render_temps; - if(render_temps) - { - for(int i = 0; i < nvfx->framebuffer.nr_cbufs; ++i) - { - if(render_temps & (1 << i)) - util_dirty_surface_set_dirty(nvfx_surface_get_dirty_surfaces(nvfx->framebuffer.cbufs[i]), - (struct util_dirty_surface*)nvfx->framebuffer.cbufs[i]); - } - - if(render_temps & 0x80) - util_dirty_surface_set_dirty(nvfx_surface_get_dirty_surfaces(nvfx->framebuffer.zsbuf), - (struct util_dirty_surface*)nvfx->framebuffer.zsbuf); - } } void @@ -161,7 +172,11 @@ nvfx_state_relocate(struct nvfx_context *nvfx) nvfx_fragtex_relocate(nvfx); nvfx_fragprog_relocate(nvfx); if (nvfx->render_mode == HW) + { nvfx_vbo_relocate(nvfx); + if(nvfx->use_index_buffer) + nvfx_idxbuf_relocate(nvfx); + } } boolean diff --git a/src/gallium/drivers/nvfx/nvfx_state_fb.c b/src/gallium/drivers/nvfx/nvfx_state_fb.c index 80b0f21575..28bbd36c2e 100644 --- a/src/gallium/drivers/nvfx/nvfx_state_fb.c +++ b/src/gallium/drivers/nvfx/nvfx_state_fb.c @@ -1,6 +1,5 @@ #include "nvfx_context.h" #include "nvfx_resource.h" -#include "nouveau/nouveau_util.h" #include "util/u_format.h" static inline boolean @@ -125,8 +124,8 @@ nvfx_framebuffer_validate(struct nvfx_context *nvfx, unsigned prepare_result) assert(!(fb->width & (fb->width - 1)) && !(fb->height & (fb->height - 1))); rt_format = NV34TCL_RT_FORMAT_TYPE_SWIZZLED | - (log2i(fb->width) << NV34TCL_RT_FORMAT_LOG2_WIDTH_SHIFT) | - (log2i(fb->height) << NV34TCL_RT_FORMAT_LOG2_HEIGHT_SHIFT); + (util_logbase2(fb->width) << NV34TCL_RT_FORMAT_LOG2_WIDTH_SHIFT) | + (util_logbase2(fb->height) << NV34TCL_RT_FORMAT_LOG2_HEIGHT_SHIFT); } else rt_format = NV34TCL_RT_FORMAT_TYPE_LINEAR; diff --git a/src/gallium/drivers/nvfx/nvfx_surface.c b/src/gallium/drivers/nvfx/nvfx_surface.c index 7efdd954b4..135978ad27 100644 --- a/src/gallium/drivers/nvfx/nvfx_surface.c +++ b/src/gallium/drivers/nvfx/nvfx_surface.c @@ -36,7 +36,6 @@ #include "util/u_blitter.h" #include "nouveau/nouveau_winsys.h" -#include "nouveau/nouveau_util.h" #include "nouveau/nouveau_screen.h" #include "nvfx_context.h" #include "nvfx_screen.h" @@ -62,7 +61,7 @@ nvfx_region_set_format(struct nv04_region* rgn, enum pipe_format format) break; default: assert(util_is_pot(bits)); - int shift = log2i(bits) - 3; + int shift = util_logbase2(bits) - 3; assert(shift >= 2); rgn->bpps = 2; shift -= 2; @@ -365,25 +364,29 @@ nvfx_surface_copy_temp(struct pipe_context* pipe, struct pipe_surface* surf, int { struct nvfx_surface* ns = (struct nvfx_surface*)surf; struct pipe_subresource tempsr, surfsr; - struct pipe_resource *idxbuf_buffer; - unsigned idxbuf_format; + struct nvfx_context* nvfx = nvfx_context(pipe); + + // TODO: we really should do this validation before setting these variable in draw calls + unsigned use_vertex_buffers = nvfx->use_vertex_buffers; + boolean use_index_buffer = nvfx->use_index_buffer; + unsigned base_vertex = nvfx->base_vertex; tempsr.face = 0; tempsr.level = 0; surfsr.face = surf->face; surfsr.level = surf->level; - // TODO: do this properly, in blitter save - idxbuf_buffer = ((struct nvfx_context*)pipe)->idxbuf_buffer; - idxbuf_format = ((struct nvfx_context*)pipe)->idxbuf_format; - if(to_temp) nvfx_resource_copy_region(pipe, &ns->temp->base.base, tempsr, 0, 0, 0, surf->texture, surfsr, 0, 0, surf->zslice, surf->width, surf->height); else nvfx_resource_copy_region(pipe, surf->texture, surfsr, 0, 0, surf->zslice, &ns->temp->base.base, tempsr, 0, 0, 0, surf->width, surf->height); - ((struct nvfx_context*)pipe)->idxbuf_buffer = idxbuf_buffer; - ((struct nvfx_context*)pipe)->idxbuf_format = idxbuf_format; + nvfx->use_vertex_buffers = use_vertex_buffers; + nvfx->use_index_buffer = use_index_buffer; + nvfx->base_vertex = base_vertex; + + nvfx->dirty |= NVFX_NEW_ARRAYS; + nvfx->draw_dirty |= NVFX_NEW_ARRAYS; } void diff --git a/src/gallium/drivers/nvfx/nvfx_transfer.c b/src/gallium/drivers/nvfx/nvfx_transfer.c index e9c3dd7e55..ca4462ef9d 100644 --- a/src/gallium/drivers/nvfx/nvfx_transfer.c +++ b/src/gallium/drivers/nvfx/nvfx_transfer.c @@ -26,25 +26,44 @@ nvfx_transfer_new(struct pipe_context *pipe, unsigned usage, const struct pipe_box *box) { - struct nvfx_staging_transfer* tx; - bool direct = !nvfx_resource_on_gpu(pt) && pt->flags & NVFX_RESOURCE_FLAG_LINEAR; - - tx = CALLOC_STRUCT(nvfx_staging_transfer); - if(!tx) - return NULL; - - util_staging_transfer_init(pipe, pt, sr, usage, box, direct, tx); + if((usage & (PIPE_TRANSFER_UNSYNCHRONIZED | PIPE_TRANSFER_DONTBLOCK)) == PIPE_TRANSFER_DONTBLOCK) + { + struct nouveau_bo* bo = ((struct nvfx_resource*)pt)->bo; + if(bo && nouveau_bo_busy(bo, NOUVEAU_BO_WR)) + return NULL; + } if(pt->target == PIPE_BUFFER) { - tx->base.base.slice_stride = tx->base.base.stride = ((struct nvfx_resource*)tx->base.staging_resource)->bo->size; - if(direct) - tx->offset = util_format_get_stride(pt->format, box->x); - else - tx->offset = 0; + // it would be nice if we could avoid all this ridiculous overhead... + struct pipe_transfer* tx; + struct nvfx_buffer* buffer = nvfx_buffer(pt); + + tx = CALLOC_STRUCT(pipe_transfer); + if (!tx) + return NULL; + + pipe_resource_reference(&tx->resource, pt); + tx->sr = sr; + tx->usage = usage; + tx->box = *box; + + tx->slice_stride = tx->stride = util_format_get_stride(pt->format, box->width); + tx->data = buffer->data + util_format_get_stride(pt->format, box->x); + + return tx; } else { + struct nvfx_staging_transfer* tx; + bool direct = !nvfx_resource_on_gpu(pt) && pt->flags & NVFX_RESOURCE_FLAG_LINEAR; + + tx = CALLOC_STRUCT(nvfx_staging_transfer); + if(!tx) + return NULL; + + util_staging_transfer_init(pipe, pt, sr, usage, box, direct, &tx->base); + if(direct) { tx->base.base.stride = nvfx_subresource_pitch(pt, sr.level); @@ -66,26 +85,132 @@ nvfx_transfer_new(struct pipe_context *pipe, } } +static void nvfx_buffer_dirty_interval(struct nvfx_buffer* buffer, unsigned begin, unsigned size, boolean unsynchronized) +{ + struct nvfx_screen* screen = nvfx_screen(buffer->base.base.screen); + buffer->last_update_static = buffer->bytes_to_draw_until_static < 0; + if(buffer->dirty_begin == buffer->dirty_end) + { + buffer->dirty_begin = begin; + buffer->dirty_end = begin + size; + buffer->dirty_unsynchronized = unsynchronized; + } + else + { + buffer->dirty_begin = MIN2(buffer->dirty_begin, begin); + buffer->dirty_end = MAX2(buffer->dirty_end, begin + size); + buffer->dirty_unsynchronized &= unsynchronized; + } + + if(unsynchronized) + { + // TODO: revisit this, it doesn't seem quite right + //printf("UNSYNC UPDATE %p %u %u\n", buffer, begin, size); + buffer->bytes_to_draw_until_static += size * screen->static_reuse_threshold; + } + else + buffer->bytes_to_draw_until_static = buffer->size * screen->static_reuse_threshold; +} + +static void nvfx_transfer_flush_region( struct pipe_context *pipe, + struct pipe_transfer *ptx, + const struct pipe_box *box) +{ + if(ptx->resource->target == PIPE_BUFFER && (ptx->usage & PIPE_TRANSFER_FLUSH_EXPLICIT)) + { + struct nvfx_buffer* buffer = nvfx_buffer(ptx->resource); + nvfx_buffer_dirty_interval(buffer, + (uint8_t*)ptx->data - buffer->data + util_format_get_stride(buffer->base.base.format, box->x), + util_format_get_stride(buffer->base.base.format, box->width), + !!(ptx->usage & PIPE_TRANSFER_UNSYNCHRONIZED)); + } +} + +static void +nvfx_transfer_destroy(struct pipe_context *pipe, struct pipe_transfer *ptx) +{ + if(ptx->resource->target == PIPE_BUFFER) + { + struct nvfx_buffer* buffer = nvfx_buffer(ptx->resource); + if((ptx->usage & (PIPE_TRANSFER_WRITE | PIPE_TRANSFER_FLUSH_EXPLICIT)) == PIPE_TRANSFER_WRITE) + nvfx_buffer_dirty_interval(buffer, + (uint8_t*)ptx->data - buffer->data, + ptx->stride, + !!(ptx->usage & PIPE_TRANSFER_UNSYNCHRONIZED)); + pipe_resource_reference(&ptx->resource, 0); + FREE(ptx); + } + else + util_staging_transfer_destroy(pipe, ptx); +} + void * nvfx_transfer_map(struct pipe_context *pipe, struct pipe_transfer *ptx) { - struct nvfx_staging_transfer *tx = (struct nvfx_staging_transfer *)ptx; - if(!ptx->data) + if(ptx->resource->target == PIPE_BUFFER) + return ptx->data; + else { - struct nvfx_miptree *mt = (struct nvfx_miptree *)tx->base.staging_resource; - uint8_t *map = nouveau_screen_bo_map(pipe->screen, mt->base.bo, nouveau_screen_transfer_flags(ptx->usage)); - ptx->data = map + tx->offset; + struct nvfx_staging_transfer *tx = (struct nvfx_staging_transfer *)ptx; + if(!ptx->data) + { + struct nvfx_miptree *mt = (struct nvfx_miptree *)tx->base.staging_resource; + uint8_t *map = nouveau_screen_bo_map(pipe->screen, mt->base.bo, nouveau_screen_transfer_flags(ptx->usage)); + ptx->data = map + tx->offset; + } + + ++tx->map_count; + return ptx->data; } - ++tx->map_count; - return ptx->data; } void nvfx_transfer_unmap(struct pipe_context *pipe, struct pipe_transfer *ptx) { - struct nvfx_staging_transfer *tx = (struct nvfx_staging_transfer *)ptx; - struct nvfx_miptree *mt = (struct nvfx_miptree *)tx->base.staging_resource; + if(ptx->resource->target != PIPE_BUFFER) + { + struct nvfx_staging_transfer *tx = (struct nvfx_staging_transfer *)ptx; + struct nvfx_miptree *mt = (struct nvfx_miptree *)tx->base.staging_resource; + + if(!--tx->map_count) + { + nouveau_screen_bo_unmap(pipe->screen, mt->base.bo); + ptx->data = 0; + } + } +} + +static void nvfx_transfer_inline_write( struct pipe_context *pipe, + struct pipe_resource *pr, + struct pipe_subresource sr, + unsigned usage, + const struct pipe_box *box, + const void *data, + unsigned stride, + unsigned slice_stride) +{ + if(pr->target != PIPE_BUFFER) + { + u_default_transfer_inline_write(pipe, pr, sr, usage, box, data, stride, slice_stride); + } + else + { + struct nvfx_buffer* buffer = nvfx_buffer(pr); + unsigned begin = util_format_get_stride(pr->format, box->x); + unsigned size = util_format_get_stride(pr->format, box->width); + memcpy(buffer->data + begin, data, size); + nvfx_buffer_dirty_interval(buffer, begin, size, + !!(pr->flags & PIPE_TRANSFER_UNSYNCHRONIZED)); + } +} - if(!--tx->map_count) - nouveau_screen_bo_unmap(pipe->screen, mt->base.bo); +void +nvfx_init_transfer_functions(struct pipe_context *pipe) +{ + pipe->get_transfer = nvfx_transfer_new; + pipe->transfer_map = nvfx_transfer_map; + pipe->transfer_flush_region = nvfx_transfer_flush_region; + pipe->transfer_unmap = nvfx_transfer_unmap; + pipe->transfer_destroy = nvfx_transfer_destroy; + pipe->transfer_inline_write = nvfx_transfer_inline_write; } diff --git a/src/gallium/drivers/nvfx/nvfx_vbo.c b/src/gallium/drivers/nvfx/nvfx_vbo.c index 4aa3793842..a6cd125635 100644 --- a/src/gallium/drivers/nvfx/nvfx_vbo.c +++ b/src/gallium/drivers/nvfx/nvfx_vbo.c @@ -2,6 +2,7 @@ #include "pipe/p_state.h" #include "util/u_inlines.h" #include "util/u_format.h" +#include "translate/translate.h" #include "nvfx_context.h" #include "nvfx_state.h" @@ -10,646 +11,583 @@ #include "nouveau/nouveau_channel.h" #include "nouveau/nouveau_class.h" #include "nouveau/nouveau_pushbuf.h" -#include "nouveau/nouveau_util.h" -static INLINE int -nvfx_vbo_format_to_hw(enum pipe_format pipe, unsigned *fmt, unsigned *ncomp) +static inline unsigned +util_guess_unique_indices_count(unsigned mode, unsigned indices) { - switch (pipe) { - case PIPE_FORMAT_R32_FLOAT: - case PIPE_FORMAT_R32G32_FLOAT: - case PIPE_FORMAT_R32G32B32_FLOAT: - case PIPE_FORMAT_R32G32B32A32_FLOAT: - *fmt = NV34TCL_VTXFMT_TYPE_FLOAT; - break; - case PIPE_FORMAT_R16_FLOAT: - case PIPE_FORMAT_R16G16_FLOAT: - case PIPE_FORMAT_R16G16B16_FLOAT: - case PIPE_FORMAT_R16G16B16A16_FLOAT: - *fmt = NV34TCL_VTXFMT_TYPE_HALF; - break; - case PIPE_FORMAT_R8_UNORM: - case PIPE_FORMAT_R8G8_UNORM: - case PIPE_FORMAT_R8G8B8_UNORM: - case PIPE_FORMAT_R8G8B8A8_UNORM: - *fmt = NV34TCL_VTXFMT_TYPE_UBYTE; - break; - case PIPE_FORMAT_R16_SSCALED: - case PIPE_FORMAT_R16G16_SSCALED: - case PIPE_FORMAT_R16G16B16_SSCALED: - case PIPE_FORMAT_R16G16B16A16_SSCALED: - *fmt = NV34TCL_VTXFMT_TYPE_USHORT; - break; - default: - NOUVEAU_ERR("Unknown format %s\n", util_format_name(pipe)); - return 1; + /* Euler's formula gives V = + * = E - F + 2 = + * = F * (polygon_edges / 2 - 1) + 2 = + * = F * (polygon_edges - 2) / 2 + 2 = + * = indices * (polygon_edges - 2) / (2 * indices_per_face) + 2 + * = indices * (1 / 2 - 1 / polygon_edges) + 2 + */ + switch(mode) + { + case PIPE_PRIM_LINES: + return indices >> 1; + case PIPE_PRIM_TRIANGLES: + { + // avoid an expensive division by 3 using the multiplicative inverse mod 2^32 + unsigned q; + unsigned inv3 = 2863311531; + indices >>= 1; + q = indices * inv3; + if(unlikely(q >= indices)) + { + q += inv3; + if(q >= indices) + q += inv3; + } + return indices + 2; + //return indices / 6 + 2; } - - switch (pipe) { - case PIPE_FORMAT_R8_UNORM: - case PIPE_FORMAT_R32_FLOAT: - case PIPE_FORMAT_R16_FLOAT: - case PIPE_FORMAT_R16_SSCALED: - *ncomp = 1; - break; - case PIPE_FORMAT_R8G8_UNORM: - case PIPE_FORMAT_R32G32_FLOAT: - case PIPE_FORMAT_R16G16_FLOAT: - case PIPE_FORMAT_R16G16_SSCALED: - *ncomp = 2; - break; - case PIPE_FORMAT_R8G8B8_UNORM: - case PIPE_FORMAT_R32G32B32_FLOAT: - case PIPE_FORMAT_R16G16B16_FLOAT: - case PIPE_FORMAT_R16G16B16_SSCALED: - *ncomp = 3; - break; - case PIPE_FORMAT_R8G8B8A8_UNORM: - case PIPE_FORMAT_R32G32B32A32_FLOAT: - case PIPE_FORMAT_R16G16B16A16_FLOAT: - case PIPE_FORMAT_R16G16B16A16_SSCALED: - *ncomp = 4; - break; + // guess that indexed quads are created by successive connections, since a closed mesh seems unlikely + case PIPE_PRIM_QUADS: + return (indices >> 1) + 2; + // return (indices >> 2) + 2; // if it is a closed mesh default: - NOUVEAU_ERR("Unknown format %s\n", util_format_name(pipe)); - return 1; + return indices; } - - return 0; } -static boolean -nvfx_vbo_set_idxbuf(struct nvfx_context *nvfx, struct pipe_resource *ib, - unsigned ib_size) +static unsigned nvfx_decide_upload_mode(struct pipe_context *pipe, const struct pipe_draw_info *info) { - unsigned type; - - if (!ib) { - nvfx->idxbuf_buffer = NULL; - nvfx->idxbuf_format = 0xdeadbeef; - return FALSE; + struct nvfx_context* nvfx = nvfx_context(pipe); + unsigned hardware_cost = 0; + unsigned inline_cost = 0; + unsigned unique_vertices; + unsigned upload_mode; + if (info->indexed) + unique_vertices = util_guess_unique_indices_count(info->mode, info->count); + else + unique_vertices = info->count; + + /* Here we try to figure out if we are better off writing vertex data directly on the FIFO, + * or create hardware buffer objects and pointing the hardware to them. + * + * This is done by computing the total memcpy cost of each option, ignoring uploads + * if we think that the buffer is static and thus the upload cost will be amortized over + * future draw calls. + * + * For instance, if everything looks static, we will always create buffer objects, while if + * everything is a user buffer and we are not doing indexed drawing, we never do. + * + * Other interesting cases are where a small user vertex buffer, but a huge user index buffer, + * where we will upload the vertex buffer, so that we can use hardware index lookup, and + * the opposite case, where we instead do index lookup in software to avoid uploading + * a huge amount of vertex data that is not going to be used. + * + * Otherwise, we generally move to the GPU the after it has been pushed + * NVFX_STATIC_BUFFER_MIN_REUSE_TIMES times to the GPU without having + * been updated with a transfer (or just the buffer having been destroyed). + * + * There is no special handling for user buffers, since applications can use + * OpenGL VBOs in a one-shot fashion. OpenGL 3/4 core profile forces this + * by the way. + * + * Note that currently we don't support only putting some data on the FIFO, and + * some on vertex buffers (constant and instanced data is independent from this). + * + * nVidia doesn't seem to do this either, even though it should be at least + * doable with VTX_ATTR and possibly with VERTEX_DATA too if not indexed. + */ + + for (unsigned i = 0; i < nvfx->vtxelt->num_per_vertex_buffer_infos; i++) + { + struct nvfx_per_vertex_buffer_info* vbi = &nvfx->vtxelt->per_vertex_buffer_info[i]; + struct pipe_vertex_buffer *vb = &nvfx->vtxbuf[vbi->vertex_buffer_index]; + struct nvfx_buffer* buffer = nvfx_buffer(vb->buffer); + buffer->bytes_to_draw_until_static -= vbi->per_vertex_size * unique_vertices; + if (!nvfx_buffer_seems_static(buffer)) + { + hardware_cost += buffer->dirty_end - buffer->dirty_begin; + if (!buffer->base.bo) + hardware_cost += nvfx->screen->buffer_allocation_cost; + } + inline_cost += vbi->per_vertex_size * info->count; } - if (!nvfx->screen->index_buffer_reloc_flags || ib_size == 1) - return FALSE; + float best_index_cost_for_hardware_vertices_as_inline_cost = 0.0f; + boolean prefer_hardware_indices = FALSE; + unsigned index_inline_cost = 0; + unsigned index_hardware_cost = 0; - switch (ib_size) { - case 2: - type = NV34TCL_IDXBUF_FORMAT_TYPE_U16; - break; - case 4: - type = NV34TCL_IDXBUF_FORMAT_TYPE_U32; - break; - default: - return FALSE; - } + if (info->indexed) + { + index_inline_cost = nvfx->idxbuf.index_size * info->count; + if (nvfx->screen->index_buffer_reloc_flags + && (nvfx->idxbuf.index_size == 2 || nvfx->idxbuf.index_size == 4) + && !(nvfx->idxbuf.offset & (nvfx->idxbuf.index_size - 1))) + { + struct nvfx_buffer* buffer = nvfx_buffer(nvfx->idxbuf.buffer); + buffer->bytes_to_draw_until_static -= index_inline_cost; - if (ib != nvfx->idxbuf_buffer || - type != nvfx->idxbuf_format) { - nvfx->dirty |= NVFX_NEW_ARRAYS; - nvfx->idxbuf_buffer = ib; - nvfx->idxbuf_format = type; - } + prefer_hardware_indices = TRUE; - return TRUE; -} + if (!nvfx_buffer_seems_static(buffer)) + { + index_hardware_cost = buffer->dirty_end - buffer->dirty_begin; + if (!buffer->base.bo) + index_hardware_cost += nvfx->screen->buffer_allocation_cost; + } -// type must be floating point -static inline void -nvfx_vbo_static_attrib(struct nvfx_context *nvfx, - int attrib, struct pipe_vertex_element *ve, - struct pipe_vertex_buffer *vb, unsigned ncomp) -{ - struct pipe_transfer *transfer; - struct nouveau_channel* chan = nvfx->screen->base.channel; - void *map; - float *v; - - map = pipe_buffer_map(&nvfx->pipe, vb->buffer, PIPE_TRANSFER_READ, &transfer); - map = (uint8_t *) map + vb->buffer_offset + ve->src_offset; - - v = map; - - switch (ncomp) { - case 4: - OUT_RING(chan, RING_3D(NV34TCL_VTX_ATTR_4F_X(attrib), 4)); - OUT_RING(chan, fui(v[0])); - OUT_RING(chan, fui(v[1])); - OUT_RING(chan, fui(v[2])); - OUT_RING(chan, fui(v[3])); - break; - case 3: - OUT_RING(chan, RING_3D(NV34TCL_VTX_ATTR_3F_X(attrib), 3)); - OUT_RING(chan, fui(v[0])); - OUT_RING(chan, fui(v[1])); - OUT_RING(chan, fui(v[2])); - break; - case 2: - OUT_RING(chan, RING_3D(NV34TCL_VTX_ATTR_2F_X(attrib), 2)); - OUT_RING(chan, fui(v[0])); - OUT_RING(chan, fui(v[1])); - break; - case 1: - OUT_RING(chan, RING_3D(NV34TCL_VTX_ATTR_1F(attrib), 1)); - OUT_RING(chan, fui(v[0])); - break; + if ((float) index_inline_cost < (float) index_hardware_cost * nvfx->screen->inline_cost_per_hardware_cost) + { + best_index_cost_for_hardware_vertices_as_inline_cost = (float) index_inline_cost; + } + else + { + best_index_cost_for_hardware_vertices_as_inline_cost = (float) index_hardware_cost * nvfx->screen->inline_cost_per_hardware_cost; + prefer_hardware_indices = TRUE; + } + } } - pipe_buffer_unmap(&nvfx->pipe, vb->buffer, transfer); + /* let's finally figure out which of the 3 paths we want to take */ + if ((float) (inline_cost + index_inline_cost) > ((float) hardware_cost * nvfx->screen->inline_cost_per_hardware_cost + best_index_cost_for_hardware_vertices_as_inline_cost)) + upload_mode = 1 + prefer_hardware_indices; + else + upload_mode = 0; + +#ifdef DEBUG + if (unlikely(nvfx->screen->trace_draw)) + { + fprintf(stderr, "DRAW"); + if (info->indexed) + { + fprintf(stderr, "_IDX%u", nvfx->idxbuf.index_size); + if (info->index_bias) + fprintf(stderr, " biased %u", info->index_bias); + fprintf(stderr, " idxrange %u -> %u", info->min_index, info->max_index); + } + if (info->instance_count > 1) + fprintf(stderr, " %u instances from %u", info->instance_count, info->indexed); + fprintf(stderr, " start %u count %u prim %u", info->start, info->count, info->mode); + if (!upload_mode) + fprintf(stderr, " -> inline vertex data"); + else if (upload_mode == 2 || !info->indexed) + fprintf(stderr, " -> buffer range"); + else + fprintf(stderr, " -> inline indices"); + fprintf(stderr, " [ivtx %u hvtx %u iidx %u hidx %u bidx %f] <", inline_cost, hardware_cost, index_inline_cost, index_hardware_cost, best_index_cost_for_hardware_vertices_as_inline_cost); + for (unsigned i = 0; i < nvfx->vtxelt->num_per_vertex_buffer_infos; ++i) + { + struct nvfx_per_vertex_buffer_info* vbi = &nvfx->vtxelt->per_vertex_buffer_info[i]; + struct pipe_vertex_buffer *vb = &nvfx->vtxbuf[vbi->vertex_buffer_index]; + struct nvfx_buffer* buffer = nvfx_buffer(vb->buffer); + if (i) + fprintf(stderr, ", "); + fprintf(stderr, "%p%s left %Li", buffer, buffer->last_update_static ? " static" : "", buffer->bytes_to_draw_until_static); + } + fprintf(stderr, ">\n"); + } +#endif + + return upload_mode; } -static void -nvfx_draw_arrays(struct pipe_context *pipe, - unsigned mode, unsigned start, unsigned count) +void nvfx_draw_vbo(struct pipe_context *pipe, const struct pipe_draw_info *info) { struct nvfx_context *nvfx = nvfx_context(pipe); - struct nvfx_screen *screen = nvfx->screen; - struct nouveau_channel *chan = screen->base.channel; - unsigned restart = 0; - - nvfx_vbo_set_idxbuf(nvfx, NULL, 0); - if (nvfx->screen->force_swtnl || !nvfx_state_validate(nvfx)) { - nvfx_draw_elements_swtnl(pipe, NULL, 0, 0, - mode, start, count); - return; - } + unsigned upload_mode = 0; - while (count) { - unsigned vc, nr, avail; + if (!nvfx->vtxelt->needs_translate) + upload_mode = nvfx_decide_upload_mode(pipe, info); - nvfx_state_emit(nvfx); + nvfx->use_index_buffer = upload_mode > 1; - avail = AVAIL_RING(chan); - avail -= 16 + (avail >> 10); /* for the BEGIN_RING_NIs, conservatively assuming one every 1024, plus 16 for safety */ + if ((upload_mode > 0) != nvfx->use_vertex_buffers) + { + nvfx->use_vertex_buffers = (upload_mode > 0); + nvfx->dirty |= NVFX_NEW_ARRAYS; + nvfx->draw_dirty |= NVFX_NEW_ARRAYS; + } - vc = nouveau_vbuf_split(avail, 6, 256, - mode, start, count, &restart); - if (!vc) { - FIRE_RING(chan); - continue; + if (upload_mode > 0) + { + for (unsigned i = 0; i < nvfx->vtxelt->num_per_vertex_buffer_infos; i++) + { + struct nvfx_per_vertex_buffer_info* vbi = &nvfx->vtxelt->per_vertex_buffer_info[i]; + struct pipe_vertex_buffer *vb = &nvfx->vtxbuf[vbi->vertex_buffer_index]; + nvfx_buffer_upload(nvfx_buffer(vb->buffer)); } - OUT_RING(chan, RING_3D(NV34TCL_VERTEX_BEGIN_END, 1)); - OUT_RING (chan, nvgl_primitive(mode)); + if (upload_mode > 1) + { + nvfx_buffer_upload(nvfx_buffer(nvfx->idxbuf.buffer)); - nr = (vc & 0xff); - if (nr) { - OUT_RING(chan, RING_3D(NV34TCL_VB_VERTEX_BATCH, 1)); - OUT_RING (chan, ((nr - 1) << 24) | start); - start += nr; + if (unlikely(info->index_bias != nvfx->base_vertex)) + { + nvfx->base_vertex = info->index_bias; + nvfx->dirty |= NVFX_NEW_ARRAYS; + } } - - nr = vc >> 8; - while (nr) { - unsigned push = nr > 2047 ? 2047 : nr; - - nr -= push; - - OUT_RING(chan, RING_3D_NI(NV34TCL_VB_VERTEX_BATCH, push)); - while (push--) { - OUT_RING(chan, ((0x100 - 1) << 24) | start); - start += 0x100; + else + { + if (unlikely(info->start < nvfx->base_vertex && nvfx->base_vertex)) + { + nvfx->base_vertex = 0; + nvfx->dirty |= NVFX_NEW_ARRAYS; } } - - OUT_RING(chan, RING_3D(NV34TCL_VERTEX_BEGIN_END, 1)); - OUT_RING (chan, 0); - - count -= vc; - start = restart; } - pipe->flush(pipe, 0, NULL); + if (nvfx->screen->force_swtnl || !nvfx_state_validate(nvfx)) + nvfx_draw_vbo_swtnl(pipe, info); + else + nvfx_push_vbo(pipe, info); } -static INLINE void -nvfx_draw_elements_u08(struct nvfx_context *nvfx, void *ib, - unsigned mode, unsigned start, unsigned count) +boolean +nvfx_vbo_validate(struct nvfx_context *nvfx) { - struct nvfx_screen *screen = nvfx->screen; - struct nouveau_channel *chan = screen->base.channel; + struct nouveau_channel* chan = nvfx->screen->base.channel; + int i; + int elements = MAX2(nvfx->vtxelt->num_elements, nvfx->hw_vtxelt_nr); + unsigned vb_flags = nvfx->screen->vertex_buffer_reloc_flags | NOUVEAU_BO_RD; - while (count) { - uint8_t *elts = (uint8_t *)ib + start; - unsigned vc, push, restart = 0, avail; + if (!elements) + return TRUE; - nvfx_state_emit(nvfx); + MARK_RING(chan, (5 + 2) * 16 + 2 + 11, 16 + 2); + for(unsigned i = 0; i < nvfx->vtxelt->num_constant; ++i) + { + struct nvfx_low_frequency_element *ve = &nvfx->vtxelt->constant[i]; + struct pipe_vertex_buffer *vb = &nvfx->vtxbuf[ve->vertex_buffer_index]; + struct nvfx_buffer* buffer = nvfx_buffer(vb->buffer); + float v[4]; + ve->fetch_rgba_float(v, buffer->data + vb->buffer_offset + ve->src_offset, 0, 0); + nvfx_emit_vtx_attr(chan, ve->idx, v, ve->ncomp); + } - avail = AVAIL_RING(chan); - avail -= 16 + (avail >> 10); /* for the BEGIN_RING_NIs, conservatively assuming one every 1024, plus 16 for safety */ - vc = nouveau_vbuf_split(avail, 6, 2, - mode, start, count, &restart); - if (vc == 0) { - FIRE_RING(chan); - continue; - } - count -= vc; + OUT_RING(chan, RING_3D(NV34TCL_VTXFMT(0), elements)); + if(nvfx->use_vertex_buffers) + { + unsigned idx = 0; + for (i = 0; i < nvfx->vtxelt->num_per_vertex; i++) { + struct nvfx_per_vertex_element *ve = &nvfx->vtxelt->per_vertex[i]; + struct pipe_vertex_buffer *vb = &nvfx->vtxbuf[ve->vertex_buffer_index]; - OUT_RING(chan, RING_3D(NV34TCL_VERTEX_BEGIN_END, 1)); - OUT_RING (chan, nvgl_primitive(mode)); + if(idx != ve->idx) + { + assert(idx < ve->idx); + OUT_RINGp(chan, &nvfx->vtxelt->vtxfmt[idx], ve->idx - idx); + idx = ve->idx; + } - if (vc & 1) { - OUT_RING(chan, RING_3D(NV34TCL_VB_ELEMENT_U32, 1)); - OUT_RING (chan, elts[0]); - elts++; vc--; + OUT_RING(chan, nvfx->vtxelt->vtxfmt[idx] | (vb->stride << NV34TCL_VTXFMT_STRIDE_SHIFT)); + ++idx; } + if(idx != nvfx->vtxelt->num_elements) + OUT_RINGp(chan, &nvfx->vtxelt->vtxfmt[idx], nvfx->vtxelt->num_elements - idx); + } + else + OUT_RINGp(chan, nvfx->vtxelt->vtxfmt, nvfx->vtxelt->num_elements); - while (vc) { - unsigned i; - - push = MIN2(vc, 2047 * 2); - - OUT_RING(chan, RING_3D_NI(NV34TCL_VB_ELEMENT_U16, push >> 1)); - for (i = 0; i < push; i+=2) - OUT_RING(chan, (elts[i+1] << 16) | elts[i]); + for(i = nvfx->vtxelt->num_elements; i < elements; ++i) + OUT_RING(chan, NV34TCL_VTXFMT_TYPE_32_FLOAT); - vc -= push; - elts += push; + if(nvfx->is_nv4x) { + unsigned i; + /* seems to be some kind of cache flushing */ + for(i = 0; i < 3; ++i) { + OUT_RING(chan, RING_3D(0x1718, 1)); + OUT_RING(chan, 0); } - - OUT_RING(chan, RING_3D(NV34TCL_VERTEX_BEGIN_END, 1)); - OUT_RING (chan, 0); - - start = restart; } -} - -static INLINE void -nvfx_draw_elements_u16(struct nvfx_context *nvfx, void *ib, - unsigned mode, unsigned start, unsigned count) -{ - struct nvfx_screen *screen = nvfx->screen; - struct nouveau_channel *chan = screen->base.channel; - - while (count) { - uint16_t *elts = (uint16_t *)ib + start; - unsigned vc, push, restart = 0, avail; - nvfx_state_emit(nvfx); - - avail = AVAIL_RING(chan); - avail -= 16 + (avail >> 10); /* for the BEGIN_RING_NIs, conservatively assuming one every 1024, plus 16 for safety */ - - vc = nouveau_vbuf_split(avail, 6, 2, - mode, start, count, &restart); - if (vc == 0) { - FIRE_RING(chan); - continue; - } - count -= vc; + OUT_RING(chan, RING_3D(NV34TCL_VTXBUF_ADDRESS(0), elements)); + if(nvfx->use_vertex_buffers) + { + unsigned idx = 0; + for (i = 0; i < nvfx->vtxelt->num_per_vertex; i++) { + struct nvfx_per_vertex_element *ve = &nvfx->vtxelt->per_vertex[i]; + struct pipe_vertex_buffer *vb = &nvfx->vtxbuf[ve->vertex_buffer_index]; + struct nouveau_bo* bo = nvfx_resource(vb->buffer)->bo; - OUT_RING(chan, RING_3D(NV34TCL_VERTEX_BEGIN_END, 1)); - OUT_RING (chan, nvgl_primitive(mode)); + for(; idx < ve->idx; ++idx) + OUT_RING(chan, 0); - if (vc & 1) { - OUT_RING(chan, RING_3D(NV34TCL_VB_ELEMENT_U32, 1)); - OUT_RING (chan, elts[0]); - elts++; vc--; + OUT_RELOC(chan, bo, + vb->buffer_offset + ve->src_offset + nvfx->base_vertex * vb->stride, + vb_flags | NOUVEAU_BO_LOW | NOUVEAU_BO_OR, + 0, NV34TCL_VTXBUF_ADDRESS_DMA1); + ++idx; } - while (vc) { - unsigned i; - - push = MIN2(vc, 2047 * 2); - - OUT_RING(chan, RING_3D_NI(NV34TCL_VB_ELEMENT_U16, push >> 1)); - for (i = 0; i < push; i+=2) - OUT_RING(chan, (elts[i+1] << 16) | elts[i]); - - vc -= push; - elts += push; - } + for(; idx < elements; ++idx) + OUT_RING(chan, 0); + } + else + { + for (i = 0; i < elements; i++) + OUT_RING(chan, 0); + } - OUT_RING(chan, RING_3D(NV34TCL_VERTEX_BEGIN_END, 1)); - OUT_RING (chan, 0); + OUT_RING(chan, RING_3D(0x1710, 1)); + OUT_RING(chan, 0); - start = restart; - } + nvfx->hw_vtxelt_nr = nvfx->vtxelt->num_elements; + return TRUE; } -static INLINE void -nvfx_draw_elements_u32(struct nvfx_context *nvfx, void *ib, - unsigned mode, unsigned start, unsigned count) +void +nvfx_vbo_relocate(struct nvfx_context *nvfx) { - struct nvfx_screen *screen = nvfx->screen; - struct nouveau_channel *chan = screen->base.channel; - - while (count) { - uint32_t *elts = (uint32_t *)ib + start; - unsigned vc, push, restart = 0, avail; - - nvfx_state_emit(nvfx); - - avail = AVAIL_RING(chan); - avail -= 16 + (avail >> 10); /* for the BEGIN_RING_NIs, conservatively assuming one every 1024, plus 16 for safety */ - - vc = nouveau_vbuf_split(avail, 5, 1, - mode, start, count, &restart); - if (vc == 0) { - FIRE_RING(chan); - continue; - } - count -= vc; - - OUT_RING(chan, RING_3D(NV34TCL_VERTEX_BEGIN_END, 1)); - OUT_RING (chan, nvgl_primitive(mode)); - - while (vc) { - push = MIN2(vc, 2047); - - OUT_RING(chan, RING_3D_NI(NV34TCL_VB_ELEMENT_U32, push)); - OUT_RINGp (chan, elts, push); - - vc -= push; - elts += push; - } + if(!nvfx->use_vertex_buffers) + return; - OUT_RING(chan, RING_3D(NV34TCL_VERTEX_BEGIN_END, 1)); - OUT_RING (chan, 0); + struct nouveau_channel* chan = nvfx->screen->base.channel; + unsigned vb_flags = nvfx->screen->vertex_buffer_reloc_flags | NOUVEAU_BO_RD | NOUVEAU_BO_DUMMY; + int i; - start = restart; + MARK_RING(chan, 2 * 16 + 3, 2 * 16 + 3); + for (i = 0; i < nvfx->vtxelt->num_per_vertex; i++) { + struct nvfx_per_vertex_element *ve = &nvfx->vtxelt->per_vertex[i]; + struct pipe_vertex_buffer *vb = &nvfx->vtxbuf[ve->vertex_buffer_index]; + struct nouveau_bo* bo = nvfx_resource(vb->buffer)->bo; + + OUT_RELOC(chan, bo, RING_3D(NV34TCL_VTXBUF_ADDRESS(ve->idx), 1), + vb_flags, 0, 0); + OUT_RELOC(chan, bo, vb->buffer_offset + ve->src_offset + nvfx->base_vertex * vb->stride, + vb_flags | NOUVEAU_BO_LOW | NOUVEAU_BO_OR, + 0, NV34TCL_VTXBUF_ADDRESS_DMA1); } } static void -nvfx_draw_elements_inline(struct pipe_context *pipe, - struct pipe_resource *ib, - unsigned ib_size, int ib_bias, - unsigned mode, unsigned start, unsigned count) +nvfx_idxbuf_emit(struct nvfx_context* nvfx, unsigned ib_flags) { - struct nvfx_context *nvfx = nvfx_context(pipe); - struct pipe_transfer *transfer; - void *map; - - map = pipe_buffer_map(pipe, ib, PIPE_TRANSFER_READ, &transfer); - if (!ib) { - NOUVEAU_ERR("failed mapping ib\n"); - return; - } + struct nouveau_channel* chan = nvfx->screen->base.channel; + unsigned ib_format = (nvfx->idxbuf.index_size == 2) ? NV34TCL_IDXBUF_FORMAT_TYPE_U16 : NV34TCL_IDXBUF_FORMAT_TYPE_U32; + struct nouveau_bo* bo = nvfx_resource(nvfx->idxbuf.buffer)->bo; + ib_flags |= nvfx->screen->index_buffer_reloc_flags | NOUVEAU_BO_RD; - assert(ib_bias == 0); - - switch (ib_size) { - case 1: - nvfx_draw_elements_u08(nvfx, map, mode, start, count); - break; - case 2: - nvfx_draw_elements_u16(nvfx, map, mode, start, count); - break; - case 4: - nvfx_draw_elements_u32(nvfx, map, mode, start, count); - break; - default: - NOUVEAU_ERR("invalid idxbuf fmt %d\n", ib_size); - break; - } + assert(nvfx->screen->index_buffer_reloc_flags); - pipe_buffer_unmap(pipe, ib, transfer); + MARK_RING(chan, 3, 3); + if(ib_flags & NOUVEAU_BO_DUMMY) + OUT_RELOC(chan, bo, RING_3D(NV34TCL_IDXBUF_ADDRESS, 2), ib_flags, 0, 0); + else + OUT_RING(chan, RING_3D(NV34TCL_IDXBUF_ADDRESS, 2)); + OUT_RELOC(chan, bo, nvfx->idxbuf.offset + 1, ib_flags | NOUVEAU_BO_LOW, 0, 0); + OUT_RELOC(chan, bo, ib_format, ib_flags | NOUVEAU_BO_OR, + 0, NV34TCL_IDXBUF_FORMAT_DMA1); } -static void -nvfx_draw_elements_vbo(struct pipe_context *pipe, - unsigned mode, unsigned start, unsigned count) +void +nvfx_idxbuf_validate(struct nvfx_context* nvfx) { - struct nvfx_context *nvfx = nvfx_context(pipe); - struct nvfx_screen *screen = nvfx->screen; - struct nouveau_channel *chan = screen->base.channel; - unsigned restart = 0; - - while (count) { - unsigned nr, vc, avail; - - nvfx_state_emit(nvfx); + nvfx_idxbuf_emit(nvfx, 0); +} - avail = AVAIL_RING(chan); - avail -= 16 + (avail >> 10); /* for the BEGIN_RING_NIs, conservatively assuming one every 1024, plus 16 for safety */ +void +nvfx_idxbuf_relocate(struct nvfx_context* nvfx) +{ + nvfx_idxbuf_emit(nvfx, NOUVEAU_BO_DUMMY); +} - vc = nouveau_vbuf_split(avail, 6, 256, - mode, start, count, &restart); - if (!vc) { - FIRE_RING(chan); - continue; - } +unsigned nvfx_vertex_formats[PIPE_FORMAT_COUNT] = +{ + [PIPE_FORMAT_R32_FLOAT] = NV34TCL_VTXFMT_TYPE_32_FLOAT, + [PIPE_FORMAT_R32G32_FLOAT] = NV34TCL_VTXFMT_TYPE_32_FLOAT, + [PIPE_FORMAT_R32G32B32A32_FLOAT] = NV34TCL_VTXFMT_TYPE_32_FLOAT, + [PIPE_FORMAT_R32G32B32_FLOAT] = NV34TCL_VTXFMT_TYPE_32_FLOAT, + [PIPE_FORMAT_R16_FLOAT] = NV34TCL_VTXFMT_TYPE_16_FLOAT, + [PIPE_FORMAT_R16G16_FLOAT] = NV34TCL_VTXFMT_TYPE_16_FLOAT, + [PIPE_FORMAT_R16G16B16_FLOAT] = NV34TCL_VTXFMT_TYPE_16_FLOAT, + [PIPE_FORMAT_R16G16B16A16_FLOAT] = NV34TCL_VTXFMT_TYPE_16_FLOAT, + [PIPE_FORMAT_R8_UNORM] = NV34TCL_VTXFMT_TYPE_8_UNORM, + [PIPE_FORMAT_R8G8_UNORM] = NV34TCL_VTXFMT_TYPE_8_UNORM, + [PIPE_FORMAT_R8G8B8_UNORM] = NV34TCL_VTXFMT_TYPE_8_UNORM, + [PIPE_FORMAT_R8G8B8A8_UNORM] = NV34TCL_VTXFMT_TYPE_8_UNORM, + [PIPE_FORMAT_R8G8B8A8_USCALED] = NV34TCL_VTXFMT_TYPE_8_USCALED, + [PIPE_FORMAT_R16_SNORM] = NV34TCL_VTXFMT_TYPE_16_SNORM, + [PIPE_FORMAT_R16G16_SNORM] = NV34TCL_VTXFMT_TYPE_16_SNORM, + [PIPE_FORMAT_R16G16B16_SNORM] = NV34TCL_VTXFMT_TYPE_16_SNORM, + [PIPE_FORMAT_R16G16B16A16_SNORM] = NV34TCL_VTXFMT_TYPE_16_SNORM, + [PIPE_FORMAT_R16_SSCALED] = NV34TCL_VTXFMT_TYPE_16_SSCALED, + [PIPE_FORMAT_R16G16_SSCALED] = NV34TCL_VTXFMT_TYPE_16_SSCALED, + [PIPE_FORMAT_R16G16B16_SSCALED] = NV34TCL_VTXFMT_TYPE_16_SSCALED, + [PIPE_FORMAT_R16G16B16A16_SSCALED] = NV34TCL_VTXFMT_TYPE_16_SSCALED, +}; + +static void * +nvfx_vtxelts_state_create(struct pipe_context *pipe, + unsigned num_elements, + const struct pipe_vertex_element *elements) +{ + struct nvfx_context* nvfx = nvfx_context(pipe); + struct nvfx_vtxelt_state *cso = CALLOC_STRUCT(nvfx_vtxelt_state); + struct translate_key transkey; + unsigned per_vertex_size[16]; + memset(per_vertex_size, 0, sizeof(per_vertex_size)); + + unsigned vb_compacted_index[16]; + + assert(num_elements < 16); /* not doing fallbacks yet */ + + memcpy(cso->pipe, elements, num_elements * sizeof(elements[0])); + cso->num_elements = num_elements; + cso->needs_translate = FALSE; + + transkey.nr_elements = 0; + transkey.output_stride = 0; + + for(unsigned i = 0; i < num_elements; ++i) + { + const struct pipe_vertex_element* ve = &elements[i]; + if(!ve->instance_divisor) + per_vertex_size[ve->vertex_buffer_index] += util_format_get_stride(ve->src_format, 1); + } + + for(unsigned i = 0; i < 16; ++i) + { + if(per_vertex_size[i]) + { + unsigned idx = cso->num_per_vertex_buffer_infos++; + cso->per_vertex_buffer_info[idx].vertex_buffer_index = i; + cso->per_vertex_buffer_info[idx].per_vertex_size = per_vertex_size[i]; + vb_compacted_index[i] = idx; + } + } + + for(unsigned i = 0; i < num_elements; ++i) + { + const struct pipe_vertex_element* ve = &elements[i]; + unsigned type = nvfx_vertex_formats[ve->src_format]; + unsigned ncomp = util_format_get_nr_components(ve->src_format); - OUT_RING(chan, RING_3D(NV34TCL_VERTEX_BEGIN_END, 1)); - OUT_RING (chan, nvgl_primitive(mode)); + //if(ve->frequency != PIPE_ELEMENT_FREQUENCY_PER_VERTEX) + if(ve->instance_divisor) + { + struct nvfx_low_frequency_element* lfve; + cso->vtxfmt[i] = NV34TCL_VTXFMT_TYPE_32_FLOAT; + + //if(ve->frequency == PIPE_ELEMENT_FREQUENCY_CONSTANT) + if(0) + lfve = &cso->constant[cso->num_constant++]; + else + { + lfve = &cso->per_instance[cso->num_per_instance++].base; + ((struct nvfx_per_instance_element*)lfve)->instance_divisor = ve->instance_divisor; + } - nr = (vc & 0xff); - if (nr) { - OUT_RING(chan, RING_3D(NV34TCL_VB_INDEX_BATCH, 1)); - OUT_RING (chan, ((nr - 1) << 24) | start); - start += nr; + lfve->idx = i; + lfve->vertex_buffer_index = ve->vertex_buffer_index; + lfve->src_offset = ve->src_offset; + lfve->fetch_rgba_float = util_format_description(ve->src_format)->fetch_rgba_float; + lfve->ncomp = ncomp; } - - nr = vc >> 8; - while (nr) { - unsigned push = nr > 2047 ? 2047 : nr; - - nr -= push; - - OUT_RING(chan, RING_3D_NI(NV34TCL_VB_INDEX_BATCH, push)); - while (push--) { - OUT_RING(chan, ((0x100 - 1) << 24) | start); - start += 0x100; + else + { + unsigned idx; + + idx = cso->num_per_vertex++; + cso->per_vertex[idx].idx = i; + cso->per_vertex[idx].vertex_buffer_index = ve->vertex_buffer_index; + cso->per_vertex[idx].src_offset = ve->src_offset; + + idx = transkey.nr_elements++; + transkey.element[idx].input_format = ve->src_format; + transkey.element[idx].input_buffer = vb_compacted_index[ve->vertex_buffer_index]; + transkey.element[idx].input_offset = ve->src_offset; + transkey.element[idx].instance_divisor = 0; + transkey.element[idx].type = TRANSLATE_ELEMENT_NORMAL; + if(type) + { + transkey.element[idx].output_format = ve->src_format; + cso->vtxfmt[i] = (ncomp << NV34TCL_VTXFMT_SIZE_SHIFT) | type; + } + else + { + unsigned float32[4] = {PIPE_FORMAT_R32_FLOAT, PIPE_FORMAT_R32G32_FLOAT, PIPE_FORMAT_R32G32B32_FLOAT, PIPE_FORMAT_R32G32B32A32_FLOAT}; + transkey.element[idx].output_format = float32[ncomp - 1]; + cso->needs_translate = TRUE; + cso->vtxfmt[i] = (ncomp << NV34TCL_VTXFMT_SIZE_SHIFT) | NV34TCL_VTXFMT_TYPE_32_FLOAT; } + transkey.element[idx].output_offset = transkey.output_stride; + transkey.output_stride += (util_format_get_stride(transkey.element[idx].output_format, 1) + 3) & ~3; } + } - OUT_RING(chan, RING_3D(NV34TCL_VERTEX_BEGIN_END, 1)); - OUT_RING (chan, 0); + cso->translate = translate_generic_create(&transkey); + cso->vertex_length = transkey.output_stride >> 2; + cso->max_vertices_per_packet = 2047 / cso->vertex_length; - count -= vc; - start = restart; - } + return (void *)cso; } static void -nvfx_draw_elements(struct pipe_context *pipe, - struct pipe_resource *indexBuffer, - unsigned indexSize, int indexBias, - unsigned mode, unsigned start, unsigned count) +nvfx_vtxelts_state_delete(struct pipe_context *pipe, void *hwcso) { - struct nvfx_context *nvfx = nvfx_context(pipe); - boolean idxbuf; - - idxbuf = nvfx_vbo_set_idxbuf(nvfx, indexBuffer, indexSize); - if (nvfx->screen->force_swtnl || !nvfx_state_validate(nvfx)) { - nvfx_draw_elements_swtnl(pipe, - indexBuffer, indexSize, indexBias, - mode, start, count); - return; - } - - if (idxbuf) { - nvfx_draw_elements_vbo(pipe, mode, start, count); - } else { - nvfx_draw_elements_inline(pipe, - indexBuffer, indexSize, indexBias, - mode, start, count); - } - - pipe->flush(pipe, 0, NULL); + FREE(hwcso); } -void -nvfx_draw_vbo(struct pipe_context *pipe, const struct pipe_draw_info *info) +static void +nvfx_vtxelts_state_bind(struct pipe_context *pipe, void *hwcso) { struct nvfx_context *nvfx = nvfx_context(pipe); - if (info->indexed && nvfx->idxbuf.buffer) { - unsigned offset; - - assert(nvfx->idxbuf.offset % nvfx->idxbuf.index_size == 0); - offset = nvfx->idxbuf.offset / nvfx->idxbuf.index_size; - - nvfx_draw_elements(pipe, - nvfx->idxbuf.buffer, - nvfx->idxbuf.index_size, - info->index_bias, - info->mode, - info->start + offset, - info->count); - } - else { - nvfx_draw_arrays(pipe, - info->mode, - info->start, - info->count); - } + nvfx->vtxelt = hwcso; + nvfx->use_vertex_buffers = -1; + nvfx->draw_dirty |= NVFX_NEW_ARRAYS; } -boolean -nvfx_vbo_validate(struct nvfx_context *nvfx) +static void +nvfx_set_vertex_buffers(struct pipe_context *pipe, unsigned count, + const struct pipe_vertex_buffer *vb) { - struct nouveau_channel* chan = nvfx->screen->base.channel; - struct pipe_resource *ib = nvfx->idxbuf_buffer; - unsigned ib_format = nvfx->idxbuf_format; - int i; - int elements = MAX2(nvfx->vtxelt->num_elements, nvfx->hw_vtxelt_nr); - uint32_t vtxfmt[16]; - unsigned vb_flags = nvfx->screen->vertex_buffer_reloc_flags | NOUVEAU_BO_RD; - - if (!elements) - return TRUE; - - nvfx->vbo_bo = 0; - - MARK_RING(chan, (5 + 2) * 16 + 2 + 11, 16 + 2); - for (i = 0; i < nvfx->vtxelt->num_elements; i++) { - struct pipe_vertex_element *ve; - struct pipe_vertex_buffer *vb; - unsigned type, ncomp; - - ve = &nvfx->vtxelt->pipe[i]; - vb = &nvfx->vtxbuf[ve->vertex_buffer_index]; - - if (nvfx_vbo_format_to_hw(ve->src_format, &type, &ncomp)) { - MARK_UNDO(chan); - nvfx->fallback_swtnl |= NVFX_NEW_ARRAYS; - return FALSE; - } + struct nvfx_context *nvfx = nvfx_context(pipe); - if (!vb->stride && type == NV34TCL_VTXFMT_TYPE_FLOAT) { - nvfx_vbo_static_attrib(nvfx, i, ve, vb, ncomp); - vtxfmt[i] = type; - } else { - vtxfmt[i] = ((vb->stride << NV34TCL_VTXFMT_STRIDE_SHIFT) | - (ncomp << NV34TCL_VTXFMT_SIZE_SHIFT) | type); - nvfx->vbo_bo |= (1 << i); - } + for(unsigned i = 0; i < count; ++i) + { + pipe_resource_reference(&nvfx->vtxbuf[i].buffer, vb[i].buffer); + nvfx->vtxbuf[i].buffer_offset = vb[i].buffer_offset; + nvfx->vtxbuf[i].max_index = vb[i].max_index; + nvfx->vtxbuf[i].stride = vb[i].stride; } - for(; i < elements; ++i) - vtxfmt[i] = NV34TCL_VTXFMT_TYPE_FLOAT; - - OUT_RING(chan, RING_3D(NV34TCL_VTXFMT(0), elements)); - OUT_RINGp(chan, vtxfmt, elements); - - if(nvfx->is_nv4x) { - unsigned i; - /* seems to be some kind of cache flushing */ - for(i = 0; i < 3; ++i) { - OUT_RING(chan, RING_3D(0x1718, 1)); - OUT_RING(chan, 0); - } - } + for(unsigned i = count; i < nvfx->vtxbuf_nr; ++i) + pipe_resource_reference(&nvfx->vtxbuf[i].buffer, 0); - OUT_RING(chan, RING_3D(NV34TCL_VTXBUF_ADDRESS(0), elements)); - for (i = 0; i < nvfx->vtxelt->num_elements; i++) { - struct pipe_vertex_element *ve; - struct pipe_vertex_buffer *vb; + nvfx->vtxbuf_nr = count; + nvfx->use_vertex_buffers = -1; + nvfx->draw_dirty |= NVFX_NEW_ARRAYS; +} - ve = &nvfx->vtxelt->pipe[i]; - vb = &nvfx->vtxbuf[ve->vertex_buffer_index]; +static void +nvfx_set_index_buffer(struct pipe_context *pipe, + const struct pipe_index_buffer *ib) +{ + struct nvfx_context *nvfx = nvfx_context(pipe); - if (!(nvfx->vbo_bo & (1 << i))) - OUT_RING(chan, 0); - else - { - struct nouveau_bo* bo = nvfx_resource(vb->buffer)->bo; - OUT_RELOC(chan, bo, - vb->buffer_offset + ve->src_offset, - vb_flags | NOUVEAU_BO_LOW | NOUVEAU_BO_OR, - 0, NV34TCL_VTXBUF_ADDRESS_DMA1); - } + if(ib) + { + pipe_resource_reference(&nvfx->idxbuf.buffer, ib->buffer); + nvfx->idxbuf.index_size = ib->index_size; + nvfx->idxbuf.offset = ib->offset; } - - for (; i < elements; i++) - OUT_RING(chan, 0); - - OUT_RING(chan, RING_3D(0x1710, 1)); - OUT_RING(chan, 0); - - if (ib) { - unsigned ib_flags = nvfx->screen->index_buffer_reloc_flags | NOUVEAU_BO_RD; - struct nouveau_bo* bo = nvfx_resource(ib)->bo; - - assert(nvfx->screen->index_buffer_reloc_flags); - - OUT_RING(chan, RING_3D(NV34TCL_IDXBUF_ADDRESS, 2)); - OUT_RELOC(chan, bo, 0, ib_flags | NOUVEAU_BO_LOW, 0, 0); - OUT_RELOC(chan, bo, ib_format, ib_flags | NOUVEAU_BO_OR, - 0, NV34TCL_IDXBUF_FORMAT_DMA1); + else + { + pipe_resource_reference(&nvfx->idxbuf.buffer, 0); + nvfx->idxbuf.index_size = 0; + nvfx->idxbuf.offset = 0; } - nvfx->hw_vtxelt_nr = nvfx->vtxelt->num_elements; - return TRUE; + nvfx->dirty |= NVFX_NEW_INDEX; + nvfx->draw_dirty |= NVFX_NEW_INDEX; } void -nvfx_vbo_relocate(struct nvfx_context *nvfx) +nvfx_init_vbo_functions(struct nvfx_context *nvfx) { - struct nouveau_channel* chan = nvfx->screen->base.channel; - unsigned vb_flags = nvfx->screen->vertex_buffer_reloc_flags | NOUVEAU_BO_RD | NOUVEAU_BO_DUMMY; - int i; + nvfx->pipe.set_vertex_buffers = nvfx_set_vertex_buffers; + nvfx->pipe.set_index_buffer = nvfx_set_index_buffer; - MARK_RING(chan, 2 * 16 + 3, 2 * 16 + 3); - for(i = 0; i < nvfx->vtxelt->num_elements; ++i) { - if(nvfx->vbo_bo & (1 << i)) { - struct pipe_vertex_element *ve = &nvfx->vtxelt->pipe[i]; - struct pipe_vertex_buffer *vb = &nvfx->vtxbuf[ve->vertex_buffer_index]; - struct nouveau_bo* bo = nvfx_resource(vb->buffer)->bo; - OUT_RELOC(chan, bo, RING_3D(NV34TCL_VTXBUF_ADDRESS(i), 1), - vb_flags, 0, 0); - OUT_RELOC(chan, bo, vb->buffer_offset + ve->src_offset, - vb_flags | NOUVEAU_BO_LOW | NOUVEAU_BO_OR, - 0, NV34TCL_VTXBUF_ADDRESS_DMA1); - } - } - - if(nvfx->idxbuf_buffer) - { - unsigned ib_flags = nvfx->screen->index_buffer_reloc_flags | NOUVEAU_BO_RD | NOUVEAU_BO_DUMMY; - struct nouveau_bo* bo = nvfx_resource(nvfx->idxbuf_buffer)->bo; - - assert(nvfx->screen->index_buffer_reloc_flags); - - OUT_RELOC(chan, bo, RING_3D(NV34TCL_IDXBUF_ADDRESS, 2), - ib_flags, 0, 0); - OUT_RELOC(chan, bo, 0, - ib_flags | NOUVEAU_BO_LOW, 0, 0); - OUT_RELOC(chan, bo, nvfx->idxbuf_format, - ib_flags | NOUVEAU_BO_OR, - 0, NV34TCL_IDXBUF_FORMAT_DMA1); - } + nvfx->pipe.create_vertex_elements_state = nvfx_vtxelts_state_create; + nvfx->pipe.delete_vertex_elements_state = nvfx_vtxelts_state_delete; + nvfx->pipe.bind_vertex_elements_state = nvfx_vtxelts_state_bind; } diff --git a/src/gallium/drivers/nvfx/nvfx_vertprog.c b/src/gallium/drivers/nvfx/nvfx_vertprog.c index 24d9846310..939d2b83ae 100644 --- a/src/gallium/drivers/nvfx/nvfx_vertprog.c +++ b/src/gallium/drivers/nvfx/nvfx_vertprog.c @@ -10,6 +10,7 @@ #include "nvfx_context.h" #include "nvfx_state.h" +#include "nvfx_resource.h" /* TODO (at least...): * 1. Indexed consts + ARL @@ -874,7 +875,6 @@ nvfx_vertprog_validate(struct nvfx_context *nvfx) struct nouveau_grobj *eng3d = screen->eng3d; struct nvfx_vertex_program *vp; struct pipe_resource *constbuf; - struct pipe_transfer *transfer = NULL; boolean upload_code = FALSE, upload_data = FALSE; int i; @@ -983,11 +983,8 @@ nvfx_vertprog_validate(struct nvfx_context *nvfx) if (vp->nr_consts) { float *map = NULL; - if (constbuf) { - map = pipe_buffer_map(pipe, constbuf, - PIPE_TRANSFER_READ, - &transfer); - } + if (constbuf) + map = nvfx_buffer(constbuf)->data; for (i = 0; i < vp->nr_consts; i++) { struct nvfx_vertex_program_data *vpd = &vp->consts[i]; @@ -1005,9 +1002,6 @@ nvfx_vertprog_validate(struct nvfx_context *nvfx) OUT_RING (chan, i + vp->data->start); OUT_RINGp (chan, (uint32_t *)vpd->value, 4); } - - if (constbuf) - pipe_buffer_unmap(pipe, constbuf, transfer); } /* Upload vtxprog */ -- cgit v1.2.3 From 4d765f7fa3751eae00bbf2b6ee9710bf5bdf95d0 Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Tue, 10 Aug 2010 23:09:53 +0200 Subject: nvfx: support proper shader linkage - adds glsl support --- src/gallium/drivers/nvfx/nvfx_context.h | 1 + src/gallium/drivers/nvfx/nvfx_fragprog.c | 204 ++++++++++++++++++++--------- src/gallium/drivers/nvfx/nvfx_shader.h | 1 + src/gallium/drivers/nvfx/nvfx_state.c | 25 ++-- src/gallium/drivers/nvfx/nvfx_state.h | 24 ++++ src/gallium/drivers/nvfx/nvfx_state_emit.c | 3 +- src/gallium/drivers/nvfx/nvfx_vertprog.c | 41 ++++-- 7 files changed, 211 insertions(+), 88 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/nvfx/nvfx_context.h b/src/gallium/drivers/nvfx/nvfx_context.h index 8899bf991e..7ec6a4f412 100644 --- a/src/gallium/drivers/nvfx/nvfx_context.h +++ b/src/gallium/drivers/nvfx/nvfx_context.h @@ -45,6 +45,7 @@ #define NVFX_NEW_VERTCONST (1 << 14) #define NVFX_NEW_FRAGCONST (1 << 15) #define NVFX_NEW_INDEX (1 << 16) +#define NVFX_NEW_SPRITE (1 << 17) struct nvfx_rasterizer_state { struct pipe_rasterizer_state pipe; diff --git a/src/gallium/drivers/nvfx/nvfx_fragprog.c b/src/gallium/drivers/nvfx/nvfx_fragprog.c index ae4fe3aa26..0a599c62a7 100644 --- a/src/gallium/drivers/nvfx/nvfx_fragprog.c +++ b/src/gallium/drivers/nvfx/nvfx_fragprog.c @@ -16,8 +16,6 @@ struct nvfx_fpc { struct nvfx_fragment_program *fp; - uint attrib_map[PIPE_MAX_SHADER_INPUTS]; - unsigned r_temps; unsigned r_temps_discard; struct nvfx_sreg r_result[PIPE_MAX_SHADER_OUTPUTS]; @@ -36,6 +34,8 @@ struct nvfx_fpc { struct nvfx_sreg imm[MAX_IMM]; unsigned nr_imm; + + unsigned char generic_to_slot[256]; /* semantic idx for each input semantic */ }; static INLINE struct nvfx_sreg @@ -111,6 +111,11 @@ emit_src(struct nvfx_fpc *fpc, int pos, struct nvfx_sreg src) sr |= (NVFX_FP_REG_TYPE_TEMP << NVFX_FP_REG_TYPE_SHIFT); sr |= (src.index << NVFX_FP_REG_SRC_SHIFT); break; + case NVFXSR_RELOCATED: + sr |= (NVFX_FP_REG_TYPE_INPUT << NVFX_FP_REG_TYPE_SHIFT); + //printf("adding relocation at %x for %x\n", fpc->inst_offset, src.index); + util_dynarray_append(&fpc->fp->slot_relocations[src.index], unsigned, fpc->inst_offset); + break; case NVFXSR_CONST: if (!fpc->have_const) { grow_insns(fpc, 4); @@ -241,8 +246,28 @@ tgsi_src(struct nvfx_fpc *fpc, const struct tgsi_full_src_register *fsrc) switch (fsrc->Register.File) { case TGSI_FILE_INPUT: - src = nvfx_sr(NVFXSR_INPUT, - fpc->attrib_map[fsrc->Register.Index]); + if(fpc->fp->info.input_semantic_name[fsrc->Register.Index] == TGSI_SEMANTIC_POSITION) { + assert(fpc->fp->info.input_semantic_index[fsrc->Register.Index] == 0); + src = nvfx_sr(NVFXSR_INPUT, NVFX_FP_OP_INPUT_SRC_POSITION); + } else if(fpc->fp->info.input_semantic_name[fsrc->Register.Index] == TGSI_SEMANTIC_COLOR) { + if(fpc->fp->info.input_semantic_index[fsrc->Register.Index] == 0) + src = nvfx_sr(NVFXSR_INPUT, NVFX_FP_OP_INPUT_SRC_COL0); + else if(fpc->fp->info.input_semantic_index[fsrc->Register.Index] == 1) + src = nvfx_sr(NVFXSR_INPUT, NVFX_FP_OP_INPUT_SRC_COL1); + else + assert(0); + } else if(fpc->fp->info.input_semantic_name[fsrc->Register.Index] == TGSI_SEMANTIC_FOG) { + assert(fpc->fp->info.input_semantic_index[fsrc->Register.Index] == 0); + src = nvfx_sr(NVFXSR_INPUT, NVFX_FP_OP_INPUT_SRC_FOGC); + } else if(fpc->fp->info.input_semantic_name[fsrc->Register.Index] == TGSI_SEMANTIC_FACE) { + /* TODO: check this has the correct values */ + /* XXX: what do we do for nv30 here (assuming it lacks facing)?! */ + assert(fpc->fp->info.input_semantic_index[fsrc->Register.Index] == 0); + src = nvfx_sr(NVFXSR_INPUT, NV40_FP_OP_INPUT_SRC_FACING); + } else { + assert(fpc->fp->info.input_semantic_name[fsrc->Register.Index] == TGSI_SEMANTIC_GENERIC); + src = nvfx_sr(NVFXSR_RELOCATED, fpc->generic_to_slot[fpc->fp->info.input_semantic_index[fsrc->Register.Index]]); + } break; case TGSI_FILE_CONSTANT: src = constant(fpc, fsrc->Register.Index, NULL); @@ -610,48 +635,6 @@ nvfx_fragprog_parse_instruction(struct nvfx_context* nvfx, struct nvfx_fpc *fpc, return TRUE; } -static boolean -nvfx_fragprog_parse_decl_attrib(struct nvfx_context* nvfx, struct nvfx_fpc *fpc, - const struct tgsi_full_declaration *fdec) -{ - int hw; - - switch (fdec->Semantic.Name) { - case TGSI_SEMANTIC_POSITION: - hw = NVFX_FP_OP_INPUT_SRC_POSITION; - break; - case TGSI_SEMANTIC_COLOR: - if (fdec->Semantic.Index == 0) { - hw = NVFX_FP_OP_INPUT_SRC_COL0; - } else - if (fdec->Semantic.Index == 1) { - hw = NVFX_FP_OP_INPUT_SRC_COL1; - } else { - NOUVEAU_ERR("bad colour semantic index\n"); - return FALSE; - } - break; - case TGSI_SEMANTIC_FOG: - hw = NVFX_FP_OP_INPUT_SRC_FOGC; - break; - case TGSI_SEMANTIC_GENERIC: - if (fdec->Semantic.Index <= 7) { - hw = NVFX_FP_OP_INPUT_SRC_TC(fdec->Semantic. - Index); - } else { - NOUVEAU_ERR("bad generic semantic index\n"); - return FALSE; - } - break; - default: - NOUVEAU_ERR("bad input semantic\n"); - return FALSE; - } - - fpc->attrib_map[fdec->Range.First] = hw; - return TRUE; -} - static boolean nvfx_fragprog_parse_decl_output(struct nvfx_context* nvfx, struct nvfx_fpc *fpc, const struct tgsi_full_declaration *fdec) @@ -691,6 +674,15 @@ nvfx_fragprog_prepare(struct nvfx_context* nvfx, struct nvfx_fpc *fpc) { struct tgsi_parse_context p; int high_temp = -1, i; + struct util_semantic_set set; + + fpc->fp->num_slots = util_semantic_set_from_program_file(&set, fpc->fp->pipe.tokens, TGSI_FILE_INPUT); + if(fpc->fp->num_slots > 8) + return FALSE; + util_semantic_layout_from_set(fpc->fp->slot_to_generic, &set, 0, 8); + util_semantic_table_from_layout(fpc->generic_to_slot, fpc->fp->slot_to_generic, 0, 8); + + memset(fpc->fp->slot_to_fp_input, 0xff, sizeof(fpc->fp->slot_to_fp_input)); tgsi_parse_init(&p, fpc->fp->pipe.tokens); while (!tgsi_parse_end_of_tokens(&p)) { @@ -703,10 +695,6 @@ nvfx_fragprog_prepare(struct nvfx_context* nvfx, struct nvfx_fpc *fpc) const struct tgsi_full_declaration *fdec; fdec = &p.FullToken.FullDeclaration; switch (fdec->Declaration.File) { - case TGSI_FILE_INPUT: - if (!nvfx_fragprog_parse_decl_attrib(nvfx, fpc, fdec)) - goto out_err; - break; case TGSI_FILE_OUTPUT: if (!nvfx_fragprog_parse_decl_output(nvfx, fpc, fdec)) goto out_err; @@ -805,7 +793,7 @@ nvfx_fragprog_translate(struct nvfx_context *nvfx, /* Terminate final instruction */ if(fp->insn) - fp->insn[fpc->inst_offset] |= 0x00000001; + fp->insn[fpc->inst_offset] |= 0x00000001; /* Append NOP + END instruction, may or may not be necessary. */ fpc->inst_offset = fp->insn_len; @@ -881,9 +869,70 @@ nvfx_fragprog_validate(struct nvfx_context *nvfx) if (nvfx->dirty & (NVFX_NEW_FRAGCONST | NVFX_NEW_FRAGPROG)) update = TRUE; - if(update) { - int offset; + struct nvfx_vertex_program* vp = nvfx->render_mode == HW ? nvfx->vertprog : nvfx->swtnl.vertprog; + if (fp->last_vp_id != vp->id) { + char* vp_sem_table = vp->generic_to_fp_input; + unsigned char* fp_semantics = fp->slot_to_generic; + unsigned diff = 0; + fp->last_vp_id = nvfx->vertprog->id; + unsigned char* cur_slots = fp->slot_to_fp_input; + for(unsigned i = 0; i < fp->num_slots; ++i) { + unsigned char slot_mask = vp_sem_table[fp_semantics[i]]; + diff |= (slot_mask >> 4) & (slot_mask ^ cur_slots[i]); + } + + if(diff) + { + for(unsigned i = 0; i < fp->num_slots; ++i) { + /* if 0xff, then this will write to the dummy value at fp->last_layout_mask[0] */ + fp->slot_to_fp_input[i] = vp_sem_table[fp_semantics[i]] & 0xf; + //printf("fp: GENERIC[%i] from fpreg %i\n", fp_semantics[i], fp->slot_to_fp_input[i]); + } + + fp->progs_left_with_obsolete_slot_assignments = fp->progs; + update = TRUE; + } + } + + // last_sprite_coord_enable + unsigned sprite_coord_enable = nvfx->rasterizer->pipe.point_quad_rasterization * nvfx->rasterizer->pipe.sprite_coord_enable; + if(fp->last_sprite_coord_enable != sprite_coord_enable) + { + unsigned texcoord_mask = vp->texcoord_ouput_mask; + fp->last_sprite_coord_enable = sprite_coord_enable; + fp->point_sprite_control = 0; + for(unsigned i = 0; i < fp->num_slots; ++i) { + if((1 << fp->slot_to_generic[i]) & sprite_coord_enable) + { + unsigned fpin = fp->slot_to_fp_input[i]; + //printf("sprite: slot %i generic %i had texcoord %i\n", i, fp->slot_to_generic[i], fpin - NVFX_FP_OP_INPUT_SRC_TC0); + if(fpin >= 0x0f) + { + unsigned tc = __builtin_ctz(~texcoord_mask); + texcoord_mask |= (1 << tc); + fp->slot_to_fp_input[i] = fpin = NVFX_FP_OP_INPUT_SRC_TC(tc); + + fp->progs_left_with_obsolete_slot_assignments = fp->progs; + update = TRUE; + } + //printf("sprite: slot %i texcoord %i\n", i, fpin - NVFX_FP_OP_INPUT_SRC_TC0); + fp->point_sprite_control |= (1 << (fpin - NVFX_FP_OP_INPUT_SRC_TC0 + 8)); + } + else + { + unsigned fpin = fp->slot_to_fp_input[i]; + if(!(vp->texcoord_ouput_mask & (1 << (fpin - NVFX_FP_OP_INPUT_SRC_TC0)))) + { + fp->slot_to_fp_input[i] = 0x0f; + fp->progs_left_with_obsolete_slot_assignments = fp->progs; + update = TRUE; + } + } + } + } + + if(update) { ++fp->bo_prog_idx; if(fp->bo_prog_idx >= fp->progs_per_bo) { @@ -893,10 +942,9 @@ nvfx_fragprog_validate(struct nvfx_context *nvfx) } else { - struct nvfx_fragment_program_bo* fpbo = os_malloc_aligned(sizeof(struct nvfx_fragment_program) + fp->prog_size * fp->progs_per_bo, 16); - char *map, *buf; - int i; - + struct nvfx_fragment_program_bo* fpbo = os_malloc_aligned(sizeof(struct nvfx_fragment_program) + (fp->prog_size + 8) * fp->progs_per_bo, 16); + fpbo->slots = (unsigned char*)&fpbo->insn[(fp->prog_size) * fp->progs_per_bo]; + memset(fpbo->slots, 0, 8 * fp->progs_per_bo); if(fp->fpbo) { fpbo->next = fp->fpbo->next; @@ -906,12 +954,14 @@ nvfx_fragprog_validate(struct nvfx_context *nvfx) fpbo->next = fpbo; fp->fpbo = fpbo; fpbo->bo = 0; + fp->progs += fp->progs_per_bo; + fp->progs_left_with_obsolete_slot_assignments += fp->progs_per_bo; nouveau_bo_new(nvfx->screen->base.device, NOUVEAU_BO_VRAM | NOUVEAU_BO_MAP, 64, fp->prog_size * fp->progs_per_bo, &fpbo->bo); nouveau_bo_map(fpbo->bo, NOUVEAU_BO_NOSYNC); - map = fpbo->bo->map; - buf = fpbo->insn; - for(i = 0; i < fp->progs_per_bo; ++i) + uint8_t* map = fpbo->bo->map; + uint8_t* buf = (uint8_t*)fpbo->insn; + for(unsigned i = 0; i < fp->progs_per_bo; ++i) { memcpy(buf, fp->insn, fp->insn_len * 4); nvfx_fp_memcpy(map, fp->insn, fp->insn_len * 4); @@ -922,7 +972,8 @@ nvfx_fragprog_validate(struct nvfx_context *nvfx) fp->bo_prog_idx = 0; } - offset = fp->bo_prog_idx * fp->prog_size; + int offset = fp->bo_prog_idx * fp->prog_size; + uint32_t* fpmap = (uint32_t*)((char*)fp->fpbo->bo->map + offset); if(nvfx->constbuf[PIPE_SHADER_FRAGMENT]) { struct pipe_resource* constbuf = nvfx->constbuf[PIPE_SHADER_FRAGMENT]; @@ -941,6 +992,25 @@ nvfx_fragprog_validate(struct nvfx_context *nvfx) } } } + + if(fp->progs_left_with_obsolete_slot_assignments) { + unsigned char* fpbo_slots = &fp->fpbo->slots[fp->bo_prog_idx * 8]; + for(unsigned i = 0; i < fp->num_slots; ++i) { + unsigned value = fp->slot_to_fp_input[i];; + if(value != fpbo_slots[i]) { + unsigned* p = (unsigned*)fp->slot_relocations[i].data; + unsigned* pend = (unsigned*)((char*)fp->slot_relocations[i].data + fp->slot_relocations[i].size); + for(; p != pend; ++p) { + unsigned off = *p; + unsigned dw = fp->insn[off]; + dw = (dw & ~NVFX_FP_OP_INPUT_SRC_MASK) | (value << NVFX_FP_OP_INPUT_SRC_SHIFT); + nvfx_fp_memcpy(&fpmap[*p], &dw, sizeof(dw)); + } + fpbo_slots[i] = value; + } + } + --fp->progs_left_with_obsolete_slot_assignments; + } } if(update || (nvfx->dirty & NVFX_NEW_FRAGPROG)) { @@ -960,6 +1030,13 @@ nvfx_fragprog_validate(struct nvfx_context *nvfx) OUT_RING(chan, fp->samplers); } } + + if(nvfx->dirty & (NVFX_NEW_FRAGPROG | NVFX_NEW_SPRITE)) + { + WAIT_RING(chan, 2); + OUT_RING(chan, RING_3D(NV34TCL_POINT_SPRITE, 1)); + OUT_RING(chan, fp->point_sprite_control | nvfx->rasterizer->pipe.point_quad_rasterization); + } } void @@ -982,6 +1059,7 @@ void nvfx_fragprog_destroy(struct nvfx_context *nvfx, struct nvfx_fragment_program *fp) { + unsigned i; struct nvfx_fragment_program_bo* fpbo = fp->fpbo; if(fpbo) { @@ -996,7 +1074,9 @@ nvfx_fragprog_destroy(struct nvfx_context *nvfx, while(fpbo != fp->fpbo); } + for(i = 0; i < 8; ++i) + util_dynarray_fini(&fp->slot_relocations[i]); + if (fp->insn_len) FREE(fp->insn); } - diff --git a/src/gallium/drivers/nvfx/nvfx_shader.h b/src/gallium/drivers/nvfx/nvfx_shader.h index 50830b3916..88cf91b95f 100644 --- a/src/gallium/drivers/nvfx/nvfx_shader.h +++ b/src/gallium/drivers/nvfx/nvfx_shader.h @@ -323,6 +323,7 @@ #define NVFXSR_INPUT 2 #define NVFXSR_TEMP 3 #define NVFXSR_CONST 4 +#define NVFXSR_RELOCATED 5 #define NVFX_COND_FL 0 #define NVFX_COND_LT 1 diff --git a/src/gallium/drivers/nvfx/nvfx_state.c b/src/gallium/drivers/nvfx/nvfx_state.c index 25d29720a8..c3addf1114 100644 --- a/src/gallium/drivers/nvfx/nvfx_state.c +++ b/src/gallium/drivers/nvfx/nvfx_state.c @@ -91,6 +91,7 @@ nvfx_rasterizer_state_create(struct pipe_context *pipe, /*XXX: ignored: * point_smooth -nohw * multisample + * sprite_coord_origin */ sb_method(sb, NV34TCL_SHADE_MODEL, 1); @@ -150,20 +151,6 @@ nvfx_rasterizer_state_create(struct pipe_context *pipe, sb_data(sb, fui(cso->offset_units * 2)); } - sb_method(sb, NV34TCL_POINT_SPRITE, 1); - if (cso->point_quad_rasterization) { - unsigned psctl = (1 << 0), i; - - for (i = 0; i < 8; i++) { - if ((cso->sprite_coord_enable >> i) & 1) - psctl |= (1 << (8 + i)); - } - - sb_data(sb, psctl); - } else { - sb_data(sb, 0); - } - rsso->pipe = *cso; rsso->sb_len = sb_len(sb, rsso->sb); return (void *)rsso; @@ -189,6 +176,12 @@ nvfx_rasterizer_state_bind(struct pipe_context *pipe, void *hwcso) nvfx->dirty |= NVFX_NEW_STIPPLE; nvfx->draw_dirty |= NVFX_NEW_STIPPLE; } + + if(((struct nvfx_rasterizer_state*)hwcso)->pipe.point_quad_rasterization != nvfx->rasterizer->pipe.point_quad_rasterization + || ((struct nvfx_rasterizer_state*)hwcso)->pipe.sprite_coord_enable != nvfx->rasterizer->pipe.sprite_coord_enable) + { + nvfx->dirty |= NVFX_NEW_SPRITE; + } } nvfx->rasterizer = hwcso; @@ -280,9 +273,13 @@ nvfx_vp_state_create(struct pipe_context *pipe, struct nvfx_context *nvfx = nvfx_context(pipe); struct nvfx_vertex_program *vp; + // TODO: use a 64-bit atomic here! + static unsigned long long id = 0; + vp = CALLOC(1, sizeof(struct nvfx_vertex_program)); vp->pipe.tokens = tgsi_dup_tokens(cso->tokens); vp->draw = draw_create_vertex_shader(nvfx->draw, &vp->pipe); + vp->id = ++id; return (void *)vp; } diff --git a/src/gallium/drivers/nvfx/nvfx_state.h b/src/gallium/drivers/nvfx/nvfx_state.h index 9ceb2577ec..e1fa3c7e04 100644 --- a/src/gallium/drivers/nvfx/nvfx_state.h +++ b/src/gallium/drivers/nvfx/nvfx_state.h @@ -4,6 +4,8 @@ #include "pipe/p_state.h" #include "tgsi/tgsi_scan.h" #include "nouveau/nouveau_statebuf.h" +#include "util/u_dynarray.h" +#include "util/u_linkage.h" struct nvfx_vertex_program_exec { uint32_t data[4]; @@ -18,6 +20,7 @@ struct nvfx_vertex_program_data { struct nvfx_vertex_program { struct pipe_shader_state pipe; + unsigned long long id; struct draw_vertex_shader *draw; @@ -30,6 +33,9 @@ struct nvfx_vertex_program { struct nvfx_vertex_program_data *consts; unsigned nr_consts; + char generic_to_fp_input[256]; + unsigned texcoord_ouput_mask; + struct nouveau_resource *exec; unsigned exec_start; struct nouveau_resource *data; @@ -49,6 +55,7 @@ struct nvfx_fragment_program_data { struct nvfx_fragment_program_bo { struct nvfx_fragment_program_bo* next; struct nouveau_bo* bo; + unsigned char* slots; char insn[] __attribute__((aligned(16))); }; @@ -58,6 +65,7 @@ struct nvfx_fragment_program { boolean translated; unsigned samplers; + unsigned point_sprite_control; uint32_t *insn; int insn_len; @@ -65,11 +73,27 @@ struct nvfx_fragment_program { struct nvfx_fragment_program_data *consts; unsigned nr_consts; + unsigned num_slots; /* how many input semantics? */ + unsigned char slot_to_generic[8]; /* semantics */ + unsigned char slot_to_fp_input[8]; /* current assignment of slots for each used semantic */ + struct util_dynarray slot_relocations[8]; + + /* This is reset to progs on any relocation update, and decreases every time we + * move to a new prog due to a constant update + * When this is the same as progs, applying relocations is no longer necessary. + */ + unsigned progs_left_with_obsolete_slot_assignments; + + unsigned long long last_vp_id; + unsigned last_sprite_coord_enable; + uint32_t fp_control; unsigned bo_prog_idx; unsigned prog_size; unsigned progs_per_bo; + unsigned progs; + struct nvfx_fragment_program_bo* fpbo; }; diff --git a/src/gallium/drivers/nvfx/nvfx_state_emit.c b/src/gallium/drivers/nvfx/nvfx_state_emit.c index b9d1897791..2e0e366ca3 100644 --- a/src/gallium/drivers/nvfx/nvfx_state_emit.c +++ b/src/gallium/drivers/nvfx/nvfx_state_emit.c @@ -15,6 +15,7 @@ nvfx_state_validate_common(struct nvfx_context *nvfx) if(nvfx != nvfx->screen->cur_ctx) { nvfx->dirty = ~0; + nvfx->hw_vtxelt_nr = 16; nvfx->screen->cur_ctx = nvfx; } @@ -86,7 +87,7 @@ nvfx_state_validate_common(struct nvfx_context *nvfx) if(dirty & NVFX_NEW_STIPPLE) nvfx_state_stipple_validate(nvfx); - if(dirty & (NVFX_NEW_FRAGPROG | NVFX_NEW_FRAGCONST)) + if(dirty & (NVFX_NEW_FRAGPROG | NVFX_NEW_FRAGCONST | NVFX_NEW_VERTPROG | NVFX_NEW_SPRITE)) { nvfx_fragprog_validate(nvfx); if(dirty & NVFX_NEW_FRAGPROG) diff --git a/src/gallium/drivers/nvfx/nvfx_vertprog.c b/src/gallium/drivers/nvfx/nvfx_vertprog.c index 939d2b83ae..3d2f2b9fba 100644 --- a/src/gallium/drivers/nvfx/nvfx_vertprog.c +++ b/src/gallium/drivers/nvfx/nvfx_vertprog.c @@ -1,7 +1,7 @@ #include "pipe/p_context.h" #include "pipe/p_defines.h" #include "pipe/p_state.h" -#include "util/u_inlines.h" +#include "util/u_linkage.h" #include "pipe/p_shader_tokens.h" #include "tgsi/tgsi_parse.h" @@ -61,7 +61,7 @@ temp(struct nvfx_vpc *vpc) return nvfx_sr(NVFXSR_TEMP, idx); } -static INLINE void +static inline void release_temps(struct nvfx_vpc *vpc) { vpc->r_temps &= ~vpc->r_temps_discard; @@ -339,7 +339,7 @@ nvfx_vp_arith(struct nvfx_context* nvfx, struct nvfx_vpc *vpc, int slot, int op, emit_src(nvfx, vpc, hw, 2, s2); } -static INLINE struct nvfx_sreg +static inline struct nvfx_sreg tgsi_src(struct nvfx_vpc *vpc, const struct tgsi_full_src_register *fsrc) { struct nvfx_sreg src = { 0 }; @@ -385,14 +385,14 @@ tgsi_dst(struct nvfx_vpc *vpc, const struct tgsi_full_dst_register *fdst) { dst = vpc->r_address[fdst->Register.Index]; break; default: - NOUVEAU_ERR("bad dst file\n"); + NOUVEAU_ERR("bad dst file %i\n", fdst->Register.File); break; } return dst; } -static INLINE int +static inline int tgsi_mask(uint tgsi) { int mask = 0; @@ -650,12 +650,8 @@ nvfx_vertprog_parse_decl_output(struct nvfx_context* nvfx, struct nvfx_vpc *vpc, hw = NVFX_VP(INST_DEST_PSZ); break; case TGSI_SEMANTIC_GENERIC: - if (fdec->Semantic.Index <= 7) { - hw = NVFX_VP(INST_DEST_TC(fdec->Semantic.Index)); - } else { - NOUVEAU_ERR("bad generic semantic index\n"); - return FALSE; - } + hw = (vpc->vp->generic_to_fp_input[fdec->Semantic.Index] & 0xf) + + NVFX_VP(INST_DEST_TC(0)) - NVFX_FP_OP_INPUT_SRC_TC(0); break; case TGSI_SEMANTIC_EDGEFLAG: /* not really an error just a fallback */ @@ -675,6 +671,29 @@ nvfx_vertprog_prepare(struct nvfx_context* nvfx, struct nvfx_vpc *vpc) { struct tgsi_parse_context p; int high_temp = -1, high_addr = -1, nr_imm = 0, i; + struct util_semantic_set set; + unsigned char sem_layout[8]; + unsigned sem_layout_size; + unsigned num_outputs; + + num_outputs = util_semantic_set_from_program_file(&set, vpc->vp->pipe.tokens, TGSI_FILE_OUTPUT); + + if(num_outputs > 8) { + NOUVEAU_ERR("too many vertex program outputs: %i\n", num_outputs); + return FALSE; + } + util_semantic_layout_from_set(sem_layout, &set, 8, 8); + + /* hope 0xf is (0, 0, 0, 1) initialized; otherwise, we are _probably_ not required to do this */ + memset(vpc->vp->generic_to_fp_input, 0x0f, sizeof(vpc->vp->generic_to_fp_input)); + vpc->vp->texcoord_ouput_mask = 0; + for(int i = 0; i < 8; ++i) { + if(sem_layout[i] == 0xff) + continue; + vpc->vp->texcoord_ouput_mask |= (1 << i); + //printf("vp: GENERIC[%i] to fpreg %i\n", sem_layout[i], NVFX_FP_OP_INPUT_SRC_TC(0) + i); + vpc->vp->generic_to_fp_input[sem_layout[i]] = 0xf0 | (NVFX_FP_OP_INPUT_SRC_TC(0) + i); + } tgsi_parse_init(&p, vpc->vp->pipe.tokens); while (!tgsi_parse_end_of_tokens(&p)) { -- cgit v1.2.3 From 0184e298636370865bb8d511ca890acd70c1c4c6 Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Sat, 13 Mar 2010 02:28:59 +0100 Subject: nvfx: expose GLSL Still no control flow support, but basic stuff works. --- src/gallium/drivers/nvfx/nvfx_screen.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/drivers/nvfx/nvfx_screen.c b/src/gallium/drivers/nvfx/nvfx_screen.c index 7e3caf8d2e..72cb5239b5 100644 --- a/src/gallium/drivers/nvfx/nvfx_screen.c +++ b/src/gallium/drivers/nvfx/nvfx_screen.c @@ -44,7 +44,7 @@ nvfx_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param) case PIPE_CAP_TWO_SIDED_STENCIL: return 1; case PIPE_CAP_GLSL: - return 0; + return 1; case PIPE_CAP_ANISOTROPIC_FILTER: return 1; case PIPE_CAP_POINT_SPRITE: -- cgit v1.2.3 From 0d74956a1f895303a44bddc6f92c246ecce40023 Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Sun, 15 Aug 2010 10:15:40 +0200 Subject: nvfx: support flatshade_first --- src/gallium/drivers/nouveau/nouveau_class.h | 1 + src/gallium/drivers/nvfx/nvfx_context.h | 2 +- src/gallium/drivers/nvfx/nvfx_state.c | 3 +++ 3 files changed, 5 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/drivers/nouveau/nouveau_class.h b/src/gallium/drivers/nouveau/nouveau_class.h index 14c11b278a..20941f379c 100644 --- a/src/gallium/drivers/nouveau/nouveau_class.h +++ b/src/gallium/drivers/nouveau/nouveau_class.h @@ -6149,6 +6149,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #define NV34TCL_FP_REG_CONTROL_UNK1_MASK 0xffff0000 #define NV34TCL_FP_REG_CONTROL_UNK0_SHIFT 0 #define NV34TCL_FP_REG_CONTROL_UNK0_MASK 0x0000ffff +#define NV34TCL_FLATSHADE_FIRST 0x00001454 #define NV34TCL_EDGEFLAG_ENABLE 0x0000145c #define NV34TCL_VP_CLIP_PLANES_ENABLE 0x00001478 #define NV34TCL_VP_CLIP_PLANES_ENABLE_PLANE0 (1 << 1) diff --git a/src/gallium/drivers/nvfx/nvfx_context.h b/src/gallium/drivers/nvfx/nvfx_context.h index 7ec6a4f412..2eec5a11a6 100644 --- a/src/gallium/drivers/nvfx/nvfx_context.h +++ b/src/gallium/drivers/nvfx/nvfx_context.h @@ -50,7 +50,7 @@ struct nvfx_rasterizer_state { struct pipe_rasterizer_state pipe; unsigned sb_len; - uint32_t sb[32]; + uint32_t sb[34]; }; struct nvfx_zsa_state { diff --git a/src/gallium/drivers/nvfx/nvfx_state.c b/src/gallium/drivers/nvfx/nvfx_state.c index c3addf1114..f529fb2a27 100644 --- a/src/gallium/drivers/nvfx/nvfx_state.c +++ b/src/gallium/drivers/nvfx/nvfx_state.c @@ -151,6 +151,9 @@ nvfx_rasterizer_state_create(struct pipe_context *pipe, sb_data(sb, fui(cso->offset_units * 2)); } + sb_method(sb, NV34TCL_FLATSHADE_FIRST, 1); + sb_data(sb, cso->flatshade_first); + rsso->pipe = *cso; rsso->sb_len = sb_len(sb, rsso->sb); return (void *)rsso; -- cgit v1.2.3 From 07b6fde4102bfa5097b3c16cf23a6d60357e5463 Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Mon, 16 Aug 2010 16:55:00 +0200 Subject: nv30: band-aid viewport issues For some reason nv30 seems to like to reset the viewport, even though attempts to isolate where exactly it does that have currently been inconclusive. --- src/gallium/drivers/nvfx/nvfx_state_emit.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/nvfx/nvfx_state_emit.c b/src/gallium/drivers/nvfx/nvfx_state_emit.c index 2e0e366ca3..7a706ea6d7 100644 --- a/src/gallium/drivers/nvfx/nvfx_state_emit.c +++ b/src/gallium/drivers/nvfx/nvfx_state_emit.c @@ -109,12 +109,14 @@ nvfx_state_validate_common(struct nvfx_context *nvfx) if(dirty & NVFX_NEW_SR) nvfx_state_sr_validate(nvfx); -/* Having this depend on FB looks wrong, but it seems - necessary to make this work on nv3x +/* All these dependencies are wrong, but otherwise + etracer, neverball, foobillard, glest totally misrender TODO: find the right fix */ - if(dirty & (NVFX_NEW_VIEWPORT | NVFX_NEW_FB)) + if(dirty & (NVFX_NEW_VIEWPORT | NVFX_NEW_RAST | NVFX_NEW_ZSA) || (all_swizzled > 0)) + { nvfx_state_viewport_validate(nvfx); + } if(flush_tex_cache) { -- cgit v1.2.3 From 6931a01222beab107cb65067270770e3406425e2 Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Tue, 17 Aug 2010 01:01:42 +0200 Subject: nvfx: fire ring after transfers Might reduce the risk of running out of memory --- src/gallium/drivers/nvfx/nvfx_transfer.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src') diff --git a/src/gallium/drivers/nvfx/nvfx_transfer.c b/src/gallium/drivers/nvfx/nvfx_transfer.c index ca4462ef9d..7cb47a20f6 100644 --- a/src/gallium/drivers/nvfx/nvfx_transfer.c +++ b/src/gallium/drivers/nvfx/nvfx_transfer.c @@ -141,7 +141,12 @@ nvfx_transfer_destroy(struct pipe_context *pipe, struct pipe_transfer *ptx) FREE(ptx); } else + { + struct nouveau_channel* chan = nvfx_context(pipe)->screen->base.channel; util_staging_transfer_destroy(pipe, ptx); + + FIRE_RING(chan); + } } void * -- cgit v1.2.3 From ed232adc80867a424978396e047f146cb94a1cc5 Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Thu, 19 Aug 2010 12:58:14 +0200 Subject: nvfx: fix GPU hardlocks when depth buffer is absent --- src/gallium/drivers/nvfx/nvfx_context.h | 2 +- src/gallium/drivers/nvfx/nvfx_state.c | 4 +--- src/gallium/drivers/nvfx/nvfx_state_emit.c | 10 +++++++++- src/gallium/drivers/nvfx/nvfx_state_fb.c | 4 ++++ 4 files changed, 15 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/nvfx/nvfx_context.h b/src/gallium/drivers/nvfx/nvfx_context.h index 2eec5a11a6..04447da3e1 100644 --- a/src/gallium/drivers/nvfx/nvfx_context.h +++ b/src/gallium/drivers/nvfx/nvfx_context.h @@ -56,7 +56,7 @@ struct nvfx_rasterizer_state { struct nvfx_zsa_state { struct pipe_depth_stencil_alpha_state pipe; unsigned sb_len; - uint32_t sb[26]; + uint32_t sb[24]; }; struct nvfx_blend_state { diff --git a/src/gallium/drivers/nvfx/nvfx_state.c b/src/gallium/drivers/nvfx/nvfx_state.c index f529fb2a27..c8431641d3 100644 --- a/src/gallium/drivers/nvfx/nvfx_state.c +++ b/src/gallium/drivers/nvfx/nvfx_state.c @@ -207,10 +207,8 @@ nvfx_depth_stencil_alpha_state_create(struct pipe_context *pipe, struct nvfx_zsa_state *zsaso = CALLOC(1, sizeof(*zsaso)); struct nouveau_statebuf_builder sb = sb_init(zsaso->sb); - sb_method(sb, NV34TCL_DEPTH_FUNC, 3); + sb_method(sb, NV34TCL_DEPTH_FUNC, 1); sb_data (sb, nvgl_comparison_op(cso->depth.func)); - sb_data (sb, cso->depth.writemask ? 1 : 0); - sb_data (sb, cso->depth.enabled ? 1 : 0); sb_method(sb, NV34TCL_ALPHA_FUNC_ENABLE, 3); sb_data (sb, cso->alpha.enabled ? 1 : 0); diff --git a/src/gallium/drivers/nvfx/nvfx_state_emit.c b/src/gallium/drivers/nvfx/nvfx_state_emit.c index 7a706ea6d7..19512194be 100644 --- a/src/gallium/drivers/nvfx/nvfx_state_emit.c +++ b/src/gallium/drivers/nvfx/nvfx_state_emit.c @@ -113,11 +113,19 @@ nvfx_state_validate_common(struct nvfx_context *nvfx) etracer, neverball, foobillard, glest totally misrender TODO: find the right fix */ - if(dirty & (NVFX_NEW_VIEWPORT | NVFX_NEW_RAST | NVFX_NEW_ZSA) || (all_swizzled > 0)) + if(dirty & (NVFX_NEW_VIEWPORT | NVFX_NEW_RAST | NVFX_NEW_ZSA) || (all_swizzled >= 0)) { nvfx_state_viewport_validate(nvfx); } + if(dirty & NVFX_NEW_ZSA || (all_swizzled >= 0)) + { + WAIT_RING(chan, 3); + OUT_RING(chan, RING_3D(NV34TCL_DEPTH_WRITE_ENABLE, 2)); + OUT_RING(chan, nvfx->framebuffer.zsbuf && nvfx->zsa->pipe.depth.writemask); + OUT_RING(chan, nvfx->framebuffer.zsbuf && nvfx->zsa->pipe.depth.enabled); + } + if(flush_tex_cache) { // TODO: what about nv30? diff --git a/src/gallium/drivers/nvfx/nvfx_state_fb.c b/src/gallium/drivers/nvfx/nvfx_state_fb.c index 28bbd36c2e..3db9cec905 100644 --- a/src/gallium/drivers/nvfx/nvfx_state_fb.c +++ b/src/gallium/drivers/nvfx/nvfx_state_fb.c @@ -252,6 +252,10 @@ nvfx_framebuffer_validate(struct nvfx_context *nvfx, unsigned prepare_result) OUT_RING(chan, nvfx->hw_zeta.pitch); } } + else if(nvfx->is_nv4x) { + OUT_RING(chan, RING_3D(NV40TCL_ZETA_PITCH, 1)); + OUT_RING(chan, 64); + } OUT_RING(chan, RING_3D(NV34TCL_RT_ENABLE, 1)); OUT_RING(chan, rt_enable); -- cgit v1.2.3 From 1dea9bc369dea1215c9e10bf6d52507e618d11ca Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Thu, 19 Aug 2010 22:36:00 +0200 Subject: nvfx: mostly fix inline corruption magically Not sure why this mostly works. --- src/gallium/drivers/nvfx/nvfx_push.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/drivers/nvfx/nvfx_push.c b/src/gallium/drivers/nvfx/nvfx_push.c index 52e891c667..49d518e2eb 100644 --- a/src/gallium/drivers/nvfx/nvfx_push.c +++ b/src/gallium/drivers/nvfx/nvfx_push.c @@ -246,7 +246,7 @@ nvfx_push_vbo(struct pipe_context *pipe, const struct pipe_draw_info *info) uint8_t* map; unsigned step; } per_instance[16]; - unsigned p_overhead = 0 + unsigned p_overhead = 64 /* magic fix */ + 4 /* begin/end */ + 4; /* potential edgeflag enable/disable */ @@ -367,6 +367,14 @@ nvfx_push_vbo(struct pipe_context *pipe, const struct pipe_draw_info *info) if(max_verts >= 16) { + /* XXX: any command a lot of times seems to (mostly) fix corruption that would otherwise happen */ + int i; + for(i = 0; i < 32; ++i) + { + OUT_RING(chan, RING_3D(0x1dac, 1)); + OUT_RING(chan, 0); + } + OUT_RING(chan, RING_3D(NV34TCL_VERTEX_BEGIN_END, 1)); OUT_RING(chan, hw_mode); done = util_split_prim_next(&s, max_verts); -- cgit v1.2.3 From 928cce672a613b2f7bfa5563eca828327b16dc27 Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Thu, 19 Aug 2010 22:47:03 +0200 Subject: nvfx: fix lodbias --- src/gallium/drivers/nvfx/nv30_fragtex.c | 2 +- src/gallium/drivers/nvfx/nv40_fragtex.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/nvfx/nv30_fragtex.c b/src/gallium/drivers/nvfx/nv30_fragtex.c index db8a8fc4b0..0c3d43fd57 100644 --- a/src/gallium/drivers/nvfx/nv30_fragtex.c +++ b/src/gallium/drivers/nvfx/nv30_fragtex.c @@ -21,7 +21,7 @@ nv30_sampler_state_init(struct pipe_context *pipe, ps->en |= NV34TCL_TX_ENABLE_ANISO_2X; } - limit = CLAMP(cso->lod_bias, -16.0, 15.0); + limit = CLAMP(cso->lod_bias, -16.0, 15.0 + (255.0 / 256.0)); ps->filt |= (int)(cso->lod_bias * 256.0) & 0x1fff; ps->max_lod = (int)CLAMP(cso->max_lod, 0.0, 15.0); diff --git a/src/gallium/drivers/nvfx/nv40_fragtex.c b/src/gallium/drivers/nvfx/nv40_fragtex.c index 5fe742f260..106ce71a07 100644 --- a/src/gallium/drivers/nvfx/nv40_fragtex.c +++ b/src/gallium/drivers/nvfx/nv40_fragtex.c @@ -29,11 +29,11 @@ nv40_sampler_state_init(struct pipe_context *pipe, ps->en |= NV40TCL_TEX_ENABLE_ANISO_2X; } - limit = CLAMP(cso->lod_bias, -16.0, 15.0); + limit = CLAMP(cso->lod_bias, -16.0, 15.0 + (255.0 / 256.0)); ps->filt |= (int)(cso->lod_bias * 256.0) & 0x1fff; - ps->max_lod = (int)(CLAMP(cso->max_lod, 0.0, 15.0) * 256.0); - ps->min_lod = (int)(CLAMP(cso->min_lod, 0.0, 15.0) * 256.0); + ps->max_lod = (int)(CLAMP(cso->max_lod, 0.0, 15.0 + (255.0 / 256.0)) * 256.0); + ps->min_lod = (int)(CLAMP(cso->min_lod, 0.0, 15.0 + (255.0 / 256.0)) * 256.0); ps->en |= NV40TCL_TEX_ENABLE_ENABLE; } -- cgit v1.2.3 From b2bad53478b6033038b51982db09094337f1f379 Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Thu, 25 Feb 2010 17:46:37 +0100 Subject: nvfx: improve and correct nvfx_shader.h --- src/gallium/drivers/nvfx/nvfx_shader.h | 78 ++++++++++++++++++++++++++++------ 1 file changed, 65 insertions(+), 13 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/nvfx/nvfx_shader.h b/src/gallium/drivers/nvfx/nvfx_shader.h index 88cf91b95f..59a439fc60 100644 --- a/src/gallium/drivers/nvfx/nvfx_shader.h +++ b/src/gallium/drivers/nvfx/nvfx_shader.h @@ -1,6 +1,8 @@ #ifndef __NVFX_SHADER_H__ #define __NVFX_SHADER_H__ +#define NVFX_SWZ_IDENTITY ((3 << 6) | (2 << 4) | (1 << 2) | (0 << 0)) + /* this will resolve to either the NV30 or the NV40 version * depending on the current hardware */ /* unusual, but very fast and compact method */ @@ -71,11 +73,58 @@ /* * Each fragment program opcode appears to be comprised of 4 32-bit values. * - * 0 - Opcode, output reg/mask, ATTRIB source - * 1 - Source 0 - * 2 - Source 1 - * 3 - Source 2 + * 0: OPDEST + * 0: program end + * 1-6: destination register + * 7: destination register is fp16?? (use for outputs) + * 8: set condition code + * 9: writemask x + * 10: writemask y + * 11: writemask z + * 12: writemask w + * 13-16: source attribute register number (e.g. COL0) + * 17-20: texture unit number + * 21: expand value on texture operation (x -> 2x - 1) + * 22-23: precision 0 = fp32, 1 = fp16, 2 = s1.10 fixed, 3 = s0.8 fixed (nv40-only)) + * 24-29: opcode + * 30: no destination + * 31: saturate + * 1 - SRC0 + * 0-17: see common source fields + * 18: execute if condition code less + * 19: execute if condition code equal + * 20: execute if condition code greater + * 21-22: condition code swizzle x source component + * 23-24: condition code swizzle y source component + * 25-26: condition code swizzle z source component + * 27-28: condition code swizzle w source component + * 29: source 0 absolute + * 30: always 0 in renouveau tests + * 31: always 0 in renouveau tests + * 2 - SRC1 + * 0-17: see common source fields + * 18: source 1 absolute + * 19-20: input precision 0 = fp32, 1 = fp16, 2 = s1.10 fixed, 3 = ??? + * 21-27: always 0 in renouveau tests + * 28-30: scale (0 = 1x, 1 = 2x, 2 = 4x, 3 = 8x, 4 = ???, 5, = 1/2, 6 = 1/4, 7 = 1/8) + * 31: opcode is branch + * 3 - SRC2 + * 0-17: see common source fields + * 18: source 2 absolute + * 19-29: address register displacement + * 30: use index register + * 31: disable perspective-correct interpolation? * +* Common fields of 0, 1, 2 - SRC + * 0-1: source register type (0 = temp, 1 = input, 2 = immediate, 3 = ???) + * 2-7: source temp register index + * 8: source register is fp16?? + * 9-10: source swizzle x source component + * 11-12: source swizzle y source component + * 13-14: source swizzle z source component + * 15-16: source swizzle w source component + * 17: negate + * There appears to be no special difference between result regs and temp regs. * result.color == R0.xyzw * result.depth == R1.z @@ -210,6 +259,7 @@ /* NV40 only fragment program opcodes */ #define NVFX_FP_OP_OPCODE_TXL_NV40 0x2F + /* The use of these instructions appears to be indicated by bit 31 of DWORD 2.*/ #define NV40_FP_OP_BRA_OPCODE_BRK 0x0 #define NV40_FP_OP_BRA_OPCODE_CAL 0x1 @@ -218,10 +268,11 @@ #define NV40_FP_OP_BRA_OPCODE_REP 0x4 #define NV40_FP_OP_BRA_OPCODE_RET 0x5 +#define NV40_FP_OP_OUT_NONE (1 << 30) #define NVFX_FP_OP_OUT_SAT (1 << 31) /* high order bits of SRC0 */ -#define NVFX_FP_OP_OUT_ABS (1 << 29) +#define NVFX_FP_OP_SRC0_ABS (1 << 29) #define NVFX_FP_OP_COND_SWZ_W_SHIFT 27 #define NVFX_FP_OP_COND_SWZ_W_MASK (3 << 27) #define NVFX_FP_OP_COND_SWZ_Z_SHIFT 25 @@ -254,6 +305,7 @@ #define NVFX_FP_OP_DST_SCALE_INV_2X 5 #define NVFX_FP_OP_DST_SCALE_INV_4X 6 #define NVFX_FP_OP_DST_SCALE_INV_8X 7 +#define NVFX_FP_OP_SRC1_ABS (1 << 18) /* SRC1 LOOP */ #define NV40_FP_OP_LOOP_INCR_SHIFT 19 @@ -263,13 +315,13 @@ #define NV40_FP_OP_LOOP_COUNT_SHIFT 2 #define NV40_FP_OP_LOOP_COUNT_MASK (0xFF << 2) -/* SRC1 IF */ -#define NV40_FP_OP_ELSE_ID_SHIFT 2 -#define NV40_FP_OP_ELSE_ID_MASK (0xFF << 2) +/* SRC1 IF: absolute offset in dwords */ +#define NV40_FP_OP_ELSE_OFFSET_SHIFT 0 +#define NV40_FP_OP_ELSE_OFFSET_MASK (0x7FFFFFFF << 0) /* SRC1 CAL */ -#define NV40_FP_OP_IADDR_SHIFT 2 -#define NV40_FP_OP_IADDR_MASK (0xFF << 2) +#define NV40_FP_OP_SUB_OFFSET_SHIFT 0 +#define NV40_FP_OP_SUB_OFFSET_MASK (0x7FFFFFFF << 0) /* SRC1 REP * I have no idea why there are 3 count values here.. but they @@ -283,9 +335,9 @@ #define NV40_FP_OP_REP_COUNT3_SHIFT 19 #define NV40_FP_OP_REP_COUNT3_MASK (0xFF << 19) -/* SRC2 REP/IF */ -#define NV40_FP_OP_END_ID_SHIFT 2 -#define NV40_FP_OP_END_ID_MASK (0xFF << 2) +/* SRC2 REP/IF: absolute offset in dwords */ +#define NV40_FP_OP_END_OFFSET_SHIFT 0 +#define NV40_FP_OP_END_OFFSET_MASK (0x7FFFFFFF << 0) /* high order bits of SRC2 */ #define NVFX_FP_OP_INDEX_INPUT (1 << 30) -- cgit v1.2.3 From 28fa9451e1b3fe251923b0de352e34f84dbd6f4a Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Sat, 21 Aug 2010 13:28:38 +0200 Subject: nvfx: add option to dump shaders in TGSI and native code --- src/gallium/drivers/nvfx/nvfx_fragprog.c | 15 +++++++++++++++ src/gallium/drivers/nvfx/nvfx_vertprog.c | 23 +++++++++++++++-------- 2 files changed, 30 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/nvfx/nvfx_fragprog.c b/src/gallium/drivers/nvfx/nvfx_fragprog.c index 0a599c62a7..6d2957c82b 100644 --- a/src/gallium/drivers/nvfx/nvfx_fragprog.c +++ b/src/gallium/drivers/nvfx/nvfx_fragprog.c @@ -2,10 +2,12 @@ #include "pipe/p_defines.h" #include "pipe/p_state.h" #include "util/u_inlines.h" +#include "util/u_debug.h" #include "pipe/p_shader_tokens.h" #include "tgsi/tgsi_parse.h" #include "tgsi/tgsi_util.h" +#include "tgsi/tgsi_dump.h" #include "nvfx_context.h" #include "nvfx_shader.h" @@ -748,6 +750,8 @@ out_err: return FALSE; } +DEBUG_GET_ONCE_BOOL_OPTION(nvfx_dump_fp, "NVFX_DUMP_FP", FALSE) + static void nvfx_fragprog_translate(struct nvfx_context *nvfx, struct nvfx_fragment_program *fp) @@ -803,6 +807,17 @@ nvfx_fragprog_translate(struct nvfx_context *nvfx, fp->insn[fpc->inst_offset + 2] = 0x00000000; fp->insn[fpc->inst_offset + 3] = 0x00000000; + if(debug_get_option_nvfx_dump_fp()) + { + debug_printf("\n"); + tgsi_dump(fp->pipe.tokens, 0); + + debug_printf("\n%s fragment program:\n", nvfx->is_nv4x ? "nv4x" : "nv3x"); + for (unsigned i = 0; i < fp->insn_len; i += 4) + debug_printf("%3u: %08x %08x %08x %08x\n", i >> 2, fp->insn[i], fp->insn[i + 1], fp->insn[i + 2], fp->insn[i + 3]); + debug_printf("\n"); + } + fp->translated = TRUE; out_err: tgsi_parse_free(&parse); diff --git a/src/gallium/drivers/nvfx/nvfx_vertprog.c b/src/gallium/drivers/nvfx/nvfx_vertprog.c index 3d2f2b9fba..359bc01341 100644 --- a/src/gallium/drivers/nvfx/nvfx_vertprog.c +++ b/src/gallium/drivers/nvfx/nvfx_vertprog.c @@ -2,6 +2,7 @@ #include "pipe/p_defines.h" #include "pipe/p_state.h" #include "util/u_linkage.h" +#include "util/u_debug.h" #include "pipe/p_shader_tokens.h" #include "tgsi/tgsi_parse.h" @@ -777,6 +778,8 @@ nvfx_vertprog_prepare(struct nvfx_context* nvfx, struct nvfx_vpc *vpc) return TRUE; } +DEBUG_GET_ONCE_BOOL_OPTION(nvfx_dump_vp, "NVFX_DUMP_VP", FALSE) + static void nvfx_vertprog_translate(struct nvfx_context *nvfx, struct nvfx_vertex_program *vp) @@ -873,6 +876,18 @@ nvfx_vertprog_translate(struct nvfx_context *nvfx, } vp->insns[vp->nr_insns - 1].data[3] |= NVFX_VP_INST_LAST; + + if(debug_get_option_nvfx_dump_vp()) + { + debug_printf("\n"); + tgsi_dump(vp->pipe.tokens, 0); + + debug_printf("\n%s vertex program:\n", nvfx->is_nv4x ? "nv4x" : "nv3x"); + for (i = 0; i < vp->nr_insns; i++) + debug_printf("%3u: %08x %08x %08x %08x\n", i, vp->insns[i].data[0], vp->insns[i].data[1], vp->insns[i].data[2], vp->insns[i].data[3]); + debug_printf("\n"); + } + vp->translated = TRUE; out_err: tgsi_parse_free(&parse); @@ -1025,14 +1040,6 @@ nvfx_vertprog_validate(struct nvfx_context *nvfx) /* Upload vtxprog */ if (upload_code) { -#if 0 - for (i = 0; i < vp->nr_insns; i++) { - NOUVEAU_MSG("VP %d: 0x%08x\n", i, vp->insns[i].data[0]); - NOUVEAU_MSG("VP %d: 0x%08x\n", i, vp->insns[i].data[1]); - NOUVEAU_MSG("VP %d: 0x%08x\n", i, vp->insns[i].data[2]); - NOUVEAU_MSG("VP %d: 0x%08x\n", i, vp->insns[i].data[3]); - } -#endif BEGIN_RING(chan, eng3d, NV34TCL_VP_UPLOAD_FROM_ID, 1); OUT_RING (chan, vp->exec->start); for (i = 0; i < vp->nr_insns; i++) { -- cgit v1.2.3 From cf0d15642289f0a4b8d40e61266c89fe09d6601b Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Sat, 21 Aug 2010 12:32:59 +0200 Subject: nvfx: refactor shader assembler --- src/gallium/drivers/nvfx/nvfx_fragprog.c | 364 +++++++++++++++---------------- src/gallium/drivers/nvfx/nvfx_shader.h | 116 ++++++---- src/gallium/drivers/nvfx/nvfx_vertprog.c | 237 ++++++++++---------- 3 files changed, 357 insertions(+), 360 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/nvfx/nvfx_fragprog.c b/src/gallium/drivers/nvfx/nvfx_fragprog.c index 6d2957c82b..f8c4eae387 100644 --- a/src/gallium/drivers/nvfx/nvfx_fragprog.c +++ b/src/gallium/drivers/nvfx/nvfx_fragprog.c @@ -20,8 +20,8 @@ struct nvfx_fpc { unsigned r_temps; unsigned r_temps_discard; - struct nvfx_sreg r_result[PIPE_MAX_SHADER_OUTPUTS]; - struct nvfx_sreg *r_temp; + struct nvfx_reg r_result[PIPE_MAX_SHADER_OUTPUTS]; + struct nvfx_reg *r_temp; int num_regs; @@ -34,13 +34,13 @@ struct nvfx_fpc { } consts[MAX_CONSTS]; int nr_consts; - struct nvfx_sreg imm[MAX_IMM]; + struct nvfx_reg imm[MAX_IMM]; unsigned nr_imm; unsigned char generic_to_slot[256]; /* semantic idx for each input semantic */ }; -static INLINE struct nvfx_sreg +static INLINE struct nvfx_reg temp(struct nvfx_fpc *fpc) { int idx = ffs(~fpc->r_temps) - 1; @@ -48,12 +48,12 @@ temp(struct nvfx_fpc *fpc) if (idx < 0) { NOUVEAU_ERR("out of temps!!\n"); assert(0); - return nvfx_sr(NVFXSR_TEMP, 0); + return nvfx_reg(NVFXSR_TEMP, 0); } fpc->r_temps |= (1 << idx); fpc->r_temps_discard |= (1 << idx); - return nvfx_sr(NVFXSR_TEMP, idx); + return nvfx_reg(NVFXSR_TEMP, idx); } static INLINE void @@ -63,7 +63,7 @@ release_temps(struct nvfx_fpc *fpc) fpc->r_temps_discard = 0; } -static INLINE struct nvfx_sreg +static INLINE struct nvfx_reg constant(struct nvfx_fpc *fpc, int pipe, float vals[4]) { int idx; @@ -75,16 +75,9 @@ constant(struct nvfx_fpc *fpc, int pipe, float vals[4]) fpc->consts[idx].pipe = pipe; if (pipe == -1) memcpy(fpc->consts[idx].vals, vals, 4 * sizeof(float)); - return nvfx_sr(NVFXSR_CONST, idx); + return nvfx_reg(NVFXSR_CONST, idx); } -#define arith(cc,s,o,d,m,s0,s1,s2) \ - nvfx_fp_arith((cc), (s), NVFX_FP_OP_OPCODE_##o, \ - (d), (m), (s0), (s1), (s2)) -#define tex(cc,s,o,u,d,m,s0,s1,s2) \ - nvfx_fp_tex((cc), (s), NVFX_FP_OP_OPCODE_##o, (u), \ - (d), (m), (s0), none, none) - static void grow_insns(struct nvfx_fpc *fpc, int size) { @@ -95,28 +88,28 @@ grow_insns(struct nvfx_fpc *fpc, int size) } static void -emit_src(struct nvfx_fpc *fpc, int pos, struct nvfx_sreg src) +emit_src(struct nvfx_fpc *fpc, int pos, struct nvfx_src src) { struct nvfx_fragment_program *fp = fpc->fp; uint32_t *hw = &fp->insn[fpc->inst_offset]; uint32_t sr = 0; - switch (src.type) { + switch (src.reg.type) { case NVFXSR_INPUT: sr |= (NVFX_FP_REG_TYPE_INPUT << NVFX_FP_REG_TYPE_SHIFT); - hw[0] |= (src.index << NVFX_FP_OP_INPUT_SRC_SHIFT); + hw[0] |= (src.reg.index << NVFX_FP_OP_INPUT_SRC_SHIFT); break; case NVFXSR_OUTPUT: sr |= NVFX_FP_REG_SRC_HALF; /* fall-through */ case NVFXSR_TEMP: sr |= (NVFX_FP_REG_TYPE_TEMP << NVFX_FP_REG_TYPE_SHIFT); - sr |= (src.index << NVFX_FP_REG_SRC_SHIFT); + sr |= (src.reg.index << NVFX_FP_REG_SRC_SHIFT); break; case NVFXSR_RELOCATED: sr |= (NVFX_FP_REG_TYPE_INPUT << NVFX_FP_REG_TYPE_SHIFT); //printf("adding relocation at %x for %x\n", fpc->inst_offset, src.index); - util_dynarray_append(&fpc->fp->slot_relocations[src.index], unsigned, fpc->inst_offset); + util_dynarray_append(&fpc->fp->slot_relocations[src.reg.index], unsigned, fpc->inst_offset); break; case NVFXSR_CONST: if (!fpc->have_const) { @@ -125,18 +118,18 @@ emit_src(struct nvfx_fpc *fpc, int pos, struct nvfx_sreg src) } hw = &fp->insn[fpc->inst_offset]; - if (fpc->consts[src.index].pipe >= 0) { + if (fpc->consts[src.reg.index].pipe >= 0) { struct nvfx_fragment_program_data *fpd; fp->consts = realloc(fp->consts, ++fp->nr_consts * sizeof(*fpd)); fpd = &fp->consts[fp->nr_consts - 1]; fpd->offset = fpc->inst_offset + 4; - fpd->index = fpc->consts[src.index].pipe; + fpd->index = fpc->consts[src.reg.index].pipe; memset(&fp->insn[fpd->offset], 0, sizeof(uint32_t) * 4); } else { memcpy(&fp->insn[fpc->inst_offset + 4], - fpc->consts[src.index].vals, + fpc->consts[src.reg.index].vals, sizeof(uint32_t) * 4); } @@ -164,7 +157,7 @@ emit_src(struct nvfx_fpc *fpc, int pos, struct nvfx_sreg src) } static void -emit_dst(struct nvfx_fpc *fpc, struct nvfx_sreg dst) +emit_dst(struct nvfx_fpc *fpc, struct nvfx_reg dst) { struct nvfx_fragment_program *fp = fpc->fp; uint32_t *hw = &fp->insn[fpc->inst_offset]; @@ -192,9 +185,7 @@ emit_dst(struct nvfx_fpc *fpc, struct nvfx_sreg dst) } static void -nvfx_fp_arith(struct nvfx_fpc *fpc, int sat, int op, - struct nvfx_sreg dst, int mask, - struct nvfx_sreg s0, struct nvfx_sreg s1, struct nvfx_sreg s2) +nvfx_fp_emit(struct nvfx_fpc *fpc, struct nvfx_insn insn) { struct nvfx_fragment_program *fp = fpc->fp; uint32_t *hw; @@ -205,85 +196,86 @@ nvfx_fp_arith(struct nvfx_fpc *fpc, int sat, int op, hw = &fp->insn[fpc->inst_offset]; memset(hw, 0, sizeof(uint32_t) * 4); - if (op == NVFX_FP_OP_OPCODE_KIL) + if (insn.op == NVFX_FP_OP_OPCODE_KIL) fp->fp_control |= NV34TCL_FP_CONTROL_USES_KIL; - hw[0] |= (op << NVFX_FP_OP_OPCODE_SHIFT); - hw[0] |= (mask << NVFX_FP_OP_OUTMASK_SHIFT); - hw[2] |= (dst.dst_scale << NVFX_FP_OP_DST_SCALE_SHIFT); + hw[0] |= (insn.op << NVFX_FP_OP_OPCODE_SHIFT); + hw[0] |= (insn.mask << NVFX_FP_OP_OUTMASK_SHIFT); + hw[2] |= (insn.scale << NVFX_FP_OP_DST_SCALE_SHIFT); - if (sat) + if (insn.sat) hw[0] |= NVFX_FP_OP_OUT_SAT; - if (dst.cc_update) + if (insn.cc_update) hw[0] |= NVFX_FP_OP_COND_WRITE_ENABLE; - hw[1] |= (dst.cc_test << NVFX_FP_OP_COND_SHIFT); - hw[1] |= ((dst.cc_swz[0] << NVFX_FP_OP_COND_SWZ_X_SHIFT) | - (dst.cc_swz[1] << NVFX_FP_OP_COND_SWZ_Y_SHIFT) | - (dst.cc_swz[2] << NVFX_FP_OP_COND_SWZ_Z_SHIFT) | - (dst.cc_swz[3] << NVFX_FP_OP_COND_SWZ_W_SHIFT)); - - emit_dst(fpc, dst); - emit_src(fpc, 0, s0); - emit_src(fpc, 1, s1); - emit_src(fpc, 2, s2); -} + hw[1] |= (insn.cc_test << NVFX_FP_OP_COND_SHIFT); + hw[1] |= ((insn.cc_swz[0] << NVFX_FP_OP_COND_SWZ_X_SHIFT) | + (insn.cc_swz[1] << NVFX_FP_OP_COND_SWZ_Y_SHIFT) | + (insn.cc_swz[2] << NVFX_FP_OP_COND_SWZ_Z_SHIFT) | + (insn.cc_swz[3] << NVFX_FP_OP_COND_SWZ_W_SHIFT)); -static void -nvfx_fp_tex(struct nvfx_fpc *fpc, int sat, int op, int unit, - struct nvfx_sreg dst, int mask, - struct nvfx_sreg s0, struct nvfx_sreg s1, struct nvfx_sreg s2) -{ - struct nvfx_fragment_program *fp = fpc->fp; - - nvfx_fp_arith(fpc, sat, op, dst, mask, s0, s1, s2); + if(insn.unit >= 0) + { + hw[0] |= (insn.unit << NVFX_FP_OP_TEX_UNIT_SHIFT); + fp->samplers |= (1 << insn.unit); + } - fp->insn[fpc->inst_offset] |= (unit << NVFX_FP_OP_TEX_UNIT_SHIFT); - fp->samplers |= (1 << unit); + emit_dst(fpc, insn.dst); + emit_src(fpc, 0, insn.src[0]); + emit_src(fpc, 1, insn.src[1]); + emit_src(fpc, 2, insn.src[2]); } -static INLINE struct nvfx_sreg +#define arith(s,o,d,m,s0,s1,s2) \ + nvfx_insn((s), NVFX_FP_OP_OPCODE_##o, -1, \ + (d), (m), (s0), (s1), (s2)) + +#define tex(s,o,u,d,m,s0,s1,s2) \ + nvfx_insn((s), NVFX_FP_OP_OPCODE_##o, (u), \ + (d), (m), (s0), none, none) + +static INLINE struct nvfx_src tgsi_src(struct nvfx_fpc *fpc, const struct tgsi_full_src_register *fsrc) { - struct nvfx_sreg src = { 0 }; + struct nvfx_src src; switch (fsrc->Register.File) { case TGSI_FILE_INPUT: if(fpc->fp->info.input_semantic_name[fsrc->Register.Index] == TGSI_SEMANTIC_POSITION) { assert(fpc->fp->info.input_semantic_index[fsrc->Register.Index] == 0); - src = nvfx_sr(NVFXSR_INPUT, NVFX_FP_OP_INPUT_SRC_POSITION); + src.reg = nvfx_reg(NVFXSR_INPUT, NVFX_FP_OP_INPUT_SRC_POSITION); } else if(fpc->fp->info.input_semantic_name[fsrc->Register.Index] == TGSI_SEMANTIC_COLOR) { if(fpc->fp->info.input_semantic_index[fsrc->Register.Index] == 0) - src = nvfx_sr(NVFXSR_INPUT, NVFX_FP_OP_INPUT_SRC_COL0); + src.reg = nvfx_reg(NVFXSR_INPUT, NVFX_FP_OP_INPUT_SRC_COL0); else if(fpc->fp->info.input_semantic_index[fsrc->Register.Index] == 1) - src = nvfx_sr(NVFXSR_INPUT, NVFX_FP_OP_INPUT_SRC_COL1); + src.reg = nvfx_reg(NVFXSR_INPUT, NVFX_FP_OP_INPUT_SRC_COL1); else assert(0); } else if(fpc->fp->info.input_semantic_name[fsrc->Register.Index] == TGSI_SEMANTIC_FOG) { assert(fpc->fp->info.input_semantic_index[fsrc->Register.Index] == 0); - src = nvfx_sr(NVFXSR_INPUT, NVFX_FP_OP_INPUT_SRC_FOGC); + src.reg = nvfx_reg(NVFXSR_INPUT, NVFX_FP_OP_INPUT_SRC_FOGC); } else if(fpc->fp->info.input_semantic_name[fsrc->Register.Index] == TGSI_SEMANTIC_FACE) { /* TODO: check this has the correct values */ /* XXX: what do we do for nv30 here (assuming it lacks facing)?! */ assert(fpc->fp->info.input_semantic_index[fsrc->Register.Index] == 0); - src = nvfx_sr(NVFXSR_INPUT, NV40_FP_OP_INPUT_SRC_FACING); + src.reg = nvfx_reg(NVFXSR_INPUT, NV40_FP_OP_INPUT_SRC_FACING); } else { assert(fpc->fp->info.input_semantic_name[fsrc->Register.Index] == TGSI_SEMANTIC_GENERIC); - src = nvfx_sr(NVFXSR_RELOCATED, fpc->generic_to_slot[fpc->fp->info.input_semantic_index[fsrc->Register.Index]]); + src.reg = nvfx_reg(NVFXSR_RELOCATED, fpc->generic_to_slot[fpc->fp->info.input_semantic_index[fsrc->Register.Index]]); } break; case TGSI_FILE_CONSTANT: - src = constant(fpc, fsrc->Register.Index, NULL); + src.reg = constant(fpc, fsrc->Register.Index, NULL); break; case TGSI_FILE_IMMEDIATE: assert(fsrc->Register.Index < fpc->nr_imm); - src = fpc->imm[fsrc->Register.Index]; + src.reg = fpc->imm[fsrc->Register.Index]; break; case TGSI_FILE_TEMPORARY: - src = fpc->r_temp[fsrc->Register.Index]; + src.reg = fpc->r_temp[fsrc->Register.Index]; break; /* NV40 fragprog result regs are just temps, so this is simple */ case TGSI_FILE_OUTPUT: - src = fpc->r_result[fsrc->Register.Index]; + src.reg = fpc->r_result[fsrc->Register.Index]; break; default: NOUVEAU_ERR("bad src file\n"); @@ -299,7 +291,7 @@ tgsi_src(struct nvfx_fpc *fpc, const struct tgsi_full_src_register *fsrc) return src; } -static INLINE struct nvfx_sreg +static INLINE struct nvfx_reg tgsi_dst(struct nvfx_fpc *fpc, const struct tgsi_full_dst_register *fdst) { switch (fdst->Register.File) { case TGSI_FILE_OUTPUT: @@ -307,10 +299,10 @@ tgsi_dst(struct nvfx_fpc *fpc, const struct tgsi_full_dst_register *fdst) { case TGSI_FILE_TEMPORARY: return fpc->r_temp[fdst->Register.Index]; case TGSI_FILE_NULL: - return nvfx_sr(NVFXSR_NONE, 0); + return nvfx_reg(NVFXSR_NONE, 0); default: NOUVEAU_ERR("bad dst file %d\n", fdst->Register.File); - return nvfx_sr(NVFXSR_NONE, 0); + return nvfx_reg(NVFXSR_NONE, 0); } } @@ -330,8 +322,10 @@ static boolean nvfx_fragprog_parse_instruction(struct nvfx_context* nvfx, struct nvfx_fpc *fpc, const struct tgsi_full_instruction *finst) { - const struct nvfx_sreg none = nvfx_sr(NVFXSR_NONE, 0); - struct nvfx_sreg src[3], dst, tmp; + const struct nvfx_src none = nvfx_src(nvfx_reg(NVFXSR_NONE, 0)); + struct nvfx_insn insn; + struct nvfx_src src[3], tmp; + struct nvfx_reg dst; int mask, sat, unit = 0; int ai = -1, ci = -1, ii = -1; int i; @@ -359,9 +353,8 @@ nvfx_fragprog_parse_instruction(struct nvfx_context* nvfx, struct nvfx_fpc *fpc, ai = fsrc->Register.Index; src[i] = tgsi_src(fpc, fsrc); } else { - src[i] = temp(fpc); - arith(fpc, 0, MOV, src[i], NVFX_FP_MASK_ALL, - tgsi_src(fpc, fsrc), none, none); + src[i] = nvfx_src(temp(fpc)); + nvfx_fp_emit(fpc, arith(0, MOV, src[i].reg, NVFX_FP_MASK_ALL, tgsi_src(fpc, fsrc), none, none)); } break; case TGSI_FILE_CONSTANT: @@ -370,9 +363,8 @@ nvfx_fragprog_parse_instruction(struct nvfx_context* nvfx, struct nvfx_fpc *fpc, ci = fsrc->Register.Index; src[i] = tgsi_src(fpc, fsrc); } else { - src[i] = temp(fpc); - arith(fpc, 0, MOV, src[i], NVFX_FP_MASK_ALL, - tgsi_src(fpc, fsrc), none, none); + src[i] = nvfx_src(temp(fpc)); + nvfx_fp_emit(fpc, arith(0, MOV, src[i].reg, NVFX_FP_MASK_ALL, tgsi_src(fpc, fsrc), none, none)); } break; case TGSI_FILE_IMMEDIATE: @@ -381,9 +373,8 @@ nvfx_fragprog_parse_instruction(struct nvfx_context* nvfx, struct nvfx_fpc *fpc, ii = fsrc->Register.Index; src[i] = tgsi_src(fpc, fsrc); } else { - src[i] = temp(fpc); - arith(fpc, 0, MOV, src[i], NVFX_FP_MASK_ALL, - tgsi_src(fpc, fsrc), none, none); + src[i] = nvfx_src(temp(fpc)); + nvfx_fp_emit(fpc, arith(0, MOV, src[i].reg, NVFX_FP_MASK_ALL, tgsi_src(fpc, fsrc), none, none)); } break; case TGSI_FILE_TEMPORARY: @@ -406,227 +397,212 @@ nvfx_fragprog_parse_instruction(struct nvfx_context* nvfx, struct nvfx_fpc *fpc, switch (finst->Instruction.Opcode) { case TGSI_OPCODE_ABS: - arith(fpc, sat, MOV, dst, mask, abs(src[0]), none, none); + nvfx_fp_emit(fpc, arith(sat, MOV, dst, mask, abs(src[0]), none, none)); break; case TGSI_OPCODE_ADD: - arith(fpc, sat, ADD, dst, mask, src[0], src[1], none); + nvfx_fp_emit(fpc, arith(sat, ADD, dst, mask, src[0], src[1], none)); break; case TGSI_OPCODE_CMP: - tmp = nvfx_sr(NVFXSR_NONE, 0); - tmp.cc_update = 1; - arith(fpc, 0, MOV, tmp, 0xf, src[0], none, none); - dst.cc_test = NVFX_COND_GE; - arith(fpc, sat, MOV, dst, mask, src[2], none, none); - dst.cc_test = NVFX_COND_LT; - arith(fpc, sat, MOV, dst, mask, src[1], none, none); + insn = arith(0, MOV, none.reg, 0xf, src[0], none, none); + insn.cc_update = 1; + nvfx_fp_emit(fpc, insn); + + insn = arith(sat, MOV, dst, mask, src[2], none, none); + insn.cc_test = NVFX_COND_GE; + nvfx_fp_emit(fpc, insn); + + insn = arith(sat, MOV, dst, mask, src[1], none, none); + insn.cc_test = NVFX_COND_LT; + nvfx_fp_emit(fpc, insn); break; case TGSI_OPCODE_COS: - arith(fpc, sat, COS, dst, mask, src[0], none, none); + nvfx_fp_emit(fpc, arith(sat, COS, dst, mask, src[0], none, none)); break; case TGSI_OPCODE_DDX: if (mask & (NVFX_FP_MASK_Z | NVFX_FP_MASK_W)) { - tmp = temp(fpc); - arith(fpc, sat, DDX, tmp, NVFX_FP_MASK_X | NVFX_FP_MASK_Y, - swz(src[0], Z, W, Z, W), none, none); - arith(fpc, 0, MOV, tmp, NVFX_FP_MASK_Z | NVFX_FP_MASK_W, - swz(tmp, X, Y, X, Y), none, none); - arith(fpc, sat, DDX, tmp, NVFX_FP_MASK_X | NVFX_FP_MASK_Y, src[0], - none, none); - arith(fpc, 0, MOV, dst, mask, tmp, none, none); + tmp = nvfx_src(temp(fpc)); + nvfx_fp_emit(fpc, arith(sat, DDX, tmp.reg, NVFX_FP_MASK_X | NVFX_FP_MASK_Y, swz(src[0], Z, W, Z, W), none, none)); + nvfx_fp_emit(fpc, arith(0, MOV, tmp.reg, NVFX_FP_MASK_Z | NVFX_FP_MASK_W, swz(tmp, X, Y, X, Y), none, none)); + nvfx_fp_emit(fpc, arith(sat, DDX, tmp.reg, NVFX_FP_MASK_X | NVFX_FP_MASK_Y, src[0], none, none)); + nvfx_fp_emit(fpc, arith(0, MOV, dst, mask, tmp, none, none)); } else { - arith(fpc, sat, DDX, dst, mask, src[0], none, none); + nvfx_fp_emit(fpc, arith(sat, DDX, dst, mask, src[0], none, none)); } break; case TGSI_OPCODE_DDY: if (mask & (NVFX_FP_MASK_Z | NVFX_FP_MASK_W)) { - tmp = temp(fpc); - arith(fpc, sat, DDY, tmp, NVFX_FP_MASK_X | NVFX_FP_MASK_Y, - swz(src[0], Z, W, Z, W), none, none); - arith(fpc, 0, MOV, tmp, NVFX_FP_MASK_Z | NVFX_FP_MASK_W, - swz(tmp, X, Y, X, Y), none, none); - arith(fpc, sat, DDY, tmp, NVFX_FP_MASK_X | NVFX_FP_MASK_Y, src[0], - none, none); - arith(fpc, 0, MOV, dst, mask, tmp, none, none); + tmp = nvfx_src(temp(fpc)); + nvfx_fp_emit(fpc, arith(sat, DDY, tmp.reg, NVFX_FP_MASK_X | NVFX_FP_MASK_Y, swz(src[0], Z, W, Z, W), none, none)); + nvfx_fp_emit(fpc, arith(0, MOV, tmp.reg, NVFX_FP_MASK_Z | NVFX_FP_MASK_W, swz(tmp, X, Y, X, Y), none, none)); + nvfx_fp_emit(fpc, arith(sat, DDY, tmp.reg, NVFX_FP_MASK_X | NVFX_FP_MASK_Y, src[0], none, none)); + nvfx_fp_emit(fpc, arith(0, MOV, dst, mask, tmp, none, none)); } else { - arith(fpc, sat, DDY, dst, mask, src[0], none, none); + nvfx_fp_emit(fpc, arith(sat, DDY, dst, mask, src[0], none, none)); } break; case TGSI_OPCODE_DP3: - arith(fpc, sat, DP3, dst, mask, src[0], src[1], none); + nvfx_fp_emit(fpc, arith(sat, DP3, dst, mask, src[0], src[1], none)); break; case TGSI_OPCODE_DP4: - arith(fpc, sat, DP4, dst, mask, src[0], src[1], none); + nvfx_fp_emit(fpc, arith(sat, DP4, dst, mask, src[0], src[1], none)); break; case TGSI_OPCODE_DPH: - tmp = temp(fpc); - arith(fpc, 0, DP3, tmp, NVFX_FP_MASK_X, src[0], src[1], none); - arith(fpc, sat, ADD, dst, mask, swz(tmp, X, X, X, X), - swz(src[1], W, W, W, W), none); + tmp = nvfx_src(temp(fpc)); + nvfx_fp_emit(fpc, arith(0, DP3, tmp.reg, NVFX_FP_MASK_X, src[0], src[1], none)); + nvfx_fp_emit(fpc, arith(sat, ADD, dst, mask, swz(tmp, X, X, X, X), swz(src[1], W, W, W, W), none)); break; case TGSI_OPCODE_DST: - arith(fpc, sat, DST, dst, mask, src[0], src[1], none); + nvfx_fp_emit(fpc, arith(sat, DST, dst, mask, src[0], src[1], none)); break; case TGSI_OPCODE_EX2: - arith(fpc, sat, EX2, dst, mask, src[0], none, none); + nvfx_fp_emit(fpc, arith(sat, EX2, dst, mask, src[0], none, none)); break; case TGSI_OPCODE_FLR: - arith(fpc, sat, FLR, dst, mask, src[0], none, none); + nvfx_fp_emit(fpc, arith(sat, FLR, dst, mask, src[0], none, none)); break; case TGSI_OPCODE_FRC: - arith(fpc, sat, FRC, dst, mask, src[0], none, none); + nvfx_fp_emit(fpc, arith(sat, FRC, dst, mask, src[0], none, none)); break; case TGSI_OPCODE_KILP: - arith(fpc, 0, KIL, none, 0, none, none, none); + nvfx_fp_emit(fpc, arith(0, KIL, none.reg, 0, none, none, none)); break; case TGSI_OPCODE_KIL: - dst = nvfx_sr(NVFXSR_NONE, 0); - dst.cc_update = 1; - arith(fpc, 0, MOV, dst, NVFX_FP_MASK_ALL, src[0], none, none); - dst.cc_update = 0; dst.cc_test = NVFX_COND_LT; - arith(fpc, 0, KIL, dst, 0, none, none, none); + insn = arith(0, MOV, none.reg, NVFX_FP_MASK_ALL, src[0], none, none); + insn.cc_update = 1; + nvfx_fp_emit(fpc, insn); + + insn = arith(0, KIL, none.reg, 0, none, none, none); + insn.cc_test = NVFX_COND_LT; + nvfx_fp_emit(fpc, insn); break; case TGSI_OPCODE_LG2: - arith(fpc, sat, LG2, dst, mask, src[0], none, none); + nvfx_fp_emit(fpc, arith(sat, LG2, dst, mask, src[0], none, none)); break; // case TGSI_OPCODE_LIT: case TGSI_OPCODE_LRP: if(!nvfx->is_nv4x) - arith(fpc, sat, LRP_NV30, dst, mask, src[0], src[1], src[2]); + nvfx_fp_emit(fpc, arith(sat, LRP_NV30, dst, mask, src[0], src[1], src[2])); else { - tmp = temp(fpc); - arith(fpc, 0, MAD, tmp, mask, neg(src[0]), src[2], src[2]); - arith(fpc, sat, MAD, dst, mask, src[0], src[1], tmp); + tmp = nvfx_src(temp(fpc)); + nvfx_fp_emit(fpc, arith(0, MAD, tmp.reg, mask, neg(src[0]), src[2], src[2])); + nvfx_fp_emit(fpc, arith(sat, MAD, dst, mask, src[0], src[1], tmp)); } break; case TGSI_OPCODE_MAD: - arith(fpc, sat, MAD, dst, mask, src[0], src[1], src[2]); + nvfx_fp_emit(fpc, arith(sat, MAD, dst, mask, src[0], src[1], src[2])); break; case TGSI_OPCODE_MAX: - arith(fpc, sat, MAX, dst, mask, src[0], src[1], none); + nvfx_fp_emit(fpc, arith(sat, MAX, dst, mask, src[0], src[1], none)); break; case TGSI_OPCODE_MIN: - arith(fpc, sat, MIN, dst, mask, src[0], src[1], none); + nvfx_fp_emit(fpc, arith(sat, MIN, dst, mask, src[0], src[1], none)); break; case TGSI_OPCODE_MOV: - arith(fpc, sat, MOV, dst, mask, src[0], none, none); + nvfx_fp_emit(fpc, arith(sat, MOV, dst, mask, src[0], none, none)); break; case TGSI_OPCODE_MUL: - arith(fpc, sat, MUL, dst, mask, src[0], src[1], none); + nvfx_fp_emit(fpc, arith(sat, MUL, dst, mask, src[0], src[1], none)); break; case TGSI_OPCODE_POW: if(!nvfx->is_nv4x) - arith(fpc, sat, POW_NV30, dst, mask, src[0], src[1], none); + nvfx_fp_emit(fpc, arith(sat, POW_NV30, dst, mask, src[0], src[1], none)); else { - tmp = temp(fpc); - arith(fpc, 0, LG2, tmp, NVFX_FP_MASK_X, - swz(src[0], X, X, X, X), none, none); - arith(fpc, 0, MUL, tmp, NVFX_FP_MASK_X, swz(tmp, X, X, X, X), - swz(src[1], X, X, X, X), none); - arith(fpc, sat, EX2, dst, mask, - swz(tmp, X, X, X, X), none, none); + tmp = nvfx_src(temp(fpc)); + nvfx_fp_emit(fpc, arith(0, LG2, tmp.reg, NVFX_FP_MASK_X, swz(src[0], X, X, X, X), none, none)); + nvfx_fp_emit(fpc, arith(0, MUL, tmp.reg, NVFX_FP_MASK_X, swz(tmp, X, X, X, X), swz(src[1], X, X, X, X), none)); + nvfx_fp_emit(fpc, arith(sat, EX2, dst, mask, swz(tmp, X, X, X, X), none, none)); } break; case TGSI_OPCODE_RCP: - arith(fpc, sat, RCP, dst, mask, src[0], none, none); + nvfx_fp_emit(fpc, arith(sat, RCP, dst, mask, src[0], none, none)); break; case TGSI_OPCODE_RET: assert(0); break; case TGSI_OPCODE_RFL: if(!nvfx->is_nv4x) - arith(fpc, 0, RFL_NV30, dst, mask, src[0], src[1], none); + nvfx_fp_emit(fpc, arith(0, RFL_NV30, dst, mask, src[0], src[1], none)); else { - tmp = temp(fpc); - arith(fpc, 0, DP3, tmp, NVFX_FP_MASK_X, src[0], src[0], none); - arith(fpc, 0, DP3, tmp, NVFX_FP_MASK_Y, src[0], src[1], none); - arith(fpc, 0, DIV, scale(tmp, 2X), NVFX_FP_MASK_Z, - swz(tmp, Y, Y, Y, Y), swz(tmp, X, X, X, X), none); - arith(fpc, sat, MAD, dst, mask, - swz(tmp, Z, Z, Z, Z), src[0], neg(src[1])); + tmp = nvfx_src(temp(fpc)); + nvfx_fp_emit(fpc, arith(0, DP3, tmp.reg, NVFX_FP_MASK_X, src[0], src[0], none)); + nvfx_fp_emit(fpc, arith(0, DP3, tmp.reg, NVFX_FP_MASK_Y, src[0], src[1], none)); + insn = arith(0, DIV, tmp.reg, NVFX_FP_MASK_Z, swz(tmp, Y, Y, Y, Y), swz(tmp, X, X, X, X), none); + insn.scale = NVFX_FP_OP_DST_SCALE_2X; + nvfx_fp_emit(fpc, insn); + nvfx_fp_emit(fpc, arith(sat, MAD, dst, mask, swz(tmp, Z, Z, Z, Z), src[0], neg(src[1]))); } break; case TGSI_OPCODE_RSQ: if(!nvfx->is_nv4x) - arith(fpc, sat, RSQ_NV30, dst, mask, abs(swz(src[0], X, X, X, X)), none, none); + nvfx_fp_emit(fpc, arith(sat, RSQ_NV30, dst, mask, abs(swz(src[0], X, X, X, X)), none, none)); else { - tmp = temp(fpc); - arith(fpc, 0, LG2, scale(tmp, INV_2X), NVFX_FP_MASK_X, - abs(swz(src[0], X, X, X, X)), none, none); - arith(fpc, sat, EX2, dst, mask, - neg(swz(tmp, X, X, X, X)), none, none); + tmp = nvfx_src(temp(fpc)); + insn = arith(0, LG2, tmp.reg, NVFX_FP_MASK_X, abs(swz(src[0], X, X, X, X)), none, none); + insn.scale = NVFX_FP_OP_DST_SCALE_INV_2X; + nvfx_fp_emit(fpc, insn); + nvfx_fp_emit(fpc, arith(sat, EX2, dst, mask, neg(swz(tmp, X, X, X, X)), none, none)); } break; case TGSI_OPCODE_SCS: /* avoid overwriting the source */ if(src[0].swz[NVFX_SWZ_X] != NVFX_SWZ_X) { - if (mask & NVFX_FP_MASK_X) { - arith(fpc, sat, COS, dst, NVFX_FP_MASK_X, - swz(src[0], X, X, X, X), none, none); - } - if (mask & NVFX_FP_MASK_Y) { - arith(fpc, sat, SIN, dst, NVFX_FP_MASK_Y, - swz(src[0], X, X, X, X), none, none); - } + if (mask & NVFX_FP_MASK_X) + nvfx_fp_emit(fpc, arith(sat, COS, dst, NVFX_FP_MASK_X, swz(src[0], X, X, X, X), none, none)); + if (mask & NVFX_FP_MASK_Y) + nvfx_fp_emit(fpc, arith(sat, SIN, dst, NVFX_FP_MASK_Y, swz(src[0], X, X, X, X), none, none)); } else { - if (mask & NVFX_FP_MASK_Y) { - arith(fpc, sat, SIN, dst, NVFX_FP_MASK_Y, - swz(src[0], X, X, X, X), none, none); - } - if (mask & NVFX_FP_MASK_X) { - arith(fpc, sat, COS, dst, NVFX_FP_MASK_X, - swz(src[0], X, X, X, X), none, none); - } + if (mask & NVFX_FP_MASK_Y) + nvfx_fp_emit(fpc, arith(sat, SIN, dst, NVFX_FP_MASK_Y, swz(src[0], X, X, X, X), none, none)); + if (mask & NVFX_FP_MASK_X) + nvfx_fp_emit(fpc, arith(sat, COS, dst, NVFX_FP_MASK_X, swz(src[0], X, X, X, X), none, none)); } break; case TGSI_OPCODE_SEQ: - arith(fpc, sat, SEQ, dst, mask, src[0], src[1], none); + nvfx_fp_emit(fpc, arith(sat, SEQ, dst, mask, src[0], src[1], none)); break; case TGSI_OPCODE_SFL: - arith(fpc, sat, SFL, dst, mask, src[0], src[1], none); + nvfx_fp_emit(fpc, arith(sat, SFL, dst, mask, src[0], src[1], none)); break; case TGSI_OPCODE_SGE: - arith(fpc, sat, SGE, dst, mask, src[0], src[1], none); + nvfx_fp_emit(fpc, arith(sat, SGE, dst, mask, src[0], src[1], none)); break; case TGSI_OPCODE_SGT: - arith(fpc, sat, SGT, dst, mask, src[0], src[1], none); + nvfx_fp_emit(fpc, arith(sat, SGT, dst, mask, src[0], src[1], none)); break; case TGSI_OPCODE_SIN: - arith(fpc, sat, SIN, dst, mask, src[0], none, none); + nvfx_fp_emit(fpc, arith(sat, SIN, dst, mask, src[0], none, none)); break; case TGSI_OPCODE_SLE: - arith(fpc, sat, SLE, dst, mask, src[0], src[1], none); + nvfx_fp_emit(fpc, arith(sat, SLE, dst, mask, src[0], src[1], none)); break; case TGSI_OPCODE_SLT: - arith(fpc, sat, SLT, dst, mask, src[0], src[1], none); + nvfx_fp_emit(fpc, arith(sat, SLT, dst, mask, src[0], src[1], none)); break; case TGSI_OPCODE_SNE: - arith(fpc, sat, SNE, dst, mask, src[0], src[1], none); + nvfx_fp_emit(fpc, arith(sat, SNE, dst, mask, src[0], src[1], none)); break; case TGSI_OPCODE_STR: - arith(fpc, sat, STR, dst, mask, src[0], src[1], none); + nvfx_fp_emit(fpc, arith(sat, STR, dst, mask, src[0], src[1], none)); break; case TGSI_OPCODE_SUB: - arith(fpc, sat, ADD, dst, mask, src[0], neg(src[1]), none); + nvfx_fp_emit(fpc, arith(sat, ADD, dst, mask, src[0], neg(src[1]), none)); break; case TGSI_OPCODE_TEX: - tex(fpc, sat, TEX, unit, dst, mask, src[0], none, none); + nvfx_fp_emit(fpc, tex(sat, TEX, unit, dst, mask, src[0], none, none)); break; case TGSI_OPCODE_TXB: - tex(fpc, sat, TXB, unit, dst, mask, src[0], none, none); + nvfx_fp_emit(fpc, tex(sat, TXB, unit, dst, mask, src[0], none, none)); break; case TGSI_OPCODE_TXP: - tex(fpc, sat, TXP, unit, dst, mask, src[0], none, none); + nvfx_fp_emit(fpc, tex(sat, TXP, unit, dst, mask, src[0], none, none)); break; case TGSI_OPCODE_XPD: - tmp = temp(fpc); - arith(fpc, 0, MUL, tmp, mask, - swz(src[0], Z, X, Y, Y), swz(src[1], Y, Z, X, X), none); - arith(fpc, sat, MAD, dst, (mask & ~NVFX_FP_MASK_W), - swz(src[0], Y, Z, X, X), swz(src[1], Z, X, Y, Y), - neg(tmp)); + tmp = nvfx_src(temp(fpc)); + nvfx_fp_emit(fpc, arith(0, MUL, tmp.reg, mask, swz(src[0], Z, X, Y, Y), swz(src[1], Y, Z, X, X), none)); + nvfx_fp_emit(fpc, arith(sat, MAD, dst, (mask & ~NVFX_FP_MASK_W), swz(src[0], Y, Z, X, X), swz(src[1], Z, X, Y, Y), neg(tmp))); break; default: NOUVEAU_ERR("invalid opcode %d\n", finst->Instruction.Opcode); @@ -666,7 +642,7 @@ nvfx_fragprog_parse_decl_output(struct nvfx_context* nvfx, struct nvfx_fpc *fpc, return FALSE; } - fpc->r_result[idx] = nvfx_sr(NVFXSR_OUTPUT, hw); + fpc->r_result[idx] = nvfx_reg(NVFXSR_OUTPUT, hw); fpc->r_temps |= (1 << hw); return TRUE; } @@ -735,7 +711,7 @@ nvfx_fragprog_prepare(struct nvfx_context* nvfx, struct nvfx_fpc *fpc) tgsi_parse_free(&p); if (++high_temp) { - fpc->r_temp = CALLOC(high_temp, sizeof(struct nvfx_sreg)); + fpc->r_temp = CALLOC(high_temp, sizeof(struct nvfx_reg)); for (i = 0; i < high_temp; i++) fpc->r_temp[i] = temp(fpc); fpc->r_temps_discard = 0; diff --git a/src/gallium/drivers/nvfx/nvfx_shader.h b/src/gallium/drivers/nvfx/nvfx_shader.h index 59a439fc60..fcf577ca74 100644 --- a/src/gallium/drivers/nvfx/nvfx_shader.h +++ b/src/gallium/drivers/nvfx/nvfx_shader.h @@ -405,51 +405,88 @@ #define NVFX_SWZ_Z 2 #define NVFX_SWZ_W 3 -#define swz(s,x,y,z,w) nvfx_sr_swz((s), NVFX_SWZ_##x, NVFX_SWZ_##y, NVFX_SWZ_##z, NVFX_SWZ_##w) -#define neg(s) nvfx_sr_neg((s)) -#define abs(s) nvfx_sr_abs((s)) -#define scale(s,v) nvfx_sr_scale((s), NVFX_FP_OP_DST_SCALE_##v) - -struct nvfx_sreg { - int type; - int index; - - int dst_scale; - - int negate; - int abs; - int swz[4]; - - int cc_update; - int cc_update_reg; - int cc_test; - int cc_test_reg; - int cc_swz[4]; +#define swz(s,x,y,z,w) nvfx_src_swz((s), NVFX_SWZ_##x, NVFX_SWZ_##y, NVFX_SWZ_##z, NVFX_SWZ_##w) +#define neg(s) nvfx_src_neg((s)) +#define abs(s) nvfx_src_abs((s)) + +struct nvfx_reg { + uint8_t type; + uint32_t index; +}; + +struct nvfx_src { + struct nvfx_reg reg; + + /* src only */ + uint8_t negate : 1; + uint8_t abs : 1; + uint8_t swz[4]; }; -static INLINE struct nvfx_sreg -nvfx_sr(int type, int index) +struct nvfx_insn { - struct nvfx_sreg temp = { - .type = type, - .index = index, - .dst_scale = 0, - .abs = 0, - .negate = 0, - .swz = { 0, 1, 2, 3 }, + uint8_t op; + char scale; + int8_t unit; + uint8_t mask; + uint8_t cc_swz[4]; + + uint8_t sat : 1; + uint8_t cc_update : 1; + uint8_t cc_update_reg : 1; + uint8_t cc_test : 3; + uint8_t cc_test_reg : 1; + + struct nvfx_reg dst; + struct nvfx_src src[3]; +}; + +static INLINE struct nvfx_insn +nvfx_insn(boolean sat, unsigned op, int unit, struct nvfx_reg dst, unsigned mask, struct nvfx_src s0, struct nvfx_src s1, struct nvfx_src s2) +{ + struct nvfx_insn insn = { + .op = op, + .scale = 0, + .unit = unit, + .sat = sat, + .mask = mask, .cc_update = 0, .cc_update_reg = 0, .cc_test = NVFX_COND_TR, .cc_test_reg = 0, .cc_swz = { 0, 1, 2, 3 }, + .dst = dst, + .src = {s0, s1, s2} + }; + return insn; +} + +static INLINE struct nvfx_reg +nvfx_reg(int type, int index) +{ + struct nvfx_reg temp = { + .type = type, + .index = index, }; return temp; } -static INLINE struct nvfx_sreg -nvfx_sr_swz(struct nvfx_sreg src, int x, int y, int z, int w) +static INLINE struct nvfx_src +nvfx_src(struct nvfx_reg reg) { - struct nvfx_sreg dst = src; + struct nvfx_src temp = { + .reg = reg, + .abs = 0, + .negate = 0, + .swz = { 0, 1, 2, 3 }, + }; + return temp; +} + +static INLINE struct nvfx_src +nvfx_src_swz(struct nvfx_src src, int x, int y, int z, int w) +{ + struct nvfx_src dst = src; dst.swz[NVFX_SWZ_X] = src.swz[x]; dst.swz[NVFX_SWZ_Y] = src.swz[y]; @@ -458,25 +495,18 @@ nvfx_sr_swz(struct nvfx_sreg src, int x, int y, int z, int w) return dst; } -static INLINE struct nvfx_sreg -nvfx_sr_neg(struct nvfx_sreg src) +static INLINE struct nvfx_src +nvfx_src_neg(struct nvfx_src src) { src.negate = !src.negate; return src; } -static INLINE struct nvfx_sreg -nvfx_sr_abs(struct nvfx_sreg src) +static INLINE struct nvfx_src +nvfx_src_abs(struct nvfx_src src) { src.abs = 1; return src; } -static INLINE struct nvfx_sreg -nvfx_sr_scale(struct nvfx_sreg src, int scale) -{ - src.dst_scale = scale; - return src; -} - #endif diff --git a/src/gallium/drivers/nvfx/nvfx_vertprog.c b/src/gallium/drivers/nvfx/nvfx_vertprog.c index 359bc01341..416e1b4d45 100644 --- a/src/gallium/drivers/nvfx/nvfx_vertprog.c +++ b/src/gallium/drivers/nvfx/nvfx_vertprog.c @@ -30,23 +30,24 @@ #define NVFX_VP_INST_DEST_CLIP(n) ((~0 - 6) + (n)) struct nvfx_vpc { + struct nvfx_context* nvfx; struct nvfx_vertex_program *vp; struct nvfx_vertex_program_exec *vpi; unsigned r_temps; unsigned r_temps_discard; - struct nvfx_sreg r_result[PIPE_MAX_SHADER_OUTPUTS]; - struct nvfx_sreg *r_address; - struct nvfx_sreg *r_temp; + struct nvfx_reg r_result[PIPE_MAX_SHADER_OUTPUTS]; + struct nvfx_reg *r_address; + struct nvfx_reg *r_temp; - struct nvfx_sreg *imm; + struct nvfx_reg *imm; unsigned nr_imm; unsigned hpos_idx; }; -static struct nvfx_sreg +static struct nvfx_reg temp(struct nvfx_vpc *vpc) { int idx = ffs(~vpc->r_temps) - 1; @@ -54,12 +55,12 @@ temp(struct nvfx_vpc *vpc) if (idx < 0) { NOUVEAU_ERR("out of temps!!\n"); assert(0); - return nvfx_sr(NVFXSR_TEMP, 0); + return nvfx_reg(NVFXSR_TEMP, 0); } vpc->r_temps |= (1 << idx); vpc->r_temps_discard |= (1 << idx); - return nvfx_sr(NVFXSR_TEMP, idx); + return nvfx_reg(NVFXSR_TEMP, idx); } static inline void @@ -69,7 +70,7 @@ release_temps(struct nvfx_vpc *vpc) vpc->r_temps_discard = 0; } -static struct nvfx_sreg +static struct nvfx_reg constant(struct nvfx_vpc *vpc, int pipe, float x, float y, float z, float w) { struct nvfx_vertex_program *vp = vpc->vp; @@ -79,7 +80,7 @@ constant(struct nvfx_vpc *vpc, int pipe, float x, float y, float z, float w) if (pipe >= 0) { for (idx = 0; idx < vp->nr_consts; idx++) { if (vp->consts[idx].index == pipe) - return nvfx_sr(NVFXSR_CONST, idx); + return nvfx_reg(NVFXSR_CONST, idx); } } @@ -92,35 +93,35 @@ constant(struct nvfx_vpc *vpc, int pipe, float x, float y, float z, float w) vpd->value[1] = y; vpd->value[2] = z; vpd->value[3] = w; - return nvfx_sr(NVFXSR_CONST, idx); + return nvfx_reg(NVFXSR_CONST, idx); } -#define arith(cc,s,o,d,m,s0,s1,s2) \ - nvfx_vp_arith(nvfx, (cc), NVFX_VP_INST_SLOT_##s, NVFX_VP_INST_##s##_OP_##o, (d), (m), (s0), (s1), (s2)) +#define arith(s,o,d,m,s0,s1,s2) \ + nvfx_insn(0, (NVFX_VP_INST_SLOT_##s << 7) | NVFX_VP_INST_##s##_OP_##o, -1, (d), (m), (s0), (s1), (s2)) static void -emit_src(struct nvfx_context* nvfx, struct nvfx_vpc *vpc, uint32_t *hw, int pos, struct nvfx_sreg src) +emit_src(struct nvfx_context* nvfx, struct nvfx_vpc *vpc, uint32_t *hw, int pos, struct nvfx_src src) { struct nvfx_vertex_program *vp = vpc->vp; uint32_t sr = 0; - switch (src.type) { + switch (src.reg.type) { case NVFXSR_TEMP: sr |= (NVFX_VP(SRC_REG_TYPE_TEMP) << NVFX_VP(SRC_REG_TYPE_SHIFT)); - sr |= (src.index << NVFX_VP(SRC_TEMP_SRC_SHIFT)); + sr |= (src.reg.index << NVFX_VP(SRC_TEMP_SRC_SHIFT)); break; case NVFXSR_INPUT: sr |= (NVFX_VP(SRC_REG_TYPE_INPUT) << NVFX_VP(SRC_REG_TYPE_SHIFT)); - vp->ir |= (1 << src.index); - hw[1] |= (src.index << NVFX_VP(INST_INPUT_SRC_SHIFT)); + vp->ir |= (1 << src.reg.index); + hw[1] |= (src.reg.index << NVFX_VP(INST_INPUT_SRC_SHIFT)); break; case NVFXSR_CONST: sr |= (NVFX_VP(SRC_REG_TYPE_CONST) << NVFX_VP(SRC_REG_TYPE_SHIFT)); assert(vpc->vpi->const_index == -1 || - vpc->vpi->const_index == src.index); - vpc->vpi->const_index = src.index; + vpc->vpi->const_index == src.reg.index); + vpc->vpi->const_index = src.reg.index; break; case NVFXSR_NONE: sr |= (NVFX_VP(SRC_REG_TYPE_INPUT) << @@ -163,7 +164,7 @@ emit_src(struct nvfx_context* nvfx, struct nvfx_vpc *vpc, uint32_t *hw, int pos, } static void -emit_dst(struct nvfx_context* nvfx, struct nvfx_vpc *vpc, uint32_t *hw, int slot, struct nvfx_sreg dst) +emit_dst(struct nvfx_context* nvfx, struct nvfx_vpc *vpc, uint32_t *hw, int slot, struct nvfx_reg dst) { struct nvfx_vertex_program *vp = vpc->vp; @@ -173,13 +174,10 @@ emit_dst(struct nvfx_context* nvfx, struct nvfx_vpc *vpc, uint32_t *hw, int slot hw[0] |= (dst.index << NV30_VP_INST_DEST_TEMP_ID_SHIFT); else { hw[3] |= NV40_VP_INST_DEST_MASK; - if (slot == 0) { - hw[0] |= (dst.index << - NV40_VP_INST_VEC_DEST_TEMP_SHIFT); - } else { - hw[3] |= (dst.index << - NV40_VP_INST_SCA_DEST_TEMP_SHIFT); - } + if (slot == 0) + hw[0] |= (dst.index << NV40_VP_INST_VEC_DEST_TEMP_SHIFT); + else + hw[3] |= (dst.index << NV40_VP_INST_SCA_DEST_TEMP_SHIFT); } break; case NVFXSR_OUTPUT: @@ -279,12 +277,12 @@ emit_dst(struct nvfx_context* nvfx, struct nvfx_vpc *vpc, uint32_t *hw, int slot } static void -nvfx_vp_arith(struct nvfx_context* nvfx, struct nvfx_vpc *vpc, int slot, int op, - struct nvfx_sreg dst, int mask, - struct nvfx_sreg s0, struct nvfx_sreg s1, - struct nvfx_sreg s2) +nvfx_vp_emit(struct nvfx_vpc *vpc, struct nvfx_insn insn) { + struct nvfx_context* nvfx = vpc->nvfx; struct nvfx_vertex_program *vp = vpc->vp; + unsigned slot = insn.op >> 7; + unsigned op = insn.op & 0x7f; uint32_t *hw; vp->insns = realloc(vp->insns, ++vp->nr_insns * sizeof(*vpc->vpi)); @@ -311,51 +309,51 @@ nvfx_vp_arith(struct nvfx_context* nvfx, struct nvfx_vpc *vpc, int slot, int op, // hw[3] |= NVFX_VP(INST_SCA_DEST_TEMP_MASK); // hw[3] |= (mask << NVFX_VP(INST_VEC_WRITEMASK_SHIFT)); - if (dst.type == NVFXSR_OUTPUT) { + if (insn.dst.type == NVFXSR_OUTPUT) { if (slot) - hw[3] |= (mask << NV30_VP_INST_SDEST_WRITEMASK_SHIFT); + hw[3] |= (insn.mask << NV30_VP_INST_SDEST_WRITEMASK_SHIFT); else - hw[3] |= (mask << NV30_VP_INST_VDEST_WRITEMASK_SHIFT); + hw[3] |= (insn.mask << NV30_VP_INST_VDEST_WRITEMASK_SHIFT); } else { if (slot) - hw[3] |= (mask << NV30_VP_INST_STEMP_WRITEMASK_SHIFT); + hw[3] |= (insn.mask << NV30_VP_INST_STEMP_WRITEMASK_SHIFT); else - hw[3] |= (mask << NV30_VP_INST_VTEMP_WRITEMASK_SHIFT); + hw[3] |= (insn.mask << NV30_VP_INST_VTEMP_WRITEMASK_SHIFT); } } else { if (slot == 0) { hw[1] |= (op << NV40_VP_INST_VEC_OPCODE_SHIFT); hw[3] |= NV40_VP_INST_SCA_DEST_TEMP_MASK; - hw[3] |= (mask << NV40_VP_INST_VEC_WRITEMASK_SHIFT); + hw[3] |= (insn.mask << NV40_VP_INST_VEC_WRITEMASK_SHIFT); } else { hw[1] |= (op << NV40_VP_INST_SCA_OPCODE_SHIFT); hw[0] |= (NV40_VP_INST_VEC_DEST_TEMP_MASK | (1 << 20)); - hw[3] |= (mask << NV40_VP_INST_SCA_WRITEMASK_SHIFT); + hw[3] |= (insn.mask << NV40_VP_INST_SCA_WRITEMASK_SHIFT); } } - emit_dst(nvfx, vpc, hw, slot, dst); - emit_src(nvfx, vpc, hw, 0, s0); - emit_src(nvfx, vpc, hw, 1, s1); - emit_src(nvfx, vpc, hw, 2, s2); + emit_dst(nvfx, vpc, hw, slot, insn.dst); + emit_src(nvfx, vpc, hw, 0, insn.src[0]); + emit_src(nvfx, vpc, hw, 1, insn.src[1]); + emit_src(nvfx, vpc, hw, 2, insn.src[2]); } -static inline struct nvfx_sreg +static inline struct nvfx_src tgsi_src(struct nvfx_vpc *vpc, const struct tgsi_full_src_register *fsrc) { - struct nvfx_sreg src = { 0 }; + struct nvfx_src src; switch (fsrc->Register.File) { case TGSI_FILE_INPUT: - src = nvfx_sr(NVFXSR_INPUT, fsrc->Register.Index); + src.reg = nvfx_reg(NVFXSR_INPUT, fsrc->Register.Index); break; case TGSI_FILE_CONSTANT: - src = constant(vpc, fsrc->Register.Index, 0, 0, 0, 0); + src.reg = constant(vpc, fsrc->Register.Index, 0, 0, 0, 0); break; case TGSI_FILE_IMMEDIATE: - src = vpc->imm[fsrc->Register.Index]; + src.reg = vpc->imm[fsrc->Register.Index]; break; case TGSI_FILE_TEMPORARY: - src = vpc->r_temp[fsrc->Register.Index]; + src.reg = vpc->r_temp[fsrc->Register.Index]; break; default: NOUVEAU_ERR("bad src file\n"); @@ -371,9 +369,9 @@ tgsi_src(struct nvfx_vpc *vpc, const struct tgsi_full_src_register *fsrc) { return src; } -static INLINE struct nvfx_sreg +static INLINE struct nvfx_reg tgsi_dst(struct nvfx_vpc *vpc, const struct tgsi_full_dst_register *fdst) { - struct nvfx_sreg dst = { 0 }; + struct nvfx_reg dst; switch (fdst->Register.File) { case TGSI_FILE_OUTPUT: @@ -409,8 +407,9 @@ static boolean nvfx_vertprog_parse_instruction(struct nvfx_context* nvfx, struct nvfx_vpc *vpc, const struct tgsi_full_instruction *finst) { - struct nvfx_sreg src[3], dst, tmp; - struct nvfx_sreg none = nvfx_sr(NVFXSR_NONE, 0); + struct nvfx_src src[3], tmp; + struct nvfx_reg dst; + struct nvfx_src none = nvfx_src(nvfx_reg(NVFXSR_NONE, 0)); int mask; int ai = -1, ci = -1, ii = -1; int i; @@ -438,9 +437,8 @@ nvfx_vertprog_parse_instruction(struct nvfx_context* nvfx, struct nvfx_vpc *vpc, ai = fsrc->Register.Index; src[i] = tgsi_src(vpc, fsrc); } else { - src[i] = temp(vpc); - arith(vpc, VEC, MOV, src[i], NVFX_VP_MASK_ALL, - tgsi_src(vpc, fsrc), none, none); + src[i] = nvfx_src(temp(vpc)); + nvfx_vp_emit(vpc, arith(VEC, MOV, src[i].reg, NVFX_VP_MASK_ALL, tgsi_src(vpc, fsrc), none, none)); } break; case TGSI_FILE_CONSTANT: @@ -449,9 +447,8 @@ nvfx_vertprog_parse_instruction(struct nvfx_context* nvfx, struct nvfx_vpc *vpc, ci = fsrc->Register.Index; src[i] = tgsi_src(vpc, fsrc); } else { - src[i] = temp(vpc); - arith(vpc, VEC, MOV, src[i], NVFX_VP_MASK_ALL, - tgsi_src(vpc, fsrc), none, none); + src[i] = nvfx_src(temp(vpc)); + nvfx_vp_emit(vpc, arith(VEC, MOV, src[i].reg, NVFX_VP_MASK_ALL, tgsi_src(vpc, fsrc), none, none)); } break; case TGSI_FILE_IMMEDIATE: @@ -460,9 +457,8 @@ nvfx_vertprog_parse_instruction(struct nvfx_context* nvfx, struct nvfx_vpc *vpc, ii = fsrc->Register.Index; src[i] = tgsi_src(vpc, fsrc); } else { - src[i] = temp(vpc); - arith(vpc, VEC, MOV, src[i], NVFX_VP_MASK_ALL, - tgsi_src(vpc, fsrc), none, none); + src[i] = nvfx_src(temp(vpc)); + nvfx_vp_emit(vpc, arith(VEC, MOV, src[i].reg, NVFX_VP_MASK_ALL, tgsi_src(vpc, fsrc), none, none)); } break; case TGSI_FILE_TEMPORARY: @@ -479,127 +475,121 @@ nvfx_vertprog_parse_instruction(struct nvfx_context* nvfx, struct nvfx_vpc *vpc, switch (finst->Instruction.Opcode) { case TGSI_OPCODE_ABS: - arith(vpc, VEC, MOV, dst, mask, abs(src[0]), none, none); + nvfx_vp_emit(vpc, arith(VEC, MOV, dst, mask, abs(src[0]), none, none)); break; case TGSI_OPCODE_ADD: - arith(vpc, VEC, ADD, dst, mask, src[0], none, src[1]); + nvfx_vp_emit(vpc, arith(VEC, ADD, dst, mask, src[0], none, src[1])); break; case TGSI_OPCODE_ARL: - arith(vpc, VEC, ARL, dst, mask, src[0], none, none); + nvfx_vp_emit(vpc, arith(VEC, ARL, dst, mask, src[0], none, none)); break; case TGSI_OPCODE_COS: - arith(vpc, SCA, COS, dst, mask, none, none, src[0]); + nvfx_vp_emit(vpc, arith(SCA, COS, dst, mask, none, none, src[0])); break; case TGSI_OPCODE_DP3: - arith(vpc, VEC, DP3, dst, mask, src[0], src[1], none); + nvfx_vp_emit(vpc, arith(VEC, DP3, dst, mask, src[0], src[1], none)); break; case TGSI_OPCODE_DP4: - arith(vpc, VEC, DP4, dst, mask, src[0], src[1], none); + nvfx_vp_emit(vpc, arith(VEC, DP4, dst, mask, src[0], src[1], none)); break; case TGSI_OPCODE_DPH: - arith(vpc, VEC, DPH, dst, mask, src[0], src[1], none); + nvfx_vp_emit(vpc, arith(VEC, DPH, dst, mask, src[0], src[1], none)); break; case TGSI_OPCODE_DST: - arith(vpc, VEC, DST, dst, mask, src[0], src[1], none); + nvfx_vp_emit(vpc, arith(VEC, DST, dst, mask, src[0], src[1], none)); break; case TGSI_OPCODE_EX2: - arith(vpc, SCA, EX2, dst, mask, none, none, src[0]); + nvfx_vp_emit(vpc, arith(SCA, EX2, dst, mask, none, none, src[0])); break; case TGSI_OPCODE_EXP: - arith(vpc, SCA, EXP, dst, mask, none, none, src[0]); + nvfx_vp_emit(vpc, arith(SCA, EXP, dst, mask, none, none, src[0])); break; case TGSI_OPCODE_FLR: - arith(vpc, VEC, FLR, dst, mask, src[0], none, none); + nvfx_vp_emit(vpc, arith(VEC, FLR, dst, mask, src[0], none, none)); break; case TGSI_OPCODE_FRC: - arith(vpc, VEC, FRC, dst, mask, src[0], none, none); + nvfx_vp_emit(vpc, arith(VEC, FRC, dst, mask, src[0], none, none)); break; case TGSI_OPCODE_LG2: - arith(vpc, SCA, LG2, dst, mask, none, none, src[0]); + nvfx_vp_emit(vpc, arith(SCA, LG2, dst, mask, none, none, src[0])); break; case TGSI_OPCODE_LIT: - arith(vpc, SCA, LIT, dst, mask, none, none, src[0]); + nvfx_vp_emit(vpc, arith(SCA, LIT, dst, mask, none, none, src[0])); break; case TGSI_OPCODE_LOG: - arith(vpc, SCA, LOG, dst, mask, none, none, src[0]); + nvfx_vp_emit(vpc, arith(SCA, LOG, dst, mask, none, none, src[0])); break; case TGSI_OPCODE_LRP: - tmp = temp(vpc); - arith(vpc, VEC, MAD, tmp, mask, neg(src[0]), src[2], src[2]); - arith(vpc, VEC, MAD, dst, mask, src[0], src[1], tmp); + tmp = nvfx_src(temp(vpc)); + nvfx_vp_emit(vpc, arith(VEC, MAD, tmp.reg, mask, neg(src[0]), src[2], src[2])); + nvfx_vp_emit(vpc, arith(VEC, MAD, dst, mask, src[0], src[1], tmp)); break; case TGSI_OPCODE_MAD: - arith(vpc, VEC, MAD, dst, mask, src[0], src[1], src[2]); + nvfx_vp_emit(vpc, arith(VEC, MAD, dst, mask, src[0], src[1], src[2])); break; case TGSI_OPCODE_MAX: - arith(vpc, VEC, MAX, dst, mask, src[0], src[1], none); + nvfx_vp_emit(vpc, arith(VEC, MAX, dst, mask, src[0], src[1], none)); break; case TGSI_OPCODE_MIN: - arith(vpc, VEC, MIN, dst, mask, src[0], src[1], none); + nvfx_vp_emit(vpc, arith(VEC, MIN, dst, mask, src[0], src[1], none)); break; case TGSI_OPCODE_MOV: - arith(vpc, VEC, MOV, dst, mask, src[0], none, none); + nvfx_vp_emit(vpc, arith(VEC, MOV, dst, mask, src[0], none, none)); break; case TGSI_OPCODE_MUL: - arith(vpc, VEC, MUL, dst, mask, src[0], src[1], none); + nvfx_vp_emit(vpc, arith(VEC, MUL, dst, mask, src[0], src[1], none)); break; case TGSI_OPCODE_POW: - tmp = temp(vpc); - arith(vpc, SCA, LG2, tmp, NVFX_VP_MASK_X, none, none, - swz(src[0], X, X, X, X)); - arith(vpc, VEC, MUL, tmp, NVFX_VP_MASK_X, swz(tmp, X, X, X, X), - swz(src[1], X, X, X, X), none); - arith(vpc, SCA, EX2, dst, mask, none, none, - swz(tmp, X, X, X, X)); + tmp = nvfx_src(temp(vpc)); + nvfx_vp_emit(vpc, arith(SCA, LG2, tmp.reg, NVFX_VP_MASK_X, none, none, swz(src[0], X, X, X, X))); + nvfx_vp_emit(vpc, arith(VEC, MUL, tmp.reg, NVFX_VP_MASK_X, swz(tmp, X, X, X, X), swz(src[1], X, X, X, X), none)); + nvfx_vp_emit(vpc, arith(SCA, EX2, dst, mask, none, none, swz(tmp, X, X, X, X))); break; case TGSI_OPCODE_RCP: - arith(vpc, SCA, RCP, dst, mask, none, none, src[0]); + nvfx_vp_emit(vpc, arith(SCA, RCP, dst, mask, none, none, src[0])); break; case TGSI_OPCODE_RET: break; case TGSI_OPCODE_RSQ: - arith(vpc, SCA, RSQ, dst, mask, none, none, abs(src[0])); + nvfx_vp_emit(vpc, arith(SCA, RSQ, dst, mask, none, none, abs(src[0]))); break; case TGSI_OPCODE_SEQ: - arith(vpc, VEC, SEQ, dst, mask, src[0], src[1], none); + nvfx_vp_emit(vpc, arith(VEC, SEQ, dst, mask, src[0], src[1], none)); break; case TGSI_OPCODE_SFL: - arith(vpc, VEC, SFL, dst, mask, src[0], src[1], none); + nvfx_vp_emit(vpc, arith(VEC, SFL, dst, mask, src[0], src[1], none)); break; case TGSI_OPCODE_SGE: - arith(vpc, VEC, SGE, dst, mask, src[0], src[1], none); + nvfx_vp_emit(vpc, arith(VEC, SGE, dst, mask, src[0], src[1], none)); break; case TGSI_OPCODE_SGT: - arith(vpc, VEC, SGT, dst, mask, src[0], src[1], none); + nvfx_vp_emit(vpc, arith(VEC, SGT, dst, mask, src[0], src[1], none)); break; case TGSI_OPCODE_SIN: - arith(vpc, SCA, SIN, dst, mask, none, none, src[0]); + nvfx_vp_emit(vpc, arith(SCA, SIN, dst, mask, none, none, src[0])); break; case TGSI_OPCODE_SLE: - arith(vpc, VEC, SLE, dst, mask, src[0], src[1], none); + nvfx_vp_emit(vpc, arith(VEC, SLE, dst, mask, src[0], src[1], none)); break; case TGSI_OPCODE_SLT: - arith(vpc, VEC, SLT, dst, mask, src[0], src[1], none); + nvfx_vp_emit(vpc, arith(VEC, SLT, dst, mask, src[0], src[1], none)); break; case TGSI_OPCODE_SNE: - arith(vpc, VEC, SNE, dst, mask, src[0], src[1], none); + nvfx_vp_emit(vpc, arith(VEC, SNE, dst, mask, src[0], src[1], none)); break; case TGSI_OPCODE_SSG: - arith(vpc, VEC, SSG, dst, mask, src[0], src[1], none); + nvfx_vp_emit(vpc, arith(VEC, SSG, dst, mask, src[0], src[1], none)); break; case TGSI_OPCODE_STR: - arith(vpc, VEC, STR, dst, mask, src[0], src[1], none); + nvfx_vp_emit(vpc, arith(VEC, STR, dst, mask, src[0], src[1], none)); break; case TGSI_OPCODE_SUB: - arith(vpc, VEC, ADD, dst, mask, src[0], none, neg(src[1])); + nvfx_vp_emit(vpc, arith(VEC, ADD, dst, mask, src[0], none, neg(src[1]))); break; case TGSI_OPCODE_XPD: - tmp = temp(vpc); - arith(vpc, VEC, MUL, tmp, mask, - swz(src[0], Z, X, Y, Y), swz(src[1], Y, Z, X, X), none); - arith(vpc, VEC, MAD, dst, (mask & ~NVFX_VP_MASK_W), - swz(src[0], Y, Z, X, X), swz(src[1], Z, X, Y, Y), - neg(tmp)); + tmp = nvfx_src(temp(vpc)); + nvfx_vp_emit(vpc, arith(VEC, MUL, tmp.reg, mask, swz(src[0], Z, X, Y, Y), swz(src[1], Y, Z, X, X), none)); + nvfx_vp_emit(vpc, arith(VEC, MAD, dst, (mask & ~NVFX_VP_MASK_W), swz(src[0], Y, Z, X, X), swz(src[1], Z, X, Y, Y), neg(tmp))); break; default: NOUVEAU_ERR("invalid opcode %d\n", finst->Instruction.Opcode); @@ -663,7 +653,7 @@ nvfx_vertprog_parse_decl_output(struct nvfx_context* nvfx, struct nvfx_vpc *vpc, return FALSE; } - vpc->r_result[idx] = nvfx_sr(NVFXSR_OUTPUT, hw); + vpc->r_result[idx] = nvfx_reg(NVFXSR_OUTPUT, hw); return TRUE; } @@ -758,18 +748,18 @@ nvfx_vertprog_prepare(struct nvfx_context* nvfx, struct nvfx_vpc *vpc) tgsi_parse_free(&p); if (nr_imm) { - vpc->imm = CALLOC(nr_imm, sizeof(struct nvfx_sreg)); + vpc->imm = CALLOC(nr_imm, sizeof(struct nvfx_reg)); assert(vpc->imm); } if (++high_temp) { - vpc->r_temp = CALLOC(high_temp, sizeof(struct nvfx_sreg)); + vpc->r_temp = CALLOC(high_temp, sizeof(struct nvfx_reg)); for (i = 0; i < high_temp; i++) vpc->r_temp[i] = temp(vpc); } if (++high_addr) { - vpc->r_address = CALLOC(high_addr, sizeof(struct nvfx_sreg)); + vpc->r_address = CALLOC(high_addr, sizeof(struct nvfx_reg)); for (i = 0; i < high_addr; i++) vpc->r_address[i] = temp(vpc); } @@ -786,12 +776,13 @@ nvfx_vertprog_translate(struct nvfx_context *nvfx, { struct tgsi_parse_context parse; struct nvfx_vpc *vpc = NULL; - struct nvfx_sreg none = nvfx_sr(NVFXSR_NONE, 0); + struct nvfx_src none = nvfx_src(nvfx_reg(NVFXSR_NONE, 0)); int i; vpc = CALLOC(1, sizeof(struct nvfx_vpc)); if (!vpc) return; + vpc->nvfx = nvfx; vpc->vp = vp; if (!nvfx_vertprog_prepare(nvfx, vpc)) { @@ -844,23 +835,23 @@ nvfx_vertprog_translate(struct nvfx_context *nvfx, /* Write out HPOS if it was redirected to a temp earlier */ if (vpc->r_result[vpc->hpos_idx].type != NVFXSR_OUTPUT) { - struct nvfx_sreg hpos = nvfx_sr(NVFXSR_OUTPUT, + struct nvfx_reg hpos = nvfx_reg(NVFXSR_OUTPUT, NVFX_VP(INST_DEST_POS)); - struct nvfx_sreg htmp = vpc->r_result[vpc->hpos_idx]; + struct nvfx_src htmp = nvfx_src(vpc->r_result[vpc->hpos_idx]); - arith(vpc, VEC, MOV, hpos, NVFX_VP_MASK_ALL, htmp, none, none); + nvfx_vp_emit(vpc, arith(VEC, MOV, hpos, NVFX_VP_MASK_ALL, htmp, none, none)); } /* Insert code to handle user clip planes */ for (i = 0; i < vp->ucp.nr; i++) { - struct nvfx_sreg cdst = nvfx_sr(NVFXSR_OUTPUT, + struct nvfx_reg cdst = nvfx_reg(NVFXSR_OUTPUT, NVFX_VP_INST_DEST_CLIP(i)); - struct nvfx_sreg ceqn = constant(vpc, -1, + struct nvfx_src ceqn = nvfx_src(constant(vpc, -1, nvfx->clip.ucp[i][0], nvfx->clip.ucp[i][1], nvfx->clip.ucp[i][2], - nvfx->clip.ucp[i][3]); - struct nvfx_sreg htmp = vpc->r_result[vpc->hpos_idx]; + nvfx->clip.ucp[i][3])); + struct nvfx_src htmp = nvfx_src(vpc->r_result[vpc->hpos_idx]); unsigned mask; switch (i) { @@ -872,7 +863,7 @@ nvfx_vertprog_translate(struct nvfx_context *nvfx, goto out_err; } - arith(vpc, VEC, DP4, cdst, mask, htmp, ceqn, none); + nvfx_vp_emit(vpc, arith(VEC, DP4, cdst, mask, htmp, ceqn, none)); } vp->insns[vp->nr_insns - 1].data[3] |= NVFX_VP_INST_LAST; -- cgit v1.2.3 From af4a6eba55ad81e343db788a97f3eaa3cf184369 Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Fri, 20 Aug 2010 21:16:49 +0200 Subject: nv40: add fragment program control flow --- src/gallium/drivers/nvfx/nvfx_fragprog.c | 247 ++++++++++++++++++++++++++++++- src/gallium/drivers/nvfx/nvfx_shader.h | 5 + 2 files changed, 247 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/nvfx/nvfx_fragprog.c b/src/gallium/drivers/nvfx/nvfx_fragprog.c index f8c4eae387..91776371e4 100644 --- a/src/gallium/drivers/nvfx/nvfx_fragprog.c +++ b/src/gallium/drivers/nvfx/nvfx_fragprog.c @@ -15,6 +15,7 @@ #define MAX_CONSTS 128 #define MAX_IMM 32 + struct nvfx_fpc { struct nvfx_fragment_program *fp; @@ -38,6 +39,10 @@ struct nvfx_fpc { unsigned nr_imm; unsigned char generic_to_slot[256]; /* semantic idx for each input semantic */ + + struct util_dynarray if_stack; + //struct util_dynarray loop_stack; + struct util_dynarray label_relocs; }; static INLINE struct nvfx_reg @@ -233,6 +238,134 @@ nvfx_fp_emit(struct nvfx_fpc *fpc, struct nvfx_insn insn) nvfx_insn((s), NVFX_FP_OP_OPCODE_##o, (u), \ (d), (m), (s0), none, none) +/* IF src.x != 0, as TGSI specifies */ +static void +nv40_fp_if(struct nvfx_fpc *fpc, struct nvfx_src src) +{ + const struct nvfx_src none = nvfx_src(nvfx_reg(NVFXSR_NONE, 0)); + struct nvfx_insn insn = arith(0, MOV, none.reg, NVFX_FP_MASK_X, src, none, none); + insn.cc_update = 1; + nvfx_fp_emit(fpc, insn); + + fpc->inst_offset = fpc->fp->insn_len; + grow_insns(fpc, 4); + uint32_t *hw = &fpc->fp->insn[fpc->inst_offset]; + /* I really wonder why fp16 precision is used. Presumably the hardware ignores it? */ + hw[0] = (NV40_FP_OP_BRA_OPCODE_IF << NVFX_FP_OP_OPCODE_SHIFT) | + NV40_FP_OP_OUT_NONE | + (NVFX_FP_PRECISION_FP16 << NVFX_FP_OP_PRECISION_SHIFT); + /* Use .xxxx swizzle so that we check only src[0].x*/ + hw[1] = (0 << NVFX_FP_OP_COND_SWZ_X_SHIFT) | + (0 << NVFX_FP_OP_COND_SWZ_Y_SHIFT) | + (0 << NVFX_FP_OP_COND_SWZ_Z_SHIFT) | + (0 << NVFX_FP_OP_COND_SWZ_W_SHIFT) | + (NVFX_FP_OP_COND_NE << NVFX_FP_OP_COND_SHIFT); + hw[2] = 0; /* | NV40_FP_OP_OPCODE_IS_BRANCH | else_offset */ + hw[3] = 0; /* | endif_offset */ + util_dynarray_append(&fpc->if_stack, unsigned, fpc->inst_offset); +} + +/* IF src.x != 0, as TGSI specifies */ +static void +nv40_fp_cal(struct nvfx_fpc *fpc, unsigned target) +{ + struct nvfx_label_relocation reloc; + fpc->inst_offset = fpc->fp->insn_len; + grow_insns(fpc, 4); + uint32_t *hw = &fpc->fp->insn[fpc->inst_offset]; + /* I really wonder why fp16 precision is used. Presumably the hardware ignores it? */ + hw[0] = (NV40_FP_OP_BRA_OPCODE_CAL << NVFX_FP_OP_OPCODE_SHIFT); + /* Use .xxxx swizzle so that we check only src[0].x*/ + hw[1] = (NVFX_SWZ_IDENTITY << NVFX_FP_OP_COND_SWZ_ALL_SHIFT) | + (NVFX_FP_OP_COND_TR << NVFX_FP_OP_COND_SHIFT); + hw[2] = NV40_FP_OP_OPCODE_IS_BRANCH; /* | call_offset */ + hw[3] = 0; + reloc.target = target; + reloc.location = fpc->inst_offset + 2; + util_dynarray_append(&fpc->label_relocs, struct nvfx_label_relocation, reloc); +} + +static void +nv40_fp_ret(struct nvfx_fpc *fpc) +{ + fpc->inst_offset = fpc->fp->insn_len; + grow_insns(fpc, 4); + uint32_t *hw = &fpc->fp->insn[fpc->inst_offset]; + /* I really wonder why fp16 precision is used. Presumably the hardware ignores it? */ + hw[0] = (NV40_FP_OP_BRA_OPCODE_RET << NVFX_FP_OP_OPCODE_SHIFT); + /* Use .xxxx swizzle so that we check only src[0].x*/ + hw[1] = (NVFX_SWZ_IDENTITY << NVFX_FP_OP_COND_SWZ_ALL_SHIFT) | + (NVFX_FP_OP_COND_TR << NVFX_FP_OP_COND_SHIFT); + hw[2] = NV40_FP_OP_OPCODE_IS_BRANCH; /* | call_offset */ + hw[3] = 0; +} + +static void +nv40_fp_rep(struct nvfx_fpc *fpc, unsigned count, unsigned target) +{ + struct nvfx_label_relocation reloc; + fpc->inst_offset = fpc->fp->insn_len; + grow_insns(fpc, 4); + uint32_t *hw = &fpc->fp->insn[fpc->inst_offset]; + /* I really wonder why fp16 precision is used. Presumably the hardware ignores it? */ + hw[0] = (NV40_FP_OP_BRA_OPCODE_REP << NVFX_FP_OP_OPCODE_SHIFT) | + NV40_FP_OP_OUT_NONE | + (NVFX_FP_PRECISION_FP16 << NVFX_FP_OP_PRECISION_SHIFT); + /* Use .xxxx swizzle so that we check only src[0].x*/ + hw[1] = (NVFX_SWZ_IDENTITY << NVFX_FP_OP_COND_SWZ_ALL_SHIFT) | + (NVFX_FP_OP_COND_TR << NVFX_FP_OP_COND_SHIFT); + hw[2] = NV40_FP_OP_OPCODE_IS_BRANCH | + (count << NV40_FP_OP_REP_COUNT1_SHIFT) | + (count << NV40_FP_OP_REP_COUNT2_SHIFT) | + (count << NV40_FP_OP_REP_COUNT3_SHIFT); + hw[3] = 0; /* | end_offset */ + reloc.target = target; + reloc.location = fpc->inst_offset + 3; + util_dynarray_append(&fpc->label_relocs, struct nvfx_label_relocation, reloc); + //util_dynarray_append(&fpc->loop_stack, unsigned, target); +} + +/* warning: this only works forward, and probably only if not inside any IF */ +static void +nv40_fp_bra(struct nvfx_fpc *fpc, unsigned target) +{ + struct nvfx_label_relocation reloc; + fpc->inst_offset = fpc->fp->insn_len; + grow_insns(fpc, 4); + uint32_t *hw = &fpc->fp->insn[fpc->inst_offset]; + /* I really wonder why fp16 precision is used. Presumably the hardware ignores it? */ + hw[0] = (NV40_FP_OP_BRA_OPCODE_IF << NVFX_FP_OP_OPCODE_SHIFT) | + NV40_FP_OP_OUT_NONE | + (NVFX_FP_PRECISION_FP16 << NVFX_FP_OP_PRECISION_SHIFT); + /* Use .xxxx swizzle so that we check only src[0].x*/ + hw[1] = (NVFX_SWZ_IDENTITY << NVFX_FP_OP_COND_SWZ_X_SHIFT) | + (NVFX_FP_OP_COND_FL << NVFX_FP_OP_COND_SHIFT); + hw[2] = NV40_FP_OP_OPCODE_IS_BRANCH; /* | else_offset */ + hw[3] = 0; /* | endif_offset */ + reloc.target = target; + reloc.location = fpc->inst_offset + 2; + util_dynarray_append(&fpc->label_relocs, struct nvfx_label_relocation, reloc); + reloc.target = target; + reloc.location = fpc->inst_offset + 3; + util_dynarray_append(&fpc->label_relocs, struct nvfx_label_relocation, reloc); +} + +static void +nv40_fp_brk(struct nvfx_fpc *fpc) +{ + fpc->inst_offset = fpc->fp->insn_len; + grow_insns(fpc, 4); + uint32_t *hw = &fpc->fp->insn[fpc->inst_offset]; + /* I really wonder why fp16 precision is used. Presumably the hardware ignores it? */ + hw[0] = (NV40_FP_OP_BRA_OPCODE_BRK << NVFX_FP_OP_OPCODE_SHIFT) | + NV40_FP_OP_OUT_NONE; + /* Use .xxxx swizzle so that we check only src[0].x*/ + hw[1] = (NVFX_SWZ_IDENTITY << NVFX_FP_OP_COND_SWZ_X_SHIFT) | + (NVFX_FP_OP_COND_TR << NVFX_FP_OP_COND_SHIFT); + hw[2] = NV40_FP_OP_OPCODE_IS_BRANCH; + hw[3] = 0; +} + static INLINE struct nvfx_src tgsi_src(struct nvfx_fpc *fpc, const struct tgsi_full_src_register *fsrc) { @@ -516,9 +649,6 @@ nvfx_fragprog_parse_instruction(struct nvfx_context* nvfx, struct nvfx_fpc *fpc, case TGSI_OPCODE_RCP: nvfx_fp_emit(fpc, arith(sat, RCP, dst, mask, src[0], none, none)); break; - case TGSI_OPCODE_RET: - assert(0); - break; case TGSI_OPCODE_RFL: if(!nvfx->is_nv4x) nvfx_fp_emit(fpc, arith(0, RFL_NV30, dst, mask, src[0], src[1], none)); @@ -604,13 +734,106 @@ nvfx_fragprog_parse_instruction(struct nvfx_context* nvfx, struct nvfx_fpc *fpc, nvfx_fp_emit(fpc, arith(0, MUL, tmp.reg, mask, swz(src[0], Z, X, Y, Y), swz(src[1], Y, Z, X, X), none)); nvfx_fp_emit(fpc, arith(sat, MAD, dst, (mask & ~NVFX_FP_MASK_W), swz(src[0], Y, Z, X, X), swz(src[1], Z, X, Y, Y), neg(tmp))); break; - default: + + case TGSI_OPCODE_IF: + // MOVRC0 R31 (TR0.xyzw), R: + // IF (NE.xxxx) ELSE END + if(!nvfx->is_nv4x) + goto nv3x_cflow; + nv40_fp_if(fpc, src[0]); + break; + + case TGSI_OPCODE_ELSE: + { + if(!nvfx->is_nv4x) + goto nv3x_cflow; + assert(util_dynarray_contains(&fpc->if_stack, unsigned)); + uint32_t *hw = &fpc->fp->insn[util_dynarray_top(&fpc->if_stack, unsigned)]; + hw[2] = NV40_FP_OP_OPCODE_IS_BRANCH | fpc->fp->insn_len; + break; + } + + case TGSI_OPCODE_ENDIF: + { + if(!nvfx->is_nv4x) + goto nv3x_cflow; + assert(util_dynarray_contains(&fpc->if_stack, unsigned)); + uint32_t *hw = &fpc->fp->insn[util_dynarray_pop(&fpc->if_stack, unsigned)]; + if(!hw[2]) + hw[2] = NV40_FP_OP_OPCODE_IS_BRANCH | fpc->fp->insn_len; + hw[3] = fpc->fp->insn_len; + break; + } + + case TGSI_OPCODE_BRA: + /* This can in limited cases be implemented with an IF with the else and endif labels pointing to the target */ + /* no state tracker uses this, so don't implement this for now */ + assert(0); + nv40_fp_bra(fpc, finst->Label.Label); + break; + + case TGSI_OPCODE_BGNSUB: + case TGSI_OPCODE_ENDSUB: + /* nothing to do here */ + break; + + case TGSI_OPCODE_CAL: + if(!nvfx->is_nv4x) + goto nv3x_cflow; + nv40_fp_cal(fpc, finst->Label.Label); + break; + + case TGSI_OPCODE_RET: + if(!nvfx->is_nv4x) + goto nv3x_cflow; + nv40_fp_ret(fpc); + break; + + case TGSI_OPCODE_BGNLOOP: + if(!nvfx->is_nv4x) + goto nv3x_cflow; + /* TODO: we should support using two nested REPs to allow a > 255 iteration count */ + nv40_fp_rep(fpc, 255, finst->Label.Label); + break; + + case TGSI_OPCODE_ENDLOOP: + break; + + case TGSI_OPCODE_BRK: + if(!nvfx->is_nv4x) + goto nv3x_cflow; + nv40_fp_brk(fpc); + break; + + case TGSI_OPCODE_CONT: + { + static int warned = 0; + if(!warned) { + NOUVEAU_ERR("Sorry, the continue keyword is not implemented: ignoring it.\n"); + warned = 1; + } + break; + } + + default: NOUVEAU_ERR("invalid opcode %d\n", finst->Instruction.Opcode); return FALSE; } +out: release_temps(fpc); return TRUE; +nv3x_cflow: + { + static int warned = 0; + if(!warned) { + NOUVEAU_ERR( + "Sorry, control flow instructions are not supported in hardware on nv3x: ignoring them\n" + "If rendering is incorrect, try to disable GLSL support in the application.\n"); + warned = 1; + } + } + goto out; } static boolean @@ -734,6 +957,7 @@ nvfx_fragprog_translate(struct nvfx_context *nvfx, { struct tgsi_parse_context parse; struct nvfx_fpc *fpc = NULL; + struct util_dynarray insns; fpc = CALLOC(1, sizeof(struct nvfx_fpc)); if (!fpc) @@ -748,6 +972,7 @@ nvfx_fragprog_translate(struct nvfx_context *nvfx, tgsi_parse_init(&parse, fp->pipe.tokens); + util_dynarray_init(&insns); while (!tgsi_parse_end_of_tokens(&parse)) { tgsi_parse_token(&parse); @@ -756,6 +981,7 @@ nvfx_fragprog_translate(struct nvfx_context *nvfx, { const struct tgsi_full_instruction *finst; + util_dynarray_append(&insns, unsigned, fp->insn_len); finst = &parse.FullToken.FullInstruction; if (!nvfx_fragprog_parse_instruction(nvfx, fpc, finst)) goto out_err; @@ -765,6 +991,14 @@ nvfx_fragprog_translate(struct nvfx_context *nvfx, break; } } + util_dynarray_append(&insns, unsigned, fp->insn_len); + + for(unsigned i = 0; i < fpc->label_relocs.size; i += sizeof(struct nvfx_label_relocation)) + { + struct nvfx_label_relocation* label_reloc = (struct nvfx_label_relocation*)((char*)fpc->label_relocs.data + i); + fp->insn[label_reloc->location] |= ((unsigned*)insns.data)[label_reloc->target]; + } + util_dynarray_fini(&insns); if(!nvfx->is_nv4x) fp->fp_control |= (fpc->num_regs-1)/2; @@ -775,7 +1009,7 @@ nvfx_fragprog_translate(struct nvfx_context *nvfx, if(fp->insn) fp->insn[fpc->inst_offset] |= 0x00000001; - /* Append NOP + END instruction, may or may not be necessary. */ + /* Append NOP + END instruction for branches to the end of the program */ fpc->inst_offset = fp->insn_len; grow_insns(fpc, 4); fp->insn[fpc->inst_offset + 0] = 0x00000001; @@ -799,6 +1033,9 @@ out_err: tgsi_parse_free(&parse); if (fpc->r_temp) FREE(fpc->r_temp); + util_dynarray_fini(&fpc->if_stack); + util_dynarray_fini(&fpc->label_relocs); + //util_dynarray_fini(&fpc->loop_stack); FREE(fpc); } diff --git a/src/gallium/drivers/nvfx/nvfx_shader.h b/src/gallium/drivers/nvfx/nvfx_shader.h index fcf577ca74..52e684aec3 100644 --- a/src/gallium/drivers/nvfx/nvfx_shader.h +++ b/src/gallium/drivers/nvfx/nvfx_shader.h @@ -509,4 +509,9 @@ nvfx_src_abs(struct nvfx_src src) return src; } +struct nvfx_label_relocation { + unsigned location; + unsigned target; +}; + #endif -- cgit v1.2.3 From 5287d86a0b818fd0a7cba6d7728b701663ea78a5 Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Sat, 21 Aug 2010 18:37:01 +0200 Subject: nvfx: fix vertex shader headers --- src/gallium/drivers/nvfx/nv30_vertprog.h | 4 ++-- src/gallium/drivers/nvfx/nv40_vertprog.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/nvfx/nv30_vertprog.h b/src/gallium/drivers/nvfx/nv30_vertprog.h index ec0444c07f..df92469078 100644 --- a/src/gallium/drivers/nvfx/nv30_vertprog.h +++ b/src/gallium/drivers/nvfx/nv30_vertprog.h @@ -68,7 +68,7 @@ #define NV30_VP_INST_DEST_TEMP_ID_SHIFT 16 #define NV30_VP_INST_DEST_TEMP_ID_MASK (0x0F << 16) #define NV30_VP_INST_COND_UPDATE_ENABLE (1<<15) -#define NV30_VP_INST_VEC_DEST_TEMP_MASK (0xF << 16) +#define NV30_VP_INST_VEC_DEST_TEMP_MASK (0x1F << 16) #define NV30_VP_INST_COND_TEST_ENABLE (1<<14) #define NV30_VP_INST_COND_SHIFT 11 #define NV30_VP_INST_COND_MASK (0x07 << 11) @@ -111,7 +111,7 @@ #define NV30_VP_INST_SRC2H_SHIFT 0 /*NV20*/ #define NV30_VP_INST_SRC2H_MASK (0x7FF << 0) /* NV30_VP_SRC2_HIGH_MASK >> 4*/ #define NV30_VP_INST_IADDR_SHIFT 2 -#define NV30_VP_INST_IADDR_MASK (0xF << 28) /* NV30_VP_SRC2_LOW_MASK << 28 */ +#define NV30_VP_INST_IADDR_MASK (0x1FF << 2) /* NV30_VP_SRC2_LOW_MASK << 28 */ /* DWORD 3 */ #define NV30_VP_INST_SRC2L_SHIFT 28 /*NV20*/ diff --git a/src/gallium/drivers/nvfx/nv40_vertprog.h b/src/gallium/drivers/nvfx/nv40_vertprog.h index 7337293bab..3d0a1fe3d1 100644 --- a/src/gallium/drivers/nvfx/nv40_vertprog.h +++ b/src/gallium/drivers/nvfx/nv40_vertprog.h @@ -44,7 +44,7 @@ #define NV40_VP_INST_SRC1_ABS (1 << 22) #define NV40_VP_INST_SRC0_ABS (1 << 21) #define NV40_VP_INST_VEC_DEST_TEMP_SHIFT 15 -#define NV40_VP_INST_VEC_DEST_TEMP_MASK (0x1F << 15) +#define NV40_VP_INST_VEC_DEST_TEMP_MASK (0x3F << 15) #define NV40_VP_INST_COND_TEST_ENABLE (1 << 13) #define NV40_VP_INST_COND_SHIFT 10 #define NV40_VP_INST_COND_MASK (0x7 << 10) @@ -100,7 +100,7 @@ #define NV40_VP_INST_SRC2H_SHIFT 0 #define NV40_VP_INST_SRC2H_MASK (0x3F << 0) #define NV40_VP_INST_IADDRH_SHIFT 0 -#define NV40_VP_INST_IADDRH_MASK (0x1F << 0) +#define NV40_VP_INST_IADDRH_MASK (0x3F << 0) /* ---- OPCODE BITS 31:0 / data DWORD 3 --- */ #define NV40_VP_INST_IADDRL_SHIFT 29 -- cgit v1.2.3 From fe3c62dd7728f1cab64978d634fd0be4237d3b23 Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Sat, 21 Aug 2010 18:37:21 +0200 Subject: nvfx: add vertex program control flow --- src/gallium/drivers/nvfx/nvfx_state.h | 3 +- src/gallium/drivers/nvfx/nvfx_vertprog.c | 184 ++++++++++++++++++++++++++++--- 2 files changed, 169 insertions(+), 18 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/nvfx/nvfx_state.h b/src/gallium/drivers/nvfx/nvfx_state.h index e1fa3c7e04..6d589af5f3 100644 --- a/src/gallium/drivers/nvfx/nvfx_state.h +++ b/src/gallium/drivers/nvfx/nvfx_state.h @@ -9,7 +9,6 @@ struct nvfx_vertex_program_exec { uint32_t data[4]; - boolean has_branch_offset; int const_index; }; @@ -45,6 +44,8 @@ struct nvfx_vertex_program { uint32_t ir; uint32_t or; uint32_t clip_ctrl; + + struct util_dynarray branch_relocs; }; struct nvfx_fragment_program_data { diff --git a/src/gallium/drivers/nvfx/nvfx_vertprog.c b/src/gallium/drivers/nvfx/nvfx_vertprog.c index 416e1b4d45..98fcc92898 100644 --- a/src/gallium/drivers/nvfx/nvfx_vertprog.c +++ b/src/gallium/drivers/nvfx/nvfx_vertprog.c @@ -29,6 +29,12 @@ #define NVFX_VP_INST_DEST_CLIP(n) ((~0 - 6) + (n)) +struct nvfx_loop_entry +{ + unsigned brk_target; + unsigned cont_target; +}; + struct nvfx_vpc { struct nvfx_context* nvfx; struct nvfx_vertex_program *vp; @@ -45,6 +51,9 @@ struct nvfx_vpc { unsigned nr_imm; unsigned hpos_idx; + + struct util_dynarray label_relocs; + struct util_dynarray loop_stack; }; static struct nvfx_reg @@ -169,6 +178,17 @@ emit_dst(struct nvfx_context* nvfx, struct nvfx_vpc *vpc, uint32_t *hw, int slot struct nvfx_vertex_program *vp = vpc->vp; switch (dst.type) { + case NVFXSR_NONE: + if(!nvfx->is_nv4x) + hw[0] |= NV30_VP_INST_DEST_TEMP_ID_MASK; + else { + hw[3] |= NV40_VP_INST_DEST_MASK; + if (slot == 0) + hw[0] |= NV40_VP_INST_VEC_DEST_TEMP_MASK; + else + hw[3] |= NV40_VP_INST_SCA_DEST_TEMP_MASK; + } + break; case NVFXSR_TEMP: if(!nvfx->is_nv4x) hw[0] |= (dst.index << NV30_VP_INST_DEST_TEMP_ID_SHIFT); @@ -254,7 +274,7 @@ emit_dst(struct nvfx_context* nvfx, struct nvfx_vpc *vpc, uint32_t *hw, int slot if(!nvfx->is_nv4x) { hw[3] |= (dst.index << NV30_VP_INST_DEST_SHIFT); - hw[0] |= NV30_VP_INST_VEC_DEST_TEMP_MASK | (1<<20); + hw[0] |= NV30_VP_INST_VEC_DEST_TEMP_MASK; /*XXX: no way this is entirely correct, someone needs to * figure out what exactly it is. @@ -264,7 +284,7 @@ emit_dst(struct nvfx_context* nvfx, struct nvfx_vpc *vpc, uint32_t *hw, int slot hw[3] |= (dst.index << NV40_VP_INST_DEST_SHIFT); if (slot == 0) { hw[0] |= NV40_VP_INST_VEC_RESULT; - hw[0] |= NV40_VP_INST_VEC_DEST_TEMP_MASK | (1<<20); + hw[0] |= NV40_VP_INST_VEC_DEST_TEMP_MASK; } else { hw[3] |= NV40_VP_INST_SCA_RESULT; hw[3] |= NV40_VP_INST_SCA_DEST_TEMP_MASK; @@ -292,11 +312,13 @@ nvfx_vp_emit(struct nvfx_vpc *vpc, struct nvfx_insn insn) hw = vpc->vpi->data; - hw[0] |= (NVFX_COND_TR << NVFX_VP(INST_COND_SHIFT)); - hw[0] |= ((0 << NVFX_VP(INST_COND_SWZ_X_SHIFT)) | - (1 << NVFX_VP(INST_COND_SWZ_Y_SHIFT)) | - (2 << NVFX_VP(INST_COND_SWZ_Z_SHIFT)) | - (3 << NVFX_VP(INST_COND_SWZ_W_SHIFT))); + hw[0] |= (insn.cc_test << NVFX_VP(INST_COND_SHIFT)); + hw[0] |= ((insn.cc_swz[0] << NVFX_VP(INST_COND_SWZ_X_SHIFT)) | + (insn.cc_swz[1] << NVFX_VP(INST_COND_SWZ_Y_SHIFT)) | + (insn.cc_swz[2] << NVFX_VP(INST_COND_SWZ_Z_SHIFT)) | + (insn.cc_swz[3] << NVFX_VP(INST_COND_SWZ_W_SHIFT))); + if(insn.cc_update) + hw[0] |= NVFX_VP(INST_COND_UPDATE_ENABLE); if(!nvfx->is_nv4x) { if(slot == 0) @@ -327,7 +349,7 @@ nvfx_vp_emit(struct nvfx_vpc *vpc, struct nvfx_insn insn) hw[3] |= (insn.mask << NV40_VP_INST_VEC_WRITEMASK_SHIFT); } else { hw[1] |= (op << NV40_VP_INST_SCA_OPCODE_SHIFT); - hw[0] |= (NV40_VP_INST_VEC_DEST_TEMP_MASK | (1 << 20)); + hw[0] |= NV40_VP_INST_VEC_DEST_TEMP_MASK ; hw[3] |= (insn.mask << NV40_VP_INST_SCA_WRITEMASK_SHIFT); } } @@ -374,6 +396,9 @@ tgsi_dst(struct nvfx_vpc *vpc, const struct tgsi_full_dst_register *fdst) { struct nvfx_reg dst; switch (fdst->Register.File) { + case TGSI_FILE_NULL: + dst = nvfx_reg(NVFXSR_NONE, 0); + break; case TGSI_FILE_OUTPUT: dst = vpc->r_result[fdst->Register.Index]; break; @@ -405,11 +430,14 @@ tgsi_mask(uint tgsi) static boolean nvfx_vertprog_parse_instruction(struct nvfx_context* nvfx, struct nvfx_vpc *vpc, - const struct tgsi_full_instruction *finst) + unsigned idx, const struct tgsi_full_instruction *finst) { struct nvfx_src src[3], tmp; struct nvfx_reg dst; struct nvfx_src none = nvfx_src(nvfx_reg(NVFXSR_NONE, 0)); + struct nvfx_insn insn; + struct nvfx_label_relocation reloc; + struct nvfx_loop_entry loop; int mask; int ai = -1, ci = -1, ii = -1; int i; @@ -548,8 +576,6 @@ nvfx_vertprog_parse_instruction(struct nvfx_context* nvfx, struct nvfx_vpc *vpc, case TGSI_OPCODE_RCP: nvfx_vp_emit(vpc, arith(SCA, RCP, dst, mask, none, none, src[0])); break; - case TGSI_OPCODE_RET: - break; case TGSI_OPCODE_RSQ: nvfx_vp_emit(vpc, arith(SCA, RSQ, dst, mask, none, none, abs(src[0]))); break; @@ -591,6 +617,84 @@ nvfx_vertprog_parse_instruction(struct nvfx_context* nvfx, struct nvfx_vpc *vpc, nvfx_vp_emit(vpc, arith(VEC, MUL, tmp.reg, mask, swz(src[0], Z, X, Y, Y), swz(src[1], Y, Z, X, X), none)); nvfx_vp_emit(vpc, arith(VEC, MAD, dst, (mask & ~NVFX_VP_MASK_W), swz(src[0], Y, Z, X, X), swz(src[1], Z, X, Y, Y), neg(tmp))); break; + + case TGSI_OPCODE_IF: + insn = arith(VEC, MOV, none.reg, NVFX_VP_MASK_X, src[0], none, none); + insn.cc_update = 1; + nvfx_vp_emit(vpc, insn); + + reloc.location = vpc->vp->nr_insns; + reloc.target = finst->Label.Label + 1; + util_dynarray_append(&vpc->label_relocs, struct nvfx_label_relocation, reloc); + + insn = arith(SCA, BRA, none.reg, 0, none, none, none); + insn.cc_test = NVFX_COND_EQ; + insn.cc_swz[0] = insn.cc_swz[1] = insn.cc_swz[2] = insn.cc_swz[3] = 0; + nvfx_vp_emit(vpc, insn); + break; + + case TGSI_OPCODE_ELSE: + case TGSI_OPCODE_BRA: + case TGSI_OPCODE_CAL: + reloc.location = vpc->vp->nr_insns; + reloc.target = finst->Label.Label; + util_dynarray_append(&vpc->label_relocs, struct nvfx_label_relocation, reloc); + + if(finst->Instruction.Opcode == TGSI_OPCODE_CAL) + insn = arith(SCA, CAL, none.reg, 0, none, none, none); + else + insn = arith(SCA, BRA, none.reg, 0, none, none, none); + nvfx_vp_emit(vpc, insn); + break; + + case TGSI_OPCODE_RET: + tmp = none; + tmp.swz[0] = tmp.swz[1] = tmp.swz[2] = tmp.swz[3] = 0; + nvfx_vp_emit(vpc, arith(SCA, RET, none.reg, 0, none, none, tmp)); + break; + + case TGSI_OPCODE_BGNSUB: + case TGSI_OPCODE_ENDSUB: + case TGSI_OPCODE_ENDIF: + /* nothing to do here */ + break; + + case TGSI_OPCODE_BGNLOOP: + loop.cont_target = idx; + loop.brk_target = finst->Label.Label + 1; + util_dynarray_append(&vpc->loop_stack, struct nvfx_loop_entry, loop); + break; + + case TGSI_OPCODE_ENDLOOP: + loop = util_dynarray_pop(&vpc->loop_stack, struct nvfx_loop_entry); + + reloc.location = vpc->vp->nr_insns; + reloc.target = loop.cont_target; + util_dynarray_append(&vpc->label_relocs, struct nvfx_label_relocation, reloc); + + nvfx_vp_emit(vpc, arith(SCA, BRA, none.reg, 0, none, none, none)); + break; + + case TGSI_OPCODE_CONT: + loop = util_dynarray_top(&vpc->loop_stack, struct nvfx_loop_entry); + + reloc.location = vpc->vp->nr_insns; + reloc.target = loop.cont_target; + util_dynarray_append(&vpc->label_relocs, struct nvfx_label_relocation, reloc); + + nvfx_vp_emit(vpc, arith(SCA, BRA, none.reg, 0, none, none, none)); + break; + + case TGSI_OPCODE_BRK: + loop = util_dynarray_top(&vpc->loop_stack, struct nvfx_loop_entry); + + reloc.location = vpc->vp->nr_insns; + reloc.target = loop.brk_target; + util_dynarray_append(&vpc->label_relocs, struct nvfx_label_relocation, reloc); + + nvfx_vp_emit(vpc, arith(SCA, BRA, none.reg, 0, none, none, none)); + break; + default: NOUVEAU_ERR("invalid opcode %d\n", finst->Instruction.Opcode); return FALSE; @@ -777,6 +881,7 @@ nvfx_vertprog_translate(struct nvfx_context *nvfx, struct tgsi_parse_context parse; struct nvfx_vpc *vpc = NULL; struct nvfx_src none = nvfx_src(nvfx_reg(NVFXSR_NONE, 0)); + struct util_dynarray insns; int i; vpc = CALLOC(1, sizeof(struct nvfx_vpc)); @@ -801,6 +906,7 @@ nvfx_vertprog_translate(struct nvfx_context *nvfx, tgsi_parse_init(&parse, vp->pipe.tokens); + util_dynarray_init(&insns); while (!tgsi_parse_end_of_tokens(&parse)) { tgsi_parse_token(&parse); @@ -823,8 +929,10 @@ nvfx_vertprog_translate(struct nvfx_context *nvfx, case TGSI_TOKEN_TYPE_INSTRUCTION: { const struct tgsi_full_instruction *finst; + unsigned idx = insns.size >> 2; + util_dynarray_append(&insns, unsigned, vp->nr_insns); finst = &parse.FullToken.FullInstruction; - if (!nvfx_vertprog_parse_instruction(nvfx, vpc, finst)) + if (!nvfx_vertprog_parse_instruction(nvfx, vpc, idx, finst)) goto out_err; } break; @@ -833,6 +941,25 @@ nvfx_vertprog_translate(struct nvfx_context *nvfx, } } + util_dynarray_append(&insns, unsigned, vp->nr_insns); + + for(unsigned i = 0; i < vpc->label_relocs.size; i += sizeof(struct nvfx_label_relocation)) + { + struct nvfx_label_relocation* label_reloc = (struct nvfx_label_relocation*)((char*)vpc->label_relocs.data + i); + struct nvfx_label_relocation hw_reloc; + + hw_reloc.location = label_reloc->location; + hw_reloc.target = ((unsigned*)insns.data)[label_reloc->target]; + + //debug_printf("hw %u -> tgsi %u = hw %u\n", hw_reloc.location, label_reloc->target, hw_reloc.target); + + util_dynarray_append(&vp->branch_relocs, struct nvfx_label_relocation, hw_reloc); + } + util_dynarray_fini(&insns); + util_dynarray_trim(&vp->branch_relocs); + + /* XXX: what if we add a RET before?! make sure we jump here...*/ + /* Write out HPOS if it was redirected to a temp earlier */ if (vpc->r_result[vpc->hpos_idx].type != NVFXSR_OUTPUT) { struct nvfx_reg hpos = nvfx_reg(NVFXSR_OUTPUT, @@ -866,7 +993,11 @@ nvfx_vertprog_translate(struct nvfx_context *nvfx, nvfx_vp_emit(vpc, arith(VEC, DP4, cdst, mask, htmp, ceqn, none)); } - vp->insns[vp->nr_insns - 1].data[3] |= NVFX_VP_INST_LAST; + //vp->insns[vp->nr_insns - 1].data[3] |= NVFX_VP_INST_LAST; + + /* Append NOP + END instruction for branches to the end of the program */ + nvfx_vp_emit(vpc, arith(VEC, NOP, none.reg, 0, none, none, none)); + vp->insns[vp->nr_insns - 1].data[3] |= NVFX_VP_INST_LAST | 0x1000; if(debug_get_option_nvfx_dump_vp()) { @@ -879,9 +1010,12 @@ nvfx_vertprog_translate(struct nvfx_context *nvfx, debug_printf("\n"); } + vp->exec_start = -1; vp->translated = TRUE; out_err: tgsi_parse_free(&parse); + util_dynarray_fini(&vpc->label_relocs); + util_dynarray_fini(&vpc->loop_stack); if (vpc->r_temp) FREE(vpc->r_temp); if (vpc->r_address) @@ -977,11 +1111,27 @@ nvfx_vertprog_validate(struct nvfx_context *nvfx) * fixup offsets and register IDs. */ if (vp->exec_start != vp->exec->start) { - for (i = 0; i < vp->nr_insns; i++) { - struct nvfx_vertex_program_exec *vpi = &vp->insns[i]; + //printf("vp_relocs %u -> %u\n", vp->exec_start, vp->exec->start); + for(unsigned i = 0; i < vp->branch_relocs.size; i += sizeof(struct nvfx_label_relocation)) + { + struct nvfx_label_relocation* reloc = (struct nvfx_label_relocation*)((char*)vp->branch_relocs.data + i); + uint32_t* hw = vp->insns[reloc->location].data; + unsigned target = vp->exec->start + reloc->target; - if (vpi->has_branch_offset) { - assert(0); + //debug_printf("vp_reloc hw %u -> hw %u\n", reloc->location, target); + + if(!nvfx->is_nv4x) + { + hw[2] &=~ NV30_VP_INST_IADDR_MASK; + hw[2] |= (target & 0x1ff) << NV30_VP_INST_IADDR_SHIFT; + } + else + { + hw[3] &=~ NV40_VP_INST_IADDRL_MASK; + hw[3] |= (target & 7) << NV40_VP_INST_IADDRL_SHIFT; + + hw[2] &=~ NV40_VP_INST_IADDRH_MASK; + hw[2] |= ((target >> 3) & 0x3f) << NV40_VP_INST_IADDRH_SHIFT; } } -- cgit v1.2.3 From 587d26fdf9c58503333e4e7603a115881a80260b Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Sat, 21 Aug 2010 19:45:06 +0200 Subject: nvfx: implement NOP --- src/gallium/drivers/nvfx/nvfx_fragprog.c | 2 ++ src/gallium/drivers/nvfx/nvfx_vertprog.c | 2 ++ 2 files changed, 4 insertions(+) (limited to 'src') diff --git a/src/gallium/drivers/nvfx/nvfx_fragprog.c b/src/gallium/drivers/nvfx/nvfx_fragprog.c index 91776371e4..2b749efece 100644 --- a/src/gallium/drivers/nvfx/nvfx_fragprog.c +++ b/src/gallium/drivers/nvfx/nvfx_fragprog.c @@ -636,6 +636,8 @@ nvfx_fragprog_parse_instruction(struct nvfx_context* nvfx, struct nvfx_fpc *fpc, case TGSI_OPCODE_MUL: nvfx_fp_emit(fpc, arith(sat, MUL, dst, mask, src[0], src[1], none)); break; + case TGSI_OPCODE_NOP: + break; case TGSI_OPCODE_POW: if(!nvfx->is_nv4x) nvfx_fp_emit(fpc, arith(sat, POW_NV30, dst, mask, src[0], src[1], none)); diff --git a/src/gallium/drivers/nvfx/nvfx_vertprog.c b/src/gallium/drivers/nvfx/nvfx_vertprog.c index 98fcc92898..2894532bd1 100644 --- a/src/gallium/drivers/nvfx/nvfx_vertprog.c +++ b/src/gallium/drivers/nvfx/nvfx_vertprog.c @@ -567,6 +567,8 @@ nvfx_vertprog_parse_instruction(struct nvfx_context* nvfx, struct nvfx_vpc *vpc, case TGSI_OPCODE_MUL: nvfx_vp_emit(vpc, arith(VEC, MUL, dst, mask, src[0], src[1], none)); break; + case TGSI_OPCODE_NOP: + break; case TGSI_OPCODE_POW: tmp = nvfx_src(temp(vpc)); nvfx_vp_emit(vpc, arith(SCA, LG2, tmp.reg, NVFX_VP_MASK_X, none, none, swz(src[0], X, X, X, X))); -- cgit v1.2.3 From 4aec8aa2e33b0bf9d5e8c292d604fe988e439bca Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Sat, 21 Aug 2010 19:35:06 +0200 Subject: nvfx: implement TRUNC in vp and fp --- src/gallium/drivers/nvfx/nvfx_fragprog.c | 25 +++++++++++++++++++------ src/gallium/drivers/nvfx/nvfx_vertprog.c | 13 +++++++++++++ 2 files changed, 32 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/nvfx/nvfx_fragprog.c b/src/gallium/drivers/nvfx/nvfx_fragprog.c index 2b749efece..2c24d523c4 100644 --- a/src/gallium/drivers/nvfx/nvfx_fragprog.c +++ b/src/gallium/drivers/nvfx/nvfx_fragprog.c @@ -725,12 +725,25 @@ nvfx_fragprog_parse_instruction(struct nvfx_context* nvfx, struct nvfx_fpc *fpc, case TGSI_OPCODE_TEX: nvfx_fp_emit(fpc, tex(sat, TEX, unit, dst, mask, src[0], none, none)); break; - case TGSI_OPCODE_TXB: - nvfx_fp_emit(fpc, tex(sat, TXB, unit, dst, mask, src[0], none, none)); - break; - case TGSI_OPCODE_TXP: - nvfx_fp_emit(fpc, tex(sat, TXP, unit, dst, mask, src[0], none, none)); - break; + case TGSI_OPCODE_TRUNC: + tmp = nvfx_src(temp(fpc)); + insn = arith(0, MOV, none.reg, mask, src[0], none, none); + insn.cc_update = 1; + nvfx_fp_emit(fpc, insn); + + nvfx_fp_emit(fpc, arith(0, FLR, tmp.reg, mask, abs(src[0]), none, none)); + nvfx_fp_emit(fpc, arith(sat, MOV, dst, mask, tmp, none, none)); + + insn = arith(sat, MOV, dst, mask, neg(tmp), none, none); + insn.cc_test = NVFX_COND_LT; + nvfx_fp_emit(fpc, insn); + break; + case TGSI_OPCODE_TXB: + nvfx_fp_emit(fpc, tex(sat, TXB, unit, dst, mask, src[0], none, none)); + break; + case TGSI_OPCODE_TXP: + nvfx_fp_emit(fpc, tex(sat, TXP, unit, dst, mask, src[0], none, none)); + break; case TGSI_OPCODE_XPD: tmp = nvfx_src(temp(fpc)); nvfx_fp_emit(fpc, arith(0, MUL, tmp.reg, mask, swz(src[0], Z, X, Y, Y), swz(src[1], Y, Z, X, X), none)); diff --git a/src/gallium/drivers/nvfx/nvfx_vertprog.c b/src/gallium/drivers/nvfx/nvfx_vertprog.c index 2894532bd1..d68224ce7a 100644 --- a/src/gallium/drivers/nvfx/nvfx_vertprog.c +++ b/src/gallium/drivers/nvfx/nvfx_vertprog.c @@ -614,6 +614,19 @@ nvfx_vertprog_parse_instruction(struct nvfx_context* nvfx, struct nvfx_vpc *vpc, case TGSI_OPCODE_SUB: nvfx_vp_emit(vpc, arith(VEC, ADD, dst, mask, src[0], none, neg(src[1]))); break; + case TGSI_OPCODE_TRUNC: + tmp = nvfx_src(temp(vpc)); + insn = arith(VEC, MOV, none.reg, mask, src[0], none, none); + insn.cc_update = 1; + nvfx_vp_emit(vpc, insn); + + nvfx_vp_emit(vpc, arith(VEC, FLR, tmp.reg, mask, abs(src[0]), none, none)); + nvfx_vp_emit(vpc, arith(VEC, MOV, dst, mask, tmp, none, none)); + + insn = arith(VEC, MOV, dst, mask, neg(tmp), none, none); + insn.cc_test = NVFX_COND_LT; + nvfx_vp_emit(vpc, insn); + break; case TGSI_OPCODE_XPD: tmp = nvfx_src(temp(vpc)); nvfx_vp_emit(vpc, arith(VEC, MUL, tmp.reg, mask, swz(src[0], Z, X, Y, Y), swz(src[1], Y, Z, X, X), none)); -- cgit v1.2.3 From 32d2525d645e4a06a116a1c0433bda0dd3bc245f Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Sat, 21 Aug 2010 19:43:46 +0200 Subject: nvfx: implement DP2 in vp and fp --- src/gallium/drivers/nvfx/nvfx_fragprog.c | 5 +++++ src/gallium/drivers/nvfx/nvfx_vertprog.c | 5 +++++ 2 files changed, 10 insertions(+) (limited to 'src') diff --git a/src/gallium/drivers/nvfx/nvfx_fragprog.c b/src/gallium/drivers/nvfx/nvfx_fragprog.c index 2c24d523c4..40cd410e9b 100644 --- a/src/gallium/drivers/nvfx/nvfx_fragprog.c +++ b/src/gallium/drivers/nvfx/nvfx_fragprog.c @@ -573,6 +573,11 @@ nvfx_fragprog_parse_instruction(struct nvfx_context* nvfx, struct nvfx_fpc *fpc, nvfx_fp_emit(fpc, arith(sat, DDY, dst, mask, src[0], none, none)); } break; + case TGSI_OPCODE_DP2: + tmp = nvfx_src(temp(fpc)); + nvfx_fp_emit(fpc, arith(0, MUL, tmp.reg, NVFX_FP_MASK_X | NVFX_FP_MASK_Y, src[0], src[1], none)); + nvfx_fp_emit(fpc, arith(0, ADD, dst, mask, swz(tmp, X, X, X, X), swz(tmp, Y, Y, Y, Y), none)); + break; case TGSI_OPCODE_DP3: nvfx_fp_emit(fpc, arith(sat, DP3, dst, mask, src[0], src[1], none)); break; diff --git a/src/gallium/drivers/nvfx/nvfx_vertprog.c b/src/gallium/drivers/nvfx/nvfx_vertprog.c index d68224ce7a..6b19d86a18 100644 --- a/src/gallium/drivers/nvfx/nvfx_vertprog.c +++ b/src/gallium/drivers/nvfx/nvfx_vertprog.c @@ -514,6 +514,11 @@ nvfx_vertprog_parse_instruction(struct nvfx_context* nvfx, struct nvfx_vpc *vpc, case TGSI_OPCODE_COS: nvfx_vp_emit(vpc, arith(SCA, COS, dst, mask, none, none, src[0])); break; + case TGSI_OPCODE_DP2: + tmp = nvfx_src(temp(vpc)); + nvfx_vp_emit(vpc, arith(VEC, MUL, tmp.reg, NVFX_VP_MASK_X | NVFX_VP_MASK_Y, src[0], src[1], none)); + nvfx_vp_emit(vpc, arith(VEC, ADD, dst, mask, swz(tmp, X, X, X, X), swz(tmp, Y, Y, Y, Y), none)); + break; case TGSI_OPCODE_DP3: nvfx_vp_emit(vpc, arith(VEC, DP3, dst, mask, src[0], src[1], none)); break; -- cgit v1.2.3 From 847ac88671ce4315eb03fcd1d746d20ee03379af Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Sat, 21 Aug 2010 20:05:04 +0200 Subject: nvfx: implement SSG in fp --- src/gallium/drivers/nvfx/nvfx_fragprog.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/drivers/nvfx/nvfx_fragprog.c b/src/gallium/drivers/nvfx/nvfx_fragprog.c index 40cd410e9b..ebd3eb88c1 100644 --- a/src/gallium/drivers/nvfx/nvfx_fragprog.c +++ b/src/gallium/drivers/nvfx/nvfx_fragprog.c @@ -457,7 +457,7 @@ nvfx_fragprog_parse_instruction(struct nvfx_context* nvfx, struct nvfx_fpc *fpc, { const struct nvfx_src none = nvfx_src(nvfx_reg(NVFXSR_NONE, 0)); struct nvfx_insn insn; - struct nvfx_src src[3], tmp; + struct nvfx_src src[3], tmp, tmp2; struct nvfx_reg dst; int mask, sat, unit = 0; int ai = -1, ci = -1, ii = -1; @@ -721,6 +721,13 @@ nvfx_fragprog_parse_instruction(struct nvfx_context* nvfx, struct nvfx_fpc *fpc, case TGSI_OPCODE_SNE: nvfx_fp_emit(fpc, arith(sat, SNE, dst, mask, src[0], src[1], none)); break; + case TGSI_OPCODE_SSG: + tmp = nvfx_src(temp(fpc)); + tmp2 = nvfx_src(temp(fpc)); + nvfx_fp_emit(fpc, arith(0, SGT, tmp.reg, mask, src[0], nvfx_src(nvfx_reg(NVFXSR_CONST, 0)), none)); + nvfx_fp_emit(fpc, arith(0, SLT, tmp.reg, mask, src[0], nvfx_src(nvfx_reg(NVFXSR_CONST, 0)), none)); + nvfx_fp_emit(fpc, arith(sat, ADD, dst, mask, tmp, neg(tmp2), none)); + break; case TGSI_OPCODE_STR: nvfx_fp_emit(fpc, arith(sat, STR, dst, mask, src[0], src[1], none)); break; @@ -896,6 +903,8 @@ nvfx_fragprog_prepare(struct nvfx_context* nvfx, struct nvfx_fpc *fpc) struct tgsi_parse_context p; int high_temp = -1, i; struct util_semantic_set set; + float const0v[4] = {0, 0, 0, 0}; + struct nvfx_reg const0; fpc->fp->num_slots = util_semantic_set_from_program_file(&set, fpc->fp->pipe.tokens, TGSI_FILE_INPUT); if(fpc->fp->num_slots > 8) @@ -905,6 +914,9 @@ nvfx_fragprog_prepare(struct nvfx_context* nvfx, struct nvfx_fpc *fpc) memset(fpc->fp->slot_to_fp_input, 0xff, sizeof(fpc->fp->slot_to_fp_input)); + const0 = constant(fpc, -1, const0v); + assert(const0.index == 0); + tgsi_parse_init(&p, fpc->fp->pipe.tokens); while (!tgsi_parse_end_of_tokens(&p)) { const union tgsi_full_token *tok = &p.FullToken; -- cgit v1.2.3 From 923f5c97b14c107ba647c1c3eb81d81000c301f3 Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Sat, 21 Aug 2010 20:07:48 +0200 Subject: nvfx: implement TXL in fp --- src/gallium/drivers/nvfx/nvfx_fragprog.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src') diff --git a/src/gallium/drivers/nvfx/nvfx_fragprog.c b/src/gallium/drivers/nvfx/nvfx_fragprog.c index ebd3eb88c1..f9b3e075a0 100644 --- a/src/gallium/drivers/nvfx/nvfx_fragprog.c +++ b/src/gallium/drivers/nvfx/nvfx_fragprog.c @@ -753,6 +753,12 @@ nvfx_fragprog_parse_instruction(struct nvfx_context* nvfx, struct nvfx_fpc *fpc, case TGSI_OPCODE_TXB: nvfx_fp_emit(fpc, tex(sat, TXB, unit, dst, mask, src[0], none, none)); break; + case TGSI_OPCODE_TXL: + if(nvfx->is_nv4x) + nvfx_fp_emit(fpc, tex(sat, TXL_NV40, unit, dst, mask, src[0], none, none)); + else /* unsupported on nv30, use TEX and hope they like it */ + nvfx_fp_emit(fpc, tex(sat, TEX, unit, dst, mask, src[0], none, none)); + break; case TGSI_OPCODE_TXP: nvfx_fp_emit(fpc, tex(sat, TXP, unit, dst, mask, src[0], none, none)); break; -- cgit v1.2.3 From 8983621c6b39d74e0f30fa97fb8b4b362eddc87c Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Sat, 21 Aug 2010 20:14:16 +0200 Subject: nvfx: implement CMP in vp --- src/gallium/drivers/nvfx/nvfx_vertprog.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src') diff --git a/src/gallium/drivers/nvfx/nvfx_vertprog.c b/src/gallium/drivers/nvfx/nvfx_vertprog.c index 6b19d86a18..8ca7cfef74 100644 --- a/src/gallium/drivers/nvfx/nvfx_vertprog.c +++ b/src/gallium/drivers/nvfx/nvfx_vertprog.c @@ -511,6 +511,19 @@ nvfx_vertprog_parse_instruction(struct nvfx_context* nvfx, struct nvfx_vpc *vpc, case TGSI_OPCODE_ARL: nvfx_vp_emit(vpc, arith(VEC, ARL, dst, mask, src[0], none, none)); break; + case TGSI_OPCODE_CMP: + insn = arith(VEC, MOV, none.reg, mask, src[0], none, none); + insn.cc_update = 1; + nvfx_vp_emit(vpc, insn); + + insn = arith(VEC, MOV, dst, mask, src[2], none, none); + insn.cc_test = NVFX_COND_GE; + nvfx_vp_emit(vpc, insn); + + insn = arith(VEC, MOV, dst, mask, src[1], none, none); + insn.cc_test = NVFX_COND_LT; + nvfx_vp_emit(vpc, insn); + break; case TGSI_OPCODE_COS: nvfx_vp_emit(vpc, arith(SCA, COS, dst, mask, none, none, src[0])); break; -- cgit v1.2.3 From 5eddf95be992d1d6cafe567068ca4c12b0ee2b4a Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Sat, 21 Aug 2010 20:14:35 +0200 Subject: nvfx: tweak CMP in fp --- src/gallium/drivers/nvfx/nvfx_fragprog.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/drivers/nvfx/nvfx_fragprog.c b/src/gallium/drivers/nvfx/nvfx_fragprog.c index f9b3e075a0..dc681f4d4d 100644 --- a/src/gallium/drivers/nvfx/nvfx_fragprog.c +++ b/src/gallium/drivers/nvfx/nvfx_fragprog.c @@ -536,7 +536,7 @@ nvfx_fragprog_parse_instruction(struct nvfx_context* nvfx, struct nvfx_fpc *fpc, nvfx_fp_emit(fpc, arith(sat, ADD, dst, mask, src[0], src[1], none)); break; case TGSI_OPCODE_CMP: - insn = arith(0, MOV, none.reg, 0xf, src[0], none, none); + insn = arith(0, MOV, none.reg, mask, src[0], none, none); insn.cc_update = 1; nvfx_fp_emit(fpc, insn); -- cgit v1.2.3 From d8e210eb111324482450c8bdbb19e29a805b088e Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Sat, 21 Aug 2010 20:23:41 +0200 Subject: nvfx: slightly improve handling of overlong vps --- src/gallium/drivers/nvfx/nvfx_vertprog.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/nvfx/nvfx_vertprog.c b/src/gallium/drivers/nvfx/nvfx_vertprog.c index 8ca7cfef74..7cccffe0ff 100644 --- a/src/gallium/drivers/nvfx/nvfx_vertprog.c +++ b/src/gallium/drivers/nvfx/nvfx_vertprog.c @@ -1110,7 +1110,11 @@ nvfx_vertprog_validate(struct nvfx_context *nvfx) } if (nouveau_resource_alloc(heap, vplen, vp, &vp->exec)) - assert(0); + { + debug_printf("Vertex shader too long: %u instructions\n", vplen); + nvfx->fallback_swtnl |= NVFX_NEW_VERTPROG; + return FALSE; + } } upload_code = TRUE; @@ -1129,7 +1133,11 @@ nvfx_vertprog_validate(struct nvfx_context *nvfx) } if (nouveau_resource_alloc(heap, vp->nr_consts, vp, &vp->data)) - assert(0); + { + debug_printf("Vertex shader uses too many constants: %u constants\n", vp->nr_consts); + nvfx->fallback_swtnl |= NVFX_NEW_VERTPROG; + return FALSE; + } } /*XXX: handle this some day */ -- cgit v1.2.3 From 1badd3c43fdb21d30a14763c681b26d9dc5924fb Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Sat, 21 Aug 2010 12:00:57 -0700 Subject: scons: Fix nvfx build. --- src/gallium/drivers/nvfx/SConscript | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/drivers/nvfx/SConscript b/src/gallium/drivers/nvfx/SConscript index 02d931b10e..80e3ef2257 100644 --- a/src/gallium/drivers/nvfx/SConscript +++ b/src/gallium/drivers/nvfx/SConscript @@ -9,7 +9,7 @@ env.PrependUnique(delete_existing=1, CPPPATH = [ nvfx = env.ConvenienceLibrary( target = 'nvfx', source = [ - 'nv04_surface_2d.c', + 'nv04_2d.c', 'nvfx_buffer.c', 'nvfx_context.c', 'nvfx_clear.c', @@ -19,6 +19,7 @@ nvfx = env.ConvenienceLibrary( 'nv30_fragtex.c', 'nv40_fragtex.c', 'nvfx_miptree.c', + 'nvfx_push.c', 'nvfx_query.c', 'nvfx_resource.c', 'nvfx_screen.c', -- cgit v1.2.3 From 683118ccf2faa5ed0becb4cde6c00516f4f4afdb Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Sat, 21 Aug 2010 12:21:59 -0700 Subject: auxiliary: Reorder list of files in Makefile. This patch reorders the list of files so that the order is more alphabetic. --- src/gallium/auxiliary/Makefile | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'src') diff --git a/src/gallium/auxiliary/Makefile b/src/gallium/auxiliary/Makefile index a24b038974..eb86d83d2a 100644 --- a/src/gallium/auxiliary/Makefile +++ b/src/gallium/auxiliary/Makefile @@ -4,8 +4,8 @@ include $(TOP)/configs/current LIBNAME = gallium C_SOURCES = \ - cso_cache/cso_context.c \ cso_cache/cso_cache.c \ + cso_cache/cso_context.c \ cso_cache/cso_hash.c \ draw/draw_context.c \ draw/draw_gs.c \ @@ -37,21 +37,21 @@ C_SOURCES = \ draw/draw_pt_vsplit.c \ draw/draw_vertex.c \ draw/draw_vs.c \ - draw/draw_vs_varient.c \ draw/draw_vs_aos.c \ draw/draw_vs_aos_io.c \ draw/draw_vs_aos_machine.c \ draw/draw_vs_exec.c \ draw/draw_vs_ppc.c \ draw/draw_vs_sse.c \ + draw/draw_vs_varient.c \ indices/u_indices_gen.c \ indices/u_unfilled_gen.c \ os/os_misc.c \ os/os_stream.c \ os/os_stream_log.c \ + os/os_stream_null.c \ os/os_stream_stdc.c \ os/os_stream_str.c \ - os/os_stream_null.c \ os/os_time.c \ pipebuffer/pb_buffer_fenced.c \ pipebuffer/pb_buffer_malloc.c \ @@ -64,17 +64,16 @@ C_SOURCES = \ pipebuffer/pb_bufmgr_slab.c \ pipebuffer/pb_validate.c \ rbug/rbug_connection.c \ + rbug/rbug_context.c \ rbug/rbug_core.c \ + rbug/rbug_demarshal.c \ rbug/rbug_texture.c \ - rbug/rbug_context.c \ rbug/rbug_shader.c \ - rbug/rbug_demarshal.c \ rtasm/rtasm_cpu.c \ rtasm/rtasm_execmem.c \ - rtasm/rtasm_x86sse.c \ rtasm/rtasm_ppc.c \ rtasm/rtasm_ppc_spe.c \ - tgsi/tgsi_sanity.c \ + rtasm/rtasm_x86sse.c \ tgsi/tgsi_build.c \ tgsi/tgsi_dump.c \ tgsi/tgsi_exec.c \ @@ -82,21 +81,22 @@ C_SOURCES = \ tgsi/tgsi_iterate.c \ tgsi/tgsi_parse.c \ tgsi/tgsi_ppc.c \ + tgsi/tgsi_sanity.c \ tgsi/tgsi_scan.c \ tgsi/tgsi_sse2.c \ tgsi/tgsi_text.c \ tgsi/tgsi_transform.c \ tgsi/tgsi_ureg.c \ tgsi/tgsi_util.c \ - translate/translate_generic.c \ - translate/translate_sse.c \ translate/translate.c \ translate/translate_cache.c \ + translate/translate_generic.c \ + translate/translate_sse.c \ util/u_debug.c \ util/u_debug_describe.c \ util/u_debug_refcnt.c \ - util/u_debug_symbol.c \ util/u_debug_stack.c \ + util/u_debug_symbol.c \ util/u_dump_defines.c \ util/u_dump_state.c \ util/u_bitmask.c \ @@ -119,8 +119,8 @@ C_SOURCES = \ util/u_gen_mipmap.c \ util/u_half.c \ util/u_handle_table.c \ - util/u_hash_table.c \ util/u_hash.c \ + util/u_hash_table.c \ util/u_keymap.c \ util/u_linear.c \ util/u_linkage.c \ @@ -174,10 +174,10 @@ GALLIVM_SOURCES = \ gallivm/lp_bld_tgsi_soa.c \ gallivm/lp_bld_type.c \ draw/draw_llvm.c \ - draw/draw_vs_llvm.c \ - draw/draw_pt_fetch_shade_pipeline_llvm.c \ + draw/draw_llvm_sample.c \ draw/draw_llvm_translate.c \ - draw/draw_llvm_sample.c + draw/draw_vs_llvm.c \ + draw/draw_pt_fetch_shade_pipeline_llvm.c GALLIVM_CPP_SOURCES = \ gallivm/lp_bld_misc.cpp -- cgit v1.2.3 From 15d558c306da649578ea3539062972ed3a18cd15 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Sat, 21 Aug 2010 12:32:17 -0700 Subject: auxiliary: Add missing files to SCons build. Add u_linear.c and u_linkages.c to SCons build. Reorder list of files to be more alphabetical. --- src/gallium/auxiliary/SConscript | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) (limited to 'src') diff --git a/src/gallium/auxiliary/SConscript b/src/gallium/auxiliary/SConscript index 93bfe9f01f..6210ada990 100644 --- a/src/gallium/auxiliary/SConscript +++ b/src/gallium/auxiliary/SConscript @@ -50,10 +50,11 @@ env.Depends('util/u_format_table.c', [ ]) source = [ - 'cso_cache/cso_context.c', 'cso_cache/cso_cache.c', + 'cso_cache/cso_context.c', 'cso_cache/cso_hash.c', 'draw/draw_context.c', + 'draw/draw_gs.c', 'draw/draw_pipe.c', 'draw/draw_pipe_aaline.c', 'draw/draw_pipe_aapoint.c', @@ -89,7 +90,6 @@ source = [ 'draw/draw_vs_ppc.c', 'draw/draw_vs_sse.c', 'draw/draw_vs_varient.c', - 'draw/draw_gs.c', #'indices/u_indices.c', #'indices/u_unfilled_indices.c', 'indices/u_indices_gen.c', @@ -97,9 +97,9 @@ source = [ 'os/os_misc.c', 'os/os_stream.c', 'os/os_stream_log.c', + 'os/os_stream_null.c', 'os/os_stream_stdc.c', 'os/os_stream_str.c', - 'os/os_stream_null.c', 'os/os_time.c', 'pipebuffer/pb_buffer_fenced.c', 'pipebuffer/pb_buffer_malloc.c', @@ -111,35 +111,35 @@ source = [ 'pipebuffer/pb_bufmgr_pool.c', 'pipebuffer/pb_bufmgr_slab.c', 'pipebuffer/pb_validate.c', + 'rbug/rbug_connection.c', + 'rbug/rbug_context.c', 'rbug/rbug_core.c', + 'rbug/rbug_demarshal.c', 'rbug/rbug_shader.c', - 'rbug/rbug_context.c', 'rbug/rbug_texture.c', - 'rbug/rbug_demarshal.c', - 'rbug/rbug_connection.c', 'rtasm/rtasm_cpu.c', 'rtasm/rtasm_execmem.c', - 'rtasm/rtasm_x86sse.c', 'rtasm/rtasm_ppc.c', 'rtasm/rtasm_ppc_spe.c', + 'rtasm/rtasm_x86sse.c', 'tgsi/tgsi_build.c', 'tgsi/tgsi_dump.c', 'tgsi/tgsi_exec.c', 'tgsi/tgsi_info.c', 'tgsi/tgsi_iterate.c', 'tgsi/tgsi_parse.c', + 'tgsi/tgsi_ppc.c', 'tgsi/tgsi_sanity.c', 'tgsi/tgsi_scan.c', - 'tgsi/tgsi_ppc.c', 'tgsi/tgsi_sse2.c', 'tgsi/tgsi_text.c', 'tgsi/tgsi_transform.c', 'tgsi/tgsi_ureg.c', 'tgsi/tgsi_util.c', - 'translate/translate_generic.c', - 'translate/translate_sse.c', 'translate/translate.c', 'translate/translate_cache.c', + 'translate/translate_generic.c', + 'translate/translate_sse.c', 'util/u_bitmask.c', 'util/u_blit.c', 'util/u_blitter.c', @@ -171,6 +171,8 @@ source = [ 'util/u_hash.c', 'util/u_hash_table.c', 'util/u_keymap.c', + 'util/u_linear.c', + 'util/u_linkage.c', 'util/u_network.c', 'util/u_math.c', 'util/u_mempool.c', @@ -209,9 +211,9 @@ if env['llvm']: 'gallivm/lp_bld_format_soa.c', 'gallivm/lp_bld_format_yuv.c', 'gallivm/lp_bld_gather.c', + 'gallivm/lp_bld_init.c', 'gallivm/lp_bld_intr.c', 'gallivm/lp_bld_logic.c', - 'gallivm/lp_bld_init.c', 'gallivm/lp_bld_misc.cpp', 'gallivm/lp_bld_pack.c', 'gallivm/lp_bld_printf.c', @@ -223,10 +225,10 @@ if env['llvm']: 'gallivm/lp_bld_tgsi_soa.c', 'gallivm/lp_bld_type.c', 'draw/draw_llvm.c', - 'draw/draw_pt_fetch_shade_pipeline_llvm.c', + 'draw/draw_llvm_sample.c', 'draw/draw_llvm_translate.c', - 'draw/draw_vs_llvm.c', - 'draw/draw_llvm_sample.c' + 'draw/draw_pt_fetch_shade_pipeline_llvm.c', + 'draw/draw_vs_llvm.c' ] gallium = env.ConvenienceLibrary( -- cgit v1.2.3 From 42210f44645c154983705a2caea6af8fbdafbc12 Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Sat, 21 Aug 2010 21:29:18 +0200 Subject: nvfx: enable translate_sse --- src/gallium/drivers/nvfx/nvfx_vbo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/drivers/nvfx/nvfx_vbo.c b/src/gallium/drivers/nvfx/nvfx_vbo.c index a6cd125635..abd7706512 100644 --- a/src/gallium/drivers/nvfx/nvfx_vbo.c +++ b/src/gallium/drivers/nvfx/nvfx_vbo.c @@ -513,7 +513,7 @@ nvfx_vtxelts_state_create(struct pipe_context *pipe, } } - cso->translate = translate_generic_create(&transkey); + cso->translate = translate_create(&transkey); cso->vertex_length = transkey.output_stride >> 2; cso->max_vertices_per_packet = 2047 / cso->vertex_length; -- cgit v1.2.3 From 0d96cbe4a5e0a39c17db007f3815868c6a766382 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Sat, 21 Aug 2010 21:58:22 +0100 Subject: gallivm: Emit DIVPS instead of RCPPS. See comments for detailed rationale. Thanks to Michal Krol and Zack Rusin for detecting and investigating this in detail. --- src/gallium/auxiliary/gallivm/lp_bld_arit.c | 36 +++++++++++++++++++---------- 1 file changed, 24 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/gallium/auxiliary/gallivm/lp_bld_arit.c b/src/gallium/auxiliary/gallivm/lp_bld_arit.c index 7b35dd4bb4..bb30e6e9df 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_arit.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_arit.c @@ -59,14 +59,6 @@ #include "lp_bld_arit.h" -/* - * XXX: Increasing eliminates some artifacts, but adds others, most - * noticeably corruption in the Earth halo in Google Earth. - */ -#define RCP_NEWTON_STEPS 0 - -#define RSQRT_NEWTON_STEPS 0 - #define EXP_POLY_DEGREE 3 #define LOG_POLY_DEGREE 5 @@ -1266,6 +1258,11 @@ lp_build_sqrt(struct lp_build_context *bld, * * x_{i+1} = x_i * (2 - a * x_i) * + * XXX: Unfortunately this won't give IEEE-754 conformant results for 0 or + * +/-Inf, giving NaN instead. Certain applications rely on this behavior, + * such as Google Earth, which does RCP(RSQRT(0.0) when drawing the Earth's + * halo. It would be necessary to clamp the argument to prevent this. + * * See also: * - http://en.wikipedia.org/wiki/Division_(digital)#Newton.E2.80.93Raphson_division * - http://softwarecommunity.intel.com/articles/eng/1818.htm @@ -1306,13 +1303,27 @@ lp_build_rcp(struct lp_build_context *bld, if(LLVMIsConstant(a)) return LLVMConstFDiv(bld->one, a); - if(util_cpu_caps.has_sse && type.width == 32 && type.length == 4) { + /* + * We don't use RCPPS because: + * - it only has 10bits of precision + * - it doesn't even get the reciprocate of 1.0 exactly + * - doing Newton-Rapshon steps yields wrong (NaN) values for 0.0 or Inf + * - for recent processors the benefit over DIVPS is marginal, a case + * depedent + * + * We could still use it on certain processors if benchmarks show that the + * RCPPS plus necessary workarounds are still preferrable to DIVPS; or for + * particular uses that require less workarounds. + */ + + if (FALSE && util_cpu_caps.has_sse && type.width == 32 && type.length == 4) { + const unsigned num_iterations = 0; LLVMValueRef res; unsigned i; res = lp_build_intrinsic_unary(bld->builder, "llvm.x86.sse.rcp.ps", bld->vec_type, a); - for (i = 0; i < RCP_NEWTON_STEPS; ++i) { + for (i = 0; i < num_iterations; ++i) { res = lp_build_rcp_refine(bld, a, res); } @@ -1363,13 +1374,14 @@ lp_build_rsqrt(struct lp_build_context *bld, assert(type.floating); - if(util_cpu_caps.has_sse && type.width == 32 && type.length == 4) { + if (util_cpu_caps.has_sse && type.width == 32 && type.length == 4) { + const unsigned num_iterations = 0; LLVMValueRef res; unsigned i; res = lp_build_intrinsic_unary(bld->builder, "llvm.x86.sse.rsqrt.ps", bld->vec_type, a); - for (i = 0; i < RSQRT_NEWTON_STEPS; ++i) { + for (i = 0; i < num_iterations; ++i) { res = lp_build_rsqrt_refine(bld, a, res); } -- cgit v1.2.3 From 11d27871a79fb7ffcf0e139a8c04d90991969023 Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Sat, 21 Aug 2010 22:48:29 +0200 Subject: nvfx: fix warnings --- src/gallium/drivers/nvfx/nvfx_context.h | 2 +- src/gallium/drivers/nvfx/nvfx_vbo.c | 1 - src/gallium/drivers/nvfx/nvfx_vertprog.c | 4 +--- 3 files changed, 2 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/nvfx/nvfx_context.h b/src/gallium/drivers/nvfx/nvfx_context.h index 04447da3e1..83c44ef477 100644 --- a/src/gallium/drivers/nvfx/nvfx_context.h +++ b/src/gallium/drivers/nvfx/nvfx_context.h @@ -312,7 +312,7 @@ extern void nvfx_vertprog_destroy(struct nvfx_context *, extern void nvfx_push_vbo(struct pipe_context *pipe, const struct pipe_draw_info *info); /* must WAIT_RING(chan, ncomp + 1) or equivalent beforehand! */ -static inline void nvfx_emit_vtx_attr(struct nouveau_channel* chan, unsigned attrib, float* v, unsigned ncomp) +static inline void nvfx_emit_vtx_attr(struct nouveau_channel* chan, unsigned attrib, const float* v, unsigned ncomp) { switch (ncomp) { case 4: diff --git a/src/gallium/drivers/nvfx/nvfx_vbo.c b/src/gallium/drivers/nvfx/nvfx_vbo.c index abd7706512..d1e7199287 100644 --- a/src/gallium/drivers/nvfx/nvfx_vbo.c +++ b/src/gallium/drivers/nvfx/nvfx_vbo.c @@ -419,7 +419,6 @@ nvfx_vtxelts_state_create(struct pipe_context *pipe, unsigned num_elements, const struct pipe_vertex_element *elements) { - struct nvfx_context* nvfx = nvfx_context(pipe); struct nvfx_vtxelt_state *cso = CALLOC_STRUCT(nvfx_vtxelt_state); struct translate_key transkey; unsigned per_vertex_size[16]; diff --git a/src/gallium/drivers/nvfx/nvfx_vertprog.c b/src/gallium/drivers/nvfx/nvfx_vertprog.c index 7cccffe0ff..b5dde2592e 100644 --- a/src/gallium/drivers/nvfx/nvfx_vertprog.c +++ b/src/gallium/drivers/nvfx/nvfx_vertprog.c @@ -801,7 +801,6 @@ nvfx_vertprog_prepare(struct nvfx_context* nvfx, struct nvfx_vpc *vpc) int high_temp = -1, high_addr = -1, nr_imm = 0, i; struct util_semantic_set set; unsigned char sem_layout[8]; - unsigned sem_layout_size; unsigned num_outputs; num_outputs = util_semantic_set_from_program_file(&set, vpc->vp->pipe.tokens, TGSI_FILE_OUTPUT); @@ -1061,7 +1060,6 @@ out_err: boolean nvfx_vertprog_validate(struct nvfx_context *nvfx) { - struct pipe_context *pipe = &nvfx->pipe; struct nvfx_screen *screen = nvfx->screen; struct nouveau_channel *chan = screen->base.channel; struct nouveau_grobj *eng3d = screen->eng3d; @@ -1200,7 +1198,7 @@ nvfx_vertprog_validate(struct nvfx_context *nvfx) float *map = NULL; if (constbuf) - map = nvfx_buffer(constbuf)->data; + map = (float*)nvfx_buffer(constbuf)->data; for (i = 0; i < vp->nr_consts; i++) { struct nvfx_vertex_program_data *vpd = &vp->consts[i]; -- cgit v1.2.3 From 489c787b80064b590016eecf2b8157760b0bc8a2 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Sat, 21 Aug 2010 14:29:50 -0700 Subject: nvfx: Fix SCons build. Move declarations before code. Fix void pointer arithmetic. --- src/gallium/drivers/nvfx/nv04_2d.c | 44 +++++++++++++++++++--------- src/gallium/drivers/nvfx/nvfx_buffer.c | 2 +- src/gallium/drivers/nvfx/nvfx_fragprog.c | 47 ++++++++++++++++++++---------- src/gallium/drivers/nvfx/nvfx_miptree.c | 5 ++-- src/gallium/drivers/nvfx/nvfx_state_emit.c | 3 +- src/gallium/drivers/nvfx/nvfx_surface.c | 35 +++++++++++++--------- src/gallium/drivers/nvfx/nvfx_vbo.c | 25 ++++++++++------ 7 files changed, 105 insertions(+), 56 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/nvfx/nv04_2d.c b/src/gallium/drivers/nvfx/nv04_2d.c index b2f2ae79e1..46d5f5c08d 100644 --- a/src/gallium/drivers/nvfx/nv04_2d.c +++ b/src/gallium/drivers/nvfx/nv04_2d.c @@ -257,6 +257,9 @@ nv04_region_assert(struct nv04_region* rgn, unsigned w, unsigned h) static inline int nv04_region_is_contiguous(struct nv04_region* rgn, int w, int h) { + int surf_min; + int rect_min; + if(rgn->pitch) return rgn->pitch == w << rgn->bpps; @@ -275,8 +278,8 @@ nv04_region_is_contiguous(struct nv04_region* rgn, int w, int h) if(rgn->d > 1) return 0; - int surf_min = MIN2(rgn->w, rgn->h); - int rect_min = MIN2(w, h); + surf_min = MIN2(rgn->w, rgn->h); + rect_min = MIN2(w, h); if((rect_min == surf_min) || (w == h) || (w == 2 * h)) return 1; @@ -361,8 +364,10 @@ nv04_region_do_align_offset(struct nv04_region* rgn, unsigned w, unsigned h, int { if(rgn->pitch > 0) { + int delta; + assert(!(rgn->offset & ((1 << rgn->bpps) - 1))); // fatal! - int delta = rgn->offset & ((1 << shift) - 1); + delta = rgn->offset & ((1 << shift) - 1); if(h <= 1) { @@ -388,19 +393,22 @@ nv04_region_do_align_offset(struct nv04_region* rgn, unsigned w, unsigned h, int } else { + int size; + int min; + int v; + // we don't care about the alignment of 3D surfaces since the 2D engine can't use them if(rgn->d < 0) return -1; - int size; - int min = MIN2(rgn->w, rgn->h); + min = MIN2(rgn->w, rgn->h); size = min * min << rgn->bpps; // this is unfixable, and should not be happening if(rgn->offset & (size - 1)) return -1; - int v = (rgn->offset & ((1 << shift) - 1)) / size; + v = (rgn->offset & ((1 << shift) - 1)) / size; rgn->offset -= v * size; if(rgn->h == min) @@ -457,6 +465,10 @@ nv04_region_align(struct nv04_region* rgn, unsigned w, unsigned h, int shift) void nv04_region_copy_cpu(struct nv04_region* dst, struct nv04_region* src, int w, int h) { + uint8_t* mdst; + uint8_t* msrc; + int size; + if(dst->bo != src->bo) { nouveau_bo_map(dst->bo, NOUVEAU_BO_WR); @@ -465,10 +477,10 @@ nv04_region_copy_cpu(struct nv04_region* dst, struct nv04_region* src, int w, in else nouveau_bo_map(dst->bo, NOUVEAU_BO_WR | NOUVEAU_BO_RD); - uint8_t* mdst = dst->bo->map + dst->offset; - uint8_t* msrc = src->bo->map + src->offset; + mdst = (uint8_t*)dst->bo->map + dst->offset; + msrc = (uint8_t*)src->bo->map + src->offset; - int size = w << dst->bpps; + size = w << dst->bpps; nv04_region_assert(dst, w, h); nv04_region_assert(src, w, h); @@ -548,6 +560,7 @@ simple: int* dswy; int* sswx; int* sswy; + int dir; if(!dst->pitch) { @@ -569,7 +582,7 @@ simple: sswy[iy] = nv04_swizzle_bits(0, src->y + iy, src->z, src->w, src->h, src->d); } - int dir = 1; + dir = 1; /* do backwards copies for overlapping swizzled surfaces */ if(dst->pitch == src->pitch && dst->offset == src->offset) { @@ -611,7 +624,7 @@ simple: void nv04_region_fill_cpu(struct nv04_region* dst, int w, int h, unsigned value) { - uint8_t* mdst = (nouveau_bo_map(dst->bo, NOUVEAU_BO_WR), dst->bo->map + dst->offset); + uint8_t* mdst = (nouveau_bo_map(dst->bo, NOUVEAU_BO_WR), (uint8_t*)dst->bo->map + dst->offset); #ifdef NV04_REGION_DEBUG fprintf(stderr, "\tRGN_FILL_CPU "); @@ -727,11 +740,12 @@ nv04_region_copy_swizzle(struct nv04_2d_context *ctx, unsigned ex = (dst->x + w - 1) >> max_shift; unsigned ey = (dst->y + h - 1) >> max_shift; unsigned chunks = (ex - sx + 1) * (ey - sy + 1); + unsigned chunk_size; if(dst->w < cw) cw = dst->w; if(dst->h < ch) ch = dst->h; - unsigned chunk_size = cw * ch << dst->bpps; + chunk_size = cw * ch << dst->bpps; #ifdef NV04_REGION_DEBUG fprintf(stderr, "\tRGN_COPY_SWIZZLE [%i, %i: %i] ", w, h, dst->bpps); @@ -770,10 +784,12 @@ nv04_region_copy_swizzle(struct nv04_2d_context *ctx, for (int cx = sx; cx <= ex; ++cx) { int rx = MAX2(0, (int)(dst->x - cw * cx)); int rw = MIN2((int)cw, (int)(dst->x - cw * cx + w)) - rx; + unsigned dst_offset; + unsigned src_offset; BEGIN_RING(chan, swzsurf, NV04_SWIZZLED_SURFACE_OFFSET, 1); - unsigned dst_offset = dst->offset + (nv04_swizzle_bits_2d(cx * cw, cy * ch, dst->w, dst->h) << dst->bpps); + dst_offset = dst->offset + (nv04_swizzle_bits_2d(cx * cw, cy * ch, dst->w, dst->h) << dst->bpps); assert(dst_offset <= dst->bo->size); assert(dst_offset + chunk_size <= dst->bo->size); OUT_RELOCl(chan, dst->bo, dst_offset, @@ -795,7 +811,7 @@ nv04_region_copy_swizzle(struct nv04_2d_context *ctx, OUT_RING (chan, src->pitch | NV03_SCALED_IMAGE_FROM_MEMORY_FORMAT_ORIGIN_CENTER | NV03_SCALED_IMAGE_FROM_MEMORY_FORMAT_FILTER_POINT_SAMPLE); - unsigned src_offset = src->offset + (cy * ch + ry + src->y - dst->y) * src->pitch + ((cx * cw + rx + src->x - dst->x) << src->bpps); + src_offset = src->offset + (cy * ch + ry + src->y - dst->y) * src->pitch + ((cx * cw + rx + src->x - dst->x) << src->bpps); assert(src_offset <= src->bo->size); assert(src_offset + (src->pitch * (rh - 1)) + (rw << src->bpps) <= src->bo->size); OUT_RELOCl(chan, src->bo, src_offset, diff --git a/src/gallium/drivers/nvfx/nvfx_buffer.c b/src/gallium/drivers/nvfx/nvfx_buffer.c index 89bb8570ef..041099e0e5 100644 --- a/src/gallium/drivers/nvfx/nvfx_buffer.c +++ b/src/gallium/drivers/nvfx/nvfx_buffer.c @@ -89,7 +89,7 @@ void nvfx_buffer_upload(struct nvfx_buffer* buffer) // TODO: may want to use a temporary in some cases nouveau_bo_map(buffer->base.bo, NOUVEAU_BO_WR | (buffer->dirty_unsynchronized ? NOUVEAU_BO_NOSYNC : 0)); - memcpy(buffer->base.bo->map + buffer->dirty_begin, buffer->data + buffer->dirty_begin, dirty); + memcpy((uint8_t*)buffer->base.bo->map + buffer->dirty_begin, buffer->data + buffer->dirty_begin, dirty); nouveau_bo_unmap(buffer->base.bo); buffer->dirty_begin = buffer->dirty_end = 0; } diff --git a/src/gallium/drivers/nvfx/nvfx_fragprog.c b/src/gallium/drivers/nvfx/nvfx_fragprog.c index dc681f4d4d..6c8f5c4708 100644 --- a/src/gallium/drivers/nvfx/nvfx_fragprog.c +++ b/src/gallium/drivers/nvfx/nvfx_fragprog.c @@ -244,12 +244,13 @@ nv40_fp_if(struct nvfx_fpc *fpc, struct nvfx_src src) { const struct nvfx_src none = nvfx_src(nvfx_reg(NVFXSR_NONE, 0)); struct nvfx_insn insn = arith(0, MOV, none.reg, NVFX_FP_MASK_X, src, none, none); + uint32_t *hw; insn.cc_update = 1; nvfx_fp_emit(fpc, insn); fpc->inst_offset = fpc->fp->insn_len; grow_insns(fpc, 4); - uint32_t *hw = &fpc->fp->insn[fpc->inst_offset]; + hw = &fpc->fp->insn[fpc->inst_offset]; /* I really wonder why fp16 precision is used. Presumably the hardware ignores it? */ hw[0] = (NV40_FP_OP_BRA_OPCODE_IF << NVFX_FP_OP_OPCODE_SHIFT) | NV40_FP_OP_OUT_NONE | @@ -270,9 +271,10 @@ static void nv40_fp_cal(struct nvfx_fpc *fpc, unsigned target) { struct nvfx_label_relocation reloc; + uint32_t *hw; fpc->inst_offset = fpc->fp->insn_len; grow_insns(fpc, 4); - uint32_t *hw = &fpc->fp->insn[fpc->inst_offset]; + hw = &fpc->fp->insn[fpc->inst_offset]; /* I really wonder why fp16 precision is used. Presumably the hardware ignores it? */ hw[0] = (NV40_FP_OP_BRA_OPCODE_CAL << NVFX_FP_OP_OPCODE_SHIFT); /* Use .xxxx swizzle so that we check only src[0].x*/ @@ -288,9 +290,10 @@ nv40_fp_cal(struct nvfx_fpc *fpc, unsigned target) static void nv40_fp_ret(struct nvfx_fpc *fpc) { + uint32_t *hw; fpc->inst_offset = fpc->fp->insn_len; grow_insns(fpc, 4); - uint32_t *hw = &fpc->fp->insn[fpc->inst_offset]; + hw = &fpc->fp->insn[fpc->inst_offset]; /* I really wonder why fp16 precision is used. Presumably the hardware ignores it? */ hw[0] = (NV40_FP_OP_BRA_OPCODE_RET << NVFX_FP_OP_OPCODE_SHIFT); /* Use .xxxx swizzle so that we check only src[0].x*/ @@ -304,9 +307,10 @@ static void nv40_fp_rep(struct nvfx_fpc *fpc, unsigned count, unsigned target) { struct nvfx_label_relocation reloc; + uint32_t *hw; fpc->inst_offset = fpc->fp->insn_len; grow_insns(fpc, 4); - uint32_t *hw = &fpc->fp->insn[fpc->inst_offset]; + hw = &fpc->fp->insn[fpc->inst_offset]; /* I really wonder why fp16 precision is used. Presumably the hardware ignores it? */ hw[0] = (NV40_FP_OP_BRA_OPCODE_REP << NVFX_FP_OP_OPCODE_SHIFT) | NV40_FP_OP_OUT_NONE | @@ -330,9 +334,10 @@ static void nv40_fp_bra(struct nvfx_fpc *fpc, unsigned target) { struct nvfx_label_relocation reloc; + uint32_t *hw; fpc->inst_offset = fpc->fp->insn_len; grow_insns(fpc, 4); - uint32_t *hw = &fpc->fp->insn[fpc->inst_offset]; + hw = &fpc->fp->insn[fpc->inst_offset]; /* I really wonder why fp16 precision is used. Presumably the hardware ignores it? */ hw[0] = (NV40_FP_OP_BRA_OPCODE_IF << NVFX_FP_OP_OPCODE_SHIFT) | NV40_FP_OP_OUT_NONE | @@ -353,9 +358,10 @@ nv40_fp_bra(struct nvfx_fpc *fpc, unsigned target) static void nv40_fp_brk(struct nvfx_fpc *fpc) { + uint32_t *hw; fpc->inst_offset = fpc->fp->insn_len; grow_insns(fpc, 4); - uint32_t *hw = &fpc->fp->insn[fpc->inst_offset]; + hw = &fpc->fp->insn[fpc->inst_offset]; /* I really wonder why fp16 precision is used. Presumably the hardware ignores it? */ hw[0] = (NV40_FP_OP_BRA_OPCODE_BRK << NVFX_FP_OP_OPCODE_SHIFT) | NV40_FP_OP_OUT_NONE; @@ -778,20 +784,22 @@ nvfx_fragprog_parse_instruction(struct nvfx_context* nvfx, struct nvfx_fpc *fpc, case TGSI_OPCODE_ELSE: { + uint32_t *hw; if(!nvfx->is_nv4x) goto nv3x_cflow; assert(util_dynarray_contains(&fpc->if_stack, unsigned)); - uint32_t *hw = &fpc->fp->insn[util_dynarray_top(&fpc->if_stack, unsigned)]; + hw = &fpc->fp->insn[util_dynarray_top(&fpc->if_stack, unsigned)]; hw[2] = NV40_FP_OP_OPCODE_IS_BRANCH | fpc->fp->insn_len; break; } case TGSI_OPCODE_ENDIF: { + uint32_t *hw; if(!nvfx->is_nv4x) goto nv3x_cflow; assert(util_dynarray_contains(&fpc->if_stack, unsigned)); - uint32_t *hw = &fpc->fp->insn[util_dynarray_pop(&fpc->if_stack, unsigned)]; + hw = &fpc->fp->insn[util_dynarray_pop(&fpc->if_stack, unsigned)]; if(!hw[2]) hw[2] = NV40_FP_OP_OPCODE_IS_BRANCH | fpc->fp->insn_len; hw[3] = fpc->fp->insn_len; @@ -1097,6 +1105,8 @@ nvfx_fragprog_validate(struct nvfx_context *nvfx) struct nouveau_channel* chan = nvfx->screen->base.channel; struct nvfx_fragment_program *fp = nvfx->fragprog; int update = 0; + struct nvfx_vertex_program* vp; + unsigned sprite_coord_enable; if (!fp->translated) { @@ -1135,13 +1145,14 @@ nvfx_fragprog_validate(struct nvfx_context *nvfx) if (nvfx->dirty & (NVFX_NEW_FRAGCONST | NVFX_NEW_FRAGPROG)) update = TRUE; - struct nvfx_vertex_program* vp = nvfx->render_mode == HW ? nvfx->vertprog : nvfx->swtnl.vertprog; + vp = nvfx->render_mode == HW ? nvfx->vertprog : nvfx->swtnl.vertprog; if (fp->last_vp_id != vp->id) { char* vp_sem_table = vp->generic_to_fp_input; unsigned char* fp_semantics = fp->slot_to_generic; unsigned diff = 0; + unsigned char* cur_slots; fp->last_vp_id = nvfx->vertprog->id; - unsigned char* cur_slots = fp->slot_to_fp_input; + cur_slots = fp->slot_to_fp_input; for(unsigned i = 0; i < fp->num_slots; ++i) { unsigned char slot_mask = vp_sem_table[fp_semantics[i]]; diff |= (slot_mask >> 4) & (slot_mask ^ cur_slots[i]); @@ -1161,7 +1172,7 @@ nvfx_fragprog_validate(struct nvfx_context *nvfx) } // last_sprite_coord_enable - unsigned sprite_coord_enable = nvfx->rasterizer->pipe.point_quad_rasterization * nvfx->rasterizer->pipe.sprite_coord_enable; + sprite_coord_enable = nvfx->rasterizer->pipe.point_quad_rasterization * nvfx->rasterizer->pipe.sprite_coord_enable; if(fp->last_sprite_coord_enable != sprite_coord_enable) { unsigned texcoord_mask = vp->texcoord_ouput_mask; @@ -1199,6 +1210,9 @@ nvfx_fragprog_validate(struct nvfx_context *nvfx) } if(update) { + int offset; + uint32_t* fpmap; + ++fp->bo_prog_idx; if(fp->bo_prog_idx >= fp->progs_per_bo) { @@ -1209,6 +1223,9 @@ nvfx_fragprog_validate(struct nvfx_context *nvfx) else { struct nvfx_fragment_program_bo* fpbo = os_malloc_aligned(sizeof(struct nvfx_fragment_program) + (fp->prog_size + 8) * fp->progs_per_bo, 16); + uint8_t* map; + uint8_t* buf; + fpbo->slots = (unsigned char*)&fpbo->insn[(fp->prog_size) * fp->progs_per_bo]; memset(fpbo->slots, 0, 8 * fp->progs_per_bo); if(fp->fpbo) @@ -1225,8 +1242,8 @@ nvfx_fragprog_validate(struct nvfx_context *nvfx) nouveau_bo_new(nvfx->screen->base.device, NOUVEAU_BO_VRAM | NOUVEAU_BO_MAP, 64, fp->prog_size * fp->progs_per_bo, &fpbo->bo); nouveau_bo_map(fpbo->bo, NOUVEAU_BO_NOSYNC); - uint8_t* map = fpbo->bo->map; - uint8_t* buf = (uint8_t*)fpbo->insn; + map = fpbo->bo->map; + buf = (uint8_t*)fpbo->insn; for(unsigned i = 0; i < fp->progs_per_bo; ++i) { memcpy(buf, fp->insn, fp->insn_len * 4); @@ -1238,8 +1255,8 @@ nvfx_fragprog_validate(struct nvfx_context *nvfx) fp->bo_prog_idx = 0; } - int offset = fp->bo_prog_idx * fp->prog_size; - uint32_t* fpmap = (uint32_t*)((char*)fp->fpbo->bo->map + offset); + offset = fp->bo_prog_idx * fp->prog_size; + fpmap = (uint32_t*)((char*)fp->fpbo->bo->map + offset); if(nvfx->constbuf[PIPE_SHADER_FRAGMENT]) { struct pipe_resource* constbuf = nvfx->constbuf[PIPE_SHADER_FRAGMENT]; diff --git a/src/gallium/drivers/nvfx/nvfx_miptree.c b/src/gallium/drivers/nvfx/nvfx_miptree.c index 559e832109..0532b43ef0 100644 --- a/src/gallium/drivers/nvfx/nvfx_miptree.c +++ b/src/gallium/drivers/nvfx/nvfx_miptree.c @@ -155,9 +155,10 @@ struct pipe_resource * nvfx_miptree_create(struct pipe_screen *pscreen, const struct pipe_resource *pt) { struct nvfx_miptree* mt = nvfx_miptree_create_skeleton(pscreen, pt); + unsigned size; nvfx_miptree_choose_format(mt); - unsigned size = nvfx_miptree_layout(mt); + size = nvfx_miptree_layout(mt); mt->base.bo = nouveau_screen_bo_new(pscreen, 256, pt->usage, pt->bind, size); @@ -173,6 +174,7 @@ struct pipe_resource * nvfx_miptree_from_handle(struct pipe_screen *pscreen, const struct pipe_resource *template, struct winsys_handle *whandle) { struct nvfx_miptree* mt = nvfx_miptree_create_skeleton(pscreen, template); + unsigned stride; if(whandle->stride) { mt->linear_pitch = whandle->stride; mt->base.base.flags |= NVFX_RESOURCE_FLAG_LINEAR; @@ -181,7 +183,6 @@ nvfx_miptree_from_handle(struct pipe_screen *pscreen, const struct pipe_resource nvfx_miptree_layout(mt); - unsigned stride; mt->base.bo = nouveau_screen_bo_from_handle(pscreen, whandle, &stride); if (mt->base.bo == NULL) { FREE(mt); diff --git a/src/gallium/drivers/nvfx/nvfx_state_emit.c b/src/gallium/drivers/nvfx/nvfx_state_emit.c index 19512194be..8e3c342179 100644 --- a/src/gallium/drivers/nvfx/nvfx_state_emit.c +++ b/src/gallium/drivers/nvfx/nvfx_state_emit.c @@ -11,6 +11,7 @@ nvfx_state_validate_common(struct nvfx_context *nvfx) unsigned still_dirty = 0; int all_swizzled = -1; boolean flush_tex_cache = FALSE; + unsigned render_temps; if(nvfx != nvfx->screen->cur_ctx) { @@ -141,7 +142,7 @@ nvfx_state_validate_common(struct nvfx_context *nvfx) nvfx->dirty = dirty & still_dirty; - unsigned render_temps = nvfx->state.render_temps; + render_temps = nvfx->state.render_temps; if(render_temps) { for(int i = 0; i < nvfx->framebuffer.nr_cbufs; ++i) diff --git a/src/gallium/drivers/nvfx/nvfx_surface.c b/src/gallium/drivers/nvfx/nvfx_surface.c index 135978ad27..806f1a22e6 100644 --- a/src/gallium/drivers/nvfx/nvfx_surface.c +++ b/src/gallium/drivers/nvfx/nvfx_surface.c @@ -60,14 +60,17 @@ nvfx_region_set_format(struct nv04_region* rgn, enum pipe_format format) rgn->bpps = 2; break; default: - assert(util_is_pot(bits)); - int shift = util_logbase2(bits) - 3; - assert(shift >= 2); - rgn->bpps = 2; - shift -= 2; - - rgn->x = util_format_get_nblocksx(format, rgn->x) << shift; - rgn->y = util_format_get_nblocksy(format, rgn->y); + { + int shift; + assert(util_is_pot(bits)); + shift = util_logbase2(bits) - 3; + assert(shift >= 2); + rgn->bpps = 2; + shift -= 2; + + rgn->x = util_format_get_nblocksx(format, rgn->x) << shift; + rgn->y = util_format_get_nblocksy(format, rgn->y); + } } } @@ -241,26 +244,29 @@ nvfx_resource_copy_region(struct pipe_context *pipe, unsigned srcx, unsigned srcy, unsigned srcz, unsigned w, unsigned h) { + static int copy_threshold = -1; struct nv04_2d_context *ctx = nvfx_screen(pipe->screen)->eng2d; struct nv04_region dst, src; + int dst_to_gpu; + int src_on_gpu; + boolean small; + int ret; if(!w || !h) return; - static int copy_threshold = -1; if(copy_threshold < 0) copy_threshold = debug_get_num_option("NOUVEAU_COPY_THRESHOLD", 4); - int dst_to_gpu = dstr->usage != PIPE_USAGE_DYNAMIC && dstr->usage != PIPE_USAGE_STAGING; - int src_on_gpu = nvfx_resource_on_gpu(srcr); + dst_to_gpu = dstr->usage != PIPE_USAGE_DYNAMIC && dstr->usage != PIPE_USAGE_STAGING; + src_on_gpu = nvfx_resource_on_gpu(srcr); nvfx_region_init_for_subresource(&dst, dstr, subdst, dstx, dsty, dstz, TRUE); nvfx_region_init_for_subresource(&src, srcr, subsrc, srcx, srcy, srcz, FALSE); w = util_format_get_stride(dstr->format, w) >> dst.bpps; h = util_format_get_nblocksy(dstr->format, h); - int ret; - boolean small = (w * h <= copy_threshold); + small = (w * h <= copy_threshold); if((!dst_to_gpu || !src_on_gpu) && small) ret = -1; /* use the CPU */ else @@ -309,6 +315,7 @@ nvfx_surface_fill(struct pipe_context* pipe, struct pipe_surface *dsts, { struct nv04_2d_context *ctx = nvfx_screen(pipe->screen)->eng2d; struct nv04_region dst; + int ret; /* Always try to use the GPU right now, if possible * If the user wanted the surface data on the CPU, he would have cleared with memset (hopefully) */ @@ -318,7 +325,7 @@ nvfx_surface_fill(struct pipe_context* pipe, struct pipe_surface *dsts, w = util_format_get_stride(dsts->format, w) >> dst.bpps; h = util_format_get_nblocksy(dsts->format, h); - int ret = nv04_region_fill_2d(ctx, &dst, w, h, value); + ret = nv04_region_fill_2d(ctx, &dst, w, h, value); if(ret > 0 && dsts->texture->bind & PIPE_BIND_RENDER_TARGET) return 1; else if(ret) diff --git a/src/gallium/drivers/nvfx/nvfx_vbo.c b/src/gallium/drivers/nvfx/nvfx_vbo.c index d1e7199287..5d3fb6fb6c 100644 --- a/src/gallium/drivers/nvfx/nvfx_vbo.c +++ b/src/gallium/drivers/nvfx/nvfx_vbo.c @@ -58,6 +58,10 @@ static unsigned nvfx_decide_upload_mode(struct pipe_context *pipe, const struct unsigned inline_cost = 0; unsigned unique_vertices; unsigned upload_mode; + float best_index_cost_for_hardware_vertices_as_inline_cost; + boolean prefer_hardware_indices; + unsigned index_inline_cost; + unsigned index_hardware_cost; if (info->indexed) unique_vertices = util_guess_unique_indices_count(info->mode, info->count); else @@ -108,10 +112,10 @@ static unsigned nvfx_decide_upload_mode(struct pipe_context *pipe, const struct inline_cost += vbi->per_vertex_size * info->count; } - float best_index_cost_for_hardware_vertices_as_inline_cost = 0.0f; - boolean prefer_hardware_indices = FALSE; - unsigned index_inline_cost = 0; - unsigned index_hardware_cost = 0; + best_index_cost_for_hardware_vertices_as_inline_cost = 0.0f; + prefer_hardware_indices = FALSE; + index_inline_cost = 0; + index_hardware_cost = 0; if (info->indexed) { @@ -336,12 +340,15 @@ nvfx_vbo_validate(struct nvfx_context *nvfx) void nvfx_vbo_relocate(struct nvfx_context *nvfx) { + struct nouveau_channel* chan; + unsigned vb_flags; + int i; + if(!nvfx->use_vertex_buffers) return; - struct nouveau_channel* chan = nvfx->screen->base.channel; - unsigned vb_flags = nvfx->screen->vertex_buffer_reloc_flags | NOUVEAU_BO_RD | NOUVEAU_BO_DUMMY; - int i; + chan = nvfx->screen->base.channel; + vb_flags = nvfx->screen->vertex_buffer_reloc_flags | NOUVEAU_BO_RD | NOUVEAU_BO_DUMMY; MARK_RING(chan, 2 * 16 + 3, 2 * 16 + 3); for (i = 0; i < nvfx->vtxelt->num_per_vertex; i++) { @@ -422,10 +429,10 @@ nvfx_vtxelts_state_create(struct pipe_context *pipe, struct nvfx_vtxelt_state *cso = CALLOC_STRUCT(nvfx_vtxelt_state); struct translate_key transkey; unsigned per_vertex_size[16]; - memset(per_vertex_size, 0, sizeof(per_vertex_size)); - unsigned vb_compacted_index[16]; + memset(per_vertex_size, 0, sizeof(per_vertex_size)); + assert(num_elements < 16); /* not doing fallbacks yet */ memcpy(cso->pipe, elements, num_elements * sizeof(elements[0])); -- cgit v1.2.3 From 4a6eb492e86f74434504766ec551130ac6306e6d Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Sat, 21 Aug 2010 14:36:29 -0700 Subject: util: Move loop variable declaration outside for loop. Fixes build error with MSVC. --- src/gallium/auxiliary/util/u_linkage.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/auxiliary/util/u_linkage.h b/src/gallium/auxiliary/util/u_linkage.h index c30b56e6e4..4720e0ee60 100644 --- a/src/gallium/auxiliary/util/u_linkage.h +++ b/src/gallium/auxiliary/util/u_linkage.h @@ -56,9 +56,10 @@ void util_semantic_layout_from_set(unsigned char *layout, const struct util_sema static INLINE void util_semantic_table_from_layout(unsigned char *table, unsigned char *layout, unsigned char first_slot_value, unsigned char num_slots) { + int i; memset(table, 0xff, sizeof(table)); - for(int i = 0; i < num_slots; ++i) + for(i = 0; i < num_slots; ++i) table[layout[i]] = first_slot_value + i; } -- cgit v1.2.3 From 251e48c64a37c4b05f26c96c5a1799c24da6474b Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Sat, 21 Aug 2010 23:33:51 +0200 Subject: nvfx: fix incorrect assert --- src/gallium/drivers/nvfx/nvfx_vbo.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/nvfx/nvfx_vbo.c b/src/gallium/drivers/nvfx/nvfx_vbo.c index 5d3fb6fb6c..b1a06654b6 100644 --- a/src/gallium/drivers/nvfx/nvfx_vbo.c +++ b/src/gallium/drivers/nvfx/nvfx_vbo.c @@ -427,14 +427,17 @@ nvfx_vtxelts_state_create(struct pipe_context *pipe, const struct pipe_vertex_element *elements) { struct nvfx_vtxelt_state *cso = CALLOC_STRUCT(nvfx_vtxelt_state); - struct translate_key transkey; - unsigned per_vertex_size[16]; - unsigned vb_compacted_index[16]; + struct translate_key transkey; + unsigned per_vertex_size[16]; + unsigned vb_compacted_index[16]; - memset(per_vertex_size, 0, sizeof(per_vertex_size)); - - assert(num_elements < 16); /* not doing fallbacks yet */ + if(num_elements > 16) + { + _debug_printf("Error: application attempted to use %u vertex elements, but only 16 are supported: ignoring the rest\n"); + num_elements = 16; + } + memset(per_vertex_size, 0, sizeof(per_vertex_size)); memcpy(cso->pipe, elements, num_elements * sizeof(elements[0])); cso->num_elements = num_elements; cso->needs_translate = FALSE; -- cgit v1.2.3 From 4edeeaf71564582d5afebc9cb59f4b3f7fb40a7e Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Sat, 21 Aug 2010 23:53:39 +0200 Subject: nvfx: actually fix it properly --- src/gallium/drivers/nvfx/nvfx_vbo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/drivers/nvfx/nvfx_vbo.c b/src/gallium/drivers/nvfx/nvfx_vbo.c index b1a06654b6..21d6e0e6f8 100644 --- a/src/gallium/drivers/nvfx/nvfx_vbo.c +++ b/src/gallium/drivers/nvfx/nvfx_vbo.c @@ -433,7 +433,7 @@ nvfx_vtxelts_state_create(struct pipe_context *pipe, if(num_elements > 16) { - _debug_printf("Error: application attempted to use %u vertex elements, but only 16 are supported: ignoring the rest\n"); + _debug_printf("Error: application attempted to use %u vertex elements, but only 16 are supported: ignoring the rest\n", num_elements); num_elements = 16; } -- cgit v1.2.3 From e511a35fc53fb75a2401d8a94c0c35634175c575 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Sat, 21 Aug 2010 15:30:34 -0700 Subject: glsl: Handle array declarations in function parameters. The 'vec4[12] foo' style already worked, but the 'vec4 foo[12]' style did not. Also, 'vec4[] foo' was wrongly accepted. Fixes piglit test cases array-19.vert and array-21.vert. May fix fd.o bug #29684 (or at least part of it). --- src/glsl/ast_to_hir.cpp | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp index 4188348626..397c84e343 100644 --- a/src/glsl/ast_to_hir.cpp +++ b/src/glsl/ast_to_hir.cpp @@ -2040,13 +2040,22 @@ ast_parameter_declarator::hir(exec_list *instructions, return NULL; } + /* This only handles "vec4 foo[..]". The earlier specifier->glsl_type(...) + * call already handled the "vec4[..] foo" case. + */ + if (this->is_array) { + type = process_array_type(type, this->array_size, state); + } + + if (type->array_size() == 0) { + _mesa_glsl_error(&loc, state, "arrays passed as parameters must have " + "a declared size."); + type = glsl_type::error_type; + } + is_void = false; 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. - */ - /* Apply any specified qualifiers to the parameter declaration. Note that * for function parameters the default mode is 'in'. */ -- cgit v1.2.3 From be99100ee78d7b97f616a375e47eb7d436fa4416 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Sat, 21 Aug 2010 15:48:25 -0700 Subject: util: Silence uninitialized variable warnings. --- src/gallium/auxiliary/util/u_linkage.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src') diff --git a/src/gallium/auxiliary/util/u_linkage.c b/src/gallium/auxiliary/util/u_linkage.c index cefcb4c9f1..2f6f41ba84 100644 --- a/src/gallium/auxiliary/util/u_linkage.c +++ b/src/gallium/auxiliary/util/u_linkage.c @@ -63,7 +63,11 @@ util_semantic_set_from_program_file(struct util_semantic_set *set, const struct semantic_index = info.output_semantic_index; } else + { assert(0); + semantic_name = NULL; + semantic_index = NULL; + } tgsi_parse_init(&parse, tokens); -- cgit v1.2.3 From 13b3d4c23d9d088a5a2b3bd657f1f163e42e4d8b Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Sat, 21 Aug 2010 16:21:41 -0700 Subject: glsl: Silence unused variable warning. The variable is actually used but only in the body of an assert. --- src/glsl/ast_to_hir.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp index 397c84e343..b60bb2f0a0 100644 --- a/src/glsl/ast_to_hir.cpp +++ b/src/glsl/ast_to_hir.cpp @@ -1973,6 +1973,7 @@ ast_declarator_list::hir(exec_list *instructions, const bool added_variable = state->symbols->add_variable(var->name, var); assert(added_variable); + (void) added_variable; } -- cgit v1.2.3 From ce9a6e6a7d855bac9bc088a97a19373bb0484829 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Sat, 21 Aug 2010 15:04:47 +0100 Subject: mesa: Removed another unused variable. --- src/mesa/state_tracker/st_cb_drawpixels.c | 1 - 1 file changed, 1 deletion(-) (limited to 'src') diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c b/src/mesa/state_tracker/st_cb_drawpixels.c index aa8776e716..1147b1950e 100644 --- a/src/mesa/state_tracker/st_cb_drawpixels.c +++ b/src/mesa/state_tracker/st_cb_drawpixels.c @@ -301,7 +301,6 @@ static struct pipe_resource * alloc_texture(struct st_context *st, GLsizei width, GLsizei height, enum pipe_format texFormat) { - struct pipe_context *pipe = st->pipe; struct pipe_resource *pt; pt = st_texture_create(st, st->internal_target, texFormat, 0, -- cgit v1.2.3 From ae34a6393e6519dc32e53fa8407155e8679fc257 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Sun, 22 Aug 2010 02:26:09 +0100 Subject: draw: Don't assert if indices point outside vertex buffer. This is valid input, and asserting here does causes the test suites that verify this to crash. Also, the assert was wrongly accepting the case max_index == vert_info->count which, IIUC, is the first vertex outside the buffer. Assuming the vert_info->count is precise (which often is not the case). --- src/gallium/auxiliary/draw/draw_pipe.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/gallium/auxiliary/draw/draw_pipe.c b/src/gallium/auxiliary/draw/draw_pipe.c index b75262a357..6206197dae 100644 --- a/src/gallium/auxiliary/draw/draw_pipe.c +++ b/src/gallium/auxiliary/draw/draw_pipe.c @@ -238,7 +238,7 @@ void draw_pipeline_run( struct draw_context *draw, const unsigned count = prim_info->primitive_lengths[i]; #if DEBUG - /* make sure none of the element indexes go outside the vertex buffer */ + /* Warn if one of the element indexes go outside the vertex buffer */ { unsigned max_index = 0x0, i; /* find the largest element index */ @@ -247,7 +247,12 @@ void draw_pipeline_run( struct draw_context *draw, if (index > max_index) max_index = index; } - assert(max_index <= vert_info->count); + if (max_index >= vert_info->count) { + debug_printf("%s: max_index (%u) outside vertex buffer (%u)\n", + __FUNCTION__, + max_index, + vert_info->count); + } } #endif -- cgit v1.2.3 From 36efb86c0570d86d8dfce87fd2416125e0e91b40 Mon Sep 17 00:00:00 2001 From: Jerome Glisse Date: Sat, 21 Aug 2010 22:49:22 -0400 Subject: r600g: partialy fix texturing from depth buffer + initial support for untiling Partialy fix texturing from depth buffer, depth buffer is tiled following different tile organisation that color buffer. This properly set the tile type & array mode field of texture sampler when sampling from db resource. Add initial support to untiling buffer when transfering them, it's kind of broken by corruption the vertex buffer of previous draw. Signed-off-by: Jerome Glisse --- src/gallium/drivers/r600/r600_blit.c | 27 ++++- src/gallium/drivers/r600/r600_context.c | 8 +- src/gallium/drivers/r600/r600_resource.h | 3 + src/gallium/drivers/r600/r600_screen.h | 1 + src/gallium/drivers/r600/r600_shader.c | 6 +- src/gallium/drivers/r600/r600_state.c | 7 +- src/gallium/drivers/r600/r600_texture.c | 179 +++++++++++++++++++++---------- 7 files changed, 165 insertions(+), 66 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/r600_blit.c b/src/gallium/drivers/r600/r600_blit.c index aef4fbd9af..dc57b333a0 100644 --- a/src/gallium/drivers/r600/r600_blit.c +++ b/src/gallium/drivers/r600/r600_blit.c @@ -120,7 +120,8 @@ static void r600_clear_depth_stencil(struct pipe_context *ctx, r600_queries_resume(ctx); } -static void r600_resource_copy_region(struct pipe_context *pipe, + +static void r600_resource_copy_region(struct pipe_context *ctx, struct pipe_resource *dst, struct pipe_subresource subdst, unsigned dstx, unsigned dsty, unsigned dstz, @@ -129,8 +130,28 @@ static void r600_resource_copy_region(struct pipe_context *pipe, unsigned srcx, unsigned srcy, unsigned srcz, unsigned width, unsigned height) { - util_resource_copy_region(pipe, dst, subdst, dstx, dsty, dstz, - src, subsrc, srcx, srcy, srcz, width, height); + struct r600_context *rctx = r600_context(ctx); + struct pipe_framebuffer_state *fb = &rctx->framebuffer->state.framebuffer; + struct pipe_sampler_state *samplers[PIPE_MAX_ATTRIBS]; + struct pipe_sampler_view_state *sampler_views[PIPE_MAX_ATTRIBS]; + unsigned i; + + for (i = 0; i < rctx->ps_nsampler_view; i++) { + sampler_views[i] = &rctx->ps_sampler_view[i]->state.sampler_view; + } + for (i = 0; i < rctx->ps_nsampler; i++) { + samplers[i] = &rctx->ps_sampler[i]->state.sampler; + } + r600_blitter_save_states(ctx); + util_blitter_save_framebuffer(rctx->blitter, fb); + util_blitter_save_fragment_sampler_states(rctx->blitter, rctx->ps_nsampler, samplers); + util_blitter_save_fragment_sampler_views(rctx->blitter, rctx->ps_nsampler_view, sampler_views); + + util_blitter_copy_region(rctx->blitter, dst, subdst, dstx, dsty, dstz, + src, subsrc, srcx, srcy, srcz, width, height, + TRUE); + /* resume queries */ + r600_queries_resume(ctx); } void r600_init_blit_functions(struct r600_context *rctx) diff --git a/src/gallium/drivers/r600/r600_context.c b/src/gallium/drivers/r600/r600_context.c index 2f59a550f5..9af28356c5 100644 --- a/src/gallium/drivers/r600/r600_context.c +++ b/src/gallium/drivers/r600/r600_context.c @@ -52,7 +52,7 @@ void r600_flush(struct pipe_context *ctx, unsigned flags, char dname[256]; /* suspend queries */ - r600_queries_suspend(rctx); + r600_queries_suspend(ctx); if (radeon_ctx_pm4(rctx->ctx)) goto out; /* FIXME dumping should be removed once shader support instructions @@ -61,8 +61,10 @@ void r600_flush(struct pipe_context *ctx, unsigned flags, if (!rctx->ctx->cpm4) goto out; sprintf(dname, "gallium-%08d.bof", dc); - if (dc < 10) + if (dc < 2) { radeon_ctx_dump_bof(rctx->ctx, dname); + R600_ERR("dumped %s\n", dname); + } #if 1 radeon_ctx_submit(rctx->ctx); #endif @@ -74,7 +76,7 @@ out: rctx->ctx = radeon_ctx_decref(rctx->ctx); rctx->ctx = radeon_ctx(rscreen->rw); /* resume queries */ - r600_queries_resume(rctx); + r600_queries_resume(ctx); } static void r600_init_config(struct r600_context *rctx) diff --git a/src/gallium/drivers/r600/r600_resource.h b/src/gallium/drivers/r600/r600_resource.h index bb90e76fb7..5ebda027e9 100644 --- a/src/gallium/drivers/r600/r600_resource.h +++ b/src/gallium/drivers/r600/r600_resource.h @@ -48,6 +48,9 @@ struct r600_resource_texture { unsigned long pitch_override; unsigned long bpt; unsigned long size; + unsigned tilled; + unsigned array_mode; + unsigned tile_type; }; void r600_init_context_resource_functions(struct r600_context *r600); diff --git a/src/gallium/drivers/r600/r600_screen.h b/src/gallium/drivers/r600/r600_screen.h index 53b560c617..147be3c4ac 100644 --- a/src/gallium/drivers/r600/r600_screen.h +++ b/src/gallium/drivers/r600/r600_screen.h @@ -38,6 +38,7 @@ struct r600_transfer { /* Buffer transfer. */ struct pipe_transfer *buffer_transfer; unsigned offset; + struct pipe_resource *linear_texture; }; struct r600_screen { diff --git a/src/gallium/drivers/r600/r600_shader.c b/src/gallium/drivers/r600/r600_shader.c index da1af6702c..79fc04a9fe 100644 --- a/src/gallium/drivers/r600/r600_shader.c +++ b/src/gallium/drivers/r600/r600_shader.c @@ -105,8 +105,8 @@ int r600_pipe_shader_create(struct pipe_context *ctx, struct r600_screen *rscreen = r600_screen(ctx->screen); int r; -fprintf(stderr, "--------------------------------------------------------------\n"); -tgsi_dump(tokens, 0); +//fprintf(stderr, "--------------------------------------------------------------\n"); +//tgsi_dump(tokens, 0); if (rpshader == NULL) return -ENOMEM; rpshader->shader.family = radeon_get_family(rscreen->rw); @@ -120,7 +120,7 @@ tgsi_dump(tokens, 0); R600_ERR("building bytecode failed !\n"); return r; } -fprintf(stderr, "______________________________________________________________\n"); +//fprintf(stderr, "______________________________________________________________\n"); return 0; } diff --git a/src/gallium/drivers/r600/r600_state.c b/src/gallium/drivers/r600/r600_state.c index 93fc68e42e..e9b03f571a 100644 --- a/src/gallium/drivers/r600/r600_state.c +++ b/src/gallium/drivers/r600/r600_state.c @@ -773,6 +773,9 @@ static struct radeon_state *r600_db(struct r600_context *rctx) return NULL; rtex = (struct r600_resource_texture*)state->zsbuf->texture; + rtex->tilled = 1; + rtex->array_mode = 2; + rtex->tile_type = 1; rbuffer = &rtex->resource; rstate->bo[0] = radeon_bo_incref(rscreen->rw, rbuffer->bo); rstate->nbo = 1; @@ -1258,7 +1261,9 @@ static struct radeon_state *r600_resource(struct r600_context *rctx, /* FIXME properly handle first level != 0 */ rstate->states[R600_PS_RESOURCE__RESOURCE0_WORD0] = S_038000_DIM(r600_tex_dim(view->texture->target)) | - S_038000_PITCH((pitch / 8) - 1) | + S_038000_TILE_MODE(tmp->array_mode) | + S_038000_TILE_TYPE(tmp->tile_type) | + S_038000_PITCH((pitch / 8) - 1) | S_038000_TEX_WIDTH(view->texture->width0 - 1); rstate->states[R600_PS_RESOURCE__RESOURCE0_WORD1] = S_038004_TEX_HEIGHT(view->texture->height0 - 1) | diff --git a/src/gallium/drivers/r600/r600_texture.c b/src/gallium/drivers/r600/r600_texture.c index 8a6b5f8764..92b4f430c5 100644 --- a/src/gallium/drivers/r600/r600_texture.c +++ b/src/gallium/drivers/r600/r600_texture.c @@ -37,6 +37,21 @@ extern struct u_resource_vtbl r600_texture_vtbl; +/* Copy from a tiled texture to a detiled one. */ +static void r600_copy_from_tiled_texture(struct pipe_context *ctx, struct r600_transfer *rtransfer) +{ + struct pipe_transfer *transfer = (struct pipe_transfer*)rtransfer; + struct pipe_resource *texture = transfer->resource; + struct pipe_subresource subdst; + + subdst.face = 0; + subdst.level = 0; + ctx->resource_copy_region(ctx, rtransfer->linear_texture, + subdst, 0, 0, 0, texture, transfer->sr, + transfer->box.x, transfer->box.y, transfer->box.z, + transfer->box.width, transfer->box.height); +} + static unsigned long r600_texture_get_offset(struct r600_resource_texture *rtex, unsigned level, unsigned zslice, unsigned face) @@ -106,7 +121,6 @@ struct pipe_resource *r600_texture_create(struct pipe_screen *screen, FREE(rtex); return NULL; } - return &resource->base.b; } @@ -208,6 +222,7 @@ struct pipe_transfer* r600_texture_get_transfer(struct pipe_context *ctx, const struct pipe_box *box) { struct r600_resource_texture *rtex = (struct r600_resource_texture*)texture; + struct pipe_resource resource; struct r600_transfer *trans; trans = CALLOC_STRUCT(r600_transfer); @@ -219,14 +234,56 @@ struct pipe_transfer* r600_texture_get_transfer(struct pipe_context *ctx, trans->transfer.box = *box; trans->transfer.stride = rtex->pitch[sr.level]; trans->offset = r600_texture_get_offset(rtex, sr.level, box->z, sr.face); + if (rtex->tilled) { + resource.target = PIPE_TEXTURE_2D; + resource.format = texture->format; + resource.width0 = box->width; + resource.height0 = box->height; + resource.depth0 = 0; + resource.last_level = 0; + resource.nr_samples = 0; + resource.usage = PIPE_USAGE_DYNAMIC; + resource.bind = 0; + resource.flags = 0; + /* For texture reading, the temporary (detiled) texture is used as + * a render target when blitting from a tiled texture. */ + if (usage & PIPE_TRANSFER_READ) { + resource.bind |= PIPE_BIND_RENDER_TARGET; + } + /* For texture writing, the temporary texture is used as a sampler + * when blitting into a tiled texture. */ + if (usage & PIPE_TRANSFER_WRITE) { + resource.bind |= PIPE_BIND_SAMPLER_VIEW; + } + /* Create the temporary texture. */ + trans->linear_texture = ctx->screen->resource_create(ctx->screen, &resource); + if (trans->linear_texture == NULL) { + R600_ERR("failed to create temporary texture to hold untiled copy\n"); + pipe_resource_reference(&trans->transfer.resource, NULL); + FREE(trans); + return NULL; + } + if (usage & PIPE_TRANSFER_READ) { + /* We cannot map a tiled texture directly because the data is + * in a different order, therefore we do detiling using a blit. */ + r600_copy_from_tiled_texture(ctx, trans); + /* Always referenced in the blit. */ + ctx->flush(ctx, 0, NULL); + } + } return &trans->transfer; } void r600_texture_transfer_destroy(struct pipe_context *ctx, - struct pipe_transfer *trans) + struct pipe_transfer *transfer) { - pipe_resource_reference(&trans->resource, NULL); - FREE(trans); + struct r600_transfer *rtransfer = (struct r600_transfer*)transfer; + + if (rtransfer->linear_texture) { + pipe_resource_reference(&rtransfer->linear_texture, NULL); + } + pipe_resource_reference(&transfer->resource, NULL); + FREE(transfer); } void* r600_texture_transfer_map(struct pipe_context *ctx, @@ -239,14 +296,20 @@ void* r600_texture_transfer_map(struct pipe_context *ctx, char *map; r600_flush(ctx, 0, NULL); - - resource = (struct r600_resource *)transfer->resource; + if (rtransfer->linear_texture) { + resource = (struct r600_resource *)rtransfer->linear_texture; + } else { + resource = (struct r600_resource *)transfer->resource; + } if (radeon_bo_map(rscreen->rw, resource->bo)) { return NULL; } radeon_bo_wait(rscreen->rw, resource->bo); map = resource->bo->data; + if (rtransfer->linear_texture) { + return map; + } return map + rtransfer->offset + transfer->box.y / util_format_get_blockheight(format) * transfer->stride + @@ -256,10 +319,15 @@ void* r600_texture_transfer_map(struct pipe_context *ctx, void r600_texture_transfer_unmap(struct pipe_context *ctx, struct pipe_transfer* transfer) { + struct r600_transfer *rtransfer = (struct r600_transfer*)transfer; struct r600_screen *rscreen = r600_screen(ctx->screen); struct r600_resource *resource; - resource = (struct r600_resource *)transfer->resource; + if (rtransfer->linear_texture) { + resource = (struct r600_resource *)rtransfer->linear_texture; + } else { + resource = (struct r600_resource *)transfer->resource; + } radeon_bo_unmap(rscreen->rw, resource->bo); } @@ -283,51 +351,51 @@ void r600_init_screen_texture_functions(struct pipe_screen *screen) } static unsigned r600_get_swizzle_combined(const unsigned char *swizzle_format, - const unsigned char *swizzle_view) + const unsigned char *swizzle_view) { - unsigned i; - unsigned char swizzle[4]; - unsigned result = 0; - const uint32_t swizzle_shift[4] = { - 16, 19, 22, 25, - }; - const uint32_t swizzle_bit[4] = { - 0, 1, 2, 3, - }; - - if (swizzle_view) { - /* Combine two sets of swizzles. */ - for (i = 0; i < 4; i++) { - swizzle[i] = swizzle_view[i] <= UTIL_FORMAT_SWIZZLE_W ? - swizzle_format[swizzle_view[i]] : swizzle_view[i]; - } - } else { - memcpy(swizzle, swizzle_format, 4); - } - - /* Get swizzle. */ - for (i = 0; i < 4; i++) { - switch (swizzle[i]) { - case UTIL_FORMAT_SWIZZLE_Y: - result |= swizzle_bit[1] << swizzle_shift[i]; - break; - case UTIL_FORMAT_SWIZZLE_Z: - result |= swizzle_bit[2] << swizzle_shift[i]; - break; - case UTIL_FORMAT_SWIZZLE_W: - result |= swizzle_bit[3] << swizzle_shift[i]; - break; - case UTIL_FORMAT_SWIZZLE_0: - result |= V_038010_SQ_SEL_0 << swizzle_shift[i]; - break; - case UTIL_FORMAT_SWIZZLE_1: - result |= V_038010_SQ_SEL_1 << swizzle_shift[i]; - break; - default: /* UTIL_FORMAT_SWIZZLE_X */ - result |= swizzle_bit[0] << swizzle_shift[i]; - } - } - return result; + unsigned i; + unsigned char swizzle[4]; + unsigned result = 0; + const uint32_t swizzle_shift[4] = { + 16, 19, 22, 25, + }; + const uint32_t swizzle_bit[4] = { + 0, 1, 2, 3, + }; + + if (swizzle_view) { + /* Combine two sets of swizzles. */ + for (i = 0; i < 4; i++) { + swizzle[i] = swizzle_view[i] <= UTIL_FORMAT_SWIZZLE_W ? + swizzle_format[swizzle_view[i]] : swizzle_view[i]; + } + } else { + memcpy(swizzle, swizzle_format, 4); + } + + /* Get swizzle. */ + for (i = 0; i < 4; i++) { + switch (swizzle[i]) { + case UTIL_FORMAT_SWIZZLE_Y: + result |= swizzle_bit[1] << swizzle_shift[i]; + break; + case UTIL_FORMAT_SWIZZLE_Z: + result |= swizzle_bit[2] << swizzle_shift[i]; + break; + case UTIL_FORMAT_SWIZZLE_W: + result |= swizzle_bit[3] << swizzle_shift[i]; + break; + case UTIL_FORMAT_SWIZZLE_0: + result |= V_038010_SQ_SEL_0 << swizzle_shift[i]; + break; + case UTIL_FORMAT_SWIZZLE_1: + result |= V_038010_SQ_SEL_1 << swizzle_shift[i]; + break; + default: /* UTIL_FORMAT_SWIZZLE_X */ + result |= swizzle_bit[0] << swizzle_shift[i]; + } + } + return result; } /* texture format translate */ @@ -353,13 +421,13 @@ uint32_t r600_translate_texformat(enum pipe_format format, case UTIL_FORMAT_COLORSPACE_ZS: switch (format) { case PIPE_FORMAT_Z16_UNORM: - result = V_028010_DEPTH_16; + result = V_0280A0_COLOR_16; goto out_word4; case PIPE_FORMAT_Z24X8_UNORM: - result = V_028010_DEPTH_X8_24; + result = V_0280A0_COLOR_8_24; goto out_word4; case PIPE_FORMAT_Z24_UNORM_S8_USCALED: - result = V_028010_DEPTH_8_24; + result = V_0280A0_COLOR_8_24; goto out_word4; default: goto out_unknown; @@ -522,9 +590,8 @@ out_word4: *word4_p = word4; if (yuv_format_p) *yuv_format_p = yuv_format; -// fprintf(stderr,"returning %08x %08x %08x\n", result, word4, yuv_format); return result; out_unknown: -// R600_ERR("Unable to handle texformat %d %s\n", format, util_format_name(format)); + R600_ERR("Unable to handle texformat %d %s\n", format, util_format_name(format)); return ~0; } -- cgit v1.2.3 From 56176f00f59624ef1335175b3669081e2f3e83ed Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Sat, 21 Aug 2010 20:38:07 -0700 Subject: glsl: Silence uninitialized variable warning. i686-apple-darwin10-gcc-4.2.1 generated the following warning. warning: 'score' may be used uninitialized in this function GCC 4.4.3 on Linux didn't generate the above warning. --- src/glsl/ir_function.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src') diff --git a/src/glsl/ir_function.cpp b/src/glsl/ir_function.cpp index 0a97e01424..dfdec144b2 100644 --- a/src/glsl/ir_function.cpp +++ b/src/glsl/ir_function.cpp @@ -139,6 +139,9 @@ parameter_lists_match(const exec_list *list_a, const exec_list *list_b) */ score = (type_compare(actual->type, param->type) == 0) ? 0 : -1; break; + + default: + assert(false); } if (score < 0) -- cgit v1.2.3 From 973c065abef2ab4066cd3c1cf12652c1da289210 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Sat, 21 Aug 2010 21:27:43 -0700 Subject: i965g: Fix printf format warning on 32-bit platforms. Fixes the following GCC warning on 32-bit platforms. warning: format '%li' expects type 'long int', but argument 4 has type 'int' --- src/gallium/drivers/i965/brw_batchbuffer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/drivers/i965/brw_batchbuffer.c b/src/gallium/drivers/i965/brw_batchbuffer.c index 8b3f46f2c1..e80067f3b1 100644 --- a/src/gallium/drivers/i965/brw_batchbuffer.c +++ b/src/gallium/drivers/i965/brw_batchbuffer.c @@ -162,7 +162,7 @@ brw_batchbuffer_emit_reloc(struct brw_batchbuffer *batch, if (batch->ptr - batch->map > batch->buf->size) { debug_printf("bad relocation ptr %p map %p offset %li size %i\n", - batch->ptr, batch->map, batch->ptr - batch->map, batch->buf->size); + batch->ptr, batch->map, (long) (batch->ptr - batch->map), batch->buf->size); return PIPE_ERROR_OUT_OF_MEMORY; } -- cgit v1.2.3 From 2506b32eecbaacf5609f0c4654a9f90c72ce0c81 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Sat, 21 Aug 2010 21:42:17 -0700 Subject: nv50: Disable unused code. Disable release_hw and emit_mov_from_pred functions as they are currently not being used. --- src/gallium/drivers/nv50/nv50_program.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src') diff --git a/src/gallium/drivers/nv50/nv50_program.c b/src/gallium/drivers/nv50/nv50_program.c index 8cb1639013..cec2290481 100644 --- a/src/gallium/drivers/nv50/nv50_program.c +++ b/src/gallium/drivers/nv50/nv50_program.c @@ -306,6 +306,7 @@ alloc_temp(struct nv50_pc *pc, struct nv50_reg *dst) return NULL; } +#if 0 /* release the hardware resource held by r */ static void release_hw(struct nv50_pc *pc, struct nv50_reg *r) @@ -321,6 +322,7 @@ release_hw(struct nv50_pc *pc, struct nv50_reg *r) if (r->index == -1) FREE(r); } +#endif static void free_temp(struct nv50_pc *pc, struct nv50_reg *r) @@ -885,6 +887,7 @@ set_half_src(struct nv50_pc *pc, struct nv50_reg *src, int lh, e->inst[pos / 32] |= ((src->hw * 2) + lh) << (pos % 32); } +#if 0 static void emit_mov_from_pred(struct nv50_pc *pc, struct nv50_reg *dst, int pred) { @@ -897,6 +900,7 @@ emit_mov_from_pred(struct nv50_pc *pc, struct nv50_reg *dst, int pred) emit(pc, e); } +#endif static void emit_mov_to_pred(struct nv50_pc *pc, int pred, struct nv50_reg *src) -- cgit v1.2.3 From 4a06525737c17126243a48741c87298ad1ffd076 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Sat, 21 Aug 2010 22:01:04 -0700 Subject: nv50: Silence incompatible pointer type initialization warning. Silence the following GCC warning. warning: initialization from incompatible pointer type --- src/gallium/drivers/nv50/nv50_push.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/nv50/nv50_push.c b/src/gallium/drivers/nv50/nv50_push.c index 6a2ffd5a3c..57c0010bf4 100644 --- a/src/gallium/drivers/nv50/nv50_push.c +++ b/src/gallium/drivers/nv50/nv50_push.c @@ -108,8 +108,9 @@ emit_vertex(struct push_context *ctx, unsigned n) int i; if (ctx->edgeflag_attr < 16) { - float *edgeflag = (uint8_t *)ctx->attr[ctx->edgeflag_attr].map + - ctx->attr[ctx->edgeflag_attr].stride * n; + float *edgeflag = (float *) + ((uint8_t *)ctx->attr[ctx->edgeflag_attr].map + + ctx->attr[ctx->edgeflag_attr].stride * n); if (*edgeflag != ctx->edgeflag) { BEGIN_RING(chan, tesla, NV50TCL_EDGEFLAG_ENABLE, 1); -- cgit v1.2.3 From 68d34f2979f4f4e0dfa5695742bb8ccdb6feb54a Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Sat, 21 Aug 2010 22:09:47 -0700 Subject: nvfx: Silence uninitialized variable warnings. Silence the following i686-apple-darwin10-gcc-4.2.1 warnings. nv04_2d.c: In function 'nv04_region_copy_cpu': nv04_2d.c:560: warning: 'dswy' may be used uninitialized in this function nv04_2d.c:559: warning: 'dswx' may be used uninitialized in this function nv04_2d.c:562: warning: 'sswy' may be used uninitialized in this function nv04_2d.c:561: warning: 'sswx' may be used uninitialized in this function --- src/gallium/drivers/nvfx/nv04_2d.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/nvfx/nv04_2d.c b/src/gallium/drivers/nvfx/nv04_2d.c index 46d5f5c08d..c7d53a786f 100644 --- a/src/gallium/drivers/nvfx/nv04_2d.c +++ b/src/gallium/drivers/nvfx/nv04_2d.c @@ -556,10 +556,10 @@ simple: } else { - int* dswx; - int* dswy; - int* sswx; - int* sswy; + int* dswx = NULL; + int* dswy = NULL; + int* sswx = NULL; + int* sswy = NULL; int dir; if(!dst->pitch) -- cgit v1.2.3 From fdedff2dba64ce25e8a572c1001f2b9e8eed00d2 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Sat, 21 Aug 2010 22:45:09 -0700 Subject: i965g: Silence printf format warnings on 64-bit builds. --- src/gallium/drivers/i965/brw_wm_debug.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/i965/brw_wm_debug.c b/src/gallium/drivers/i965/brw_wm_debug.c index e2767264e7..1b2aa93bef 100644 --- a/src/gallium/drivers/i965/brw_wm_debug.c +++ b/src/gallium/drivers/i965/brw_wm_debug.c @@ -101,16 +101,16 @@ void brw_wm_print_value( struct brw_wm_compile *c, debug_printf("undef"); else if( value - c->vreg >= 0 && value - c->vreg < BRW_WM_MAX_VREG) - debug_printf("r%d", value - c->vreg); + debug_printf("r%ld", (long) (value - c->vreg)); else if (value - c->creg >= 0 && value - c->creg < BRW_WM_MAX_PARAM) - debug_printf("c%d", value - c->creg); + debug_printf("c%ld", (long) (value - c->creg)); else if (value - c->payload.input_interp >= 0 && value - c->payload.input_interp < PIPE_MAX_SHADER_INPUTS) - debug_printf("i%d", value - c->payload.input_interp); + debug_printf("i%ld", (long) (value - c->payload.input_interp)); else if (value - c->payload.depth >= 0 && value - c->payload.depth < PIPE_MAX_SHADER_INPUTS) - debug_printf("d%d", value - c->payload.depth); + debug_printf("d%ld", (long) (value - c->payload.depth)); else debug_printf("?"); } -- cgit v1.2.3 From 172953ef3a481612aa3bc9894941c2f9d34f509e Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Sat, 21 Aug 2010 22:59:46 -0700 Subject: nvfx: Silence uninitialized variable warnings. Variables weren't initialized on the error paths. --- src/gallium/drivers/nvfx/nvfx_fragprog.c | 2 ++ src/gallium/drivers/nvfx/nvfx_vertprog.c | 4 ++++ 2 files changed, 6 insertions(+) (limited to 'src') diff --git a/src/gallium/drivers/nvfx/nvfx_fragprog.c b/src/gallium/drivers/nvfx/nvfx_fragprog.c index 6c8f5c4708..db33ecd78c 100644 --- a/src/gallium/drivers/nvfx/nvfx_fragprog.c +++ b/src/gallium/drivers/nvfx/nvfx_fragprog.c @@ -418,6 +418,8 @@ tgsi_src(struct nvfx_fpc *fpc, const struct tgsi_full_src_register *fsrc) break; default: NOUVEAU_ERR("bad src file\n"); + src.reg.index = 0; + src.reg.type = 0; break; } diff --git a/src/gallium/drivers/nvfx/nvfx_vertprog.c b/src/gallium/drivers/nvfx/nvfx_vertprog.c index b5dde2592e..38f37168a1 100644 --- a/src/gallium/drivers/nvfx/nvfx_vertprog.c +++ b/src/gallium/drivers/nvfx/nvfx_vertprog.c @@ -379,6 +379,8 @@ tgsi_src(struct nvfx_vpc *vpc, const struct tgsi_full_src_register *fsrc) { break; default: NOUVEAU_ERR("bad src file\n"); + src.reg.index = 0; + src.reg.type = 0; break; } @@ -410,6 +412,8 @@ tgsi_dst(struct nvfx_vpc *vpc, const struct tgsi_full_dst_register *fdst) { break; default: NOUVEAU_ERR("bad dst file %i\n", fdst->Register.File); + dst.index = 0; + dst.type = 0; break; } -- cgit v1.2.3 From 2a7493ada4503db855ed35031d48fcf2a31eded3 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Sat, 21 Aug 2010 23:24:28 -0700 Subject: translate_sse: Silence uninitialized variable warnings. Initialize variables on error paths. --- src/gallium/auxiliary/translate/translate_sse.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src') diff --git a/src/gallium/auxiliary/translate/translate_sse.c b/src/gallium/auxiliary/translate/translate_sse.c index 06b8f32fe6..5188e49cd5 100644 --- a/src/gallium/auxiliary/translate/translate_sse.c +++ b/src/gallium/auxiliary/translate/translate_sse.c @@ -553,6 +553,13 @@ static boolean translate_attr_convert( struct translate_sse *p, case 32: factor = get_inv_2147483647(p); break; + default: + assert(0); + factor.disp = 0; + factor.file = 0; + factor.idx = 0; + factor.mod = 0; + break; } sse_mulps(p->func, dataXMM, factor); } @@ -596,6 +603,13 @@ static boolean translate_attr_convert( struct translate_sse *p, case 32: factor = get_inv_2147483647(p); break; + default: + assert(0); + factor.disp = 0; + factor.file = 0; + factor.idx = 0; + factor.mod = 0; + break; } sse_mulps(p->func, dataXMM, factor); } -- cgit v1.2.3 From 0f3b3751b8643352dcc242567b3696bd1505df1d Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Sat, 21 Aug 2010 23:28:52 -0700 Subject: util: Define dump_cpu only for DEBUG builds. dump_cpu is used only when DEBUG is defined. Fixes the following GCC warning on builds without DEBUG defined. util/u_cpu_detect.c:76: warning: 'debug_get_option_dump_cpu' defined but not used --- src/gallium/auxiliary/util/u_cpu_detect.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/gallium/auxiliary/util/u_cpu_detect.c b/src/gallium/auxiliary/util/u_cpu_detect.c index f33d6b3461..5d0b16d28e 100644 --- a/src/gallium/auxiliary/util/u_cpu_detect.c +++ b/src/gallium/auxiliary/util/u_cpu_detect.c @@ -73,7 +73,9 @@ #endif +#if DEBUG DEBUG_GET_ONCE_BOOL_OPTION(dump_cpu, "GALLIUM_DUMP_CPU", FALSE) +#endif struct util_cpu_caps util_cpu_caps; -- cgit v1.2.3 From 3bdbccef2adfc699a737d7d25911004938bbbfcc Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Sat, 21 Aug 2010 23:36:30 -0700 Subject: util: Use #ifdef instead of #if. This is a typo fix of earlier commit 0f3b3751b8643352dcc242567b3696bd1505df1d. --- src/gallium/auxiliary/util/u_cpu_detect.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/auxiliary/util/u_cpu_detect.c b/src/gallium/auxiliary/util/u_cpu_detect.c index 5d0b16d28e..32519b148b 100644 --- a/src/gallium/auxiliary/util/u_cpu_detect.c +++ b/src/gallium/auxiliary/util/u_cpu_detect.c @@ -73,7 +73,7 @@ #endif -#if DEBUG +#ifdef DEBUG DEBUG_GET_ONCE_BOOL_OPTION(dump_cpu, "GALLIUM_DUMP_CPU", FALSE) #endif -- cgit v1.2.3 From 405546882a010885d342b0b40392de0da289374e Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Sat, 21 Aug 2010 23:56:24 -0700 Subject: mesa: Initialize variables in mesa_src_reg_from_ir_src_reg. --- src/mesa/program/ir_to_mesa.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp index 9fdeaa9be3..8df85dc3ea 100644 --- a/src/mesa/program/ir_to_mesa.cpp +++ b/src/mesa/program/ir_to_mesa.cpp @@ -2235,6 +2235,8 @@ mesa_src_reg_from_ir_src_reg(ir_to_mesa_src_reg reg) mesa_reg.Negate = reg.negate; mesa_reg.Abs = 0; mesa_reg.HasIndex2 = GL_FALSE; + mesa_reg.RelAddr2 = 0; + mesa_reg.Index2 = 0; return mesa_reg; } -- cgit v1.2.3 From 48c289fb552a3d363b505514b6ea22467f00e318 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Sun, 22 Aug 2010 00:09:43 -0700 Subject: mesa: Initialize member variables in ir_to_mesa_src_reg constructor. The default constructor did not initialize some member variables. --- src/mesa/program/ir_to_mesa.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src') diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp index 8df85dc3ea..676f68e5a0 100644 --- a/src/mesa/program/ir_to_mesa.cpp +++ b/src/mesa/program/ir_to_mesa.cpp @@ -78,6 +78,10 @@ typedef struct ir_to_mesa_src_reg { ir_to_mesa_src_reg() { this->file = PROGRAM_UNDEFINED; + this->index = 0; + this->swizzle = 0; + this->negate = 0; + this->reladdr = NULL; } int file; /**< PROGRAM_* from Mesa */ -- cgit v1.2.3 From 928830606f267aa828ede92cf0a643eb5901c3e2 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Sun, 22 Aug 2010 00:16:54 -0700 Subject: nvfx: Silence unused variable warning. The variable is used but only in the body of an assert. --- src/gallium/drivers/nvfx/nv04_2d.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/gallium/drivers/nvfx/nv04_2d.c b/src/gallium/drivers/nvfx/nv04_2d.c index c7d53a786f..3761002bcb 100644 --- a/src/gallium/drivers/nvfx/nv04_2d.c +++ b/src/gallium/drivers/nvfx/nv04_2d.c @@ -247,6 +247,7 @@ nv04_region_assert(struct nv04_region* rgn, unsigned w, unsigned h) assert(rgn->offset <= (int)rgn->bo->size); assert(end <= rgn->bo->size); + (void) end; if(!rgn->pitch) { assert(util_is_pot(rgn->w)); assert(util_is_pot(rgn->h)); -- cgit v1.2.3 From df604834d3cfaa5871439ca56177f182a8bcba45 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Sun, 22 Aug 2010 00:30:47 -0700 Subject: libgl-xlib: Include missing header in xlib.c. Include st_api.h for st_api_create_OpenGL symbol. --- src/gallium/targets/libgl-xlib/xlib.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/gallium/targets/libgl-xlib/xlib.c b/src/gallium/targets/libgl-xlib/xlib.c index 69b4ddd33f..5a9c80c856 100644 --- a/src/gallium/targets/libgl-xlib/xlib.c +++ b/src/gallium/targets/libgl-xlib/xlib.c @@ -36,6 +36,7 @@ #include "state_tracker/xlib_sw_winsys.h" #include "xm_public.h" +#include "state_tracker/st_api.h" #include "state_tracker/st_gl_api.h" /* piggy back on this libGL for OpenGL support in EGL */ -- cgit v1.2.3 From 527a9a4de218cae89d7faf92788f88ce1f9387b6 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Sat, 21 Aug 2010 23:47:06 -0700 Subject: i965: Use intel->gen >= 6 instead of IS_GEN6. --- src/mesa/drivers/dri/i965/brw_draw_upload.c | 4 ++-- src/mesa/drivers/dri/i965/brw_misc_state.c | 2 +- src/mesa/drivers/dri/i965/brw_state_upload.c | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_draw_upload.c b/src/mesa/drivers/dri/i965/brw_draw_upload.c index f07aab86e9..249e874ab1 100644 --- a/src/mesa/drivers/dri/i965/brw_draw_upload.c +++ b/src/mesa/drivers/dri/i965/brw_draw_upload.c @@ -476,7 +476,7 @@ static void brw_emit_vertices(struct brw_context *brw) if (brw->vb.nr_enabled == 0) { BEGIN_BATCH(3); OUT_BATCH((CMD_VERTEX_ELEMENT << 16) | 1); - if (IS_GEN6(intel->intelScreen->deviceID)) { + if (intel->gen >= 6) { OUT_BATCH((0 << GEN6_VE0_INDEX_SHIFT) | GEN6_VE0_VALID | (BRW_SURFACEFORMAT_R32G32B32A32_FLOAT << BRW_VE0_FORMAT_SHIFT) | @@ -553,7 +553,7 @@ static void brw_emit_vertices(struct brw_context *brw) break; } - if (IS_GEN6(intel->intelScreen->deviceID)) { + if (intel->gen >= 6) { OUT_BATCH((i << GEN6_VE0_INDEX_SHIFT) | GEN6_VE0_VALID | (format << BRW_VE0_FORMAT_SHIFT) | diff --git a/src/mesa/drivers/dri/i965/brw_misc_state.c b/src/mesa/drivers/dri/i965/brw_misc_state.c index 572175f463..565a9e3ee1 100644 --- a/src/mesa/drivers/dri/i965/brw_misc_state.c +++ b/src/mesa/drivers/dri/i965/brw_misc_state.c @@ -281,7 +281,7 @@ static void emit_depthbuffer(struct brw_context *brw) } assert(region->tiling != I915_TILING_X); - if (IS_GEN6(intel->intelScreen->deviceID)) + if (intel->gen >= 6) assert(region->tiling != I915_TILING_NONE); BEGIN_BATCH(len); diff --git a/src/mesa/drivers/dri/i965/brw_state_upload.c b/src/mesa/drivers/dri/i965/brw_state_upload.c index f92a19c2aa..97266124fe 100644 --- a/src/mesa/drivers/dri/i965/brw_state_upload.c +++ b/src/mesa/drivers/dri/i965/brw_state_upload.c @@ -351,7 +351,7 @@ void brw_validate_state( struct brw_context *brw ) brw_add_validated_bo(brw, intel->batch->buf); - if (IS_GEN6(intel->intelScreen->deviceID)) { + if (intel->gen >= 6) { atoms = gen6_atoms; num_atoms = ARRAY_SIZE(gen6_atoms); } else { @@ -425,7 +425,7 @@ void brw_upload_state(struct brw_context *brw) const struct brw_tracked_state **atoms; int num_atoms; - if (IS_GEN6(intel->intelScreen->deviceID)) { + if (intel->gen >= 6) { atoms = gen6_atoms; num_atoms = ARRAY_SIZE(gen6_atoms); } else { -- cgit v1.2.3 From 556f19415a5210aacd52d652b8aae6e58c44e4ed Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Sun, 22 Aug 2010 00:26:09 -0700 Subject: i965: Fix up WM push constant setup on gen6. Fixes glsl-algebraic-add-add-1. --- src/mesa/drivers/dri/i965/brw_context.h | 8 +++- src/mesa/drivers/dri/i965/brw_state.h | 1 + src/mesa/drivers/dri/i965/brw_state_upload.c | 2 +- src/mesa/drivers/dri/i965/brw_vtbl.c | 1 + src/mesa/drivers/dri/i965/gen6_wm_state.c | 71 ++++++++++++++++++---------- 5 files changed, 57 insertions(+), 26 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h index cc4e6638e8..68fc8debc6 100644 --- a/src/mesa/drivers/dri/i965/brw_context.h +++ b/src/mesa/drivers/dri/i965/brw_context.h @@ -654,7 +654,13 @@ struct brw_context drm_intel_bo *prog_bo; drm_intel_bo *state_bo; - drm_intel_bo *const_bo; + drm_intel_bo *const_bo; /* pull constant buffer. */ + /** + * This is the push constant BO on gen6. + * + * Pre-gen6, push constants live in the CURBE. + */ + drm_intel_bo *push_const_bo; } wm; diff --git a/src/mesa/drivers/dri/i965/brw_state.h b/src/mesa/drivers/dri/i965/brw_state.h index af08446f2d..c5d296b129 100644 --- a/src/mesa/drivers/dri/i965/brw_state.h +++ b/src/mesa/drivers/dri/i965/brw_state.h @@ -107,6 +107,7 @@ extern const struct brw_tracked_state gen6_sf_vp; extern const struct brw_tracked_state gen6_urb; extern const struct brw_tracked_state gen6_viewport_state; extern const struct brw_tracked_state gen6_vs_state; +extern const struct brw_tracked_state gen6_wm_constants; extern const struct brw_tracked_state gen6_wm_state; /*********************************************************************** diff --git a/src/mesa/drivers/dri/i965/brw_state_upload.c b/src/mesa/drivers/dri/i965/brw_state_upload.c index 97266124fe..f51b0719d1 100644 --- a/src/mesa/drivers/dri/i965/brw_state_upload.c +++ b/src/mesa/drivers/dri/i965/brw_state_upload.c @@ -129,7 +129,7 @@ const struct brw_tracked_state *gen6_atoms[] = &gen6_cc_state_pointers, &brw_vs_constants, /* Before vs_surfaces and constant_buffer */ - &brw_wm_constants, /* Before wm_surfaces and constant_buffer */ + &gen6_wm_constants, /* Before wm_surfaces and constant_buffer */ &brw_vs_surfaces, /* must do before unit */ &brw_wm_constant_surface, /* must do before wm surfaces/bind bo */ diff --git a/src/mesa/drivers/dri/i965/brw_vtbl.c b/src/mesa/drivers/dri/i965/brw_vtbl.c index 14227a5133..8f1601d10f 100644 --- a/src/mesa/drivers/dri/i965/brw_vtbl.c +++ b/src/mesa/drivers/dri/i965/brw_vtbl.c @@ -101,6 +101,7 @@ static void brw_destroy_context( struct intel_context *intel ) dri_bo_release(&brw->wm.prog_bo); dri_bo_release(&brw->wm.state_bo); dri_bo_release(&brw->wm.const_bo); + dri_bo_release(&brw->wm.push_const_bo); dri_bo_release(&brw->cc.prog_bo); dri_bo_release(&brw->cc.state_bo); dri_bo_release(&brw->cc.vp_bo); diff --git a/src/mesa/drivers/dri/i965/gen6_wm_state.c b/src/mesa/drivers/dri/i965/gen6_wm_state.c index 863c85449d..2cd640de17 100644 --- a/src/mesa/drivers/dri/i965/gen6_wm_state.c +++ b/src/mesa/drivers/dri/i965/gen6_wm_state.c @@ -33,6 +33,50 @@ #include "program/prog_statevars.h" #include "intel_batchbuffer.h" +static void +prepare_wm_constants(struct brw_context *brw) +{ + struct intel_context *intel = &brw->intel; + GLcontext *ctx = &intel->ctx; + const struct brw_fragment_program *fp = + brw_fragment_program_const(brw->fragment_program); + + drm_intel_bo_unreference(brw->wm.push_const_bo); + brw->wm.push_const_bo = NULL; + + /* Updates the ParamaterValues[i] pointers for all parameters of the + * basic type of PROGRAM_STATE_VAR. + */ + /* XXX: Should this happen somewhere before to get our state flag set? */ + _mesa_load_state_parameters(ctx, fp->program.Base.Parameters); + + if (brw->wm.prog_data->nr_params != 0) { + float *constants; + unsigned int i; + + brw->wm.push_const_bo = drm_intel_bo_alloc(intel->bufmgr, + "WM constant_bo", + brw->wm.prog_data->nr_params * + sizeof(float), + 4096); + drm_intel_gem_bo_map_gtt(brw->wm.push_const_bo); + constants = brw->wm.push_const_bo->virtual; + for (i = 0; i < brw->wm.prog_data->nr_params; i++) { + constants[i] = *brw->wm.prog_data->param[i]; + } + drm_intel_gem_bo_unmap_gtt(brw->wm.push_const_bo); + } +} + +const struct brw_tracked_state gen6_wm_constants = { + .dirty = { + .mesa = _NEW_PROGRAM_CONSTANTS, + .brw = 0, + .cache = 0, + }, + .prepare = prepare_wm_constants, +}; + static void upload_wm_state(struct brw_context *brw) { @@ -40,12 +84,9 @@ upload_wm_state(struct brw_context *brw) GLcontext *ctx = &intel->ctx; const struct brw_fragment_program *fp = brw_fragment_program_const(brw->fragment_program); - unsigned int nr_params = fp->program.Base.Parameters->NumParameters; - drm_intel_bo *constant_bo; - int i; uint32_t dw2, dw4, dw5, dw6; - if (fp->use_const_buffer || nr_params == 0) { + if (fp->use_const_buffer || brw->wm.prog_data->nr_params == 0) { /* Disable the push constant buffers. */ BEGIN_BATCH(5); OUT_BATCH(CMD_3D_CONSTANT_PS_STATE << 16 | (5 - 2)); @@ -55,35 +96,17 @@ upload_wm_state(struct brw_context *brw) OUT_BATCH(0); ADVANCE_BATCH(); } else { - /* Updates the ParamaterValues[i] pointers for all parameters of the - * basic type of PROGRAM_STATE_VAR. - */ - _mesa_load_state_parameters(ctx, fp->program.Base.Parameters); - - constant_bo = drm_intel_bo_alloc(intel->bufmgr, "WM constant_bo", - nr_params * 4 * sizeof(float), - 4096); - drm_intel_gem_bo_map_gtt(constant_bo); - for (i = 0; i < nr_params; i++) { - memcpy((char *)constant_bo->virtual + i * 4 * sizeof(float), - fp->program.Base.Parameters->ParameterValues[i], - 4 * sizeof(float)); - } - drm_intel_gem_bo_unmap_gtt(constant_bo); - BEGIN_BATCH(5); OUT_BATCH(CMD_3D_CONSTANT_PS_STATE << 16 | GEN6_CONSTANT_BUFFER_0_ENABLE | (5 - 2)); - OUT_RELOC(constant_bo, + OUT_RELOC(brw->wm.push_const_bo, I915_GEM_DOMAIN_RENDER, 0, /* XXX: bad domain */ - ALIGN(nr_params, 2) / 2 - 1); + ALIGN(brw->wm.prog_data->nr_params, 8) / 8 - 1); OUT_BATCH(0); OUT_BATCH(0); OUT_BATCH(0); ADVANCE_BATCH(); - - drm_intel_bo_unreference(constant_bo); } intel_batchbuffer_emit_mi_flush(intel->batch); -- cgit v1.2.3 From 250fccecc81e2ad8a63efaccae85793fbffd0a37 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Sun, 22 Aug 2010 00:44:28 -0700 Subject: i965: Fix brw_math1 with scalar argument in gen6 FS. The docs claim two conflicting things: One, that a scalar source is supported. Two, source hstride must be 1 and width must be exec size. So splat a constant argument out into a full reg to operate on, since violating the second set of constraints is clearly failing. The alternative here might be to do a 1-wide exec on a constant argument for math1. It would probably save cycles too. But I'll leave that for the glsl2-965 branch. Fixes glsl-algebraic-div-one-2.shader_test. --- src/mesa/drivers/dri/i965/brw_wm_emit.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_wm_emit.c b/src/mesa/drivers/dri/i965/brw_wm_emit.c index 5c07108eb8..05b440eaa8 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_emit.c +++ b/src/mesa/drivers/dri/i965/brw_wm_emit.c @@ -852,10 +852,22 @@ void emit_math1(struct brw_wm_compile *c, const struct brw_reg *arg0) { struct brw_compile *p = &c->func; + struct intel_context *intel = &p->brw->intel; int dst_chan = _mesa_ffs(mask & WRITEMASK_XYZW) - 1; GLuint saturate = ((mask & SATURATE) ? BRW_MATH_SATURATE_SATURATE : BRW_MATH_SATURATE_NONE); + struct brw_reg src; + + if (intel->gen >= 6 && arg0[0].hstride == BRW_HORIZONTAL_STRIDE_0) { + /* Gen6 math requires that source and dst horizontal stride be 1. + * + */ + src = *dst; + brw_MOV(p, src, arg0[0]); + } else { + src = arg0[0]; + } if (!(mask & WRITEMASK_XYZW)) return; /* Do not emit dead code */ @@ -871,7 +883,7 @@ void emit_math1(struct brw_wm_compile *c, function, saturate, 2, - arg0[0], + src, BRW_MATH_DATA_VECTOR, BRW_MATH_PRECISION_FULL); @@ -882,7 +894,7 @@ void emit_math1(struct brw_wm_compile *c, function, saturate, 3, - sechalf(arg0[0]), + sechalf(src), BRW_MATH_DATA_VECTOR, BRW_MATH_PRECISION_FULL); } -- cgit v1.2.3 From 52e9520274c797f55af5f515a3f203515b6cb231 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Sun, 22 Aug 2010 00:47:45 -0700 Subject: i965: Fix 8-wide FB writes on gen6. My merge of Zhenyu's patch on top of my previous patches broke it by my code expecting simd16 single write and Zhenyu's simd8 path being disabled by mine. Merge the two for success. --- src/mesa/drivers/dri/i965/brw_wm_emit.c | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_wm_emit.c b/src/mesa/drivers/dri/i965/brw_wm_emit.c index 05b440eaa8..f3ad01b3fe 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_emit.c +++ b/src/mesa/drivers/dri/i965/brw_wm_emit.c @@ -1312,7 +1312,6 @@ void emit_fb_write(struct brw_wm_compile *c, struct intel_context *intel = &brw->intel; GLuint nr = 2; GLuint channel; - int step = 0; int base_reg; /* For gen6 fb write with no header, starting from color payload directly!. */ /* Reserve a space for AA - may not be needed: @@ -1342,7 +1341,11 @@ void emit_fb_write(struct brw_wm_compile *c, * m + 6: a0 * m + 7: a1 */ - brw_MOV(p, brw_message_reg(nr + channel * 2), arg0[channel]); + if (c->dispatch_width == 16) { + brw_MOV(p, brw_message_reg(nr + channel * 2), arg0[channel]); + } else { + brw_MOV(p, brw_message_reg(nr + channel), arg0[channel]); + } } else if (c->dispatch_width == 16 && brw->has_compr4) { /* pre-gen6 SIMD16 single source DP write looks like: * m + 0: r0 @@ -1361,16 +1364,6 @@ void emit_fb_write(struct brw_wm_compile *c, brw_MOV(p, brw_message_reg(nr + channel + BRW_MRF_COMPR4), arg0[channel]); - } else if (intel->gen >= 6) { - brw_set_compression_control(p, BRW_COMPRESSION_NONE); - brw_MOV(p, brw_message_reg(nr + channel + step), arg0[channel]); - if (c->dispatch_width == 16) { - brw_set_compression_control(p, BRW_COMPRESSION_NONE); - brw_MOV(p, - brw_message_reg(nr + channel + step + 1), - sechalf(arg0[channel])); - ++step; - } } else { /* mov (8) m2.0<1>:ud r28.0<8;8,1>:ud { Align1 } */ /* mov (8) m6.0<1>:ud r29.0<8;8,1>:ud { Align1 SecHalf } */ -- cgit v1.2.3 From 04094b2da2030a82ff49e647fc8658502f02cea8 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Sun, 15 Aug 2010 13:36:02 +0100 Subject: svga: Do not shortcut NULL surface relocations with SVGA3D_INVALID_ID. How to cope with NULL surface relocations should be entirely at winsys' discretion. --- src/gallium/drivers/svga/svga_cmd.c | 2 +- src/gallium/drivers/svga/svga_state_tss.c | 13 ++++++++----- 2 files changed, 9 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/svga/svga_cmd.c b/src/gallium/drivers/svga/svga_cmd.c index 7b2dfe2549..e975f3b02f 100644 --- a/src/gallium/drivers/svga/svga_cmd.c +++ b/src/gallium/drivers/svga/svga_cmd.c @@ -67,7 +67,7 @@ void surface_to_surfaceid(struct svga_winsys_context *swc, // IN id->mipmap = s->real_level; } else { - id->sid = SVGA3D_INVALID_ID; + swc->surface_relocation(swc, &id->sid, NULL, flags); id->face = 0; id->mipmap = 0; } diff --git a/src/gallium/drivers/svga/svga_state_tss.c b/src/gallium/drivers/svga/svga_state_tss.c index 76a2dae143..e42c4f7fce 100644 --- a/src/gallium/drivers/svga/svga_state_tss.c +++ b/src/gallium/drivers/svga/svga_state_tss.c @@ -128,18 +128,21 @@ update_tss_binding(struct svga_context *svga, goto fail; for (i = 0; i < queue.bind_count; i++) { + struct svga_winsys_surface *handle; + ts[i].stage = queue.bind[i].unit; ts[i].name = SVGA3D_TS_BIND_TEXTURE; if (queue.bind[i].view->v) { - svga->swc->surface_relocation(svga->swc, - &ts[i].value, - queue.bind[i].view->v->handle, - SVGA_RELOC_READ); + handle = queue.bind[i].view->v->handle; } else { - ts[i].value = SVGA3D_INVALID_ID; + handle = NULL; } + svga->swc->surface_relocation(svga->swc, + &ts[i].value, + handle, + SVGA_RELOC_READ); queue.bind[i].view->dirty = FALSE; } -- cgit v1.2.3 From 8a878c266a8bf50b49d3ef8c5984790581e33133 Mon Sep 17 00:00:00 2001 From: Henri Verbeet Date: Mon, 16 Aug 2010 22:18:37 +0200 Subject: r600g: Don't blindly unmap NULL->size. There may actually be something mapped in that range, especially for large buffers like e.g. the GL Drawable. --- src/gallium/winsys/r600/drm/radeon_bo.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/winsys/r600/drm/radeon_bo.c b/src/gallium/winsys/r600/drm/radeon_bo.c index f259ae7fb5..a1306f6e9d 100644 --- a/src/gallium/winsys/r600/drm/radeon_bo.c +++ b/src/gallium/winsys/r600/drm/radeon_bo.c @@ -145,7 +145,9 @@ struct radeon_bo *radeon_bo_decref(struct radeon *radeon, struct radeon_bo *bo) return NULL; } - munmap(bo->data, bo->size); + if (bo->map_count) { + munmap(bo->data, bo->size); + } memset(&args, 0, sizeof(args)); args.handle = bo->handle; drmIoctl(radeon->fd, DRM_IOCTL_GEM_CLOSE, &args); -- cgit v1.2.3 From a0c45eabf961905ea7bd48b2750fce41c8ba542b Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Sun, 22 Aug 2010 00:21:55 +0200 Subject: nvfx: use relocations array for vp constants --- src/gallium/drivers/nvfx/nvfx_fragprog.c | 18 ++++++------ src/gallium/drivers/nvfx/nvfx_shader.h | 2 +- src/gallium/drivers/nvfx/nvfx_state.h | 2 +- src/gallium/drivers/nvfx/nvfx_vertprog.c | 47 ++++++++++++++++---------------- 4 files changed, 34 insertions(+), 35 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/nvfx/nvfx_fragprog.c b/src/gallium/drivers/nvfx/nvfx_fragprog.c index db33ecd78c..025989ac5b 100644 --- a/src/gallium/drivers/nvfx/nvfx_fragprog.c +++ b/src/gallium/drivers/nvfx/nvfx_fragprog.c @@ -270,7 +270,7 @@ nv40_fp_if(struct nvfx_fpc *fpc, struct nvfx_src src) static void nv40_fp_cal(struct nvfx_fpc *fpc, unsigned target) { - struct nvfx_label_relocation reloc; + struct nvfx_relocation reloc; uint32_t *hw; fpc->inst_offset = fpc->fp->insn_len; grow_insns(fpc, 4); @@ -284,7 +284,7 @@ nv40_fp_cal(struct nvfx_fpc *fpc, unsigned target) hw[3] = 0; reloc.target = target; reloc.location = fpc->inst_offset + 2; - util_dynarray_append(&fpc->label_relocs, struct nvfx_label_relocation, reloc); + util_dynarray_append(&fpc->label_relocs, struct nvfx_relocation, reloc); } static void @@ -306,7 +306,7 @@ nv40_fp_ret(struct nvfx_fpc *fpc) static void nv40_fp_rep(struct nvfx_fpc *fpc, unsigned count, unsigned target) { - struct nvfx_label_relocation reloc; + struct nvfx_relocation reloc; uint32_t *hw; fpc->inst_offset = fpc->fp->insn_len; grow_insns(fpc, 4); @@ -325,7 +325,7 @@ nv40_fp_rep(struct nvfx_fpc *fpc, unsigned count, unsigned target) hw[3] = 0; /* | end_offset */ reloc.target = target; reloc.location = fpc->inst_offset + 3; - util_dynarray_append(&fpc->label_relocs, struct nvfx_label_relocation, reloc); + util_dynarray_append(&fpc->label_relocs, struct nvfx_relocation, reloc); //util_dynarray_append(&fpc->loop_stack, unsigned, target); } @@ -333,7 +333,7 @@ nv40_fp_rep(struct nvfx_fpc *fpc, unsigned count, unsigned target) static void nv40_fp_bra(struct nvfx_fpc *fpc, unsigned target) { - struct nvfx_label_relocation reloc; + struct nvfx_relocation reloc; uint32_t *hw; fpc->inst_offset = fpc->fp->insn_len; grow_insns(fpc, 4); @@ -349,10 +349,10 @@ nv40_fp_bra(struct nvfx_fpc *fpc, unsigned target) hw[3] = 0; /* | endif_offset */ reloc.target = target; reloc.location = fpc->inst_offset + 2; - util_dynarray_append(&fpc->label_relocs, struct nvfx_label_relocation, reloc); + util_dynarray_append(&fpc->label_relocs, struct nvfx_relocation, reloc); reloc.target = target; reloc.location = fpc->inst_offset + 3; - util_dynarray_append(&fpc->label_relocs, struct nvfx_label_relocation, reloc); + util_dynarray_append(&fpc->label_relocs, struct nvfx_relocation, reloc); } static void @@ -1041,9 +1041,9 @@ nvfx_fragprog_translate(struct nvfx_context *nvfx, } util_dynarray_append(&insns, unsigned, fp->insn_len); - for(unsigned i = 0; i < fpc->label_relocs.size; i += sizeof(struct nvfx_label_relocation)) + for(unsigned i = 0; i < fpc->label_relocs.size; i += sizeof(struct nvfx_relocation)) { - struct nvfx_label_relocation* label_reloc = (struct nvfx_label_relocation*)((char*)fpc->label_relocs.data + i); + struct nvfx_relocation* label_reloc = (struct nvfx_relocation*)((char*)fpc->label_relocs.data + i); fp->insn[label_reloc->location] |= ((unsigned*)insns.data)[label_reloc->target]; } util_dynarray_fini(&insns); diff --git a/src/gallium/drivers/nvfx/nvfx_shader.h b/src/gallium/drivers/nvfx/nvfx_shader.h index 52e684aec3..c711484ee2 100644 --- a/src/gallium/drivers/nvfx/nvfx_shader.h +++ b/src/gallium/drivers/nvfx/nvfx_shader.h @@ -509,7 +509,7 @@ nvfx_src_abs(struct nvfx_src src) return src; } -struct nvfx_label_relocation { +struct nvfx_relocation { unsigned location; unsigned target; }; diff --git a/src/gallium/drivers/nvfx/nvfx_state.h b/src/gallium/drivers/nvfx/nvfx_state.h index 6d589af5f3..1247abcfa2 100644 --- a/src/gallium/drivers/nvfx/nvfx_state.h +++ b/src/gallium/drivers/nvfx/nvfx_state.h @@ -9,7 +9,6 @@ struct nvfx_vertex_program_exec { uint32_t data[4]; - int const_index; }; struct nvfx_vertex_program_data { @@ -46,6 +45,7 @@ struct nvfx_vertex_program { uint32_t clip_ctrl; struct util_dynarray branch_relocs; + struct util_dynarray const_relocs; }; struct nvfx_fragment_program_data { diff --git a/src/gallium/drivers/nvfx/nvfx_vertprog.c b/src/gallium/drivers/nvfx/nvfx_vertprog.c index 38f37168a1..996680e32c 100644 --- a/src/gallium/drivers/nvfx/nvfx_vertprog.c +++ b/src/gallium/drivers/nvfx/nvfx_vertprog.c @@ -113,6 +113,7 @@ emit_src(struct nvfx_context* nvfx, struct nvfx_vpc *vpc, uint32_t *hw, int pos, { struct nvfx_vertex_program *vp = vpc->vp; uint32_t sr = 0; + struct nvfx_relocation reloc; switch (src.reg.type) { case NVFXSR_TEMP: @@ -128,9 +129,9 @@ emit_src(struct nvfx_context* nvfx, struct nvfx_vpc *vpc, uint32_t *hw, int pos, case NVFXSR_CONST: sr |= (NVFX_VP(SRC_REG_TYPE_CONST) << NVFX_VP(SRC_REG_TYPE_SHIFT)); - assert(vpc->vpi->const_index == -1 || - vpc->vpi->const_index == src.reg.index); - vpc->vpi->const_index = src.reg.index; + reloc.location = vp->nr_insns - 1; + reloc.target = src.reg.index; + util_dynarray_append(&vp->const_relocs, struct nvfx_relocation, reloc); break; case NVFXSR_NONE: sr |= (NVFX_VP(SRC_REG_TYPE_INPUT) << @@ -308,7 +309,6 @@ nvfx_vp_emit(struct nvfx_vpc *vpc, struct nvfx_insn insn) vp->insns = realloc(vp->insns, ++vp->nr_insns * sizeof(*vpc->vpi)); vpc->vpi = &vp->insns[vp->nr_insns - 1]; memset(vpc->vpi, 0, sizeof(*vpc->vpi)); - vpc->vpi->const_index = -1; hw = vpc->vpi->data; @@ -440,7 +440,7 @@ nvfx_vertprog_parse_instruction(struct nvfx_context* nvfx, struct nvfx_vpc *vpc, struct nvfx_reg dst; struct nvfx_src none = nvfx_src(nvfx_reg(NVFXSR_NONE, 0)); struct nvfx_insn insn; - struct nvfx_label_relocation reloc; + struct nvfx_relocation reloc; struct nvfx_loop_entry loop; int mask; int ai = -1, ci = -1, ii = -1; @@ -662,7 +662,7 @@ nvfx_vertprog_parse_instruction(struct nvfx_context* nvfx, struct nvfx_vpc *vpc, reloc.location = vpc->vp->nr_insns; reloc.target = finst->Label.Label + 1; - util_dynarray_append(&vpc->label_relocs, struct nvfx_label_relocation, reloc); + util_dynarray_append(&vpc->label_relocs, struct nvfx_relocation, reloc); insn = arith(SCA, BRA, none.reg, 0, none, none, none); insn.cc_test = NVFX_COND_EQ; @@ -675,7 +675,7 @@ nvfx_vertprog_parse_instruction(struct nvfx_context* nvfx, struct nvfx_vpc *vpc, case TGSI_OPCODE_CAL: reloc.location = vpc->vp->nr_insns; reloc.target = finst->Label.Label; - util_dynarray_append(&vpc->label_relocs, struct nvfx_label_relocation, reloc); + util_dynarray_append(&vpc->label_relocs, struct nvfx_relocation, reloc); if(finst->Instruction.Opcode == TGSI_OPCODE_CAL) insn = arith(SCA, CAL, none.reg, 0, none, none, none); @@ -707,7 +707,7 @@ nvfx_vertprog_parse_instruction(struct nvfx_context* nvfx, struct nvfx_vpc *vpc, reloc.location = vpc->vp->nr_insns; reloc.target = loop.cont_target; - util_dynarray_append(&vpc->label_relocs, struct nvfx_label_relocation, reloc); + util_dynarray_append(&vpc->label_relocs, struct nvfx_relocation, reloc); nvfx_vp_emit(vpc, arith(SCA, BRA, none.reg, 0, none, none, none)); break; @@ -717,7 +717,7 @@ nvfx_vertprog_parse_instruction(struct nvfx_context* nvfx, struct nvfx_vpc *vpc, reloc.location = vpc->vp->nr_insns; reloc.target = loop.cont_target; - util_dynarray_append(&vpc->label_relocs, struct nvfx_label_relocation, reloc); + util_dynarray_append(&vpc->label_relocs, struct nvfx_relocation, reloc); nvfx_vp_emit(vpc, arith(SCA, BRA, none.reg, 0, none, none, none)); break; @@ -727,7 +727,7 @@ nvfx_vertprog_parse_instruction(struct nvfx_context* nvfx, struct nvfx_vpc *vpc, reloc.location = vpc->vp->nr_insns; reloc.target = loop.brk_target; - util_dynarray_append(&vpc->label_relocs, struct nvfx_label_relocation, reloc); + util_dynarray_append(&vpc->label_relocs, struct nvfx_relocation, reloc); nvfx_vp_emit(vpc, arith(SCA, BRA, none.reg, 0, none, none, none)); break; @@ -979,17 +979,17 @@ nvfx_vertprog_translate(struct nvfx_context *nvfx, util_dynarray_append(&insns, unsigned, vp->nr_insns); - for(unsigned i = 0; i < vpc->label_relocs.size; i += sizeof(struct nvfx_label_relocation)) + for(unsigned i = 0; i < vpc->label_relocs.size; i += sizeof(struct nvfx_relocation)) { - struct nvfx_label_relocation* label_reloc = (struct nvfx_label_relocation*)((char*)vpc->label_relocs.data + i); - struct nvfx_label_relocation hw_reloc; + struct nvfx_relocation* label_reloc = (struct nvfx_relocation*)((char*)vpc->label_relocs.data + i); + struct nvfx_relocation hw_reloc; hw_reloc.location = label_reloc->location; hw_reloc.target = ((unsigned*)insns.data)[label_reloc->target]; //debug_printf("hw %u -> tgsi %u = hw %u\n", hw_reloc.location, label_reloc->target, hw_reloc.target); - util_dynarray_append(&vp->branch_relocs, struct nvfx_label_relocation, hw_reloc); + util_dynarray_append(&vp->branch_relocs, struct nvfx_relocation, hw_reloc); } util_dynarray_fini(&insns); util_dynarray_trim(&vp->branch_relocs); @@ -1155,9 +1155,9 @@ nvfx_vertprog_validate(struct nvfx_context *nvfx) */ if (vp->exec_start != vp->exec->start) { //printf("vp_relocs %u -> %u\n", vp->exec_start, vp->exec->start); - for(unsigned i = 0; i < vp->branch_relocs.size; i += sizeof(struct nvfx_label_relocation)) + for(unsigned i = 0; i < vp->branch_relocs.size; i += sizeof(struct nvfx_relocation)) { - struct nvfx_label_relocation* reloc = (struct nvfx_label_relocation*)((char*)vp->branch_relocs.data + i); + struct nvfx_relocation* reloc = (struct nvfx_relocation*)((char*)vp->branch_relocs.data + i); uint32_t* hw = vp->insns[reloc->location].data; unsigned target = vp->exec->start + reloc->target; @@ -1182,16 +1182,15 @@ nvfx_vertprog_validate(struct nvfx_context *nvfx) } if (vp->nr_consts && vp->data_start != vp->data->start) { - for (i = 0; i < vp->nr_insns; i++) { - struct nvfx_vertex_program_exec *vpi = &vp->insns[i]; + for(unsigned i = 0; i < vp->const_relocs.size; i += sizeof(struct nvfx_relocation)) + { + struct nvfx_relocation* reloc = (struct nvfx_relocation*)((char*)vp->const_relocs.data + i); + struct nvfx_vertex_program_exec *vpi = &vp->insns[reloc->location]; - if (vpi->const_index >= 0) { - vpi->data[1] &= ~NVFX_VP(INST_CONST_SRC_MASK); - vpi->data[1] |= - (vpi->const_index + vp->data->start) << + vpi->data[1] &= ~NVFX_VP(INST_CONST_SRC_MASK); + vpi->data[1] |= + (reloc->target + vp->data->start) << NVFX_VP(INST_CONST_SRC_SHIFT); - - } } vp->data_start = vp->data->start; -- cgit v1.2.3 From 793e398681ac9ef9da6f6a453a5665bdfd0270e8 Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Sun, 22 Aug 2010 14:53:49 +0200 Subject: nvfx: fix vertex programs --- src/gallium/drivers/nvfx/nvfx_vertprog.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/gallium/drivers/nvfx/nvfx_vertprog.c b/src/gallium/drivers/nvfx/nvfx_vertprog.c index 996680e32c..3c3521e162 100644 --- a/src/gallium/drivers/nvfx/nvfx_vertprog.c +++ b/src/gallium/drivers/nvfx/nvfx_vertprog.c @@ -1272,4 +1272,6 @@ nvfx_vertprog_destroy(struct nvfx_context *nvfx, struct nvfx_vertex_program *vp) vp->data_start_min = 0; vp->ir = vp->or = vp->clip_ctrl = 0; + util_dynarray_fini(&vp->branch_relocs); + util_dynarray_fini(&vp->const_relocs); } -- cgit v1.2.3 From 9fefab340f59519efc5c5690347a54e437d9407a Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Sun, 22 Aug 2010 11:58:54 +0200 Subject: nvfx: make stipple setting independent of enable --- src/gallium/drivers/nvfx/nvfx_context.c | 1 - src/gallium/drivers/nvfx/nvfx_context.h | 1 - src/gallium/drivers/nvfx/nvfx_state.c | 7 ------- src/gallium/drivers/nvfx/nvfx_state_stipple.c | 21 +++------------------ 4 files changed, 3 insertions(+), 27 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/nvfx/nvfx_context.c b/src/gallium/drivers/nvfx/nvfx_context.c index 94c854b22b..8e852010f5 100644 --- a/src/gallium/drivers/nvfx/nvfx_context.c +++ b/src/gallium/drivers/nvfx/nvfx_context.c @@ -90,7 +90,6 @@ nvfx_create(struct pipe_screen *pscreen, void *priv) /* set these to that we init them on first validation */ nvfx->state.scissor_enabled = ~0; - nvfx->state.stipple_enabled = ~0; nvfx->use_vertex_buffers = -1; LIST_INITHEAD(&nvfx->render_cache); diff --git a/src/gallium/drivers/nvfx/nvfx_context.h b/src/gallium/drivers/nvfx/nvfx_context.h index 83c44ef477..63fbce87b5 100644 --- a/src/gallium/drivers/nvfx/nvfx_context.h +++ b/src/gallium/drivers/nvfx/nvfx_context.h @@ -68,7 +68,6 @@ struct nvfx_blend_state { struct nvfx_state { unsigned scissor_enabled; - unsigned stipple_enabled; unsigned fp_samplers; unsigned render_temps; }; diff --git a/src/gallium/drivers/nvfx/nvfx_state.c b/src/gallium/drivers/nvfx/nvfx_state.c index c8431641d3..e3c3fcb7d5 100644 --- a/src/gallium/drivers/nvfx/nvfx_state.c +++ b/src/gallium/drivers/nvfx/nvfx_state.c @@ -173,13 +173,6 @@ nvfx_rasterizer_state_bind(struct pipe_context *pipe, void *hwcso) nvfx->draw_dirty |= NVFX_NEW_SCISSOR; } - if(((struct nvfx_rasterizer_state*)hwcso)->pipe.poly_stipple_enable - != nvfx->rasterizer->pipe.poly_stipple_enable) - { - nvfx->dirty |= NVFX_NEW_STIPPLE; - nvfx->draw_dirty |= NVFX_NEW_STIPPLE; - } - if(((struct nvfx_rasterizer_state*)hwcso)->pipe.point_quad_rasterization != nvfx->rasterizer->pipe.point_quad_rasterization || ((struct nvfx_rasterizer_state*)hwcso)->pipe.sprite_coord_enable != nvfx->rasterizer->pipe.sprite_coord_enable) { diff --git a/src/gallium/drivers/nvfx/nvfx_state_stipple.c b/src/gallium/drivers/nvfx/nvfx_state_stipple.c index 4da968f093..b76e9dd382 100644 --- a/src/gallium/drivers/nvfx/nvfx_state_stipple.c +++ b/src/gallium/drivers/nvfx/nvfx_state_stipple.c @@ -4,23 +4,8 @@ void nvfx_state_stipple_validate(struct nvfx_context *nvfx) { struct nouveau_channel *chan = nvfx->screen->base.channel; - struct pipe_rasterizer_state *rast = &nvfx->rasterizer->pipe; - if ((rast->poly_stipple_enable == 0 && nvfx->state.stipple_enabled == 0)) - return; - - if (rast->poly_stipple_enable) { - unsigned i; - - WAIT_RING(chan, 35); - OUT_RING(chan, RING_3D(NV34TCL_POLYGON_STIPPLE_ENABLE, 1)); - OUT_RING(chan, 1); - OUT_RING(chan, RING_3D(NV34TCL_POLYGON_STIPPLE_PATTERN(0), 32)); - for (i = 0; i < 32; i++) - OUT_RING(chan, nvfx->stipple[i]); - } else { - WAIT_RING(chan, 2); - OUT_RING(chan, RING_3D(NV34TCL_POLYGON_STIPPLE_ENABLE, 1)); - OUT_RING(chan, 0); - } + WAIT_RING(chan, 33); + OUT_RING(chan, RING_3D(NV34TCL_POLYGON_STIPPLE_PATTERN(0), 32)); + OUT_RINGp(chan, nvfx->stipple, 32); } -- cgit v1.2.3 From 7de1f86c49716eeadb443507d16ead933288059c Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Sun, 22 Aug 2010 12:02:41 +0200 Subject: nvfx: simplify and correct fragment program update logic This version should hopefully be much clearer and thus less likely to be subtly broken. Also fixes point sprites on nv40 and possibly some other bugs too. --- src/gallium/drivers/nvfx/nvfx_context.c | 2 + src/gallium/drivers/nvfx/nvfx_context.h | 2 + src/gallium/drivers/nvfx/nvfx_fragprog.c | 185 +++++++++++++++++++---------- src/gallium/drivers/nvfx/nvfx_state.h | 3 +- src/gallium/drivers/nvfx/nvfx_state_emit.c | 2 + src/gallium/drivers/nvfx/nvfx_vertprog.c | 49 +++----- 6 files changed, 149 insertions(+), 94 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/nvfx/nvfx_context.c b/src/gallium/drivers/nvfx/nvfx_context.c index 8e852010f5..e78fc14da4 100644 --- a/src/gallium/drivers/nvfx/nvfx_context.c +++ b/src/gallium/drivers/nvfx/nvfx_context.c @@ -90,6 +90,8 @@ nvfx_create(struct pipe_screen *pscreen, void *priv) /* set these to that we init them on first validation */ nvfx->state.scissor_enabled = ~0; + nvfx->hw_pointsprite_control = -1; + nvfx->hw_vp_output = -1; nvfx->use_vertex_buffers = -1; LIST_INITHEAD(&nvfx->render_cache); diff --git a/src/gallium/drivers/nvfx/nvfx_context.h b/src/gallium/drivers/nvfx/nvfx_context.h index 63fbce87b5..fb4a9da579 100644 --- a/src/gallium/drivers/nvfx/nvfx_context.h +++ b/src/gallium/drivers/nvfx/nvfx_context.h @@ -193,6 +193,8 @@ struct nvfx_context { uint32_t hw_txf[8]; struct nvfx_render_target hw_rt[4]; struct nvfx_render_target hw_zeta; + int hw_pointsprite_control; + int hw_vp_output; }; static INLINE struct nvfx_context * diff --git a/src/gallium/drivers/nvfx/nvfx_fragprog.c b/src/gallium/drivers/nvfx/nvfx_fragprog.c index 025989ac5b..e40a814e18 100644 --- a/src/gallium/drivers/nvfx/nvfx_fragprog.c +++ b/src/gallium/drivers/nvfx/nvfx_fragprog.c @@ -1101,6 +1101,35 @@ nvfx_fp_memcpy(void* dst, const void* src, size_t len) #endif } +/* The hardware only supports immediate constants inside the fragment program, + * and at least on nv30 doesn't support an indirect linkage table. + * + * Hence, we need to patch the fragment program itself both to update constants + * and update linkage. + * + * Using a single fragment program would entail unacceptable stalls if the GPU is + * already rendering with that fragment program. + * Thus, we instead use a "rotating queue" of buffer objects, each of which is + * packed with multiple versions of the same program. + * + * Whenever we need to patch something, we move to the next program and + * patch it. If all buffer objects are in use by the GPU, we allocate another one, + * expanding the queue. + * + * As an additional optimization, we record when all the programs have the + * current input slot configuration, and at that point we stop patching inputs. + * This happens, for instance, if a given fragment program is always used with + * the same vertex program (i.e. always with GLSL), or if the layouts match + * enough (non-GLSL). + * + * Note that instead of using multiple programs, we could push commands + * on the FIFO to patch a single program: it's not fully clear which option is + * faster, but my guess is that the current way is faster. + * + * We also track the previous slot assignments for each version and don't + * patch if they are the same (this could perhaps be removed). + */ + void nvfx_fragprog_validate(struct nvfx_context *nvfx) { @@ -1109,6 +1138,7 @@ nvfx_fragprog_validate(struct nvfx_context *nvfx) int update = 0; struct nvfx_vertex_program* vp; unsigned sprite_coord_enable; + boolean update_pointsprite = !!(nvfx->dirty & NVFX_NEW_FRAGPROG); if (!fp->translated) { @@ -1141,80 +1171,96 @@ nvfx_fragprog_validate(struct nvfx_context *nvfx) fp->bo_prog_idx = fp->progs_per_bo - 1; } - /* we must update constants even on "just" fragprog changes, because - we don't check whether the current constant buffer matches the latest - one bound to this fragment program */ - if (nvfx->dirty & (NVFX_NEW_FRAGCONST | NVFX_NEW_FRAGPROG)) - update = TRUE; - vp = nvfx->render_mode == HW ? nvfx->vertprog : nvfx->swtnl.vertprog; - if (fp->last_vp_id != vp->id) { - char* vp_sem_table = vp->generic_to_fp_input; - unsigned char* fp_semantics = fp->slot_to_generic; - unsigned diff = 0; - unsigned char* cur_slots; - fp->last_vp_id = nvfx->vertprog->id; - cur_slots = fp->slot_to_fp_input; - for(unsigned i = 0; i < fp->num_slots; ++i) { - unsigned char slot_mask = vp_sem_table[fp_semantics[i]]; - diff |= (slot_mask >> 4) & (slot_mask ^ cur_slots[i]); - } + sprite_coord_enable = nvfx->rasterizer->pipe.point_quad_rasterization * nvfx->rasterizer->pipe.sprite_coord_enable; + + if (fp->last_vp_id != vp->id || fp->last_sprite_coord_enable != sprite_coord_enable) { + int sprite_input = -1; + unsigned i; + fp->last_vp_id = vp->id; + fp->last_sprite_coord_enable = sprite_coord_enable; - if(diff) + if(sprite_coord_enable) { - for(unsigned i = 0; i < fp->num_slots; ++i) { - /* if 0xff, then this will write to the dummy value at fp->last_layout_mask[0] */ - fp->slot_to_fp_input[i] = vp_sem_table[fp_semantics[i]] & 0xf; - //printf("fp: GENERIC[%i] from fpreg %i\n", fp_semantics[i], fp->slot_to_fp_input[i]); + sprite_input = vp->sprite_fp_input; + if(sprite_input < 0) + { + unsigned used_texcoords = 0; + for(unsigned i = 0; i < fp->num_slots; ++i) { + unsigned generic = fp->slot_to_generic[i]; + if(!((1 << generic) & sprite_coord_enable)) + { + unsigned char slot_mask = vp->generic_to_fp_input[generic]; + if(slot_mask >= 0xf0) + used_texcoords |= 1 << ((slot_mask & 0xf) - NVFX_FP_OP_INPUT_SRC_TC0); + } + } + + sprite_input = NVFX_FP_OP_INPUT_SRC_TC(__builtin_ctz(~used_texcoords)); } - fp->progs_left_with_obsolete_slot_assignments = fp->progs; - update = TRUE; + fp->point_sprite_control |= (1 << (sprite_input - NVFX_FP_OP_INPUT_SRC_TC0 + 8)); } - } + else + fp->point_sprite_control = 0; - // last_sprite_coord_enable - sprite_coord_enable = nvfx->rasterizer->pipe.point_quad_rasterization * nvfx->rasterizer->pipe.sprite_coord_enable; - if(fp->last_sprite_coord_enable != sprite_coord_enable) - { - unsigned texcoord_mask = vp->texcoord_ouput_mask; - fp->last_sprite_coord_enable = sprite_coord_enable; - fp->point_sprite_control = 0; - for(unsigned i = 0; i < fp->num_slots; ++i) { - if((1 << fp->slot_to_generic[i]) & sprite_coord_enable) + for(i = 0; i < fp->num_slots; ++i) { + unsigned generic = fp->slot_to_generic[i]; + if((1 << generic) & sprite_coord_enable) { - unsigned fpin = fp->slot_to_fp_input[i]; - //printf("sprite: slot %i generic %i had texcoord %i\n", i, fp->slot_to_generic[i], fpin - NVFX_FP_OP_INPUT_SRC_TC0); - if(fpin >= 0x0f) - { - unsigned tc = __builtin_ctz(~texcoord_mask); - texcoord_mask |= (1 << tc); - fp->slot_to_fp_input[i] = fpin = NVFX_FP_OP_INPUT_SRC_TC(tc); - - fp->progs_left_with_obsolete_slot_assignments = fp->progs; - update = TRUE; - } - //printf("sprite: slot %i texcoord %i\n", i, fpin - NVFX_FP_OP_INPUT_SRC_TC0); - fp->point_sprite_control |= (1 << (fpin - NVFX_FP_OP_INPUT_SRC_TC0 + 8)); + if(fp->slot_to_fp_input[i] != sprite_input) + goto update_slots; } else { - unsigned fpin = fp->slot_to_fp_input[i]; - if(!(vp->texcoord_ouput_mask & (1 << (fpin - NVFX_FP_OP_INPUT_SRC_TC0)))) - { - fp->slot_to_fp_input[i] = 0x0f; + unsigned char slot_mask = vp->generic_to_fp_input[generic]; + if((slot_mask >> 4) & (slot_mask ^ fp->slot_to_fp_input[i])) + goto update_slots; + } + } + + if(0) + { +update_slots: + /* optimization: we start updating from the slot we found the first difference in */ + for(; i < fp->num_slots; ++i) + { + unsigned generic = fp->slot_to_generic[i]; + if((1 << generic) & sprite_coord_enable) + fp->slot_to_fp_input[i] = sprite_input; + else + fp->slot_to_fp_input[i] = vp->generic_to_fp_input[generic] & 0xf; + } - fp->progs_left_with_obsolete_slot_assignments = fp->progs; - update = TRUE; + if(nvfx->is_nv4x) + { + fp->or = 0; + for(i = 0; i < fp->num_slots; ++i) { + unsigned fp_input = fp->slot_to_fp_input[i]; + if(fp_input == NVFX_FP_OP_INPUT_SRC_TC(8)) + fp->or |= (1 << 12); + else if(fp_input == NVFX_FP_OP_INPUT_SRC_TC(9)) + fp->or |= (1 << 13); + else if(fp_input != 0xf) + fp->or |= (1 << (fp_input - NVFX_FP_OP_INPUT_SRC_TC0 + 14)); } } + + fp->progs_left_with_obsolete_slot_assignments = fp->progs; + goto update; } } - if(update) { + /* We must update constants even on "just" fragprog changes, because + * we don't check whether the current constant buffer matches the latest + * one bound to this fragment program. + * Doing such a check would likely be a pessimization. + */ + if (nvfx->dirty & (NVFX_NEW_FRAGCONST | NVFX_NEW_FRAGPROG)) { int offset; uint32_t* fpmap; +update: ++fp->bo_prog_idx; if(fp->bo_prog_idx >= fp->progs_per_bo) { @@ -1278,6 +1324,9 @@ nvfx_fragprog_validate(struct nvfx_context *nvfx) } } + /* we only do this if we aren't sure that all program versions have the + * current slot assignments, otherwise we just update constants for speed + */ if(fp->progs_left_with_obsolete_slot_assignments) { unsigned char* fpbo_slots = &fp->fpbo->slots[fp->bo_prog_idx * 8]; for(unsigned i = 0; i < fp->num_slots; ++i) { @@ -1296,10 +1345,7 @@ nvfx_fragprog_validate(struct nvfx_context *nvfx) } --fp->progs_left_with_obsolete_slot_assignments; } - } - if(update || (nvfx->dirty & NVFX_NEW_FRAGPROG)) { - int offset = fp->bo_prog_idx * fp->prog_size; MARK_RING(chan, 8, 1); OUT_RING(chan, RING_3D(NV34TCL_FP_ACTIVE_PROGRAM, 1)); OUT_RELOC(chan, fp->fpbo->bo, offset, NOUVEAU_BO_VRAM | @@ -1316,11 +1362,28 @@ nvfx_fragprog_validate(struct nvfx_context *nvfx) } } - if(nvfx->dirty & (NVFX_NEW_FRAGPROG | NVFX_NEW_SPRITE)) { - WAIT_RING(chan, 2); - OUT_RING(chan, RING_3D(NV34TCL_POINT_SPRITE, 1)); - OUT_RING(chan, fp->point_sprite_control | nvfx->rasterizer->pipe.point_quad_rasterization); + unsigned pointsprite_control = fp->point_sprite_control | nvfx->rasterizer->pipe.point_quad_rasterization; + if(pointsprite_control != nvfx->hw_pointsprite_control) + { + WAIT_RING(chan, 2); + OUT_RING(chan, RING_3D(NV34TCL_POINT_SPRITE, 1)); + OUT_RING(chan, pointsprite_control); + nvfx->hw_pointsprite_control = pointsprite_control; + } + } + + if(nvfx->is_nv4x) + { + unsigned vp_output = vp->or | fp->or; + + if(vp_output != nvfx->hw_vp_output) + { + WAIT_RING(chan, 2); + OUT_RING(chan, RING_3D(NV40TCL_VP_RESULT_EN, 1)); + OUT_RING(chan, vp_output); + nvfx->hw_vp_output = vp_output; + } } } diff --git a/src/gallium/drivers/nvfx/nvfx_state.h b/src/gallium/drivers/nvfx/nvfx_state.h index 1247abcfa2..05d41cfc8d 100644 --- a/src/gallium/drivers/nvfx/nvfx_state.h +++ b/src/gallium/drivers/nvfx/nvfx_state.h @@ -32,7 +32,7 @@ struct nvfx_vertex_program { unsigned nr_consts; char generic_to_fp_input[256]; - unsigned texcoord_ouput_mask; + int sprite_fp_input; struct nouveau_resource *exec; unsigned exec_start; @@ -67,6 +67,7 @@ struct nvfx_fragment_program { boolean translated; unsigned samplers; unsigned point_sprite_control; + unsigned or; uint32_t *insn; int insn_len; diff --git a/src/gallium/drivers/nvfx/nvfx_state_emit.c b/src/gallium/drivers/nvfx/nvfx_state_emit.c index 8e3c342179..bd89a385d7 100644 --- a/src/gallium/drivers/nvfx/nvfx_state_emit.c +++ b/src/gallium/drivers/nvfx/nvfx_state_emit.c @@ -17,6 +17,8 @@ nvfx_state_validate_common(struct nvfx_context *nvfx) { nvfx->dirty = ~0; nvfx->hw_vtxelt_nr = 16; + nvfx->hw_pointsprite_control = -1; + nvfx->hw_vp_output = -1; nvfx->screen->cur_ctx = nvfx; } diff --git a/src/gallium/drivers/nvfx/nvfx_vertprog.c b/src/gallium/drivers/nvfx/nvfx_vertprog.c index 3c3521e162..806f263dcf 100644 --- a/src/gallium/drivers/nvfx/nvfx_vertprog.c +++ b/src/gallium/drivers/nvfx/nvfx_vertprog.c @@ -235,24 +235,10 @@ emit_dst(struct nvfx_context* nvfx, struct nvfx_vpc *vpc, uint32_t *hw, int slot dst.index = NVFX_VP(INST_DEST_PSZ); break; default: - if(!nvfx->is_nv4x) { - switch (dst.index) { - case NV30_VP_INST_DEST_COL0 : vp->or |= (1 << 0); break; - case NV30_VP_INST_DEST_COL1 : vp->or |= (1 << 1); break; - case NV30_VP_INST_DEST_BFC0 : vp->or |= (1 << 2); break; - case NV30_VP_INST_DEST_BFC1 : vp->or |= (1 << 3); break; - case NV30_VP_INST_DEST_FOGC: vp->or |= (1 << 4); break; - case NV30_VP_INST_DEST_PSZ : vp->or |= (1 << 5); break; - case NV30_VP_INST_DEST_TC(0): vp->or |= (1 << 14); break; - case NV30_VP_INST_DEST_TC(1): vp->or |= (1 << 15); break; - case NV30_VP_INST_DEST_TC(2): vp->or |= (1 << 16); break; - case NV30_VP_INST_DEST_TC(3): vp->or |= (1 << 17); break; - case NV30_VP_INST_DEST_TC(4): vp->or |= (1 << 18); break; - case NV30_VP_INST_DEST_TC(5): vp->or |= (1 << 19); break; - case NV30_VP_INST_DEST_TC(6): vp->or |= (1 << 20); break; - case NV30_VP_INST_DEST_TC(7): vp->or |= (1 << 21); break; - } - } else { + if(nvfx->is_nv4x) { + /* we don't need vp->or on nv3x + * texcoords are handled by fragment program + */ switch (dst.index) { case NV40_VP_INST_DEST_COL0 : vp->or |= (1 << 0); break; case NV40_VP_INST_DEST_COL1 : vp->or |= (1 << 1); break; @@ -260,14 +246,6 @@ emit_dst(struct nvfx_context* nvfx, struct nvfx_vpc *vpc, uint32_t *hw, int slot case NV40_VP_INST_DEST_BFC1 : vp->or |= (1 << 3); break; case NV40_VP_INST_DEST_FOGC: vp->or |= (1 << 4); break; case NV40_VP_INST_DEST_PSZ : vp->or |= (1 << 5); break; - case NV40_VP_INST_DEST_TC(0): vp->or |= (1 << 14); break; - case NV40_VP_INST_DEST_TC(1): vp->or |= (1 << 15); break; - case NV40_VP_INST_DEST_TC(2): vp->or |= (1 << 16); break; - case NV40_VP_INST_DEST_TC(3): vp->or |= (1 << 17); break; - case NV40_VP_INST_DEST_TC(4): vp->or |= (1 << 18); break; - case NV40_VP_INST_DEST_TC(5): vp->or |= (1 << 19); break; - case NV40_VP_INST_DEST_TC(6): vp->or |= (1 << 20); break; - case NV40_VP_INST_DEST_TC(7): vp->or |= (1 << 21); break; } } break; @@ -817,13 +795,21 @@ nvfx_vertprog_prepare(struct nvfx_context* nvfx, struct nvfx_vpc *vpc) /* hope 0xf is (0, 0, 0, 1) initialized; otherwise, we are _probably_ not required to do this */ memset(vpc->vp->generic_to_fp_input, 0x0f, sizeof(vpc->vp->generic_to_fp_input)); - vpc->vp->texcoord_ouput_mask = 0; for(int i = 0; i < 8; ++i) { if(sem_layout[i] == 0xff) continue; - vpc->vp->texcoord_ouput_mask |= (1 << i); //printf("vp: GENERIC[%i] to fpreg %i\n", sem_layout[i], NVFX_FP_OP_INPUT_SRC_TC(0) + i); - vpc->vp->generic_to_fp_input[sem_layout[i]] = 0xf0 | (NVFX_FP_OP_INPUT_SRC_TC(0) + i); + vpc->vp->generic_to_fp_input[sem_layout[i]] = 0xf0 | NVFX_FP_OP_INPUT_SRC_TC(i); + } + + vpc->vp->sprite_fp_input = -1; + for(int i = 0; i < 8; ++i) + { + if(sem_layout[i] == 0xff) + { + vpc->vp->sprite_fp_input = NVFX_FP_OP_INPUT_SRC_TC(i); + break; + } } tgsi_parse_init(&p, vpc->vp->pipe.tokens); @@ -1233,13 +1219,12 @@ nvfx_vertprog_validate(struct nvfx_context *nvfx) if(nvfx->dirty & (NVFX_NEW_VERTPROG | NVFX_NEW_UCP)) { - WAIT_RING(chan, 7); + WAIT_RING(chan, 6); OUT_RING(chan, RING_3D(NV34TCL_VP_START_FROM_ID, 1)); OUT_RING(chan, vp->exec->start); if(nvfx->is_nv4x) { - OUT_RING(chan, RING_3D(NV40TCL_VP_ATTRIB_EN, 2)); + OUT_RING(chan, RING_3D(NV40TCL_VP_ATTRIB_EN, 1)); OUT_RING(chan, vp->ir); - OUT_RING(chan, vp->or); } OUT_RING(chan, RING_3D(NV34TCL_VP_CLIP_PLANES_ENABLE, 1)); OUT_RING(chan, vp->clip_ctrl); -- cgit v1.2.3 From 8570232b3b7930bd2ef58a337e9d57b12d3a8874 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Fri, 20 Aug 2010 00:08:22 +0100 Subject: glx/xlib: no need to call XSync from XMesaFlush Try to eliminate some unnecessary X server round trips. --- src/gallium/state_trackers/glx/xlib/xm_api.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/state_trackers/glx/xlib/xm_api.c b/src/gallium/state_trackers/glx/xlib/xm_api.c index c0c418306f..3c9d149761 100644 --- a/src/gallium/state_trackers/glx/xlib/xm_api.c +++ b/src/gallium/state_trackers/glx/xlib/xm_api.c @@ -1154,7 +1154,7 @@ void XMesaFlush( XMesaContext c ) xmdpy->screen->fence_finish(xmdpy->screen, fence, 0); xmdpy->screen->fence_reference(xmdpy->screen, &fence, NULL); } - XSync( c->xm_visual->display, False ); + XFlush( c->xm_visual->display ); } } -- cgit v1.2.3 From 8b15de2736976ed6095d6f36e22c66f9de43601d Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Fri, 20 Aug 2010 00:14:47 +0100 Subject: glx/xlib: remove another XSync With this change, xmesa_get_window_size still does one round trip, but that's better than doing two. --- src/gallium/state_trackers/glx/xlib/xm_api.c | 1 - 1 file changed, 1 deletion(-) (limited to 'src') diff --git a/src/gallium/state_trackers/glx/xlib/xm_api.c b/src/gallium/state_trackers/glx/xlib/xm_api.c index 3c9d149761..2fc400b3fc 100644 --- a/src/gallium/state_trackers/glx/xlib/xm_api.c +++ b/src/gallium/state_trackers/glx/xlib/xm_api.c @@ -263,7 +263,6 @@ xmesa_get_window_size(Display *dpy, XMesaBuffer b, Status stat; pipe_mutex_lock(xmdpy->mutex); - XSync(b->xm_visual->display, 0); /* added for Chromium */ stat = get_drawable_size(dpy, b->ws.drawable, width, height); pipe_mutex_unlock(xmdpy->mutex); -- cgit v1.2.3 From a1de6f48c3fa79bbc8f2514da19b3e01138e7093 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Sat, 21 Aug 2010 22:51:38 +0100 Subject: draw: reduce the size of the llvm variant key --- src/gallium/auxiliary/draw/draw_llvm.c | 67 ++++++++++++++-------- src/gallium/auxiliary/draw/draw_llvm.h | 54 ++++++++++++++--- .../draw/draw_pt_fetch_shade_pipeline_llvm.c | 12 ++-- src/gallium/auxiliary/draw/draw_vs_llvm.c | 5 ++ 4 files changed, 100 insertions(+), 38 deletions(-) (limited to 'src') diff --git a/src/gallium/auxiliary/draw/draw_llvm.c b/src/gallium/auxiliary/draw/draw_llvm.c index 58d3e345e5..8759c38cab 100644 --- a/src/gallium/auxiliary/draw/draw_llvm.c +++ b/src/gallium/auxiliary/draw/draw_llvm.c @@ -285,15 +285,23 @@ draw_llvm_destroy(struct draw_llvm *llvm) } struct draw_llvm_variant * -draw_llvm_create_variant(struct draw_llvm *llvm, int num_inputs) +draw_llvm_create_variant(struct draw_llvm *llvm, + unsigned num_inputs, + const struct draw_llvm_variant_key *key) { - struct draw_llvm_variant *variant = MALLOC(sizeof(struct draw_llvm_variant)); + struct draw_llvm_variant *variant; struct llvm_vertex_shader *shader = llvm_vertex_shader(llvm->draw->vs.vertex_shader); + variant = MALLOC(sizeof *variant + + shader->variant_key_size - + sizeof variant->key); + if (variant == NULL) + return NULL; + variant->llvm = llvm; - draw_llvm_make_variant_key(llvm, &variant->key); + memcpy(&variant->key, key, shader->variant_key_size); llvm->vertex_header_ptr_type = create_vertex_header(llvm, num_inputs); @@ -731,8 +739,9 @@ draw_llvm_generate(struct draw_llvm *llvm, struct draw_llvm_variant *variant) step = LLVMConstInt(LLVMInt32Type(), max_vertices, 0); /* code generated texture sampling */ - sampler = draw_llvm_sampler_soa_create(variant->key.sampler, - context_ptr); + sampler = draw_llvm_sampler_soa_create( + draw_llvm_variant_key_samplers(&variant->key), + context_ptr); #if DEBUG_STORE lp_build_printf(builder, "start = %d, end = %d, step = %d\n", @@ -894,8 +903,9 @@ draw_llvm_generate_elts(struct draw_llvm *llvm, struct draw_llvm_variant *varian step = LLVMConstInt(LLVMInt32Type(), max_vertices, 0); /* code generated texture sampling */ - sampler = draw_llvm_sampler_soa_create(variant->key.sampler, - context_ptr); + sampler = draw_llvm_sampler_soa_create( + draw_llvm_variant_key_samplers(&variant->key), + context_ptr); fetch_max = LLVMBuildSub(builder, fetch_count, LLVMConstInt(LLVMInt32Type(), 1, 0), @@ -995,35 +1005,42 @@ draw_llvm_generate_elts(struct draw_llvm *llvm, struct draw_llvm_variant *varian lp_func_delete_body(variant->function_elts); } -void -draw_llvm_make_variant_key(struct draw_llvm *llvm, - struct draw_llvm_variant_key *key) + +struct draw_llvm_variant_key * +draw_llvm_make_variant_key(struct draw_llvm *llvm, char *store) { unsigned i; + struct draw_llvm_variant_key *key; + struct lp_sampler_static_state *sampler; - memset(key, 0, sizeof(struct draw_llvm_variant_key)); + key = (struct draw_llvm_variant_key *)store; + /* Presumably all variants of the shader should have the same + * number of vertex elements - ie the number of shader inputs. + */ key->nr_vertex_elements = llvm->draw->pt.nr_vertex_elements; + /* All variants of this shader will have the same value for + * nr_samplers. Not yet trying to compact away holes in the + * sampler array. + */ + key->nr_samplers = llvm->draw->vs.vertex_shader->info.file_max[TGSI_FILE_SAMPLER] + 1; + + sampler = draw_llvm_variant_key_samplers(key); + memcpy(key->vertex_element, llvm->draw->pt.vertex_element, sizeof(struct pipe_vertex_element) * key->nr_vertex_elements); + + memset(sampler, 0, key->nr_samplers * sizeof *sampler); - memcpy(&key->vs, - &llvm->draw->vs.vertex_shader->state, - sizeof(struct pipe_shader_state)); - - /* if the driver implemented the sampling hooks then - * setup our sampling state */ - if (llvm->draw->num_sampler_views && llvm->draw->num_samplers) { - for(i = 0; i < PIPE_MAX_VERTEX_SAMPLERS; ++i) { - struct draw_vertex_shader *shader = llvm->draw->vs.vertex_shader; - if(shader->info.file_mask[TGSI_FILE_SAMPLER] & (1 << i)) - lp_sampler_static_state(&key->sampler[i], - llvm->draw->sampler_views[i], - llvm->draw->samplers[i]); - } + for (i = 0 ; i < key->nr_samplers; i++) { + lp_sampler_static_state(&sampler[i], + llvm->draw->sampler_views[i], + llvm->draw->samplers[i]); } + + return key; } void diff --git a/src/gallium/auxiliary/draw/draw_llvm.h b/src/gallium/auxiliary/draw/draw_llvm.h index 4addb47d2d..6196b2f983 100644 --- a/src/gallium/auxiliary/draw/draw_llvm.h +++ b/src/gallium/auxiliary/draw/draw_llvm.h @@ -151,12 +151,43 @@ typedef void struct draw_llvm_variant_key { - struct pipe_vertex_element vertex_element[PIPE_MAX_ATTRIBS]; - unsigned nr_vertex_elements; - struct pipe_shader_state vs; - struct lp_sampler_static_state sampler[PIPE_MAX_VERTEX_SAMPLERS]; + unsigned nr_vertex_elements:16; + unsigned nr_samplers:16; + + /* Variable number of vertex elements: + */ + struct pipe_vertex_element vertex_element[1]; + + /* Followed by variable number of samplers: + */ +/* struct lp_sampler_static_state sampler; */ }; +#define DRAW_LLVM_MAX_VARIANT_KEY_SIZE \ + (sizeof(struct draw_llvm_variant_key) + \ + PIPE_MAX_VERTEX_SAMPLERS * sizeof(struct lp_sampler_static_state) + \ + (PIPE_MAX_ATTRIBS-1) * sizeof(struct pipe_vertex_element)) + + +static INLINE size_t +draw_llvm_variant_key_size(unsigned nr_vertex_elements, + unsigned nr_samplers) +{ + return (sizeof(struct draw_llvm_variant_key) + + nr_samplers * sizeof(struct lp_sampler_static_state) + + (nr_vertex_elements - 1) * sizeof(struct pipe_vertex_element)); +} + + +static INLINE struct lp_sampler_static_state * +draw_llvm_variant_key_samplers(struct draw_llvm_variant_key *key) +{ + return (struct lp_sampler_static_state *) + &key->vertex_element[key->nr_vertex_elements]; +} + + + struct draw_llvm_variant_list_item { struct draw_llvm_variant *base; @@ -165,7 +196,6 @@ struct draw_llvm_variant_list_item struct draw_llvm_variant { - struct draw_llvm_variant_key key; LLVMValueRef function; LLVMValueRef function_elts; draw_jit_vert_func jit_func; @@ -176,11 +206,16 @@ struct draw_llvm_variant struct draw_llvm *llvm; struct draw_llvm_variant_list_item list_item_global; struct draw_llvm_variant_list_item list_item_local; + + /* key is variable-sized, must be last */ + struct draw_llvm_variant_key key; + /* key is variable-sized, must be last */ }; struct llvm_vertex_shader { struct draw_vertex_shader base; + unsigned variant_key_size; struct draw_llvm_variant_list_item variants; unsigned variants_created; unsigned variants_cached; @@ -220,14 +255,15 @@ void draw_llvm_destroy(struct draw_llvm *llvm); struct draw_llvm_variant * -draw_llvm_create_variant(struct draw_llvm *llvm, int num_inputs); +draw_llvm_create_variant(struct draw_llvm *llvm, + unsigned num_vertex_header_attribs, + const struct draw_llvm_variant_key *key); void draw_llvm_destroy_variant(struct draw_llvm_variant *variant); -void -draw_llvm_make_variant_key(struct draw_llvm *llvm, - struct draw_llvm_variant_key *key); +struct draw_llvm_variant_key * +draw_llvm_make_variant_key(struct draw_llvm *llvm, char *store); LLVMValueRef draw_llvm_translate_from(LLVMBuilderRef builder, diff --git a/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline_llvm.c b/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline_llvm.c index 78b1bf988c..cc0b4e5232 100644 --- a/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline_llvm.c +++ b/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline_llvm.c @@ -66,7 +66,8 @@ llvm_middle_end_prepare( struct draw_pt_middle_end *middle, struct draw_context *draw = fpme->draw; struct llvm_vertex_shader *shader = llvm_vertex_shader(draw->vs.vertex_shader); - struct draw_llvm_variant_key key; + char store[DRAW_LLVM_MAX_VARIANT_KEY_SIZE]; + struct draw_llvm_variant_key *key; struct draw_llvm_variant *variant = NULL; struct draw_llvm_variant_list_item *li; unsigned i; @@ -125,11 +126,14 @@ llvm_middle_end_prepare( struct draw_pt_middle_end *middle, *max_vertices = 4096; } - draw_llvm_make_variant_key(fpme->llvm, &key); + /* return even number */ + *max_vertices = *max_vertices & ~1; + + key = draw_llvm_make_variant_key(fpme->llvm, store); li = first_elem(&shader->variants); while(!at_end(&shader->variants, li)) { - if(memcmp(&li->base->key, &key, sizeof key) == 0) { + if(memcmp(&li->base->key, key, shader->variant_key_size) == 0) { variant = li->base; break; } @@ -152,7 +156,7 @@ llvm_middle_end_prepare( struct draw_pt_middle_end *middle, } } - variant = draw_llvm_create_variant(fpme->llvm, nr); + variant = draw_llvm_create_variant(fpme->llvm, nr, key); if (variant) { insert_at_head(&shader->variants, &variant->list_item_local); diff --git a/src/gallium/auxiliary/draw/draw_vs_llvm.c b/src/gallium/auxiliary/draw/draw_vs_llvm.c index d13ad24fff..0014863454 100644 --- a/src/gallium/auxiliary/draw/draw_vs_llvm.c +++ b/src/gallium/auxiliary/draw/draw_vs_llvm.c @@ -109,6 +109,11 @@ draw_create_vs_llvm(struct draw_context *draw, tgsi_scan_shader(state->tokens, &vs->base.info); + vs->variant_key_size = + draw_llvm_variant_key_size( + vs->base.info.file_max[TGSI_FILE_INPUT]+1, + vs->base.info.file_max[TGSI_FILE_SAMPLER]+1); + vs->base.draw = draw; vs->base.prepare = vs_llvm_prepare; vs->base.run_linear = vs_llvm_run_linear; -- cgit v1.2.3 From 0ad82b8d28cbb8d7224bf96c43c80fed45321597 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Sun, 22 Aug 2010 11:43:01 +0100 Subject: llvmpipe: don't clear unused bins If bins outside the current scene bounds are being corrupted, we'll need to fix that separately. Currently seems ok though. --- src/gallium/drivers/llvmpipe/lp_scene.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/llvmpipe/lp_scene.c b/src/gallium/drivers/llvmpipe/lp_scene.c index f88a759fe7..15a09b7100 100644 --- a/src/gallium/drivers/llvmpipe/lp_scene.c +++ b/src/gallium/drivers/llvmpipe/lp_scene.c @@ -163,12 +163,15 @@ lp_scene_reset(struct lp_scene *scene ) /* Free all but last binner command lists: */ - for (i = 0; i < TILES_X; i++) { - for (j = 0; j < TILES_Y; j++) { + for (i = 0; i < scene->tiles_x; i++) { + for (j = 0; j < scene->tiles_y; j++) { lp_scene_bin_reset(scene, i, j); } } + /* If there are any bins which weren't cleared by the loop above, + * they will be caught (on debug builds at least) by this assert: + */ assert(lp_scene_is_empty(scene)); /* Free all but last binned data block: -- cgit v1.2.3 From 49a2ea082b16732959b1e8e793d9c3293d8332c0 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Sun, 22 Aug 2010 12:16:45 +0100 Subject: llvmpipe: remove unused member from lp_fragment_shader_variant_key --- src/gallium/drivers/llvmpipe/lp_state_fs.h | 4 ---- 1 file changed, 4 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/llvmpipe/lp_state_fs.h b/src/gallium/drivers/llvmpipe/lp_state_fs.h index 37900fc544..78c5b1aee2 100644 --- a/src/gallium/drivers/llvmpipe/lp_state_fs.h +++ b/src/gallium/drivers/llvmpipe/lp_state_fs.h @@ -56,10 +56,6 @@ struct lp_fragment_shader_variant_key unsigned flatshade:1; unsigned occlusion_count:1; - struct { - ubyte colormask; - } cbuf_blend[PIPE_MAX_COLOR_BUFS]; - struct lp_sampler_static_state sampler[PIPE_MAX_SAMPLERS]; }; -- cgit v1.2.3 From 3d4b60f1f7be3dc54951c9c414601062e73ca674 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Sun, 22 Aug 2010 12:31:18 +0100 Subject: llvmpipe: reduce size of fragment shader variant key Don't spend as much time comparing them. --- src/gallium/drivers/llvmpipe/lp_state_fs.c | 26 ++++++++++++++++++++------ src/gallium/drivers/llvmpipe/lp_state_fs.h | 2 ++ 2 files changed, 22 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/llvmpipe/lp_state_fs.c b/src/gallium/drivers/llvmpipe/lp_state_fs.c index dbca49a2ef..35ef63389c 100644 --- a/src/gallium/drivers/llvmpipe/lp_state_fs.c +++ b/src/gallium/drivers/llvmpipe/lp_state_fs.c @@ -808,7 +808,7 @@ generate_variant(struct llvmpipe_context *lp, variant->list_item_local.base = variant; variant->no = shader->variants_created++; - memcpy(&variant->key, key, sizeof *key); + memcpy(&variant->key, key, shader->variant_key_size); if (gallivm_debug & GALLIVM_DEBUG_IR) { debug_printf("llvmpipe: Creating fragment shader #%u variant #%u:\n", @@ -840,6 +840,7 @@ llvmpipe_create_fs_state(struct pipe_context *pipe, const struct pipe_shader_state *templ) { struct lp_fragment_shader *shader; + int nr_samplers; shader = CALLOC_STRUCT(lp_fragment_shader); if (!shader) @@ -854,6 +855,11 @@ llvmpipe_create_fs_state(struct pipe_context *pipe, /* we need to keep a local copy of the tokens */ shader->base.tokens = tgsi_dup_tokens(templ->tokens); + nr_samplers = shader->info.file_max[TGSI_FILE_SAMPLER] + 1; + + shader->variant_key_size = Offset(struct lp_fragment_shader_variant_key, + sampler[nr_samplers]); + if (LP_DEBUG & DEBUG_TGSI) { unsigned attrib; debug_printf("llvmpipe: Create fragment shader #%u %p:\n", shader->no, (void *) shader); @@ -1027,7 +1033,7 @@ make_variant_key(struct llvmpipe_context *lp, { unsigned i; - memset(key, 0, sizeof *key); + memset(key, 0, shader->variant_key_size); if (lp->framebuffer.zsbuf) { if (lp->depth_stencil->depth.enabled) { @@ -1097,9 +1103,17 @@ make_variant_key(struct llvmpipe_context *lp, } } - for(i = 0; i < PIPE_MAX_SAMPLERS; ++i) - if(shader->info.file_mask[TGSI_FILE_SAMPLER] & (1 << i)) - lp_sampler_static_state(&key->sampler[i], lp->fragment_sampler_views[i], lp->sampler[i]); + /* This value will be the same for all the variants of a given shader: + */ + key->nr_samplers = shader->info.file_max[TGSI_FILE_SAMPLER] + 1; + + for(i = 0; i < key->nr_samplers; ++i) { + if(shader->info.file_mask[TGSI_FILE_SAMPLER] & (1 << i)) { + lp_sampler_static_state(&key->sampler[i], + lp->fragment_sampler_views[i], + lp->sampler[i]); + } + } } /** @@ -1118,7 +1132,7 @@ llvmpipe_update_fs(struct llvmpipe_context *lp) li = first_elem(&shader->variants); while(!at_end(&shader->variants, li)) { - if(memcmp(&li->base->key, &key, sizeof key) == 0) { + if(memcmp(&li->base->key, &key, shader->variant_key_size) == 0) { variant = li->base; break; } diff --git a/src/gallium/drivers/llvmpipe/lp_state_fs.h b/src/gallium/drivers/llvmpipe/lp_state_fs.h index 78c5b1aee2..33c480010d 100644 --- a/src/gallium/drivers/llvmpipe/lp_state_fs.h +++ b/src/gallium/drivers/llvmpipe/lp_state_fs.h @@ -53,6 +53,7 @@ struct lp_fragment_shader_variant_key struct pipe_blend_state blend; enum pipe_format zsbuf_format; unsigned nr_cbufs:8; + unsigned nr_samplers:8; /* actually derivable from just the shader */ unsigned flatshade:1; unsigned occlusion_count:1; @@ -93,6 +94,7 @@ struct lp_fragment_shader struct lp_fs_variant_list_item variants; /* For debugging/profiling purposes */ + unsigned variant_key_size; unsigned no; unsigned variants_created; unsigned variants_cached; -- cgit v1.2.3 From 42719df0b866a00ea4a7739e82e1639c9943fcfd Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Sun, 22 Aug 2010 14:14:55 +0100 Subject: glx/xlib: configurable strict/non-strict buffer size invalidate Introduce a new configuration option XMESA_STRICT_INVALIDATE to switch between swapbuffers-based and glViewport-based buffer invalidation. Default strict invalidate to false, ie glViewport-based invalidation, aka ST_MANAGER_BROKEN_INVALIDATE. This means we will not call XGetGeometry after every swapbuffers, which allows swapbuffers to remain asynchronous. For apps running at 100fps with synchronous swapping, a 10% boost is typical. For gears, I see closer to 20% speedup. Note that the work of copying data on swapbuffers doesn't disappear - this change just allows the X server to execute the PutImage asynchronously without us effectively blocked until its completion. This applies even to llvmpipe's threaded rasterization as the swapbuffers operation was a large part of the serial component of an llvmpipe frame. The downside of this is correctness - applications which don't call glViewport on window resizes will get incorrect rendering, unless XMESA_STRICT_INVALIDATE is set. The ultimate solution would be to have per-frame but asynchronous invalidation. Xcb almost looks as if it could provide this, but the API doesn't seem to quite be there. --- src/gallium/state_trackers/glx/xlib/xm_api.c | 32 +++++++++++++++++++++++++++- src/gallium/state_trackers/glx/xlib/xm_api.h | 2 +- src/gallium/state_trackers/glx/xlib/xm_st.c | 12 +++++++++-- 3 files changed, 42 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/gallium/state_trackers/glx/xlib/xm_api.c b/src/gallium/state_trackers/glx/xlib/xm_api.c index 2fc400b3fc..894ed548ee 100644 --- a/src/gallium/state_trackers/glx/xlib/xm_api.c +++ b/src/gallium/state_trackers/glx/xlib/xm_api.c @@ -72,10 +72,35 @@ static struct xm_driver driver; static struct st_api *stapi; +/* Default strict invalidate to false. This means we will not call + * XGetGeometry after every swapbuffers, which allows swapbuffers to + * remain asynchronous. For apps running at 100fps with synchronous + * swapping, a 10% boost is typical. For gears, I see closer to 20% + * speedup. + * + * Note that the work of copying data on swapbuffers doesn't disappear + * - this change just allows the X server to execute the PutImage + * asynchronously without us effectively blocked until its completion. + * + * This speeds up even llvmpipe's threaded rasterization as the + * swapbuffers operation was a large part of the serial component of + * an llvmpipe frame. + * + * The downside of this is correctness - applications which don't call + * glViewport on window resizes will get incorrect rendering. A + * better solution would be to have per-frame but asynchronous + * invalidation. Xcb almost looks as if it could provide this, but + * the API doesn't seem to quite be there. + */ +boolean xmesa_strict_invalidate = FALSE; + void xmesa_set_driver( const struct xm_driver *templ ) { driver = *templ; stapi = driver.create_st_api(); + + xmesa_strict_invalidate = + debug_get_bool_option("XMESA_STRICT_INVALIDATE", FALSE); } @@ -91,7 +116,12 @@ static int xmesa_get_param(struct st_manager *smapi, enum st_manager_param param) { - return 0; + switch(param) { + case ST_MANAGER_BROKEN_INVALIDATE: + return !xmesa_strict_invalidate; + default: + return 0; + } } static XMesaDisplay diff --git a/src/gallium/state_trackers/glx/xlib/xm_api.h b/src/gallium/state_trackers/glx/xlib/xm_api.h index 4f2c8a6e6a..934c749450 100644 --- a/src/gallium/state_trackers/glx/xlib/xm_api.h +++ b/src/gallium/state_trackers/glx/xlib/xm_api.h @@ -378,6 +378,6 @@ xmesa_buffer_height(XMesaBuffer b) return b->height; } - +extern boolean xmesa_strict_invalidate; #endif diff --git a/src/gallium/state_trackers/glx/xlib/xm_st.c b/src/gallium/state_trackers/glx/xlib/xm_st.c index 9cd744c3a6..873d5b6603 100644 --- a/src/gallium/state_trackers/glx/xlib/xm_st.c +++ b/src/gallium/state_trackers/glx/xlib/xm_st.c @@ -211,6 +211,12 @@ xmesa_st_framebuffer_validate(struct st_framebuffer_iface *stfbi, /* record newly allocated textures */ new_mask = statt_mask & ~xstfb->texture_mask; + /* If xmesa_strict_invalidate is not set, we will not yet have + * called XGetGeometry(). Do so here: + */ + if (!xmesa_strict_invalidate) + xmesa_check_buffer_size(xstfb->buffer); + resized = (xstfb->buffer->width != xstfb->texture_width || xstfb->buffer->height != xstfb->texture_height); @@ -252,7 +258,8 @@ xmesa_st_framebuffer_flush_front(struct st_framebuffer_iface *stfbi, boolean ret; ret = xmesa_st_framebuffer_display(stfbi, statt); - if (ret) + + if (ret && xmesa_strict_invalidate) xmesa_check_buffer_size(xstfb->buffer); return ret; @@ -327,7 +334,8 @@ xmesa_swap_st_framebuffer(struct st_framebuffer_iface *stfbi) *back = tmp; } - xmesa_check_buffer_size(xstfb->buffer); + if (xmesa_strict_invalidate) + xmesa_check_buffer_size(xstfb->buffer); } } -- cgit v1.2.3 From ed99c28d12579bb8ee79eb9cfa55452785be7b6e Mon Sep 17 00:00:00 2001 From: Jerome Glisse Date: Sun, 22 Aug 2010 14:22:00 -0400 Subject: r600g: depth buffer likely needs decompression when used as texture Before using depth buffer as texture, it needs to be decompressed (tile pattern of db are different from one used for colorbuffer like texture) Signed-off-by: Jerome Glisse --- src/gallium/drivers/r600/r600_blit.c | 665 ++++++++++++++++++++++++++++++- src/gallium/drivers/r600/r600_context.h | 2 +- src/gallium/drivers/r600/r600_draw.c | 2 +- src/gallium/drivers/r600/r600_resource.h | 8 + src/gallium/drivers/r600/r600_screen.h | 9 +- src/gallium/drivers/r600/r600_shader.c | 1 + src/gallium/drivers/r600/r600_state.c | 38 +- src/gallium/drivers/r600/r600_texture.c | 228 +++++++++++ 8 files changed, 919 insertions(+), 34 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/r600_blit.c b/src/gallium/drivers/r600/r600_blit.c index dc57b333a0..8cb2795d2b 100644 --- a/src/gallium/drivers/r600/r600_blit.c +++ b/src/gallium/drivers/r600/r600_blit.c @@ -24,6 +24,7 @@ * Jerome Glisse * Marek Olšák */ +#include #include #include #include @@ -31,6 +32,7 @@ #include "util/u_surface.h" #include "r600_screen.h" #include "r600_context.h" +#include "r600d.h" static void r600_blitter_save_states(struct pipe_context *ctx) { @@ -130,28 +132,8 @@ static void r600_resource_copy_region(struct pipe_context *ctx, unsigned srcx, unsigned srcy, unsigned srcz, unsigned width, unsigned height) { - struct r600_context *rctx = r600_context(ctx); - struct pipe_framebuffer_state *fb = &rctx->framebuffer->state.framebuffer; - struct pipe_sampler_state *samplers[PIPE_MAX_ATTRIBS]; - struct pipe_sampler_view_state *sampler_views[PIPE_MAX_ATTRIBS]; - unsigned i; - - for (i = 0; i < rctx->ps_nsampler_view; i++) { - sampler_views[i] = &rctx->ps_sampler_view[i]->state.sampler_view; - } - for (i = 0; i < rctx->ps_nsampler; i++) { - samplers[i] = &rctx->ps_sampler[i]->state.sampler; - } - r600_blitter_save_states(ctx); - util_blitter_save_framebuffer(rctx->blitter, fb); - util_blitter_save_fragment_sampler_states(rctx->blitter, rctx->ps_nsampler, samplers); - util_blitter_save_fragment_sampler_views(rctx->blitter, rctx->ps_nsampler_view, sampler_views); - - util_blitter_copy_region(rctx->blitter, dst, subdst, dstx, dsty, dstz, - src, subsrc, srcx, srcy, srcz, width, height, - TRUE); - /* resume queries */ - r600_queries_resume(ctx); + util_resource_copy_region(pipe, dst, subdst, dstx, dsty, dstz, + src, subsrc, srcx, srcy, srcz, width, height); } void r600_init_blit_functions(struct r600_context *rctx) @@ -161,3 +143,642 @@ void r600_init_blit_functions(struct r600_context *rctx) rctx->context.clear_depth_stencil = r600_clear_depth_stencil; rctx->context.resource_copy_region = r600_resource_copy_region; } + + +struct r600_blit_states { + struct radeon_state *rasterizer; + struct radeon_state *dsa; + struct radeon_state *blend; + struct radeon_state *viewport; + struct radeon_state *cb_cntl; + struct radeon_state *config; + struct radeon_state *vgt; + struct radeon_state *draw; + struct radeon_state *vs_constant0; + struct radeon_state *vs_constant1; + struct radeon_state *vs_constant2; + struct radeon_state *vs_constant3; + struct radeon_state *ps_shader; + struct radeon_state *vs_shader; + struct radeon_state *vs_resource0; + struct radeon_state *vs_resource1; +}; + +static int r600_blit_state_vs_resources(struct r600_screen *rscreen, struct r600_blit_states *bstates) +{ + struct radeon_state *rstate; + struct radeon_bo *bo; + u32 vbo[] = { + 0xBF800000, 0xBF800000, 0x3F800000, 0x3F800000, + 0x3F000000, 0x3F000000, 0x3F000000, 0x00000000, + 0x3F800000, 0xBF800000, 0x3F800000, 0x3F800000, + 0x3F000000, 0x3F000000, 0x3F000000, 0x00000000, + 0x3F800000, 0x3F800000, 0x3F800000, 0x3F800000, + 0x3F000000, 0x3F000000, 0x3F000000, 0x00000000, + 0xBF800000, 0x3F800000, 0x3F800000, 0x3F800000, + 0x3F000000, 0x3F000000, 0x3F000000, 0x00000000 + }; + + /* simple shader */ + bo = radeon_bo(rscreen->rw, 0, 128, 4096, NULL); + if (bo == NULL) { + return -ENOMEM; + } + if (radeon_bo_map(rscreen->rw, bo)) { + radeon_bo_decref(rscreen->rw, bo); + return -ENOMEM; + } + memcpy(bo->data, vbo, 128); + radeon_bo_unmap(rscreen->rw, bo); + + rstate = radeon_state(rscreen->rw, R600_VS_RESOURCE_TYPE, R600_VS_RESOURCE + 0); + if (rstate == NULL) { + radeon_bo_decref(rscreen->rw, bo); + return -ENOMEM; + } + + /* set states (most default value are 0 and struct already + * initialized to 0, thus avoid resetting them) + */ + rstate->states[R600_VS_RESOURCE__RESOURCE160_WORD0] = 0x00000000; + rstate->states[R600_VS_RESOURCE__RESOURCE160_WORD1] = 0x00000080; + rstate->states[R600_VS_RESOURCE__RESOURCE160_WORD2] = 0x02302000; + rstate->states[R600_VS_RESOURCE__RESOURCE160_WORD3] = 0x00000000; + rstate->states[R600_VS_RESOURCE__RESOURCE160_WORD4] = 0x00000000; + rstate->states[R600_VS_RESOURCE__RESOURCE160_WORD5] = 0x00000000; + rstate->states[R600_VS_RESOURCE__RESOURCE160_WORD6] = 0xC0000000; + rstate->bo[0] = bo; + rstate->nbo = 1; + rstate->placement[0] = RADEON_GEM_DOMAIN_GTT; + if (radeon_state_pm4(rstate)) { + radeon_state_decref(rstate); + return -ENOMEM; + } + bstates->vs_resource0 = rstate; + + rstate = radeon_state(rscreen->rw, R600_VS_RESOURCE_TYPE, R600_VS_RESOURCE + 1); + if (rstate == NULL) { + return -ENOMEM; + } + rstate->states[R600_VS_RESOURCE__RESOURCE160_WORD0] = 0x00000010; + rstate->states[R600_VS_RESOURCE__RESOURCE160_WORD1] = 0x00000070; + rstate->states[R600_VS_RESOURCE__RESOURCE160_WORD2] = 0x02302000; + rstate->states[R600_VS_RESOURCE__RESOURCE160_WORD3] = 0x00000000; + rstate->states[R600_VS_RESOURCE__RESOURCE160_WORD4] = 0x00000000; + rstate->states[R600_VS_RESOURCE__RESOURCE160_WORD5] = 0x00000000; + rstate->states[R600_VS_RESOURCE__RESOURCE160_WORD6] = 0xC0000000; + rstate->bo[0] = radeon_bo_incref(rscreen->rw, bo); + rstate->nbo = 1; + rstate->placement[0] = RADEON_GEM_DOMAIN_GTT; + if (radeon_state_pm4(rstate)) { + radeon_state_decref(rstate); + return -ENOMEM; + } + bstates->vs_resource1 = rstate; + + return 0; +} + +static struct radeon_state *r600_blit_state_vs_shader(struct r600_screen *rscreen) +{ + struct radeon_state *rstate; + struct radeon_bo *bo; + u32 shader_bc[] = { + 0x00000004, 0x81000400, + 0x00000008, 0xA01C0000, + 0xC001A03C, 0x94000688, + 0xC0024000, 0x94200688, + 0x7C000000, 0x002D1001, + 0x00080000, 0x00000000, + 0x7C000100, 0x002D1002, + 0x00080000, 0x00000000, + 0x00000001, 0x00601910, + 0x00000401, 0x20601910, + 0x00000801, 0x40601910, + 0x80000C01, 0x60601910, + 0x00000002, 0x00801910, + 0x00000402, 0x20801910, + 0x00000802, 0x40801910, + 0x80000C02, 0x60801910 + }; + + /* simple shader */ + bo = radeon_bo(rscreen->rw, 0, 128, 4096, NULL); + if (bo == NULL) { + return NULL; + } + if (radeon_bo_map(rscreen->rw, bo)) { + radeon_bo_decref(rscreen->rw, bo); + return NULL; + } + memcpy(bo->data, shader_bc, 128); + radeon_bo_unmap(rscreen->rw, bo); + + rstate = radeon_state(rscreen->rw, R600_VS_SHADER_TYPE, R600_VS_SHADER); + if (rstate == NULL) { + radeon_bo_decref(rscreen->rw, bo); + return NULL; + } + + /* set states (most default value are 0 and struct already + * initialized to 0, thus avoid resetting them) + */ + rstate->states[R600_VS_SHADER__SPI_VS_OUT_ID_0] = 0x03020100; + rstate->states[R600_VS_SHADER__SPI_VS_OUT_ID_1] = 0x07060504; + rstate->states[R600_VS_SHADER__SQ_PGM_RESOURCES_VS] = 0x00000005; + + rstate->bo[0] = bo; + rstate->bo[1] = radeon_bo_incref(rscreen->rw, bo); + rstate->nbo = 2; + rstate->placement[0] = RADEON_GEM_DOMAIN_GTT; + rstate->placement[2] = RADEON_GEM_DOMAIN_GTT; + + if (radeon_state_pm4(rstate)) { + radeon_state_decref(rstate); + return NULL; + } + return rstate; +} + +static struct radeon_state *r600_blit_state_ps_shader(struct r600_screen *rscreen) +{ + struct radeon_state *rstate; + struct radeon_bo *bo; + u32 shader_bc[] = { + 0x00000002, 0xA00C0000, + 0xC0008000, 0x94200688, + 0x00000000, 0x00201910, + 0x00000400, 0x20201910, + 0x00000800, 0x40201910, + 0x80000C00, 0x60201910 + }; + + /* simple shader */ + bo = radeon_bo(rscreen->rw, 0, 128, 4096, NULL); + if (bo == NULL) { + radeon_bo_decref(rscreen->rw, bo); + return NULL; + } + if (radeon_bo_map(rscreen->rw, bo)) { + return NULL; + } + memcpy(bo->data, shader_bc, 48); + radeon_bo_unmap(rscreen->rw, bo); + + rstate = radeon_state(rscreen->rw, R600_PS_SHADER_TYPE, R600_PS_SHADER); + if (rstate == NULL) { + radeon_bo_decref(rscreen->rw, bo); + return NULL; + } + + /* set states (most default value are 0 and struct already + * initialized to 0, thus avoid resetting them) + */ + rstate->states[R600_PS_SHADER__SPI_PS_INPUT_CNTL_0] = 0x00000C00; + rstate->states[R600_PS_SHADER__SPI_PS_IN_CONTROL_0] = 0x10000001; + rstate->states[R600_PS_SHADER__SQ_PGM_EXPORTS_PS] = 0x00000002; + rstate->states[R600_PS_SHADER__SQ_PGM_RESOURCES_PS] = 0x00000002; + + rstate->bo[0] = bo; + rstate->nbo = 1; + rstate->placement[0] = RADEON_GEM_DOMAIN_GTT; + + if (radeon_state_pm4(rstate)) { + radeon_state_decref(rstate); + return NULL; + } + return rstate; +} + +static struct radeon_state *r600_blit_state_vgt(struct r600_screen *rscreen) +{ + struct radeon_state *rstate; + + rstate = radeon_state(rscreen->rw, R600_VGT_TYPE, R600_VGT); + if (rstate == NULL) + return NULL; + + /* set states (most default value are 0 and struct already + * initialized to 0, thus avoid resetting them) + */ + rstate->states[R600_VGT__VGT_DMA_NUM_INSTANCES] = 0x00000001; + rstate->states[R600_VGT__VGT_MAX_VTX_INDX] = 0x00FFFFFF; + rstate->states[R600_VGT__VGT_PRIMITIVE_TYPE] = 0x00000005; + + if (radeon_state_pm4(rstate)) { + radeon_state_decref(rstate); + return NULL; + } + return rstate; +} + +static struct radeon_state *r600_blit_state_draw(struct r600_screen *rscreen) +{ + struct radeon_state *rstate; + + rstate = radeon_state(rscreen->rw, R600_DRAW_TYPE, R600_DRAW); + if (rstate == NULL) + return NULL; + + /* set states (most default value are 0 and struct already + * initialized to 0, thus avoid resetting them) + */ + rstate->states[R600_DRAW__VGT_DRAW_INITIATOR] = 0x00000002; + rstate->states[R600_DRAW__VGT_NUM_INDICES] = 0x00000004; + + if (radeon_state_pm4(rstate)) { + radeon_state_decref(rstate); + return NULL; + } + return rstate; +} + +static struct radeon_state *r600_blit_state_vs_constant(struct r600_screen *rscreen, + unsigned id, float c0, float c1, + float c2, float c3) +{ + struct radeon_state *rstate; + + rstate = radeon_state(rscreen->rw, R600_VS_CONSTANT_TYPE, R600_VS_CONSTANT + id); + if (rstate == NULL) + return NULL; + + /* set states (most default value are 0 and struct already + * initialized to 0, thus avoid resetting them) + */ + rstate->states[R600_VS_CONSTANT__SQ_ALU_CONSTANT0_256] = fui(c0); + rstate->states[R600_VS_CONSTANT__SQ_ALU_CONSTANT1_256] = fui(c1); + rstate->states[R600_VS_CONSTANT__SQ_ALU_CONSTANT2_256] = fui(c2); + rstate->states[R600_VS_CONSTANT__SQ_ALU_CONSTANT3_256] = fui(c3); + + if (radeon_state_pm4(rstate)) { + radeon_state_decref(rstate); + return NULL; + } + return rstate; +} + +static struct radeon_state *r600_blit_state_rasterizer(struct r600_screen *rscreen) +{ + struct radeon_state *rstate; + + rstate = radeon_state(rscreen->rw, R600_RASTERIZER_TYPE, R600_RASTERIZER); + if (rstate == NULL) + return NULL; + + /* set states (most default value are 0 and struct already + * initialized to 0, thus avoid resetting them) + */ + rstate->states[R600_RASTERIZER__PA_CL_GB_HORZ_CLIP_ADJ] = 0x3F800000; + rstate->states[R600_RASTERIZER__PA_CL_GB_HORZ_DISC_ADJ] = 0x3F800000; + rstate->states[R600_RASTERIZER__PA_CL_GB_VERT_CLIP_ADJ] = 0x3F800000; + rstate->states[R600_RASTERIZER__PA_CL_GB_VERT_DISC_ADJ] = 0x3F800000; + rstate->states[R600_RASTERIZER__PA_SC_LINE_CNTL] = 0x00000400; + rstate->states[R600_RASTERIZER__PA_SC_LINE_STIPPLE] = 0x00000005; + rstate->states[R600_RASTERIZER__PA_SU_LINE_CNTL] = 0x00000008; + rstate->states[R600_RASTERIZER__PA_SU_POINT_MINMAX] = 0x80000000; + rstate->states[R600_RASTERIZER__PA_SU_SC_MODE_CNTL] = 0x00080004; + rstate->states[R600_RASTERIZER__SPI_INTERP_CONTROL_0] = 0x00000001; + + if (radeon_state_pm4(rstate)) { + radeon_state_decref(rstate); + return NULL; + } + return rstate; +} + +static struct radeon_state *r600_blit_state_dsa(struct r600_screen *rscreen) +{ + struct radeon_state *rstate; + + rstate = radeon_state(rscreen->rw, R600_DSA_TYPE, R600_DSA); + if (rstate == NULL) + return NULL; + + /* set states (most default value are 0 and struct already + * initialized to 0, thus avoid resetting them) + */ + rstate->states[R600_DSA__DB_ALPHA_TO_MASK] = 0x0000AA00; + rstate->states[R600_DSA__DB_DEPTH_CLEAR] = 0x3F800000; + rstate->states[R600_DSA__DB_RENDER_CONTROL] = 0x00000060; + rstate->states[R600_DSA__DB_RENDER_OVERRIDE] = 0x0000002A; + rstate->states[R600_DSA__DB_SHADER_CONTROL] = 0x00000210; + + if (radeon_state_pm4(rstate)) { + radeon_state_decref(rstate); + return NULL; + } + return rstate; +} + +static struct radeon_state *r600_blit_state_blend(struct r600_screen *rscreen) +{ + struct radeon_state *rstate; + + rstate = radeon_state(rscreen->rw, R600_BLEND_TYPE, R600_BLEND); + if (rstate == NULL) + return NULL; + + /* set states (most default value are 0 and struct already + * initialized to 0, thus avoid resetting them) + */ + + if (radeon_state_pm4(rstate)) { + radeon_state_decref(rstate); + return NULL; + } + return rstate; +} + +static struct radeon_state *r600_blit_state_viewport(struct r600_screen *rscreen) +{ + struct radeon_state *rstate; + + rstate = radeon_state(rscreen->rw, R600_VIEWPORT_TYPE, R600_VIEWPORT); + if (rstate == NULL) + return NULL; + + /* set states (most default value are 0 and struct already + * initialized to 0, thus avoid resetting them) + */ + rstate->states[R600_VIEWPORT__PA_CL_VPORT_XOFFSET_0] = 0x42FA0000; + rstate->states[R600_VIEWPORT__PA_CL_VPORT_XSCALE_0] = 0x42FA0000; + rstate->states[R600_VIEWPORT__PA_CL_VPORT_YOFFSET_0] = 0x42FA0000; + rstate->states[R600_VIEWPORT__PA_CL_VPORT_YSCALE_0] = 0xC2FA0000; + rstate->states[R600_VIEWPORT__PA_CL_VPORT_ZOFFSET_0] = 0x3F000000; + rstate->states[R600_VIEWPORT__PA_CL_VPORT_ZSCALE_0] = 0x3F000000; + rstate->states[R600_VIEWPORT__PA_CL_VTE_CNTL] = 0x0000043F; + rstate->states[R600_VIEWPORT__PA_SC_VPORT_ZMAX_0] = 0x3F800000; + + if (radeon_state_pm4(rstate)) { + radeon_state_decref(rstate); + return NULL; + } + return rstate; +} + +static struct radeon_state *r600_blit_state_cb_cntl(struct r600_screen *rscreen) +{ + struct radeon_state *rstate; + + rstate = radeon_state(rscreen->rw, R600_CB_CNTL_TYPE, R600_CB_CNTL); + if (rstate == NULL) + return NULL; + + /* set states (most default value are 0 and struct already + * initialized to 0, thus avoid resetting them) + */ + rstate->states[R600_CB_CNTL__CB_CLRCMP_CONTROL] = 0x01000000; + rstate->states[R600_CB_CNTL__CB_CLRCMP_DST] = 0x000000FF; + rstate->states[R600_CB_CNTL__CB_CLRCMP_MSK] = 0xFFFFFFFF; + rstate->states[R600_CB_CNTL__CB_COLOR_CONTROL] = 0x00CC0080; + rstate->states[R600_CB_CNTL__CB_SHADER_MASK] = 0x0000000F; + rstate->states[R600_CB_CNTL__CB_TARGET_MASK] = 0x0000000F; + rstate->states[R600_CB_CNTL__PA_SC_AA_MASK] = 0xFFFFFFFF; + + if (radeon_state_pm4(rstate)) { + radeon_state_decref(rstate); + return NULL; + } + return rstate; +} + +static int r600_blit_states_init(struct pipe_context *ctx, struct r600_blit_states *bstates) +{ + struct r600_screen *rscreen = r600_screen(ctx->screen); + struct r600_context *rctx = r600_context(ctx); + int r; + + bstates->ps_shader = r600_blit_state_ps_shader(rscreen); + if (bstates->ps_shader == NULL) { + R600_ERR("failed creating ps_shader state\n"); + return -ENOMEM; + } + bstates->vs_shader = r600_blit_state_vs_shader(rscreen); + if (bstates->vs_shader == NULL) { + R600_ERR("failed creating vs_shader state\n"); + return -ENOMEM; + } + bstates->vgt = r600_blit_state_vgt(rscreen); + if (bstates->vgt == NULL) { + R600_ERR("failed creating vgt state\n"); + return -ENOMEM; + } + bstates->draw = r600_blit_state_draw(rscreen); + if (bstates->draw == NULL) { + R600_ERR("failed creating draw state\n"); + return -ENOMEM; + } + bstates->vs_constant0 = r600_blit_state_vs_constant(rscreen, 0, 1.0, 0.0, 0.0, 0.0); + if (bstates->vs_constant0 == NULL) { + R600_ERR("failed creating vs_constant0 state\n"); + return -ENOMEM; + } + bstates->vs_constant1 = r600_blit_state_vs_constant(rscreen, 1, 0.0, 1.0, 0.0, 0.0); + if (bstates->vs_constant1 == NULL) { + R600_ERR("failed creating vs_constant1 state\n"); + return -ENOMEM; + } + bstates->vs_constant2 = r600_blit_state_vs_constant(rscreen, 2, 0.0, 0.0, -0.00199900055, 0.0); + if (bstates->vs_constant2 == NULL) { + R600_ERR("failed creating vs_constant2 state\n"); + return -ENOMEM; + } + bstates->vs_constant3 = r600_blit_state_vs_constant(rscreen, 3, 0.0, 0.0, -0.99900049, 1.0); + if (bstates->vs_constant3 == NULL) { + R600_ERR("failed creating vs_constant3 state\n"); + return -ENOMEM; + } + bstates->rasterizer = r600_blit_state_rasterizer(rscreen); + if (bstates->rasterizer == NULL) { + R600_ERR("failed creating rasterizer state\n"); + return -ENOMEM; + } + bstates->dsa = r600_blit_state_dsa(rscreen); + if (bstates->dsa == NULL) { + R600_ERR("failed creating dsa state\n"); + return -ENOMEM; + } + bstates->blend = r600_blit_state_blend(rscreen); + if (bstates->blend == NULL) { + R600_ERR("failed creating blend state\n"); + return -ENOMEM; + } + bstates->viewport = r600_blit_state_viewport(rscreen); + if (bstates->viewport == NULL) { + R600_ERR("failed creating viewport state\n"); + return -ENOMEM; + } + bstates->cb_cntl = r600_blit_state_cb_cntl(rscreen); + if (bstates->cb_cntl == NULL) { + R600_ERR("failed creating cb_cntl state\n"); + return -ENOMEM; + } + r = r600_blit_state_vs_resources(rscreen, bstates); + if (r) { + R600_ERR("failed creating vs_resource state\n"); + return r; + } + bstates->config = radeon_state_incref(rctx->hw_states.config); + return 0; +} + +static void r600_blit_states_destroy(struct pipe_context *ctx, struct r600_blit_states *bstates) +{ + radeon_state_decref(bstates->rasterizer); + radeon_state_decref(bstates->dsa); + radeon_state_decref(bstates->blend); + radeon_state_decref(bstates->viewport); + radeon_state_decref(bstates->cb_cntl); + radeon_state_decref(bstates->config); + radeon_state_decref(bstates->vgt); + radeon_state_decref(bstates->draw); + radeon_state_decref(bstates->vs_constant0); + radeon_state_decref(bstates->vs_constant1); + radeon_state_decref(bstates->vs_constant2); + radeon_state_decref(bstates->vs_constant3); + radeon_state_decref(bstates->ps_shader); + radeon_state_decref(bstates->vs_shader); + radeon_state_decref(bstates->vs_resource0); + radeon_state_decref(bstates->vs_resource1); +} + +int r600_blit_uncompress_depth(struct pipe_context *ctx, struct r600_resource_texture *rtexture, unsigned level) +{ + struct r600_screen *rscreen = r600_screen(ctx->screen); + struct r600_context *rctx = r600_context(ctx); + struct radeon_draw *draw = NULL; + struct r600_blit_states bstates; + int r; + + r = r600_texture_scissor(ctx, rtexture, level); + if (r) { + return r; + } + r = r600_texture_cb0(ctx, rtexture, level); + if (r) { + return r; + } + r = r600_texture_db(ctx, rtexture, level); + if (r) { + return r; + } + + r = r600_blit_states_init(ctx, &bstates); + if (r) { + return r; + } + bstates.dsa->states[R600_DSA__DB_RENDER_CONTROL] = 0x000000EC; + bstates.cb_cntl->states[R600_CB_CNTL__CB_TARGET_MASK] = 0x00000001; + /* force rebuild */ + bstates.dsa->cpm4 = bstates.cb_cntl->cpm4 = 0; + if (radeon_state_pm4(bstates.dsa)) { + goto out; + } + if (radeon_state_pm4(bstates.cb_cntl)) { + goto out; + } + + draw = radeon_draw(rscreen->rw); + if (draw == NULL) { + R600_ERR("failed creating draw for uncompressing textures\n"); + goto out; + } + + r = radeon_draw_set(draw, bstates.vs_shader); + if (r) { + goto out; + } + r = radeon_draw_set(draw, bstates.ps_shader); + if (r) { + goto out; + } + r = radeon_draw_set(draw, bstates.rasterizer); + if (r) { + goto out; + } + r = radeon_draw_set(draw, bstates.dsa); + if (r) { + goto out; + } + r = radeon_draw_set(draw, bstates.blend); + if (r) { + goto out; + } + r = radeon_draw_set(draw, bstates.viewport); + if (r) { + goto out; + } + r = radeon_draw_set(draw, bstates.cb_cntl); + if (r) { + goto out; + } + r = radeon_draw_set(draw, bstates.config); + if (r) { + goto out; + } + r = radeon_draw_set(draw, bstates.vgt); + if (r) { + goto out; + } + r = radeon_draw_set(draw, bstates.draw); + if (r) { + goto out; + } + r = radeon_draw_set(draw, bstates.vs_resource0); + if (r) { + goto out; + } + r = radeon_draw_set(draw, bstates.vs_resource1); + if (r) { + goto out; + } + r = radeon_draw_set(draw, bstates.vs_constant0); + if (r) { + goto out; + } + r = radeon_draw_set(draw, bstates.vs_constant1); + if (r) { + goto out; + } + r = radeon_draw_set(draw, bstates.vs_constant2); + if (r) { + goto out; + } + r = radeon_draw_set(draw, bstates.vs_constant3); + if (r) { + goto out; + } + r = radeon_draw_set(draw, rtexture->scissor[level]); + if (r) { + goto out; + } + r = radeon_draw_set(draw, rtexture->cb0[level]); + if (r) { + goto out; + } + r = radeon_draw_set(draw, rtexture->db[level]); + if (r) { + goto out; + } + + /* suspend queries */ + r600_queries_suspend(ctx); + + /* schedule draw*/ + r = radeon_ctx_set_draw_new(rctx->ctx, draw); + if (r == -EBUSY) { + r600_flush(ctx, 0, NULL); + r = radeon_ctx_set_draw_new(rctx->ctx, draw); + } + if (r) { + goto out; + } + + /* resume queries */ + r600_queries_resume(ctx); + +out: + r600_blit_states_destroy(ctx, &bstates); + return r; +} diff --git a/src/gallium/drivers/r600/r600_context.h b/src/gallium/drivers/r600/r600_context.h index 900aa9fd0c..d96d5b513f 100644 --- a/src/gallium/drivers/r600/r600_context.h +++ b/src/gallium/drivers/r600/r600_context.h @@ -186,7 +186,7 @@ struct r600_context_state *r600_context_state_decref(struct r600_context_state * void r600_flush(struct pipe_context *ctx, unsigned flags, struct pipe_fence_handle **fence); -int r600_context_hw_states(struct r600_context *rctx); +int r600_context_hw_states(struct pipe_context *ctx); void r600_draw_vbo(struct pipe_context *ctx, const struct pipe_draw_info *info); diff --git a/src/gallium/drivers/r600/r600_draw.c b/src/gallium/drivers/r600/r600_draw.c index f058455162..1eb868c4c7 100644 --- a/src/gallium/drivers/r600/r600_draw.c +++ b/src/gallium/drivers/r600/r600_draw.c @@ -58,7 +58,7 @@ static int r600_draw_common(struct r600_draw *draw) struct pipe_vertex_buffer *vertex_buffer; int r; - r = r600_context_hw_states(rctx); + r = r600_context_hw_states(draw->ctx); if (r) return r; switch (draw->index_size) { diff --git a/src/gallium/drivers/r600/r600_resource.h b/src/gallium/drivers/r600/r600_resource.h index 5ebda027e9..5b3a7027a7 100644 --- a/src/gallium/drivers/r600/r600_resource.h +++ b/src/gallium/drivers/r600/r600_resource.h @@ -44,6 +44,8 @@ struct r600_resource_texture { struct r600_resource resource; unsigned long offset[PIPE_MAX_TEXTURE_LEVELS]; unsigned long pitch[PIPE_MAX_TEXTURE_LEVELS]; + unsigned long width[PIPE_MAX_TEXTURE_LEVELS]; + unsigned long height[PIPE_MAX_TEXTURE_LEVELS]; unsigned long layer_size[PIPE_MAX_TEXTURE_LEVELS]; unsigned long pitch_override; unsigned long bpt; @@ -51,6 +53,12 @@ struct r600_resource_texture { unsigned tilled; unsigned array_mode; unsigned tile_type; + unsigned depth; + unsigned dirty; + struct radeon_bo *uncompressed; + struct radeon_state *scissor[PIPE_MAX_TEXTURE_LEVELS]; + struct radeon_state *cb0[PIPE_MAX_TEXTURE_LEVELS]; + struct radeon_state *db[PIPE_MAX_TEXTURE_LEVELS]; }; void r600_init_context_resource_functions(struct r600_context *r600); diff --git a/src/gallium/drivers/r600/r600_screen.h b/src/gallium/drivers/r600/r600_screen.h index 147be3c4ac..4b2aac73ac 100644 --- a/src/gallium/drivers/r600/r600_screen.h +++ b/src/gallium/drivers/r600/r600_screen.h @@ -30,6 +30,7 @@ #include #include "radeon.h" #include "util/u_transfer.h" +#include "r600_resource.h" /* Texture transfer. */ struct r600_transfer { @@ -63,7 +64,7 @@ unsigned r600_buffer_is_referenced_by_cs(struct pipe_context *context, struct pipe_resource *r600_buffer_from_handle(struct pipe_screen *screen, struct winsys_handle *whandle); -/* Texture transfer functions. */ +/* r600_texture.c texture transfer functions. */ struct pipe_transfer* r600_texture_get_transfer(struct pipe_context *ctx, struct pipe_resource *texture, struct pipe_subresource sr, @@ -75,7 +76,13 @@ void* r600_texture_transfer_map(struct pipe_context *ctx, struct pipe_transfer* transfer); void r600_texture_transfer_unmap(struct pipe_context *ctx, struct pipe_transfer* transfer); +int r600_texture_scissor(struct pipe_context *ctx, struct r600_resource_texture *rtexture, unsigned level); +int r600_texture_cb0(struct pipe_context *ctx, struct r600_resource_texture *rtexture, unsigned level); +int r600_texture_db(struct pipe_context *ctx, struct r600_resource_texture *rtexture, unsigned level); +int r600_texture_from_depth(struct pipe_context *ctx, struct r600_resource_texture *rtexture, unsigned level); +/* r600_blit.c */ +int r600_blit_uncompress_depth(struct pipe_context *ctx, struct r600_resource_texture *rtexture, unsigned level); /* helpers */ int r600_conv_pipe_format(unsigned pformat, unsigned *format); diff --git a/src/gallium/drivers/r600/r600_shader.c b/src/gallium/drivers/r600/r600_shader.c index 79fc04a9fe..5cdbe2bfe8 100644 --- a/src/gallium/drivers/r600/r600_shader.c +++ b/src/gallium/drivers/r600/r600_shader.c @@ -150,6 +150,7 @@ static int r600_pipe_shader_vs(struct pipe_context *ctx, struct r600_context_sta rpshader->rstate->bo[1] = radeon_bo_incref(rscreen->rw, rpshader->bo); rpshader->rstate->nbo = 2; rpshader->rstate->placement[0] = RADEON_GEM_DOMAIN_GTT; + rpshader->rstate->placement[2] = RADEON_GEM_DOMAIN_GTT; return radeon_state_pm4(state); } diff --git a/src/gallium/drivers/r600/r600_state.c b/src/gallium/drivers/r600/r600_state.c index e9b03f571a..58df32818e 100644 --- a/src/gallium/drivers/r600/r600_state.c +++ b/src/gallium/drivers/r600/r600_state.c @@ -776,7 +776,9 @@ static struct radeon_state *r600_db(struct r600_context *rctx) rtex->tilled = 1; rtex->array_mode = 2; rtex->tile_type = 1; + rtex->depth = 1; rbuffer = &rtex->resource; +R600_ERR("DB handle %d %p %d\n", rbuffer->bo->handle, rtex, state->zsbuf->texture->format); rstate->bo[0] = radeon_bo_incref(rscreen->rw, rbuffer->bo); rstate->nbo = 1; rstate->placement[0] = RADEON_GEM_DOMAIN_VRAM; @@ -785,7 +787,7 @@ static struct radeon_state *r600_db(struct r600_context *rctx) slice = (rtex->pitch[level] / rtex->bpt) * state->zsbuf->height / 64 - 1; format = r600_translate_dbformat(state->zsbuf->texture->format); rstate->states[R600_DB__DB_DEPTH_BASE] = rtex->offset[level] >> 8; - rstate->states[R600_DB__DB_DEPTH_INFO] = 0x00010000 | + rstate->states[R600_DB__DB_DEPTH_INFO] = S_028010_ARRAY_MODE(rtex->array_mode) | S_028010_FORMAT(format); rstate->states[R600_DB__DB_DEPTH_VIEW] = 0x00000000; rstate->states[R600_DB__DB_PREFETCH_LIMIT] = (state->zsbuf->height / 8) -1; @@ -1214,10 +1216,11 @@ static inline unsigned r600_tex_dim(unsigned dim) } } -static struct radeon_state *r600_resource(struct r600_context *rctx, +static struct radeon_state *r600_resource(struct pipe_context *ctx, const struct pipe_sampler_view *view, unsigned id) { + struct r600_context *rctx = r600_context(ctx); struct r600_screen *rscreen = rctx->screen; const struct util_format_description *desc; struct r600_resource_texture *tmp; @@ -1225,7 +1228,8 @@ static struct radeon_state *r600_resource(struct r600_context *rctx, struct radeon_state *rstate; unsigned format; uint32_t word4 = 0, yuv_format = 0, pitch = 0; - unsigned char swizzle[4]; + unsigned char swizzle[4], array_mode = 0, tile_type = 0; + int r; swizzle[0] = view->swizzle_r; swizzle[1] = view->swizzle_g; @@ -1247,8 +1251,23 @@ static struct radeon_state *r600_resource(struct r600_context *rctx, } tmp = (struct r600_resource_texture*)view->texture; rbuffer = &tmp->resource; - rstate->bo[0] = radeon_bo_incref(rscreen->rw, rbuffer->bo); - rstate->bo[1] = radeon_bo_incref(rscreen->rw, rbuffer->bo); + if (tmp->depth) { + r = r600_texture_from_depth(ctx, tmp, view->first_level); + if (r) { + return NULL; + } +format = r600_translate_colorformat(view->texture->format); +R600_ERR("DEPTH TEXTURE %d rtex %p %d 0x%02X\n", tmp->uncompressed->handle, tmp, view->texture->format, format); +format = 17; + rstate->bo[0] = radeon_bo_incref(rscreen->rw, tmp->uncompressed); + rstate->bo[1] = radeon_bo_incref(rscreen->rw, tmp->uncompressed); +// array_mode = tmp->array_mode; +// tile_type = tmp->tile_type; + } else { +R600_ERR("NOT DEPTH TEXTURE\n"); + rstate->bo[0] = radeon_bo_incref(rscreen->rw, rbuffer->bo); + rstate->bo[1] = radeon_bo_incref(rscreen->rw, rbuffer->bo); + } rstate->nbo = 2; rstate->placement[0] = RADEON_GEM_DOMAIN_GTT; rstate->placement[1] = RADEON_GEM_DOMAIN_GTT; @@ -1261,8 +1280,8 @@ static struct radeon_state *r600_resource(struct r600_context *rctx, /* FIXME properly handle first level != 0 */ rstate->states[R600_PS_RESOURCE__RESOURCE0_WORD0] = S_038000_DIM(r600_tex_dim(view->texture->target)) | - S_038000_TILE_MODE(tmp->array_mode) | - S_038000_TILE_TYPE(tmp->tile_type) | + S_038000_TILE_MODE(array_mode) | + S_038000_TILE_TYPE(tile_type) | S_038000_PITCH((pitch / 8) - 1) | S_038000_TEX_WIDTH(view->texture->width0 - 1); rstate->states[R600_PS_RESOURCE__RESOURCE0_WORD1] = @@ -1347,8 +1366,9 @@ static struct radeon_state *r600_cb_cntl(struct r600_context *rctx) return rstate; } -int r600_context_hw_states(struct r600_context *rctx) +int r600_context_hw_states(struct pipe_context *ctx) { + struct r600_context *rctx = r600_context(ctx); unsigned i; int r; int nr_cbufs = rctx->framebuffer->state.framebuffer.nr_cbufs; @@ -1410,7 +1430,7 @@ int r600_context_hw_states(struct r600_context *rctx) rctx->hw_states.ps_nsampler = rctx->ps_nsampler; for (i = 0; i < rctx->ps_nsampler_view; i++) { if (rctx->ps_sampler_view[i]) { - rctx->hw_states.ps_resource[i] = r600_resource(rctx, + rctx->hw_states.ps_resource[i] = r600_resource(ctx, &rctx->ps_sampler_view[i]->state.sampler_view, R600_PS_RESOURCE + i); } diff --git a/src/gallium/drivers/r600/r600_texture.c b/src/gallium/drivers/r600/r600_texture.c index 92b4f430c5..c79dd34f09 100644 --- a/src/gallium/drivers/r600/r600_texture.c +++ b/src/gallium/drivers/r600/r600_texture.c @@ -24,6 +24,7 @@ * Jerome Glisse * Corbin Simpson */ +#include #include #include #include @@ -33,6 +34,7 @@ #include "r600_screen.h" #include "r600_context.h" #include "r600_resource.h" +#include "r600_state_inlines.h" #include "r600d.h" extern struct u_resource_vtbl r600_texture_vtbl; @@ -91,6 +93,8 @@ static void r600_setup_miptree(struct r600_screen *rscreen, struct r600_resource rtex->offset[i] = offset; rtex->layer_size[i] = layer_size; rtex->pitch[i] = pitch; + rtex->width[i] = w; + rtex->height[i] = h; offset += size; } rtex->size = offset; @@ -130,10 +134,19 @@ static void r600_texture_destroy(struct pipe_screen *screen, struct r600_resource_texture *rtex = (struct r600_resource_texture*)ptex; struct r600_resource *resource = &rtex->resource; struct r600_screen *rscreen = r600_screen(screen); + unsigned i; if (resource->bo) { radeon_bo_decref(rscreen->rw, resource->bo); } + if (rtex->uncompressed) { + radeon_bo_decref(rscreen->rw, rtex->uncompressed); + } + for (i = 0; i < PIPE_MAX_TEXTURE_LEVELS; i++) { + radeon_state_decref(rtex->scissor[i]); + radeon_state_decref(rtex->cb0[i]); + radeon_state_decref(rtex->db[i]); + } FREE(rtex); } @@ -595,3 +608,218 @@ out_unknown: R600_ERR("Unable to handle texformat %d %s\n", format, util_format_name(format)); return ~0; } + +int r600_texture_from_depth(struct pipe_context *ctx, struct r600_resource_texture *rtexture, unsigned level) +{ + struct r600_screen *rscreen = r600_screen(ctx->screen); + int r; + + if (!rtexture->depth) { + /* This shouldn't happen maybe print a warning */ + return 0; + } + if (rtexture->uncompressed && !rtexture->dirty) { + /* Uncompressed bo already in good state */ + return 0; + } + + /* allocate uncompressed texture */ + if (rtexture->uncompressed == NULL) { + rtexture->uncompressed = radeon_bo(rscreen->rw, 0, rtexture->size, 4096, NULL); + if (rtexture->uncompressed == NULL) { + return -ENOMEM; + } + } + + /* render a rectangle covering whole buffer to uncompress depth */ + r = r600_blit_uncompress_depth(ctx, rtexture, level); +R600_ERR("---step0 %d\n", r); + if (r) { + return r; + } + + rtexture->dirty = 0; + return 0; +} + +static struct radeon_state *r600_texture_state_scissor(struct r600_screen *rscreen, + struct r600_resource_texture *rtexture, + unsigned level) +{ + struct radeon_state *rstate; + + rstate = radeon_state(rscreen->rw, R600_SCISSOR_TYPE, R600_SCISSOR); + if (rstate == NULL) + return NULL; + + /* set states (most default value are 0 and struct already + * initialized to 0, thus avoid resetting them) + */ + rstate->states[R600_SCISSOR__PA_SC_CLIPRECT_0_BR] = S_028244_BR_X(rtexture->width[level]) | S_028244_BR_Y(rtexture->height[level]); + rstate->states[R600_SCISSOR__PA_SC_CLIPRECT_0_TL] = 0x80000000; + rstate->states[R600_SCISSOR__PA_SC_CLIPRECT_1_BR] = S_028244_BR_X(rtexture->width[level]) | S_028244_BR_Y(rtexture->height[level]); + rstate->states[R600_SCISSOR__PA_SC_CLIPRECT_1_TL] = 0x80000000; + rstate->states[R600_SCISSOR__PA_SC_CLIPRECT_2_BR] = S_028244_BR_X(rtexture->width[level]) | S_028244_BR_Y(rtexture->height[level]); + rstate->states[R600_SCISSOR__PA_SC_CLIPRECT_2_TL] = 0x80000000; + rstate->states[R600_SCISSOR__PA_SC_CLIPRECT_3_BR] = S_028244_BR_X(rtexture->width[level]) | S_028244_BR_Y(rtexture->height[level]); + rstate->states[R600_SCISSOR__PA_SC_CLIPRECT_3_TL] = 0x80000000; + rstate->states[R600_SCISSOR__PA_SC_CLIPRECT_RULE] = 0x0000FFFF; + rstate->states[R600_SCISSOR__PA_SC_EDGERULE] = 0xAAAAAAAA; + rstate->states[R600_SCISSOR__PA_SC_GENERIC_SCISSOR_BR] = S_028244_BR_X(rtexture->width[level]) | S_028244_BR_Y(rtexture->height[level]); + rstate->states[R600_SCISSOR__PA_SC_GENERIC_SCISSOR_TL] = 0x80000000; + rstate->states[R600_SCISSOR__PA_SC_SCREEN_SCISSOR_BR] = S_028244_BR_X(rtexture->width[level]) | S_028244_BR_Y(rtexture->height[level]); + rstate->states[R600_SCISSOR__PA_SC_SCREEN_SCISSOR_TL] = 0x80000000; + rstate->states[R600_SCISSOR__PA_SC_VPORT_SCISSOR_0_BR] = S_028244_BR_X(rtexture->width[level]) | S_028244_BR_Y(rtexture->height[level]); + rstate->states[R600_SCISSOR__PA_SC_VPORT_SCISSOR_0_TL] = 0x80000000; + rstate->states[R600_SCISSOR__PA_SC_WINDOW_SCISSOR_BR] = S_028244_BR_X(rtexture->width[level]) | S_028244_BR_Y(rtexture->height[level]); + rstate->states[R600_SCISSOR__PA_SC_WINDOW_SCISSOR_TL] = 0x80000000; + + if (radeon_state_pm4(rstate)) { + radeon_state_decref(rstate); + return NULL; + } + return rstate; +} + +static struct radeon_state *r600_texture_state_cb0(struct r600_screen *rscreen, + struct r600_resource_texture *rtexture, + unsigned level) +{ + struct radeon_state *rstate; + struct r600_resource *rbuffer; + unsigned pitch, slice; + unsigned color_info; + unsigned format, swap, ntype; + const struct util_format_description *desc; + + rstate = radeon_state(rscreen->rw, R600_CB0_TYPE, R600_CB0); + if (rstate == NULL) + return NULL; + rbuffer = &rtexture->resource; + + /* set states (most default value are 0 and struct already + * initialized to 0, thus avoid resetting them) + */ + pitch = (rtexture->pitch[level] / rtexture->bpt) / 8 - 1; + slice = (rtexture->pitch[level] / rtexture->bpt) * rtexture->height[level] / 64 - 1; + ntype = 0; + desc = util_format_description(rbuffer->base.b.format); + if (desc->colorspace == UTIL_FORMAT_COLORSPACE_SRGB) + ntype = V_0280A0_NUMBER_SRGB; + format = r600_translate_colorformat(rtexture->resource.base.b.format); + swap = r600_translate_colorswap(rtexture->resource.base.b.format); + color_info = S_0280A0_FORMAT(format) | + S_0280A0_COMP_SWAP(swap) | + S_0280A0_BLEND_CLAMP(1) | + S_0280A0_NUMBER_TYPE(ntype); + if (desc->colorspace == UTIL_FORMAT_COLORSPACE_ZS) { +R600_ERR("CB0 uncompressed texture %p (handle)%d %d 0x%02X\n", rtexture, rtexture->uncompressed->handle, rtexture->resource.base.b.format, format); +format = 17; + rstate->bo[0] = radeon_bo_incref(rscreen->rw, rtexture->uncompressed); + rstate->bo[1] = radeon_bo_incref(rscreen->rw, rtexture->uncompressed); + rstate->bo[2] = radeon_bo_incref(rscreen->rw, rtexture->uncompressed); + rstate->placement[0] = RADEON_GEM_DOMAIN_GTT; + rstate->placement[2] = RADEON_GEM_DOMAIN_GTT; + rstate->placement[4] = RADEON_GEM_DOMAIN_GTT; + rstate->nbo = 3; + } else { + rstate->bo[0] = radeon_bo_incref(rscreen->rw, rbuffer->bo); + rstate->bo[1] = radeon_bo_incref(rscreen->rw, rbuffer->bo); + rstate->bo[2] = radeon_bo_incref(rscreen->rw, rbuffer->bo); + rstate->placement[0] = RADEON_GEM_DOMAIN_GTT; + rstate->placement[2] = RADEON_GEM_DOMAIN_GTT; + rstate->placement[4] = RADEON_GEM_DOMAIN_GTT; + rstate->nbo = 3; + color_info |= S_0280A0_SOURCE_FORMAT(1); + } + rstate->states[R600_CB0__CB_COLOR0_BASE] = rtexture->offset[level] >> 8; + rstate->states[R600_CB0__CB_COLOR0_INFO] = color_info; + rstate->states[R600_CB0__CB_COLOR0_SIZE] = S_028060_PITCH_TILE_MAX(pitch) | + S_028060_SLICE_TILE_MAX(slice); + + if (radeon_state_pm4(rstate)) { + radeon_state_decref(rstate); + return NULL; + } + return rstate; +} + +static struct radeon_state *r600_texture_state_db(struct r600_screen *rscreen, + struct r600_resource_texture *rtexture, + unsigned level) +{ + struct radeon_state *rstate; + struct r600_resource *rbuffer; + unsigned pitch, slice, format; + + rstate = radeon_state(rscreen->rw, R600_DB_TYPE, R600_DB); + if (rstate == NULL) + return NULL; + rbuffer = &rtexture->resource; + + /* set states (most default value are 0 and struct already + * initialized to 0, thus avoid resetting them) + */ + pitch = (rtexture->pitch[level] / rtexture->bpt) / 8 - 1; + slice = (rtexture->pitch[level] / rtexture->bpt) * rtexture->height[level] / 64 - 1; + format = r600_translate_dbformat(rbuffer->base.b.format); + rstate->states[R600_DB__DB_DEPTH_BASE] = rtexture->offset[level] >> 8; + rstate->states[R600_DB__DB_DEPTH_INFO] = S_028010_ARRAY_MODE(rtexture->array_mode) | + S_028010_FORMAT(format); + rstate->states[R600_DB__DB_DEPTH_VIEW] = 0x00000000; + rstate->states[R600_DB__DB_PREFETCH_LIMIT] = (rtexture->height[level] / 8) -1; + rstate->states[R600_DB__DB_DEPTH_SIZE] = S_028000_PITCH_TILE_MAX(pitch) | + S_028000_SLICE_TILE_MAX(slice); +R600_ERR("DB handle %d %p %d\n", rbuffer->bo->handle, rtexture, rbuffer->base.b.format); + rstate->bo[0] = radeon_bo_incref(rscreen->rw, rbuffer->bo); + rstate->placement[0] = RADEON_GEM_DOMAIN_GTT; + rstate->nbo = 1; + + if (radeon_state_pm4(rstate)) { + radeon_state_decref(rstate); + return NULL; + } + return rstate; +} + +int r600_texture_scissor(struct pipe_context *ctx, struct r600_resource_texture *rtexture, unsigned level) +{ + struct r600_screen *rscreen = r600_screen(ctx->screen); + + if (rtexture->scissor[level] == NULL) { + rtexture->scissor[level] = r600_texture_state_scissor(rscreen, rtexture, level); + if (rtexture->scissor[level] == NULL) { + R600_ERR("failed to create scissor for uncompressing depth\n"); + return -ENOMEM; + } + } + return 0; +} + +int r600_texture_cb0(struct pipe_context *ctx, struct r600_resource_texture *rtexture, unsigned level) +{ + struct r600_screen *rscreen = r600_screen(ctx->screen); + + if (rtexture->cb0[level] == NULL) { + rtexture->cb0[level] = r600_texture_state_cb0(rscreen, rtexture, level); + if (rtexture->cb0[level] == NULL) { + R600_ERR("failed to create cb0 state for texture\n"); + return -ENOMEM; + } + } + return 0; +} + +int r600_texture_db(struct pipe_context *ctx, struct r600_resource_texture *rtexture, unsigned level) +{ + struct r600_screen *rscreen = r600_screen(ctx->screen); + + if (rtexture->db[level] == NULL) { + rtexture->db[level] = r600_texture_state_db(rscreen, rtexture, level); + if (rtexture->db[level] == NULL) { + R600_ERR("failed to create db state for texture\n"); + return -ENOMEM; + } + } + return 0; +} -- cgit v1.2.3 From 47537a4557c8a264f1e0eb308aff07464c81e0ca Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Sun, 22 Aug 2010 15:48:41 +0200 Subject: nvfx: move stuff around --- src/gallium/drivers/nvfx/nvfx_context.c | 2 + src/gallium/drivers/nvfx/nvfx_context.h | 5 +- src/gallium/drivers/nvfx/nvfx_fragprog.c | 42 ++++++++++++++++ src/gallium/drivers/nvfx/nvfx_state.c | 82 -------------------------------- src/gallium/drivers/nvfx/nvfx_vertprog.c | 48 +++++++++++++++++++ 5 files changed, 95 insertions(+), 84 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/nvfx/nvfx_context.c b/src/gallium/drivers/nvfx/nvfx_context.c index e78fc14da4..99ad7bfacf 100644 --- a/src/gallium/drivers/nvfx/nvfx_context.c +++ b/src/gallium/drivers/nvfx/nvfx_context.c @@ -77,6 +77,8 @@ nvfx_create(struct pipe_screen *pscreen, void *priv) nvfx_init_state_functions(nvfx); nvfx_init_sampling_functions(nvfx); nvfx_init_vbo_functions(nvfx); + nvfx_init_fragprog_functions(nvfx); + nvfx_init_vertprog_functions(nvfx); nvfx_init_resource_functions(&nvfx->pipe); nvfx_init_transfer_functions(&nvfx->pipe); diff --git a/src/gallium/drivers/nvfx/nvfx_context.h b/src/gallium/drivers/nvfx/nvfx_context.h index fb4a9da579..02e8ed0178 100644 --- a/src/gallium/drivers/nvfx/nvfx_context.h +++ b/src/gallium/drivers/nvfx/nvfx_context.h @@ -244,8 +244,8 @@ nvfx_framebuffer_relocate(struct nvfx_context *nvfx); extern void nvfx_fragprog_destroy(struct nvfx_context *, struct nvfx_fragment_program *); extern void nvfx_fragprog_validate(struct nvfx_context *nvfx); -extern void -nvfx_fragprog_relocate(struct nvfx_context *nvfx); +extern void nvfx_fragprog_relocate(struct nvfx_context *nvfx); +extern void nvfx_init_fragprog_functions(struct nvfx_context *nvfx); /* nvfx_fragtex.c */ extern void nvfx_init_sampling_functions(struct nvfx_context *nvfx); @@ -308,6 +308,7 @@ extern unsigned nvfx_vertex_formats[]; extern boolean nvfx_vertprog_validate(struct nvfx_context *nvfx); extern void nvfx_vertprog_destroy(struct nvfx_context *, struct nvfx_vertex_program *); +extern void nvfx_init_vertprog_functions(struct nvfx_context *nvfx); /* nvfx_push.c */ extern void nvfx_push_vbo(struct pipe_context *pipe, const struct pipe_draw_info *info); diff --git a/src/gallium/drivers/nvfx/nvfx_fragprog.c b/src/gallium/drivers/nvfx/nvfx_fragprog.c index e40a814e18..e0e31e4689 100644 --- a/src/gallium/drivers/nvfx/nvfx_fragprog.c +++ b/src/gallium/drivers/nvfx/nvfx_fragprog.c @@ -1428,3 +1428,45 @@ nvfx_fragprog_destroy(struct nvfx_context *nvfx, if (fp->insn_len) FREE(fp->insn); } + +static void * +nvfx_fp_state_create(struct pipe_context *pipe, + const struct pipe_shader_state *cso) +{ + struct nvfx_fragment_program *fp; + + fp = CALLOC(1, sizeof(struct nvfx_fragment_program)); + fp->pipe.tokens = tgsi_dup_tokens(cso->tokens); + + tgsi_scan_shader(fp->pipe.tokens, &fp->info); + + return (void *)fp; +} + +static void +nvfx_fp_state_bind(struct pipe_context *pipe, void *hwcso) +{ + struct nvfx_context *nvfx = nvfx_context(pipe); + + nvfx->fragprog = hwcso; + nvfx->dirty |= NVFX_NEW_FRAGPROG; +} + +static void +nvfx_fp_state_delete(struct pipe_context *pipe, void *hwcso) +{ + struct nvfx_context *nvfx = nvfx_context(pipe); + struct nvfx_fragment_program *fp = hwcso; + + nvfx_fragprog_destroy(nvfx, fp); + FREE((void*)fp->pipe.tokens); + FREE(fp); +} + +void +nvfx_init_fragprog_functions(struct nvfx_context *nvfx) +{ + nvfx->pipe.create_fs_state = nvfx_fp_state_create; + nvfx->pipe.bind_fs_state = nvfx_fp_state_bind; + nvfx->pipe.delete_fs_state = nvfx_fp_state_delete; +} diff --git a/src/gallium/drivers/nvfx/nvfx_state.c b/src/gallium/drivers/nvfx/nvfx_state.c index e3c3fcb7d5..cb32e503c8 100644 --- a/src/gallium/drivers/nvfx/nvfx_state.c +++ b/src/gallium/drivers/nvfx/nvfx_state.c @@ -260,80 +260,6 @@ nvfx_depth_stencil_alpha_state_delete(struct pipe_context *pipe, void *hwcso) FREE(zsaso); } -static void * -nvfx_vp_state_create(struct pipe_context *pipe, - const struct pipe_shader_state *cso) -{ - struct nvfx_context *nvfx = nvfx_context(pipe); - struct nvfx_vertex_program *vp; - - // TODO: use a 64-bit atomic here! - static unsigned long long id = 0; - - vp = CALLOC(1, sizeof(struct nvfx_vertex_program)); - vp->pipe.tokens = tgsi_dup_tokens(cso->tokens); - vp->draw = draw_create_vertex_shader(nvfx->draw, &vp->pipe); - vp->id = ++id; - - return (void *)vp; -} - -static void -nvfx_vp_state_bind(struct pipe_context *pipe, void *hwcso) -{ - struct nvfx_context *nvfx = nvfx_context(pipe); - - nvfx->vertprog = hwcso; - nvfx->dirty |= NVFX_NEW_VERTPROG; - nvfx->draw_dirty |= NVFX_NEW_VERTPROG; -} - -static void -nvfx_vp_state_delete(struct pipe_context *pipe, void *hwcso) -{ - struct nvfx_context *nvfx = nvfx_context(pipe); - struct nvfx_vertex_program *vp = hwcso; - - draw_delete_vertex_shader(nvfx->draw, vp->draw); - nvfx_vertprog_destroy(nvfx, vp); - FREE((void*)vp->pipe.tokens); - FREE(vp); -} - -static void * -nvfx_fp_state_create(struct pipe_context *pipe, - const struct pipe_shader_state *cso) -{ - struct nvfx_fragment_program *fp; - - fp = CALLOC(1, sizeof(struct nvfx_fragment_program)); - fp->pipe.tokens = tgsi_dup_tokens(cso->tokens); - - tgsi_scan_shader(fp->pipe.tokens, &fp->info); - - return (void *)fp; -} - -static void -nvfx_fp_state_bind(struct pipe_context *pipe, void *hwcso) -{ - struct nvfx_context *nvfx = nvfx_context(pipe); - - nvfx->fragprog = hwcso; - nvfx->dirty |= NVFX_NEW_FRAGPROG; -} - -static void -nvfx_fp_state_delete(struct pipe_context *pipe, void *hwcso) -{ - struct nvfx_context *nvfx = nvfx_context(pipe); - struct nvfx_fragment_program *fp = hwcso; - - nvfx_fragprog_destroy(nvfx, fp); - FREE((void*)fp->pipe.tokens); - FREE(fp); -} - static void nvfx_set_blend_color(struct pipe_context *pipe, const struct pipe_blend_color *bcol) @@ -450,14 +376,6 @@ nvfx_init_state_functions(struct nvfx_context *nvfx) nvfx->pipe.delete_depth_stencil_alpha_state = nvfx_depth_stencil_alpha_state_delete; - nvfx->pipe.create_vs_state = nvfx_vp_state_create; - nvfx->pipe.bind_vs_state = nvfx_vp_state_bind; - nvfx->pipe.delete_vs_state = nvfx_vp_state_delete; - - nvfx->pipe.create_fs_state = nvfx_fp_state_create; - nvfx->pipe.bind_fs_state = nvfx_fp_state_bind; - nvfx->pipe.delete_fs_state = nvfx_fp_state_delete; - nvfx->pipe.set_blend_color = nvfx_set_blend_color; nvfx->pipe.set_stencil_ref = nvfx_set_stencil_ref; nvfx->pipe.set_clip_state = nvfx_set_clip_state; diff --git a/src/gallium/drivers/nvfx/nvfx_vertprog.c b/src/gallium/drivers/nvfx/nvfx_vertprog.c index 806f263dcf..f8f1af9816 100644 --- a/src/gallium/drivers/nvfx/nvfx_vertprog.c +++ b/src/gallium/drivers/nvfx/nvfx_vertprog.c @@ -1260,3 +1260,51 @@ nvfx_vertprog_destroy(struct nvfx_context *nvfx, struct nvfx_vertex_program *vp) util_dynarray_fini(&vp->branch_relocs); util_dynarray_fini(&vp->const_relocs); } + +static void * +nvfx_vp_state_create(struct pipe_context *pipe, + const struct pipe_shader_state *cso) +{ + struct nvfx_context *nvfx = nvfx_context(pipe); + struct nvfx_vertex_program *vp; + + // TODO: use a 64-bit atomic here! + static unsigned long long id = 0; + + vp = CALLOC(1, sizeof(struct nvfx_vertex_program)); + vp->pipe.tokens = tgsi_dup_tokens(cso->tokens); + vp->draw = draw_create_vertex_shader(nvfx->draw, &vp->pipe); + vp->id = ++id; + + return (void *)vp; +} + +static void +nvfx_vp_state_bind(struct pipe_context *pipe, void *hwcso) +{ + struct nvfx_context *nvfx = nvfx_context(pipe); + + nvfx->vertprog = hwcso; + nvfx->dirty |= NVFX_NEW_VERTPROG; + nvfx->draw_dirty |= NVFX_NEW_VERTPROG; +} + +static void +nvfx_vp_state_delete(struct pipe_context *pipe, void *hwcso) +{ + struct nvfx_context *nvfx = nvfx_context(pipe); + struct nvfx_vertex_program *vp = hwcso; + + draw_delete_vertex_shader(nvfx->draw, vp->draw); + nvfx_vertprog_destroy(nvfx, vp); + FREE((void*)vp->pipe.tokens); + FREE(vp); +} + +void +nvfx_init_vertprog_functions(struct nvfx_context *nvfx) +{ + nvfx->pipe.create_vs_state = nvfx_vp_state_create; + nvfx->pipe.bind_vs_state = nvfx_vp_state_bind; + nvfx->pipe.delete_vs_state = nvfx_vp_state_delete; +} -- cgit v1.2.3 From df86f1e7d50e01b92e03dc25fa9e9258d2d4fa2f Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Sun, 22 Aug 2010 16:15:51 +0200 Subject: nvfx: refactor to support multiple fragment program versions --- src/gallium/drivers/nvfx/nvfx_context.c | 4 + src/gallium/drivers/nvfx/nvfx_context.h | 5 +- src/gallium/drivers/nvfx/nvfx_draw.c | 10 +- src/gallium/drivers/nvfx/nvfx_fragprog.c | 174 +++++++++++++++++++------------ src/gallium/drivers/nvfx/nvfx_state.h | 10 +- 5 files changed, 127 insertions(+), 76 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/nvfx/nvfx_context.c b/src/gallium/drivers/nvfx/nvfx_context.c index 99ad7bfacf..80b36fb7b9 100644 --- a/src/gallium/drivers/nvfx/nvfx_context.c +++ b/src/gallium/drivers/nvfx/nvfx_context.c @@ -33,6 +33,9 @@ nvfx_destroy(struct pipe_context *pipe) { struct nvfx_context *nvfx = nvfx_context(pipe); + if(nvfx->dummy_fs) + pipe->delete_fs_state(pipe, nvfx->dummy_fs); + for(unsigned i = 0; i < nvfx->vtxbuf_nr; ++i) pipe_resource_reference(&nvfx->vtxbuf[i].buffer, 0); pipe_resource_reference(&nvfx->idxbuf.buffer, 0); @@ -42,6 +45,7 @@ nvfx_destroy(struct pipe_context *pipe) if (nvfx->draw) draw_destroy(nvfx->draw); + FREE(nvfx); } diff --git a/src/gallium/drivers/nvfx/nvfx_context.h b/src/gallium/drivers/nvfx/nvfx_context.h index 02e8ed0178..2134f3c386 100644 --- a/src/gallium/drivers/nvfx/nvfx_context.h +++ b/src/gallium/drivers/nvfx/nvfx_context.h @@ -161,7 +161,7 @@ struct nvfx_context { unsigned stipple[32]; struct pipe_clip_state clip; struct nvfx_vertex_program *vertprog; - struct nvfx_fragment_program *fragprog; + struct nvfx_pipe_fragment_program *fragprog; struct pipe_resource *constbuf[PIPE_SHADER_TYPES]; unsigned constbuf_nr[PIPE_SHADER_TYPES]; struct nvfx_rasterizer_state *rasterizer; @@ -174,6 +174,8 @@ struct nvfx_context { struct pipe_index_buffer idxbuf; struct nvfx_sampler_state *tex_sampler[PIPE_MAX_SAMPLERS]; struct pipe_sampler_view *fragment_sampler_views[PIPE_MAX_SAMPLERS]; + struct nvfx_pipe_fragment_program* dummy_fs; + unsigned nr_samplers; unsigned nr_textures; unsigned dirty_samplers; @@ -195,6 +197,7 @@ struct nvfx_context { struct nvfx_render_target hw_zeta; int hw_pointsprite_control; int hw_vp_output; + struct nvfx_fragment_program* hw_fragprog; }; static INLINE struct nvfx_context * diff --git a/src/gallium/drivers/nvfx/nvfx_draw.c b/src/gallium/drivers/nvfx/nvfx_draw.c index 331e28418a..0b17921295 100644 --- a/src/gallium/drivers/nvfx/nvfx_draw.c +++ b/src/gallium/drivers/nvfx/nvfx_draw.c @@ -274,19 +274,19 @@ emit_attrib(struct nvfx_context *nvfx, unsigned hw, unsigned emit, void nvfx_vtxfmt_validate(struct nvfx_context *nvfx) { - struct nvfx_fragment_program *fp = nvfx->fragprog; + struct nvfx_pipe_fragment_program *pfp = nvfx->fragprog; unsigned colour = 0, texcoords = 0, fog = 0, i; /* Determine needed fragprog inputs */ - for (i = 0; i < fp->info.num_inputs; i++) { - switch (fp->info.input_semantic_name[i]) { + for (i = 0; i < pfp->info.num_inputs; i++) { + switch (pfp->info.input_semantic_name[i]) { case TGSI_SEMANTIC_POSITION: break; case TGSI_SEMANTIC_COLOR: - colour |= (1 << fp->info.input_semantic_index[i]); + colour |= (1 << pfp->info.input_semantic_index[i]); break; case TGSI_SEMANTIC_GENERIC: - texcoords |= (1 << fp->info.input_semantic_index[i]); + texcoords |= (1 << pfp->info.input_semantic_index[i]); break; case TGSI_SEMANTIC_FOG: fog = 1; diff --git a/src/gallium/drivers/nvfx/nvfx_fragprog.c b/src/gallium/drivers/nvfx/nvfx_fragprog.c index e0e31e4689..c4394b25f3 100644 --- a/src/gallium/drivers/nvfx/nvfx_fragprog.c +++ b/src/gallium/drivers/nvfx/nvfx_fragprog.c @@ -8,6 +8,7 @@ #include "tgsi/tgsi_parse.h" #include "tgsi/tgsi_util.h" #include "tgsi/tgsi_dump.h" +#include "tgsi/tgsi_ureg.h" #include "nvfx_context.h" #include "nvfx_shader.h" @@ -17,6 +18,7 @@ #define MAX_IMM 32 struct nvfx_fpc { + struct nvfx_pipe_fragment_program* pfp; struct nvfx_fragment_program *fp; unsigned r_temps; @@ -379,27 +381,27 @@ tgsi_src(struct nvfx_fpc *fpc, const struct tgsi_full_src_register *fsrc) switch (fsrc->Register.File) { case TGSI_FILE_INPUT: - if(fpc->fp->info.input_semantic_name[fsrc->Register.Index] == TGSI_SEMANTIC_POSITION) { - assert(fpc->fp->info.input_semantic_index[fsrc->Register.Index] == 0); + if(fpc->pfp->info.input_semantic_name[fsrc->Register.Index] == TGSI_SEMANTIC_POSITION) { + assert(fpc->pfp->info.input_semantic_index[fsrc->Register.Index] == 0); src.reg = nvfx_reg(NVFXSR_INPUT, NVFX_FP_OP_INPUT_SRC_POSITION); - } else if(fpc->fp->info.input_semantic_name[fsrc->Register.Index] == TGSI_SEMANTIC_COLOR) { - if(fpc->fp->info.input_semantic_index[fsrc->Register.Index] == 0) + } else if(fpc->pfp->info.input_semantic_name[fsrc->Register.Index] == TGSI_SEMANTIC_COLOR) { + if(fpc->pfp->info.input_semantic_index[fsrc->Register.Index] == 0) src.reg = nvfx_reg(NVFXSR_INPUT, NVFX_FP_OP_INPUT_SRC_COL0); - else if(fpc->fp->info.input_semantic_index[fsrc->Register.Index] == 1) + else if(fpc->pfp->info.input_semantic_index[fsrc->Register.Index] == 1) src.reg = nvfx_reg(NVFXSR_INPUT, NVFX_FP_OP_INPUT_SRC_COL1); else assert(0); - } else if(fpc->fp->info.input_semantic_name[fsrc->Register.Index] == TGSI_SEMANTIC_FOG) { - assert(fpc->fp->info.input_semantic_index[fsrc->Register.Index] == 0); + } else if(fpc->pfp->info.input_semantic_name[fsrc->Register.Index] == TGSI_SEMANTIC_FOG) { + assert(fpc->pfp->info.input_semantic_index[fsrc->Register.Index] == 0); src.reg = nvfx_reg(NVFXSR_INPUT, NVFX_FP_OP_INPUT_SRC_FOGC); - } else if(fpc->fp->info.input_semantic_name[fsrc->Register.Index] == TGSI_SEMANTIC_FACE) { + } else if(fpc->pfp->info.input_semantic_name[fsrc->Register.Index] == TGSI_SEMANTIC_FACE) { /* TODO: check this has the correct values */ /* XXX: what do we do for nv30 here (assuming it lacks facing)?! */ - assert(fpc->fp->info.input_semantic_index[fsrc->Register.Index] == 0); + assert(fpc->pfp->info.input_semantic_index[fsrc->Register.Index] == 0); src.reg = nvfx_reg(NVFXSR_INPUT, NV40_FP_OP_INPUT_SRC_FACING); } else { - assert(fpc->fp->info.input_semantic_name[fsrc->Register.Index] == TGSI_SEMANTIC_GENERIC); - src.reg = nvfx_reg(NVFXSR_RELOCATED, fpc->generic_to_slot[fpc->fp->info.input_semantic_index[fsrc->Register.Index]]); + assert(fpc->pfp->info.input_semantic_name[fsrc->Register.Index] == TGSI_SEMANTIC_GENERIC); + src.reg = nvfx_reg(NVFXSR_RELOCATED, fpc->generic_to_slot[fpc->pfp->info.input_semantic_index[fsrc->Register.Index]]); } break; case TGSI_FILE_CONSTANT: @@ -922,7 +924,7 @@ nvfx_fragprog_prepare(struct nvfx_context* nvfx, struct nvfx_fpc *fpc) float const0v[4] = {0, 0, 0, 0}; struct nvfx_reg const0; - fpc->fp->num_slots = util_semantic_set_from_program_file(&set, fpc->fp->pipe.tokens, TGSI_FILE_INPUT); + fpc->fp->num_slots = util_semantic_set_from_program_file(&set, fpc->pfp->pipe.tokens, TGSI_FILE_INPUT); if(fpc->fp->num_slots > 8) return FALSE; util_semantic_layout_from_set(fpc->fp->slot_to_generic, &set, 0, 8); @@ -933,7 +935,7 @@ nvfx_fragprog_prepare(struct nvfx_context* nvfx, struct nvfx_fpc *fpc) const0 = constant(fpc, -1, const0v); assert(const0.index == 0); - tgsi_parse_init(&p, fpc->fp->pipe.tokens); + tgsi_parse_init(&p, fpc->pfp->pipe.tokens); while (!tgsi_parse_end_of_tokens(&p)) { const union tgsi_full_token *tok = &p.FullToken; @@ -999,26 +1001,32 @@ out_err: DEBUG_GET_ONCE_BOOL_OPTION(nvfx_dump_fp, "NVFX_DUMP_FP", FALSE) -static void +static struct nvfx_fragment_program* nvfx_fragprog_translate(struct nvfx_context *nvfx, - struct nvfx_fragment_program *fp) + struct nvfx_pipe_fragment_program *pfp) { struct tgsi_parse_context parse; struct nvfx_fpc *fpc = NULL; struct util_dynarray insns; + struct nvfx_fragment_program* fp = NULL; + const int min_size = 4096; + + fp = CALLOC_STRUCT(nvfx_fragment_program); + if(!fp) + goto out_err; - fpc = CALLOC(1, sizeof(struct nvfx_fpc)); + fpc = CALLOC_STRUCT(nvfx_fpc); if (!fpc) - return; + goto out_err; + + fpc->pfp = pfp; fpc->fp = fp; fpc->num_regs = 2; - if (!nvfx_fragprog_prepare(nvfx, fpc)) { - FREE(fpc); - return; - } + if (!nvfx_fragprog_prepare(nvfx, fpc)) + goto out_err; - tgsi_parse_init(&parse, fp->pipe.tokens); + tgsi_parse_init(&parse, pfp->pipe.tokens); util_dynarray_init(&insns); while (!tgsi_parse_end_of_tokens(&parse)) { @@ -1068,7 +1076,7 @@ nvfx_fragprog_translate(struct nvfx_context *nvfx, if(debug_get_option_nvfx_dump_fp()) { debug_printf("\n"); - tgsi_dump(fp->pipe.tokens, 0); + tgsi_dump(pfp->pipe.tokens, 0); debug_printf("\n%s fragment program:\n", nvfx->is_nv4x ? "nv4x" : "nv3x"); for (unsigned i = 0; i < fp->insn_len; i += 4) @@ -1076,15 +1084,37 @@ nvfx_fragprog_translate(struct nvfx_context *nvfx, debug_printf("\n"); } - fp->translated = TRUE; -out_err: + fp->prog_size = (fp->insn_len * 4 + 63) & ~63; + + if(fp->prog_size >= min_size) + fp->progs_per_bo = 1; + else + fp->progs_per_bo = min_size / fp->prog_size; + fp->bo_prog_idx = fp->progs_per_bo - 1; + +out: tgsi_parse_free(&parse); - if (fpc->r_temp) - FREE(fpc->r_temp); - util_dynarray_fini(&fpc->if_stack); - util_dynarray_fini(&fpc->label_relocs); - //util_dynarray_fini(&fpc->loop_stack); - FREE(fpc); + if(fpc) + { + if (fpc->r_temp) + FREE(fpc->r_temp); + util_dynarray_fini(&fpc->if_stack); + util_dynarray_fini(&fpc->label_relocs); + //util_dynarray_fini(&fpc->loop_stack); + FREE(fpc); + } + return fp; + +out_err: + _debug_printf("Error: failed to compile this fragment program:\n"); + tgsi_dump(pfp->pipe.tokens, 0); + + if(fp) + { + FREE(fp); + fp = NULL; + } + goto out; } static inline void @@ -1134,43 +1164,49 @@ void nvfx_fragprog_validate(struct nvfx_context *nvfx) { struct nouveau_channel* chan = nvfx->screen->base.channel; - struct nvfx_fragment_program *fp = nvfx->fragprog; - int update = 0; + struct nvfx_pipe_fragment_program *pfp = nvfx->fragprog; struct nvfx_vertex_program* vp; unsigned sprite_coord_enable; - boolean update_pointsprite = !!(nvfx->dirty & NVFX_NEW_FRAGPROG); + unsigned key = 0; + struct nvfx_fragment_program* fp; - if (!fp->translated) + fp = pfp->fps[key]; + if (!fp) { - const int min_size = 4096; + fp = nvfx_fragprog_translate(nvfx, pfp); - nvfx_fragprog_translate(nvfx, fp); - if (!fp->translated) { - static unsigned dummy[8] = {1, 0, 0, 0, 1, 0, 0, 0}; - static int warned = 0; - if(!warned) + if(!fp) + { + if(!nvfx->dummy_fs) { - fprintf(stderr, "nvfx: failed to translate fragment program!\n"); - warned = 1; + struct ureg_program *ureg = ureg_create( TGSI_PROCESSOR_FRAGMENT ); + if (ureg) + { + ureg_END( ureg ); + nvfx->dummy_fs = ureg_create_shader_and_destroy( ureg, &nvfx->pipe ); + } + + if(!nvfx->dummy_fs) + { + _debug_printf("Error: unable to create a dummy fragment shader: aborting."); + abort(); + } } - /* use dummy program: we cannot fail here */ - fp->translated = TRUE; - fp->insn = malloc(sizeof(dummy)); - memcpy(fp->insn, dummy, sizeof(dummy)); - fp->insn_len = sizeof(dummy) / sizeof(dummy[0]); - } - update = TRUE; + fp = nvfx_fragprog_translate(nvfx, nvfx->dummy_fs); - fp->prog_size = (fp->insn_len * 4 + 63) & ~63; + if(!fp) + { + _debug_printf("Error: unable to compile even a dummy fragment shader: aborting."); + abort(); + } + } - if(fp->prog_size >= min_size) - fp->progs_per_bo = 1; - else - fp->progs_per_bo = min_size / fp->prog_size; - fp->bo_prog_idx = fp->progs_per_bo - 1; + pfp->fps[key] = fp; } + nvfx->hw_fragprog = fp; + vp = nvfx->render_mode == HW ? nvfx->vertprog : nvfx->swtnl.vertprog; sprite_coord_enable = nvfx->rasterizer->pipe.point_quad_rasterization * nvfx->rasterizer->pipe.sprite_coord_enable; @@ -1391,7 +1427,7 @@ void nvfx_fragprog_relocate(struct nvfx_context *nvfx) { struct nouveau_channel* chan = nvfx->screen->base.channel; - struct nvfx_fragment_program *fp = nvfx->fragprog; + struct nvfx_fragment_program *fp = nvfx->hw_fragprog; struct nouveau_bo* bo = fp->fpbo->bo; int offset = fp->bo_prog_idx * fp->prog_size; unsigned fp_flags = NOUVEAU_BO_VRAM | NOUVEAU_BO_RD; // TODO: GART? @@ -1433,14 +1469,14 @@ static void * nvfx_fp_state_create(struct pipe_context *pipe, const struct pipe_shader_state *cso) { - struct nvfx_fragment_program *fp; + struct nvfx_pipe_fragment_program *pfp; - fp = CALLOC(1, sizeof(struct nvfx_fragment_program)); - fp->pipe.tokens = tgsi_dup_tokens(cso->tokens); + pfp = CALLOC(1, sizeof(struct nvfx_pipe_fragment_program)); + pfp->pipe.tokens = tgsi_dup_tokens(cso->tokens); - tgsi_scan_shader(fp->pipe.tokens, &fp->info); + tgsi_scan_shader(pfp->pipe.tokens, &pfp->info); - return (void *)fp; + return (void *)pfp; } static void @@ -1456,11 +1492,17 @@ static void nvfx_fp_state_delete(struct pipe_context *pipe, void *hwcso) { struct nvfx_context *nvfx = nvfx_context(pipe); - struct nvfx_fragment_program *fp = hwcso; + struct nvfx_pipe_fragment_program *pfp = hwcso; + unsigned i; + + for(i = 0; i < Elements(pfp->fps); ++i) + { + nvfx_fragprog_destroy(nvfx, pfp->fps[i]); + FREE(pfp->fps[i]); + } - nvfx_fragprog_destroy(nvfx, fp); - FREE((void*)fp->pipe.tokens); - FREE(fp); + FREE((void*)pfp->pipe.tokens); + FREE(pfp); } void diff --git a/src/gallium/drivers/nvfx/nvfx_state.h b/src/gallium/drivers/nvfx/nvfx_state.h index 05d41cfc8d..fd2174ed69 100644 --- a/src/gallium/drivers/nvfx/nvfx_state.h +++ b/src/gallium/drivers/nvfx/nvfx_state.h @@ -61,10 +61,6 @@ struct nvfx_fragment_program_bo { }; struct nvfx_fragment_program { - struct pipe_shader_state pipe; - struct tgsi_shader_info info; - - boolean translated; unsigned samplers; unsigned point_sprite_control; unsigned or; @@ -99,5 +95,11 @@ struct nvfx_fragment_program { struct nvfx_fragment_program_bo* fpbo; }; +struct nvfx_pipe_fragment_program { + struct pipe_shader_state pipe; + struct tgsi_shader_info info; + + struct nvfx_fragment_program* fps[1]; +}; #endif -- cgit v1.2.3 From 4f3fedcef735cda34aa04416950b5febb64435fc Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Sun, 22 Aug 2010 17:11:22 +0100 Subject: translate_sse: refactor constant management --- src/gallium/auxiliary/translate/translate_sse.c | 157 ++++++++++++------------ 1 file changed, 76 insertions(+), 81 deletions(-) (limited to 'src') diff --git a/src/gallium/auxiliary/translate/translate_sse.c b/src/gallium/auxiliary/translate/translate_sse.c index 5188e49cd5..3fcd120ed1 100644 --- a/src/gallium/auxiliary/translate/translate_sse.c +++ b/src/gallium/auxiliary/translate/translate_sse.c @@ -62,6 +62,30 @@ struct translate_buffer_varient { #define ELEMENT_BUFFER_INSTANCE_ID 1001 +#define NUM_CONSTS 7 + +enum +{ + CONST_IDENTITY, + CONST_INV_127, + CONST_INV_255, + CONST_INV_32767, + CONST_INV_65535, + CONST_INV_2147483647, + CONST_255 +}; + +#define C(v) {(float)(v), (float)(v), (float)(v), (float)(v)} +static float consts[NUM_CONSTS][4] = { + {0, 0, 0, 1}, + C(1.0 / 127.0), + C(1.0 / 255.0), + C(1.0 / 32767.0), + C(1.0 / 65535.0), + C(1.0 / 2147483647.0), + C(255.0) +}; +#undef C struct translate_sse { struct translate translate; @@ -72,11 +96,9 @@ struct translate_sse { struct x86_function elt8_func; struct x86_function *func; - boolean loaded_identity; - boolean loaded_const[5]; - - float identity[4]; - float const_value[5][4]; + PIPE_ALIGN_VAR(16) float consts[NUM_CONSTS][4]; + int8_t reg_to_const[16]; + int8_t const_to_reg[NUM_CONSTS]; struct translate_buffer buffer[PIPE_MAX_ATTRIBS]; unsigned nr_buffers; @@ -108,69 +130,38 @@ static int get_offset( const void *a, const void *b ) return (const char *)b - (const char *)a; } - - -static struct x86_reg get_identity( struct translate_sse *p ) +static struct x86_reg get_const( struct translate_sse *p, unsigned id) { - struct x86_reg reg = x86_make_reg(file_XMM, 7); - - if (!p->loaded_identity) { - p->loaded_identity = TRUE; - p->identity[0] = 0; - p->identity[1] = 0; - p->identity[2] = 0; - p->identity[3] = 1; - - sse_movups(p->func, reg, - x86_make_disp(p->machine_EDI, - get_offset(p, &p->identity[0]))); - } + struct x86_reg reg; + unsigned i; - return reg; -} + if(p->const_to_reg[id] >= 0) + return x86_make_reg(file_XMM, p->const_to_reg[id]); -static struct x86_reg get_const( struct translate_sse *p, unsigned i, float v) -{ - struct x86_reg reg = x86_make_reg(file_XMM, 2 + i); - - if (!p->loaded_const[i]) { - p->loaded_const[i] = TRUE; - p->const_value[i][0] = - p->const_value[i][1] = - p->const_value[i][2] = - p->const_value[i][3] = v; - - sse_movups(p->func, reg, - x86_make_disp(p->machine_EDI, - get_offset(p, &p->const_value[i][0]))); + for(i = 2; i < 8; ++i) + { + if(p->reg_to_const[i] < 0) + break; } - return reg; -} + /* TODO: be smarter here */ + if(i == 8) + --i; -static struct x86_reg get_inv_127( struct translate_sse *p ) -{ - return get_const(p, 0, 1.0f / 127.0f); -} + reg = x86_make_reg(file_XMM, i); -static struct x86_reg get_inv_255( struct translate_sse *p ) -{ - return get_const(p, 1, 1.0f / 255.0f); -} + if(p->reg_to_const[i] >= 0) + p->const_to_reg[p->reg_to_const[i]] = -1; -static struct x86_reg get_inv_32767( struct translate_sse *p ) -{ - return get_const(p, 2, 1.0f / 32767.0f); -} + p->reg_to_const[i] = id; + p->const_to_reg[id] = i; -static struct x86_reg get_inv_65535( struct translate_sse *p ) -{ - return get_const(p, 3, 1.0f / 65535.0f); -} + /* TODO: this should happen outside the loop, if possible */ + sse_movaps(p->func, reg, + x86_make_disp(p->machine_EDI, + get_offset(p, &p->consts[id][0]))); -static struct x86_reg get_inv_2147483647( struct translate_sse *p ) -{ - return get_const(p, 4, 1.0f / 2147483647.0f); + return reg; } /* load the data in a SSE2 register, padding with zeros */ @@ -247,16 +238,16 @@ static void emit_load_float32( struct translate_sse *p, */ sse_movss(p->func, data, arg0); if(out_chans == CHANNELS_0001) - sse_orps(p->func, data, get_identity(p) ); + sse_orps(p->func, data, get_const(p, CONST_IDENTITY) ); break; case 2: /* 0 0 0 1 * a b 0 1 */ if(out_chans == CHANNELS_0001) - sse_shufps(p->func, data, get_identity(p), SHUF(X, Y, Z, W) ); + sse_shufps(p->func, data, get_const(p, CONST_IDENTITY), SHUF(X, Y, Z, W) ); else if(out_chans > 2) - sse_movlhps(p->func, data, get_identity(p) ); + sse_movlhps(p->func, data, get_const(p, CONST_IDENTITY) ); sse_movlps(p->func, data, arg0); break; case 3: @@ -269,7 +260,7 @@ static void emit_load_float32( struct translate_sse *p, */ sse_movss(p->func, data, x86_make_disp(arg0, 8)); if(out_chans == CHANNELS_0001) - sse_shufps(p->func, data, get_identity(p), SHUF(X,Y,Z,W) ); + sse_shufps(p->func, data, get_const(p, CONST_IDENTITY), SHUF(X,Y,Z,W) ); sse_shufps(p->func, data, data, SHUF(Y,Z,X,W) ); sse_movlps(p->func, data, arg0); break; @@ -298,15 +289,15 @@ static void emit_load_float64to32( struct translate_sse *p, else sse2_cvtsd2ss(p->func, data, data); if(out_chans == CHANNELS_0001) - sse_shufps(p->func, data, get_identity(p), SHUF(X, Y, Z, W) ); + sse_shufps(p->func, data, get_const(p, CONST_IDENTITY), SHUF(X, Y, Z, W) ); break; case 2: sse2_movupd(p->func, data, arg0); sse2_cvtpd2ps(p->func, data, data); if(out_chans == CHANNELS_0001) - sse_shufps(p->func, data, get_identity(p), SHUF(X, Y, Z, W) ); + sse_shufps(p->func, data, get_const(p, CONST_IDENTITY), SHUF(X, Y, Z, W) ); else if(out_chans > 2) - sse_movlhps(p->func, data, get_identity(p) ); + sse_movlhps(p->func, data, get_const(p, CONST_IDENTITY) ); break; case 3: sse2_movupd(p->func, data, arg0); @@ -318,7 +309,7 @@ static void emit_load_float64to32( struct translate_sse *p, sse2_cvtsd2ss(p->func, tmpXMM, tmpXMM); sse_movlhps(p->func, data, tmpXMM); if(out_chans == CHANNELS_0001) - sse_orps(p->func, data, get_identity(p) ); + sse_orps(p->func, data, get_const(p, CONST_IDENTITY) ); break; case 4: sse2_movupd(p->func, data, arg0); @@ -526,11 +517,11 @@ static boolean translate_attr_convert( struct translate_sse *p, { case 8: /* TODO: this may be inefficient due to get_identity() being used both as a float and integer register */ - sse2_punpcklbw(p->func, dataXMM, get_identity(p)); - sse2_punpcklbw(p->func, dataXMM, get_identity(p)); + sse2_punpcklbw(p->func, dataXMM, get_const(p, CONST_IDENTITY)); + sse2_punpcklbw(p->func, dataXMM, get_const(p, CONST_IDENTITY)); break; case 16: - sse2_punpcklwd(p->func, dataXMM, get_identity(p)); + sse2_punpcklwd(p->func, dataXMM, get_const(p, CONST_IDENTITY)); break; case 32: /* we lose precision here */ sse2_psrld_imm(p->func, dataXMM, 1); @@ -545,13 +536,13 @@ static boolean translate_attr_convert( struct translate_sse *p, switch(input_desc->channel[0].size) { case 8: - factor = get_inv_255(p); + factor = get_const(p, CONST_INV_255); break; case 16: - factor = get_inv_65535(p); + factor = get_const(p, CONST_INV_65535); break; case 32: - factor = get_inv_2147483647(p); + factor = get_const(p, CONST_INV_2147483647); break; default: assert(0); @@ -595,13 +586,13 @@ static boolean translate_attr_convert( struct translate_sse *p, switch(input_desc->channel[0].size) { case 8: - factor = get_inv_127(p); + factor = get_const(p, CONST_INV_127); break; case 16: - factor = get_inv_32767(p); + factor = get_const(p, CONST_INV_32767); break; case 32: - factor = get_inv_2147483647(p); + factor = get_const(p, CONST_INV_2147483647); break; default: assert(0); @@ -750,12 +741,12 @@ static boolean translate_attr_convert( struct translate_sse *p, sse2_psrlw_imm(p->func, dataXMM, 1); } else - sse2_punpcklbw(p->func, dataXMM, get_identity(p)); + sse2_punpcklbw(p->func, dataXMM, get_const(p, CONST_IDENTITY)); break; case UTIL_FORMAT_TYPE_SIGNED: if(input_desc->channel[0].normalized) { - sse2_movq(p->func, tmpXMM, get_identity(p)); + sse2_movq(p->func, tmpXMM, get_const(p, CONST_IDENTITY)); sse2_punpcklbw(p->func, tmpXMM, dataXMM); sse2_psllw_imm(p->func, dataXMM, 9); sse2_psrlw_imm(p->func, dataXMM, 8); @@ -1020,6 +1011,7 @@ static boolean translate_attr_convert( struct translate_sse *p, } return TRUE; } + return FALSE; } @@ -1245,8 +1237,6 @@ static boolean build_vertex_emit( struct translate_sse *p, p->src_ECX = x86_make_reg(file_REG32, reg_CX); p->func = func; - memset(&p->loaded_const, 0, sizeof(p->loaded_const)); - p->loaded_identity = FALSE; x86_init_func(p->func); @@ -1406,7 +1396,7 @@ static void translate_sse_release( struct translate *translate ) x86_release_func( &p->linear_func ); x86_release_func( &p->elt_func ); - FREE(p); + os_free_aligned(p); } @@ -1419,9 +1409,14 @@ struct translate *translate_sse2_create( const struct translate_key *key ) if (!rtasm_cpu_has_sse()) goto fail; - p = CALLOC_STRUCT( translate_sse ); + p = os_malloc_aligned(sizeof(struct translate_sse), 16); if (p == NULL) goto fail; + memset(p, 0, sizeof(*p)); + + memcpy(p->consts, consts, sizeof(consts)); + memset(p->reg_to_const, 0xff, sizeof(p->reg_to_const)); + memset(p->const_to_reg, 0xff, sizeof(p->const_to_reg)); p->translate.key = *key; p->translate.release = translate_sse_release; -- cgit v1.2.3 From 8e632666af494219c77072056e8ca0e9cd09f5fa Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Sun, 22 Aug 2010 19:58:57 +0200 Subject: translate_sse: add R32G32B32A32_FLOAT -> X8X8X8X8_UNORM for EMIT_4UB Changed by me to use movd instead of movss to avoid penalties. --- src/gallium/auxiliary/translate/translate_sse.c | 26 +++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'src') diff --git a/src/gallium/auxiliary/translate/translate_sse.c b/src/gallium/auxiliary/translate/translate_sse.c index 3fcd120ed1..5d555bbd98 100644 --- a/src/gallium/auxiliary/translate/translate_sse.c +++ b/src/gallium/auxiliary/translate/translate_sse.c @@ -1011,6 +1011,32 @@ static boolean translate_attr_convert( struct translate_sse *p, } return TRUE; } + /* special case for draw's EMIT_4UB (RGBA) and EMIT_4UB_BGRA */ + else if((x86_target_caps(p->func) & X86_SSE2) && + a->input_format == PIPE_FORMAT_R32G32B32A32_FLOAT && (0 + || a->output_format == PIPE_FORMAT_B8G8R8A8_UNORM + || a->output_format == PIPE_FORMAT_R8G8B8A8_UNORM + )) + { + struct x86_reg dataXMM = x86_make_reg(file_XMM, 0); + + /* load */ + sse_movups(p->func, dataXMM, src); + + if (a->output_format == PIPE_FORMAT_B8G8R8A8_UNORM) + sse_shufps(p->func, dataXMM, dataXMM, SHUF(2,1,0,3)); + + /* scale by 255.0 */ + sse_mulps(p->func, dataXMM, get_const(p, CONST_255)); + + /* pack and emit */ + sse2_cvtps2dq(p->func, dataXMM, dataXMM); + sse2_packssdw(p->func, dataXMM, dataXMM); + sse2_packuswb(p->func, dataXMM, dataXMM); + sse2_movd(p->func, dst, dataXMM); + + return TRUE; + } return FALSE; } -- cgit v1.2.3 From d324fcea67f8e3f3c371ec089c5d5106be06e160 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Sun, 22 Aug 2010 12:45:04 -0700 Subject: nvfx: Include missing header in nvfx_vertprog.c. Include draw_context.h for draw_*_vertex_shader symbols. Fixes the following GCC warning. nvfx_vertprog.c: In function 'nvfx_vp_state_create': nvfx_vertprog.c:1276: warning: implicit declaration of function 'draw_create_vertex_shader' nvfx_vertprog.c:1276: warning: assignment makes pointer from integer without a cast nvfx_vertprog.c: In function 'nvfx_vp_state_delete': nvfx_vertprog.c:1298: warning: implicit declaration of function 'draw_delete_vertex_shader' --- src/gallium/drivers/nvfx/nvfx_vertprog.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/gallium/drivers/nvfx/nvfx_vertprog.c b/src/gallium/drivers/nvfx/nvfx_vertprog.c index f8f1af9816..3b8d3853b7 100644 --- a/src/gallium/drivers/nvfx/nvfx_vertprog.c +++ b/src/gallium/drivers/nvfx/nvfx_vertprog.c @@ -9,6 +9,8 @@ #include "tgsi/tgsi_dump.h" #include "tgsi/tgsi_util.h" +#include "draw/draw_context.h" + #include "nvfx_context.h" #include "nvfx_state.h" #include "nvfx_resource.h" -- cgit v1.2.3 From d843bbfd3f92d5afea665c3ff16bcca0628f2e7b Mon Sep 17 00:00:00 2001 From: Jerome Glisse Date: Sun, 22 Aug 2010 17:13:58 -0400 Subject: r600g: fix DB decompression Signed-off-by: Jerome Glisse --- src/gallium/drivers/r600/r600_blit.c | 48 +++-------- src/gallium/drivers/r600/r600_resource.h | 1 + src/gallium/drivers/r600/r600_screen.h | 1 + src/gallium/drivers/r600/r600_state.c | 10 +-- src/gallium/drivers/r600/r600_state_inlines.h | 2 +- src/gallium/drivers/r600/r600_texture.c | 110 +++++++++++++++++++------- 6 files changed, 97 insertions(+), 75 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/r600_blit.c b/src/gallium/drivers/r600/r600_blit.c index 8cb2795d2b..1a975da4bd 100644 --- a/src/gallium/drivers/r600/r600_blit.c +++ b/src/gallium/drivers/r600/r600_blit.c @@ -149,7 +149,6 @@ struct r600_blit_states { struct radeon_state *rasterizer; struct radeon_state *dsa; struct radeon_state *blend; - struct radeon_state *viewport; struct radeon_state *cb_cntl; struct radeon_state *config; struct radeon_state *vgt; @@ -490,33 +489,6 @@ static struct radeon_state *r600_blit_state_blend(struct r600_screen *rscreen) return rstate; } -static struct radeon_state *r600_blit_state_viewport(struct r600_screen *rscreen) -{ - struct radeon_state *rstate; - - rstate = radeon_state(rscreen->rw, R600_VIEWPORT_TYPE, R600_VIEWPORT); - if (rstate == NULL) - return NULL; - - /* set states (most default value are 0 and struct already - * initialized to 0, thus avoid resetting them) - */ - rstate->states[R600_VIEWPORT__PA_CL_VPORT_XOFFSET_0] = 0x42FA0000; - rstate->states[R600_VIEWPORT__PA_CL_VPORT_XSCALE_0] = 0x42FA0000; - rstate->states[R600_VIEWPORT__PA_CL_VPORT_YOFFSET_0] = 0x42FA0000; - rstate->states[R600_VIEWPORT__PA_CL_VPORT_YSCALE_0] = 0xC2FA0000; - rstate->states[R600_VIEWPORT__PA_CL_VPORT_ZOFFSET_0] = 0x3F000000; - rstate->states[R600_VIEWPORT__PA_CL_VPORT_ZSCALE_0] = 0x3F000000; - rstate->states[R600_VIEWPORT__PA_CL_VTE_CNTL] = 0x0000043F; - rstate->states[R600_VIEWPORT__PA_SC_VPORT_ZMAX_0] = 0x3F800000; - - if (radeon_state_pm4(rstate)) { - radeon_state_decref(rstate); - return NULL; - } - return rstate; -} - static struct radeon_state *r600_blit_state_cb_cntl(struct r600_screen *rscreen) { struct radeon_state *rstate; @@ -604,11 +576,6 @@ static int r600_blit_states_init(struct pipe_context *ctx, struct r600_blit_stat R600_ERR("failed creating blend state\n"); return -ENOMEM; } - bstates->viewport = r600_blit_state_viewport(rscreen); - if (bstates->viewport == NULL) { - R600_ERR("failed creating viewport state\n"); - return -ENOMEM; - } bstates->cb_cntl = r600_blit_state_cb_cntl(rscreen); if (bstates->cb_cntl == NULL) { R600_ERR("failed creating cb_cntl state\n"); @@ -628,7 +595,6 @@ static void r600_blit_states_destroy(struct pipe_context *ctx, struct r600_blit_ radeon_state_decref(bstates->rasterizer); radeon_state_decref(bstates->dsa); radeon_state_decref(bstates->blend); - radeon_state_decref(bstates->viewport); radeon_state_decref(bstates->cb_cntl); radeon_state_decref(bstates->config); radeon_state_decref(bstates->vgt); @@ -663,12 +629,16 @@ int r600_blit_uncompress_depth(struct pipe_context *ctx, struct r600_resource_te if (r) { return r; } + r = r600_texture_viewport(ctx, rtexture, level); + if (r) { + return r; + } r = r600_blit_states_init(ctx, &bstates); if (r) { return r; } - bstates.dsa->states[R600_DSA__DB_RENDER_CONTROL] = 0x000000EC; + bstates.dsa->states[R600_DSA__DB_RENDER_CONTROL] = 0x0000008C; bstates.cb_cntl->states[R600_CB_CNTL__CB_TARGET_MASK] = 0x00000001; /* force rebuild */ bstates.dsa->cpm4 = bstates.cb_cntl->cpm4 = 0; @@ -705,10 +675,6 @@ int r600_blit_uncompress_depth(struct pipe_context *ctx, struct r600_resource_te if (r) { goto out; } - r = radeon_draw_set(draw, bstates.viewport); - if (r) { - goto out; - } r = radeon_draw_set(draw, bstates.cb_cntl); if (r) { goto out; @@ -749,6 +715,10 @@ int r600_blit_uncompress_depth(struct pipe_context *ctx, struct r600_resource_te if (r) { goto out; } + r = radeon_draw_set(draw, rtexture->viewport[level]); + if (r) { + goto out; + } r = radeon_draw_set(draw, rtexture->scissor[level]); if (r) { goto out; diff --git a/src/gallium/drivers/r600/r600_resource.h b/src/gallium/drivers/r600/r600_resource.h index 5b3a7027a7..b880f9369c 100644 --- a/src/gallium/drivers/r600/r600_resource.h +++ b/src/gallium/drivers/r600/r600_resource.h @@ -59,6 +59,7 @@ struct r600_resource_texture { struct radeon_state *scissor[PIPE_MAX_TEXTURE_LEVELS]; struct radeon_state *cb0[PIPE_MAX_TEXTURE_LEVELS]; struct radeon_state *db[PIPE_MAX_TEXTURE_LEVELS]; + struct radeon_state *viewport[PIPE_MAX_TEXTURE_LEVELS]; }; void r600_init_context_resource_functions(struct r600_context *r600); diff --git a/src/gallium/drivers/r600/r600_screen.h b/src/gallium/drivers/r600/r600_screen.h index 4b2aac73ac..5e82ac8e23 100644 --- a/src/gallium/drivers/r600/r600_screen.h +++ b/src/gallium/drivers/r600/r600_screen.h @@ -80,6 +80,7 @@ int r600_texture_scissor(struct pipe_context *ctx, struct r600_resource_texture int r600_texture_cb0(struct pipe_context *ctx, struct r600_resource_texture *rtexture, unsigned level); int r600_texture_db(struct pipe_context *ctx, struct r600_resource_texture *rtexture, unsigned level); int r600_texture_from_depth(struct pipe_context *ctx, struct r600_resource_texture *rtexture, unsigned level); +int r600_texture_viewport(struct pipe_context *ctx, struct r600_resource_texture *rtexture, unsigned level); /* r600_blit.c */ int r600_blit_uncompress_depth(struct pipe_context *ctx, struct r600_resource_texture *rtexture, unsigned level); diff --git a/src/gallium/drivers/r600/r600_state.c b/src/gallium/drivers/r600/r600_state.c index 58df32818e..c3ef6267b2 100644 --- a/src/gallium/drivers/r600/r600_state.c +++ b/src/gallium/drivers/r600/r600_state.c @@ -775,10 +775,10 @@ static struct radeon_state *r600_db(struct r600_context *rctx) rtex = (struct r600_resource_texture*)state->zsbuf->texture; rtex->tilled = 1; rtex->array_mode = 2; - rtex->tile_type = 1; + rtex->tile_type = 0; rtex->depth = 1; rbuffer = &rtex->resource; -R600_ERR("DB handle %d %p %d\n", rbuffer->bo->handle, rtex, state->zsbuf->texture->format); + rstate->bo[0] = radeon_bo_incref(rscreen->rw, rbuffer->bo); rstate->nbo = 1; rstate->placement[0] = RADEON_GEM_DOMAIN_VRAM; @@ -1256,15 +1256,9 @@ static struct radeon_state *r600_resource(struct pipe_context *ctx, if (r) { return NULL; } -format = r600_translate_colorformat(view->texture->format); -R600_ERR("DEPTH TEXTURE %d rtex %p %d 0x%02X\n", tmp->uncompressed->handle, tmp, view->texture->format, format); -format = 17; rstate->bo[0] = radeon_bo_incref(rscreen->rw, tmp->uncompressed); rstate->bo[1] = radeon_bo_incref(rscreen->rw, tmp->uncompressed); -// array_mode = tmp->array_mode; -// tile_type = tmp->tile_type; } else { -R600_ERR("NOT DEPTH TEXTURE\n"); rstate->bo[0] = radeon_bo_incref(rscreen->rw, rbuffer->bo); rstate->bo[1] = radeon_bo_incref(rscreen->rw, rbuffer->bo); } diff --git a/src/gallium/drivers/r600/r600_state_inlines.h b/src/gallium/drivers/r600/r600_state_inlines.h index f93c20da35..927c342bb5 100644 --- a/src/gallium/drivers/r600/r600_state_inlines.h +++ b/src/gallium/drivers/r600/r600_state_inlines.h @@ -262,7 +262,7 @@ static INLINE uint32_t r600_translate_colorformat(enum pipe_format format) case PIPE_FORMAT_Z24X8_UNORM: case PIPE_FORMAT_Z24_UNORM_S8_USCALED: - return V_0280A0_COLOR_24_8; + return V_0280A0_COLOR_8_24; /* 64-bit buffers. */ case PIPE_FORMAT_R16G16B16A16_UNORM: diff --git a/src/gallium/drivers/r600/r600_texture.c b/src/gallium/drivers/r600/r600_texture.c index c79dd34f09..fb84ed9cfe 100644 --- a/src/gallium/drivers/r600/r600_texture.c +++ b/src/gallium/drivers/r600/r600_texture.c @@ -247,7 +247,7 @@ struct pipe_transfer* r600_texture_get_transfer(struct pipe_context *ctx, trans->transfer.box = *box; trans->transfer.stride = rtex->pitch[sr.level]; trans->offset = r600_texture_get_offset(rtex, sr.level, box->z, sr.face); - if (rtex->tilled) { + if (rtex->tilled && !rtex->depth) { resource.target = PIPE_TEXTURE_2D; resource.format = texture->format; resource.width0 = box->width; @@ -303,30 +303,40 @@ void* r600_texture_transfer_map(struct pipe_context *ctx, struct pipe_transfer* transfer) { struct r600_transfer *rtransfer = (struct r600_transfer*)transfer; - struct r600_resource *resource; + struct radeon_bo *bo; enum pipe_format format = transfer->resource->format; struct r600_screen *rscreen = r600_screen(ctx->screen); + struct r600_resource_texture *rtex; + unsigned long offset = 0; char *map; + int r; r600_flush(ctx, 0, NULL); if (rtransfer->linear_texture) { - resource = (struct r600_resource *)rtransfer->linear_texture; + bo = ((struct r600_resource *)rtransfer->linear_texture)->bo; } else { - resource = (struct r600_resource *)transfer->resource; + rtex = (struct r600_resource_texture*)transfer->resource; + if (rtex->depth) { + r = r600_texture_from_depth(ctx, rtex, transfer->sr.level); + if (r) { + return NULL; + } + r600_flush(ctx, 0, NULL); + bo = rtex->uncompressed; + } else { + bo = ((struct r600_resource *)transfer->resource)->bo; + } + offset = rtransfer->offset + + transfer->box.y / util_format_get_blockheight(format) * transfer->stride + + transfer->box.x / util_format_get_blockwidth(format) * util_format_get_blocksize(format); } - if (radeon_bo_map(rscreen->rw, resource->bo)) { + if (radeon_bo_map(rscreen->rw, bo)) { return NULL; } - radeon_bo_wait(rscreen->rw, resource->bo); - - map = resource->bo->data; - if (rtransfer->linear_texture) { - return map; - } + radeon_bo_wait(rscreen->rw, bo); - return map + rtransfer->offset + - transfer->box.y / util_format_get_blockheight(format) * transfer->stride + - transfer->box.x / util_format_get_blockwidth(format) * util_format_get_blocksize(format); + map = bo->data; + return map + offset; } void r600_texture_transfer_unmap(struct pipe_context *ctx, @@ -334,14 +344,20 @@ void r600_texture_transfer_unmap(struct pipe_context *ctx, { struct r600_transfer *rtransfer = (struct r600_transfer*)transfer; struct r600_screen *rscreen = r600_screen(ctx->screen); - struct r600_resource *resource; + struct r600_resource_texture *rtex; + struct radeon_bo *bo; if (rtransfer->linear_texture) { - resource = (struct r600_resource *)rtransfer->linear_texture; + bo = ((struct r600_resource *)rtransfer->linear_texture)->bo; } else { - resource = (struct r600_resource *)transfer->resource; + rtex = (struct r600_resource_texture*)transfer->resource; + if (rtex->depth) { + bo = rtex->uncompressed; + } else { + bo = ((struct r600_resource *)transfer->resource)->bo; + } } - radeon_bo_unmap(rscreen->rw, resource->bo); + radeon_bo_unmap(rscreen->rw, bo); } struct u_resource_vtbl r600_texture_vtbl = @@ -633,7 +649,6 @@ int r600_texture_from_depth(struct pipe_context *ctx, struct r600_resource_textu /* render a rectangle covering whole buffer to uncompress depth */ r = r600_blit_uncompress_depth(ctx, rtexture, level); -R600_ERR("---step0 %d\n", r); if (r) { return r; } @@ -708,13 +723,7 @@ static struct radeon_state *r600_texture_state_cb0(struct r600_screen *rscreen, ntype = V_0280A0_NUMBER_SRGB; format = r600_translate_colorformat(rtexture->resource.base.b.format); swap = r600_translate_colorswap(rtexture->resource.base.b.format); - color_info = S_0280A0_FORMAT(format) | - S_0280A0_COMP_SWAP(swap) | - S_0280A0_BLEND_CLAMP(1) | - S_0280A0_NUMBER_TYPE(ntype); if (desc->colorspace == UTIL_FORMAT_COLORSPACE_ZS) { -R600_ERR("CB0 uncompressed texture %p (handle)%d %d 0x%02X\n", rtexture, rtexture->uncompressed->handle, rtexture->resource.base.b.format, format); -format = 17; rstate->bo[0] = radeon_bo_incref(rscreen->rw, rtexture->uncompressed); rstate->bo[1] = radeon_bo_incref(rscreen->rw, rtexture->uncompressed); rstate->bo[2] = radeon_bo_incref(rscreen->rw, rtexture->uncompressed); @@ -722,6 +731,7 @@ format = 17; rstate->placement[2] = RADEON_GEM_DOMAIN_GTT; rstate->placement[4] = RADEON_GEM_DOMAIN_GTT; rstate->nbo = 3; + color_info = 0; } else { rstate->bo[0] = radeon_bo_incref(rscreen->rw, rbuffer->bo); rstate->bo[1] = radeon_bo_incref(rscreen->rw, rbuffer->bo); @@ -730,8 +740,12 @@ format = 17; rstate->placement[2] = RADEON_GEM_DOMAIN_GTT; rstate->placement[4] = RADEON_GEM_DOMAIN_GTT; rstate->nbo = 3; - color_info |= S_0280A0_SOURCE_FORMAT(1); + color_info = S_0280A0_SOURCE_FORMAT(1); } + color_info |= S_0280A0_FORMAT(format) | + S_0280A0_COMP_SWAP(swap) | + S_0280A0_BLEND_CLAMP(1) | + S_0280A0_NUMBER_TYPE(ntype); rstate->states[R600_CB0__CB_COLOR0_BASE] = rtexture->offset[level] >> 8; rstate->states[R600_CB0__CB_COLOR0_INFO] = color_info; rstate->states[R600_CB0__CB_COLOR0_SIZE] = S_028060_PITCH_TILE_MAX(pitch) | @@ -770,7 +784,6 @@ static struct radeon_state *r600_texture_state_db(struct r600_screen *rscreen, rstate->states[R600_DB__DB_PREFETCH_LIMIT] = (rtexture->height[level] / 8) -1; rstate->states[R600_DB__DB_DEPTH_SIZE] = S_028000_PITCH_TILE_MAX(pitch) | S_028000_SLICE_TILE_MAX(slice); -R600_ERR("DB handle %d %p %d\n", rbuffer->bo->handle, rtexture, rbuffer->base.b.format); rstate->bo[0] = radeon_bo_incref(rscreen->rw, rbuffer->bo); rstate->placement[0] = RADEON_GEM_DOMAIN_GTT; rstate->nbo = 1; @@ -796,6 +809,35 @@ int r600_texture_scissor(struct pipe_context *ctx, struct r600_resource_texture return 0; } +static struct radeon_state *r600_texture_state_viewport(struct r600_screen *rscreen, + struct r600_resource_texture *rtexture, + unsigned level) +{ + struct radeon_state *rstate; + + rstate = radeon_state(rscreen->rw, R600_VIEWPORT_TYPE, R600_VIEWPORT); + if (rstate == NULL) + return NULL; + + /* set states (most default value are 0 and struct already + * initialized to 0, thus avoid resetting them) + */ + rstate->states[R600_VIEWPORT__PA_CL_VPORT_XOFFSET_0] = fui((float)rtexture->width[level]/2.0); + rstate->states[R600_VIEWPORT__PA_CL_VPORT_XSCALE_0] = fui((float)rtexture->width[level]/2.0); + rstate->states[R600_VIEWPORT__PA_CL_VPORT_YOFFSET_0] = fui((float)rtexture->height[level]/2.0); + rstate->states[R600_VIEWPORT__PA_CL_VPORT_YSCALE_0] = fui((float)-rtexture->height[level]/2.0); + rstate->states[R600_VIEWPORT__PA_CL_VPORT_ZOFFSET_0] = 0x3F000000; + rstate->states[R600_VIEWPORT__PA_CL_VPORT_ZSCALE_0] = 0x3F000000; + rstate->states[R600_VIEWPORT__PA_CL_VTE_CNTL] = 0x0000043F; + rstate->states[R600_VIEWPORT__PA_SC_VPORT_ZMAX_0] = 0x3F800000; + + if (radeon_state_pm4(rstate)) { + radeon_state_decref(rstate); + return NULL; + } + return rstate; +} + int r600_texture_cb0(struct pipe_context *ctx, struct r600_resource_texture *rtexture, unsigned level) { struct r600_screen *rscreen = r600_screen(ctx->screen); @@ -823,3 +865,17 @@ int r600_texture_db(struct pipe_context *ctx, struct r600_resource_texture *rtex } return 0; } + +int r600_texture_viewport(struct pipe_context *ctx, struct r600_resource_texture *rtexture, unsigned level) +{ + struct r600_screen *rscreen = r600_screen(ctx->screen); + + if (rtexture->viewport[level] == NULL) { + rtexture->viewport[level] = r600_texture_state_viewport(rscreen, rtexture, level); + if (rtexture->viewport[level] == NULL) { + R600_ERR("failed to create viewport state for texture\n"); + return -ENOMEM; + } + } + return 0; +} -- cgit v1.2.3 From d21be6ee2cae2daeb83583a5d3798f5104c00d73 Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Sun, 22 Aug 2010 21:41:49 +0200 Subject: nvfx: use 64-bit bitmasks for temps --- src/gallium/drivers/nvfx/nvfx_fragprog.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/nvfx/nvfx_fragprog.c b/src/gallium/drivers/nvfx/nvfx_fragprog.c index c4394b25f3..47df71f232 100644 --- a/src/gallium/drivers/nvfx/nvfx_fragprog.c +++ b/src/gallium/drivers/nvfx/nvfx_fragprog.c @@ -21,8 +21,8 @@ struct nvfx_fpc { struct nvfx_pipe_fragment_program* pfp; struct nvfx_fragment_program *fp; - unsigned r_temps; - unsigned r_temps_discard; + unsigned long long r_temps; + unsigned long long r_temps_discard; struct nvfx_reg r_result[PIPE_MAX_SHADER_OUTPUTS]; struct nvfx_reg *r_temp; @@ -50,7 +50,7 @@ struct nvfx_fpc { static INLINE struct nvfx_reg temp(struct nvfx_fpc *fpc) { - int idx = ffs(~fpc->r_temps) - 1; + int idx = ffsll(~fpc->r_temps) - 1; if (idx < 0) { NOUVEAU_ERR("out of temps!!\n"); @@ -58,8 +58,8 @@ temp(struct nvfx_fpc *fpc) return nvfx_reg(NVFXSR_TEMP, 0); } - fpc->r_temps |= (1 << idx); - fpc->r_temps_discard |= (1 << idx); + fpc->r_temps |= (1ULL << idx); + fpc->r_temps_discard |= (1ULL << idx); return nvfx_reg(NVFXSR_TEMP, idx); } @@ -67,7 +67,7 @@ static INLINE void release_temps(struct nvfx_fpc *fpc) { fpc->r_temps &= ~fpc->r_temps_discard; - fpc->r_temps_discard = 0; + fpc->r_temps_discard = 0ULL; } static INLINE struct nvfx_reg @@ -911,7 +911,7 @@ nvfx_fragprog_parse_decl_output(struct nvfx_context* nvfx, struct nvfx_fpc *fpc, } fpc->r_result[idx] = nvfx_reg(NVFXSR_OUTPUT, hw); - fpc->r_temps |= (1 << hw); + fpc->r_temps |= (1ULL << hw); return TRUE; } @@ -987,7 +987,7 @@ nvfx_fragprog_prepare(struct nvfx_context* nvfx, struct nvfx_fpc *fpc) fpc->r_temp = CALLOC(high_temp, sizeof(struct nvfx_reg)); for (i = 0; i < high_temp; i++) fpc->r_temp[i] = temp(fpc); - fpc->r_temps_discard = 0; + fpc->r_temps_discard = 0ULL; } return TRUE; -- cgit v1.2.3 From d507c0812d5a01d29f1f9f6942ec5cfd91ea0375 Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Sun, 22 Aug 2010 23:29:34 +0200 Subject: nvfx: support both sprite coord origins Now we lie less when claiming OpenGL 2 support. Also, first piglit result group is now all green, except for fdo25614-genmipmap, which seems mesa/st's fault. --- src/gallium/drivers/nvfx/nvfx_fragprog.c | 139 ++++++++++++++++++++++--------- src/gallium/drivers/nvfx/nvfx_state.c | 3 +- src/gallium/drivers/nvfx/nvfx_state.h | 9 +- 3 files changed, 108 insertions(+), 43 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/nvfx/nvfx_fragprog.c b/src/gallium/drivers/nvfx/nvfx_fragprog.c index 47df71f232..12b002a819 100644 --- a/src/gallium/drivers/nvfx/nvfx_fragprog.c +++ b/src/gallium/drivers/nvfx/nvfx_fragprog.c @@ -25,6 +25,7 @@ struct nvfx_fpc { unsigned long long r_temps_discard; struct nvfx_reg r_result[PIPE_MAX_SHADER_OUTPUTS]; struct nvfx_reg *r_temp; + unsigned sprite_coord_temp; int num_regs; @@ -114,9 +115,10 @@ emit_src(struct nvfx_fpc *fpc, int pos, struct nvfx_src src) sr |= (src.reg.index << NVFX_FP_REG_SRC_SHIFT); break; case NVFXSR_RELOCATED: - sr |= (NVFX_FP_REG_TYPE_INPUT << NVFX_FP_REG_TYPE_SHIFT); + sr |= (NVFX_FP_REG_TYPE_TEMP << NVFX_FP_REG_TYPE_SHIFT); + sr |= (fpc->sprite_coord_temp << NVFX_FP_REG_SRC_SHIFT); //printf("adding relocation at %x for %x\n", fpc->inst_offset, src.index); - util_dynarray_append(&fpc->fp->slot_relocations[src.reg.index], unsigned, fpc->inst_offset); + util_dynarray_append(&fpc->fp->slot_relocations[src.reg.index], unsigned, fpc->inst_offset + pos + 1); break; case NVFXSR_CONST: if (!fpc->have_const) { @@ -1003,7 +1005,8 @@ DEBUG_GET_ONCE_BOOL_OPTION(nvfx_dump_fp, "NVFX_DUMP_FP", FALSE) static struct nvfx_fragment_program* nvfx_fragprog_translate(struct nvfx_context *nvfx, - struct nvfx_pipe_fragment_program *pfp) + struct nvfx_pipe_fragment_program *pfp, + boolean emulate_sprite_flipping) { struct tgsi_parse_context parse; struct nvfx_fpc *fpc = NULL; @@ -1027,8 +1030,20 @@ nvfx_fragprog_translate(struct nvfx_context *nvfx, goto out_err; tgsi_parse_init(&parse, pfp->pipe.tokens); - util_dynarray_init(&insns); + + if(emulate_sprite_flipping) + { + struct nvfx_reg reg = temp(fpc); + struct nvfx_src sprite_input = nvfx_src(nvfx_reg(NVFXSR_RELOCATED, fp->num_slots)); + float v[4] = {1, -1, 0, 0}; + struct nvfx_src imm = nvfx_src(constant(fpc, -1, v)); + + fpc->sprite_coord_temp = reg.index; + fpc->r_temps_discard = 0ULL; + nvfx_fp_emit(fpc, arith(0, MAD, reg, NVFX_FP_MASK_ALL, sprite_input, swz(imm, X, Y, X, X), swz(imm, Z, X, Z, Z))); + } + while (!tgsi_parse_end_of_tokens(&parse)) { tgsi_parse_token(&parse); @@ -1166,14 +1181,16 @@ nvfx_fragprog_validate(struct nvfx_context *nvfx) struct nouveau_channel* chan = nvfx->screen->base.channel; struct nvfx_pipe_fragment_program *pfp = nvfx->fragprog; struct nvfx_vertex_program* vp; - unsigned sprite_coord_enable; - unsigned key = 0; + unsigned sprite_coord_enable = nvfx->rasterizer->pipe.point_quad_rasterization * nvfx->rasterizer->pipe.sprite_coord_enable; + // TODO: correct or flipped? + boolean emulate_sprite_flipping = sprite_coord_enable && nvfx->rasterizer->pipe.sprite_coord_mode; + unsigned key = emulate_sprite_flipping; struct nvfx_fragment_program* fp; fp = pfp->fps[key]; if (!fp) { - fp = nvfx_fragprog_translate(nvfx, pfp); + fp = nvfx_fragprog_translate(nvfx, pfp, emulate_sprite_flipping); if(!fp) { @@ -1193,7 +1210,8 @@ nvfx_fragprog_validate(struct nvfx_context *nvfx) } } - fp = nvfx_fragprog_translate(nvfx, nvfx->dummy_fs); + fp = nvfx_fragprog_translate(nvfx, nvfx->dummy_fs, FALSE); + emulate_sprite_flipping = FALSE; if(!fp) { @@ -1205,21 +1223,19 @@ nvfx_fragprog_validate(struct nvfx_context *nvfx) pfp->fps[key] = fp; } - nvfx->hw_fragprog = fp; - vp = nvfx->render_mode == HW ? nvfx->vertprog : nvfx->swtnl.vertprog; - sprite_coord_enable = nvfx->rasterizer->pipe.point_quad_rasterization * nvfx->rasterizer->pipe.sprite_coord_enable; if (fp->last_vp_id != vp->id || fp->last_sprite_coord_enable != sprite_coord_enable) { - int sprite_input = -1; + int sprite_real_input = -1; + int sprite_reloc_input; unsigned i; fp->last_vp_id = vp->id; fp->last_sprite_coord_enable = sprite_coord_enable; if(sprite_coord_enable) { - sprite_input = vp->sprite_fp_input; - if(sprite_input < 0) + sprite_real_input = vp->sprite_fp_input; + if(sprite_real_input < 0) { unsigned used_texcoords = 0; for(unsigned i = 0; i < fp->num_slots; ++i) { @@ -1232,19 +1248,24 @@ nvfx_fragprog_validate(struct nvfx_context *nvfx) } } - sprite_input = NVFX_FP_OP_INPUT_SRC_TC(__builtin_ctz(~used_texcoords)); + sprite_real_input = NVFX_FP_OP_INPUT_SRC_TC(__builtin_ctz(~used_texcoords)); } - fp->point_sprite_control |= (1 << (sprite_input - NVFX_FP_OP_INPUT_SRC_TC0 + 8)); + fp->point_sprite_control |= (1 << (sprite_real_input - NVFX_FP_OP_INPUT_SRC_TC0 + 8)); } else fp->point_sprite_control = 0; + if(emulate_sprite_flipping) + sprite_reloc_input = 0; + else + sprite_reloc_input = sprite_real_input; + for(i = 0; i < fp->num_slots; ++i) { unsigned generic = fp->slot_to_generic[i]; if((1 << generic) & sprite_coord_enable) { - if(fp->slot_to_fp_input[i] != sprite_input) + if(fp->slot_to_fp_input[i] != sprite_reloc_input) goto update_slots; } else @@ -1255,6 +1276,12 @@ nvfx_fragprog_validate(struct nvfx_context *nvfx) } } + if(emulate_sprite_flipping) + { + if(fp->slot_to_fp_input[fp->num_slots] != sprite_real_input) + goto update_slots; + } + if(0) { update_slots: @@ -1263,21 +1290,23 @@ update_slots: { unsigned generic = fp->slot_to_generic[i]; if((1 << generic) & sprite_coord_enable) - fp->slot_to_fp_input[i] = sprite_input; + fp->slot_to_fp_input[i] = sprite_reloc_input; else fp->slot_to_fp_input[i] = vp->generic_to_fp_input[generic] & 0xf; } + fp->slot_to_fp_input[fp->num_slots] = sprite_real_input; + if(nvfx->is_nv4x) { fp->or = 0; - for(i = 0; i < fp->num_slots; ++i) { + for(i = 0; i <= fp->num_slots; ++i) { unsigned fp_input = fp->slot_to_fp_input[i]; if(fp_input == NVFX_FP_OP_INPUT_SRC_TC(8)) fp->or |= (1 << 12); else if(fp_input == NVFX_FP_OP_INPUT_SRC_TC(9)) fp->or |= (1 << 13); - else if(fp_input != 0xf) + else if(fp_input >= NVFX_FP_OP_INPUT_SRC_TC(0) && fp_input <= NVFX_FP_OP_INPUT_SRC_TC(7)) fp->or |= (1 << (fp_input - NVFX_FP_OP_INPUT_SRC_TC0 + 14)); } } @@ -1292,7 +1321,7 @@ update_slots: * one bound to this fragment program. * Doing such a check would likely be a pessimization. */ - if (nvfx->dirty & (NVFX_NEW_FRAGCONST | NVFX_NEW_FRAGPROG)) { + if ((nvfx->hw_fragprog != fp) || (nvfx->dirty & (NVFX_NEW_FRAGPROG | NVFX_NEW_FRAGCONST))) { int offset; uint32_t* fpmap; @@ -1365,16 +1394,45 @@ update: */ if(fp->progs_left_with_obsolete_slot_assignments) { unsigned char* fpbo_slots = &fp->fpbo->slots[fp->bo_prog_idx * 8]; - for(unsigned i = 0; i < fp->num_slots; ++i) { + /* also relocate sprite coord slot, if any */ + for(unsigned i = 0; i <= fp->num_slots; ++i) { unsigned value = fp->slot_to_fp_input[i];; if(value != fpbo_slots[i]) { - unsigned* p = (unsigned*)fp->slot_relocations[i].data; - unsigned* pend = (unsigned*)((char*)fp->slot_relocations[i].data + fp->slot_relocations[i].size); - for(; p != pend; ++p) { - unsigned off = *p; - unsigned dw = fp->insn[off]; - dw = (dw & ~NVFX_FP_OP_INPUT_SRC_MASK) | (value << NVFX_FP_OP_INPUT_SRC_SHIFT); - nvfx_fp_memcpy(&fpmap[*p], &dw, sizeof(dw)); + unsigned* p; + unsigned* begin = (unsigned*)fp->slot_relocations[i].data; + unsigned* end = (unsigned*)((char*)fp->slot_relocations[i].data + fp->slot_relocations[i].size); + //printf("fp %p reloc slot %u/%u: %u -> %u\n", fp, i, fp->num_slots, fpbo_slots[i], value); + if(value == 0) + { + /* was relocated to an input, switch type to temporary */ + for(p = begin; p != end; ++p) { + unsigned off = *p; + unsigned dw = fp->insn[off]; + dw &=~ NVFX_FP_REG_TYPE_MASK; + //printf("reloc_tmp at %x\n", off); + nvfx_fp_memcpy(&fpmap[off], &dw, sizeof(dw)); + } + } else { + if(!fpbo_slots[i]) + { + /* was relocated to a temporary, switch type to input */ + for(p= begin; p != end; ++p) { + unsigned off = *p; + unsigned dw = fp->insn[off]; + //printf("reloc_in at %x\n", off); + dw |= NVFX_FP_REG_TYPE_INPUT << NVFX_FP_REG_TYPE_SHIFT; + nvfx_fp_memcpy(&fpmap[off], &dw, sizeof(dw)); + } + } + + /* set the correct input index */ + for(p = begin; p != end; ++p) { + unsigned off = *p & ~3; + unsigned dw = fp->insn[off]; + //printf("reloc&~3 at %x\n", off); + dw = (dw & ~NVFX_FP_OP_INPUT_SRC_MASK) | (value << NVFX_FP_OP_INPUT_SRC_SHIFT); + nvfx_fp_memcpy(&fpmap[off], &dw, sizeof(dw)); + } } fpbo_slots[i] = value; } @@ -1382,6 +1440,8 @@ update: --fp->progs_left_with_obsolete_slot_assignments; } + nvfx->hw_fragprog = fp; + MARK_RING(chan, 8, 1); OUT_RING(chan, RING_3D(NV34TCL_FP_ACTIVE_PROGRAM, 1)); OUT_RELOC(chan, fp->fpbo->bo, offset, NOUVEAU_BO_VRAM | @@ -1491,15 +1551,18 @@ nvfx_fp_state_bind(struct pipe_context *pipe, void *hwcso) static void nvfx_fp_state_delete(struct pipe_context *pipe, void *hwcso) { - struct nvfx_context *nvfx = nvfx_context(pipe); - struct nvfx_pipe_fragment_program *pfp = hwcso; - unsigned i; - - for(i = 0; i < Elements(pfp->fps); ++i) - { - nvfx_fragprog_destroy(nvfx, pfp->fps[i]); - FREE(pfp->fps[i]); - } + struct nvfx_context *nvfx = nvfx_context(pipe); + struct nvfx_pipe_fragment_program *pfp = hwcso; + unsigned i; + + for(i = 0; i < Elements(pfp->fps); ++i) + { + if(pfp->fps[i]) + { + nvfx_fragprog_destroy(nvfx, pfp->fps[i]); + FREE(pfp->fps[i]); + } + } FREE((void*)pfp->pipe.tokens); FREE(pfp); diff --git a/src/gallium/drivers/nvfx/nvfx_state.c b/src/gallium/drivers/nvfx/nvfx_state.c index cb32e503c8..5bd7dc07f0 100644 --- a/src/gallium/drivers/nvfx/nvfx_state.c +++ b/src/gallium/drivers/nvfx/nvfx_state.c @@ -174,7 +174,8 @@ nvfx_rasterizer_state_bind(struct pipe_context *pipe, void *hwcso) } if(((struct nvfx_rasterizer_state*)hwcso)->pipe.point_quad_rasterization != nvfx->rasterizer->pipe.point_quad_rasterization - || ((struct nvfx_rasterizer_state*)hwcso)->pipe.sprite_coord_enable != nvfx->rasterizer->pipe.sprite_coord_enable) + || ((struct nvfx_rasterizer_state*)hwcso)->pipe.sprite_coord_enable != nvfx->rasterizer->pipe.sprite_coord_enable + || ((struct nvfx_rasterizer_state*)hwcso)->pipe.sprite_coord_mode != nvfx->rasterizer->pipe.sprite_coord_mode) { nvfx->dirty |= NVFX_NEW_SPRITE; } diff --git a/src/gallium/drivers/nvfx/nvfx_state.h b/src/gallium/drivers/nvfx/nvfx_state.h index fd2174ed69..3795191918 100644 --- a/src/gallium/drivers/nvfx/nvfx_state.h +++ b/src/gallium/drivers/nvfx/nvfx_state.h @@ -71,10 +71,11 @@ struct nvfx_fragment_program { struct nvfx_fragment_program_data *consts; unsigned nr_consts; + /* the slot at num_slots is for the sprite coordinate, if any */ unsigned num_slots; /* how many input semantics? */ - unsigned char slot_to_generic[8]; /* semantics */ - unsigned char slot_to_fp_input[8]; /* current assignment of slots for each used semantic */ - struct util_dynarray slot_relocations[8]; + unsigned char slot_to_generic[10]; /* semantics */ + unsigned char slot_to_fp_input[11]; /* current assignment of slots for each used semantic */ + struct util_dynarray slot_relocations[11]; /* This is reset to progs on any relocation update, and decreases every time we * move to a new prog due to a constant update @@ -99,7 +100,7 @@ struct nvfx_pipe_fragment_program { struct pipe_shader_state pipe; struct tgsi_shader_info info; - struct nvfx_fragment_program* fps[1]; + struct nvfx_fragment_program* fps[2]; }; #endif -- cgit v1.2.3 From 8ffc3572281c24d1f97b3c119117918dca80f53e Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Mon, 23 Aug 2010 00:16:23 +0200 Subject: nvfx: fix minor memory leak --- src/gallium/drivers/nvfx/nvfx_fragprog.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/drivers/nvfx/nvfx_fragprog.c b/src/gallium/drivers/nvfx/nvfx_fragprog.c index 12b002a819..a7e43b1513 100644 --- a/src/gallium/drivers/nvfx/nvfx_fragprog.c +++ b/src/gallium/drivers/nvfx/nvfx_fragprog.c @@ -1518,7 +1518,7 @@ nvfx_fragprog_destroy(struct nvfx_context *nvfx, while(fpbo != fp->fpbo); } - for(i = 0; i < 8; ++i) + for(i = 0; i < Elements(fp->slot_relocations); ++i) util_dynarray_fini(&fp->slot_relocations[i]); if (fp->insn_len) -- cgit v1.2.3 From 639cdd3782c40c422c33c907949376c735d9340c Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Sun, 22 Aug 2010 17:34:18 -0700 Subject: mesa: AC_SUBST the talloc libs/cflags so the ./configure results are saved. I had used pkg-config from the Makefile because I didn't want to screw around with the non-autoconf build, but that doesn't work because the PKG_CONFIG_PATH or TALLOC_LIBS/TALLOC_CFLAGS that people set at configure time needs to be respected and may not be present at build time. Bug #29585 --- configs/autoconf.in | 3 +++ configs/default | 5 ++++- configure.ac | 2 ++ src/glsl/Makefile | 3 ++- 4 files changed, 11 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/configs/autoconf.in b/configs/autoconf.in index c7611a6f78..305a3a4c3f 100644 --- a/configs/autoconf.in +++ b/configs/autoconf.in @@ -34,6 +34,9 @@ LLVM_LIBS = @LLVM_LIBS@ GLW_CFLAGS = @GLW_CFLAGS@ GLUT_CFLAGS = @GLUT_CFLAGS@ +TALLOC_LIBS = @TALLOC_LIBS@ +TALLOC_FLAGS = @TALLOC_CFLAGS@ + # dlopen DLOPEN_LIBS = @DLOPEN_LIBS@ diff --git a/configs/default b/configs/default index cdfa811b10..0435796429 100644 --- a/configs/default +++ b/configs/default @@ -82,6 +82,9 @@ GLESv1_CM_LIB_GLOB = $(GLESv1_CM_LIB_NAME)* GLESv2_LIB_GLOB = $(GLESv2_LIB_NAME)* VG_LIB_GLOB = $(VG_LIB_NAME)* +TALLOC_LIBS = `pkg-config --libs talloc` +TALLOC_CFLAGS = `pkg-config --cflags talloc` + # Optional assembly language optimization files for libGL MESA_ASM_SOURCES = @@ -116,7 +119,7 @@ EGL_CLIENT_APIS = $(GL_LIB) # Library dependencies #EXTRA_LIB_PATH ?= -GL_LIB_DEPS = $(EXTRA_LIB_PATH) -lX11 -lXext -lm -lpthread -ltalloc -lstdc++ +GL_LIB_DEPS = $(EXTRA_LIB_PATH) -lX11 -lXext -lm -lpthread $(TALLOC_LIBS) -lstdc++ EGL_LIB_DEPS = $(EXTRA_LIB_PATH) -ldl -lpthread OSMESA_LIB_DEPS = $(EXTRA_LIB_PATH) -L$(TOP)/$(LIB_DIR) -l$(GL_LIB) GLU_LIB_DEPS = $(EXTRA_LIB_PATH) -L$(TOP)/$(LIB_DIR) -l$(GL_LIB) -lm diff --git a/configure.ac b/configure.ac index 3d86decada..b2c6b52d2e 100644 --- a/configure.ac +++ b/configure.ac @@ -464,6 +464,8 @@ xxlib|xdri|xosmesa) esac PKG_CHECK_MODULES([TALLOC], [talloc]) +AC_SUBST([TALLOC_LIBS]) +AC_SUBST([TALLOC_CFLAGS]) dnl dnl Driver specific build directories diff --git a/src/glsl/Makefile b/src/glsl/Makefile index 1d200b47b4..fef389162a 100644 --- a/src/glsl/Makefile +++ b/src/glsl/Makefile @@ -75,7 +75,7 @@ CXX_SOURCES = \ LIBS = \ $(TOP)/src/glsl/libglsl.a \ - $(shell pkg-config --libs talloc) + $(TALLOC_LIBS) APPS = glsl_compiler glcpp/glcpp @@ -104,6 +104,7 @@ OBJECTS = \ $(CXX_SOURCES:.cpp=.o) INCLUDES = \ + $(TALLOC_CFLAGS) \ -I. \ -I../mesa \ -I../mapi \ -- cgit v1.2.3 From ed57286b75e337b29204cc998462a50a6fe47bc2 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sun, 22 Aug 2010 18:48:28 -0600 Subject: st/mesa: clean-up pipe_get_transfer() calls --- src/mesa/state_tracker/st_cb_readpixels.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/mesa/state_tracker/st_cb_readpixels.c b/src/mesa/state_tracker/st_cb_readpixels.c index b8493dab93..d5f5d42274 100644 --- a/src/mesa/state_tracker/st_cb_readpixels.c +++ b/src/mesa/state_tracker/st_cb_readpixels.c @@ -74,10 +74,10 @@ st_read_stencil_pixels(GLcontext *ctx, GLint x, GLint y, /* Create a read transfer from the renderbuffer's texture */ - pt = pipe_get_transfer(st_context(ctx)->pipe, strb->texture, - 0, 0, 0, - PIPE_TRANSFER_READ, x, y, - width, height); + pt = pipe_get_transfer(pipe, strb->texture, + 0, 0, 0, /* face, level, zslice */ + PIPE_TRANSFER_READ, + x, y, width, height); /* map the stencil buffer */ stmap = pipe_transfer_map(pipe, pt); @@ -230,10 +230,10 @@ st_fast_readpixels(GLcontext *ctx, struct st_renderbuffer *strb, y = strb->texture->height0 - y - height; } - trans = pipe_get_transfer(st_context(ctx)->pipe, strb->texture, - 0, 0, 0, - PIPE_TRANSFER_READ, x, y, - width, height); + trans = pipe_get_transfer(pipe, strb->texture, + 0, 0, 0, /* face, level, zslice */ + PIPE_TRANSFER_READ, + x, y, width, height); if (!trans) { return GL_FALSE; } @@ -394,10 +394,10 @@ st_readpixels(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height, } /* Create a read transfer from the renderbuffer's texture */ - trans = pipe_get_transfer(st_context(ctx)->pipe, strb->texture, - 0, 0, 0, - PIPE_TRANSFER_READ, x, y, - width, height); + trans = pipe_get_transfer(pipe, strb->texture, + 0, 0, 0, /* face, level, zslice */ + PIPE_TRANSFER_READ, + x, y, width, height); /* determine bottom-to-top vs. top-to-bottom order */ if (st_fb_orientation(ctx->ReadBuffer) == Y_0_TOP) { -- cgit v1.2.3 From c94256e83b6d482cb0c92e09b9f3275894fdc1b8 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sun, 22 Aug 2010 18:54:50 -0600 Subject: mesa: use driver hook for creating new renderbuffers --- src/mesa/main/depthstencil.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/mesa/main/depthstencil.c b/src/mesa/main/depthstencil.c index 885e718a76..dbaa841645 100644 --- a/src/mesa/main/depthstencil.c +++ b/src/mesa/main/depthstencil.c @@ -359,7 +359,7 @@ _mesa_new_z24_renderbuffer_wrapper(GLcontext *ctx, dsrb->Format == MESA_FORMAT_X8_Z24); ASSERT(dsrb->DataType == GL_UNSIGNED_INT_24_8_EXT); - z24rb = _mesa_new_renderbuffer(ctx, 0); + z24rb = ctx->Driver.NewRenderbuffer(ctx, 0); if (!z24rb) return NULL; @@ -645,7 +645,7 @@ _mesa_new_s8_renderbuffer_wrapper(GLcontext *ctx, struct gl_renderbuffer *dsrb) dsrb->Format == MESA_FORMAT_S8_Z24); ASSERT(dsrb->DataType == GL_UNSIGNED_INT_24_8_EXT); - s8rb = _mesa_new_renderbuffer(ctx, 0); + s8rb = ctx->Driver.NewRenderbuffer(ctx, 0); if (!s8rb) return NULL; -- cgit v1.2.3 From 6b90d1b1acaaf42b9c8b787d0dac54ac74d4fdcc Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sun, 22 Aug 2010 19:04:47 -0600 Subject: st/mesa: fix ReadPixels crashes when reading depth/stencil from a FBO MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is based on a patch from Marek Olšák. NOTE: This is a candidate for the Mesa 7.8 branch. --- src/mesa/state_tracker/st_cb_readpixels.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src') diff --git a/src/mesa/state_tracker/st_cb_readpixels.c b/src/mesa/state_tracker/st_cb_readpixels.c index d5f5d42274..6ab03ec939 100644 --- a/src/mesa/state_tracker/st_cb_readpixels.c +++ b/src/mesa/state_tracker/st_cb_readpixels.c @@ -68,6 +68,10 @@ st_read_stencil_pixels(GLcontext *ctx, GLint x, GLint y, ubyte *stmap; GLint j; + if (strb->Base.Wrapped) { + strb = st_renderbuffer(strb->Base.Wrapped); + } + if (st_fb_orientation(ctx->DrawBuffer) == Y_0_TOP) { y = ctx->DrawBuffer->Height - y - height; } @@ -359,6 +363,9 @@ st_readpixels(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height, } else if (format == GL_DEPTH_COMPONENT) { strb = st_renderbuffer(ctx->ReadBuffer->_DepthBuffer); + if (strb->Base.Wrapped) { + strb = st_renderbuffer(strb->Base.Wrapped); + } } else { /* Read color buffer */ -- cgit v1.2.3 From 137b8397fa5cc5d70e86a4b14d6be9326340f584 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Sun, 22 Aug 2010 18:25:55 -0700 Subject: glsl: Don't tree-graft in an expression in place of a function outval. Fixes: glsl-constant-folding-call-1 (bug #29737) --- src/glsl/ir_tree_grafting.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src') diff --git a/src/glsl/ir_tree_grafting.cpp b/src/glsl/ir_tree_grafting.cpp index 6acc5b86c5..748dcecefc 100644 --- a/src/glsl/ir_tree_grafting.cpp +++ b/src/glsl/ir_tree_grafting.cpp @@ -188,11 +188,16 @@ ir_tree_grafting_visitor::visit_enter(ir_function_signature *ir) ir_visitor_status ir_tree_grafting_visitor::visit_enter(ir_call *ir) { + exec_list_iterator sig_iter = ir->get_callee()->parameters.iterator(); /* Reminder: iterating ir_call iterates its parameters. */ foreach_iter(exec_list_iterator, iter, *ir) { + ir_variable *sig_param = (ir_variable *)sig_iter.get(); ir_rvalue *ir = (ir_rvalue *)iter.get(); ir_rvalue *new_ir = ir; + if (sig_param->mode != ir_var_in) + continue; + if (do_graft(&new_ir)) { ir->replace_with(new_ir); return visit_stop; -- cgit v1.2.3 From 6606fde3ec18288ecc4c6ce6d3fd32224a6c5248 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Sun, 22 Aug 2010 18:15:20 -0700 Subject: glsl: Convert constant folding to the rvalue visitor. This should be mostly a noop, except that a plain dereference of a variable that is not part of a constant expression could now get "constant folded". I expect that for all current backends this will be either a noop, or possibly a win when it provokes more ir_algebraic. It'll also ensure that when new features are added, tree walking will work normally. Before this, constants weren't getting folded inside of loops. --- src/glsl/ir_constant_folding.cpp | 200 ++++----------------------------------- 1 file changed, 19 insertions(+), 181 deletions(-) (limited to 'src') diff --git a/src/glsl/ir_constant_folding.cpp b/src/glsl/ir_constant_folding.cpp index 11260423d9..90135b5807 100644 --- a/src/glsl/ir_constant_folding.cpp +++ b/src/glsl/ir_constant_folding.cpp @@ -28,6 +28,7 @@ #include "ir.h" #include "ir_visitor.h" +#include "ir_rvalue_visitor.h" #include "ir_optimization.h" #include "glsl_types.h" @@ -35,7 +36,7 @@ * Visitor class for replacing expressions with ir_constant values. */ -class ir_constant_folding_visitor : public ir_visitor { +class ir_constant_folding_visitor : public ir_rvalue_visitor { public: ir_constant_folding_visitor() { @@ -47,40 +48,15 @@ public: /* 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 *); - /*@}*/ + virtual ir_visitor_status visit_enter(ir_assignment *ir); - void fold_constant(ir_rvalue **rvalue); + virtual void handle_rvalue(ir_rvalue **rvalue); bool progress; }; void -ir_constant_folding_visitor::fold_constant(ir_rvalue **rvalue) +ir_constant_folding_visitor::handle_rvalue(ir_rvalue **rvalue) { if (*rvalue == NULL || (*rvalue)->ir_type == ir_type_constant) return; @@ -94,104 +70,20 @@ ir_constant_folding_visitor::fold_constant(ir_rvalue **rvalue) } } -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) -{ - unsigned int operand; - - for (operand = 0; operand < ir->get_num_operands(); operand++) { - fold_constant(&ir->operands[operand]); - } -} - - -void -ir_constant_folding_visitor::visit(ir_texture *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_visitor_status +ir_constant_folding_visitor::visit_enter(ir_assignment *ir) { - fold_constant(&ir->val); -} - - -void -ir_constant_folding_visitor::visit(ir_dereference_variable *ir) -{ - (void) ir; -} - - -void -ir_constant_folding_visitor::visit(ir_dereference_array *ir) -{ - fold_constant(&ir->array_index); - 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) -{ - fold_constant(&ir->rhs); + ir->rhs->accept(this); + handle_rvalue(&ir->rhs); if (ir->condition) { + ir->condition->accept(this); + handle_rvalue(&ir->condition); + + ir_constant *const_val = ir->condition->as_constant(); /* If the condition is constant, either remove the condition or * remove the never-executed assignment. */ - ir_constant *const_val = ir->condition->constant_expression_value(); if (const_val) { if (const_val->value.b[0]) ir->condition = NULL; @@ -200,66 +92,12 @@ ir_constant_folding_visitor::visit(ir_assignment *ir) this->progress = true; } } -} - - -void -ir_constant_folding_visitor::visit(ir_constant *ir) -{ - (void) ir; -} - -void -ir_constant_folding_visitor::visit(ir_call *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) -{ - fold_constant(&ir->value); -} - - -void -ir_constant_folding_visitor::visit(ir_discard *ir) -{ - (void) ir; -} - - -void -ir_constant_folding_visitor::visit(ir_if *ir) -{ - fold_constant(&ir->condition); - - 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; + /* Don't descend into the LHS because we want it to stay as a + * variable dereference. FINISHME: We probably should to get array + * indices though. + */ + return visit_continue_with_parent; } bool @@ -267,7 +105,7 @@ do_constant_folding(exec_list *instructions) { ir_constant_folding_visitor constant_folding; - visit_exec_list(instructions, &constant_folding); + visit_list_elements(&constant_folding, instructions); return constant_folding.progress; } -- cgit v1.2.3 From 428a3cd2d537a42c8a01765a5a53dca139e07443 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Sun, 22 Aug 2010 18:26:42 -0700 Subject: glsl: Don't constant-fold in a constant in place of a function outval. --- src/glsl/ir_constant_folding.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'src') diff --git a/src/glsl/ir_constant_folding.cpp b/src/glsl/ir_constant_folding.cpp index 90135b5807..5d77093852 100644 --- a/src/glsl/ir_constant_folding.cpp +++ b/src/glsl/ir_constant_folding.cpp @@ -49,6 +49,7 @@ public: } virtual ir_visitor_status visit_enter(ir_assignment *ir); + virtual ir_visitor_status visit_enter(ir_call *ir); virtual void handle_rvalue(ir_rvalue **rvalue); @@ -100,6 +101,27 @@ ir_constant_folding_visitor::visit_enter(ir_assignment *ir) return visit_continue_with_parent; } +ir_visitor_status +ir_constant_folding_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 *sig_param = (ir_variable *)sig_iter.get(); + + if (sig_param->mode == ir_var_in) { + ir_rvalue *new_param = param_rval; + + handle_rvalue(&new_param); + if (new_param != param_rval) { + param_rval->replace_with(new_param); + } + } + } + + return visit_continue_with_parent; +} + bool do_constant_folding(exec_list *instructions) { -- cgit v1.2.3 From 24bd9780bcf400a00f6fc5a89b1648c7e3b7df07 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sun, 22 Aug 2010 19:34:53 -0600 Subject: st/mesa: added st_is_depth_stencil_combined() function MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This code is part of a patch by Marek Olšák. --- src/mesa/state_tracker/st_cb_fbo.c | 24 ++++++++++++++++++++++++ src/mesa/state_tracker/st_cb_fbo.h | 5 +++++ 2 files changed, 29 insertions(+) (limited to 'src') diff --git a/src/mesa/state_tracker/st_cb_fbo.c b/src/mesa/state_tracker/st_cb_fbo.c index 48d83ded55..71bd4729e0 100644 --- a/src/mesa/state_tracker/st_cb_fbo.c +++ b/src/mesa/state_tracker/st_cb_fbo.c @@ -447,6 +447,30 @@ st_validate_attachment(struct pipe_screen *screen, } +/** + * Check if two renderbuffer attachments name a combined depth/stencil + * renderbuffer. + */ +GLboolean +st_is_depth_stencil_combined(const struct gl_renderbuffer_attachment *depth, + const struct gl_renderbuffer_attachment *stencil) +{ + assert(depth && stencil); + + if (depth->Type == stencil->Type) { + if (depth->Type == GL_RENDERBUFFER_EXT && + depth->Renderbuffer == stencil->Renderbuffer) + return GL_TRUE; + + if (depth->Type == GL_TEXTURE && + depth->Texture == stencil->Texture) + return GL_TRUE; + } + + return GL_FALSE; +} + + /** * Check that the framebuffer configuration is valid in terms of what * the driver can support. diff --git a/src/mesa/state_tracker/st_cb_fbo.h b/src/mesa/state_tracker/st_cb_fbo.h index 62a9bbcb25..3e9815c1b1 100644 --- a/src/mesa/state_tracker/st_cb_fbo.h +++ b/src/mesa/state_tracker/st_cb_fbo.h @@ -88,4 +88,9 @@ st_get_renderbuffer_sampler_view(struct st_renderbuffer *rb, struct pipe_context *pipe); +extern GLboolean +st_is_depth_stencil_combined(const struct gl_renderbuffer_attachment *depth, + const struct gl_renderbuffer_attachment *stencil); + + #endif /* ST_CB_FBO_H */ -- cgit v1.2.3 From 36e523f4a3383bc9e6170d0bc959ba9ffdb85016 Mon Sep 17 00:00:00 2001 From: Marek Olšák Date: Sat, 14 Aug 2010 08:47:32 -0700 Subject: st/mesa: fix BlitFramebuffer for D24S8 textures This is the same issue as in the previous patch, but here the Blit is not implemented for separate depth and stencil buffers at all (such a configuration is not supported in Gallium) and the code incorrectly treated a D24S8 texture as two separate buffers, making this Blit a no-op. Signed-off-by: Brian Paul --- src/mesa/state_tracker/st_cb_blit.c | 38 +++++++++++++++++-------------------- 1 file changed, 17 insertions(+), 21 deletions(-) (limited to 'src') diff --git a/src/mesa/state_tracker/st_cb_blit.c b/src/mesa/state_tracker/st_cb_blit.c index 1f73f503f6..b3c754477a 100644 --- a/src/mesa/state_tracker/st_cb_blit.c +++ b/src/mesa/state_tracker/st_cb_blit.c @@ -40,6 +40,7 @@ #include "st_cb_fbo.h" #include "util/u_blit.h" +#include "util/u_inlines.h" void @@ -152,38 +153,33 @@ st_BlitFramebuffer(GLcontext *ctx, /* depth and/or stencil blit */ /* get src/dst depth surfaces */ - struct st_renderbuffer *srcDepthRb = + struct gl_renderbuffer_attachment *srcDepth = + &readFB->Attachment[BUFFER_DEPTH]; + struct gl_renderbuffer_attachment *dstDepth = + &drawFB->Attachment[BUFFER_DEPTH]; + struct gl_renderbuffer_attachment *srcStencil = + &readFB->Attachment[BUFFER_STENCIL]; + struct gl_renderbuffer_attachment *dstStencil = + &drawFB->Attachment[BUFFER_STENCIL]; + + struct st_renderbuffer *srcDepthRb = st_renderbuffer(readFB->Attachment[BUFFER_DEPTH].Renderbuffer); struct st_renderbuffer *dstDepthRb = st_renderbuffer(drawFB->Attachment[BUFFER_DEPTH].Renderbuffer); - struct pipe_surface *srcDepthSurf = - srcDepthRb ? srcDepthRb->surface : NULL; struct pipe_surface *dstDepthSurf = dstDepthRb ? dstDepthRb->surface : NULL; - /* get src/dst stencil surfaces */ - struct st_renderbuffer *srcStencilRb = - st_renderbuffer(readFB->Attachment[BUFFER_STENCIL].Renderbuffer); - struct st_renderbuffer *dstStencilRb = - st_renderbuffer(drawFB->Attachment[BUFFER_STENCIL].Renderbuffer); - struct pipe_surface *srcStencilSurf = - srcStencilRb ? srcStencilRb->surface : NULL; - struct pipe_surface *dstStencilSurf = - dstStencilRb ? dstStencilRb->surface : NULL; - if ((mask & depthStencil) == depthStencil && - srcDepthSurf == srcStencilSurf && - dstDepthSurf == dstStencilSurf) { - struct pipe_subresource srcSub; - - srcSub.face = srcDepthRb->surface->face; - srcSub.level = srcDepthRb->surface->level; + st_is_depth_stencil_combined(srcDepth, srcStencil) && + st_is_depth_stencil_combined(dstDepth, dstStencil)) { /* Blitting depth and stencil values between combined * depth/stencil buffers. This is the ideal case for such buffers. */ - util_blit_pixels(st->blit, - srcDepthRb->texture, srcSub, srcX0, srcY0, srcX1, srcY1, + util_blit_pixels(st->blit, srcDepthRb->texture, + u_subresource(srcDepthRb->surface->face, + srcDepthRb->surface->level), + srcX0, srcY0, srcX1, srcY1, srcDepthRb->surface->zslice, dstDepthSurf, dstX0, dstY0, dstX1, dstY1, 0.0, pFilter); -- cgit v1.2.3 From 7945e143e0110398596311842309a88a6e455703 Mon Sep 17 00:00:00 2001 From: Marek Olšák Date: Sun, 22 Aug 2010 19:29:32 -0600 Subject: util: implement depth blitting in u_blit Signed-off-by: Brian Paul --- src/gallium/auxiliary/util/u_blit.c | 60 ++++++++++++++++++++++++++----------- 1 file changed, 43 insertions(+), 17 deletions(-) (limited to 'src') diff --git a/src/gallium/auxiliary/util/u_blit.c b/src/gallium/auxiliary/util/u_blit.c index 6fb341eaf2..dfb142b9e1 100644 --- a/src/gallium/auxiliary/util/u_blit.c +++ b/src/gallium/auxiliary/util/u_blit.c @@ -42,6 +42,7 @@ #include "util/u_blit.h" #include "util/u_draw_quad.h" +#include "util/u_format.h" #include "util/u_math.h" #include "util/u_memory.h" #include "util/u_sampler.h" @@ -56,7 +57,8 @@ struct blit_state struct cso_context *cso; struct pipe_blend_state blend; - struct pipe_depth_stencil_alpha_state depthstencil; + struct pipe_depth_stencil_alpha_state depthstencil_keep; + struct pipe_depth_stencil_alpha_state depthstencil_write; struct pipe_rasterizer_state rasterizer; struct pipe_sampler_state sampler; struct pipe_viewport_state viewport; @@ -66,6 +68,7 @@ struct blit_state void *vs; void *fs[TGSI_WRITEMASK_XYZW + 1]; + void *fs_depth; struct pipe_resource *vbuf; /**< quad vertices */ unsigned vbuf_slot; @@ -96,7 +99,11 @@ util_create_blit(struct pipe_context *pipe, struct cso_context *cso) ctx->blend.rt[0].colormask = PIPE_MASK_RGBA; /* no-op depth/stencil/alpha */ - memset(&ctx->depthstencil, 0, sizeof(ctx->depthstencil)); + memset(&ctx->depthstencil_keep, 0, sizeof(ctx->depthstencil_keep)); + memset(&ctx->depthstencil_write, 0, sizeof(ctx->depthstencil_write)); + ctx->depthstencil_write.depth.enabled = 1; + ctx->depthstencil_write.depth.writemask = 1; + ctx->depthstencil_write.depth.func = PIPE_FUNC_ALWAYS; /* rasterizer */ memset(&ctx->rasterizer, 0, sizeof(ctx->rasterizer)); @@ -169,6 +176,9 @@ util_destroy_blit(struct blit_state *ctx) if (ctx->fs[i]) pipe->delete_fs_state(pipe, ctx->fs[i]); + if (ctx->fs_depth) + pipe->delete_fs_state(pipe, ctx->fs_depth); + pipe_resource_reference(&ctx->vbuf, NULL); FREE(ctx); @@ -276,7 +286,7 @@ regions_overlap(int srcX0, int srcY0, * \param writemask controls which channels in the dest surface are sourced * from the src surface. Disabled channels are sourced * from (0,0,0,1). - * XXX need some control over blitting Z and/or stencil. + * XXX need some control over blitting stencil. */ void util_blit_pixels_writemask(struct blit_state *ctx, @@ -299,7 +309,7 @@ util_blit_pixels_writemask(struct blit_state *ctx, const int srcW = abs(srcX1 - srcX0); const int srcH = abs(srcY1 - srcY0); unsigned offset; - boolean overlap; + boolean overlap, dst_is_depth; float s0, t0, s1, t1; boolean normalized; @@ -444,14 +454,15 @@ util_blit_pixels_writemask(struct blit_state *ctx, } } + dst_is_depth = util_format_is_depth_or_stencil(dst->format); assert(screen->is_format_supported(screen, sampler_view->format, ctx->internal_target, sampler_view->texture->nr_samples, PIPE_BIND_SAMPLER_VIEW, 0)); assert(screen->is_format_supported(screen, dst->format, ctx->internal_target, dst->texture->nr_samples, - PIPE_BIND_RENDER_TARGET, 0)); - + dst_is_depth ? PIPE_BIND_DEPTH_STENCIL : + PIPE_BIND_RENDER_TARGET, 0)); /* save state (restored below) */ cso_save_blend(ctx->cso); cso_save_depth_stencil_alpha(ctx->cso); @@ -467,7 +478,9 @@ util_blit_pixels_writemask(struct blit_state *ctx, /* set misc state we care about */ cso_set_blend(ctx->cso, &ctx->blend); - cso_set_depth_stencil_alpha(ctx->cso, &ctx->depthstencil); + cso_set_depth_stencil_alpha(ctx->cso, + dst_is_depth ? &ctx->depthstencil_write : + &ctx->depthstencil_keep); cso_set_rasterizer(ctx->cso, &ctx->rasterizer); cso_set_clip(ctx->cso, &ctx->clip); cso_set_vertex_elements(ctx->cso, 2, ctx->velem); @@ -496,22 +509,35 @@ util_blit_pixels_writemask(struct blit_state *ctx, /* texture */ cso_set_fragment_sampler_views(ctx->cso, 1, &sampler_view); - if (ctx->fs[writemask] == NULL) - ctx->fs[writemask] = - util_make_fragment_tex_shader_writemask(pipe, TGSI_TEXTURE_2D, - TGSI_INTERPOLATE_LINEAR, - writemask); - /* shaders */ - cso_set_fragment_shader_handle(ctx->cso, ctx->fs[writemask]); + if (dst_is_depth) { + if (ctx->fs_depth == NULL) + ctx->fs_depth = + util_make_fragment_tex_shader_writedepth(pipe, TGSI_TEXTURE_2D, + TGSI_INTERPOLATE_LINEAR); + + cso_set_fragment_shader_handle(ctx->cso, ctx->fs_depth); + } else { + if (ctx->fs[writemask] == NULL) + ctx->fs[writemask] = + util_make_fragment_tex_shader_writemask(pipe, TGSI_TEXTURE_2D, + TGSI_INTERPOLATE_LINEAR, + writemask); + + cso_set_fragment_shader_handle(ctx->cso, ctx->fs[writemask]); + } cso_set_vertex_shader_handle(ctx->cso, ctx->vs); /* drawing dest */ memset(&fb, 0, sizeof(fb)); fb.width = dst->width; fb.height = dst->height; - fb.nr_cbufs = 1; - fb.cbufs[0] = dst; + if (dst_is_depth) { + fb.zsbuf = dst; + } else { + fb.nr_cbufs = 1; + fb.cbufs[0] = dst; + } cso_set_framebuffer(ctx->cso, &fb); /* draw quad */ @@ -644,7 +670,7 @@ util_blit_pixels_tex(struct blit_state *ctx, /* set misc state we care about */ cso_set_blend(ctx->cso, &ctx->blend); - cso_set_depth_stencil_alpha(ctx->cso, &ctx->depthstencil); + cso_set_depth_stencil_alpha(ctx->cso, &ctx->depthstencil_keep); cso_set_rasterizer(ctx->cso, &ctx->rasterizer); cso_set_clip(ctx->cso, &ctx->clip); cso_set_vertex_elements(ctx->cso, 2, ctx->velem); -- cgit v1.2.3 From cfc4d866566c5b2d584cdc998e6540733190ea05 Mon Sep 17 00:00:00 2001 From: Marek Olšák Date: Sat, 14 Aug 2010 08:47:34 -0700 Subject: st/mesa: implement depth-only blit for BlitFramebuffer Signed-off-by: Brian Paul --- src/mesa/state_tracker/st_cb_blit.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/mesa/state_tracker/st_cb_blit.c b/src/mesa/state_tracker/st_cb_blit.c index b3c754477a..536748402f 100644 --- a/src/mesa/state_tracker/st_cb_blit.c +++ b/src/mesa/state_tracker/st_cb_blit.c @@ -188,8 +188,13 @@ st_BlitFramebuffer(GLcontext *ctx, /* blitting depth and stencil separately */ if (mask & GL_DEPTH_BUFFER_BIT) { - /* blit Z only */ - _mesa_problem(ctx, "st_BlitFramebuffer(DEPTH) not completed"); + util_blit_pixels(st->blit, srcDepthRb->texture, + u_subresource(srcDepthRb->surface->face, + srcDepthRb->surface->level), + srcX0, srcY0, srcX1, srcY1, + srcDepthRb->surface->zslice, + dstDepthSurf, dstX0, dstY0, dstX1, dstY1, + 0.0, pFilter); } if (mask & GL_STENCIL_BUFFER_BIT) { -- cgit v1.2.3 From 8a537b2fb856d27f49235d9f5684901f1213214c Mon Sep 17 00:00:00 2001 From: Zhenyu Wang Date: Mon, 23 Aug 2010 10:16:45 +0800 Subject: i965: Add sandybridge D0 pci ids Signed-off-by: Zhenyu Wang --- src/mesa/drivers/dri/intel/intel_chipset.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/intel/intel_chipset.h b/src/mesa/drivers/dri/intel/intel_chipset.h index 72a74322ee..b5f180bbc8 100644 --- a/src/mesa/drivers/dri/intel/intel_chipset.h +++ b/src/mesa/drivers/dri/intel/intel_chipset.h @@ -73,6 +73,7 @@ #define PCI_CHIP_SANDYBRIDGE 0x0102 #define PCI_CHIP_SANDYBRIDGE_M 0x0106 +#define PCI_CHIP_SANDYBRIDGE_M_D0 0x0126 #define IS_MOBILE(devid) (devid == PCI_CHIP_I855_GM || \ devid == PCI_CHIP_I915_GM || \ @@ -119,7 +120,8 @@ #define IS_IRONLAKE(devid) IS_GEN5(devid) #define IS_GEN6(devid) (devid == PCI_CHIP_SANDYBRIDGE || \ - devid == PCI_CHIP_SANDYBRIDGE_M) + devid == PCI_CHIP_SANDYBRIDGE_M || \ + devid == PCI_CHIP_SANDYBRIDGE_M_D0) #define IS_965(devid) (IS_GEN4(devid) || \ IS_G4X(devid) || \ -- cgit v1.2.3 From 0c878280506767c38887b71b45af2cb64a0f4abd Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Sat, 21 Aug 2010 18:20:39 +0800 Subject: mesa: Assorted fixes for es_generator.py on win32. Fix mixed use of GL_APIENTRY and GLAPIENTRY. Parameter list of a function prototype should never be empty. --- src/mesa/main/es_generator.py | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src') diff --git a/src/mesa/main/es_generator.py b/src/mesa/main/es_generator.py index c1fe2401c4..ecb34bb5cd 100644 --- a/src/mesa/main/es_generator.py +++ b/src/mesa/main/es_generator.py @@ -215,6 +215,10 @@ extern void _mesa_error(void *ctx, GLenum error, const char *fmtString, ... ); #ifdef IN_DRI_DRIVER #define _GLAPI_USE_REMAP_TABLE #endif +/* glapi uses GLAPIENTRY while GLES headers define GL_APIENTRY */ +#ifndef GLAPIENTRY +#define GLAPIENTRY GL_APIENTRY +#endif #include "%sapi/glapi/glapitable.h" #include "%sapi/glapi/glapioffsets.h" #include "%sapi/glapi/glapidispatch.h" @@ -603,6 +607,8 @@ for funcName in keys: # are complete; remove the extra ", " at the front of each. passthroughDeclarationString = passthroughDeclarationString[2:] passthroughCallString = passthroughCallString[2:] + if not passthroughDeclarationString: + passthroughDeclarationString = "void" # The Mesa functions are scattered across all the Mesa # header files. The easiest way to manage declarations -- cgit v1.2.3 From e607b67ebc0d15f6709fc8f9c79afeeda8ac1031 Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Mon, 23 Aug 2010 16:13:12 +0800 Subject: glapi: Clean up header inclusions. Do not rely on PUBLIC being defined in glapi.h. Do not include core mesa headers. --- src/mapi/glapi/glapi.h | 21 ++++++++++++++++++++- src/mapi/glapi/glapi_dispatch.c | 11 +---------- src/mapi/glapi/glapi_entrypoint.c | 9 --------- src/mapi/glapi/glapi_getproc.c | 9 --------- src/mapi/glapi/glapi_nop.c | 10 +--------- src/mapi/glapi/glapi_priv.h | 25 +++++++++++++++++++++++-- 6 files changed, 45 insertions(+), 40 deletions(-) (limited to 'src') diff --git a/src/mapi/glapi/glapi.h b/src/mapi/glapi/glapi.h index 1f18bf00fd..a0bb078106 100644 --- a/src/mapi/glapi/glapi.h +++ b/src/mapi/glapi/glapi.h @@ -45,7 +45,26 @@ #define _GLAPI_H -#define _GLAPI_EXPORT PUBLIC +/* opengl.dll does not export _glapi_* */ +#if defined(_WIN32) +#define _GLAPI_NO_EXPORTS +#endif + +#ifdef _GLAPI_NO_EXPORTS +# define _GLAPI_EXPORT +#else /* _GLAPI_NO_EXPORTS */ +# ifdef _WIN32 +# ifdef _GLAPI_DLL_EXPORTS +# define _GLAPI_EXPORT __declspec(dllexport) +# else +# define _GLAPI_EXPORT __declspec(dllimport) +# endif +# elif defined(__GNUC__) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590)) +# define _GLAPI_EXPORT __attribute__((visibility("default"))) +# else +# define _GLAPI_EXPORT +# endif +#endif /* _GLAPI_NO_EXPORTS */ /* Is this needed? It is incomplete anyway. */ diff --git a/src/mapi/glapi/glapi_dispatch.c b/src/mapi/glapi/glapi_dispatch.c index ae59140ad3..7421a36d35 100644 --- a/src/mapi/glapi/glapi_dispatch.c +++ b/src/mapi/glapi/glapi_dispatch.c @@ -37,18 +37,9 @@ * \author Brian Paul */ -#ifdef HAVE_DIX_CONFIG_H -#include -#include "glapi/mesa.h" -#else -#include "main/glheader.h" -#include "main/compiler.h" -#endif - -#include "glapi/glapi.h" +#include "glapi/glapi_priv.h" #include "glapi/glapitable.h" #include "glapi/glapidispatch.h" -#include "glapi/glthread.h" #if !(defined(USE_X86_ASM) || defined(USE_X86_64_ASM) || defined(USE_SPARC_ASM)) diff --git a/src/mapi/glapi/glapi_entrypoint.c b/src/mapi/glapi/glapi_entrypoint.c index 82c68c27c8..993ccb94c2 100644 --- a/src/mapi/glapi/glapi_entrypoint.c +++ b/src/mapi/glapi/glapi_entrypoint.c @@ -29,15 +29,6 @@ */ -#ifdef HAVE_DIX_CONFIG_H -#include -#include "glapi/mesa.h" -#else -#include "main/glheader.h" -#include "main/compiler.h" -#endif - -#include "glapi/glapi.h" #include "glapi/glapi_priv.h" #include "mapi/u_execmem.h" diff --git a/src/mapi/glapi/glapi_getproc.c b/src/mapi/glapi/glapi_getproc.c index 3c134f929d..dc4905b64e 100644 --- a/src/mapi/glapi/glapi_getproc.c +++ b/src/mapi/glapi/glapi_getproc.c @@ -30,15 +30,6 @@ */ -#ifdef HAVE_DIX_CONFIG_H -#include -#include "glapi/mesa.h" -#else -#include "main/glheader.h" -#include "main/compiler.h" -#endif - -#include "glapi/glapi.h" #include "glapi/glapi_priv.h" #include "glapi/glapitable.h" #include "glapi/glapioffsets.h" diff --git a/src/mapi/glapi/glapi_nop.c b/src/mapi/glapi/glapi_nop.c index df46ca8c89..9b09297150 100644 --- a/src/mapi/glapi/glapi_nop.c +++ b/src/mapi/glapi/glapi_nop.c @@ -38,15 +38,7 @@ -#ifdef HAVE_DIX_CONFIG_H -#include -#include "glapi/mesa.h" -#else -#include "main/compiler.h" -#include "main/glheader.h" -#endif - -#include "glapi/glapi.h" +#include "glapi/glapi_priv.h" void diff --git a/src/mapi/glapi/glapi_priv.h b/src/mapi/glapi/glapi_priv.h index 1c2a704211..89f81c723e 100644 --- a/src/mapi/glapi/glapi_priv.h +++ b/src/mapi/glapi/glapi_priv.h @@ -26,9 +26,30 @@ #ifndef _GLAPI_PRIV_H #define _GLAPI_PRIV_H -#include "glthread.h" -#include "glapi.h" +#include +#include +#include + +#ifdef HAVE_DIX_CONFIG_H +#include +#include "glapi/mesa.h" +#else /* HAVE_DIX_CONFIG_H */ +#define GL_GLEXT_PROTOTYPES +#include "GL/gl.h" +#include "GL/glext.h" + +#ifndef GL_FIXED +typedef int GLfixed; +typedef int GLclampx; +#endif + +#ifndef GL_OES_EGL_image +typedef void *GLeglImageOES; +#endif + +#endif /* HAVE_DIX_CONFIG_H */ +#include "glapi/glapi.h" /* getproc */ -- cgit v1.2.3 From eb430b0e948caf02b9f4095d0e1435880073c2aa Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Mon, 23 Aug 2010 20:28:02 +1000 Subject: r300g: avoid stall in no-tcl drawing when mapping vbo the current code reuses the same vbo over and over, however after a flush we'd stall and wait for mapping on the vbo when we should just fire and forget. On a gears test this brings me from ~620 to ~750 on my rv530 in swtcl mode. Signed-off-by: Dave Airlie --- src/gallium/drivers/r300/r300_context.h | 4 ++++ src/gallium/drivers/r300/r300_flush.c | 2 ++ src/gallium/drivers/r300/r300_render.c | 35 +++++++++++++++++++-------------- 3 files changed, 26 insertions(+), 15 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_context.h b/src/gallium/drivers/r300/r300_context.h index 6fa7f470f9..030bb2314f 100644 --- a/src/gallium/drivers/r300/r300_context.h +++ b/src/gallium/drivers/r300/r300_context.h @@ -449,6 +449,7 @@ struct r300_context { struct r300_screen *screen; /* Draw module. Used mostly for SW TCL. */ struct draw_context* draw; + size_t draw_vbo_size; /* Accelerated blit support. */ struct blitter_context* blitter; /* Stencil two-sided reference value fallback. */ @@ -649,6 +650,9 @@ void r300_translate_index_buffer(struct r300_context *r300, /* r300_render_stencilref.c */ void r300_plug_in_stencil_ref_fallback(struct r300_context *r300); +/* r300 render */ +void r300_draw_flush_vbuf(struct r300_context *r300); + /* r300_state.c */ enum r300_fb_state_change { R300_CHANGED_FB_STATE = 0, diff --git a/src/gallium/drivers/r300/r300_flush.c b/src/gallium/drivers/r300/r300_flush.c index fe182b6615..f00707b066 100644 --- a/src/gallium/drivers/r300/r300_flush.c +++ b/src/gallium/drivers/r300/r300_flush.c @@ -43,6 +43,8 @@ static void r300_flush(struct pipe_context* pipe, u_upload_flush(r300->upload_vb); u_upload_flush(r300->upload_ib); + if (r300->draw) + r300_draw_flush_vbuf(r300); if (r300->dirty_hw) { r300_emit_hyperz_end(r300); r300_emit_query_end(r300); diff --git a/src/gallium/drivers/r300/r300_render.c b/src/gallium/drivers/r300/r300_render.c index 86b11ca045..73447057bb 100644 --- a/src/gallium/drivers/r300/r300_render.c +++ b/src/gallium/drivers/r300/r300_render.c @@ -726,8 +726,6 @@ struct r300_render { unsigned hwprim; /* VBO */ - struct pipe_resource* vbo; - size_t vbo_size; size_t vbo_offset; size_t vbo_max_used; void * vbo_ptr; @@ -759,31 +757,31 @@ static boolean r300_render_allocate_vertices(struct vbuf_render* render, struct pipe_screen* screen = r300->context.screen; size_t size = (size_t)vertex_size * (size_t)count; - if (size + r300render->vbo_offset > r300render->vbo_size) + if (size + r300render->vbo_offset > r300->draw_vbo_size) { - pipe_resource_reference(&r300->vbo, NULL); - r300render->vbo = pipe_buffer_create(screen, - PIPE_BIND_VERTEX_BUFFER, - R300_MAX_DRAW_VBO_SIZE); + pipe_resource_reference(&r300->vbo, NULL); + r300->vbo = pipe_buffer_create(screen, + PIPE_BIND_VERTEX_BUFFER, + R300_MAX_DRAW_VBO_SIZE); r300render->vbo_offset = 0; - r300render->vbo_size = R300_MAX_DRAW_VBO_SIZE; + r300->draw_vbo_size = R300_MAX_DRAW_VBO_SIZE; } r300render->vertex_size = vertex_size; - r300->vbo = r300render->vbo; r300->vbo_offset = r300render->vbo_offset; - return (r300render->vbo) ? TRUE : FALSE; + return (r300->vbo) ? TRUE : FALSE; } static void* r300_render_map_vertices(struct vbuf_render* render) { struct r300_render* r300render = r300_render(render); + struct r300_context* r300 = r300render->r300; assert(!r300render->vbo_transfer); r300render->vbo_ptr = pipe_buffer_map(&r300render->r300->context, - r300render->vbo, + r300->vbo, PIPE_TRANSFER_WRITE, &r300render->vbo_transfer); @@ -798,12 +796,13 @@ static void r300_render_unmap_vertices(struct vbuf_render* render, { struct r300_render* r300render = r300_render(render); struct pipe_context* context = &r300render->r300->context; + struct r300_context* r300 = r300render->r300; assert(r300render->vbo_transfer); r300render->vbo_max_used = MAX2(r300render->vbo_max_used, r300render->vertex_size * (max + 1)); - pipe_buffer_unmap(context, r300render->vbo, r300render->vbo_transfer); + pipe_buffer_unmap(context, r300->vbo, r300render->vbo_transfer); r300render->vbo_transfer = NULL; } @@ -880,7 +879,7 @@ static void r300_render_draw_elements(struct vbuf_render* render, struct r300_context* r300 = r300render->r300; int i; unsigned end_cs_dwords; - unsigned max_index = (r300render->vbo_size - r300render->vbo_offset) / + unsigned max_index = (r300->draw_vbo_size - r300render->vbo_offset) / (r300render->r300->vertex_info.size * 4) - 1; unsigned short_count; unsigned free_dwords; @@ -956,8 +955,6 @@ static struct vbuf_render* r300_render_create(struct r300_context* r300) r300render->base.release_vertices = r300_render_release_vertices; r300render->base.destroy = r300_render_destroy; - r300render->vbo = NULL; - r300render->vbo_size = 0; r300render->vbo_offset = 0; return &r300render->base; @@ -986,6 +983,14 @@ struct draw_stage* r300_draw_stage(struct r300_context* r300) return stage; } +void r300_draw_flush_vbuf(struct r300_context *r300) +{ + struct r300_render *r300render; + + pipe_resource_reference(&r300->vbo, NULL); + r300->draw_vbo_size = 0; +} + /**************************************************************************** * End of SW TCL functions * ***************************************************************************/ -- cgit v1.2.3 From bfaa2577c6474222c79341c0d90685ed579f3414 Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Mon, 23 Aug 2010 00:31:08 +0200 Subject: nvfx: support clip planes sensibly and fix them on nv30 Before, we were discarding the compiled vertex program on each vertex program change. Now we compile the program as if there were 6 clip planes and dynamically patch in an "end program" bit at the right place. Also, nv30 should now work. --- src/gallium/auxiliary/util/u_dynarray.h | 3 + src/gallium/drivers/nvfx/nv30_vertprog.h | 5 +- src/gallium/drivers/nvfx/nvfx_context.c | 4 + src/gallium/drivers/nvfx/nvfx_context.h | 1 + src/gallium/drivers/nvfx/nvfx_fragprog.c | 13 --- src/gallium/drivers/nvfx/nvfx_state.h | 4 +- src/gallium/drivers/nvfx/nvfx_state_emit.c | 82 ++++++++++++++ src/gallium/drivers/nvfx/nvfx_vertprog.c | 170 ++++++++++++----------------- 8 files changed, 166 insertions(+), 116 deletions(-) (limited to 'src') diff --git a/src/gallium/auxiliary/util/u_dynarray.h b/src/gallium/auxiliary/util/u_dynarray.h index 9d1c1713a7..980cadf22d 100644 --- a/src/gallium/auxiliary/util/u_dynarray.h +++ b/src/gallium/auxiliary/util/u_dynarray.h @@ -106,6 +106,9 @@ util_dynarray_trim(struct util_dynarray *buf) #define util_dynarray_pop_ptr(buf, type) (type*)((char*)(buf)->data + ((buf)->size -= sizeof(type))) #define util_dynarray_pop(buf, type) *util_dynarray_pop_ptr(buf, type) #define util_dynarray_contains(buf, type) ((buf)->size >= sizeof(type)) +#define util_dynarray_element(buf, type, idx) ((type*)(buf)->data + (idx)) +#define util_dynarray_begin(buf) ((buf)->data) +#define util_dynarray_end(buf) ((void*)util_dynarray_element((buf), char, (buf)->size)) #endif /* U_DYNARRAY_H */ diff --git a/src/gallium/drivers/nvfx/nv30_vertprog.h b/src/gallium/drivers/nvfx/nv30_vertprog.h index df92469078..9a68f5c1fb 100644 --- a/src/gallium/drivers/nvfx/nv30_vertprog.h +++ b/src/gallium/drivers/nvfx/nv30_vertprog.h @@ -125,7 +125,7 @@ #define NV30_VP_INST_VDEST_WRITEMASK_SHIFT 12 /*NV20*/ #define NV30_VP_INST_VDEST_WRITEMASK_MASK (0x0F << 12) /*NV20*/ #define NV30_VP_INST_DEST_SHIFT 2 -#define NV30_VP_INST_DEST_MASK (0x0F << 2) +#define NV30_VP_INST_DEST_MASK (0x1F << 2) # define NV30_VP_INST_DEST_POS 0 # define NV30_VP_INST_DEST_BFC0 1 # define NV30_VP_INST_DEST_BFC1 2 @@ -133,7 +133,8 @@ # define NV30_VP_INST_DEST_COL1 4 # define NV30_VP_INST_DEST_FOGC 5 # define NV30_VP_INST_DEST_PSZ 6 -# define NV30_VP_INST_DEST_TC(n) (8+n) +# define NV30_VP_INST_DEST_TC(n) (8+(n)) +# define NV30_VP_INST_DEST_CLP(n) (17 + (n)) /* Useful to split the source selection regs into their pieces */ #define NV30_VP_SRC0_HIGH_SHIFT 6 diff --git a/src/gallium/drivers/nvfx/nvfx_context.c b/src/gallium/drivers/nvfx/nvfx_context.c index 80b36fb7b9..2f775f92cf 100644 --- a/src/gallium/drivers/nvfx/nvfx_context.c +++ b/src/gallium/drivers/nvfx/nvfx_context.c @@ -75,6 +75,10 @@ nvfx_create(struct pipe_screen *pscreen, void *priv) screen->base.channel->user_private = nvfx; nvfx->is_nv4x = screen->is_nv4x; + /* TODO: it seems that nv30 might have fixed function clipping usable with vertex programs + * However, my code for that doesn't work, so use vp clipping for all cards, which works. + */ + nvfx->use_vp_clipping = TRUE; nvfx_init_query_functions(nvfx); nvfx_init_surface_functions(nvfx); diff --git a/src/gallium/drivers/nvfx/nvfx_context.h b/src/gallium/drivers/nvfx/nvfx_context.h index 2134f3c386..680f4c6ce0 100644 --- a/src/gallium/drivers/nvfx/nvfx_context.h +++ b/src/gallium/drivers/nvfx/nvfx_context.h @@ -134,6 +134,7 @@ struct nvfx_context { struct nvfx_screen *screen; unsigned is_nv4x; /* either 0 or ~0 */ + boolean use_vp_clipping; struct draw_context *draw; struct blitter_context* blitter; diff --git a/src/gallium/drivers/nvfx/nvfx_fragprog.c b/src/gallium/drivers/nvfx/nvfx_fragprog.c index a7e43b1513..23a85c9342 100644 --- a/src/gallium/drivers/nvfx/nvfx_fragprog.c +++ b/src/gallium/drivers/nvfx/nvfx_fragprog.c @@ -1468,19 +1468,6 @@ update: nvfx->hw_pointsprite_control = pointsprite_control; } } - - if(nvfx->is_nv4x) - { - unsigned vp_output = vp->or | fp->or; - - if(vp_output != nvfx->hw_vp_output) - { - WAIT_RING(chan, 2); - OUT_RING(chan, RING_3D(NV40TCL_VP_RESULT_EN, 1)); - OUT_RING(chan, vp_output); - nvfx->hw_vp_output = vp_output; - } - } } void diff --git a/src/gallium/drivers/nvfx/nvfx_state.h b/src/gallium/drivers/nvfx/nvfx_state.h index 3795191918..e9c1f2c26d 100644 --- a/src/gallium/drivers/nvfx/nvfx_state.h +++ b/src/gallium/drivers/nvfx/nvfx_state.h @@ -24,8 +24,6 @@ struct nvfx_vertex_program { boolean translated; - struct pipe_clip_state ucp; - struct nvfx_vertex_program_exec *insns; unsigned nr_insns; struct nvfx_vertex_program_data *consts; @@ -42,7 +40,7 @@ struct nvfx_vertex_program { uint32_t ir; uint32_t or; - uint32_t clip_ctrl; + int clip_nr; struct util_dynarray branch_relocs; struct util_dynarray const_relocs; diff --git a/src/gallium/drivers/nvfx/nvfx_state_emit.c b/src/gallium/drivers/nvfx/nvfx_state_emit.c index bd89a385d7..c43a75aaa2 100644 --- a/src/gallium/drivers/nvfx/nvfx_state_emit.c +++ b/src/gallium/drivers/nvfx/nvfx_state_emit.c @@ -90,6 +90,74 @@ nvfx_state_validate_common(struct nvfx_context *nvfx) if(dirty & NVFX_NEW_STIPPLE) nvfx_state_stipple_validate(nvfx); + if(nvfx->dirty & NVFX_NEW_UCP) + { + unsigned enables[7] = + { + 0, + NV34TCL_VP_CLIP_PLANES_ENABLE_PLANE0, + NV34TCL_VP_CLIP_PLANES_ENABLE_PLANE0 | NV34TCL_VP_CLIP_PLANES_ENABLE_PLANE1, + NV34TCL_VP_CLIP_PLANES_ENABLE_PLANE0 | NV34TCL_VP_CLIP_PLANES_ENABLE_PLANE1 | NV34TCL_VP_CLIP_PLANES_ENABLE_PLANE2, + NV34TCL_VP_CLIP_PLANES_ENABLE_PLANE0 | NV34TCL_VP_CLIP_PLANES_ENABLE_PLANE1 | NV34TCL_VP_CLIP_PLANES_ENABLE_PLANE2 | NV34TCL_VP_CLIP_PLANES_ENABLE_PLANE3, + NV34TCL_VP_CLIP_PLANES_ENABLE_PLANE0 | NV34TCL_VP_CLIP_PLANES_ENABLE_PLANE1 | NV34TCL_VP_CLIP_PLANES_ENABLE_PLANE2 | NV34TCL_VP_CLIP_PLANES_ENABLE_PLANE3 | NV34TCL_VP_CLIP_PLANES_ENABLE_PLANE4, + NV34TCL_VP_CLIP_PLANES_ENABLE_PLANE0 | NV34TCL_VP_CLIP_PLANES_ENABLE_PLANE1 | NV34TCL_VP_CLIP_PLANES_ENABLE_PLANE2 | NV34TCL_VP_CLIP_PLANES_ENABLE_PLANE3 | NV34TCL_VP_CLIP_PLANES_ENABLE_PLANE4 | NV34TCL_VP_CLIP_PLANES_ENABLE_PLANE5, + }; + + if(!nvfx->use_vp_clipping) + { + WAIT_RING(chan, 2); + OUT_RING(chan, RING_3D(NV34TCL_VP_CLIP_PLANES_ENABLE, 1)); + OUT_RING(chan, 0); + + WAIT_RING(chan, 6 * 4 + 1); + OUT_RING(chan, RING_3D(NV34TCL_VP_CLIP_PLANE_A(0), nvfx->clip.nr * 4)); + OUT_RINGp(chan, &nvfx->clip.ucp[0][0], nvfx->clip.nr * 4); + } + + WAIT_RING(chan, 2); + OUT_RING(chan, RING_3D(NV34TCL_VP_CLIP_PLANES_ENABLE, 1)); + OUT_RING(chan, enables[nvfx->clip.nr]); + } + + if(nvfx->use_vp_clipping && (nvfx->dirty & (NVFX_NEW_UCP | NVFX_NEW_VERTPROG))) + { + unsigned i; + struct nvfx_vertex_program* vp = nvfx->vertprog; + if(nvfx->clip.nr != vp->clip_nr) + { + unsigned idx; + WAIT_RING(chan, 14); + + /* remove last instruction bit */ + if(vp->clip_nr >= 0) + { + idx = vp->nr_insns - 7 + vp->clip_nr; + OUT_RING(chan, RING_3D(NV34TCL_VP_UPLOAD_FROM_ID, 1)); + OUT_RING(chan, vp->exec->start + idx); + OUT_RING(chan, RING_3D(NV34TCL_VP_UPLOAD_INST(0), 4)); + OUT_RINGp (chan, vp->insns[idx].data, 4); + } + + /* set last instruction bit */ + idx = vp->nr_insns - 7 + nvfx->clip.nr; + OUT_RING(chan, RING_3D(NV34TCL_VP_UPLOAD_FROM_ID, 1)); + OUT_RING(chan, vp->exec->start + idx); + OUT_RING(chan, RING_3D(NV34TCL_VP_UPLOAD_INST(0), 4)); + OUT_RINGp(chan, vp->insns[idx].data, 3); + OUT_RING(chan, vp->insns[idx].data[3] | 1); + vp->clip_nr = nvfx->clip.nr; + } + + // TODO: only do this for the ones changed + WAIT_RING(chan, 6 * 6); + for(i = 0; i < nvfx->clip.nr; ++i) + { + OUT_RING(chan, RING_3D(NV34TCL_VP_UPLOAD_CONST_ID, 5)); + OUT_RING(chan, vp->data->start + i); + OUT_RINGp (chan, nvfx->clip.ucp[i], 4); + } + } + if(dirty & (NVFX_NEW_FRAGPROG | NVFX_NEW_FRAGCONST | NVFX_NEW_VERTPROG | NVFX_NEW_SPRITE)) { nvfx_fragprog_validate(nvfx); @@ -97,6 +165,20 @@ nvfx_state_validate_common(struct nvfx_context *nvfx) flush_tex_cache = TRUE; // TODO: do we need this? } + if(nvfx->is_nv4x) + { + unsigned vp_output = nvfx->vertprog->or | nvfx->hw_fragprog->or; + vp_output |= (1 << (nvfx->clip.nr + 6)) - (1 << 6); + + if(vp_output != nvfx->hw_vp_output) + { + WAIT_RING(chan, 2); + OUT_RING(chan, RING_3D(NV40TCL_VP_RESULT_EN, 1)); + OUT_RING(chan, vp_output); + nvfx->hw_vp_output = vp_output; + } + } + if(all_swizzled >= 0) nvfx_framebuffer_validate(nvfx, all_swizzled); diff --git a/src/gallium/drivers/nvfx/nvfx_vertprog.c b/src/gallium/drivers/nvfx/nvfx_vertprog.c index 3b8d3853b7..ea7e88c561 100644 --- a/src/gallium/drivers/nvfx/nvfx_vertprog.c +++ b/src/gallium/drivers/nvfx/nvfx_vertprog.c @@ -29,8 +29,6 @@ #include "nv30_vertprog.h" #include "nv40_vertprog.h" -#define NVFX_VP_INST_DEST_CLIP(n) ((~0 - 6) + (n)) - struct nvfx_loop_entry { unsigned brk_target; @@ -205,52 +203,33 @@ emit_dst(struct nvfx_context* nvfx, struct nvfx_vpc *vpc, uint32_t *hw, int slot break; case NVFXSR_OUTPUT: /* TODO: this may be wrong because on nv30 COL0 and BFC0 are swapped */ - switch (dst.index) { - case NVFX_VP_INST_DEST_CLIP(0): - vp->or |= (1 << 6); - vp->clip_ctrl |= NV34TCL_VP_CLIP_PLANES_ENABLE_PLANE0; - dst.index = NVFX_VP(INST_DEST_FOGC); - break; - case NVFX_VP_INST_DEST_CLIP(1): - vp->or |= (1 << 7); - vp->clip_ctrl |= NV34TCL_VP_CLIP_PLANES_ENABLE_PLANE1; - dst.index = NVFX_VP(INST_DEST_FOGC); - break; - case NVFX_VP_INST_DEST_CLIP(2): - vp->or |= (1 << 8); - vp->clip_ctrl |= NV34TCL_VP_CLIP_PLANES_ENABLE_PLANE2; - dst.index = NVFX_VP(INST_DEST_FOGC); - break; - case NVFX_VP_INST_DEST_CLIP(3): - vp->or |= (1 << 9); - vp->clip_ctrl |= NV34TCL_VP_CLIP_PLANES_ENABLE_PLANE3; - dst.index = NVFX_VP(INST_DEST_PSZ); - break; - case NVFX_VP_INST_DEST_CLIP(4): - vp->or |= (1 << 10); - vp->clip_ctrl |= NV34TCL_VP_CLIP_PLANES_ENABLE_PLANE4; - dst.index = NVFX_VP(INST_DEST_PSZ); - break; - case NVFX_VP_INST_DEST_CLIP(5): - vp->or |= (1 << 11); - vp->clip_ctrl |= NV34TCL_VP_CLIP_PLANES_ENABLE_PLANE5; - dst.index = NVFX_VP(INST_DEST_PSZ); - break; - default: - if(nvfx->is_nv4x) { - /* we don't need vp->or on nv3x - * texcoords are handled by fragment program - */ - switch (dst.index) { - case NV40_VP_INST_DEST_COL0 : vp->or |= (1 << 0); break; - case NV40_VP_INST_DEST_COL1 : vp->or |= (1 << 1); break; - case NV40_VP_INST_DEST_BFC0 : vp->or |= (1 << 2); break; - case NV40_VP_INST_DEST_BFC1 : vp->or |= (1 << 3); break; - case NV40_VP_INST_DEST_FOGC: vp->or |= (1 << 4); break; - case NV40_VP_INST_DEST_PSZ : vp->or |= (1 << 5); break; - } + if(nvfx->is_nv4x) { + switch (dst.index) { + case NV30_VP_INST_DEST_CLP(0): + dst.index = NVFX_VP(INST_DEST_FOGC); + break; + case NV30_VP_INST_DEST_CLP(1): + dst.index = NVFX_VP(INST_DEST_FOGC); + break; + case NV30_VP_INST_DEST_CLP(2): + dst.index = NVFX_VP(INST_DEST_FOGC); + break; + case NV30_VP_INST_DEST_CLP(3): + dst.index = NVFX_VP(INST_DEST_PSZ); + break; + case NV30_VP_INST_DEST_CLP(4): + dst.index = NVFX_VP(INST_DEST_PSZ); + break; + case NV30_VP_INST_DEST_CLP(5): + dst.index = NVFX_VP(INST_DEST_PSZ); + break; + case NV40_VP_INST_DEST_COL0 : vp->or |= (1 << 0); break; + case NV40_VP_INST_DEST_COL1 : vp->or |= (1 << 1); break; + case NV40_VP_INST_DEST_BFC0 : vp->or |= (1 << 2); break; + case NV40_VP_INST_DEST_BFC1 : vp->or |= (1 << 3); break; + case NV40_VP_INST_DEST_FOGC: vp->or |= (1 << 4); break; + case NV40_VP_INST_DEST_PSZ : vp->or |= (1 << 5); break; } - break; } if(!nvfx->is_nv4x) { @@ -914,6 +893,13 @@ nvfx_vertprog_translate(struct nvfx_context *nvfx, vpc->nvfx = nvfx; vpc->vp = vp; + /* reserve space for ucps */ + if(nvfx->use_vp_clipping) + { + for(i = 0; i < 6; ++i) + constant(vpc, -1, 0, 0, 0, 0); + } + if (!nvfx_vertprog_prepare(nvfx, vpc)) { FREE(vpc); return; @@ -923,7 +909,8 @@ nvfx_vertprog_translate(struct nvfx_context *nvfx, * planes are enabled. We need to append code to the vtxprog * to handle clip planes later. */ - if (vp->ucp.nr) { + /* TODO: maybe support patching this depending on whether there are ucps: not sure if it is really matters much */ + if (nvfx->use_vp_clipping) { vpc->r_result[vpc->hpos_idx] = temp(vpc); vpc->r_temps_discard = 0; } @@ -994,34 +981,39 @@ nvfx_vertprog_translate(struct nvfx_context *nvfx, } /* Insert code to handle user clip planes */ - for (i = 0; i < vp->ucp.nr; i++) { - struct nvfx_reg cdst = nvfx_reg(NVFXSR_OUTPUT, - NVFX_VP_INST_DEST_CLIP(i)); - struct nvfx_src ceqn = nvfx_src(constant(vpc, -1, - nvfx->clip.ucp[i][0], - nvfx->clip.ucp[i][1], - nvfx->clip.ucp[i][2], - nvfx->clip.ucp[i][3])); - struct nvfx_src htmp = nvfx_src(vpc->r_result[vpc->hpos_idx]); - unsigned mask; + if(nvfx->use_vp_clipping) + { + for (i = 0; i < 6; i++) { + struct nvfx_reg cdst = nvfx_reg(NVFXSR_OUTPUT, NV30_VP_INST_DEST_CLP(i)); + struct nvfx_src ceqn = nvfx_src(nvfx_reg(NVFXSR_CONST, i)); + struct nvfx_src htmp = nvfx_src(vpc->r_result[vpc->hpos_idx]); + unsigned mask; - switch (i) { - case 0: case 3: mask = NVFX_VP_MASK_Y; break; - case 1: case 4: mask = NVFX_VP_MASK_Z; break; - case 2: case 5: mask = NVFX_VP_MASK_W; break; - default: - NOUVEAU_ERR("invalid clip dist #%d\n", i); - goto out_err; - } + if(nvfx->is_nv4x) + { + switch (i) { + case 0: case 3: mask = NVFX_VP_MASK_Y; break; + case 1: case 4: mask = NVFX_VP_MASK_Z; break; + case 2: case 5: mask = NVFX_VP_MASK_W; break; + default: + NOUVEAU_ERR("invalid clip dist #%d\n", i); + goto out_err; + } + } + else + mask = NVFX_VP_MASK_X; - nvfx_vp_emit(vpc, arith(VEC, DP4, cdst, mask, htmp, ceqn, none)); + nvfx_vp_emit(vpc, arith(VEC, DP4, cdst, mask, htmp, ceqn, none)); + } } + else + { + if(vp->nr_insns) + vp->insns[vp->nr_insns - 1].data[3] |= NVFX_VP_INST_LAST; - //vp->insns[vp->nr_insns - 1].data[3] |= NVFX_VP_INST_LAST; - - /* Append NOP + END instruction for branches to the end of the program */ - nvfx_vp_emit(vpc, arith(VEC, NOP, none.reg, 0, none, none, none)); - vp->insns[vp->nr_insns - 1].data[3] |= NVFX_VP_INST_LAST | 0x1000; + nvfx_vp_emit(vpc, arith(VEC, NOP, none.reg, 0, none, none, none)); + vp->insns[vp->nr_insns - 1].data[3] |= NVFX_VP_INST_LAST; + } if(debug_get_option_nvfx_dump_vp()) { @@ -1034,6 +1026,7 @@ nvfx_vertprog_translate(struct nvfx_context *nvfx, debug_printf("\n"); } + vp->clip_nr = -1; vp->exec_start = -1; vp->translated = TRUE; out_err: @@ -1063,13 +1056,6 @@ nvfx_vertprog_validate(struct nvfx_context *nvfx) if (nvfx->render_mode == HW) { vp = nvfx->vertprog; constbuf = nvfx->constbuf[PIPE_SHADER_VERTEX]; - - // TODO: ouch! can't we just use constant slots for these?! - if ((nvfx->dirty & NVFX_NEW_UCP) || - memcmp(&nvfx->clip, &vp->ucp, sizeof(vp->ucp))) { - nvfx_vertprog_destroy(nvfx, vp); - memcpy(&vp->ucp, &nvfx->clip, sizeof(vp->ucp)); - } } else { vp = nvfx->swtnl.vertprog; constbuf = NULL; @@ -1169,7 +1155,7 @@ nvfx_vertprog_validate(struct nvfx_context *nvfx) vp->exec_start = vp->exec->start; } - if (vp->nr_consts && vp->data_start != vp->data->start) { + if (vp->data_start != vp->data->start) { for(unsigned i = 0; i < vp->const_relocs.size; i += sizeof(struct nvfx_relocation)) { struct nvfx_relocation* reloc = (struct nvfx_relocation*)((char*)vp->const_relocs.data + i); @@ -1182,6 +1168,7 @@ nvfx_vertprog_validate(struct nvfx_context *nvfx) } vp->data_start = vp->data->start; + upload_code = TRUE; } /* Update + Upload constant values */ @@ -1191,7 +1178,7 @@ nvfx_vertprog_validate(struct nvfx_context *nvfx) if (constbuf) map = (float*)nvfx_buffer(constbuf)->data; - for (i = 0; i < vp->nr_consts; i++) { + for (i = nvfx->use_vp_clipping ? 6 : 0; i < vp->nr_consts; i++) { struct nvfx_vertex_program_data *vpd = &vp->consts[i]; if (vpd->index >= 0) { @@ -1217,9 +1204,10 @@ nvfx_vertprog_validate(struct nvfx_context *nvfx) BEGIN_RING(chan, eng3d, NV34TCL_VP_UPLOAD_INST(0), 4); OUT_RINGp (chan, vp->insns[i].data, 4); } + vp->clip_nr = -1; } - if(nvfx->dirty & (NVFX_NEW_VERTPROG | NVFX_NEW_UCP)) + if(nvfx->dirty & (NVFX_NEW_VERTPROG)) { WAIT_RING(chan, 6); OUT_RING(chan, RING_3D(NV34TCL_VP_START_FROM_ID, 1)); @@ -1228,8 +1216,6 @@ nvfx_vertprog_validate(struct nvfx_context *nvfx) OUT_RING(chan, RING_3D(NV40TCL_VP_ATTRIB_EN, 1)); OUT_RING(chan, vp->ir); } - OUT_RING(chan, RING_3D(NV34TCL_VP_CLIP_PLANES_ENABLE, 1)); - OUT_RING(chan, vp->clip_ctrl); } return TRUE; @@ -1238,27 +1224,15 @@ nvfx_vertprog_validate(struct nvfx_context *nvfx) void nvfx_vertprog_destroy(struct nvfx_context *nvfx, struct nvfx_vertex_program *vp) { - vp->translated = FALSE; - - if (vp->nr_insns) { + if (vp->nr_insns) FREE(vp->insns); - vp->insns = NULL; - vp->nr_insns = 0; - } - if (vp->nr_consts) { + if (vp->nr_consts) FREE(vp->consts); - vp->consts = NULL; - vp->nr_consts = 0; - } nouveau_resource_free(&vp->exec); - vp->exec_start = 0; nouveau_resource_free(&vp->data); - vp->data_start = 0; - vp->data_start_min = 0; - vp->ir = vp->or = vp->clip_ctrl = 0; util_dynarray_fini(&vp->branch_relocs); util_dynarray_fini(&vp->const_relocs); } -- cgit v1.2.3 From 2e215bc28f71d6b556ba65e6c4e26654782e1844 Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Mon, 23 Aug 2010 15:20:31 +0200 Subject: nvfx: match Gallium's gl_PointCoord brokenness Gallium always puts gl_PointCoord in GENERIC[0] if point_quad_rasterization is enabled. This is silly, but for now it makes mesa-demos/glsl/pointcoord work. --- src/gallium/drivers/nvfx/nvfx_fragprog.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/nvfx/nvfx_fragprog.c b/src/gallium/drivers/nvfx/nvfx_fragprog.c index 23a85c9342..049b814d49 100644 --- a/src/gallium/drivers/nvfx/nvfx_fragprog.c +++ b/src/gallium/drivers/nvfx/nvfx_fragprog.c @@ -1181,8 +1181,11 @@ nvfx_fragprog_validate(struct nvfx_context *nvfx) struct nouveau_channel* chan = nvfx->screen->base.channel; struct nvfx_pipe_fragment_program *pfp = nvfx->fragprog; struct nvfx_vertex_program* vp; - unsigned sprite_coord_enable = nvfx->rasterizer->pipe.point_quad_rasterization * nvfx->rasterizer->pipe.sprite_coord_enable; - // TODO: correct or flipped? + /* Gallium always puts the point coord in GENERIC[0] + * TODO: this is wrong, Gallium needs to be fixed + */ + unsigned sprite_coord_enable = nvfx->rasterizer->pipe.point_quad_rasterization * (nvfx->rasterizer->pipe.sprite_coord_enable | 1); + boolean emulate_sprite_flipping = sprite_coord_enable && nvfx->rasterizer->pipe.sprite_coord_mode; unsigned key = emulate_sprite_flipping; struct nvfx_fragment_program* fp; -- cgit v1.2.3 From ea709696185846c876581e1c41a21921826823ec Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 23 Aug 2010 07:05:07 -0700 Subject: glsl2: Add missing sig_iter.next() to the no-constant-folding-to-outvals fix. --- src/glsl/ir_constant_folding.cpp | 1 + src/glsl/ir_tree_grafting.cpp | 1 + 2 files changed, 2 insertions(+) (limited to 'src') diff --git a/src/glsl/ir_constant_folding.cpp b/src/glsl/ir_constant_folding.cpp index 5d77093852..3e6934c9a7 100644 --- a/src/glsl/ir_constant_folding.cpp +++ b/src/glsl/ir_constant_folding.cpp @@ -117,6 +117,7 @@ ir_constant_folding_visitor::visit_enter(ir_call *ir) param_rval->replace_with(new_param); } } + sig_iter.next(); } return visit_continue_with_parent; diff --git a/src/glsl/ir_tree_grafting.cpp b/src/glsl/ir_tree_grafting.cpp index 748dcecefc..9b569b8284 100644 --- a/src/glsl/ir_tree_grafting.cpp +++ b/src/glsl/ir_tree_grafting.cpp @@ -202,6 +202,7 @@ ir_tree_grafting_visitor::visit_enter(ir_call *ir) ir->replace_with(new_ir); return visit_stop; } + sig_iter.next(); } return visit_continue; -- cgit v1.2.3 From c907b947130c884de09e48e1ecbeecc9afc9f75b Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Mon, 23 Aug 2010 16:43:04 +0200 Subject: nvfx: emit bo relocations only when needed Should improve performance, possibly significantly. --- src/gallium/drivers/nvfx/nvfx_context.c | 6 ++++-- src/gallium/drivers/nvfx/nvfx_context.h | 28 ++++++++++++++++++++++++++-- src/gallium/drivers/nvfx/nvfx_fragprog.c | 3 +++ src/gallium/drivers/nvfx/nvfx_fragtex.c | 2 ++ src/gallium/drivers/nvfx/nvfx_screen.c | 11 +++++++++++ src/gallium/drivers/nvfx/nvfx_state_emit.c | 30 ++++++++++++++---------------- src/gallium/drivers/nvfx/nvfx_state_fb.c | 2 ++ src/gallium/drivers/nvfx/nvfx_vbo.c | 3 +++ 8 files changed, 65 insertions(+), 20 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/nvfx/nvfx_context.c b/src/gallium/drivers/nvfx/nvfx_context.c index 2f775f92cf..5a2fa14c88 100644 --- a/src/gallium/drivers/nvfx/nvfx_context.c +++ b/src/gallium/drivers/nvfx/nvfx_context.c @@ -46,6 +46,9 @@ nvfx_destroy(struct pipe_context *pipe) if (nvfx->draw) draw_destroy(nvfx->draw); + if(nvfx->screen->cur_ctx == nvfx) + nvfx->screen->cur_ctx = NULL; + FREE(nvfx); } @@ -72,8 +75,6 @@ nvfx_create(struct pipe_screen *pscreen, void *priv) nvfx->pipe.clear = nvfx_clear; nvfx->pipe.flush = nvfx_flush; - screen->base.channel->user_private = nvfx; - nvfx->is_nv4x = screen->is_nv4x; /* TODO: it seems that nv30 might have fixed function clipping usable with vertex programs * However, my code for that doesn't work, so use vp clipping for all cards, which works. @@ -103,6 +104,7 @@ nvfx_create(struct pipe_screen *pscreen, void *priv) nvfx->hw_pointsprite_control = -1; nvfx->hw_vp_output = -1; nvfx->use_vertex_buffers = -1; + nvfx->relocs_needed = NVFX_RELOCATE_ALL; LIST_INITHEAD(&nvfx->render_cache); diff --git a/src/gallium/drivers/nvfx/nvfx_context.h b/src/gallium/drivers/nvfx/nvfx_context.h index 680f4c6ce0..4c654bfa8b 100644 --- a/src/gallium/drivers/nvfx/nvfx_context.h +++ b/src/gallium/drivers/nvfx/nvfx_context.h @@ -47,6 +47,13 @@ #define NVFX_NEW_INDEX (1 << 16) #define NVFX_NEW_SPRITE (1 << 17) +#define NVFX_RELOCATE_FRAMEBUFFER (1 << 0) +#define NVFX_RELOCATE_FRAGTEX (1 << 1) +#define NVFX_RELOCATE_FRAGPROG (1 << 2) +#define NVFX_RELOCATE_VTXBUF (1 << 3) +#define NVFX_RELOCATE_IDXBUF (1 << 4) +#define NVFX_RELOCATE_ALL 0x1f + struct nvfx_rasterizer_state { struct pipe_rasterizer_state pipe; unsigned sb_len; @@ -199,6 +206,8 @@ struct nvfx_context { int hw_pointsprite_control; int hw_vp_output; struct nvfx_fragment_program* hw_fragprog; + + unsigned relocs_needed; }; static INLINE struct nvfx_context * @@ -290,10 +299,25 @@ extern void nvfx_state_sr_validate(struct nvfx_context *nvfx); extern void nvfx_state_zsa_validate(struct nvfx_context *nvfx); /* nvfx_state_emit.c */ -extern void nvfx_state_relocate(struct nvfx_context *nvfx); +extern void nvfx_state_relocate(struct nvfx_context *nvfx, unsigned relocs); extern boolean nvfx_state_validate(struct nvfx_context *nvfx); extern boolean nvfx_state_validate_swtnl(struct nvfx_context *nvfx); -extern void nvfx_state_emit(struct nvfx_context *nvfx); + +static inline void +nvfx_state_emit(struct nvfx_context *nvfx) +{ + unsigned relocs = NVFX_RELOCATE_FRAMEBUFFER | NVFX_RELOCATE_FRAGTEX | NVFX_RELOCATE_FRAGPROG; + if (nvfx->render_mode == HW) + { + relocs |= NVFX_RELOCATE_VTXBUF; + if(nvfx->use_index_buffer) + relocs |= NVFX_RELOCATE_IDXBUF; + } + + relocs &= nvfx->relocs_needed; + if(relocs) + nvfx_state_relocate(nvfx, relocs); +} /* nvfx_transfer.c */ extern void nvfx_init_transfer_functions(struct pipe_context *pipe); diff --git a/src/gallium/drivers/nvfx/nvfx_fragprog.c b/src/gallium/drivers/nvfx/nvfx_fragprog.c index 049b814d49..7caddfab70 100644 --- a/src/gallium/drivers/nvfx/nvfx_fragprog.c +++ b/src/gallium/drivers/nvfx/nvfx_fragprog.c @@ -1471,6 +1471,8 @@ update: nvfx->hw_pointsprite_control = pointsprite_control; } } + + nvfx->relocs_needed &=~ NVFX_RELOCATE_FRAGPROG; } void @@ -1487,6 +1489,7 @@ nvfx_fragprog_relocate(struct nvfx_context *nvfx) OUT_RELOC(chan, bo, offset, fp_flags | NOUVEAU_BO_LOW | NOUVEAU_BO_OR, NV34TCL_FP_ACTIVE_PROGRAM_DMA0, NV34TCL_FP_ACTIVE_PROGRAM_DMA1); + nvfx->relocs_needed &=~ NVFX_RELOCATE_FRAGPROG; } void diff --git a/src/gallium/drivers/nvfx/nvfx_fragtex.c b/src/gallium/drivers/nvfx/nvfx_fragtex.c index 00c47be76a..6503c7afcb 100644 --- a/src/gallium/drivers/nvfx/nvfx_fragtex.c +++ b/src/gallium/drivers/nvfx/nvfx_fragtex.c @@ -205,6 +205,7 @@ nvfx_fragtex_validate(struct nvfx_context *nvfx) } } nvfx->dirty_samplers = 0; + nvfx->relocs_needed &=~ NVFX_RELOCATE_FRAGTEX; } void @@ -231,6 +232,7 @@ nvfx_fragtex_relocate(struct nvfx_context *nvfx) OUT_RELOC(chan, bo, nvfx->hw_txf[unit], tex_flags | NOUVEAU_BO_OR | NOUVEAU_BO_DUMMY, NV34TCL_TX_FORMAT_DMA0, NV34TCL_TX_FORMAT_DMA1); } + nvfx->relocs_needed &=~ NVFX_RELOCATE_FRAGTEX; } void diff --git a/src/gallium/drivers/nvfx/nvfx_screen.c b/src/gallium/drivers/nvfx/nvfx_screen.c index 72cb5239b5..99b4d8b58c 100644 --- a/src/gallium/drivers/nvfx/nvfx_screen.c +++ b/src/gallium/drivers/nvfx/nvfx_screen.c @@ -377,6 +377,14 @@ nvfx_screen_get_vertex_buffer_flags(struct nvfx_screen* screen) return vram_hack ? NOUVEAU_BO_VRAM : NOUVEAU_BO_GART; } +static void nvfx_channel_flush_notify(struct nouveau_channel* chan) +{ + struct nvfx_screen* screen = chan->user_private; + struct nvfx_context* nvfx = screen->cur_ctx; + if(nvfx) + nvfx->relocs_needed = NVFX_RELOCATE_ALL; +} + struct pipe_screen * nvfx_screen_create(struct pipe_winsys *ws, struct nouveau_device *dev) { @@ -398,6 +406,9 @@ nvfx_screen_create(struct pipe_winsys *ws, struct nouveau_device *dev) return NULL; } chan = screen->base.channel; + screen->cur_ctx = NULL; + chan->user_private = screen; + chan->flush_notify = nvfx_channel_flush_notify; pscreen->winsys = ws; pscreen->destroy = nvfx_screen_destroy; diff --git a/src/gallium/drivers/nvfx/nvfx_state_emit.c b/src/gallium/drivers/nvfx/nvfx_state_emit.c index c43a75aaa2..cfcb0f7ef6 100644 --- a/src/gallium/drivers/nvfx/nvfx_state_emit.c +++ b/src/gallium/drivers/nvfx/nvfx_state_emit.c @@ -20,6 +20,7 @@ nvfx_state_validate_common(struct nvfx_context *nvfx) nvfx->hw_pointsprite_control = -1; nvfx->hw_vp_output = -1; nvfx->screen->cur_ctx = nvfx; + nvfx->relocs_needed = NVFX_RELOCATE_ALL; } /* These can trigger use the of 3D engine to copy temporaries. @@ -244,12 +245,12 @@ nvfx_state_validate_common(struct nvfx_context *nvfx) return TRUE; } -void -nvfx_state_emit(struct nvfx_context *nvfx) +inline void +nvfx_state_relocate(struct nvfx_context *nvfx, unsigned relocs) { struct nouveau_channel* chan = nvfx->screen->base.channel; /* we need to ensure there is enough space to output relocations in one go */ - unsigned max_relocs = 0 + const unsigned max_relocs = 0 + 16 /* vertex buffers, incl. dma flag */ + 2 /* index buffer plus format+dma flag */ + 2 * 5 /* 4 cbufs + zsbuf, plus dma objects */ @@ -257,22 +258,19 @@ nvfx_state_emit(struct nvfx_context *nvfx) + 2 * 4 /* vertex textures plus format+dma flag */ + 1 /* fragprog incl dma flag */ ; + MARK_RING(chan, max_relocs * 2, max_relocs * 2); - nvfx_state_relocate(nvfx); -} -void -nvfx_state_relocate(struct nvfx_context *nvfx) -{ - nvfx_framebuffer_relocate(nvfx); - nvfx_fragtex_relocate(nvfx); - nvfx_fragprog_relocate(nvfx); - if (nvfx->render_mode == HW) - { + if(relocs & NVFX_RELOCATE_FRAMEBUFFER) + nvfx_framebuffer_relocate(nvfx); + if(relocs & NVFX_RELOCATE_FRAGTEX) + nvfx_fragtex_relocate(nvfx); + if(relocs & NVFX_RELOCATE_FRAGPROG) + nvfx_fragprog_relocate(nvfx); + if(relocs & NVFX_RELOCATE_VTXBUF) nvfx_vbo_relocate(nvfx); - if(nvfx->use_index_buffer) - nvfx_idxbuf_relocate(nvfx); - } + if(relocs & NVFX_RELOCATE_IDXBUF) + nvfx_idxbuf_relocate(nvfx); } boolean diff --git a/src/gallium/drivers/nvfx/nvfx_state_fb.c b/src/gallium/drivers/nvfx/nvfx_state_fb.c index 3db9cec905..3b869d43a1 100644 --- a/src/gallium/drivers/nvfx/nvfx_state_fb.c +++ b/src/gallium/drivers/nvfx/nvfx_state_fb.c @@ -278,6 +278,7 @@ nvfx_framebuffer_validate(struct nvfx_context *nvfx, unsigned prepare_result) OUT_RING(chan, RING_3D(NV34TCL_VIEWPORT_TX_ORIGIN, 1)); OUT_RING(chan, 0); } + nvfx->relocs_needed &=~ NVFX_RELOCATE_FRAMEBUFFER; } void @@ -307,4 +308,5 @@ nvfx_framebuffer_relocate(struct nvfx_context *nvfx) DO(NV40, 3); DO_(nvfx->hw_zeta, NV34, ZETA); + nvfx->relocs_needed &=~ NVFX_RELOCATE_FRAMEBUFFER; } diff --git a/src/gallium/drivers/nvfx/nvfx_vbo.c b/src/gallium/drivers/nvfx/nvfx_vbo.c index 21d6e0e6f8..e6e9a8f2e4 100644 --- a/src/gallium/drivers/nvfx/nvfx_vbo.c +++ b/src/gallium/drivers/nvfx/nvfx_vbo.c @@ -334,6 +334,7 @@ nvfx_vbo_validate(struct nvfx_context *nvfx) OUT_RING(chan, 0); nvfx->hw_vtxelt_nr = nvfx->vtxelt->num_elements; + nvfx->relocs_needed &=~ NVFX_RELOCATE_VTXBUF; return TRUE; } @@ -362,6 +363,7 @@ nvfx_vbo_relocate(struct nvfx_context *nvfx) vb_flags | NOUVEAU_BO_LOW | NOUVEAU_BO_OR, 0, NV34TCL_VTXBUF_ADDRESS_DMA1); } + nvfx->relocs_needed &=~ NVFX_RELOCATE_VTXBUF; } static void @@ -382,6 +384,7 @@ nvfx_idxbuf_emit(struct nvfx_context* nvfx, unsigned ib_flags) OUT_RELOC(chan, bo, nvfx->idxbuf.offset + 1, ib_flags | NOUVEAU_BO_LOW, 0, 0); OUT_RELOC(chan, bo, ib_format, ib_flags | NOUVEAU_BO_OR, 0, NV34TCL_IDXBUF_FORMAT_DMA1); + nvfx->relocs_needed &=~ NVFX_RELOCATE_IDXBUF; } void -- cgit v1.2.3 From c2f074d8a4b93f3f3a81311f9a114b11bc5f80d8 Mon Sep 17 00:00:00 2001 From: Roland Scheidegger Date: Mon, 23 Aug 2010 17:55:16 +0200 Subject: util: fix util_fill_rect to take util_color instead of u32 param util_fill_rect could not handle formats with more than 32 bits, since the fill color was a uint32_t value. Fix this by using a util_color union instead, and also expand the union so it works with formats which have up to 256 bits (the max of any format currently defined). --- src/gallium/auxiliary/util/u_pack_color.h | 8 ++++- src/gallium/auxiliary/util/u_rect.c | 51 ++++++++++++++++++++----------- src/gallium/auxiliary/util/u_rect.h | 3 +- src/gallium/auxiliary/util/u_surface.c | 46 +++------------------------- 4 files changed, 47 insertions(+), 61 deletions(-) (limited to 'src') diff --git a/src/gallium/auxiliary/util/u_pack_color.h b/src/gallium/auxiliary/util/u_pack_color.h index 5f113f742b..aae8b8bdf1 100644 --- a/src/gallium/auxiliary/util/u_pack_color.h +++ b/src/gallium/auxiliary/util/u_pack_color.h @@ -42,12 +42,18 @@ #include "util/u_math.h" - +/** + * Helper union for packing pixel values. + * Will often contain values in formats which are too complex to be described + * in simple terms, hence might just effectively contain a number of bytes. + * Must be big enough to hold data for all formats (currently 256 bits). + */ union util_color { ubyte ub; ushort us; uint ui; float f[4]; + double d[4]; }; /** diff --git a/src/gallium/auxiliary/util/u_rect.c b/src/gallium/auxiliary/util/u_rect.c index 9bbcf1c8c4..56fcfac069 100644 --- a/src/gallium/auxiliary/util/u_rect.c +++ b/src/gallium/auxiliary/util/u_rect.c @@ -32,6 +32,7 @@ #include "util/u_format.h" #include "util/u_rect.h" +#include "util/u_pack_color.h" /** @@ -94,7 +95,7 @@ util_fill_rect(ubyte * dst, unsigned dst_y, unsigned width, unsigned height, - uint32_t value) + union util_color *uc) { unsigned i, j; unsigned width_size; @@ -110,40 +111,54 @@ util_fill_rect(ubyte * dst, dst_y /= blockheight; width = (width + blockwidth - 1)/blockwidth; height = (height + blockheight - 1)/blockheight; - + dst += dst_x * blocksize; dst += dst_y * dst_stride; width_size = width * blocksize; - + switch (blocksize) { case 1: if(dst_stride == width_size) - memset(dst, (ubyte) value, height * width_size); + memset(dst, uc->ub, height * width_size); else { - for (i = 0; i < height; i++) { - memset(dst, (ubyte) value, width_size); - dst += dst_stride; - } + for (i = 0; i < height; i++) { + memset(dst, uc->ub, width_size); + dst += dst_stride; + } } break; case 2: for (i = 0; i < height; i++) { - uint16_t *row = (uint16_t *)dst; - for (j = 0; j < width; j++) - *row++ = (uint16_t) value; - dst += dst_stride; + uint16_t *row = (uint16_t *)dst; + for (j = 0; j < width; j++) + *row++ = uc->us; + dst += dst_stride; } break; case 4: for (i = 0; i < height; i++) { - uint32_t *row = (uint32_t *)dst; - for (j = 0; j < width; j++) - *row++ = value; - dst += dst_stride; + uint32_t *row = (uint32_t *)dst; + for (j = 0; j < width; j++) + *row++ = uc->ui; + dst += dst_stride; + } + break; + case 8: + case 12: + case 16: + case 24: + case 32: + for (i = 0; i < height; i++) { + ubyte *row = dst; + for (j = 0; j < width; j++) { + memcpy(row, uc, blocksize); + row += blocksize; + } + dst += dst_stride; } break; default: - assert(0); - break; + assert(0); + break; } } diff --git a/src/gallium/auxiliary/util/u_rect.h b/src/gallium/auxiliary/util/u_rect.h index 40d57e662d..deb00cc80c 100644 --- a/src/gallium/auxiliary/util/u_rect.h +++ b/src/gallium/auxiliary/util/u_rect.h @@ -36,6 +36,7 @@ #include "pipe/p_format.h" +#include "util/u_pack_color.h" extern void @@ -47,7 +48,7 @@ util_copy_rect(ubyte * dst, enum pipe_format format, extern void util_fill_rect(ubyte * dst, enum pipe_format format, unsigned dst_stride, unsigned dst_x, unsigned dst_y, - unsigned width, unsigned height, uint32_t value); + unsigned width, unsigned height, union util_color *uc); #endif /* U_RECT_H */ diff --git a/src/gallium/auxiliary/util/u_surface.c b/src/gallium/auxiliary/util/u_surface.c index cab7691c70..af99163b2e 100644 --- a/src/gallium/auxiliary/util/u_surface.c +++ b/src/gallium/auxiliary/util/u_surface.c @@ -216,7 +216,7 @@ util_clear_render_target(struct pipe_context *pipe, assert(dst->texture); if (!dst->texture) return; - util_pack_color(rgba, dst->texture->format, &uc); + dst_trans = pipe_get_transfer(pipe, dst->texture, dst->face, @@ -232,46 +232,10 @@ util_clear_render_target(struct pipe_context *pipe, if (dst_map) { assert(dst_trans->stride > 0); - switch (util_format_get_blocksize(dst->texture->format)) { - case 1: - case 2: - case 4: - util_pack_color(rgba, dst->texture->format, &uc); - util_fill_rect(dst_map, dst->texture->format, - dst_trans->stride, - 0, 0, width, height, uc.ui); - break; - case 8: - { - /* expand the 4-byte clear value to an 8-byte value */ - /* should probably not convert back from ubyte but not - sure what this code really achieved since it doesn't even - check for format type... */ - ushort *row = (ushort *) dst_map; - ushort val0 = UBYTE_TO_USHORT((uc.ui >> 0) & 0xff); - ushort val1 = UBYTE_TO_USHORT((uc.ui >> 8) & 0xff); - ushort val2 = UBYTE_TO_USHORT((uc.ui >> 16) & 0xff); - ushort val3 = UBYTE_TO_USHORT((uc.ui >> 24) & 0xff); - unsigned i, j; - val0 = (val0 << 8) | val0; - val1 = (val1 << 8) | val1; - val2 = (val2 << 8) | val2; - val3 = (val3 << 8) | val3; - for (i = 0; i < height; i++) { - for (j = 0; j < width; j++) { - row[j*4+0] = val0; - row[j*4+1] = val1; - row[j*4+2] = val2; - row[j*4+3] = val3; - } - row += dst_trans->stride/2; - } - } - break; - default: - assert(0); - break; - } + util_pack_color(rgba, dst->texture->format, &uc); + util_fill_rect(dst_map, dst->texture->format, + dst_trans->stride, + 0, 0, width, height, &uc); } pipe->transfer_unmap(pipe, dst_trans); -- cgit v1.2.3 From 001a7bfdfc8b3c8930d5ced21982dbdfb8cd35b3 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 23 Aug 2010 09:47:15 -0700 Subject: mesa: Don't add 1 to GL_ACTIVE_UNIFORM_MAX_LENGTH. Fixes: glsl-getactiveuniform-length. --- src/mesa/main/shaderapi.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'src') diff --git a/src/mesa/main/shaderapi.c b/src/mesa/main/shaderapi.c index cc350c93b9..1335f0f411 100644 --- a/src/mesa/main/shaderapi.c +++ b/src/mesa/main/shaderapi.c @@ -644,8 +644,6 @@ get_programiv(GLcontext *ctx, GLuint program, GLenum pname, GLint *params) break; case GL_ACTIVE_UNIFORM_MAX_LENGTH: *params = _mesa_longest_uniform_name(shProg->Uniforms); - if (*params > 0) - (*params)++; /* add one for terminating zero */ break; case GL_PROGRAM_BINARY_LENGTH_OES: *params = 0; -- cgit v1.2.3 From a721abfbd1724e83381b46fc670bb38fbde76f69 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 23 Aug 2010 10:32:01 -0700 Subject: glsl: Trim the size of uniform arrays to the maximum element used. Fixes glsl-getactiveuniform-array-size. --- src/glsl/ast_to_hir.cpp | 5 +++++ src/glsl/linker.cpp | 52 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 57 insertions(+) (limited to 'src') diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp index b60bb2f0a0..8e4c3299aa 100644 --- a/src/glsl/ast_to_hir.cpp +++ b/src/glsl/ast_to_hir.cpp @@ -1258,6 +1258,11 @@ ast_expression::hir(exec_list *instructions, } } else if (array->type->array_size() == 0) { _mesa_glsl_error(&loc, state, "unsized array index must be constant"); + } else { + if (array->type->is_array()) { + ir_variable *v = array->whole_variable_referenced(); + v->max_array_access = array->type->array_size(); + } } if (error_emitted) diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp index 2dc569777e..deb30d7fec 100644 --- a/src/glsl/linker.cpp +++ b/src/glsl/linker.cpp @@ -809,6 +809,56 @@ struct uniform_node { unsigned slots; }; +/** + * Update the sizes of linked shader uniform arrays to the maximum + * array index used. + * + * From page 81 (page 95 of the PDF) of the OpenGL 2.1 spec: + * + * If one or more elements of an array are active, + * GetActiveUniform will return the name of the array in name, + * subject to the restrictions listed above. The type of the array + * is returned in type. The size parameter contains the highest + * array element index used, plus one. The compiler or linker + * determines the highest index used. There will be only one + * active uniform reported by the GL per uniform array. + + */ +static void +update_uniform_array_sizes(struct gl_shader_program *prog) +{ + 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) || + !var->type->is_array()) + continue; + + unsigned int size = var->max_array_access; + for (unsigned j = 0; j < prog->_NumLinkedShaders; j++) { + foreach_list(node2, prog->_LinkedShaders[j]->ir) { + ir_variable *other_var = ((ir_instruction *) node2)->as_variable(); + if (!other_var) + continue; + + if (strcmp(var->name, other_var->name) == 0 && + other_var->max_array_access > size) { + size = other_var->max_array_access; + } + } + } + if (size + 1 != var->type->fields.array->length) { + var->type = glsl_type::get_array_instance(var->type->fields.array, + size + 1); + /* FINISHME: We should update the types of array + * dereferences of this variable now. + */ + } + } + } +} + void assign_uniform_locations(struct gl_shader_program *prog) { @@ -818,6 +868,8 @@ assign_uniform_locations(struct gl_shader_program *prog) hash_table *ht = hash_table_ctor(32, hash_table_string_hash, hash_table_string_compare); + update_uniform_array_sizes(prog); + for (unsigned i = 0; i < prog->_NumLinkedShaders; i++) { unsigned next_position = 0; -- cgit v1.2.3 From 0acd68c4050fea82797f80ad90212926df4cf001 Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Mon, 23 Aug 2010 08:54:06 -0700 Subject: glcpp: Add test for the #error directive. This directive is already implemented nicely, but wasn't previously tested. It will be convenient to use this directive in further tests that rely on error messages, (such as ensuring that #line correctly sets the line number in the error message). --- src/glsl/glcpp/tests/090-hash-error.c | 1 + src/glsl/glcpp/tests/090-hash-error.c.expected | 3 +++ 2 files changed, 4 insertions(+) create mode 100644 src/glsl/glcpp/tests/090-hash-error.c create mode 100644 src/glsl/glcpp/tests/090-hash-error.c.expected (limited to 'src') diff --git a/src/glsl/glcpp/tests/090-hash-error.c b/src/glsl/glcpp/tests/090-hash-error.c new file mode 100644 index 0000000000..d19bb7faed --- /dev/null +++ b/src/glsl/glcpp/tests/090-hash-error.c @@ -0,0 +1 @@ +#error human error diff --git a/src/glsl/glcpp/tests/090-hash-error.c.expected b/src/glsl/glcpp/tests/090-hash-error.c.expected new file mode 100644 index 0000000000..f2f1fbeaf8 --- /dev/null +++ b/src/glsl/glcpp/tests/090-hash-error.c.expected @@ -0,0 +1,3 @@ +0:1(2): preprocessor error: #error human error + + -- cgit v1.2.3 From c15f04b326aafc27aa2e508ab88bf209c829abd7 Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Mon, 23 Aug 2010 09:06:11 -0700 Subject: glcpp: Update README file (new specifications and fewer limitations). The README file had grown a little bit stale. We've been using newer versions of both the GLSL and C99 specifications, so list those. Also, several of the documented known limitations have since been fixed, so remove those. --- src/glsl/glcpp/README | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/glsl/glcpp/README b/src/glsl/glcpp/README index ab42a3ffe1..0b5ef508ce 100644 --- a/src/glsl/glcpp/README +++ b/src/glsl/glcpp/README @@ -4,26 +4,28 @@ 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 +http://www.opengl.org/registry/doc/GLSLangSpec.Full.1.30.10.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: +preprocessors". To fill in these details, I've been using a draft of +the C99 standard as available from: -http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1124.pdf +http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1256.pdf -Known limitations ------------------ -Macro invocations cannot include embedded newlines. +Any downstream compiler accepting output from glcpp should be prepared +to encounter and deal with the following preprocessor macros: -The __LINE__, __FILE__, and __VERSION__ macros are not yet supported. + #line + #pragma + #extension -The argument of the 'defined' operator cannot yet include enclosing -parentheses. +All other macros will be handles according to the GLSL specification +and will not appear in the output. -The #error, #pragma, #extension, #version, and #line macros are not -yet supported. +Known limitations +----------------- +The __LINE__ and __FILE__ 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 -- cgit v1.2.3 From 2a9e791fdeb45080a98042d41c153ea19c17caae Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Mon, 23 Aug 2010 09:26:44 -0700 Subject: glcpp: Add new test for #line directive. This test exposes two current bugs: 1. The source number is not being correctly emitted in error messages (instead, it's always 0). 2. A directive of "#line 0" is resulting in the following parse error: preprocessor error: Invalid tokens after # --- src/glsl/glcpp/tests/091-hash-line.c | 8 ++++++++ src/glsl/glcpp/tests/091-hash-line.c.expected | 13 +++++++++++++ 2 files changed, 21 insertions(+) create mode 100644 src/glsl/glcpp/tests/091-hash-line.c create mode 100644 src/glsl/glcpp/tests/091-hash-line.c.expected (limited to 'src') diff --git a/src/glsl/glcpp/tests/091-hash-line.c b/src/glsl/glcpp/tests/091-hash-line.c new file mode 100644 index 0000000000..fea35d37b0 --- /dev/null +++ b/src/glsl/glcpp/tests/091-hash-line.c @@ -0,0 +1,8 @@ +#line 0 +#error line 0 error +#line 25 +#error line 25 error +#line 0 1 +#error source 1, line 0 error +#line 30 2 +#error source 2, line 30 error diff --git a/src/glsl/glcpp/tests/091-hash-line.c.expected b/src/glsl/glcpp/tests/091-hash-line.c.expected new file mode 100644 index 0000000000..e663398c16 --- /dev/null +++ b/src/glsl/glcpp/tests/091-hash-line.c.expected @@ -0,0 +1,13 @@ +0:0(1): preprocessor error: #error line 0 error +0:25(1): preprocessor error: #error line 25 error +1:0(1): preprocessor error: #error source 1, line 0 error +2:30(1): preprocessor error: #error source 2, line 30 error + + + + + + + + + -- cgit v1.2.3 From ff10d239af3b48f4ba13a0ef947e97d3302ea818 Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Mon, 23 Aug 2010 09:29:49 -0700 Subject: glcpp: Fix source numbers set with "#line LINE_NUMBER SOURCE_NUMBER" Previously, the YY_USER_ACTION was overwriting the yylloc->source value in every action, (after that value had been carefully set by the handling of the #line directive). Instead, we want to initialize it once in YY_USER_INIT and then not touch it at all in YY_USER_ACTION. --- src/glsl/glcpp/glcpp-lex.l | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/glsl/glcpp/glcpp-lex.l b/src/glsl/glcpp/glcpp-lex.l index c81bd044a2..a90430f255 100644 --- a/src/glsl/glcpp/glcpp-lex.l +++ b/src/glsl/glcpp/glcpp-lex.l @@ -38,12 +38,17 @@ void glcpp_set_column (int column_no , yyscan_t yyscanner); #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 = 1; yycolumn = 1; + +#define YY_USER_INIT \ + do { \ + yylineno = 1; \ + yycolumn = 1; \ + yylloc->source = 0; \ + } while(0) %} %option bison-bridge bison-locations reentrant noyywrap -- cgit v1.2.3 From c2280e63817238bb969b20605c7d8dab4ddf1721 Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Mon, 23 Aug 2010 09:31:42 -0700 Subject: glcpp: Fix handling of "#line 0" The existing DECIMAL_INTEGER pattern is the correct thing to use when looking for a C decimal integer, (that is, a digit-sequence not starting with 0 which would instead be an octal integer). But for #line, we really want to accept any digit sequence, (including "0"), and always interpret it as a decimal constant. So we add a new DIGITS pattern for this case. This should fix the compilation failure noted in bug #28138 https://bugs.freedesktop.org/show_bug.cgi?id=28138 (Though the generated file will not be updated until the next commit.) --- src/glsl/glcpp/glcpp-lex.l | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/glsl/glcpp/glcpp-lex.l b/src/glsl/glcpp/glcpp-lex.l index a90430f255..8eb84ed138 100644 --- a/src/glsl/glcpp/glcpp-lex.l +++ b/src/glsl/glcpp/glcpp-lex.l @@ -68,6 +68,7 @@ IDENTIFIER [_a-zA-Z][_a-zA-Z0-9]* PUNCTUATION [][(){}.&*~!/%<>^|;,=+-] OTHER [^][(){}.&*~!/%<>^|;,=#[:space:]+-]+ +DIGITS [0-9][0-9]* DECIMAL_INTEGER [1-9][0-9]*[uU]? OCTAL_INTEGER 0[0-7]*[uU]? HEXADECIMAL_INTEGER 0[xX][0-9a-fA-F]+[uU]? @@ -105,7 +106,7 @@ HEXADECIMAL_INTEGER 0[xX][0-9a-fA-F]+[uU]? return OTHER; } -{HASH}line{HSPACE}+{DECIMAL_INTEGER}{HSPACE}+{DECIMAL_INTEGER}{HSPACE}*$ { +{HASH}line{HSPACE}+{DIGITS}{HSPACE}+{DIGITS}{HSPACE}*$ { /* Eat characters until the first digit is * encountered */ @@ -121,7 +122,7 @@ HEXADECIMAL_INTEGER 0[xX][0-9a-fA-F]+[uU]? yylloc->source = strtol(ptr, NULL, 0); } -{HASH}line{HSPACE}+{DECIMAL_INTEGER}{HSPACE}*$ { +{HASH}line{HSPACE}+{DIGITS}{HSPACE}*$ { /* Eat characters until the first digit is * encountered */ -- cgit v1.2.3 From eab206510fc76407ee8b18aacafadd0d5406e483 Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Mon, 23 Aug 2010 09:35:24 -0700 Subject: glcpp: Update generated glcpp-lex.c for the last two changes. This fixes both "#line 0" and "#line XXX YYY" as described in the two most recent commits. --- src/glsl/glcpp/glcpp-lex.c | 377 ++++++++++++++++++++++----------------------- 1 file changed, 186 insertions(+), 191 deletions(-) (limited to 'src') diff --git a/src/glsl/glcpp/glcpp-lex.c b/src/glsl/glcpp/glcpp-lex.c index 1f0a77be8e..0f99ea1bbb 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. @@ -377,7 +386,7 @@ static yyconst flex_int16_t yy_acclist[137] = 18, 9, 8, 8212, 10, 18 } ; -static yyconst flex_int16_t yy_accept[166] = +static yyconst flex_int16_t yy_accept[164] = { 0, 1, 1, 1, 1, 1, 2, 3, 3, 3, 4, 6, 8, 10, 11, 13, 14, 16, 18, 20, 23, @@ -395,8 +404,8 @@ static yyconst flex_int16_t yy_accept[166] = 109, 111, 111, 113, 114, 115, 115, 116, 116, 116, 116, 117, 117, 120, 121, 121, 123, 124, 124, 124, 126, 127, 127, 127, 127, 128, 128, 128, 130, 130, - 132, 132, 132, 133, 134, 134, 134, 134, 135, 135, - 135, 137, 137, 137, 137 + 132, 132, 133, 134, 134, 134, 134, 135, 135, 135, + 137, 137, 137 } ; static yyconst flex_int32_t yy_ec[256] = @@ -439,55 +448,55 @@ static yyconst flex_int32_t yy_meta[40] = 1, 1, 1, 1, 1, 1, 1, 1, 1 } ; -static yyconst flex_int16_t yy_base[184] = +static yyconst flex_int16_t yy_base[182] = { 0, - 0, 38, 0, 0, 38, 39, 465, 464, 466, 48, - 43, 665, 462, 44, 63, 460, 59, 65, 87, 125, - 58, 67, 68, 164, 203, 40, 75, 241, 665, 459, - 665, 140, 665, 140, 458, 665, 144, 457, 456, 452, - 451, 450, 156, 179, 267, 0, 209, 449, 448, 447, - 446, 445, 381, 124, 401, 153, 397, 396, 154, 198, - 159, 155, 183, 160, 193, 398, 665, 222, 665, 227, - 665, 397, 204, 161, 231, 232, 238, 243, 236, 303, + 0, 38, 0, 0, 38, 39, 499, 498, 500, 48, + 43, 552, 496, 44, 63, 495, 59, 65, 87, 125, + 58, 67, 68, 164, 203, 40, 75, 241, 552, 494, + 552, 140, 552, 140, 493, 552, 144, 492, 491, 487, + 486, 485, 156, 179, 267, 0, 209, 472, 471, 470, + 469, 468, 446, 124, 466, 153, 462, 458, 154, 198, + 159, 155, 183, 160, 193, 460, 552, 222, 552, 227, + 552, 459, 204, 161, 231, 232, 238, 243, 236, 303, 245, 180, 247, 249, 281, 56, 257, 271, 248, 259, - 252, 264, 396, 395, 297, 299, 312, 313, 320, 294, - - 373, 295, 393, 391, 321, 296, 324, 390, 665, 389, - 665, 327, 329, 195, 328, 331, 332, 230, 334, 388, - 665, 386, 665, 378, 372, 335, 367, 337, 347, 342, - 360, 340, 331, 255, 348, 665, 260, 338, 246, 665, - 197, 370, 192, 344, 406, 345, 186, 665, 364, 665, - 444, 377, 184, 141, 480, 365, 518, 79, 554, 383, - 665, 592, 385, 665, 628, 630, 632, 634, 636, 638, - 71, 640, 642, 644, 646, 648, 650, 652, 654, 656, - 658, 660, 662 + 252, 264, 455, 454, 297, 299, 312, 313, 320, 294, + + 407, 295, 427, 426, 321, 296, 324, 425, 552, 424, + 552, 327, 329, 195, 328, 331, 332, 230, 334, 378, + 552, 377, 552, 371, 370, 335, 365, 337, 358, 342, + 360, 344, 326, 255, 340, 552, 260, 338, 246, 552, + 197, 364, 192, 352, 382, 348, 186, 552, 420, 552, + 423, 184, 141, 437, 421, 447, 79, 476, 346, 552, + 453, 552, 515, 517, 519, 521, 523, 525, 71, 527, + 529, 531, 533, 535, 537, 539, 541, 543, 545, 547, + 549 } ; -static yyconst flex_int16_t yy_def[184] = +static yyconst flex_int16_t yy_def[182] = { 0, - 164, 1, 165, 165, 166, 166, 167, 167, 164, 168, - 169, 164, 169, 169, 169, 169, 169, 169, 164, 168, - 169, 169, 169, 170, 170, 169, 169, 169, 164, 171, - 164, 172, 164, 20, 169, 164, 169, 169, 169, 169, - 169, 173, 19, 20, 20, 20, 20, 169, 169, 169, - 169, 169, 25, 25, 169, 169, 28, 28, 169, 169, - 169, 169, 169, 169, 169, 171, 164, 172, 164, 172, - 164, 173, 45, 25, 169, 169, 169, 169, 169, 169, - 169, 169, 169, 169, 20, 25, 169, 169, 169, 169, - 169, 169, 174, 175, 169, 169, 169, 169, 169, 169, - - 25, 169, 176, 177, 169, 169, 169, 174, 164, 175, - 164, 169, 169, 169, 169, 169, 169, 25, 169, 176, - 164, 177, 164, 178, 179, 169, 180, 169, 169, 169, - 169, 169, 25, 169, 178, 164, 179, 169, 180, 164, - 181, 169, 182, 169, 164, 169, 181, 164, 169, 164, - 169, 169, 182, 169, 183, 169, 169, 169, 183, 169, - 164, 169, 169, 0, 164, 164, 164, 164, 164, 164, - 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, - 164, 164, 164 + 162, 1, 163, 163, 164, 164, 165, 165, 162, 166, + 167, 162, 167, 167, 167, 167, 167, 167, 162, 166, + 167, 167, 167, 168, 168, 167, 167, 167, 162, 169, + 162, 170, 162, 20, 167, 162, 167, 167, 167, 167, + 167, 171, 19, 20, 20, 20, 20, 167, 167, 167, + 167, 167, 25, 25, 167, 167, 28, 28, 167, 167, + 167, 167, 167, 167, 167, 169, 162, 170, 162, 170, + 162, 171, 45, 25, 167, 167, 167, 167, 167, 167, + 167, 167, 167, 167, 20, 25, 167, 167, 167, 167, + 167, 167, 172, 173, 167, 167, 167, 167, 167, 167, + + 25, 167, 174, 175, 167, 167, 167, 172, 162, 173, + 162, 167, 167, 167, 167, 167, 167, 25, 167, 174, + 162, 175, 162, 176, 177, 167, 178, 167, 167, 167, + 167, 167, 25, 167, 176, 162, 177, 167, 178, 162, + 179, 167, 180, 167, 162, 167, 179, 162, 167, 162, + 167, 180, 167, 181, 167, 167, 167, 181, 167, 162, + 167, 0, 162, 162, 162, 162, 162, 162, 162, 162, + 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, + 162 } ; -static yyconst flex_int16_t yy_nxt[705] = +static yyconst flex_int16_t yy_nxt[592] = { 0, 10, 11, 12, 13, 14, 15, 16, 17, 16, 16, 18, 19, 20, 20, 21, 22, 23, 24, 24, 24, @@ -514,7 +523,7 @@ static yyconst flex_int16_t yy_nxt[705] = 36, 98, 35, 34, 35, 36, 35, 35, 35, 35, 35, 35, 35, 35, 34, 82, 84, 35, 35, 35, 34, 34, 34, 85, 69, 76, 54, 77, 34, 69, - 78, 164, 164, 36, 36, 79, 70, 71, 36, 85, + 78, 162, 162, 36, 36, 79, 70, 71, 36, 85, 36, 35, 58, 36, 34, 36, 39, 36, 140, 36, 36, 36, 133, 53, 36, 87, 145, 36, 88, 36, 90, 36, 36, 59, 60, 89, 36, 61, 62, 99, @@ -526,50 +535,38 @@ static yyconst flex_int16_t yy_nxt[705] = 93, 93, 93, 93, 36, 36, 34, 93, 93, 93, 112, 113, 36, 36, 119, 95, 36, 117, 125, 36, 36, 36, 96, 36, 36, 114, 36, 36, 115, 36, - 36, 93, 36, 116, 36, 124, 36, 36, 129, 36, - 136, 127, 128, 126, 53, 131, 130, 134, 132, 142, - 142, 141, 36, 143, 146, 149, 150, 36, 138, 140, - 144, 149, 150, 154, 36, 156, 157, 157, 149, 150, - 136, 151, 151, 151, 160, 161, 160, 161, 123, 152, - 121, 111, 109, 123, 143, 121, 118, 111, 109, 36, - - 67, 35, 35, 36, 53, 152, 35, 145, 36, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 155, 155, 155, 155, 155, 155, 155, - 155, 155, 155, 155, 155, 155, 155, 155, 155, 155, - 155, 155, 155, 155, 35, 149, 150, 36, 36, 36, - 36, 36, 36, 36, 36, 151, 151, 151, 36, 36, - 36, 67, 36, 152, 36, 164, 29, 29, 164, 164, - 164, 164, 164, 164, 164, 164, 164, 164, 164, 152, - 35, 35, 36, 35, 35, 35, 35, 35, 158, 35, - 35, 164, 164, 164, 35, 35, 35, 164, 164, 164, - - 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, - 164, 164, 164, 164, 164, 164, 164, 164, 35, 160, - 161, 164, 164, 164, 164, 164, 164, 164, 164, 162, - 162, 162, 164, 164, 164, 164, 164, 163, 164, 164, - 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, - 164, 164, 164, 163, 35, 35, 36, 35, 35, 35, - 35, 35, 158, 35, 35, 164, 164, 164, 35, 35, - 35, 164, 164, 164, 164, 164, 164, 164, 164, 164, - 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, - 164, 164, 35, 160, 161, 164, 164, 164, 164, 164, - - 164, 164, 164, 162, 162, 162, 164, 164, 164, 164, - 164, 163, 164, 164, 164, 164, 164, 164, 164, 164, - 164, 164, 164, 164, 164, 164, 164, 163, 29, 29, - 30, 30, 33, 33, 34, 34, 35, 35, 53, 53, - 68, 68, 72, 72, 108, 108, 110, 110, 120, 120, - 122, 122, 135, 135, 137, 137, 139, 139, 147, 147, - 153, 153, 159, 159, 9, 164, 164, 164, 164, 164, - 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, - 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, - 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, - - 164, 164, 164, 164 + 36, 93, 136, 116, 36, 124, 36, 159, 160, 53, + 36, 127, 128, 126, 36, 131, 130, 134, 132, 129, + 36, 141, 36, 143, 146, 149, 150, 140, 138, 142, + 142, 142, 36, 136, 144, 151, 151, 151, 155, 123, + 121, 153, 35, 145, 36, 35, 35, 35, 35, 35, + 35, 35, 35, 35, 35, 35, 35, 35, 35, 154, + + 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, + 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, + 35, 149, 150, 36, 149, 150, 111, 109, 123, 121, + 118, 156, 156, 156, 151, 151, 151, 35, 35, 36, + 35, 35, 35, 35, 35, 157, 35, 35, 159, 160, + 143, 35, 35, 35, 159, 160, 111, 109, 161, 161, + 161, 36, 67, 35, 161, 161, 161, 35, 36, 53, + 36, 36, 36, 36, 36, 35, 35, 35, 36, 35, + 35, 35, 35, 35, 157, 35, 35, 36, 36, 36, + 35, 35, 35, 36, 36, 36, 67, 36, 36, 162, + + 29, 29, 162, 162, 162, 162, 162, 162, 162, 162, + 162, 162, 162, 162, 35, 29, 29, 30, 30, 33, + 33, 34, 34, 35, 35, 53, 53, 68, 68, 72, + 72, 108, 108, 110, 110, 120, 120, 122, 122, 135, + 135, 137, 137, 139, 139, 147, 147, 152, 152, 158, + 158, 9, 162, 162, 162, 162, 162, 162, 162, 162, + 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, + 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, + 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, + 162 + } ; -static yyconst flex_int16_t yy_chk[705] = +static yyconst flex_int16_t yy_chk[592] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, @@ -578,19 +575,19 @@ static yyconst flex_int16_t yy_chk[705] = 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, 171, 21, 21, 18, 18, 27, 27, 26, 86, - 27, 158, 22, 23, 23, 86, 10, 19, 19, 19, + 23, 169, 21, 21, 18, 18, 27, 27, 26, 86, + 27, 157, 22, 23, 23, 86, 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, 154, 20, 37, 37, 54, 54, 32, + 20, 20, 32, 153, 20, 37, 37, 54, 54, 32, 32, 34, 34, 34, 56, 56, 59, 62, 56, 34, 20, 61, 64, 20, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 34, 43, 59, 24, 24, - 24, 62, 82, 61, 74, 63, 153, 74, 147, 64, + 24, 62, 82, 61, 74, 63, 152, 74, 147, 64, 44, 44, 44, 43, 143, 65, 114, 114, 44, 141, 60, 82, 24, 25, 25, 25, 25, 25, 25, 25, @@ -608,47 +605,35 @@ static yyconst flex_int16_t yy_chk[705] = 80, 80, 80, 80, 97, 98, 85, 80, 80, 80, 95, 96, 99, 105, 102, 80, 107, 100, 106, 112, 115, 113, 80, 116, 117, 97, 119, 126, 98, 128, - 138, 80, 132, 99, 130, 105, 144, 146, 129, 129, - 135, 112, 113, 107, 133, 116, 115, 119, 117, 129, - 129, 128, 131, 130, 138, 149, 149, 156, 126, 127, - 132, 142, 142, 144, 125, 146, 149, 149, 152, 152, - 124, 142, 142, 142, 160, 160, 163, 163, 122, 142, - 120, 110, 108, 104, 156, 103, 101, 94, 93, 72, - - 66, 58, 57, 55, 53, 142, 145, 145, 145, 145, + 138, 80, 135, 99, 130, 105, 132, 159, 159, 133, + 146, 112, 113, 107, 144, 116, 115, 119, 117, 129, + 129, 128, 131, 130, 138, 142, 142, 127, 126, 129, + 129, 129, 125, 124, 132, 142, 142, 142, 146, 122, + 120, 144, 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, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, - 145, 145, 145, 145, 145, 151, 151, 52, 51, 50, - 49, 48, 42, 41, 40, 151, 151, 151, 39, 38, - 35, 30, 16, 151, 13, 9, 8, 7, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 151, - 155, 155, 155, 155, 155, 155, 155, 155, 155, 155, - 155, 0, 0, 0, 155, 155, 155, 0, 0, 0, - - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 155, 157, - 157, 0, 0, 0, 0, 0, 0, 0, 0, 157, - 157, 157, 0, 0, 0, 0, 0, 157, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 157, 159, 159, 159, 159, 159, 159, - 159, 159, 159, 159, 159, 0, 0, 0, 159, 159, - 159, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 159, 162, 162, 0, 0, 0, 0, 0, - - 0, 0, 0, 162, 162, 162, 0, 0, 0, 0, - 0, 162, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 162, 165, 165, - 166, 166, 167, 167, 168, 168, 169, 169, 170, 170, - 172, 172, 173, 173, 174, 174, 175, 175, 176, 176, - 177, 177, 178, 178, 179, 179, 180, 180, 181, 181, - 182, 182, 183, 183, 164, 164, 164, 164, 164, 164, - 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, - 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, - 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, - - 164, 164, 164, 164 + 145, 149, 149, 155, 151, 151, 110, 108, 104, 103, + 101, 149, 149, 149, 151, 151, 151, 154, 154, 154, + 154, 154, 154, 154, 154, 154, 154, 154, 156, 156, + 155, 154, 154, 154, 161, 161, 94, 93, 156, 156, + 156, 72, 66, 58, 161, 161, 161, 57, 55, 53, + 52, 51, 50, 49, 48, 154, 158, 158, 158, 158, + 158, 158, 158, 158, 158, 158, 158, 42, 41, 40, + 158, 158, 158, 39, 38, 35, 30, 16, 13, 9, + + 8, 7, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 158, 163, 163, 164, 164, 165, + 165, 166, 166, 167, 167, 168, 168, 170, 170, 171, + 171, 172, 172, 173, 173, 174, 174, 175, 175, 176, + 176, 177, 177, 178, 178, 179, 179, 180, 180, 181, + 181, 162, 162, 162, 162, 162, 162, 162, 162, 162, + 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, + 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, + 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, + 162 + } ; #define YY_TRAILING_MASK 0x2000 @@ -708,14 +693,19 @@ void glcpp_set_column (int column_no , yyscan_t yyscanner); #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 = 1; yycolumn = 1; -#line 719 "glcpp/glcpp-lex.c" +#define YY_USER_INIT \ + do { \ + yylineno = 1; \ + yycolumn = 1; \ + yylloc->source = 0; \ + } while(0) + +#line 709 "glcpp/glcpp-lex.c" #define INITIAL 0 #define DONE 1 @@ -862,7 +852,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. */ @@ -870,7 +865,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, @@ -881,7 +876,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; \ @@ -969,11 +964,11 @@ YY_DECL register int yy_act; struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; -#line 70 "glcpp/glcpp-lex.l" +#line 76 "glcpp/glcpp-lex.l" /* Single-line comments */ -#line 977 "glcpp/glcpp-lex.c" +#line 972 "glcpp/glcpp-lex.c" yylval = yylval_param; @@ -1036,14 +1031,14 @@ 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 >= 165 ) + if ( yy_current_state >= 163 ) 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_current_state != 164 ); + while ( yy_current_state != 162 ); yy_find_action: yy_current_state = *--yyg->yy_state_ptr; @@ -1095,41 +1090,41 @@ do_action: /* This label is used only to access EOF actions. */ { /* beginning of action switch */ case 1: YY_RULE_SETUP -#line 73 "glcpp/glcpp-lex.l" +#line 79 "glcpp/glcpp-lex.l" { } YY_BREAK /* Multi-line comments */ case 2: YY_RULE_SETUP -#line 77 "glcpp/glcpp-lex.l" +#line 83 "glcpp/glcpp-lex.l" { yy_push_state(COMMENT, yyscanner); } YY_BREAK case 3: YY_RULE_SETUP -#line 78 "glcpp/glcpp-lex.l" +#line 84 "glcpp/glcpp-lex.l" YY_BREAK case 4: /* rule 4 can match eol */ YY_RULE_SETUP -#line 79 "glcpp/glcpp-lex.l" +#line 85 "glcpp/glcpp-lex.l" { yylineno++; yycolumn = 0; } YY_BREAK case 5: YY_RULE_SETUP -#line 80 "glcpp/glcpp-lex.l" +#line 86 "glcpp/glcpp-lex.l" YY_BREAK case 6: /* rule 6 can match eol */ YY_RULE_SETUP -#line 81 "glcpp/glcpp-lex.l" +#line 87 "glcpp/glcpp-lex.l" { yylineno++; yycolumn = 0; } YY_BREAK case 7: YY_RULE_SETUP -#line 82 "glcpp/glcpp-lex.l" +#line 88 "glcpp/glcpp-lex.l" { yy_pop_state(yyscanner); if (yyextra->space_tokens) @@ -1138,7 +1133,7 @@ YY_RULE_SETUP YY_BREAK case 8: YY_RULE_SETUP -#line 88 "glcpp/glcpp-lex.l" +#line 94 "glcpp/glcpp-lex.l" { yylval->str = talloc_strdup (yyextra, yytext); yyextra->space_tokens = 0; @@ -1149,7 +1144,7 @@ YY_RULE_SETUP * Simply pass them through to the main compiler's lexer/parser. */ case 9: YY_RULE_SETUP -#line 96 "glcpp/glcpp-lex.l" +#line 102 "glcpp/glcpp-lex.l" { yylval->str = talloc_strdup (yyextra, yytext); yylineno++; @@ -1162,7 +1157,7 @@ case 10: yyg->yy_c_buf_p = yy_cp -= 1; YY_DO_BEFORE_ACTION; /* set up yytext again */ YY_RULE_SETUP -#line 103 "glcpp/glcpp-lex.l" +#line 109 "glcpp/glcpp-lex.l" { /* Eat characters until the first digit is * encountered @@ -1184,7 +1179,7 @@ case 11: yyg->yy_c_buf_p = yy_cp -= 1; YY_DO_BEFORE_ACTION; /* set up yytext again */ YY_RULE_SETUP -#line 119 "glcpp/glcpp-lex.l" +#line 125 "glcpp/glcpp-lex.l" { /* Eat characters until the first digit is * encountered @@ -1203,7 +1198,7 @@ YY_RULE_SETUP case 12: /* rule 12 can match eol */ YY_RULE_SETUP -#line 134 "glcpp/glcpp-lex.l" +#line 140 "glcpp/glcpp-lex.l" { yyextra->lexing_if = 1; yyextra->space_tokens = 0; @@ -1213,7 +1208,7 @@ YY_RULE_SETUP case 13: /* rule 13 can match eol */ YY_RULE_SETUP -#line 140 "glcpp/glcpp-lex.l" +#line 146 "glcpp/glcpp-lex.l" { yyextra->lexing_if = 1; yyextra->space_tokens = 0; @@ -1223,7 +1218,7 @@ YY_RULE_SETUP case 14: /* rule 14 can match eol */ YY_RULE_SETUP -#line 146 "glcpp/glcpp-lex.l" +#line 152 "glcpp/glcpp-lex.l" { yyextra->lexing_if = 1; yyextra->space_tokens = 0; @@ -1233,7 +1228,7 @@ YY_RULE_SETUP case 15: /* rule 15 can match eol */ YY_RULE_SETUP -#line 152 "glcpp/glcpp-lex.l" +#line 158 "glcpp/glcpp-lex.l" { yyextra->lexing_if = 1; yyextra->space_tokens = 0; @@ -1243,7 +1238,7 @@ YY_RULE_SETUP case 16: /* rule 16 can match eol */ YY_RULE_SETUP -#line 158 "glcpp/glcpp-lex.l" +#line 164 "glcpp/glcpp-lex.l" { yyextra->space_tokens = 0; return HASH_ELSE; @@ -1252,7 +1247,7 @@ YY_RULE_SETUP case 17: /* rule 17 can match eol */ YY_RULE_SETUP -#line 163 "glcpp/glcpp-lex.l" +#line 169 "glcpp/glcpp-lex.l" { yyextra->space_tokens = 0; return HASH_ENDIF; @@ -1272,7 +1267,7 @@ case 18: yyg->yy_c_buf_p = yy_cp -= 1; YY_DO_BEFORE_ACTION; /* set up yytext again */ YY_RULE_SETUP -#line 176 "glcpp/glcpp-lex.l" +#line 182 "glcpp/glcpp-lex.l" { /* Since this rule always matches, YY_USER_ACTION gets called for it, * wrongly incrementing yycolumn. We undo that effect here. */ @@ -1287,7 +1282,7 @@ YY_RULE_SETUP YY_BREAK case 19: YY_RULE_SETUP -#line 188 "glcpp/glcpp-lex.l" +#line 194 "glcpp/glcpp-lex.l" { char *p; for (p = yytext; !isalpha(p[0]); p++); /* skip " # " */ @@ -1297,7 +1292,7 @@ YY_RULE_SETUP YY_BREAK case 20: YY_RULE_SETUP -#line 195 "glcpp/glcpp-lex.l" +#line 201 "glcpp/glcpp-lex.l" { yyextra->space_tokens = 0; return HASH_DEFINE_FUNC; @@ -1305,7 +1300,7 @@ YY_RULE_SETUP YY_BREAK case 21: YY_RULE_SETUP -#line 200 "glcpp/glcpp-lex.l" +#line 206 "glcpp/glcpp-lex.l" { yyextra->space_tokens = 0; return HASH_DEFINE_OBJ; @@ -1313,7 +1308,7 @@ YY_RULE_SETUP YY_BREAK case 22: YY_RULE_SETUP -#line 205 "glcpp/glcpp-lex.l" +#line 211 "glcpp/glcpp-lex.l" { yyextra->space_tokens = 0; return HASH_UNDEF; @@ -1321,7 +1316,7 @@ YY_RULE_SETUP YY_BREAK case 23: YY_RULE_SETUP -#line 210 "glcpp/glcpp-lex.l" +#line 216 "glcpp/glcpp-lex.l" { yyextra->space_tokens = 0; return HASH; @@ -1329,7 +1324,7 @@ YY_RULE_SETUP YY_BREAK case 24: YY_RULE_SETUP -#line 215 "glcpp/glcpp-lex.l" +#line 221 "glcpp/glcpp-lex.l" { yylval->str = talloc_strdup (yyextra, yytext); return INTEGER_STRING; @@ -1337,7 +1332,7 @@ YY_RULE_SETUP YY_BREAK case 25: YY_RULE_SETUP -#line 220 "glcpp/glcpp-lex.l" +#line 226 "glcpp/glcpp-lex.l" { yylval->str = talloc_strdup (yyextra, yytext); return INTEGER_STRING; @@ -1345,7 +1340,7 @@ YY_RULE_SETUP YY_BREAK case 26: YY_RULE_SETUP -#line 225 "glcpp/glcpp-lex.l" +#line 231 "glcpp/glcpp-lex.l" { yylval->str = talloc_strdup (yyextra, yytext); return INTEGER_STRING; @@ -1353,77 +1348,77 @@ YY_RULE_SETUP YY_BREAK case 27: YY_RULE_SETUP -#line 230 "glcpp/glcpp-lex.l" +#line 236 "glcpp/glcpp-lex.l" { return LEFT_SHIFT; } YY_BREAK case 28: YY_RULE_SETUP -#line 234 "glcpp/glcpp-lex.l" +#line 240 "glcpp/glcpp-lex.l" { return RIGHT_SHIFT; } YY_BREAK case 29: YY_RULE_SETUP -#line 238 "glcpp/glcpp-lex.l" +#line 244 "glcpp/glcpp-lex.l" { return LESS_OR_EQUAL; } YY_BREAK case 30: YY_RULE_SETUP -#line 242 "glcpp/glcpp-lex.l" +#line 248 "glcpp/glcpp-lex.l" { return GREATER_OR_EQUAL; } YY_BREAK case 31: YY_RULE_SETUP -#line 246 "glcpp/glcpp-lex.l" +#line 252 "glcpp/glcpp-lex.l" { return EQUAL; } YY_BREAK case 32: YY_RULE_SETUP -#line 250 "glcpp/glcpp-lex.l" +#line 256 "glcpp/glcpp-lex.l" { return NOT_EQUAL; } YY_BREAK case 33: YY_RULE_SETUP -#line 254 "glcpp/glcpp-lex.l" +#line 260 "glcpp/glcpp-lex.l" { return AND; } YY_BREAK case 34: YY_RULE_SETUP -#line 258 "glcpp/glcpp-lex.l" +#line 264 "glcpp/glcpp-lex.l" { return OR; } YY_BREAK case 35: YY_RULE_SETUP -#line 262 "glcpp/glcpp-lex.l" +#line 268 "glcpp/glcpp-lex.l" { return PASTE; } YY_BREAK case 36: YY_RULE_SETUP -#line 266 "glcpp/glcpp-lex.l" +#line 272 "glcpp/glcpp-lex.l" { return DEFINED; } YY_BREAK case 37: YY_RULE_SETUP -#line 270 "glcpp/glcpp-lex.l" +#line 276 "glcpp/glcpp-lex.l" { yylval->str = talloc_strdup (yyextra, yytext); return IDENTIFIER; @@ -1431,14 +1426,14 @@ YY_RULE_SETUP YY_BREAK case 38: YY_RULE_SETUP -#line 275 "glcpp/glcpp-lex.l" +#line 281 "glcpp/glcpp-lex.l" { return yytext[0]; } YY_BREAK case 39: YY_RULE_SETUP -#line 279 "glcpp/glcpp-lex.l" +#line 285 "glcpp/glcpp-lex.l" { yylval->str = talloc_strdup (yyextra, yytext); return OTHER; @@ -1446,7 +1441,7 @@ YY_RULE_SETUP YY_BREAK case 40: YY_RULE_SETUP -#line 284 "glcpp/glcpp-lex.l" +#line 290 "glcpp/glcpp-lex.l" { if (yyextra->space_tokens) { return SPACE; @@ -1456,7 +1451,7 @@ YY_RULE_SETUP case 41: /* rule 41 can match eol */ YY_RULE_SETUP -#line 290 "glcpp/glcpp-lex.l" +#line 296 "glcpp/glcpp-lex.l" { yyextra->lexing_if = 0; yylineno++; @@ -1466,7 +1461,7 @@ YY_RULE_SETUP YY_BREAK /* Handle missing newline at EOF. */ case YY_STATE_EOF(INITIAL): -#line 298 "glcpp/glcpp-lex.l" +#line 304 "glcpp/glcpp-lex.l" { BEGIN DONE; /* Don't keep matching this rule forever. */ yyextra->lexing_if = 0; @@ -1479,7 +1474,7 @@ case YY_STATE_EOF(INITIAL): warnings. */ case 42: YY_RULE_SETUP -#line 308 "glcpp/glcpp-lex.l" +#line 314 "glcpp/glcpp-lex.l" { unput('.'); yy_top_state(yyextra); @@ -1487,10 +1482,10 @@ YY_RULE_SETUP YY_BREAK case 43: YY_RULE_SETUP -#line 313 "glcpp/glcpp-lex.l" +#line 319 "glcpp/glcpp-lex.l" ECHO; YY_BREAK -#line 1494 "glcpp/glcpp-lex.c" +#line 1489 "glcpp/glcpp-lex.c" case YY_STATE_EOF(DONE): case YY_STATE_EOF(COMMENT): case YY_STATE_EOF(UNREACHABLE): @@ -1756,7 +1751,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 >= 165 ) + if ( yy_current_state >= 163 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; @@ -1780,11 +1775,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 >= 165 ) + if ( yy_current_state >= 163 ) 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 == 164); + yy_is_jam = (yy_current_state == 162); if ( ! yy_is_jam ) *yyg->yy_state_ptr++ = yy_current_state; @@ -2229,8 +2224,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. */ @@ -2684,7 +2679,7 @@ void glcpp_free (void * ptr , yyscan_t yyscanner) #define YYTABLES_NAME "yytables" -#line 313 "glcpp/glcpp-lex.l" +#line 319 "glcpp/glcpp-lex.l" -- cgit v1.2.3 From cf8bb19a114d753bca94f920b87dcf51aa26af99 Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Mon, 23 Aug 2010 09:42:14 -0700 Subject: glcpp: Fix segfault in standalone preprocessor for "file not found", etc. This error message was missing so that the program would simply segfault if the provided filename could not be opened for some reason. While we're at it, we add explicit support for a filename of "-" to indicate input from stdin. --- src/glsl/glcpp/glcpp.c | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/glsl/glcpp/glcpp.c b/src/glsl/glcpp/glcpp.c index e49a1df79c..011058a36a 100644 --- a/src/glsl/glcpp/glcpp.c +++ b/src/glsl/glcpp/glcpp.c @@ -25,6 +25,8 @@ #include #include #include +#include +#include #include "glcpp.h" extern int yydebug; @@ -35,10 +37,18 @@ 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; + int fd; + + if (file_name == NULL || strcmp(file_name, "-") == 0) { + fd = STDIN_FILENO; + } else { + fd = open (file_name, O_RDONLY); + + if (fd < 0) { + fprintf (stderr, "Failed to open file %s: %s\n", + file_name, strerror (errno)); + return NULL; + } } if (fstat(fd, & st) == 0) { @@ -82,6 +92,9 @@ main (int argc, char *argv[]) } shader = load_text_file(ctx, filename); + if (shader == NULL) + return 1; + ret = preprocess(ctx, &shader, &info_log, NULL); printf("%s", shader); -- cgit v1.2.3 From 21560c40e8aa98624a225752b98babc7ae2938d5 Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Mon, 23 Aug 2010 10:41:30 -0700 Subject: glcpp: Fix test suite to avoid flagging failed tests as valgrind errors. We recently added several tests that intentionally trigger preprocessor errors. During valgrind-based testing, our test script was noticing the non-zero return value from the preprocessor and incorrectly flagging the valgrind-based test as failing. To fix this, we make valgrind return an error code that is otherwise unused by the preprocessor. --- src/glsl/glcpp/tests/glcpp-test | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/glsl/glcpp/tests/glcpp-test b/src/glsl/glcpp/tests/glcpp-test index 6494d0c0e7..5dc08ea6ac 100755 --- a/src/glsl/glcpp/tests/glcpp-test +++ b/src/glsl/glcpp/tests/glcpp-test @@ -27,13 +27,14 @@ echo "" 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 + valgrind --error-exitcode=31 --log-file=$test.valgrind-errors ../glcpp < $test >/dev/null 2>&1 + if [ "$?" = "31" ]; then + echo "ERRORS" + cat $test.valgrind-errors + else echo "CLEAN" clean=$((clean+1)) rm $test.valgrind-errors - else - echo "ERRORS" - cat $test.valgrind-errors fi done -- cgit v1.2.3 From 61f73fec532b24ef5ec4b5baef81f5e6b9f20918 Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Mon, 23 Aug 2010 10:43:27 -0700 Subject: glcpp: Make standalone preprocessor work with a tty as stdin Previously glcpp would silently abort if it couldn't fstat the file being read, (so it would work with stdin redirected from a file, but would not work with stdin as a tty). The stat was so that glcpp could allocate a buffer for the file content in a single call. We now use talloc_realloc instead, (even if the fstat is possible). This is theoretically less efficient, but quite irrelevant, (particularly because the standalone preprocessor is used only for testing). --- src/glsl/glcpp/glcpp.c | 82 ++++++++++++++++++++++++++++++-------------------- 1 file changed, 49 insertions(+), 33 deletions(-) (limited to 'src') diff --git a/src/glsl/glcpp/glcpp.c b/src/glsl/glcpp/glcpp.c index 011058a36a..56714936bb 100644 --- a/src/glsl/glcpp/glcpp.c +++ b/src/glsl/glcpp/glcpp.c @@ -31,48 +31,64 @@ extern int yydebug; +/* Read from fd until EOF and return a string of everything read. + */ static char * -load_text_file(void *ctx, const char *file_name) +load_text_fd (void *ctx, int fd) { +#define CHUNK 4096 char *text = NULL; - struct stat st; + ssize_t text_size = 0; ssize_t total_read = 0; - int fd; + ssize_t bytes; + + while (1) { + if (total_read + CHUNK + 1 > text_size) { + text_size = text_size ? text_size * 2 : CHUNK + 1; + text = talloc_realloc_size (ctx, text, text_size); + if (text == NULL) { + fprintf (stderr, "Out of memory\n"); + return NULL; + } + } + bytes = read (fd, text + total_read, CHUNK); + if (bytes < 0) { + fprintf (stderr, "Error while reading: %s\n", + strerror (errno)); + talloc_free (text); + return NULL; + } - if (file_name == NULL || strcmp(file_name, "-") == 0) { - fd = STDIN_FILENO; - } else { - fd = open (file_name, O_RDONLY); + if (bytes == 0) { + break; + } - if (fd < 0) { - fprintf (stderr, "Failed to open file %s: %s\n", - file_name, strerror (errno)); - return NULL; - } + total_read += bytes; } - 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'; - } + text[total_read] = '\0'; + + return text; +} + +static char * +load_text_file(void *ctx, const char *filename) +{ + char *text; + int fd; + + if (filename == NULL || strcmp (filename, "-") == 0) + return load_text_fd (ctx, STDIN_FILENO); + + fd = open (filename, O_RDONLY); + if (fd < 0) { + fprintf (stderr, "Failed to open file %s: %s\n", + filename, strerror (errno)); + return NULL; } + text = load_text_fd (ctx, fd); + close(fd); return text; @@ -91,7 +107,7 @@ main (int argc, char *argv[]) filename = argv[1]; } - shader = load_text_file(ctx, filename); + shader = load_text_file (ctx, filename); if (shader == NULL) return 1; -- cgit v1.2.3 From ebef04011736ea8e13692fed87623d425c4d1b08 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 23 Aug 2010 10:57:54 -0700 Subject: ir_to_mesa: Fix constant array handling to return the temp we created. We ended up returning CONST[loc] rather than TEMP[loc2]. Things would *usually* end up working out OK, since the constants often ended up getting allocated to CONST[loc..loc+columns] with no swizzle. But for the case where the contigous temporary copy of the swizzled constant vec4 args was actually needed, we'd end up reading some other constant values, possibly including ones not actually allocated. Fixes: glsl-varying-mat3x2. --- src/mesa/program/ir_to_mesa.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp index 676f68e5a0..17ebdbb220 100644 --- a/src/mesa/program/ir_to_mesa.cpp +++ b/src/mesa/program/ir_to_mesa.cpp @@ -1817,6 +1817,7 @@ ir_to_mesa_visitor::visit(ir_constant *ir) } this->result = mat; + return; } src_reg.file = PROGRAM_CONSTANT; -- cgit v1.2.3 From 4b2b5f8e30347ce0a1818524f8825335d47eb5ca Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sun, 22 Aug 2010 18:40:48 -0600 Subject: tgsi: fix false CondStackTop==0 assertion --- src/gallium/auxiliary/tgsi/tgsi_exec.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src') diff --git a/src/gallium/auxiliary/tgsi/tgsi_exec.c b/src/gallium/auxiliary/tgsi/tgsi_exec.c index 298f3d0a8b..0757f05dfa 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_exec.c +++ b/src/gallium/auxiliary/tgsi/tgsi_exec.c @@ -3239,6 +3239,8 @@ exec_instruction( if (mach->CallStackTop == 0) { /* returning from main() */ + mach->CondStackTop = 0; + mach->LoopStackTop = 0; *pc = -1; return; } @@ -3767,6 +3769,9 @@ tgsi_exec_machine_run( struct tgsi_exec_machine *mach ) } #endif + /* Strictly speaking, these assertions aren't really needed but they + * can potentially catch some bugs in the control flow code. + */ assert(mach->CondStackTop == 0); assert(mach->LoopStackTop == 0); assert(mach->ContStackTop == 0); -- cgit v1.2.3 From 4ab1001ac28b5716e1b103df44d04b8a8ddd2375 Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Mon, 23 Aug 2010 20:27:40 +0200 Subject: nvfx: improve fp temp accounting --- src/gallium/drivers/nvfx/nvfx_fragprog.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/nvfx/nvfx_fragprog.c b/src/gallium/drivers/nvfx/nvfx_fragprog.c index 7caddfab70..7f6b3f6599 100644 --- a/src/gallium/drivers/nvfx/nvfx_fragprog.c +++ b/src/gallium/drivers/nvfx/nvfx_fragprog.c @@ -21,6 +21,7 @@ struct nvfx_fpc { struct nvfx_pipe_fragment_program* pfp; struct nvfx_fragment_program *fp; + unsigned max_temps; unsigned long long r_temps; unsigned long long r_temps_discard; struct nvfx_reg r_result[PIPE_MAX_SHADER_OUTPUTS]; @@ -51,9 +52,9 @@ struct nvfx_fpc { static INLINE struct nvfx_reg temp(struct nvfx_fpc *fpc) { - int idx = ffsll(~fpc->r_temps) - 1; + int idx = __builtin_ctzll(~fpc->r_temps); - if (idx < 0) { + if (idx >= fpc->max_temps) { NOUVEAU_ERR("out of temps!!\n"); assert(0); return nvfx_reg(NVFXSR_TEMP, 0); @@ -1022,6 +1023,7 @@ nvfx_fragprog_translate(struct nvfx_context *nvfx, if (!fpc) goto out_err; + fpc->max_temps = nvfx->is_nv4x ? 48 : 32; fpc->pfp = pfp; fpc->fp = fp; fpc->num_regs = 2; -- cgit v1.2.3 From 6355ae2b80a01b1d58824ffeae0c638d917519c0 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Mon, 23 Aug 2010 12:36:40 -0700 Subject: generate_builtins.py: Generate output in sorted order. --- src/glsl/builtins/tools/generate_builtins.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/glsl/builtins/tools/generate_builtins.py b/src/glsl/builtins/tools/generate_builtins.py index d793c28443..2a763d784b 100755 --- a/src/glsl/builtins/tools/generate_builtins.py +++ b/src/glsl/builtins/tools/generate_builtins.py @@ -1,7 +1,8 @@ #!/usr/bin/python # -*- coding: UTF-8 -*- -import re, glob +import re +from glob import glob from os import path from subprocess import Popen, PIPE @@ -12,7 +13,7 @@ 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'), '*')): + for filename in glob(path.join(path.join(builtins_dir, 'ir'), '*')): with open(filename) as f: fs[path.basename(filename)] = f.read() @@ -29,7 +30,7 @@ def stringify(s): def write_function_definitions(): fs = get_builtin_definitions() - for k, v in fs.iteritems(): + for k, v in sorted(fs.iteritems()): print 'static const char *builtin_' + k + ' =' print stringify(v), ';' @@ -74,7 +75,7 @@ def write_profile(filename, profile): function_names.add(func.group(1)) print 'static const char *functions_for_' + profile + ' [] = {' - for func in function_names: + for func in sorted(function_names): print ' builtin_' + func + ',' print '};' @@ -85,7 +86,7 @@ def write_profiles(): def get_profile_list(): profiles = [] - for pfile in glob.glob(path.join(path.join(builtins_dir, 'profiles'), '*')): + for pfile in sorted(glob(path.join(path.join(builtins_dir, 'profiles'), '*'))): profiles.append((pfile, path.basename(pfile).replace('.', '_'))) return profiles -- cgit v1.2.3 From bcf7f66a934ebd9c91da90d6e1f9b169c33c746c Mon Sep 17 00:00:00 2001 From: Jerome Glisse Date: Mon, 23 Aug 2010 15:39:39 -0400 Subject: r600g: export one component per pixel + r7xx uncompression shader We need to always at least export one component (wether it's depth or color. Add valid r7xx shader program for depth decompression. Signed-off-by: Jerome Glisse --- src/gallium/drivers/r600/r600_blit.c | 58 +++++++++++++++++++++++++++++++--- src/gallium/drivers/r600/r600_screen.c | 23 ++++++++++++++ src/gallium/drivers/r600/r600_screen.h | 7 ++++ src/gallium/drivers/r600/r600_shader.c | 4 +++ src/gallium/drivers/r600/r600_state.c | 2 +- 5 files changed, 89 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/r600_blit.c b/src/gallium/drivers/r600/r600_blit.c index 1a975da4bd..72175fbbd5 100644 --- a/src/gallium/drivers/r600/r600_blit.c +++ b/src/gallium/drivers/r600/r600_blit.c @@ -242,7 +242,7 @@ static struct radeon_state *r600_blit_state_vs_shader(struct r600_screen *rscree { struct radeon_state *rstate; struct radeon_bo *bo; - u32 shader_bc[] = { + u32 shader_bc_r600[] = { 0x00000004, 0x81000400, 0x00000008, 0xA01C0000, 0xC001A03C, 0x94000688, @@ -260,6 +260,24 @@ static struct radeon_state *r600_blit_state_vs_shader(struct r600_screen *rscree 0x00000802, 0x40801910, 0x80000C02, 0x60801910 }; + u32 shader_bc_r700[] = { + 0x00000004, 0x81000400, + 0x00000008, 0xA01C0000, + 0xC001A03C, 0x94000688, + 0xC0024000, 0x94200688, + 0x7C000000, 0x002D1001, + 0x00080000, 0x00000000, + 0x7C000100, 0x002D1002, + 0x00080000, 0x00000000, + 0x00000001, 0x00600C90, + 0x00000401, 0x20600C90, + 0x00000801, 0x40600C90, + 0x80000C01, 0x60600C90, + 0x00000002, 0x00800C90, + 0x00000402, 0x20800C90, + 0x00000802, 0x40800C90, + 0x80000C02, 0x60800C90 + }; /* simple shader */ bo = radeon_bo(rscreen->rw, 0, 128, 4096, NULL); @@ -270,7 +288,19 @@ static struct radeon_state *r600_blit_state_vs_shader(struct r600_screen *rscree radeon_bo_decref(rscreen->rw, bo); return NULL; } - memcpy(bo->data, shader_bc, 128); + switch (rscreen->chip_class) { + case R600: + memcpy(bo->data, shader_bc_r600, 128); + break; + case R700: + memcpy(bo->data, shader_bc_r700, 128); + break; + default: + R600_ERR("unsupported chip family\n"); + radeon_bo_unmap(rscreen->rw, bo); + radeon_bo_decref(rscreen->rw, bo); + return NULL; + } radeon_bo_unmap(rscreen->rw, bo); rstate = radeon_state(rscreen->rw, R600_VS_SHADER_TYPE, R600_VS_SHADER); @@ -303,7 +333,7 @@ static struct radeon_state *r600_blit_state_ps_shader(struct r600_screen *rscree { struct radeon_state *rstate; struct radeon_bo *bo; - u32 shader_bc[] = { + u32 shader_bc_r600[] = { 0x00000002, 0xA00C0000, 0xC0008000, 0x94200688, 0x00000000, 0x00201910, @@ -311,6 +341,14 @@ static struct radeon_state *r600_blit_state_ps_shader(struct r600_screen *rscree 0x00000800, 0x40201910, 0x80000C00, 0x60201910 }; + u32 shader_bc_r700[] = { + 0x00000002, 0xA00C0000, + 0xC0008000, 0x94200688, + 0x00000000, 0x00200C90, + 0x00000400, 0x20200C90, + 0x00000800, 0x40200C90, + 0x80000C00, 0x60200C90 + }; /* simple shader */ bo = radeon_bo(rscreen->rw, 0, 128, 4096, NULL); @@ -321,7 +359,19 @@ static struct radeon_state *r600_blit_state_ps_shader(struct r600_screen *rscree if (radeon_bo_map(rscreen->rw, bo)) { return NULL; } - memcpy(bo->data, shader_bc, 48); + switch (rscreen->chip_class) { + case R600: + memcpy(bo->data, shader_bc_r600, 48); + break; + case R700: + memcpy(bo->data, shader_bc_r700, 48); + break; + default: + R600_ERR("unsupported chip family\n"); + radeon_bo_unmap(rscreen->rw, bo); + radeon_bo_decref(rscreen->rw, bo); + return NULL; + } radeon_bo_unmap(rscreen->rw, bo); rstate = radeon_state(rscreen->rw, R600_PS_SHADER_TYPE, R600_PS_SHADER); diff --git a/src/gallium/drivers/r600/r600_screen.c b/src/gallium/drivers/r600/r600_screen.c index cdaca9ed7d..1358432957 100644 --- a/src/gallium/drivers/r600/r600_screen.c +++ b/src/gallium/drivers/r600/r600_screen.c @@ -234,11 +234,34 @@ static void r600_destroy_screen(struct pipe_screen* pscreen) struct pipe_screen *r600_screen_create(struct radeon *rw) { struct r600_screen* rscreen; + enum radeon_family family = radeon_get_family(rw); rscreen = CALLOC_STRUCT(r600_screen); if (rscreen == NULL) { return NULL; } + + switch (family) { + case CHIP_R600: + case CHIP_RV610: + case CHIP_RV630: + case CHIP_RV670: + case CHIP_RV620: + case CHIP_RV635: + case CHIP_RS780: + case CHIP_RS880: + rscreen->chip_class = R600; + break; + case CHIP_RV770: + case CHIP_RV730: + case CHIP_RV710: + case CHIP_RV740: + rscreen->chip_class = R700; + break; + default: + FREE(rscreen); + return NULL; + } rscreen->rw = rw; rscreen->screen.winsys = (struct pipe_winsys*)rw; rscreen->screen.destroy = r600_destroy_screen; diff --git a/src/gallium/drivers/r600/r600_screen.h b/src/gallium/drivers/r600/r600_screen.h index 5e82ac8e23..438976f654 100644 --- a/src/gallium/drivers/r600/r600_screen.h +++ b/src/gallium/drivers/r600/r600_screen.h @@ -42,9 +42,16 @@ struct r600_transfer { struct pipe_resource *linear_texture; }; +enum chip_class { + R600, + R700, + EVERGREEN, +}; + struct r600_screen { struct pipe_screen screen; struct radeon *rw; + enum chip_class chip_class; }; static INLINE struct r600_screen *r600_screen(struct pipe_screen *screen) diff --git a/src/gallium/drivers/r600/r600_shader.c b/src/gallium/drivers/r600/r600_shader.c index 5cdbe2bfe8..b20a5a11be 100644 --- a/src/gallium/drivers/r600/r600_shader.c +++ b/src/gallium/drivers/r600/r600_shader.c @@ -191,6 +191,10 @@ static int r600_pipe_shader_ps(struct pipe_context *ctx, struct r600_context_sta num_cout++; } } + if (!exports_ps) { + /* always at least export 1 component per pixel */ + exports_ps = 2; + } state->states[R600_PS_SHADER__SPI_PS_IN_CONTROL_0] = S_0286CC_NUM_INTERP(rshader->ninput) | S_0286CC_PERSP_GRADIENT_ENA(1); state->states[R600_PS_SHADER__SPI_PS_IN_CONTROL_1] = 0x00000000; diff --git a/src/gallium/drivers/r600/r600_state.c b/src/gallium/drivers/r600/r600_state.c index c3ef6267b2..12a61cacda 100644 --- a/src/gallium/drivers/r600/r600_state.c +++ b/src/gallium/drivers/r600/r600_state.c @@ -775,7 +775,7 @@ static struct radeon_state *r600_db(struct r600_context *rctx) rtex = (struct r600_resource_texture*)state->zsbuf->texture; rtex->tilled = 1; rtex->array_mode = 2; - rtex->tile_type = 0; + rtex->tile_type = 1; rtex->depth = 1; rbuffer = &rtex->resource; -- cgit v1.2.3 From c0eb479e0782c063a1a781f81b99a18ef649e9ef Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Mon, 23 Aug 2010 21:43:11 +0200 Subject: auxiliary: fix nvfx/nv50 primitive splitting for line loops s->close_first was on the wrong side of the inequality. Caught by blender. Thanks to AndrewR for reporting this. --- src/gallium/auxiliary/util/u_split_prim.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/auxiliary/util/u_split_prim.h b/src/gallium/auxiliary/util/u_split_prim.h index 206e1ec311..e63a7c1fad 100644 --- a/src/gallium/auxiliary/util/u_split_prim.h +++ b/src/gallium/auxiliary/util/u_split_prim.h @@ -48,7 +48,7 @@ util_split_prim_next(struct util_split_prim *s, unsigned max_verts) } } - if (s->p_start + s->close_first + max_verts >= s->p_end) { + if ((s->p_end - s->p_start) + s->close_first <= max_verts) { s->emit(s->priv, s->p_start, s->p_end - s->p_start); if (s->close_first) s->emit(s->priv, s->start, 1); -- cgit v1.2.3 From 44a6c13ac33fc00fc4d0cf7435ac23eaa8058300 Mon Sep 17 00:00:00 2001 From: Aras Pranckevicius Date: Mon, 23 Aug 2010 09:19:51 +0300 Subject: mesa: Fix msvc build of glsl. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: José Fonseca --- src/mesa/main/imports.h | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/mesa/main/imports.h b/src/mesa/main/imports.h index e967b14731..22ac26e15e 100644 --- a/src/mesa/main/imports.h +++ b/src/mesa/main/imports.h @@ -120,7 +120,7 @@ typedef union { GLfloat f; GLint i; } fi_type; * \name Work-arounds for platforms that lack C99 math functions */ /*@{*/ -#if (defined(_XOPEN_SOURCE) && (_XOPEN_SOURCE < 600)) && !defined(_ISOC99_SOURCE) \ +#if (!defined(_XOPEN_SOURCE) || (_XOPEN_SOURCE < 600)) && !defined(_ISOC99_SOURCE) \ && (!defined(__STDC_VERSION__) || (__STDC_VERSION__ < 199901L)) \ && (!defined(_MSC_VER) || (_MSC_VER < 1400)) #define acosf(f) ((float) acos(f)) @@ -141,7 +141,12 @@ typedef union { GLfloat f; GLint i; } fi_type; #define sqrtf(f) ((float) sqrt(f)) #define tanf(f) ((float) tan(f)) #define tanhf(f) ((float) tanh(f)) -#define truncf(f) ((float) trunc(f)) +#endif + +#if defined(_MSC_VER) +static INLINE float truncf(float x) { return x < 0.0f ? ceilf(x) : floorf(x); } +static INLINE float exp2f(float x) { return powf(2.0f, x); } +static INLINE float log2f(float x) { return logf(x) * 1.442695041f; } #endif /*@}*/ -- cgit v1.2.3 From 6dad5a4e8d5c4ea90bb9342e329defb9c8eb2092 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Thu, 12 Aug 2010 17:57:07 -0700 Subject: glsl2: Include imports.h to get snprintf wrapper for MSVC MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: José Fonseca --- src/glsl/glsl_types.cpp | 1 + src/glsl/ir_explog_to_explog2.cpp | 2 +- src/mesa/main/imports.h | 6 ++++++ 3 files changed, 8 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/glsl/glsl_types.cpp b/src/glsl/glsl_types.cpp index 8e80cf99e9..518abc959d 100644 --- a/src/glsl/glsl_types.cpp +++ b/src/glsl/glsl_types.cpp @@ -29,6 +29,7 @@ #include "glsl_types.h" #include "builtin_types.h" extern "C" { +#include "main/imports.h" #include "program/hash_table.h" } diff --git a/src/glsl/ir_explog_to_explog2.cpp b/src/glsl/ir_explog_to_explog2.cpp index 4fe1daaee9..9bf8271081 100644 --- a/src/glsl/ir_explog_to_explog2.cpp +++ b/src/glsl/ir_explog_to_explog2.cpp @@ -29,7 +29,7 @@ * and log2 operations. */ -#include +#include "main/imports.h" #include "ir.h" #include "glsl_types.h" diff --git a/src/mesa/main/imports.h b/src/mesa/main/imports.h index 22ac26e15e..6c2ef52d35 100644 --- a/src/mesa/main/imports.h +++ b/src/mesa/main/imports.h @@ -578,6 +578,12 @@ _mesa_error( __GLcontext *ctx, GLenum error, const char *fmtString, ... ); extern void _mesa_debug( const __GLcontext *ctx, const char *fmtString, ... ); + +#if defined(_MSC_VER) && !defined(snprintf) +#define snprintf _snprintf +#endif + + #ifdef __cplusplus } #endif -- cgit v1.2.3 From 18a60239001c27ff98739865d5fc70fd3d011b2e Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 23 Aug 2010 11:29:25 -0700 Subject: glsl: Count function call outvals as writing to variables for linker checks. Fixes: glsl-vs-position-outval. Bug #28138 (regnum online) --- src/glsl/linker.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'src') diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp index deb30d7fec..38d19c4c71 100644 --- a/src/glsl/linker.cpp +++ b/src/glsl/linker.cpp @@ -106,6 +106,27 @@ public: return visit_continue_with_parent; } + virtual ir_visitor_status 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 *sig_param = (ir_variable *)sig_iter.get(); + + if (sig_param->mode == ir_var_out || + sig_param->mode == ir_var_inout) { + ir_variable *var = param_rval->variable_referenced(); + if (var && strcmp(name, var->name) == 0) { + found = true; + return visit_stop; + } + } + sig_iter.next(); + } + + return visit_continue_with_parent; + } + bool variable_found() { return found; -- cgit v1.2.3 From 66afcb560771b6ba6ad668156e9f442e86b9a7a2 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 23 Aug 2010 12:53:39 -0700 Subject: ir_to_mesa: Implement f2b by comparing the arg to 0, not the result. Fixes: glsl-fs-any --- src/mesa/program/ir_to_mesa.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp index 17ebdbb220..7a615f2d58 100644 --- a/src/mesa/program/ir_to_mesa.cpp +++ b/src/mesa/program/ir_to_mesa.cpp @@ -911,7 +911,7 @@ ir_to_mesa_visitor::visit(ir_expression *ir) case ir_unop_f2b: case ir_unop_i2b: ir_to_mesa_emit_op2(ir, OPCODE_SNE, result_dst, - result_src, src_reg_for_float(0.0)); + op[0], src_reg_for_float(0.0)); break; case ir_unop_trunc: ir_to_mesa_emit_op1(ir, OPCODE_TRUNC, result_dst, op[0]); -- cgit v1.2.3 From 47003a8f653db881fbafc96fca93aba38ea3ebc2 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 23 Aug 2010 12:39:35 -0700 Subject: glsl: Regenerate builtins with the new sorting. --- src/glsl/builtin_function.cpp | 16310 ++++++++++++++++++++-------------------- 1 file changed, 8155 insertions(+), 8155 deletions(-) (limited to 'src') diff --git a/src/glsl/builtin_function.cpp b/src/glsl/builtin_function.cpp index b4138d0af7..517a6ad86d 100644 --- a/src/glsl/builtin_function.cpp +++ b/src/glsl/builtin_function.cpp @@ -70,6 +70,55 @@ read_builtins(GLenum target, const char *protos, const char **functions, unsigne return sh; } +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 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 *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" + " (declare (in) vec4 x))\n" + " ((return (expression vec4 - (constant float (1.5707963))\n" + " (call asin ((var_ref x)))))))\n" + "))\n" + "" +; static const char *builtin_all = "((function all\n" " (signature bool\n" @@ -89,541 +138,569 @@ static const char *builtin_all = "))\n" "" ; -static const char *builtin_textureProj = - "((function textureProj\n" - " (signature vec4\n" +static const char *builtin_any = + "((function any\n" + " (signature bool\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) 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) 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" + " (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 uvec4\n" + " (signature bool\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" + " (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_asin = + "((function asin\n" + " (signature float\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) 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" "\n" - " (signature ivec4\n" + " (signature vec2\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) 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" "\n" - " (signature uvec4\n" + " (signature vec3\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) 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" "\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" + " (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" + "" +; +static const char *builtin_atan = + "((function atan\n" + " (signature float\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) 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 ivec4\n" + " (signature vec2\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" + " (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 uvec4\n" + " (signature vec3\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) 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) 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) 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 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" - " (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" + " (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" - " (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" + " (\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" + " )\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" - " (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" "\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" + " (return (var_ref r) )\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" "\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" + " (signature vec2\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" + " (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 uvec4\n" + " (signature vec3\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" + " (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" " (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" + " (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" "))\n" "" ; -static const char *builtin_fwidth = - "((function fwidth\n" +static const char *builtin_ceil = + "((function ceil\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 arg0))\n" + " ((return (expression float ceil (var_ref arg0)))))\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 arg0))\n" + " ((return (expression vec2 ceil (var_ref arg0)))))\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 arg0))\n" + " ((return (expression vec3 ceil (var_ref arg0)))))\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 arg0))\n" + " ((return (expression vec4 ceil (var_ref arg0)))))\n" "))\n" "" ; -static const char *builtin_texture2DProj = - "((function texture2DProj\n" - " (signature vec4\n" +static const char *builtin_clamp = + "((function clamp\n" + " (signature float\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) 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 vec4\n" + " (signature vec2\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) 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 vec4\n" + " (signature vec3\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) 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) 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) 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" + " (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" - "))\n" - "" -; -static const char *builtin_texture3DLod = - "((function texture3DLod\n" - " (signature vec4\n" + " (signature vec2\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) 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" - "))\n" - "" -; -static const char *builtin_textureCubeLod = - "((function textureCubeLod\n" - " (signature vec4\n" + " (signature vec3\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) 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" - "))\n" - "" -; -static const char *builtin_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 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 ivec4\n" + " (signature int\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) 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 uvec4\n" + " (signature ivec2\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) 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 vec4\n" + " (signature ivec3\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) 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) isampler2D 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 (in) ivec4 arg2))\n" + " ((return (expression ivec4 max (expression ivec4 min (var_ref arg0) (var_ref arg2)) (var_ref arg1)))))\n" "\n" - " (signature uvec4\n" + " (signature ivec2\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) 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 vec4\n" + " (signature ivec3\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) 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 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" + " (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 uvec4\n" + " (signature uint\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) 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 vec4\n" + " (signature uvec2\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) 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 ivec4\n" + " (signature uvec3\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) 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) usamplerCube 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" + " (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) sampler1DArray sampler)\n" - " (declare (in) vec2 P) )\n" - " ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () ))))\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 ivec4\n" + " (signature uvec3\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) 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 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" + " (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_cos = + "((function cos\n" + " (signature float\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) float angle))\n" + " ((return (expression float cos (var_ref angle)))))\n" "\n" - " (signature ivec4\n" + " (signature vec2\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) vec2 angle))\n" + " ((return (expression vec2 cos (var_ref angle)))))\n" "\n" - " (signature uvec4\n" + " (signature vec3\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) vec3 angle))\n" + " ((return (expression vec3 cos (var_ref angle)))))\n" "\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" + " (declare (in) vec4 angle))\n" + " ((return (expression vec4 cos (var_ref angle)))))\n" + "))\n" + "" +; +static const char *builtin_cosh = + "((function cosh\n" + " (signature float\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" + " (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) 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" + " (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) 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) 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) 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" + " (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_cross = + "((function cross\n" + " (signature vec3\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" + " (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_dFdx = + "((function dFdx\n" + " (signature float\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) float p))\n" + " ((return (expression float dFdx (var_ref p)))))\n" "\n" - " (signature ivec4\n" + " (signature vec2\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) vec2 p))\n" + " ((return (expression vec2 dFdx (var_ref p)))))\n" "\n" - " (signature uvec4\n" + " (signature vec3\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) vec3 p))\n" + " ((return (expression vec3 dFdx (var_ref p)))))\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" + " (declare (in) vec4 p))\n" + " ((return (expression vec4 dFdx (var_ref p)))))\n" + "))\n" + "" +; +static const char *builtin_dFdy = + "((function dFdy\n" + " (signature float\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" + " (declare (in) float p))\n" + " ((return (expression float dFdy (var_ref p)))))\n" "\n" - " (signature ivec4\n" + " (signature vec2\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) vec2 p))\n" + " ((return (expression vec2 dFdy (var_ref p)))))\n" "\n" - " (signature uvec4\n" + " (signature vec3\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) vec3 p))\n" + " ((return (expression vec3 dFdy (var_ref p)))))\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" + " (declare (in) vec4 p))\n" + " ((return (expression vec4 dFdy (var_ref p)))))\n" "))\n" "" ; @@ -651,1333 +728,1444 @@ static const char *builtin_degrees = "))\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" +static const char *builtin_distance = + "((function distance\n" " (signature float\n" " (parameters\n" - " (declare (in) float arg0))\n" - " ((return (expression float ceil (var_ref arg0)))))\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 vec2\n" + " (signature float\n" " (parameters\n" - " (declare (in) vec2 arg0))\n" - " ((return (expression vec2 ceil (var_ref arg0)))))\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 vec3\n" + " (signature float\n" " (parameters\n" - " (declare (in) vec3 arg0))\n" - " ((return (expression vec3 ceil (var_ref arg0)))))\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 vec4\n" + " (signature float\n" " (parameters\n" - " (declare (in) vec4 arg0))\n" - " ((return (expression vec4 ceil (var_ref arg0)))))\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_texture1D = - "((function texture1D\n" - " (signature vec4\n" +static const char *builtin_dot = + "((function dot\n" + " (signature float\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) float arg0)\n" + " (declare (in) float arg1))\n" + " ((return (expression float dot (var_ref arg0) (var_ref arg1)))))\n" "\n" - " (signature vec4\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) 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 *builtin_not = - "((function not\n" +static const char *builtin_equal = + "((function equal\n" " (signature bvec2\n" " (parameters\n" - " (declare (in) bvec2 arg0))\n" - " ((return (expression bvec2 ! (var_ref arg0)))))\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) bvec3 arg0))\n" - " ((return (expression bvec3 ! (var_ref arg0)))))\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) bvec4 arg0))\n" - " ((return (expression bvec4 ! (var_ref arg0)))))\n" - "))\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" + " (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) 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" + " (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" + " (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" + " (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 *builtin_mod = - "((function mod\n" +static const char *builtin_exp = + "((function exp\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) float arg0))\n" + " ((return (expression float exp (var_ref arg0)))))\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" + " (declare (in) vec2 arg0))\n" + " ((return (expression vec2 exp (var_ref arg0)))))\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" + " (declare (in) vec3 arg0))\n" + " ((return (expression vec3 exp (var_ref arg0)))))\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) vec4 arg0))\n" + " ((return (expression vec4 exp (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 vec2\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) vec2 arg0))\n" + " ((return (expression vec2 exp2 (var_ref arg0)))))\n" "\n" " (signature vec3\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) vec3 arg0))\n" + " ((return (expression vec3 exp2 (var_ref arg0)))))\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" + " (declare (in) vec4 arg0))\n" + " ((return (expression vec4 exp2 (var_ref arg0)))))\n" "))\n" "" ; -static const char *builtin_radians = - "((function radians\n" +static const char *builtin_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 *builtin_floor = + "((function floor\n" " (signature float\n" " (parameters\n" " (declare (in) float arg0))\n" - " ((return (expression float * (var_ref arg0) (constant float (0.017453))))))\n" + " ((return (expression float floor (var_ref arg0)))))\n" "\n" " (signature vec2\n" " (parameters\n" " (declare (in) vec2 arg0))\n" - " ((return (expression vec2 * (var_ref arg0) (constant float (0.017453))))))\n" + " ((return (expression vec2 floor (var_ref arg0)))))\n" "\n" " (signature vec3\n" " (parameters\n" " (declare (in) vec3 arg0))\n" - " ((return (expression vec3 * (var_ref arg0) (constant float (0.017453))))))\n" + " ((return (expression vec3 floor (var_ref arg0)))))\n" "\n" " (signature vec4\n" " (parameters\n" " (declare (in) vec4 arg0))\n" - " ((return (expression vec4 * (var_ref arg0) (constant float (0.017453))))))\n" + " ((return (expression vec4 floor (var_ref arg0)))))\n" "))\n" "" ; -static const char *builtin_smoothstep = - "((function smoothstep\n" +static const char *builtin_fract = + "((function fract\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" + " ((return (expression float fract (var_ref x)))))\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" + " ((return (expression vec2 fract (var_ref x)))))\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" + " ((return (expression vec3 fract (var_ref x)))))\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" + " ((return (expression vec4 fract (var_ref x)))))\n" + "))\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" + "" +; +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" + " ((return (expression vec4 *\n" + " (var_ref gl_ModelViewProjectionMatrix)\n" + " (var_ref gl_Vertex)))))\n" + "))\n" + "" +; +static const char *builtin_fwidth = + "((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 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) 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 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) 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 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" + " (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" - "\n" "" ; -static const char *builtin_textureProjGrad = - "((function textureProjGrad\n" - " (signature vec4\n" +static const char *builtin_greaterThan = + "((function greaterThan\n" + " (signature bvec2\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) 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 ivec4\n" + " (signature bvec3\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) 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 uvec4\n" + " (signature bvec4\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) 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) 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) 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 ivec4\n" + " (signature bvec3\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) 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 uvec4\n" + " (signature bvec4\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) 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 vec4\n" + " (signature bvec2\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) 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 ivec4\n" + " (signature bvec3\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) 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 uvec4\n" + " (signature bvec4\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" + " (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_greaterThanEqual = + "((function greaterThanEqual\n" + " (signature bvec2\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) 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 ivec4\n" + " (signature bvec3\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) 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 uvec4\n" + " (signature bvec4\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) 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) 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) 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 ivec4\n" + " (signature bvec3\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) 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 uvec4\n" + " (signature bvec4\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) 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 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 *builtin_dFdx = - "((function dFdx\n" +static const char *builtin_inversesqrt = + "((function inversesqrt\n" " (signature float\n" " (parameters\n" - " (declare (in) float p))\n" - " ((return (expression float dFdx (var_ref p)))))\n" + " (declare (in) float arg0))\n" + " ((return (expression float rsq (var_ref arg0)))))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in) vec2 p))\n" - " ((return (expression vec2 dFdx (var_ref p)))))\n" + " (declare (in) vec2 arg0))\n" + " ((return (expression vec2 rsq (var_ref arg0)))))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in) vec3 p))\n" - " ((return (expression vec3 dFdx (var_ref p)))))\n" + " (declare (in) vec3 arg0))\n" + " ((return (expression vec3 rsq (var_ref arg0)))))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in) vec4 p))\n" - " ((return (expression vec4 dFdx (var_ref p)))))\n" + " (declare (in) vec4 arg0))\n" + " ((return (expression vec4 rsq (var_ref arg0)))))\n" "))\n" "" ; -static const char *builtin_dFdy = - "((function dFdy\n" +static const char *builtin_length = + "((function length\n" " (signature float\n" " (parameters\n" - " (declare (in) float p))\n" - " ((return (expression float dFdy (var_ref p)))))\n" + " (declare (in) float arg0))\n" + " ((return (expression float sqrt (expression float dot (var_ref arg0) (var_ref arg0))))))\n" "\n" - " (signature vec2\n" + " (signature float\n" " (parameters\n" - " (declare (in) vec2 p))\n" - " ((return (expression vec2 dFdy (var_ref p)))))\n" + " (declare (in) vec2 arg0))\n" + " ((return (expression float sqrt (expression float dot (var_ref arg0) (var_ref arg0))))))\n" "\n" - " (signature vec3\n" + " (signature float\n" " (parameters\n" - " (declare (in) vec3 p))\n" - " ((return (expression vec3 dFdy (var_ref p)))))\n" + " (declare (in) vec3 arg0))\n" + " ((return (expression float sqrt (expression float dot (var_ref arg0) (var_ref arg0))))))\n" "\n" - " (signature vec4\n" + " (signature float\n" " (parameters\n" - " (declare (in) vec4 p))\n" - " ((return (expression vec4 dFdy (var_ref p)))))\n" + " (declare (in) vec4 arg0))\n" + " ((return (expression float sqrt (expression float dot (var_ref arg0) (var_ref arg0))))))\n" "))\n" "" ; -static const char *builtin_textureGrad = - "((function textureGrad\n" - " (signature vec4\n" +static const char *builtin_lessThan = + "((function lessThan\n" + " (signature bvec2\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) 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 ivec4\n" + " (signature bvec3\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) 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 uvec4\n" + " (signature bvec4\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" + " (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) 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) 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 ivec4\n" + " (signature bvec3\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) 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 uvec4\n" + " (signature bvec4\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) 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 vec4\n" + " (signature bvec2\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) 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 ivec4\n" + " (signature bvec3\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) 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 uvec4\n" + " (signature bvec4\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" + " (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_lessThanEqual = + "((function lessThanEqual\n" + " (signature bvec2\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) 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 ivec4\n" + " (signature bvec3\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) 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 uvec4\n" + " (signature bvec4\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) 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) 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) 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 ivec4\n" + " (signature bvec3\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) 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 uvec4\n" + " (signature bvec4\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) 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 vec4\n" + " (signature bvec2\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) 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 ivec4\n" + " (signature bvec3\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) 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 uvec4\n" + " (signature bvec4\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" + " (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_clamp = - "((function clamp\n" +static const char *builtin_log = + "((function log\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) float arg0))\n" + " ((return (expression float log (var_ref arg0)))))\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" + " (declare (in) vec2 arg0))\n" + " ((return (expression vec2 log (var_ref arg0)))))\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" + " (declare (in) vec3 arg0))\n" + " ((return (expression vec3 log (var_ref arg0)))))\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) vec4 arg0))\n" + " ((return (expression vec4 log (var_ref arg0)))))\n" + "))\n" + "" +; +static const char *builtin_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" - " (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) vec2 arg0))\n" + " ((return (expression vec2 log2 (var_ref arg0)))))\n" "\n" " (signature vec3\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) vec3 arg0))\n" + " ((return (expression vec3 log2 (var_ref arg0)))))\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" - " (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" + " (declare (in) vec4 arg0))\n" + " ((return (expression vec4 log2 (var_ref arg0)))))\n" + "))\n" + "" +; +static const char *builtin_matrixCompMult = + "((function matrixCompMult\n" + " (signature mat2\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) 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 ivec3\n" + " (signature mat3\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) 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 ivec4\n" + " (signature mat4\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) 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 ivec2\n" + " (signature mat2x3\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) 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 ivec3\n" + " (signature mat3x2\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) 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 ivec4\n" + " (signature mat2x4\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) 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 uint\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 *builtin_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" + " ((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" + " ((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" + " ((return (expression vec4 max (var_ref arg0) (var_ref arg1)))))\n" + "\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" + " ((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" + " ((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" + " ((return (expression ivec4 max (var_ref arg0) (var_ref arg1)))))\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" + " (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" - " (declare (in) uvec2 arg2))\n" - " ((return (expression uvec2 max (expression uvec2 min (var_ref arg0) (var_ref arg2)) (var_ref arg1)))))\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" - " (declare (in) uvec3 arg2))\n" - " ((return (expression uvec3 max (expression uvec3 min (var_ref arg0) (var_ref arg2)) (var_ref arg1)))))\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" - " (declare (in) uvec4 arg2))\n" - " ((return (expression uvec4 max (expression uvec4 min (var_ref arg0) (var_ref arg2)) (var_ref arg1)))))\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 (in) uint arg2))\n" - " ((return (expression uvec2 max (expression uvec2 min (var_ref arg0) (var_ref arg2)) (var_ref arg1)))))\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" " (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) 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) 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) sampler2DRect sampler)\n" - " (declare (in) vec2 P) )\n" - " ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () ))))\n" - "\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_cosh = - "((function cosh\n" +static const char *builtin_min = + "((function min\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" + " (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 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" + " (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 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 *builtin_texture1DArrayLod = - "((function texture1DArrayLod\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) 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) vec4 arg0)\n" + " (declare (in) vec4 arg1))\n" + " ((return (expression vec4 min (var_ref arg0) (var_ref arg1)))))\n" "\n" - "))\n" - "" -; -static const char *builtin_asin = - "((function asin\n" - " (signature float\n" + " (signature vec2\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) vec2 arg0)\n" + " (declare (in) float arg1))\n" + " ((return (expression vec2 min (var_ref arg0) (var_ref arg1)))))\n" "\n" - " (signature vec2\n" + " (signature vec3\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" - "\n" - " (signature vec3\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" - "\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" - "" -; -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" + " (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) 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) float arg1))\n" + " ((return (expression vec4 min (var_ref arg0) (var_ref arg1)))))\n" "\n" - " (signature vec4\n" + " (signature int\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) int arg0)\n" + " (declare (in) int arg1))\n" + " ((return (expression int min (var_ref arg0) (var_ref arg1)))))\n" "\n" - " (signature vec4\n" + " (signature ivec2\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) ivec2 arg0)\n" + " (declare (in) ivec2 arg1))\n" + " ((return (expression ivec2 min (var_ref arg0) (var_ref arg1)))))\n" "\n" - "))\n" - "" -; -static const char *builtin_lessThan = - "((function lessThan\n" - " (signature bvec2\n" + " (signature ivec3\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) ivec3 arg0)\n" + " (declare (in) ivec3 arg1))\n" + " ((return (expression ivec3 min (var_ref arg0) (var_ref arg1)))))\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) ivec4 arg0)\n" + " (declare (in) ivec4 arg1))\n" + " ((return (expression ivec4 min (var_ref arg0) (var_ref arg1)))))\n" "\n" - " (signature bvec4\n" + " (signature ivec2\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) ivec2 arg0)\n" + " (declare (in) int arg1))\n" + " ((return (expression ivec2 min (var_ref arg0) (var_ref arg1)))))\n" "\n" - " (signature bvec2\n" + " (signature ivec3\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) ivec3 arg0)\n" + " (declare (in) int arg1))\n" + " ((return (expression ivec3 min (var_ref arg0) (var_ref arg1)))))\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) ivec4 arg0)\n" + " (declare (in) int arg1))\n" + " ((return (expression ivec4 min (var_ref arg0) (var_ref arg1)))))\n" "\n" - " (signature bvec4\n" + " (signature uint\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) uint arg0)\n" + " (declare (in) uint arg1))\n" + " ((return (expression uint min (var_ref arg0) (var_ref arg1)))))\n" "\n" - " (signature bvec2\n" + " (signature uvec2\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 uvec2 min (var_ref arg0) (var_ref arg1)))))\n" "\n" - " (signature bvec3\n" + " (signature uvec3\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" + " ((return (expression uvec3 min (var_ref arg0) (var_ref arg1)))))\n" "\n" - " (signature bvec4\n" + " (signature uvec4\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" + " ((return (expression uvec4 min (var_ref arg0) (var_ref arg1)))))\n" + "\n" + " (signature uvec2\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) uvec2 arg0)\n" + " (declare (in) uint arg1))\n" + " ((return (expression uvec2 min (var_ref arg0) (var_ref arg1)))))\n" "\n" - " (signature vec4\n" + " (signature uvec3\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) 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) uvec4 arg0)\n" + " (declare (in) uint arg1))\n" + " ((return (expression uvec4 min (var_ref arg0) (var_ref arg1)))))\n" "))\n" "" ; -static const char *builtin_textureLod = - "((function textureLod\n" - " (signature vec4\n" +static const char *builtin_mix = + "((function mix\n" + " (signature float\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) 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 ivec4\n" + " (signature vec2\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" + " (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 uvec4\n" + " (signature vec3\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) 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) 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) 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 ivec4\n" + " (signature vec2\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" + " (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 uvec4\n" + " (signature vec3\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" + " (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 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" + " (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 vec4\n" + " (signature float\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) 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 ivec4\n" + " (signature vec2\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) 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 uvec4\n" + " (signature vec3\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) 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) 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" + " (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 *builtin_faceforward = - "((function faceforward\n" +static const char *builtin_mod = + "((function mod\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" + " (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 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) 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 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) 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 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" + " (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" - " ((return (expression vec2 abs (var_ref arg0)))))\n" + " (declare (in) vec2 arg0)\n" + " (declare (in) float arg1))\n" + " ((return (expression vec2 % (var_ref arg0) (var_ref arg1)))))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in) vec3 arg0))\n" - " ((return (expression vec3 abs (var_ref arg0)))))\n" + " (declare (in) vec3 arg0)\n" + " (declare (in) float arg1))\n" + " ((return (expression vec3 % (var_ref arg0) (var_ref arg1)))))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in) vec4 arg0))\n" - " ((return (expression vec4 abs (var_ref arg0)))))\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 *builtin_log2 = - "((function log2\n" +static const char *builtin_noise1 = + "((function noise1\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" + " (declare (in) float x))\n" + " ((return (constant float (0)))))\n" + " (signature float\n" " (parameters\n" - " (declare (in) vec3 arg0))\n" - " ((return (expression vec3 log2 (var_ref arg0)))))\n" - "\n" - " (signature vec4\n" + " (declare (in) vec2 x))\n" + " ((return (constant float (0)))))\n" + " (signature float\n" " (parameters\n" - " (declare (in) vec4 arg0))\n" - " ((return (expression vec4 log2 (var_ref arg0)))))\n" - "))\n" - "" -; -static const char *builtin_shadow2DRect = - "((function shadow2DRect\n" - " (signature vec4\n" + " (declare (in) vec3 x))\n" + " ((return (constant float (0)))))\n" + " (signature float\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" + " (declare (in) vec4 x))\n" + " ((return (constant float (0)))))\n" "))\n" "" ; -static const char *builtin_lessThanEqual = - "((function lessThanEqual\n" - " (signature bvec2\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_noise3 = + "((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" + "" +; +static const char *builtin_noise4 = + "((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" + "" +; +static const char *builtin_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 *builtin_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 *builtin_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 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" @@ -1985,9 +2173,9 @@ static const char *builtin_lessThanEqual = " (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" + " (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" @@ -1995,10 +2183,10 @@ static const char *builtin_lessThanEqual = " (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" + " (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" @@ -2006,8 +2194,8 @@ static const char *builtin_lessThanEqual = " (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" @@ -2015,9 +2203,9 @@ static const char *builtin_lessThanEqual = " (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" @@ -2025,10 +2213,10 @@ static const char *builtin_lessThanEqual = " (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" " (signature bvec2\n" @@ -2036,8 +2224,8 @@ static const char *builtin_lessThanEqual = " (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" @@ -2045,9 +2233,9 @@ static const char *builtin_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" @@ -2055,957 +2243,884 @@ static const char *builtin_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 *builtin_transpose = - "((function transpose\n" +static const char *builtin_outerProduct = + "((function outerProduct\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" + " (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 mat3x2\n" + " (signature mat2x3\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) 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 mat4x2\n" + " (signature mat2x4\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) 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 mat2x3\n" + " (signature mat3x2\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) 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" " (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) 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 mat4x3\n" + " (signature mat3x4\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) 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 mat2x4\n" + " (signature mat4x2\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) 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 mat3x4\n" + " (signature mat4x3\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) 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 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" + " (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_step = - "((function step\n" +static const char *builtin_pow = + "((function pow\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" + " (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 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" + " (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 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" + " (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 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" + " (declare (in) vec4 arg1))\n" + " ((return (expression vec4 pow (var_ref arg0) (var_ref arg1)))))\n" "))\n" - "\n" "" ; -static const char *builtin_sinh = - "((function sinh\n" +static const char *builtin_radians = + "((function radians\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" + " (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 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" + " (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 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" + " (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 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" + " (declare (in) vec4 arg0))\n" + " ((return (expression vec4 * (var_ref arg0) (constant float (0.017453))))))\n" "))\n" "" ; -static const char *builtin_cos = - "((function cos\n" +static const char *builtin_reflect = + "((function reflect\n" " (signature float\n" " (parameters\n" - " (declare (in) float angle))\n" - " ((return (expression float cos (var_ref angle)))))\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 angle))\n" - " ((return (expression vec2 cos (var_ref angle)))))\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 angle))\n" - " ((return (expression vec3 cos (var_ref angle)))))\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 angle))\n" - " ((return (expression vec4 cos (var_ref angle)))))\n" - "))\n" - "" -; -static const char *builtin_shadow2DProjLod = - "((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 *builtin_shadow2DArray = - "((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 *builtin_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" - " (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 *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" - " (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 *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" - " (declare (in) vec4 x))\n" - " ((return (expression vec4 - (constant float (1.5707963))\n" - " (call asin ((var_ref x)))))))\n" - "))\n" - "" -; -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" - " (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" + " (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 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 *builtin_pow = - "((function pow\n" +static const char *builtin_refract = + "((function refract\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" + " (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 arg0)\n" - " (declare (in) vec2 arg1))\n" - " ((return (expression vec2 pow (var_ref arg0) (var_ref arg1)))))\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 arg0)\n" - " (declare (in) vec3 arg1))\n" - " ((return (expression vec3 pow (var_ref arg0) (var_ref arg1)))))\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) vec4 arg0)\n" - " (declare (in) vec4 arg1))\n" - " ((return (expression vec4 pow (var_ref arg0) (var_ref arg1)))))\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" "))\n" "" ; -static const char *builtin_texture2DProjLod = - "((function texture2DProjLod\n" +static const char *builtin_shadow1D = + "((function shadow1D\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" + " (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) 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) 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" "" ; -static const char *builtin_textureProjLod = - "((function textureProjLod\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" +static const char *builtin_shadow1DArray = + "((function shadow1DArray\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" + " (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 ivec4\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) isampler2D sampler)\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) (swiz z (var_ref P)) () (var_ref lod) ))))\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" - " (signature uvec4\n" + "))\n" + "" +; +static const char *builtin_shadow1DArrayLod = + "((function shadow1DArrayLod\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) usampler2D sampler)\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) (swiz z (var_ref P)) () (var_ref 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_shadow1DLod = + "((function shadow1DLod\n" " (signature vec4\n" " (parameters\n" - " (declare (in) sampler2D sampler)\n" - " (declare (in) vec4 P) \n" + " (declare (in) sampler1DShadow 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 w (var_ref P)) () (var_ref 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 ivec4\n" + "))\n" + "" +; +static const char *builtin_shadow1DProj = + "((function shadow1DProj\n" + " (signature vec4\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" + " (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) usampler2D sampler)\n" + " (declare (in) sampler1DShadow 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) 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 *builtin_shadow1DProjLod = + "((function shadow1DProjLod\n" " (signature vec4\n" " (parameters\n" - " (declare (in) sampler3D sampler)\n" + " (declare (in) sampler1DShadow 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" + " ((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" - " (signature ivec4\n" + "))\n" + "" +; +static const char *builtin_shadow2D = + "((function shadow2D\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) 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 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) 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_log = - "((function log\n" - " (signature float\n" +static const char *builtin_shadow2DArray = + "((function shadow2DArray\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) float arg0))\n" - " ((return (expression float log (var_ref arg0)))))\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 vec2\n" + "))\n" + "" +; +static const char *builtin_shadow2DLod = + "((function shadow2DLod\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) vec2 arg0))\n" - " ((return (expression vec2 log (var_ref arg0)))))\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" - " (signature vec3\n" + "))\n" + "" +; +static const char *builtin_shadow2DProj = + "((function shadow2DProj\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) vec3 arg0))\n" - " ((return (expression vec3 log (var_ref arg0)))))\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) vec4 arg0))\n" - " ((return (expression vec4 log (var_ref arg0)))))\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_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" +static const char *builtin_shadow2DProjLod = + "((function shadow2DProjLod\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) vec2 arg0))\n" - " ((return (expression vec2 exp2 (var_ref arg0)))))\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" - " (signature vec3\n" + "))\n" + "" +; +static const char *builtin_shadow2DRect = + "((function shadow2DRect\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) vec3 arg0))\n" - " ((return (expression vec3 exp2 (var_ref arg0)))))\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 *builtin_shadow2DRectProj = + "((function shadow2DRectProj\n" " (signature vec4\n" " (parameters\n" - " (declare (in) vec4 arg0))\n" - " ((return (expression vec4 exp2 (var_ref arg0)))))\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" "))\n" "" ; -static const char *builtin_fract = - "((function fract\n" +static const char *builtin_sign = + "((function sign\n" " (signature float\n" " (parameters\n" " (declare (in) float x))\n" - " ((return (expression float fract (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 fract (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 fract (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 fract (var_ref x)))))\n" - "))\n" + " ((return (expression vec4 sign (var_ref x)))))\n" "\n" - "" -; -static const char *builtin_shadow1DLod = - "((function shadow1DLod\n" - " (signature vec4\n" + " (signature int\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" + " (declare (in) int x))\n" + " ((return (expression int sign (var_ref x)))))\n" "\n" - "))\n" - "" -; -static const char *builtin_texture1DLod = - "((function texture1DLod\n" - " (signature vec4\n" + " (signature ivec2\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) 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 *builtin_texture2DArray = - "((function texture2DArray\n" - " (signature vec4\n" +static const char *builtin_sin = + "((function sin\n" + " (signature float\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) float angle))\n" + " ((return (expression float sin (var_ref angle)))))\n" "\n" - " (signature vec4\n" + " (signature vec2\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) 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 *builtin_texture3DProj = - "((function texture3DProj\n" - " (signature vec4\n" +static const char *builtin_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) 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" + " (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) 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" + " (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_sign = - "((function sign\n" +static const char *builtin_smoothstep = + "((function smoothstep\n" " (signature float\n" " (parameters\n" + " (declare (in) float edge0)\n" + " (declare (in) float edge1)\n" " (declare (in) float x))\n" - " ((return (expression float sign (var_ref 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" - " ((return (expression vec2 sign (var_ref 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" - " ((return (expression vec3 sign (var_ref 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" - " ((return (expression vec4 sign (var_ref x)))))\n" + " ((declare () vec4 t)\n" + " (declare () vec4 retval)\n" "\n" - " (signature int\n" - " (parameters\n" - " (declare (in) int x))\n" - " ((return (expression int sign (var_ref x)))))\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 ivec2\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) ivec2 x))\n" - " ((return (expression ivec2 sign (var_ref x)))))\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 ivec3\n" + " (signature vec3\n" " (parameters\n" - " (declare (in) ivec3 x))\n" - " ((return (expression ivec3 sign (var_ref x)))))\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 ivec4\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) ivec4 x))\n" - " ((return (expression ivec4 sign (var_ref x)))))\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" "\n" "" ; -static const char *builtin_inversesqrt = - "((function inversesqrt\n" +static const char *builtin_sqrt = + "((function sqrt\n" " (signature float\n" " (parameters\n" " (declare (in) float arg0))\n" - " ((return (expression float rsq (var_ref arg0)))))\n" + " ((return (expression float sqrt (var_ref arg0)))))\n" "\n" " (signature vec2\n" " (parameters\n" " (declare (in) vec2 arg0))\n" - " ((return (expression vec2 rsq (var_ref arg0)))))\n" + " ((return (expression vec2 sqrt (var_ref arg0)))))\n" "\n" " (signature vec3\n" " (parameters\n" " (declare (in) vec3 arg0))\n" - " ((return (expression vec3 rsq (var_ref arg0)))))\n" + " ((return (expression vec3 sqrt (var_ref arg0)))))\n" "\n" " (signature vec4\n" " (parameters\n" " (declare (in) vec4 arg0))\n" - " ((return (expression vec4 rsq (var_ref arg0)))))\n" + " ((return (expression vec4 sqrt (var_ref arg0)))))\n" "))\n" "" ; -static const char *builtin_distance = - "((function distance\n" +static const char *builtin_step = + "((function step\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" + " (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 float\n" + " (signature vec2\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) 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 float\n" + " (signature vec3\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) 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 float\n" + " (signature vec4\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" + " (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 *builtin_noise2 = - "((function noise2\n" - " (signature vec2\n" +static const char *builtin_tan = + "((function tan\n" + " (signature float\n" " (parameters\n" - " (declare (in) float x))\n" - " ((return (constant vec2 (0 0)))))\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 x))\n" - " ((return (constant vec2 (0 0)))))\n" - " (signature vec2\n" + " (declare (in) vec2 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 x))\n" - " ((return (constant vec2 (0 0)))))\n" - " (signature vec2\n" + " (declare (in) vec3 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 x))\n" - " ((return (constant vec2 (0 0)))))\n" + " (declare (in) vec4 angle))\n" + " ((return (expression vec4 / (expression vec4 sin (var_ref angle)) (expression vec4 cos (var_ref angle))))))\n" "))\n" "" ; @@ -3054,50 +3169,246 @@ static const char *builtin_tanh = "))\n" "" ; -static const char *builtin_texture1DProjLod = - "((function texture1DProjLod\n" +static const char *builtin_texelFetch = + "((function texelFetch\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" + " (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 *builtin_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) 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) 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" - "))\n" - "" -; -static const char *builtin_texture1DArray = - "((function texture1DArray\n" - " (signature vec4\n" + " (signature uvec4\n" " (parameters\n" - " (declare (in) sampler1DArray sampler)\n" - " (declare (in) vec2 P) )\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) sampler1DArray sampler)\n" - " (declare (in) vec2 P) \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_texture2D = - "((function texture2D\n" - " (signature vec4\n" + " (signature ivec4\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) 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" @@ -3106,1614 +3417,1303 @@ static const char *builtin_texture2D = " (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" + " (signature ivec4\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) 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 bvec3\n" + " (signature uvec4\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) 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 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) 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 bvec2\n" + " (signature ivec4\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) 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 bvec3\n" + " (signature uvec4\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) 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 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) 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 bvec2\n" + " (signature ivec4\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) 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 bvec3\n" + " (signature uvec4\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) 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 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_texture3DProjLod = - "((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" - "" -; -static const char *builtin_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" + " (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 vec2\n" + " (signature ivec4\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) 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 vec3\n" + " (signature uvec4\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) 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) 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) bvec2 arg0))\n" - " ((return (expression bool || (swiz x (var_ref arg0))(swiz y (var_ref arg0))))))\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 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) 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 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" + " (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 *builtin_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" +static const char *builtin_texture1D = + "((function texture1D\n" + " (signature vec4\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) sampler1D sampler)\n" + " (declare (in) float P) )\n" + " ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () ))))\n" "\n" - " (signature vec3\n" + " (signature vec4\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) 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 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 *builtin_shadow1DProj = - "((function shadow1DProj\n" +static const char *builtin_texture1DArray = + "((function texture1DArray\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" + " (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) sampler1DShadow sampler)\n" - " (declare (in) vec4 P) \n" + " (declare (in) sampler1DArray 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 w (var_ref P)) (swiz z (var_ref P)) (var_ref bias) ))))\n" + " ((return (txb (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref bias) ))))\n" "\n" "))\n" "" ; -static const char *builtin_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" +static const char *builtin_texture1DArrayLod = + "((function texture1DArrayLod\n" " (signature vec4\n" " (parameters\n" - " (declare (in) vec4 arg0))\n" - " ((return (expression vec4 floor (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" "))\n" "" ; -static const char *builtin_cross = - "((function cross\n" - " (signature vec3\n" +static const char *builtin_texture1DLod = + "((function texture1DLod\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" + " (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 *builtin_sqrt = - "((function sqrt\n" - " (signature float\n" +static const char *builtin_texture1DProj = + "((function texture1DProj\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) float arg0))\n" - " ((return (expression float sqrt (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 vec2\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) vec2 arg0))\n" - " ((return (expression vec2 sqrt (var_ref arg0)))))\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 arg0))\n" - " ((return (expression vec3 sqrt (var_ref arg0)))))\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 arg0))\n" - " ((return (expression vec4 sqrt (var_ref arg0)))))\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 *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 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" +static const char *builtin_texture1DProjLod = + "((function texture1DProjLod\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 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 float - (constant float (1.000000)) (var_ref arg2))) (expression vec3 * (var_ref arg1) (var_ref arg2))))))\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) 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" + " (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 float\n" + "))\n" + "" +; +static const char *builtin_texture2D = + "((function texture2D\n" + " (signature vec4\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" + " (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 vec2\n" + " (signature vec4\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" + " (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 vec3\n" + "))\n" + "" +; +static const char *builtin_texture2DArray = + "((function texture2DArray\n" + " (signature vec4\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" + " (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) 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" + " (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_shadow1DArrayLod = - "((function shadow1DArrayLod\n" +static const char *builtin_texture2DArrayLod = + "((function texture2DArrayLod\n" " (signature vec4\n" " (parameters\n" - " (declare (in) sampler1DArrayShadow sampler)\n" + " (declare (in) sampler2DArray 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" + " ((return (txl (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref lod) ))))\n" "\n" "))\n" "" ; -static const char *builtin_ftransform = - "((declare (uniform) mat4 gl_ModelViewProjectionMatrix)\n" - " (declare (in) vec4 gl_Vertex)\n" - " (function ftransform\n" +static const char *builtin_texture2DLod = + "((function texture2DLod\n" " (signature vec4\n" - " (parameters)\n" - " ((return (expression vec4 *\n" - " (var_ref gl_ModelViewProjectionMatrix)\n" - " (var_ref gl_Vertex)))))\n" - "))\n" - "" -; -static const char *builtin_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" + " (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 vec4\n" - " (parameters\n" - " (declare (in) vec4 angle))\n" - " ((return (expression vec4 sin (var_ref angle)))))\n" "))\n" "" ; -static const char *builtin_shadow2D = - "((function shadow2D\n" +static const char *builtin_texture2DProj = + "((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) 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) 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 vec4\n" " (parameters\n" - " (declare (in) sampler2DShadow sampler)\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) 1 (swiz z (var_ref P)) (var_ref 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" "" ; -static const char *builtin_shadow2DLod = - "((function shadow2DLod\n" +static const char *builtin_texture2DProjLod = + "((function texture2DProjLod\n" " (signature vec4\n" " (parameters\n" - " (declare (in) sampler2DShadow sampler)\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) 1 (swiz z (var_ref P)) (var_ref 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" "" ; -static const char *builtin_shadow2DRectProj = - "((function shadow2DRectProj\n" +static const char *builtin_texture2DRect = + "((function texture2DRect\n" " (signature vec4\n" " (parameters\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" + " (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 *builtin_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" +static const char *builtin_texture2DRectProj = + "((function texture2DRectProj\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" - " )\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" - " (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" + " (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) 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) 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_max = - "((function max\n" - " (signature float\n" +static const char *builtin_texture3D = + "((function texture3D\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) sampler3D 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 vec4\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) 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 vec3\n" + "))\n" + "" +; +static const char *builtin_texture3DLod = + "((function texture3DLod\n" + " (signature vec4\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) 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" + "" +; +static const char *builtin_texture3DProj = + "((function texture3DProj\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) 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 vec2\n" + " (signature vec4\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) 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 vec3\n" + "))\n" + "" +; +static const char *builtin_texture3DProjLod = + "((function texture3DProjLod\n" + " (signature vec4\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) 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" + "" +; +static const char *builtin_textureCube = + "((function textureCube\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" + " (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 int\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) 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 ivec2\n" + "))\n" + "" +; +static const char *builtin_textureCubeLod = + "((function textureCubeLod\n" + " (signature vec4\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) 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 ivec3\n" + "))\n" + "" +; +static const char *builtin_textureGrad = + "((function textureGrad\n" + " (signature vec4\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) 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) ivec4 arg0)\n" - " (declare (in) ivec4 arg1))\n" - " ((return (expression ivec4 max (var_ref arg0) (var_ref arg1)))))\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 ivec2\n" + " (signature uvec4\n" " (parameters\n" - " (declare (in) ivec2 arg0)\n" - " (declare (in) int arg1))\n" - " ((return (expression ivec2 max (var_ref arg0) (var_ref arg1)))))\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 ivec3\n" + " (signature vec4\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) 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) ivec4 arg0)\n" - " (declare (in) int arg1))\n" - " ((return (expression ivec4 max (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 uint\n" + " (signature uvec4\n" " (parameters\n" - " (declare (in) uint arg0)\n" - " (declare (in) uint arg1))\n" - " ((return (expression uint max (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 uvec2\n" + " (signature vec4\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) 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 uvec3\n" + " (signature ivec4\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) 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) uvec4 arg0)\n" - " (declare (in) uvec4 arg1))\n" - " ((return (expression uvec4 max (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 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" + " (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 uvec3\n" + " (signature ivec4\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) 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) 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" + " (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) 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" + " (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 vec2\n" + " (signature ivec4\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) 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 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" + " (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 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) 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" - "))\n" - "" -; -static const char *builtin_texture3D = - "((function texture3D\n" - " (signature vec4\n" + " (signature ivec4\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) 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 vec4\n" + " (signature uvec4\n" " (parameters\n" - " (declare (in) sampler3D sampler)\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" + " (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_texelFetch = - "((function texelFetch\n" +static const char *builtin_textureLod = + "((function textureLod\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" + " (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) 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) 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) 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) 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) 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 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) 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 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) 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 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) 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 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) 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 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) 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 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) 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 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) 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 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) 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 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) 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 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) 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 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) 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 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_noise4 = - "((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" +static const char *builtin_textureProj = + "((function textureProj\n" " (signature vec4\n" " (parameters\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) 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" + " (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 bvec2\n" + " (signature ivec4\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) 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 bvec3\n" + " (signature uvec4\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) 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 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_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 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" + " (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 mat2x3\n" + " (signature ivec4\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) 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 mat2x4\n" + " (signature uvec4\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) 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 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" + " (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 mat3\n" + " (signature ivec4\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) 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 mat3x4\n" + " (signature uvec4\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) 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 mat4x2\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) 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 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) 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 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 *builtin_shadow1D = - "((function shadow1D\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) 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" + " (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" " (signature vec4\n" " (parameters\n" - " (declare (in) sampler1DShadow sampler)\n" - " (declare (in) vec3 P) \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) 1 (swiz z (var_ref P)) (var_ref 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" - "" -; -static const char *builtin_noise1 = - "((function noise1\n" - " (signature float\n" - " (parameters\n" - " (declare (in) float x))\n" - " ((return (constant float (0)))))\n" - " (signature float\n" + " (signature ivec4\n" " (parameters\n" - " (declare (in) vec2 x))\n" - " ((return (constant float (0)))))\n" - " (signature float\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) vec3 x))\n" - " ((return (constant float (0)))))\n" - " (signature float\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) vec4 x))\n" - " ((return (constant float (0)))))\n" - "))\n" - "" -; -static const char *builtin_refract = - "((function refract\n" - " (signature float\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) 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" + " (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 vec2\n" + " (signature uvec4\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" + " (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 vec3\n" + " (signature vec4\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" + " (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) 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) 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_noise3 = - "((function noise3\n" - " (signature vec3\n" + " (signature ivec4\n" " (parameters\n" - " (declare (in) float x))\n" - " ((return (constant vec3 (0 0 0)))))\n" - " (signature vec3\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) vec2 x))\n" - " ((return (constant vec3 (0 0 0)))))\n" - " (signature vec3\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) vec3 x))\n" - " ((return (constant vec3 (0 0 0)))))\n" - " (signature vec3\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) vec4 x))\n" - " ((return (constant vec3 (0 0 0)))))\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 *builtin_min = - "((function min\n" - " (signature float\n" +static const char *builtin_textureProjGrad = + "((function textureProjGrad\n" + " (signature vec4\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) 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" - " (declare (in) vec2 arg1))\n" - " ((return (expression vec2 min (var_ref arg0) (var_ref arg1)))))\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" - " (declare (in) vec3 arg1))\n" - " ((return (expression vec3 min (var_ref arg0) (var_ref arg1)))))\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" - " (declare (in) vec4 arg1))\n" - " ((return (expression vec4 min (var_ref arg0) (var_ref arg1)))))\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 vec2\n" + " (signature ivec4\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) 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 vec3\n" + " (signature uvec4\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) 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) vec4 arg0)\n" - " (declare (in) float arg1))\n" - " ((return (expression vec4 min (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 int\n" + " (signature ivec4\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) 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 ivec2\n" + " (signature uvec4\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) 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 ivec3\n" + " (signature vec4\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) 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) ivec4 arg0)\n" - " (declare (in) ivec4 arg1))\n" - " ((return (expression ivec4 min (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 ivec2\n" + " (signature uvec4\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) 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 ivec3\n" + " (signature vec4\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) 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) ivec4 arg0)\n" - " (declare (in) int arg1))\n" - " ((return (expression ivec4 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 uint\n" + " (signature uvec4\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) 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 uvec2\n" + "))\n" + "" +; +static const char *builtin_textureProjLod = + "((function textureProjLod\n" + " (signature vec4\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) 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 uvec3\n" + " (signature ivec4\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) 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) uvec4 arg0)\n" - " (declare (in) uvec4 arg1))\n" - " ((return (expression uvec4 min (var_ref arg0) (var_ref arg1)))))\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 uvec2\n" + " (signature vec4\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) 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 uvec3\n" + " (signature ivec4\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) 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) 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) samplerCube sampler)\n" - " (declare (in) vec3 P) )\n" - " ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () ))))\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) samplerCube sampler)\n" + " (declare (in) sampler2D 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) 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" - "))\n" - "" -; -static const char *builtin_shadow1DArray = - "((function shadow1DArray\n" - " (signature vec4\n" + " (signature ivec4\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" + " (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 vec4\n" + " (signature uvec4\n" " (parameters\n" - " (declare (in) sampler1DArrayShadow sampler)\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) 1 (swiz z (var_ref P)) (var_ref bias) ))))\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" - "))\n" - "" -; -static const char *builtin_exp = - "((function exp\n" - " (signature float\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) float arg0))\n" - " ((return (expression float exp (var_ref arg0)))))\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 vec2\n" + " (signature ivec4\n" " (parameters\n" - " (declare (in) vec2 arg0))\n" - " ((return (expression vec2 exp (var_ref arg0)))))\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 vec3\n" + " (signature uvec4\n" " (parameters\n" - " (declare (in) vec3 arg0))\n" - " ((return (expression vec3 exp (var_ref arg0)))))\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) 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) 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" + " (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 bvec4\n" + " (signature ivec4\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) 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 bvec2\n" + " (signature uvec4\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) 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 bvec3\n" + "))\n" + "" +; +static const char *builtin_transpose = + "((function transpose\n" + " (signature mat2\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) 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 bvec4\n" + " (signature mat3x2\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) 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 bvec2\n" + " (signature mat4x2\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) 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 bvec3\n" + " (signature mat2x3\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) 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 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" + " (signature mat3\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) 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" - "" -; -static const char *builtin_dot = - "((function dot\n" - " (signature float\n" + " (signature mat4x3\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) 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 float\n" + " (signature mat2x4\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) 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 float\n" + " (signature mat3x4\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) 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 float\n" + " (signature mat4\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" + " (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 *prototypes_for_120_vert = +static const char *prototypes_for_110_frag = "(\n" "(function radians\n" " (signature float\n" @@ -5434,10 +5434,6 @@ static const char *prototypes_for_120_vert = " (parameters\n" " (declare (in) vec4 x))\n" " ()))\n" - "(function ftransform\n" - " (signature vec4\n" - " (parameters)\n" - " ()))\n" "(function faceforward\n" " (signature float\n" " (parameters\n" @@ -5524,119 +5520,6 @@ static const char *prototypes_for_120_vert = " (parameters\n" " (declare (in) mat4 x)\n" " (declare (in) mat4 y))\n" - " ())\n" - " (signature mat2x3\n" - " (parameters\n" - " (declare (in) mat2x3 x)\n" - " (declare (in) mat2x3 y))\n" - " ())\n" - " (signature mat2x4\n" - " (parameters\n" - " (declare (in) mat2x4 x)\n" - " (declare (in) mat2x4 y))\n" - " ())\n" - " (signature mat3x2\n" - " (parameters\n" - " (declare (in) mat3x2 x)\n" - " (declare (in) mat3x2 y))\n" - " ())\n" - " (signature mat3x4\n" - " (parameters\n" - " (declare (in) mat3x4 x)\n" - " (declare (in) mat3x4 y))\n" - " ())\n" - " (signature mat4x2\n" - " (parameters\n" - " (declare (in) mat4x2 x)\n" - " (declare (in) mat4x2 y))\n" - " ())\n" - " (signature mat4x3\n" - " (parameters\n" - " (declare (in) mat4x3 x)\n" - " (declare (in) mat4x3 y))\n" - " ()))\n" - "(function outerProduct\n" - " (signature mat2\n" - " (parameters\n" - " (declare (in) vec2 c)\n" - " (declare (in) vec2 r))\n" - " ())\n" - " (signature mat3\n" - " (parameters\n" - " (declare (in) vec3 c)\n" - " (declare (in) vec3 r))\n" - " ())\n" - " (signature mat4\n" - " (parameters\n" - " (declare (in) vec4 c)\n" - " (declare (in) vec4 r))\n" - " ())\n" - " (signature mat2x3\n" - " (parameters\n" - " (declare (in) vec3 c)\n" - " (declare (in) vec2 r))\n" - " ())\n" - " (signature mat3x2\n" - " (parameters\n" - " (declare (in) vec2 c)\n" - " (declare (in) vec3 r))\n" - " ())\n" - " (signature mat2x4\n" - " (parameters\n" - " (declare (in) vec4 c)\n" - " (declare (in) vec2 r))\n" - " ())\n" - " (signature mat4x2\n" - " (parameters\n" - " (declare (in) vec2 c)\n" - " (declare (in) vec4 r))\n" - " ())\n" - " (signature mat3x4\n" - " (parameters\n" - " (declare (in) vec4 c)\n" - " (declare (in) vec3 r))\n" - " ())\n" - " (signature mat4x3\n" - " (parameters\n" - " (declare (in) vec3 c)\n" - " (declare (in) vec4 r))\n" - " ()))\n" - "(function transpose\n" - " (signature mat2\n" - " (parameters\n" - " (declare (in) mat2 m))\n" - " ())\n" - " (signature mat3\n" - " (parameters\n" - " (declare (in) mat3 m))\n" - " ())\n" - " (signature mat4\n" - " (parameters\n" - " (declare (in) mat4 m))\n" - " ())\n" - " (signature mat2x3\n" - " (parameters\n" - " (declare (in) mat3x2 m))\n" - " ())\n" - " (signature mat3x2\n" - " (parameters\n" - " (declare (in) mat2x3 m))\n" - " ())\n" - " (signature mat2x4\n" - " (parameters\n" - " (declare (in) mat4x2 m))\n" - " ())\n" - " (signature mat4x2\n" - " (parameters\n" - " (declare (in) mat2x4 m))\n" - " ())\n" - " (signature mat3x4\n" - " (parameters\n" - " (declare (in) mat4x3 m))\n" - " ())\n" - " (signature mat4x3\n" - " (parameters\n" - " (declare (in) mat3x4 m))\n" " ()))\n" "(function lessThan\n" " (signature bvec2\n" @@ -5898,6 +5781,12 @@ static const char *prototypes_for_120_vert = " (parameters\n" " (declare (in) sampler1D sampler)\n" " (declare (in) float coord))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) float coord)\n" + " (declare (in) float bias))\n" " ()))\n" "(function texture1DProj\n" " (signature vec4\n" @@ -5909,32 +5798,30 @@ static const char *prototypes_for_120_vert = " (parameters\n" " (declare (in) sampler1D sampler)\n" " (declare (in) vec4 coord))\n" - " ()))\n" - "(function texture1DLod\n" - " (signature vec4\n" - " (parameters\n" - " (declare (in) sampler1D sampler)\n" - " (declare (in) float coord)\n" - " (declare (in) float lod))\n" - " ()))\n" - "(function texture1DProjLod\n" + " ())\n" " (signature vec4\n" " (parameters\n" " (declare (in) sampler1D sampler)\n" " (declare (in) vec2 coord)\n" - " (declare (in) float lod))\n" + " (declare (in) float bias))\n" " ())\n" " (signature vec4\n" " (parameters\n" " (declare (in) sampler1D sampler)\n" " (declare (in) vec4 coord)\n" - " (declare (in) float lod))\n" + " (declare (in) float bias))\n" " ()))\n" "(function texture2D\n" " (signature vec4\n" " (parameters\n" " (declare (in) sampler2D sampler)\n" " (declare (in) vec2 coord))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec2 coord)\n" + " (declare (in) float bias))\n" " ()))\n" "(function texture2DProj\n" " (signature vec4\n" @@ -5946,117 +5833,153 @@ static const char *prototypes_for_120_vert = " (parameters\n" " (declare (in) sampler2D sampler)\n" " (declare (in) vec4 coord))\n" - " ()))\n" - "(function texture2DLod\n" - " (signature vec4\n" - " (parameters\n" - " (declare (in) sampler2D sampler)\n" - " (declare (in) vec2 coord)\n" - " (declare (in) float lod))\n" - " ()))\n" - "(function texture2DProjLod\n" + " ())\n" " (signature vec4\n" " (parameters\n" " (declare (in) sampler2D sampler)\n" " (declare (in) vec3 coord)\n" - " (declare (in) float lod))\n" + " (declare (in) float bias))\n" " ())\n" " (signature vec4\n" " (parameters\n" " (declare (in) sampler2D sampler)\n" " (declare (in) vec4 coord)\n" - " (declare (in) float lod))\n" + " (declare (in) float bias))\n" " ()))\n" "(function texture3D\n" " (signature vec4\n" " (parameters\n" " (declare (in) sampler3D sampler)\n" " (declare (in) vec3 coord))\n" - " ()))\n" - "(function texture3DProj\n" + " ())\n" " (signature vec4\n" " (parameters\n" " (declare (in) sampler3D sampler)\n" - " (declare (in) vec4 coord))\n" + " (declare (in) vec3 coord)\n" + " (declare (in) float bias))\n" " ()))\n" - "(function texture3DLod\n" + "(function texture3DProj\n" " (signature vec4\n" " (parameters\n" " (declare (in) sampler3D sampler)\n" - " (declare (in) vec3 coord)\n" - " (declare (in) float lod))\n" - " ()))\n" - "(function texture3DProjLod\n" + " (declare (in) vec4 coord))\n" + " ())\n" " (signature vec4\n" " (parameters\n" " (declare (in) sampler3D sampler)\n" " (declare (in) vec4 coord)\n" - " (declare (in) float lod))\n" + " (declare (in) float bias))\n" " ()))\n" "(function textureCube\n" " (signature vec4\n" " (parameters\n" " (declare (in) samplerCube sampler)\n" " (declare (in) vec3 coord))\n" - " ()))\n" - "(function textureCubeLod\n" + " ())\n" " (signature vec4\n" " (parameters\n" " (declare (in) samplerCube sampler)\n" " (declare (in) vec3 coord)\n" - " (declare (in) float lod))\n" + " (declare (in) float bias))\n" " ()))\n" "(function shadow1D\n" " (signature vec4\n" " (parameters\n" " (declare (in) sampler1DShadow sampler)\n" " (declare (in) vec3 coord))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1DShadow sampler)\n" + " (declare (in) vec3 coord)\n" + " (declare (in) float bias))\n" " ()))\n" "(function shadow2D\n" " (signature vec4\n" " (parameters\n" " (declare (in) sampler2DShadow sampler)\n" " (declare (in) vec3 coord))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2DShadow sampler)\n" + " (declare (in) vec3 coord)\n" + " (declare (in) float bias))\n" " ()))\n" "(function shadow1DProj\n" " (signature vec4\n" " (parameters\n" " (declare (in) sampler1DShadow sampler)\n" " (declare (in) vec4 coord))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1DShadow sampler)\n" + " (declare (in) vec4 coord)\n" + " (declare (in) float bias))\n" " ()))\n" "(function shadow2DProj\n" " (signature vec4\n" " (parameters\n" " (declare (in) sampler2DShadow sampler)\n" " (declare (in) vec4 coord))\n" - " ()))\n" - "(function shadow1DLod\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in) sampler1DShadow sampler)\n" - " (declare (in) vec3 coord)\n" - " (declare (in) float lod))\n" + " (declare (in) sampler2DShadow sampler)\n" + " (declare (in) vec4 coord)\n" + " (declare (in) float bias))\n" " ()))\n" - "(function shadow2DLod\n" + "(function dFdx\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float p))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 p))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 p))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in) sampler2DShadow sampler)\n" - " (declare (in) vec3 coord)\n" - " (declare (in) float lod))\n" + " (declare (in) vec4 p))\n" " ()))\n" - "(function shadow1DProjLod\n" + "(function dFdy\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float p))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 p))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 p))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in) sampler1DShadow sampler)\n" - " (declare (in) vec4 coord)\n" - " (declare (in) float lod))\n" + " (declare (in) vec4 p))\n" " ()))\n" - "(function shadow2DProjLod\n" + "(function fwidth\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float p))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 p))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 p))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in) sampler2DShadow sampler)\n" - " (declare (in) vec4 coord)\n" - " (declare (in) float lod))\n" + " (declare (in) vec4 p))\n" " ()))\n" "(function noise1\n" " (signature float\n" @@ -6127,132 +6050,70 @@ static const char *prototypes_for_120_vert = " (declare (in) vec4 x))\n" " ())))" ; -static const char *functions_for_120_vert [] = { +static const char *functions_for_110_frag [] = { + builtin_abs, + builtin_acos, + builtin_all, + builtin_any, + builtin_asin, + builtin_atan, + builtin_ceil, builtin_clamp, - builtin_matrixCompMult, - builtin_shadow2DProjLod, - builtin_noise2, - builtin_texture3DProjLod, - builtin_pow, - builtin_texture2DProj, - builtin_greaterThanEqual, - builtin_sign, - builtin_texture3DProj, - builtin_texture2D, + builtin_cos, + builtin_cross, + builtin_dFdx, + builtin_dFdy, + builtin_degrees, + builtin_distance, + builtin_dot, builtin_equal, + builtin_exp, + builtin_exp2, 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_fwidth, builtin_greaterThan, - builtin_texture3D, - builtin_not, - builtin_texture2DProjLod, + builtin_greaterThanEqual, builtin_inversesqrt, + builtin_length, + builtin_lessThan, + builtin_lessThanEqual, + builtin_log, + builtin_log2, + builtin_matrixCompMult, + builtin_max, + builtin_min, + builtin_mix, builtin_mod, - builtin_noise4, - builtin_distance, - builtin_cos, - builtin_shadow1D, builtin_noise1, - builtin_refract, + builtin_noise2, builtin_noise3, - builtin_texture2DLod, - builtin_min, + builtin_noise4, + builtin_normalize, + builtin_not, + builtin_notEqual, + builtin_pow, 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)\n" - " (declare (in) vec2 coord))\n" - " ())\n" - " (signature vec4\n" - " (parameters\n" - " (declare (in) sampler1DArray sampler)\n" - " (declare (in) vec2 coord)\n" - " (declare (in) float bias))\n" - " ()))\n" - "(function texture2DArray\n" - " (signature vec4\n" - " (parameters\n" - " (declare (in) sampler2DArray sampler)\n" - " (declare (in) vec3 coord))\n" - " ())\n" - " (signature vec4\n" - " (parameters\n" - " (declare (in) sampler2DArray sampler)\n" - " (declare (in) vec3 coord)\n" - " (declare (in) float bias))\n" - " ()))\n" - "(function shadow1DArray\n" - " (signature vec4\n" - " (parameters\n" - " (declare (in) sampler1DArrayShadow sampler)\n" - " (declare (in) vec3 coord))\n" - " ())\n" - " (signature vec4\n" - " (parameters\n" - " (declare (in) sampler1DArrayShadow sampler)\n" - " (declare (in) vec3 coord)\n" - " (declare (in) float bias))\n" - " ()))\n" - "(function shadow2DArray\n" - " (signature vec4\n" - " (parameters\n" - " (declare (in) sampler2DArrayShadow sampler)\n" - " (declare (in) vec4 coord))\n" - " ())))" -; -static const char *functions_for_EXT_texture_array_frag [] = { - builtin_shadow2DArray, - builtin_shadow1DArray, - builtin_texture1DArray, - builtin_texture2DArray, + builtin_reflect, + builtin_refract, + builtin_shadow1D, + builtin_shadow1DProj, + builtin_shadow2D, + builtin_shadow2DProj, + builtin_sign, + builtin_sin, + builtin_smoothstep, + builtin_sqrt, + builtin_step, + builtin_tan, + builtin_texture1D, + builtin_texture1DProj, + builtin_texture2D, + builtin_texture2DProj, + builtin_texture3D, + builtin_texture3DProj, + builtin_textureCube, }; static const char *prototypes_for_110_vert = "(\n" @@ -7556,80 +7417,80 @@ static const char *prototypes_for_110_vert = " ())))" ; static const char *functions_for_110_vert [] = { + builtin_abs, + builtin_acos, + builtin_all, + builtin_any, + builtin_asin, + builtin_atan, + builtin_ceil, builtin_clamp, - builtin_matrixCompMult, - builtin_shadow2DProjLod, - builtin_noise2, - builtin_texture3DProjLod, - builtin_pow, - builtin_texture2DProj, - builtin_greaterThanEqual, - builtin_sign, - builtin_texture3DProj, - builtin_texture2D, + builtin_cos, + builtin_cross, + builtin_degrees, + builtin_distance, + builtin_dot, builtin_equal, + builtin_exp, + builtin_exp2, 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_greaterThanEqual, builtin_inversesqrt, + builtin_length, + builtin_lessThan, + builtin_lessThanEqual, + builtin_log, + builtin_log2, + builtin_matrixCompMult, + builtin_max, + builtin_min, + builtin_mix, builtin_mod, - builtin_noise4, - builtin_distance, - builtin_cos, - builtin_shadow1D, builtin_noise1, - builtin_refract, + builtin_noise2, builtin_noise3, - builtin_texture2DLod, - builtin_min, + builtin_noise4, + builtin_normalize, + builtin_not, + builtin_notEqual, + builtin_pow, builtin_radians, + builtin_reflect, + builtin_refract, + builtin_shadow1D, + builtin_shadow1DLod, + builtin_shadow1DProj, + builtin_shadow1DProjLod, + builtin_shadow2D, + builtin_shadow2DLod, + builtin_shadow2DProj, + builtin_shadow2DProjLod, + builtin_sign, + builtin_sin, builtin_smoothstep, + builtin_sqrt, + builtin_step, + builtin_tan, + builtin_texture1D, + builtin_texture1DLod, + builtin_texture1DProj, builtin_texture1DProjLod, + builtin_texture2D, + builtin_texture2DLod, + builtin_texture2DProj, + builtin_texture2DProjLod, + builtin_texture3D, + builtin_texture3DLod, + builtin_texture3DProj, + builtin_texture3DProjLod, builtin_textureCube, - builtin_length, - builtin_texture1DLod, - builtin_exp, - builtin_acos, - builtin_mix, - builtin_dot, + builtin_textureCubeLod, }; -static const char *prototypes_for_110_frag = +static const char *prototypes_for_120_frag = "(\n" "(function radians\n" " (signature float\n" @@ -8399,43 +8260,156 @@ static const char *prototypes_for_110_frag = "(function refract\n" " (signature float\n" " (parameters\n" - " (declare (in) float I)\n" - " (declare (in) float N)\n" - " (declare (in) float eta))\n" + " (declare (in) float I)\n" + " (declare (in) float N)\n" + " (declare (in) float eta))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 I)\n" + " (declare (in) vec2 N)\n" + " (declare (in) float eta))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 I)\n" + " (declare (in) vec3 N)\n" + " (declare (in) float eta))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 I)\n" + " (declare (in) vec4 N)\n" + " (declare (in) float eta))\n" + " ()))\n" + "(function matrixCompMult\n" + " (signature mat2\n" + " (parameters\n" + " (declare (in) mat2 x)\n" + " (declare (in) mat2 y))\n" + " ())\n" + " (signature mat3\n" + " (parameters\n" + " (declare (in) mat3 x)\n" + " (declare (in) mat3 y))\n" + " ())\n" + " (signature mat4\n" + " (parameters\n" + " (declare (in) mat4 x)\n" + " (declare (in) mat4 y))\n" + " ())\n" + " (signature mat2x3\n" + " (parameters\n" + " (declare (in) mat2x3 x)\n" + " (declare (in) mat2x3 y))\n" + " ())\n" + " (signature mat2x4\n" + " (parameters\n" + " (declare (in) mat2x4 x)\n" + " (declare (in) mat2x4 y))\n" + " ())\n" + " (signature mat3x2\n" + " (parameters\n" + " (declare (in) mat3x2 x)\n" + " (declare (in) mat3x2 y))\n" + " ())\n" + " (signature mat3x4\n" + " (parameters\n" + " (declare (in) mat3x4 x)\n" + " (declare (in) mat3x4 y))\n" + " ())\n" + " (signature mat4x2\n" + " (parameters\n" + " (declare (in) mat4x2 x)\n" + " (declare (in) mat4x2 y))\n" + " ())\n" + " (signature mat4x3\n" + " (parameters\n" + " (declare (in) mat4x3 x)\n" + " (declare (in) mat4x3 y))\n" + " ()))\n" + "(function outerProduct\n" + " (signature mat2\n" + " (parameters\n" + " (declare (in) vec2 c)\n" + " (declare (in) vec2 r))\n" + " ())\n" + " (signature mat3\n" + " (parameters\n" + " (declare (in) vec3 c)\n" + " (declare (in) vec3 r))\n" + " ())\n" + " (signature mat4\n" + " (parameters\n" + " (declare (in) vec4 c)\n" + " (declare (in) vec4 r))\n" + " ())\n" + " (signature mat2x3\n" + " (parameters\n" + " (declare (in) vec3 c)\n" + " (declare (in) vec2 r))\n" + " ())\n" + " (signature mat3x2\n" + " (parameters\n" + " (declare (in) vec2 c)\n" + " (declare (in) vec3 r))\n" + " ())\n" + " (signature mat2x4\n" + " (parameters\n" + " (declare (in) vec4 c)\n" + " (declare (in) vec2 r))\n" + " ())\n" + " (signature mat4x2\n" + " (parameters\n" + " (declare (in) vec2 c)\n" + " (declare (in) vec4 r))\n" + " ())\n" + " (signature mat3x4\n" + " (parameters\n" + " (declare (in) vec4 c)\n" + " (declare (in) vec3 r))\n" + " ())\n" + " (signature mat4x3\n" + " (parameters\n" + " (declare (in) vec3 c)\n" + " (declare (in) vec4 r))\n" + " ()))\n" + "(function transpose\n" + " (signature mat2\n" + " (parameters\n" + " (declare (in) mat2 m))\n" + " ())\n" + " (signature mat3\n" + " (parameters\n" + " (declare (in) mat3 m))\n" + " ())\n" + " (signature mat4\n" + " (parameters\n" + " (declare (in) mat4 m))\n" " ())\n" - " (signature vec2\n" + " (signature mat2x3\n" " (parameters\n" - " (declare (in) vec2 I)\n" - " (declare (in) vec2 N)\n" - " (declare (in) float eta))\n" + " (declare (in) mat3x2 m))\n" " ())\n" - " (signature vec3\n" + " (signature mat3x2\n" " (parameters\n" - " (declare (in) vec3 I)\n" - " (declare (in) vec3 N)\n" - " (declare (in) float eta))\n" + " (declare (in) mat2x3 m))\n" " ())\n" - " (signature vec4\n" + " (signature mat2x4\n" " (parameters\n" - " (declare (in) vec4 I)\n" - " (declare (in) vec4 N)\n" - " (declare (in) float eta))\n" - " ()))\n" - "(function matrixCompMult\n" - " (signature mat2\n" + " (declare (in) mat4x2 m))\n" + " ())\n" + " (signature mat4x2\n" " (parameters\n" - " (declare (in) mat2 x)\n" - " (declare (in) mat2 y))\n" + " (declare (in) mat2x4 m))\n" " ())\n" - " (signature mat3\n" + " (signature mat3x4\n" " (parameters\n" - " (declare (in) mat3 x)\n" - " (declare (in) mat3 y))\n" + " (declare (in) mat4x3 m))\n" " ())\n" - " (signature mat4\n" + " (signature mat4x3\n" " (parameters\n" - " (declare (in) mat4 x)\n" - " (declare (in) mat4 y))\n" + " (declare (in) mat3x4 m))\n" " ()))\n" "(function lessThan\n" " (signature bvec2\n" @@ -8966,129 +8940,74 @@ static const char *prototypes_for_110_frag = " (declare (in) vec4 x))\n" " ())))" ; -static const char *functions_for_110_frag [] = { +static const char *functions_for_120_frag [] = { + builtin_abs, + builtin_acos, + builtin_all, + builtin_any, + builtin_asin, + builtin_atan, + builtin_ceil, builtin_clamp, - builtin_matrixCompMult, - builtin_noise2, - builtin_pow, - builtin_texture2DProj, - builtin_fwidth, - builtin_greaterThanEqual, - builtin_sign, - builtin_texture3DProj, - builtin_texture2D, + builtin_cos, + builtin_cross, + builtin_dFdx, + builtin_dFdy, + builtin_degrees, + builtin_distance, + builtin_dot, builtin_equal, + builtin_exp, + builtin_exp2, 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_fwidth, builtin_greaterThan, - builtin_texture3D, - builtin_not, + builtin_greaterThanEqual, builtin_inversesqrt, + builtin_length, + builtin_lessThan, + builtin_lessThanEqual, + builtin_log, + builtin_log2, + builtin_matrixCompMult, + builtin_max, + builtin_min, + builtin_mix, builtin_mod, - builtin_noise4, - builtin_distance, - builtin_cos, - builtin_shadow1D, builtin_noise1, - builtin_refract, + builtin_noise2, builtin_noise3, - builtin_min, + builtin_noise4, + builtin_normalize, + builtin_not, + builtin_notEqual, + builtin_outerProduct, + builtin_pow, builtin_radians, + builtin_reflect, + builtin_refract, + builtin_shadow1D, + builtin_shadow1DProj, + builtin_shadow2D, + builtin_shadow2DProj, + builtin_sign, + builtin_sin, builtin_smoothstep, + builtin_sqrt, + builtin_step, + builtin_tan, + builtin_texture1D, + builtin_texture1DProj, + builtin_texture2D, + builtin_texture2DProj, + builtin_texture3D, + builtin_texture3DProj, 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)\n" - " (declare (in) vec2 coord))\n" - " ()))\n" - "(function texture1DArrayLod\n" - " (signature vec4\n" - " (parameters\n" - " (declare (in) sampler1DArray sampler)\n" - " (declare (in) vec2 coord)\n" - " (declare (in) float lod))\n" - " ()))\n" - "(function texture2DArray\n" - " (signature vec4\n" - " (parameters\n" - " (declare (in) sampler2DArray sampler)\n" - " (declare (in) vec3 coord))\n" - " ()))\n" - "(function texture2DArrayLod\n" - " (signature vec4\n" - " (parameters\n" - " (declare (in) sampler2DArray sampler)\n" - " (declare (in) vec3 coord)\n" - " (declare (in) float lod))\n" - " ()))\n" - "(function shadow1DArray\n" - " (signature vec4\n" - " (parameters\n" - " (declare (in) sampler1DArrayShadow sampler)\n" - " (declare (in) vec3 coord))\n" - " ()))\n" - "(function shadow1DArrayLod\n" - " (signature vec4\n" - " (parameters\n" - " (declare (in) sampler1DArrayShadow sampler)\n" - " (declare (in) vec3 coord)\n" - " (declare (in) float lod))\n" - " ()))\n" - "(function shadow2DArray\n" - " (signature vec4\n" - " (parameters\n" - " (declare (in) sampler2DArrayShadow sampler)\n" - " (declare (in) vec4 coord))\n" - " ())))" -; -static const char *functions_for_EXT_texture_array_vert [] = { - builtin_texture1DArrayLod, - builtin_shadow2DArray, - builtin_texture2DArrayLod, - builtin_shadow1DArrayLod, - builtin_shadow1DArray, - builtin_texture2DArray, - builtin_texture1DArray, + builtin_transpose, }; -static const char *prototypes_for_130_frag = +static const char *prototypes_for_120_vert = "(\n" "(function radians\n" " (signature float\n" @@ -9246,57 +9165,6 @@ static const char *prototypes_for_130_frag = " (parameters\n" " (declare (in) vec4 y_over_x))\n" " ()))\n" - "(function sinh\n" - " (signature float\n" - " (parameters\n" - " (declare (in) float x))\n" - " ())\n" - " (signature vec2\n" - " (parameters\n" - " (declare (in) vec2 x))\n" - " ())\n" - " (signature vec3\n" - " (parameters\n" - " (declare (in) vec3 x))\n" - " ())\n" - " (signature vec4\n" - " (parameters\n" - " (declare (in) vec4 x))\n" - " ()))\n" - "(function cosh\n" - " (signature float\n" - " (parameters\n" - " (declare (in) float x))\n" - " ())\n" - " (signature vec2\n" - " (parameters\n" - " (declare (in) vec2 x))\n" - " ())\n" - " (signature vec3\n" - " (parameters\n" - " (declare (in) vec3 x))\n" - " ())\n" - " (signature vec4\n" - " (parameters\n" - " (declare (in) vec4 x))\n" - " ()))\n" - "(function tanh\n" - " (signature float\n" - " (parameters\n" - " (declare (in) float x))\n" - " ())\n" - " (signature vec2\n" - " (parameters\n" - " (declare (in) vec2 x))\n" - " ())\n" - " (signature vec3\n" - " (parameters\n" - " (declare (in) vec3 x))\n" - " ())\n" - " (signature vec4\n" - " (parameters\n" - " (declare (in) vec4 x))\n" - " ()))\n" "(function pow\n" " (signature float\n" " (parameters\n" @@ -9436,22 +9304,6 @@ static const char *prototypes_for_130_frag = " (signature vec4\n" " (parameters\n" " (declare (in) vec4 x))\n" - " ())\n" - " (signature int\n" - " (parameters\n" - " (declare (in) int x))\n" - " ())\n" - " (signature ivec2\n" - " (parameters\n" - " (declare (in) ivec2 x))\n" - " ())\n" - " (signature ivec3\n" - " (parameters\n" - " (declare (in) ivec3 x))\n" - " ())\n" - " (signature ivec4\n" - " (parameters\n" - " (declare (in) ivec4 x))\n" " ()))\n" "(function sign\n" " (signature float\n" @@ -9469,22 +9321,6 @@ static const char *prototypes_for_130_frag = " (signature vec4\n" " (parameters\n" " (declare (in) vec4 x))\n" - " ())\n" - " (signature int\n" - " (parameters\n" - " (declare (in) int x))\n" - " ())\n" - " (signature ivec2\n" - " (parameters\n" - " (declare (in) ivec2 x))\n" - " ())\n" - " (signature ivec3\n" - " (parameters\n" - " (declare (in) ivec3 x))\n" - " ())\n" - " (signature ivec4\n" - " (parameters\n" - " (declare (in) ivec4 x))\n" " ()))\n" "(function floor\n" " (signature float\n" @@ -9608,76 +9444,6 @@ static const char *prototypes_for_130_frag = " (parameters\n" " (declare (in) vec4 x)\n" " (declare (in) float y))\n" - " ())\n" - " (signature int\n" - " (parameters\n" - " (declare (in) int x)\n" - " (declare (in) int y))\n" - " ())\n" - " (signature ivec2\n" - " (parameters\n" - " (declare (in) ivec2 x)\n" - " (declare (in) ivec2 y))\n" - " ())\n" - " (signature ivec3\n" - " (parameters\n" - " (declare (in) ivec3 x)\n" - " (declare (in) ivec3 y))\n" - " ())\n" - " (signature ivec4\n" - " (parameters\n" - " (declare (in) ivec4 x)\n" - " (declare (in) ivec4 y))\n" - " ())\n" - " (signature ivec2\n" - " (parameters\n" - " (declare (in) ivec2 x)\n" - " (declare (in) int y))\n" - " ())\n" - " (signature ivec3\n" - " (parameters\n" - " (declare (in) ivec3 x)\n" - " (declare (in) int y))\n" - " ())\n" - " (signature ivec4\n" - " (parameters\n" - " (declare (in) ivec4 x)\n" - " (declare (in) int y))\n" - " ())\n" - " (signature uint\n" - " (parameters\n" - " (declare (in) uint x)\n" - " (declare (in) uint y))\n" - " ())\n" - " (signature uvec2\n" - " (parameters\n" - " (declare (in) uvec2 x)\n" - " (declare (in) uvec2 y))\n" - " ())\n" - " (signature uvec3\n" - " (parameters\n" - " (declare (in) uvec3 x)\n" - " (declare (in) uvec3 y))\n" - " ())\n" - " (signature uvec4\n" - " (parameters\n" - " (declare (in) uvec4 x)\n" - " (declare (in) uvec4 y))\n" - " ())\n" - " (signature uvec2\n" - " (parameters\n" - " (declare (in) uvec2 x)\n" - " (declare (in) uint y))\n" - " ())\n" - " (signature uvec3\n" - " (parameters\n" - " (declare (in) uvec3 x)\n" - " (declare (in) uint y))\n" - " ())\n" - " (signature uvec4\n" - " (parameters\n" - " (declare (in) uvec4 x)\n" - " (declare (in) uint y))\n" " ()))\n" "(function max\n" " (signature float\n" @@ -9714,203 +9480,49 @@ static const char *prototypes_for_130_frag = " (parameters\n" " (declare (in) vec4 x)\n" " (declare (in) float y))\n" - " ())\n" - " (signature int\n" - " (parameters\n" - " (declare (in) int x)\n" - " (declare (in) int y))\n" - " ())\n" - " (signature ivec2\n" - " (parameters\n" - " (declare (in) ivec2 x)\n" - " (declare (in) ivec2 y))\n" - " ())\n" - " (signature ivec3\n" - " (parameters\n" - " (declare (in) ivec3 x)\n" - " (declare (in) ivec3 y))\n" - " ())\n" - " (signature ivec4\n" - " (parameters\n" - " (declare (in) ivec4 x)\n" - " (declare (in) ivec4 y))\n" - " ())\n" - " (signature ivec2\n" - " (parameters\n" - " (declare (in) ivec2 x)\n" - " (declare (in) int y))\n" - " ())\n" - " (signature ivec3\n" - " (parameters\n" - " (declare (in) ivec3 x)\n" - " (declare (in) int y))\n" - " ())\n" - " (signature ivec4\n" - " (parameters\n" - " (declare (in) ivec4 x)\n" - " (declare (in) int y))\n" - " ())\n" - " (signature uint\n" - " (parameters\n" - " (declare (in) uint x)\n" - " (declare (in) uint y))\n" - " ())\n" - " (signature uvec2\n" - " (parameters\n" - " (declare (in) uvec2 x)\n" - " (declare (in) uvec2 y))\n" - " ())\n" - " (signature uvec3\n" - " (parameters\n" - " (declare (in) uvec3 x)\n" - " (declare (in) uvec3 y))\n" - " ())\n" - " (signature uvec4\n" - " (parameters\n" - " (declare (in) uvec4 x)\n" - " (declare (in) uvec4 y))\n" - " ())\n" - " (signature uvec2\n" - " (parameters\n" - " (declare (in) uvec2 x)\n" - " (declare (in) uint y))\n" - " ())\n" - " (signature uvec3\n" - " (parameters\n" - " (declare (in) uvec3 x)\n" - " (declare (in) uint y))\n" - " ())\n" - " (signature uvec4\n" - " (parameters\n" - " (declare (in) uvec4 x)\n" - " (declare (in) uint y))\n" " ()))\n" "(function clamp\n" " (signature float\n" " (parameters\n" - " (declare (in) float x)\n" - " (declare (in) float minVal)\n" - " (declare (in) float maxVal))\n" - " ())\n" - " (signature vec2\n" - " (parameters\n" - " (declare (in) vec2 x)\n" - " (declare (in) vec2 minVal)\n" - " (declare (in) vec2 maxVal))\n" - " ())\n" - " (signature vec3\n" - " (parameters\n" - " (declare (in) vec3 x)\n" - " (declare (in) vec3 minVal)\n" - " (declare (in) vec3 maxVal))\n" - " ())\n" - " (signature vec4\n" - " (parameters\n" - " (declare (in) vec4 x)\n" - " (declare (in) vec4 minVal)\n" - " (declare (in) vec4 maxVal))\n" - " ())\n" - " (signature vec2\n" - " (parameters\n" - " (declare (in) vec2 x)\n" - " (declare (in) float minVal)\n" - " (declare (in) float maxVal))\n" - " ())\n" - " (signature vec3\n" - " (parameters\n" - " (declare (in) vec3 x)\n" - " (declare (in) float minVal)\n" - " (declare (in) float maxVal))\n" - " ())\n" - " (signature vec4\n" - " (parameters\n" - " (declare (in) vec4 x)\n" - " (declare (in) float minVal)\n" - " (declare (in) float maxVal))\n" - " ())\n" - " (signature int\n" - " (parameters\n" - " (declare (in) int x)\n" - " (declare (in) int minVal)\n" - " (declare (in) int maxVal))\n" - " ())\n" - " (signature ivec2\n" - " (parameters\n" - " (declare (in) ivec2 x)\n" - " (declare (in) ivec2 minVal)\n" - " (declare (in) ivec2 maxVal))\n" - " ())\n" - " (signature ivec3\n" - " (parameters\n" - " (declare (in) ivec3 x)\n" - " (declare (in) ivec3 minVal)\n" - " (declare (in) ivec3 maxVal))\n" - " ())\n" - " (signature ivec4\n" - " (parameters\n" - " (declare (in) ivec4 x)\n" - " (declare (in) ivec4 minVal)\n" - " (declare (in) ivec4 maxVal))\n" - " ())\n" - " (signature ivec2\n" - " (parameters\n" - " (declare (in) ivec2 x)\n" - " (declare (in) int minVal)\n" - " (declare (in) int maxVal))\n" - " ())\n" - " (signature ivec3\n" - " (parameters\n" - " (declare (in) ivec3 x)\n" - " (declare (in) int minVal)\n" - " (declare (in) int maxVal))\n" - " ())\n" - " (signature ivec4\n" - " (parameters\n" - " (declare (in) ivec4 x)\n" - " (declare (in) int minVal)\n" - " (declare (in) int maxVal))\n" - " ())\n" - " (signature uint\n" - " (parameters\n" - " (declare (in) uint x)\n" - " (declare (in) uint minVal)\n" - " (declare (in) uint maxVal))\n" + " (declare (in) float x)\n" + " (declare (in) float minVal)\n" + " (declare (in) float maxVal))\n" " ())\n" - " (signature uvec2\n" + " (signature vec2\n" " (parameters\n" - " (declare (in) uvec2 x)\n" - " (declare (in) uvec2 minVal)\n" - " (declare (in) uvec2 maxVal))\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 minVal)\n" + " (declare (in) vec2 maxVal))\n" " ())\n" - " (signature uvec3\n" + " (signature vec3\n" " (parameters\n" - " (declare (in) uvec3 x)\n" - " (declare (in) uvec3 minVal)\n" - " (declare (in) uvec3 maxVal))\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 minVal)\n" + " (declare (in) vec3 maxVal))\n" " ())\n" - " (signature uvec4\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) uvec4 x)\n" - " (declare (in) uvec4 minVal)\n" - " (declare (in) uvec4 maxVal))\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 minVal)\n" + " (declare (in) vec4 maxVal))\n" " ())\n" - " (signature uvec2\n" + " (signature vec2\n" " (parameters\n" - " (declare (in) uvec2 x)\n" - " (declare (in) uint minVal)\n" - " (declare (in) uint maxVal))\n" + " (declare (in) vec2 x)\n" + " (declare (in) float minVal)\n" + " (declare (in) float maxVal))\n" " ())\n" - " (signature uvec3\n" + " (signature vec3\n" " (parameters\n" - " (declare (in) uvec3 x)\n" - " (declare (in) uint minVal)\n" - " (declare (in) uint maxVal))\n" + " (declare (in) vec3 x)\n" + " (declare (in) float minVal)\n" + " (declare (in) float maxVal))\n" " ())\n" - " (signature uvec4\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) uvec4 x)\n" - " (declare (in) uint minVal)\n" - " (declare (in) uint maxVal))\n" + " (declare (in) vec4 x)\n" + " (declare (in) float minVal)\n" + " (declare (in) float maxVal))\n" " ()))\n" "(function mix\n" " (signature float\n" @@ -10116,6 +9728,10 @@ static const char *prototypes_for_130_frag = " (parameters\n" " (declare (in) vec4 x))\n" " ()))\n" + "(function ftransform\n" + " (signature vec4\n" + " (parameters)\n" + " ()))\n" "(function faceforward\n" " (signature float\n" " (parameters\n" @@ -10346,21 +9962,6 @@ static const char *prototypes_for_130_frag = " (parameters\n" " (declare (in) ivec4 x)\n" " (declare (in) ivec4 y))\n" - " ())\n" - " (signature bvec2\n" - " (parameters\n" - " (declare (in) uvec2 x)\n" - " (declare (in) uvec2 y))\n" - " ())\n" - " (signature bvec3\n" - " (parameters\n" - " (declare (in) uvec3 x)\n" - " (declare (in) uvec3 y))\n" - " ())\n" - " (signature bvec4\n" - " (parameters\n" - " (declare (in) uvec4 x)\n" - " (declare (in) uvec4 y))\n" " ()))\n" "(function lessThanEqual\n" " (signature bvec2\n" @@ -10392,21 +9993,6 @@ static const char *prototypes_for_130_frag = " (parameters\n" " (declare (in) ivec4 x)\n" " (declare (in) ivec4 y))\n" - " ())\n" - " (signature bvec2\n" - " (parameters\n" - " (declare (in) uvec2 x)\n" - " (declare (in) uvec2 y))\n" - " ())\n" - " (signature bvec3\n" - " (parameters\n" - " (declare (in) uvec3 x)\n" - " (declare (in) uvec3 y))\n" - " ())\n" - " (signature bvec4\n" - " (parameters\n" - " (declare (in) uvec4 x)\n" - " (declare (in) uvec4 y))\n" " ()))\n" "(function greaterThan\n" " (signature bvec2\n" @@ -10438,21 +10024,6 @@ static const char *prototypes_for_130_frag = " (parameters\n" " (declare (in) ivec4 x)\n" " (declare (in) ivec4 y))\n" - " ())\n" - " (signature bvec2\n" - " (parameters\n" - " (declare (in) uvec2 x)\n" - " (declare (in) uvec2 y))\n" - " ())\n" - " (signature bvec3\n" - " (parameters\n" - " (declare (in) uvec3 x)\n" - " (declare (in) uvec3 y))\n" - " ())\n" - " (signature bvec4\n" - " (parameters\n" - " (declare (in) uvec4 x)\n" - " (declare (in) uvec4 y))\n" " ()))\n" "(function greaterThanEqual\n" " (signature bvec2\n" @@ -10484,21 +10055,6 @@ static const char *prototypes_for_130_frag = " (parameters\n" " (declare (in) ivec4 x)\n" " (declare (in) ivec4 y))\n" - " ())\n" - " (signature bvec2\n" - " (parameters\n" - " (declare (in) uvec2 x)\n" - " (declare (in) uvec2 y))\n" - " ())\n" - " (signature bvec3\n" - " (parameters\n" - " (declare (in) uvec3 x)\n" - " (declare (in) uvec3 y))\n" - " ())\n" - " (signature bvec4\n" - " (parameters\n" - " (declare (in) uvec4 x)\n" - " (declare (in) uvec4 y))\n" " ()))\n" "(function equal\n" " (signature bvec2\n" @@ -10533,21 +10089,6 @@ static const char *prototypes_for_130_frag = " ())\n" " (signature bvec2\n" " (parameters\n" - " (declare (in) uvec2 x)\n" - " (declare (in) uvec2 y))\n" - " ())\n" - " (signature bvec3\n" - " (parameters\n" - " (declare (in) uvec3 x)\n" - " (declare (in) uvec3 y))\n" - " ())\n" - " (signature bvec4\n" - " (parameters\n" - " (declare (in) uvec4 x)\n" - " (declare (in) uvec4 y))\n" - " ())\n" - " (signature bvec2\n" - " (parameters\n" " (declare (in) bvec2 x)\n" " (declare (in) bvec2 y))\n" " ())\n" @@ -10594,21 +10135,6 @@ static const char *prototypes_for_130_frag = " ())\n" " (signature bvec2\n" " (parameters\n" - " (declare (in) uvec2 x)\n" - " (declare (in) uvec2 y))\n" - " ())\n" - " (signature bvec3\n" - " (parameters\n" - " (declare (in) uvec3 x)\n" - " (declare (in) uvec3 y))\n" - " ())\n" - " (signature bvec4\n" - " (parameters\n" - " (declare (in) uvec4 x)\n" - " (declare (in) uvec4 y))\n" - " ())\n" - " (signature bvec2\n" - " (parameters\n" " (declare (in) bvec2 x)\n" " (declare (in) bvec2 y))\n" " ())\n" @@ -10661,5761 +10187,5994 @@ static const char *prototypes_for_130_frag = " (parameters\n" " (declare (in) bvec4 x))\n" " ()))\n" - "(function texture\n" + "(function texture1D\n" " (signature vec4\n" " (parameters\n" " (declare (in) sampler1D sampler)\n" - " (declare (in) float P))\n" + " (declare (in) float coord))\n" + " ()))\n" + "(function texture1DProj\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) vec2 coord))\n" " ())\n" - " (signature ivec4\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) isampler1D sampler)\n" - " (declare (in) float P))\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) vec4 coord))\n" + " ()))\n" + "(function texture1DLod\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) float coord)\n" + " (declare (in) float lod))\n" + " ()))\n" + "(function texture1DProjLod\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) vec2 coord)\n" + " (declare (in) float lod))\n" " ())\n" - " (signature uvec4\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) vec4 coord)\n" + " (declare (in) float lod))\n" + " ()))\n" + "(function texture2D\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec2 coord))\n" + " ()))\n" + "(function texture2DProj\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec3 coord))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec4 coord))\n" + " ()))\n" + "(function texture2DLod\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec2 coord)\n" + " (declare (in) float lod))\n" + " ()))\n" + "(function texture2DProjLod\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec3 coord)\n" + " (declare (in) float lod))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec4 coord)\n" + " (declare (in) float lod))\n" + " ()))\n" + "(function texture3D\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler3D sampler)\n" + " (declare (in) vec3 coord))\n" + " ()))\n" + "(function texture3DProj\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler3D sampler)\n" + " (declare (in) vec4 coord))\n" + " ()))\n" + "(function texture3DLod\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler3D sampler)\n" + " (declare (in) vec3 coord)\n" + " (declare (in) float lod))\n" + " ()))\n" + "(function texture3DProjLod\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler3D sampler)\n" + " (declare (in) vec4 coord)\n" + " (declare (in) float lod))\n" + " ()))\n" + "(function textureCube\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) samplerCube sampler)\n" + " (declare (in) vec3 coord))\n" + " ()))\n" + "(function textureCubeLod\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) usampler1D sampler)\n" - " (declare (in) float P))\n" - " ())\n" + " (declare (in) samplerCube sampler)\n" + " (declare (in) vec3 coord)\n" + " (declare (in) float lod))\n" + " ()))\n" + "(function shadow1D\n" " (signature vec4\n" " (parameters\n" - " (declare (in) sampler2D sampler)\n" - " (declare (in) vec2 P))\n" - " ())\n" - " (signature ivec4\n" + " (declare (in) sampler1DShadow sampler)\n" + " (declare (in) vec3 coord))\n" + " ()))\n" + "(function shadow2D\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) isampler2D sampler)\n" - " (declare (in) vec2 P))\n" - " ())\n" - " (signature uvec4\n" + " (declare (in) sampler2DShadow sampler)\n" + " (declare (in) vec3 coord))\n" + " ()))\n" + "(function shadow1DProj\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) usampler2D sampler)\n" - " (declare (in) vec2 P))\n" - " ())\n" + " (declare (in) sampler1DShadow sampler)\n" + " (declare (in) vec4 coord))\n" + " ()))\n" + "(function shadow2DProj\n" " (signature vec4\n" " (parameters\n" - " (declare (in) sampler3D sampler)\n" - " (declare (in) vec3 P))\n" - " ())\n" - " (signature ivec4\n" + " (declare (in) sampler2DShadow sampler)\n" + " (declare (in) vec4 coord))\n" + " ()))\n" + "(function shadow1DLod\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) isampler3D sampler)\n" - " (declare (in) vec3 P))\n" - " ())\n" - " (signature uvec4\n" + " (declare (in) sampler1DShadow sampler)\n" + " (declare (in) vec3 coord)\n" + " (declare (in) float lod))\n" + " ()))\n" + "(function shadow2DLod\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) usampler3D sampler)\n" - " (declare (in) vec3 P))\n" - " ())\n" + " (declare (in) sampler2DShadow sampler)\n" + " (declare (in) vec3 coord)\n" + " (declare (in) float lod))\n" + " ()))\n" + "(function shadow1DProjLod\n" " (signature vec4\n" " (parameters\n" - " (declare (in) samplerCube sampler)\n" - " (declare (in) vec3 P))\n" - " ())\n" - " (signature ivec4\n" + " (declare (in) sampler1DShadow sampler)\n" + " (declare (in) vec4 coord)\n" + " (declare (in) float lod))\n" + " ()))\n" + "(function shadow2DProjLod\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) isamplerCube sampler)\n" - " (declare (in) vec3 P))\n" - " ())\n" - " (signature uvec4\n" + " (declare (in) sampler2DShadow sampler)\n" + " (declare (in) vec4 coord)\n" + " (declare (in) float lod))\n" + " ()))\n" + "(function noise1\n" + " (signature float\n" " (parameters\n" - " (declare (in) usamplerCube sampler)\n" - " (declare (in) vec3 P))\n" + " (declare (in) float x))\n" " ())\n" " (signature float\n" " (parameters\n" - " (declare (in) sampler1DShadow sampler)\n" - " (declare (in) vec3 P))\n" + " (declare (in) vec2 x))\n" " ())\n" " (signature float\n" " (parameters\n" - " (declare (in) sampler2DShadow sampler)\n" - " (declare (in) vec3 P))\n" + " (declare (in) vec3 x))\n" " ())\n" " (signature float\n" " (parameters\n" - " (declare (in) samplerCubeShadow sampler)\n" - " (declare (in) vec4 P))\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function noise2\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) float x))\n" " ())\n" - " (signature vec4\n" + " (signature vec2\n" " (parameters\n" - " (declare (in) sampler1DArray sampler)\n" - " (declare (in) vec2 P))\n" + " (declare (in) vec2 x))\n" " ())\n" - " (signature ivec4\n" + " (signature vec2\n" " (parameters\n" - " (declare (in) isampler1DArray sampler)\n" - " (declare (in) vec2 P))\n" + " (declare (in) vec3 x))\n" " ())\n" - " (signature uvec4\n" + " (signature vec2\n" " (parameters\n" - " (declare (in) usampler1DArray sampler)\n" - " (declare (in) vec2 P))\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function noise3\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) float x))\n" " ())\n" - " (signature vec4\n" + " (signature vec3\n" " (parameters\n" - " (declare (in) sampler2DArray sampler)\n" - " (declare (in) vec3 P))\n" + " (declare (in) vec2 x))\n" " ())\n" - " (signature ivec4\n" + " (signature vec3\n" " (parameters\n" - " (declare (in) isampler2DArray sampler)\n" - " (declare (in) vec3 P))\n" + " (declare (in) vec3 x))\n" " ())\n" - " (signature uvec4\n" + " (signature vec3\n" " (parameters\n" - " (declare (in) usampler2DArray sampler)\n" - " (declare (in) vec3 P))\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function noise4\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) float x))\n" " ())\n" - " (signature float\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) sampler1DArrayShadow sampler)\n" - " (declare (in) vec3 P))\n" + " (declare (in) vec2 x))\n" " ())\n" - " (signature float\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) sampler2DArrayShadow sampler)\n" - " (declare (in) vec4 P))\n" + " (declare (in) vec3 x))\n" " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in) sampler1D sampler)\n" - " (declare (in) float P)\n" - " (declare (in) float bias))\n" + " (declare (in) vec4 x))\n" + " ())))" +; +static const char *functions_for_120_vert [] = { + builtin_abs, + builtin_acos, + builtin_all, + builtin_any, + builtin_asin, + builtin_atan, + builtin_ceil, + builtin_clamp, + builtin_cos, + builtin_cross, + builtin_degrees, + builtin_distance, + builtin_dot, + builtin_equal, + builtin_exp, + builtin_exp2, + builtin_faceforward, + builtin_floor, + builtin_fract, + builtin_ftransform, + builtin_greaterThan, + builtin_greaterThanEqual, + builtin_inversesqrt, + builtin_length, + builtin_lessThan, + builtin_lessThanEqual, + builtin_log, + builtin_log2, + builtin_matrixCompMult, + builtin_max, + builtin_min, + builtin_mix, + builtin_mod, + builtin_noise1, + builtin_noise2, + builtin_noise3, + builtin_noise4, + builtin_normalize, + builtin_not, + builtin_notEqual, + builtin_outerProduct, + builtin_pow, + builtin_radians, + builtin_reflect, + builtin_refract, + builtin_shadow1D, + builtin_shadow1DLod, + builtin_shadow1DProj, + builtin_shadow1DProjLod, + builtin_shadow2D, + builtin_shadow2DLod, + builtin_shadow2DProj, + builtin_shadow2DProjLod, + builtin_sign, + builtin_sin, + builtin_smoothstep, + builtin_sqrt, + builtin_step, + builtin_tan, + builtin_texture1D, + builtin_texture1DLod, + builtin_texture1DProj, + builtin_texture1DProjLod, + builtin_texture2D, + builtin_texture2DLod, + builtin_texture2DProj, + builtin_texture2DProjLod, + builtin_texture3D, + builtin_texture3DLod, + builtin_texture3DProj, + builtin_texture3DProjLod, + builtin_textureCube, + builtin_textureCubeLod, + builtin_transpose, +}; +static const char *prototypes_for_130_frag = + "(\n" + "(function radians\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float degrees))\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" + " (declare (in) vec2 degrees))\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" + " (declare (in) vec3 degrees))\n" " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in) sampler2D sampler)\n" - " (declare (in) vec2 P)\n" - " (declare (in) float bias))\n" + " (declare (in) vec4 degrees))\n" + " ()))\n" + "(function degrees\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float radians))\n" " ())\n" - " (signature ivec4\n" + " (signature vec2\n" " (parameters\n" - " (declare (in) isampler2D sampler)\n" - " (declare (in) vec2 P)\n" - " (declare (in) float bias))\n" + " (declare (in) vec2 radians))\n" " ())\n" - " (signature uvec4\n" + " (signature vec3\n" " (parameters\n" - " (declare (in) usampler2D sampler)\n" - " (declare (in) vec2 P)\n" - " (declare (in) float bias))\n" + " (declare (in) vec3 radians))\n" " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in) sampler3D sampler)\n" - " (declare (in) vec3 P)\n" - " (declare (in) float bias))\n" + " (declare (in) vec4 radians))\n" + " ()))\n" + "(function sin\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float angle))\n" " ())\n" - " (signature ivec4\n" + " (signature vec2\n" " (parameters\n" - " (declare (in) isampler3D sampler)\n" - " (declare (in) vec3 P)\n" - " (declare (in) float bias))\n" + " (declare (in) vec2 angle))\n" " ())\n" - " (signature uvec4\n" + " (signature vec3\n" " (parameters\n" - " (declare (in) usampler3D sampler)\n" - " (declare (in) vec3 P)\n" - " (declare (in) float bias))\n" + " (declare (in) vec3 angle))\n" " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in) samplerCube sampler)\n" - " (declare (in) vec3 P)\n" - " (declare (in) float bias))\n" + " (declare (in) vec4 angle))\n" + " ()))\n" + "(function cos\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float angle))\n" " ())\n" - " (signature ivec4\n" + " (signature vec2\n" " (parameters\n" - " (declare (in) isamplerCube sampler)\n" - " (declare (in) vec3 P)\n" - " (declare (in) float bias))\n" + " (declare (in) vec2 angle))\n" " ())\n" - " (signature uvec4\n" + " (signature vec3\n" " (parameters\n" - " (declare (in) usamplerCube sampler)\n" - " (declare (in) vec3 P)\n" - " (declare (in) float bias))\n" + " (declare (in) vec3 angle))\n" " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 angle))\n" + " ()))\n" + "(function tan\n" " (signature float\n" " (parameters\n" - " (declare (in) sampler1DShadow sampler)\n" - " (declare (in) vec3 P)\n" - " (declare (in) float bias))\n" + " (declare (in) float angle))\n" " ())\n" - " (signature float\n" + " (signature vec2\n" " (parameters\n" - " (declare (in) sampler2DShadow sampler)\n" - " (declare (in) vec3 P)\n" - " (declare (in) float bias))\n" + " (declare (in) vec2 angle))\n" " ())\n" - " (signature float\n" + " (signature vec3\n" " (parameters\n" - " (declare (in) samplerCubeShadow sampler)\n" - " (declare (in) vec4 P)\n" - " (declare (in) float bias))\n" + " (declare (in) vec3 angle))\n" " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in) sampler1DArray sampler)\n" - " (declare (in) vec2 P)\n" - " (declare (in) float bias))\n" + " (declare (in) vec4 angle))\n" + " ()))\n" + "(function asin\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float angle))\n" " ())\n" - " (signature ivec4\n" + " (signature vec2\n" " (parameters\n" - " (declare (in) isampler1DArray sampler)\n" - " (declare (in) vec2 P)\n" - " (declare (in) float bias))\n" + " (declare (in) vec2 angle))\n" " ())\n" - " (signature uvec4\n" + " (signature vec3\n" " (parameters\n" - " (declare (in) usampler1DArray sampler)\n" - " (declare (in) vec2 P)\n" - " (declare (in) float bias))\n" + " (declare (in) vec3 angle))\n" " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in) sampler2DArray sampler)\n" - " (declare (in) vec3 P)\n" - " (declare (in) float bias))\n" + " (declare (in) vec4 angle))\n" + " ()))\n" + "(function acos\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float angle))\n" " ())\n" - " (signature ivec4\n" + " (signature vec2\n" " (parameters\n" - " (declare (in) isampler2DArray sampler)\n" - " (declare (in) vec3 P)\n" - " (declare (in) float bias))\n" + " (declare (in) vec2 angle))\n" " ())\n" - " (signature uvec4\n" + " (signature vec3\n" " (parameters\n" - " (declare (in) usampler2DArray sampler)\n" - " (declare (in) vec3 P)\n" - " (declare (in) float bias))\n" + " (declare (in) vec3 angle))\n" " ())\n" - " (signature float\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) sampler1DArrayShadow sampler)\n" - " (declare (in) vec3 P)\n" - " (declare (in) float bias))\n" + " (declare (in) vec4 angle))\n" " ()))\n" - "(function textureProj\n" - " (signature vec4\n" + "(function atan\n" + " (signature float\n" " (parameters\n" - " (declare (in) sampler1D sampler)\n" - " (declare (in) vec2 P))\n" + " (declare (in) float y)\n" + " (declare (in) float x))\n" " ())\n" - " (signature ivec4\n" + " (signature vec2\n" " (parameters\n" - " (declare (in) isampler1D sampler)\n" - " (declare (in) vec2 P))\n" + " (declare (in) vec2 y)\n" + " (declare (in) vec2 x))\n" " ())\n" - " (signature uvec4\n" + " (signature vec3\n" " (parameters\n" - " (declare (in) usampler1D sampler)\n" - " (declare (in) vec2 P))\n" + " (declare (in) vec3 y)\n" + " (declare (in) vec3 x))\n" " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in) sampler1D sampler)\n" - " (declare (in) vec4 P))\n" + " (declare (in) vec4 y)\n" + " (declare (in) vec4 x))\n" " ())\n" - " (signature ivec4\n" + " (signature float\n" " (parameters\n" - " (declare (in) isampler1D sampler)\n" - " (declare (in) vec4 P))\n" + " (declare (in) float y_over_x))\n" " ())\n" - " (signature uvec4\n" + " (signature vec2\n" " (parameters\n" - " (declare (in) usampler1D sampler)\n" - " (declare (in) vec4 P))\n" + " (declare (in) vec2 y_over_x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 y_over_x))\n" " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in) sampler2D sampler)\n" - " (declare (in) vec3 P))\n" + " (declare (in) vec4 y_over_x))\n" + " ()))\n" + "(function sinh\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x))\n" " ())\n" - " (signature ivec4\n" + " (signature vec2\n" " (parameters\n" - " (declare (in) isampler2D sampler)\n" - " (declare (in) vec3 P))\n" + " (declare (in) vec2 x))\n" " ())\n" - " (signature uvec4\n" + " (signature vec3\n" " (parameters\n" - " (declare (in) usampler2D sampler)\n" - " (declare (in) vec3 P))\n" + " (declare (in) vec3 x))\n" " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in) sampler2D sampler)\n" - " (declare (in) vec4 P))\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function cosh\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x))\n" " ())\n" - " (signature ivec4\n" + " (signature vec2\n" " (parameters\n" - " (declare (in) isampler2D sampler)\n" - " (declare (in) vec4 P))\n" + " (declare (in) vec2 x))\n" " ())\n" - " (signature uvec4\n" + " (signature vec3\n" " (parameters\n" - " (declare (in) usampler2D sampler)\n" - " (declare (in) vec4 P))\n" + " (declare (in) vec3 x))\n" " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in) sampler3D sampler)\n" - " (declare (in) vec4 P))\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function tanh\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x))\n" " ())\n" - " (signature ivec4\n" + " (signature vec2\n" " (parameters\n" - " (declare (in) isampler3D sampler)\n" - " (declare (in) vec4 P))\n" + " (declare (in) vec2 x))\n" " ())\n" - " (signature uvec4\n" + " (signature vec3\n" " (parameters\n" - " (declare (in) usampler3D sampler)\n" - " (declare (in) vec4 P))\n" + " (declare (in) vec3 x))\n" " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function pow\n" " (signature float\n" " (parameters\n" - " (declare (in) sampler1DShadow sampler)\n" - " (declare (in) vec4 P))\n" + " (declare (in) float x)\n" + " (declare (in) float y))\n" " ())\n" - " (signature float\n" + " (signature vec2\n" " (parameters\n" - " (declare (in) sampler2DShadow sampler)\n" - " (declare (in) vec4 P))\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" " ())\n" - " (signature vec4\n" + " (signature vec3\n" " (parameters\n" - " (declare (in) sampler1D sampler)\n" - " (declare (in) vec2 P)\n" - " (declare (in) float bias))\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" " ())\n" - " (signature ivec4\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) isampler1D sampler)\n" - " (declare (in) vec2 P)\n" - " (declare (in) float bias))\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" + " ()))\n" + "(function exp\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x))\n" " ())\n" - " (signature uvec4\n" + " (signature vec2\n" " (parameters\n" - " (declare (in) usampler1D sampler)\n" - " (declare (in) vec2 P)\n" - " (declare (in) float bias))\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x))\n" " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in) sampler1D sampler)\n" - " (declare (in) vec4 P)\n" - " (declare (in) float bias))\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function log\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x))\n" " ())\n" - " (signature ivec4\n" + " (signature vec2\n" " (parameters\n" - " (declare (in) isampler1D sampler)\n" - " (declare (in) vec4 P)\n" - " (declare (in) float bias))\n" + " (declare (in) vec2 x))\n" " ())\n" - " (signature uvec4\n" + " (signature vec3\n" " (parameters\n" - " (declare (in) usampler1D sampler)\n" - " (declare (in) vec4 P)\n" - " (declare (in) float bias))\n" + " (declare (in) vec3 x))\n" " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in) sampler2D sampler)\n" - " (declare (in) vec3 P)\n" - " (declare (in) float bias))\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function exp2\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x))\n" " ())\n" - " (signature ivec4\n" + " (signature vec2\n" " (parameters\n" - " (declare (in) isampler2D sampler)\n" - " (declare (in) vec3 P)\n" - " (declare (in) float bias))\n" + " (declare (in) vec2 x))\n" " ())\n" - " (signature uvec4\n" + " (signature vec3\n" " (parameters\n" - " (declare (in) usampler2D sampler)\n" - " (declare (in) vec3 P)\n" - " (declare (in) float bias))\n" + " (declare (in) vec3 x))\n" " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in) sampler2D sampler)\n" - " (declare (in) vec4 P)\n" - " (declare (in) float bias))\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function log2\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x))\n" " ())\n" - " (signature ivec4\n" + " (signature vec2\n" " (parameters\n" - " (declare (in) isampler2D sampler)\n" - " (declare (in) vec4 P)\n" - " (declare (in) float bias))\n" + " (declare (in) vec2 x))\n" " ())\n" - " (signature uvec4\n" + " (signature vec3\n" " (parameters\n" - " (declare (in) usampler2D sampler)\n" - " (declare (in) vec4 P)\n" - " (declare (in) float bias))\n" + " (declare (in) vec3 x))\n" " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in) sampler3D sampler)\n" - " (declare (in) vec4 P)\n" - " (declare (in) float bias))\n" - " ())\n" - " (signature ivec4\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function sqrt\n" + " (signature float\n" " (parameters\n" - " (declare (in) isampler3D sampler)\n" - " (declare (in) vec4 P)\n" - " (declare (in) float bias))\n" + " (declare (in) float x))\n" " ())\n" - " (signature uvec4\n" + " (signature vec2\n" " (parameters\n" - " (declare (in) usampler3D sampler)\n" - " (declare (in) vec4 P)\n" - " (declare (in) float bias))\n" + " (declare (in) vec2 x))\n" " ())\n" - " (signature float\n" + " (signature vec3\n" " (parameters\n" - " (declare (in) sampler1DShadow sampler)\n" - " (declare (in) vec4 P)\n" - " (declare (in) float bias))\n" + " (declare (in) vec3 x))\n" " ())\n" - " (signature float\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) sampler2DShadow sampler)\n" - " (declare (in) vec4 P)\n" - " (declare (in) float bias))\n" + " (declare (in) vec4 x))\n" " ()))\n" - "(function textureLod\n" - " (signature vec4\n" + "(function inversesqrt\n" + " (signature float\n" " (parameters\n" - " (declare (in) sampler1D sampler)\n" - " (declare (in) float P)\n" - " (declare (in) float lod))\n" + " (declare (in) float x))\n" " ())\n" - " (signature ivec4\n" + " (signature vec2\n" " (parameters\n" - " (declare (in) isampler1D sampler)\n" - " (declare (in) float P)\n" - " (declare (in) float lod))\n" + " (declare (in) vec2 x))\n" " ())\n" - " (signature uvec4\n" + " (signature vec3\n" " (parameters\n" - " (declare (in) usampler1D sampler)\n" - " (declare (in) float P)\n" - " (declare (in) float lod))\n" + " (declare (in) vec3 x))\n" " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in) sampler2D sampler)\n" - " (declare (in) vec2 P)\n" - " (declare (in) float lod))\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function abs\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x))\n" " ())\n" - " (signature ivec4\n" + " (signature vec2\n" " (parameters\n" - " (declare (in) isampler2D sampler)\n" - " (declare (in) vec2 P)\n" - " (declare (in) float lod))\n" + " (declare (in) vec2 x))\n" " ())\n" - " (signature uvec4\n" + " (signature vec3\n" " (parameters\n" - " (declare (in) usampler2D sampler)\n" - " (declare (in) vec2 P)\n" - " (declare (in) float lod))\n" + " (declare (in) vec3 x))\n" " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in) sampler3D sampler)\n" - " (declare (in) vec3 P)\n" - " (declare (in) float lod))\n" + " (declare (in) vec4 x))\n" " ())\n" - " (signature ivec4\n" + " (signature int\n" " (parameters\n" - " (declare (in) isampler3D sampler)\n" - " (declare (in) vec3 P)\n" - " (declare (in) float lod))\n" + " (declare (in) int x))\n" " ())\n" - " (signature uvec4\n" + " (signature ivec2\n" " (parameters\n" - " (declare (in) usampler3D sampler)\n" - " (declare (in) vec3 P)\n" - " (declare (in) float lod))\n" + " (declare (in) ivec2 x))\n" " ())\n" - " (signature vec4\n" + " (signature ivec3\n" " (parameters\n" - " (declare (in) samplerCube sampler)\n" - " (declare (in) vec3 P)\n" - " (declare (in) float lod))\n" + " (declare (in) ivec3 x))\n" " ())\n" " (signature ivec4\n" " (parameters\n" - " (declare (in) isamplerCube sampler)\n" - " (declare (in) vec3 P)\n" - " (declare (in) float lod))\n" - " ())\n" - " (signature uvec4\n" + " (declare (in) ivec4 x))\n" + " ()))\n" + "(function sign\n" + " (signature float\n" " (parameters\n" - " (declare (in) usamplerCube sampler)\n" - " (declare (in) vec3 P)\n" - " (declare (in) float lod))\n" + " (declare (in) float x))\n" " ())\n" - " (signature float\n" + " (signature vec2\n" " (parameters\n" - " (declare (in) sampler1DShadow sampler)\n" - " (declare (in) vec3 P)\n" - " (declare (in) float lod))\n" + " (declare (in) vec2 x))\n" " ())\n" - " (signature float\n" + " (signature vec3\n" " (parameters\n" - " (declare (in) sampler2DShadow sampler)\n" - " (declare (in) vec3 P)\n" - " (declare (in) float lod))\n" + " (declare (in) vec3 x))\n" " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in) sampler1DArray sampler)\n" - " (declare (in) vec2 P)\n" - " (declare (in) float lod))\n" + " (declare (in) vec4 x))\n" " ())\n" - " (signature ivec4\n" + " (signature int\n" " (parameters\n" - " (declare (in) isampler1DArray sampler)\n" - " (declare (in) vec2 P)\n" - " (declare (in) float lod))\n" + " (declare (in) int x))\n" " ())\n" - " (signature uvec4\n" + " (signature ivec2\n" " (parameters\n" - " (declare (in) usampler1DArray sampler)\n" - " (declare (in) vec2 P)\n" - " (declare (in) float lod))\n" + " (declare (in) ivec2 x))\n" " ())\n" - " (signature vec4\n" + " (signature ivec3\n" " (parameters\n" - " (declare (in) sampler2DArray sampler)\n" - " (declare (in) vec3 P)\n" - " (declare (in) float lod))\n" + " (declare (in) ivec3 x))\n" " ())\n" " (signature ivec4\n" " (parameters\n" - " (declare (in) isampler2DArray sampler)\n" - " (declare (in) vec3 P)\n" - " (declare (in) float lod))\n" + " (declare (in) ivec4 x))\n" + " ()))\n" + "(function floor\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x))\n" " ())\n" - " (signature uvec4\n" + " (signature vec2\n" " (parameters\n" - " (declare (in) usampler2DArray sampler)\n" - " (declare (in) vec3 P)\n" - " (declare (in) float lod))\n" + " (declare (in) vec2 x))\n" " ())\n" - " (signature float\n" + " (signature vec3\n" " (parameters\n" - " (declare (in) sampler1DArrayShadow sampler)\n" - " (declare (in) vec3 P)\n" - " (declare (in) float lod))\n" - " ()))\n" - "(function texelFetch\n" + " (declare (in) vec3 x))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in) sampler1D sampler)\n" - " (declare (in) int P)\n" - " (declare (in) int lod))\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function ceil\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x))\n" " ())\n" - " (signature ivec4\n" + " (signature vec2\n" " (parameters\n" - " (declare (in) isampler1D sampler)\n" - " (declare (in) int P)\n" - " (declare (in) int lod))\n" + " (declare (in) vec2 x))\n" " ())\n" - " (signature uvec4\n" + " (signature vec3\n" " (parameters\n" - " (declare (in) usampler1D sampler)\n" - " (declare (in) int P)\n" - " (declare (in) int lod))\n" + " (declare (in) vec3 x))\n" " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in) sampler2D sampler)\n" - " (declare (in) ivec2 P)\n" - " (declare (in) int lod))\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function fract\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x))\n" " ())\n" - " (signature ivec4\n" + " (signature vec2\n" " (parameters\n" - " (declare (in) isampler2D sampler)\n" - " (declare (in) ivec2 P)\n" - " (declare (in) int lod))\n" + " (declare (in) vec2 x))\n" " ())\n" - " (signature uvec4\n" + " (signature vec3\n" " (parameters\n" - " (declare (in) usampler2D sampler)\n" - " (declare (in) ivec2 P)\n" - " (declare (in) int lod))\n" + " (declare (in) vec3 x))\n" " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in) sampler3D sampler)\n" - " (declare (in) ivec3 P)\n" - " (declare (in) int lod))\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function mod\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x)\n" + " (declare (in) float y))\n" " ())\n" - " (signature ivec4\n" + " (signature vec2\n" " (parameters\n" - " (declare (in) isampler3D sampler)\n" - " (declare (in) ivec3 P)\n" - " (declare (in) int lod))\n" + " (declare (in) vec2 x)\n" + " (declare (in) float y))\n" " ())\n" - " (signature uvec4\n" + " (signature vec3\n" " (parameters\n" - " (declare (in) usampler3D sampler)\n" - " (declare (in) ivec3 P)\n" - " (declare (in) int lod))\n" + " (declare (in) vec3 x)\n" + " (declare (in) float y))\n" " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in) sampler1DArray sampler)\n" - " (declare (in) ivec2 P)\n" - " (declare (in) int lod))\n" + " (declare (in) vec4 x)\n" + " (declare (in) float y))\n" " ())\n" - " (signature ivec4\n" + " (signature vec2\n" " (parameters\n" - " (declare (in) isampler1DArray sampler)\n" - " (declare (in) ivec2 P)\n" - " (declare (in) int lod))\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" " ())\n" - " (signature uvec4\n" + " (signature vec3\n" " (parameters\n" - " (declare (in) usampler1DArray sampler)\n" - " (declare (in) ivec2 P)\n" - " (declare (in) int lod))\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in) sampler2DArray sampler)\n" - " (declare (in) ivec3 P)\n" - " (declare (in) int lod))\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" + " ()))\n" + "(function min\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x)\n" + " (declare (in) float y))\n" " ())\n" - " (signature ivec4\n" + " (signature vec2\n" " (parameters\n" - " (declare (in) isampler2DArray sampler)\n" - " (declare (in) ivec3 P)\n" - " (declare (in) int lod))\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" " ())\n" - " (signature uvec4\n" + " (signature vec3\n" " (parameters\n" - " (declare (in) usampler2DArray sampler)\n" - " (declare (in) ivec3 P)\n" - " (declare (in) int lod))\n" - " ()))\n" - "(function textureProjLod\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in) sampler1D sampler)\n" - " (declare (in) vec2 P)\n" - " (declare (in) float lod))\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" " ())\n" - " (signature ivec4\n" + " (signature vec2\n" " (parameters\n" - " (declare (in) isampler1D sampler)\n" - " (declare (in) vec2 P)\n" - " (declare (in) float lod))\n" + " (declare (in) vec2 x)\n" + " (declare (in) float y))\n" " ())\n" - " (signature uvec4\n" + " (signature vec3\n" " (parameters\n" - " (declare (in) usampler1D sampler)\n" - " (declare (in) vec2 P)\n" - " (declare (in) float lod))\n" + " (declare (in) vec3 x)\n" + " (declare (in) float y))\n" " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in) sampler1D sampler)\n" - " (declare (in) vec4 P)\n" - " (declare (in) float lod))\n" + " (declare (in) vec4 x)\n" + " (declare (in) float y))\n" " ())\n" - " (signature ivec4\n" + " (signature int\n" " (parameters\n" - " (declare (in) isampler1D sampler)\n" - " (declare (in) vec4 P)\n" - " (declare (in) float lod))\n" + " (declare (in) int x)\n" + " (declare (in) int y))\n" " ())\n" - " (signature uvec4\n" + " (signature ivec2\n" " (parameters\n" - " (declare (in) usampler1D sampler)\n" - " (declare (in) vec4 P)\n" - " (declare (in) float lod))\n" + " (declare (in) ivec2 x)\n" + " (declare (in) ivec2 y))\n" " ())\n" - " (signature vec4\n" + " (signature ivec3\n" " (parameters\n" - " (declare (in) sampler2D sampler)\n" - " (declare (in) vec3 P)\n" - " (declare (in) float lod))\n" + " (declare (in) ivec3 x)\n" + " (declare (in) ivec3 y))\n" " ())\n" " (signature ivec4\n" " (parameters\n" - " (declare (in) isampler2D sampler)\n" - " (declare (in) vec3 P)\n" - " (declare (in) float lod))\n" + " (declare (in) ivec4 x)\n" + " (declare (in) ivec4 y))\n" " ())\n" - " (signature uvec4\n" + " (signature ivec2\n" " (parameters\n" - " (declare (in) usampler2D sampler)\n" - " (declare (in) vec3 P)\n" - " (declare (in) float lod))\n" + " (declare (in) ivec2 x)\n" + " (declare (in) int y))\n" " ())\n" - " (signature vec4\n" + " (signature ivec3\n" " (parameters\n" - " (declare (in) sampler2D sampler)\n" - " (declare (in) vec4 P)\n" - " (declare (in) float lod))\n" + " (declare (in) ivec3 x)\n" + " (declare (in) int y))\n" " ())\n" " (signature ivec4\n" " (parameters\n" - " (declare (in) isampler2D sampler)\n" - " (declare (in) vec4 P)\n" - " (declare (in) float lod))\n" + " (declare (in) ivec4 x)\n" + " (declare (in) int y))\n" " ())\n" - " (signature uvec4\n" + " (signature uint\n" " (parameters\n" - " (declare (in) usampler2D sampler)\n" - " (declare (in) vec4 P)\n" - " (declare (in) float lod))\n" + " (declare (in) uint x)\n" + " (declare (in) uint y))\n" " ())\n" - " (signature vec4\n" + " (signature uvec2\n" " (parameters\n" - " (declare (in) sampler3D sampler)\n" - " (declare (in) vec4 P)\n" - " (declare (in) float lod))\n" + " (declare (in) uvec2 x)\n" + " (declare (in) uvec2 y))\n" " ())\n" - " (signature ivec4\n" + " (signature uvec3\n" " (parameters\n" - " (declare (in) isampler3D sampler)\n" - " (declare (in) vec4 P)\n" - " (declare (in) float lod))\n" + " (declare (in) uvec3 x)\n" + " (declare (in) uvec3 y))\n" " ())\n" " (signature uvec4\n" " (parameters\n" - " (declare (in) usampler3D sampler)\n" - " (declare (in) vec4 P)\n" - " (declare (in) float lod))\n" + " (declare (in) uvec4 x)\n" + " (declare (in) uvec4 y))\n" " ())\n" - " (signature float\n" + " (signature uvec2\n" " (parameters\n" - " (declare (in) sampler1DShadow sampler)\n" - " (declare (in) vec4 P)\n" - " (declare (in) float lod))\n" + " (declare (in) uvec2 x)\n" + " (declare (in) uint y))\n" " ())\n" - " (signature float\n" + " (signature uvec3\n" " (parameters\n" - " (declare (in) sampler2DShadow sampler)\n" - " (declare (in) vec4 P)\n" - " (declare (in) float lod))\n" + " (declare (in) uvec3 x)\n" + " (declare (in) uint y))\n" + " ())\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) uvec4 x)\n" + " (declare (in) uint y))\n" " ()))\n" - "(function textureGrad\n" - " (signature vec4\n" + "(function max\n" + " (signature float\n" " (parameters\n" - " (declare (in) sampler1D sampler)\n" - " (declare (in) float P)\n" - " (declare (in) float dPdx)\n" - " (declare (in) float dPdy))\n" + " (declare (in) float x)\n" + " (declare (in) float y))\n" " ())\n" - " (signature ivec4\n" + " (signature vec2\n" " (parameters\n" - " (declare (in) isampler1D sampler)\n" - " (declare (in) float P)\n" - " (declare (in) float dPdx)\n" - " (declare (in) float dPdy))\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" " ())\n" - " (signature uvec4\n" + " (signature vec3\n" " (parameters\n" - " (declare (in) usampler1D sampler)\n" - " (declare (in) float P)\n" - " (declare (in) float dPdx)\n" - " (declare (in) float dPdy))\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\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" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\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" + " (declare (in) vec2 x)\n" + " (declare (in) float y))\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" + " (declare (in) vec3 x)\n" + " (declare (in) float y))\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" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x)\n" + " (declare (in) float y))\n" " ())\n" - " (signature ivec4\n" + " (signature int\n" " (parameters\n" - " (declare (in) isampler3D sampler)\n" - " (declare (in) vec3 P)\n" - " (declare (in) vec3 dPdx)\n" - " (declare (in) vec3 dPdy))\n" + " (declare (in) int x)\n" + " (declare (in) int y))\n" " ())\n" - " (signature uvec4\n" + " (signature ivec2\n" " (parameters\n" - " (declare (in) usampler3D sampler)\n" - " (declare (in) vec3 P)\n" - " (declare (in) vec3 dPdx)\n" - " (declare (in) vec3 dPdy))\n" + " (declare (in) ivec2 x)\n" + " (declare (in) ivec2 y))\n" " ())\n" - " (signature vec4\n" + " (signature ivec3\n" " (parameters\n" - " (declare (in) samplerCube sampler)\n" - " (declare (in) vec3 P)\n" - " (declare (in) vec3 dPdx)\n" - " (declare (in) vec3 dPdy))\n" + " (declare (in) ivec3 x)\n" + " (declare (in) ivec3 y))\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" + " (declare (in) ivec4 x)\n" + " (declare (in) ivec4 y))\n" " ())\n" - " (signature uvec4\n" + " (signature ivec2\n" " (parameters\n" - " (declare (in) usamplerCube sampler)\n" - " (declare (in) vec3 P)\n" - " (declare (in) vec3 dPdx)\n" - " (declare (in) vec3 dPdy))\n" + " (declare (in) ivec2 x)\n" + " (declare (in) int y))\n" " ())\n" - " (signature float\n" + " (signature ivec3\n" " (parameters\n" - " (declare (in) sampler1DShadow sampler)\n" - " (declare (in) vec3 P)\n" - " (declare (in) float dPdx)\n" - " (declare (in) float dPdy))\n" + " (declare (in) ivec3 x)\n" + " (declare (in) int y))\n" " ())\n" - " (signature float\n" + " (signature ivec4\n" " (parameters\n" - " (declare (in) sampler2DShadow sampler)\n" - " (declare (in) vec3 P)\n" - " (declare (in) vec2 dPdx)\n" - " (declare (in) vec2 dPdy))\n" + " (declare (in) ivec4 x)\n" + " (declare (in) int y))\n" " ())\n" - " (signature float\n" + " (signature uint\n" " (parameters\n" - " (declare (in) samplerCubeShadow sampler)\n" - " (declare (in) vec4 P)\n" - " (declare (in) vec3 dPdx)\n" - " (declare (in) vec3 dPdy))\n" + " (declare (in) uint x)\n" + " (declare (in) uint y))\n" " ())\n" - " (signature vec4\n" + " (signature uvec2\n" " (parameters\n" - " (declare (in) sampler1DArray sampler)\n" - " (declare (in) vec2 P)\n" - " (declare (in) float dPdx)\n" - " (declare (in) float dPdy))\n" + " (declare (in) uvec2 x)\n" + " (declare (in) uvec2 y))\n" " ())\n" - " (signature ivec4\n" + " (signature uvec3\n" " (parameters\n" - " (declare (in) isampler1DArray sampler)\n" - " (declare (in) vec2 P)\n" - " (declare (in) float dPdx)\n" - " (declare (in) float dPdy))\n" + " (declare (in) uvec3 x)\n" + " (declare (in) uvec3 y))\n" " ())\n" " (signature uvec4\n" " (parameters\n" - " (declare (in) usampler1DArray sampler)\n" - " (declare (in) vec2 P)\n" - " (declare (in) float dPdx)\n" - " (declare (in) float dPdy))\n" + " (declare (in) uvec4 x)\n" + " (declare (in) uvec4 y))\n" " ())\n" - " (signature vec4\n" + " (signature uvec2\n" " (parameters\n" - " (declare (in) sampler2DArray sampler)\n" - " (declare (in) vec3 P)\n" - " (declare (in) vec2 dPdx)\n" - " (declare (in) vec2 dPdy))\n" + " (declare (in) uvec2 x)\n" + " (declare (in) uint y))\n" " ())\n" - " (signature ivec4\n" + " (signature uvec3\n" " (parameters\n" - " (declare (in) isampler2DArray sampler)\n" - " (declare (in) vec3 P)\n" - " (declare (in) vec2 dPdx)\n" - " (declare (in) vec2 dPdy))\n" + " (declare (in) uvec3 x)\n" + " (declare (in) uint y))\n" " ())\n" " (signature uvec4\n" " (parameters\n" - " (declare (in) usampler2DArray sampler)\n" - " (declare (in) vec3 P)\n" - " (declare (in) vec2 dPdx)\n" - " (declare (in) vec2 dPdy))\n" - " ())\n" + " (declare (in) uvec4 x)\n" + " (declare (in) uint y))\n" + " ()))\n" + "(function clamp\n" " (signature float\n" " (parameters\n" - " (declare (in) sampler1DArrayShadow sampler)\n" - " (declare (in) vec3 P)\n" - " (declare (in) float dPdx)\n" - " (declare (in) float dPdy))\n" + " (declare (in) float x)\n" + " (declare (in) float minVal)\n" + " (declare (in) float maxVal))\n" " ())\n" - " (signature float\n" + " (signature vec2\n" " (parameters\n" - " (declare (in) sampler2DArrayShadow sampler)\n" - " (declare (in) vec4 P)\n" - " (declare (in) vec2 dPdx)\n" - " (declare (in) vec2 dPdy))\n" - " ()))\n" - "(function textureProjGrad\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 minVal)\n" + " (declare (in) vec2 maxVal))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 minVal)\n" + " (declare (in) vec3 maxVal))\n" + " ())\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" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 minVal)\n" + " (declare (in) vec4 maxVal))\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" + " (declare (in) vec2 x)\n" + " (declare (in) float minVal)\n" + " (declare (in) float maxVal))\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" + " (declare (in) vec3 x)\n" + " (declare (in) float minVal)\n" + " (declare (in) float maxVal))\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" + " (declare (in) vec4 x)\n" + " (declare (in) float minVal)\n" + " (declare (in) float maxVal))\n" " ())\n" - " (signature ivec4\n" + " (signature int\n" " (parameters\n" - " (declare (in) isampler1D sampler)\n" - " (declare (in) vec4 P)\n" - " (declare (in) float dPdx)\n" - " (declare (in) float dPdy))\n" + " (declare (in) int x)\n" + " (declare (in) int minVal)\n" + " (declare (in) int maxVal))\n" " ())\n" - " (signature uvec4\n" + " (signature ivec2\n" " (parameters\n" - " (declare (in) usampler1D sampler)\n" - " (declare (in) vec4 P)\n" - " (declare (in) float dPdx)\n" - " (declare (in) float dPdy))\n" + " (declare (in) ivec2 x)\n" + " (declare (in) ivec2 minVal)\n" + " (declare (in) ivec2 maxVal))\n" " ())\n" - " (signature vec4\n" + " (signature ivec3\n" " (parameters\n" - " (declare (in) sampler2D sampler)\n" - " (declare (in) vec3 P)\n" - " (declare (in) vec2 dPdx)\n" - " (declare (in) vec2 dPdy))\n" + " (declare (in) ivec3 x)\n" + " (declare (in) ivec3 minVal)\n" + " (declare (in) ivec3 maxVal))\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" + " (declare (in) ivec4 x)\n" + " (declare (in) ivec4 minVal)\n" + " (declare (in) ivec4 maxVal))\n" " ())\n" - " (signature uvec4\n" + " (signature ivec2\n" " (parameters\n" - " (declare (in) usampler2D sampler)\n" - " (declare (in) vec3 P)\n" - " (declare (in) vec2 dPdx)\n" - " (declare (in) vec2 dPdy))\n" + " (declare (in) ivec2 x)\n" + " (declare (in) int minVal)\n" + " (declare (in) int maxVal))\n" " ())\n" - " (signature vec4\n" + " (signature ivec3\n" " (parameters\n" - " (declare (in) sampler2D sampler)\n" - " (declare (in) vec4 P)\n" - " (declare (in) vec2 dPdx)\n" - " (declare (in) vec2 dPdy))\n" + " (declare (in) ivec3 x)\n" + " (declare (in) int minVal)\n" + " (declare (in) int maxVal))\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" + " (declare (in) ivec4 x)\n" + " (declare (in) int minVal)\n" + " (declare (in) int maxVal))\n" " ())\n" - " (signature uvec4\n" + " (signature uint\n" " (parameters\n" - " (declare (in) usampler2D sampler)\n" - " (declare (in) vec4 P)\n" - " (declare (in) vec2 dPdx)\n" - " (declare (in) vec2 dPdy))\n" + " (declare (in) uint x)\n" + " (declare (in) uint minVal)\n" + " (declare (in) uint maxVal))\n" " ())\n" - " (signature vec4\n" + " (signature uvec2\n" " (parameters\n" - " (declare (in) sampler3D sampler)\n" - " (declare (in) vec4 P)\n" - " (declare (in) vec3 dPdx)\n" - " (declare (in) vec3 dPdy))\n" + " (declare (in) uvec2 x)\n" + " (declare (in) uvec2 minVal)\n" + " (declare (in) uvec2 maxVal))\n" " ())\n" - " (signature ivec4\n" + " (signature uvec3\n" " (parameters\n" - " (declare (in) isampler3D sampler)\n" - " (declare (in) vec4 P)\n" - " (declare (in) vec3 dPdx)\n" - " (declare (in) vec3 dPdy))\n" + " (declare (in) uvec3 x)\n" + " (declare (in) uvec3 minVal)\n" + " (declare (in) uvec3 maxVal))\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" + " (declare (in) uvec4 x)\n" + " (declare (in) uvec4 minVal)\n" + " (declare (in) uvec4 maxVal))\n" " ())\n" - " (signature float\n" + " (signature uvec2\n" " (parameters\n" - " (declare (in) sampler1DShadow sampler)\n" - " (declare (in) vec4 P)\n" - " (declare (in) float dPdx)\n" - " (declare (in) float dPdy))\n" + " (declare (in) uvec2 x)\n" + " (declare (in) uint minVal)\n" + " (declare (in) uint maxVal))\n" " ())\n" - " (signature float\n" - " (parameters\n" - " (declare (in) sampler2DShadow sampler)\n" - " (declare (in) vec4 P)\n" - " (declare (in) vec2 dPdx)\n" - " (declare (in) vec2 dPdy))\n" - " ()))\n" - "(function texture1D\n" - " (signature vec4\n" + " (signature uvec3\n" " (parameters\n" - " (declare (in) sampler1D sampler)\n" - " (declare (in) float coord))\n" + " (declare (in) uvec3 x)\n" + " (declare (in) uint minVal)\n" + " (declare (in) uint maxVal))\n" " ())\n" - " (signature vec4\n" + " (signature uvec4\n" " (parameters\n" - " (declare (in) sampler1D sampler)\n" - " (declare (in) float coord)\n" - " (declare (in) float bias))\n" + " (declare (in) uvec4 x)\n" + " (declare (in) uint minVal)\n" + " (declare (in) uint maxVal))\n" " ()))\n" - "(function texture1DProj\n" - " (signature vec4\n" + "(function mix\n" + " (signature float\n" " (parameters\n" - " (declare (in) sampler1D sampler)\n" - " (declare (in) vec2 coord))\n" + " (declare (in) float x)\n" + " (declare (in) float y)\n" + " (declare (in) float a))\n" " ())\n" - " (signature vec4\n" + " (signature vec2\n" " (parameters\n" - " (declare (in) sampler1D sampler)\n" - " (declare (in) vec4 coord))\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y)\n" + " (declare (in) vec2 a))\n" " ())\n" - " (signature vec4\n" + " (signature vec3\n" " (parameters\n" - " (declare (in) sampler1D sampler)\n" - " (declare (in) vec2 coord)\n" - " (declare (in) float bias))\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y)\n" + " (declare (in) vec3 a))\n" " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in) sampler1D sampler)\n" - " (declare (in) vec4 coord)\n" - " (declare (in) float bias))\n" - " ()))\n" - "(function texture1DLod\n" - " (signature vec4\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y)\n" + " (declare (in) vec4 a))\n" + " ())\n" + " (signature vec2\n" " (parameters\n" - " (declare (in) sampler1D sampler)\n" - " (declare (in) float coord)\n" - " (declare (in) float lod))\n" - " ()))\n" - "(function texture1DProjLod\n" - " (signature vec4\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y)\n" + " (declare (in) float a))\n" + " ())\n" + " (signature vec3\n" " (parameters\n" - " (declare (in) sampler1D sampler)\n" - " (declare (in) vec2 coord)\n" - " (declare (in) float lod))\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y)\n" + " (declare (in) float a))\n" " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in) sampler1D sampler)\n" - " (declare (in) vec4 coord)\n" - " (declare (in) float lod))\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y)\n" + " (declare (in) float a))\n" " ()))\n" - "(function texture2D\n" - " (signature vec4\n" + "(function step\n" + " (signature float\n" " (parameters\n" - " (declare (in) sampler2D sampler)\n" - " (declare (in) vec2 coord))\n" + " (declare (in) float edge)\n" + " (declare (in) float x))\n" " ())\n" - " (signature vec4\n" + " (signature vec2\n" " (parameters\n" - " (declare (in) sampler2D sampler)\n" - " (declare (in) vec2 coord)\n" - " (declare (in) float bias))\n" - " ()))\n" - "(function texture2DProj\n" - " (signature vec4\n" + " (declare (in) vec2 edge)\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature vec3\n" " (parameters\n" - " (declare (in) sampler2D sampler)\n" - " (declare (in) vec3 coord))\n" + " (declare (in) vec3 edge)\n" + " (declare (in) vec3 x))\n" " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in) sampler2D sampler)\n" - " (declare (in) vec4 coord))\n" + " (declare (in) vec4 edge)\n" + " (declare (in) vec4 x))\n" " ())\n" - " (signature vec4\n" + " (signature vec2\n" " (parameters\n" - " (declare (in) sampler2D sampler)\n" - " (declare (in) vec3 coord)\n" - " (declare (in) float bias))\n" + " (declare (in) float edge)\n" + " (declare (in) vec2 x))\n" " ())\n" - " (signature vec4\n" + " (signature vec3\n" " (parameters\n" - " (declare (in) sampler2D sampler)\n" - " (declare (in) vec4 coord)\n" - " (declare (in) float bias))\n" - " ()))\n" - "(function texture2DLod\n" + " (declare (in) float edge)\n" + " (declare (in) vec3 x))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in) sampler2D sampler)\n" - " (declare (in) vec2 coord)\n" - " (declare (in) float lod))\n" + " (declare (in) float edge)\n" + " (declare (in) vec4 x))\n" " ()))\n" - "(function texture2DProjLod\n" - " (signature vec4\n" + "(function smoothstep\n" + " (signature float\n" " (parameters\n" - " (declare (in) sampler2D sampler)\n" - " (declare (in) vec3 coord)\n" - " (declare (in) float lod))\n" + " (declare (in) float edge0)\n" + " (declare (in) float edge1)\n" + " (declare (in) float x))\n" " ())\n" - " (signature vec4\n" + " (signature vec2\n" " (parameters\n" - " (declare (in) sampler2D sampler)\n" - " (declare (in) vec4 coord)\n" - " (declare (in) float lod))\n" - " ()))\n" - "(function texture3D\n" - " (signature vec4\n" + " (declare (in) vec2 edge0)\n" + " (declare (in) vec2 edge1)\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature vec3\n" " (parameters\n" - " (declare (in) sampler3D sampler)\n" - " (declare (in) vec3 coord))\n" + " (declare (in) vec3 edge0)\n" + " (declare (in) vec3 edge1)\n" + " (declare (in) vec3 x))\n" " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in) sampler3D sampler)\n" - " (declare (in) vec3 coord)\n" - " (declare (in) float bias))\n" - " ()))\n" - "(function texture3DProj\n" - " (signature vec4\n" + " (declare (in) vec4 edge0)\n" + " (declare (in) vec4 edge1)\n" + " (declare (in) vec4 x))\n" + " ())\n" + " (signature vec2\n" " (parameters\n" - " (declare (in) sampler3D sampler)\n" - " (declare (in) vec4 coord))\n" + " (declare (in) float edge0)\n" + " (declare (in) float edge1)\n" + " (declare (in) vec2 x))\n" " ())\n" - " (signature vec4\n" + " (signature vec3\n" " (parameters\n" - " (declare (in) sampler3D sampler)\n" - " (declare (in) vec4 coord)\n" - " (declare (in) float bias))\n" - " ()))\n" - "(function texture3DLod\n" + " (declare (in) float edge0)\n" + " (declare (in) float edge1)\n" + " (declare (in) vec3 x))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in) sampler3D sampler)\n" - " (declare (in) vec3 coord)\n" - " (declare (in) float lod))\n" + " (declare (in) float edge0)\n" + " (declare (in) float edge1)\n" + " (declare (in) vec4 x))\n" " ()))\n" - "(function texture3DProjLod\n" - " (signature vec4\n" + "(function length\n" + " (signature float\n" " (parameters\n" - " (declare (in) sampler3D sampler)\n" - " (declare (in) vec4 coord)\n" - " (declare (in) float lod))\n" - " ()))\n" - "(function textureCube\n" - " (signature vec4\n" + " (declare (in) float x))\n" + " ())\n" + " (signature float\n" " (parameters\n" - " (declare (in) samplerCube sampler)\n" - " (declare (in) vec3 coord))\n" + " (declare (in) vec2 x))\n" " ())\n" - " (signature vec4\n" + " (signature float\n" " (parameters\n" - " (declare (in) samplerCube sampler)\n" - " (declare (in) vec3 coord)\n" - " (declare (in) float bias))\n" - " ()))\n" - "(function textureCubeLod\n" - " (signature vec4\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature float\n" " (parameters\n" - " (declare (in) samplerCube sampler)\n" - " (declare (in) vec3 coord)\n" - " (declare (in) float lod))\n" + " (declare (in) vec4 x))\n" " ()))\n" - "(function shadow1D\n" - " (signature vec4\n" + "(function distance\n" + " (signature float\n" " (parameters\n" - " (declare (in) sampler1DShadow sampler)\n" - " (declare (in) vec3 coord))\n" + " (declare (in) float p0)\n" + " (declare (in) float p1))\n" " ())\n" - " (signature vec4\n" - " (parameters\n" - " (declare (in) sampler1DShadow sampler)\n" - " (declare (in) vec3 coord)\n" - " (declare (in) float bias))\n" - " ()))\n" - "(function shadow2D\n" - " (signature vec4\n" + " (signature float\n" " (parameters\n" - " (declare (in) sampler2DShadow sampler)\n" - " (declare (in) vec3 coord))\n" + " (declare (in) vec2 p0)\n" + " (declare (in) vec2 p1))\n" " ())\n" - " (signature vec4\n" + " (signature float\n" " (parameters\n" - " (declare (in) sampler2DShadow sampler)\n" - " (declare (in) vec3 coord)\n" - " (declare (in) float bias))\n" + " (declare (in) vec3 p0)\n" + " (declare (in) vec3 p1))\n" + " ())\n" + " (signature float\n" + " (parameters\n" + " (declare (in) vec4 p0)\n" + " (declare (in) vec4 p1))\n" " ()))\n" - "(function shadow1DProj\n" - " (signature vec4\n" + "(function dot\n" + " (signature float\n" " (parameters\n" - " (declare (in) sampler1DShadow sampler)\n" - " (declare (in) vec4 coord))\n" + " (declare (in) float x)\n" + " (declare (in) float y))\n" " ())\n" - " (signature vec4\n" + " (signature float\n" " (parameters\n" - " (declare (in) sampler1DShadow sampler)\n" - " (declare (in) vec4 coord)\n" - " (declare (in) float bias))\n" - " ()))\n" - "(function shadow2DProj\n" - " (signature vec4\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" + " ())\n" + " (signature float\n" " (parameters\n" - " (declare (in) sampler2DShadow sampler)\n" - " (declare (in) vec4 coord))\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" " ())\n" - " (signature vec4\n" + " (signature float\n" " (parameters\n" - " (declare (in) sampler2DShadow sampler)\n" - " (declare (in) vec4 coord)\n" - " (declare (in) float bias))\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" " ()))\n" - "(function shadow1DLod\n" - " (signature vec4\n" + "(function cross\n" + " (signature vec3\n" " (parameters\n" - " (declare (in) sampler1DShadow sampler)\n" - " (declare (in) vec3 coord)\n" - " (declare (in) float lod))\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" " ()))\n" - "(function shadow2DLod\n" - " (signature vec4\n" + "(function normalize\n" + " (signature float\n" " (parameters\n" - " (declare (in) sampler2DShadow sampler)\n" - " (declare (in) vec3 coord)\n" - " (declare (in) float lod))\n" - " ()))\n" - "(function shadow1DProjLod\n" - " (signature vec4\n" + " (declare (in) float x))\n" + " ())\n" + " (signature vec2\n" " (parameters\n" - " (declare (in) sampler1DShadow sampler)\n" - " (declare (in) vec4 coord)\n" - " (declare (in) float lod))\n" - " ()))\n" - "(function shadow2DProjLod\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in) sampler2DShadow sampler)\n" - " (declare (in) vec4 coord)\n" - " (declare (in) float lod))\n" + " (declare (in) vec4 x))\n" " ()))\n" - "(function dFdx\n" + "(function faceforward\n" " (signature float\n" " (parameters\n" - " (declare (in) float p))\n" + " (declare (in) float N)\n" + " (declare (in) float I)\n" + " (declare (in) float Nref))\n" " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in) vec2 p))\n" + " (declare (in) vec2 N)\n" + " (declare (in) vec2 I)\n" + " (declare (in) vec2 Nref))\n" " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in) vec3 p))\n" + " (declare (in) vec3 N)\n" + " (declare (in) vec3 I)\n" + " (declare (in) vec3 Nref))\n" " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in) vec4 p))\n" + " (declare (in) vec4 N)\n" + " (declare (in) vec4 I)\n" + " (declare (in) vec4 Nref))\n" " ()))\n" - "(function dFdy\n" + "(function reflect\n" " (signature float\n" " (parameters\n" - " (declare (in) float p))\n" + " (declare (in) float I)\n" + " (declare (in) float N))\n" " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in) vec2 p))\n" + " (declare (in) vec2 I)\n" + " (declare (in) vec2 N))\n" " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in) vec3 p))\n" + " (declare (in) vec3 I)\n" + " (declare (in) vec3 N))\n" " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in) vec4 p))\n" + " (declare (in) vec4 I)\n" + " (declare (in) vec4 N))\n" " ()))\n" - "(function fwidth\n" + "(function refract\n" " (signature float\n" " (parameters\n" - " (declare (in) float p))\n" + " (declare (in) float I)\n" + " (declare (in) float N)\n" + " (declare (in) float eta))\n" " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in) vec2 p))\n" + " (declare (in) vec2 I)\n" + " (declare (in) vec2 N)\n" + " (declare (in) float eta))\n" " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in) vec3 p))\n" + " (declare (in) vec3 I)\n" + " (declare (in) vec3 N)\n" + " (declare (in) float eta))\n" " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in) vec4 p))\n" + " (declare (in) vec4 I)\n" + " (declare (in) vec4 N)\n" + " (declare (in) float eta))\n" " ()))\n" - "(function noise1\n" - " (signature float\n" + "(function matrixCompMult\n" + " (signature mat2\n" " (parameters\n" - " (declare (in) float x))\n" + " (declare (in) mat2 x)\n" + " (declare (in) mat2 y))\n" " ())\n" - " (signature float\n" + " (signature mat3\n" " (parameters\n" - " (declare (in) vec2 x))\n" + " (declare (in) mat3 x)\n" + " (declare (in) mat3 y))\n" " ())\n" - " (signature float\n" + " (signature mat4\n" " (parameters\n" - " (declare (in) vec3 x))\n" + " (declare (in) mat4 x)\n" + " (declare (in) mat4 y))\n" " ())\n" - " (signature float\n" + " (signature mat2x3\n" " (parameters\n" - " (declare (in) vec4 x))\n" + " (declare (in) mat2x3 x)\n" + " (declare (in) mat2x3 y))\n" + " ())\n" + " (signature mat2x4\n" + " (parameters\n" + " (declare (in) mat2x4 x)\n" + " (declare (in) mat2x4 y))\n" + " ())\n" + " (signature mat3x2\n" + " (parameters\n" + " (declare (in) mat3x2 x)\n" + " (declare (in) mat3x2 y))\n" + " ())\n" + " (signature mat3x4\n" + " (parameters\n" + " (declare (in) mat3x4 x)\n" + " (declare (in) mat3x4 y))\n" + " ())\n" + " (signature mat4x2\n" + " (parameters\n" + " (declare (in) mat4x2 x)\n" + " (declare (in) mat4x2 y))\n" + " ())\n" + " (signature mat4x3\n" + " (parameters\n" + " (declare (in) mat4x3 x)\n" + " (declare (in) mat4x3 y))\n" " ()))\n" - "(function noise2\n" - " (signature vec2\n" + "(function outerProduct\n" + " (signature mat2\n" " (parameters\n" - " (declare (in) float x))\n" + " (declare (in) vec2 c)\n" + " (declare (in) vec2 r))\n" " ())\n" - " (signature vec2\n" + " (signature mat3\n" " (parameters\n" - " (declare (in) vec2 x))\n" + " (declare (in) vec3 c)\n" + " (declare (in) vec3 r))\n" " ())\n" - " (signature vec2\n" + " (signature mat4\n" " (parameters\n" - " (declare (in) vec3 x))\n" + " (declare (in) vec4 c)\n" + " (declare (in) vec4 r))\n" " ())\n" - " (signature vec2\n" + " (signature mat2x3\n" " (parameters\n" - " (declare (in) vec4 x))\n" + " (declare (in) vec3 c)\n" + " (declare (in) vec2 r))\n" + " ())\n" + " (signature mat3x2\n" + " (parameters\n" + " (declare (in) vec2 c)\n" + " (declare (in) vec3 r))\n" + " ())\n" + " (signature mat2x4\n" + " (parameters\n" + " (declare (in) vec4 c)\n" + " (declare (in) vec2 r))\n" + " ())\n" + " (signature mat4x2\n" + " (parameters\n" + " (declare (in) vec2 c)\n" + " (declare (in) vec4 r))\n" + " ())\n" + " (signature mat3x4\n" + " (parameters\n" + " (declare (in) vec4 c)\n" + " (declare (in) vec3 r))\n" + " ())\n" + " (signature mat4x3\n" + " (parameters\n" + " (declare (in) vec3 c)\n" + " (declare (in) vec4 r))\n" " ()))\n" - "(function noise3\n" - " (signature vec3\n" + "(function transpose\n" + " (signature mat2\n" " (parameters\n" - " (declare (in) float x))\n" + " (declare (in) mat2 m))\n" " ())\n" - " (signature vec3\n" + " (signature mat3\n" + " (parameters\n" + " (declare (in) mat3 m))\n" + " ())\n" + " (signature mat4\n" + " (parameters\n" + " (declare (in) mat4 m))\n" + " ())\n" + " (signature mat2x3\n" + " (parameters\n" + " (declare (in) mat3x2 m))\n" + " ())\n" + " (signature mat3x2\n" + " (parameters\n" + " (declare (in) mat2x3 m))\n" + " ())\n" + " (signature mat2x4\n" + " (parameters\n" + " (declare (in) mat4x2 m))\n" + " ())\n" + " (signature mat4x2\n" " (parameters\n" - " (declare (in) vec2 x))\n" + " (declare (in) mat2x4 m))\n" " ())\n" - " (signature vec3\n" + " (signature mat3x4\n" " (parameters\n" - " (declare (in) vec3 x))\n" + " (declare (in) mat4x3 m))\n" " ())\n" - " (signature vec3\n" + " (signature mat4x3\n" " (parameters\n" - " (declare (in) vec4 x))\n" + " (declare (in) mat3x4 m))\n" " ()))\n" - "(function noise4\n" - " (signature vec4\n" + "(function lessThan\n" + " (signature bvec2\n" " (parameters\n" - " (declare (in) float x))\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" " ())\n" - " (signature vec4\n" + " (signature bvec3\n" " (parameters\n" - " (declare (in) vec2 x))\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" " ())\n" - " (signature vec4\n" + " (signature bvec4\n" " (parameters\n" - " (declare (in) vec3 x))\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" " ())\n" - " (signature vec4\n" + " (signature bvec2\n" " (parameters\n" - " (declare (in) vec4 x))\n" - " ())))" -; -static const char *functions_for_130_frag [] = { - builtin_all, - builtin_textureProj, - builtin_fwidth, - builtin_texture2DProj, - builtin_shadow1DProjLod, - builtin_texture3DLod, - builtin_mix, - builtin_texture, - builtin_degrees, - builtin_ceil, - builtin_texture1D, - builtin_not, - builtin_mod, - builtin_radians, - builtin_smoothstep, - builtin_textureProjGrad, - builtin_lessThan, - builtin_dFdy, - builtin_textureGrad, - builtin_clamp, - builtin_cosh, - builtin_asin, - builtin_texture1DProj, - builtin_dFdx, - builtin_shadow2DProj, - builtin_textureLod, - builtin_faceforward, - builtin_abs, - builtin_log2, - builtin_lessThanEqual, - builtin_transpose, - builtin_step, - builtin_sinh, - builtin_cos, - builtin_shadow2DProjLod, - builtin_equal, - builtin_length, - builtin_texelFetch, - builtin_matrixCompMult, - builtin_pow, - builtin_texture2DProjLod, - builtin_textureProjLod, - builtin_log, - builtin_exp2, - builtin_fract, - builtin_shadow1DLod, - builtin_texture1DLod, - builtin_greaterThan, - builtin_texture3DProj, - builtin_sign, - builtin_inversesqrt, - builtin_distance, - builtin_refract, - builtin_tanh, - builtin_texture1DProjLod, - builtin_texture2D, - builtin_greaterThanEqual, - builtin_texture3DProjLod, - builtin_tan, - builtin_any, - builtin_normalize, - builtin_shadow1DProj, - builtin_floor, - builtin_cross, - builtin_sqrt, - builtin_textureCubeLod, - builtin_sin, - builtin_shadow2D, - builtin_shadow2DLod, - builtin_atan, - builtin_max, - builtin_reflect, - builtin_texture3D, - builtin_acos, - builtin_noise4, - builtin_notEqual, - builtin_outerProduct, - builtin_shadow1D, - builtin_noise1, - builtin_noise2, - builtin_noise3, - builtin_min, - builtin_textureCube, - builtin_exp, - builtin_texture2DLod, - builtin_dot, -}; -static const char *prototypes_for_ARB_texture_rectangle_vert = - "(\n" - "(function texture2DRect\n" - " (signature vec4\n" + " (declare (in) ivec2 x)\n" + " (declare (in) ivec2 y))\n" + " ())\n" + " (signature bvec3\n" " (parameters\n" - " (declare (in) sampler2DRect sampler)\n" - " (declare (in) vec2 coord))\n" - " ()))\n" - "(function texture2DRectProj\n" - " (signature vec4\n" + " (declare (in) ivec3 x)\n" + " (declare (in) ivec3 y))\n" + " ())\n" + " (signature bvec4\n" " (parameters\n" - " (declare (in) sampler2DRect sampler)\n" - " (declare (in) vec3 coord))\n" + " (declare (in) ivec4 x)\n" + " (declare (in) ivec4 y))\n" " ())\n" - " (signature vec4\n" + " (signature bvec2\n" " (parameters\n" - " (declare (in) sampler2DRect sampler)\n" - " (declare (in) vec4 coord))\n" - " ()))\n" - "(function shadow2DRect\n" - " (signature vec4\n" + " (declare (in) uvec2 x)\n" + " (declare (in) uvec2 y))\n" + " ())\n" + " (signature bvec3\n" " (parameters\n" - " (declare (in) sampler2DRectShadow sampler)\n" - " (declare (in) vec3 coord))\n" + " (declare (in) uvec3 x)\n" + " (declare (in) uvec3 y))\n" + " ())\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) uvec4 x)\n" + " (declare (in) uvec4 y))\n" " ()))\n" - "(function shadow2DRectProj\n" - " (signature vec4\n" + "(function lessThanEqual\n" + " (signature bvec2\n" " (parameters\n" - " (declare (in) sampler2DRectShadow sampler)\n" - " (declare (in) vec4 coord))\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" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" + " ())\n" + " (signature bvec3\n" " (parameters\n" - " (declare (in) float degrees))\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" " ())\n" - " (signature vec2\n" + " (signature bvec4\n" " (parameters\n" - " (declare (in) vec2 degrees))\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" " ())\n" - " (signature vec3\n" + " (signature bvec2\n" " (parameters\n" - " (declare (in) vec3 degrees))\n" + " (declare (in) ivec2 x)\n" + " (declare (in) ivec2 y))\n" " ())\n" - " (signature vec4\n" + " (signature bvec3\n" " (parameters\n" - " (declare (in) vec4 degrees))\n" - " ()))\n" - "(function degrees\n" - " (signature float\n" + " (declare (in) ivec3 x)\n" + " (declare (in) ivec3 y))\n" + " ())\n" + " (signature bvec4\n" " (parameters\n" - " (declare (in) float radians))\n" + " (declare (in) ivec4 x)\n" + " (declare (in) ivec4 y))\n" " ())\n" - " (signature vec2\n" + " (signature bvec2\n" " (parameters\n" - " (declare (in) vec2 radians))\n" + " (declare (in) uvec2 x)\n" + " (declare (in) uvec2 y))\n" " ())\n" - " (signature vec3\n" + " (signature bvec3\n" " (parameters\n" - " (declare (in) vec3 radians))\n" + " (declare (in) uvec3 x)\n" + " (declare (in) uvec3 y))\n" " ())\n" - " (signature vec4\n" + " (signature bvec4\n" " (parameters\n" - " (declare (in) vec4 radians))\n" + " (declare (in) uvec4 x)\n" + " (declare (in) uvec4 y))\n" " ()))\n" - "(function sin\n" - " (signature float\n" + "(function greaterThan\n" + " (signature bvec2\n" " (parameters\n" - " (declare (in) float angle))\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" " ())\n" - " (signature vec2\n" + " (signature bvec3\n" " (parameters\n" - " (declare (in) vec2 angle))\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" " ())\n" - " (signature vec3\n" + " (signature bvec4\n" " (parameters\n" - " (declare (in) vec3 angle))\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" " ())\n" - " (signature vec4\n" + " (signature bvec2\n" " (parameters\n" - " (declare (in) vec4 angle))\n" - " ()))\n" - "(function cos\n" - " (signature float\n" + " (declare (in) ivec2 x)\n" + " (declare (in) ivec2 y))\n" + " ())\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) ivec3 x)\n" + " (declare (in) ivec3 y))\n" + " ())\n" + " (signature bvec4\n" " (parameters\n" - " (declare (in) float angle))\n" + " (declare (in) ivec4 x)\n" + " (declare (in) ivec4 y))\n" " ())\n" - " (signature vec2\n" + " (signature bvec2\n" " (parameters\n" - " (declare (in) vec2 angle))\n" + " (declare (in) uvec2 x)\n" + " (declare (in) uvec2 y))\n" " ())\n" - " (signature vec3\n" + " (signature bvec3\n" " (parameters\n" - " (declare (in) vec3 angle))\n" + " (declare (in) uvec3 x)\n" + " (declare (in) uvec3 y))\n" " ())\n" - " (signature vec4\n" + " (signature bvec4\n" " (parameters\n" - " (declare (in) vec4 angle))\n" + " (declare (in) uvec4 x)\n" + " (declare (in) uvec4 y))\n" " ()))\n" - "(function tan\n" - " (signature float\n" + "(function greaterThanEqual\n" + " (signature bvec2\n" " (parameters\n" - " (declare (in) float angle))\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" " ())\n" - " (signature vec2\n" + " (signature bvec3\n" " (parameters\n" - " (declare (in) vec2 angle))\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" " ())\n" - " (signature vec3\n" + " (signature bvec4\n" " (parameters\n" - " (declare (in) vec3 angle))\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" " ())\n" - " (signature vec4\n" + " (signature bvec2\n" " (parameters\n" - " (declare (in) vec4 angle))\n" - " ()))\n" - "(function asin\n" - " (signature float\n" + " (declare (in) ivec2 x)\n" + " (declare (in) ivec2 y))\n" + " ())\n" + " (signature bvec3\n" " (parameters\n" - " (declare (in) float angle))\n" + " (declare (in) ivec3 x)\n" + " (declare (in) ivec3 y))\n" " ())\n" - " (signature vec2\n" + " (signature bvec4\n" " (parameters\n" - " (declare (in) vec2 angle))\n" + " (declare (in) ivec4 x)\n" + " (declare (in) ivec4 y))\n" " ())\n" - " (signature vec3\n" + " (signature bvec2\n" " (parameters\n" - " (declare (in) vec3 angle))\n" + " (declare (in) uvec2 x)\n" + " (declare (in) uvec2 y))\n" " ())\n" - " (signature vec4\n" + " (signature bvec3\n" " (parameters\n" - " (declare (in) vec4 angle))\n" + " (declare (in) uvec3 x)\n" + " (declare (in) uvec3 y))\n" + " ())\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) uvec4 x)\n" + " (declare (in) uvec4 y))\n" " ()))\n" - "(function acos\n" - " (signature float\n" + "(function equal\n" + " (signature bvec2\n" " (parameters\n" - " (declare (in) float angle))\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" " ())\n" - " (signature vec2\n" + " (signature bvec3\n" " (parameters\n" - " (declare (in) vec2 angle))\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" " ())\n" - " (signature vec3\n" + " (signature bvec4\n" " (parameters\n" - " (declare (in) vec3 angle))\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" " ())\n" - " (signature vec4\n" + " (signature bvec2\n" " (parameters\n" - " (declare (in) vec4 angle))\n" - " ()))\n" - "(function atan\n" - " (signature float\n" + " (declare (in) ivec2 x)\n" + " (declare (in) ivec2 y))\n" + " ())\n" + " (signature bvec3\n" " (parameters\n" - " (declare (in) float y)\n" - " (declare (in) float x))\n" + " (declare (in) ivec3 x)\n" + " (declare (in) ivec3 y))\n" " ())\n" - " (signature vec2\n" + " (signature bvec4\n" " (parameters\n" - " (declare (in) vec2 y)\n" - " (declare (in) vec2 x))\n" + " (declare (in) ivec4 x)\n" + " (declare (in) ivec4 y))\n" " ())\n" - " (signature vec3\n" + " (signature bvec2\n" " (parameters\n" - " (declare (in) vec3 y)\n" - " (declare (in) vec3 x))\n" + " (declare (in) uvec2 x)\n" + " (declare (in) uvec2 y))\n" " ())\n" - " (signature vec4\n" + " (signature bvec3\n" " (parameters\n" - " (declare (in) vec4 y)\n" - " (declare (in) vec4 x))\n" + " (declare (in) uvec3 x)\n" + " (declare (in) uvec3 y))\n" " ())\n" - " (signature float\n" + " (signature bvec4\n" " (parameters\n" - " (declare (in) float y_over_x))\n" + " (declare (in) uvec4 x)\n" + " (declare (in) uvec4 y))\n" " ())\n" - " (signature vec2\n" + " (signature bvec2\n" " (parameters\n" - " (declare (in) vec2 y_over_x))\n" + " (declare (in) bvec2 x)\n" + " (declare (in) bvec2 y))\n" " ())\n" - " (signature vec3\n" + " (signature bvec3\n" " (parameters\n" - " (declare (in) vec3 y_over_x))\n" + " (declare (in) bvec3 x)\n" + " (declare (in) bvec3 y))\n" " ())\n" - " (signature vec4\n" + " (signature bvec4\n" " (parameters\n" - " (declare (in) vec4 y_over_x))\n" + " (declare (in) bvec4 x)\n" + " (declare (in) bvec4 y))\n" " ()))\n" - "(function sinh\n" - " (signature float\n" + "(function notEqual\n" + " (signature bvec2\n" " (parameters\n" - " (declare (in) float x))\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" " ())\n" - " (signature vec2\n" + " (signature bvec3\n" " (parameters\n" - " (declare (in) vec2 x))\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" " ())\n" - " (signature vec3\n" + " (signature bvec4\n" " (parameters\n" - " (declare (in) vec3 x))\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" " ())\n" - " (signature vec4\n" + " (signature bvec2\n" " (parameters\n" - " (declare (in) vec4 x))\n" - " ()))\n" - "(function cosh\n" - " (signature float\n" + " (declare (in) ivec2 x)\n" + " (declare (in) ivec2 y))\n" + " ())\n" + " (signature bvec3\n" " (parameters\n" - " (declare (in) float x))\n" + " (declare (in) ivec3 x)\n" + " (declare (in) ivec3 y))\n" " ())\n" - " (signature vec2\n" + " (signature bvec4\n" " (parameters\n" - " (declare (in) vec2 x))\n" + " (declare (in) ivec4 x)\n" + " (declare (in) ivec4 y))\n" " ())\n" - " (signature vec3\n" + " (signature bvec2\n" " (parameters\n" - " (declare (in) vec3 x))\n" + " (declare (in) uvec2 x)\n" + " (declare (in) uvec2 y))\n" " ())\n" - " (signature vec4\n" + " (signature bvec3\n" " (parameters\n" - " (declare (in) vec4 x))\n" - " ()))\n" - "(function tanh\n" - " (signature float\n" + " (declare (in) uvec3 x)\n" + " (declare (in) uvec3 y))\n" + " ())\n" + " (signature bvec4\n" " (parameters\n" - " (declare (in) float x))\n" + " (declare (in) uvec4 x)\n" + " (declare (in) uvec4 y))\n" " ())\n" - " (signature vec2\n" + " (signature bvec2\n" " (parameters\n" - " (declare (in) vec2 x))\n" + " (declare (in) bvec2 x)\n" + " (declare (in) bvec2 y))\n" " ())\n" - " (signature vec3\n" + " (signature bvec3\n" " (parameters\n" - " (declare (in) vec3 x))\n" + " (declare (in) bvec3 x)\n" + " (declare (in) bvec3 y))\n" " ())\n" - " (signature vec4\n" + " (signature bvec4\n" " (parameters\n" - " (declare (in) vec4 x))\n" + " (declare (in) bvec4 x)\n" + " (declare (in) bvec4 y))\n" " ()))\n" - "(function pow\n" - " (signature float\n" - " (parameters\n" - " (declare (in) float x)\n" - " (declare (in) float y))\n" - " ())\n" - " (signature vec2\n" + "(function any\n" + " (signature bool\n" " (parameters\n" - " (declare (in) vec2 x)\n" - " (declare (in) vec2 y))\n" + " (declare (in) bvec2 x))\n" " ())\n" - " (signature vec3\n" + " (signature bool\n" " (parameters\n" - " (declare (in) vec3 x)\n" - " (declare (in) vec3 y))\n" + " (declare (in) bvec3 x))\n" " ())\n" - " (signature vec4\n" + " (signature bool\n" " (parameters\n" - " (declare (in) vec4 x)\n" - " (declare (in) vec4 y))\n" + " (declare (in) bvec4 x))\n" " ()))\n" - "(function exp\n" - " (signature float\n" - " (parameters\n" - " (declare (in) float x))\n" - " ())\n" - " (signature vec2\n" + "(function all\n" + " (signature bool\n" " (parameters\n" - " (declare (in) vec2 x))\n" + " (declare (in) bvec2 x))\n" " ())\n" - " (signature vec3\n" + " (signature bool\n" " (parameters\n" - " (declare (in) vec3 x))\n" + " (declare (in) bvec3 x))\n" " ())\n" - " (signature vec4\n" + " (signature bool\n" " (parameters\n" - " (declare (in) vec4 x))\n" + " (declare (in) bvec4 x))\n" " ()))\n" - "(function log\n" - " (signature float\n" - " (parameters\n" - " (declare (in) float x))\n" - " ())\n" - " (signature vec2\n" + "(function not\n" + " (signature bvec2\n" " (parameters\n" - " (declare (in) vec2 x))\n" + " (declare (in) bvec2 x))\n" " ())\n" - " (signature vec3\n" + " (signature bvec3\n" " (parameters\n" - " (declare (in) vec3 x))\n" + " (declare (in) bvec3 x))\n" " ())\n" - " (signature vec4\n" + " (signature bvec4\n" " (parameters\n" - " (declare (in) vec4 x))\n" + " (declare (in) bvec4 x))\n" " ()))\n" - "(function exp2\n" - " (signature float\n" + "(function texture\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) float x))\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) float P))\n" " ())\n" - " (signature vec2\n" + " (signature ivec4\n" " (parameters\n" - " (declare (in) vec2 x))\n" + " (declare (in) isampler1D sampler)\n" + " (declare (in) float P))\n" " ())\n" - " (signature vec3\n" + " (signature uvec4\n" " (parameters\n" - " (declare (in) vec3 x))\n" + " (declare (in) usampler1D sampler)\n" + " (declare (in) float P))\n" " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in) vec4 x))\n" - " ()))\n" - "(function log2\n" - " (signature float\n" - " (parameters\n" - " (declare (in) float x))\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec2 P))\n" " ())\n" - " (signature vec2\n" + " (signature ivec4\n" " (parameters\n" - " (declare (in) vec2 x))\n" + " (declare (in) isampler2D sampler)\n" + " (declare (in) vec2 P))\n" " ())\n" - " (signature vec3\n" + " (signature uvec4\n" " (parameters\n" - " (declare (in) vec3 x))\n" + " (declare (in) usampler2D sampler)\n" + " (declare (in) vec2 P))\n" " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in) vec4 x))\n" - " ()))\n" - "(function sqrt\n" - " (signature float\n" - " (parameters\n" - " (declare (in) float x))\n" + " (declare (in) sampler3D sampler)\n" + " (declare (in) vec3 P))\n" " ())\n" - " (signature vec2\n" + " (signature ivec4\n" " (parameters\n" - " (declare (in) vec2 x))\n" + " (declare (in) isampler3D sampler)\n" + " (declare (in) vec3 P))\n" " ())\n" - " (signature vec3\n" + " (signature uvec4\n" " (parameters\n" - " (declare (in) vec3 x))\n" + " (declare (in) usampler3D sampler)\n" + " (declare (in) vec3 P))\n" " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in) vec4 x))\n" - " ()))\n" - "(function inversesqrt\n" - " (signature float\n" - " (parameters\n" - " (declare (in) float x))\n" + " (declare (in) samplerCube sampler)\n" + " (declare (in) vec3 P))\n" " ())\n" - " (signature vec2\n" + " (signature ivec4\n" " (parameters\n" - " (declare (in) vec2 x))\n" + " (declare (in) isamplerCube sampler)\n" + " (declare (in) vec3 P))\n" " ())\n" - " (signature vec3\n" + " (signature uvec4\n" " (parameters\n" - " (declare (in) vec3 x))\n" + " (declare (in) usamplerCube sampler)\n" + " (declare (in) vec3 P))\n" " ())\n" - " (signature vec4\n" - " (parameters\n" - " (declare (in) vec4 x))\n" - " ()))\n" - "(function abs\n" " (signature float\n" " (parameters\n" - " (declare (in) float x))\n" + " (declare (in) sampler1DShadow sampler)\n" + " (declare (in) vec3 P))\n" " ())\n" - " (signature vec2\n" + " (signature float\n" " (parameters\n" - " (declare (in) vec2 x))\n" + " (declare (in) sampler2DShadow sampler)\n" + " (declare (in) vec3 P))\n" " ())\n" - " (signature vec3\n" + " (signature float\n" " (parameters\n" - " (declare (in) vec3 x))\n" + " (declare (in) samplerCubeShadow sampler)\n" + " (declare (in) vec4 P))\n" " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in) vec4 x))\n" + " (declare (in) sampler1DArray sampler)\n" + " (declare (in) vec2 P))\n" " ())\n" - " (signature int\n" + " (signature ivec4\n" " (parameters\n" - " (declare (in) int x))\n" + " (declare (in) isampler1DArray sampler)\n" + " (declare (in) vec2 P))\n" " ())\n" - " (signature ivec2\n" + " (signature uvec4\n" " (parameters\n" - " (declare (in) ivec2 x))\n" + " (declare (in) usampler1DArray sampler)\n" + " (declare (in) vec2 P))\n" " ())\n" - " (signature ivec3\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) ivec3 x))\n" + " (declare (in) sampler2DArray sampler)\n" + " (declare (in) vec3 P))\n" " ())\n" " (signature ivec4\n" " (parameters\n" - " (declare (in) ivec4 x))\n" - " ()))\n" - "(function sign\n" - " (signature float\n" + " (declare (in) isampler2DArray sampler)\n" + " (declare (in) vec3 P))\n" + " ())\n" + " (signature uvec4\n" " (parameters\n" - " (declare (in) float x))\n" + " (declare (in) usampler2DArray sampler)\n" + " (declare (in) vec3 P))\n" " ())\n" - " (signature vec2\n" + " (signature float\n" " (parameters\n" - " (declare (in) vec2 x))\n" + " (declare (in) sampler1DArrayShadow sampler)\n" + " (declare (in) vec3 P))\n" " ())\n" - " (signature vec3\n" + " (signature float\n" " (parameters\n" - " (declare (in) vec3 x))\n" + " (declare (in) sampler2DArrayShadow sampler)\n" + " (declare (in) vec4 P))\n" " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in) vec4 x))\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) float P)\n" + " (declare (in) float bias))\n" " ())\n" - " (signature int\n" + " (signature ivec4\n" " (parameters\n" - " (declare (in) int x))\n" + " (declare (in) isampler1D sampler)\n" + " (declare (in) float P)\n" + " (declare (in) float bias))\n" " ())\n" - " (signature ivec2\n" + " (signature uvec4\n" " (parameters\n" - " (declare (in) ivec2 x))\n" + " (declare (in) usampler1D sampler)\n" + " (declare (in) float P)\n" + " (declare (in) float bias))\n" " ())\n" - " (signature ivec3\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) ivec3 x))\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec2 P)\n" + " (declare (in) float bias))\n" " ())\n" " (signature ivec4\n" " (parameters\n" - " (declare (in) ivec4 x))\n" - " ()))\n" - "(function floor\n" - " (signature float\n" - " (parameters\n" - " (declare (in) float x))\n" + " (declare (in) isampler2D sampler)\n" + " (declare (in) vec2 P)\n" + " (declare (in) float bias))\n" " ())\n" - " (signature vec2\n" + " (signature uvec4\n" " (parameters\n" - " (declare (in) vec2 x))\n" + " (declare (in) usampler2D sampler)\n" + " (declare (in) vec2 P)\n" + " (declare (in) float bias))\n" " ())\n" - " (signature vec3\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) vec3 x))\n" + " (declare (in) sampler3D sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float bias))\n" " ())\n" - " (signature vec4\n" + " (signature ivec4\n" " (parameters\n" - " (declare (in) vec4 x))\n" - " ()))\n" - "(function ceil\n" - " (signature float\n" + " (declare (in) isampler3D sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float bias))\n" + " ())\n" + " (signature uvec4\n" " (parameters\n" - " (declare (in) float x))\n" + " (declare (in) usampler3D sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float bias))\n" " ())\n" - " (signature vec2\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) vec2 x))\n" + " (declare (in) samplerCube sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float bias))\n" " ())\n" - " (signature vec3\n" + " (signature ivec4\n" " (parameters\n" - " (declare (in) vec3 x))\n" + " (declare (in) isamplerCube sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float bias))\n" " ())\n" - " (signature vec4\n" + " (signature uvec4\n" " (parameters\n" - " (declare (in) vec4 x))\n" - " ()))\n" - "(function fract\n" + " (declare (in) usamplerCube sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float bias))\n" + " ())\n" " (signature float\n" " (parameters\n" - " (declare (in) float x))\n" + " (declare (in) sampler1DShadow sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float bias))\n" " ())\n" - " (signature vec2\n" + " (signature float\n" " (parameters\n" - " (declare (in) vec2 x))\n" + " (declare (in) sampler2DShadow sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float bias))\n" " ())\n" - " (signature vec3\n" + " (signature float\n" " (parameters\n" - " (declare (in) vec3 x))\n" + " (declare (in) samplerCubeShadow sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) float bias))\n" " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in) vec4 x))\n" - " ()))\n" - "(function mod\n" - " (signature float\n" - " (parameters\n" - " (declare (in) float x)\n" - " (declare (in) float y))\n" + " (declare (in) sampler1DArray sampler)\n" + " (declare (in) vec2 P)\n" + " (declare (in) float bias))\n" " ())\n" - " (signature vec2\n" + " (signature ivec4\n" " (parameters\n" - " (declare (in) vec2 x)\n" - " (declare (in) float y))\n" + " (declare (in) isampler1DArray sampler)\n" + " (declare (in) vec2 P)\n" + " (declare (in) float bias))\n" " ())\n" - " (signature vec3\n" + " (signature uvec4\n" " (parameters\n" - " (declare (in) vec3 x)\n" - " (declare (in) float y))\n" + " (declare (in) usampler1DArray sampler)\n" + " (declare (in) vec2 P)\n" + " (declare (in) float bias))\n" " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in) vec4 x)\n" - " (declare (in) float y))\n" + " (declare (in) sampler2DArray sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float bias))\n" " ())\n" - " (signature vec2\n" + " (signature ivec4\n" " (parameters\n" - " (declare (in) vec2 x)\n" - " (declare (in) vec2 y))\n" + " (declare (in) isampler2DArray sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float bias))\n" " ())\n" - " (signature vec3\n" + " (signature uvec4\n" " (parameters\n" - " (declare (in) vec3 x)\n" - " (declare (in) vec3 y))\n" + " (declare (in) usampler2DArray sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float bias))\n" " ())\n" - " (signature vec4\n" + " (signature float\n" " (parameters\n" - " (declare (in) vec4 x)\n" - " (declare (in) vec4 y))\n" + " (declare (in) sampler1DArrayShadow sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float bias))\n" " ()))\n" - "(function min\n" - " (signature float\n" + "(function textureProj\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) float x)\n" - " (declare (in) float y))\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) vec2 P))\n" " ())\n" - " (signature vec2\n" + " (signature ivec4\n" " (parameters\n" - " (declare (in) vec2 x)\n" - " (declare (in) vec2 y))\n" + " (declare (in) isampler1D sampler)\n" + " (declare (in) vec2 P))\n" " ())\n" - " (signature vec3\n" + " (signature uvec4\n" " (parameters\n" - " (declare (in) vec3 x)\n" - " (declare (in) vec3 y))\n" + " (declare (in) usampler1D sampler)\n" + " (declare (in) vec2 P))\n" " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in) vec4 x)\n" - " (declare (in) vec4 y))\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) vec4 P))\n" " ())\n" - " (signature vec2\n" + " (signature ivec4\n" " (parameters\n" - " (declare (in) vec2 x)\n" - " (declare (in) float y))\n" + " (declare (in) isampler1D sampler)\n" + " (declare (in) vec4 P))\n" " ())\n" - " (signature vec3\n" + " (signature uvec4\n" " (parameters\n" - " (declare (in) vec3 x)\n" - " (declare (in) float y))\n" + " (declare (in) usampler1D sampler)\n" + " (declare (in) vec4 P))\n" " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in) vec4 x)\n" - " (declare (in) float y))\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec3 P))\n" " ())\n" - " (signature int\n" + " (signature ivec4\n" " (parameters\n" - " (declare (in) int x)\n" - " (declare (in) int y))\n" + " (declare (in) isampler2D sampler)\n" + " (declare (in) vec3 P))\n" " ())\n" - " (signature ivec2\n" + " (signature uvec4\n" " (parameters\n" - " (declare (in) ivec2 x)\n" - " (declare (in) ivec2 y))\n" + " (declare (in) usampler2D sampler)\n" + " (declare (in) vec3 P))\n" " ())\n" - " (signature ivec3\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) ivec3 x)\n" - " (declare (in) ivec3 y))\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec4 P))\n" " ())\n" " (signature ivec4\n" " (parameters\n" - " (declare (in) ivec4 x)\n" - " (declare (in) ivec4 y))\n" + " (declare (in) isampler2D sampler)\n" + " (declare (in) vec4 P))\n" " ())\n" - " (signature ivec2\n" + " (signature uvec4\n" " (parameters\n" - " (declare (in) ivec2 x)\n" - " (declare (in) int y))\n" + " (declare (in) usampler2D sampler)\n" + " (declare (in) vec4 P))\n" " ())\n" - " (signature ivec3\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) ivec3 x)\n" - " (declare (in) int y))\n" + " (declare (in) sampler3D sampler)\n" + " (declare (in) vec4 P))\n" " ())\n" " (signature ivec4\n" " (parameters\n" - " (declare (in) ivec4 x)\n" - " (declare (in) int y))\n" - " ())\n" - " (signature uint\n" - " (parameters\n" - " (declare (in) uint x)\n" - " (declare (in) uint y))\n" + " (declare (in) isampler3D sampler)\n" + " (declare (in) vec4 P))\n" " ())\n" - " (signature uvec2\n" + " (signature uvec4\n" " (parameters\n" - " (declare (in) uvec2 x)\n" - " (declare (in) uvec2 y))\n" + " (declare (in) usampler3D sampler)\n" + " (declare (in) vec4 P))\n" " ())\n" - " (signature uvec3\n" + " (signature float\n" " (parameters\n" - " (declare (in) uvec3 x)\n" - " (declare (in) uvec3 y))\n" + " (declare (in) sampler1DShadow sampler)\n" + " (declare (in) vec4 P))\n" " ())\n" - " (signature uvec4\n" + " (signature float\n" " (parameters\n" - " (declare (in) uvec4 x)\n" - " (declare (in) uvec4 y))\n" + " (declare (in) sampler2DShadow sampler)\n" + " (declare (in) vec4 P))\n" " ())\n" - " (signature uvec2\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) uvec2 x)\n" - " (declare (in) uint y))\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) vec2 P)\n" + " (declare (in) float bias))\n" " ())\n" - " (signature uvec3\n" + " (signature ivec4\n" " (parameters\n" - " (declare (in) uvec3 x)\n" - " (declare (in) uint y))\n" + " (declare (in) isampler1D sampler)\n" + " (declare (in) vec2 P)\n" + " (declare (in) float bias))\n" " ())\n" " (signature uvec4\n" " (parameters\n" - " (declare (in) uvec4 x)\n" - " (declare (in) uint y))\n" - " ()))\n" - "(function max\n" - " (signature float\n" + " (declare (in) usampler1D sampler)\n" + " (declare (in) vec2 P)\n" + " (declare (in) float bias))\n" + " ())\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) float x)\n" - " (declare (in) float y))\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) float bias))\n" " ())\n" - " (signature vec2\n" + " (signature ivec4\n" " (parameters\n" - " (declare (in) vec2 x)\n" - " (declare (in) vec2 y))\n" + " (declare (in) isampler1D sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) float bias))\n" " ())\n" - " (signature vec3\n" + " (signature uvec4\n" " (parameters\n" - " (declare (in) vec3 x)\n" - " (declare (in) vec3 y))\n" + " (declare (in) usampler1D sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) float bias))\n" " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in) vec4 x)\n" - " (declare (in) vec4 y))\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float bias))\n" " ())\n" - " (signature vec2\n" + " (signature ivec4\n" " (parameters\n" - " (declare (in) vec2 x)\n" - " (declare (in) float y))\n" + " (declare (in) isampler2D sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float bias))\n" " ())\n" - " (signature vec3\n" + " (signature uvec4\n" " (parameters\n" - " (declare (in) vec3 x)\n" - " (declare (in) float y))\n" + " (declare (in) usampler2D sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float bias))\n" " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in) vec4 x)\n" - " (declare (in) float y))\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) float bias))\n" " ())\n" - " (signature int\n" + " (signature ivec4\n" " (parameters\n" - " (declare (in) int x)\n" - " (declare (in) int y))\n" + " (declare (in) isampler2D sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) float bias))\n" " ())\n" - " (signature ivec2\n" + " (signature uvec4\n" " (parameters\n" - " (declare (in) ivec2 x)\n" - " (declare (in) ivec2 y))\n" + " (declare (in) usampler2D sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) float bias))\n" " ())\n" - " (signature ivec3\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) ivec3 x)\n" - " (declare (in) ivec3 y))\n" + " (declare (in) sampler3D sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) float bias))\n" " ())\n" " (signature ivec4\n" " (parameters\n" - " (declare (in) ivec4 x)\n" - " (declare (in) ivec4 y))\n" + " (declare (in) isampler3D sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) float bias))\n" " ())\n" - " (signature ivec2\n" + " (signature uvec4\n" " (parameters\n" - " (declare (in) ivec2 x)\n" - " (declare (in) int y))\n" + " (declare (in) usampler3D sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) float bias))\n" " ())\n" - " (signature ivec3\n" + " (signature float\n" " (parameters\n" - " (declare (in) ivec3 x)\n" - " (declare (in) int y))\n" + " (declare (in) sampler1DShadow sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) float bias))\n" + " ())\n" + " (signature float\n" + " (parameters\n" + " (declare (in) sampler2DShadow sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) float bias))\n" + " ()))\n" + "(function textureLod\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) float P)\n" + " (declare (in) float lod))\n" " ())\n" " (signature ivec4\n" " (parameters\n" - " (declare (in) ivec4 x)\n" - " (declare (in) int y))\n" + " (declare (in) isampler1D sampler)\n" + " (declare (in) float P)\n" + " (declare (in) float lod))\n" " ())\n" - " (signature uint\n" + " (signature uvec4\n" " (parameters\n" - " (declare (in) uint x)\n" - " (declare (in) uint y))\n" + " (declare (in) usampler1D sampler)\n" + " (declare (in) float P)\n" + " (declare (in) float lod))\n" " ())\n" - " (signature uvec2\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) uvec2 x)\n" - " (declare (in) uvec2 y))\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec2 P)\n" + " (declare (in) float lod))\n" " ())\n" - " (signature uvec3\n" + " (signature ivec4\n" " (parameters\n" - " (declare (in) uvec3 x)\n" - " (declare (in) uvec3 y))\n" + " (declare (in) isampler2D sampler)\n" + " (declare (in) vec2 P)\n" + " (declare (in) float lod))\n" " ())\n" " (signature uvec4\n" " (parameters\n" - " (declare (in) uvec4 x)\n" - " (declare (in) uvec4 y))\n" + " (declare (in) usampler2D sampler)\n" + " (declare (in) vec2 P)\n" + " (declare (in) float lod))\n" " ())\n" - " (signature uvec2\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) uvec2 x)\n" - " (declare (in) uint y))\n" + " (declare (in) sampler3D sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float lod))\n" " ())\n" - " (signature uvec3\n" + " (signature ivec4\n" " (parameters\n" - " (declare (in) uvec3 x)\n" - " (declare (in) uint y))\n" + " (declare (in) isampler3D sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float lod))\n" " ())\n" " (signature uvec4\n" " (parameters\n" - " (declare (in) uvec4 x)\n" - " (declare (in) uint y))\n" - " ()))\n" - "(function clamp\n" - " (signature float\n" - " (parameters\n" - " (declare (in) float x)\n" - " (declare (in) float minVal)\n" - " (declare (in) float maxVal))\n" + " (declare (in) usampler3D sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float lod))\n" " ())\n" - " (signature vec2\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) vec2 x)\n" - " (declare (in) vec2 minVal)\n" - " (declare (in) vec2 maxVal))\n" + " (declare (in) samplerCube sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float lod))\n" " ())\n" - " (signature vec3\n" + " (signature ivec4\n" " (parameters\n" - " (declare (in) vec3 x)\n" - " (declare (in) vec3 minVal)\n" - " (declare (in) vec3 maxVal))\n" + " (declare (in) isamplerCube sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float lod))\n" " ())\n" - " (signature vec4\n" + " (signature uvec4\n" " (parameters\n" - " (declare (in) vec4 x)\n" - " (declare (in) vec4 minVal)\n" - " (declare (in) vec4 maxVal))\n" + " (declare (in) usamplerCube sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float lod))\n" " ())\n" - " (signature vec2\n" + " (signature float\n" " (parameters\n" - " (declare (in) vec2 x)\n" - " (declare (in) float minVal)\n" - " (declare (in) float maxVal))\n" + " (declare (in) sampler1DShadow sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float lod))\n" " ())\n" - " (signature vec3\n" + " (signature float\n" " (parameters\n" - " (declare (in) vec3 x)\n" - " (declare (in) float minVal)\n" - " (declare (in) float maxVal))\n" + " (declare (in) sampler2DShadow sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float lod))\n" " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in) vec4 x)\n" - " (declare (in) float minVal)\n" - " (declare (in) float maxVal))\n" + " (declare (in) sampler1DArray sampler)\n" + " (declare (in) vec2 P)\n" + " (declare (in) float lod))\n" " ())\n" - " (signature int\n" + " (signature ivec4\n" " (parameters\n" - " (declare (in) int x)\n" - " (declare (in) int minVal)\n" - " (declare (in) int maxVal))\n" + " (declare (in) isampler1DArray sampler)\n" + " (declare (in) vec2 P)\n" + " (declare (in) float lod))\n" " ())\n" - " (signature ivec2\n" + " (signature uvec4\n" " (parameters\n" - " (declare (in) ivec2 x)\n" - " (declare (in) ivec2 minVal)\n" - " (declare (in) ivec2 maxVal))\n" + " (declare (in) usampler1DArray sampler)\n" + " (declare (in) vec2 P)\n" + " (declare (in) float lod))\n" " ())\n" - " (signature ivec3\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) ivec3 x)\n" - " (declare (in) ivec3 minVal)\n" - " (declare (in) ivec3 maxVal))\n" + " (declare (in) sampler2DArray sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float lod))\n" " ())\n" " (signature ivec4\n" " (parameters\n" - " (declare (in) ivec4 x)\n" - " (declare (in) ivec4 minVal)\n" - " (declare (in) ivec4 maxVal))\n" + " (declare (in) isampler2DArray sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float lod))\n" " ())\n" - " (signature ivec2\n" + " (signature uvec4\n" " (parameters\n" - " (declare (in) ivec2 x)\n" - " (declare (in) int minVal)\n" - " (declare (in) int maxVal))\n" + " (declare (in) usampler2DArray sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float lod))\n" " ())\n" - " (signature ivec3\n" + " (signature float\n" " (parameters\n" - " (declare (in) ivec3 x)\n" - " (declare (in) int minVal)\n" - " (declare (in) int maxVal))\n" + " (declare (in) sampler1DArrayShadow sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float lod))\n" + " ()))\n" + "(function texelFetch\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) int P)\n" + " (declare (in) int lod))\n" " ())\n" " (signature ivec4\n" " (parameters\n" - " (declare (in) ivec4 x)\n" - " (declare (in) int minVal)\n" - " (declare (in) int maxVal))\n" + " (declare (in) isampler1D sampler)\n" + " (declare (in) int P)\n" + " (declare (in) int lod))\n" " ())\n" - " (signature uint\n" + " (signature uvec4\n" " (parameters\n" - " (declare (in) uint x)\n" - " (declare (in) uint minVal)\n" - " (declare (in) uint maxVal))\n" + " (declare (in) usampler1D sampler)\n" + " (declare (in) int P)\n" + " (declare (in) int lod))\n" " ())\n" - " (signature uvec2\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) uvec2 x)\n" - " (declare (in) uvec2 minVal)\n" - " (declare (in) uvec2 maxVal))\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) ivec2 P)\n" + " (declare (in) int lod))\n" " ())\n" - " (signature uvec3\n" + " (signature ivec4\n" " (parameters\n" - " (declare (in) uvec3 x)\n" - " (declare (in) uvec3 minVal)\n" - " (declare (in) uvec3 maxVal))\n" + " (declare (in) isampler2D sampler)\n" + " (declare (in) ivec2 P)\n" + " (declare (in) int lod))\n" " ())\n" " (signature uvec4\n" " (parameters\n" - " (declare (in) uvec4 x)\n" - " (declare (in) uvec4 minVal)\n" - " (declare (in) uvec4 maxVal))\n" + " (declare (in) usampler2D sampler)\n" + " (declare (in) ivec2 P)\n" + " (declare (in) int lod))\n" " ())\n" - " (signature uvec2\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) uvec2 x)\n" - " (declare (in) uint minVal)\n" - " (declare (in) uint maxVal))\n" + " (declare (in) sampler3D sampler)\n" + " (declare (in) ivec3 P)\n" + " (declare (in) int lod))\n" " ())\n" - " (signature uvec3\n" + " (signature ivec4\n" " (parameters\n" - " (declare (in) uvec3 x)\n" - " (declare (in) uint minVal)\n" - " (declare (in) uint maxVal))\n" + " (declare (in) isampler3D sampler)\n" + " (declare (in) ivec3 P)\n" + " (declare (in) int lod))\n" " ())\n" " (signature uvec4\n" " (parameters\n" - " (declare (in) uvec4 x)\n" - " (declare (in) uint minVal)\n" - " (declare (in) uint maxVal))\n" - " ()))\n" - "(function mix\n" - " (signature float\n" - " (parameters\n" - " (declare (in) float x)\n" - " (declare (in) float y)\n" - " (declare (in) float a))\n" + " (declare (in) usampler3D sampler)\n" + " (declare (in) ivec3 P)\n" + " (declare (in) int lod))\n" " ())\n" - " (signature vec2\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) vec2 x)\n" - " (declare (in) vec2 y)\n" - " (declare (in) vec2 a))\n" + " (declare (in) sampler1DArray sampler)\n" + " (declare (in) ivec2 P)\n" + " (declare (in) int lod))\n" " ())\n" - " (signature vec3\n" + " (signature ivec4\n" " (parameters\n" - " (declare (in) vec3 x)\n" - " (declare (in) vec3 y)\n" - " (declare (in) vec3 a))\n" + " (declare (in) isampler1DArray sampler)\n" + " (declare (in) ivec2 P)\n" + " (declare (in) int lod))\n" " ())\n" - " (signature vec4\n" + " (signature uvec4\n" " (parameters\n" - " (declare (in) vec4 x)\n" - " (declare (in) vec4 y)\n" - " (declare (in) vec4 a))\n" + " (declare (in) usampler1DArray sampler)\n" + " (declare (in) ivec2 P)\n" + " (declare (in) int lod))\n" " ())\n" - " (signature vec2\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) vec2 x)\n" - " (declare (in) vec2 y)\n" - " (declare (in) float a))\n" + " (declare (in) sampler2DArray sampler)\n" + " (declare (in) ivec3 P)\n" + " (declare (in) int lod))\n" " ())\n" - " (signature vec3\n" + " (signature ivec4\n" " (parameters\n" - " (declare (in) vec3 x)\n" - " (declare (in) vec3 y)\n" - " (declare (in) float a))\n" + " (declare (in) isampler2DArray sampler)\n" + " (declare (in) ivec3 P)\n" + " (declare (in) int lod))\n" " ())\n" - " (signature vec4\n" + " (signature uvec4\n" " (parameters\n" - " (declare (in) vec4 x)\n" - " (declare (in) vec4 y)\n" - " (declare (in) float a))\n" + " (declare (in) usampler2DArray sampler)\n" + " (declare (in) ivec3 P)\n" + " (declare (in) int lod))\n" " ()))\n" - "(function step\n" - " (signature float\n" + "(function textureProjLod\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) float edge)\n" - " (declare (in) float x))\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) vec2 P)\n" + " (declare (in) float lod))\n" " ())\n" - " (signature vec2\n" + " (signature ivec4\n" " (parameters\n" - " (declare (in) vec2 edge)\n" - " (declare (in) vec2 x))\n" + " (declare (in) isampler1D sampler)\n" + " (declare (in) vec2 P)\n" + " (declare (in) float lod))\n" " ())\n" - " (signature vec3\n" + " (signature uvec4\n" " (parameters\n" - " (declare (in) vec3 edge)\n" - " (declare (in) vec3 x))\n" + " (declare (in) usampler1D sampler)\n" + " (declare (in) vec2 P)\n" + " (declare (in) float lod))\n" " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in) vec4 edge)\n" - " (declare (in) vec4 x))\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) float lod))\n" " ())\n" - " (signature vec2\n" + " (signature ivec4\n" " (parameters\n" - " (declare (in) float edge)\n" - " (declare (in) vec2 x))\n" + " (declare (in) isampler1D sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) float lod))\n" " ())\n" - " (signature vec3\n" + " (signature uvec4\n" " (parameters\n" - " (declare (in) float edge)\n" - " (declare (in) vec3 x))\n" + " (declare (in) usampler1D sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) float lod))\n" " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in) float edge)\n" - " (declare (in) vec4 x))\n" - " ()))\n" - "(function smoothstep\n" - " (signature float\n" - " (parameters\n" - " (declare (in) float edge0)\n" - " (declare (in) float edge1)\n" - " (declare (in) float x))\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float lod))\n" " ())\n" - " (signature vec2\n" + " (signature ivec4\n" " (parameters\n" - " (declare (in) vec2 edge0)\n" - " (declare (in) vec2 edge1)\n" - " (declare (in) vec2 x))\n" + " (declare (in) isampler2D sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float lod))\n" " ())\n" - " (signature vec3\n" + " (signature uvec4\n" " (parameters\n" - " (declare (in) vec3 edge0)\n" - " (declare (in) vec3 edge1)\n" - " (declare (in) vec3 x))\n" + " (declare (in) usampler2D sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float lod))\n" " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in) vec4 edge0)\n" - " (declare (in) vec4 edge1)\n" - " (declare (in) vec4 x))\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) float lod))\n" " ())\n" - " (signature vec2\n" + " (signature ivec4\n" " (parameters\n" - " (declare (in) float edge0)\n" - " (declare (in) float edge1)\n" - " (declare (in) vec2 x))\n" + " (declare (in) isampler2D sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) float lod))\n" " ())\n" - " (signature vec3\n" + " (signature uvec4\n" " (parameters\n" - " (declare (in) float edge0)\n" - " (declare (in) float edge1)\n" - " (declare (in) vec3 x))\n" + " (declare (in) usampler2D sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) float lod))\n" " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in) float edge0)\n" - " (declare (in) float edge1)\n" - " (declare (in) vec4 x))\n" - " ()))\n" - "(function length\n" - " (signature float\n" + " (declare (in) sampler3D sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) float lod))\n" + " ())\n" + " (signature ivec4\n" " (parameters\n" - " (declare (in) float x))\n" + " (declare (in) isampler3D sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) float lod))\n" " ())\n" - " (signature float\n" + " (signature uvec4\n" " (parameters\n" - " (declare (in) vec2 x))\n" + " (declare (in) usampler3D sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) float lod))\n" " ())\n" " (signature float\n" " (parameters\n" - " (declare (in) vec3 x))\n" + " (declare (in) sampler1DShadow sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) float lod))\n" " ())\n" " (signature float\n" " (parameters\n" - " (declare (in) vec4 x))\n" + " (declare (in) sampler2DShadow sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) float lod))\n" " ()))\n" - "(function distance\n" - " (signature float\n" + "(function textureGrad\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) float p0)\n" - " (declare (in) float p1))\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) float P)\n" + " (declare (in) float dPdx)\n" + " (declare (in) float dPdy))\n" " ())\n" - " (signature float\n" + " (signature ivec4\n" " (parameters\n" - " (declare (in) vec2 p0)\n" - " (declare (in) vec2 p1))\n" + " (declare (in) isampler1D sampler)\n" + " (declare (in) float P)\n" + " (declare (in) float dPdx)\n" + " (declare (in) float dPdy))\n" " ())\n" - " (signature float\n" + " (signature uvec4\n" " (parameters\n" - " (declare (in) vec3 p0)\n" - " (declare (in) vec3 p1))\n" + " (declare (in) usampler1D sampler)\n" + " (declare (in) float P)\n" + " (declare (in) float dPdx)\n" + " (declare (in) float dPdy))\n" " ())\n" - " (signature float\n" - " (parameters\n" - " (declare (in) vec4 p0)\n" - " (declare (in) vec4 p1))\n" - " ()))\n" - "(function dot\n" - " (signature float\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) float x)\n" - " (declare (in) float y))\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec2 P)\n" + " (declare (in) vec2 dPdx)\n" + " (declare (in) vec2 dPdy))\n" " ())\n" - " (signature float\n" + " (signature ivec4\n" " (parameters\n" - " (declare (in) vec2 x)\n" - " (declare (in) vec2 y))\n" + " (declare (in) isampler2D sampler)\n" + " (declare (in) vec2 P)\n" + " (declare (in) vec2 dPdx)\n" + " (declare (in) vec2 dPdy))\n" " ())\n" - " (signature float\n" + " (signature uvec4\n" " (parameters\n" - " (declare (in) vec3 x)\n" - " (declare (in) vec3 y))\n" + " (declare (in) usampler2D sampler)\n" + " (declare (in) vec2 P)\n" + " (declare (in) vec2 dPdx)\n" + " (declare (in) vec2 dPdy))\n" " ())\n" - " (signature float\n" - " (parameters\n" - " (declare (in) vec4 x)\n" - " (declare (in) vec4 y))\n" - " ()))\n" - "(function cross\n" - " (signature vec3\n" - " (parameters\n" - " (declare (in) vec3 x)\n" - " (declare (in) vec3 y))\n" - " ()))\n" - "(function normalize\n" - " (signature float\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) float x))\n" + " (declare (in) sampler3D sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) vec3 dPdx)\n" + " (declare (in) vec3 dPdy))\n" " ())\n" - " (signature vec2\n" + " (signature ivec4\n" " (parameters\n" - " (declare (in) vec2 x))\n" + " (declare (in) isampler3D sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) vec3 dPdx)\n" + " (declare (in) vec3 dPdy))\n" " ())\n" - " (signature vec3\n" + " (signature uvec4\n" " (parameters\n" - " (declare (in) vec3 x))\n" + " (declare (in) usampler3D sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) vec3 dPdx)\n" + " (declare (in) vec3 dPdy))\n" " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in) vec4 x))\n" - " ()))\n" - "(function ftransform\n" - " (signature vec4\n" - " (parameters)\n" - " ()))\n" - "(function faceforward\n" - " (signature float\n" - " (parameters\n" - " (declare (in) float N)\n" - " (declare (in) float I)\n" - " (declare (in) float Nref))\n" + " (declare (in) samplerCube sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) vec3 dPdx)\n" + " (declare (in) vec3 dPdy))\n" " ())\n" - " (signature vec2\n" + " (signature ivec4\n" " (parameters\n" - " (declare (in) vec2 N)\n" - " (declare (in) vec2 I)\n" - " (declare (in) vec2 Nref))\n" + " (declare (in) isamplerCube sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) vec3 dPdx)\n" + " (declare (in) vec3 dPdy))\n" " ())\n" - " (signature vec3\n" + " (signature uvec4\n" " (parameters\n" - " (declare (in) vec3 N)\n" - " (declare (in) vec3 I)\n" - " (declare (in) vec3 Nref))\n" + " (declare (in) usamplerCube sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) vec3 dPdx)\n" + " (declare (in) vec3 dPdy))\n" " ())\n" - " (signature vec4\n" - " (parameters\n" - " (declare (in) vec4 N)\n" - " (declare (in) vec4 I)\n" - " (declare (in) vec4 Nref))\n" - " ()))\n" - "(function reflect\n" " (signature float\n" " (parameters\n" - " (declare (in) float I)\n" - " (declare (in) float N))\n" + " (declare (in) sampler1DShadow sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float dPdx)\n" + " (declare (in) float dPdy))\n" " ())\n" - " (signature vec2\n" + " (signature float\n" " (parameters\n" - " (declare (in) vec2 I)\n" - " (declare (in) vec2 N))\n" + " (declare (in) sampler2DShadow sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) vec2 dPdx)\n" + " (declare (in) vec2 dPdy))\n" " ())\n" - " (signature vec3\n" + " (signature float\n" " (parameters\n" - " (declare (in) vec3 I)\n" - " (declare (in) vec3 N))\n" + " (declare (in) samplerCubeShadow sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) vec3 dPdx)\n" + " (declare (in) vec3 dPdy))\n" " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in) vec4 I)\n" - " (declare (in) vec4 N))\n" - " ()))\n" - "(function refract\n" - " (signature float\n" - " (parameters\n" - " (declare (in) float I)\n" - " (declare (in) float N)\n" - " (declare (in) float eta))\n" + " (declare (in) sampler1DArray sampler)\n" + " (declare (in) vec2 P)\n" + " (declare (in) float dPdx)\n" + " (declare (in) float dPdy))\n" " ())\n" - " (signature vec2\n" + " (signature ivec4\n" " (parameters\n" - " (declare (in) vec2 I)\n" - " (declare (in) vec2 N)\n" - " (declare (in) float eta))\n" + " (declare (in) isampler1DArray sampler)\n" + " (declare (in) vec2 P)\n" + " (declare (in) float dPdx)\n" + " (declare (in) float dPdy))\n" " ())\n" - " (signature vec3\n" + " (signature uvec4\n" " (parameters\n" - " (declare (in) vec3 I)\n" - " (declare (in) vec3 N)\n" - " (declare (in) float eta))\n" + " (declare (in) usampler1DArray sampler)\n" + " (declare (in) vec2 P)\n" + " (declare (in) float dPdx)\n" + " (declare (in) float dPdy))\n" " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in) vec4 I)\n" - " (declare (in) vec4 N)\n" - " (declare (in) float eta))\n" - " ()))\n" - "(function matrixCompMult\n" - " (signature mat2\n" - " (parameters\n" - " (declare (in) mat2 x)\n" - " (declare (in) mat2 y))\n" + " (declare (in) sampler2DArray sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) vec2 dPdx)\n" + " (declare (in) vec2 dPdy))\n" " ())\n" - " (signature mat3\n" + " (signature ivec4\n" " (parameters\n" - " (declare (in) mat3 x)\n" - " (declare (in) mat3 y))\n" + " (declare (in) isampler2DArray sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) vec2 dPdx)\n" + " (declare (in) vec2 dPdy))\n" " ())\n" - " (signature mat4\n" + " (signature uvec4\n" " (parameters\n" - " (declare (in) mat4 x)\n" - " (declare (in) mat4 y))\n" + " (declare (in) usampler2DArray sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) vec2 dPdx)\n" + " (declare (in) vec2 dPdy))\n" " ())\n" - " (signature mat2x3\n" + " (signature float\n" " (parameters\n" - " (declare (in) mat2x3 x)\n" - " (declare (in) mat2x3 y))\n" + " (declare (in) sampler1DArrayShadow sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float dPdx)\n" + " (declare (in) float dPdy))\n" " ())\n" - " (signature mat2x4\n" + " (signature float\n" " (parameters\n" - " (declare (in) mat2x4 x)\n" - " (declare (in) mat2x4 y))\n" - " ())\n" - " (signature mat3x2\n" + " (declare (in) sampler2DArrayShadow sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) vec2 dPdx)\n" + " (declare (in) vec2 dPdy))\n" + " ()))\n" + "(function textureProjGrad\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) mat3x2 x)\n" - " (declare (in) mat3x2 y))\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) vec2 P)\n" + " (declare (in) float dPdx)\n" + " (declare (in) float dPdy))\n" " ())\n" - " (signature mat3x4\n" + " (signature ivec4\n" " (parameters\n" - " (declare (in) mat3x4 x)\n" - " (declare (in) mat3x4 y))\n" + " (declare (in) isampler1D sampler)\n" + " (declare (in) vec2 P)\n" + " (declare (in) float dPdx)\n" + " (declare (in) float dPdy))\n" " ())\n" - " (signature mat4x2\n" + " (signature uvec4\n" " (parameters\n" - " (declare (in) mat4x2 x)\n" - " (declare (in) mat4x2 y))\n" + " (declare (in) usampler1D sampler)\n" + " (declare (in) vec2 P)\n" + " (declare (in) float dPdx)\n" + " (declare (in) float dPdy))\n" " ())\n" - " (signature mat4x3\n" - " (parameters\n" - " (declare (in) mat4x3 x)\n" - " (declare (in) mat4x3 y))\n" - " ()))\n" - "(function outerProduct\n" - " (signature mat2\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) vec2 c)\n" - " (declare (in) vec2 r))\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) float dPdx)\n" + " (declare (in) float dPdy))\n" " ())\n" - " (signature mat3\n" + " (signature ivec4\n" " (parameters\n" - " (declare (in) vec3 c)\n" - " (declare (in) vec3 r))\n" + " (declare (in) isampler1D sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) float dPdx)\n" + " (declare (in) float dPdy))\n" " ())\n" - " (signature mat4\n" + " (signature uvec4\n" " (parameters\n" - " (declare (in) vec4 c)\n" - " (declare (in) vec4 r))\n" + " (declare (in) usampler1D sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) float dPdx)\n" + " (declare (in) float dPdy))\n" " ())\n" - " (signature mat2x3\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) vec3 c)\n" - " (declare (in) vec2 r))\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) vec2 dPdx)\n" + " (declare (in) vec2 dPdy))\n" " ())\n" - " (signature mat3x2\n" + " (signature ivec4\n" " (parameters\n" - " (declare (in) vec2 c)\n" - " (declare (in) vec3 r))\n" + " (declare (in) isampler2D sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) vec2 dPdx)\n" + " (declare (in) vec2 dPdy))\n" " ())\n" - " (signature mat2x4\n" + " (signature uvec4\n" " (parameters\n" - " (declare (in) vec4 c)\n" - " (declare (in) vec2 r))\n" + " (declare (in) usampler2D sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) vec2 dPdx)\n" + " (declare (in) vec2 dPdy))\n" " ())\n" - " (signature mat4x2\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) vec2 c)\n" - " (declare (in) vec4 r))\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) vec2 dPdx)\n" + " (declare (in) vec2 dPdy))\n" " ())\n" - " (signature mat3x4\n" + " (signature ivec4\n" " (parameters\n" - " (declare (in) vec4 c)\n" - " (declare (in) vec3 r))\n" + " (declare (in) isampler2D sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) vec2 dPdx)\n" + " (declare (in) vec2 dPdy))\n" " ())\n" - " (signature mat4x3\n" + " (signature uvec4\n" " (parameters\n" - " (declare (in) vec3 c)\n" - " (declare (in) vec4 r))\n" - " ()))\n" - "(function transpose\n" - " (signature mat2\n" + " (declare (in) usampler2D sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) vec2 dPdx)\n" + " (declare (in) vec2 dPdy))\n" + " ())\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) mat2 m))\n" + " (declare (in) sampler3D sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) vec3 dPdx)\n" + " (declare (in) vec3 dPdy))\n" " ())\n" - " (signature mat3\n" + " (signature ivec4\n" " (parameters\n" - " (declare (in) mat3 m))\n" + " (declare (in) isampler3D sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) vec3 dPdx)\n" + " (declare (in) vec3 dPdy))\n" " ())\n" - " (signature mat4\n" + " (signature uvec4\n" " (parameters\n" - " (declare (in) mat4 m))\n" + " (declare (in) usampler3D sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) vec3 dPdx)\n" + " (declare (in) vec3 dPdy))\n" " ())\n" - " (signature mat2x3\n" + " (signature float\n" " (parameters\n" - " (declare (in) mat3x2 m))\n" + " (declare (in) sampler1DShadow sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) float dPdx)\n" + " (declare (in) float dPdy))\n" " ())\n" - " (signature mat3x2\n" + " (signature float\n" " (parameters\n" - " (declare (in) mat2x3 m))\n" + " (declare (in) sampler2DShadow sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) vec2 dPdx)\n" + " (declare (in) vec2 dPdy))\n" + " ()))\n" + "(function texture1D\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) float coord))\n" " ())\n" - " (signature mat2x4\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) mat4x2 m))\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) float coord)\n" + " (declare (in) float bias))\n" + " ()))\n" + "(function texture1DProj\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) vec2 coord))\n" " ())\n" - " (signature mat4x2\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) mat2x4 m))\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) vec4 coord))\n" " ())\n" - " (signature mat3x4\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) mat4x3 m))\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) vec2 coord)\n" + " (declare (in) float bias))\n" " ())\n" - " (signature mat4x3\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) mat3x4 m))\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) vec4 coord)\n" + " (declare (in) float bias))\n" " ()))\n" - "(function lessThan\n" - " (signature bvec2\n" + "(function texture1DLod\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) vec2 x)\n" - " (declare (in) vec2 y))\n" - " ())\n" - " (signature bvec3\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) float coord)\n" + " (declare (in) float lod))\n" + " ()))\n" + "(function texture1DProjLod\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) vec3 x)\n" - " (declare (in) vec3 y))\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) vec2 coord)\n" + " (declare (in) float lod))\n" " ())\n" - " (signature bvec4\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) vec4 x)\n" - " (declare (in) vec4 y))\n" - " ())\n" - " (signature bvec2\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) vec4 coord)\n" + " (declare (in) float lod))\n" + " ()))\n" + "(function texture2D\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) ivec2 x)\n" - " (declare (in) ivec2 y))\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec2 coord))\n" " ())\n" - " (signature bvec3\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) ivec3 x)\n" - " (declare (in) ivec3 y))\n" - " ())\n" - " (signature bvec4\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec2 coord)\n" + " (declare (in) float bias))\n" + " ()))\n" + "(function texture2DProj\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) ivec4 x)\n" - " (declare (in) ivec4 y))\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec3 coord))\n" " ())\n" - " (signature bvec2\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) uvec2 x)\n" - " (declare (in) uvec2 y))\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec4 coord))\n" " ())\n" - " (signature bvec3\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) uvec3 x)\n" - " (declare (in) uvec3 y))\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec3 coord)\n" + " (declare (in) float bias))\n" " ())\n" - " (signature bvec4\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) uvec4 x)\n" - " (declare (in) uvec4 y))\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec4 coord)\n" + " (declare (in) float bias))\n" " ()))\n" - "(function lessThanEqual\n" - " (signature bvec2\n" + "(function texture2DLod\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) vec2 x)\n" - " (declare (in) vec2 y))\n" - " ())\n" - " (signature bvec3\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec2 coord)\n" + " (declare (in) float lod))\n" + " ()))\n" + "(function texture2DProjLod\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) vec3 x)\n" - " (declare (in) vec3 y))\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec3 coord)\n" + " (declare (in) float lod))\n" " ())\n" - " (signature bvec4\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) vec4 x)\n" - " (declare (in) vec4 y))\n" - " ())\n" - " (signature bvec2\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec4 coord)\n" + " (declare (in) float lod))\n" + " ()))\n" + "(function texture3D\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) ivec2 x)\n" - " (declare (in) ivec2 y))\n" + " (declare (in) sampler3D sampler)\n" + " (declare (in) vec3 coord))\n" " ())\n" - " (signature bvec3\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) ivec3 x)\n" - " (declare (in) ivec3 y))\n" - " ())\n" - " (signature bvec4\n" + " (declare (in) sampler3D sampler)\n" + " (declare (in) vec3 coord)\n" + " (declare (in) float bias))\n" + " ()))\n" + "(function texture3DProj\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) ivec4 x)\n" - " (declare (in) ivec4 y))\n" + " (declare (in) sampler3D sampler)\n" + " (declare (in) vec4 coord))\n" " ())\n" - " (signature bvec2\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) uvec2 x)\n" - " (declare (in) uvec2 y))\n" - " ())\n" - " (signature bvec3\n" + " (declare (in) sampler3D sampler)\n" + " (declare (in) vec4 coord)\n" + " (declare (in) float bias))\n" + " ()))\n" + "(function texture3DLod\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) uvec3 x)\n" - " (declare (in) uvec3 y))\n" - " ())\n" - " (signature bvec4\n" + " (declare (in) sampler3D sampler)\n" + " (declare (in) vec3 coord)\n" + " (declare (in) float lod))\n" + " ()))\n" + "(function texture3DProjLod\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) uvec4 x)\n" - " (declare (in) uvec4 y))\n" + " (declare (in) sampler3D sampler)\n" + " (declare (in) vec4 coord)\n" + " (declare (in) float lod))\n" " ()))\n" - "(function greaterThan\n" - " (signature bvec2\n" + "(function textureCube\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) vec2 x)\n" - " (declare (in) vec2 y))\n" + " (declare (in) samplerCube sampler)\n" + " (declare (in) vec3 coord))\n" " ())\n" - " (signature bvec3\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) vec3 x)\n" - " (declare (in) vec3 y))\n" - " ())\n" - " (signature bvec4\n" + " (declare (in) samplerCube sampler)\n" + " (declare (in) vec3 coord)\n" + " (declare (in) float bias))\n" + " ()))\n" + "(function textureCubeLod\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) vec4 x)\n" - " (declare (in) vec4 y))\n" - " ())\n" - " (signature bvec2\n" + " (declare (in) samplerCube sampler)\n" + " (declare (in) vec3 coord)\n" + " (declare (in) float lod))\n" + " ()))\n" + "(function shadow1D\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) ivec2 x)\n" - " (declare (in) ivec2 y))\n" + " (declare (in) sampler1DShadow sampler)\n" + " (declare (in) vec3 coord))\n" " ())\n" - " (signature bvec3\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) ivec3 x)\n" - " (declare (in) ivec3 y))\n" - " ())\n" - " (signature bvec4\n" + " (declare (in) sampler1DShadow sampler)\n" + " (declare (in) vec3 coord)\n" + " (declare (in) float bias))\n" + " ()))\n" + "(function shadow2D\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) ivec4 x)\n" - " (declare (in) ivec4 y))\n" + " (declare (in) sampler2DShadow sampler)\n" + " (declare (in) vec3 coord))\n" " ())\n" - " (signature bvec2\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) uvec2 x)\n" - " (declare (in) uvec2 y))\n" + " (declare (in) sampler2DShadow sampler)\n" + " (declare (in) vec3 coord)\n" + " (declare (in) float bias))\n" + " ()))\n" + "(function shadow1DProj\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1DShadow sampler)\n" + " (declare (in) vec4 coord))\n" " ())\n" - " (signature bvec3\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) uvec3 x)\n" - " (declare (in) uvec3 y))\n" + " (declare (in) sampler1DShadow sampler)\n" + " (declare (in) vec4 coord)\n" + " (declare (in) float bias))\n" + " ()))\n" + "(function shadow2DProj\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2DShadow sampler)\n" + " (declare (in) vec4 coord))\n" " ())\n" - " (signature bvec4\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2DShadow sampler)\n" + " (declare (in) vec4 coord)\n" + " (declare (in) float bias))\n" + " ()))\n" + "(function shadow1DLod\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1DShadow sampler)\n" + " (declare (in) vec3 coord)\n" + " (declare (in) float lod))\n" + " ()))\n" + "(function shadow2DLod\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) uvec4 x)\n" - " (declare (in) uvec4 y))\n" + " (declare (in) sampler2DShadow sampler)\n" + " (declare (in) vec3 coord)\n" + " (declare (in) float lod))\n" " ()))\n" - "(function greaterThanEqual\n" - " (signature bvec2\n" + "(function shadow1DProjLod\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) vec2 x)\n" - " (declare (in) vec2 y))\n" - " ())\n" - " (signature bvec3\n" + " (declare (in) sampler1DShadow sampler)\n" + " (declare (in) vec4 coord)\n" + " (declare (in) float lod))\n" + " ()))\n" + "(function shadow2DProjLod\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) vec3 x)\n" - " (declare (in) vec3 y))\n" - " ())\n" - " (signature bvec4\n" + " (declare (in) sampler2DShadow sampler)\n" + " (declare (in) vec4 coord)\n" + " (declare (in) float lod))\n" + " ()))\n" + "(function dFdx\n" + " (signature float\n" " (parameters\n" - " (declare (in) vec4 x)\n" - " (declare (in) vec4 y))\n" + " (declare (in) float p))\n" " ())\n" - " (signature bvec2\n" + " (signature vec2\n" " (parameters\n" - " (declare (in) ivec2 x)\n" - " (declare (in) ivec2 y))\n" + " (declare (in) vec2 p))\n" " ())\n" - " (signature bvec3\n" + " (signature vec3\n" " (parameters\n" - " (declare (in) ivec3 x)\n" - " (declare (in) ivec3 y))\n" + " (declare (in) vec3 p))\n" " ())\n" - " (signature bvec4\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) ivec4 x)\n" - " (declare (in) ivec4 y))\n" + " (declare (in) vec4 p))\n" + " ()))\n" + "(function dFdy\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float p))\n" " ())\n" - " (signature bvec2\n" + " (signature vec2\n" " (parameters\n" - " (declare (in) uvec2 x)\n" - " (declare (in) uvec2 y))\n" + " (declare (in) vec2 p))\n" " ())\n" - " (signature bvec3\n" + " (signature vec3\n" " (parameters\n" - " (declare (in) uvec3 x)\n" - " (declare (in) uvec3 y))\n" + " (declare (in) vec3 p))\n" " ())\n" - " (signature bvec4\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) uvec4 x)\n" - " (declare (in) uvec4 y))\n" + " (declare (in) vec4 p))\n" " ()))\n" - "(function equal\n" - " (signature bvec2\n" + "(function fwidth\n" + " (signature float\n" " (parameters\n" - " (declare (in) vec2 x)\n" - " (declare (in) vec2 y))\n" + " (declare (in) float p))\n" " ())\n" - " (signature bvec3\n" + " (signature vec2\n" " (parameters\n" - " (declare (in) vec3 x)\n" - " (declare (in) vec3 y))\n" + " (declare (in) vec2 p))\n" " ())\n" - " (signature bvec4\n" + " (signature vec3\n" " (parameters\n" - " (declare (in) vec4 x)\n" - " (declare (in) vec4 y))\n" + " (declare (in) vec3 p))\n" " ())\n" - " (signature bvec2\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) ivec2 x)\n" - " (declare (in) ivec2 y))\n" - " ())\n" - " (signature bvec3\n" + " (declare (in) vec4 p))\n" + " ()))\n" + "(function noise1\n" + " (signature float\n" " (parameters\n" - " (declare (in) ivec3 x)\n" - " (declare (in) ivec3 y))\n" + " (declare (in) float x))\n" " ())\n" - " (signature bvec4\n" + " (signature float\n" " (parameters\n" - " (declare (in) ivec4 x)\n" - " (declare (in) ivec4 y))\n" + " (declare (in) vec2 x))\n" " ())\n" - " (signature bvec2\n" + " (signature float\n" " (parameters\n" - " (declare (in) uvec2 x)\n" - " (declare (in) uvec2 y))\n" + " (declare (in) vec3 x))\n" " ())\n" - " (signature bvec3\n" + " (signature float\n" " (parameters\n" - " (declare (in) uvec3 x)\n" - " (declare (in) uvec3 y))\n" - " ())\n" - " (signature bvec4\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function noise2\n" + " (signature vec2\n" " (parameters\n" - " (declare (in) uvec4 x)\n" - " (declare (in) uvec4 y))\n" + " (declare (in) float x))\n" " ())\n" - " (signature bvec2\n" + " (signature vec2\n" " (parameters\n" - " (declare (in) bvec2 x)\n" - " (declare (in) bvec2 y))\n" + " (declare (in) vec2 x))\n" " ())\n" - " (signature bvec3\n" + " (signature vec2\n" " (parameters\n" - " (declare (in) bvec3 x)\n" - " (declare (in) bvec3 y))\n" + " (declare (in) vec3 x))\n" " ())\n" - " (signature bvec4\n" + " (signature vec2\n" " (parameters\n" - " (declare (in) bvec4 x)\n" - " (declare (in) bvec4 y))\n" + " (declare (in) vec4 x))\n" " ()))\n" - "(function notEqual\n" - " (signature bvec2\n" + "(function noise3\n" + " (signature vec3\n" " (parameters\n" - " (declare (in) vec2 x)\n" - " (declare (in) vec2 y))\n" + " (declare (in) float x))\n" " ())\n" - " (signature bvec3\n" + " (signature vec3\n" " (parameters\n" - " (declare (in) vec3 x)\n" - " (declare (in) vec3 y))\n" + " (declare (in) vec2 x))\n" " ())\n" - " (signature bvec4\n" + " (signature vec3\n" " (parameters\n" - " (declare (in) vec4 x)\n" - " (declare (in) vec4 y))\n" + " (declare (in) vec3 x))\n" " ())\n" - " (signature bvec2\n" + " (signature vec3\n" " (parameters\n" - " (declare (in) ivec2 x)\n" - " (declare (in) ivec2 y))\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function noise4\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) float x))\n" " ())\n" - " (signature bvec3\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) ivec3 x)\n" - " (declare (in) ivec3 y))\n" + " (declare (in) vec2 x))\n" " ())\n" - " (signature bvec4\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) ivec4 x)\n" - " (declare (in) ivec4 y))\n" + " (declare (in) vec3 x))\n" " ())\n" - " (signature bvec2\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x))\n" + " ())))" +; +static const char *functions_for_130_frag [] = { + builtin_abs, + builtin_acos, + builtin_all, + builtin_any, + builtin_asin, + builtin_atan, + builtin_ceil, + builtin_clamp, + builtin_cos, + builtin_cosh, + builtin_cross, + builtin_dFdx, + builtin_dFdy, + builtin_degrees, + builtin_distance, + builtin_dot, + builtin_equal, + builtin_exp, + builtin_exp2, + builtin_faceforward, + builtin_floor, + builtin_fract, + builtin_fwidth, + builtin_greaterThan, + builtin_greaterThanEqual, + builtin_inversesqrt, + builtin_length, + builtin_lessThan, + builtin_lessThanEqual, + builtin_log, + builtin_log2, + builtin_matrixCompMult, + builtin_max, + builtin_min, + builtin_mix, + builtin_mod, + builtin_noise1, + builtin_noise2, + builtin_noise3, + builtin_noise4, + builtin_normalize, + builtin_not, + builtin_notEqual, + builtin_outerProduct, + builtin_pow, + builtin_radians, + builtin_reflect, + builtin_refract, + builtin_shadow1D, + builtin_shadow1DLod, + builtin_shadow1DProj, + builtin_shadow1DProjLod, + builtin_shadow2D, + builtin_shadow2DLod, + builtin_shadow2DProj, + builtin_shadow2DProjLod, + builtin_sign, + builtin_sin, + builtin_sinh, + builtin_smoothstep, + builtin_sqrt, + builtin_step, + builtin_tan, + builtin_tanh, + builtin_texelFetch, + builtin_texture, + builtin_texture1D, + builtin_texture1DLod, + builtin_texture1DProj, + builtin_texture1DProjLod, + builtin_texture2D, + builtin_texture2DLod, + builtin_texture2DProj, + builtin_texture2DProjLod, + builtin_texture3D, + builtin_texture3DLod, + builtin_texture3DProj, + builtin_texture3DProjLod, + builtin_textureCube, + builtin_textureCubeLod, + builtin_textureGrad, + builtin_textureLod, + builtin_textureProj, + builtin_textureProjGrad, + builtin_textureProjLod, + builtin_transpose, +}; +static const char *prototypes_for_130_vert = + "(\n" + "(function radians\n" + " (signature float\n" " (parameters\n" - " (declare (in) uvec2 x)\n" - " (declare (in) uvec2 y))\n" + " (declare (in) float degrees))\n" " ())\n" - " (signature bvec3\n" + " (signature vec2\n" " (parameters\n" - " (declare (in) uvec3 x)\n" - " (declare (in) uvec3 y))\n" + " (declare (in) vec2 degrees))\n" " ())\n" - " (signature bvec4\n" + " (signature vec3\n" " (parameters\n" - " (declare (in) uvec4 x)\n" - " (declare (in) uvec4 y))\n" + " (declare (in) vec3 degrees))\n" " ())\n" - " (signature bvec2\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) bvec2 x)\n" - " (declare (in) bvec2 y))\n" - " ())\n" - " (signature bvec3\n" + " (declare (in) vec4 degrees))\n" + " ()))\n" + "(function degrees\n" + " (signature float\n" " (parameters\n" - " (declare (in) bvec3 x)\n" - " (declare (in) bvec3 y))\n" + " (declare (in) float radians))\n" " ())\n" - " (signature bvec4\n" - " (parameters\n" - " (declare (in) bvec4 x)\n" - " (declare (in) bvec4 y))\n" - " ()))\n" - "(function any\n" - " (signature bool\n" + " (signature vec2\n" " (parameters\n" - " (declare (in) bvec2 x))\n" + " (declare (in) vec2 radians))\n" " ())\n" - " (signature bool\n" + " (signature vec3\n" " (parameters\n" - " (declare (in) bvec3 x))\n" + " (declare (in) vec3 radians))\n" " ())\n" - " (signature bool\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) bvec4 x))\n" + " (declare (in) vec4 radians))\n" " ()))\n" - "(function all\n" - " (signature bool\n" - " (parameters\n" - " (declare (in) bvec2 x))\n" - " ())\n" - " (signature bool\n" + "(function sin\n" + " (signature float\n" " (parameters\n" - " (declare (in) bvec3 x))\n" + " (declare (in) float angle))\n" " ())\n" - " (signature bool\n" - " (parameters\n" - " (declare (in) bvec4 x))\n" - " ()))\n" - "(function not\n" - " (signature bvec2\n" + " (signature vec2\n" " (parameters\n" - " (declare (in) bvec2 x))\n" + " (declare (in) vec2 angle))\n" " ())\n" - " (signature bvec3\n" + " (signature vec3\n" " (parameters\n" - " (declare (in) bvec3 x))\n" + " (declare (in) vec3 angle))\n" " ())\n" - " (signature bvec4\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) bvec4 x))\n" + " (declare (in) vec4 angle))\n" " ()))\n" - "(function texture\n" - " (signature vec4\n" + "(function cos\n" + " (signature float\n" " (parameters\n" - " (declare (in) sampler1D sampler)\n" - " (declare (in) float P))\n" + " (declare (in) float angle))\n" " ())\n" - " (signature ivec4\n" + " (signature vec2\n" " (parameters\n" - " (declare (in) isampler1D sampler)\n" - " (declare (in) float P))\n" + " (declare (in) vec2 angle))\n" " ())\n" - " (signature uvec4\n" + " (signature vec3\n" " (parameters\n" - " (declare (in) usampler1D sampler)\n" - " (declare (in) float P))\n" + " (declare (in) vec3 angle))\n" " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in) sampler2D sampler)\n" - " (declare (in) vec2 P))\n" - " ())\n" - " (signature ivec4\n" - " (parameters\n" - " (declare (in) isampler2D sampler)\n" - " (declare (in) vec2 P))\n" - " ())\n" - " (signature uvec4\n" - " (parameters\n" - " (declare (in) usampler2D sampler)\n" - " (declare (in) vec2 P))\n" - " ())\n" - " (signature vec4\n" + " (declare (in) vec4 angle))\n" + " ()))\n" + "(function tan\n" + " (signature float\n" " (parameters\n" - " (declare (in) sampler3D sampler)\n" - " (declare (in) vec3 P))\n" + " (declare (in) float angle))\n" " ())\n" - " (signature ivec4\n" + " (signature vec2\n" " (parameters\n" - " (declare (in) isampler3D sampler)\n" - " (declare (in) vec3 P))\n" + " (declare (in) vec2 angle))\n" " ())\n" - " (signature uvec4\n" + " (signature vec3\n" " (parameters\n" - " (declare (in) usampler3D sampler)\n" - " (declare (in) vec3 P))\n" + " (declare (in) vec3 angle))\n" " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in) samplerCube sampler)\n" - " (declare (in) vec3 P))\n" - " ())\n" - " (signature ivec4\n" - " (parameters\n" - " (declare (in) isamplerCube sampler)\n" - " (declare (in) vec3 P))\n" - " ())\n" - " (signature uvec4\n" - " (parameters\n" - " (declare (in) usamplerCube sampler)\n" - " (declare (in) vec3 P))\n" - " ())\n" + " (declare (in) vec4 angle))\n" + " ()))\n" + "(function asin\n" " (signature float\n" " (parameters\n" - " (declare (in) sampler1DShadow sampler)\n" - " (declare (in) vec3 P))\n" + " (declare (in) float angle))\n" " ())\n" - " (signature float\n" + " (signature vec2\n" " (parameters\n" - " (declare (in) sampler2DShadow sampler)\n" - " (declare (in) vec3 P))\n" + " (declare (in) vec2 angle))\n" " ())\n" - " (signature float\n" + " (signature vec3\n" " (parameters\n" - " (declare (in) samplerCubeShadow sampler)\n" - " (declare (in) vec4 P))\n" + " (declare (in) vec3 angle))\n" " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in) sampler1DArray sampler)\n" - " (declare (in) vec2 P))\n" - " ())\n" - " (signature ivec4\n" - " (parameters\n" - " (declare (in) isampler1DArray sampler)\n" - " (declare (in) vec2 P))\n" - " ())\n" - " (signature uvec4\n" - " (parameters\n" - " (declare (in) usampler1DArray sampler)\n" - " (declare (in) vec2 P))\n" - " ())\n" - " (signature vec4\n" + " (declare (in) vec4 angle))\n" + " ()))\n" + "(function acos\n" + " (signature float\n" " (parameters\n" - " (declare (in) sampler2DArray sampler)\n" - " (declare (in) vec3 P))\n" + " (declare (in) float angle))\n" " ())\n" - " (signature ivec4\n" + " (signature vec2\n" " (parameters\n" - " (declare (in) isampler2DArray sampler)\n" - " (declare (in) vec3 P))\n" + " (declare (in) vec2 angle))\n" " ())\n" - " (signature uvec4\n" + " (signature vec3\n" " (parameters\n" - " (declare (in) usampler2DArray sampler)\n" - " (declare (in) vec3 P))\n" + " (declare (in) vec3 angle))\n" " ())\n" - " (signature float\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) sampler1DArrayShadow sampler)\n" - " (declare (in) vec3 P))\n" - " ())\n" + " (declare (in) vec4 angle))\n" + " ()))\n" + "(function atan\n" " (signature float\n" " (parameters\n" - " (declare (in) sampler2DArrayShadow sampler)\n" - " (declare (in) vec4 P))\n" - " ())\n" - " (signature vec4\n" - " (parameters\n" - " (declare (in) sampler1D sampler)\n" - " (declare (in) float P)\n" - " (declare (in) float bias))\n" + " (declare (in) float y)\n" + " (declare (in) float x))\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" + " (declare (in) vec2 y)\n" + " (declare (in) vec2 x))\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" + " (declare (in) vec3 y)\n" + " (declare (in) vec3 x))\n" " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in) sampler2D sampler)\n" - " (declare (in) vec2 P)\n" - " (declare (in) float bias))\n" - " ())\n" - " (signature ivec4\n" - " (parameters\n" - " (declare (in) isampler2D sampler)\n" - " (declare (in) vec2 P)\n" - " (declare (in) float bias))\n" - " ())\n" - " (signature uvec4\n" - " (parameters\n" - " (declare (in) usampler2D sampler)\n" - " (declare (in) vec2 P)\n" - " (declare (in) float bias))\n" + " (declare (in) vec4 y)\n" + " (declare (in) vec4 x))\n" " ())\n" - " (signature vec4\n" + " (signature float\n" " (parameters\n" - " (declare (in) sampler3D sampler)\n" - " (declare (in) vec3 P)\n" - " (declare (in) float bias))\n" + " (declare (in) float y_over_x))\n" " ())\n" - " (signature ivec4\n" - " (parameters\n" - " (declare (in) isampler3D sampler)\n" - " (declare (in) vec3 P)\n" - " (declare (in) float bias))\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 y_over_x))\n" " ())\n" - " (signature uvec4\n" + " (signature vec3\n" " (parameters\n" - " (declare (in) usampler3D sampler)\n" - " (declare (in) vec3 P)\n" - " (declare (in) float bias))\n" + " (declare (in) vec3 y_over_x))\n" " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in) samplerCube sampler)\n" - " (declare (in) vec3 P)\n" - " (declare (in) float bias))\n" + " (declare (in) vec4 y_over_x))\n" + " ()))\n" + "(function sinh\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x))\n" " ())\n" - " (signature ivec4\n" + " (signature vec2\n" " (parameters\n" - " (declare (in) isamplerCube sampler)\n" - " (declare (in) vec3 P)\n" - " (declare (in) float bias))\n" + " (declare (in) vec2 x))\n" " ())\n" - " (signature uvec4\n" + " (signature vec3\n" " (parameters\n" - " (declare (in) usamplerCube sampler)\n" - " (declare (in) vec3 P)\n" - " (declare (in) float bias))\n" + " (declare (in) vec3 x))\n" " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function cosh\n" " (signature float\n" " (parameters\n" - " (declare (in) sampler1DShadow sampler)\n" - " (declare (in) vec3 P)\n" - " (declare (in) float bias))\n" + " (declare (in) float x))\n" " ())\n" - " (signature float\n" + " (signature vec2\n" " (parameters\n" - " (declare (in) sampler2DShadow sampler)\n" - " (declare (in) vec3 P)\n" - " (declare (in) float bias))\n" + " (declare (in) vec2 x))\n" " ())\n" - " (signature float\n" + " (signature vec3\n" " (parameters\n" - " (declare (in) samplerCubeShadow sampler)\n" - " (declare (in) vec4 P)\n" - " (declare (in) float bias))\n" + " (declare (in) vec3 x))\n" " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in) sampler1DArray sampler)\n" - " (declare (in) vec2 P)\n" - " (declare (in) float bias))\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function tanh\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x))\n" " ())\n" - " (signature ivec4\n" + " (signature vec2\n" " (parameters\n" - " (declare (in) isampler1DArray sampler)\n" - " (declare (in) vec2 P)\n" - " (declare (in) float bias))\n" + " (declare (in) vec2 x))\n" " ())\n" - " (signature uvec4\n" + " (signature vec3\n" " (parameters\n" - " (declare (in) usampler1DArray sampler)\n" - " (declare (in) vec2 P)\n" - " (declare (in) float bias))\n" + " (declare (in) vec3 x))\n" " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in) sampler2DArray sampler)\n" - " (declare (in) vec3 P)\n" - " (declare (in) float bias))\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function pow\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x)\n" + " (declare (in) float y))\n" " ())\n" - " (signature ivec4\n" + " (signature vec2\n" " (parameters\n" - " (declare (in) isampler2DArray sampler)\n" - " (declare (in) vec3 P)\n" - " (declare (in) float bias))\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" " ())\n" - " (signature uvec4\n" + " (signature vec3\n" " (parameters\n" - " (declare (in) usampler2DArray sampler)\n" - " (declare (in) vec3 P)\n" - " (declare (in) float bias))\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" " ())\n" - " (signature float\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) sampler1DArrayShadow sampler)\n" - " (declare (in) vec3 P)\n" - " (declare (in) float bias))\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" " ()))\n" - "(function textureProj\n" - " (signature vec4\n" + "(function exp\n" + " (signature float\n" " (parameters\n" - " (declare (in) sampler1D sampler)\n" - " (declare (in) vec2 P))\n" + " (declare (in) float x))\n" " ())\n" - " (signature ivec4\n" + " (signature vec2\n" " (parameters\n" - " (declare (in) isampler1D sampler)\n" - " (declare (in) vec2 P))\n" + " (declare (in) vec2 x))\n" " ())\n" - " (signature uvec4\n" + " (signature vec3\n" " (parameters\n" - " (declare (in) usampler1D sampler)\n" - " (declare (in) vec2 P))\n" + " (declare (in) vec3 x))\n" " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in) sampler1D sampler)\n" - " (declare (in) vec4 P))\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function log\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x))\n" " ())\n" - " (signature ivec4\n" + " (signature vec2\n" " (parameters\n" - " (declare (in) isampler1D sampler)\n" - " (declare (in) vec4 P))\n" + " (declare (in) vec2 x))\n" " ())\n" - " (signature uvec4\n" + " (signature vec3\n" " (parameters\n" - " (declare (in) usampler1D sampler)\n" - " (declare (in) vec4 P))\n" + " (declare (in) vec3 x))\n" " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in) sampler2D sampler)\n" - " (declare (in) vec3 P))\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function exp2\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x))\n" " ())\n" - " (signature ivec4\n" + " (signature vec2\n" " (parameters\n" - " (declare (in) isampler2D sampler)\n" - " (declare (in) vec3 P))\n" + " (declare (in) vec2 x))\n" " ())\n" - " (signature uvec4\n" + " (signature vec3\n" " (parameters\n" - " (declare (in) usampler2D sampler)\n" - " (declare (in) vec3 P))\n" + " (declare (in) vec3 x))\n" " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in) sampler2D sampler)\n" - " (declare (in) vec4 P))\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function log2\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x))\n" " ())\n" - " (signature ivec4\n" + " (signature vec2\n" " (parameters\n" - " (declare (in) isampler2D sampler)\n" - " (declare (in) vec4 P))\n" + " (declare (in) vec2 x))\n" " ())\n" - " (signature uvec4\n" + " (signature vec3\n" " (parameters\n" - " (declare (in) usampler2D sampler)\n" - " (declare (in) vec4 P))\n" + " (declare (in) vec3 x))\n" " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in) sampler3D sampler)\n" - " (declare (in) vec4 P))\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function sqrt\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x))\n" " ())\n" - " (signature ivec4\n" + " (signature vec2\n" " (parameters\n" - " (declare (in) isampler3D sampler)\n" - " (declare (in) vec4 P))\n" + " (declare (in) vec2 x))\n" " ())\n" - " (signature uvec4\n" + " (signature vec3\n" " (parameters\n" - " (declare (in) usampler3D sampler)\n" - " (declare (in) vec4 P))\n" + " (declare (in) vec3 x))\n" " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function inversesqrt\n" " (signature float\n" " (parameters\n" - " (declare (in) sampler1DShadow sampler)\n" - " (declare (in) vec4 P))\n" + " (declare (in) float x))\n" " ())\n" - " (signature float\n" + " (signature vec2\n" " (parameters\n" - " (declare (in) sampler2DShadow sampler)\n" - " (declare (in) vec4 P))\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x))\n" " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in) sampler1D sampler)\n" - " (declare (in) vec2 P)\n" - " (declare (in) float bias))\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function abs\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x))\n" " ())\n" - " (signature ivec4\n" + " (signature vec2\n" " (parameters\n" - " (declare (in) isampler1D sampler)\n" - " (declare (in) vec2 P)\n" - " (declare (in) float bias))\n" + " (declare (in) vec2 x))\n" " ())\n" - " (signature uvec4\n" + " (signature vec3\n" " (parameters\n" - " (declare (in) usampler1D sampler)\n" - " (declare (in) vec2 P)\n" - " (declare (in) float bias))\n" + " (declare (in) vec3 x))\n" " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in) sampler1D sampler)\n" - " (declare (in) vec4 P)\n" - " (declare (in) float bias))\n" + " (declare (in) vec4 x))\n" " ())\n" - " (signature ivec4\n" + " (signature int\n" " (parameters\n" - " (declare (in) isampler1D sampler)\n" - " (declare (in) vec4 P)\n" - " (declare (in) float bias))\n" + " (declare (in) int x))\n" " ())\n" - " (signature uvec4\n" + " (signature ivec2\n" " (parameters\n" - " (declare (in) usampler1D sampler)\n" - " (declare (in) vec4 P)\n" - " (declare (in) float bias))\n" + " (declare (in) ivec2 x))\n" " ())\n" - " (signature vec4\n" + " (signature ivec3\n" + " (parameters\n" + " (declare (in) ivec3 x))\n" + " ())\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) ivec4 x))\n" + " ()))\n" + "(function sign\n" + " (signature float\n" " (parameters\n" - " (declare (in) sampler2D sampler)\n" - " (declare (in) vec3 P)\n" - " (declare (in) float bias))\n" + " (declare (in) float x))\n" " ())\n" - " (signature ivec4\n" + " (signature vec2\n" " (parameters\n" - " (declare (in) isampler2D sampler)\n" - " (declare (in) vec3 P)\n" - " (declare (in) float bias))\n" + " (declare (in) vec2 x))\n" " ())\n" - " (signature uvec4\n" + " (signature vec3\n" " (parameters\n" - " (declare (in) usampler2D sampler)\n" - " (declare (in) vec3 P)\n" - " (declare (in) float bias))\n" + " (declare (in) vec3 x))\n" " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in) sampler2D sampler)\n" - " (declare (in) vec4 P)\n" - " (declare (in) float bias))\n" + " (declare (in) vec4 x))\n" " ())\n" - " (signature ivec4\n" + " (signature int\n" " (parameters\n" - " (declare (in) isampler2D sampler)\n" - " (declare (in) vec4 P)\n" - " (declare (in) float bias))\n" + " (declare (in) int x))\n" " ())\n" - " (signature uvec4\n" + " (signature ivec2\n" " (parameters\n" - " (declare (in) usampler2D sampler)\n" - " (declare (in) vec4 P)\n" - " (declare (in) float bias))\n" + " (declare (in) ivec2 x))\n" " ())\n" - " (signature vec4\n" + " (signature ivec3\n" " (parameters\n" - " (declare (in) sampler3D sampler)\n" - " (declare (in) vec4 P)\n" - " (declare (in) float bias))\n" + " (declare (in) ivec3 x))\n" " ())\n" " (signature ivec4\n" " (parameters\n" - " (declare (in) isampler3D sampler)\n" - " (declare (in) vec4 P)\n" - " (declare (in) float bias))\n" + " (declare (in) ivec4 x))\n" + " ()))\n" + "(function floor\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x))\n" " ())\n" - " (signature uvec4\n" + " (signature vec2\n" " (parameters\n" - " (declare (in) usampler3D sampler)\n" - " (declare (in) vec4 P)\n" - " (declare (in) float bias))\n" + " (declare (in) vec2 x))\n" " ())\n" - " (signature float\n" + " (signature vec3\n" " (parameters\n" - " (declare (in) sampler1DShadow sampler)\n" - " (declare (in) vec4 P)\n" - " (declare (in) float bias))\n" + " (declare (in) vec3 x))\n" " ())\n" - " (signature float\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) sampler2DShadow sampler)\n" - " (declare (in) vec4 P)\n" - " (declare (in) float bias))\n" + " (declare (in) vec4 x))\n" " ()))\n" - "(function textureLod\n" - " (signature vec4\n" + "(function ceil\n" + " (signature float\n" " (parameters\n" - " (declare (in) sampler1D sampler)\n" - " (declare (in) float P)\n" - " (declare (in) float lod))\n" + " (declare (in) float x))\n" " ())\n" - " (signature ivec4\n" + " (signature vec2\n" " (parameters\n" - " (declare (in) isampler1D sampler)\n" - " (declare (in) float P)\n" - " (declare (in) float lod))\n" + " (declare (in) vec2 x))\n" " ())\n" - " (signature uvec4\n" + " (signature vec3\n" " (parameters\n" - " (declare (in) usampler1D sampler)\n" - " (declare (in) float P)\n" - " (declare (in) float lod))\n" + " (declare (in) vec3 x))\n" " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in) sampler2D sampler)\n" - " (declare (in) vec2 P)\n" - " (declare (in) float lod))\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function fract\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x))\n" " ())\n" - " (signature ivec4\n" + " (signature vec2\n" " (parameters\n" - " (declare (in) isampler2D sampler)\n" - " (declare (in) vec2 P)\n" - " (declare (in) float lod))\n" + " (declare (in) vec2 x))\n" " ())\n" - " (signature uvec4\n" + " (signature vec3\n" " (parameters\n" - " (declare (in) usampler2D sampler)\n" - " (declare (in) vec2 P)\n" - " (declare (in) float lod))\n" + " (declare (in) vec3 x))\n" " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in) sampler3D sampler)\n" - " (declare (in) vec3 P)\n" - " (declare (in) float lod))\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function mod\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x)\n" + " (declare (in) float y))\n" " ())\n" - " (signature ivec4\n" + " (signature vec2\n" " (parameters\n" - " (declare (in) isampler3D sampler)\n" - " (declare (in) vec3 P)\n" - " (declare (in) float lod))\n" + " (declare (in) vec2 x)\n" + " (declare (in) float y))\n" " ())\n" - " (signature uvec4\n" + " (signature vec3\n" " (parameters\n" - " (declare (in) usampler3D sampler)\n" - " (declare (in) vec3 P)\n" - " (declare (in) float lod))\n" + " (declare (in) vec3 x)\n" + " (declare (in) float y))\n" " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in) samplerCube sampler)\n" - " (declare (in) vec3 P)\n" - " (declare (in) float lod))\n" + " (declare (in) vec4 x)\n" + " (declare (in) float y))\n" " ())\n" - " (signature ivec4\n" + " (signature vec2\n" " (parameters\n" - " (declare (in) isamplerCube sampler)\n" - " (declare (in) vec3 P)\n" - " (declare (in) float lod))\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" " ())\n" - " (signature uvec4\n" + " (signature vec3\n" " (parameters\n" - " (declare (in) usamplerCube sampler)\n" - " (declare (in) vec3 P)\n" - " (declare (in) float lod))\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" + " ()))\n" + "(function min\n" " (signature float\n" " (parameters\n" - " (declare (in) sampler1DShadow sampler)\n" - " (declare (in) vec3 P)\n" - " (declare (in) float lod))\n" + " (declare (in) float x)\n" + " (declare (in) float y))\n" " ())\n" - " (signature float\n" + " (signature vec2\n" " (parameters\n" - " (declare (in) sampler2DShadow sampler)\n" - " (declare (in) vec3 P)\n" - " (declare (in) float lod))\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in) sampler1DArray sampler)\n" - " (declare (in) vec2 P)\n" - " (declare (in) float lod))\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" " ())\n" - " (signature ivec4\n" + " (signature vec2\n" " (parameters\n" - " (declare (in) isampler1DArray sampler)\n" - " (declare (in) vec2 P)\n" - " (declare (in) float lod))\n" + " (declare (in) vec2 x)\n" + " (declare (in) float y))\n" " ())\n" - " (signature uvec4\n" + " (signature vec3\n" " (parameters\n" - " (declare (in) usampler1DArray sampler)\n" - " (declare (in) vec2 P)\n" - " (declare (in) float lod))\n" + " (declare (in) vec3 x)\n" + " (declare (in) float y))\n" " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in) sampler2DArray sampler)\n" - " (declare (in) vec3 P)\n" - " (declare (in) float lod))\n" + " (declare (in) vec4 x)\n" + " (declare (in) float y))\n" " ())\n" - " (signature ivec4\n" + " (signature int\n" " (parameters\n" - " (declare (in) isampler2DArray sampler)\n" - " (declare (in) vec3 P)\n" - " (declare (in) float lod))\n" + " (declare (in) int x)\n" + " (declare (in) int y))\n" " ())\n" - " (signature uvec4\n" + " (signature ivec2\n" " (parameters\n" - " (declare (in) usampler2DArray sampler)\n" - " (declare (in) vec3 P)\n" - " (declare (in) float lod))\n" + " (declare (in) ivec2 x)\n" + " (declare (in) ivec2 y))\n" " ())\n" - " (signature float\n" - " (parameters\n" - " (declare (in) sampler1DArrayShadow sampler)\n" - " (declare (in) vec3 P)\n" - " (declare (in) float lod))\n" - " ()))\n" - "(function texelFetch\n" - " (signature vec4\n" + " (signature ivec3\n" " (parameters\n" - " (declare (in) sampler1D sampler)\n" - " (declare (in) int P)\n" - " (declare (in) int lod))\n" + " (declare (in) ivec3 x)\n" + " (declare (in) ivec3 y))\n" " ())\n" " (signature ivec4\n" " (parameters\n" - " (declare (in) isampler1D sampler)\n" - " (declare (in) int P)\n" - " (declare (in) int lod))\n" + " (declare (in) ivec4 x)\n" + " (declare (in) ivec4 y))\n" " ())\n" - " (signature uvec4\n" + " (signature ivec2\n" " (parameters\n" - " (declare (in) usampler1D sampler)\n" - " (declare (in) int P)\n" - " (declare (in) int lod))\n" + " (declare (in) ivec2 x)\n" + " (declare (in) int y))\n" " ())\n" - " (signature vec4\n" + " (signature ivec3\n" " (parameters\n" - " (declare (in) sampler2D sampler)\n" - " (declare (in) ivec2 P)\n" - " (declare (in) int lod))\n" + " (declare (in) ivec3 x)\n" + " (declare (in) int y))\n" " ())\n" " (signature ivec4\n" " (parameters\n" - " (declare (in) isampler2D sampler)\n" - " (declare (in) ivec2 P)\n" - " (declare (in) int lod))\n" + " (declare (in) ivec4 x)\n" + " (declare (in) int y))\n" " ())\n" - " (signature uvec4\n" + " (signature uint\n" " (parameters\n" - " (declare (in) usampler2D sampler)\n" - " (declare (in) ivec2 P)\n" - " (declare (in) int lod))\n" + " (declare (in) uint x)\n" + " (declare (in) uint y))\n" " ())\n" - " (signature vec4\n" + " (signature uvec2\n" " (parameters\n" - " (declare (in) sampler3D sampler)\n" - " (declare (in) ivec3 P)\n" - " (declare (in) int lod))\n" + " (declare (in) uvec2 x)\n" + " (declare (in) uvec2 y))\n" " ())\n" - " (signature ivec4\n" + " (signature uvec3\n" " (parameters\n" - " (declare (in) isampler3D sampler)\n" - " (declare (in) ivec3 P)\n" - " (declare (in) int lod))\n" + " (declare (in) uvec3 x)\n" + " (declare (in) uvec3 y))\n" " ())\n" " (signature uvec4\n" " (parameters\n" - " (declare (in) usampler3D sampler)\n" - " (declare (in) ivec3 P)\n" - " (declare (in) int lod))\n" + " (declare (in) uvec4 x)\n" + " (declare (in) uvec4 y))\n" " ())\n" - " (signature vec4\n" + " (signature uvec2\n" " (parameters\n" - " (declare (in) sampler1DArray sampler)\n" - " (declare (in) ivec2 P)\n" - " (declare (in) int lod))\n" + " (declare (in) uvec2 x)\n" + " (declare (in) uint y))\n" " ())\n" - " (signature ivec4\n" + " (signature uvec3\n" " (parameters\n" - " (declare (in) isampler1DArray sampler)\n" - " (declare (in) ivec2 P)\n" - " (declare (in) int lod))\n" + " (declare (in) uvec3 x)\n" + " (declare (in) uint y))\n" " ())\n" " (signature uvec4\n" " (parameters\n" - " (declare (in) usampler1DArray sampler)\n" - " (declare (in) ivec2 P)\n" - " (declare (in) int lod))\n" - " ())\n" - " (signature vec4\n" + " (declare (in) uvec4 x)\n" + " (declare (in) uint y))\n" + " ()))\n" + "(function max\n" + " (signature float\n" " (parameters\n" - " (declare (in) sampler2DArray sampler)\n" - " (declare (in) ivec3 P)\n" - " (declare (in) int lod))\n" + " (declare (in) float x)\n" + " (declare (in) float y))\n" " ())\n" - " (signature ivec4\n" + " (signature vec2\n" " (parameters\n" - " (declare (in) isampler2DArray sampler)\n" - " (declare (in) ivec3 P)\n" - " (declare (in) int lod))\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" " ())\n" - " (signature uvec4\n" + " (signature vec3\n" " (parameters\n" - " (declare (in) usampler2DArray sampler)\n" - " (declare (in) ivec3 P)\n" - " (declare (in) int lod))\n" - " ()))\n" - "(function textureProjLod\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in) sampler1D sampler)\n" - " (declare (in) vec2 P)\n" - " (declare (in) float lod))\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" " ())\n" - " (signature ivec4\n" + " (signature vec2\n" " (parameters\n" - " (declare (in) isampler1D sampler)\n" - " (declare (in) vec2 P)\n" - " (declare (in) float lod))\n" + " (declare (in) vec2 x)\n" + " (declare (in) float y))\n" " ())\n" - " (signature uvec4\n" + " (signature vec3\n" " (parameters\n" - " (declare (in) usampler1D sampler)\n" - " (declare (in) vec2 P)\n" - " (declare (in) float lod))\n" + " (declare (in) vec3 x)\n" + " (declare (in) float y))\n" " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in) sampler1D sampler)\n" - " (declare (in) vec4 P)\n" - " (declare (in) float lod))\n" + " (declare (in) vec4 x)\n" + " (declare (in) float y))\n" " ())\n" - " (signature ivec4\n" + " (signature int\n" " (parameters\n" - " (declare (in) isampler1D sampler)\n" - " (declare (in) vec4 P)\n" - " (declare (in) float lod))\n" + " (declare (in) int x)\n" + " (declare (in) int y))\n" " ())\n" - " (signature uvec4\n" + " (signature ivec2\n" " (parameters\n" - " (declare (in) usampler1D sampler)\n" - " (declare (in) vec4 P)\n" - " (declare (in) float lod))\n" + " (declare (in) ivec2 x)\n" + " (declare (in) ivec2 y))\n" " ())\n" - " (signature vec4\n" + " (signature ivec3\n" " (parameters\n" - " (declare (in) sampler2D sampler)\n" - " (declare (in) vec3 P)\n" - " (declare (in) float lod))\n" + " (declare (in) ivec3 x)\n" + " (declare (in) ivec3 y))\n" " ())\n" " (signature ivec4\n" " (parameters\n" - " (declare (in) isampler2D sampler)\n" - " (declare (in) vec3 P)\n" - " (declare (in) float lod))\n" + " (declare (in) ivec4 x)\n" + " (declare (in) ivec4 y))\n" " ())\n" - " (signature uvec4\n" + " (signature ivec2\n" " (parameters\n" - " (declare (in) usampler2D sampler)\n" - " (declare (in) vec3 P)\n" - " (declare (in) float lod))\n" + " (declare (in) ivec2 x)\n" + " (declare (in) int y))\n" " ())\n" - " (signature vec4\n" + " (signature ivec3\n" " (parameters\n" - " (declare (in) sampler2D sampler)\n" - " (declare (in) vec4 P)\n" - " (declare (in) float lod))\n" + " (declare (in) ivec3 x)\n" + " (declare (in) int y))\n" " ())\n" " (signature ivec4\n" " (parameters\n" - " (declare (in) isampler2D sampler)\n" - " (declare (in) vec4 P)\n" - " (declare (in) float lod))\n" + " (declare (in) ivec4 x)\n" + " (declare (in) int y))\n" " ())\n" - " (signature uvec4\n" + " (signature uint\n" " (parameters\n" - " (declare (in) usampler2D sampler)\n" - " (declare (in) vec4 P)\n" - " (declare (in) float lod))\n" + " (declare (in) uint x)\n" + " (declare (in) uint y))\n" " ())\n" - " (signature vec4\n" + " (signature uvec2\n" " (parameters\n" - " (declare (in) sampler3D sampler)\n" - " (declare (in) vec4 P)\n" - " (declare (in) float lod))\n" + " (declare (in) uvec2 x)\n" + " (declare (in) uvec2 y))\n" " ())\n" - " (signature ivec4\n" + " (signature uvec3\n" " (parameters\n" - " (declare (in) isampler3D sampler)\n" - " (declare (in) vec4 P)\n" - " (declare (in) float lod))\n" + " (declare (in) uvec3 x)\n" + " (declare (in) uvec3 y))\n" " ())\n" " (signature uvec4\n" " (parameters\n" - " (declare (in) usampler3D sampler)\n" - " (declare (in) vec4 P)\n" - " (declare (in) float lod))\n" + " (declare (in) uvec4 x)\n" + " (declare (in) uvec4 y))\n" " ())\n" - " (signature float\n" + " (signature uvec2\n" " (parameters\n" - " (declare (in) sampler1DShadow sampler)\n" - " (declare (in) vec4 P)\n" - " (declare (in) float lod))\n" + " (declare (in) uvec2 x)\n" + " (declare (in) uint y))\n" " ())\n" - " (signature float\n" + " (signature uvec3\n" " (parameters\n" - " (declare (in) sampler2DShadow sampler)\n" - " (declare (in) vec4 P)\n" - " (declare (in) float lod))\n" + " (declare (in) uvec3 x)\n" + " (declare (in) uint y))\n" + " ())\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) uvec4 x)\n" + " (declare (in) uint y))\n" " ()))\n" - "(function textureGrad\n" - " (signature vec4\n" + "(function clamp\n" + " (signature float\n" " (parameters\n" - " (declare (in) sampler1D sampler)\n" - " (declare (in) float P)\n" - " (declare (in) float dPdx)\n" - " (declare (in) float dPdy))\n" + " (declare (in) float x)\n" + " (declare (in) float minVal)\n" + " (declare (in) float maxVal))\n" " ())\n" - " (signature ivec4\n" + " (signature vec2\n" " (parameters\n" - " (declare (in) isampler1D sampler)\n" - " (declare (in) float P)\n" - " (declare (in) float dPdx)\n" - " (declare (in) float dPdy))\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 minVal)\n" + " (declare (in) vec2 maxVal))\n" " ())\n" - " (signature uvec4\n" + " (signature vec3\n" " (parameters\n" - " (declare (in) usampler1D sampler)\n" - " (declare (in) float P)\n" - " (declare (in) float dPdx)\n" - " (declare (in) float dPdy))\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 minVal)\n" + " (declare (in) vec3 maxVal))\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" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 minVal)\n" + " (declare (in) vec4 maxVal))\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" + " (declare (in) vec2 x)\n" + " (declare (in) float minVal)\n" + " (declare (in) float maxVal))\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" + " (declare (in) vec3 x)\n" + " (declare (in) float minVal)\n" + " (declare (in) float maxVal))\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" + " (declare (in) vec4 x)\n" + " (declare (in) float minVal)\n" + " (declare (in) float maxVal))\n" " ())\n" - " (signature ivec4\n" + " (signature int\n" " (parameters\n" - " (declare (in) isampler3D sampler)\n" - " (declare (in) vec3 P)\n" - " (declare (in) vec3 dPdx)\n" - " (declare (in) vec3 dPdy))\n" + " (declare (in) int x)\n" + " (declare (in) int minVal)\n" + " (declare (in) int maxVal))\n" " ())\n" - " (signature uvec4\n" + " (signature ivec2\n" " (parameters\n" - " (declare (in) usampler3D sampler)\n" - " (declare (in) vec3 P)\n" - " (declare (in) vec3 dPdx)\n" - " (declare (in) vec3 dPdy))\n" + " (declare (in) ivec2 x)\n" + " (declare (in) ivec2 minVal)\n" + " (declare (in) ivec2 maxVal))\n" " ())\n" - " (signature vec4\n" + " (signature ivec3\n" " (parameters\n" - " (declare (in) samplerCube sampler)\n" - " (declare (in) vec3 P)\n" - " (declare (in) vec3 dPdx)\n" - " (declare (in) vec3 dPdy))\n" + " (declare (in) ivec3 x)\n" + " (declare (in) ivec3 minVal)\n" + " (declare (in) ivec3 maxVal))\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" + " (declare (in) ivec4 x)\n" + " (declare (in) ivec4 minVal)\n" + " (declare (in) ivec4 maxVal))\n" " ())\n" - " (signature uvec4\n" + " (signature ivec2\n" " (parameters\n" - " (declare (in) usamplerCube sampler)\n" - " (declare (in) vec3 P)\n" - " (declare (in) vec3 dPdx)\n" - " (declare (in) vec3 dPdy))\n" + " (declare (in) ivec2 x)\n" + " (declare (in) int minVal)\n" + " (declare (in) int maxVal))\n" " ())\n" - " (signature float\n" + " (signature ivec3\n" " (parameters\n" - " (declare (in) sampler1DShadow sampler)\n" - " (declare (in) vec3 P)\n" - " (declare (in) float dPdx)\n" - " (declare (in) float dPdy))\n" + " (declare (in) ivec3 x)\n" + " (declare (in) int minVal)\n" + " (declare (in) int maxVal))\n" " ())\n" - " (signature float\n" + " (signature ivec4\n" " (parameters\n" - " (declare (in) sampler2DShadow sampler)\n" - " (declare (in) vec3 P)\n" - " (declare (in) vec2 dPdx)\n" - " (declare (in) vec2 dPdy))\n" + " (declare (in) ivec4 x)\n" + " (declare (in) int minVal)\n" + " (declare (in) int maxVal))\n" " ())\n" - " (signature float\n" + " (signature uint\n" " (parameters\n" - " (declare (in) samplerCubeShadow sampler)\n" - " (declare (in) vec4 P)\n" - " (declare (in) vec3 dPdx)\n" - " (declare (in) vec3 dPdy))\n" + " (declare (in) uint x)\n" + " (declare (in) uint minVal)\n" + " (declare (in) uint maxVal))\n" " ())\n" - " (signature vec4\n" + " (signature uvec2\n" " (parameters\n" - " (declare (in) sampler1DArray sampler)\n" - " (declare (in) vec2 P)\n" - " (declare (in) float dPdx)\n" - " (declare (in) float dPdy))\n" + " (declare (in) uvec2 x)\n" + " (declare (in) uvec2 minVal)\n" + " (declare (in) uvec2 maxVal))\n" " ())\n" - " (signature ivec4\n" + " (signature uvec3\n" " (parameters\n" - " (declare (in) isampler1DArray sampler)\n" - " (declare (in) vec2 P)\n" - " (declare (in) float dPdx)\n" - " (declare (in) float dPdy))\n" + " (declare (in) uvec3 x)\n" + " (declare (in) uvec3 minVal)\n" + " (declare (in) uvec3 maxVal))\n" " ())\n" " (signature uvec4\n" " (parameters\n" - " (declare (in) usampler1DArray sampler)\n" - " (declare (in) vec2 P)\n" - " (declare (in) float dPdx)\n" - " (declare (in) float dPdy))\n" + " (declare (in) uvec4 x)\n" + " (declare (in) uvec4 minVal)\n" + " (declare (in) uvec4 maxVal))\n" " ())\n" - " (signature vec4\n" + " (signature uvec2\n" " (parameters\n" - " (declare (in) sampler2DArray sampler)\n" - " (declare (in) vec3 P)\n" - " (declare (in) vec2 dPdx)\n" - " (declare (in) vec2 dPdy))\n" + " (declare (in) uvec2 x)\n" + " (declare (in) uint minVal)\n" + " (declare (in) uint maxVal))\n" " ())\n" - " (signature ivec4\n" + " (signature uvec3\n" " (parameters\n" - " (declare (in) isampler2DArray sampler)\n" - " (declare (in) vec3 P)\n" - " (declare (in) vec2 dPdx)\n" - " (declare (in) vec2 dPdy))\n" + " (declare (in) uvec3 x)\n" + " (declare (in) uint minVal)\n" + " (declare (in) uint maxVal))\n" " ())\n" " (signature uvec4\n" " (parameters\n" - " (declare (in) usampler2DArray sampler)\n" - " (declare (in) vec3 P)\n" - " (declare (in) vec2 dPdx)\n" - " (declare (in) vec2 dPdy))\n" - " ())\n" + " (declare (in) uvec4 x)\n" + " (declare (in) uint minVal)\n" + " (declare (in) uint maxVal))\n" + " ()))\n" + "(function mix\n" " (signature float\n" " (parameters\n" - " (declare (in) sampler1DArrayShadow sampler)\n" - " (declare (in) vec3 P)\n" - " (declare (in) float dPdx)\n" - " (declare (in) float dPdy))\n" + " (declare (in) float x)\n" + " (declare (in) float y)\n" + " (declare (in) float a))\n" " ())\n" - " (signature float\n" + " (signature vec2\n" " (parameters\n" - " (declare (in) sampler2DArrayShadow sampler)\n" - " (declare (in) vec4 P)\n" - " (declare (in) vec2 dPdx)\n" - " (declare (in) vec2 dPdy))\n" - " ()))\n" - "(function textureProjGrad\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y)\n" + " (declare (in) vec2 a))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y)\n" + " (declare (in) vec3 a))\n" + " ())\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" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y)\n" + " (declare (in) vec4 a))\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" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y)\n" + " (declare (in) float a))\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" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y)\n" + " (declare (in) float a))\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" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y)\n" + " (declare (in) float a))\n" + " ()))\n" + "(function step\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float edge)\n" + " (declare (in) float x))\n" " ())\n" - " (signature ivec4\n" + " (signature vec2\n" " (parameters\n" - " (declare (in) isampler1D sampler)\n" - " (declare (in) vec4 P)\n" - " (declare (in) float dPdx)\n" - " (declare (in) float dPdy))\n" + " (declare (in) vec2 edge)\n" + " (declare (in) vec2 x))\n" " ())\n" - " (signature uvec4\n" + " (signature vec3\n" " (parameters\n" - " (declare (in) usampler1D sampler)\n" - " (declare (in) vec4 P)\n" - " (declare (in) float dPdx)\n" - " (declare (in) float dPdy))\n" + " (declare (in) vec3 edge)\n" + " (declare (in) vec3 x))\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" + " (declare (in) vec4 edge)\n" + " (declare (in) vec4 x))\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" + " (declare (in) float edge)\n" + " (declare (in) vec2 x))\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" + " (declare (in) float edge)\n" + " (declare (in) vec3 x))\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" + " (declare (in) float edge)\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function smoothstep\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float edge0)\n" + " (declare (in) float edge1)\n" + " (declare (in) float x))\n" " ())\n" - " (signature ivec4\n" + " (signature vec2\n" " (parameters\n" - " (declare (in) isampler2D sampler)\n" - " (declare (in) vec4 P)\n" - " (declare (in) vec2 dPdx)\n" - " (declare (in) vec2 dPdy))\n" + " (declare (in) vec2 edge0)\n" + " (declare (in) vec2 edge1)\n" + " (declare (in) vec2 x))\n" " ())\n" - " (signature uvec4\n" + " (signature vec3\n" " (parameters\n" - " (declare (in) usampler2D sampler)\n" - " (declare (in) vec4 P)\n" - " (declare (in) vec2 dPdx)\n" - " (declare (in) vec2 dPdy))\n" + " (declare (in) vec3 edge0)\n" + " (declare (in) vec3 edge1)\n" + " (declare (in) vec3 x))\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" + " (declare (in) vec4 edge0)\n" + " (declare (in) vec4 edge1)\n" + " (declare (in) vec4 x))\n" " ())\n" - " (signature ivec4\n" + " (signature vec2\n" " (parameters\n" - " (declare (in) isampler3D sampler)\n" - " (declare (in) vec4 P)\n" - " (declare (in) vec3 dPdx)\n" - " (declare (in) vec3 dPdy))\n" + " (declare (in) float edge0)\n" + " (declare (in) float edge1)\n" + " (declare (in) vec2 x))\n" " ())\n" - " (signature uvec4\n" + " (signature vec3\n" " (parameters\n" - " (declare (in) usampler3D sampler)\n" - " (declare (in) vec4 P)\n" - " (declare (in) vec3 dPdx)\n" - " (declare (in) vec3 dPdy))\n" + " (declare (in) float edge0)\n" + " (declare (in) float edge1)\n" + " (declare (in) vec3 x))\n" " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) float edge0)\n" + " (declare (in) float edge1)\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function length\n" " (signature float\n" " (parameters\n" - " (declare (in) sampler1DShadow sampler)\n" - " (declare (in) vec4 P)\n" - " (declare (in) float dPdx)\n" - " (declare (in) float dPdy))\n" + " (declare (in) float x))\n" " ())\n" " (signature float\n" " (parameters\n" - " (declare (in) sampler2DShadow sampler)\n" - " (declare (in) vec4 P)\n" - " (declare (in) vec2 dPdx)\n" - " (declare (in) vec2 dPdy))\n" - " ()))\n" - "(function texture1D\n" - " (signature vec4\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature float\n" " (parameters\n" - " (declare (in) sampler1D sampler)\n" - " (declare (in) float coord))\n" + " (declare (in) vec3 x))\n" " ())\n" - " (signature vec4\n" + " (signature float\n" " (parameters\n" - " (declare (in) sampler1D sampler)\n" - " (declare (in) float coord)\n" - " (declare (in) float bias))\n" + " (declare (in) vec4 x))\n" " ()))\n" - "(function texture1DProj\n" - " (signature vec4\n" + "(function distance\n" + " (signature float\n" " (parameters\n" - " (declare (in) sampler1D sampler)\n" - " (declare (in) vec2 coord))\n" + " (declare (in) float p0)\n" + " (declare (in) float p1))\n" " ())\n" - " (signature vec4\n" + " (signature float\n" " (parameters\n" - " (declare (in) sampler1D sampler)\n" - " (declare (in) vec4 coord))\n" + " (declare (in) vec2 p0)\n" + " (declare (in) vec2 p1))\n" " ())\n" - " (signature vec4\n" + " (signature float\n" " (parameters\n" - " (declare (in) sampler1D sampler)\n" - " (declare (in) vec2 coord)\n" - " (declare (in) float bias))\n" + " (declare (in) vec3 p0)\n" + " (declare (in) vec3 p1))\n" " ())\n" - " (signature vec4\n" - " (parameters\n" - " (declare (in) sampler1D sampler)\n" - " (declare (in) vec4 coord)\n" - " (declare (in) float bias))\n" - " ()))\n" - "(function texture1DLod\n" - " (signature vec4\n" + " (signature float\n" " (parameters\n" - " (declare (in) sampler1D sampler)\n" - " (declare (in) float coord)\n" - " (declare (in) float lod))\n" + " (declare (in) vec4 p0)\n" + " (declare (in) vec4 p1))\n" " ()))\n" - "(function texture1DProjLod\n" - " (signature vec4\n" + "(function dot\n" + " (signature float\n" " (parameters\n" - " (declare (in) sampler1D sampler)\n" - " (declare (in) vec2 coord)\n" - " (declare (in) float lod))\n" + " (declare (in) float x)\n" + " (declare (in) float y))\n" " ())\n" - " (signature vec4\n" + " (signature float\n" " (parameters\n" - " (declare (in) sampler1D sampler)\n" - " (declare (in) vec4 coord)\n" - " (declare (in) float lod))\n" - " ()))\n" - "(function texture2D\n" - " (signature vec4\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" + " ())\n" + " (signature float\n" " (parameters\n" - " (declare (in) sampler2D sampler)\n" - " (declare (in) vec2 coord))\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" " ())\n" - " (signature vec4\n" + " (signature float\n" " (parameters\n" - " (declare (in) sampler2D sampler)\n" - " (declare (in) vec2 coord)\n" - " (declare (in) float bias))\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" " ()))\n" - "(function texture2DProj\n" - " (signature vec4\n" + "(function cross\n" + " (signature vec3\n" " (parameters\n" - " (declare (in) sampler2D sampler)\n" - " (declare (in) vec3 coord))\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ()))\n" + "(function normalize\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x))\n" " ())\n" - " (signature vec4\n" + " (signature vec2\n" " (parameters\n" - " (declare (in) sampler2D sampler)\n" - " (declare (in) vec4 coord))\n" + " (declare (in) vec2 x))\n" " ())\n" - " (signature vec4\n" + " (signature vec3\n" " (parameters\n" - " (declare (in) sampler2D sampler)\n" - " (declare (in) vec3 coord)\n" - " (declare (in) float bias))\n" + " (declare (in) vec3 x))\n" " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in) sampler2D sampler)\n" - " (declare (in) vec4 coord)\n" - " (declare (in) float bias))\n" + " (declare (in) vec4 x))\n" " ()))\n" - "(function texture2DLod\n" + "(function ftransform\n" " (signature vec4\n" - " (parameters\n" - " (declare (in) sampler2D sampler)\n" - " (declare (in) vec2 coord)\n" - " (declare (in) float lod))\n" + " (parameters)\n" " ()))\n" - "(function texture2DProjLod\n" - " (signature vec4\n" + "(function faceforward\n" + " (signature float\n" " (parameters\n" - " (declare (in) sampler2D sampler)\n" - " (declare (in) vec3 coord)\n" - " (declare (in) float lod))\n" + " (declare (in) float N)\n" + " (declare (in) float I)\n" + " (declare (in) float Nref))\n" " ())\n" - " (signature vec4\n" + " (signature vec2\n" " (parameters\n" - " (declare (in) sampler2D sampler)\n" - " (declare (in) vec4 coord)\n" - " (declare (in) float lod))\n" - " ()))\n" - "(function texture3D\n" - " (signature vec4\n" + " (declare (in) vec2 N)\n" + " (declare (in) vec2 I)\n" + " (declare (in) vec2 Nref))\n" + " ())\n" + " (signature vec3\n" " (parameters\n" - " (declare (in) sampler3D sampler)\n" - " (declare (in) vec3 coord))\n" + " (declare (in) vec3 N)\n" + " (declare (in) vec3 I)\n" + " (declare (in) vec3 Nref))\n" " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in) sampler3D sampler)\n" - " (declare (in) vec3 coord)\n" - " (declare (in) float bias))\n" + " (declare (in) vec4 N)\n" + " (declare (in) vec4 I)\n" + " (declare (in) vec4 Nref))\n" " ()))\n" - "(function texture3DProj\n" - " (signature vec4\n" + "(function reflect\n" + " (signature float\n" " (parameters\n" - " (declare (in) sampler3D sampler)\n" - " (declare (in) vec4 coord))\n" + " (declare (in) float I)\n" + " (declare (in) float N))\n" " ())\n" - " (signature vec4\n" + " (signature vec2\n" " (parameters\n" - " (declare (in) sampler3D sampler)\n" - " (declare (in) vec4 coord)\n" - " (declare (in) float bias))\n" - " ()))\n" - "(function texture3DLod\n" - " (signature vec4\n" + " (declare (in) vec2 I)\n" + " (declare (in) vec2 N))\n" + " ())\n" + " (signature vec3\n" " (parameters\n" - " (declare (in) sampler3D sampler)\n" - " (declare (in) vec3 coord)\n" - " (declare (in) float lod))\n" - " ()))\n" - "(function texture3DProjLod\n" + " (declare (in) vec3 I)\n" + " (declare (in) vec3 N))\n" + " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in) sampler3D sampler)\n" - " (declare (in) vec4 coord)\n" - " (declare (in) float lod))\n" + " (declare (in) vec4 I)\n" + " (declare (in) vec4 N))\n" " ()))\n" - "(function textureCube\n" - " (signature vec4\n" + "(function refract\n" + " (signature float\n" " (parameters\n" - " (declare (in) samplerCube sampler)\n" - " (declare (in) vec3 coord))\n" + " (declare (in) float I)\n" + " (declare (in) float N)\n" + " (declare (in) float eta))\n" " ())\n" - " (signature vec4\n" - " (parameters\n" - " (declare (in) samplerCube sampler)\n" - " (declare (in) vec3 coord)\n" - " (declare (in) float bias))\n" - " ()))\n" - "(function textureCubeLod\n" - " (signature vec4\n" + " (signature vec2\n" " (parameters\n" - " (declare (in) samplerCube sampler)\n" - " (declare (in) vec3 coord)\n" - " (declare (in) float lod))\n" - " ()))\n" - "(function shadow1D\n" - " (signature vec4\n" + " (declare (in) vec2 I)\n" + " (declare (in) vec2 N)\n" + " (declare (in) float eta))\n" + " ())\n" + " (signature vec3\n" " (parameters\n" - " (declare (in) sampler1DShadow sampler)\n" - " (declare (in) vec3 coord))\n" + " (declare (in) vec3 I)\n" + " (declare (in) vec3 N)\n" + " (declare (in) float eta))\n" " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in) sampler1DShadow sampler)\n" - " (declare (in) vec3 coord)\n" - " (declare (in) float bias))\n" + " (declare (in) vec4 I)\n" + " (declare (in) vec4 N)\n" + " (declare (in) float eta))\n" " ()))\n" - "(function shadow2D\n" - " (signature vec4\n" + "(function matrixCompMult\n" + " (signature mat2\n" " (parameters\n" - " (declare (in) sampler2DShadow sampler)\n" - " (declare (in) vec3 coord))\n" + " (declare (in) mat2 x)\n" + " (declare (in) mat2 y))\n" " ())\n" - " (signature vec4\n" + " (signature mat3\n" " (parameters\n" - " (declare (in) sampler2DShadow sampler)\n" - " (declare (in) vec3 coord)\n" - " (declare (in) float bias))\n" - " ()))\n" - "(function shadow1DProj\n" - " (signature vec4\n" + " (declare (in) mat3 x)\n" + " (declare (in) mat3 y))\n" + " ())\n" + " (signature mat4\n" " (parameters\n" - " (declare (in) sampler1DShadow sampler)\n" - " (declare (in) vec4 coord))\n" + " (declare (in) mat4 x)\n" + " (declare (in) mat4 y))\n" " ())\n" - " (signature vec4\n" + " (signature mat2x3\n" " (parameters\n" - " (declare (in) sampler1DShadow sampler)\n" - " (declare (in) vec4 coord)\n" - " (declare (in) float bias))\n" - " ()))\n" - "(function shadow2DProj\n" - " (signature vec4\n" + " (declare (in) mat2x3 x)\n" + " (declare (in) mat2x3 y))\n" + " ())\n" + " (signature mat2x4\n" " (parameters\n" - " (declare (in) sampler2DShadow sampler)\n" - " (declare (in) vec4 coord))\n" + " (declare (in) mat2x4 x)\n" + " (declare (in) mat2x4 y))\n" " ())\n" - " (signature vec4\n" + " (signature mat3x2\n" " (parameters\n" - " (declare (in) sampler2DShadow sampler)\n" - " (declare (in) vec4 coord)\n" - " (declare (in) float bias))\n" - " ()))\n" - "(function shadow1DLod\n" - " (signature vec4\n" + " (declare (in) mat3x2 x)\n" + " (declare (in) mat3x2 y))\n" + " ())\n" + " (signature mat3x4\n" " (parameters\n" - " (declare (in) sampler1DShadow sampler)\n" - " (declare (in) vec3 coord)\n" - " (declare (in) float lod))\n" - " ()))\n" - "(function shadow2DLod\n" - " (signature vec4\n" + " (declare (in) mat3x4 x)\n" + " (declare (in) mat3x4 y))\n" + " ())\n" + " (signature mat4x2\n" " (parameters\n" - " (declare (in) sampler2DShadow sampler)\n" - " (declare (in) vec3 coord)\n" - " (declare (in) float lod))\n" - " ()))\n" - "(function shadow1DProjLod\n" - " (signature vec4\n" + " (declare (in) mat4x2 x)\n" + " (declare (in) mat4x2 y))\n" + " ())\n" + " (signature mat4x3\n" " (parameters\n" - " (declare (in) sampler1DShadow sampler)\n" - " (declare (in) vec4 coord)\n" - " (declare (in) float lod))\n" + " (declare (in) mat4x3 x)\n" + " (declare (in) mat4x3 y))\n" " ()))\n" - "(function shadow2DProjLod\n" - " (signature vec4\n" + "(function outerProduct\n" + " (signature mat2\n" " (parameters\n" - " (declare (in) sampler2DShadow sampler)\n" - " (declare (in) vec4 coord)\n" - " (declare (in) float lod))\n" - " ()))\n" - "(function noise1\n" - " (signature float\n" + " (declare (in) vec2 c)\n" + " (declare (in) vec2 r))\n" + " ())\n" + " (signature mat3\n" " (parameters\n" - " (declare (in) float x))\n" + " (declare (in) vec3 c)\n" + " (declare (in) vec3 r))\n" " ())\n" - " (signature float\n" + " (signature mat4\n" " (parameters\n" - " (declare (in) vec2 x))\n" + " (declare (in) vec4 c)\n" + " (declare (in) vec4 r))\n" " ())\n" - " (signature float\n" + " (signature mat2x3\n" " (parameters\n" - " (declare (in) vec3 x))\n" + " (declare (in) vec3 c)\n" + " (declare (in) vec2 r))\n" " ())\n" - " (signature float\n" + " (signature mat3x2\n" " (parameters\n" - " (declare (in) vec4 x))\n" - " ()))\n" - "(function noise2\n" - " (signature vec2\n" + " (declare (in) vec2 c)\n" + " (declare (in) vec3 r))\n" + " ())\n" + " (signature mat2x4\n" " (parameters\n" - " (declare (in) float x))\n" + " (declare (in) vec4 c)\n" + " (declare (in) vec2 r))\n" " ())\n" - " (signature vec2\n" + " (signature mat4x2\n" " (parameters\n" - " (declare (in) vec2 x))\n" + " (declare (in) vec2 c)\n" + " (declare (in) vec4 r))\n" " ())\n" - " (signature vec2\n" + " (signature mat3x4\n" " (parameters\n" - " (declare (in) vec3 x))\n" + " (declare (in) vec4 c)\n" + " (declare (in) vec3 r))\n" " ())\n" - " (signature vec2\n" + " (signature mat4x3\n" " (parameters\n" - " (declare (in) vec4 x))\n" + " (declare (in) vec3 c)\n" + " (declare (in) vec4 r))\n" " ()))\n" - "(function noise3\n" - " (signature vec3\n" + "(function transpose\n" + " (signature mat2\n" " (parameters\n" - " (declare (in) float x))\n" + " (declare (in) mat2 m))\n" " ())\n" - " (signature vec3\n" + " (signature mat3\n" " (parameters\n" - " (declare (in) vec2 x))\n" + " (declare (in) mat3 m))\n" " ())\n" - " (signature vec3\n" + " (signature mat4\n" " (parameters\n" - " (declare (in) vec3 x))\n" + " (declare (in) mat4 m))\n" " ())\n" - " (signature vec3\n" + " (signature mat2x3\n" " (parameters\n" - " (declare (in) vec4 x))\n" - " ()))\n" - "(function noise4\n" - " (signature vec4\n" + " (declare (in) mat3x2 m))\n" + " ())\n" + " (signature mat3x2\n" " (parameters\n" - " (declare (in) float x))\n" + " (declare (in) mat2x3 m))\n" " ())\n" - " (signature vec4\n" + " (signature mat2x4\n" " (parameters\n" - " (declare (in) vec2 x))\n" + " (declare (in) mat4x2 m))\n" " ())\n" - " (signature vec4\n" + " (signature mat4x2\n" " (parameters\n" - " (declare (in) vec3 x))\n" + " (declare (in) mat2x4 m))\n" " ())\n" - " (signature vec4\n" + " (signature mat3x4\n" " (parameters\n" - " (declare (in) vec4 x))\n" - " ())))" -; -static const char *functions_for_130_vert [] = { - builtin_clamp, - builtin_shadow2DLod, - builtin_matrixCompMult, - builtin_textureProj, - builtin_noise2, - builtin_texture3DProjLod, - builtin_pow, - builtin_texture2DProj, - builtin_greaterThanEqual, - builtin_cosh, - 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_noise3, - builtin_texture2DProjLod, - 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_sinh, - builtin_shadow2DProjLod, - builtin_not, - builtin_sign, - builtin_inversesqrt, - builtin_mod, - builtin_noise4, - builtin_distance, - builtin_cos, - builtin_shadow1D, - builtin_noise1, - builtin_refract, - builtin_tanh, - 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" + " (declare (in) mat4x3 m))\n" + " ())\n" + " (signature mat4x3\n" " (parameters\n" - " (declare (in) sampler2DRect sampler)\n" - " (declare (in) vec2 coord))\n" + " (declare (in) mat3x4 m))\n" " ()))\n" - "(function texture2DRectProj\n" - " (signature vec4\n" + "(function lessThan\n" + " (signature bvec2\n" " (parameters\n" - " (declare (in) sampler2DRect sampler)\n" - " (declare (in) vec3 coord))\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" " ())\n" - " (signature vec4\n" + " (signature bvec3\n" " (parameters\n" - " (declare (in) sampler2DRect sampler)\n" - " (declare (in) vec4 coord))\n" - " ()))\n" - "(function shadow2DRect\n" - " (signature vec4\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ())\n" + " (signature bvec4\n" " (parameters\n" - " (declare (in) sampler2DRectShadow sampler)\n" - " (declare (in) vec3 coord))\n" - " ()))\n" - "(function shadow2DRectProj\n" - " (signature vec4\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" + " ())\n" + " (signature bvec2\n" " (parameters\n" - " (declare (in) sampler2DRectShadow sampler)\n" - " (declare (in) vec4 coord))\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" + " (declare (in) ivec2 x)\n" + " (declare (in) ivec2 y))\n" + " ())\n" + " (signature bvec3\n" " (parameters\n" - " (declare (in) float degrees))\n" + " (declare (in) ivec3 x)\n" + " (declare (in) ivec3 y))\n" " ())\n" - " (signature vec2\n" + " (signature bvec4\n" " (parameters\n" - " (declare (in) vec2 degrees))\n" + " (declare (in) ivec4 x)\n" + " (declare (in) ivec4 y))\n" " ())\n" - " (signature vec3\n" + " (signature bvec2\n" " (parameters\n" - " (declare (in) vec3 degrees))\n" + " (declare (in) uvec2 x)\n" + " (declare (in) uvec2 y))\n" " ())\n" - " (signature vec4\n" + " (signature bvec3\n" " (parameters\n" - " (declare (in) vec4 degrees))\n" + " (declare (in) uvec3 x)\n" + " (declare (in) uvec3 y))\n" + " ())\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) uvec4 x)\n" + " (declare (in) uvec4 y))\n" " ()))\n" - "(function degrees\n" - " (signature float\n" + "(function lessThanEqual\n" + " (signature bvec2\n" " (parameters\n" - " (declare (in) float radians))\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" " ())\n" - " (signature vec2\n" + " (signature bvec3\n" " (parameters\n" - " (declare (in) vec2 radians))\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" " ())\n" - " (signature vec3\n" + " (signature bvec4\n" " (parameters\n" - " (declare (in) vec3 radians))\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" " ())\n" - " (signature vec4\n" + " (signature bvec2\n" " (parameters\n" - " (declare (in) vec4 radians))\n" - " ()))\n" - "(function sin\n" - " (signature float\n" + " (declare (in) ivec2 x)\n" + " (declare (in) ivec2 y))\n" + " ())\n" + " (signature bvec3\n" " (parameters\n" - " (declare (in) float angle))\n" + " (declare (in) ivec3 x)\n" + " (declare (in) ivec3 y))\n" " ())\n" - " (signature vec2\n" + " (signature bvec4\n" " (parameters\n" - " (declare (in) vec2 angle))\n" + " (declare (in) ivec4 x)\n" + " (declare (in) ivec4 y))\n" " ())\n" - " (signature vec3\n" + " (signature bvec2\n" " (parameters\n" - " (declare (in) vec3 angle))\n" + " (declare (in) uvec2 x)\n" + " (declare (in) uvec2 y))\n" " ())\n" - " (signature vec4\n" + " (signature bvec3\n" " (parameters\n" - " (declare (in) vec4 angle))\n" + " (declare (in) uvec3 x)\n" + " (declare (in) uvec3 y))\n" + " ())\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) uvec4 x)\n" + " (declare (in) uvec4 y))\n" " ()))\n" - "(function cos\n" - " (signature float\n" + "(function greaterThan\n" + " (signature bvec2\n" " (parameters\n" - " (declare (in) float angle))\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" " ())\n" - " (signature vec2\n" + " (signature bvec3\n" " (parameters\n" - " (declare (in) vec2 angle))\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" " ())\n" - " (signature vec3\n" + " (signature bvec4\n" " (parameters\n" - " (declare (in) vec3 angle))\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" " ())\n" - " (signature vec4\n" + " (signature bvec2\n" " (parameters\n" - " (declare (in) vec4 angle))\n" + " (declare (in) ivec2 x)\n" + " (declare (in) ivec2 y))\n" + " ())\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) ivec3 x)\n" + " (declare (in) ivec3 y))\n" + " ())\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) ivec4 x)\n" + " (declare (in) ivec4 y))\n" + " ())\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) uvec2 x)\n" + " (declare (in) uvec2 y))\n" + " ())\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) uvec3 x)\n" + " (declare (in) uvec3 y))\n" + " ())\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) uvec4 x)\n" + " (declare (in) uvec4 y))\n" " ()))\n" - "(function tan\n" - " (signature float\n" + "(function greaterThanEqual\n" + " (signature bvec2\n" " (parameters\n" - " (declare (in) float angle))\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" " ())\n" - " (signature vec2\n" + " (signature bvec3\n" " (parameters\n" - " (declare (in) vec2 angle))\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" " ())\n" - " (signature vec3\n" + " (signature bvec4\n" " (parameters\n" - " (declare (in) vec3 angle))\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" " ())\n" - " (signature vec4\n" + " (signature bvec2\n" " (parameters\n" - " (declare (in) vec4 angle))\n" + " (declare (in) ivec2 x)\n" + " (declare (in) ivec2 y))\n" + " ())\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) ivec3 x)\n" + " (declare (in) ivec3 y))\n" + " ())\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) ivec4 x)\n" + " (declare (in) ivec4 y))\n" + " ())\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) uvec2 x)\n" + " (declare (in) uvec2 y))\n" + " ())\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) uvec3 x)\n" + " (declare (in) uvec3 y))\n" + " ())\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) uvec4 x)\n" + " (declare (in) uvec4 y))\n" " ()))\n" - "(function asin\n" - " (signature float\n" + "(function equal\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" + " ())\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ())\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" + " ())\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) ivec2 x)\n" + " (declare (in) ivec2 y))\n" + " ())\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) ivec3 x)\n" + " (declare (in) ivec3 y))\n" + " ())\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) ivec4 x)\n" + " (declare (in) ivec4 y))\n" + " ())\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) uvec2 x)\n" + " (declare (in) uvec2 y))\n" + " ())\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) uvec3 x)\n" + " (declare (in) uvec3 y))\n" + " ())\n" + " (signature bvec4\n" " (parameters\n" - " (declare (in) float angle))\n" + " (declare (in) uvec4 x)\n" + " (declare (in) uvec4 y))\n" " ())\n" - " (signature vec2\n" + " (signature bvec2\n" " (parameters\n" - " (declare (in) vec2 angle))\n" + " (declare (in) bvec2 x)\n" + " (declare (in) bvec2 y))\n" " ())\n" - " (signature vec3\n" + " (signature bvec3\n" " (parameters\n" - " (declare (in) vec3 angle))\n" + " (declare (in) bvec3 x)\n" + " (declare (in) bvec3 y))\n" " ())\n" - " (signature vec4\n" + " (signature bvec4\n" " (parameters\n" - " (declare (in) vec4 angle))\n" + " (declare (in) bvec4 x)\n" + " (declare (in) bvec4 y))\n" " ()))\n" - "(function acos\n" - " (signature float\n" + "(function notEqual\n" + " (signature bvec2\n" " (parameters\n" - " (declare (in) float angle))\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" " ())\n" - " (signature vec2\n" + " (signature bvec3\n" " (parameters\n" - " (declare (in) vec2 angle))\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" " ())\n" - " (signature vec3\n" + " (signature bvec4\n" " (parameters\n" - " (declare (in) vec3 angle))\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" " ())\n" - " (signature vec4\n" + " (signature bvec2\n" " (parameters\n" - " (declare (in) vec4 angle))\n" - " ()))\n" - "(function atan\n" - " (signature float\n" + " (declare (in) ivec2 x)\n" + " (declare (in) ivec2 y))\n" + " ())\n" + " (signature bvec3\n" " (parameters\n" - " (declare (in) float y)\n" - " (declare (in) float x))\n" + " (declare (in) ivec3 x)\n" + " (declare (in) ivec3 y))\n" " ())\n" - " (signature vec2\n" + " (signature bvec4\n" " (parameters\n" - " (declare (in) vec2 y)\n" - " (declare (in) vec2 x))\n" + " (declare (in) ivec4 x)\n" + " (declare (in) ivec4 y))\n" " ())\n" - " (signature vec3\n" + " (signature bvec2\n" " (parameters\n" - " (declare (in) vec3 y)\n" - " (declare (in) vec3 x))\n" + " (declare (in) uvec2 x)\n" + " (declare (in) uvec2 y))\n" " ())\n" - " (signature vec4\n" + " (signature bvec3\n" " (parameters\n" - " (declare (in) vec4 y)\n" - " (declare (in) vec4 x))\n" + " (declare (in) uvec3 x)\n" + " (declare (in) uvec3 y))\n" " ())\n" - " (signature float\n" + " (signature bvec4\n" " (parameters\n" - " (declare (in) float y_over_x))\n" + " (declare (in) uvec4 x)\n" + " (declare (in) uvec4 y))\n" " ())\n" - " (signature vec2\n" + " (signature bvec2\n" " (parameters\n" - " (declare (in) vec2 y_over_x))\n" + " (declare (in) bvec2 x)\n" + " (declare (in) bvec2 y))\n" " ())\n" - " (signature vec3\n" + " (signature bvec3\n" " (parameters\n" - " (declare (in) vec3 y_over_x))\n" + " (declare (in) bvec3 x)\n" + " (declare (in) bvec3 y))\n" " ())\n" - " (signature vec4\n" + " (signature bvec4\n" " (parameters\n" - " (declare (in) vec4 y_over_x))\n" + " (declare (in) bvec4 x)\n" + " (declare (in) bvec4 y))\n" " ()))\n" - "(function pow\n" - " (signature float\n" - " (parameters\n" - " (declare (in) float x)\n" - " (declare (in) float y))\n" - " ())\n" - " (signature vec2\n" + "(function any\n" + " (signature bool\n" " (parameters\n" - " (declare (in) vec2 x)\n" - " (declare (in) vec2 y))\n" + " (declare (in) bvec2 x))\n" " ())\n" - " (signature vec3\n" + " (signature bool\n" " (parameters\n" - " (declare (in) vec3 x)\n" - " (declare (in) vec3 y))\n" + " (declare (in) bvec3 x))\n" " ())\n" - " (signature vec4\n" + " (signature bool\n" " (parameters\n" - " (declare (in) vec4 x)\n" - " (declare (in) vec4 y))\n" + " (declare (in) bvec4 x))\n" " ()))\n" - "(function exp\n" - " (signature float\n" - " (parameters\n" - " (declare (in) float x))\n" - " ())\n" - " (signature vec2\n" + "(function all\n" + " (signature bool\n" " (parameters\n" - " (declare (in) vec2 x))\n" + " (declare (in) bvec2 x))\n" " ())\n" - " (signature vec3\n" + " (signature bool\n" " (parameters\n" - " (declare (in) vec3 x))\n" + " (declare (in) bvec3 x))\n" " ())\n" - " (signature vec4\n" + " (signature bool\n" " (parameters\n" - " (declare (in) vec4 x))\n" + " (declare (in) bvec4 x))\n" " ()))\n" - "(function log\n" - " (signature float\n" - " (parameters\n" - " (declare (in) float x))\n" - " ())\n" - " (signature vec2\n" + "(function not\n" + " (signature bvec2\n" " (parameters\n" - " (declare (in) vec2 x))\n" + " (declare (in) bvec2 x))\n" " ())\n" - " (signature vec3\n" + " (signature bvec3\n" " (parameters\n" - " (declare (in) vec3 x))\n" + " (declare (in) bvec3 x))\n" " ())\n" - " (signature vec4\n" + " (signature bvec4\n" " (parameters\n" - " (declare (in) vec4 x))\n" + " (declare (in) bvec4 x))\n" " ()))\n" - "(function exp2\n" - " (signature float\n" + "(function texture\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) float x))\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) float P))\n" " ())\n" - " (signature vec2\n" + " (signature ivec4\n" " (parameters\n" - " (declare (in) vec2 x))\n" + " (declare (in) isampler1D sampler)\n" + " (declare (in) float P))\n" " ())\n" - " (signature vec3\n" + " (signature uvec4\n" " (parameters\n" - " (declare (in) vec3 x))\n" + " (declare (in) usampler1D sampler)\n" + " (declare (in) float P))\n" " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in) vec4 x))\n" - " ()))\n" - "(function log2\n" - " (signature float\n" - " (parameters\n" - " (declare (in) float x))\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec2 P))\n" " ())\n" - " (signature vec2\n" + " (signature ivec4\n" " (parameters\n" - " (declare (in) vec2 x))\n" + " (declare (in) isampler2D sampler)\n" + " (declare (in) vec2 P))\n" " ())\n" - " (signature vec3\n" + " (signature uvec4\n" " (parameters\n" - " (declare (in) vec3 x))\n" + " (declare (in) usampler2D sampler)\n" + " (declare (in) vec2 P))\n" " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in) vec4 x))\n" - " ()))\n" - "(function sqrt\n" - " (signature float\n" - " (parameters\n" - " (declare (in) float x))\n" + " (declare (in) sampler3D sampler)\n" + " (declare (in) vec3 P))\n" " ())\n" - " (signature vec2\n" + " (signature ivec4\n" " (parameters\n" - " (declare (in) vec2 x))\n" + " (declare (in) isampler3D sampler)\n" + " (declare (in) vec3 P))\n" " ())\n" - " (signature vec3\n" + " (signature uvec4\n" " (parameters\n" - " (declare (in) vec3 x))\n" + " (declare (in) usampler3D sampler)\n" + " (declare (in) vec3 P))\n" " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in) vec4 x))\n" - " ()))\n" - "(function inversesqrt\n" - " (signature float\n" - " (parameters\n" - " (declare (in) float x))\n" + " (declare (in) samplerCube sampler)\n" + " (declare (in) vec3 P))\n" " ())\n" - " (signature vec2\n" + " (signature ivec4\n" " (parameters\n" - " (declare (in) vec2 x))\n" + " (declare (in) isamplerCube sampler)\n" + " (declare (in) vec3 P))\n" " ())\n" - " (signature vec3\n" + " (signature uvec4\n" " (parameters\n" - " (declare (in) vec3 x))\n" + " (declare (in) usamplerCube sampler)\n" + " (declare (in) vec3 P))\n" " ())\n" - " (signature vec4\n" - " (parameters\n" - " (declare (in) vec4 x))\n" - " ()))\n" - "(function abs\n" " (signature float\n" " (parameters\n" - " (declare (in) float x))\n" + " (declare (in) sampler1DShadow sampler)\n" + " (declare (in) vec3 P))\n" " ())\n" - " (signature vec2\n" + " (signature float\n" " (parameters\n" - " (declare (in) vec2 x))\n" + " (declare (in) sampler2DShadow sampler)\n" + " (declare (in) vec3 P))\n" " ())\n" - " (signature vec3\n" + " (signature float\n" " (parameters\n" - " (declare (in) vec3 x))\n" + " (declare (in) samplerCubeShadow sampler)\n" + " (declare (in) vec4 P))\n" " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in) vec4 x))\n" - " ()))\n" - "(function sign\n" - " (signature float\n" + " (declare (in) sampler1DArray sampler)\n" + " (declare (in) vec2 P))\n" + " ())\n" + " (signature ivec4\n" " (parameters\n" - " (declare (in) float x))\n" + " (declare (in) isampler1DArray sampler)\n" + " (declare (in) vec2 P))\n" " ())\n" - " (signature vec2\n" + " (signature uvec4\n" " (parameters\n" - " (declare (in) vec2 x))\n" + " (declare (in) usampler1DArray sampler)\n" + " (declare (in) vec2 P))\n" " ())\n" - " (signature vec3\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) vec3 x))\n" + " (declare (in) sampler2DArray sampler)\n" + " (declare (in) vec3 P))\n" " ())\n" - " (signature vec4\n" + " (signature ivec4\n" " (parameters\n" - " (declare (in) vec4 x))\n" - " ()))\n" - "(function floor\n" - " (signature float\n" + " (declare (in) isampler2DArray sampler)\n" + " (declare (in) vec3 P))\n" + " ())\n" + " (signature uvec4\n" " (parameters\n" - " (declare (in) float x))\n" + " (declare (in) usampler2DArray sampler)\n" + " (declare (in) vec3 P))\n" " ())\n" - " (signature vec2\n" + " (signature float\n" " (parameters\n" - " (declare (in) vec2 x))\n" + " (declare (in) sampler1DArrayShadow sampler)\n" + " (declare (in) vec3 P))\n" " ())\n" - " (signature vec3\n" + " (signature float\n" " (parameters\n" - " (declare (in) vec3 x))\n" + " (declare (in) sampler2DArrayShadow sampler)\n" + " (declare (in) vec4 P))\n" " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in) vec4 x))\n" - " ()))\n" - "(function ceil\n" - " (signature float\n" - " (parameters\n" - " (declare (in) float x))\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) float P)\n" + " (declare (in) float bias))\n" " ())\n" - " (signature vec2\n" + " (signature ivec4\n" " (parameters\n" - " (declare (in) vec2 x))\n" + " (declare (in) isampler1D sampler)\n" + " (declare (in) float P)\n" + " (declare (in) float bias))\n" " ())\n" - " (signature vec3\n" + " (signature uvec4\n" " (parameters\n" - " (declare (in) vec3 x))\n" + " (declare (in) usampler1D sampler)\n" + " (declare (in) float P)\n" + " (declare (in) float bias))\n" " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in) vec4 x))\n" - " ()))\n" - "(function fract\n" - " (signature float\n" - " (parameters\n" - " (declare (in) float x))\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec2 P)\n" + " (declare (in) float bias))\n" " ())\n" - " (signature vec2\n" + " (signature ivec4\n" " (parameters\n" - " (declare (in) vec2 x))\n" + " (declare (in) isampler2D sampler)\n" + " (declare (in) vec2 P)\n" + " (declare (in) float bias))\n" " ())\n" - " (signature vec3\n" + " (signature uvec4\n" " (parameters\n" - " (declare (in) vec3 x))\n" + " (declare (in) usampler2D sampler)\n" + " (declare (in) vec2 P)\n" + " (declare (in) float bias))\n" " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in) vec4 x))\n" - " ()))\n" - "(function mod\n" - " (signature float\n" - " (parameters\n" - " (declare (in) float x)\n" - " (declare (in) float y))\n" + " (declare (in) sampler3D sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float bias))\n" " ())\n" - " (signature vec2\n" + " (signature ivec4\n" " (parameters\n" - " (declare (in) vec2 x)\n" - " (declare (in) float y))\n" + " (declare (in) isampler3D sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float bias))\n" " ())\n" - " (signature vec3\n" + " (signature uvec4\n" " (parameters\n" - " (declare (in) vec3 x)\n" - " (declare (in) float y))\n" + " (declare (in) usampler3D sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float bias))\n" " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in) vec4 x)\n" - " (declare (in) float y))\n" + " (declare (in) samplerCube sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float bias))\n" " ())\n" - " (signature vec2\n" + " (signature ivec4\n" " (parameters\n" - " (declare (in) vec2 x)\n" - " (declare (in) vec2 y))\n" + " (declare (in) isamplerCube sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float bias))\n" " ())\n" - " (signature vec3\n" + " (signature uvec4\n" " (parameters\n" - " (declare (in) vec3 x)\n" - " (declare (in) vec3 y))\n" + " (declare (in) usamplerCube sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float bias))\n" " ())\n" - " (signature vec4\n" - " (parameters\n" - " (declare (in) vec4 x)\n" - " (declare (in) vec4 y))\n" - " ()))\n" - "(function min\n" " (signature float\n" " (parameters\n" - " (declare (in) float x)\n" - " (declare (in) float y))\n" + " (declare (in) sampler1DShadow sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float bias))\n" " ())\n" - " (signature vec2\n" + " (signature float\n" " (parameters\n" - " (declare (in) vec2 x)\n" - " (declare (in) vec2 y))\n" + " (declare (in) sampler2DShadow sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float bias))\n" " ())\n" - " (signature vec3\n" + " (signature float\n" " (parameters\n" - " (declare (in) vec3 x)\n" - " (declare (in) vec3 y))\n" + " (declare (in) samplerCubeShadow sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) float bias))\n" " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in) vec4 x)\n" - " (declare (in) vec4 y))\n" + " (declare (in) sampler1DArray sampler)\n" + " (declare (in) vec2 P)\n" + " (declare (in) float bias))\n" " ())\n" - " (signature vec2\n" + " (signature ivec4\n" " (parameters\n" - " (declare (in) vec2 x)\n" - " (declare (in) float y))\n" + " (declare (in) isampler1DArray sampler)\n" + " (declare (in) vec2 P)\n" + " (declare (in) float bias))\n" " ())\n" - " (signature vec3\n" + " (signature uvec4\n" " (parameters\n" - " (declare (in) vec3 x)\n" - " (declare (in) float y))\n" + " (declare (in) usampler1DArray sampler)\n" + " (declare (in) vec2 P)\n" + " (declare (in) float bias))\n" " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in) vec4 x)\n" - " (declare (in) float y))\n" - " ()))\n" - "(function max\n" - " (signature float\n" - " (parameters\n" - " (declare (in) float x)\n" - " (declare (in) float y))\n" + " (declare (in) sampler2DArray sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float bias))\n" " ())\n" - " (signature vec2\n" + " (signature ivec4\n" " (parameters\n" - " (declare (in) vec2 x)\n" - " (declare (in) vec2 y))\n" + " (declare (in) isampler2DArray sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float bias))\n" " ())\n" - " (signature vec3\n" + " (signature uvec4\n" " (parameters\n" - " (declare (in) vec3 x)\n" - " (declare (in) vec3 y))\n" + " (declare (in) usampler2DArray sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float bias))\n" " ())\n" + " (signature float\n" + " (parameters\n" + " (declare (in) sampler1DArrayShadow sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float bias))\n" + " ()))\n" + "(function textureProj\n" " (signature vec4\n" " (parameters\n" - " (declare (in) vec4 x)\n" - " (declare (in) vec4 y))\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) vec2 P))\n" " ())\n" - " (signature vec2\n" + " (signature ivec4\n" " (parameters\n" - " (declare (in) vec2 x)\n" - " (declare (in) float y))\n" + " (declare (in) isampler1D sampler)\n" + " (declare (in) vec2 P))\n" " ())\n" - " (signature vec3\n" + " (signature uvec4\n" " (parameters\n" - " (declare (in) vec3 x)\n" - " (declare (in) float y))\n" + " (declare (in) usampler1D sampler)\n" + " (declare (in) vec2 P))\n" " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in) vec4 x)\n" - " (declare (in) float y))\n" - " ()))\n" - "(function clamp\n" - " (signature float\n" - " (parameters\n" - " (declare (in) float x)\n" - " (declare (in) float minVal)\n" - " (declare (in) float maxVal))\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) vec4 P))\n" " ())\n" - " (signature vec2\n" + " (signature ivec4\n" " (parameters\n" - " (declare (in) vec2 x)\n" - " (declare (in) vec2 minVal)\n" - " (declare (in) vec2 maxVal))\n" + " (declare (in) isampler1D sampler)\n" + " (declare (in) vec4 P))\n" " ())\n" - " (signature vec3\n" + " (signature uvec4\n" " (parameters\n" - " (declare (in) vec3 x)\n" - " (declare (in) vec3 minVal)\n" - " (declare (in) vec3 maxVal))\n" + " (declare (in) usampler1D sampler)\n" + " (declare (in) vec4 P))\n" " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in) vec4 x)\n" - " (declare (in) vec4 minVal)\n" - " (declare (in) vec4 maxVal))\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec3 P))\n" " ())\n" - " (signature vec2\n" + " (signature ivec4\n" " (parameters\n" - " (declare (in) vec2 x)\n" - " (declare (in) float minVal)\n" - " (declare (in) float maxVal))\n" + " (declare (in) isampler2D sampler)\n" + " (declare (in) vec3 P))\n" " ())\n" - " (signature vec3\n" + " (signature uvec4\n" " (parameters\n" - " (declare (in) vec3 x)\n" - " (declare (in) float minVal)\n" - " (declare (in) float maxVal))\n" + " (declare (in) usampler2D sampler)\n" + " (declare (in) vec3 P))\n" " ())\n" " (signature vec4\n" - " (parameters\n" - " (declare (in) vec4 x)\n" - " (declare (in) float minVal)\n" - " (declare (in) float maxVal))\n" - " ()))\n" - "(function mix\n" - " (signature float\n" - " (parameters\n" - " (declare (in) float x)\n" - " (declare (in) float y)\n" - " (declare (in) float a))\n" + " (parameters\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec4 P))\n" " ())\n" - " (signature vec2\n" + " (signature ivec4\n" " (parameters\n" - " (declare (in) vec2 x)\n" - " (declare (in) vec2 y)\n" - " (declare (in) vec2 a))\n" + " (declare (in) isampler2D sampler)\n" + " (declare (in) vec4 P))\n" " ())\n" - " (signature vec3\n" + " (signature uvec4\n" " (parameters\n" - " (declare (in) vec3 x)\n" - " (declare (in) vec3 y)\n" - " (declare (in) vec3 a))\n" + " (declare (in) usampler2D sampler)\n" + " (declare (in) vec4 P))\n" " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in) vec4 x)\n" - " (declare (in) vec4 y)\n" - " (declare (in) vec4 a))\n" + " (declare (in) sampler3D sampler)\n" + " (declare (in) vec4 P))\n" " ())\n" - " (signature vec2\n" + " (signature ivec4\n" " (parameters\n" - " (declare (in) vec2 x)\n" - " (declare (in) vec2 y)\n" - " (declare (in) float a))\n" + " (declare (in) isampler3D sampler)\n" + " (declare (in) vec4 P))\n" " ())\n" - " (signature vec3\n" + " (signature uvec4\n" " (parameters\n" - " (declare (in) vec3 x)\n" - " (declare (in) vec3 y)\n" - " (declare (in) float a))\n" + " (declare (in) usampler3D sampler)\n" + " (declare (in) vec4 P))\n" " ())\n" - " (signature vec4\n" + " (signature float\n" " (parameters\n" - " (declare (in) vec4 x)\n" - " (declare (in) vec4 y)\n" - " (declare (in) float a))\n" - " ()))\n" - "(function step\n" + " (declare (in) sampler1DShadow sampler)\n" + " (declare (in) vec4 P))\n" + " ())\n" " (signature float\n" " (parameters\n" - " (declare (in) float edge)\n" - " (declare (in) float x))\n" + " (declare (in) sampler2DShadow sampler)\n" + " (declare (in) vec4 P))\n" " ())\n" - " (signature vec2\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) vec2 edge)\n" - " (declare (in) vec2 x))\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) vec2 P)\n" + " (declare (in) float bias))\n" " ())\n" - " (signature vec3\n" + " (signature ivec4\n" " (parameters\n" - " (declare (in) vec3 edge)\n" - " (declare (in) vec3 x))\n" + " (declare (in) isampler1D sampler)\n" + " (declare (in) vec2 P)\n" + " (declare (in) float bias))\n" + " ())\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler1D sampler)\n" + " (declare (in) vec2 P)\n" + " (declare (in) float bias))\n" " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in) vec4 edge)\n" - " (declare (in) vec4 x))\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) float bias))\n" " ())\n" - " (signature vec2\n" + " (signature ivec4\n" " (parameters\n" - " (declare (in) float edge)\n" - " (declare (in) vec2 x))\n" + " (declare (in) isampler1D sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) float bias))\n" " ())\n" - " (signature vec3\n" + " (signature uvec4\n" " (parameters\n" - " (declare (in) float edge)\n" - " (declare (in) vec3 x))\n" + " (declare (in) usampler1D sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) float bias))\n" " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in) float edge)\n" - " (declare (in) vec4 x))\n" - " ()))\n" - "(function smoothstep\n" - " (signature float\n" - " (parameters\n" - " (declare (in) float edge0)\n" - " (declare (in) float edge1)\n" - " (declare (in) float x))\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float bias))\n" " ())\n" - " (signature vec2\n" + " (signature ivec4\n" " (parameters\n" - " (declare (in) vec2 edge0)\n" - " (declare (in) vec2 edge1)\n" - " (declare (in) vec2 x))\n" + " (declare (in) isampler2D sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float bias))\n" " ())\n" - " (signature vec3\n" + " (signature uvec4\n" " (parameters\n" - " (declare (in) vec3 edge0)\n" - " (declare (in) vec3 edge1)\n" - " (declare (in) vec3 x))\n" + " (declare (in) usampler2D sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float bias))\n" " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in) vec4 edge0)\n" - " (declare (in) vec4 edge1)\n" - " (declare (in) vec4 x))\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) float bias))\n" " ())\n" - " (signature vec2\n" + " (signature ivec4\n" " (parameters\n" - " (declare (in) float edge0)\n" - " (declare (in) float edge1)\n" - " (declare (in) vec2 x))\n" + " (declare (in) isampler2D sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) float bias))\n" " ())\n" - " (signature vec3\n" + " (signature uvec4\n" " (parameters\n" - " (declare (in) float edge0)\n" - " (declare (in) float edge1)\n" - " (declare (in) vec3 x))\n" + " (declare (in) usampler2D sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) float bias))\n" " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in) float edge0)\n" - " (declare (in) float edge1)\n" - " (declare (in) vec4 x))\n" - " ()))\n" - "(function length\n" - " (signature float\n" + " (declare (in) sampler3D sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) float bias))\n" + " ())\n" + " (signature ivec4\n" " (parameters\n" - " (declare (in) float x))\n" + " (declare (in) isampler3D sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) float bias))\n" " ())\n" - " (signature float\n" + " (signature uvec4\n" " (parameters\n" - " (declare (in) vec2 x))\n" + " (declare (in) usampler3D sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) float bias))\n" " ())\n" " (signature float\n" " (parameters\n" - " (declare (in) vec3 x))\n" + " (declare (in) sampler1DShadow sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) float bias))\n" " ())\n" " (signature float\n" " (parameters\n" - " (declare (in) vec4 x))\n" + " (declare (in) sampler2DShadow sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) float bias))\n" " ()))\n" - "(function distance\n" - " (signature float\n" + "(function textureLod\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) float p0)\n" - " (declare (in) float p1))\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) float P)\n" + " (declare (in) float lod))\n" " ())\n" - " (signature float\n" + " (signature ivec4\n" " (parameters\n" - " (declare (in) vec2 p0)\n" - " (declare (in) vec2 p1))\n" + " (declare (in) isampler1D sampler)\n" + " (declare (in) float P)\n" + " (declare (in) float lod))\n" " ())\n" - " (signature float\n" + " (signature uvec4\n" " (parameters\n" - " (declare (in) vec3 p0)\n" - " (declare (in) vec3 p1))\n" + " (declare (in) usampler1D sampler)\n" + " (declare (in) float P)\n" + " (declare (in) float lod))\n" " ())\n" - " (signature float\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) vec4 p0)\n" - " (declare (in) vec4 p1))\n" - " ()))\n" - "(function dot\n" - " (signature float\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec2 P)\n" + " (declare (in) float lod))\n" + " ())\n" + " (signature ivec4\n" " (parameters\n" - " (declare (in) float x)\n" - " (declare (in) float y))\n" + " (declare (in) isampler2D sampler)\n" + " (declare (in) vec2 P)\n" + " (declare (in) float lod))\n" " ())\n" - " (signature float\n" + " (signature uvec4\n" " (parameters\n" - " (declare (in) vec2 x)\n" - " (declare (in) vec2 y))\n" + " (declare (in) usampler2D sampler)\n" + " (declare (in) vec2 P)\n" + " (declare (in) float lod))\n" " ())\n" - " (signature float\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) vec3 x)\n" - " (declare (in) vec3 y))\n" + " (declare (in) sampler3D sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float lod))\n" " ())\n" - " (signature float\n" + " (signature ivec4\n" " (parameters\n" - " (declare (in) vec4 x)\n" - " (declare (in) vec4 y))\n" - " ()))\n" - "(function cross\n" - " (signature vec3\n" + " (declare (in) isampler3D sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float lod))\n" + " ())\n" + " (signature uvec4\n" " (parameters\n" - " (declare (in) vec3 x)\n" - " (declare (in) vec3 y))\n" - " ()))\n" - "(function normalize\n" - " (signature float\n" + " (declare (in) usampler3D sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float lod))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) samplerCube sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float lod))\n" + " ())\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isamplerCube sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float lod))\n" + " ())\n" + " (signature uvec4\n" " (parameters\n" - " (declare (in) float x))\n" + " (declare (in) usamplerCube sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float lod))\n" " ())\n" - " (signature vec2\n" + " (signature float\n" " (parameters\n" - " (declare (in) vec2 x))\n" + " (declare (in) sampler1DShadow sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float lod))\n" " ())\n" - " (signature vec3\n" + " (signature float\n" " (parameters\n" - " (declare (in) vec3 x))\n" + " (declare (in) sampler2DShadow sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float lod))\n" " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in) vec4 x))\n" - " ()))\n" - "(function faceforward\n" - " (signature float\n" - " (parameters\n" - " (declare (in) float N)\n" - " (declare (in) float I)\n" - " (declare (in) float Nref))\n" + " (declare (in) sampler1DArray sampler)\n" + " (declare (in) vec2 P)\n" + " (declare (in) float lod))\n" " ())\n" - " (signature vec2\n" + " (signature ivec4\n" " (parameters\n" - " (declare (in) vec2 N)\n" - " (declare (in) vec2 I)\n" - " (declare (in) vec2 Nref))\n" + " (declare (in) isampler1DArray sampler)\n" + " (declare (in) vec2 P)\n" + " (declare (in) float lod))\n" " ())\n" - " (signature vec3\n" + " (signature uvec4\n" " (parameters\n" - " (declare (in) vec3 N)\n" - " (declare (in) vec3 I)\n" - " (declare (in) vec3 Nref))\n" + " (declare (in) usampler1DArray sampler)\n" + " (declare (in) vec2 P)\n" + " (declare (in) float lod))\n" " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in) vec4 N)\n" - " (declare (in) vec4 I)\n" - " (declare (in) vec4 Nref))\n" - " ()))\n" - "(function reflect\n" - " (signature float\n" - " (parameters\n" - " (declare (in) float I)\n" - " (declare (in) float N))\n" + " (declare (in) sampler2DArray sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float lod))\n" " ())\n" - " (signature vec2\n" + " (signature ivec4\n" " (parameters\n" - " (declare (in) vec2 I)\n" - " (declare (in) vec2 N))\n" + " (declare (in) isampler2DArray sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float lod))\n" " ())\n" - " (signature vec3\n" + " (signature uvec4\n" " (parameters\n" - " (declare (in) vec3 I)\n" - " (declare (in) vec3 N))\n" + " (declare (in) usampler2DArray sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float lod))\n" " ())\n" - " (signature vec4\n" + " (signature float\n" " (parameters\n" - " (declare (in) vec4 I)\n" - " (declare (in) vec4 N))\n" + " (declare (in) sampler1DArrayShadow sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float lod))\n" " ()))\n" - "(function refract\n" - " (signature float\n" + "(function texelFetch\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) float I)\n" - " (declare (in) float N)\n" - " (declare (in) float eta))\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) int P)\n" + " (declare (in) int lod))\n" " ())\n" - " (signature vec2\n" + " (signature ivec4\n" " (parameters\n" - " (declare (in) vec2 I)\n" - " (declare (in) vec2 N)\n" - " (declare (in) float eta))\n" + " (declare (in) isampler1D sampler)\n" + " (declare (in) int P)\n" + " (declare (in) int lod))\n" " ())\n" - " (signature vec3\n" + " (signature uvec4\n" " (parameters\n" - " (declare (in) vec3 I)\n" - " (declare (in) vec3 N)\n" - " (declare (in) float eta))\n" + " (declare (in) usampler1D sampler)\n" + " (declare (in) int P)\n" + " (declare (in) int lod))\n" " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in) vec4 I)\n" - " (declare (in) vec4 N)\n" - " (declare (in) float eta))\n" - " ()))\n" - "(function matrixCompMult\n" - " (signature mat2\n" - " (parameters\n" - " (declare (in) mat2 x)\n" - " (declare (in) mat2 y))\n" - " ())\n" - " (signature mat3\n" - " (parameters\n" - " (declare (in) mat3 x)\n" - " (declare (in) mat3 y))\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) ivec2 P)\n" + " (declare (in) int lod))\n" " ())\n" - " (signature mat4\n" + " (signature ivec4\n" " (parameters\n" - " (declare (in) mat4 x)\n" - " (declare (in) mat4 y))\n" + " (declare (in) isampler2D sampler)\n" + " (declare (in) ivec2 P)\n" + " (declare (in) int lod))\n" " ())\n" - " (signature mat2x3\n" + " (signature uvec4\n" " (parameters\n" - " (declare (in) mat2x3 x)\n" - " (declare (in) mat2x3 y))\n" + " (declare (in) usampler2D sampler)\n" + " (declare (in) ivec2 P)\n" + " (declare (in) int lod))\n" " ())\n" - " (signature mat2x4\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) mat2x4 x)\n" - " (declare (in) mat2x4 y))\n" + " (declare (in) sampler3D sampler)\n" + " (declare (in) ivec3 P)\n" + " (declare (in) int lod))\n" " ())\n" - " (signature mat3x2\n" + " (signature ivec4\n" " (parameters\n" - " (declare (in) mat3x2 x)\n" - " (declare (in) mat3x2 y))\n" + " (declare (in) isampler3D sampler)\n" + " (declare (in) ivec3 P)\n" + " (declare (in) int lod))\n" " ())\n" - " (signature mat3x4\n" + " (signature uvec4\n" " (parameters\n" - " (declare (in) mat3x4 x)\n" - " (declare (in) mat3x4 y))\n" + " (declare (in) usampler3D sampler)\n" + " (declare (in) ivec3 P)\n" + " (declare (in) int lod))\n" " ())\n" - " (signature mat4x2\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) mat4x2 x)\n" - " (declare (in) mat4x2 y))\n" + " (declare (in) sampler1DArray sampler)\n" + " (declare (in) ivec2 P)\n" + " (declare (in) int lod))\n" " ())\n" - " (signature mat4x3\n" - " (parameters\n" - " (declare (in) mat4x3 x)\n" - " (declare (in) mat4x3 y))\n" - " ()))\n" - "(function outerProduct\n" - " (signature mat2\n" + " (signature ivec4\n" " (parameters\n" - " (declare (in) vec2 c)\n" - " (declare (in) vec2 r))\n" + " (declare (in) isampler1DArray sampler)\n" + " (declare (in) ivec2 P)\n" + " (declare (in) int lod))\n" " ())\n" - " (signature mat3\n" + " (signature uvec4\n" " (parameters\n" - " (declare (in) vec3 c)\n" - " (declare (in) vec3 r))\n" + " (declare (in) usampler1DArray sampler)\n" + " (declare (in) ivec2 P)\n" + " (declare (in) int lod))\n" " ())\n" - " (signature mat4\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) vec4 c)\n" - " (declare (in) vec4 r))\n" + " (declare (in) sampler2DArray sampler)\n" + " (declare (in) ivec3 P)\n" + " (declare (in) int lod))\n" " ())\n" - " (signature mat2x3\n" + " (signature ivec4\n" " (parameters\n" - " (declare (in) vec3 c)\n" - " (declare (in) vec2 r))\n" + " (declare (in) isampler2DArray sampler)\n" + " (declare (in) ivec3 P)\n" + " (declare (in) int lod))\n" " ())\n" - " (signature mat3x2\n" + " (signature uvec4\n" " (parameters\n" - " (declare (in) vec2 c)\n" - " (declare (in) vec3 r))\n" - " ())\n" - " (signature mat2x4\n" + " (declare (in) usampler2DArray sampler)\n" + " (declare (in) ivec3 P)\n" + " (declare (in) int lod))\n" + " ()))\n" + "(function textureProjLod\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) vec4 c)\n" - " (declare (in) vec2 r))\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) vec2 P)\n" + " (declare (in) float lod))\n" " ())\n" - " (signature mat4x2\n" + " (signature ivec4\n" " (parameters\n" - " (declare (in) vec2 c)\n" - " (declare (in) vec4 r))\n" + " (declare (in) isampler1D sampler)\n" + " (declare (in) vec2 P)\n" + " (declare (in) float lod))\n" " ())\n" - " (signature mat3x4\n" + " (signature uvec4\n" " (parameters\n" - " (declare (in) vec4 c)\n" - " (declare (in) vec3 r))\n" + " (declare (in) usampler1D sampler)\n" + " (declare (in) vec2 P)\n" + " (declare (in) float lod))\n" " ())\n" - " (signature mat4x3\n" - " (parameters\n" - " (declare (in) vec3 c)\n" - " (declare (in) vec4 r))\n" - " ()))\n" - "(function transpose\n" - " (signature mat2\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) mat2 m))\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) float lod))\n" " ())\n" - " (signature mat3\n" + " (signature ivec4\n" " (parameters\n" - " (declare (in) mat3 m))\n" + " (declare (in) isampler1D sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) float lod))\n" " ())\n" - " (signature mat4\n" + " (signature uvec4\n" " (parameters\n" - " (declare (in) mat4 m))\n" + " (declare (in) usampler1D sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) float lod))\n" " ())\n" - " (signature mat2x3\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) mat3x2 m))\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float lod))\n" " ())\n" - " (signature mat3x2\n" + " (signature ivec4\n" " (parameters\n" - " (declare (in) mat2x3 m))\n" + " (declare (in) isampler2D sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float lod))\n" " ())\n" - " (signature mat2x4\n" + " (signature uvec4\n" " (parameters\n" - " (declare (in) mat4x2 m))\n" + " (declare (in) usampler2D sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float lod))\n" " ())\n" - " (signature mat4x2\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) mat2x4 m))\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) float lod))\n" " ())\n" - " (signature mat3x4\n" + " (signature ivec4\n" " (parameters\n" - " (declare (in) mat4x3 m))\n" + " (declare (in) isampler2D sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) float lod))\n" " ())\n" - " (signature mat4x3\n" - " (parameters\n" - " (declare (in) mat3x4 m))\n" - " ()))\n" - "(function lessThan\n" - " (signature bvec2\n" + " (signature uvec4\n" " (parameters\n" - " (declare (in) vec2 x)\n" - " (declare (in) vec2 y))\n" + " (declare (in) usampler2D sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) float lod))\n" " ())\n" - " (signature bvec3\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) vec3 x)\n" - " (declare (in) vec3 y))\n" + " (declare (in) sampler3D sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) float lod))\n" " ())\n" - " (signature bvec4\n" + " (signature ivec4\n" " (parameters\n" - " (declare (in) vec4 x)\n" - " (declare (in) vec4 y))\n" + " (declare (in) isampler3D sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) float lod))\n" " ())\n" - " (signature bvec2\n" + " (signature uvec4\n" " (parameters\n" - " (declare (in) ivec2 x)\n" - " (declare (in) ivec2 y))\n" + " (declare (in) usampler3D sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) float lod))\n" " ())\n" - " (signature bvec3\n" + " (signature float\n" " (parameters\n" - " (declare (in) ivec3 x)\n" - " (declare (in) ivec3 y))\n" + " (declare (in) sampler1DShadow sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) float lod))\n" " ())\n" - " (signature bvec4\n" + " (signature float\n" " (parameters\n" - " (declare (in) ivec4 x)\n" - " (declare (in) ivec4 y))\n" + " (declare (in) sampler2DShadow sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) float lod))\n" " ()))\n" - "(function lessThanEqual\n" - " (signature bvec2\n" - " (parameters\n" - " (declare (in) vec2 x)\n" - " (declare (in) vec2 y))\n" - " ())\n" - " (signature bvec3\n" + "(function textureGrad\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) vec3 x)\n" - " (declare (in) vec3 y))\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) float P)\n" + " (declare (in) float dPdx)\n" + " (declare (in) float dPdy))\n" " ())\n" - " (signature bvec4\n" + " (signature ivec4\n" " (parameters\n" - " (declare (in) vec4 x)\n" - " (declare (in) vec4 y))\n" + " (declare (in) isampler1D sampler)\n" + " (declare (in) float P)\n" + " (declare (in) float dPdx)\n" + " (declare (in) float dPdy))\n" " ())\n" - " (signature bvec2\n" + " (signature uvec4\n" " (parameters\n" - " (declare (in) ivec2 x)\n" - " (declare (in) ivec2 y))\n" + " (declare (in) usampler1D sampler)\n" + " (declare (in) float P)\n" + " (declare (in) float dPdx)\n" + " (declare (in) float dPdy))\n" " ())\n" - " (signature bvec3\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) ivec3 x)\n" - " (declare (in) ivec3 y))\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec2 P)\n" + " (declare (in) vec2 dPdx)\n" + " (declare (in) vec2 dPdy))\n" " ())\n" - " (signature bvec4\n" - " (parameters\n" - " (declare (in) ivec4 x)\n" - " (declare (in) ivec4 y))\n" - " ()))\n" - "(function greaterThan\n" - " (signature bvec2\n" + " (signature ivec4\n" " (parameters\n" - " (declare (in) vec2 x)\n" - " (declare (in) vec2 y))\n" + " (declare (in) isampler2D sampler)\n" + " (declare (in) vec2 P)\n" + " (declare (in) vec2 dPdx)\n" + " (declare (in) vec2 dPdy))\n" " ())\n" - " (signature bvec3\n" + " (signature uvec4\n" " (parameters\n" - " (declare (in) vec3 x)\n" - " (declare (in) vec3 y))\n" + " (declare (in) usampler2D sampler)\n" + " (declare (in) vec2 P)\n" + " (declare (in) vec2 dPdx)\n" + " (declare (in) vec2 dPdy))\n" " ())\n" - " (signature bvec4\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) vec4 x)\n" - " (declare (in) vec4 y))\n" + " (declare (in) sampler3D sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) vec3 dPdx)\n" + " (declare (in) vec3 dPdy))\n" " ())\n" - " (signature bvec2\n" + " (signature ivec4\n" " (parameters\n" - " (declare (in) ivec2 x)\n" - " (declare (in) ivec2 y))\n" + " (declare (in) isampler3D sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) vec3 dPdx)\n" + " (declare (in) vec3 dPdy))\n" " ())\n" - " (signature bvec3\n" + " (signature uvec4\n" " (parameters\n" - " (declare (in) ivec3 x)\n" - " (declare (in) ivec3 y))\n" + " (declare (in) usampler3D sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) vec3 dPdx)\n" + " (declare (in) vec3 dPdy))\n" " ())\n" - " (signature bvec4\n" - " (parameters\n" - " (declare (in) ivec4 x)\n" - " (declare (in) ivec4 y))\n" - " ()))\n" - "(function greaterThanEqual\n" - " (signature bvec2\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) vec2 x)\n" - " (declare (in) vec2 y))\n" + " (declare (in) samplerCube sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) vec3 dPdx)\n" + " (declare (in) vec3 dPdy))\n" " ())\n" - " (signature bvec3\n" + " (signature ivec4\n" " (parameters\n" - " (declare (in) vec3 x)\n" - " (declare (in) vec3 y))\n" + " (declare (in) isamplerCube sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) vec3 dPdx)\n" + " (declare (in) vec3 dPdy))\n" " ())\n" - " (signature bvec4\n" + " (signature uvec4\n" " (parameters\n" - " (declare (in) vec4 x)\n" - " (declare (in) vec4 y))\n" + " (declare (in) usamplerCube sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) vec3 dPdx)\n" + " (declare (in) vec3 dPdy))\n" " ())\n" - " (signature bvec2\n" + " (signature float\n" " (parameters\n" - " (declare (in) ivec2 x)\n" - " (declare (in) ivec2 y))\n" + " (declare (in) sampler1DShadow sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float dPdx)\n" + " (declare (in) float dPdy))\n" " ())\n" - " (signature bvec3\n" + " (signature float\n" " (parameters\n" - " (declare (in) ivec3 x)\n" - " (declare (in) ivec3 y))\n" + " (declare (in) sampler2DShadow sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) vec2 dPdx)\n" + " (declare (in) vec2 dPdy))\n" " ())\n" - " (signature bvec4\n" - " (parameters\n" - " (declare (in) ivec4 x)\n" - " (declare (in) ivec4 y))\n" - " ()))\n" - "(function equal\n" - " (signature bvec2\n" + " (signature float\n" " (parameters\n" - " (declare (in) vec2 x)\n" - " (declare (in) vec2 y))\n" + " (declare (in) samplerCubeShadow sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) vec3 dPdx)\n" + " (declare (in) vec3 dPdy))\n" " ())\n" - " (signature bvec3\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) vec3 x)\n" - " (declare (in) vec3 y))\n" + " (declare (in) sampler1DArray sampler)\n" + " (declare (in) vec2 P)\n" + " (declare (in) float dPdx)\n" + " (declare (in) float dPdy))\n" " ())\n" - " (signature bvec4\n" + " (signature ivec4\n" " (parameters\n" - " (declare (in) vec4 x)\n" - " (declare (in) vec4 y))\n" + " (declare (in) isampler1DArray sampler)\n" + " (declare (in) vec2 P)\n" + " (declare (in) float dPdx)\n" + " (declare (in) float dPdy))\n" " ())\n" - " (signature bvec2\n" + " (signature uvec4\n" " (parameters\n" - " (declare (in) ivec2 x)\n" - " (declare (in) ivec2 y))\n" + " (declare (in) usampler1DArray sampler)\n" + " (declare (in) vec2 P)\n" + " (declare (in) float dPdx)\n" + " (declare (in) float dPdy))\n" " ())\n" - " (signature bvec3\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) ivec3 x)\n" - " (declare (in) ivec3 y))\n" + " (declare (in) sampler2DArray sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) vec2 dPdx)\n" + " (declare (in) vec2 dPdy))\n" " ())\n" - " (signature bvec4\n" + " (signature ivec4\n" " (parameters\n" - " (declare (in) ivec4 x)\n" - " (declare (in) ivec4 y))\n" + " (declare (in) isampler2DArray sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) vec2 dPdx)\n" + " (declare (in) vec2 dPdy))\n" " ())\n" - " (signature bvec2\n" + " (signature uvec4\n" " (parameters\n" - " (declare (in) bvec2 x)\n" - " (declare (in) bvec2 y))\n" + " (declare (in) usampler2DArray sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) vec2 dPdx)\n" + " (declare (in) vec2 dPdy))\n" " ())\n" - " (signature bvec3\n" + " (signature float\n" " (parameters\n" - " (declare (in) bvec3 x)\n" - " (declare (in) bvec3 y))\n" + " (declare (in) sampler1DArrayShadow sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float dPdx)\n" + " (declare (in) float dPdy))\n" " ())\n" - " (signature bvec4\n" + " (signature float\n" " (parameters\n" - " (declare (in) bvec4 x)\n" - " (declare (in) bvec4 y))\n" + " (declare (in) sampler2DArrayShadow sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) vec2 dPdx)\n" + " (declare (in) vec2 dPdy))\n" " ()))\n" - "(function notEqual\n" - " (signature bvec2\n" + "(function textureProjGrad\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) vec2 x)\n" - " (declare (in) vec2 y))\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) vec2 P)\n" + " (declare (in) float dPdx)\n" + " (declare (in) float dPdy))\n" " ())\n" - " (signature bvec3\n" + " (signature ivec4\n" " (parameters\n" - " (declare (in) vec3 x)\n" - " (declare (in) vec3 y))\n" + " (declare (in) isampler1D sampler)\n" + " (declare (in) vec2 P)\n" + " (declare (in) float dPdx)\n" + " (declare (in) float dPdy))\n" " ())\n" - " (signature bvec4\n" + " (signature uvec4\n" " (parameters\n" - " (declare (in) vec4 x)\n" - " (declare (in) vec4 y))\n" + " (declare (in) usampler1D sampler)\n" + " (declare (in) vec2 P)\n" + " (declare (in) float dPdx)\n" + " (declare (in) float dPdy))\n" " ())\n" - " (signature bvec2\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) ivec2 x)\n" - " (declare (in) ivec2 y))\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) float dPdx)\n" + " (declare (in) float dPdy))\n" " ())\n" - " (signature bvec3\n" + " (signature ivec4\n" " (parameters\n" - " (declare (in) ivec3 x)\n" - " (declare (in) ivec3 y))\n" + " (declare (in) isampler1D sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) float dPdx)\n" + " (declare (in) float dPdy))\n" " ())\n" - " (signature bvec4\n" + " (signature uvec4\n" " (parameters\n" - " (declare (in) ivec4 x)\n" - " (declare (in) ivec4 y))\n" + " (declare (in) usampler1D sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) float dPdx)\n" + " (declare (in) float dPdy))\n" " ())\n" - " (signature bvec2\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) bvec2 x)\n" - " (declare (in) bvec2 y))\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) vec2 dPdx)\n" + " (declare (in) vec2 dPdy))\n" " ())\n" - " (signature bvec3\n" + " (signature ivec4\n" " (parameters\n" - " (declare (in) bvec3 x)\n" - " (declare (in) bvec3 y))\n" + " (declare (in) isampler2D sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) vec2 dPdx)\n" + " (declare (in) vec2 dPdy))\n" " ())\n" - " (signature bvec4\n" - " (parameters\n" - " (declare (in) bvec4 x)\n" - " (declare (in) bvec4 y))\n" - " ()))\n" - "(function any\n" - " (signature bool\n" + " (signature uvec4\n" " (parameters\n" - " (declare (in) bvec2 x))\n" + " (declare (in) usampler2D sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) vec2 dPdx)\n" + " (declare (in) vec2 dPdy))\n" " ())\n" - " (signature bool\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) bvec3 x))\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) vec2 dPdx)\n" + " (declare (in) vec2 dPdy))\n" " ())\n" - " (signature bool\n" + " (signature ivec4\n" " (parameters\n" - " (declare (in) bvec4 x))\n" - " ()))\n" - "(function all\n" - " (signature bool\n" + " (declare (in) isampler2D sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) vec2 dPdx)\n" + " (declare (in) vec2 dPdy))\n" + " ())\n" + " (signature uvec4\n" " (parameters\n" - " (declare (in) bvec2 x))\n" + " (declare (in) usampler2D sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) vec2 dPdx)\n" + " (declare (in) vec2 dPdy))\n" " ())\n" - " (signature bool\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) bvec3 x))\n" + " (declare (in) sampler3D sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) vec3 dPdx)\n" + " (declare (in) vec3 dPdy))\n" " ())\n" - " (signature bool\n" + " (signature ivec4\n" " (parameters\n" - " (declare (in) bvec4 x))\n" - " ()))\n" - "(function not\n" - " (signature bvec2\n" + " (declare (in) isampler3D sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) vec3 dPdx)\n" + " (declare (in) vec3 dPdy))\n" + " ())\n" + " (signature uvec4\n" " (parameters\n" - " (declare (in) bvec2 x))\n" + " (declare (in) usampler3D sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) vec3 dPdx)\n" + " (declare (in) vec3 dPdy))\n" " ())\n" - " (signature bvec3\n" + " (signature float\n" " (parameters\n" - " (declare (in) bvec3 x))\n" + " (declare (in) sampler1DShadow sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) float dPdx)\n" + " (declare (in) float dPdy))\n" " ())\n" - " (signature bvec4\n" + " (signature float\n" " (parameters\n" - " (declare (in) bvec4 x))\n" + " (declare (in) sampler2DShadow sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) vec2 dPdx)\n" + " (declare (in) vec2 dPdy))\n" " ()))\n" "(function texture1D\n" " (signature vec4\n" @@ -16452,6 +16211,26 @@ static const char *prototypes_for_120_frag = " (declare (in) vec4 coord)\n" " (declare (in) float bias))\n" " ()))\n" + "(function texture1DLod\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) float coord)\n" + " (declare (in) float lod))\n" + " ()))\n" + "(function texture1DProjLod\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) vec2 coord)\n" + " (declare (in) float lod))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) vec4 coord)\n" + " (declare (in) float lod))\n" + " ()))\n" "(function texture2D\n" " (signature vec4\n" " (parameters\n" @@ -16487,6 +16266,26 @@ static const char *prototypes_for_120_frag = " (declare (in) vec4 coord)\n" " (declare (in) float bias))\n" " ()))\n" + "(function texture2DLod\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec2 coord)\n" + " (declare (in) float lod))\n" + " ()))\n" + "(function texture2DProjLod\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec3 coord)\n" + " (declare (in) float lod))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec4 coord)\n" + " (declare (in) float lod))\n" + " ()))\n" "(function texture3D\n" " (signature vec4\n" " (parameters\n" @@ -16511,6 +16310,20 @@ static const char *prototypes_for_120_frag = " (declare (in) vec4 coord)\n" " (declare (in) float bias))\n" " ()))\n" + "(function texture3DLod\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler3D sampler)\n" + " (declare (in) vec3 coord)\n" + " (declare (in) float lod))\n" + " ()))\n" + "(function texture3DProjLod\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler3D sampler)\n" + " (declare (in) vec4 coord)\n" + " (declare (in) float lod))\n" + " ()))\n" "(function textureCube\n" " (signature vec4\n" " (parameters\n" @@ -16523,6 +16336,13 @@ static const char *prototypes_for_120_frag = " (declare (in) vec3 coord)\n" " (declare (in) float bias))\n" " ()))\n" + "(function textureCubeLod\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) samplerCube sampler)\n" + " (declare (in) vec3 coord)\n" + " (declare (in) float lod))\n" + " ()))\n" "(function shadow1D\n" " (signature vec4\n" " (parameters\n" @@ -16543,220 +16363,400 @@ static const char *prototypes_for_120_frag = " ())\n" " (signature vec4\n" " (parameters\n" - " (declare (in) sampler2DShadow sampler)\n" + " (declare (in) sampler2DShadow sampler)\n" + " (declare (in) vec3 coord)\n" + " (declare (in) float bias))\n" + " ()))\n" + "(function shadow1DProj\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1DShadow sampler)\n" + " (declare (in) vec4 coord))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1DShadow sampler)\n" + " (declare (in) vec4 coord)\n" + " (declare (in) float bias))\n" + " ()))\n" + "(function shadow2DProj\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2DShadow sampler)\n" + " (declare (in) vec4 coord))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2DShadow sampler)\n" + " (declare (in) vec4 coord)\n" + " (declare (in) float bias))\n" + " ()))\n" + "(function shadow1DLod\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1DShadow sampler)\n" " (declare (in) vec3 coord)\n" - " (declare (in) float bias))\n" + " (declare (in) float lod))\n" " ()))\n" - "(function shadow1DProj\n" + "(function shadow2DLod\n" " (signature vec4\n" " (parameters\n" - " (declare (in) sampler1DShadow sampler)\n" - " (declare (in) vec4 coord))\n" - " ())\n" + " (declare (in) sampler2DShadow sampler)\n" + " (declare (in) vec3 coord)\n" + " (declare (in) float lod))\n" + " ()))\n" + "(function shadow1DProjLod\n" " (signature vec4\n" " (parameters\n" " (declare (in) sampler1DShadow sampler)\n" " (declare (in) vec4 coord)\n" - " (declare (in) float bias))\n" + " (declare (in) float lod))\n" " ()))\n" - "(function shadow2DProj\n" - " (signature vec4\n" - " (parameters\n" - " (declare (in) sampler2DShadow sampler)\n" - " (declare (in) vec4 coord))\n" - " ())\n" + "(function shadow2DProjLod\n" " (signature vec4\n" " (parameters\n" " (declare (in) sampler2DShadow sampler)\n" " (declare (in) vec4 coord)\n" - " (declare (in) float bias))\n" + " (declare (in) float lod))\n" " ()))\n" - "(function dFdx\n" + "(function noise1\n" " (signature float\n" " (parameters\n" - " (declare (in) float p))\n" + " (declare (in) float x))\n" " ())\n" - " (signature vec2\n" + " (signature float\n" " (parameters\n" - " (declare (in) vec2 p))\n" + " (declare (in) vec2 x))\n" " ())\n" - " (signature vec3\n" + " (signature float\n" " (parameters\n" - " (declare (in) vec3 p))\n" + " (declare (in) vec3 x))\n" " ())\n" - " (signature vec4\n" + " (signature float\n" " (parameters\n" - " (declare (in) vec4 p))\n" + " (declare (in) vec4 x))\n" " ()))\n" - "(function dFdy\n" - " (signature float\n" + "(function noise2\n" + " (signature vec2\n" " (parameters\n" - " (declare (in) float p))\n" + " (declare (in) float x))\n" " ())\n" " (signature vec2\n" " (parameters\n" - " (declare (in) vec2 p))\n" + " (declare (in) vec2 x))\n" " ())\n" - " (signature vec3\n" + " (signature vec2\n" " (parameters\n" - " (declare (in) vec3 p))\n" + " (declare (in) vec3 x))\n" " ())\n" - " (signature vec4\n" + " (signature vec2\n" " (parameters\n" - " (declare (in) vec4 p))\n" + " (declare (in) vec4 x))\n" " ()))\n" - "(function fwidth\n" - " (signature float\n" + "(function noise3\n" + " (signature vec3\n" " (parameters\n" - " (declare (in) float p))\n" + " (declare (in) float x))\n" " ())\n" - " (signature vec2\n" + " (signature vec3\n" " (parameters\n" - " (declare (in) vec2 p))\n" + " (declare (in) vec2 x))\n" " ())\n" " (signature vec3\n" " (parameters\n" - " (declare (in) vec3 p))\n" + " (declare (in) vec3 x))\n" " ())\n" - " (signature vec4\n" + " (signature vec3\n" " (parameters\n" - " (declare (in) vec4 p))\n" + " (declare (in) vec4 x))\n" " ()))\n" - "(function noise1\n" - " (signature float\n" + "(function noise4\n" + " (signature vec4\n" " (parameters\n" " (declare (in) float x))\n" " ())\n" - " (signature float\n" + " (signature vec4\n" " (parameters\n" " (declare (in) vec2 x))\n" " ())\n" - " (signature float\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x))\n" + " ())))" +; +static const char *functions_for_130_vert [] = { + builtin_abs, + builtin_acos, + builtin_all, + builtin_any, + builtin_asin, + builtin_atan, + builtin_ceil, + builtin_clamp, + builtin_cos, + builtin_cosh, + builtin_cross, + builtin_degrees, + builtin_distance, + builtin_dot, + builtin_equal, + builtin_exp, + builtin_exp2, + builtin_faceforward, + builtin_floor, + builtin_fract, + builtin_ftransform, + builtin_greaterThan, + builtin_greaterThanEqual, + builtin_inversesqrt, + builtin_length, + builtin_lessThan, + builtin_lessThanEqual, + builtin_log, + builtin_log2, + builtin_matrixCompMult, + builtin_max, + builtin_min, + builtin_mix, + builtin_mod, + builtin_noise1, + builtin_noise2, + builtin_noise3, + builtin_noise4, + builtin_normalize, + builtin_not, + builtin_notEqual, + builtin_outerProduct, + builtin_pow, + builtin_radians, + builtin_reflect, + builtin_refract, + builtin_shadow1D, + builtin_shadow1DLod, + builtin_shadow1DProj, + builtin_shadow1DProjLod, + builtin_shadow2D, + builtin_shadow2DLod, + builtin_shadow2DProj, + builtin_shadow2DProjLod, + builtin_sign, + builtin_sin, + builtin_sinh, + builtin_smoothstep, + builtin_sqrt, + builtin_step, + builtin_tan, + builtin_tanh, + builtin_texelFetch, + builtin_texture, + builtin_texture1D, + builtin_texture1DLod, + builtin_texture1DProj, + builtin_texture1DProjLod, + builtin_texture2D, + builtin_texture2DLod, + builtin_texture2DProj, + builtin_texture2DProjLod, + builtin_texture3D, + builtin_texture3DLod, + builtin_texture3DProj, + builtin_texture3DProjLod, + builtin_textureCube, + builtin_textureCubeLod, + builtin_textureGrad, + builtin_textureLod, + builtin_textureProj, + builtin_textureProjGrad, + builtin_textureProjLod, + builtin_transpose, +}; +static const char *prototypes_for_ARB_texture_rectangle_frag = + "(\n" + "(function texture2DRect\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2DRect sampler)\n" + " (declare (in) vec2 coord))\n" + " ()))\n" + "(function texture2DRectProj\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2DRect sampler)\n" + " (declare (in) vec3 coord))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2DRect sampler)\n" + " (declare (in) vec4 coord))\n" + " ()))\n" + "(function shadow2DRect\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2DRectShadow sampler)\n" + " (declare (in) vec3 coord))\n" + " ()))\n" + "(function shadow2DRectProj\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2DRectShadow sampler)\n" + " (declare (in) vec4 coord))\n" + " ())))" +; +static const char *functions_for_ARB_texture_rectangle_frag [] = { + builtin_shadow2DRect, + builtin_shadow2DRectProj, + builtin_texture2DRect, + builtin_texture2DRectProj, +}; +static const char *prototypes_for_ARB_texture_rectangle_vert = + "(\n" + "(function texture2DRect\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2DRect sampler)\n" + " (declare (in) vec2 coord))\n" + " ()))\n" + "(function texture2DRectProj\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2DRect sampler)\n" + " (declare (in) vec3 coord))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2DRect sampler)\n" + " (declare (in) vec4 coord))\n" + " ()))\n" + "(function shadow2DRect\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2DRectShadow sampler)\n" + " (declare (in) vec3 coord))\n" + " ()))\n" + "(function shadow2DRectProj\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2DRectShadow sampler)\n" + " (declare (in) vec4 coord))\n" + " ())))" +; +static const char *functions_for_ARB_texture_rectangle_vert [] = { + builtin_shadow2DRect, + builtin_shadow2DRectProj, + builtin_texture2DRect, + builtin_texture2DRectProj, +}; +static const char *prototypes_for_EXT_texture_array_frag = + "(\n" + "(function texture1DArray\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) vec3 x))\n" + " (declare (in) sampler1DArray sampler)\n" + " (declare (in) vec2 coord))\n" " ())\n" - " (signature float\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) vec4 x))\n" + " (declare (in) sampler1DArray sampler)\n" + " (declare (in) vec2 coord)\n" + " (declare (in) float bias))\n" " ()))\n" - "(function noise2\n" - " (signature vec2\n" + "(function texture2DArray\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) float x))\n" + " (declare (in) sampler2DArray sampler)\n" + " (declare (in) vec3 coord))\n" " ())\n" - " (signature vec2\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) vec2 x))\n" - " ())\n" - " (signature vec2\n" + " (declare (in) sampler2DArray sampler)\n" + " (declare (in) vec3 coord)\n" + " (declare (in) float bias))\n" + " ()))\n" + "(function shadow1DArray\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) vec3 x))\n" + " (declare (in) sampler1DArrayShadow sampler)\n" + " (declare (in) vec3 coord))\n" " ())\n" - " (signature vec2\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) vec4 x))\n" + " (declare (in) sampler1DArrayShadow sampler)\n" + " (declare (in) vec3 coord)\n" + " (declare (in) float bias))\n" " ()))\n" - "(function noise3\n" - " (signature vec3\n" + "(function shadow2DArray\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) float x))\n" - " ())\n" - " (signature vec3\n" + " (declare (in) sampler2DArrayShadow sampler)\n" + " (declare (in) vec4 coord))\n" + " ())))" +; +static const char *functions_for_EXT_texture_array_frag [] = { + builtin_shadow1DArray, + builtin_shadow2DArray, + builtin_texture1DArray, + builtin_texture2DArray, +}; +static const char *prototypes_for_EXT_texture_array_vert = + "(\n" + "(function texture1DArray\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) vec2 x))\n" - " ())\n" - " (signature vec3\n" + " (declare (in) sampler1DArray sampler)\n" + " (declare (in) vec2 coord))\n" + " ()))\n" + "(function texture1DArrayLod\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) vec3 x))\n" - " ())\n" - " (signature vec3\n" + " (declare (in) sampler1DArray sampler)\n" + " (declare (in) vec2 coord)\n" + " (declare (in) float lod))\n" + " ()))\n" + "(function texture2DArray\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) vec4 x))\n" + " (declare (in) sampler2DArray sampler)\n" + " (declare (in) vec3 coord))\n" " ()))\n" - "(function noise4\n" + "(function texture2DArrayLod\n" " (signature vec4\n" " (parameters\n" - " (declare (in) float x))\n" - " ())\n" + " (declare (in) sampler2DArray sampler)\n" + " (declare (in) vec3 coord)\n" + " (declare (in) float lod))\n" + " ()))\n" + "(function shadow1DArray\n" " (signature vec4\n" " (parameters\n" - " (declare (in) vec2 x))\n" - " ())\n" + " (declare (in) sampler1DArrayShadow sampler)\n" + " (declare (in) vec3 coord))\n" + " ()))\n" + "(function shadow1DArrayLod\n" " (signature vec4\n" " (parameters\n" - " (declare (in) vec3 x))\n" - " ())\n" + " (declare (in) sampler1DArrayShadow sampler)\n" + " (declare (in) vec3 coord)\n" + " (declare (in) float lod))\n" + " ()))\n" + "(function shadow2DArray\n" " (signature vec4\n" " (parameters\n" - " (declare (in) vec4 x))\n" + " (declare (in) sampler2DArrayShadow sampler)\n" + " (declare (in) vec4 coord))\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, +static const char *functions_for_EXT_texture_array_vert [] = { + builtin_shadow1DArray, + builtin_shadow1DArrayLod, + builtin_shadow2DArray, + builtin_texture1DArray, + builtin_texture1DArrayLod, + builtin_texture2DArray, + builtin_texture2DArrayLod, }; void *builtin_mem_ctx = NULL; @@ -16776,13 +16776,13 @@ _mesa_glsl_initialize_functions(exec_list *instructions, state->num_builtins_to_link = 0; - if (state->target == vertex_shader && state->language_version == 120) { + if (state->target == fragment_shader && state->language_version == 110) { static gl_shader *sh = NULL; if (sh == NULL) { sh = read_builtins(GL_VERTEX_SHADER, - prototypes_for_120_vert, - functions_for_120_vert, - Elements(functions_for_120_vert )); + prototypes_for_110_frag, + functions_for_110_frag, + Elements(functions_for_110_frag )); talloc_steal(builtin_mem_ctx, sh); } @@ -16792,13 +16792,13 @@ _mesa_glsl_initialize_functions(exec_list *instructions, state->num_builtins_to_link++; } - if (state->target == fragment_shader && state->EXT_texture_array_enable) { + if (state->target == vertex_shader && state->language_version == 110) { static gl_shader *sh = NULL; if (sh == NULL) { 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 )); + prototypes_for_110_vert, + functions_for_110_vert, + Elements(functions_for_110_vert )); talloc_steal(builtin_mem_ctx, sh); } @@ -16808,13 +16808,13 @@ _mesa_glsl_initialize_functions(exec_list *instructions, state->num_builtins_to_link++; } - if (state->target == vertex_shader && state->language_version == 110) { + if (state->target == fragment_shader && state->language_version == 120) { static gl_shader *sh = NULL; if (sh == NULL) { sh = read_builtins(GL_VERTEX_SHADER, - prototypes_for_110_vert, - functions_for_110_vert, - Elements(functions_for_110_vert )); + prototypes_for_120_frag, + functions_for_120_frag, + Elements(functions_for_120_frag )); talloc_steal(builtin_mem_ctx, sh); } @@ -16824,13 +16824,13 @@ _mesa_glsl_initialize_functions(exec_list *instructions, 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, - prototypes_for_110_frag, - functions_for_110_frag, - Elements(functions_for_110_frag )); + prototypes_for_120_vert, + functions_for_120_vert, + Elements(functions_for_120_vert )); talloc_steal(builtin_mem_ctx, sh); } @@ -16840,13 +16840,13 @@ _mesa_glsl_initialize_functions(exec_list *instructions, state->num_builtins_to_link++; } - if (state->target == vertex_shader && state->EXT_texture_array_enable) { + 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_EXT_texture_array_vert, - functions_for_EXT_texture_array_vert, - Elements(functions_for_EXT_texture_array_vert )); + prototypes_for_130_frag, + functions_for_130_frag, + Elements(functions_for_130_frag )); talloc_steal(builtin_mem_ctx, sh); } @@ -16856,13 +16856,13 @@ _mesa_glsl_initialize_functions(exec_list *instructions, state->num_builtins_to_link++; } - if (state->target == fragment_shader && state->language_version == 130) { + 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_frag, - functions_for_130_frag, - Elements(functions_for_130_frag )); + prototypes_for_130_vert, + functions_for_130_vert, + Elements(functions_for_130_vert )); talloc_steal(builtin_mem_ctx, sh); } @@ -16872,13 +16872,13 @@ _mesa_glsl_initialize_functions(exec_list *instructions, state->num_builtins_to_link++; } - if (state->target == vertex_shader && state->ARB_texture_rectangle_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, - prototypes_for_ARB_texture_rectangle_vert, - functions_for_ARB_texture_rectangle_vert, - Elements(functions_for_ARB_texture_rectangle_vert )); + 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); } @@ -16888,13 +16888,13 @@ _mesa_glsl_initialize_functions(exec_list *instructions, state->num_builtins_to_link++; } - if (state->target == vertex_shader && state->language_version == 130) { + if (state->target == vertex_shader && state->ARB_texture_rectangle_enable) { 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 )); + 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); } @@ -16904,13 +16904,13 @@ _mesa_glsl_initialize_functions(exec_list *instructions, state->num_builtins_to_link++; } - if (state->target == fragment_shader && state->ARB_texture_rectangle_enable) { + if (state->target == fragment_shader && state->EXT_texture_array_enable) { static gl_shader *sh = NULL; if (sh == NULL) { 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 )); + 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); } @@ -16920,13 +16920,13 @@ _mesa_glsl_initialize_functions(exec_list *instructions, state->num_builtins_to_link++; } - if (state->target == fragment_shader && state->language_version == 120) { + if (state->target == vertex_shader && state->EXT_texture_array_enable) { static gl_shader *sh = NULL; if (sh == NULL) { sh = read_builtins(GL_VERTEX_SHADER, - prototypes_for_120_frag, - functions_for_120_frag, - Elements(functions_for_120_frag )); + 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); } -- cgit v1.2.3 From 5e9ac94cc44ef4f97063d7b696411b2a4be16f36 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 23 Aug 2010 12:21:33 -0700 Subject: mesa: Add new ir_unop_any() expression operation. The previous any() implementation would generate arg0.x || arg0.y || arg0.z. Having an expression operation for this makes it easy for the backend to generate something easier (DPn + SNE for 915 FS, .any predication on 965 VS) --- src/glsl/README | 1 + src/glsl/builtins/ir/any | 6 +++--- src/glsl/ir.cpp | 2 ++ src/glsl/ir.h | 1 + src/glsl/ir_constant_expression.cpp | 9 +++++++++ src/glsl/ir_validate.cpp | 5 +++++ src/mesa/program/ir_to_mesa.cpp | 20 ++++++++++++++++++++ 7 files changed, 41 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/glsl/README b/src/glsl/README index 74520321b2..2e501d6206 100644 --- a/src/glsl/README +++ b/src/glsl/README @@ -180,6 +180,7 @@ ir.h (new enum) ir.cpp:get_num_operands() (used for ir_reader) ir.cpp:operator_strs (used for ir_reader) ir_constant_expression.cpp (you probably want to be able to constant fold) +ir_validate.cpp (check users have the right types) You may also need to update the backends if they will see the new expr type: diff --git a/src/glsl/builtins/ir/any b/src/glsl/builtins/ir/any index f10e8a7b47..cc6038a315 100644 --- a/src/glsl/builtins/ir/any +++ b/src/glsl/builtins/ir/any @@ -2,15 +2,15 @@ (signature bool (parameters (declare (in) bvec2 arg0)) - ((return (expression bool || (swiz x (var_ref arg0))(swiz y (var_ref arg0)))))) + ((return (expression bool any (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)))))) + ((return (expression bool any (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)))))) + ((return (expression bool any (var_ref arg0))))) )) diff --git a/src/glsl/ir.cpp b/src/glsl/ir.cpp index ebb592792b..4622a1f939 100644 --- a/src/glsl/ir.cpp +++ b/src/glsl/ir.cpp @@ -184,6 +184,7 @@ ir_expression::get_num_operands(ir_expression_operation op) 1, /* ir_unop_i2b */ 1, /* ir_unop_b2i */ 1, /* ir_unop_u2f */ + 1, /* ir_unop_any */ 1, /* ir_unop_trunc */ 1, /* ir_unop_ceil */ @@ -252,6 +253,7 @@ static const char *const operator_strs[] = { "i2b", "b2i", "u2f", + "any", "trunc", "ceil", "floor", diff --git a/src/glsl/ir.h b/src/glsl/ir.h index b04222893c..500b152408 100644 --- a/src/glsl/ir.h +++ b/src/glsl/ir.h @@ -604,6 +604,7 @@ enum ir_expression_operation { ir_unop_i2b, /**< int-to-boolean conversion */ ir_unop_b2i, /**< Boolean-to-int conversion */ ir_unop_u2f, /**< Unsigned-to-float conversion. */ + ir_unop_any, /** * \name Unary floating-point rounding operations. diff --git a/src/glsl/ir_constant_expression.cpp b/src/glsl/ir_constant_expression.cpp index 54f14d1a54..942f198360 100644 --- a/src/glsl/ir_constant_expression.cpp +++ b/src/glsl/ir_constant_expression.cpp @@ -149,6 +149,15 @@ ir_expression::constant_expression_value() } break; + case ir_unop_any: + assert(op[0]->type->is_boolean()); + data.b[0] = false; + for (unsigned c = 0; c < op[0]->type->components(); c++) { + if (op[0]->value.b[c]) + data.b[0] = true; + } + break; + case ir_unop_trunc: assert(op[0]->type->base_type == GLSL_TYPE_FLOAT); for (unsigned c = 0; c < op[0]->type->components(); c++) { diff --git a/src/glsl/ir_validate.cpp b/src/glsl/ir_validate.cpp index 6e08fa4025..9ea11dd400 100644 --- a/src/glsl/ir_validate.cpp +++ b/src/glsl/ir_validate.cpp @@ -223,6 +223,11 @@ ir_validate::visit_leave(ir_expression *ir) assert(ir->type->base_type == GLSL_TYPE_FLOAT); break; + case ir_unop_any: + assert(ir->operands[0]->type->base_type == GLSL_TYPE_BOOL); + assert(ir->type == glsl_type::bool_type); + break; + case ir_unop_trunc: case ir_unop_ceil: case ir_unop_floor: diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp index 7a615f2d58..ea2560af3e 100644 --- a/src/mesa/program/ir_to_mesa.cpp +++ b/src/mesa/program/ir_to_mesa.cpp @@ -844,6 +844,26 @@ ir_to_mesa_visitor::visit(ir_expression *ir) ir_to_mesa_emit_op2(ir, OPCODE_SNE, result_dst, op[0], op[1]); } break; + + case ir_unop_any: + switch (ir->operands[0]->type->vector_elements) { + case 4: + ir_to_mesa_emit_op2(ir, OPCODE_DP4, result_dst, op[0], op[0]); + break; + case 3: + ir_to_mesa_emit_op2(ir, OPCODE_DP3, result_dst, op[0], op[0]); + break; + case 2: + ir_to_mesa_emit_op2(ir, OPCODE_DP2, result_dst, op[0], op[0]); + break; + default: + assert(!"unreached: ir_unop_any of non-bvec"); + break; + } + ir_to_mesa_emit_op2(ir, OPCODE_SNE, + result_dst, result_src, src_reg_for_float(0.0)); + break; + case ir_binop_logic_xor: ir_to_mesa_emit_op2(ir, OPCODE_SNE, result_dst, op[0], op[1]); break; -- cgit v1.2.3 From b75645d8adf88ef237c3f835b6190e8113452b09 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 23 Aug 2010 12:54:55 -0700 Subject: glsl: Rebuild builtins for any() change. --- src/glsl/builtin_function.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/glsl/builtin_function.cpp b/src/glsl/builtin_function.cpp index 517a6ad86d..5471ba6020 100644 --- a/src/glsl/builtin_function.cpp +++ b/src/glsl/builtin_function.cpp @@ -143,17 +143,17 @@ static const char *builtin_any = " (signature bool\n" " (parameters\n" " (declare (in) bvec2 arg0))\n" - " ((return (expression bool || (swiz x (var_ref arg0))(swiz y (var_ref arg0))))))\n" + " ((return (expression bool any (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" + " ((return (expression bool any (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" + " ((return (expression bool any (var_ref arg0)))))\n" "))\n" "" ; -- cgit v1.2.3 From 6fb39f0fa2cad668fd6c49d0b739c33954a6946c Mon Sep 17 00:00:00 2001 From: Henri Verbeet Date: Mon, 23 Aug 2010 21:13:59 +0200 Subject: r600g: Add support for PIPE_CAP_DEPTH_CLAMP. --- src/gallium/drivers/r600/r600_screen.c | 2 +- src/gallium/drivers/r600/r600_state.c | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/r600_screen.c b/src/gallium/drivers/r600/r600_screen.c index 1358432957..a047a49a6c 100644 --- a/src/gallium/drivers/r600/r600_screen.c +++ b/src/gallium/drivers/r600/r600_screen.c @@ -69,6 +69,7 @@ static int r600_get_param(struct pipe_screen* pscreen, enum pipe_cap param) case PIPE_CAP_TEXTURE_SWIZZLE: case PIPE_CAP_INDEP_BLEND_ENABLE: case PIPE_CAP_DEPTHSTENCIL_CLEAR_SEPARATE: + case PIPE_CAP_DEPTH_CLAMP: return 1; /* Unsupported features (boolean caps). */ @@ -77,7 +78,6 @@ static int r600_get_param(struct pipe_screen* pscreen, enum pipe_cap param) case PIPE_CAP_STREAM_OUTPUT: case PIPE_CAP_INDEP_BLEND_FUNC: /* FIXME allow this */ case PIPE_CAP_GEOMETRY_SHADER4: - case PIPE_CAP_DEPTH_CLAMP: /* FIXME allow this */ return 0; /* Texturing. */ diff --git a/src/gallium/drivers/r600/r600_state.c b/src/gallium/drivers/r600/r600_state.c index 12a61cacda..b5e5346163 100644 --- a/src/gallium/drivers/r600/r600_state.c +++ b/src/gallium/drivers/r600/r600_state.c @@ -861,9 +861,10 @@ static struct radeon_state *r600_rasterizer(struct r600_context *rctx) } } rstate->states[R600_RASTERIZER__PA_CL_CLIP_CNTL] = 0; - if (clip && clip->nr) { + if (clip) { rstate->states[R600_RASTERIZER__PA_CL_CLIP_CNTL] = S_028810_PS_UCP_MODE(3) | ((1 << clip->nr) - 1); - rstate->states[R600_RASTERIZER__PA_CL_CLIP_CNTL] |= S_028810_CLIP_DISABLE(clip->depth_clamp); + rstate->states[R600_RASTERIZER__PA_CL_CLIP_CNTL] |= S_028810_ZCLIP_NEAR_DISABLE(clip->depth_clamp); + rstate->states[R600_RASTERIZER__PA_CL_CLIP_CNTL] |= S_028810_ZCLIP_FAR_DISABLE(clip->depth_clamp); } rstate->states[R600_RASTERIZER__PA_SU_SC_MODE_CNTL] = S_028814_PROVOKING_VTX_LAST(prov_vtx) | -- cgit v1.2.3 From 76e96d74f49cc262ceaf2ed6c48d2f4ed21d219f Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 23 Aug 2010 13:26:52 -0700 Subject: glsl: Cleanly fail when a function has an unknown return type. Bug #29608. --- src/glsl/ast_to_hir.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp index 8e4c3299aa..7ac24b06fe 100644 --- a/src/glsl/ast_to_hir.cpp +++ b/src/glsl/ast_to_hir.cpp @@ -2138,7 +2138,13 @@ ast_function::hir(exec_list *instructions, const glsl_type *return_type = this->return_type->specifier->glsl_type(& return_type_name, state); - assert(return_type != NULL); + if (!return_type) { + YYLTYPE loc = this->get_location(); + _mesa_glsl_error(&loc, state, + "function `%s' has undeclared return type `%s'", + name, return_type_name); + return_type = glsl_type::error_type; + } /* 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." -- cgit v1.2.3 From d1e6b31cb848ed79dd82849f277ab07c9bcdd707 Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Mon, 23 Aug 2010 23:21:18 +0200 Subject: translate_sse: fix x86-64 --- src/gallium/auxiliary/translate/translate_sse.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/gallium/auxiliary/translate/translate_sse.c b/src/gallium/auxiliary/translate/translate_sse.c index 5d555bbd98..92dcd408c9 100644 --- a/src/gallium/auxiliary/translate/translate_sse.c +++ b/src/gallium/auxiliary/translate/translate_sse.c @@ -1224,6 +1224,7 @@ static boolean incr_inputs( struct translate_sse *p, } } else { + x64_rexw(p->func); x86_lea(p->func, p->idx_ESI, x86_make_disp(p->idx_ESI, index_size)); } -- cgit v1.2.3 From e11757bb896e3dadc54fb3d18adf4b71e3e883b3 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 23 Aug 2010 14:54:06 -0700 Subject: glsl: When unable to assign the initializer for a const variable, set it to 0. This prevents assertion failures or cascading errors after we've logged the fact that we were unable to handle the initializer. Fixes unsized-array-non-const-index-2.vert --- src/glsl/ast_to_hir.cpp | 34 +++++++++++++++++++++------------- 1 file changed, 21 insertions(+), 13 deletions(-) (limited to 'src') diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp index 7ac24b06fe..57e331742e 100644 --- a/src/glsl/ast_to_hir.cpp +++ b/src/glsl/ast_to_hir.cpp @@ -1827,24 +1827,32 @@ ast_declarator_list::hir(exec_list *instructions, ir_rvalue *new_rhs = validate_assignment(state, var->type, rhs); if (new_rhs != NULL) { rhs = new_rhs; + + ir_constant *constant_value = rhs->constant_expression_value(); + if (!constant_value) { + _mesa_glsl_error(& initializer_loc, state, + "initializer of %s variable `%s' must be a " + "constant expression", + (this->type->qualifier.constant) + ? "const" : "uniform", + decl->identifier); + if (var->type->is_numeric()) { + /* Reduce cascading errors. */ + var->constant_value = ir_constant::zero(ctx, var->type); + } + } else { + rhs = constant_value; + var->constant_value = constant_value; + } } else { _mesa_glsl_error(&initializer_loc, state, "initializer of type %s cannot be assigned to " "variable of type %s", rhs->type->name, var->type->name); - } - - 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 (var->type->is_numeric()) { + /* Reduce cascading errors. */ + var->constant_value = ir_constant::zero(ctx, var->type); + } } } -- cgit v1.2.3 From c60c2d3a64a54ff28dd772e51b1848aca6b42316 Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Tue, 24 Aug 2010 00:03:28 +0200 Subject: nvfx: don't emit dummy commands on nv30 Should fix errors on the original nv30, reported by pmdata. --- src/gallium/drivers/nvfx/nvfx_push.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/nvfx/nvfx_push.c b/src/gallium/drivers/nvfx/nvfx_push.c index 49d518e2eb..ffe7e98357 100644 --- a/src/gallium/drivers/nvfx/nvfx_push.c +++ b/src/gallium/drivers/nvfx/nvfx_push.c @@ -368,11 +368,15 @@ nvfx_push_vbo(struct pipe_context *pipe, const struct pipe_draw_info *info) if(max_verts >= 16) { /* XXX: any command a lot of times seems to (mostly) fix corruption that would otherwise happen */ - int i; - for(i = 0; i < 32; ++i) + /* this seems to cause issues on nv3x, and also be unneeded there */ + if(nvfx->is_nv4x) { - OUT_RING(chan, RING_3D(0x1dac, 1)); - OUT_RING(chan, 0); + int i; + for(i = 0; i < 32; ++i) + { + OUT_RING(chan, RING_3D(0x1dac, 1)); + OUT_RING(chan, 0); + } } OUT_RING(chan, RING_3D(NV34TCL_VERTEX_BEGIN_END, 1)); -- cgit v1.2.3 From 87f44d5723ebb3a2efe0dddc1a6edb6536adea4d Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Tue, 24 Aug 2010 09:18:32 +1000 Subject: r600g: add CMP support. ported from r600c, fixes fp-cmp, glsl1-sqrt* --- src/gallium/drivers/r600/r600_shader.c | 51 +++++++++++++++++++++++++++++++++- 1 file changed, 50 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/r600_shader.c b/src/gallium/drivers/r600/r600_shader.c index b20a5a11be..e8f7e09d96 100644 --- a/src/gallium/drivers/r600/r600_shader.c +++ b/src/gallium/drivers/r600/r600_shader.c @@ -1446,6 +1446,55 @@ static int tgsi_lrp(struct r600_shader_ctx *ctx) return tgsi_helper_copy(ctx, inst); } +static int tgsi_cmp(struct r600_shader_ctx *ctx) +{ + struct tgsi_full_instruction *inst = &ctx->parse.FullToken.FullInstruction; + struct r600_bc_alu_src r600_src[3]; + struct r600_bc_alu alu; + int use_temp = 0; + int i, r; + + r = tgsi_split_constant(ctx, r600_src); + if (r) + return r; + + if (inst->Dst[0].Register.WriteMask != 0xf) + use_temp = 1; + + for (i = 0; i < 4; i++) { + memset(&alu, 0, sizeof(struct r600_bc_alu)); + alu.inst = V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_CNDGE; + alu.src[0] = r600_src[0]; + alu.src[0].chan = tgsi_chan(&inst->Src[0], i); + + alu.src[1] = r600_src[2]; + alu.src[1].chan = tgsi_chan(&inst->Src[2], i); + + alu.src[2] = r600_src[1]; + alu.src[2].chan = tgsi_chan(&inst->Src[1], i); + + if (use_temp) + alu.dst.sel = ctx->temp_reg; + else { + r = tgsi_dst(ctx, &inst->Dst[0], i, &alu.dst); + if (r) + return r; + } + alu.dst.chan = i; + alu.dst.write = 1; + alu.is_op3 = 1; + if (i == 3) + alu.last = 1; + r = r600_bc_add_alu(ctx->bc, &alu); + if (r) + return r; + } + if (use_temp) + return tgsi_helper_copy(ctx, inst); + return 0; +} + + static struct r600_shader_tgsi_instruction r600_shader_tgsi_instruction[] = { {TGSI_OPCODE_ARL, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported}, {TGSI_OPCODE_MOV, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV, tgsi_op2}, @@ -1516,7 +1565,7 @@ static struct r600_shader_tgsi_instruction r600_shader_tgsi_instruction[] = { {TGSI_OPCODE_CAL, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported}, {TGSI_OPCODE_RET, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported}, {TGSI_OPCODE_SSG, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_ssg}, - {TGSI_OPCODE_CMP, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported}, + {TGSI_OPCODE_CMP, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_cmp}, {TGSI_OPCODE_SCS, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported}, {TGSI_OPCODE_TXB, 0, SQ_TEX_INST_SAMPLE_L, tgsi_tex}, {TGSI_OPCODE_NRM, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported}, -- cgit v1.2.3 From 0e6a02d29915db2ca460206656ab517ddaf0b455 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Tue, 24 Aug 2010 09:56:22 +1000 Subject: r600g: add XPD support ported from r600c. --- src/gallium/drivers/r600/r600_shader.c | 125 ++++++++++++++++++++++++++++++++- 1 file changed, 124 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/r600_shader.c b/src/gallium/drivers/r600/r600_shader.c index e8f7e09d96..b2d1a1bf01 100644 --- a/src/gallium/drivers/r600/r600_shader.c +++ b/src/gallium/drivers/r600/r600_shader.c @@ -1494,6 +1494,129 @@ static int tgsi_cmp(struct r600_shader_ctx *ctx) return 0; } +static int tgsi_xpd(struct r600_shader_ctx *ctx) +{ + struct tgsi_full_instruction *inst = &ctx->parse.FullToken.FullInstruction; + struct r600_bc_alu_src r600_src[3]; + struct r600_bc_alu alu; + uint32_t use_temp = 0; + int i, r; + + if (inst->Dst[0].Register.WriteMask != 0xf) + use_temp = 1; + + r = tgsi_split_constant(ctx, r600_src); + if (r) + return r; + + for (i = 0; i < 4; i++) { + memset(&alu, 0, sizeof(struct r600_bc_alu)); + alu.inst = V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MUL; + + alu.src[0] = r600_src[0]; + switch (i) { + case 0: + alu.src[0].chan = tgsi_chan(&inst->Src[0], 2); + break; + case 1: + alu.src[0].chan = tgsi_chan(&inst->Src[0], 0); + break; + case 2: + alu.src[0].chan = tgsi_chan(&inst->Src[0], 1); + break; + case 3: + alu.src[0].sel = V_SQ_ALU_SRC_0; + alu.src[0].chan = i; + } + + alu.src[1] = r600_src[1]; + switch (i) { + case 0: + alu.src[1].chan = tgsi_chan(&inst->Src[1], 1); + break; + case 1: + alu.src[1].chan = tgsi_chan(&inst->Src[1], 2); + break; + case 2: + alu.src[1].chan = tgsi_chan(&inst->Src[1], 0); + break; + case 3: + alu.src[1].sel = V_SQ_ALU_SRC_0; + alu.src[1].chan = i; + } + + alu.dst.sel = ctx->temp_reg; + alu.dst.chan = i; + alu.dst.write = 1; + + if (i == 3) + alu.last = 1; + r = r600_bc_add_alu(ctx->bc, &alu); + if (r) + return r; + } + + for (i = 0; i < 4; i++) { + memset(&alu, 0, sizeof(struct r600_bc_alu)); + alu.inst = V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_MULADD; + + alu.src[0] = r600_src[0]; + switch (i) { + case 0: + alu.src[0].chan = tgsi_chan(&inst->Src[0], 1); + break; + case 1: + alu.src[0].chan = tgsi_chan(&inst->Src[0], 2); + break; + case 2: + alu.src[0].chan = tgsi_chan(&inst->Src[0], 0); + break; + case 3: + alu.src[0].sel = V_SQ_ALU_SRC_0; + alu.src[0].chan = i; + } + + alu.src[1] = r600_src[1]; + switch (i) { + case 0: + alu.src[1].chan = tgsi_chan(&inst->Src[1], 2); + break; + case 1: + alu.src[1].chan = tgsi_chan(&inst->Src[1], 0); + break; + case 2: + alu.src[1].chan = tgsi_chan(&inst->Src[1], 1); + break; + case 3: + alu.src[1].sel = V_SQ_ALU_SRC_0; + alu.src[1].chan = i; + } + + alu.src[2].sel = ctx->temp_reg; + alu.src[2].neg = 1; + alu.src[2].chan = i; + + if (use_temp) + alu.dst.sel = ctx->temp_reg; + else { + r = tgsi_dst(ctx, &inst->Dst[0], i, &alu.dst); + if (r) + return r; + } + alu.dst.chan = i; + alu.dst.write = 1; + alu.is_op3 = 1; + if (i == 3) + alu.last = 1; + r = r600_bc_add_alu(ctx->bc, &alu); + if (r) + return r; + } + if (use_temp) + return tgsi_helper_copy(ctx, inst); + return 0; +} + static struct r600_shader_tgsi_instruction r600_shader_tgsi_instruction[] = { {TGSI_OPCODE_ARL, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported}, @@ -1529,7 +1652,7 @@ static struct r600_shader_tgsi_instruction r600_shader_tgsi_instruction[] = { {TGSI_OPCODE_EX2, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_EXP_IEEE, tgsi_trans_srcx_replicate}, {TGSI_OPCODE_LG2, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_LOG_IEEE, tgsi_trans_srcx_replicate}, {TGSI_OPCODE_POW, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_pow}, - {TGSI_OPCODE_XPD, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported}, + {TGSI_OPCODE_XPD, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_xpd}, /* gap */ {32, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported}, {TGSI_OPCODE_ABS, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV, tgsi_op2}, -- cgit v1.2.3 From d1b4f4034796e607371536d43370c6fefc22811c Mon Sep 17 00:00:00 2001 From: Alex Deucher Date: Mon, 23 Aug 2010 20:18:28 -0400 Subject: radeon: print chip family for evergreen in renderer string --- src/mesa/drivers/dri/radeon/radeon_chipset.h | 2 -- src/mesa/drivers/dri/radeon/radeon_common_context.c | 5 +++++ 2 files changed, 5 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/radeon/radeon_chipset.h b/src/mesa/drivers/dri/radeon/radeon_chipset.h index 8efaa5b8e3..61106fbc43 100644 --- a/src/mesa/drivers/dri/radeon/radeon_chipset.h +++ b/src/mesa/drivers/dri/radeon/radeon_chipset.h @@ -478,13 +478,11 @@ enum { CHIP_FAMILY_RV730, CHIP_FAMILY_RV710, CHIP_FAMILY_RV740, - CHIP_FAMILY_CEDAR, CHIP_FAMILY_REDWOOD, CHIP_FAMILY_JUNIPER, CHIP_FAMILY_CYPRESS, CHIP_FAMILY_HEMLOCK, - CHIP_FAMILY_LAST }; diff --git a/src/mesa/drivers/dri/radeon/radeon_common_context.c b/src/mesa/drivers/dri/radeon/radeon_common_context.c index 92663bf66d..07f7cba354 100644 --- a/src/mesa/drivers/dri/radeon/radeon_common_context.c +++ b/src/mesa/drivers/dri/radeon/radeon_common_context.c @@ -93,6 +93,11 @@ static const char* get_chip_family_name(int chip_family) case CHIP_FAMILY_RV730: return "RV730"; case CHIP_FAMILY_RV710: return "RV710"; case CHIP_FAMILY_RV740: return "RV740"; + case CHIP_FAMILY_CEDAR: return "CEDAR"; + case CHIP_FAMILY_REDWOOD: return "REDWOOD"; + case CHIP_FAMILY_JUNIPER: return "JUNIPER"; + case CHIP_FAMILY_CYPRESS: return "CYPRESS"; + case CHIP_FAMILY_HEMLOCK: return "HEMLOCK"; default: return "unknown"; } } -- cgit v1.2.3 From e0564d56b1d3bc339b7a9cd232df4b042a93aab2 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 23 Aug 2010 15:53:16 -0700 Subject: intel: Add support for MAX_SAMPLES=1 EXT_framebuffer_multisample. The spec specifically sets the minimum MAX_SAMPLES at 1 to allow exposing the extension on all implementations, so do so. --- docs/relnotes-7.9.html | 1 + src/mesa/drivers/dri/intel/intel_context.c | 2 ++ src/mesa/drivers/dri/intel/intel_extensions.c | 4 +++- 3 files changed, 6 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/docs/relnotes-7.9.html b/docs/relnotes-7.9.html index 457dd8fd05..c3ca9c9c42 100644 --- a/docs/relnotes-7.9.html +++ b/docs/relnotes-7.9.html @@ -35,6 +35,7 @@ tbd

New features

  • GL_EXT_timer_query extension (i965 driver only) +
  • GL_EXT_framebuffer_multisample extension (intel drivers, MAX_SAMPLES = 1)
  • GL_ARB_texture_swizzle extension (alias of GL_EXT_texture_swizzle)
  • GL_ARB_draw_elements_base_vertex, GL_ARB_fragment_program_shadow and GL_EXT_draw_buffers2 in Gallium drivers diff --git a/src/mesa/drivers/dri/intel/intel_context.c b/src/mesa/drivers/dri/intel/intel_context.c index e19f44035f..4e63b45127 100644 --- a/src/mesa/drivers/dri/intel/intel_context.c +++ b/src/mesa/drivers/dri/intel/intel_context.c @@ -720,6 +720,8 @@ intelInitContext(struct intel_context *intel, ctx->Const.MaxPointSizeAA = 3.0; ctx->Const.PointSizeGranularity = 1.0; + ctx->Const.MaxSamples = 1.0; + /* reinitialize the context point state. * It depend on constants in __GLcontextRec::Const */ diff --git a/src/mesa/drivers/dri/intel/intel_extensions.c b/src/mesa/drivers/dri/intel/intel_extensions.c index edba1fc2f2..bf22a423fc 100644 --- a/src/mesa/drivers/dri/intel/intel_extensions.c +++ b/src/mesa/drivers/dri/intel/intel_extensions.c @@ -50,8 +50,9 @@ #define need_GL_EXT_cull_vertex #define need_GL_EXT_draw_buffers2 #define need_GL_EXT_fog_coord -#define need_GL_EXT_framebuffer_object #define need_GL_EXT_framebuffer_blit +#define need_GL_EXT_framebuffer_multisample +#define need_GL_EXT_framebuffer_object #define need_GL_EXT_gpu_program_parameters #define need_GL_EXT_point_parameters #define need_GL_EXT_provoking_vertex @@ -111,6 +112,7 @@ static const struct dri_extension card_extensions[] = { { "GL_EXT_cull_vertex", GL_EXT_cull_vertex_functions }, { "GL_EXT_framebuffer_blit", GL_EXT_framebuffer_blit_functions }, { "GL_EXT_framebuffer_object", GL_EXT_framebuffer_object_functions }, + { "GL_EXT_framebuffer_multisample", GL_EXT_framebuffer_multisample_functions }, { "GL_EXT_fog_coord", GL_EXT_fog_coord_functions }, { "GL_EXT_gpu_program_parameters", GL_EXT_gpu_program_parameters_functions }, { "GL_EXT_packed_depth_stencil", NULL }, -- cgit v1.2.3 From 8dd619ba6825e673a357336b69c96accaa96a7ef Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 23 Aug 2010 17:16:25 -0700 Subject: glsl: Rely on talloc_autofree_context() instead of trying to free on our own. Because the static types talloc their names at dlopen time, talloc_freeing the types at DRI driver screen teardown means that if the screen gets brought back up again, the names will point at freed memory. talloc_autofree_context() exists to do just what we want here: Free memory referenced across the program's lifetime so that we avoid noise in memory leak checkers. Fixes: bug #29722 (assertion failure in unigine). --- src/glsl/glsl_types.cpp | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'src') diff --git a/src/glsl/glsl_types.cpp b/src/glsl/glsl_types.cpp index 518abc959d..c488f5c271 100644 --- a/src/glsl/glsl_types.cpp +++ b/src/glsl/glsl_types.cpp @@ -41,7 +41,7 @@ void glsl_type::init_talloc_type_ctx(void) { if (glsl_type::mem_ctx == NULL) { - glsl_type::mem_ctx = talloc_init("glsl_type"); + glsl_type::mem_ctx = talloc_autofree_context(); assert(glsl_type::mem_ctx != NULL); } } @@ -230,11 +230,6 @@ _mesa_glsl_release_types(void) hash_table_dtor(glsl_type::record_types); glsl_type::record_types = NULL; } - - if (glsl_type::mem_ctx != NULL) { - talloc_free(glsl_type::mem_ctx); - glsl_type::mem_ctx = NULL; - } } -- cgit v1.2.3 From 6b6b45403740144fa5ef2ce362a4c5b9fd0066b6 Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Tue, 24 Aug 2010 04:16:42 +0200 Subject: translate_sse: clear state for each function emission Fixes #29771. --- src/gallium/auxiliary/translate/translate_sse.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/gallium/auxiliary/translate/translate_sse.c b/src/gallium/auxiliary/translate/translate_sse.c index 92dcd408c9..f8bf5b4669 100644 --- a/src/gallium/auxiliary/translate/translate_sse.c +++ b/src/gallium/auxiliary/translate/translate_sse.c @@ -1255,6 +1255,9 @@ static boolean build_vertex_emit( struct translate_sse *p, int fixup, label; unsigned j; + memset(p->reg_to_const, 0xff, sizeof(p->reg_to_const)); + memset(p->const_to_reg, 0xff, sizeof(p->const_to_reg)); + p->tmp_EAX = x86_make_reg(file_REG32, reg_AX); p->idx_ESI = x86_make_reg(file_REG32, reg_SI); p->outbuf_EBX = x86_make_reg(file_REG32, reg_BX); @@ -1440,10 +1443,7 @@ struct translate *translate_sse2_create( const struct translate_key *key ) if (p == NULL) goto fail; memset(p, 0, sizeof(*p)); - memcpy(p->consts, consts, sizeof(consts)); - memset(p->reg_to_const, 0xff, sizeof(p->reg_to_const)); - memset(p->const_to_reg, 0xff, sizeof(p->const_to_reg)); p->translate.key = *key; p->translate.release = translate_sse_release; -- cgit v1.2.3 From f90b5936d07c4c8f280318ab5cf5894ecb67aef6 Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Mon, 23 Aug 2010 17:39:15 +0800 Subject: mesa: Add core.h. core.h is the public header of core mesa. GLX, WGL, and GLSL are supposed to include this header file. It should be noted that headers included by core.h must not perform feature tests (#if FEATURE_xxx). Otherwise, we cannot, for example, mix a FEATURE_ES2 libmesagallium.a with a FEATURE_GL libglsl.a. --- src/mesa/main/core.h | 66 ++++++++++++++++++++++++++++++++++++++++++++++++++ src/mesa/main/dd.h | 30 +++++++---------------- src/mesa/main/mtypes.h | 32 +++++------------------- 3 files changed, 81 insertions(+), 47 deletions(-) create mode 100644 src/mesa/main/core.h (limited to 'src') diff --git a/src/mesa/main/core.h b/src/mesa/main/core.h new file mode 100644 index 0000000000..11b68cc987 --- /dev/null +++ b/src/mesa/main/core.h @@ -0,0 +1,66 @@ +/* + * Mesa 3-D graphics library + * Version: 7.9 + * + * Copyright (C) 2010 LunarG Inc. + * + * 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 + * 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. + * + * Authors: + * Chia-I Wu + */ + + +/** + * \file core.h + * The public header of core mesa. + * + * This file is the (only) public header of core mesa. It is supposed to be + * used by GLX, WGL, and GLSL. It is important that headers directly or + * indirectly included here do not perform feature tests (#if FEATURE_xxx). + */ + + +#ifndef CORE_H +#define CORE_H + + +#include "main/glheader.h" +#include "main/compiler.h" +#include "main/imports.h" +#include "main/macros.h" + +#include "main/version.h" /* for MESA_VERSION_STRING */ +#include "main/context.h" /* for _mesa_share_state */ +#include "main/mtypes.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* for GLSL */ +#include "program/prog_parameter.h" +#include "program/prog_uniform.h" + +#ifdef __cplusplus +}; +#endif + + +#endif /* CORE_H */ diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h index 71d0f570e4..8a20a66363 100644 --- a/src/mesa/main/dd.h +++ b/src/mesa/main/dd.h @@ -36,7 +36,7 @@ struct gl_pixelstore_attrib; struct gl_display_list; -#if FEATURE_ARB_vertex_buffer_object +/* GL_ARB_vertex_buffer_object */ /* Modifies GL_MAP_UNSYNCHRONIZED_BIT to allow driver to fail (return * NULL) if buffer is unavailable for immediate mapping. * @@ -49,7 +49,6 @@ struct gl_display_list; * respect the contents of already referenced data. */ #define MESA_MAP_NOWAIT_BIT 0x0040 -#endif /** @@ -730,7 +729,6 @@ struct dd_function_table { /** * \name Vertex/pixel buffer object functions */ -#if FEATURE_ARB_vertex_buffer_object /*@{*/ void (*BindBuffer)( GLcontext *ctx, GLenum target, struct gl_buffer_object *obj ); @@ -774,12 +772,10 @@ struct dd_function_table { GLboolean (*UnmapBuffer)( GLcontext *ctx, GLenum target, struct gl_buffer_object *obj ); /*@}*/ -#endif /** * \name Functions for GL_APPLE_object_purgeable */ -#if FEATURE_APPLE_object_purgeable /*@{*/ /* variations on ObjectPurgeable */ GLenum (*BufferObjectPurgeable)( GLcontext *ctx, struct gl_buffer_object *obj, GLenum option ); @@ -791,12 +787,10 @@ struct dd_function_table { GLenum (*RenderObjectUnpurgeable)( GLcontext *ctx, struct gl_renderbuffer *obj, GLenum option ); GLenum (*TextureObjectUnpurgeable)( GLcontext *ctx, struct gl_texture_object *obj, GLenum option ); /*@}*/ -#endif /** - * \name Functions for GL_EXT_framebuffer_object + * \name Functions for GL_EXT_framebuffer_{object,blit}. */ -#if FEATURE_EXT_framebuffer_object /*@{*/ struct gl_framebuffer * (*NewFramebuffer)(GLcontext *ctx, GLuint name); struct gl_renderbuffer * (*NewRenderbuffer)(GLcontext *ctx, GLuint name); @@ -815,13 +809,10 @@ struct dd_function_table { void (*ValidateFramebuffer)(GLcontext *ctx, struct gl_framebuffer *fb); /*@}*/ -#endif -#if FEATURE_EXT_framebuffer_blit void (*BlitFramebuffer)(GLcontext *ctx, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); -#endif /** * \name Query objects @@ -976,7 +967,6 @@ struct dd_function_table { void (*EndCallList)( GLcontext *ctx ); -#if FEATURE_ARB_sync /** * \name GL_ARB_sync interfaces */ @@ -990,14 +980,12 @@ struct dd_function_table { void (*ServerWaitSync)(GLcontext *, struct gl_sync_object *, GLbitfield, GLuint64); /*@}*/ -#endif /** GL_NV_conditional_render */ void (*BeginConditionalRender)(GLcontext *ctx, struct gl_query_object *q, GLenum mode); void (*EndConditionalRender)(GLcontext *ctx, struct gl_query_object *q); -#if FEATURE_OES_draw_texture /** * \name GL_OES_draw_texture interface */ @@ -1005,9 +993,10 @@ struct dd_function_table { void (*DrawTex)(GLcontext *ctx, GLfloat x, GLfloat y, GLfloat z, GLfloat width, GLfloat height); /*@}*/ -#endif -#if FEATURE_OES_EGL_image + /** + * \name GL_OES_EGL_image interface + */ void (*EGLImageTargetTexture2D)(GLcontext *ctx, GLenum target, struct gl_texture_object *texObj, struct gl_texture_image *texImage, @@ -1015,9 +1004,10 @@ struct dd_function_table { void (*EGLImageTargetRenderbufferStorage)(GLcontext *ctx, struct gl_renderbuffer *rb, void *image_handle); -#endif -#if FEATURE_EXT_transform_feedback + /** + * \name GL_EXT_transform_feedback interface + */ struct gl_transform_feedback_object * (*NewTransformFeedback)(GLcontext *ctx, GLuint name); void (*DeleteTransformFeedback)(GLcontext *ctx, @@ -1032,7 +1022,6 @@ struct dd_function_table { struct gl_transform_feedback_object *obj); void (*DrawTransformFeedback)(GLcontext *ctx, GLenum mode, struct gl_transform_feedback_object *obj); -#endif }; @@ -1115,7 +1104,7 @@ typedef struct { void (GLAPIENTRYP VertexAttrib3fvNV)( GLuint index, const GLfloat *v ); void (GLAPIENTRYP VertexAttrib4fNV)( GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w ); void (GLAPIENTRYP VertexAttrib4fvNV)( GLuint index, const GLfloat *v ); -#if FEATURE_ARB_vertex_program + /* GL_ARB_vertex_program */ void (GLAPIENTRYP VertexAttrib1fARB)( GLuint index, GLfloat x ); void (GLAPIENTRYP VertexAttrib1fvARB)( GLuint index, const GLfloat *v ); void (GLAPIENTRYP VertexAttrib2fARB)( GLuint index, GLfloat x, GLfloat y ); @@ -1124,7 +1113,6 @@ typedef struct { void (GLAPIENTRYP VertexAttrib3fvARB)( GLuint index, const GLfloat *v ); void (GLAPIENTRYP VertexAttrib4fARB)( GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w ); void (GLAPIENTRYP VertexAttrib4fvARB)( GLuint index, const GLfloat *v ); -#endif /*@}*/ void (GLAPIENTRYP Rectf)( GLfloat, GLfloat, GLfloat, GLfloat ); diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index b8bcda56bf..d44eff69cc 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -1632,10 +1632,9 @@ struct gl_array_attrib GLbitfield NewState; /**< mask of _NEW_ARRAY_* values */ -#if FEATURE_ARB_vertex_buffer_object + /* GL_ARB_vertex_buffer_object */ struct gl_buffer_object *ArrayBufferObj; struct gl_buffer_object *ElementArrayBufferObj; -#endif }; @@ -2264,39 +2263,26 @@ struct gl_shared_state */ /*@{*/ struct _mesa_HashTable *Programs; /**< All vertex/fragment programs */ -#if FEATURE_ARB_vertex_program struct gl_vertex_program *DefaultVertexProgram; -#endif -#if FEATURE_ARB_fragment_program struct gl_fragment_program *DefaultFragmentProgram; -#endif -#if FEATURE_ARB_geometry_shader4 struct gl_geometry_program *DefaultGeometryProgram; -#endif /*@}*/ -#if FEATURE_ATI_fragment_shader + /* GL_ATI_fragment_shader */ struct _mesa_HashTable *ATIShaders; struct ati_fragment_shader *DefaultFragmentShader; -#endif -#if FEATURE_ARB_vertex_buffer_object || FEATURE_ARB_pixel_buffer_object struct _mesa_HashTable *BufferObjects; -#endif -#if FEATURE_ARB_shader_objects /** Table of both gl_shader and gl_shader_program objects */ struct _mesa_HashTable *ShaderObjects; -#endif -#if FEATURE_EXT_framebuffer_object + /* GL_EXT_framebuffer_object */ struct _mesa_HashTable *RenderBuffers; struct _mesa_HashTable *FrameBuffers; -#endif -#if FEATURE_ARB_sync + /* GL_ARB_sync */ struct simple_node SyncObjects; -#endif void *DriverData; /**< Device driver shared state */ }; @@ -2531,14 +2517,13 @@ struct gl_program_constants GLuint MaxNativeParameters; /* For shaders */ GLuint MaxUniformComponents; -#if FEATURE_ARB_geometry_shader4 + /* GL_ARB_geometry_shader4 */ GLuint MaxGeometryTextureImageUnits; GLuint MaxGeometryVaryingComponents; GLuint MaxVertexVaryingComponents; GLuint MaxGeometryUniformComponents; GLuint MaxGeometryOutputVertices; GLuint MaxGeometryTotalOutputComponents; -#endif }; @@ -2786,12 +2771,8 @@ struct gl_extensions GLboolean SGIS_texture_lod; GLboolean TDFX_texture_compression_FXT1; GLboolean S3_s3tc; -#if FEATURE_OES_EGL_image GLboolean OES_EGL_image; -#endif -#if FEATURE_OES_draw_texture GLboolean OES_draw_texture; -#endif /* FEATURE_OES_draw_texture */ /** The extension string */ const GLubyte *String; /** Number of supported extensions */ @@ -3232,9 +3213,8 @@ struct __GLcontextRec struct gl_meta_state *Meta; /**< for "meta" operations */ -#if FEATURE_EXT_framebuffer_object + /* GL_EXT_framebuffer_object */ struct gl_renderbuffer *CurrentRenderbuffer; -#endif GLenum ErrorValue; /**< Last error code */ -- cgit v1.2.3 From bfd7c9ac228c7ed8aec04c3b3aa33f40ee00b035 Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Mon, 23 Aug 2010 17:51:42 +0800 Subject: glsl: Include main/core.h. Make glsl include only main/core.h from core mesa. --- src/glsl/ast_function.cpp | 2 +- src/glsl/ast_to_hir.cpp | 3 +-- src/glsl/builtin_function.cpp | 2 +- src/glsl/builtin_variables.h | 2 +- src/glsl/builtins/tools/generate_builtins.py | 2 +- src/glsl/glcpp/glcpp-parse.c | 2 +- src/glsl/glcpp/glcpp-parse.y | 2 +- src/glsl/glsl_parser_extras.cpp | 2 +- src/glsl/glsl_types.cpp | 3 +-- src/glsl/hir_field_selection.cpp | 1 - src/glsl/ir.cpp | 3 +-- src/glsl/ir_constant_expression.cpp | 2 +- src/glsl/ir_explog_to_explog2.cpp | 2 +- src/glsl/ir_set_program_inouts.cpp | 2 +- src/glsl/ir_variable.cpp | 1 - src/glsl/link_functions.cpp | 2 +- src/glsl/linker.cpp | 5 +---- src/glsl/program.h | 8 +------- 18 files changed, 16 insertions(+), 30 deletions(-) (limited to 'src') diff --git a/src/glsl/ast_function.cpp b/src/glsl/ast_function.cpp index f85b308c1b..34b0f70d41 100644 --- a/src/glsl/ast_function.cpp +++ b/src/glsl/ast_function.cpp @@ -25,7 +25,7 @@ #include "ast.h" #include "glsl_types.h" #include "ir.h" -#include "main/macros.h" +#include "main/core.h" /* for MIN2 */ static ir_rvalue * convert_component(ir_rvalue *src, const glsl_type *desired_type); diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp index 57e331742e..64b142fa35 100644 --- a/src/glsl/ast_to_hir.cpp +++ b/src/glsl/ast_to_hir.cpp @@ -49,8 +49,7 @@ * parser (and lexer) sources. */ -#include "main/imports.h" -#include "main/extensions.h" +#include "main/core.h" /* for struct gl_extensions */ #include "glsl_symbol_table.h" #include "glsl_parser_extras.h" #include "ast.h" diff --git a/src/glsl/builtin_function.cpp b/src/glsl/builtin_function.cpp index 5471ba6020..a277ed6e8d 100644 --- a/src/glsl/builtin_function.cpp +++ b/src/glsl/builtin_function.cpp @@ -23,7 +23,7 @@ */ #include -#include "main/compiler.h" +#include "main/core.h" /* for struct gl_shader */ #include "glsl_parser_extras.h" #include "ir_reader.h" #include "program.h" diff --git a/src/glsl/builtin_variables.h b/src/glsl/builtin_variables.h index 2ec7d621bb..a7dbe480e9 100644 --- a/src/glsl/builtin_variables.h +++ b/src/glsl/builtin_variables.h @@ -21,7 +21,7 @@ * DEALINGS IN THE SOFTWARE. */ -#include "main/mtypes.h" +#include "main/core.h" /* for slot numbers */ struct builtin_variable { enum ir_variable_mode mode; diff --git a/src/glsl/builtins/tools/generate_builtins.py b/src/glsl/builtins/tools/generate_builtins.py index 2a763d784b..c72b5b3bc1 100755 --- a/src/glsl/builtins/tools/generate_builtins.py +++ b/src/glsl/builtins/tools/generate_builtins.py @@ -116,7 +116,7 @@ if __name__ == "__main__": */ #include -#include "main/compiler.h" +#include "main/core.h" /* for struct gl_shader */ #include "glsl_parser_extras.h" #include "ir_reader.h" #include "program.h" diff --git a/src/glsl/glcpp/glcpp-parse.c b/src/glsl/glcpp/glcpp-parse.c index 2c04d7d71b..91eb0bf972 100644 --- a/src/glsl/glcpp/glcpp-parse.c +++ b/src/glsl/glcpp/glcpp-parse.c @@ -100,7 +100,7 @@ #include #include "glcpp.h" -#include "main/mtypes.h" +#include "main/core.h" /* for struct gl_extensions */ #define glcpp_print(stream, str) stream = talloc_strdup_append(stream, str) #define glcpp_printf(stream, fmt, args, ...) \ diff --git a/src/glsl/glcpp/glcpp-parse.y b/src/glsl/glcpp/glcpp-parse.y index 3275496d99..3c28edf688 100644 --- a/src/glsl/glcpp/glcpp-parse.y +++ b/src/glsl/glcpp/glcpp-parse.y @@ -29,7 +29,7 @@ #include #include "glcpp.h" -#include "main/mtypes.h" +#include "main/core.h" /* for struct gl_extensions */ #define glcpp_print(stream, str) stream = talloc_strdup_append(stream, str) #define glcpp_printf(stream, fmt, args, ...) \ diff --git a/src/glsl/glsl_parser_extras.cpp b/src/glsl/glsl_parser_extras.cpp index b864218d50..bc56e4fcaf 100644 --- a/src/glsl/glsl_parser_extras.cpp +++ b/src/glsl/glsl_parser_extras.cpp @@ -27,7 +27,7 @@ extern "C" { #include -#include "main/mtypes.h" +#include "main/core.h" /* for struct __GLcontextRec */ } #include "ast.h" diff --git a/src/glsl/glsl_types.cpp b/src/glsl/glsl_types.cpp index c488f5c271..1da2fd76de 100644 --- a/src/glsl/glsl_types.cpp +++ b/src/glsl/glsl_types.cpp @@ -23,13 +23,12 @@ #include #include -#include "main/compiler.h" +#include "main/core.h" /* for Elements */ #include "glsl_symbol_table.h" #include "glsl_parser_extras.h" #include "glsl_types.h" #include "builtin_types.h" extern "C" { -#include "main/imports.h" #include "program/hash_table.h" } diff --git a/src/glsl/hir_field_selection.cpp b/src/glsl/hir_field_selection.cpp index 23045ff182..3c33127b5f 100644 --- a/src/glsl/hir_field_selection.cpp +++ b/src/glsl/hir_field_selection.cpp @@ -22,7 +22,6 @@ */ #include "ir.h" -#include "main/imports.h" #include "program/symbol_table.h" #include "glsl_parser_extras.h" #include "ast.h" diff --git a/src/glsl/ir.cpp b/src/glsl/ir.cpp index 4622a1f939..e5ed10d3e4 100644 --- a/src/glsl/ir.cpp +++ b/src/glsl/ir.cpp @@ -21,8 +21,7 @@ * DEALINGS IN THE SOFTWARE. */ #include -#include "main/imports.h" -#include "main/macros.h" +#include "main/core.h" /* for MAX2 */ #include "ir.h" #include "ir_visitor.h" #include "glsl_types.h" diff --git a/src/glsl/ir_constant_expression.cpp b/src/glsl/ir_constant_expression.cpp index 942f198360..f1c175c97a 100644 --- a/src/glsl/ir_constant_expression.cpp +++ b/src/glsl/ir_constant_expression.cpp @@ -34,7 +34,7 @@ */ #include -#include "main/macros.h" +#include "main/core.h" /* for MAX2, MIN2, CLAMP */ #include "ir.h" #include "ir_visitor.h" #include "glsl_types.h" diff --git a/src/glsl/ir_explog_to_explog2.cpp b/src/glsl/ir_explog_to_explog2.cpp index 9bf8271081..78694a2029 100644 --- a/src/glsl/ir_explog_to_explog2.cpp +++ b/src/glsl/ir_explog_to_explog2.cpp @@ -29,7 +29,7 @@ * and log2 operations. */ -#include "main/imports.h" +#include "main/core.h" /* for log2f on MSVC */ #include "ir.h" #include "glsl_types.h" diff --git a/src/glsl/ir_set_program_inouts.cpp b/src/glsl/ir_set_program_inouts.cpp index 534f602128..b3f1cc0d8b 100644 --- a/src/glsl/ir_set_program_inouts.cpp +++ b/src/glsl/ir_set_program_inouts.cpp @@ -35,7 +35,7 @@ */ extern "C" { -#include "main/mtypes.h" +#include "main/core.h" /* for struct gl_program */ #include "program/hash_table.h" } #include "ir.h" diff --git a/src/glsl/ir_variable.cpp b/src/glsl/ir_variable.cpp index 917c06743b..e638c9602f 100644 --- a/src/glsl/ir_variable.cpp +++ b/src/glsl/ir_variable.cpp @@ -21,7 +21,6 @@ * DEALINGS IN THE SOFTWARE. */ -#include "main/compiler.h" #include "ir.h" #include "glsl_parser_extras.h" #include "glsl_symbol_table.h" diff --git a/src/glsl/link_functions.cpp b/src/glsl/link_functions.cpp index dfda05fcbe..6374573e61 100644 --- a/src/glsl/link_functions.cpp +++ b/src/glsl/link_functions.cpp @@ -29,7 +29,7 @@ extern "C" { #include } -#include "main/mtypes.h" +#include "main/core.h" #include "glsl_symbol_table.h" #include "glsl_parser_extras.h" #include "ir.h" diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp index 38d19c4c71..c5c8c9cdd6 100644 --- a/src/glsl/linker.cpp +++ b/src/glsl/linker.cpp @@ -72,10 +72,7 @@ extern "C" { #include } -#include "main/compiler.h" -#include "main/mtypes.h" -#include "main/macros.h" -#include "main/shaderobj.h" +#include "main/core.h" #include "glsl_symbol_table.h" #include "ir.h" #include "program.h" diff --git a/src/glsl/program.h b/src/glsl/program.h index ea2c4ab0dd..893169b6cc 100644 --- a/src/glsl/program.h +++ b/src/glsl/program.h @@ -21,13 +21,7 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -#include -#include "main/mtypes.h" - -extern "C" { -#include "program/prog_parameter.h" -#include "program/prog_uniform.h" -} +#include "main/core.h" extern void link_shaders(GLcontext *ctx, struct gl_shader_program *prog); -- cgit v1.2.3 From 40fd4323b4be0eee6d4204463737a37011739333 Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Mon, 23 Aug 2010 17:31:38 +0800 Subject: st/glx: Include main/core.h. Make st/glx include only main/core.h from core mesa. --- src/gallium/state_trackers/glx/xlib/glx_api.c | 6 +--- src/gallium/state_trackers/glx/xlib/glx_usefont.c | 3 +- src/gallium/state_trackers/glx/xlib/xm_api.c | 43 +++++++++++++++++------ src/gallium/state_trackers/glx/xlib/xm_api.h | 2 +- src/gallium/state_trackers/glx/xlib/xm_st.c | 5 ++- 5 files changed, 38 insertions(+), 21 deletions(-) (limited to 'src') diff --git a/src/gallium/state_trackers/glx/xlib/glx_api.c b/src/gallium/state_trackers/glx/xlib/glx_api.c index eb8d6a1933..a90edfb055 100644 --- a/src/gallium/state_trackers/glx/xlib/glx_api.c +++ b/src/gallium/state_trackers/glx/xlib/glx_api.c @@ -34,10 +34,6 @@ #include "GL/glx.h" #include "xm_api.h" -#include "main/context.h" -#include "main/macros.h" -#include "main/imports.h" -#include "main/version.h" /* This indicates the client-side GLX API and GLX encoder version. */ @@ -1299,7 +1295,7 @@ glXCopyContext( Display *dpy, GLXContext src, GLXContext dst, XMesaContext xm_dst = dst->xmesaContext; (void) dpy; if (MakeCurrent_PrevContext == src) { - _mesa_Flush(); + glFlush(); } XMesaCopyContext(xm_src, xm_dst, mask); } diff --git a/src/gallium/state_trackers/glx/xlib/glx_usefont.c b/src/gallium/state_trackers/glx/xlib/glx_usefont.c index 8903b0e6cb..0aa37e150b 100644 --- a/src/gallium/state_trackers/glx/xlib/glx_usefont.c +++ b/src/gallium/state_trackers/glx/xlib/glx_usefont.c @@ -30,8 +30,7 @@ */ -#include "main/context.h" -#include "main/imports.h" +#include "main/core.h" #include diff --git a/src/gallium/state_trackers/glx/xlib/xm_api.c b/src/gallium/state_trackers/glx/xlib/xm_api.c index 894ed548ee..eb4ce74266 100644 --- a/src/gallium/state_trackers/glx/xlib/xm_api.c +++ b/src/gallium/state_trackers/glx/xlib/xm_api.c @@ -56,7 +56,6 @@ #include "xm_api.h" #include "xm_st.h" -#include "main/context.h" #include "pipe/p_defines.h" #include "pipe/p_screen.h" #include "pipe/p_context.h" @@ -755,15 +754,39 @@ XMesaVisual XMesaCreateVisual( Display *display, alpha_bits = v->mesa_visual.alphaBits; } - _mesa_initialize_visual( &v->mesa_visual, - db_flag, stereo_flag, - red_bits, green_bits, - blue_bits, alpha_bits, - depth_size, - stencil_size, - accum_red_size, accum_green_size, - accum_blue_size, accum_alpha_size, - 0 ); + /* initialize visual */ + { + __GLcontextModes *vis = &v->mesa_visual; + + vis->rgbMode = GL_TRUE; + vis->doubleBufferMode = db_flag; + vis->stereoMode = stereo_flag; + + vis->redBits = red_bits; + vis->greenBits = green_bits; + vis->blueBits = blue_bits; + vis->alphaBits = alpha_bits; + vis->rgbBits = red_bits + green_bits + blue_bits; + + vis->indexBits = 0; + vis->depthBits = depth_size; + vis->stencilBits = stencil_size; + + vis->accumRedBits = accum_red_size; + vis->accumGreenBits = accum_green_size; + vis->accumBlueBits = accum_blue_size; + vis->accumAlphaBits = accum_alpha_size; + + vis->haveAccumBuffer = accum_red_size > 0; + vis->haveDepthBuffer = depth_size > 0; + vis->haveStencilBuffer = stencil_size > 0; + + vis->numAuxBuffers = 0; + vis->level = 0; + vis->pixmapMode = 0; + vis->sampleBuffers = 0; + vis->samples = 0; + } v->stvis.buffer_mask = ST_ATTACHMENT_FRONT_LEFT_MASK; if (db_flag) diff --git a/src/gallium/state_trackers/glx/xlib/xm_api.h b/src/gallium/state_trackers/glx/xlib/xm_api.h index 934c749450..f209b14ea1 100644 --- a/src/gallium/state_trackers/glx/xlib/xm_api.h +++ b/src/gallium/state_trackers/glx/xlib/xm_api.h @@ -57,7 +57,7 @@ and create a window, you must do the following to use the X/Mesa interface: #define XMESA_H -#include "main/mtypes.h" +#include "main/core.h" /* for GLvisual and MESA_VERSION_STRING */ #include "state_tracker/st_api.h" #include "os/os_thread.h" diff --git a/src/gallium/state_trackers/glx/xlib/xm_st.c b/src/gallium/state_trackers/glx/xlib/xm_st.c index 873d5b6603..0f74b3f7aa 100644 --- a/src/gallium/state_trackers/glx/xlib/xm_st.c +++ b/src/gallium/state_trackers/glx/xlib/xm_st.c @@ -26,12 +26,11 @@ * Chia-I Wu */ -#include "util/u_memory.h" -#include "util/u_inlines.h" - #include "xm_api.h" #include "xm_st.h" +#include "util/u_inlines.h" + struct xmesa_st_framebuffer { XMesaDisplay display; XMesaBuffer buffer; -- cgit v1.2.3 From 59e6e765426a5877db7446e1e34bb7edd3dc1f74 Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Mon, 23 Aug 2010 17:31:27 +0800 Subject: st/wgl: Include main/core.h. Make st/wgl include only main/core.h from core mesa. --- src/gallium/state_trackers/wgl/stw_context.c | 2 +- src/gallium/state_trackers/wgl/stw_device.c | 2 +- src/gallium/state_trackers/wgl/stw_pixelformat.c | 4 +--- src/gallium/state_trackers/wgl/stw_pixelformat.h | 2 -- 4 files changed, 3 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/gallium/state_trackers/wgl/stw_context.c b/src/gallium/state_trackers/wgl/stw_context.c index 0fb7cd8306..a0e14b9601 100644 --- a/src/gallium/state_trackers/wgl/stw_context.c +++ b/src/gallium/state_trackers/wgl/stw_context.c @@ -33,7 +33,7 @@ /* for _mesa_share_state */ #include "state_tracker/st_context.h" -#include "main/context.h" +#include "main/core.h" #include "stw_icd.h" #include "stw_device.h" diff --git a/src/gallium/state_trackers/wgl/stw_device.c b/src/gallium/state_trackers/wgl/stw_device.c index a107c71bda..37809d084c 100644 --- a/src/gallium/state_trackers/wgl/stw_device.c +++ b/src/gallium/state_trackers/wgl/stw_device.c @@ -27,7 +27,7 @@ #include -#include "glapi/glthread.h" +#include "glapi/glapi.h" #include "util/u_debug.h" #include "util/u_math.h" #include "util/u_memory.h" diff --git a/src/gallium/state_trackers/wgl/stw_pixelformat.c b/src/gallium/state_trackers/wgl/stw_pixelformat.c index e606477e97..18ac482369 100644 --- a/src/gallium/state_trackers/wgl/stw_pixelformat.c +++ b/src/gallium/state_trackers/wgl/stw_pixelformat.c @@ -25,15 +25,13 @@ * **************************************************************************/ -#include "main/mtypes.h" -#include "main/context.h" - #include "pipe/p_format.h" #include "pipe/p_defines.h" #include "pipe/p_screen.h" #include "util/u_format.h" #include "util/u_debug.h" +#include "util/u_memory.h" #include "stw_icd.h" #include "stw_device.h" diff --git a/src/gallium/state_trackers/wgl/stw_pixelformat.h b/src/gallium/state_trackers/wgl/stw_pixelformat.h index d405172773..282c9f643c 100644 --- a/src/gallium/state_trackers/wgl/stw_pixelformat.h +++ b/src/gallium/state_trackers/wgl/stw_pixelformat.h @@ -34,8 +34,6 @@ #define PFD_SUPPORT_COMPOSITION 0x00008000 #endif -#include "main/mtypes.h" - #include "pipe/p_compiler.h" #include "pipe/p_format.h" #include "state_tracker/st_api.h" -- cgit v1.2.3 From d473543069b9156ea7a928f17fb15bc70545d4d1 Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Mon, 23 Aug 2010 17:31:20 +0800 Subject: st/dri: Remove unnecessary main/mtype.h. --- src/gallium/state_trackers/dri/common/dri_context.h | 1 - 1 file changed, 1 deletion(-) (limited to 'src') diff --git a/src/gallium/state_trackers/dri/common/dri_context.h b/src/gallium/state_trackers/dri/common/dri_context.h index 692c49d7cd..35b870a8a3 100644 --- a/src/gallium/state_trackers/dri/common/dri_context.h +++ b/src/gallium/state_trackers/dri/common/dri_context.h @@ -34,7 +34,6 @@ #include "pipe/p_compiler.h" #include "dri_wrapper.h" -#include "main/mtypes.h" struct pipe_context; struct pipe_fence; -- cgit v1.2.3 From 9dd95b46c80e71eb858c373b636ad04c69c0d15d Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Tue, 24 Aug 2010 11:49:55 +0800 Subject: mesa: Remove extraneous semicolon. --- src/mesa/main/core.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/main/core.h b/src/mesa/main/core.h index 11b68cc987..ea6e6bf118 100644 --- a/src/mesa/main/core.h +++ b/src/mesa/main/core.h @@ -59,7 +59,7 @@ extern "C" { #include "program/prog_uniform.h" #ifdef __cplusplus -}; +} #endif -- cgit v1.2.3 From ce7016e8827ae64f6b7a92bbc4cdc51d3f8761cd Mon Sep 17 00:00:00 2001 From: Benjamin Franzke Date: Sun, 22 Aug 2010 18:24:10 +0200 Subject: targets/egl: rename pipe_radeon to pipe_r300 st/egl/x11/x11_screen.c requests a driver named r300 not radeon KNOWN ISSUE: breaks st/egl/kms/ st/egl/kms requests a pipe named "radeon" that will not be found now so why not leaving pipe_radeon there? that was possible as long we have only r300g. now there is also r600g for which st/egl/kms also requests a pipe named "radeon" (possible solution in later commit) --- src/gallium/targets/egl/Makefile | 14 +++++++------- src/gallium/targets/egl/pipe_r300.c | 27 +++++++++++++++++++++++++++ src/gallium/targets/egl/pipe_radeon.c | 27 --------------------------- 3 files changed, 34 insertions(+), 34 deletions(-) create mode 100644 src/gallium/targets/egl/pipe_r300.c delete mode 100644 src/gallium/targets/egl/pipe_radeon.c (limited to 'src') diff --git a/src/gallium/targets/egl/Makefile b/src/gallium/targets/egl/Makefile index 1585e2dc20..636fceb91f 100644 --- a/src/gallium/targets/egl/Makefile +++ b/src/gallium/targets/egl/Makefile @@ -90,10 +90,10 @@ nouveau_LIBS := \ $(TOP)/src/gallium/drivers/nv50/libnv50.a \ $(TOP)/src/gallium/drivers/nouveau/libnouveau.a -# radeon pipe driver -radeon_CPPFLAGS := -radeon_SYS := -ldrm -ldrm_radeon -radeon_LIBS := \ +# r300 pipe driver +r300_CPPFLAGS := +r300_SYS := -ldrm -ldrm_radeon +r300_LIBS := \ $(TOP)/src/gallium/winsys/radeon/drm/libradeonwinsys.a \ $(TOP)/src/gallium/drivers/r300/libr300.a @@ -151,7 +151,7 @@ ifneq ($(findstring nouveau/drm,$(GALLIUM_WINSYS_DIRS)),) OUTPUTS += nouveau endif ifneq ($(findstring radeon/drm,$(GALLIUM_WINSYS_DIRS)),) -OUTPUTS += radeon +OUTPUTS += r300 endif ifneq ($(findstring svga/drm,$(GALLIUM_WINSYS_DIRS)),) OUTPUTS += vmwgfx @@ -188,8 +188,8 @@ $(OUTPUT_PATH)/$(PIPE_PREFIX)i965.so: pipe_i965.o $(i965_LIBS) $(OUTPUT_PATH)/$(PIPE_PREFIX)nouveau.so: pipe_nouveau.o $(nouveau_LIBS) $(call mklib,nouveau) -$(OUTPUT_PATH)/$(PIPE_PREFIX)radeon.so: pipe_radeon.o $(radeon_LIBS) - $(call mklib,radeon) +$(OUTPUT_PATH)/$(PIPE_PREFIX)r300.so: pipe_r300.o $(r300_LIBS) + $(call mklib,r300) $(OUTPUT_PATH)/$(PIPE_PREFIX)vmwgfx.so: pipe_vmwgfx.o $(vmwgfx_LIBS) $(call mklib,vmwgfx) diff --git a/src/gallium/targets/egl/pipe_r300.c b/src/gallium/targets/egl/pipe_r300.c new file mode 100644 index 0000000000..2fa495e8a2 --- /dev/null +++ b/src/gallium/targets/egl/pipe_r300.c @@ -0,0 +1,27 @@ + +#include "target-helpers/inline_debug_helper.h" +#include "state_tracker/drm_driver.h" +#include "radeon/drm/radeon_drm_public.h" +#include "r300/r300_public.h" + +static struct pipe_screen * +create_screen(int fd) +{ + struct r300_winsys_screen *sws; + struct pipe_screen *screen; + + sws = r300_drm_winsys_screen_create(fd); + if (!sws) + return NULL; + + screen = r300_screen_create(sws); + if (!screen) + return NULL; + + screen = debug_screen_wrap(screen); + + return screen; +} + +PUBLIC +DRM_DRIVER_DESCRIPTOR("r300", "r300", create_screen) diff --git a/src/gallium/targets/egl/pipe_radeon.c b/src/gallium/targets/egl/pipe_radeon.c deleted file mode 100644 index 35550bcb26..0000000000 --- a/src/gallium/targets/egl/pipe_radeon.c +++ /dev/null @@ -1,27 +0,0 @@ - -#include "target-helpers/inline_debug_helper.h" -#include "state_tracker/drm_driver.h" -#include "radeon/drm/radeon_drm_public.h" -#include "r300/r300_public.h" - -static struct pipe_screen * -create_screen(int fd) -{ - struct r300_winsys_screen *sws; - struct pipe_screen *screen; - - sws = r300_drm_winsys_screen_create(fd); - if (!sws) - return NULL; - - screen = r300_screen_create(sws); - if (!screen) - return NULL; - - screen = debug_screen_wrap(screen); - - return screen; -} - -PUBLIC -DRM_DRIVER_DESCRIPTOR("radeon", "radeon", create_screen) -- cgit v1.2.3 From 0ba164365875bba0150937c7e1a81cfa06d9f9b4 Mon Sep 17 00:00:00 2001 From: Benjamin Franzke Date: Sun, 22 Aug 2010 18:24:12 +0200 Subject: targets/egl: add pipe_r600 KNOWN ISSUE: eglShowScreenSurfaceMESA in st/egl/kms fails but st/egl/x11 works --- src/gallium/targets/egl/Makefile | 13 +++++++++++++ src/gallium/targets/egl/pipe_r600.c | 27 +++++++++++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 src/gallium/targets/egl/pipe_r600.c (limited to 'src') diff --git a/src/gallium/targets/egl/Makefile b/src/gallium/targets/egl/Makefile index 636fceb91f..2784fd0d10 100644 --- a/src/gallium/targets/egl/Makefile +++ b/src/gallium/targets/egl/Makefile @@ -97,6 +97,13 @@ r300_LIBS := \ $(TOP)/src/gallium/winsys/radeon/drm/libradeonwinsys.a \ $(TOP)/src/gallium/drivers/r300/libr300.a +# r600 pipe driver +r600_CPPFLAGS := +r600_SYS := -ldrm -ldrm_radeon +r600_LIBS := \ + $(TOP)/src/gallium/winsys/r600/drm/libr600winsys.a \ + $(TOP)/src/gallium/drivers/r600/libr600.a + # vmwgfx pipe driver vmwgfx_CPPFLAGS := vmwgfx_SYS := @@ -153,6 +160,9 @@ endif ifneq ($(findstring radeon/drm,$(GALLIUM_WINSYS_DIRS)),) OUTPUTS += r300 endif +ifneq ($(findstring r600/drm,$(GALLIUM_WINSYS_DIRS)),) +OUTPUTS += r600 +endif ifneq ($(findstring svga/drm,$(GALLIUM_WINSYS_DIRS)),) OUTPUTS += vmwgfx endif @@ -191,6 +201,9 @@ $(OUTPUT_PATH)/$(PIPE_PREFIX)nouveau.so: pipe_nouveau.o $(nouveau_LIBS) $(OUTPUT_PATH)/$(PIPE_PREFIX)r300.so: pipe_r300.o $(r300_LIBS) $(call mklib,r300) +$(OUTPUT_PATH)/$(PIPE_PREFIX)r600.so: pipe_r600.o $(r600_LIBS) + $(call mklib,r600) + $(OUTPUT_PATH)/$(PIPE_PREFIX)vmwgfx.so: pipe_vmwgfx.o $(vmwgfx_LIBS) $(call mklib,vmwgfx) diff --git a/src/gallium/targets/egl/pipe_r600.c b/src/gallium/targets/egl/pipe_r600.c new file mode 100644 index 0000000000..c35a0b09b9 --- /dev/null +++ b/src/gallium/targets/egl/pipe_r600.c @@ -0,0 +1,27 @@ + +#include "state_tracker/drm_driver.h" +#include "target-helpers/inline_debug_helper.h" +#include "r600/drm/r600_drm_public.h" +#include "r600/r600_public.h" + +static struct pipe_screen * +create_screen(int fd) +{ + struct radeon *rw; + struct pipe_screen *screen; + + rw = r600_drm_winsys_create(fd); + if (!rw) + return NULL; + + screen = r600_screen_create(rw); + if (!screen) + return NULL; + + screen = debug_screen_wrap(screen); + + return screen; +} + +PUBLIC +DRM_DRIVER_DESCRIPTOR("r600", "r600", create_screen) -- cgit v1.2.3 From 65741c596f9c89ee25dfa4eb910a48140d22515b Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Mon, 23 Aug 2010 23:03:51 +0800 Subject: targets/egl: Check against drm_driver_descriptor::name. drm_driver_descriptor::driver_name is defined to be the name of the kernel module. We should check against drm_driver_descriptor::name instead of drm_driver_descriptor::driver_name. --- src/gallium/targets/egl/egl.c | 27 +++++++++++++-------------- src/gallium/targets/egl/pipe_r300.c | 2 +- src/gallium/targets/egl/pipe_r600.c | 2 +- 3 files changed, 15 insertions(+), 16 deletions(-) (limited to 'src') diff --git a/src/gallium/targets/egl/egl.c b/src/gallium/targets/egl/egl.c index d9d89485c3..a573b21217 100644 --- a/src/gallium/targets/egl/egl.c +++ b/src/gallium/targets/egl/egl.c @@ -155,24 +155,23 @@ load_pipe_module(struct pipe_module *pmod, const char *name) if (!pmod->name) return FALSE; + _eglLog(_EGL_DEBUG, "searching for pipe module %s", pmod->name); _eglSearchPathForEach(dlopen_pipe_module_cb, (void *) pmod); if (pmod->lib) { pmod->drmdd = (const struct drm_driver_descriptor *) util_dl_get_proc_address(pmod->lib, "driver_descriptor"); - if (pmod->drmdd) { - if (pmod->drmdd->driver_name) { - /* driver name mismatch */ - if (strcmp(pmod->drmdd->driver_name, pmod->name) != 0) - pmod->drmdd = NULL; - } - else { - /* swrast */ - pmod->swrast_create_screen = - (struct pipe_screen *(*)(struct sw_winsys *)) - util_dl_get_proc_address(pmod->lib, "swrast_create_screen"); - if (!pmod->swrast_create_screen) - pmod->drmdd = NULL; - } + + /* sanity check on the name */ + if (pmod->drmdd && strcmp(pmod->drmdd->name, pmod->name) != 0) + pmod->drmdd = NULL; + + /* swrast */ + if (pmod->drmdd && !pmod->drmdd->driver_name) { + pmod->swrast_create_screen = + (struct pipe_screen *(*)(struct sw_winsys *)) + util_dl_get_proc_address(pmod->lib, "swrast_create_screen"); + if (!pmod->swrast_create_screen) + pmod->drmdd = NULL; } if (!pmod->drmdd) { diff --git a/src/gallium/targets/egl/pipe_r300.c b/src/gallium/targets/egl/pipe_r300.c index 2fa495e8a2..d84bb92539 100644 --- a/src/gallium/targets/egl/pipe_r300.c +++ b/src/gallium/targets/egl/pipe_r300.c @@ -24,4 +24,4 @@ create_screen(int fd) } PUBLIC -DRM_DRIVER_DESCRIPTOR("r300", "r300", create_screen) +DRM_DRIVER_DESCRIPTOR("r300", "radeon", create_screen) diff --git a/src/gallium/targets/egl/pipe_r600.c b/src/gallium/targets/egl/pipe_r600.c index c35a0b09b9..486a659258 100644 --- a/src/gallium/targets/egl/pipe_r600.c +++ b/src/gallium/targets/egl/pipe_r600.c @@ -24,4 +24,4 @@ create_screen(int fd) } PUBLIC -DRM_DRIVER_DESCRIPTOR("r600", "r600", create_screen) +DRM_DRIVER_DESCRIPTOR("r600", "radeon", create_screen) -- cgit v1.2.3 From 1288d5c39234e7c54ae2fbb81dd788c98c62a7b3 Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Tue, 24 Aug 2010 01:05:12 +0800 Subject: st/egl: Fix r300/r600 support in KMS backend. When the kernel driver name is radeon, ask the loader for r300 or r600 depending on the PCI ID. --- src/gallium/state_trackers/egl/Makefile | 2 +- src/gallium/state_trackers/egl/kms/native_kms.c | 33 +++++++++++++++++++++++-- 2 files changed, 32 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/gallium/state_trackers/egl/Makefile b/src/gallium/state_trackers/egl/Makefile index 9e9e479e7e..4199d7c6ba 100644 --- a/src/gallium/state_trackers/egl/Makefile +++ b/src/gallium/state_trackers/egl/Makefile @@ -24,7 +24,7 @@ x11_SOURCES = $(wildcard x11/*.c) \ x11_OBJECTS = $(x11_SOURCES:.c=.o) -kms_INCLUDES = $(shell pkg-config --cflags-only-I libdrm) +kms_INCLUDES = -I$(TOP)/src/gallium/winsys $(shell pkg-config --cflags-only-I libdrm) kms_SOURCES = $(wildcard kms/*.c) kms_OBJECTS = $(kms_SOURCES:.c=.o) diff --git a/src/gallium/state_trackers/egl/kms/native_kms.c b/src/gallium/state_trackers/egl/kms/native_kms.c index d4e8fbc913..0a69919328 100644 --- a/src/gallium/state_trackers/egl/kms/native_kms.c +++ b/src/gallium/state_trackers/egl/kms/native_kms.c @@ -38,6 +38,10 @@ #include "native_kms.h" +/* see get_drm_screen_name */ +#include +#include "radeon/drm/radeon_drm.h" + static boolean kms_surface_validate(struct native_surface *nsurf, uint attachment_mask, unsigned int *seq_num, struct pipe_resource **textures, @@ -664,6 +668,27 @@ kms_display_destroy(struct native_display *ndpy) FREE(kdpy); } +static const char * +get_drm_screen_name(int fd, drmVersionPtr version) +{ + const char *name = version->name; + + if (name && !strcmp(name, "radeon")) { + int chip_id; + struct drm_radeon_info info; + + memset(&info, 0, sizeof(info)); + info.request = RADEON_INFO_DEVICE_ID; + info.value = pointer_to_intptr(&chip_id); + if (drmCommandWriteRead(fd, DRM_RADEON_INFO, &info, sizeof(info)) != 0) + return NULL; + + name = is_r3xx(chip_id) ? "r300" : "r600"; + } + + return name; +} + /** * Initialize KMS and pipe screen. */ @@ -672,6 +697,7 @@ kms_display_init_screen(struct native_display *ndpy) { struct kms_display *kdpy = kms_display(ndpy); drmVersionPtr version; + const char *name; version = drmGetVersion(kdpy->fd); if (!version) { @@ -679,8 +705,11 @@ kms_display_init_screen(struct native_display *ndpy) return FALSE; } - kdpy->base.screen = kdpy->event_handler->new_drm_screen(&kdpy->base, - version->name, kdpy->fd);; + name = get_drm_screen_name(kdpy->fd, version); + if (name) { + kdpy->base.screen = + kdpy->event_handler->new_drm_screen(&kdpy->base, name, kdpy->fd); + } drmFreeVersion(version); if (!kdpy->base.screen) { -- cgit v1.2.3 From b48f20dab8a93fe187f6e6d9d7544f07ed8148db Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Mon, 23 Aug 2010 22:15:24 -0700 Subject: r300g: Remove unused variable. Fixes this GCC warning. r300_render.c: In function 'r300_draw_flush_vbuf': r300_render.c:988: warning: unused variable 'r300_render' --- src/gallium/drivers/r300/r300_render.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_render.c b/src/gallium/drivers/r300/r300_render.c index 73447057bb..fc3844f788 100644 --- a/src/gallium/drivers/r300/r300_render.c +++ b/src/gallium/drivers/r300/r300_render.c @@ -985,8 +985,6 @@ struct draw_stage* r300_draw_stage(struct r300_context* r300) void r300_draw_flush_vbuf(struct r300_context *r300) { - struct r300_render *r300render; - pipe_resource_reference(&r300->vbo, NULL); r300->draw_vbo_size = 0; } -- cgit v1.2.3 From e5df3cc286fa2607897944d478081014929b38ec Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Mon, 23 Aug 2010 22:27:49 -0700 Subject: glsl: Silence unused variable warning. The variable is used but only in the body of an assert. --- src/glsl/glsl_types.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/glsl/glsl_types.cpp b/src/glsl/glsl_types.cpp index 1da2fd76de..2e5c2ecf04 100644 --- a/src/glsl/glsl_types.cpp +++ b/src/glsl/glsl_types.cpp @@ -243,6 +243,7 @@ glsl_type::generate_constructor(glsl_symbol_table *symtab) const bool added = symtab->add_function(name, f); assert(added); + (void) added; ir_function_signature *const sig = new(ctx) ir_function_signature(this); f->add_signature(sig); -- cgit v1.2.3 From f122dba59a753e8672cb7cc9b9109b81e0ab1b1c Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Tue, 24 Aug 2010 16:10:28 +1000 Subject: glsl: make 'make clean' work properly. this has make clean remove all the objects. --- src/glsl/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/glsl/Makefile b/src/glsl/Makefile index fef389162a..3fd06bc9cb 100644 --- a/src/glsl/Makefile +++ b/src/glsl/Makefile @@ -131,7 +131,7 @@ depend: $(ALL_SOURCES) Makefile # Remove .o and backup files clean: - rm -f $(OBJECTS) lib$(LIBNAME).a depend depend.bak + rm -f $(GLCPP_OBJECTS) $(GLSL2_OBJECTS) $(OBJECTS) lib$(LIBNAME).a depend depend.bak -rm -f $(APPS) # Dummy target -- cgit v1.2.3 From b018ea19a39cb0e5326e92c88a55ff220e463404 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Mon, 23 Aug 2010 23:58:57 -0700 Subject: nvfx: Remove unnecessary headers. --- src/gallium/drivers/nvfx/nvfx_miptree.c | 2 -- src/gallium/drivers/nvfx/nvfx_resource.c | 1 - src/gallium/drivers/nvfx/nvfx_surface.c | 1 - 3 files changed, 4 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/nvfx/nvfx_miptree.c b/src/gallium/drivers/nvfx/nvfx_miptree.c index 0532b43ef0..46e1f9e4f4 100644 --- a/src/gallium/drivers/nvfx/nvfx_miptree.c +++ b/src/gallium/drivers/nvfx/nvfx_miptree.c @@ -10,8 +10,6 @@ #include "nouveau/nouveau_screen.h" #include "nvfx_screen.h" #include "nvfx_resource.h" -#include "nvfx_transfer.h" -#include "nv04_2d.h" static void nvfx_miptree_choose_format(struct nvfx_miptree *mt) diff --git a/src/gallium/drivers/nvfx/nvfx_resource.c b/src/gallium/drivers/nvfx/nvfx_resource.c index 3a46e0a7a5..39ae893f1b 100644 --- a/src/gallium/drivers/nvfx/nvfx_resource.c +++ b/src/gallium/drivers/nvfx/nvfx_resource.c @@ -2,7 +2,6 @@ #include "pipe/p_context.h" #include "util/u_staging.h" #include "nvfx_resource.h" -#include "nvfx_transfer.h" #include "nouveau/nouveau_screen.h" static unsigned int diff --git a/src/gallium/drivers/nvfx/nvfx_surface.c b/src/gallium/drivers/nvfx/nvfx_surface.c index 806f1a22e6..f6cc985673 100644 --- a/src/gallium/drivers/nvfx/nvfx_surface.c +++ b/src/gallium/drivers/nvfx/nvfx_surface.c @@ -32,7 +32,6 @@ #include "util/u_math.h" #include "util/u_memory.h" #include "util/u_pack_color.h" -#include "util/u_rect.h" #include "util/u_blitter.h" #include "nouveau/nouveau_winsys.h" -- cgit v1.2.3 From c8b26c63fdad84d311748a24972146b6a371ab31 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Tue, 24 Aug 2010 01:16:46 -0700 Subject: glsl: Add assert to check variable_entry referenced_count after construction. A variable_entry after construction should have its referenced_count member set to 0. However, occassionally this isn't the case and entry->referenced_count has been observed to be a garbage value. This leads to crashes of several tests in the Piglit test suite. This patch adds an assert to check that a variable_entry instance has its referenced_count member initialized to 0 after construction. --- src/glsl/ir_variable_refcount.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/glsl/ir_variable_refcount.cpp b/src/glsl/ir_variable_refcount.cpp index 20c2f6602b..66147279be 100644 --- a/src/glsl/ir_variable_refcount.cpp +++ b/src/glsl/ir_variable_refcount.cpp @@ -45,6 +45,7 @@ ir_variable_refcount_visitor::get_variable_entry(ir_variable *var) } variable_entry *entry = new(mem_ctx) variable_entry(var); + assert(entry->referenced_count == 0); this->variable_list.push_tail(entry); return entry; } -- cgit v1.2.3 From f82163b01260edf2c1bf6905846f74bf001d7139 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 24 Aug 2010 08:04:37 -0600 Subject: mesa: added isblank() for MSVC --- src/mesa/main/imports.h | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/mesa/main/imports.h b/src/mesa/main/imports.h index 6c2ef52d35..cb35885dbd 100644 --- a/src/mesa/main/imports.h +++ b/src/mesa/main/imports.h @@ -147,6 +147,7 @@ typedef union { GLfloat f; GLint i; } fi_type; static INLINE float truncf(float x) { return x < 0.0f ? ceilf(x) : floorf(x); } static INLINE float exp2f(float x) { return powf(2.0f, x); } static INLINE float log2f(float x) { return logf(x) * 1.442695041f; } +static INLINE int isblank(int ch) { return ch == ' ' || ch == '\t'; } #endif /*@}*/ -- cgit v1.2.3 From 2eb8b2d3bb68cef1d3fc431debe1b18f6c017aeb Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 24 Aug 2010 10:01:40 -0600 Subject: glsl2: move constructor into .cpp file to work around compiler bug Fixes fd.o bug 29770 The refcount==0 assertion only failed on some systems. One example being 32-bit Linux with gcc 4.4.4. --- src/glsl/ir_variable_refcount.cpp | 12 ++++++++++++ src/glsl/ir_variable_refcount.h | 9 +-------- 2 files changed, 13 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/glsl/ir_variable_refcount.cpp b/src/glsl/ir_variable_refcount.cpp index 66147279be..7d39abb368 100644 --- a/src/glsl/ir_variable_refcount.cpp +++ b/src/glsl/ir_variable_refcount.cpp @@ -34,6 +34,18 @@ #include "ir_variable_refcount.h" #include "glsl_types.h" + +// constructor +variable_entry::variable_entry(ir_variable *var) +{ + this->var = var; + assign = NULL; + assigned_count = 0; + declaration = false; + referenced_count = 0; +} + + variable_entry * ir_variable_refcount_visitor::get_variable_entry(ir_variable *var) { diff --git a/src/glsl/ir_variable_refcount.h b/src/glsl/ir_variable_refcount.h index 059ea097a6..8b43bad71f 100644 --- a/src/glsl/ir_variable_refcount.h +++ b/src/glsl/ir_variable_refcount.h @@ -36,14 +36,7 @@ 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; - } + variable_entry(ir_variable *var); ir_variable *var; /* The key: the variable's pointer. */ ir_assignment *assign; /* An assignment to the variable, if any */ -- cgit v1.2.3 From 81137623e55bb003d2479385547028661c71b415 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 24 Aug 2010 10:21:25 -0600 Subject: glsl2: rename local variable_entry class With MSVC it seems that this class and its constructor is colliding with the one in ir_variable_refcount.cpp. Rename the class here to avoid the collision. This is a bit of a hack. Can the two variable_entry classes be merged and shared? --- src/glsl/ir_structure_splitting.cpp | 39 +++++++++++++++++++++---------------- 1 file changed, 22 insertions(+), 17 deletions(-) (limited to 'src') diff --git a/src/glsl/ir_structure_splitting.cpp b/src/glsl/ir_structure_splitting.cpp index 91f6dac23e..ff3ec936eb 100644 --- a/src/glsl/ir_structure_splitting.cpp +++ b/src/glsl/ir_structure_splitting.cpp @@ -40,10 +40,14 @@ static bool debug = false; -class variable_entry : public exec_node +// XXX using variable_entry2 here to avoid collision (MSVC multiply-defined +// function) with the variable_entry class seen in ir_variable_refcount.h +// Perhaps we can use the one in ir_variable_refcount.h and make this class +// here go away? +class variable_entry2 : public exec_node { public: - variable_entry(ir_variable *var) + variable_entry2(ir_variable *var) { this->var = var; this->whole_structure_access = 0; @@ -65,6 +69,7 @@ public: void *mem_ctx; }; + class ir_structure_reference_visitor : public ir_hierarchical_visitor { public: ir_structure_reference_visitor(void) @@ -84,7 +89,7 @@ public: 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); + variable_entry2 *get_variable_entry2(ir_variable *var); /* List of variable_entry */ exec_list variable_list; @@ -92,8 +97,8 @@ public: void *mem_ctx; }; -variable_entry * -ir_structure_reference_visitor::get_variable_entry(ir_variable *var) +variable_entry2 * +ir_structure_reference_visitor::get_variable_entry2(ir_variable *var) { assert(var); @@ -101,12 +106,12 @@ ir_structure_reference_visitor::get_variable_entry(ir_variable *var) return NULL; foreach_iter(exec_list_iterator, iter, this->variable_list) { - variable_entry *entry = (variable_entry *)iter.get(); + variable_entry2 *entry = (variable_entry2 *)iter.get(); if (entry->var == var) return entry; } - variable_entry *entry = new(mem_ctx) variable_entry(var); + variable_entry2 *entry = new(mem_ctx) variable_entry2(var); this->variable_list.push_tail(entry); return entry; } @@ -115,7 +120,7 @@ ir_structure_reference_visitor::get_variable_entry(ir_variable *var) ir_visitor_status ir_structure_reference_visitor::visit(ir_variable *ir) { - variable_entry *entry = this->get_variable_entry(ir); + variable_entry2 *entry = this->get_variable_entry2(ir); if (entry) entry->declaration = true; @@ -127,7 +132,7 @@ 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); + variable_entry2 *entry = this->get_variable_entry2(var); if (entry) entry->whole_structure_access++; @@ -182,13 +187,13 @@ public: void split_deref(ir_dereference **deref); void handle_rvalue(ir_rvalue **rvalue); - variable_entry *get_splitting_entry(ir_variable *var); + variable_entry2 *get_splitting_entry(ir_variable *var); exec_list *variable_list; void *mem_ctx; }; -variable_entry * +variable_entry2 * ir_structure_splitting_visitor::get_splitting_entry(ir_variable *var) { assert(var); @@ -197,7 +202,7 @@ ir_structure_splitting_visitor::get_splitting_entry(ir_variable *var) return NULL; foreach_iter(exec_list_iterator, iter, *this->variable_list) { - variable_entry *entry = (variable_entry *)iter.get(); + variable_entry2 *entry = (variable_entry2 *)iter.get(); if (entry->var == var) { return entry; } @@ -217,7 +222,7 @@ ir_structure_splitting_visitor::split_deref(ir_dereference **deref) if (!deref_var) return; - variable_entry *entry = get_splitting_entry(deref_var->var); + variable_entry2 *entry = get_splitting_entry(deref_var->var); if (!entry) return; @@ -252,8 +257,8 @@ ir_structure_splitting_visitor::visit_leave(ir_assignment *ir) { 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; + variable_entry2 *lhs_entry = lhs_deref ? get_splitting_entry(lhs_deref->var) : NULL; + variable_entry2 *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) { @@ -301,7 +306,7 @@ do_structure_splitting(exec_list *instructions) /* Trim out variables we can't split. */ foreach_iter(exec_list_iterator, iter, refs.variable_list) { - variable_entry *entry = (variable_entry *)iter.get(); + variable_entry2 *entry = (variable_entry2 *)iter.get(); if (debug) { printf("structure %s@%p: decl %d, whole_access %d\n", @@ -323,7 +328,7 @@ do_structure_splitting(exec_list *instructions) * components. */ foreach_iter(exec_list_iterator, iter, refs.variable_list) { - variable_entry *entry = (variable_entry *)iter.get(); + variable_entry2 *entry = (variable_entry2 *)iter.get(); const struct glsl_type *type = entry->var->type; entry->mem_ctx = talloc_parent(entry->var); -- cgit v1.2.3 From 0eb2026c8767d6e1f68e6b07f35a9aca9ed757c7 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Tue, 17 Aug 2010 17:40:20 -0700 Subject: prog_execute: Implement OPCODE_TXL Fixes bugzilla #29628 --- src/mesa/program/prog_execute.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src') diff --git a/src/mesa/program/prog_execute.c b/src/mesa/program/prog_execute.c index 1222a0f4c8..ff8c20c4cf 100644 --- a/src/mesa/program/prog_execute.c +++ b/src/mesa/program/prog_execute.c @@ -1679,6 +1679,22 @@ _mesa_execute_program(GLcontext * ctx, store_vector4(inst, machine, color); } break; + case OPCODE_TXL: + /* Texel lookup with explicit LOD */ + { + GLfloat texcoord[4], color[4], lod; + + fetch_vector4(&inst->SrcReg[0], machine, texcoord); + + /* texcoord[3] is the LOD */ + lod = texcoord[3]; + + machine->FetchTexelLod(ctx, texcoord, lod, + machine->Samplers[inst->TexSrcUnit], color); + + store_vector4(inst, machine, color); + } + break; case OPCODE_TXP: /* GL_ARB_fragment_program only */ /* Texture lookup w/ projective divide */ { -- cgit v1.2.3 From 547e8675583053f15dc62a073b52f4722e7d0f5f Mon Sep 17 00:00:00 2001 From: Henri Verbeet Date: Tue, 24 Aug 2010 20:51:20 +0200 Subject: r600g: Add support for PIPE_FORMAT_R32_FLOAT. --- src/gallium/drivers/r600/r600_state_inlines.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src') diff --git a/src/gallium/drivers/r600/r600_state_inlines.h b/src/gallium/drivers/r600/r600_state_inlines.h index 927c342bb5..d67d4be6f8 100644 --- a/src/gallium/drivers/r600/r600_state_inlines.h +++ b/src/gallium/drivers/r600/r600_state_inlines.h @@ -264,6 +264,9 @@ static INLINE uint32_t r600_translate_colorformat(enum pipe_format format) case PIPE_FORMAT_Z24_UNORM_S8_USCALED: return V_0280A0_COLOR_8_24; + case PIPE_FORMAT_R32_FLOAT: + return V_0280A0_COLOR_32_FLOAT; + /* 64-bit buffers. */ case PIPE_FORMAT_R16G16B16A16_UNORM: case PIPE_FORMAT_R16G16B16A16_SNORM: -- cgit v1.2.3 From ad58f0d9e021065d8e6d82e1aa7387dcd206f86e Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 24 Aug 2010 12:18:09 -0700 Subject: make: Use C++ compiler to link stdc++ library. glxinfo and glxgears run on swrast and softpipe without undefined symbol errors. --- src/gallium/targets/libgl-xlib/Makefile | 3 ++- src/glx/Makefile | 5 +++-- src/mesa/drivers/x11/Makefile | 5 +++-- 3 files changed, 8 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/gallium/targets/libgl-xlib/Makefile b/src/gallium/targets/libgl-xlib/Makefile index e745023ba5..fe0541543a 100644 --- a/src/gallium/targets/libgl-xlib/Makefile +++ b/src/gallium/targets/libgl-xlib/Makefile @@ -68,8 +68,9 @@ $(TOP)/$(LIB_DIR)/gallium: # Make the libGL.so library $(TOP)/$(LIB_DIR)/gallium/$(GL_LIB_NAME): $(XLIB_TARGET_OBJECTS) $(LIBS) Makefile $(TOP)/bin/mklib -o $(GL_LIB) \ - -linker "$(CC)" \ + -linker "$(CXX)" \ -major $(GL_MAJOR) -minor $(GL_MINOR) -patch $(GL_TINY) \ + -cplusplus \ -install $(TOP)/$(LIB_DIR)/gallium \ $(MKLIB_OPTIONS) $(XLIB_TARGET_OBJECTS) \ -Wl,--start-group $(LIBS) -Wl,--end-group $(GL_LIB_DEPS) diff --git a/src/glx/Makefile b/src/glx/Makefile index 9a22d0c547..ba5708ffed 100644 --- a/src/glx/Makefile +++ b/src/glx/Makefile @@ -71,8 +71,9 @@ default: depend $(TOP)/$(LIB_DIR)/$(GL_LIB_NAME) # Make libGL $(TOP)/$(LIB_DIR)/$(GL_LIB_NAME): $(OBJECTS) $(GLAPI_LIB) Makefile - $(MKLIB) -o $(GL_LIB) -linker '$(CC)' -ldflags '$(LDFLAGS)' \ - -major 1 -minor 2 $(MKLIB_OPTIONS) \ + $(MKLIB) -o $(GL_LIB) -linker '$(CXX)' -ldflags '$(LDFLAGS)' \ + -major 1 -minor 2 \ + -cplusplus $(MKLIB_OPTIONS) \ -install $(TOP)/$(LIB_DIR) -id $(INSTALL_LIB_DIR)/lib$(GL_LIB).1.dylib \ $(GL_LIB_DEPS) $(OBJECTS) $(GLAPI_LIB) diff --git a/src/mesa/drivers/x11/Makefile b/src/mesa/drivers/x11/Makefile index b5b0c1f11a..f759da0a97 100644 --- a/src/mesa/drivers/x11/Makefile +++ b/src/mesa/drivers/x11/Makefile @@ -57,9 +57,10 @@ default: $(TOP)/$(LIB_DIR)/$(GL_LIB_NAME) $(TOP)/$(LIB_DIR)/$(GL_LIB_NAME): $(OBJECTS) $(CORE_MESA) - @ $(MKLIB) -o $(GL_LIB) -linker '$(CC)' -ldflags '$(LDFLAGS)' \ + @ $(MKLIB) -o $(GL_LIB) -linker '$(CXX)' -ldflags '$(LDFLAGS)' \ -major $(GL_MAJOR) -minor $(GL_MINOR) -patch $(GL_TINY) \ - -install $(TOP)/$(LIB_DIR) $(MKLIB_OPTIONS) \ + -install $(TOP)/$(LIB_DIR) \ + -cplusplus $(MKLIB_OPTIONS) \ -id $(INSTALL_LIB_DIR)/lib$(GL_LIB).$(GL_MAJOR).dylib \ $(GL_LIB_DEPS) $(OBJECTS) $(CORE_MESA) -- cgit v1.2.3 From 37f0654fa56a97c6f4ea6220c97758ee95267e0b Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Sun, 22 Aug 2010 17:28:20 +1000 Subject: r300g: rename radeong_dri.so to r300_dri.so acked on irc by Corbin + Marek. --- configure.ac | 2 +- src/gallium/targets/dri-r300/Makefile | 27 +++++++++++++++++++++++++++ src/gallium/targets/dri-r300/SConscript | 30 ++++++++++++++++++++++++++++++ src/gallium/targets/dri-r300/target.c | 26 ++++++++++++++++++++++++++ src/gallium/targets/dri-radeong/Makefile | 27 --------------------------- src/gallium/targets/dri-radeong/SConscript | 30 ------------------------------ src/gallium/targets/dri-radeong/target.c | 26 -------------------------- 7 files changed, 84 insertions(+), 84 deletions(-) create mode 100644 src/gallium/targets/dri-r300/Makefile create mode 100644 src/gallium/targets/dri-r300/SConscript create mode 100644 src/gallium/targets/dri-r300/target.c delete mode 100644 src/gallium/targets/dri-radeong/Makefile delete mode 100644 src/gallium/targets/dri-radeong/SConscript delete mode 100644 src/gallium/targets/dri-radeong/target.c (limited to 'src') diff --git a/configure.ac b/configure.ac index b2c6b52d2e..0b60837bf4 100644 --- a/configure.ac +++ b/configure.ac @@ -1488,7 +1488,7 @@ AC_ARG_ENABLE([gallium-radeon], [enable_gallium_radeon=auto]) if test "x$enable_gallium_radeon" = xyes; then GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS r300" - gallium_check_st "radeon/drm" "dri-radeong" "xorg-radeon" + gallium_check_st "radeon/drm" "dri-r300" "xorg-radeon" elif test "x$enable_gallium_radeon" = xauto; then GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS r300" fi diff --git a/src/gallium/targets/dri-r300/Makefile b/src/gallium/targets/dri-r300/Makefile new file mode 100644 index 0000000000..9afbb13276 --- /dev/null +++ b/src/gallium/targets/dri-r300/Makefile @@ -0,0 +1,27 @@ +TOP = ../../../.. +include $(TOP)/configs/current + +LIBNAME = r300_dri.so + +PIPE_DRIVERS = \ + $(TOP)/src/gallium/state_trackers/dri/drm/libdridrm.a \ + $(TOP)/src/gallium/winsys/radeon/drm/libradeonwinsys.a \ + $(TOP)/src/gallium/drivers/softpipe/libsoftpipe.a \ + $(TOP)/src/gallium/drivers/galahad/libgalahad.a \ + $(TOP)/src/gallium/drivers/trace/libtrace.a \ + $(TOP)/src/gallium/drivers/rbug/librbug.a \ + $(TOP)/src/gallium/drivers/r300/libr300.a + +C_SOURCES = \ + target.c \ + $(COMMON_GALLIUM_SOURCES) \ + $(DRIVER_SOURCES) + +DRIVER_DEFINES = \ + -DGALLIUM_RBUG -DGALLIUM_TRACE -DGALLIUM_GALAHAD + +include ../Makefile.dri + +DRI_LIB_DEPS += -ldrm_radeon + +symlinks: diff --git a/src/gallium/targets/dri-r300/SConscript b/src/gallium/targets/dri-r300/SConscript new file mode 100644 index 0000000000..33a458f2e6 --- /dev/null +++ b/src/gallium/targets/dri-r300/SConscript @@ -0,0 +1,30 @@ +Import('*') + +if not 'r300' in env['drivers']: + print 'warning: r300 pipe driver not built skipping r300_dri.so' + Return() + +env = drienv.Clone() + +env.ParseConfig('pkg-config --cflags --libs libdrm_radeon') + +env.Append(CPPDEFINES = ['GALLIUM_RBUG', 'GALLIUM_TRACE', 'GALLIUM_GALAHAD']) + +env.Prepend(LIBS = [ + st_dri, + radeonwinsys, + r300, + galahad, + trace, + rbug, + mesa, + glsl, + gallium, + COMMON_DRI_DRM_OBJECTS +]) + +env.SharedLibrary( + target ='r300_dri.so', + source = 'target.c', + SHLIBPREFIX = '', +) diff --git a/src/gallium/targets/dri-r300/target.c b/src/gallium/targets/dri-r300/target.c new file mode 100644 index 0000000000..2ecf3457a7 --- /dev/null +++ b/src/gallium/targets/dri-r300/target.c @@ -0,0 +1,26 @@ + +#include "target-helpers/inline_debug_helper.h" +#include "state_tracker/drm_driver.h" +#include "radeon/drm/radeon_drm_public.h" +#include "r300/r300_public.h" + +static struct pipe_screen * +create_screen(int fd) +{ + struct r300_winsys_screen *sws; + struct pipe_screen *screen; + + sws = r300_drm_winsys_screen_create(fd); + if (!sws) + return NULL; + + screen = r300_screen_create(sws); + if (!screen) + return NULL; + + screen = debug_screen_wrap(screen); + + return screen; +} + +DRM_DRIVER_DESCRIPTOR("r300", "radeon", create_screen) diff --git a/src/gallium/targets/dri-radeong/Makefile b/src/gallium/targets/dri-radeong/Makefile deleted file mode 100644 index 3f9ec36166..0000000000 --- a/src/gallium/targets/dri-radeong/Makefile +++ /dev/null @@ -1,27 +0,0 @@ -TOP = ../../../.. -include $(TOP)/configs/current - -LIBNAME = radeong_dri.so - -PIPE_DRIVERS = \ - $(TOP)/src/gallium/state_trackers/dri/drm/libdridrm.a \ - $(TOP)/src/gallium/winsys/radeon/drm/libradeonwinsys.a \ - $(TOP)/src/gallium/drivers/softpipe/libsoftpipe.a \ - $(TOP)/src/gallium/drivers/galahad/libgalahad.a \ - $(TOP)/src/gallium/drivers/trace/libtrace.a \ - $(TOP)/src/gallium/drivers/rbug/librbug.a \ - $(TOP)/src/gallium/drivers/r300/libr300.a - -C_SOURCES = \ - target.c \ - $(COMMON_GALLIUM_SOURCES) \ - $(DRIVER_SOURCES) - -DRIVER_DEFINES = \ - -DGALLIUM_RBUG -DGALLIUM_TRACE -DGALLIUM_GALAHAD - -include ../Makefile.dri - -DRI_LIB_DEPS += -ldrm_radeon - -symlinks: diff --git a/src/gallium/targets/dri-radeong/SConscript b/src/gallium/targets/dri-radeong/SConscript deleted file mode 100644 index 1402c3bd12..0000000000 --- a/src/gallium/targets/dri-radeong/SConscript +++ /dev/null @@ -1,30 +0,0 @@ -Import('*') - -if not 'r300' in env['drivers']: - print 'warning: r300 pipe driver not built skipping radeong_dri.so' - Return() - -env = drienv.Clone() - -env.ParseConfig('pkg-config --cflags --libs libdrm_radeon') - -env.Append(CPPDEFINES = ['GALLIUM_RBUG', 'GALLIUM_TRACE', 'GALLIUM_GALAHAD']) - -env.Prepend(LIBS = [ - st_dri, - radeonwinsys, - r300, - galahad, - trace, - rbug, - mesa, - glsl, - gallium, - COMMON_DRI_DRM_OBJECTS -]) - -env.SharedLibrary( - target ='radeon_dri.so', - source = 'target.c', - SHLIBPREFIX = '', -) diff --git a/src/gallium/targets/dri-radeong/target.c b/src/gallium/targets/dri-radeong/target.c deleted file mode 100644 index 5a0a8dc573..0000000000 --- a/src/gallium/targets/dri-radeong/target.c +++ /dev/null @@ -1,26 +0,0 @@ - -#include "target-helpers/inline_debug_helper.h" -#include "state_tracker/drm_driver.h" -#include "radeon/drm/radeon_drm_public.h" -#include "r300/r300_public.h" - -static struct pipe_screen * -create_screen(int fd) -{ - struct r300_winsys_screen *sws; - struct pipe_screen *screen; - - sws = r300_drm_winsys_screen_create(fd); - if (!sws) - return NULL; - - screen = r300_screen_create(sws); - if (!screen) - return NULL; - - screen = debug_screen_wrap(screen); - - return screen; -} - -DRM_DRIVER_DESCRIPTOR("radeon", "radeon", create_screen) -- cgit v1.2.3 From 7de4d8fe11c53e59265b8a4252ab9940ffcc9929 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 24 Aug 2010 15:30:42 -0700 Subject: glsl: Don't dead-code eliminate a uniform initializer. Partial fix for glsl-uniform-initializer-5. --- src/glsl/ir_dead_code.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src') diff --git a/src/glsl/ir_dead_code.cpp b/src/glsl/ir_dead_code.cpp index 7ff580d538..5cf5e99add 100644 --- a/src/glsl/ir_dead_code.cpp +++ b/src/glsl/ir_dead_code.cpp @@ -92,6 +92,14 @@ do_dead_code(exec_list *instructions) /* If there are no assignments or references to the variable left, * then we can remove its declaration. */ + + /* uniform initializers are precious, and could get used by another + * stage. + */ + if (entry->var->mode == ir_var_uniform && + entry->var->constant_value) + continue; + entry->var->remove(); progress = true; -- cgit v1.2.3 From 2f5bf20e44d509fa3afbe2cfbb9bb65347daea6a Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 24 Aug 2010 15:43:56 -0700 Subject: glsl: Set up uniform initializers by walking the shaders after linking. Previously, uniform initializers were handled by ir_to_mesa as it made its Parameters list. However, uniform values are global to all shaders, and the value set in one Parameters list wasn't propagated to the other gl_program->Parameters lists. By going back through the general Mesa uniform handling, we make sure that all gl_programs get updated values, and also successfully separate uniform initializer handling from ir_to_mesa gl_program generation. Fixes: glsl-uniform-initializer-5. --- src/mesa/main/uniforms.c | 108 +++++++++++++----------- src/mesa/main/uniforms.h | 15 +++- src/mesa/program/ir_to_mesa.cpp | 180 ++++++++++++++++++++++++---------------- 3 files changed, 181 insertions(+), 122 deletions(-) (limited to 'src') diff --git a/src/mesa/main/uniforms.c b/src/mesa/main/uniforms.c index d68a7768df..a5d7da51f0 100644 --- a/src/mesa/main/uniforms.c +++ b/src/mesa/main/uniforms.c @@ -454,17 +454,12 @@ _mesa_get_uniformiv(GLcontext *ctx, GLuint program, GLint location, * The return value will encode two values, the uniform location and an * offset (used for arrays, structs). */ -static GLint -_mesa_get_uniform_location(GLcontext *ctx, GLuint program, const GLchar *name) +GLint +_mesa_get_uniform_location(GLcontext *ctx, struct gl_shader_program *shProg, + const GLchar *name) { GLint offset = 0, location = -1; - struct gl_shader_program *shProg = - _mesa_lookup_shader_program_err(ctx, program, "glGetUniformLocation"); - - if (!shProg) - return -1; - if (shProg->LinkStatus == GL_FALSE) { _mesa_error(ctx, GL_INVALID_OPERATION, "glGetUniformfv(program)"); return -1; @@ -751,11 +746,11 @@ set_program_uniform(GLcontext *ctx, struct gl_program *program, /** * Called via glUniform*() functions. */ -static void -_mesa_uniform(GLcontext *ctx, GLint location, GLsizei count, +void +_mesa_uniform(GLcontext *ctx, struct gl_shader_program *shProg, + GLint location, GLsizei count, const GLvoid *values, GLenum type) { - struct gl_shader_program *shProg = ctx->Shader.CurrentProgram; struct gl_uniform *uniform; GLint elems, offset; @@ -923,12 +918,12 @@ set_program_uniform_matrix(GLcontext *ctx, struct gl_program *program, * Called by glUniformMatrix*() functions. * Note: cols=2, rows=4 ==> array[2] of vec4 */ -static void -_mesa_uniform_matrix(GLcontext *ctx, GLint cols, GLint rows, +void +_mesa_uniform_matrix(GLcontext *ctx, struct gl_shader_program *shProg, + GLint cols, GLint rows, GLint location, GLsizei count, GLboolean transpose, const GLfloat *values) { - struct gl_shader_program *shProg = ctx->Shader.CurrentProgram; struct gl_uniform *uniform; GLint offset; @@ -999,7 +994,7 @@ void GLAPIENTRY _mesa_Uniform1fARB(GLint location, GLfloat v0) { GET_CURRENT_CONTEXT(ctx); - _mesa_uniform(ctx, location, 1, &v0, GL_FLOAT); + _mesa_uniform(ctx, ctx->Shader.CurrentProgram, location, 1, &v0, GL_FLOAT); } void GLAPIENTRY @@ -1009,7 +1004,7 @@ _mesa_Uniform2fARB(GLint location, GLfloat v0, GLfloat v1) GLfloat v[2]; v[0] = v0; v[1] = v1; - _mesa_uniform(ctx, location, 1, v, GL_FLOAT_VEC2); + _mesa_uniform(ctx, ctx->Shader.CurrentProgram, location, 1, v, GL_FLOAT_VEC2); } void GLAPIENTRY @@ -1020,7 +1015,7 @@ _mesa_Uniform3fARB(GLint location, GLfloat v0, GLfloat v1, GLfloat v2) v[0] = v0; v[1] = v1; v[2] = v2; - _mesa_uniform(ctx, location, 1, v, GL_FLOAT_VEC3); + _mesa_uniform(ctx, ctx->Shader.CurrentProgram, location, 1, v, GL_FLOAT_VEC3); } void GLAPIENTRY @@ -1033,14 +1028,14 @@ _mesa_Uniform4fARB(GLint location, GLfloat v0, GLfloat v1, GLfloat v2, v[1] = v1; v[2] = v2; v[3] = v3; - _mesa_uniform(ctx, location, 1, v, GL_FLOAT_VEC4); + _mesa_uniform(ctx, ctx->Shader.CurrentProgram, location, 1, v, GL_FLOAT_VEC4); } void GLAPIENTRY _mesa_Uniform1iARB(GLint location, GLint v0) { GET_CURRENT_CONTEXT(ctx); - _mesa_uniform(ctx, location, 1, &v0, GL_INT); + _mesa_uniform(ctx, ctx->Shader.CurrentProgram, location, 1, &v0, GL_INT); } void GLAPIENTRY @@ -1050,7 +1045,7 @@ _mesa_Uniform2iARB(GLint location, GLint v0, GLint v1) GLint v[2]; v[0] = v0; v[1] = v1; - _mesa_uniform(ctx, location, 1, v, GL_INT_VEC2); + _mesa_uniform(ctx, ctx->Shader.CurrentProgram, location, 1, v, GL_INT_VEC2); } void GLAPIENTRY @@ -1061,7 +1056,7 @@ _mesa_Uniform3iARB(GLint location, GLint v0, GLint v1, GLint v2) v[0] = v0; v[1] = v1; v[2] = v2; - _mesa_uniform(ctx, location, 1, v, GL_INT_VEC3); + _mesa_uniform(ctx, ctx->Shader.CurrentProgram, location, 1, v, GL_INT_VEC3); } void GLAPIENTRY @@ -1073,63 +1068,63 @@ _mesa_Uniform4iARB(GLint location, GLint v0, GLint v1, GLint v2, GLint v3) v[1] = v1; v[2] = v2; v[3] = v3; - _mesa_uniform(ctx, location, 1, v, GL_INT_VEC4); + _mesa_uniform(ctx, ctx->Shader.CurrentProgram, location, 1, v, GL_INT_VEC4); } void GLAPIENTRY _mesa_Uniform1fvARB(GLint location, GLsizei count, const GLfloat * value) { GET_CURRENT_CONTEXT(ctx); - _mesa_uniform(ctx, location, count, value, GL_FLOAT); + _mesa_uniform(ctx, ctx->Shader.CurrentProgram, location, count, value, GL_FLOAT); } void GLAPIENTRY _mesa_Uniform2fvARB(GLint location, GLsizei count, const GLfloat * value) { GET_CURRENT_CONTEXT(ctx); - _mesa_uniform(ctx, location, count, value, GL_FLOAT_VEC2); + _mesa_uniform(ctx, ctx->Shader.CurrentProgram, location, count, value, GL_FLOAT_VEC2); } void GLAPIENTRY _mesa_Uniform3fvARB(GLint location, GLsizei count, const GLfloat * value) { GET_CURRENT_CONTEXT(ctx); - _mesa_uniform(ctx, location, count, value, GL_FLOAT_VEC3); + _mesa_uniform(ctx, ctx->Shader.CurrentProgram, location, count, value, GL_FLOAT_VEC3); } void GLAPIENTRY _mesa_Uniform4fvARB(GLint location, GLsizei count, const GLfloat * value) { GET_CURRENT_CONTEXT(ctx); - _mesa_uniform(ctx, location, count, value, GL_FLOAT_VEC4); + _mesa_uniform(ctx, ctx->Shader.CurrentProgram, location, count, value, GL_FLOAT_VEC4); } void GLAPIENTRY _mesa_Uniform1ivARB(GLint location, GLsizei count, const GLint * value) { GET_CURRENT_CONTEXT(ctx); - _mesa_uniform(ctx, location, count, value, GL_INT); + _mesa_uniform(ctx, ctx->Shader.CurrentProgram, location, count, value, GL_INT); } void GLAPIENTRY _mesa_Uniform2ivARB(GLint location, GLsizei count, const GLint * value) { GET_CURRENT_CONTEXT(ctx); - _mesa_uniform(ctx, location, count, value, GL_INT_VEC2); + _mesa_uniform(ctx, ctx->Shader.CurrentProgram, location, count, value, GL_INT_VEC2); } void GLAPIENTRY _mesa_Uniform3ivARB(GLint location, GLsizei count, const GLint * value) { GET_CURRENT_CONTEXT(ctx); - _mesa_uniform(ctx, location, count, value, GL_INT_VEC3); + _mesa_uniform(ctx, ctx->Shader.CurrentProgram, location, count, value, GL_INT_VEC3); } void GLAPIENTRY _mesa_Uniform4ivARB(GLint location, GLsizei count, const GLint * value) { GET_CURRENT_CONTEXT(ctx); - _mesa_uniform(ctx, location, count, value, GL_INT_VEC4); + _mesa_uniform(ctx, ctx->Shader.CurrentProgram, location, count, value, GL_INT_VEC4); } @@ -1138,7 +1133,7 @@ void GLAPIENTRY _mesa_Uniform1ui(GLint location, GLuint v0) { GET_CURRENT_CONTEXT(ctx); - _mesa_uniform(ctx, location, 1, &v0, GL_UNSIGNED_INT); + _mesa_uniform(ctx, ctx->Shader.CurrentProgram, location, 1, &v0, GL_UNSIGNED_INT); } void GLAPIENTRY @@ -1148,7 +1143,7 @@ _mesa_Uniform2ui(GLint location, GLuint v0, GLuint v1) GLuint v[2]; v[0] = v0; v[1] = v1; - _mesa_uniform(ctx, location, 1, v, GL_UNSIGNED_INT_VEC2); + _mesa_uniform(ctx, ctx->Shader.CurrentProgram, location, 1, v, GL_UNSIGNED_INT_VEC2); } void GLAPIENTRY @@ -1159,7 +1154,7 @@ _mesa_Uniform3ui(GLint location, GLuint v0, GLuint v1, GLuint v2) v[0] = v0; v[1] = v1; v[2] = v2; - _mesa_uniform(ctx, location, 1, v, GL_UNSIGNED_INT_VEC3); + _mesa_uniform(ctx, ctx->Shader.CurrentProgram, location, 1, v, GL_UNSIGNED_INT_VEC3); } void GLAPIENTRY @@ -1171,35 +1166,35 @@ _mesa_Uniform4ui(GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3) v[1] = v1; v[2] = v2; v[3] = v3; - _mesa_uniform(ctx, location, 1, v, GL_UNSIGNED_INT_VEC4); + _mesa_uniform(ctx, ctx->Shader.CurrentProgram, location, 1, v, GL_UNSIGNED_INT_VEC4); } void GLAPIENTRY _mesa_Uniform1uiv(GLint location, GLsizei count, const GLuint *value) { GET_CURRENT_CONTEXT(ctx); - _mesa_uniform(ctx, location, count, value, GL_UNSIGNED_INT); + _mesa_uniform(ctx, ctx->Shader.CurrentProgram, location, count, value, GL_UNSIGNED_INT); } void GLAPIENTRY _mesa_Uniform2uiv(GLint location, GLsizei count, const GLuint *value) { GET_CURRENT_CONTEXT(ctx); - _mesa_uniform(ctx, location, count, value, GL_UNSIGNED_INT_VEC2); + _mesa_uniform(ctx, ctx->Shader.CurrentProgram, location, count, value, GL_UNSIGNED_INT_VEC2); } void GLAPIENTRY _mesa_Uniform3uiv(GLint location, GLsizei count, const GLuint *value) { GET_CURRENT_CONTEXT(ctx); - _mesa_uniform(ctx, location, count, value, GL_UNSIGNED_INT_VEC3); + _mesa_uniform(ctx, ctx->Shader.CurrentProgram, location, count, value, GL_UNSIGNED_INT_VEC3); } void GLAPIENTRY _mesa_Uniform4uiv(GLint location, GLsizei count, const GLuint *value) { GET_CURRENT_CONTEXT(ctx); - _mesa_uniform(ctx, location, count, value, GL_UNSIGNED_INT_VEC4); + _mesa_uniform(ctx, ctx->Shader.CurrentProgram, location, count, value, GL_UNSIGNED_INT_VEC4); } @@ -1209,7 +1204,8 @@ _mesa_UniformMatrix2fvARB(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) { GET_CURRENT_CONTEXT(ctx); - _mesa_uniform_matrix(ctx, 2, 2, location, count, transpose, value); + _mesa_uniform_matrix(ctx, ctx->Shader.CurrentProgram, + 2, 2, location, count, transpose, value); } void GLAPIENTRY @@ -1217,7 +1213,8 @@ _mesa_UniformMatrix3fvARB(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) { GET_CURRENT_CONTEXT(ctx); - _mesa_uniform_matrix(ctx, 3, 3, location, count, transpose, value); + _mesa_uniform_matrix(ctx, ctx->Shader.CurrentProgram, + 3, 3, location, count, transpose, value); } void GLAPIENTRY @@ -1225,7 +1222,8 @@ _mesa_UniformMatrix4fvARB(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) { GET_CURRENT_CONTEXT(ctx); - _mesa_uniform_matrix(ctx, 4, 4, location, count, transpose, value); + _mesa_uniform_matrix(ctx, ctx->Shader.CurrentProgram, + 4, 4, location, count, transpose, value); } @@ -1237,7 +1235,8 @@ _mesa_UniformMatrix2x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value) { GET_CURRENT_CONTEXT(ctx); - _mesa_uniform_matrix(ctx, 2, 3, location, count, transpose, value); + _mesa_uniform_matrix(ctx, ctx->Shader.CurrentProgram, + 2, 3, location, count, transpose, value); } void GLAPIENTRY @@ -1245,7 +1244,8 @@ _mesa_UniformMatrix3x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value) { GET_CURRENT_CONTEXT(ctx); - _mesa_uniform_matrix(ctx, 3, 2, location, count, transpose, value); + _mesa_uniform_matrix(ctx, ctx->Shader.CurrentProgram, + 3, 2, location, count, transpose, value); } void GLAPIENTRY @@ -1253,7 +1253,8 @@ _mesa_UniformMatrix2x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value) { GET_CURRENT_CONTEXT(ctx); - _mesa_uniform_matrix(ctx, 2, 4, location, count, transpose, value); + _mesa_uniform_matrix(ctx, ctx->Shader.CurrentProgram, + 2, 4, location, count, transpose, value); } void GLAPIENTRY @@ -1261,7 +1262,8 @@ _mesa_UniformMatrix4x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value) { GET_CURRENT_CONTEXT(ctx); - _mesa_uniform_matrix(ctx, 4, 2, location, count, transpose, value); + _mesa_uniform_matrix(ctx, ctx->Shader.CurrentProgram, + 4, 2, location, count, transpose, value); } void GLAPIENTRY @@ -1269,7 +1271,8 @@ _mesa_UniformMatrix3x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value) { GET_CURRENT_CONTEXT(ctx); - _mesa_uniform_matrix(ctx, 3, 4, location, count, transpose, value); + _mesa_uniform_matrix(ctx, ctx->Shader.CurrentProgram, + 3, 4, location, count, transpose, value); } void GLAPIENTRY @@ -1277,7 +1280,8 @@ _mesa_UniformMatrix4x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value) { GET_CURRENT_CONTEXT(ctx); - _mesa_uniform_matrix(ctx, 4, 3, location, count, transpose, value); + _mesa_uniform_matrix(ctx, ctx->Shader.CurrentProgram, + 4, 3, location, count, transpose, value); } @@ -1300,8 +1304,16 @@ _mesa_GetUniformivARB(GLhandleARB program, GLint location, GLint *params) GLint GLAPIENTRY _mesa_GetUniformLocationARB(GLhandleARB programObj, const GLcharARB *name) { + struct gl_shader_program *shProg; + GET_CURRENT_CONTEXT(ctx); - return _mesa_get_uniform_location(ctx, programObj, name); + + shProg = _mesa_lookup_shader_program_err(ctx, programObj, + "glGetUniformLocation"); + if (!shProg) + return -1; + + return _mesa_get_uniform_location(ctx, shProg, name); } diff --git a/src/mesa/main/uniforms.h b/src/mesa/main/uniforms.h index ef98fe16bb..f823c61444 100644 --- a/src/mesa/main/uniforms.h +++ b/src/mesa/main/uniforms.h @@ -150,7 +150,20 @@ _mesa_GetUniformivARB(GLhandleARB, GLint, GLint *); extern GLint GLAPIENTRY _mesa_GetUniformLocationARB(GLhandleARB, const GLcharARB *); - +GLint +_mesa_get_uniform_location(GLcontext *ctx, struct gl_shader_program *shProg, + const GLchar *name); + +void +_mesa_uniform(GLcontext *ctx, struct gl_shader_program *shader_program, + GLint location, GLsizei count, + const GLvoid *values, GLenum type); + +void +_mesa_uniform_matrix(GLcontext *ctx, struct gl_shader_program *shProg, + GLint cols, GLint rows, + GLint location, GLsizei count, + GLboolean transpose, const GLfloat *values); extern void _mesa_update_shader_textures_used(struct gl_program *prog); diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp index ea2560af3e..da69d26a94 100644 --- a/src/mesa/program/ir_to_mesa.cpp +++ b/src/mesa/program/ir_to_mesa.cpp @@ -261,12 +261,10 @@ public: int mul_operand); int add_uniform(const char *name, - const glsl_type *type, - ir_constant *constant); + const glsl_type *type); void add_aggregate_uniform(ir_instruction *ir, const char *name, const struct glsl_type *type, - ir_constant *constant, struct ir_to_mesa_dst_reg temp); struct hash_table *sampler_map; @@ -1307,8 +1305,7 @@ get_builtin_matrix_ref(void *mem_ctx, struct gl_program *prog, ir_variable *var, int ir_to_mesa_visitor::add_uniform(const char *name, - const glsl_type *type, - ir_constant *constant) + const glsl_type *type) { int len; @@ -1319,65 +1316,11 @@ ir_to_mesa_visitor::add_uniform(const char *name, len = type_size(type) * 4; } - float *values = NULL; - if (constant && type->is_array()) { - values = (float *)malloc(type->length * 4 * sizeof(float)); - - assert(type->fields.array->is_scalar() || - type->fields.array->is_vector() || - !"FINISHME: uniform array initializers for non-vector"); - - for (unsigned int i = 0; i < type->length; i++) { - ir_constant *element = constant->array_elements[i]; - unsigned int c; - - for (c = 0; c < type->fields.array->vector_elements; c++) { - switch (type->fields.array->base_type) { - case GLSL_TYPE_FLOAT: - values[4 * i + c] = element->value.f[c]; - break; - case GLSL_TYPE_INT: - values[4 * i + c] = element->value.i[c]; - break; - case GLSL_TYPE_UINT: - values[4 * i + c] = element->value.u[c]; - break; - case GLSL_TYPE_BOOL: - values[4 * i + c] = element->value.b[c]; - break; - default: - assert(!"not reached"); - } - } - } - } else if (constant) { - values = (float *)malloc(16 * sizeof(float)); - for (unsigned int i = 0; i < type->components(); i++) { - switch (type->base_type) { - case GLSL_TYPE_FLOAT: - values[i] = constant->value.f[i]; - break; - case GLSL_TYPE_INT: - values[i] = constant->value.i[i]; - break; - case GLSL_TYPE_UINT: - values[i] = constant->value.u[i]; - break; - case GLSL_TYPE_BOOL: - values[i] = constant->value.b[i]; - break; - default: - assert(!"not reached"); - } - } - } - int loc = _mesa_add_uniform(this->prog->Parameters, name, len, type->gl_type, - values); - free(values); + NULL); return loc; } @@ -1389,17 +1332,12 @@ void ir_to_mesa_visitor::add_aggregate_uniform(ir_instruction *ir, const char *name, const struct glsl_type *type, - ir_constant *constant, struct ir_to_mesa_dst_reg temp) { int loc; if (type->is_record()) { void *mem_ctx = talloc_new(NULL); - ir_constant *field_constant = NULL; - - if (constant) - field_constant = (ir_constant *)constant->components.get_head(); for (unsigned int i = 0; i < type->length; i++) { const glsl_type *field_type = type->fields.structure[i].type; @@ -1407,11 +1345,8 @@ ir_to_mesa_visitor::add_aggregate_uniform(ir_instruction *ir, add_aggregate_uniform(ir, talloc_asprintf(mem_ctx, "%s.%s", name, type->fields.structure[i].name), - field_type, field_constant, temp); + field_type, temp); temp.index += type_size(field_type); - - if (constant) - field_constant = (ir_constant *)field_constant->next; } talloc_free(mem_ctx); @@ -1421,7 +1356,7 @@ ir_to_mesa_visitor::add_aggregate_uniform(ir_instruction *ir, assert(type->is_vector() || type->is_scalar() || !"FINISHME: other types"); - loc = add_uniform(name, type, constant); + loc = add_uniform(name, type); ir_to_mesa_src_reg uniform(PROGRAM_UNIFORM, loc, type); @@ -1485,14 +1420,12 @@ ir_to_mesa_visitor::visit(ir_dereference_variable *ir) this->variables.push_tail(entry); add_aggregate_uniform(ir->var, ir->var->name, ir->var->type, - ir->var->constant_value, ir_to_mesa_dst_reg_from_src(temp)); break; } loc = add_uniform(ir->var->name, - ir->var->type, - ir->var->constant_value); + ir->var->type); /* Always mark the uniform used at this point. If it isn't * used, dead code elimination should have nuked the decl already. @@ -2433,6 +2366,105 @@ link_uniforms_to_shared_uniform_list(struct gl_uniform_list *uniforms, } } +static void +set_uniform_initializer(GLcontext *ctx, void *mem_ctx, + struct gl_shader_program *shader_program, + const char *name, const glsl_type *type, + ir_constant *val) +{ + if (type->is_record()) { + ir_constant *field_constant; + + field_constant = (ir_constant *)val->components.get_head(); + + for (unsigned int i = 0; i < type->length; i++) { + const glsl_type *field_type = type->fields.structure[i].type; + const char *field_name = talloc_asprintf(mem_ctx, "%s.%s", name, + type->fields.structure[i].name); + set_uniform_initializer(ctx, mem_ctx, shader_program, field_name, + field_type, field_constant); + field_constant = (ir_constant *)field_constant->next; + } + return; + } + + int loc = _mesa_get_uniform_location(ctx, shader_program, name); + + if (loc == -1) { + shader_program->InfoLog = + talloc_asprintf_append(shader_program->InfoLog, + "Couldn't find uniform for " + "initializer %s\n", name); + shader_program->LinkStatus = false; + abort(); + } + + for (unsigned int i = 0; i < (type->is_array() ? type->length : 1); i++) { + ir_constant *element; + const glsl_type *element_type; + if (type->is_array()) { + element = val->array_elements[i]; + element_type = type->fields.array; + } else { + element = val; + element_type = type; + } + + void *values; + + if (element_type->base_type == GLSL_TYPE_BOOL) { + int *conv = talloc_array(mem_ctx, int, element_type->components()); + for (unsigned int j = 0; j < element_type->components(); j++) { + conv[j] = element->value.b[j]; + } + values = (void *)conv; + element_type = glsl_type::get_instance(GLSL_TYPE_INT, + element_type->vector_elements, + 1); + } else { + values = &element->value; + } + + if (element_type->is_matrix()) { + _mesa_uniform_matrix(ctx, shader_program, + element_type->matrix_columns, + element_type->vector_elements, + loc, 1, GL_FALSE, (GLfloat *)values); + loc += element_type->matrix_columns; + } else { + _mesa_uniform(ctx, shader_program, loc, element_type->matrix_columns, + values, element_type->gl_type); + loc += type_size(element_type); + } + } +} + +static void +set_uniform_initializers(GLcontext *ctx, + struct gl_shader_program *shader_program) +{ + void *mem_ctx = NULL; + + for (unsigned int i = 0; i < shader_program->_NumLinkedShaders; i++) { + struct gl_shader *shader = shader_program->_LinkedShaders[i]; + foreach_iter(exec_list_iterator, iter, *shader->ir) { + ir_instruction *ir = (ir_instruction *)iter.get(); + ir_variable *var = ir->as_variable(); + + if (!var || var->mode != ir_var_uniform || !var->constant_value) + continue; + + if (!mem_ctx) + mem_ctx = talloc_new(NULL); + + set_uniform_initializer(ctx, mem_ctx, shader_program, var->name, + var->type, var->constant_value); + } + } + + talloc_free(mem_ctx); +} + struct gl_program * get_mesa_program(GLcontext *ctx, struct gl_shader_program *shader_program, struct gl_shader *shader) @@ -2780,6 +2812,8 @@ _mesa_glsl_link_shader(GLcontext *ctx, struct gl_shader_program *prog) } } + set_uniform_initializers(ctx, prog); + if (ctx->Shader.Flags & GLSL_DUMP) { if (!prog->LinkStatus) { printf("GLSL shader program %d failed to link\n", prog->Name); -- cgit v1.2.3 From 57e66ed9b1f6128dc8225477dcb2faa54a4960ac Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Tue, 24 Aug 2010 17:40:50 -0700 Subject: nvfx: Initialize variables on error path. --- src/gallium/drivers/nvfx/nv04_2d.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src') diff --git a/src/gallium/drivers/nvfx/nv04_2d.c b/src/gallium/drivers/nvfx/nv04_2d.c index 3761002bcb..c05312219b 100644 --- a/src/gallium/drivers/nvfx/nv04_2d.c +++ b/src/gallium/drivers/nvfx/nv04_2d.c @@ -1126,7 +1126,11 @@ nv04_region_fill_gdirect(struct nv04_2d_context *ctx, struct nv04_region* dst, i cs2d_format = NV04_CONTEXT_SURFACES_2D_FORMAT_Y32; } else + { assert(0); + gdirect_format = 0; + cs2d_format = 0; + } MARK_RING (chan, 15, 4); BEGIN_RING(chan, surf2d, NV04_CONTEXT_SURFACES_2D_DMA_IMAGE_SOURCE, 2); -- cgit v1.2.3 From 5755d1d6a7ff68c7d690d67c4cd64ef8e01ec2ed Mon Sep 17 00:00:00 2001 From: Marek Olšák Date: Sun, 22 Aug 2010 03:15:00 +0200 Subject: ir_to_mesa: set IndirectRegisterFiles This fixes relative addressing of temporaries (and maybe others) in all gallium drivers. Acked on irc by Eric Anholt. --- src/mesa/program/ir_to_mesa.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src') diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp index da69d26a94..fc145b475e 100644 --- a/src/mesa/program/ir_to_mesa.cpp +++ b/src/mesa/program/ir_to_mesa.cpp @@ -2569,6 +2569,14 @@ get_mesa_program(GLcontext *ctx, struct gl_shader_program *shader_program, mesa_inst->TexShadow = inst->tex_shadow; mesa_instruction_annotation[i] = inst->ir; + /* Set IndirectRegisterFiles. */ + if (mesa_inst->DstReg.RelAddr) + prog->IndirectRegisterFiles |= 1 << mesa_inst->DstReg.File; + + for (unsigned src = 0; src < 3; src++) + if (mesa_inst->SrcReg[src].RelAddr) + prog->IndirectRegisterFiles |= 1 << mesa_inst->SrcReg[src].File; + if (ctx->Shader.EmitNoIfs && mesa_inst->Opcode == OPCODE_IF) { shader_program->InfoLog = talloc_asprintf_append(shader_program->InfoLog, -- cgit v1.2.3 From cb925970eeade17016f59497d2123e4e8a447164 Mon Sep 17 00:00:00 2001 From: Marek Olšák Date: Tue, 24 Aug 2010 17:16:44 +0200 Subject: r300g: reset the index bias to 0 at the end of CS --- src/gallium/drivers/r300/r300_context.h | 4 +++- src/gallium/drivers/r300/r300_emit.c | 2 ++ src/gallium/drivers/r300/r300_flush.c | 3 +++ src/gallium/drivers/r300/r300_render.c | 8 ++++---- 4 files changed, 12 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_context.h b/src/gallium/drivers/r300/r300_context.h index 030bb2314f..2b665ba2b5 100644 --- a/src/gallium/drivers/r300/r300_context.h +++ b/src/gallium/drivers/r300/r300_context.h @@ -650,8 +650,10 @@ void r300_translate_index_buffer(struct r300_context *r300, /* r300_render_stencilref.c */ void r300_plug_in_stencil_ref_fallback(struct r300_context *r300); -/* r300 render */ +/* r300_render.c */ void r300_draw_flush_vbuf(struct r300_context *r300); +boolean r500_index_bias_supported(struct r300_context *r300); +void r500_emit_index_bias(struct r300_context *r300, int index_bias); /* r300_state.c */ enum r300_fb_state_change { diff --git a/src/gallium/drivers/r300/r300_emit.c b/src/gallium/drivers/r300/r300_emit.c index d0fd45349e..87d995010e 100644 --- a/src/gallium/drivers/r300/r300_emit.c +++ b/src/gallium/drivers/r300/r300_emit.c @@ -1219,6 +1219,8 @@ unsigned r300_get_num_cs_end_dwords(struct r300_context *r300) /* Emitted in flush. */ dwords += 26; /* emit_query_end */ dwords += r300->hyperz_state.size + 2; /* emit_hyperz_end + zcache flush */ + if (r500_index_bias_supported(r300)) + dwords += 2; return dwords; } diff --git a/src/gallium/drivers/r300/r300_flush.c b/src/gallium/drivers/r300/r300_flush.c index f00707b066..2b5d2e42ba 100644 --- a/src/gallium/drivers/r300/r300_flush.c +++ b/src/gallium/drivers/r300/r300_flush.c @@ -45,9 +45,12 @@ static void r300_flush(struct pipe_context* pipe, if (r300->draw) r300_draw_flush_vbuf(r300); + if (r300->dirty_hw) { r300_emit_hyperz_end(r300); r300_emit_query_end(r300); + if (r500_index_bias_supported(r300)) + r500_emit_index_bias(r300, 0); r300->flush_counter++; r300->rws->cs_flush(r300->cs); diff --git a/src/gallium/drivers/r300/r300_render.c b/src/gallium/drivers/r300/r300_render.c index fc3844f788..e08335a105 100644 --- a/src/gallium/drivers/r300/r300_render.c +++ b/src/gallium/drivers/r300/r300_render.c @@ -118,13 +118,13 @@ static uint32_t r300_provoking_vertex_fixes(struct r300_context *r300, return color_control; } -static boolean index_bias_supported(struct r300_context *r300) +boolean r500_index_bias_supported(struct r300_context *r300) { return r300->screen->caps.is_r500 && r300->rws->get_value(r300->rws, R300_VID_DRM_2_3_0); } -static void r500_emit_index_bias(struct r300_context *r300, int index_bias) +void r500_emit_index_bias(struct r300_context *r300, int index_bias) { CS_LOCALS(r300); @@ -199,7 +199,7 @@ static void r300_prepare_for_rendering(struct r300_context *r300, boolean emit_aos = flags & PREP_EMIT_AOS; boolean emit_aos_swtcl = flags & PREP_EMIT_AOS_SWTCL; boolean indexed = flags & PREP_INDEXED; - boolean hw_index_bias = index_bias_supported(r300); + boolean hw_index_bias = r500_index_bias_supported(r300); /* Add dirty state, index offset, and AOS. */ if (first_draw) { @@ -506,7 +506,7 @@ static void r300_draw_range_elements(struct pipe_context* pipe, translate = TRUE; } - if (indexBias && !index_bias_supported(r300)) { + if (indexBias && !r500_index_bias_supported(r300)) { r300_split_index_bias(r300, indexBias, &buffer_offset, &index_offset); } -- cgit v1.2.3 From 3aee8c3b1d10f8e8978c1b902aff4347684d4e79 Mon Sep 17 00:00:00 2001 From: Marek Olšák Date: Sun, 22 Aug 2010 03:20:19 +0200 Subject: r300/compiler: disable register allocation for indexable temporaries in VS If there is relative addressing of temporaries, we cannot change register indices, so skip register allocation entirely. To utilize register allocation at least partially, we need separate indexable and non-indexable register files in both TGSI and Mesa IR. --- src/mesa/drivers/dri/r300/compiler/r3xx_vertprog.c | 30 ++++++++++++++++++---- 1 file changed, 25 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r300/compiler/r3xx_vertprog.c b/src/mesa/drivers/dri/r300/compiler/r3xx_vertprog.c index 666c9c2a7a..56c5fe6d96 100644 --- a/src/mesa/drivers/dri/r300/compiler/r3xx_vertprog.c +++ b/src/mesa/drivers/dri/r300/compiler/r3xx_vertprog.c @@ -624,10 +624,9 @@ static void allocate_temporary_registers(struct r300_vertex_program_compiler * c struct temporary_allocation * ta; unsigned int i, j; - compiler->code->num_temporaries = 0; memset(hwtemps, 0, sizeof(hwtemps)); - /* Pass 1: Count original temporaries and allocate structures */ + /* Pass 1: Count original temporaries. */ for(inst = compiler->Base.Program.Instructions.Next; inst != &compiler->Base.Program.Instructions; inst = inst->Next) { const struct rc_opcode_info * opcode = rc_get_opcode_info(inst->U.I.Opcode); @@ -645,12 +644,30 @@ static void allocate_temporary_registers(struct r300_vertex_program_compiler * c } } } + compiler->code->num_temporaries = num_orig_temps; + + /* Pass 2: If there is relative addressing of temporaries, we cannot change register indices. Give up. */ + for (inst = compiler->Base.Program.Instructions.Next; inst != &compiler->Base.Program.Instructions; inst = inst->Next) { + const struct rc_opcode_info *opcode = rc_get_opcode_info(inst->U.I.Opcode); + + if (opcode->HasDstReg) + if (inst->U.I.DstReg.RelAddr) + return; + for (i = 0; i < opcode->NumSrcRegs; ++i) { + if (inst->U.I.SrcReg[i].File == RC_FILE_TEMPORARY && + inst->U.I.SrcReg[i].RelAddr) { + return; + } + } + } + + compiler->code->num_temporaries = 0; ta = (struct temporary_allocation*)memory_pool_malloc(&compiler->Base.Pool, sizeof(struct temporary_allocation) * num_orig_temps); memset(ta, 0, sizeof(struct temporary_allocation) * num_orig_temps); - /* Pass 2: Determine original temporary lifetimes */ + /* Pass 3: Determine original temporary lifetimes */ for(inst = compiler->Base.Program.Instructions.Next; inst != &compiler->Base.Program.Instructions; inst = inst->Next) { const struct rc_opcode_info * opcode = rc_get_opcode_info(inst->U.I.Opcode); /* Instructions inside of loops need to use the ENDLOOP @@ -685,7 +702,7 @@ static void allocate_temporary_registers(struct r300_vertex_program_compiler * c } } - /* Pass 3: Register allocation */ + /* Pass 4: Register allocation */ for(inst = compiler->Base.Program.Instructions.Next; inst != &compiler->Base.Program.Instructions; inst = inst->Next) { const struct rc_opcode_info * opcode = rc_get_opcode_info(inst->U.I.Opcode); @@ -937,9 +954,12 @@ void r3xx_compile_vertex_program(struct r300_vertex_program_compiler* compiler) rc_dataflow_swizzles(&compiler->Base); + debug_program_log(compiler, "after dataflow"); + allocate_temporary_registers(compiler); - debug_program_log(compiler, "after dataflow"); + debug_program_log(compiler, "after register allocation"); + translate_vertex_program(compiler); -- cgit v1.2.3 From 6c88f84bddf4b61f8306c5e0eb48642cb636bd58 Mon Sep 17 00:00:00 2001 From: Marek Olšák Date: Sun, 22 Aug 2010 03:29:54 +0200 Subject: r300/compiler: handle indexable temporaries correctly in deadcode elimination --- .../dri/r300/compiler/radeon_dataflow_deadcode.c | 31 +++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_dataflow_deadcode.c b/src/mesa/drivers/dri/r300/compiler/radeon_dataflow_deadcode.c index faf531b412..acdb371de9 100644 --- a/src/mesa/drivers/dri/r300/compiler/radeon_dataflow_deadcode.c +++ b/src/mesa/drivers/dri/r300/compiler/radeon_dataflow_deadcode.c @@ -157,8 +157,12 @@ static void update_instruction(struct deadcode_state * s, struct rc_instruction unsigned char * pused = get_used_ptr(s, inst->U.I.DstReg.File, inst->U.I.DstReg.Index); if (pused) { usedmask = *pused & inst->U.I.DstReg.WriteMask; - *pused &= ~usedmask; + if (!inst->U.I.DstReg.RelAddr) + *pused &= ~usedmask; } + + if (inst->U.I.DstReg.RelAddr) + mark_used(s, RC_FILE_ADDRESS, 0, RC_MASK_X); } insts->WriteMask |= usedmask; @@ -213,6 +217,7 @@ void rc_dataflow_deadcode(struct radeon_compiler * c, rc_dataflow_mark_outputs_f { struct deadcode_state s; unsigned int nr_instructions; + unsigned has_temp_reladdr_src = 0; memset(&s, 0, sizeof(s)); s.C = c; @@ -300,6 +305,30 @@ void rc_dataflow_deadcode(struct radeon_compiler * c, rc_dataflow_mark_outputs_f rc_error(c, "%s: Unhandled control flow instruction %s\n", __FUNCTION__, opcode->Name); } } + + if (!has_temp_reladdr_src) { + for (unsigned i = 0; i < opcode->NumSrcRegs; i++) { + if (inst->U.I.SrcReg[i].File == RC_FILE_TEMPORARY && + inst->U.I.SrcReg[i].RelAddr) { + /* If there is a register read from a temporary file with relative addressing, + * mark all preceding written registers as used. */ + for (struct rc_instruction *ptr = inst->Prev; + ptr != &c->Program.Instructions; + ptr = ptr->Prev) { + if (opcode->HasDstReg && + ptr->U.I.DstReg.File == RC_FILE_TEMPORARY && + ptr->U.I.DstReg.WriteMask) { + mark_used(&s, + ptr->U.I.DstReg.File, + ptr->U.I.DstReg.Index, + ptr->U.I.DstReg.WriteMask); + } + } + + has_temp_reladdr_src = 1; + } + } + } } update_instruction(&s, inst); -- cgit v1.2.3 From 1802007ee9d63f71d1f372a80b169b6291daa378 Mon Sep 17 00:00:00 2001 From: Marek Olšák Date: Sun, 22 Aug 2010 20:45:50 +0200 Subject: r300/compiler: fail to compile if we hit hw limits or an unimplemented feature i.e. relative addressing (mainly FS), saturate modifiers, exceeding the maximum number of constants. --- src/mesa/drivers/dri/r300/compiler/r3xx_fragprog.c | 10 ++++++++ src/mesa/drivers/dri/r300/compiler/r3xx_vertprog.c | 22 ++++++++++++++++ .../dri/r300/compiler/radeon_pair_translate.c | 30 ++++++++++++++++++++++ 3 files changed, 62 insertions(+) (limited to 'src') diff --git a/src/mesa/drivers/dri/r300/compiler/r3xx_fragprog.c b/src/mesa/drivers/dri/r300/compiler/r3xx_fragprog.c index d2fa816894..59f4efc888 100644 --- a/src/mesa/drivers/dri/r300/compiler/r3xx_fragprog.c +++ b/src/mesa/drivers/dri/r300/compiler/r3xx_fragprog.c @@ -224,4 +224,14 @@ void r3xx_compile_fragment_program(struct r300_fragment_program_compiler* c) r300FragmentProgramDump(c->code); } } + + /* Check the number of constants. */ + if (!c->Base.Error) { + unsigned max = c->Base.is_r500 ? R500_PFS_NUM_CONST_REGS : R300_PFS_NUM_CONST_REGS; + + if (c->Base.Program.Constants.Count > max) { + rc_error(&c->Base, "Too many constants. Max: %i, Got: %i\n", + max, c->Base.Program.Constants.Count); + } + } } diff --git a/src/mesa/drivers/dri/r300/compiler/r3xx_vertprog.c b/src/mesa/drivers/dri/r300/compiler/r3xx_vertprog.c index 56c5fe6d96..e54f1d657f 100644 --- a/src/mesa/drivers/dri/r300/compiler/r3xx_vertprog.c +++ b/src/mesa/drivers/dri/r300/compiler/r3xx_vertprog.c @@ -484,6 +484,21 @@ static void translate_vertex_program(struct r300_vertex_program_compiler * compi if (!valid_dst(compiler->code, &vpi->DstReg)) continue; + if (rc_get_opcode_info(vpi->Opcode)->HasDstReg) { + /* Relative addressing of destination operands is not supported yet. */ + if (vpi->DstReg.RelAddr) { + rc_error(&compiler->Base, "Vertex program does not support relative " + "addressing of destination operands (yet).\n"); + return; + } + + /* Neither is Saturate. */ + if (vpi->SaturateMode != RC_SATURATE_NONE) { + rc_error(&compiler->Base, "Vertex program does not support the Saturate " + "modifier (yet).\n"); + } + } + if (compiler->code->length >= R500_VS_MAX_ALU_DWORDS || (compiler->code->length >= R300_VS_MAX_ALU_DWORDS && !compiler->Base.is_r500)) { rc_error(&compiler->Base, "Vertex program has too many instructions\n"); @@ -972,4 +987,11 @@ void r3xx_compile_vertex_program(struct r300_vertex_program_compiler* compiler) fprintf(stderr, "Final vertex program code:\n"); r300_vertex_program_dump(compiler); } + + /* Check the number of constants. */ + if (!compiler->Base.Error && + compiler->Base.Program.Constants.Count > 256) { + rc_error(&compiler->Base, "Too many constants. Max: 256, Got: %i\n", + compiler->Base.Program.Constants.Count); + } } diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_pair_translate.c b/src/mesa/drivers/dri/r300/compiler/radeon_pair_translate.c index 407a0a55ee..8327e9aced 100644 --- a/src/mesa/drivers/dri/r300/compiler/radeon_pair_translate.c +++ b/src/mesa/drivers/dri/r300/compiler/radeon_pair_translate.c @@ -230,6 +230,34 @@ static void set_pair_instruction(struct r300_fragment_program_compiler *c, } +static void check_opcode_support(struct r300_fragment_program_compiler *c, + struct rc_sub_instruction *inst) +{ + const struct rc_opcode_info * opcode = rc_get_opcode_info(inst->Opcode); + + if (opcode->HasDstReg) { + if (inst->DstReg.RelAddr) { + rc_error(&c->Base, "Fragment program does not support relative addressing " + "of destination operands.\n"); + return; + } + + if (inst->SaturateMode == RC_SATURATE_MINUS_PLUS_ONE) { + rc_error(&c->Base, "Fragment program does not support signed Saturate.\n"); + return; + } + } + + for (unsigned i = 0; i < opcode->NumSrcRegs; i++) { + if (inst->SrcReg[i].RelAddr) { + rc_error(&c->Base, "Fragment program does not support relative addressing " + " of source operands.\n"); + return; + } + } +} + + /** * Translate all ALU instructions into corresponding pair instructions, * performing no other changes. @@ -249,6 +277,8 @@ void rc_pair_translate(struct r300_fragment_program_compiler *c) struct rc_sub_instruction copy = inst->U.I; + check_opcode_support(c, ©); + final_rewrite(©); inst->Type = RC_INSTRUCTION_PAIR; set_pair_instruction(c, &inst->U.P, ©); -- cgit v1.2.3 From 4b9b2a3cdc6a809b2e583a21b888ed59e5c20aec Mon Sep 17 00:00:00 2001 From: Marek Olšák Date: Mon, 23 Aug 2010 01:24:01 +0200 Subject: r300/compiler: terminate vertex shader compilation immediately after an error Also rename "compiler" to "c". --- src/mesa/drivers/dri/r300/compiler/r3xx_vertprog.c | 92 +++++++++++++--------- 1 file changed, 56 insertions(+), 36 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r300/compiler/r3xx_vertprog.c b/src/mesa/drivers/dri/r300/compiler/r3xx_vertprog.c index e54f1d657f..5009ab9eed 100644 --- a/src/mesa/drivers/dri/r300/compiler/r3xx_vertprog.c +++ b/src/mesa/drivers/dri/r300/compiler/r3xx_vertprog.c @@ -900,44 +900,52 @@ static struct rc_swizzle_caps r300_vertprog_swizzle_caps = { }; -void r3xx_compile_vertex_program(struct r300_vertex_program_compiler* compiler) +void r3xx_compile_vertex_program(struct r300_vertex_program_compiler *c) { struct emulate_loop_state loop_state; - compiler->Base.SwizzleCaps = &r300_vertprog_swizzle_caps; + c->Base.SwizzleCaps = &r300_vertprog_swizzle_caps; - addArtificialOutputs(compiler); + addArtificialOutputs(c); - debug_program_log(compiler, "before compilation"); + debug_program_log(c, "before compilation"); - if (compiler->Base.is_r500) - rc_transform_loops(&compiler->Base, &loop_state, R500_VS_MAX_ALU); + if (c->Base.is_r500) + rc_transform_loops(&c->Base, &loop_state, R500_VS_MAX_ALU); else - rc_transform_loops(&compiler->Base, &loop_state, R300_VS_MAX_ALU); + rc_transform_loops(&c->Base, &loop_state, R300_VS_MAX_ALU); + if (c->Base.Error) + return; - debug_program_log(compiler, "after emulate loops"); + debug_program_log(c, "after emulate loops"); - if (!compiler->Base.is_r500) { - rc_emulate_branches(&compiler->Base); - debug_program_log(compiler, "after emulate branches"); + if (!c->Base.is_r500) { + rc_emulate_branches(&c->Base); + if (c->Base.Error) + return; + debug_program_log(c, "after emulate branches"); } - if (compiler->Base.is_r500) { + if (c->Base.is_r500) { struct radeon_program_transformation transformations[] = { { &r300_transform_vertex_alu, 0 }, { &r300_transform_trig_scale_vertex, 0 } }; - radeonLocalTransform(&compiler->Base, 2, transformations); + radeonLocalTransform(&c->Base, 2, transformations); + if (c->Base.Error) + return; - debug_program_log(compiler, "after native rewrite"); + debug_program_log(c, "after native rewrite"); } else { struct radeon_program_transformation transformations[] = { { &r300_transform_vertex_alu, 0 }, { &radeonTransformTrigSimple, 0 } }; - radeonLocalTransform(&compiler->Base, 2, transformations); + radeonLocalTransform(&c->Base, 2, transformations); + if (c->Base.Error) + return; - debug_program_log(compiler, "after native rewrite"); + debug_program_log(c, "after native rewrite"); /* Note: This pass has to be done seperately from ALU rewrite, * because it needs to check every instruction. @@ -945,9 +953,11 @@ void r3xx_compile_vertex_program(struct r300_vertex_program_compiler* compiler) struct radeon_program_transformation transformations2[] = { { &transform_nonnative_modifiers, 0 }, }; - radeonLocalTransform(&compiler->Base, 1, transformations2); + radeonLocalTransform(&c->Base, 1, transformations2); + if (c->Base.Error) + return; - debug_program_log(compiler, "after emulate modifiers"); + debug_program_log(c, "after emulate modifiers"); } { @@ -958,40 +968,50 @@ void r3xx_compile_vertex_program(struct r300_vertex_program_compiler* compiler) struct radeon_program_transformation transformations[] = { { &transform_source_conflicts, 0 }, }; - radeonLocalTransform(&compiler->Base, 1, transformations); + radeonLocalTransform(&c->Base, 1, transformations); + if (c->Base.Error) + return; } - debug_program_log(compiler, "after source conflict resolve"); + debug_program_log(c, "after source conflict resolve"); - rc_dataflow_deadcode(&compiler->Base, &dataflow_outputs_mark_used, compiler); + rc_dataflow_deadcode(&c->Base, &dataflow_outputs_mark_used, c); + if (c->Base.Error) + return; - debug_program_log(compiler, "after deadcode"); + debug_program_log(c, "after deadcode"); - rc_dataflow_swizzles(&compiler->Base); + rc_dataflow_swizzles(&c->Base); + if (c->Base.Error) + return; - debug_program_log(compiler, "after dataflow"); + debug_program_log(c, "after dataflow"); - allocate_temporary_registers(compiler); + allocate_temporary_registers(c); + if (c->Base.Error) + return; - debug_program_log(compiler, "after register allocation"); + debug_program_log(c, "after register allocation"); - translate_vertex_program(compiler); + translate_vertex_program(c); + if (c->Base.Error) + return; - rc_constants_copy(&compiler->code->constants, &compiler->Base.Program.Constants); + rc_constants_copy(&c->code->constants, &c->Base.Program.Constants); - compiler->code->InputsRead = compiler->Base.Program.InputsRead; - compiler->code->OutputsWritten = compiler->Base.Program.OutputsWritten; + c->code->InputsRead = c->Base.Program.InputsRead; + c->code->OutputsWritten = c->Base.Program.OutputsWritten; - if (compiler->Base.Debug) { + if (c->Base.Debug) { fprintf(stderr, "Final vertex program code:\n"); - r300_vertex_program_dump(compiler); + r300_vertex_program_dump(c); } /* Check the number of constants. */ - if (!compiler->Base.Error && - compiler->Base.Program.Constants.Count > 256) { - rc_error(&compiler->Base, "Too many constants. Max: 256, Got: %i\n", - compiler->Base.Program.Constants.Count); + if (!c->Base.Error && + c->Base.Program.Constants.Count > 256) { + rc_error(&c->Base, "Too many constants. Max: 256, Got: %i\n", + c->Base.Program.Constants.Count); } } -- cgit v1.2.3 From 574ba4b5f50bfe661427327cd792a8a200559376 Mon Sep 17 00:00:00 2001 From: Marek Olšák Date: Mon, 23 Aug 2010 05:48:39 +0200 Subject: r300/compiler: implement elimination of unused constants Wine likes to create a *lot* of constants, exceeding the size of the constant file in hw. --- src/mesa/drivers/dri/r300/compiler/Makefile | 1 + src/mesa/drivers/dri/r300/compiler/SConscript | 1 + src/mesa/drivers/dri/r300/compiler/r3xx_fragprog.c | 8 ++ src/mesa/drivers/dri/r300/compiler/r3xx_vertprog.c | 9 ++ src/mesa/drivers/dri/r300/compiler/radeon_code.h | 2 + .../drivers/dri/r300/compiler/radeon_compiler.h | 5 +- .../dri/r300/compiler/radeon_remove_constants.c | 128 +++++++++++++++++++++ .../dri/r300/compiler/radeon_remove_constants.h | 36 ++++++ 8 files changed, 189 insertions(+), 1 deletion(-) create mode 100644 src/mesa/drivers/dri/r300/compiler/radeon_remove_constants.c create mode 100644 src/mesa/drivers/dri/r300/compiler/radeon_remove_constants.h (limited to 'src') diff --git a/src/mesa/drivers/dri/r300/compiler/Makefile b/src/mesa/drivers/dri/r300/compiler/Makefile index 3167d49bca..d0eb170784 100644 --- a/src/mesa/drivers/dri/r300/compiler/Makefile +++ b/src/mesa/drivers/dri/r300/compiler/Makefile @@ -23,6 +23,7 @@ C_SOURCES = \ radeon_dataflow_deadcode.c \ radeon_dataflow_swizzles.c \ radeon_optimize.c \ + radeon_remove_constants.c \ radeon_rename_regs.c \ r3xx_fragprog.c \ r300_fragprog.c \ diff --git a/src/mesa/drivers/dri/r300/compiler/SConscript b/src/mesa/drivers/dri/r300/compiler/SConscript index c6f47a6f8a..9729441f3a 100755 --- a/src/mesa/drivers/dri/r300/compiler/SConscript +++ b/src/mesa/drivers/dri/r300/compiler/SConscript @@ -22,6 +22,7 @@ r300compiler = env.ConvenienceLibrary( 'radeon_pair_schedule.c', 'radeon_pair_regalloc.c', 'radeon_optimize.c', + 'radeon_remove_constants.c' 'radeon_rename_regs.c', 'radeon_emulate_branches.c', 'radeon_emulate_loops.c', diff --git a/src/mesa/drivers/dri/r300/compiler/r3xx_fragprog.c b/src/mesa/drivers/dri/r300/compiler/r3xx_fragprog.c index 59f4efc888..8613ec5109 100644 --- a/src/mesa/drivers/dri/r300/compiler/r3xx_fragprog.c +++ b/src/mesa/drivers/dri/r300/compiler/r3xx_fragprog.c @@ -30,6 +30,7 @@ #include "radeon_program_alu.h" #include "radeon_program_tex.h" #include "radeon_rename_regs.h" +#include "radeon_remove_constants.h" #include "r300_fragprog.h" #include "r300_fragprog_swizzle.h" #include "r500_fragprog.h" @@ -180,6 +181,13 @@ void r3xx_compile_fragment_program(struct r300_fragment_program_compiler* c) debug_program_log(c, "after dataflow passes"); + if (c->Base.remove_unused_constants) { + rc_remove_unused_constants(&c->Base, + &c->code->constants_remap_table); + + debug_program_log(c, "after constants cleanup"); + } + if(!c->Base.is_r500) { /* This pass makes it easier for the scheduler to group TEX * instructions and reduces the chances of creating too diff --git a/src/mesa/drivers/dri/r300/compiler/r3xx_vertprog.c b/src/mesa/drivers/dri/r300/compiler/r3xx_vertprog.c index 5009ab9eed..997c0912d7 100644 --- a/src/mesa/drivers/dri/r300/compiler/r3xx_vertprog.c +++ b/src/mesa/drivers/dri/r300/compiler/r3xx_vertprog.c @@ -31,6 +31,7 @@ #include "radeon_swizzle.h" #include "radeon_emulate_branches.h" #include "radeon_emulate_loops.h" +#include "radeon_remove_constants.h" struct loop { int BgnLoop; @@ -993,6 +994,14 @@ void r3xx_compile_vertex_program(struct r300_vertex_program_compiler *c) debug_program_log(c, "after register allocation"); + if (c->Base.remove_unused_constants) { + rc_remove_unused_constants(&c->Base, + &c->code->constants_remap_table); + if (c->Base.Error) + return; + + debug_program_log(c, "after constants cleanup"); + } translate_vertex_program(c); if (c->Base.Error) diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_code.h b/src/mesa/drivers/dri/r300/compiler/radeon_code.h index 896246d203..f76676fae8 100644 --- a/src/mesa/drivers/dri/r300/compiler/radeon_code.h +++ b/src/mesa/drivers/dri/r300/compiler/radeon_code.h @@ -235,6 +235,7 @@ struct rX00_fragment_program_code { unsigned writes_depth:1; struct rc_constant_list constants; + unsigned *constants_remap_table; }; @@ -266,6 +267,7 @@ struct r300_vertex_program_code { int outputs[VSF_MAX_OUTPUTS]; struct rc_constant_list constants; + unsigned *constants_remap_table; uint32_t InputsRead; uint32_t OutputsWritten; diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_compiler.h b/src/mesa/drivers/dri/r300/compiler/radeon_compiler.h index 7c42eb3ae5..5155b912e1 100644 --- a/src/mesa/drivers/dri/r300/compiler/radeon_compiler.h +++ b/src/mesa/drivers/dri/r300/compiler/radeon_compiler.h @@ -39,9 +39,12 @@ struct radeon_compiler { char * ErrorMsg; /* Hardware specification. */ - unsigned is_r500; + unsigned is_r500:1; unsigned max_temp_regs; + /* Whether to remove unused constants and empty holes in constant space. */ + unsigned remove_unused_constants:1; + /** * Variables used internally, not be touched by callers * of the compiler diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_remove_constants.c b/src/mesa/drivers/dri/r300/compiler/radeon_remove_constants.c new file mode 100644 index 0000000000..be89e9fa5b --- /dev/null +++ b/src/mesa/drivers/dri/r300/compiler/radeon_remove_constants.c @@ -0,0 +1,128 @@ +/* + * Copyright (C) 2010 Marek Olšák + * + * 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 (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 COPYRIGHT OWNER(S) AND/OR ITS 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. + * + */ + +#include "radeon_remove_constants.h" + +void rc_remove_unused_constants(struct radeon_compiler *c, + unsigned **out_remap_table) +{ + unsigned char *const_used; + unsigned *remap_table; + unsigned *inv_remap_table; + unsigned has_rel_addr = 0; + unsigned is_identity = 1; + unsigned are_externals_remapped = 0; + struct rc_constant *constants = c->Program.Constants.Constants; + + if (!c->Program.Constants.Count) { + *out_remap_table = NULL; + return; + } + + const_used = malloc(c->Program.Constants.Count); + memset(const_used, 0, c->Program.Constants.Count); + + /* Pass 1: Mark used constants. */ + for (struct rc_instruction *inst = c->Program.Instructions.Next; + inst != &c->Program.Instructions; inst = inst->Next) { + const struct rc_opcode_info *opcode = rc_get_opcode_info(inst->U.I.Opcode); + + for (unsigned i = 0; i < opcode->NumSrcRegs; i++) { + if (inst->U.I.SrcReg[i].File == RC_FILE_CONSTANT) { + if (inst->U.I.SrcReg[i].RelAddr) { + has_rel_addr = 1; + } else { + const_used[inst->U.I.SrcReg[i].Index] = 1; + } + } + } + } + + /* Pass 2: If there is relative addressing, mark all externals as used. */ + if (has_rel_addr) { + for (unsigned i = 0; i < c->Program.Constants.Count; i++) + if (constants[i].Type == RC_CONSTANT_EXTERNAL) + const_used[i] = 1; + } + + /* Pass 3: Make the remapping table and remap constants. + * This pass removes unused constants simply by overwriting them by other constants. */ + remap_table = malloc(c->Program.Constants.Count * sizeof(unsigned)); + inv_remap_table = malloc(c->Program.Constants.Count * sizeof(unsigned)); + unsigned new_count = 0; + + for (unsigned i = 0; i < c->Program.Constants.Count; i++) { + if (const_used[i]) { + remap_table[new_count] = i; + inv_remap_table[i] = new_count; + + if (i != new_count) { + if (constants[i].Type == RC_CONSTANT_EXTERNAL) + are_externals_remapped = 1; + + constants[new_count] = constants[i]; + is_identity = 0; + } + new_count++; + } + } + + /* is_identity ==> new_count == old_count + * !is_identity ==> new_count < old_count */ + assert( is_identity || new_count < c->Program.Constants.Count); + assert(!(has_rel_addr && are_externals_remapped)); + + /* Pass 4: Redirect reads of all constants to their new locations. */ + if (!is_identity) { + for (struct rc_instruction *inst = c->Program.Instructions.Next; + inst != &c->Program.Instructions; inst = inst->Next) { + const struct rc_opcode_info *opcode = rc_get_opcode_info(inst->U.I.Opcode); + + for (unsigned i = 0; i < opcode->NumSrcRegs; i++) { + if (inst->U.I.SrcReg[i].File == RC_FILE_CONSTANT) { + inst->U.I.SrcReg[i].Index = inv_remap_table[inst->U.I.SrcReg[i].Index]; + } + } + } + + } + + /* Set the new constant count. Note that new_count may be less than + * Count even though the remapping function is identity. In that case, + * the constants have been removed at the end of the array. */ + c->Program.Constants.Count = new_count; + + if (are_externals_remapped) { + *out_remap_table = remap_table; + } else { + *out_remap_table = NULL; + free(remap_table); + } + + free(const_used); + free(inv_remap_table); +} diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_remove_constants.h b/src/mesa/drivers/dri/r300/compiler/radeon_remove_constants.h new file mode 100644 index 0000000000..0d3a26ca1c --- /dev/null +++ b/src/mesa/drivers/dri/r300/compiler/radeon_remove_constants.h @@ -0,0 +1,36 @@ +/* + * Copyright (C) 2010 Marek Olšák + * + * 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 (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 COPYRIGHT OWNER(S) AND/OR ITS 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. + * + */ + +#ifndef RADEON_REMOVE_CONSTANTS_H +#define RADEON_REMOVE_CONSTANTS_H + +#include "radeon_compiler.h" + +void rc_remove_unused_constants(struct radeon_compiler *c, + unsigned **out_remap_table); + +#endif -- cgit v1.2.3 From 2eeaf773fdd58c176f7cdbcd05b75ad3a5ecab4c Mon Sep 17 00:00:00 2001 From: Marek Olšák Date: Mon, 23 Aug 2010 05:58:08 +0200 Subject: r300g: fix indentation --- src/gallium/drivers/r300/r300_fs.c | 10 +++++----- src/gallium/drivers/r300/r300_state.c | 6 +++--- 2 files changed, 8 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_fs.c b/src/gallium/drivers/r300/r300_fs.c index 2a0c30620a..315d5b85f7 100644 --- a/src/gallium/drivers/r300/r300_fs.c +++ b/src/gallium/drivers/r300/r300_fs.c @@ -257,17 +257,17 @@ static void r300_emit_fs_code_to_buffer( shader->cb_code_size = 19 + ((code->inst_end + 1) * 6) + imm_count * 7 + - code->int_constant_count * 2; + code->int_constant_count * 2; NEW_CB(shader->cb_code, shader->cb_code_size); OUT_CB_REG(R500_US_CONFIG, R500_ZERO_TIMES_ANYTHING_EQUALS_ZERO); OUT_CB_REG(R500_US_PIXSIZE, code->max_temp_idx); OUT_CB_REG(R500_US_FC_CTRL, code->us_fc_ctrl); for(i = 0; i < code->int_constant_count; i++){ - OUT_CB_REG(R500_US_FC_INT_CONST_0 + (i * 4), - code->int_constants[i]); - } - OUT_CB_REG(R500_US_CODE_RANGE, + OUT_CB_REG(R500_US_FC_INT_CONST_0 + (i * 4), + code->int_constants[i]); + } + OUT_CB_REG(R500_US_CODE_RANGE, R500_US_CODE_RANGE_ADDR(0) | R500_US_CODE_RANGE_SIZE(code->inst_end)); OUT_CB_REG(R500_US_CODE_OFFSET, 0); OUT_CB_REG(R500_US_CODE_ADDR, diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c index 239edd98e3..dc0d0415cb 100644 --- a/src/gallium/drivers/r300/r300_state.c +++ b/src/gallium/drivers/r300/r300_state.c @@ -1050,11 +1050,11 @@ static void* r300_create_rs_state(struct pipe_context* pipe, stuffing_enable = 0; if (state->sprite_coord_enable) { stuffing_enable = R300_GB_POINT_STUFF_ENABLE; - for (i = 0; i < 8; i++) { - if (state->sprite_coord_enable & (1 << i)) + for (i = 0; i < 8; i++) { + if (state->sprite_coord_enable & (1 << i)) stuffing_enable |= R300_GB_TEX_ST << (R300_GB_TEX0_SOURCE_SHIFT + (i*2)); - } + } point_texcoord_left = 0.0f; point_texcoord_right = 1.0f; -- cgit v1.2.3 From 62eb9eda1d15acc180b4e144cc14427980419d07 Mon Sep 17 00:00:00 2001 From: Marek Olšák Date: Tue, 24 Aug 2010 23:05:09 +0200 Subject: r300g: clean up some mess in set_constant_buffer --- src/gallium/drivers/r300/r300_context.h | 2 -- src/gallium/drivers/r300/r300_state.c | 21 +-------------------- 2 files changed, 1 insertion(+), 22 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_context.h b/src/gallium/drivers/r300/r300_context.h index 2b665ba2b5..c596d1cba2 100644 --- a/src/gallium/drivers/r300/r300_context.h +++ b/src/gallium/drivers/r300/r300_context.h @@ -254,8 +254,6 @@ struct r300_ztop_state { struct r300_constant_buffer { /* Buffer of constants */ uint32_t *ptr; - /* Total number of vec4s */ - unsigned count; }; /* Query object. diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c index dc0d0415cb..c4e270b444 100644 --- a/src/gallium/drivers/r300/r300_state.c +++ b/src/gallium/drivers/r300/r300_state.c @@ -1795,47 +1795,28 @@ static void r300_set_constant_buffer(struct pipe_context *pipe, struct r300_context* r300 = r300_context(pipe); struct r300_constant_buffer *cbuf; uint32_t *mapped = r300_buffer(buf)->user_buffer; - int max_size = 0, max_size_bytes = 0, clamped_size = 0; switch (shader) { case PIPE_SHADER_VERTEX: cbuf = (struct r300_constant_buffer*)r300->vs_constants.state; - max_size = 256; break; case PIPE_SHADER_FRAGMENT: cbuf = (struct r300_constant_buffer*)r300->fs_constants.state; - if (r300->screen->caps.is_r500) { - max_size = 256; - } else { - max_size = 32; - } break; default: assert(0); return; } - max_size_bytes = max_size * 4 * sizeof(float); if (buf == NULL || buf->width0 == 0 || (mapped = r300_buffer(buf)->constant_buffer) == NULL) { - cbuf->count = 0; return; } if (shader == PIPE_SHADER_FRAGMENT || (shader == PIPE_SHADER_VERTEX && r300->screen->caps.has_tcl)) { assert((buf->width0 % (4 * sizeof(float))) == 0); - - /* Check the size of the constant buffer. */ - /* XXX Subtract immediates and RC_STATE_* variables. */ - if (buf->width0 > max_size_bytes) { - fprintf(stderr, "r300: Max size of the constant buffer is " - "%i*4 floats.\n", max_size); - } - - clamped_size = MIN2(buf->width0, max_size_bytes); - cbuf->count = clamped_size / (4 * sizeof(float)); - cbuf->ptr = mapped; + cbuf->ptr = mapped + index*4; } if (shader == PIPE_SHADER_VERTEX) { -- cgit v1.2.3 From abae06ac85349a30996257f29f9c52c3f687d35d Mon Sep 17 00:00:00 2001 From: Marek Olšák Date: Mon, 23 Aug 2010 05:56:48 +0200 Subject: r300g: eliminate unused constants in VS --- src/gallium/drivers/r300/r300_context.h | 2 ++ src/gallium/drivers/r300/r300_emit.c | 10 +++++++++- src/gallium/drivers/r300/r300_fs.c | 5 ++--- src/gallium/drivers/r300/r300_state.c | 5 +++++ src/gallium/drivers/r300/r300_vs.c | 17 +++++++++++++---- 5 files changed, 31 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_context.h b/src/gallium/drivers/r300/r300_context.h index c596d1cba2..8f0e86fd37 100644 --- a/src/gallium/drivers/r300/r300_context.h +++ b/src/gallium/drivers/r300/r300_context.h @@ -254,6 +254,8 @@ struct r300_ztop_state { struct r300_constant_buffer { /* Buffer of constants */ uint32_t *ptr; + /* Remapping table. */ + unsigned *remap_table; }; /* Query object. diff --git a/src/gallium/drivers/r300/r300_emit.c b/src/gallium/drivers/r300/r300_emit.c index 87d995010e..d3ca23211e 100644 --- a/src/gallium/drivers/r300/r300_emit.c +++ b/src/gallium/drivers/r300/r300_emit.c @@ -961,6 +961,7 @@ void r300_emit_vs_constants(struct r300_context* r300, unsigned count = ((struct r300_vertex_shader*)r300->vs_state.state)->externals_count; struct r300_constant_buffer *buf = (struct r300_constant_buffer*)state; + unsigned i; CS_LOCALS(r300); if (!count) @@ -971,7 +972,14 @@ void r300_emit_vs_constants(struct r300_context* r300, (r300->screen->caps.is_r500 ? R500_PVS_CONST_START : R300_PVS_CONST_START)); OUT_CS_ONE_REG(R300_VAP_PVS_UPLOAD_DATA, count * 4); - OUT_CS_TABLE(buf->ptr, count * 4); + if (buf->remap_table){ + for (i = 0; i < count; i++) { + uint32_t *data = &buf->ptr[buf->remap_table[i]*4]; + OUT_CS_TABLE(data, 4); + } + } else { + OUT_CS_TABLE(buf->ptr, count * 4); + } END_CS; } diff --git a/src/gallium/drivers/r300/r300_fs.c b/src/gallium/drivers/r300/r300_fs.c index 315d5b85f7..d95587b381 100644 --- a/src/gallium/drivers/r300/r300_fs.c +++ b/src/gallium/drivers/r300/r300_fs.c @@ -431,9 +431,8 @@ static void r300_translate_fragment_shader( } if (compiler.Base.Error) { - DBG(r300, DBG_FP, "r300 FP: Compiler Error:\n%sUsing a dummy shader" - " instead.\nIf there's an 'unknown opcode' message, please" - " file a bug report and attach this log.\n", compiler.Base.ErrorMsg); + fprintf(stderr, "r300 FP: Compiler Error:\n%sUsing a dummy shader" + " instead.\n", compiler.Base.ErrorMsg); if (shader->dummy) { fprintf(stderr, "r300 FP: Cannot compile the dummy shader! " diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c index c4e270b444..ed39c575ce 100644 --- a/src/gallium/drivers/r300/r300_state.c +++ b/src/gallium/drivers/r300/r300_state.c @@ -1765,6 +1765,9 @@ static void r300_bind_vs_state(struct pipe_context* pipe, void* shader) r300->vs_constants.size = 0; } + ((struct r300_constant_buffer*)r300->vs_constants.state)->remap_table = + vs->code.constants_remap_table; + r300->pvs_flush.dirty = TRUE; } else { draw_bind_vertex_shader(r300->draw, @@ -1779,6 +1782,8 @@ static void r300_delete_vs_state(struct pipe_context* pipe, void* shader) if (r300->screen->caps.has_tcl) { rc_constants_destroy(&vs->code.constants); + if (vs->code.constants_remap_table) + FREE(vs->code.constants_remap_table); } else { draw_delete_vertex_shader(r300->draw, (struct draw_vertex_shader*)vs->draw_vs); diff --git a/src/gallium/drivers/r300/r300_vs.c b/src/gallium/drivers/r300/r300_vs.c index 54c8de1241..5f8dbb28d0 100644 --- a/src/gallium/drivers/r300/r300_vs.c +++ b/src/gallium/drivers/r300/r300_vs.c @@ -196,6 +196,7 @@ void r300_translate_vertex_shader(struct r300_context *r300, { struct r300_vertex_program_compiler compiler; struct tgsi_to_rc ttr; + unsigned i; /* Setup the compiler */ rc_init(&compiler.Base); @@ -205,6 +206,7 @@ void r300_translate_vertex_shader(struct r300_context *r300, compiler.UserData = vs; compiler.Base.is_r500 = r300->screen->caps.is_r500; compiler.Base.max_temp_regs = 32; + compiler.Base.remove_unused_constants = TRUE; if (compiler.Base.Debug) { DBG(r300, DBG_VP, "r300: Initial vertex program\n"); @@ -227,9 +229,8 @@ void r300_translate_vertex_shader(struct r300_context *r300, /* Invoke the compiler */ r3xx_compile_vertex_program(&compiler); if (compiler.Base.Error) { - DBG(r300, DBG_VP, "r300 VP: Compiler error:\n%sUsing a dummy shader" - " instead.\nIf there's an 'unknown opcode' message, please" - " file a bug report and attach this log.\n", compiler.Base.ErrorMsg); + fprintf(stderr, "r300 VP: Compiler error:\n%sUsing a dummy shader" + " instead.\n", compiler.Base.ErrorMsg); if (vs->dummy) { fprintf(stderr, "r300 VP: Cannot compile the dummy shader! " @@ -243,7 +244,15 @@ void r300_translate_vertex_shader(struct r300_context *r300, } /* Initialize numbers of constants for each type. */ - vs->externals_count = ttr.immediate_offset; + vs->externals_count = 0; + for (i = 0; + i < vs->code.constants.Count && + vs->code.constants.Constants[i].Type == RC_CONSTANT_EXTERNAL; i++) { + vs->externals_count = i+1; + } + for (; i < vs->code.constants.Count; i++) { + assert(vs->code.constants.Constants[i].Type == RC_CONSTANT_IMMEDIATE); + } vs->immediates_count = vs->code.constants.Count - vs->externals_count; /* And, finally... */ -- cgit v1.2.3 From 0a21938de92a1f1e74be7c4559b03179bd657fcd Mon Sep 17 00:00:00 2001 From: Marek Olšák Date: Tue, 24 Aug 2010 02:51:20 +0200 Subject: r300g: eliminate unused constants in FS --- src/gallium/drivers/r300/r300_emit.c | 28 ++++++++++++++++++++++------ src/gallium/drivers/r300/r300_fs.c | 8 +++++++- src/gallium/drivers/r300/r300_state.c | 3 +++ 3 files changed, 32 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_emit.c b/src/gallium/drivers/r300/r300_emit.c index d3ca23211e..90bc9c56d3 100644 --- a/src/gallium/drivers/r300/r300_emit.c +++ b/src/gallium/drivers/r300/r300_emit.c @@ -180,9 +180,18 @@ void r300_emit_fs_constants(struct r300_context* r300, unsigned size, void *stat BEGIN_CS(size); OUT_CS_REG_SEQ(R300_PFS_PARAM_0_X, count * 4); - for (i = 0; i < count; i++) - for (j = 0; j < 4; j++) - OUT_CS(pack_float24(*(float*)&buf->ptr[i*4+j])); + if (buf->remap_table){ + for (i = 0; i < count; i++) { + uint32_t *data = &buf->ptr[buf->remap_table[i]*4]; + for (j = 0; j < 4; j++) + OUT_CS(pack_float24(data[j])); + } + } else { + for (i = 0; i < count; i++) + for (j = 0; j < 4; j++) + OUT_CS(pack_float24(*(float*)&buf->ptr[i*4+j])); + } + END_CS; } @@ -226,7 +235,7 @@ void r500_emit_fs_constants(struct r300_context* r300, unsigned size, void *stat { struct r300_fragment_shader *fs = r300_fs(r300); struct r300_constant_buffer *buf = (struct r300_constant_buffer*)state; - unsigned count = fs->shader->externals_count * 4; + unsigned count = fs->shader->externals_count; CS_LOCALS(r300); if (count == 0) @@ -234,8 +243,15 @@ void r500_emit_fs_constants(struct r300_context* r300, unsigned size, void *stat BEGIN_CS(size); OUT_CS_REG(R500_GA_US_VECTOR_INDEX, R500_GA_US_VECTOR_INDEX_TYPE_CONST); - OUT_CS_ONE_REG(R500_GA_US_VECTOR_DATA, count); - OUT_CS_TABLE(buf->ptr, count); + OUT_CS_ONE_REG(R500_GA_US_VECTOR_DATA, count * 4); + if (buf->remap_table){ + for (unsigned i = 0; i < count; i++) { + uint32_t *data = &buf->ptr[buf->remap_table[i]*4]; + OUT_CS_TABLE(data, 4); + } + } else { + OUT_CS_TABLE(buf->ptr, count * 4); + } END_CS; } diff --git a/src/gallium/drivers/r300/r300_fs.c b/src/gallium/drivers/r300/r300_fs.c index d95587b381..9845e54610 100644 --- a/src/gallium/drivers/r300/r300_fs.c +++ b/src/gallium/drivers/r300/r300_fs.c @@ -386,6 +386,7 @@ static void r300_translate_fragment_shader( compiler.state = shader->compare_state; compiler.Base.is_r500 = r300->screen->caps.is_r500; compiler.Base.max_temp_regs = compiler.Base.is_r500 ? 128 : 32; + compiler.Base.remove_unused_constants = TRUE; compiler.AllocateHwInputs = &allocate_hardware_inputs; compiler.UserData = &shader->inputs; @@ -446,7 +447,12 @@ static void r300_translate_fragment_shader( } /* Initialize numbers of constants for each type. */ - shader->externals_count = ttr.immediate_offset; + shader->externals_count = 0; + for (i = 0; + i < shader->code.constants.Count && + shader->code.constants.Constants[i].Type == RC_CONSTANT_EXTERNAL; i++) { + shader->externals_count = i+1; + } shader->immediates_count = 0; shader->rc_state_count = 0; diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c index ed39c575ce..3e35d7ab28 100644 --- a/src/gallium/drivers/r300/r300_state.c +++ b/src/gallium/drivers/r300/r300_state.c @@ -865,6 +865,9 @@ void r300_mark_fs_code_dirty(struct r300_context *r300) r300->fs_rc_constant_state.size = fs->shader->rc_state_count * 5; r300->fs_constants.size = fs->shader->externals_count * 4 + 1; } + + ((struct r300_constant_buffer*)r300->fs_constants.state)->remap_table = + fs->shader->code.constants_remap_table; } /* Bind fragment shader state. */ -- cgit v1.2.3 From 67925c6cd6710ca70a0d926438d79a59937fd3c6 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Tue, 24 Aug 2010 18:20:26 -0700 Subject: r600: Remove spaces between backslash and newline. Fixes the following GCC warnings. r600_cmdbuf.h:201: warning: backslash and newline separated by space r600_cmdbuf.h:202: warning: backslash and newline separated by space --- src/mesa/drivers/dri/r600/r600_cmdbuf.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r600/r600_cmdbuf.h b/src/mesa/drivers/dri/r600/r600_cmdbuf.h index f102ba6d6b..801bb013f6 100644 --- a/src/mesa/drivers/dri/r600/r600_cmdbuf.h +++ b/src/mesa/drivers/dri/r600/r600_cmdbuf.h @@ -198,8 +198,8 @@ do { \ R600_OUT_BATCH(((reg) - R600_SET_CONFIG_REG_OFFSET) >> 2); \ } else if ((reg) >= R600_SET_CONTEXT_REG_OFFSET && (reg) < R600_SET_CONTEXT_REG_END) { \ R600_OUT_BATCH(CP_PACKET3(R600_IT_SET_CONTEXT_REG, (num))); \ - R600_OUT_BATCH(((reg) - R600_SET_CONTEXT_REG_OFFSET) >> 2); \ - } else if ((reg) >= EG_SET_RESOURCE_OFFSET && (reg) < EG_SET_RESOURCE_END) { \ + R600_OUT_BATCH(((reg) - R600_SET_CONTEXT_REG_OFFSET) >> 2); \ + } else if ((reg) >= EG_SET_RESOURCE_OFFSET && (reg) < EG_SET_RESOURCE_END) { \ R600_OUT_BATCH(CP_PACKET3(R600_IT_SET_RESOURCE, (num))); \ R600_OUT_BATCH(((reg) - EG_SET_RESOURCE_OFFSET) >> 2); \ } else if ((reg) >= EG_SET_LOOP_CONST_OFFSET && (reg) < EG_SET_LOOP_CONST_END) { \ -- cgit v1.2.3 From 3db9d4b2534288931a80137434bcf8ee02b7253f Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Tue, 24 Aug 2010 18:32:51 -0700 Subject: r600: Remove unused variable. Fixes the following GCC warning. r600_emit.c In function 'r600AllocShaderConsts': r600_emit.c:59: warning: unused variable 'out' --- src/mesa/drivers/dri/r600/r600_emit.c | 1 - 1 file changed, 1 deletion(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r600/r600_emit.c b/src/mesa/drivers/dri/r600/r600_emit.c index 4814cb1453..a840106c14 100644 --- a/src/mesa/drivers/dri/r600/r600_emit.c +++ b/src/mesa/drivers/dri/r600/r600_emit.c @@ -56,7 +56,6 @@ GLboolean r600AllocShaderConsts(GLcontext * ctx, { radeonContextPtr radeonctx = RADEON_CONTEXT(ctx); struct radeon_bo * pbo; - uint32_t *out; if(sizeinBYTE < 64) /* SQ_ALU_CONST_BUFFER_SIZE need 64 bytes at least to be non 0 */ { -- cgit v1.2.3 From e96b3110373e8f15c3ba1de5ab561c9885e0003b Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Tue, 24 Aug 2010 18:51:56 -0700 Subject: i965: Fix printf format warnings on 32-bit builds. --- src/mesa/drivers/dri/i965/brw_wm_debug.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_wm_debug.c b/src/mesa/drivers/dri/i965/brw_wm_debug.c index 191670d498..6a91251a80 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_debug.c +++ b/src/mesa/drivers/dri/i965/brw_wm_debug.c @@ -44,16 +44,16 @@ void brw_wm_print_value( struct brw_wm_compile *c, printf("undef"); else if( value - c->vreg >= 0 && value - c->vreg < BRW_WM_MAX_VREG) - printf("r%ld", value - c->vreg); + printf("r%ld", (long) (value - c->vreg)); else if (value - c->creg >= 0 && value - c->creg < BRW_WM_MAX_PARAM) - printf("c%ld", value - c->creg); + printf("c%ld", (long) (value - c->creg)); else if (value - c->payload.input_interp >= 0 && value - c->payload.input_interp < FRAG_ATTRIB_MAX) - printf("i%ld", value - c->payload.input_interp); + printf("i%ld", (long) (value - c->payload.input_interp)); else if (value - c->payload.depth >= 0 && value - c->payload.depth < FRAG_ATTRIB_MAX) - printf("d%ld", value - c->payload.depth); + printf("d%ld", (long) (value - c->payload.depth)); else printf("?"); } -- cgit v1.2.3 From 8cf7eaf3ffd22d60d4f163ac169faa820fbf0c27 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Tue, 24 Aug 2010 19:04:19 -0700 Subject: r600: Remove unused variable. Silences the following GCC warning. evergreen_state.c: In function 'evergreenSetBlendState': evergreen_state.c:341: warning: unused variable 'id' --- src/mesa/drivers/dri/r600/evergreen_state.c | 1 - 1 file changed, 1 deletion(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r600/evergreen_state.c b/src/mesa/drivers/dri/r600/evergreen_state.c index 49ee525492..931478caa5 100644 --- a/src/mesa/drivers/dri/r600/evergreen_state.c +++ b/src/mesa/drivers/dri/r600/evergreen_state.c @@ -338,7 +338,6 @@ static void evergreenSetBlendState(GLcontext * ctx) //diff : CB_COLOR_CONTROL, C { context_t *context = EVERGREEN_CONTEXT(ctx); EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); - int id = 0; uint32_t blend_reg = 0, eqn, eqnA; EVERGREEN_STATECHANGE(context, cb); -- cgit v1.2.3 From 3a97ec7f4833ff62fa1b533de693a41ae49f1fef Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Tue, 24 Aug 2010 19:08:47 -0700 Subject: r600: Include missing header in evergreen_render.c. Fixes the following GCC warning. evergreen_render.c: In function 'evergreenTryDrawPrims': evergreen_render.c:836: error: implicit declaration of function 'evergreenSetupFragmentProgram' --- src/mesa/drivers/dri/r600/evergreen_render.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/mesa/drivers/dri/r600/evergreen_render.c b/src/mesa/drivers/dri/r600/evergreen_render.c index 29b304e846..b9df3351e1 100644 --- a/src/mesa/drivers/dri/r600/evergreen_render.c +++ b/src/mesa/drivers/dri/r600/evergreen_render.c @@ -46,6 +46,7 @@ #include "r600_context.h" #include "r600_cmdbuf.h" +#include "evergreen_fragprog.h" #include "evergreen_vertprog.h" #include "evergreen_state.h" -- cgit v1.2.3 From 879a73023189eed488db2840b829aa5c78e5ba3f Mon Sep 17 00:00:00 2001 From: Marek Olšák Date: Wed, 25 Aug 2010 04:55:01 +0200 Subject: r300g: fix gl_PointCoord Is this hackish or is this the correct way to use point_quad_rasterization? Copied from nvfx. --- src/gallium/drivers/r300/r300_state.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c index 3e35d7ab28..47e359cd5f 100644 --- a/src/gallium/drivers/r300/r300_state.c +++ b/src/gallium/drivers/r300/r300_state.c @@ -950,6 +950,11 @@ static void* r300_create_rs_state(struct pipe_context* pipe, rs->rs = *state; rs->rs_draw = *state; + /* Generate point sprite texture coordinates in GENERIC0 + * if point_quad_rasterization is TRUE. */ + rs->rs.sprite_coord_enable = state->point_quad_rasterization * + (state->sprite_coord_enable | 1); + /* Override some states for Draw. */ rs->rs_draw.sprite_coord_enable = 0; /* We can do this in HW. */ @@ -1051,10 +1056,10 @@ static void* r300_create_rs_state(struct pipe_context* pipe, /* Point sprites */ stuffing_enable = 0; - if (state->sprite_coord_enable) { + if (rs->rs.sprite_coord_enable) { stuffing_enable = R300_GB_POINT_STUFF_ENABLE; for (i = 0; i < 8; i++) { - if (state->sprite_coord_enable & (1 << i)) + if (rs->rs.sprite_coord_enable & (1 << i)) stuffing_enable |= R300_GB_TEX_ST << (R300_GB_TEX0_SOURCE_SHIFT + (i*2)); } -- cgit v1.2.3 From 19f9340e6741611779ec2b78b60f521330984077 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Tue, 24 Aug 2010 22:28:21 -0700 Subject: r300g: Add missing comma in SConscript. This is a follow-on patch to commit 574ba4b5f50bfe661427327cd792a8a200559376. Fixes r300g SCons build. --- src/mesa/drivers/dri/r300/compiler/SConscript | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r300/compiler/SConscript b/src/mesa/drivers/dri/r300/compiler/SConscript index 9729441f3a..847857b142 100755 --- a/src/mesa/drivers/dri/r300/compiler/SConscript +++ b/src/mesa/drivers/dri/r300/compiler/SConscript @@ -22,7 +22,7 @@ r300compiler = env.ConvenienceLibrary( 'radeon_pair_schedule.c', 'radeon_pair_regalloc.c', 'radeon_optimize.c', - 'radeon_remove_constants.c' + 'radeon_remove_constants.c', 'radeon_rename_regs.c', 'radeon_emulate_branches.c', 'radeon_emulate_loops.c', -- cgit v1.2.3 From 0ae6b30c147e6a237cd4e6338975e46de5a95565 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Tue, 24 Aug 2010 23:04:20 -0700 Subject: r300/compiler: Silence uninitialized variable warning. The variable loops would be used uninitialized if it ever processed a RC_OPCODE_ENDLOOP case first. This patch initalizes the loops variable to NULL and adds an assert at the RC_OPCODE_ENDLOOP case that loops isn't NULL. Silence the following GCC warning. r3xx_vertprog.c: In function 'translate_vertex_program': r3xx_vertprog.c:469: warning: 'loops' may be used uninitialized in this function --- src/mesa/drivers/dri/r300/compiler/r3xx_vertprog.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r300/compiler/r3xx_vertprog.c b/src/mesa/drivers/dri/r300/compiler/r3xx_vertprog.c index 997c0912d7..5086d76d4d 100644 --- a/src/mesa/drivers/dri/r300/compiler/r3xx_vertprog.c +++ b/src/mesa/drivers/dri/r300/compiler/r3xx_vertprog.c @@ -466,7 +466,7 @@ static void translate_vertex_program(struct r300_vertex_program_compiler * compi { struct rc_instruction *rci; - struct loop * loops; + struct loop * loops = NULL; int current_loop_depth = 0; int loops_reserved = 0; @@ -559,10 +559,16 @@ static void translate_vertex_program(struct r300_vertex_program_compiler * compi } case RC_OPCODE_ENDLOOP: { - struct loop * l = &loops[current_loop_depth - 1]; - unsigned int act_addr = l->BgnLoop - 1; - unsigned int last_addr = (compiler->code->length / 4) - 1; - unsigned int ret_addr = l->BgnLoop; + struct loop * l; + unsigned int act_addr; + unsigned int last_addr; + unsigned int ret_addr; + + assert(loops); + l = &loops[current_loop_depth - 1]; + act_addr = l->BgnLoop - 1; + last_addr = (compiler->code->length / 4) - 1; + ret_addr = l->BgnLoop; if (loops_reserved >= R300_VS_MAX_FC_OPS) { rc_error(&compiler->Base, -- cgit v1.2.3 From 72ae834fa16a32cc58ae7a93e74f6e11822fcac0 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Tue, 24 Aug 2010 23:50:45 -0700 Subject: gallivm: Include missing header in lp_bld_pack.h. Include p_compiler.h for boolean symbol. --- src/gallium/auxiliary/gallivm/lp_bld_pack.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/gallium/auxiliary/gallivm/lp_bld_pack.h b/src/gallium/auxiliary/gallivm/lp_bld_pack.h index e470082b97..e947b90d16 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_pack.h +++ b/src/gallium/auxiliary/gallivm/lp_bld_pack.h @@ -37,6 +37,8 @@ #define LP_BLD_PACK_H +#include "pipe/p_compiler.h" + #include "gallivm/lp_bld.h" -- cgit v1.2.3 From deffeba17204c249cac698a516a210e364d2cf55 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Tue, 24 Aug 2010 23:53:26 -0700 Subject: gallivm: Include missing header in lp_bld_sample.h. Include p_format.h for enum pipe_format symbol. --- src/gallium/auxiliary/gallivm/lp_bld_sample.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample.h b/src/gallium/auxiliary/gallivm/lp_bld_sample.h index 5b8f478094..aff7bb2a4d 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_sample.h +++ b/src/gallium/auxiliary/gallivm/lp_bld_sample.h @@ -36,6 +36,8 @@ #define LP_BLD_SAMPLE_H +#include "pipe/p_format.h" + #include "gallivm/lp_bld.h" struct pipe_resource; -- cgit v1.2.3 From cab86cb765bedb625b56398c9d312f55c9a24006 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Wed, 25 Aug 2010 00:19:45 -0700 Subject: r600: Include missing header in evergreen_vertprog.c. Include r600_emit.h for r600EmitShader and r600EmitShaderConsts symbols. Fixes the following GCC warnings. evergreen_vertprog.c:614: warning: implicit declaration of function 'r600EmitShader' evergreen_vertprog.c:701: warning: implicit declaration of function 'r600EmitShaderConsts' --- src/mesa/drivers/dri/r600/evergreen_vertprog.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/mesa/drivers/dri/r600/evergreen_vertprog.c b/src/mesa/drivers/dri/r600/evergreen_vertprog.c index 38f3c61ddb..c1497f4cf8 100644 --- a/src/mesa/drivers/dri/r600/evergreen_vertprog.c +++ b/src/mesa/drivers/dri/r600/evergreen_vertprog.c @@ -42,6 +42,7 @@ #include "radeon_debug.h" #include "r600_context.h" #include "r600_cmdbuf.h" +#include "r600_emit.h" #include "program/programopt.h" #include "r700_debug.h" -- cgit v1.2.3 From a8177e745654c332592fad12cbd49d1e6ab1c029 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Wed, 25 Aug 2010 00:29:19 -0700 Subject: r600: Include missing header in evergreen_fragprog.c. Include r600_emit.h for r600EmitShader and r600EmitShaderConsts symbols. Fixes the following GCC warnings. evergreen_fragprog.c: In function 'evergreenSetupFragmentProgram': evergreen_fragprog.c:521: warning: implicit declaration of function 'r600EmitShader' evergreen_fragprog.c:778: warning: implicit declaration of function 'r600EmitShaderConsts' --- src/mesa/drivers/dri/r600/evergreen_fragprog.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/mesa/drivers/dri/r600/evergreen_fragprog.c b/src/mesa/drivers/dri/r600/evergreen_fragprog.c index 9cf06b398a..1cf5a908d1 100644 --- a/src/mesa/drivers/dri/r600/evergreen_fragprog.c +++ b/src/mesa/drivers/dri/r600/evergreen_fragprog.c @@ -39,6 +39,7 @@ #include "r600_context.h" #include "r600_cmdbuf.h" +#include "r600_emit.h" #include "evergreen_vertprog.h" #include "evergreen_fragprog.h" -- cgit v1.2.3 From cc4925bfe6915010caf03e5aa041ba1fdf0a422f Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Wed, 25 Aug 2010 00:40:00 -0700 Subject: i965: Remove unnecessary header. --- src/mesa/drivers/dri/i965/brw_state_upload.c | 1 - 1 file changed, 1 deletion(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_state_upload.c b/src/mesa/drivers/dri/i965/brw_state_upload.c index f51b0719d1..a0c130557e 100644 --- a/src/mesa/drivers/dri/i965/brw_state_upload.c +++ b/src/mesa/drivers/dri/i965/brw_state_upload.c @@ -35,7 +35,6 @@ #include "brw_state.h" #include "intel_batchbuffer.h" #include "intel_buffers.h" -#include "intel_chipset.h" /* This is used to initialize brw->state.atoms[]. We could use this * list directly except for a single atom, brw_constant_buffer, which -- cgit v1.2.3 From fbc3a911e1cbbc39da4c3b0e3dc9f1b964bf7fbc Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Wed, 25 Aug 2010 00:44:28 -0700 Subject: nvfx: Include missing headers in nvfx_shader.h. Include stdint.h for uint8_t symbol. Include p_compiler.h for INLINE symbol. --- src/gallium/drivers/nvfx/nvfx_shader.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src') diff --git a/src/gallium/drivers/nvfx/nvfx_shader.h b/src/gallium/drivers/nvfx/nvfx_shader.h index c711484ee2..35006eec3d 100644 --- a/src/gallium/drivers/nvfx/nvfx_shader.h +++ b/src/gallium/drivers/nvfx/nvfx_shader.h @@ -1,6 +1,10 @@ #ifndef __NVFX_SHADER_H__ #define __NVFX_SHADER_H__ +#include + +#include "pipe/p_compiler.h" + #define NVFX_SWZ_IDENTITY ((3 << 6) | (2 << 4) | (1 << 2) | (0 << 0)) /* this will resolve to either the NV30 or the NV40 version -- cgit v1.2.3 From 4e823197332604ca652ae6be21583725313f9f3d Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Wed, 25 Aug 2010 00:52:34 -0700 Subject: nvfx: Clean up header file inclusion in nvfx_screen.h. Remove nvfx_context.h. Include p_compiler.h for INLINE symbol. Fixes nvfx_context.h -> nvfx_screen.h -> nvfx_context.h include recursion. --- src/gallium/drivers/nvfx/nvfx_screen.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/nvfx/nvfx_screen.h b/src/gallium/drivers/nvfx/nvfx_screen.h index 473a112775..1b79235ae0 100644 --- a/src/gallium/drivers/nvfx/nvfx_screen.h +++ b/src/gallium/drivers/nvfx/nvfx_screen.h @@ -1,11 +1,11 @@ #ifndef __NVFX_SCREEN_H__ #define __NVFX_SCREEN_H__ +#include "pipe/p_compiler.h" #include "util/u_double_list.h" #include "nouveau/nouveau_screen.h" -#include "nvfx_context.h" -struct nv04_2d_context; +struct pipe_screen; struct nvfx_screen { struct nouveau_screen base; -- cgit v1.2.3 From 4f024e0f642f4f743e4d051ec71c00e45bfd361f Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Wed, 25 Aug 2010 14:02:12 +0800 Subject: draw: Add draw_set_index_buffer and others. This commit adds draw_set_index_buffer, draw_set_mapped_index_buffer, and draw_vbo. The idea behind the new functions is that an index buffer should be a state. draw_arrays and draw_set_mapped_element_buffer are preserved, but the latter will be removed soon. --- src/gallium/auxiliary/draw/draw_context.c | 35 +++++++++-- src/gallium/auxiliary/draw/draw_context.h | 9 +++ src/gallium/auxiliary/draw/draw_private.h | 2 + src/gallium/auxiliary/draw/draw_pt.c | 83 ++++++++++++++++++------- src/gallium/auxiliary/draw/draw_pt_vsplit_tmp.h | 6 +- 5 files changed, 104 insertions(+), 31 deletions(-) (limited to 'src') diff --git a/src/gallium/auxiliary/draw/draw_context.c b/src/gallium/auxiliary/draw/draw_context.c index d118a8db52..c2b7a441bd 100644 --- a/src/gallium/auxiliary/draw/draw_context.c +++ b/src/gallium/auxiliary/draw/draw_context.c @@ -496,6 +496,27 @@ void draw_set_render( struct draw_context *draw, } +void +draw_set_index_buffer(struct draw_context *draw, + const struct pipe_index_buffer *ib) +{ + if (ib) + memcpy(&draw->pt.index_buffer, ib, sizeof(draw->pt.index_buffer)); + else + memset(&draw->pt.index_buffer, 0, sizeof(draw->pt.index_buffer)); +} + + +/** + * Tell drawing context where to find mapped index/element buffer. + */ +void +draw_set_mapped_index_buffer(struct draw_context *draw, + const void *elements) +{ + draw->pt.user.elts = elements; +} + /** * Tell the drawing context about the index/element buffer to use @@ -515,8 +536,13 @@ draw_set_mapped_element_buffer_range( struct draw_context *draw, unsigned max_index, const void *elements ) { + struct pipe_index_buffer ib; + + memset(&ib, 0, sizeof(ib)); + ib.index_size = eltSize; + draw_set_index_buffer(draw, &ib); + draw->pt.user.elts = elements; - draw->pt.user.eltSize = eltSize; draw->pt.user.eltBias = eltBias; draw->pt.user.min_index = min_index; draw->pt.user.max_index = max_index; @@ -529,11 +555,8 @@ draw_set_mapped_element_buffer( struct draw_context *draw, int eltBias, const void *elements ) { - draw->pt.user.elts = elements; - draw->pt.user.eltSize = eltSize; - draw->pt.user.eltBias = eltBias; - draw->pt.user.min_index = 0; - draw->pt.user.max_index = 0xffffffff; + draw_set_mapped_element_buffer_range(draw, + eltSize, eltBias, 0, 0xffffffff, elements); } diff --git a/src/gallium/auxiliary/draw/draw_context.h b/src/gallium/auxiliary/draw/draw_context.h index 116716af6f..e9f3237dda 100644 --- a/src/gallium/auxiliary/draw/draw_context.h +++ b/src/gallium/auxiliary/draw/draw_context.h @@ -160,6 +160,12 @@ void draw_set_vertex_elements(struct draw_context *draw, unsigned count, const struct pipe_vertex_element *elements); +void draw_set_index_buffer(struct draw_context *draw, + const struct pipe_index_buffer *ib); + +void draw_set_mapped_index_buffer(struct draw_context *draw, + const void *elements); + void draw_set_mapped_element_buffer_range( struct draw_context *draw, unsigned eltSize, @@ -196,6 +202,9 @@ draw_set_so_state(struct draw_context *draw, * draw_pt.c */ +void draw_vbo(struct draw_context *draw, + const struct pipe_draw_info *info); + void draw_arrays(struct draw_context *draw, unsigned prim, unsigned start, unsigned count); diff --git a/src/gallium/auxiliary/draw/draw_private.h b/src/gallium/auxiliary/draw/draw_private.h index 854c45f060..7bc3923692 100644 --- a/src/gallium/auxiliary/draw/draw_private.h +++ b/src/gallium/auxiliary/draw/draw_private.h @@ -149,6 +149,8 @@ struct draw_context struct pipe_vertex_element vertex_element[PIPE_MAX_ATTRIBS]; unsigned nr_vertex_elements; + struct pipe_index_buffer index_buffer; + /* user-space vertex data, buffers */ struct { /** vertex element/index buffer (ex: glDrawElements) */ diff --git a/src/gallium/auxiliary/draw/draw_pt.c b/src/gallium/auxiliary/draw/draw_pt.c index feacd8258b..8db0d73662 100644 --- a/src/gallium/auxiliary/draw/draw_pt.c +++ b/src/gallium/auxiliary/draw/draw_pt.c @@ -39,6 +39,7 @@ #include "util/u_math.h" #include "util/u_prim.h" #include "util/u_format.h" +#include "util/u_draw.h" DEBUG_GET_ONCE_BOOL_OPTION(draw_fse, "DRAW_FSE", FALSE) @@ -189,24 +190,29 @@ draw_print_arrays(struct draw_context *draw, uint prim, int start, uint count) uint ii = 0; uint j; - if (draw->pt.user.elts) { + if (draw->pt.user.eltSize) { + const char *elts; + /* indexed arrays */ + elts = (const char *) draw->pt.user.elts; + elts += draw->pt.index_buffer.offset; + switch (draw->pt.user.eltSize) { case 1: { - const ubyte *elem = (const ubyte *) draw->pt.user.elts; + const ubyte *elem = (const ubyte *) elts; ii = elem[start + i]; } break; case 2: { - const ushort *elem = (const ushort *) draw->pt.user.elts; + const ushort *elem = (const ushort *) elts; ii = elem[start + i]; } break; case 4: { - const uint *elem = (const uint *) draw->pt.user.elts; + const uint *elem = (const uint *) elts; ii = elem[start + i]; } break; @@ -292,17 +298,9 @@ draw_arrays(struct draw_context *draw, unsigned prim, /** - * Draw vertex arrays. - * This is the main entrypoint into the drawing module. - * If drawing an indexed primitive, the draw_set_mapped_element_buffer_range() - * function should have already been called to specify the element/index buffer - * information. - * - * \param prim one of PIPE_PRIM_x - * \param start index of first vertex to draw - * \param count number of vertices to draw - * \param startInstance number for the first primitive instance (usually 0). - * \param instanceCount number of instances to draw (1=non-instanced) + * Instanced drawing. + * draw_set_mapped_element_buffer must be called before calling this function. + * \sa draw_vbo */ void draw_arrays_instanced(struct draw_context *draw, @@ -312,10 +310,49 @@ draw_arrays_instanced(struct draw_context *draw, unsigned startInstance, unsigned instanceCount) { - unsigned reduced_prim = u_reduced_prim(mode); + struct pipe_draw_info info; + + util_draw_init_info(&info); + + info.mode = mode; + info.start = start; + info.count = count; + info.start_instance = startInstance; + info.instance_count = instanceCount; + + info.indexed = (draw->pt.user.elts != NULL); + info.index_bias = draw->pt.user.eltBias; + info.min_index = draw->pt.user.min_index; + info.max_index = draw->pt.user.max_index; + + draw_vbo(draw, &info); +} + + +/** + * Draw vertex arrays. + * This is the main entrypoint into the drawing module. If drawing an indexed + * primitive, the draw_set_index_buffer() and draw_set_mapped_index_buffer() + * functions should have already been called to specify the element/index + * buffer information. + */ +void +draw_vbo(struct draw_context *draw, + const struct pipe_draw_info *info) +{ + unsigned reduced_prim = u_reduced_prim(info->mode); unsigned instance; - assert(instanceCount > 0); + assert(info->instance_count > 0); + if (info->indexed) + assert(draw->pt.user.elts); + + draw->pt.user.eltSize = + (info->indexed) ? draw->pt.index_buffer.index_size : 0; + + draw->pt.user.eltBias = info->index_bias; + draw->pt.user.min_index = info->min_index; + draw->pt.user.max_index = info->max_index; if (reduced_prim != draw->reduced_prim) { draw_do_flush(draw, DRAW_FLUSH_STATE_CHANGE); @@ -323,8 +360,8 @@ draw_arrays_instanced(struct draw_context *draw, } if (0) - debug_printf("draw_arrays(mode=%u start=%u count=%u):\n", - mode, start, count); + debug_printf("draw_vbo(mode=%u start=%u count=%u):\n", + info->mode, info->start, info->count); if (0) tgsi_dump(draw->vs.vertex_shader->state.tokens, 0); @@ -352,10 +389,10 @@ draw_arrays_instanced(struct draw_context *draw, } if (0) - draw_print_arrays(draw, mode, start, MIN2(count, 20)); + draw_print_arrays(draw, info->mode, info->start, MIN2(info->count, 20)); - for (instance = 0; instance < instanceCount; instance++) { - draw->instance_id = instance + startInstance; - draw_pt_arrays(draw, mode, start, count); + for (instance = 0; instance < info->instance_count; instance++) { + draw->instance_id = instance + info->start_instance; + draw_pt_arrays(draw, info->mode, info->start, info->count); } } diff --git a/src/gallium/auxiliary/draw/draw_pt_vsplit_tmp.h b/src/gallium/auxiliary/draw/draw_pt_vsplit_tmp.h index 4bb57b1493..3f66f962e1 100644 --- a/src/gallium/auxiliary/draw/draw_pt_vsplit_tmp.h +++ b/src/gallium/auxiliary/draw/draw_pt_vsplit_tmp.h @@ -38,7 +38,8 @@ CONCAT(vsplit_primitive_, ELT_TYPE)(struct vsplit_frontend *vsplit, unsigned istart, unsigned icount) { struct draw_context *draw = vsplit->draw; - const ELT_TYPE *ib = (const ELT_TYPE *) draw->pt.user.elts; + const ELT_TYPE *ib = (const ELT_TYPE *) + ((const char *) draw->pt.user.elts + draw->pt.index_buffer.offset); const unsigned min_index = draw->pt.user.min_index; const unsigned max_index = draw->pt.user.max_index; const int elt_bias = draw->pt.user.eltBias; @@ -119,7 +120,8 @@ CONCAT(vsplit_segment_cache_, ELT_TYPE)(struct vsplit_frontend *vsplit, boolean close, unsigned iclose) { struct draw_context *draw = vsplit->draw; - const ELT_TYPE *ib = (const ELT_TYPE *) draw->pt.user.elts; + const ELT_TYPE *ib = (const ELT_TYPE *) + ((const char *) draw->pt.user.elts + draw->pt.index_buffer.offset); const int ibias = draw->pt.user.eltBias; unsigned i; -- cgit v1.2.3 From 94e8d4171d9647db84cd53334a2b14fab062640d Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Sun, 1 Aug 2010 14:27:56 +0800 Subject: svga: Remove redundant svga_draw_range_elements. That is, implement draw_vbo directly. As a result, svga_swtnl_draw_range_elements is also replaced by svga_swtnl_draw_vbo. This commit should not have any functional change. --- src/gallium/drivers/svga/svga_pipe_draw.c | 82 +++++++++--------------------- src/gallium/drivers/svga/svga_swtnl.h | 11 +--- src/gallium/drivers/svga/svga_swtnl_draw.c | 39 +++++++------- 3 files changed, 45 insertions(+), 87 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/svga/svga_pipe_draw.c b/src/gallium/drivers/svga/svga_pipe_draw.c index de08bc5e56..001ec3616c 100644 --- a/src/gallium/drivers/svga/svga_pipe_draw.c +++ b/src/gallium/drivers/svga/svga_pipe_draw.c @@ -146,23 +146,15 @@ retry: } - - - static void -svga_draw_range_elements( struct pipe_context *pipe, - struct pipe_resource *index_buffer, - unsigned index_size, - int index_bias, - unsigned min_index, - unsigned max_index, - unsigned prim, unsigned start, unsigned count) +svga_draw_vbo(struct pipe_context *pipe, const struct pipe_draw_info *info) { struct svga_context *svga = svga_context( pipe ); - unsigned reduced_prim = u_reduced_prim(prim); + unsigned reduced_prim = u_reduced_prim( info->mode ); + unsigned count = info->count; enum pipe_error ret = 0; - if (!u_trim_pipe_prim( prim, &count )) + if (!u_trim_pipe_prim( info->mode, &count )) return; /* @@ -187,34 +179,32 @@ svga_draw_range_elements( struct pipe_context *pipe, return; #endif - if (svga->state.sw.need_swtnl) - { - ret = svga_swtnl_draw_range_elements( svga, - index_buffer, - index_size, - index_bias, - min_index, max_index, - prim, - start, count ); + if (svga->state.sw.need_swtnl) { + ret = svga_swtnl_draw_vbo( svga, info ); } else { - if (index_buffer) { + if (info->indexed && svga->curr.ib.buffer) { + unsigned offset; + + assert(svga->curr.ib.offset % svga->curr.ib.index_size == 0); + offset = svga->curr.ib.offset / svga->curr.ib.index_size; + ret = retry_draw_range_elements( svga, - index_buffer, - index_size, - index_bias, - min_index, - max_index, - prim, - start, - count, + svga->curr.ib.buffer, + svga->curr.ib.index_size, + info->index_bias, + info->min_index, + info->max_index, + info->mode, + info->start + offset, + info->count, TRUE ); } else { - ret = retry_draw_arrays( svga, - prim, - start, - count, + ret = retry_draw_arrays( svga, + info->mode, + info->start, + info->count, TRUE ); } } @@ -226,30 +216,6 @@ svga_draw_range_elements( struct pipe_context *pipe, } -static void -svga_draw_vbo(struct pipe_context *pipe, const struct pipe_draw_info *info) -{ - struct svga_context *svga = svga_context(pipe); - - if (info->indexed && svga->curr.ib.buffer) { - unsigned offset; - - assert(svga->curr.ib.offset % svga->curr.ib.index_size == 0); - offset = svga->curr.ib.offset / svga->curr.ib.index_size; - - svga_draw_range_elements(pipe, svga->curr.ib.buffer, - svga->curr.ib.index_size, info->index_bias, - info->min_index, info->max_index, - info->mode, info->start + offset, info->count); - } - else { - svga_draw_range_elements(pipe, NULL, 0, 0, - info->min_index, info->max_index, - info->mode, info->start, info->count); - } -} - - void svga_init_draw_functions( struct svga_context *svga ) { svga->pipe.draw_vbo = svga_draw_vbo; diff --git a/src/gallium/drivers/svga/svga_swtnl.h b/src/gallium/drivers/svga/svga_swtnl.h index 65c675f99c..fc094e5142 100644 --- a/src/gallium/drivers/svga/svga_swtnl.h +++ b/src/gallium/drivers/svga/svga_swtnl.h @@ -38,15 +38,8 @@ void svga_destroy_swtnl( struct svga_context *svga ); enum pipe_error -svga_swtnl_draw_range_elements(struct svga_context *svga, - struct pipe_resource *indexBuffer, - unsigned indexSize, - int indexBias, - unsigned min_index, - unsigned max_index, - unsigned prim, - unsigned start, - unsigned count); +svga_swtnl_draw_vbo(struct svga_context *svga, + const struct pipe_draw_info *info); #endif diff --git a/src/gallium/drivers/svga/svga_swtnl_draw.c b/src/gallium/drivers/svga/svga_swtnl_draw.c index eb71c23195..4f83822b5c 100644 --- a/src/gallium/drivers/svga/svga_swtnl_draw.c +++ b/src/gallium/drivers/svga/svga_swtnl_draw.c @@ -36,13 +36,8 @@ enum pipe_error -svga_swtnl_draw_range_elements(struct svga_context *svga, - struct pipe_resource *indexBuffer, - unsigned indexSize, - int indexBias, - unsigned min_index, - unsigned max_index, - unsigned prim, unsigned start, unsigned count) +svga_swtnl_draw_vbo(struct svga_context *svga, + const struct pipe_draw_info *info) { struct pipe_transfer *vb_transfer[PIPE_MAX_ATTRIBS]; struct pipe_transfer *ib_transfer = NULL; @@ -77,18 +72,22 @@ svga_swtnl_draw_range_elements(struct svga_context *svga, } /* Map index buffer, if present */ - if (indexBuffer) { - map = pipe_buffer_map(&svga->pipe, indexBuffer, + map = NULL; + if (info->indexed && svga->curr.ib.buffer) { + map = pipe_buffer_map(&svga->pipe, svga->curr.ib.buffer, PIPE_TRANSFER_READ, - &ib_transfer); - - draw_set_mapped_element_buffer_range(draw, - indexSize, indexBias, - min_index, - max_index, - map); + &ib_transfer); + if (map) + map = (const void *) ((const char *) map + svga->curr.ib.offset); } - + + draw_set_mapped_element_buffer_range(draw, (map) ? + svga->curr.ib.index_size : 0, + info->index_bias, + info->min_index, + info->max_index, + map); + if (svga->curr.cb[PIPE_SHADER_VERTEX]) { map = pipe_buffer_map(&svga->pipe, svga->curr.cb[PIPE_SHADER_VERTEX], @@ -101,7 +100,7 @@ svga_swtnl_draw_range_elements(struct svga_context *svga, svga->curr.cb[PIPE_SHADER_VERTEX]->width0); } - draw_arrays(svga->swtnl.draw, prim, start, count); + draw_arrays(draw, info->mode, info->start, info->count); draw_flush(svga->swtnl.draw); @@ -117,8 +116,8 @@ svga_swtnl_draw_range_elements(struct svga_context *svga, draw_set_mapped_vertex_buffer(draw, i, NULL); } - if (indexBuffer) { - pipe_buffer_unmap(&svga->pipe, indexBuffer, ib_transfer); + if (ib_transfer) { + pipe_buffer_unmap(&svga->pipe, svga->curr.ib.buffer, ib_transfer); draw_set_mapped_element_buffer(draw, 0, 0, NULL); } -- cgit v1.2.3 From 22f6026324f63c142925244ff575fefc29a90389 Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Wed, 25 Aug 2010 15:11:03 +0800 Subject: gallium: Use draw_set_index_buffer and others. Update all drivers to use draw_set_index_buffer, draw_set_mapped_index_buffer, and draw_vbo. Remove draw_set_mapped_element_buffer and draw_set_mapped_element_buffer_range. --- src/gallium/auxiliary/draw/draw_context.c | 42 ---------------------- src/gallium/auxiliary/draw/draw_context.h | 13 ------- src/gallium/auxiliary/draw/draw_pt.c | 8 ++--- src/gallium/drivers/cell/ppu/cell_draw_arrays.c | 15 +++----- src/gallium/drivers/cell/ppu/cell_state_vertex.c | 2 +- src/gallium/drivers/i915/i915_context.c | 22 ++++-------- src/gallium/drivers/i915/i915_state.c | 3 +- src/gallium/drivers/llvmpipe/lp_draw_arrays.c | 18 +++------- src/gallium/drivers/llvmpipe/lp_state_vertex.c | 2 +- src/gallium/drivers/nvfx/nvfx_draw.c | 12 +++---- src/gallium/drivers/nvfx/nvfx_state_emit.c | 3 ++ src/gallium/drivers/r300/r300_render.c | 14 ++------ src/gallium/drivers/r300/r300_state.c | 7 +++- src/gallium/drivers/softpipe/sp_draw_arrays.c | 26 ++++---------- src/gallium/drivers/softpipe/sp_state_vertex.c | 2 +- src/gallium/drivers/svga/svga_swtnl_draw.c | 17 ++++----- src/mesa/state_tracker/st_draw_feedback.c | 46 +++++++++++++----------- 17 files changed, 80 insertions(+), 172 deletions(-) (limited to 'src') diff --git a/src/gallium/auxiliary/draw/draw_context.c b/src/gallium/auxiliary/draw/draw_context.c index c2b7a441bd..b39b835f05 100644 --- a/src/gallium/auxiliary/draw/draw_context.c +++ b/src/gallium/auxiliary/draw/draw_context.c @@ -518,48 +518,6 @@ draw_set_mapped_index_buffer(struct draw_context *draw, } -/** - * Tell the drawing context about the index/element buffer to use - * (ala glDrawElements) - * If no element buffer is to be used (i.e. glDrawArrays) then this - * should be called with eltSize=0 and elements=NULL. - * - * \param draw the drawing context - * \param eltSize size of each element (1, 2 or 4 bytes) - * \param elements the element buffer ptr - */ -void -draw_set_mapped_element_buffer_range( struct draw_context *draw, - unsigned eltSize, - int eltBias, - unsigned min_index, - unsigned max_index, - const void *elements ) -{ - struct pipe_index_buffer ib; - - memset(&ib, 0, sizeof(ib)); - ib.index_size = eltSize; - draw_set_index_buffer(draw, &ib); - - draw->pt.user.elts = elements; - draw->pt.user.eltBias = eltBias; - draw->pt.user.min_index = min_index; - draw->pt.user.max_index = max_index; -} - - -void -draw_set_mapped_element_buffer( struct draw_context *draw, - unsigned eltSize, - int eltBias, - const void *elements ) -{ - draw_set_mapped_element_buffer_range(draw, - eltSize, eltBias, 0, 0xffffffff, elements); -} - - /* Revamp me please: */ void draw_do_flush( struct draw_context *draw, unsigned flags ) diff --git a/src/gallium/auxiliary/draw/draw_context.h b/src/gallium/auxiliary/draw/draw_context.h index e9f3237dda..ea55320c42 100644 --- a/src/gallium/auxiliary/draw/draw_context.h +++ b/src/gallium/auxiliary/draw/draw_context.h @@ -166,19 +166,6 @@ void draw_set_index_buffer(struct draw_context *draw, void draw_set_mapped_index_buffer(struct draw_context *draw, const void *elements); -void -draw_set_mapped_element_buffer_range( struct draw_context *draw, - unsigned eltSize, - int eltBias, - unsigned min_index, - unsigned max_index, - const void *elements ); - -void draw_set_mapped_element_buffer( struct draw_context *draw, - unsigned eltSize, - int eltBias, - const void *elements ); - void draw_set_mapped_vertex_buffer(struct draw_context *draw, unsigned attr, const void *buffer); diff --git a/src/gallium/auxiliary/draw/draw_pt.c b/src/gallium/auxiliary/draw/draw_pt.c index 8db0d73662..f81714d6b4 100644 --- a/src/gallium/auxiliary/draw/draw_pt.c +++ b/src/gallium/auxiliary/draw/draw_pt.c @@ -299,7 +299,6 @@ draw_arrays(struct draw_context *draw, unsigned prim, /** * Instanced drawing. - * draw_set_mapped_element_buffer must be called before calling this function. * \sa draw_vbo */ void @@ -321,9 +320,10 @@ draw_arrays_instanced(struct draw_context *draw, info.instance_count = instanceCount; info.indexed = (draw->pt.user.elts != NULL); - info.index_bias = draw->pt.user.eltBias; - info.min_index = draw->pt.user.min_index; - info.max_index = draw->pt.user.max_index; + if (!info.indexed) { + info.min_index = start; + info.max_index = start + count - 1; + } draw_vbo(draw, &info); } diff --git a/src/gallium/drivers/cell/ppu/cell_draw_arrays.c b/src/gallium/drivers/cell/ppu/cell_draw_arrays.c index 4adef5b8c0..a367fa3fe1 100644 --- a/src/gallium/drivers/cell/ppu/cell_draw_arrays.c +++ b/src/gallium/drivers/cell/ppu/cell_draw_arrays.c @@ -78,20 +78,13 @@ cell_draw_vbo(struct pipe_context *pipe, const struct pipe_draw_info *info) draw_set_mapped_vertex_buffer(draw, i, buf); } /* Map index buffer, if present */ - if (info->indexed && cell->index_buffer.buffer) { + if (info->indexed && cell->index_buffer.buffer) mapped_indices = cell_resource(cell->index_buffer.buffer)->data; - mapped_indices += cell->index_buffer.offset; - } - draw_set_mapped_element_buffer_range(draw, (mapped_indices) ? - lp->index_buffer.index_size : 0, - info->index_bias, - info->min_index, - info->max_index, - mapped_indices); + draw_set_mapped_index_buffer(draw, mapped_indices); /* draw! */ - draw_arrays(draw, info->mode, info->start, info->count); + draw_vbo(draw, info); /* * unmap vertex/index buffers - will cause draw module to flush @@ -100,7 +93,7 @@ cell_draw_vbo(struct pipe_context *pipe, const struct pipe_draw_info *info) draw_set_mapped_vertex_buffer(draw, i, NULL); } if (mapped_indices) { - draw_set_mapped_element_buffer(draw, 0, 0, NULL); + draw_set_mapped_index_buffer(draw, NULL); } /* diff --git a/src/gallium/drivers/cell/ppu/cell_state_vertex.c b/src/gallium/drivers/cell/ppu/cell_state_vertex.c index 4e3701cd0a..a065d68b5a 100644 --- a/src/gallium/drivers/cell/ppu/cell_state_vertex.c +++ b/src/gallium/drivers/cell/ppu/cell_state_vertex.c @@ -102,7 +102,7 @@ cell_set_index_buffer(struct pipe_context *pipe, else memset(&cell->index_buffer, 0, sizeof(cell->index_buffer)); - /* TODO make this more like a state */ + draw_set_index_buffer(cell->draw, ib); } diff --git a/src/gallium/drivers/i915/i915_context.c b/src/gallium/drivers/i915/i915_context.c index 2beb9e3091..847dd6dd47 100644 --- a/src/gallium/drivers/i915/i915_context.c +++ b/src/gallium/drivers/i915/i915_context.c @@ -66,18 +66,9 @@ i915_draw_vbo(struct pipe_context *pipe, const struct pipe_draw_info *info) /* * Map index buffer, if present */ - if (info->indexed && i915->index_buffer.buffer) { - char *indices = (char *) i915_buffer(i915->index_buffer.buffer)->data; - mapped_indices = (void *) (indices + i915->index_buffer.offset); - } - - draw_set_mapped_element_buffer_range(draw, (mapped_indices) ? - i915->index_buffer.index_size : 0, - info->index_bias, - info->min_index, - info->max_index, - mapped_indices); - + if (info->indexed && i915->index_buffer.buffer) + mapped_indices = i915_buffer(i915->index_buffer.buffer)->data; + draw_set_mapped_index_buffer(draw, mapped_indices); draw_set_mapped_constant_buffer(draw, PIPE_SHADER_VERTEX, 0, i915->current.constants[PIPE_SHADER_VERTEX], @@ -87,7 +78,7 @@ i915_draw_vbo(struct pipe_context *pipe, const struct pipe_draw_info *info) /* * Do the drawing */ - draw_arrays(i915->draw, info->mode, info->start, info->count); + draw_vbo(i915->draw, info); /* * unmap vertex/index buffers @@ -96,9 +87,8 @@ i915_draw_vbo(struct pipe_context *pipe, const struct pipe_draw_info *info) draw_set_mapped_vertex_buffer(draw, i, NULL); } - if (mapped_indices) { - draw_set_mapped_element_buffer(draw, 0, 0, NULL); - } + if (mapped_indices) + draw_set_mapped_index_buffer(draw, NULL); } diff --git a/src/gallium/drivers/i915/i915_state.c b/src/gallium/drivers/i915/i915_state.c index 8c53b06931..bbfcff6bc4 100644 --- a/src/gallium/drivers/i915/i915_state.c +++ b/src/gallium/drivers/i915/i915_state.c @@ -817,7 +817,8 @@ static void i915_set_index_buffer(struct pipe_context *pipe, else memset(&i915->index_buffer, 0, sizeof(i915->index_buffer)); - /* TODO make this more like a state */ + /* pass-through to draw module */ + draw_set_index_buffer(i915->draw, ib); } static void diff --git a/src/gallium/drivers/llvmpipe/lp_draw_arrays.c b/src/gallium/drivers/llvmpipe/lp_draw_arrays.c index e73b431cb4..3af5c8d5c5 100644 --- a/src/gallium/drivers/llvmpipe/lp_draw_arrays.c +++ b/src/gallium/drivers/llvmpipe/lp_draw_arrays.c @@ -68,25 +68,17 @@ llvmpipe_draw_vbo(struct pipe_context *pipe, const struct pipe_draw_info *info) } /* Map index buffer, if present */ - if (info->indexed && lp->index_buffer.buffer) { - char *indices = (char *) llvmpipe_resource_data(lp->index_buffer.buffer); - mapped_indices = (void *) (indices + lp->index_buffer.offset); - } + if (info->indexed && lp->index_buffer.buffer) + mapped_indices = llvmpipe_resource_data(lp->index_buffer.buffer); - draw_set_mapped_element_buffer_range(draw, (mapped_indices) ? - lp->index_buffer.index_size : 0, - info->index_bias, - info->min_index, - info->max_index, - mapped_indices); + draw_set_mapped_index_buffer(draw, mapped_indices); llvmpipe_prepare_vertex_sampling(lp, lp->num_vertex_sampler_views, lp->vertex_sampler_views); /* draw! */ - draw_arrays_instanced(draw, info->mode, info->start, info->count, - info->start_instance, info->instance_count); + draw_vbo(draw, info); /* * unmap vertex/index buffers @@ -95,7 +87,7 @@ llvmpipe_draw_vbo(struct pipe_context *pipe, const struct pipe_draw_info *info) draw_set_mapped_vertex_buffer(draw, i, NULL); } if (mapped_indices) { - draw_set_mapped_element_buffer(draw, 0, 0, NULL); + draw_set_mapped_index_buffer(draw, NULL); } llvmpipe_cleanup_vertex_sampling(lp); diff --git a/src/gallium/drivers/llvmpipe/lp_state_vertex.c b/src/gallium/drivers/llvmpipe/lp_state_vertex.c index d86e66b4fb..fb29423dd3 100644 --- a/src/gallium/drivers/llvmpipe/lp_state_vertex.c +++ b/src/gallium/drivers/llvmpipe/lp_state_vertex.c @@ -100,7 +100,7 @@ llvmpipe_set_index_buffer(struct pipe_context *pipe, else memset(&llvmpipe->index_buffer, 0, sizeof(llvmpipe->index_buffer)); - /* TODO make this more like a state */ + draw_set_index_buffer(llvmpipe->draw, ib); } void diff --git a/src/gallium/drivers/nvfx/nvfx_draw.c b/src/gallium/drivers/nvfx/nvfx_draw.c index 0b17921295..2601d5b8e2 100644 --- a/src/gallium/drivers/nvfx/nvfx_draw.c +++ b/src/gallium/drivers/nvfx/nvfx_draw.c @@ -239,12 +239,10 @@ nvfx_draw_vbo_swtnl(struct pipe_context *pipe, const struct pipe_draw_info* info draw_set_mapped_vertex_buffer(nvfx->draw, i, map); } - if (info->indexed) { - map = nvfx_buffer(nvfx->idxbuf.buffer)->data + nvfx->idxbuf.offset; - draw_set_mapped_element_buffer_range(nvfx->draw, nvfx->idxbuf.index_size, info->index_bias, info->min_index, info->max_index, map); - } else { - draw_set_mapped_element_buffer(nvfx->draw, 0, 0, NULL); - } + map = NULL; + if (info->indexed && nvfx->idxbuf.buffer) + map = nvfx_buffer(nvfx->idxbuf.buffer)->data; + draw_set_mapped_index_buffer(nvfx->draw, map); if (nvfx->constbuf[PIPE_SHADER_VERTEX]) { const unsigned nr = nvfx->constbuf_nr[PIPE_SHADER_VERTEX]; @@ -254,7 +252,7 @@ nvfx_draw_vbo_swtnl(struct pipe_context *pipe, const struct pipe_draw_info* info map, nr); } - draw_arrays_instanced(nvfx->draw, info->mode, info->start, info->count, info->start_instance, info->instance_count); + draw_vbo(nvfx->draw, info); draw_flush(nvfx->draw); } diff --git a/src/gallium/drivers/nvfx/nvfx_state_emit.c b/src/gallium/drivers/nvfx/nvfx_state_emit.c index cfcb0f7ef6..390bca8cdb 100644 --- a/src/gallium/drivers/nvfx/nvfx_state_emit.c +++ b/src/gallium/drivers/nvfx/nvfx_state_emit.c @@ -335,6 +335,9 @@ nvfx_state_validate_swtnl(struct nvfx_context *nvfx) draw_set_vertex_elements(draw, nvfx->vtxelt->num_elements, nvfx->vtxelt->pipe); } + if (nvfx->draw_dirty & NVFX_NEW_INDEX) + draw_set_index_buffer(draw, &nvfx->idxbuf); + nvfx_state_validate_common(nvfx); nvfx->draw_dirty = 0; diff --git a/src/gallium/drivers/r300/r300_render.c b/src/gallium/drivers/r300/r300_render.c index e08335a105..20bad2c56f 100644 --- a/src/gallium/drivers/r300/r300_render.c +++ b/src/gallium/drivers/r300/r300_render.c @@ -680,18 +680,11 @@ static void r300_swtcl_draw_vbo(struct pipe_context* pipe, if (info->indexed && r300->index_buffer.buffer) { indices = pipe_buffer_map(pipe, r300->index_buffer.buffer, PIPE_TRANSFER_READ, &ib_transfer); - if (indices) - indices = (void *) ((char *) indices + r300->index_buffer.offset); } - draw_set_mapped_element_buffer_range(r300->draw, (indices) ? - r300->index_buffer.index_size : 0, - info->index_bias, - info->min_index, - info->max_index, - indices); + draw_set_mapped_index_buffer(r300->draw, indices); - draw_arrays(r300->draw, info->mode, info->start, count); + draw_vbo(r300->draw, info); /* XXX Not sure whether this is the best fix. * It prevents CS from being rejected and weird assertion failures. */ @@ -707,8 +700,7 @@ static void r300_swtcl_draw_vbo(struct pipe_context* pipe, if (ib_transfer) { pipe_buffer_unmap(pipe, r300->index_buffer.buffer, ib_transfer); - draw_set_mapped_element_buffer_range(r300->draw, 0, 0, info->start, - info->start + count - 1, NULL); + draw_set_mapped_index_buffer(r300->draw, NULL); } } diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c index 47e359cd5f..5c225e24f9 100644 --- a/src/gallium/drivers/r300/r300_state.c +++ b/src/gallium/drivers/r300/r300_state.c @@ -1556,7 +1556,12 @@ static void r300_set_index_buffer(struct pipe_context* pipe, memset(&r300->index_buffer, 0, sizeof(r300->index_buffer)); } - /* TODO make this more like a state */ + if (r300->screen->caps.has_tcl) { + /* TODO make this more like a state */ + } + else { + draw_set_index_buffer(r300->draw, ib); + } } /* Initialize the PSC tables. */ diff --git a/src/gallium/drivers/softpipe/sp_draw_arrays.c b/src/gallium/drivers/softpipe/sp_draw_arrays.c index 386c8acb8c..01b4ca985d 100644 --- a/src/gallium/drivers/softpipe/sp_draw_arrays.c +++ b/src/gallium/drivers/softpipe/sp_draw_arrays.c @@ -75,14 +75,10 @@ softpipe_draw_stream_output(struct pipe_context *pipe, unsigned mode) buf = (void*)((int32_t*)buf + offset); draw_set_mapped_vertex_buffer(draw, 0, buf); - draw_set_mapped_element_buffer_range(draw, - 0, 0, - start, - start + count - 1, - NULL); + draw_set_mapped_index_buffer(draw, NULL); /* draw! */ - draw_arrays_instanced(draw, mode, start, count, 0, 1); + draw_arrays(draw, mode, start, count); /* unmap vertex/index buffers - will cause draw module to flush */ draw_set_mapped_vertex_buffer(draw, 0, NULL); @@ -138,28 +134,20 @@ softpipe_draw_vbo(struct pipe_context *pipe, } /* Map index buffer, if present */ - if (info->indexed && sp->index_buffer.buffer) { - char *indices = (char *) softpipe_resource(sp->index_buffer.buffer)->data; - mapped_indices = (void *) (indices + sp->index_buffer.offset); - } + if (info->indexed && sp->index_buffer.buffer) + mapped_indices = softpipe_resource(sp->index_buffer.buffer)->data; - draw_set_mapped_element_buffer_range(draw, (mapped_indices) ? - sp->index_buffer.index_size : 0, - info->index_bias, - info->min_index, - info->max_index, - mapped_indices); + draw_set_mapped_index_buffer(draw, mapped_indices); /* draw! */ - draw_arrays_instanced(draw, info->mode, info->start, info->count, - info->start_instance, info->instance_count); + draw_vbo(draw, info); /* unmap vertex/index buffers - will cause draw module to flush */ for (i = 0; i < sp->num_vertex_buffers; i++) { draw_set_mapped_vertex_buffer(draw, i, NULL); } if (mapped_indices) { - draw_set_mapped_element_buffer(draw, 0, 0, NULL); + draw_set_mapped_index_buffer(draw, NULL); } /* diff --git a/src/gallium/drivers/softpipe/sp_state_vertex.c b/src/gallium/drivers/softpipe/sp_state_vertex.c index 880a7c7cd2..b650fcaea5 100644 --- a/src/gallium/drivers/softpipe/sp_state_vertex.c +++ b/src/gallium/drivers/softpipe/sp_state_vertex.c @@ -100,5 +100,5 @@ softpipe_set_index_buffer(struct pipe_context *pipe, else memset(&softpipe->index_buffer, 0, sizeof(softpipe->index_buffer)); - /* TODO make this more like a state */ + draw_set_index_buffer(softpipe->draw, ib); } diff --git a/src/gallium/drivers/svga/svga_swtnl_draw.c b/src/gallium/drivers/svga/svga_swtnl_draw.c index 4f83822b5c..e9eba3b422 100644 --- a/src/gallium/drivers/svga/svga_swtnl_draw.c +++ b/src/gallium/drivers/svga/svga_swtnl_draw.c @@ -71,22 +71,17 @@ svga_swtnl_draw_vbo(struct svga_context *svga, draw_set_mapped_vertex_buffer(draw, i, map); } + /* TODO move this to update_swtnl_draw */ + draw_set_index_buffer(draw, &svga->curr.ib); + /* Map index buffer, if present */ map = NULL; if (info->indexed && svga->curr.ib.buffer) { map = pipe_buffer_map(&svga->pipe, svga->curr.ib.buffer, PIPE_TRANSFER_READ, &ib_transfer); - if (map) - map = (const void *) ((const char *) map + svga->curr.ib.offset); } - - draw_set_mapped_element_buffer_range(draw, (map) ? - svga->curr.ib.index_size : 0, - info->index_bias, - info->min_index, - info->max_index, - map); + draw_set_mapped_index_buffer(draw, map); if (svga->curr.cb[PIPE_SHADER_VERTEX]) { map = pipe_buffer_map(&svga->pipe, @@ -100,7 +95,7 @@ svga_swtnl_draw_vbo(struct svga_context *svga, svga->curr.cb[PIPE_SHADER_VERTEX]->width0); } - draw_arrays(draw, info->mode, info->start, info->count); + draw_vbo(draw, info); draw_flush(svga->swtnl.draw); @@ -118,7 +113,7 @@ svga_swtnl_draw_vbo(struct svga_context *svga, if (ib_transfer) { pipe_buffer_unmap(&svga->pipe, svga->curr.ib.buffer, ib_transfer); - draw_set_mapped_element_buffer(draw, 0, 0, NULL); + draw_set_mapped_index_buffer(draw, NULL); } if (svga->curr.cb[PIPE_SHADER_VERTEX]) { diff --git a/src/mesa/state_tracker/st_draw_feedback.c b/src/mesa/state_tracker/st_draw_feedback.c index 5cf2666334..e0995f8318 100644 --- a/src/mesa/state_tracker/st_draw_feedback.c +++ b/src/mesa/state_tracker/st_draw_feedback.c @@ -40,6 +40,7 @@ #include "pipe/p_context.h" #include "pipe/p_defines.h" #include "util/u_inlines.h" +#include "util/u_draw.h" #include "draw/draw_private.h" #include "draw/draw_context.h" @@ -104,14 +105,15 @@ st_feedback_draw_vbo(GLcontext *ctx, struct draw_context *draw = st->draw; const struct st_vertex_program *vp; const struct pipe_shader_state *vs; - struct pipe_resource *index_buffer_handle = 0; struct pipe_vertex_buffer vbuffers[PIPE_MAX_SHADER_INPUTS]; struct pipe_vertex_element velements[PIPE_MAX_ATTRIBS]; + struct pipe_index_buffer ibuffer; struct pipe_transfer *vb_transfer[PIPE_MAX_ATTRIBS]; struct pipe_transfer *ib_transfer = NULL; struct pipe_transfer *cb_transfer; GLuint attr, i; ubyte *mapped_constants; + const void *mapped_indices = NULL; assert(draw); @@ -204,17 +206,19 @@ st_feedback_draw_vbo(GLcontext *ctx, draw_set_vertex_buffers(draw, vp->num_inputs, vbuffers); draw_set_vertex_elements(draw, vp->num_inputs, velements); + memset(&ibuffer, 0, sizeof(ibuffer)); if (ib) { struct gl_buffer_object *bufobj = ib->obj; - unsigned indexSize; - void *map; switch (ib->type) { case GL_UNSIGNED_INT: - indexSize = 4; + ibuffer.index_size = 4; break; case GL_UNSIGNED_SHORT: - indexSize = 2; + ibuffer.index_size = 2; + break; + case GL_UNSIGNED_BYTE: + ibuffer.index_size = 1; break; default: assert(0); @@ -224,23 +228,20 @@ st_feedback_draw_vbo(GLcontext *ctx, if (bufobj && bufobj->Name) { struct st_buffer_object *stobj = st_buffer_object(bufobj); - index_buffer_handle = stobj->buffer; - - map = pipe_buffer_map(pipe, index_buffer_handle, - PIPE_TRANSFER_READ, &ib_transfer); + pipe_resource_reference(&ibuffer.buffer, stobj->buffer); + ibuffer.offset = pointer_to_offset(ib->ptr); - draw_set_mapped_element_buffer(draw, indexSize, 0, map); + mapped_indices = pipe_buffer_map(pipe, stobj->buffer, + PIPE_TRANSFER_READ, &ib_transfer); } else { - draw_set_mapped_element_buffer(draw, indexSize, 0, (void *) ib->ptr); - ib_transfer = NULL; + /* skip setting ibuffer.buffer as the draw module does not use it */ + mapped_indices = ib->ptr; } - } - else { - /* no index/element buffer */ - draw_set_mapped_element_buffer(draw, 0, 0, NULL); - } + draw_set_index_buffer(draw, &ibuffer); + draw_set_mapped_index_buffer(draw, mapped_indices); + } /* map constant buffers */ mapped_constants = pipe_buffer_map(pipe, @@ -273,9 +274,14 @@ st_feedback_draw_vbo(GLcontext *ctx, draw_set_mapped_vertex_buffer(draw, i, NULL); } } - if (index_buffer_handle) { - pipe_buffer_unmap(pipe, index_buffer_handle, ib_transfer); - draw_set_mapped_element_buffer(draw, 0, 0, NULL); + + if (ib) { + draw_set_mapped_index_buffer(draw, NULL); + draw_set_index_buffer(draw, NULL); + + if (ib_transfer) + pipe_buffer_unmap(pipe, ibuffer.buffer, ib_transfer); + pipe_resource_reference(&ibuffer.buffer, NULL); } } -- cgit v1.2.3 From d29d7807c1e2c53336b1adaf0ecdeb3e35b39969 Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Sat, 7 Aug 2010 21:08:23 +0800 Subject: draw: Remove UNDEFINED_VERTEX_ID checks in emit pathes. UNDEFINED_VERTEX_ID is used by draw_pipe_vbuf to decide whether a vertex has been emitted or not. The non-pipeline pathes do not use it (they tell the frontend the max vertex count when prepare() is called). --- src/gallium/auxiliary/draw/draw_pt_emit.c | 8 -------- src/gallium/auxiliary/draw/draw_pt_fetch_emit.c | 11 ----------- src/gallium/auxiliary/draw/draw_pt_fetch_shade_emit.c | 9 --------- 3 files changed, 28 deletions(-) (limited to 'src') diff --git a/src/gallium/auxiliary/draw/draw_pt_emit.c b/src/gallium/auxiliary/draw/draw_pt_emit.c index 89d96c4235..c8dfc16911 100644 --- a/src/gallium/auxiliary/draw/draw_pt_emit.c +++ b/src/gallium/auxiliary/draw/draw_pt_emit.c @@ -144,11 +144,6 @@ void draw_pt_emit( struct pt_emit *emit, if (vertex_count == 0) return; - if (vertex_count >= UNDEFINED_VERTEX_ID) { - assert(0); - return; - } - /* XXX: and work out some way to coordinate the render primitive * between vbuf.c and here... */ @@ -223,9 +218,6 @@ void draw_pt_emit_linear(struct pt_emit *emit, */ draw_do_flush( draw, DRAW_FLUSH_BACKEND ); - if (count >= UNDEFINED_VERTEX_ID) - goto fail; - /* XXX: and work out some way to coordinate the render primitive * between vbuf.c and here... */ diff --git a/src/gallium/auxiliary/draw/draw_pt_fetch_emit.c b/src/gallium/auxiliary/draw/draw_pt_fetch_emit.c index 80a89428b6..e706b7796f 100644 --- a/src/gallium/auxiliary/draw/draw_pt_fetch_emit.c +++ b/src/gallium/auxiliary/draw/draw_pt_fetch_emit.c @@ -212,11 +212,6 @@ static void fetch_emit_run( struct draw_pt_middle_end *middle, */ draw_do_flush( draw, DRAW_FLUSH_BACKEND ); - if (fetch_count >= UNDEFINED_VERTEX_ID) { - assert(0); - return; - } - draw->render->allocate_vertices( draw->render, (ushort)feme->translate->key.output_stride, (ushort)fetch_count ); @@ -276,9 +271,6 @@ static void fetch_emit_run_linear( struct draw_pt_middle_end *middle, */ draw_do_flush( draw, DRAW_FLUSH_BACKEND ); - if (count >= UNDEFINED_VERTEX_ID) - goto fail; - if (!draw->render->allocate_vertices( draw->render, (ushort)feme->translate->key.output_stride, (ushort)count )) @@ -338,9 +330,6 @@ static boolean fetch_emit_run_linear_elts( struct draw_pt_middle_end *middle, */ draw_do_flush( draw, DRAW_FLUSH_BACKEND ); - if (count >= UNDEFINED_VERTEX_ID) - return FALSE; - if (!draw->render->allocate_vertices( draw->render, (ushort)feme->translate->key.output_stride, (ushort)count )) diff --git a/src/gallium/auxiliary/draw/draw_pt_fetch_shade_emit.c b/src/gallium/auxiliary/draw/draw_pt_fetch_shade_emit.c index a31d3feb16..4fbf88844a 100644 --- a/src/gallium/auxiliary/draw/draw_pt_fetch_shade_emit.c +++ b/src/gallium/auxiliary/draw/draw_pt_fetch_shade_emit.c @@ -199,9 +199,6 @@ static void fse_run_linear( struct draw_pt_middle_end *middle, */ draw_do_flush( draw, DRAW_FLUSH_BACKEND ); - if (count >= UNDEFINED_VERTEX_ID) - goto fail; - if (!draw->render->allocate_vertices( draw->render, (ushort)fse->key.output_stride, (ushort)count )) @@ -268,9 +265,6 @@ fse_run(struct draw_pt_middle_end *middle, */ draw_do_flush( draw, DRAW_FLUSH_BACKEND ); - if (fetch_count >= UNDEFINED_VERTEX_ID) - goto fail; - if (!draw->render->allocate_vertices( draw->render, (ushort)fse->key.output_stride, (ushort)fetch_count )) @@ -331,9 +325,6 @@ static boolean fse_run_linear_elts( struct draw_pt_middle_end *middle, */ draw_do_flush( draw, DRAW_FLUSH_BACKEND ); - if (count >= UNDEFINED_VERTEX_ID) - return FALSE; - if (!draw->render->allocate_vertices( draw->render, (ushort)fse->key.output_stride, (ushort)count )) -- cgit v1.2.3 From f77daaa88290388ec817e1a4756405fddce1e696 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Fri, 20 Aug 2010 11:36:53 +0100 Subject: llvmpipe: remove dead code --- src/gallium/drivers/llvmpipe/lp_rast.c | 37 ---------------------------------- 1 file changed, 37 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/llvmpipe/lp_rast.c b/src/gallium/drivers/llvmpipe/lp_rast.c index 3215d0f652..b1c306bbe9 100644 --- a/src/gallium/drivers/llvmpipe/lp_rast.c +++ b/src/gallium/drivers/llvmpipe/lp_rast.c @@ -316,43 +316,6 @@ lp_rast_clear_zstencil(struct lp_rasterizer_task *task, } -/** - * Load tile color from the framebuffer surface. - * This is a bin command called during bin processing. - */ -#if 0 -void -lp_rast_load_color(struct lp_rasterizer_task *task, - const union lp_rast_cmd_arg arg) -{ - struct lp_rasterizer *rast = task->rast; - unsigned buf; - enum lp_texture_usage usage; - - LP_DBG(DEBUG_RAST, "%s at %u, %u\n", __FUNCTION__, x, y); - - if (scene->has_color_clear) - usage = LP_TEX_USAGE_WRITE_ALL; - else - usage = LP_TEX_USAGE_READ_WRITE; - - /* Get pointers to color tile(s). - * This will convert linear data to tiled if needed. - */ - for (buf = 0; buf < rast->state.nr_cbufs; buf++) { - struct pipe_surface *cbuf = rast->curr_scene->fb.cbufs[buf]; - struct llvmpipe_texture *lpt; - assert(cbuf); - lpt = llvmpipe_texture(cbuf->texture); - task->color_tiles[buf] = llvmpipe_get_texture_tile(lpt, - cbuf->face + cbuf->zslice, - cbuf->level, - usage, - task->x, task->y); - assert(task->color_tiles[buf]); - } -} -#endif /** -- cgit v1.2.3 From bc3cff2a4fbc690d7dcaf81cb821093950efee31 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Fri, 20 Aug 2010 11:38:33 +0100 Subject: gallium/docs: notes on scissor state --- src/gallium/docs/source/context.rst | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/docs/source/context.rst b/src/gallium/docs/source/context.rst index f241411a00..8250c30f2a 100644 --- a/src/gallium/docs/source/context.rst +++ b/src/gallium/docs/source/context.rst @@ -63,7 +63,9 @@ objects. They all follow simple, one-method binding calls, e.g. * ``set_scissor_state`` sets the bounds for the scissor test, which culls pixels before blending to render targets. If the :ref:`Rasterizer` does not have the scissor test enabled, then the scissor bounds never need to - be set since they will not be used. + be set since they will not be used. Note that scissor xmin and ymin are + inclusive, but xmax and ymax are exclusive. The inclusive ranges in x + and y would be [xmin..xmax-1] and [ymin..ymax-1]. * ``set_viewport_state`` -- cgit v1.2.3 From 4cef3087261317f04e4a06cc645c895d31f6e06b Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Fri, 20 Aug 2010 11:40:26 +0100 Subject: util: add rectangle helpers to u_rect.h This begins a process of repurposing this file. The existing usage is as a header file for some software blit fallbacks, which should be moved to a more appropriately named header. --- src/gallium/auxiliary/util/u_rect.h | 57 ++++++++++++++++++++++++++++++++++--- 1 file changed, 53 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/gallium/auxiliary/util/u_rect.h b/src/gallium/auxiliary/util/u_rect.h index deb00cc80c..4cb90d3c31 100644 --- a/src/gallium/auxiliary/util/u_rect.h +++ b/src/gallium/auxiliary/util/u_rect.h @@ -26,19 +26,68 @@ **************************************************************************/ -/** - * Pipe copy/fill rect helpers. +#ifndef U_RECT_H +#define U_RECT_H + +#include "pipe/p_compiler.h" + +struct u_rect { + int x0, x1; + int y0, y1; +}; + +/* Do two rectangles intersect? */ +static INLINE boolean +u_rect_test_intersection(const struct u_rect *a, + const struct u_rect *b) +{ + return (!(a->x1 < b->x0 || + b->x1 < a->x0 || + a->y1 < b->y0 || + b->y1 < a->y0)); +} +/* Find the intersection of two rectangles known to intersect. + */ +static INLINE void +u_rect_find_intersection(const struct u_rect *a, + struct u_rect *b) +{ + /* Caller should verify intersection exists before calling. + */ + if (b->x0 < a->x0) b->x0 = a->x0; + if (b->x1 > a->x1) b->x1 = a->x1; + if (b->y0 < a->y0) b->y0 = a->y0; + if (b->y1 > a->y1) b->y1 = a->y1; +} -#ifndef U_RECT_H -#define U_RECT_H +static INLINE void +u_rect_possible_intersection(const struct u_rect *a, + struct u_rect *b) +{ + if (u_rect_test_intersection(a,b)) { + u_rect_find_intersection(a,b); + } + else { + b->x0 = b->x1 = b->y0 = b->y1 = 0; + } +} #include "pipe/p_format.h" #include "util/u_pack_color.h" + +/********************************************************************** + * Pipe copy/fill rect helpers. + */ + +/* These really should move to a different file: + */ +#include "pipe/p_format.h" + extern void util_copy_rect(ubyte * dst, enum pipe_format format, unsigned dst_stride, unsigned dst_x, unsigned dst_y, -- cgit v1.2.3 From 6c0dc4bafbdbdc0cb4b6e5934fe064226dbd47ec Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Fri, 20 Aug 2010 15:52:58 +0100 Subject: draw: specialized cliptesting routines --- src/gallium/auxiliary/draw/draw_cliptest_tmp.h | 114 ++++++++ src/gallium/auxiliary/draw/draw_context.c | 31 ++- src/gallium/auxiliary/draw/draw_context.h | 3 +- src/gallium/auxiliary/draw/draw_pipe_validate.c | 2 +- src/gallium/auxiliary/draw/draw_private.h | 12 +- src/gallium/auxiliary/draw/draw_pt.c | 4 +- src/gallium/auxiliary/draw/draw_pt.h | 4 +- .../auxiliary/draw/draw_pt_fetch_shade_emit.c | 2 +- .../auxiliary/draw/draw_pt_fetch_shade_pipeline.c | 6 +- .../draw/draw_pt_fetch_shade_pipeline_llvm.c | 6 +- src/gallium/auxiliary/draw/draw_pt_post_vs.c | 288 ++++++++------------- src/gallium/drivers/r300/r300_context.c | 2 - src/gallium/drivers/svga/svga_swtnl_draw.c | 3 +- 13 files changed, 269 insertions(+), 208 deletions(-) create mode 100644 src/gallium/auxiliary/draw/draw_cliptest_tmp.h (limited to 'src') diff --git a/src/gallium/auxiliary/draw/draw_cliptest_tmp.h b/src/gallium/auxiliary/draw/draw_cliptest_tmp.h new file mode 100644 index 0000000000..958ed20dc8 --- /dev/null +++ b/src/gallium/auxiliary/draw/draw_cliptest_tmp.h @@ -0,0 +1,114 @@ +/************************************************************************** + * + * Copyright 2010, 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, 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 VMWARE AND/OR ITS 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. + * + **************************************************************************/ + + + +static boolean TAG(do_cliptest)( struct pt_post_vs *pvs, + struct draw_vertex_info *info ) +{ + struct vertex_header *out = info->verts; + const float *scale = pvs->draw->viewport.scale; + const float *trans = pvs->draw->viewport.translate; + /* const */ float (*plane)[4] = pvs->draw->plane; + const unsigned pos = draw_current_shader_position_output(pvs->draw); + const unsigned ef = pvs->draw->vs.edgeflag_output; + const unsigned nr = pvs->draw->nr_planes; + const unsigned flags = (FLAGS); + unsigned need_pipeline = 0; + unsigned j; + + for (j = 0; j < info->count; j++) { + float *position = out->data[pos]; + unsigned mask = 0x0; + + initialize_vertex_header(out); + + if (flags & (DO_CLIP_XY | DO_CLIP_FULL_Z | DO_CLIP_HALF_Z | DO_CLIP_USER)) { + out->clip[0] = position[0]; + out->clip[1] = position[1]; + out->clip[2] = position[2]; + out->clip[3] = position[3]; + + /* Do the hardwired planes first: + */ + if (flags & DO_CLIP_XY) { + if (-position[0] + position[3] < 0) mask |= (1<<0); + if ( position[0] + position[3] < 0) mask |= (1<<1); + if (-position[1] + position[3] < 0) mask |= (1<<2); + if ( position[1] + position[3] < 0) mask |= (1<<3); + } + + /* Clip Z planes according to full cube, half cube or none. + */ + if (flags & DO_CLIP_FULL_Z) { + if ( position[2] + position[3] < 0) mask |= (1<<4); + if (-position[2] + position[3] < 0) mask |= (1<<5); + } + else if (flags & DO_CLIP_HALF_Z) { + if ( position[2] < 0) mask |= (1<<4); + if (-position[2] + position[3] < 0) mask |= (1<<5); + } + + if (flags & DO_CLIP_USER) { + unsigned i; + for (i = 6; i < nr; i++) { + if (dot4(position, plane[i]) < 0) + mask |= (1<clipmask = mask; + need_pipeline |= out->clipmask; + } + + if ((flags & DO_VIEWPORT) && mask == 0) + { + /* divide by w */ + float w = 1.0f / position[3]; + + /* Viewport mapping */ + position[0] = position[0] * w * scale[0] + trans[0]; + position[1] = position[1] * w * scale[1] + trans[1]; + position[2] = position[2] * w * scale[2] + trans[2]; + position[3] = w; + } + + if ((flags & DO_EDGEFLAG) && ef) { + const float *edgeflag = out->data[ef]; + out->edgeflag = !(edgeflag[0] != 1.0f); + need_pipeline |= !out->edgeflag; + } + + out = (struct vertex_header *)( (char *)out + info->stride ); + } + + return need_pipeline != 0; +} + + +#undef FLAGS +#undef TAG diff --git a/src/gallium/auxiliary/draw/draw_context.c b/src/gallium/auxiliary/draw/draw_context.c index b39b835f05..937b093479 100644 --- a/src/gallium/auxiliary/draw/draw_context.c +++ b/src/gallium/auxiliary/draw/draw_context.c @@ -106,6 +106,8 @@ boolean draw_init(struct draw_context *draw) ASSIGN_4V( draw->plane[4], 0, 0, 1, 1 ); /* yes these are correct */ ASSIGN_4V( draw->plane[5], 0, 0, -1, 1 ); /* mesa's a bit wonky */ draw->nr_planes = 6; + draw->clip_xy = 1; + draw->clip_z = 1; draw->reduced_prim = ~0; /* != any of PIPE_PRIM_x */ @@ -186,6 +188,14 @@ void draw_set_mrd(struct draw_context *draw, double mrd) } +static void update_clip_flags( struct draw_context *draw ) +{ + draw->clip_xy = !draw->driver.bypass_clip_xy; + draw->clip_z = (!draw->driver.bypass_clip_z && + !draw->depth_clamp); + draw->clip_user = (draw->nr_planes > 6); +} + /** * Register new primitive rasterization/rendering state. * This causes the drawing pipeline to be rebuilt. @@ -200,18 +210,25 @@ void draw_set_rasterizer_state( struct draw_context *draw, draw->rasterizer = raster; draw->rast_handle = rast_handle; - draw->bypass_clipping = draw->driver.bypass_clipping; - } + } } - +/* With a little more work, llvmpipe will be able to turn this off and + * do its own x/y clipping. + * + * Some hardware can turn off clipping altogether - in particular any + * hardware with a TNL unit can do its own clipping, even if it is + * relying on the draw module for some other reason. + */ void draw_set_driver_clipping( struct draw_context *draw, - boolean bypass_clipping ) + boolean bypass_clip_xy, + boolean bypass_clip_z ) { draw_do_flush( draw, DRAW_FLUSH_STATE_CHANGE ); - draw->driver.bypass_clipping = bypass_clipping; - draw->bypass_clipping = draw->driver.bypass_clipping; + draw->driver.bypass_clip_xy = bypass_clip_xy; + draw->driver.bypass_clip_z = bypass_clip_z; + update_clip_flags(draw); } @@ -241,6 +258,8 @@ void draw_set_clip_state( struct draw_context *draw, memcpy(&draw->plane[6], clip->ucp, clip->nr * sizeof(clip->ucp[0])); draw->nr_planes = 6 + clip->nr; draw->depth_clamp = clip->depth_clamp; + + update_clip_flags(draw); } diff --git a/src/gallium/auxiliary/draw/draw_context.h b/src/gallium/auxiliary/draw/draw_context.h index ea55320c42..4c780e4dcb 100644 --- a/src/gallium/auxiliary/draw/draw_context.h +++ b/src/gallium/auxiliary/draw/draw_context.h @@ -212,7 +212,8 @@ void draw_set_render( struct draw_context *draw, struct vbuf_render *render ); void draw_set_driver_clipping( struct draw_context *draw, - boolean bypass_clipping ); + boolean bypass_clip_xy, + boolean bypass_clip_z ); void draw_set_force_passthrough( struct draw_context *draw, boolean enable ); diff --git a/src/gallium/auxiliary/draw/draw_pipe_validate.c b/src/gallium/auxiliary/draw/draw_pipe_validate.c index eafa29276f..8b92543987 100644 --- a/src/gallium/auxiliary/draw/draw_pipe_validate.c +++ b/src/gallium/auxiliary/draw/draw_pipe_validate.c @@ -265,7 +265,7 @@ static struct draw_stage *validate_pipeline( struct draw_stage *stage ) /* Clip stage */ - if (!draw->bypass_clipping) + if (draw->clip_xy || draw->clip_z || draw->clip_user) { draw->pipeline.clip->next = next; next = draw->pipeline.clip; diff --git a/src/gallium/auxiliary/draw/draw_private.h b/src/gallium/auxiliary/draw/draw_private.h index 7bc3923692..362f563ba6 100644 --- a/src/gallium/auxiliary/draw/draw_private.h +++ b/src/gallium/auxiliary/draw/draw_private.h @@ -176,13 +176,19 @@ struct draw_context } pt; struct { - boolean bypass_clipping; - boolean bypass_vs; + boolean bypass_clip_xy; + boolean bypass_clip_z; } driver; boolean flushing; /**< debugging/sanity */ boolean suspend_flushing; /**< internally set */ - boolean bypass_clipping; /**< set if either api or driver bypass_clipping true */ + + /* Flags set if API requires clipping in these planes and the + * driver doesn't indicate that it can do it for us. + */ + boolean clip_xy; + boolean clip_z; + boolean clip_user; boolean force_passthrough; /**< never clip or shade */ diff --git a/src/gallium/auxiliary/draw/draw_pt.c b/src/gallium/auxiliary/draw/draw_pt.c index f81714d6b4..f44bf2507c 100644 --- a/src/gallium/auxiliary/draw/draw_pt.c +++ b/src/gallium/auxiliary/draw/draw_pt.c @@ -86,7 +86,9 @@ draw_pt_arrays(struct draw_context *draw, opt |= PT_PIPELINE; } - if (!draw->bypass_clipping && !draw->pt.test_fse) { + if ((draw->clip_xy || + draw->clip_z || + draw->clip_user) && !draw->pt.test_fse) { opt |= PT_CLIPTEST; } diff --git a/src/gallium/auxiliary/draw/draw_pt.h b/src/gallium/auxiliary/draw/draw_pt.h index 0db5666529..5fbb424291 100644 --- a/src/gallium/auxiliary/draw/draw_pt.h +++ b/src/gallium/auxiliary/draw/draw_pt.h @@ -221,7 +221,9 @@ boolean draw_pt_post_vs_run( struct pt_post_vs *pvs, struct draw_vertex_info *info ); void draw_pt_post_vs_prepare( struct pt_post_vs *pvs, - boolean bypass_clipping, + boolean clip_xy, + boolean clip_z, + boolean clip_user, boolean bypass_viewport, boolean opengl, boolean need_edgeflags ); diff --git a/src/gallium/auxiliary/draw/draw_pt_fetch_shade_emit.c b/src/gallium/auxiliary/draw/draw_pt_fetch_shade_emit.c index 4fbf88844a..7c198c6026 100644 --- a/src/gallium/auxiliary/draw/draw_pt_fetch_shade_emit.c +++ b/src/gallium/auxiliary/draw/draw_pt_fetch_shade_emit.c @@ -102,7 +102,7 @@ static void fse_prepare( struct draw_pt_middle_end *middle, fse->key.nr_inputs); /* inputs - fetch from api format */ fse->key.viewport = !draw->identity_viewport; - fse->key.clip = !draw->bypass_clipping; + fse->key.clip = draw->clip_xy || draw->clip_z || draw->clip_user; fse->key.const_vbuffers = 0; memset(fse->key.element, 0, diff --git a/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline.c b/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline.c index 96b40fb363..b72fd61245 100644 --- a/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline.c +++ b/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline.c @@ -100,8 +100,10 @@ static void fetch_pipeline_prepare( struct draw_pt_middle_end *middle, * but gl vs dx9 clip spaces. */ draw_pt_post_vs_prepare( fpme->post_vs, - (boolean)draw->bypass_clipping, - (boolean)draw->identity_viewport, + draw->clip_xy, + draw->clip_z, + draw->clip_user, + draw->identity_viewport, (boolean)draw->rasterizer->gl_rasterization_rules, (draw->vs.edgeflag_output ? TRUE : FALSE) ); diff --git a/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline_llvm.c b/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline_llvm.c index cc0b4e5232..77291e304e 100644 --- a/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline_llvm.c +++ b/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline_llvm.c @@ -107,8 +107,10 @@ llvm_middle_end_prepare( struct draw_pt_middle_end *middle, * but gl vs dx9 clip spaces. */ draw_pt_post_vs_prepare( fpme->post_vs, - (boolean)draw->bypass_clipping, - (boolean)(draw->identity_viewport), + draw->clip_xy, + draw->clip_z, + draw->clip_user, + draw->identity_viewport, (boolean)draw->rasterizer->gl_rasterization_rules, (draw->vs.edgeflag_output ? TRUE : FALSE) ); diff --git a/src/gallium/auxiliary/draw/draw_pt_post_vs.c b/src/gallium/auxiliary/draw/draw_pt_post_vs.c index 308f927b77..769409cfd6 100644 --- a/src/gallium/auxiliary/draw/draw_pt_post_vs.c +++ b/src/gallium/auxiliary/draw/draw_pt_post_vs.c @@ -26,14 +26,26 @@ **************************************************************************/ #include "util/u_memory.h" +#include "util/u_math.h" #include "pipe/p_context.h" #include "draw/draw_context.h" #include "draw/draw_private.h" #include "draw/draw_pt.h" + +#define DO_CLIP_XY 0x1 +#define DO_CLIP_FULL_Z 0x2 +#define DO_CLIP_HALF_Z 0x4 +#define DO_CLIP_USER 0x8 +#define DO_VIEWPORT 0x10 +#define DO_EDGEFLAG 0x20 + + struct pt_post_vs { struct draw_context *draw; + unsigned flags; + boolean (*run)( struct pt_post_vs *pvs, struct draw_vertex_info *info ); }; @@ -56,186 +68,47 @@ dot4(const float *a, const float *b) a[3]*b[3]); } -static INLINE unsigned -compute_clipmask_gl(const float *clip, /*const*/ float plane[][4], unsigned nr, - boolean clip_depth) -{ - unsigned mask = 0x0; - unsigned i; +#define FLAGS (0) +#define TAG(x) x##_none +#include "draw_cliptest_tmp.h" -#if 0 - debug_printf("compute clipmask %f %f %f %f\n", - clip[0], clip[1], clip[2], clip[3]); - assert(clip[3] != 0.0); -#endif +#define FLAGS (DO_CLIP_XY | DO_CLIP_FULL_Z | DO_VIEWPORT) +#define TAG(x) x##_xy_fullz_viewport +#include "draw_cliptest_tmp.h" - /* Do the hardwired planes first: - */ - if (-clip[0] + clip[3] < 0) mask |= (1<<0); - if ( clip[0] + clip[3] < 0) mask |= (1<<1); - if (-clip[1] + clip[3] < 0) mask |= (1<<2); - if ( clip[1] + clip[3] < 0) mask |= (1<<3); - if (clip_depth) { - if ( clip[2] + clip[3] < 0) mask |= (1<<4); /* match mesa clipplane numbering - for now */ - if (-clip[2] + clip[3] < 0) mask |= (1<<5); /* match mesa clipplane numbering - for now */ - } +#define FLAGS (DO_CLIP_XY | DO_CLIP_HALF_Z | DO_VIEWPORT) +#define TAG(x) x##_xy_halfz_viewport +#include "draw_cliptest_tmp.h" - /* Followed by any remaining ones: - */ - for (i = 6; i < nr; i++) { - if (dot4(clip, plane[i]) < 0) - mask |= (1<verts; - const float *scale = pvs->draw->viewport.scale; - const float *trans = pvs->draw->viewport.translate; - const unsigned pos = draw_current_shader_position_output(pvs->draw); - unsigned clipped = 0; - unsigned j; - - if (0) debug_printf("%s count, %d\n", __FUNCTION__, info->count); - - for (j = 0; j < info->count; j++) { - float *position = out->data[pos]; - - initialize_vertex_header(out); -#if 0 - debug_printf("%d) io = %p, data = %p = [%f, %f, %f, %f]\n", - j, out, position, position[0], position[1], position[2], position[3]); -#endif - - out->clip[0] = position[0]; - out->clip[1] = position[1]; - out->clip[2] = position[2]; - out->clip[3] = position[3]; - - out->vertex_id = 0xffff; - /* Disable depth clipping if depth clamping is enabled. */ - out->clipmask = compute_clipmask_gl(out->clip, - pvs->draw->plane, - pvs->draw->nr_planes, - !pvs->draw->depth_clamp); - clipped += out->clipmask; - - if (out->clipmask == 0) - { - /* divide by w */ - float w = 1.0f / position[3]; - - /* Viewport mapping */ - position[0] = position[0] * w * scale[0] + trans[0]; - position[1] = position[1] * w * scale[1] + trans[1]; - position[2] = position[2] * w * scale[2] + trans[2]; - position[3] = w; -#if 0 - debug_printf("post viewport: %f %f %f %f\n", - position[0], - position[1], - position[2], - position[3]); -#endif - } - - out = (struct vertex_header *)( (char *)out + info->stride ); - } - - return clipped != 0; -} +#define FLAGS (DO_CLIP_XY | DO_CLIP_FULL_Z | DO_CLIP_USER | DO_VIEWPORT | DO_EDGEFLAG) +#define TAG(x) x##_xy_fullz_user_viewport_edgeflag +#include "draw_cliptest_tmp.h" -/* As above plus edgeflags +/* Don't want to create 64 versions of this function, so catch the + * less common ones here. This is looking like something which should + * be code-generated, perhaps appended to the end of the vertex + * shader. */ -static boolean -post_vs_cliptest_viewport_gl_edgeflag(struct pt_post_vs *pvs, - struct draw_vertex_info *info) -{ - unsigned j; - boolean needpipe; - - needpipe = post_vs_cliptest_viewport_gl(pvs, info); - - /* If present, copy edgeflag VS output into vertex header. - * Otherwise, leave header as is. - */ - if (pvs->draw->vs.edgeflag_output) { - struct vertex_header *out = info->verts; - int ef = pvs->draw->vs.edgeflag_output; - - for (j = 0; j < info->count; j++) { - const float *edgeflag = out->data[ef]; - out->edgeflag = !(edgeflag[0] != 1.0f); - needpipe |= !out->edgeflag; - out = (struct vertex_header *)( (char *)out + info->stride ); - } - } - return needpipe; -} - +#define FLAGS (pvs->flags) +#define TAG(x) x##_generic +#include "draw_cliptest_tmp.h" -/* If bypass_clipping is set, skip cliptest and rhw divide. - */ -static boolean post_vs_viewport( struct pt_post_vs *pvs, - struct draw_vertex_info *info ) -{ - struct vertex_header *out = info->verts; - const float *scale = pvs->draw->viewport.scale; - const float *trans = pvs->draw->viewport.translate; - const unsigned pos = draw_current_shader_position_output(pvs->draw); - unsigned j; - - if (0) debug_printf("%s\n", __FUNCTION__); - for (j = 0; j < info->count; j++) { - float *position = out->data[pos]; - - initialize_vertex_header(out); - /* Viewport mapping only, no cliptest/rhw divide - */ - position[0] = position[0] * scale[0] + trans[0]; - position[1] = position[1] * scale[1] + trans[1]; - position[2] = position[2] * scale[2] + trans[2]; - - out = (struct vertex_header *)((char *)out + info->stride); - } - - return FALSE; -} - - -/* If bypass_clipping is set and we have an identity viewport, nothing - * to do. - */ -static boolean post_vs_none( struct pt_post_vs *pvs, - struct draw_vertex_info *info ) -{ - struct vertex_header *out = info->verts; - unsigned j; - - if (0) debug_printf("%s\n", __FUNCTION__); - /* just initialize the vertex_id in all headers */ - for (j = 0; j < info->count; j++) { - initialize_vertex_header(out); - - out = (struct vertex_header *)((char *)out + info->stride); - } - return FALSE; -} - boolean draw_pt_post_vs_run( struct pt_post_vs *pvs, struct draw_vertex_info *info ) { @@ -244,31 +117,72 @@ boolean draw_pt_post_vs_run( struct pt_post_vs *pvs, void draw_pt_post_vs_prepare( struct pt_post_vs *pvs, - boolean bypass_clipping, + boolean clip_xy, + boolean clip_z, + boolean clip_user, boolean bypass_viewport, boolean opengl, boolean need_edgeflags ) { - if (!need_edgeflags) { - if (bypass_clipping) { - if (bypass_viewport) - pvs->run = post_vs_none; - else - pvs->run = post_vs_viewport; - } - else { - /* if (opengl) */ - pvs->run = post_vs_cliptest_viewport_gl; - } + pvs->flags = 0; + + if (clip_xy) + pvs->flags |= DO_CLIP_XY; + + if (clip_z && opengl) { + pvs->flags |= DO_CLIP_FULL_Z; + ASSIGN_4V( pvs->draw->plane[4], 0, 0, 1, 1 ); + } + + if (clip_z && !opengl) { + pvs->flags |= DO_CLIP_HALF_Z; + ASSIGN_4V( pvs->draw->plane[4], 0, 0, 1, 0 ); } - else { - /* If we need to copy edgeflags to the vertex header, it should - * mean we're running the primitive pipeline. Hence the bypass - * flags should be false. - */ - assert(!bypass_clipping); - assert(!bypass_viewport); - pvs->run = post_vs_cliptest_viewport_gl_edgeflag; + + if (clip_user) + pvs->flags |= DO_CLIP_USER; + + if (!bypass_viewport) + pvs->flags |= DO_VIEWPORT; + + if (need_edgeflags) + pvs->flags |= DO_EDGEFLAG; + + /* Now select the relevant function: + */ + switch (pvs->flags) { + case 0: + pvs->run = do_cliptest_none; + break; + + case DO_CLIP_XY | DO_CLIP_FULL_Z | DO_VIEWPORT: + pvs->run = do_cliptest_xy_fullz_viewport; + break; + + case DO_CLIP_XY | DO_CLIP_HALF_Z | DO_VIEWPORT: + pvs->run = do_cliptest_xy_halfz_viewport; + break; + + case DO_CLIP_FULL_Z | DO_VIEWPORT: + pvs->run = do_cliptest_fullz_viewport; + break; + + case DO_CLIP_HALF_Z | DO_VIEWPORT: + pvs->run = do_cliptest_halfz_viewport; + break; + + case DO_CLIP_XY | DO_CLIP_FULL_Z | DO_CLIP_USER | DO_VIEWPORT: + pvs->run = do_cliptest_xy_fullz_user_viewport; + break; + + case (DO_CLIP_XY | DO_CLIP_FULL_Z | DO_CLIP_USER | + DO_VIEWPORT | DO_EDGEFLAG): + pvs->run = do_cliptest_xy_fullz_user_viewport_edgeflag; + break; + + default: + pvs->run = do_cliptest_generic; + break; } } diff --git a/src/gallium/drivers/r300/r300_context.c b/src/gallium/drivers/r300/r300_context.c index 852d88af54..05f7d09316 100644 --- a/src/gallium/drivers/r300/r300_context.c +++ b/src/gallium/drivers/r300/r300_context.c @@ -431,8 +431,6 @@ struct pipe_context* r300_create_context(struct pipe_screen* screen, r300->draw = draw_create(&r300->context); /* Enable our renderer. */ draw_set_rasterize_stage(r300->draw, r300_draw_stage(r300)); - /* Enable Draw's clipping. */ - draw_set_driver_clipping(r300->draw, FALSE); /* Disable converting points/lines to triangles. */ draw_wide_line_threshold(r300->draw, 10000000.f); draw_wide_point_threshold(r300->draw, 10000000.f); diff --git a/src/gallium/drivers/svga/svga_swtnl_draw.c b/src/gallium/drivers/svga/svga_swtnl_draw.c index e9eba3b422..814e8edd70 100644 --- a/src/gallium/drivers/svga/svga_swtnl_draw.c +++ b/src/gallium/drivers/svga/svga_swtnl_draw.c @@ -151,7 +151,8 @@ boolean svga_init_swtnl( struct svga_context *svga ) draw_install_aapoint_stage(svga->swtnl.draw, &svga->pipe); draw_install_pstipple_stage(svga->swtnl.draw, &svga->pipe); - draw_set_driver_clipping(svga->swtnl.draw, debug_get_bool_option("SVGA_SWTNL_FSE", FALSE)); + if (debug_get_bool_option("SVGA_SWTNL_FSE", FALSE)) + draw_set_driver_clipping(svga->swtnl.draw, TRUE, TRUE); return TRUE; -- cgit v1.2.3 From 285ea417ef5ee1027d1e8dd03b069cb157105bf7 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Fri, 20 Aug 2010 14:51:57 +0100 Subject: tgsi: helper for dumping tokens as hex --- src/gallium/auxiliary/tgsi/tgsi_parse.c | 27 ++++++++++++++++----------- src/gallium/auxiliary/tgsi/tgsi_parse.h | 11 +++++++++-- 2 files changed, 25 insertions(+), 13 deletions(-) (limited to 'src') diff --git a/src/gallium/auxiliary/tgsi/tgsi_parse.c b/src/gallium/auxiliary/tgsi/tgsi_parse.c index db9a342220..1891203abe 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_parse.c +++ b/src/gallium/auxiliary/tgsi/tgsi_parse.c @@ -282,17 +282,6 @@ tgsi_parse_token( } -unsigned -tgsi_num_tokens(const struct tgsi_token *tokens) -{ - struct tgsi_parse_context ctx; - if (tgsi_parse_init(&ctx, tokens) == TGSI_PARSE_OK) { - unsigned len = (ctx.FullHeader.Header.HeaderSize + - ctx.FullHeader.Header.BodySize); - return len; - } - return 0; -} /** @@ -319,3 +308,19 @@ tgsi_alloc_tokens(unsigned num_tokens) unsigned bytes = num_tokens * sizeof(struct tgsi_token); return (struct tgsi_token *) MALLOC(bytes); } + + +void +tgsi_dump_tokens(const struct tgsi_token *tokens) +{ + const unsigned *dwords = (const unsigned *)tokens; + int nr = tgsi_num_tokens(tokens); + int i; + + assert(sizeof(*tokens) == sizeof(unsigned)); + + debug_printf("const unsigned tokens[%d] = {\n", nr); + for (i = 0; i < nr; i++) + debug_printf("0x%08x,\n", dwords[i]); + debug_printf("};\n"); +} diff --git a/src/gallium/auxiliary/tgsi/tgsi_parse.h b/src/gallium/auxiliary/tgsi/tgsi_parse.h index 36de8807b4..bb2bb0d3d3 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_parse.h +++ b/src/gallium/auxiliary/tgsi/tgsi_parse.h @@ -132,8 +132,15 @@ void tgsi_parse_token( struct tgsi_parse_context *ctx ); -unsigned -tgsi_num_tokens(const struct tgsi_token *tokens); +static INLINE unsigned +tgsi_num_tokens(const struct tgsi_token *tokens) +{ + struct tgsi_header header = *(const struct tgsi_header *) tokens; + return header.HeaderSize + header.BodySize; +} + +void +tgsi_dump_tokens(const struct tgsi_token *tokens); struct tgsi_token * tgsi_dup_tokens(const struct tgsi_token *tokens); -- cgit v1.2.3 From b6e03eafe3311142445ca42c1574d3f6998eecc3 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Fri, 20 Aug 2010 15:14:19 +0100 Subject: llvmpipe: fence debugging, add llvmpipe_finish --- src/gallium/drivers/llvmpipe/lp_context.c | 10 +++++++- src/gallium/drivers/llvmpipe/lp_debug.h | 2 ++ src/gallium/drivers/llvmpipe/lp_fence.c | 16 +++++++++++-- src/gallium/drivers/llvmpipe/lp_fence.h | 1 + src/gallium/drivers/llvmpipe/lp_flush.c | 38 ++++++++++++++---------------- src/gallium/drivers/llvmpipe/lp_flush.h | 13 +++++++--- src/gallium/drivers/llvmpipe/lp_query.c | 25 ++++---------------- src/gallium/drivers/llvmpipe/lp_screen.c | 2 ++ src/gallium/drivers/llvmpipe/lp_setup.c | 5 ++-- src/gallium/drivers/llvmpipe/lp_setup.h | 3 ++- src/gallium/drivers/llvmpipe/lp_state_fs.c | 15 ++---------- src/gallium/drivers/llvmpipe/lp_surface.c | 6 +++-- src/gallium/drivers/llvmpipe/lp_texture.c | 3 ++- 13 files changed, 74 insertions(+), 65 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/llvmpipe/lp_context.c b/src/gallium/drivers/llvmpipe/lp_context.c index 7543bd7b2b..086a2d5898 100644 --- a/src/gallium/drivers/llvmpipe/lp_context.c +++ b/src/gallium/drivers/llvmpipe/lp_context.c @@ -85,6 +85,14 @@ static void llvmpipe_destroy( struct pipe_context *pipe ) align_free( llvmpipe ); } +static void +do_flush( struct pipe_context *pipe, + unsigned flags, + struct pipe_fence_handle **fence) +{ + llvmpipe_flush(pipe, flags, fence, __FUNCTION__); +} + struct pipe_context * llvmpipe_create_context( struct pipe_screen *screen, void *priv ) @@ -109,7 +117,7 @@ llvmpipe_create_context( struct pipe_screen *screen, void *priv ) llvmpipe->pipe.destroy = llvmpipe_destroy; llvmpipe->pipe.set_framebuffer_state = llvmpipe_set_framebuffer_state; llvmpipe->pipe.clear = llvmpipe_clear; - llvmpipe->pipe.flush = llvmpipe_flush; + llvmpipe->pipe.flush = do_flush; llvmpipe_init_blend_funcs(llvmpipe); llvmpipe_init_clip_funcs(llvmpipe); diff --git a/src/gallium/drivers/llvmpipe/lp_debug.h b/src/gallium/drivers/llvmpipe/lp_debug.h index 92fb2b3ee5..a928ee38be 100644 --- a/src/gallium/drivers/llvmpipe/lp_debug.h +++ b/src/gallium/drivers/llvmpipe/lp_debug.h @@ -46,6 +46,8 @@ st_print_current(void); #define DEBUG_SHOW_TILES 0x200 #define DEBUG_SHOW_SUBTILES 0x400 #define DEBUG_COUNTERS 0x800 +#define DEBUG_SCENE 0x1000 +#define DEBUG_FENCE 0x2000 #ifdef DEBUG diff --git a/src/gallium/drivers/llvmpipe/lp_fence.c b/src/gallium/drivers/llvmpipe/lp_fence.c index f9805e5d68..4d549b0750 100644 --- a/src/gallium/drivers/llvmpipe/lp_fence.c +++ b/src/gallium/drivers/llvmpipe/lp_fence.c @@ -44,6 +44,7 @@ struct lp_fence * lp_fence_create(unsigned rank) { + static int fence_id; struct lp_fence *fence = CALLOC_STRUCT(lp_fence); pipe_reference_init(&fence->reference, 1); @@ -51,8 +52,12 @@ lp_fence_create(unsigned rank) pipe_mutex_init(fence->mutex); pipe_condvar_init(fence->signalled); + fence->id = fence_id++; fence->rank = rank; + if (LP_DEBUG & DEBUG_FENCE) + debug_printf("%s %d\n", __FUNCTION__, fence->id); + return fence; } @@ -61,6 +66,9 @@ lp_fence_create(unsigned rank) void lp_fence_destroy(struct lp_fence *fence) { + if (LP_DEBUG & DEBUG_FENCE) + debug_printf("%s %d\n", __FUNCTION__, fence->id); + pipe_mutex_destroy(fence->mutex); pipe_condvar_destroy(fence->signalled); FREE(fence); @@ -126,13 +134,17 @@ llvmpipe_fence_finish(struct pipe_screen *screen, void lp_fence_signal(struct lp_fence *fence) { + if (LP_DEBUG & DEBUG_FENCE) + debug_printf("%s %d\n", __FUNCTION__, fence->id); + pipe_mutex_lock(fence->mutex); fence->count++; assert(fence->count <= fence->rank); - LP_DBG(DEBUG_RAST, "%s count=%u rank=%u\n", __FUNCTION__, - fence->count, fence->rank); + if (LP_DEBUG & DEBUG_FENCE) + debug_printf("%s count=%u rank=%u\n", __FUNCTION__, + fence->count, fence->rank); pipe_condvar_signal(fence->signalled); diff --git a/src/gallium/drivers/llvmpipe/lp_fence.h b/src/gallium/drivers/llvmpipe/lp_fence.h index 13358fb99f..b80af5c654 100644 --- a/src/gallium/drivers/llvmpipe/lp_fence.h +++ b/src/gallium/drivers/llvmpipe/lp_fence.h @@ -41,6 +41,7 @@ struct pipe_screen; struct lp_fence { struct pipe_reference reference; + unsigned id; pipe_mutex mutex; pipe_condvar signalled; diff --git a/src/gallium/drivers/llvmpipe/lp_flush.c b/src/gallium/drivers/llvmpipe/lp_flush.c index 845292f4ab..040fe0ba9a 100644 --- a/src/gallium/drivers/llvmpipe/lp_flush.c +++ b/src/gallium/drivers/llvmpipe/lp_flush.c @@ -45,14 +45,15 @@ void llvmpipe_flush( struct pipe_context *pipe, unsigned flags, - struct pipe_fence_handle **fence ) + struct pipe_fence_handle **fence, + const char *reason) { struct llvmpipe_context *llvmpipe = llvmpipe_context(pipe); draw_flush(llvmpipe->draw); /* ask the setup module to flush */ - lp_setup_flush(llvmpipe->setup, flags, fence); + lp_setup_flush(llvmpipe->setup, flags, fence, reason); /* Enable to dump BMPs of the color/depth buffers each frame */ if (0) { @@ -76,6 +77,17 @@ llvmpipe_flush( struct pipe_context *pipe, } } +void +llvmpipe_finish( struct pipe_context *pipe, + const char *reason ) +{ + struct pipe_fence_handle *fence = NULL; + llvmpipe_flush(pipe, 0, &fence, reason); + if (fence) { + pipe->screen->fence_finish(pipe->screen, fence, 0); + pipe->screen->fence_reference(pipe->screen, &fence, NULL); + } +} /** * Flush context if necessary. @@ -93,7 +105,8 @@ llvmpipe_flush_resource(struct pipe_context *pipe, unsigned flush_flags, boolean read_only, boolean cpu_access, - boolean do_not_block) + boolean do_not_block, + const char *reason) { unsigned referenced; @@ -106,31 +119,16 @@ llvmpipe_flush_resource(struct pipe_context *pipe, /* * Flush and wait. */ - - struct pipe_fence_handle *fence = NULL; - if (do_not_block) return FALSE; - /* - * Do the unswizzling in parallel. - * - * XXX: Don't abuse the PIPE_FLUSH_FRAME flag for this. - */ - flush_flags |= PIPE_FLUSH_FRAME; - - llvmpipe_flush(pipe, flush_flags, &fence); - - if (fence) { - pipe->screen->fence_finish(pipe->screen, fence, 0); - pipe->screen->fence_reference(pipe->screen, &fence, NULL); - } + llvmpipe_finish(pipe, reason); } else { /* * Just flush. */ - llvmpipe_flush(pipe, flush_flags, NULL); + llvmpipe_flush(pipe, flush_flags, NULL, reason); } } diff --git a/src/gallium/drivers/llvmpipe/lp_flush.h b/src/gallium/drivers/llvmpipe/lp_flush.h index 7b605681a9..bb538b2bd8 100644 --- a/src/gallium/drivers/llvmpipe/lp_flush.h +++ b/src/gallium/drivers/llvmpipe/lp_flush.h @@ -34,8 +34,14 @@ struct pipe_context; struct pipe_fence_handle; void -llvmpipe_flush(struct pipe_context *pipe, unsigned flags, - struct pipe_fence_handle **fence); +llvmpipe_flush(struct pipe_context *pipe, + unsigned flags, + struct pipe_fence_handle **fence, + const char *reason); + +void +llvmpipe_finish( struct pipe_context *pipe, + const char *reason ); boolean llvmpipe_flush_resource(struct pipe_context *pipe, @@ -45,6 +51,7 @@ llvmpipe_flush_resource(struct pipe_context *pipe, unsigned flush_flags, boolean read_only, boolean cpu_access, - boolean do_not_block); + boolean do_not_block, + const char *reason); #endif diff --git a/src/gallium/drivers/llvmpipe/lp_query.c b/src/gallium/drivers/llvmpipe/lp_query.c index 02eeaf6487..540eea7fd1 100644 --- a/src/gallium/drivers/llvmpipe/lp_query.c +++ b/src/gallium/drivers/llvmpipe/lp_query.c @@ -35,9 +35,9 @@ #include "util/u_memory.h" #include "lp_context.h" #include "lp_flush.h" +#include "lp_fence.h" #include "lp_query.h" #include "lp_rast.h" -#include "lp_rast_priv.h" #include "lp_state.h" @@ -69,12 +69,7 @@ llvmpipe_destroy_query(struct pipe_context *pipe, struct pipe_query *q) struct llvmpipe_query *pq = llvmpipe_query(q); /* query might still be in process if we never waited for the result */ if (!pq->done) { - struct pipe_fence_handle *fence = NULL; - llvmpipe_flush(pipe, 0, &fence); - if (fence) { - pipe->screen->fence_finish(pipe->screen, fence, 0); - pipe->screen->fence_reference(pipe->screen, &fence, NULL); - } + llvmpipe_finish(pipe, __FUNCTION__); } pipe_mutex_destroy(pq->mutex); @@ -93,16 +88,11 @@ llvmpipe_get_query_result(struct pipe_context *pipe, if (!pq->done) { if (wait) { - struct pipe_fence_handle *fence = NULL; - llvmpipe_flush(pipe, 0, &fence); - if (fence) { - pipe->screen->fence_finish(pipe->screen, fence, 0); - pipe->screen->fence_reference(pipe->screen, &fence, NULL); - } + llvmpipe_finish(pipe, __FUNCTION__); } /* this is a bit inconsequent but should be ok */ else { - llvmpipe_flush(pipe, 0, NULL); + llvmpipe_flush(pipe, 0, NULL, __FUNCTION__); } } @@ -125,12 +115,7 @@ llvmpipe_begin_query(struct pipe_context *pipe, struct pipe_query *q) * frame of rendering. */ if (pq->binned) { - struct pipe_fence_handle *fence; - llvmpipe_flush(pipe, 0, &fence); - if (fence) { - pipe->screen->fence_finish(pipe->screen, fence, 0); - pipe->screen->fence_reference(pipe->screen, &fence, NULL); - } + llvmpipe_finish(pipe, __FUNCTION__); } lp_setup_begin_query(llvmpipe->setup, pq); diff --git a/src/gallium/drivers/llvmpipe/lp_screen.c b/src/gallium/drivers/llvmpipe/lp_screen.c index 6968cda629..14a156378a 100644 --- a/src/gallium/drivers/llvmpipe/lp_screen.c +++ b/src/gallium/drivers/llvmpipe/lp_screen.c @@ -61,6 +61,8 @@ static const struct debug_named_value lp_debug_flags[] = { { "show_tiles", DEBUG_SHOW_TILES, NULL }, { "show_subtiles", DEBUG_SHOW_SUBTILES, NULL }, { "counters", DEBUG_COUNTERS, NULL }, + { "scene", DEBUG_SCENE, NULL }, + { "fence", DEBUG_FENCE, NULL }, DEBUG_NAMED_VALUE_END }; #endif diff --git a/src/gallium/drivers/llvmpipe/lp_setup.c b/src/gallium/drivers/llvmpipe/lp_setup.c index 556e571585..6eede83bfb 100644 --- a/src/gallium/drivers/llvmpipe/lp_setup.c +++ b/src/gallium/drivers/llvmpipe/lp_setup.c @@ -275,9 +275,10 @@ set_scene_state( struct lp_setup_context *setup, void lp_setup_flush( struct lp_setup_context *setup, unsigned flags, - struct pipe_fence_handle **fence) + struct pipe_fence_handle **fence, + const char *reason) { - LP_DBG(DEBUG_SETUP, "%s\n", __FUNCTION__); + LP_DBG(DEBUG_SETUP, "%s %s\n", __FUNCTION__, reason); if (setup->scene) { if (fence) { diff --git a/src/gallium/drivers/llvmpipe/lp_setup.h b/src/gallium/drivers/llvmpipe/lp_setup.h index 73b1c85325..a41bb8863b 100644 --- a/src/gallium/drivers/llvmpipe/lp_setup.h +++ b/src/gallium/drivers/llvmpipe/lp_setup.h @@ -85,7 +85,8 @@ lp_setup_fence( struct lp_setup_context *setup ); void lp_setup_flush( struct lp_setup_context *setup, unsigned flags, - struct pipe_fence_handle **fence); + struct pipe_fence_handle **fence, + const char *reason); void diff --git a/src/gallium/drivers/llvmpipe/lp_state_fs.c b/src/gallium/drivers/llvmpipe/lp_state_fs.c index 35ef63389c..33c1a49efe 100644 --- a/src/gallium/drivers/llvmpipe/lp_state_fs.c +++ b/src/gallium/drivers/llvmpipe/lp_state_fs.c @@ -927,7 +927,6 @@ static void llvmpipe_delete_fs_state(struct pipe_context *pipe, void *fs) { struct llvmpipe_context *llvmpipe = llvmpipe_context(pipe); - struct pipe_fence_handle *fence = NULL; struct lp_fragment_shader *shader = fs; struct lp_fs_variant_list_item *li; @@ -940,12 +939,7 @@ llvmpipe_delete_fs_state(struct pipe_context *pipe, void *fs) * Flushing alone might not sufficient we need to wait on it too. */ - llvmpipe_flush(pipe, 0, &fence); - - if (fence) { - pipe->screen->fence_finish(pipe->screen, fence, 0); - pipe->screen->fence_reference(pipe->screen, &fence, NULL); - } + llvmpipe_finish(pipe, __FUNCTION__); li = first_elem(&shader->variants); while(!at_end(&shader->variants, li)) { @@ -1148,19 +1142,14 @@ llvmpipe_update_fs(struct llvmpipe_context *lp) unsigned i; if (lp->nr_fs_variants >= LP_MAX_SHADER_VARIANTS) { struct pipe_context *pipe = &lp->pipe; - struct pipe_fence_handle *fence = NULL; /* * XXX: we need to flush the context until we have some sort of reference * counting in fragment shaders as they may still be binned * Flushing alone might not be sufficient we need to wait on it too. */ - llvmpipe_flush(pipe, 0, &fence); + llvmpipe_finish(pipe, __FUNCTION__); - if (fence) { - pipe->screen->fence_finish(pipe->screen, fence, 0); - pipe->screen->fence_reference(pipe->screen, &fence, NULL); - } for (i = 0; i < LP_MAX_SHADER_VARIANTS / 4; i++) { struct lp_fs_variant_list_item *item = last_elem(&lp->fs_variants_list); remove_shader_variant(lp, item->base); diff --git a/src/gallium/drivers/llvmpipe/lp_surface.c b/src/gallium/drivers/llvmpipe/lp_surface.c index f761e82850..63ddc669c2 100644 --- a/src/gallium/drivers/llvmpipe/lp_surface.c +++ b/src/gallium/drivers/llvmpipe/lp_surface.c @@ -68,14 +68,16 @@ lp_resource_copy(struct pipe_context *pipe, 0, /* flush_flags */ FALSE, /* read_only */ TRUE, /* cpu_access */ - FALSE); /* do_not_block */ + FALSE, + "blit dst"); /* do_not_block */ llvmpipe_flush_resource(pipe, src, subsrc.face, subsrc.level, 0, /* flush_flags */ TRUE, /* read_only */ TRUE, /* cpu_access */ - FALSE); /* do_not_block */ + FALSE, + "blit src"); /* do_not_block */ /* printf("surface copy from %u to %u: %u,%u to %u,%u %u x %u\n", diff --git a/src/gallium/drivers/llvmpipe/lp_texture.c b/src/gallium/drivers/llvmpipe/lp_texture.c index ff4773fd7c..5832ea2744 100644 --- a/src/gallium/drivers/llvmpipe/lp_texture.c +++ b/src/gallium/drivers/llvmpipe/lp_texture.c @@ -584,7 +584,8 @@ llvmpipe_get_transfer(struct pipe_context *pipe, 0, /* flush_flags */ read_only, TRUE, /* cpu_access */ - do_not_block)) { + do_not_block, + "transfer dest")) { /* * It would have blocked, but state tracker requested no to. */ -- cgit v1.2.3 From 1e926fe42a9780fd5e6574df2014a75d4af1101d Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Fri, 20 Aug 2010 15:15:36 +0100 Subject: llvmpipe: wake all threads waiting on a fence --- src/gallium/drivers/llvmpipe/lp_fence.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/drivers/llvmpipe/lp_fence.c b/src/gallium/drivers/llvmpipe/lp_fence.c index 4d549b0750..1f96dcd81a 100644 --- a/src/gallium/drivers/llvmpipe/lp_fence.c +++ b/src/gallium/drivers/llvmpipe/lp_fence.c @@ -146,7 +146,9 @@ lp_fence_signal(struct lp_fence *fence) debug_printf("%s count=%u rank=%u\n", __FUNCTION__, fence->count, fence->rank); - pipe_condvar_signal(fence->signalled); + /* Wakeup all threads waiting on the mutex: + */ + pipe_condvar_broadcast(fence->signalled); pipe_mutex_unlock(fence->mutex); } -- cgit v1.2.3 From 5a45e53df4419fde1fe7696f3a9459893363f7c5 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Fri, 20 Aug 2010 15:25:27 +0100 Subject: llvmpipe: move some fence functions into lp_screen.c --- src/gallium/drivers/llvmpipe/lp_fence.c | 73 ++++++++------------------------ src/gallium/drivers/llvmpipe/lp_fence.h | 12 ++++++ src/gallium/drivers/llvmpipe/lp_screen.c | 49 ++++++++++++++++++++- src/gallium/drivers/llvmpipe/lp_setup.c | 2 + 4 files changed, 79 insertions(+), 57 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/llvmpipe/lp_fence.c b/src/gallium/drivers/llvmpipe/lp_fence.c index 1f96dcd81a..3a55e76bc3 100644 --- a/src/gallium/drivers/llvmpipe/lp_fence.c +++ b/src/gallium/drivers/llvmpipe/lp_fence.c @@ -75,58 +75,6 @@ lp_fence_destroy(struct lp_fence *fence) } -/** - * For reference counting. - * This is a Gallium API function. - */ -static void -llvmpipe_fence_reference(struct pipe_screen *screen, - struct pipe_fence_handle **ptr, - struct pipe_fence_handle *fence) -{ - struct lp_fence **old = (struct lp_fence **) ptr; - struct lp_fence *f = (struct lp_fence *) fence; - - lp_fence_reference(old, f); -} - - -/** - * Has the fence been executed/finished? - * This is a Gallium API function. - */ -static int -llvmpipe_fence_signalled(struct pipe_screen *screen, - struct pipe_fence_handle *fence, - unsigned flag) -{ - struct lp_fence *f = (struct lp_fence *) fence; - - return f->count == f->rank; -} - - -/** - * Wait for the fence to finish. - * This is a Gallium API function. - */ -static int -llvmpipe_fence_finish(struct pipe_screen *screen, - struct pipe_fence_handle *fence_handle, - unsigned flag) -{ - struct lp_fence *fence = (struct lp_fence *) fence_handle; - - pipe_mutex_lock(fence->mutex); - while (fence->count < fence->rank) { - pipe_condvar_wait(fence->signalled, fence->mutex); - } - pipe_mutex_unlock(fence->mutex); - - return 0; -} - - /** * Called by the rendering threads to increment the fence counter. * When the counter == the rank, the fence is finished. @@ -153,11 +101,24 @@ lp_fence_signal(struct lp_fence *fence) pipe_mutex_unlock(fence->mutex); } +boolean +lp_fence_signalled(struct lp_fence *f) +{ + return f->count == f->rank; +} void -llvmpipe_init_screen_fence_funcs(struct pipe_screen *screen) +lp_fence_wait(struct lp_fence *f) { - screen->fence_reference = llvmpipe_fence_reference; - screen->fence_signalled = llvmpipe_fence_signalled; - screen->fence_finish = llvmpipe_fence_finish; + if (LP_DEBUG & DEBUG_FENCE) + debug_printf("%s %d\n", __FUNCTION__, f->id); + + pipe_mutex_lock(f->mutex); + assert(f->issued); + while (f->count < f->rank) { + pipe_condvar_wait(f->signalled, f->mutex); + } + pipe_mutex_unlock(f->mutex); } + + diff --git a/src/gallium/drivers/llvmpipe/lp_fence.h b/src/gallium/drivers/llvmpipe/lp_fence.h index b80af5c654..3c59118780 100644 --- a/src/gallium/drivers/llvmpipe/lp_fence.h +++ b/src/gallium/drivers/llvmpipe/lp_fence.h @@ -46,6 +46,7 @@ struct lp_fence pipe_mutex mutex; pipe_condvar signalled; + boolean issued; unsigned rank; unsigned count; }; @@ -58,6 +59,11 @@ lp_fence_create(unsigned rank); void lp_fence_signal(struct lp_fence *fence); +boolean +lp_fence_signalled(struct lp_fence *fence); + +void +lp_fence_wait(struct lp_fence *fence); void llvmpipe_init_screen_fence_funcs(struct pipe_screen *screen); @@ -79,5 +85,11 @@ lp_fence_reference(struct lp_fence **ptr, *ptr = f; } +static INLINE boolean +lp_fence_issued(const struct lp_fence *fence) +{ + return fence->issued; +} + #endif /* LP_FENCE_H */ diff --git a/src/gallium/drivers/llvmpipe/lp_screen.c b/src/gallium/drivers/llvmpipe/lp_screen.c index 14a156378a..9b7e0d51cd 100644 --- a/src/gallium/drivers/llvmpipe/lp_screen.c +++ b/src/gallium/drivers/llvmpipe/lp_screen.c @@ -317,6 +317,51 @@ llvmpipe_destroy_screen( struct pipe_screen *_screen ) + +/** + * Fence reference counting. + */ +static void +llvmpipe_fence_reference(struct pipe_screen *screen, + struct pipe_fence_handle **ptr, + struct pipe_fence_handle *fence) +{ + struct lp_fence **old = (struct lp_fence **) ptr; + struct lp_fence *f = (struct lp_fence *) fence; + + lp_fence_reference(old, f); +} + + +/** + * Has the fence been executed/finished? + */ +static int +llvmpipe_fence_signalled(struct pipe_screen *screen, + struct pipe_fence_handle *fence, + unsigned flag) +{ + struct lp_fence *f = (struct lp_fence *) fence; + return lp_fence_signalled(f); +} + + +/** + * Wait for the fence to finish. + */ +static int +llvmpipe_fence_finish(struct pipe_screen *screen, + struct pipe_fence_handle *fence_handle, + unsigned flag) +{ + struct lp_fence *f = (struct lp_fence *) fence_handle; + + lp_fence_wait(f); + return 0; +} + + + /** * Create a new pipe_screen object * Note: we're not presently subclassing pipe_screen (no llvmpipe_screen). @@ -354,9 +399,11 @@ llvmpipe_create_screen(struct sw_winsys *winsys) screen->base.context_create = llvmpipe_create_context; screen->base.flush_frontbuffer = llvmpipe_flush_frontbuffer; + screen->base.fence_reference = llvmpipe_fence_reference; + screen->base.fence_signalled = llvmpipe_fence_signalled; + screen->base.fence_finish = llvmpipe_fence_finish; llvmpipe_init_screen_resource_funcs(&screen->base); - llvmpipe_init_screen_fence_funcs(&screen->base); lp_jit_screen_init(screen); diff --git a/src/gallium/drivers/llvmpipe/lp_setup.c b/src/gallium/drivers/llvmpipe/lp_setup.c index 6eede83bfb..5389de8b63 100644 --- a/src/gallium/drivers/llvmpipe/lp_setup.c +++ b/src/gallium/drivers/llvmpipe/lp_setup.c @@ -288,6 +288,8 @@ lp_setup_flush( struct lp_setup_context *setup, *fence = lp_setup_fence( setup ); } + if (setup->scene->fence) + setup->scene->fence->issued = TRUE; } set_scene_state( setup, SETUP_FLUSHED ); -- cgit v1.2.3 From 98f3ff8f4a761d579ee9b42ee3090635519213a5 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Fri, 20 Aug 2010 15:45:25 +0100 Subject: llvmpipe: more rasterization counters --- src/gallium/drivers/llvmpipe/lp_perf.c | 21 +++++++++++++++------ src/gallium/drivers/llvmpipe/lp_perf.h | 7 +++++++ src/gallium/drivers/llvmpipe/lp_rast_tri_tmp.h | 7 +++++++ 3 files changed, 29 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/llvmpipe/lp_perf.c b/src/gallium/drivers/llvmpipe/lp_perf.c index 083e7e30a5..e22532f25c 100644 --- a/src/gallium/drivers/llvmpipe/lp_perf.c +++ b/src/gallium/drivers/llvmpipe/lp_perf.c @@ -46,7 +46,7 @@ lp_print_counters(void) { if (LP_DEBUG & DEBUG_COUNTERS) { unsigned total_64, total_16, total_4; - float p1, p2, p3, p4; + float p1, p2, p3, p5, p6; debug_printf("llvmpipe: nr_triangles: %9u\n", lp_count.nr_tris); debug_printf("llvmpipe: nr_culled_triangles: %9u\n", lp_count.nr_culled_tris); @@ -58,11 +58,15 @@ lp_print_counters(void) p1 = 100.0 * (float) lp_count.nr_empty_64 / (float) total_64; p2 = 100.0 * (float) lp_count.nr_fully_covered_64 / (float) total_64; p3 = 100.0 * (float) lp_count.nr_partially_covered_64 / (float) total_64; - p4 = 100.0 * (float) lp_count.nr_shade_opaque_64 / (float) total_64; + p5 = 100.0 * (float) lp_count.nr_shade_opaque_64 / (float) total_64; + p6 = 100.0 * (float) lp_count.nr_shade_64 / (float) total_64; debug_printf("llvmpipe: nr_64x64: %9u\n", total_64); debug_printf("llvmpipe: nr_fully_covered_64x64: %9u (%3.0f%% of %u)\n", lp_count.nr_fully_covered_64, p2, total_64); - debug_printf("llvmpipe: nr_shade_opaque_64x64: %9u (%3.0f%% of %u)\n", lp_count.nr_shade_opaque_64, p4, total_64); + debug_printf("llvmpipe: nr_shade_opaque_64x64: %9u (%3.0f%% of %u)\n", lp_count.nr_shade_opaque_64, p5, total_64); + debug_printf("llvmpipe: nr_pure_shade_opaque: %9u (%3.0f%% of %u)\n", lp_count.nr_pure_shade_opaque_64, 0.0, lp_count.nr_shade_opaque_64); + debug_printf("llvmpipe: nr_shade_64x64: %9u (%3.0f%% of %u)\n", lp_count.nr_shade_64, p6, total_64); + debug_printf("llvmpipe: nr_pure_shade: %9u (%3.0f%% of %u)\n", lp_count.nr_pure_shade_64, 0.0, lp_count.nr_shade_64); debug_printf("llvmpipe: nr_partially_covered_64x64: %9u (%3.0f%% of %u)\n", lp_count.nr_partially_covered_64, p3, total_64); debug_printf("llvmpipe: nr_empty_64x64: %9u (%3.0f%% of %u)\n", lp_count.nr_empty_64, p1, total_64); @@ -79,12 +83,17 @@ lp_print_counters(void) debug_printf("llvmpipe: nr_partially_covered_16x16: %9u (%3.0f%% of %u)\n", lp_count.nr_partially_covered_16, p3, total_16); debug_printf("llvmpipe: nr_empty_16x16: %9u (%3.0f%% of %u)\n", lp_count.nr_empty_16, p1, total_16); - total_4 = (lp_count.nr_empty_4 + lp_count.nr_non_empty_4); + total_4 = (lp_count.nr_empty_4 + + lp_count.nr_fully_covered_4 + + lp_count.nr_partially_covered_4); p1 = 100.0 * (float) lp_count.nr_empty_4 / (float) total_4; - p2 = 100.0 * (float) lp_count.nr_non_empty_4 / (float) total_4; + p2 = 100.0 * (float) lp_count.nr_fully_covered_4 / (float) total_4; + p3 = 100.0 * (float) lp_count.nr_partially_covered_4 / (float) total_4; - debug_printf("llvmpipe: nr_4x4: %9u\n", total_4); + debug_printf("llvmpipe: nr_tri_4x4: %9u\n", total_4); + debug_printf("llvmpipe: nr_fully_covered_4x4: %9u (%3.0f%% of %u)\n", lp_count.nr_fully_covered_4, p2, total_4); + debug_printf("llvmpipe: nr_partially_covered_4x4: %9u (%3.0f%% of %u)\n", lp_count.nr_partially_covered_4, p3, total_4); debug_printf("llvmpipe: nr_empty_4x4: %9u (%3.0f%% of %u)\n", lp_count.nr_empty_4, p1, total_4); debug_printf("llvmpipe: nr_non_empty_4x4: %9u (%3.0f%% of %u)\n", lp_count.nr_non_empty_4, p2, total_4); diff --git a/src/gallium/drivers/llvmpipe/lp_perf.h b/src/gallium/drivers/llvmpipe/lp_perf.h index 4774f64550..c28652fc30 100644 --- a/src/gallium/drivers/llvmpipe/lp_perf.h +++ b/src/gallium/drivers/llvmpipe/lp_perf.h @@ -44,11 +44,16 @@ struct lp_counters unsigned nr_empty_64; unsigned nr_fully_covered_64; unsigned nr_partially_covered_64; + unsigned nr_pure_shade_opaque_64; + unsigned nr_pure_shade_64; + unsigned nr_shade_64; unsigned nr_shade_opaque_64; unsigned nr_empty_16; unsigned nr_fully_covered_16; unsigned nr_partially_covered_16; unsigned nr_empty_4; + unsigned nr_fully_covered_4; + unsigned nr_partially_covered_4; unsigned nr_non_empty_4; unsigned nr_llvm_compiles; int64_t llvm_compile_time; /**< total, in microseconds */ @@ -66,9 +71,11 @@ extern struct lp_counters lp_count; #ifdef DEBUG #define LP_COUNT(counter) lp_count.counter++ #define LP_COUNT_ADD(counter, incr) lp_count.counter += (incr) +#define LP_COUNT_GET(counter) (lp_count.counter) #else #define LP_COUNT(counter) #define LP_COUNT_ADD(counter, incr) (void) incr +#define LP_COUNT_GET(counter) 0 #endif diff --git a/src/gallium/drivers/llvmpipe/lp_rast_tri_tmp.h b/src/gallium/drivers/llvmpipe/lp_rast_tri_tmp.h index 43f72d8ca8..70a4b64c8d 100644 --- a/src/gallium/drivers/llvmpipe/lp_rast_tri_tmp.h +++ b/src/gallium/drivers/llvmpipe/lp_rast_tri_tmp.h @@ -102,6 +102,8 @@ TAG(do_block_16)(struct lp_rasterizer_task *task, assert((partial_mask & inmask) == 0); + LP_COUNT_ADD(nr_empty_4, util_bitcount(0xffff & ~(partial_mask | inmask))); + /* Iterate over partials: */ while (partial_mask) { @@ -114,6 +116,8 @@ TAG(do_block_16)(struct lp_rasterizer_task *task, partial_mask &= ~(1 << i); + LP_COUNT(nr_partially_covered_4); + for (j = 0; j < NR_PLANES; j++) cx[j] = (c[j] - plane[j].dcdx * ix @@ -133,6 +137,7 @@ TAG(do_block_16)(struct lp_rasterizer_task *task, inmask &= ~(1 << i); + LP_COUNT(nr_fully_covered_4); block_full_4(task, tri, px, py); } } @@ -190,6 +195,8 @@ TAG(lp_rast_triangle)(struct lp_rasterizer_task *task, assert((partial_mask & inmask) == 0); + LP_COUNT_ADD(nr_empty_16, util_bitcount(0xffff & ~(partial_mask | inmask))); + /* Iterate over partials: */ while (partial_mask) { -- cgit v1.2.3 From c25151dd6a06acd93c8bf0d9e79fdcf134ffe818 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Fri, 20 Aug 2010 16:18:23 +0100 Subject: llvmpipe: cull zero-area triangles early --- src/gallium/drivers/llvmpipe/lp_setup_tri.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/llvmpipe/lp_setup_tri.c b/src/gallium/drivers/llvmpipe/lp_setup_tri.c index 614a6372b4..b4325390fe 100644 --- a/src/gallium/drivers/llvmpipe/lp_setup_tri.c +++ b/src/gallium/drivers/llvmpipe/lp_setup_tri.c @@ -819,9 +819,10 @@ static void triangle_both( struct lp_setup_context *setup, const float fy = v1[0][1] - v2[0][1]; /* det = cross(e,f).z */ - if (ex * fy - ey * fx < 0.0f) + const float det = ex * fy - ey * fx; + if (det < 0.0f) triangle_ccw( setup, v0, v1, v2 ); - else + else if (det > 0.0f) triangle_cw( setup, v0, v1, v2 ); } -- cgit v1.2.3 From d808f7b53ec71a7684bac7e6b536911fc27d5238 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Tue, 24 Aug 2010 19:58:54 +0100 Subject: llvmpipe: better triangle debugging --- src/gallium/drivers/llvmpipe/lp_setup_context.h | 12 ++++ src/gallium/drivers/llvmpipe/lp_setup_tri.c | 74 ++++++++++++++++++------- 2 files changed, 67 insertions(+), 19 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/llvmpipe/lp_setup_context.h b/src/gallium/drivers/llvmpipe/lp_setup_context.h index a0606f5034..102361cca3 100644 --- a/src/gallium/drivers/llvmpipe/lp_setup_context.h +++ b/src/gallium/drivers/llvmpipe/lp_setup_context.h @@ -158,4 +158,16 @@ void lp_setup_update_state( struct lp_setup_context *setup ); void lp_setup_destroy( struct lp_setup_context *setup ); +void +lp_setup_print_triangle(struct lp_setup_context *setup, + const float (*v0)[4], + const float (*v1)[4], + const float (*v2)[4]); + +void +lp_setup_print_vertex(struct lp_setup_context *setup, + const char *name, + const float (*v)[4]); + #endif + diff --git a/src/gallium/drivers/llvmpipe/lp_setup_tri.c b/src/gallium/drivers/llvmpipe/lp_setup_tri.c index b4325390fe..d6c837d8d4 100644 --- a/src/gallium/drivers/llvmpipe/lp_setup_tri.c +++ b/src/gallium/drivers/llvmpipe/lp_setup_tri.c @@ -357,31 +357,67 @@ alloc_triangle(struct lp_scene *scene, return tri; } +void +lp_setup_print_vertex(struct lp_setup_context *setup, + const char *name, + const float (*v)[4]) +{ + int i, j; + + debug_printf(" wpos (%s[0]) xyzw %f %f %f %f\n", + name, + v[0][0], v[0][1], v[0][2], v[0][3]); + + for (i = 0; i < setup->fs.nr_inputs; i++) { + const float *in = v[setup->fs.input[i].src_index]; + + debug_printf(" in[%d] (%s[%d]) %s%s%s%s ", + i, + name, setup->fs.input[i].src_index, + (setup->fs.input[i].usage_mask & 0x1) ? "x" : " ", + (setup->fs.input[i].usage_mask & 0x2) ? "y" : " ", + (setup->fs.input[i].usage_mask & 0x4) ? "z" : " ", + (setup->fs.input[i].usage_mask & 0x8) ? "w" : " "); + + for (j = 0; j < 4; j++) + if (setup->fs.input[i].usage_mask & (1<fs.nr_inputs; i++) { - debug_printf(" v1[%d]: %f %f %f %f\n", i, - v1[i][0], v1[i][1], v1[i][2], v1[i][3]); - } - for (i = 0; i < 1 + setup->fs.nr_inputs; i++) { - debug_printf(" v2[%d]: %f %f %f %f\n", i, - v2[i][0], v2[i][1], v2[i][2], v2[i][3]); - } - for (i = 0; i < 1 + setup->fs.nr_inputs; i++) { - debug_printf(" v3[%d]: %f %f %f %f\n", i, - v3[i][0], v3[i][1], v3[i][2], v3[i][3]); + { + const float ex = v0[0][0] - v2[0][0]; + const float ey = v0[0][1] - v2[0][1]; + const float fx = v1[0][0] - v2[0][0]; + const float fy = v1[0][1] - v2[0][1]; + + /* det = cross(e,f).z */ + const float det = ex * fy - ey * fx; + if (det < 0.0f) + debug_printf(" - ccw\n"); + else if (det > 0.0f) + debug_printf(" - cw\n"); + else + debug_printf(" - zero area\n"); } + + lp_setup_print_vertex(setup, "v0", v0); + lp_setup_print_vertex(setup, "v1", v1); + lp_setup_print_vertex(setup, "v2", v2); } @@ -421,7 +457,7 @@ do_triangle_ccw(struct lp_setup_context *setup, int nr_planes = 3; if (0) - print_triangle(setup, v1, v2, v3); + lp_setup_print_triangle(setup, v1, v2, v3); if (setup->scissor_test) { nr_planes = 7; -- cgit v1.2.3 From 29bcbf5e797a18430285c75abb8a9300c8defe1d Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Tue, 24 Aug 2010 20:04:08 +0100 Subject: llvmpipe: track drawing region as a single u_rect --- src/gallium/drivers/llvmpipe/lp_setup.c | 29 ++++-- src/gallium/drivers/llvmpipe/lp_setup_context.h | 7 +- src/gallium/drivers/llvmpipe/lp_setup_tri.c | 113 ++++++++++++------------ 3 files changed, 86 insertions(+), 63 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/llvmpipe/lp_setup.c b/src/gallium/drivers/llvmpipe/lp_setup.c index 5389de8b63..0c6d2de193 100644 --- a/src/gallium/drivers/llvmpipe/lp_setup.c +++ b/src/gallium/drivers/llvmpipe/lp_setup.c @@ -315,6 +315,11 @@ lp_setup_bind_framebuffer( struct lp_setup_context *setup, * scene. */ util_copy_framebuffer_state(&setup->fb, fb); + setup->framebuffer.x0 = 0; + setup->framebuffer.y0 = 0; + setup->framebuffer.x1 = fb->width-1; + setup->framebuffer.y1 = fb->height-1; + setup->dirty |= LP_SETUP_NEW_SCISSOR; } @@ -472,8 +477,12 @@ lp_setup_set_triangle_state( struct lp_setup_context *setup, setup->ccw_is_frontface = ccw_is_frontface; setup->cullmode = cull_mode; setup->triangle = first_triangle; - setup->scissor_test = scissor; setup->pixel_offset = gl_rasterization_rules ? 0.5f : 0.0f; + + if (setup->scissor_test != scissor) { + setup->dirty |= LP_SETUP_NEW_SCISSOR; + setup->scissor_test = scissor; + } } @@ -562,10 +571,11 @@ lp_setup_set_scissor( struct lp_setup_context *setup, assert(scissor); - if (memcmp(&setup->scissor.current, scissor, sizeof(*scissor)) != 0) { - setup->scissor.current = *scissor; /* struct copy */ - setup->dirty |= LP_SETUP_NEW_SCISSOR; - } + setup->scissor.x0 = scissor->minx; + setup->scissor.x1 = scissor->maxx-1; + setup->scissor.y0 = scissor->miny; + setup->scissor.y1 = scissor->maxy-1; + setup->dirty |= LP_SETUP_NEW_SCISSOR; } @@ -805,6 +815,15 @@ lp_setup_update_state( struct lp_setup_context *setup ) for (i = 0; i < Elements(setup->fs.current_tex); i++) { if (setup->fs.current_tex[i]) lp_scene_add_resource_reference(scene, setup->fs.current_tex[i]); + if (setup->dirty & LP_SETUP_NEW_SCISSOR) { + setup->draw_region = setup->framebuffer; + if (setup->scissor_test) { + u_rect_possible_intersection(&setup->scissor, + &setup->draw_region); + } + } + + } } } diff --git a/src/gallium/drivers/llvmpipe/lp_setup_context.h b/src/gallium/drivers/llvmpipe/lp_setup_context.h index 102361cca3..1a147e0353 100644 --- a/src/gallium/drivers/llvmpipe/lp_setup_context.h +++ b/src/gallium/drivers/llvmpipe/lp_setup_context.h @@ -41,6 +41,7 @@ #include "lp_scene.h" #include "draw/draw_vbuf.h" +#include "util/u_rect.h" #define LP_SETUP_NEW_FS 0x01 #define LP_SETUP_NEW_CONSTANTS 0x02 @@ -92,6 +93,9 @@ struct lp_setup_context float pixel_offset; struct pipe_framebuffer_state fb; + struct u_rect framebuffer; + struct u_rect scissor; + struct u_rect draw_region; /* intersection of fb & scissor */ struct { unsigned flags; @@ -127,9 +131,6 @@ struct lp_setup_context uint8_t *stored; } blend_color; - struct { - struct pipe_scissor_state current; - } scissor; unsigned dirty; /**< bitmask of LP_SETUP_NEW_x bits */ diff --git a/src/gallium/drivers/llvmpipe/lp_setup_tri.c b/src/gallium/drivers/llvmpipe/lp_setup_tri.c index d6c837d8d4..fe5c9358dd 100644 --- a/src/gallium/drivers/llvmpipe/lp_setup_tri.c +++ b/src/gallium/drivers/llvmpipe/lp_setup_tri.c @@ -31,6 +31,7 @@ #include "util/u_math.h" #include "util/u_memory.h" +#include "util/u_rect.h" #include "lp_perf.h" #include "lp_setup_context.h" #include "lp_rast.h" @@ -450,7 +451,7 @@ do_triangle_ccw(struct lp_setup_context *setup, struct lp_rast_triangle *tri; struct tri_info info; int area; - int minx, maxx, miny, maxy; + struct u_rect bbox; int ix0, ix1, iy0, iy1; unsigned tri_bytes; int i; @@ -466,6 +467,50 @@ do_triangle_ccw(struct lp_setup_context *setup, nr_planes = 3; } + /* x/y positions in fixed point */ + info.x[0] = subpixel_snap(v1[0][0] - setup->pixel_offset); + info.x[1] = subpixel_snap(v2[0][0] - setup->pixel_offset); + info.x[2] = subpixel_snap(v3[0][0] - setup->pixel_offset); + info.y[0] = subpixel_snap(v1[0][1] - setup->pixel_offset); + info.y[1] = subpixel_snap(v2[0][1] - setup->pixel_offset); + info.y[2] = subpixel_snap(v3[0][1] - setup->pixel_offset); + + + + /* Bounding rectangle (in pixels) */ + { + /* Yes this is necessary to accurately calculate bounding boxes + * with the two fill-conventions we support. GL (normally) ends + * up needing a bottom-left fill convention, which requires + * slightly different rounding. + */ + int adj = (setup->pixel_offset != 0) ? 1 : 0; + + bbox.x0 = (MIN3(info.x[0], info.x[1], info.x[2]) + (FIXED_ONE-1)) >> FIXED_ORDER; + bbox.x1 = (MAX3(info.x[0], info.x[1], info.x[2]) + (FIXED_ONE-1)) >> FIXED_ORDER; + bbox.y0 = (MIN3(info.y[0], info.y[1], info.y[2]) + (FIXED_ONE-1) + adj) >> FIXED_ORDER; + bbox.y1 = (MAX3(info.y[0], info.y[1], info.y[2]) + (FIXED_ONE-1) + adj) >> FIXED_ORDER; + + /* Inclusive coordinates: + */ + bbox.x1--; + bbox.y1--; + } + + if (bbox.x1 < bbox.x0 || + bbox.y1 < bbox.y0) { + if (0) debug_printf("empty bounding box\n"); + LP_COUNT(nr_culled_tris); + return; + } + + if (!u_rect_test_intersection(&setup->draw_region, &bbox)) { + if (0) debug_printf("offscreen\n"); + LP_COUNT(nr_culled_tris); + return; + } + + u_rect_find_intersection(&setup->draw_region, &bbox); tri = alloc_triangle(scene, setup->fs.nr_inputs, @@ -483,14 +528,6 @@ do_triangle_ccw(struct lp_setup_context *setup, tri->v[2][1] = v3[0][1]; #endif - /* x/y positions in fixed point */ - info.x[0] = subpixel_snap(v1[0][0] - setup->pixel_offset); - info.x[1] = subpixel_snap(v2[0][0] - setup->pixel_offset); - info.x[2] = subpixel_snap(v3[0][0] - setup->pixel_offset); - info.y[0] = subpixel_snap(v1[0][1] - setup->pixel_offset); - info.y[1] = subpixel_snap(v2[0][1] - setup->pixel_offset); - info.y[2] = subpixel_snap(v3[0][1] - setup->pixel_offset); - tri->plane[0].dcdy = info.x[0] - info.x[1]; tri->plane[1].dcdy = info.x[1] - info.x[2]; tri->plane[2].dcdy = info.x[2] - info.x[0]; @@ -514,40 +551,6 @@ do_triangle_ccw(struct lp_setup_context *setup, return; } - /* Bounding rectangle (in pixels) */ - { - /* Yes this is necessary to accurately calculate bounding boxes - * with the two fill-conventions we support. GL (normally) ends - * up needing a bottom-left fill convention, which requires - * slightly different rounding. - */ - int adj = (setup->pixel_offset != 0) ? 1 : 0; - - minx = (MIN3(info.x[0], info.x[1], info.x[2]) + (FIXED_ONE-1)) >> FIXED_ORDER; - maxx = (MAX3(info.x[0], info.x[1], info.x[2]) + (FIXED_ONE-1)) >> FIXED_ORDER; - miny = (MIN3(info.y[0], info.y[1], info.y[2]) + (FIXED_ONE-1) + adj) >> FIXED_ORDER; - maxy = (MAX3(info.y[0], info.y[1], info.y[2]) + (FIXED_ONE-1) + adj) >> FIXED_ORDER; - } - - if (setup->scissor_test) { - minx = MAX2(minx, setup->scissor.current.minx); - maxx = MIN2(maxx, setup->scissor.current.maxx); - miny = MAX2(miny, setup->scissor.current.miny); - maxy = MIN2(maxy, setup->scissor.current.maxy); - } - else { - minx = MAX2(minx, 0); - miny = MAX2(miny, 0); - maxx = MIN2(maxx, scene->fb.width); - maxy = MIN2(maxy, scene->fb.height); - } - - - if (miny >= maxy || minx >= maxx) { - lp_scene_putback_data( scene, tri_bytes ); - LP_COUNT(nr_culled_tris); - return; - } /* */ @@ -648,25 +651,25 @@ do_triangle_ccw(struct lp_setup_context *setup, if (nr_planes == 7) { tri->plane[3].dcdx = -1; tri->plane[3].dcdy = 0; - tri->plane[3].c = 1-minx; + tri->plane[3].c = 1-bbox.x0; tri->plane[3].ei = 0; tri->plane[3].eo = 1; tri->plane[4].dcdx = 1; tri->plane[4].dcdy = 0; - tri->plane[4].c = maxx; + tri->plane[4].c = bbox.x1+1; tri->plane[4].ei = -1; tri->plane[4].eo = 0; tri->plane[5].dcdx = 0; tri->plane[5].dcdy = 1; - tri->plane[5].c = 1-miny; + tri->plane[5].c = 1-bbox.y0; tri->plane[5].ei = 0; tri->plane[5].eo = 1; tri->plane[6].dcdx = 0; tri->plane[6].dcdy = -1; - tri->plane[6].c = maxy; + tri->plane[6].c = bbox.y1+1; tri->plane[6].ei = -1; tri->plane[6].eo = 0; } @@ -680,10 +683,10 @@ do_triangle_ccw(struct lp_setup_context *setup, /* Convert to tile coordinates, and inclusive ranges: */ if (nr_planes == 3) { - int ix0 = minx / 16; - int iy0 = miny / 16; - int ix1 = (maxx-1) / 16; - int iy1 = (maxy-1) / 16; + int ix0 = bbox.x0 / 16; + int iy0 = bbox.y0 / 16; + int ix1 = bbox.x1 / 16; + int iy1 = bbox.y1 / 16; if (iy0 == iy1 && ix0 == ix1) { @@ -699,10 +702,10 @@ do_triangle_ccw(struct lp_setup_context *setup, } } - ix0 = minx / TILE_SIZE; - iy0 = miny / TILE_SIZE; - ix1 = (maxx-1) / TILE_SIZE; - iy1 = (maxy-1) / TILE_SIZE; + ix0 = bbox.x0 / TILE_SIZE; + iy0 = bbox.y0 / TILE_SIZE; + ix1 = bbox.x1 / TILE_SIZE; + iy1 = bbox.y1 / TILE_SIZE; /* * Clamp to framebuffer size -- cgit v1.2.3 From b7a8893a2413adfddf4dc836676a19463fb6ffd7 Mon Sep 17 00:00:00 2001 From: Kristian Høgsberg Date: Fri, 4 Jun 2010 14:28:59 -0400 Subject: egl: Add EGL_MESA_drm_image extension Create EGLImages from DRM buffer handles. --- docs/MESA_drm_image.spec | 149 ++++++++++++++++++++++++++++++++++++++++++++++ include/EGL/eglext.h | 23 +++++++ src/egl/main/eglapi.c | 43 +++++++++++++ src/egl/main/eglapi.h | 10 ++++ src/egl/main/egldisplay.h | 1 + src/egl/main/eglmisc.c | 1 + 6 files changed, 227 insertions(+) create mode 100644 docs/MESA_drm_image.spec (limited to 'src') diff --git a/docs/MESA_drm_image.spec b/docs/MESA_drm_image.spec new file mode 100644 index 0000000000..118501c3d3 --- /dev/null +++ b/docs/MESA_drm_image.spec @@ -0,0 +1,149 @@ +Name + + MESA_drm_image + +Name Strings + + EGL_MESA_drm_image + +Contact + + Kristian Høgsberg + +Status + + Proposal + +Version + + Version 2, August 25, 2010 + +Number + + EGL Extension #not assigned + +Dependencies + + Reguires EGL 1.4 or later. This extension is written against the + wording of the EGL 1.4 specification. + + EGL_KHR_base_image is required. + +Overview + + This extension provides entry points for integrating EGLImage with the + Linux DRM mode setting and memory management drivers. The extension + lets applications create EGLImages without a client API resource and + lets the application get the DRM buffer handles. + +IP Status + + Open-source; freely implementable. + +New Procedures and Functions + + EGLImageKHR eglCreateDRMImageMESA(EGLDisplay dpy, + const EGLint *attrib_list); + + EGLBoolean eglExportDRMImageMESA(EGLDisplay dpy, + EGLImageKHR image, + EGLint *name, + EGLint *handle, + EGLint *stride); + +New Tokens + + Accepted in the parameter of eglCreateDRMImageMESA: + + EGL_DRM_BUFFER_FORMAT_MESA 0x31D0 + EGL_DRM_BUFFER_USE_MESA 0x31D1 + + Accepted as values for the EGL_IMAGE_FORMAT_MESA attribute: + + EGL_DRM_BUFFER_FORMAT_ARGB32_MESA 0x31D2 + + Bits accepted in EGL_DRM_BUFFER_USE_MESA: + + EGL_DRM_BUFFER_USE_SCANOUT_MESA 0x0001 + EGL_DRM_BUFFER_USE_SHARE_MESA 0x0002 + + Accepted in the parameter of eglCreateImageKHR: + + EGL_DRM_BUFFER_MESA 0x31D3 + + Use when importing drm buffer: + + EGL_DRM_BUFFER_STRIDE_MESA 0x31D4 + EGL_DRM_BUFFER_FORMAT_MESA 0x31D0 + +Additions to the EGL 1.4 Specification: + + To create a DRM EGLImage, call + + EGLImageKHR eglCreateDRMImageMESA(EGLDisplay dpy, + const EGLint *attrib_list); + + In the attribute list, pass EGL_WIDTH, EGL_EIGHT and format and + use in the attrib list using EGL_DRM_BUFFER_FORMAT_MESA and + EGL_DRM_BUFFER_USE_MESA. The only format specified by this + extension is EGL_DRM_BUFFER_FORMAT_ARGB32_MESA, where each pixel + is a CPU-endian, 32-bit quantity, with alpha in the upper 8 bits, + then red, then green, then blue. The bit values accepted by + EGL_DRM_BUFFER_USE_MESA are EGL_DRM_BUFFER_USE_SCANOUT_MESA and + EGL_DRM_BUFFER_USE_SHARE_MESA. EGL_DRM_BUFFER_USE_SCANOUT_MESA + requests that the created EGLImage should be usable as a scanout + buffer with the DRM kernel modesetting API. The + EGL_DRM_BUFFER_USE_SHARE_MESA bit requests that the EGLImage can + be shared with other processes by passing the underlying DRM + buffer name. + + To create a process local handle or a global DRM name for a + buffer, call + + EGLBoolean eglExportDRMImageMESA(EGLDisplay dpy, + EGLImageKHR image, + EGLint *name, + EGLint *handle, + EGLint *stride); + + If is non-NULL, a global name is assigned to the image and + written to , the handle (local to the DRM file descriptor, + for use with DRM kernel modesetting API) is written to if + non-NULL and the stride (in bytes) is written to , if + non-NULL. + + Import a shared buffer by calling eglCreateImageKHR with + EGL_DRM_BUFFER_MESA as the target, using EGL_WIDTH, EGL_HEIGHT, + EGL_DRM_BUFFER_FORMAT_MESA, EGL_DRM_BUFFER_STRIDE_MESA + in the attrib list. + +Issues + + 1. Why don't we use eglCreateImageKHR with a target that + indicates that we want to create an EGLImage from scratch? + + RESOLVED: The eglCreateImageKHR entry point is reserved for + creating an EGLImage from an already existing client API + resource. This is fine when we're creating the EGLImage from + an existing DRM buffer name, it doesn't seem right to overload + the function to also allocate the underlying resource. + + 2. Why don't we use an eglQueryImageMESA type functions for + querying the DRM EGLImage attributes (name, handle, and stride)? + + RESOLVED: The eglQueryImage function has been proposed often, + but it goes against the EGLImage design. EGLImages are opaque + handles to a 2D array of pixels, which can be passed between + client APIs. By referenceing an EGLImage in a client API, the + EGLImage target (a texture, a renderbuffer or such) can be + used to query the attributes of the EGLImage. We don't have a + full client API for creating and querying DRM buffers, though, + so we use a new EGL extension entry point instead. + +Revision History + + Version 1, June 3, 2010 + Initial draft (Kristian Høgsberg) + Version 2, August 25, 2010 + Flesh out the extension a bit, add final EGL tokens, capture + some of the original discussion in the issues section. diff --git a/include/EGL/eglext.h b/include/EGL/eglext.h index 171892c93e..04603931b3 100644 --- a/include/EGL/eglext.h +++ b/include/EGL/eglext.h @@ -120,6 +120,29 @@ typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYIMAGEKHRPROC) (EGLDisplay dpy, EGL #define EGL_GL_RENDERBUFFER_KHR 0x30B9 /* eglCreateImageKHR target */ #endif +#ifndef EGL_MESA_drm_image +#define EGL_MESA_drm_image 1 +#define EGL_DRM_BUFFER_FORMAT_MESA 0x31D0 /* eglCreateImageKHR attribute */ +#define EGL_DRM_BUFFER_USE_MESA 0x31D1 + +/* EGL_DRM_BUFFER_FORMAT_MESA tokens */ +#define EGL_DRM_BUFFER_FORMAT_ARGB32_MESA 0x31D2 + +/* EGL_DRM_BUFFER_USE_MESA bits */ +#define EGL_DRM_BUFFER_USE_SCANOUT_MESA 0x0001 +#define EGL_DRM_BUFFER_USE_SHARE_MESA 0x0002 + +#define EGL_DRM_BUFFER_MESA 0x31D3 /* eglCreateImageKHR target */ +#define EGL_DRM_BUFFER_STRIDE_MESA 0x31D4 /* eglCreateImageKHR attribute */ + +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLImageKHR EGLAPIENTRY eglCreateDRMImageMESA(EGLDisplay dpy, const EGLint *attrib_list); +EGLAPI EGLBoolean EGLAPIENTRY eglExportDRMImageMESA(EGLDisplay dpy, EGLImageKHR image, EGLint *name, EGLint *handle, EGLint *stride); +#endif +typedef EGLImageKHR (EGLAPIENTRYP PFNEGLCREATEDRMIMAGEMESA) (EGLDisplay dpy, const EGLint *attrib_list); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLEXPORTDRMIMAGEMESA) (EGLDisplay dpy, EGLImageKHR image, EGLint *name, EGLint *handle, EGLint *stride); +#endif + #if KHRONOS_SUPPORT_INT64 /* EGLTimeKHR requires 64-bit uint support */ #ifndef EGL_KHR_reusable_sync #define EGL_KHR_reusable_sync 1 diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c index c62459ec6f..31c5419bbc 100644 --- a/src/egl/main/eglapi.c +++ b/src/egl/main/eglapi.c @@ -893,6 +893,10 @@ eglGetProcAddress(const char *procname) #endif /* EGL_KHR_image_base */ #ifdef EGL_NOK_swap_region { "eglSwapBuffersRegionNOK", (_EGLProc) eglSwapBuffersRegionNOK }, +#endif +#ifdef EGL_MESA_drm_image + { "eglCreateDRMImageMESA", (_EGLProc) eglCreateDRMImageMESA }, + { "eglExportDRMImageMESA", (_EGLProc) eglExportDRMImageMESA }, #endif { NULL, NULL } }; @@ -1416,3 +1420,42 @@ eglSwapBuffersRegionNOK(EGLDisplay dpy, EGLSurface surface, } #endif /* EGL_NOK_swap_region */ + + +#ifdef EGL_MESA_drm_image + +EGLImageKHR EGLAPIENTRY +eglCreateDRMImageMESA(EGLDisplay dpy, const EGLint *attr_list) +{ + _EGLDisplay *disp = _eglLockDisplay(dpy); + _EGLDriver *drv; + _EGLImage *img; + EGLImageKHR ret; + + _EGL_CHECK_DISPLAY(disp, EGL_NO_IMAGE_KHR, drv); + + img = drv->API.CreateDRMImageMESA(drv, disp, attr_list); + ret = (img) ? _eglLinkImage(img, disp) : EGL_NO_IMAGE_KHR; + + RETURN_EGL_EVAL(disp, ret); +} + +EGLBoolean EGLAPIENTRY +eglExportDRMImageMESA(EGLDisplay dpy, EGLImageKHR image, + EGLint *name, EGLint *handle, EGLint *stride) +{ + _EGLDisplay *disp = _eglLockDisplay(dpy); + _EGLImage *img = _eglLookupImage(image, disp); + _EGLDriver *drv; + EGLBoolean ret; + + _EGL_CHECK_DISPLAY(disp, EGL_FALSE, drv); + if (!img) + RETURN_EGL_ERROR(disp, EGL_BAD_PARAMETER, EGL_FALSE); + + ret = drv->API.ExportDRMImageMESA(drv, disp, img, name, handle, stride); + + RETURN_EGL_EVAL(disp, ret); +} + +#endif diff --git a/src/egl/main/eglapi.h b/src/egl/main/eglapi.h index 5045a9a272..127becc9ac 100644 --- a/src/egl/main/eglapi.h +++ b/src/egl/main/eglapi.h @@ -90,6 +90,11 @@ typedef EGLBoolean (*GetSyncAttribKHR_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGL typedef EGLBoolean (*SwapBuffersRegionNOK_t)(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *surf, EGLint numRects, const EGLint *rects); #endif +#ifdef EGL_MESA_drm_image +typedef _EGLImage *(*CreateDRMImageMESA_t)(_EGLDriver *drv, _EGLDisplay *disp, const EGLint *attr_list); +typedef EGLBoolean (*ExportDRMImageMESA_t)(_EGLDriver *drv, _EGLDisplay *disp, _EGLImage *img, EGLint *name, EGLint *handle, EGLint *stride); +#endif + /** * The API dispatcher jumps through these functions */ @@ -159,6 +164,11 @@ struct _egl_api #ifdef EGL_NOK_swap_region SwapBuffersRegionNOK_t SwapBuffersRegionNOK; #endif + +#ifdef EGL_MESA_drm_image + CreateDRMImageMESA_t CreateDRMImageMESA; + ExportDRMImageMESA_t ExportDRMImageMESA; +#endif }; #endif /* EGLAPI_INCLUDED */ diff --git a/src/egl/main/egldisplay.h b/src/egl/main/egldisplay.h index 97c9d196ec..3863cce010 100644 --- a/src/egl/main/egldisplay.h +++ b/src/egl/main/egldisplay.h @@ -54,6 +54,7 @@ struct _egl_extensions EGLBoolean MESA_screen_surface; EGLBoolean MESA_copy_context; EGLBoolean MESA_drm_display; + EGLBoolean MESA_drm_image; EGLBoolean KHR_image_base; EGLBoolean KHR_image_pixmap; diff --git a/src/egl/main/eglmisc.c b/src/egl/main/eglmisc.c index b10783bcb9..eb3dde1fb4 100644 --- a/src/egl/main/eglmisc.c +++ b/src/egl/main/eglmisc.c @@ -85,6 +85,7 @@ _eglUpdateExtensionsString(_EGLDisplay *dpy) _EGL_CHECK_EXTENSION(MESA_screen_surface); _EGL_CHECK_EXTENSION(MESA_copy_context); _EGL_CHECK_EXTENSION(MESA_drm_display); + _EGL_CHECK_EXTENSION(MESA_drm_image); _EGL_CHECK_EXTENSION(KHR_image_base); _EGL_CHECK_EXTENSION(KHR_image_pixmap); -- cgit v1.2.3 From 5aaa53e66cc49bf0d28ec53bdab4e3b7f714e5ba Mon Sep 17 00:00:00 2001 From: Kristian Høgsberg Date: Thu, 3 Jun 2010 21:36:40 -0400 Subject: egl_dri2: Add support for MESA_image_drm --- include/GL/internal/dri_interface.h | 19 +++ src/egl/drivers/dri2/egl_dri2.c | 223 ++++++++++++++++++++++++++++++++++++ 2 files changed, 242 insertions(+) (limited to 'src') diff --git a/include/GL/internal/dri_interface.h b/include/GL/internal/dri_interface.h index 2c8546499c..ff83ff145e 100644 --- a/include/GL/internal/dri_interface.h +++ b/include/GL/internal/dri_interface.h @@ -789,6 +789,17 @@ struct __DRIdri2ExtensionRec { #define __DRI_IMAGE_FORMAT_XRGB8888 0x1002 #define __DRI_IMAGE_FORMAT_ARGB8888 0x1003 +#define __DRI_IMAGE_USE_SHARE 0x0001 +#define __DRI_IMAGE_USE_SCANOUT 0x0002 + +/** + * queryImage attributes + */ + +#define __DRI_IMAGE_ATTRIB_STRIDE 0x2000 +#define __DRI_IMAGE_ATTRIB_HANDLE 0x2001 +#define __DRI_IMAGE_ATTRIB_NAME 0x2002 + typedef struct __DRIimageRec __DRIimage; typedef struct __DRIimageExtensionRec __DRIimageExtension; struct __DRIimageExtensionRec { @@ -804,8 +815,16 @@ struct __DRIimageExtensionRec { void *loaderPrivate); void (*destroyImage)(__DRIimage *image); + + __DRIimage *(*createImage)(__DRIscreen *screen, + int width, int height, int format, + unsigned int use, + void *loaderPrivate); + + GLboolean (*queryImage)(__DRIimage *image, int attrib, int *value); }; + /** * This extension must be implemented by the loader and passed to the * driver at screen creation time. The EGLImage entry points in the diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c index efb93bcf06..2b78bcc763 100644 --- a/src/egl/drivers/dri2/egl_dri2.c +++ b/src/egl/drivers/dri2/egl_dri2.c @@ -836,6 +836,7 @@ dri2_initialize_x11(_EGLDriver *drv, _EGLDisplay *disp, goto cleanup_configs; } + disp->Extensions.MESA_drm_image = EGL_TRUE; disp->Extensions.KHR_image_base = EGL_TRUE; disp->Extensions.KHR_image_pixmap = EGL_TRUE; disp->Extensions.KHR_gl_renderbuffer_image = EGL_TRUE; @@ -994,6 +995,7 @@ dri2_initialize_drm(_EGLDriver *drv, _EGLDisplay *disp, for (i = 0; dri2_dpy->driver_configs[i]; i++) dri2_add_config(disp, dri2_dpy->driver_configs[i], i + 1, 0, 0); + disp->Extensions.MESA_drm_image = EGL_TRUE; disp->Extensions.KHR_image_base = EGL_TRUE; disp->Extensions.KHR_gl_renderbuffer_image = EGL_TRUE; disp->Extensions.KHR_gl_texture_2D_image = EGL_TRUE; @@ -1620,6 +1622,96 @@ dri2_create_image_khr_renderbuffer(_EGLDisplay *disp, _EGLContext *ctx, return &dri2_img->base; } +static _EGLImage * +dri2_create_image_mesa_drm_buffer(_EGLDisplay *disp, _EGLContext *ctx, + EGLClientBuffer buffer, const EGLint *attr_list) +{ + struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp); + struct dri2_egl_context *dri2_ctx = dri2_egl_context(ctx); + struct dri2_egl_image *dri2_img; + EGLint width, height, format, name, stride, pitch, i, err; + + name = (EGLint) buffer; + + err = EGL_SUCCESS; + width = 0; + height = 0; + format = 0; + stride = 0; + + for (i = 0; attr_list[i] != EGL_NONE; i++) { + EGLint attr = attr_list[i++]; + EGLint val = attr_list[i]; + + switch (attr) { + case EGL_WIDTH: + width = val; + break; + case EGL_HEIGHT: + height = val; + break; + case EGL_DRM_BUFFER_FORMAT_MESA: + format = val; + break; + case EGL_DRM_BUFFER_STRIDE_MESA: + stride = val; + break; + default: + err = EGL_BAD_ATTRIBUTE; + break; + } + + if (err != EGL_SUCCESS) { + _eglLog(_EGL_WARNING, "bad image attribute 0x%04x", attr); + return NULL; + } + } + + if (width <= 0 || height <= 0 || stride <= 0) { + _eglError(EGL_BAD_PARAMETER, + "bad width, height or stride"); + return NULL; + } + + switch (format) { + case EGL_DRM_BUFFER_FORMAT_ARGB32_MESA: + format = __DRI_IMAGE_FORMAT_ARGB8888; + pitch = stride; + break; + default: + _eglError(EGL_BAD_PARAMETER, + "dri2_create_image_khr: unsupported pixmap depth"); + return NULL; + } + + dri2_img = malloc(sizeof *dri2_img); + if (!dri2_img) { + _eglError(EGL_BAD_ALLOC, "dri2_create_image_mesa_drm"); + return NULL; + } + + if (!_eglInitImage(&dri2_img->base, disp, attr_list)) { + free(dri2_img); + return NULL; + } + + dri2_img->dri_image = + dri2_dpy->image->createImageFromName(dri2_ctx->dri_context, + width, + height, + format, + name, + pitch, + dri2_img); + if (dri2_img->dri_image == NULL) { + free(dri2_img); + _eglError(EGL_BAD_ALLOC, "dri2_create_image_mesa_drm"); + return NULL; + } + + return &dri2_img->base; +} + static _EGLImage * dri2_create_image_khr(_EGLDriver *drv, _EGLDisplay *disp, _EGLContext *ctx, EGLenum target, @@ -1630,6 +1722,8 @@ dri2_create_image_khr(_EGLDriver *drv, _EGLDisplay *disp, return dri2_create_image_khr_pixmap(disp, ctx, buffer, attr_list); case EGL_GL_RENDERBUFFER_KHR: return dri2_create_image_khr_renderbuffer(disp, ctx, buffer, attr_list); + case EGL_DRM_BUFFER_MESA: + return dri2_create_image_mesa_drm_buffer(disp, ctx, buffer, attr_list); default: _eglError(EGL_BAD_PARAMETER, "dri2_create_image_khr"); return EGL_NO_IMAGE_KHR; @@ -1648,6 +1742,133 @@ dri2_destroy_image_khr(_EGLDriver *drv, _EGLDisplay *disp, _EGLImage *image) return EGL_TRUE; } +static _EGLImage * +dri2_create_drm_image_mesa(_EGLDriver *drv, _EGLDisplay *disp, + const EGLint *attr_list) +{ + struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp); + struct dri2_egl_image *dri2_img; + int width, height, format, i; + unsigned int use, dri_use, valid_mask; + EGLint err = EGL_SUCCESS; + + dri2_img = malloc(sizeof *dri2_img); + if (!dri2_img) { + _eglError(EGL_BAD_ALLOC, "dri2_create_image_khr"); + return EGL_NO_IMAGE_KHR; + } + + if (!attr_list) { + err = EGL_BAD_PARAMETER; + goto cleanup_img; + } + + if (!_eglInitImage(&dri2_img->base, disp, attr_list)) { + err = EGL_BAD_PARAMETER; + goto cleanup_img; + } + + width = 0; + height = 0; + format = 0; + use = 0; + for (i = 0; attr_list[i] != EGL_NONE; i++) { + EGLint attr = attr_list[i++]; + EGLint val = attr_list[i]; + + switch (attr) { + case EGL_WIDTH: + width = val; + break; + case EGL_HEIGHT: + height = val; + break; + case EGL_DRM_BUFFER_FORMAT_MESA: + format = val; + break; + case EGL_DRM_BUFFER_USE_MESA: + use = val; + break; + default: + err = EGL_BAD_ATTRIBUTE; + break; + } + + if (err != EGL_SUCCESS) { + _eglLog(_EGL_WARNING, "bad image attribute 0x%04x", attr); + goto cleanup_img; + } + } + + if (width <= 0 || height <= 0) { + _eglLog(_EGL_WARNING, "bad width or height (%dx%d)", width, height); + goto cleanup_img; + } + + switch (format) { + case EGL_DRM_BUFFER_FORMAT_ARGB32_MESA: + format = __DRI_IMAGE_FORMAT_ARGB8888; + break; + default: + _eglLog(_EGL_WARNING, "bad image format value 0x%04x", format); + goto cleanup_img; + } + + valid_mask = + EGL_DRM_BUFFER_USE_SCANOUT_MESA | + EGL_DRM_BUFFER_USE_SHARE_MESA; + if (use & ~valid_mask) { + _eglLog(_EGL_WARNING, "bad image use bit 0x%04x", use & ~valid_mask); + goto cleanup_img; + } + + dri_use = 0; + if (use & EGL_DRM_BUFFER_USE_SHARE_MESA) + dri_use |= __DRI_IMAGE_USE_SHARE; + if (use & EGL_DRM_BUFFER_USE_SCANOUT_MESA) + dri_use |= __DRI_IMAGE_USE_SCANOUT; + + dri2_img->dri_image = + dri2_dpy->image->createImage(dri2_dpy->dri_screen, + width, height, format, dri_use, dri2_img); + if (dri2_img->dri_image == NULL) { + err = EGL_BAD_ALLOC; + goto cleanup_img; + } + + return &dri2_img->base; + + cleanup_img: + free(dri2_img); + _eglError(err, "dri2_create_drm_image_mesa"); + + return EGL_NO_IMAGE_KHR; +} + +static EGLBoolean +dri2_export_drm_image_mesa(_EGLDriver *drv, _EGLDisplay *disp, _EGLImage *img, + EGLint *name, EGLint *handle, EGLint *stride) +{ + struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp); + struct dri2_egl_image *dri2_img = dri2_egl_image(img); + + if (name && !dri2_dpy->image->queryImage(dri2_img->dri_image, + __DRI_IMAGE_ATTRIB_NAME, name)) { + _eglError(EGL_BAD_ALLOC, "dri2_export_drm_image_mesa"); + return EGL_FALSE; + } + + if (handle) + dri2_dpy->image->queryImage(dri2_img->dri_image, + __DRI_IMAGE_ATTRIB_HANDLE, handle); + + if (stride) + dri2_dpy->image->queryImage(dri2_img->dri_image, + __DRI_IMAGE_ATTRIB_STRIDE, stride); + + return EGL_TRUE; +} + /** * This is the main entrypoint into the driver, called by libEGL. * Create a new _EGLDriver object and init its dispatch table. @@ -1681,6 +1902,8 @@ _eglMain(const char *args) dri2_drv->base.API.CreateImageKHR = dri2_create_image_khr; dri2_drv->base.API.DestroyImageKHR = dri2_destroy_image_khr; dri2_drv->base.API.SwapBuffersRegionNOK = dri2_swap_buffers_region; + dri2_drv->base.API.CreateDRMImageMESA = dri2_create_drm_image_mesa; + dri2_drv->base.API.ExportDRMImageMESA = dri2_export_drm_image_mesa; dri2_drv->base.Name = "DRI2"; dri2_drv->base.Unload = dri2_unload; -- cgit v1.2.3 From 9087ba128089ed0dc00e6eb38f37126fb7557d3b Mon Sep 17 00:00:00 2001 From: Kristian Høgsberg Date: Thu, 3 Jun 2010 21:56:21 -0400 Subject: intel: Take an intel_screen pointer in intel_alloc_region_* functions --- src/mesa/drivers/dri/intel/intel_context.c | 3 +- src/mesa/drivers/dri/intel/intel_fbo.c | 2 +- src/mesa/drivers/dri/intel/intel_mipmap_tree.c | 2 +- src/mesa/drivers/dri/intel/intel_regions.c | 55 +++++++++++--------------- src/mesa/drivers/dri/intel/intel_regions.h | 4 +- src/mesa/drivers/dri/intel/intel_screen.c | 3 +- 6 files changed, 32 insertions(+), 37 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/intel/intel_context.c b/src/mesa/drivers/dri/intel/intel_context.c index 4e63b45127..a9ba93d24b 100644 --- a/src/mesa/drivers/dri/intel/intel_context.c +++ b/src/mesa/drivers/dri/intel/intel_context.c @@ -377,7 +377,8 @@ intel_update_renderbuffers(__DRIcontext *context, __DRIdrawable *drawable) intel_region_reference(®ion, depth_region); } else - region = intel_region_alloc_for_handle(intel, buffers[i].cpp, + region = intel_region_alloc_for_handle(intel->intelScreen, + buffers[i].cpp, drawable->w, drawable->h, buffers[i].pitch / buffers[i].cpp, diff --git a/src/mesa/drivers/dri/intel/intel_fbo.c b/src/mesa/drivers/dri/intel/intel_fbo.c index 4a83886fc1..6435857f33 100644 --- a/src/mesa/drivers/dri/intel/intel_fbo.c +++ b/src/mesa/drivers/dri/intel/intel_fbo.c @@ -182,7 +182,7 @@ intel_alloc_renderbuffer_storage(GLcontext * ctx, struct gl_renderbuffer *rb, /* alloc hardware renderbuffer */ DBG("Allocating %d x %d Intel RBO\n", width, height); - irb->region = intel_region_alloc(intel, I915_TILING_NONE, cpp, + irb->region = intel_region_alloc(intel->intelScreen, I915_TILING_NONE, cpp, width, height, GL_TRUE); if (!irb->region) return GL_FALSE; /* out of memory? */ diff --git a/src/mesa/drivers/dri/intel/intel_mipmap_tree.c b/src/mesa/drivers/dri/intel/intel_mipmap_tree.c index 42adb4cb4a..d316d34d69 100644 --- a/src/mesa/drivers/dri/intel/intel_mipmap_tree.c +++ b/src/mesa/drivers/dri/intel/intel_mipmap_tree.c @@ -137,7 +137,7 @@ intel_miptree_create(struct intel_context *intel, return NULL; } - mt->region = intel_region_alloc(intel, + mt->region = intel_region_alloc(intel->intelScreen, tiling, mt->cpp, mt->total_width, diff --git a/src/mesa/drivers/dri/intel/intel_regions.c b/src/mesa/drivers/dri/intel/intel_regions.c index 680d18ba29..57ffe611d1 100644 --- a/src/mesa/drivers/dri/intel/intel_regions.c +++ b/src/mesa/drivers/dri/intel/intel_regions.c @@ -142,10 +142,10 @@ intel_region_unmap(struct intel_context *intel, struct intel_region *region) } static struct intel_region * -intel_region_alloc_internal(struct intel_context *intel, +intel_region_alloc_internal(struct intel_screen *screen, GLuint cpp, GLuint width, GLuint height, GLuint pitch, - drm_intel_bo *buffer) + uint32_t tiling, drm_intel_bo *buffer) { struct intel_region *region; @@ -164,44 +164,36 @@ intel_region_alloc_internal(struct intel_context *intel, region->pitch = pitch; region->refcount = 1; region->buffer = buffer; - - /* Default to no tiling */ - region->tiling = I915_TILING_NONE; + region->tiling = tiling; + region->screen = screen; _DBG("%s <-- %p\n", __FUNCTION__, region); return region; } struct intel_region * -intel_region_alloc(struct intel_context *intel, +intel_region_alloc(struct intel_screen *screen, uint32_t tiling, GLuint cpp, GLuint width, GLuint height, GLboolean expect_accelerated_upload) { drm_intel_bo *buffer; - struct intel_region *region; unsigned long flags = 0; unsigned long aligned_pitch; if (expect_accelerated_upload) flags |= BO_ALLOC_FOR_RENDER; - buffer = drm_intel_bo_alloc_tiled(intel->bufmgr, "region", + buffer = drm_intel_bo_alloc_tiled(screen->bufmgr, "region", width, height, cpp, &tiling, &aligned_pitch, flags); - region = intel_region_alloc_internal(intel, cpp, width, height, - aligned_pitch / cpp, buffer); - if (region == NULL) - return region; - - region->tiling = tiling; - - return region; + return intel_region_alloc_internal(screen, cpp, width, height, + aligned_pitch / cpp, tiling, buffer); } struct intel_region * -intel_region_alloc_for_handle(struct intel_context *intel, +intel_region_alloc_for_handle(struct intel_screen *screen, GLuint cpp, GLuint width, GLuint height, GLuint pitch, GLuint handle, const char *name) @@ -209,9 +201,9 @@ intel_region_alloc_for_handle(struct intel_context *intel, struct intel_region *region, *dummy; drm_intel_bo *buffer; int ret; - uint32_t bit_6_swizzle; + uint32_t bit_6_swizzle, tiling; - region = _mesa_HashLookup(intel->intelScreen->named_regions, handle); + region = _mesa_HashLookup(screen->named_regions, handle); if (region != NULL) { dummy = NULL; if (region->width != width || region->height != height || @@ -225,25 +217,26 @@ intel_region_alloc_for_handle(struct intel_context *intel, return dummy; } - buffer = intel_bo_gem_create_from_name(intel->bufmgr, name, handle); - - region = intel_region_alloc_internal(intel, cpp, - width, height, pitch, buffer); - if (region == NULL) - return region; - - ret = drm_intel_bo_get_tiling(region->buffer, ®ion->tiling, - &bit_6_swizzle); + buffer = intel_bo_gem_create_from_name(screen->bufmgr, name, handle); + if (buffer == NULL) + return NULL; + ret = drm_intel_bo_get_tiling(buffer, &tiling, &bit_6_swizzle); if (ret != 0) { fprintf(stderr, "Couldn't get tiling of buffer %d (%s): %s\n", handle, name, strerror(-ret)); - intel_region_release(®ion); + drm_intel_bo_unreference(buffer); + return NULL; + } + + region = intel_region_alloc_internal(screen, cpp, + width, height, pitch, tiling, buffer); + if (region == NULL) { + drm_intel_bo_unreference(buffer); return NULL; } region->name = handle; - region->screen = intel->intelScreen; - _mesa_HashInsert(intel->intelScreen->named_regions, handle, region); + _mesa_HashInsert(screen->named_regions, handle, region); return region; } diff --git a/src/mesa/drivers/dri/intel/intel_regions.h b/src/mesa/drivers/dri/intel/intel_regions.h index 6bbed32f2a..c88395be18 100644 --- a/src/mesa/drivers/dri/intel/intel_regions.h +++ b/src/mesa/drivers/dri/intel/intel_regions.h @@ -76,14 +76,14 @@ struct intel_region /* Allocate a refcounted region. Pointers to regions should only be * copied by calling intel_reference_region(). */ -struct intel_region *intel_region_alloc(struct intel_context *intel, +struct intel_region *intel_region_alloc(struct intel_screen *screen, uint32_t tiling, GLuint cpp, GLuint width, GLuint height, GLboolean expect_accelerated_upload); struct intel_region * -intel_region_alloc_for_handle(struct intel_context *intel, +intel_region_alloc_for_handle(struct intel_screen *screen, GLuint cpp, GLuint width, GLuint height, GLuint pitch, unsigned int handle, const char *name); diff --git a/src/mesa/drivers/dri/intel/intel_screen.c b/src/mesa/drivers/dri/intel/intel_screen.c index 8c41115ea4..643e7762b0 100644 --- a/src/mesa/drivers/dri/intel/intel_screen.c +++ b/src/mesa/drivers/dri/intel/intel_screen.c @@ -159,7 +159,8 @@ intel_create_image_from_name(__DRIcontext *context, image->data = loaderPrivate; cpp = _mesa_get_format_bytes(image->format); - image->region = intel_region_alloc_for_handle(intel, cpp, width, height, + image->region = intel_region_alloc_for_handle(intel->intelScreen, + cpp, width, height, pitch, name, "image"); if (image->region == NULL) { FREE(image); -- cgit v1.2.3 From f301932dba4cc75e810e0c051e39247128a899fc Mon Sep 17 00:00:00 2001 From: Kristian Høgsberg Date: Sun, 6 Jun 2010 20:39:19 -0400 Subject: intel: Support EGL_MESA_image_drm --- src/mesa/drivers/dri/intel/intel_regions.c | 16 +++++++ src/mesa/drivers/dri/intel/intel_regions.h | 3 ++ src/mesa/drivers/dri/intel/intel_screen.c | 68 ++++++++++++++++++++++++++++++ 3 files changed, 87 insertions(+) (limited to 'src') diff --git a/src/mesa/drivers/dri/intel/intel_regions.c b/src/mesa/drivers/dri/intel/intel_regions.c index 57ffe611d1..e87e29462c 100644 --- a/src/mesa/drivers/dri/intel/intel_regions.c +++ b/src/mesa/drivers/dri/intel/intel_regions.c @@ -192,6 +192,22 @@ intel_region_alloc(struct intel_screen *screen, aligned_pitch / cpp, tiling, buffer); } +GLboolean +intel_region_flink(struct intel_region *region, uint32_t *name) +{ + if (region->name == 0) { + if (drm_intel_bo_flink(region->buffer, ®ion->name)) + return GL_FALSE; + + _mesa_HashInsert(region->screen->named_regions, + region->name, region); + } + + *name = region->name; + + return GL_TRUE; +} + struct intel_region * intel_region_alloc_for_handle(struct intel_screen *screen, GLuint cpp, diff --git a/src/mesa/drivers/dri/intel/intel_regions.h b/src/mesa/drivers/dri/intel/intel_regions.h index c88395be18..8464a5e937 100644 --- a/src/mesa/drivers/dri/intel/intel_regions.h +++ b/src/mesa/drivers/dri/intel/intel_regions.h @@ -88,6 +88,9 @@ intel_region_alloc_for_handle(struct intel_screen *screen, GLuint width, GLuint height, GLuint pitch, unsigned int handle, const char *name); +GLboolean +intel_region_flink(struct intel_region *region, uint32_t *name); + void intel_region_reference(struct intel_region **dst, struct intel_region *src); diff --git a/src/mesa/drivers/dri/intel/intel_screen.c b/src/mesa/drivers/dri/intel/intel_screen.c index 643e7762b0..0a542a7303 100644 --- a/src/mesa/drivers/dri/intel/intel_screen.c +++ b/src/mesa/drivers/dri/intel/intel_screen.c @@ -207,11 +207,79 @@ intel_destroy_image(__DRIimage *image) FREE(image); } +static __DRIimage * +intel_create_image(__DRIscreen *screen, + int width, int height, int format, + unsigned int use, + void *loaderPrivate) +{ + __DRIimage *image; + struct intel_screen *intelScreen = screen->private; + int cpp; + + image = CALLOC(sizeof *image); + if (image == NULL) + return NULL; + + switch (format) { + case __DRI_IMAGE_FORMAT_RGB565: + image->format = MESA_FORMAT_RGB565; + image->internal_format = GL_RGB; + image->data_type = GL_UNSIGNED_BYTE; + break; + case __DRI_IMAGE_FORMAT_XRGB8888: + image->format = MESA_FORMAT_XRGB8888; + image->internal_format = GL_RGB; + image->data_type = GL_UNSIGNED_BYTE; + break; + case __DRI_IMAGE_FORMAT_ARGB8888: + image->format = MESA_FORMAT_ARGB8888; + image->internal_format = GL_RGBA; + image->data_type = GL_UNSIGNED_BYTE; + break; + default: + free(image); + return NULL; + } + + image->data = loaderPrivate; + cpp = _mesa_get_format_bytes(image->format); + + image->region = + intel_region_alloc(intelScreen, I915_TILING_NONE, + cpp, width, height, GL_TRUE); + if (image->region == NULL) { + FREE(image); + return NULL; + } + + return image; +} + +static GLboolean +intel_query_image(__DRIimage *image, int attrib, int *value) +{ + switch (attrib) { + case __DRI_IMAGE_ATTRIB_STRIDE: + *value = image->region->pitch * image->region->cpp; + return GL_TRUE; + case __DRI_IMAGE_ATTRIB_HANDLE: + *value = image->region->buffer->handle; + return GL_TRUE; + case __DRI_IMAGE_ATTRIB_NAME: + return intel_region_flink(image->region, (uint32_t *) value); + default: + return GL_FALSE; + } +} + static struct __DRIimageExtensionRec intelImageExtension = { { __DRI_IMAGE, __DRI_IMAGE_VERSION }, intel_create_image_from_name, intel_create_image_from_renderbuffer, intel_destroy_image, + intel_create_image, + intel_query_image }; static const __DRIextension *intelScreenExtensions[] = { -- cgit v1.2.3 From 653ddaab2636764b9e7999fa39b37edde7fe7c6d Mon Sep 17 00:00:00 2001 From: Aras Pranckevicius Date: Wed, 25 Aug 2010 10:07:14 +0300 Subject: glsl/mesa: fixes for MSVC Signed-off-by: Brian Paul --- src/glsl/glcpp/pp.c | 1 + src/mesa/main/imports.h | 1 + 2 files changed, 2 insertions(+) (limited to 'src') diff --git a/src/glsl/glcpp/pp.c b/src/glsl/glcpp/pp.c index 7672490958..8769f4f7e5 100644 --- a/src/glsl/glcpp/pp.c +++ b/src/glsl/glcpp/pp.c @@ -25,6 +25,7 @@ #include #include #include "glcpp.h" +#include "main/core.h" /* for isblank() on MSVC */ void glcpp_error (YYLTYPE *locp, glcpp_parser_t *parser, const char *fmt, ...) diff --git a/src/mesa/main/imports.h b/src/mesa/main/imports.h index cb35885dbd..317e2b7df0 100644 --- a/src/mesa/main/imports.h +++ b/src/mesa/main/imports.h @@ -148,6 +148,7 @@ static INLINE float truncf(float x) { return x < 0.0f ? ceilf(x) : floorf(x); } static INLINE float exp2f(float x) { return powf(2.0f, x); } static INLINE float log2f(float x) { return logf(x) * 1.442695041f; } static INLINE int isblank(int ch) { return ch == ' ' || ch == '\t'; } +#define strtoll(p, e, b) _strtoi64(p, e, b) #endif /*@}*/ -- cgit v1.2.3 From 14ac294e1a67577d3f2b63e77272ec472a93c224 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Wed, 25 Aug 2010 09:55:07 -0700 Subject: llvmpipe: Remove unnecessary header. --- src/gallium/drivers/llvmpipe/lp_query.c | 1 - 1 file changed, 1 deletion(-) (limited to 'src') diff --git a/src/gallium/drivers/llvmpipe/lp_query.c b/src/gallium/drivers/llvmpipe/lp_query.c index 540eea7fd1..67fd797af2 100644 --- a/src/gallium/drivers/llvmpipe/lp_query.c +++ b/src/gallium/drivers/llvmpipe/lp_query.c @@ -37,7 +37,6 @@ #include "lp_flush.h" #include "lp_fence.h" #include "lp_query.h" -#include "lp_rast.h" #include "lp_state.h" -- cgit v1.2.3 From d4bfd8a24a4c2b246b55888d4983ddcf665b6976 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Wed, 25 Aug 2010 18:01:51 +0100 Subject: llvmpipe: fix bad patch application --- src/gallium/drivers/llvmpipe/lp_setup.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/llvmpipe/lp_setup.c b/src/gallium/drivers/llvmpipe/lp_setup.c index 0c6d2de193..9aa6c4bf38 100644 --- a/src/gallium/drivers/llvmpipe/lp_setup.c +++ b/src/gallium/drivers/llvmpipe/lp_setup.c @@ -815,6 +815,10 @@ lp_setup_update_state( struct lp_setup_context *setup ) for (i = 0; i < Elements(setup->fs.current_tex); i++) { if (setup->fs.current_tex[i]) lp_scene_add_resource_reference(scene, setup->fs.current_tex[i]); + } + } + } + if (setup->dirty & LP_SETUP_NEW_SCISSOR) { setup->draw_region = setup->framebuffer; if (setup->scissor_test) { @@ -823,11 +827,6 @@ lp_setup_update_state( struct lp_setup_context *setup ) } } - - } - } - } - setup->dirty = 0; assert(setup->fs.stored); -- cgit v1.2.3 From 92cfcc2afdb796cc702cb0430ffcf98704c0a880 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Wed, 25 Aug 2010 10:05:32 -0700 Subject: st/mesa: Remove unnecessary header. --- src/mesa/state_tracker/st_draw_feedback.c | 1 - 1 file changed, 1 deletion(-) (limited to 'src') diff --git a/src/mesa/state_tracker/st_draw_feedback.c b/src/mesa/state_tracker/st_draw_feedback.c index e0995f8318..df05c7f70d 100644 --- a/src/mesa/state_tracker/st_draw_feedback.c +++ b/src/mesa/state_tracker/st_draw_feedback.c @@ -40,7 +40,6 @@ #include "pipe/p_context.h" #include "pipe/p_defines.h" #include "util/u_inlines.h" -#include "util/u_draw.h" #include "draw/draw_private.h" #include "draw/draw_context.h" -- cgit v1.2.3 From dc27515780d5e1b3a7b3f9ab7119d3e35b22294c Mon Sep 17 00:00:00 2001 From: Marek Olšák Date: Wed, 25 Aug 2010 20:02:24 +0200 Subject: r300g: fix potentially uninitialized variables in create_rs_state It had no impact on correctness, though. Reported by Vinson Lee. --- src/gallium/drivers/r300/r300_state.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c index 5c225e24f9..2240011368 100644 --- a/src/gallium/drivers/r300/r300_state.c +++ b/src/gallium/drivers/r300/r300_state.c @@ -940,9 +940,9 @@ static void* r300_create_rs_state(struct pipe_context* pipe, uint32_t stuffing_enable; /* R300_GB_ENABLE: 0x4008 */ /* Point sprites texture coordinates, 0: lower left, 1: upper right */ - float point_texcoord_left; /* R300_GA_POINT_S0: 0x4200 */ + float point_texcoord_left = 0; /* R300_GA_POINT_S0: 0x4200 */ float point_texcoord_bottom = 0;/* R300_GA_POINT_T0: 0x4204 */ - float point_texcoord_right; /* R300_GA_POINT_S1: 0x4208 */ + float point_texcoord_right = 1; /* R300_GA_POINT_S1: 0x4208 */ float point_texcoord_top = 0; /* R300_GA_POINT_T1: 0x420c */ CB_LOCALS; @@ -1064,9 +1064,6 @@ static void* r300_create_rs_state(struct pipe_context* pipe, R300_GB_TEX_ST << (R300_GB_TEX0_SOURCE_SHIFT + (i*2)); } - point_texcoord_left = 0.0f; - point_texcoord_right = 1.0f; - switch (state->sprite_coord_mode) { case PIPE_SPRITE_COORD_UPPER_LEFT: point_texcoord_top = 0.0f; -- cgit v1.2.3 From 721954c334787bbddd8726348a4c95465f89677b Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Wed, 25 Aug 2010 11:22:55 -0700 Subject: nvfx: Set pointer to NULL after free. Guard against potential use after free. --- src/gallium/drivers/nvfx/nvfx_fragprog.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/drivers/nvfx/nvfx_fragprog.c b/src/gallium/drivers/nvfx/nvfx_fragprog.c index 7f6b3f6599..275672a31f 100644 --- a/src/gallium/drivers/nvfx/nvfx_fragprog.c +++ b/src/gallium/drivers/nvfx/nvfx_fragprog.c @@ -996,8 +996,10 @@ nvfx_fragprog_prepare(struct nvfx_context* nvfx, struct nvfx_fpc *fpc) return TRUE; out_err: - if (fpc->r_temp) + if (fpc->r_temp) { FREE(fpc->r_temp); + fpc->r_temp = NULL; + } tgsi_parse_free(&p); return FALSE; } -- cgit v1.2.3 From bcca7fd5d56890a05527e09f5abef0449398f95e Mon Sep 17 00:00:00 2001 From: Marek Olšák Date: Wed, 25 Aug 2010 20:23:29 +0200 Subject: r300/compiler: emulate relative addressing with negative offsets in VS 3 more piglits, cool. --- src/mesa/drivers/dri/r300/compiler/r3xx_vertprog.c | 74 ++++++++++++++++++++++ 1 file changed, 74 insertions(+) (limited to 'src') diff --git a/src/mesa/drivers/dri/r300/compiler/r3xx_vertprog.c b/src/mesa/drivers/dri/r300/compiler/r3xx_vertprog.c index 5086d76d4d..b05b3aabf3 100644 --- a/src/mesa/drivers/dri/r300/compiler/r3xx_vertprog.c +++ b/src/mesa/drivers/dri/r300/compiler/r3xx_vertprog.c @@ -892,6 +892,76 @@ static int swizzle_is_native(rc_opcode opcode, struct rc_src_register reg) return 1; } +static void transform_negative_addressing(struct r300_vertex_program_compiler *c, + struct rc_instruction *arl, + struct rc_instruction *end, + int min_offset) +{ + struct rc_instruction *inst, *add; + unsigned const_swizzle; + + /* Transform ARL */ + add = rc_insert_new_instruction(&c->Base, arl->Prev); + add->U.I.Opcode = RC_OPCODE_ADD; + add->U.I.DstReg.File = RC_FILE_TEMPORARY; + add->U.I.DstReg.Index = rc_find_free_temporary(&c->Base); + add->U.I.DstReg.WriteMask = RC_MASK_X; + add->U.I.SrcReg[0] = arl->U.I.SrcReg[0]; + add->U.I.SrcReg[1].File = RC_FILE_CONSTANT; + add->U.I.SrcReg[1].Index = rc_constants_add_immediate_scalar(&c->Base.Program.Constants, + min_offset, &const_swizzle); + add->U.I.SrcReg[1].Swizzle = const_swizzle; + + arl->U.I.SrcReg[0].File = RC_FILE_TEMPORARY; + arl->U.I.SrcReg[0].Index = add->U.I.DstReg.Index; + arl->U.I.SrcReg[0].Swizzle = RC_SWIZZLE_XXXX; + + /* Rewrite offsets up to and excluding inst. */ + for (inst = arl->Next; inst != end; inst = inst->Next) { + const struct rc_opcode_info * opcode = rc_get_opcode_info(inst->U.I.Opcode); + + for (unsigned i = 0; i < opcode->NumSrcRegs; i++) + if (inst->U.I.SrcReg[i].RelAddr) + inst->U.I.SrcReg[i].Index -= min_offset; + } +} + +static void rc_emulate_negative_addressing(struct r300_vertex_program_compiler *c) +{ + struct rc_instruction *inst, *lastARL = NULL; + int min_offset = 0; + + for (inst = c->Base.Program.Instructions.Next; inst != &c->Base.Program.Instructions; inst = inst->Next) { + const struct rc_opcode_info * opcode = rc_get_opcode_info(inst->U.I.Opcode); + + if (inst->U.I.Opcode == RC_OPCODE_ARL) { + if (lastARL != NULL && min_offset < 0) + transform_negative_addressing(c, lastARL, inst, min_offset); + + lastARL = inst; + min_offset = 0; + continue; + } + + for (unsigned i = 0; i < opcode->NumSrcRegs; i++) { + if (inst->U.I.SrcReg[i].RelAddr && + inst->U.I.SrcReg[i].Index < 0) { + /* ARL must precede any indirect addressing. */ + if (lastARL == NULL) { + rc_error(&c->Base, "Vertex shader: Found relative addressing without ARL."); + return; + } + + if (inst->U.I.SrcReg[i].Index < min_offset) + min_offset = inst->U.I.SrcReg[i].Index; + } + } + } + + if (lastARL != NULL && min_offset < 0) + transform_negative_addressing(c, lastARL, inst, min_offset); +} + static void debug_program_log(struct r300_vertex_program_compiler* c, const char * where) { if (c->Base.Debug) { @@ -933,6 +1003,10 @@ void r3xx_compile_vertex_program(struct r300_vertex_program_compiler *c) debug_program_log(c, "after emulate branches"); } + rc_emulate_negative_addressing(c); + + debug_program_log(c, "after negative addressing emulation"); + if (c->Base.is_r500) { struct radeon_program_transformation transformations[] = { { &r300_transform_vertex_alu, 0 }, -- cgit v1.2.3 From ea2231ff5e4ced36bdb65ccdd02a1008fb8bfce7 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 24 Aug 2010 16:47:09 -0700 Subject: mesa: Remove the "Used" flag in gl_program_parameter. This was in place for uniform handling, but nothing actually needs the value now, since presence in a parameter list indicates that the uniform was used as far as the linker was concerned. --- src/mesa/program/ir_to_mesa.cpp | 5 ----- src/mesa/program/prog_parameter.c | 22 ---------------------- src/mesa/program/prog_parameter.h | 7 +------ 3 files changed, 1 insertion(+), 33 deletions(-) (limited to 'src') diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp index fc145b475e..4429b7468d 100644 --- a/src/mesa/program/ir_to_mesa.cpp +++ b/src/mesa/program/ir_to_mesa.cpp @@ -1427,11 +1427,6 @@ ir_to_mesa_visitor::visit(ir_dereference_variable *ir) loc = add_uniform(ir->var->name, ir->var->type); - /* Always mark the uniform used at this point. If it isn't - * used, dead code elimination should have nuked the decl already. - */ - this->prog->Parameters->Parameters[loc].Used = GL_TRUE; - entry = new(mem_ctx) variable_storage(ir->var, PROGRAM_UNIFORM, loc); this->variables.push_tail(entry); break; diff --git a/src/mesa/program/prog_parameter.c b/src/mesa/program/prog_parameter.c index fa5deaf127..7e01f675d3 100644 --- a/src/mesa/program/prog_parameter.c +++ b/src/mesa/program/prog_parameter.c @@ -314,27 +314,6 @@ _mesa_add_uniform(struct gl_program_parameter_list *paramList, } -/** - * Mark the named uniform as 'used'. - */ -void -_mesa_use_uniform(struct gl_program_parameter_list *paramList, - const char *name) -{ - GLuint i; - for (i = 0; i < paramList->NumParameters; i++) { - struct gl_program_parameter *p = paramList->Parameters + i; - if ((p->Type == PROGRAM_UNIFORM || p->Type == PROGRAM_SAMPLER) && - strcmp(p->Name, name) == 0) { - p->Used = GL_TRUE; - /* Note that large uniforms may occupy several slots so we're - * not done searching yet. - */ - } - } -} - - /** * Add a sampler to the parameter list. * \param name uniform's name @@ -658,7 +637,6 @@ _mesa_clone_parameter_list(const struct gl_program_parameter_list *list) list->ParameterValues[i], NULL, 0x0); ASSERT(j >= 0); pCopy = clone->Parameters + j; - pCopy->Used = p->Used; pCopy->Flags = p->Flags; /* copy state indexes */ if (p->Type == PROGRAM_STATE_VAR) { diff --git a/src/mesa/program/prog_parameter.h b/src/mesa/program/prog_parameter.h index 1860f31287..5381a6dc0f 100644 --- a/src/mesa/program/prog_parameter.h +++ b/src/mesa/program/prog_parameter.h @@ -64,8 +64,7 @@ struct gl_program_parameter * 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? */ + GLboolean Initialized; /**< debug: Has the ParameterValue[] been set? */ GLbitfield Flags; /**< Bitmask of PROG_PARAM_*_BIT */ /** * A sequence of STATE_* tokens and integers to identify GL state. @@ -136,10 +135,6 @@ _mesa_add_uniform(struct gl_program_parameter_list *paramList, const char *name, GLuint size, GLenum datatype, const GLfloat *values); -extern void -_mesa_use_uniform(struct gl_program_parameter_list *paramList, - const char *name); - extern GLint _mesa_add_sampler(struct gl_program_parameter_list *paramList, const char *name, GLenum datatype, int array_length); -- cgit v1.2.3 From 45388b5467d66a887e9c76b66ae126ec07d4125a Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 24 Aug 2010 13:51:35 -0700 Subject: glsl: Make uniform linking generate separate uniforms for struct members. This is a step towards making the linker code usable as our uniform setup, instead of having it wedged into ir_to_mesa.cpp. --- src/glsl/linker.cpp | 131 +++++++++++++++++++++++++++++++++++----------------- 1 file changed, 89 insertions(+), 42 deletions(-) (limited to 'src') diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp index c5c8c9cdd6..cb06036ef2 100644 --- a/src/glsl/linker.cpp +++ b/src/glsl/linker.cpp @@ -877,6 +877,83 @@ update_uniform_array_sizes(struct gl_shader_program *prog) } } +static void +add_uniform(void *mem_ctx, exec_list *uniforms, struct hash_table *ht, + const char *name, const glsl_type *type, GLenum shader_type, + unsigned *next_shader_pos, unsigned *total_uniforms) +{ + if (type->is_record()) { + for (unsigned int i = 0; i < type->length; i++) { + const glsl_type *field_type = type->fields.structure[i].type; + char *field_name = talloc_asprintf(mem_ctx, "%s.%s", name, + type->fields.structure[i].name); + + add_uniform(mem_ctx, uniforms, ht, field_name, field_type, + shader_type, next_shader_pos, total_uniforms); + } + } else { + uniform_node *n = (uniform_node *) hash_table_find(ht, name); + unsigned int vec4_slots; + const glsl_type *array_elem_type = NULL; + + if (type->is_array()) { + array_elem_type = type->fields.array; + /* Array of structures. */ + if (array_elem_type->is_record()) { + for (unsigned int i = 0; i < type->length; i++) { + char *elem_name = talloc_asprintf(mem_ctx, "%s[%d]", name, i); + add_uniform(mem_ctx, uniforms, ht, elem_name, array_elem_type, + shader_type, next_shader_pos, total_uniforms); + } + return; + } + } + + /* Fix the storage size of samplers at 1 vec4 each. Be sure to pad out + * vectors to vec4 slots. + */ + if (type->is_array()) { + if (array_elem_type->is_sampler()) + vec4_slots = type->length; + else + vec4_slots = type->length * array_elem_type->matrix_columns; + } else if (type->is_sampler()) { + vec4_slots = 1; + } else { + vec4_slots = type->matrix_columns; + } + + if (n == NULL) { + n = (uniform_node *) calloc(1, sizeof(struct uniform_node)); + n->u = (gl_uniform *) calloc(1, sizeof(struct gl_uniform)); + n->slots = vec4_slots; + + n->u->Name = strdup(name); + n->u->VertPos = -1; + n->u->FragPos = -1; + n->u->GeomPos = -1; + (*total_uniforms)++; + + hash_table_insert(ht, n, name); + uniforms->push_tail(& n->link); + } + + switch (shader_type) { + case GL_VERTEX_SHADER: + n->u->VertPos = *next_shader_pos; + break; + case GL_FRAGMENT_SHADER: + n->u->FragPos = *next_shader_pos; + break; + case GL_GEOMETRY_SHADER: + n->u->GeomPos = *next_shader_pos; + break; + } + + (*next_shader_pos) += vec4_slots; + } +} + void assign_uniform_locations(struct gl_shader_program *prog) { @@ -885,6 +962,7 @@ assign_uniform_locations(struct gl_shader_program *prog) unsigned total_uniforms = 0; hash_table *ht = hash_table_ctor(32, hash_table_string_hash, hash_table_string_compare); + void *mem_ctx = talloc_new(NULL); update_uniform_array_sizes(prog); @@ -897,54 +975,23 @@ assign_uniform_locations(struct gl_shader_program *prog) if ((var == NULL) || (var->mode != ir_var_uniform)) continue; - const unsigned vec4_slots = (var->component_slots() + 3) / 4; - 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. + if (strncmp(var->name, "gl_", 3) == 0) { + /* At the moment, we don't allocate uniform locations for + * builtin uniforms. It's permitted by spec, and we'll + * likely switch to doing that at some point, but not yet. */ continue; } - 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 = strdup(var->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++; - } + add_uniform(mem_ctx, &uniforms, ht, var->name, var->type, + prog->_LinkedShaders[i]->Type, + &next_position, &total_uniforms); } } + talloc_free(mem_ctx); + gl_uniform_list *ul = (gl_uniform_list *) calloc(1, sizeof(gl_uniform_list)); @@ -960,8 +1007,8 @@ assign_uniform_locations(struct gl_shader_program *prog) next = (uniform_node *) node->link.next; node->link.remove(); - memcpy(&ul->Uniforms[idx], node->u, sizeof(gl_uniform) * node->slots); - idx += node->slots; + memcpy(&ul->Uniforms[idx], node->u, sizeof(gl_uniform)); + idx++; free(node->u); free(node); -- cgit v1.2.3 From 0924ba0c3496160a134d37cec800f902ae805b9c Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 24 Aug 2010 14:27:27 -0700 Subject: ir_to_mesa: Convert this code to using linker.cpp's uniform locations. Fixes: glsl-fs-uniform-array-4. --- src/glsl/linker.cpp | 1 + src/mesa/program/ir_to_mesa.cpp | 199 +++++++++++++++------------------------- src/mesa/program/prog_uniform.h | 5 +- 3 files changed, 78 insertions(+), 127 deletions(-) (limited to 'src') diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp index cb06036ef2..0348bd01e8 100644 --- a/src/glsl/linker.cpp +++ b/src/glsl/linker.cpp @@ -929,6 +929,7 @@ add_uniform(void *mem_ctx, exec_list *uniforms, struct hash_table *ht, n->slots = vec4_slots; n->u->Name = strdup(name); + n->u->Type = type; n->u->VertPos = -1; n->u->FragPos = -1; n->u->GeomPos = -1; diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp index 4429b7468d..4a4278eb1a 100644 --- a/src/mesa/program/ir_to_mesa.cpp +++ b/src/mesa/program/ir_to_mesa.cpp @@ -260,13 +260,6 @@ public: GLboolean try_emit_mad(ir_expression *ir, int mul_operand); - int add_uniform(const char *name, - const glsl_type *type); - void add_aggregate_uniform(ir_instruction *ir, - const char *name, - const struct glsl_type *type, - struct ir_to_mesa_dst_reg temp); - struct hash_table *sampler_map; void set_sampler_location(ir_variable *sampler, int location); @@ -522,10 +515,10 @@ type_size(const struct glsl_type *type) } return size; case GLSL_TYPE_SAMPLER: - /* Samplers take up no register space, since they're baked in at - * link time. + /* Samplers take up one slot in UNIFORMS[], but they're baked in + * at link time. */ - return 0; + return 1; default: assert(0); return 0; @@ -1290,7 +1283,6 @@ get_builtin_matrix_ref(void *mem_ctx, struct gl_program *prog, ir_variable *var, tokens[1] = 0; /* unused array index */ base_pos = add_matrix_ref(prog, tokens); } - tokens[4] = matrices[i].modifier; entry = new(mem_ctx) variable_storage(var, PROGRAM_STATE_VAR, @@ -1303,76 +1295,10 @@ get_builtin_matrix_ref(void *mem_ctx, struct gl_program *prog, ir_variable *var, return NULL; } -int -ir_to_mesa_visitor::add_uniform(const char *name, - const glsl_type *type) -{ - int len; - - if (type->is_vector() || - type->is_scalar()) { - len = type->vector_elements; - } else { - len = type_size(type) * 4; - } - - int loc = _mesa_add_uniform(this->prog->Parameters, - name, - len, - type->gl_type, - NULL); - - return loc; -} - -/* Recursively add all the members of the aggregate uniform as uniform names - * to Mesa, moving those uniforms to our structured temporary. - */ -void -ir_to_mesa_visitor::add_aggregate_uniform(ir_instruction *ir, - const char *name, - const struct glsl_type *type, - struct ir_to_mesa_dst_reg temp) -{ - int loc; - - if (type->is_record()) { - void *mem_ctx = talloc_new(NULL); - - for (unsigned int i = 0; i < type->length; i++) { - const glsl_type *field_type = type->fields.structure[i].type; - - add_aggregate_uniform(ir, - talloc_asprintf(mem_ctx, "%s.%s", name, - type->fields.structure[i].name), - field_type, temp); - temp.index += type_size(field_type); - } - - talloc_free(mem_ctx); - - return; - } - - assert(type->is_vector() || type->is_scalar() || !"FINISHME: other types"); - - loc = add_uniform(name, type); - - ir_to_mesa_src_reg uniform(PROGRAM_UNIFORM, loc, type); - - for (int i = 0; i < type_size(type); i++) { - ir_to_mesa_emit_op1(ir, OPCODE_MOV, temp, uniform); - temp.index++; - uniform.index++; - } -} - - void ir_to_mesa_visitor::visit(ir_dereference_variable *ir) { variable_storage *entry = find_variable_storage(ir->var); - unsigned int loc; if (!entry) { switch (ir->var->mode) { @@ -1382,7 +1308,6 @@ ir_to_mesa_visitor::visit(ir_dereference_variable *ir) if (entry) break; - /* FINISHME: Fix up uniform name for arrays and things */ if (ir->var->type->base_type == GLSL_TYPE_SAMPLER || (ir->var->type->base_type == GLSL_TYPE_ARRAY && ir->var->type->fields.array->base_type == GLSL_TYPE_SAMPLER)) { @@ -1404,30 +1329,8 @@ ir_to_mesa_visitor::visit(ir_dereference_variable *ir) break; } - assert(ir->var->type->gl_type != 0 && - ir->var->type->gl_type != GL_INVALID_ENUM); - - /* Oh, the joy of aggregate types in Mesa. Like constants, - * we can only really do vec4s. So, make a temp, chop the - * aggregate up into vec4s, and move those vec4s to the temp. - */ - if (ir->var->type->is_record()) { - ir_to_mesa_src_reg temp = get_temp(ir->var->type); - - entry = new(mem_ctx) variable_storage(ir->var, - temp.file, - temp.index); - this->variables.push_tail(entry); - - add_aggregate_uniform(ir->var, ir->var->name, ir->var->type, - ir_to_mesa_dst_reg_from_src(temp)); - break; - } - - loc = add_uniform(ir->var->name, - ir->var->type); - - entry = new(mem_ctx) variable_storage(ir->var, PROGRAM_UNIFORM, loc); + entry = new(mem_ctx) variable_storage(ir->var, PROGRAM_UNIFORM, + ir->var->location); this->variables.push_tail(entry); break; case ir_var_in: @@ -2338,25 +2241,81 @@ count_resources(struct gl_program *prog) _mesa_update_shader_textures_used(prog); } -/* Each stage has some uniforms in its Parameters list. The Uniforms - * list for the linked shader program has a pointer to these uniforms - * in each of the stage's Parameters list, so that their values can be - * updated when a uniform is set. +/* Add the uniforms to the parameters. The linker chose locations + * in our parameters lists (which weren't created yet), which the + * uniforms code will use to poke values into our parameters list + * when uniforms are updated. */ static void -link_uniforms_to_shared_uniform_list(struct gl_uniform_list *uniforms, - struct gl_program *prog) +add_uniforms_to_parameters_list(struct gl_shader_program *shader_program, + struct gl_shader *shader, + struct gl_program *prog) { unsigned int i; - for (i = 0; i < prog->Parameters->NumParameters; i++) { - const struct gl_program_parameter *p = prog->Parameters->Parameters + i; + for (i = 0; i < shader_program->Uniforms->NumUniforms; i++) { + struct gl_uniform *uniform = shader_program->Uniforms->Uniforms + i; + const glsl_type *type = uniform->Type; + unsigned int size; + int parameter_index = -1; + + switch (shader->Type) { + case GL_VERTEX_SHADER: + parameter_index = uniform->VertPos; + break; + case GL_FRAGMENT_SHADER: + parameter_index = uniform->FragPos; + break; + case GL_GEOMETRY_SHADER: + parameter_index = uniform->GeomPos; + break; + } + + /* Only add uniforms used in our target. */ + if (parameter_index == -1) + continue; + + if (type->is_vector() || + type->is_scalar()) { + size = type->vector_elements; + } else { + size = type_size(type) * 4; + } + + if (type->is_sampler() || + (type->is_array() && type->fields.array->is_sampler())) { + int array_length; - if (p->Type == PROGRAM_UNIFORM || p->Type == PROGRAM_SAMPLER) { - struct gl_uniform *uniform = - _mesa_append_uniform(uniforms, p->Name, prog->Target, i); - if (uniform) - uniform->Initialized = p->Initialized; + if (type->is_array()) + array_length = type->length; + else + array_length = 1; + + (void)_mesa_add_sampler(prog->Parameters, + uniform->Name, + type->gl_type, + array_length); + } else { + GLint index = _mesa_lookup_parameter_index(prog->Parameters, -1, + uniform->Name); + + if (index < 0) { + index = _mesa_add_parameter(prog->Parameters, PROGRAM_UNIFORM, + uniform->Name, size, type->gl_type, + NULL, NULL, 0x0); + + /* The location chosen in the Parameters list here (returned + * from _mesa_add_uniform) has to match what the linker chose. + */ + if (index != parameter_index) { + shader_program->InfoLog = + talloc_asprintf_append(shader_program->InfoLog, + "Allocation of uniform `%s' to target " + "failed (%d vs %d)\n", uniform->Name, + index, parameter_index); + shader_program->LinkStatus = false; + } + } } } } @@ -2498,6 +2457,8 @@ get_mesa_program(GLcontext *ctx, struct gl_shader_program *shader_program, v.ctx = ctx; v.prog = prog; + add_uniforms_to_parameters_list(shader_program, shader, prog); + /* Emit Mesa IR for main(). */ visit_exec_list(shader->ir, &v); v.ir_to_mesa_emit_op0(NULL, OPCODE_END); @@ -2676,8 +2637,6 @@ _mesa_ir_link_shader(GLcontext *ctx, struct gl_shader_program *prog) linked_prog = get_mesa_program(ctx, prog, prog->_LinkedShaders[i]); - link_uniforms_to_shared_uniform_list(prog->Uniforms, linked_prog); - switch (prog->_LinkedShaders[i]->Type) { case GL_VERTEX_SHADER: _mesa_reference_vertprog(ctx, &prog->VertexProgram, @@ -2801,12 +2760,6 @@ _mesa_glsl_link_shader(GLcontext *ctx, struct gl_shader_program *prog) if (prog->LinkStatus) { link_shaders(ctx, prog); - - /* We don't use the linker's uniforms list, and cook up our own at - * generate time. - */ - _mesa_free_uniform_list(prog->Uniforms); - prog->Uniforms = _mesa_new_uniform_list(); } if (prog->LinkStatus) { diff --git a/src/mesa/program/prog_uniform.h b/src/mesa/program/prog_uniform.h index 7988d534a7..67f78006ea 100644 --- a/src/mesa/program/prog_uniform.h +++ b/src/mesa/program/prog_uniform.h @@ -51,10 +51,7 @@ struct gl_uniform GLint FragPos; GLint GeomPos; 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 + const struct glsl_type *Type; }; -- cgit v1.2.3 From 9ab1332d749e8e7eda2896c25725e245fd0f8444 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 24 Aug 2010 21:02:22 -0700 Subject: mesa: Remove now-unused _mesa_add_uniform. We had to inline it to avoid doing a double-lookup in the process of adding assertion checks. --- src/mesa/program/prog_parameter.c | 30 ------------------------------ src/mesa/program/prog_parameter.h | 5 ----- 2 files changed, 35 deletions(-) (limited to 'src') diff --git a/src/mesa/program/prog_parameter.c b/src/mesa/program/prog_parameter.c index 7e01f675d3..b3770f83b5 100644 --- a/src/mesa/program/prog_parameter.c +++ b/src/mesa/program/prog_parameter.c @@ -284,36 +284,6 @@ _mesa_add_unnamed_constant(struct gl_program_parameter_list *paramList, return pos; } - -/** - * Add a uniform to the parameter list. - * Note that if the uniform is an array, size may be greater than - * what's implied by the datatype. - * \param name uniform's name - * \param size number of floats to allocate - * \param datatype GL_FLOAT_VEC3, GL_FLOAT_MAT4, etc. - */ -GLint -_mesa_add_uniform(struct gl_program_parameter_list *paramList, - const char *name, GLuint size, GLenum datatype, - const GLfloat *values) -{ - GLint i = _mesa_lookup_parameter_index(paramList, -1, name); - ASSERT(datatype != GL_NONE); - if (i >= 0 && paramList->Parameters[i].Type == PROGRAM_UNIFORM) { - ASSERT(paramList->Parameters[i].Size == size); - ASSERT(paramList->Parameters[i].DataType == datatype); - /* already in list */ - return i; - } - else { - i = _mesa_add_parameter(paramList, PROGRAM_UNIFORM, name, - size, datatype, values, NULL, 0x0); - return i; - } -} - - /** * Add a sampler to the parameter list. * \param name uniform's name diff --git a/src/mesa/program/prog_parameter.h b/src/mesa/program/prog_parameter.h index 5381a6dc0f..b3b11a9536 100644 --- a/src/mesa/program/prog_parameter.h +++ b/src/mesa/program/prog_parameter.h @@ -130,11 +130,6 @@ _mesa_add_unnamed_constant(struct gl_program_parameter_list *paramList, const GLfloat values[4], GLuint size, GLuint *swizzleOut); -extern GLint -_mesa_add_uniform(struct gl_program_parameter_list *paramList, - const char *name, GLuint size, GLenum datatype, - const GLfloat *values); - extern GLint _mesa_add_sampler(struct gl_program_parameter_list *paramList, const char *name, GLenum datatype, int array_length); -- cgit v1.2.3 From aa452e20bff9aea2ecb994c9f7b413b0726a04f3 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 24 Aug 2010 21:43:07 -0700 Subject: ir_to_mesa: Add support for samplers in structures. Fixes: glsl-fs-uniform-sampler-struct glsl-fs-sampler-numbering-3 Bug #29690 --- src/mesa/program/ir_to_mesa.cpp | 231 +++++++++++++++++++++------------------- 1 file changed, 122 insertions(+), 109 deletions(-) (limited to 'src') diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp index 4a4278eb1a..7fb5974946 100644 --- a/src/mesa/program/ir_to_mesa.cpp +++ b/src/mesa/program/ir_to_mesa.cpp @@ -173,6 +173,7 @@ public: GLcontext *ctx; struct gl_program *prog; + struct gl_shader_program *shader_program; int next_temp; @@ -260,10 +261,7 @@ public: GLboolean try_emit_mad(ir_expression *ir, int mul_operand); - struct hash_table *sampler_map; - - void set_sampler_location(ir_variable *sampler, int location); - int get_sampler_location(ir_variable *sampler); + int get_sampler_uniform_value(ir_dereference *deref); void *mem_ctx; }; @@ -368,25 +366,6 @@ ir_to_mesa_visitor::ir_to_mesa_emit_op0(ir_instruction *ir, ir_to_mesa_undef); } -void -ir_to_mesa_visitor::set_sampler_location(ir_variable *sampler, int location) -{ - if (this->sampler_map == NULL) { - this->sampler_map = hash_table_ctor(0, hash_table_pointer_hash, - hash_table_pointer_compare); - } - - hash_table_insert(this->sampler_map, (void *)(uintptr_t)location, sampler); -} - -int -ir_to_mesa_visitor::get_sampler_location(ir_variable *sampler) -{ - void *result = hash_table_find(this->sampler_map, sampler); - - return (int)(uintptr_t)result; -} - inline ir_to_mesa_dst_reg ir_to_mesa_dst_reg_from_src(ir_to_mesa_src_reg reg) { @@ -1308,27 +1287,6 @@ ir_to_mesa_visitor::visit(ir_dereference_variable *ir) if (entry) break; - if (ir->var->type->base_type == GLSL_TYPE_SAMPLER || - (ir->var->type->base_type == GLSL_TYPE_ARRAY && - ir->var->type->fields.array->base_type == GLSL_TYPE_SAMPLER)) { - int array_length; - - if (ir->var->type->base_type == GLSL_TYPE_ARRAY) - array_length = ir->var->type->length; - else - array_length = 1; - int sampler = _mesa_add_sampler(this->prog->Parameters, - ir->var->name, - ir->var->type->gl_type, - array_length); - set_sampler_location(ir->var, sampler); - - entry = new(mem_ctx) variable_storage(ir->var, PROGRAM_SAMPLER, - sampler); - this->variables.push_tail(entry); - break; - } - entry = new(mem_ctx) variable_storage(ir->var, PROGRAM_UNIFORM, ir->var->location); this->variables.push_tail(entry); @@ -1825,6 +1783,91 @@ ir_to_mesa_visitor::visit(ir_call *ir) this->result = entry->return_reg; } +class get_sampler_name : public ir_hierarchical_visitor +{ +public: + get_sampler_name(ir_to_mesa_visitor *mesa, ir_dereference *last) + { + this->mem_ctx = mesa->mem_ctx; + this->mesa = mesa; + this->name = NULL; + this->offset = 0; + this->last = last; + } + + virtual ir_visitor_status visit(ir_dereference_variable *ir) + { + this->name = ir->var->name; + return visit_continue; + } + + virtual ir_visitor_status visit_leave(ir_dereference_record *ir) + { + this->name = talloc_asprintf(mem_ctx, "%s.%s", name, ir->field); + return visit_continue; + } + + virtual ir_visitor_status visit_leave(ir_dereference_array *ir) + { + ir_constant *index = ir->array_index->as_constant(); + int i; + + if (index) { + i = index->value.i[0]; + } else { + /* GLSL 1.10 and 1.20 allowed variable sampler array indices, + * while GLSL 1.30 requires that the array indices be + * constant integer expressions. We don't expect any driver + * to actually work with a really variable array index, so + * all that would work would be an unrolled loop counter that ends + * up being constant above. + */ + mesa->shader_program->InfoLog = + talloc_asprintf_append(mesa->shader_program->InfoLog, + "warning: Variable sampler array index " + "unsupported.\nThis feature of the language " + "was removed in GLSL 1.20 and is unlikely " + "to be supported for 1.10 in Mesa.\n"); + i = 0; + } + if (ir != last) { + this->name = talloc_asprintf(mem_ctx, "%s[%d]", name, i); + } else { + offset = i; + } + return visit_continue; + } + + ir_to_mesa_visitor *mesa; + const char *name; + void *mem_ctx; + int offset; + ir_dereference *last; +}; + +int +ir_to_mesa_visitor::get_sampler_uniform_value(ir_dereference *sampler) +{ + get_sampler_name getname(this, sampler); + + sampler->accept(&getname); + + GLint index = _mesa_lookup_parameter_index(prog->Parameters, -1, + getname.name); + + if (index < 0) { + this->shader_program->InfoLog = + talloc_asprintf_append(this->shader_program->InfoLog, + "failed to find sampler named %s.\n", + getname.name); + this->shader_program->LinkStatus = GL_FALSE; + return 0; + } + + index += getname.offset; + + return this->prog->Parameters->ParameterValues[index][0]; +} void ir_to_mesa_visitor::visit(ir_texture *ir) @@ -1925,34 +1968,9 @@ ir_to_mesa_visitor::visit(ir_texture *ir) if (ir->shadow_comparitor) inst->tex_shadow = GL_TRUE; - ir_variable *sampler = ir->sampler->variable_referenced(); + inst->sampler = get_sampler_uniform_value(ir->sampler); - /* generate the mapping, remove when we generate storage at - * declaration time - */ - ir->sampler->accept(this); - - inst->sampler = get_sampler_location(sampler); - - ir_dereference_array *sampler_array = ir->sampler->as_dereference_array(); - if (sampler_array) { - ir_constant *array_index = - sampler_array->array_index->constant_expression_value(); - - /* GLSL 1.10 and 1.20 allowed variable sampler array indices, - * while GLSL 1.30 requires that the array indices be constant - * integer expressions. We don't expect any driver to actually - * work with a really variable array index, and in 1.20 all that - * would work would be an unrolled loop counter, so assert that - * we ended up with a constant at least.. - */ - assert(array_index); - inst->sampler += array_index->value.i[0]; - } - - const glsl_type *sampler_type = sampler->type; - while (sampler_type->base_type == GLSL_TYPE_ARRAY) - sampler_type = sampler_type->fields.array; + const glsl_type *sampler_type = ir->sampler->type; switch (sampler_type->sampler_dimensionality) { case GLSL_SAMPLER_DIM_1D: @@ -2066,7 +2084,6 @@ ir_to_mesa_visitor::ir_to_mesa_visitor() result.file = PROGRAM_UNDEFINED; next_temp = 1; next_signature_id = 1; - sampler_map = NULL; current_function = NULL; mem_ctx = talloc_new(NULL); } @@ -2074,8 +2091,6 @@ ir_to_mesa_visitor::ir_to_mesa_visitor() ir_to_mesa_visitor::~ir_to_mesa_visitor() { talloc_free(mem_ctx); - if (this->sampler_map) - hash_table_dtor(this->sampler_map); } static struct prog_src_register @@ -2222,12 +2237,6 @@ count_resources(struct gl_program *prog) for (i = 0; i < prog->NumInstructions; i++) { struct prog_instruction *inst = &prog->Instructions[i]; - /* 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; @@ -2252,6 +2261,7 @@ add_uniforms_to_parameters_list(struct gl_shader_program *shader_program, struct gl_program *prog) { unsigned int i; + unsigned int next_sampler = 0; for (i = 0; i < shader_program->Uniforms->NumUniforms; i++) { struct gl_uniform *uniform = shader_program->Uniforms->Uniforms + i; @@ -2282,39 +2292,41 @@ add_uniforms_to_parameters_list(struct gl_shader_program *shader_program, size = type_size(type) * 4; } + gl_register_file file; if (type->is_sampler() || (type->is_array() && type->fields.array->is_sampler())) { - int array_length; + file = PROGRAM_SAMPLER; + } else { + file = PROGRAM_UNIFORM; + } - if (type->is_array()) - array_length = type->length; - else - array_length = 1; + GLint index = _mesa_lookup_parameter_index(prog->Parameters, -1, + uniform->Name); - (void)_mesa_add_sampler(prog->Parameters, - uniform->Name, - type->gl_type, - array_length); - } else { - GLint index = _mesa_lookup_parameter_index(prog->Parameters, -1, - uniform->Name); - - if (index < 0) { - index = _mesa_add_parameter(prog->Parameters, PROGRAM_UNIFORM, - uniform->Name, size, type->gl_type, - NULL, NULL, 0x0); - - /* The location chosen in the Parameters list here (returned - * from _mesa_add_uniform) has to match what the linker chose. - */ - if (index != parameter_index) { - shader_program->InfoLog = - talloc_asprintf_append(shader_program->InfoLog, - "Allocation of uniform `%s' to target " - "failed (%d vs %d)\n", uniform->Name, - index, parameter_index); - shader_program->LinkStatus = false; - } + if (index < 0) { + index = _mesa_add_parameter(prog->Parameters, file, + uniform->Name, size, type->gl_type, + NULL, NULL, 0x0); + + /* Sampler uniform values are stored in prog->SamplerUnits, + * and the entry in that array is selected by this index we + * store in ParameterValues[]. + */ + if (file == PROGRAM_SAMPLER) { + for (unsigned int j = 0; j < size / 4; j++) + prog->Parameters->ParameterValues[index + j][0] = next_sampler++; + } + + /* The location chosen in the Parameters list here (returned + * from _mesa_add_uniform) has to match what the linker chose. + */ + if (index != parameter_index) { + shader_program->InfoLog = + talloc_asprintf_append(shader_program->InfoLog, + "Allocation of uniform `%s' to target " + "failed (%d vs %d)\n", uniform->Name, + index, parameter_index); + shader_program->LinkStatus = false; } } } @@ -2456,6 +2468,7 @@ get_mesa_program(GLcontext *ctx, struct gl_shader_program *shader_program, prog->Attributes = _mesa_new_parameter_list(); v.ctx = ctx; v.prog = prog; + v.shader_program = shader_program; add_uniforms_to_parameters_list(shader_program, shader, prog); -- cgit v1.2.3 From b5c07b9226d8e7de78f6367b5799b39caf820ef3 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 24 Aug 2010 21:45:40 -0700 Subject: mesa: Remove now-unused _mesa_add_sampler(). We do the generation of "what sampler number within Parameters are we" right in ir_to_mesa.cpp, instead of repeatedly walking the existing list to find out. --- src/mesa/program/prog_parameter.c | 37 ------------------------------------- src/mesa/program/prog_parameter.h | 4 ---- 2 files changed, 41 deletions(-) (limited to 'src') diff --git a/src/mesa/program/prog_parameter.c b/src/mesa/program/prog_parameter.c index b3770f83b5..40dc92cb20 100644 --- a/src/mesa/program/prog_parameter.c +++ b/src/mesa/program/prog_parameter.c @@ -284,43 +284,6 @@ _mesa_add_unnamed_constant(struct gl_program_parameter_list *paramList, return pos; } -/** - * Add a sampler to the parameter list. - * \param name uniform's name - * \param datatype GL_SAMPLER_2D, GL_SAMPLER_2D_RECT_ARB, etc. - * \param index the sampler number (as seen in TEX instructions) - * \return sampler index (starting at zero) or -1 if error - */ -GLint -_mesa_add_sampler(struct gl_program_parameter_list *paramList, - const char *name, GLenum datatype, int array_length) -{ - GLint i = _mesa_lookup_parameter_index(paramList, -1, name); - if (i >= 0 && paramList->Parameters[i].Type == PROGRAM_SAMPLER) { - ASSERT(paramList->Parameters[i].Size == 4 * array_length); - ASSERT(paramList->Parameters[i].DataType == datatype); - /* already in list */ - return (GLint) paramList->ParameterValues[i][0]; - } - else { - GLuint i; - /* One integer texture unit number goes in each parameter location. */ - const GLint size = 4 * array_length; - GLfloat value[4]; - GLint numSamplers = 0; - for (i = 0; i < paramList->NumParameters; i++) { - if (paramList->Parameters[i].Type == PROGRAM_SAMPLER) - numSamplers++; - } - value[0] = (GLfloat) numSamplers; - value[1] = value[2] = value[3] = 0.0F; - (void) _mesa_add_parameter(paramList, PROGRAM_SAMPLER, name, - size, datatype, value, NULL, 0x0); - return numSamplers; - } -} - - /** * Add parameter representing a varying variable. */ diff --git a/src/mesa/program/prog_parameter.h b/src/mesa/program/prog_parameter.h index b3b11a9536..10cbbe57a6 100644 --- a/src/mesa/program/prog_parameter.h +++ b/src/mesa/program/prog_parameter.h @@ -130,10 +130,6 @@ _mesa_add_unnamed_constant(struct gl_program_parameter_list *paramList, const GLfloat values[4], GLuint size, GLuint *swizzleOut); -extern GLint -_mesa_add_sampler(struct gl_program_parameter_list *paramList, - const char *name, GLenum datatype, int array_length); - extern GLint _mesa_add_varying(struct gl_program_parameter_list *paramList, const char *name, GLuint size, GLenum datatype, -- cgit v1.2.3 From bd25e23bf3740f59ce8859848c715daeb9e9821f Mon Sep 17 00:00:00 2001 From: Jerome Glisse Date: Tue, 24 Aug 2010 17:46:31 -0400 Subject: r600g: simplify states Directly build PM4 packet, avoid using malloc (no states are bigger than 128 dwords), remove unecessary informations, remove pm4 building in favor of prebuild pm4 packet. Signed-off-by: Jerome Glisse --- src/gallium/drivers/r600/r600_blit.c | 61 +- src/gallium/drivers/r600/r600_context.c | 9 +- src/gallium/drivers/r600/r600_draw.c | 46 +- src/gallium/drivers/r600/r600_query.c | 6 +- src/gallium/drivers/r600/r600_shader.c | 7 +- src/gallium/drivers/r600/r600_state.c | 78 +- src/gallium/drivers/r600/r600_texture.c | 18 +- src/gallium/drivers/r600/radeon.h | 669 +-- src/gallium/winsys/r600/drm/r600_state.c | 8091 ++++++++++++++++++++++++++-- src/gallium/winsys/r600/drm/r600_states.h | 562 -- src/gallium/winsys/r600/drm/radeon.c | 44 - src/gallium/winsys/r600/drm/radeon_ctx.c | 313 +- src/gallium/winsys/r600/drm/radeon_draw.c | 3 +- src/gallium/winsys/r600/drm/radeon_priv.h | 34 +- src/gallium/winsys/r600/drm/radeon_state.c | 56 +- 15 files changed, 8277 insertions(+), 1720 deletions(-) delete mode 100644 src/gallium/winsys/r600/drm/r600_states.h (limited to 'src') diff --git a/src/gallium/drivers/r600/r600_blit.c b/src/gallium/drivers/r600/r600_blit.c index 72175fbbd5..d3b722c82f 100644 --- a/src/gallium/drivers/r600/r600_blit.c +++ b/src/gallium/drivers/r600/r600_blit.c @@ -132,7 +132,7 @@ static void r600_resource_copy_region(struct pipe_context *ctx, unsigned srcx, unsigned srcy, unsigned srcz, unsigned width, unsigned height) { - util_resource_copy_region(pipe, dst, subdst, dstx, dsty, dstz, + util_resource_copy_region(ctx, dst, subdst, dstx, dsty, dstz, src, subsrc, srcx, srcy, srcz, width, height); } @@ -190,7 +190,7 @@ static int r600_blit_state_vs_resources(struct r600_screen *rscreen, struct r600 memcpy(bo->data, vbo, 128); radeon_bo_unmap(rscreen->rw, bo); - rstate = radeon_state(rscreen->rw, R600_VS_RESOURCE_TYPE, R600_VS_RESOURCE + 0); + rstate = radeon_state(rscreen->rw, R600_VS_RESOURCE0 + 0); if (rstate == NULL) { radeon_bo_decref(rscreen->rw, bo); return -ENOMEM; @@ -199,33 +199,35 @@ static int r600_blit_state_vs_resources(struct r600_screen *rscreen, struct r600 /* set states (most default value are 0 and struct already * initialized to 0, thus avoid resetting them) */ - rstate->states[R600_VS_RESOURCE__RESOURCE160_WORD0] = 0x00000000; - rstate->states[R600_VS_RESOURCE__RESOURCE160_WORD1] = 0x00000080; - rstate->states[R600_VS_RESOURCE__RESOURCE160_WORD2] = 0x02302000; - rstate->states[R600_VS_RESOURCE__RESOURCE160_WORD3] = 0x00000000; - rstate->states[R600_VS_RESOURCE__RESOURCE160_WORD4] = 0x00000000; - rstate->states[R600_VS_RESOURCE__RESOURCE160_WORD5] = 0x00000000; - rstate->states[R600_VS_RESOURCE__RESOURCE160_WORD6] = 0xC0000000; + rstate->states[R600_RESOURCE__RESOURCE_WORD0] = 0x00000000; + rstate->states[R600_RESOURCE__RESOURCE_WORD1] = 0x00000080; + rstate->states[R600_RESOURCE__RESOURCE_WORD2] = 0x02302000; + rstate->states[R600_RESOURCE__RESOURCE_WORD3] = 0x00000000; + rstate->states[R600_RESOURCE__RESOURCE_WORD4] = 0x00000000; + rstate->states[R600_RESOURCE__RESOURCE_WORD5] = 0x00000000; + rstate->states[R600_RESOURCE__RESOURCE_WORD6] = 0xC0000000; rstate->bo[0] = bo; rstate->nbo = 1; rstate->placement[0] = RADEON_GEM_DOMAIN_GTT; + rstate->reloc_pm4_id[0] = R600_RESOURCE__RESOURCE_BO0_ID; + rstate->reloc_pm4_id[1] = R600_RESOURCE__RESOURCE_BO1_ID; if (radeon_state_pm4(rstate)) { radeon_state_decref(rstate); return -ENOMEM; } bstates->vs_resource0 = rstate; - rstate = radeon_state(rscreen->rw, R600_VS_RESOURCE_TYPE, R600_VS_RESOURCE + 1); + rstate = radeon_state(rscreen->rw, R600_VS_RESOURCE0 + 1); if (rstate == NULL) { return -ENOMEM; } - rstate->states[R600_VS_RESOURCE__RESOURCE160_WORD0] = 0x00000010; - rstate->states[R600_VS_RESOURCE__RESOURCE160_WORD1] = 0x00000070; - rstate->states[R600_VS_RESOURCE__RESOURCE160_WORD2] = 0x02302000; - rstate->states[R600_VS_RESOURCE__RESOURCE160_WORD3] = 0x00000000; - rstate->states[R600_VS_RESOURCE__RESOURCE160_WORD4] = 0x00000000; - rstate->states[R600_VS_RESOURCE__RESOURCE160_WORD5] = 0x00000000; - rstate->states[R600_VS_RESOURCE__RESOURCE160_WORD6] = 0xC0000000; + rstate->states[R600_RESOURCE__RESOURCE_WORD0] = 0x00000010; + rstate->states[R600_RESOURCE__RESOURCE_WORD1] = 0x00000070; + rstate->states[R600_RESOURCE__RESOURCE_WORD2] = 0x02302000; + rstate->states[R600_RESOURCE__RESOURCE_WORD3] = 0x00000000; + rstate->states[R600_RESOURCE__RESOURCE_WORD4] = 0x00000000; + rstate->states[R600_RESOURCE__RESOURCE_WORD5] = 0x00000000; + rstate->states[R600_RESOURCE__RESOURCE_WORD6] = 0xC0000000; rstate->bo[0] = radeon_bo_incref(rscreen->rw, bo); rstate->nbo = 1; rstate->placement[0] = RADEON_GEM_DOMAIN_GTT; @@ -303,7 +305,7 @@ static struct radeon_state *r600_blit_state_vs_shader(struct r600_screen *rscree } radeon_bo_unmap(rscreen->rw, bo); - rstate = radeon_state(rscreen->rw, R600_VS_SHADER_TYPE, R600_VS_SHADER); + rstate = radeon_state(rscreen->rw, R600_VS_SHADER); if (rstate == NULL) { radeon_bo_decref(rscreen->rw, bo); return NULL; @@ -321,6 +323,8 @@ static struct radeon_state *r600_blit_state_vs_shader(struct r600_screen *rscree rstate->nbo = 2; rstate->placement[0] = RADEON_GEM_DOMAIN_GTT; rstate->placement[2] = RADEON_GEM_DOMAIN_GTT; + rstate->reloc_pm4_id[0] = R600_VS_SHADER__SQ_PGM_START_VS_BO_ID; + rstate->reloc_pm4_id[1] = R600_VS_SHADER__SQ_PGM_START_FS_BO_ID; if (radeon_state_pm4(rstate)) { radeon_state_decref(rstate); @@ -374,7 +378,7 @@ static struct radeon_state *r600_blit_state_ps_shader(struct r600_screen *rscree } radeon_bo_unmap(rscreen->rw, bo); - rstate = radeon_state(rscreen->rw, R600_PS_SHADER_TYPE, R600_PS_SHADER); + rstate = radeon_state(rscreen->rw, R600_PS_SHADER); if (rstate == NULL) { radeon_bo_decref(rscreen->rw, bo); return NULL; @@ -391,6 +395,7 @@ static struct radeon_state *r600_blit_state_ps_shader(struct r600_screen *rscree rstate->bo[0] = bo; rstate->nbo = 1; rstate->placement[0] = RADEON_GEM_DOMAIN_GTT; + rstate->reloc_pm4_id[0] = R600_PS_SHADER__SQ_PGM_START_PS_BO_ID; if (radeon_state_pm4(rstate)) { radeon_state_decref(rstate); @@ -403,7 +408,7 @@ static struct radeon_state *r600_blit_state_vgt(struct r600_screen *rscreen) { struct radeon_state *rstate; - rstate = radeon_state(rscreen->rw, R600_VGT_TYPE, R600_VGT); + rstate = radeon_state(rscreen->rw, R600_VGT); if (rstate == NULL) return NULL; @@ -425,7 +430,7 @@ static struct radeon_state *r600_blit_state_draw(struct r600_screen *rscreen) { struct radeon_state *rstate; - rstate = radeon_state(rscreen->rw, R600_DRAW_TYPE, R600_DRAW); + rstate = radeon_state(rscreen->rw, R600_DRAW); if (rstate == NULL) return NULL; @@ -448,7 +453,7 @@ static struct radeon_state *r600_blit_state_vs_constant(struct r600_screen *rscr { struct radeon_state *rstate; - rstate = radeon_state(rscreen->rw, R600_VS_CONSTANT_TYPE, R600_VS_CONSTANT + id); + rstate = radeon_state(rscreen->rw, R600_VS_CONSTANT0 + id); if (rstate == NULL) return NULL; @@ -471,7 +476,7 @@ static struct radeon_state *r600_blit_state_rasterizer(struct r600_screen *rscre { struct radeon_state *rstate; - rstate = radeon_state(rscreen->rw, R600_RASTERIZER_TYPE, R600_RASTERIZER); + rstate = radeon_state(rscreen->rw, R600_RASTERIZER); if (rstate == NULL) return NULL; @@ -500,7 +505,7 @@ static struct radeon_state *r600_blit_state_dsa(struct r600_screen *rscreen) { struct radeon_state *rstate; - rstate = radeon_state(rscreen->rw, R600_DSA_TYPE, R600_DSA); + rstate = radeon_state(rscreen->rw, R600_DSA); if (rstate == NULL) return NULL; @@ -524,7 +529,7 @@ static struct radeon_state *r600_blit_state_blend(struct r600_screen *rscreen) { struct radeon_state *rstate; - rstate = radeon_state(rscreen->rw, R600_BLEND_TYPE, R600_BLEND); + rstate = radeon_state(rscreen->rw, R600_BLEND); if (rstate == NULL) return NULL; @@ -543,7 +548,7 @@ static struct radeon_state *r600_blit_state_cb_cntl(struct r600_screen *rscreen) { struct radeon_state *rstate; - rstate = radeon_state(rscreen->rw, R600_CB_CNTL_TYPE, R600_CB_CNTL); + rstate = radeon_state(rscreen->rw, R600_CB_CNTL); if (rstate == NULL) return NULL; @@ -786,10 +791,10 @@ int r600_blit_uncompress_depth(struct pipe_context *ctx, struct r600_resource_te r600_queries_suspend(ctx); /* schedule draw*/ - r = radeon_ctx_set_draw_new(rctx->ctx, draw); + r = radeon_ctx_set_draw(rctx->ctx, draw); if (r == -EBUSY) { r600_flush(ctx, 0, NULL); - r = radeon_ctx_set_draw_new(rctx->ctx, draw); + r = radeon_ctx_set_draw(rctx->ctx, draw); } if (r) { goto out; diff --git a/src/gallium/drivers/r600/r600_context.c b/src/gallium/drivers/r600/r600_context.c index 9af28356c5..790a85110b 100644 --- a/src/gallium/drivers/r600/r600_context.c +++ b/src/gallium/drivers/r600/r600_context.c @@ -53,12 +53,10 @@ void r600_flush(struct pipe_context *ctx, unsigned flags, /* suspend queries */ r600_queries_suspend(ctx); - if (radeon_ctx_pm4(rctx->ctx)) - goto out; /* FIXME dumping should be removed once shader support instructions * without throwing bad code */ - if (!rctx->ctx->cpm4) + if (!rctx->ctx->id) goto out; sprintf(dname, "gallium-%08d.bof", dc); if (dc < 2) { @@ -73,8 +71,7 @@ void r600_flush(struct pipe_context *ctx, unsigned flags, } dc++; out: - rctx->ctx = radeon_ctx_decref(rctx->ctx); - rctx->ctx = radeon_ctx(rscreen->rw); + radeon_ctx_clear(rctx->ctx); /* resume queries */ r600_queries_resume(ctx); } @@ -218,7 +215,7 @@ static void r600_init_config(struct r600_context *rctx) num_es_stack_entries = 0; break; } - rctx->hw_states.config = radeon_state(rctx->rw, R600_CONFIG_TYPE, R600_CONFIG); + rctx->hw_states.config = radeon_state(rctx->rw, R600_CONFIG); rctx->hw_states.config->states[R600_CONFIG__SQ_CONFIG] = 0x00000000; switch (family) { diff --git a/src/gallium/drivers/r600/r600_draw.c b/src/gallium/drivers/r600/r600_draw.c index 1eb868c4c7..a1a392ad2b 100644 --- a/src/gallium/drivers/r600/r600_draw.c +++ b/src/gallium/drivers/r600/r600_draw.c @@ -101,19 +101,21 @@ static int r600_draw_common(struct r600_draw *draw) rbuffer = (struct r600_resource*)vertex_buffer->buffer; offset = rctx->vertex_elements->elements[i].src_offset + vertex_buffer->buffer_offset; format = r600_translate_colorformat(rctx->vertex_elements->elements[i].src_format); - vs_resource = radeon_state(rscreen->rw, R600_VS_RESOURCE_TYPE, R600_VS_RESOURCE + i); + vs_resource = radeon_state(rscreen->rw, R600_VS_RESOURCE0 + i); if (vs_resource == NULL) return -ENOMEM; vs_resource->bo[0] = radeon_bo_incref(rscreen->rw, rbuffer->bo); vs_resource->nbo = 1; - vs_resource->states[R600_PS_RESOURCE__RESOURCE0_WORD0] = offset; - vs_resource->states[R600_PS_RESOURCE__RESOURCE0_WORD1] = rbuffer->bo->size - offset; - vs_resource->states[R600_PS_RESOURCE__RESOURCE0_WORD2] = S_038008_STRIDE(vertex_buffer->stride) | + vs_resource->reloc_pm4_id[0] = R600_RESOURCE__RESOURCE_BO0_ID; + vs_resource->reloc_pm4_id[1] = R600_RESOURCE__RESOURCE_BO1_ID; + vs_resource->states[R600_RESOURCE__RESOURCE_WORD0] = offset; + vs_resource->states[R600_RESOURCE__RESOURCE_WORD1] = rbuffer->bo->size - offset; + vs_resource->states[R600_RESOURCE__RESOURCE_WORD2] = S_038008_STRIDE(vertex_buffer->stride) | S_038008_DATA_FORMAT(format); - vs_resource->states[R600_PS_RESOURCE__RESOURCE0_WORD3] = 0x00000000; - vs_resource->states[R600_PS_RESOURCE__RESOURCE0_WORD4] = 0x00000000; - vs_resource->states[R600_PS_RESOURCE__RESOURCE0_WORD5] = 0x00000000; - vs_resource->states[R600_PS_RESOURCE__RESOURCE0_WORD6] = 0xC0000000; + vs_resource->states[R600_RESOURCE__RESOURCE_WORD3] = 0x00000000; + vs_resource->states[R600_RESOURCE__RESOURCE_WORD4] = 0x00000000; + vs_resource->states[R600_RESOURCE__RESOURCE_WORD5] = 0x00000000; + vs_resource->states[R600_RESOURCE__RESOURCE_WORD6] = 0xC0000000; vs_resource->placement[0] = RADEON_GEM_DOMAIN_GTT; vs_resource->placement[1] = RADEON_GEM_DOMAIN_GTT; r = radeon_draw_set_new(rctx->draw, vs_resource); @@ -121,22 +123,29 @@ static int r600_draw_common(struct r600_draw *draw) return r; } /* FIXME start need to change winsys */ - draw->draw = radeon_state(rscreen->rw, R600_DRAW_TYPE, R600_DRAW); - if (draw->draw == NULL) - return -ENOMEM; - draw->draw->states[R600_DRAW__VGT_NUM_INDICES] = draw->count; - draw->draw->states[R600_DRAW__VGT_DRAW_INITIATOR] = vgt_draw_initiator; if (draw->index_buffer) { + draw->draw = radeon_state(rscreen->rw, R600_DRAW); + if (draw->draw == NULL) + return -ENOMEM; + draw->draw->states[R600_DRAW__VGT_NUM_INDICES] = draw->count; + draw->draw->states[R600_DRAW__VGT_DRAW_INITIATOR] = vgt_draw_initiator; rbuffer = (struct r600_resource*)draw->index_buffer; draw->draw->bo[0] = radeon_bo_incref(rscreen->rw, rbuffer->bo); draw->draw->placement[0] = RADEON_GEM_DOMAIN_GTT; draw->draw->placement[1] = RADEON_GEM_DOMAIN_GTT; draw->draw->nbo = 1; + draw->draw->reloc_pm4_id[0] = R600_DRAW__INDICES_BO_ID; + } else { + draw->draw = radeon_state(rscreen->rw, R600_DRAW_AUTO); + if (draw->draw == NULL) + return -ENOMEM; + draw->draw->states[R600_DRAW_AUTO__VGT_NUM_INDICES] = draw->count; + draw->draw->states[R600_DRAW_AUTO__VGT_DRAW_INITIATOR] = vgt_draw_initiator; } r = radeon_draw_set_new(rctx->draw, draw->draw); if (r) return r; - draw->vgt = radeon_state(rscreen->rw, R600_VGT_TYPE, R600_VGT); + draw->vgt = radeon_state(rscreen->rw, R600_VGT); if (draw->vgt == NULL) return -ENOMEM; draw->vgt->states[R600_VGT__VGT_PRIMITIVE_TYPE] = prim; @@ -145,23 +154,18 @@ static int r600_draw_common(struct r600_draw *draw) draw->vgt->states[R600_VGT__VGT_INDX_OFFSET] = draw->start; draw->vgt->states[R600_VGT__VGT_MULTI_PRIM_IB_RESET_INDX] = 0x00000000; draw->vgt->states[R600_VGT__VGT_DMA_INDEX_TYPE] = vgt_dma_index_type; - draw->vgt->states[R600_VGT__VGT_PRIMITIVEID_EN] = 0x00000000; draw->vgt->states[R600_VGT__VGT_DMA_NUM_INSTANCES] = 0x00000001; - draw->vgt->states[R600_VGT__VGT_MULTI_PRIM_IB_RESET_EN] = 0x00000000; - draw->vgt->states[R600_VGT__VGT_INSTANCE_STEP_RATE_0] = 0x00000000; - draw->vgt->states[R600_VGT__VGT_INSTANCE_STEP_RATE_1] = 0x00000000; r = radeon_draw_set_new(rctx->draw, draw->vgt); if (r) return r; /* FIXME */ - r = radeon_ctx_set_draw_new(rctx->ctx, rctx->draw); + r = radeon_ctx_set_draw(rctx->ctx, rctx->draw); if (r == -EBUSY) { r600_flush(draw->ctx, 0, NULL); - r = radeon_ctx_set_draw_new(rctx->ctx, rctx->draw); + r = radeon_ctx_set_draw(rctx->ctx, rctx->draw); } if (r) return r; - rctx->draw = radeon_draw_duplicate(rctx->draw); return 0; } diff --git a/src/gallium/drivers/r600/r600_query.c b/src/gallium/drivers/r600/r600_query.c index 5929606cd2..8b4fe8999f 100644 --- a/src/gallium/drivers/r600/r600_query.c +++ b/src/gallium/drivers/r600/r600_query.c @@ -36,10 +36,11 @@ static struct radeon_state *r600_query_begin(struct r600_context *rctx, struct r struct r600_screen *rscreen = rctx->screen; struct radeon_state *rstate; - rstate = radeon_state(rscreen->rw, R600_QUERY_BEGIN_TYPE, R600_QUERY_BEGIN); + rstate = radeon_state(rscreen->rw, R600_QUERY_BEGIN); if (rstate == NULL) return NULL; rstate->states[R600_QUERY__OFFSET] = rquery->num_results; + rstate->reloc_pm4_id[0] = R600_QUERY__BO_ID; rstate->bo[0] = radeon_bo_incref(rscreen->rw, rquery->buffer); rstate->nbo = 1; rstate->placement[0] = RADEON_GEM_DOMAIN_GTT; @@ -55,10 +56,11 @@ static struct radeon_state *r600_query_end(struct r600_context *rctx, struct r60 struct r600_screen *rscreen = rctx->screen; struct radeon_state *rstate; - rstate = radeon_state(rscreen->rw, R600_QUERY_END_TYPE, R600_QUERY_END); + rstate = radeon_state(rscreen->rw, R600_QUERY_END); if (rstate == NULL) return NULL; rstate->states[R600_QUERY__OFFSET] = rquery->num_results + 8; + rstate->reloc_pm4_id[0] = R600_QUERY__BO_ID; rstate->bo[0] = radeon_bo_incref(rscreen->rw, rquery->buffer); rstate->nbo = 1; rstate->placement[0] = RADEON_GEM_DOMAIN_GTT; diff --git a/src/gallium/drivers/r600/r600_shader.c b/src/gallium/drivers/r600/r600_shader.c index b2d1a1bf01..f0b7df5a6f 100644 --- a/src/gallium/drivers/r600/r600_shader.c +++ b/src/gallium/drivers/r600/r600_shader.c @@ -132,7 +132,7 @@ static int r600_pipe_shader_vs(struct pipe_context *ctx, struct r600_context_sta unsigned i, tmp; rpshader->rstate = radeon_state_decref(rpshader->rstate); - state = radeon_state(rscreen->rw, R600_VS_SHADER_TYPE, R600_VS_SHADER); + state = radeon_state(rscreen->rw, R600_VS_SHADER); if (state == NULL) return -ENOMEM; for (i = 0; i < 10; i++) { @@ -151,6 +151,8 @@ static int r600_pipe_shader_vs(struct pipe_context *ctx, struct r600_context_sta rpshader->rstate->nbo = 2; rpshader->rstate->placement[0] = RADEON_GEM_DOMAIN_GTT; rpshader->rstate->placement[2] = RADEON_GEM_DOMAIN_GTT; + state->reloc_pm4_id[0] = R600_VS_SHADER__SQ_PGM_START_VS_BO_ID; + state->reloc_pm4_id[1] = R600_VS_SHADER__SQ_PGM_START_FS_BO_ID; return radeon_state_pm4(state); } @@ -165,7 +167,7 @@ static int r600_pipe_shader_ps(struct pipe_context *ctx, struct r600_context_sta rasterizer = &rctx->rasterizer->state.rasterizer; rpshader->rstate = radeon_state_decref(rpshader->rstate); - state = radeon_state(rscreen->rw, R600_PS_SHADER_TYPE, R600_PS_SHADER); + state = radeon_state(rscreen->rw, R600_PS_SHADER); if (state == NULL) return -ENOMEM; for (i = 0; i < rshader->ninput; i++) { @@ -204,6 +206,7 @@ static int r600_pipe_shader_ps(struct pipe_context *ctx, struct r600_context_sta rpshader->rstate->bo[0] = radeon_bo_incref(rscreen->rw, rpshader->bo); rpshader->rstate->nbo = 1; rpshader->rstate->placement[0] = RADEON_GEM_DOMAIN_GTT; + state->reloc_pm4_id[0] = R600_PS_SHADER__SQ_PGM_START_PS_BO_ID; return radeon_state_pm4(state); } diff --git a/src/gallium/drivers/r600/r600_state.c b/src/gallium/drivers/r600/r600_state.c index b5e5346163..e75575da79 100644 --- a/src/gallium/drivers/r600/r600_state.c +++ b/src/gallium/drivers/r600/r600_state.c @@ -283,19 +283,17 @@ static void r600_set_constant_buffer(struct pipe_context *ctx, { struct r600_screen *rscreen = r600_screen(ctx->screen); struct r600_context *rctx = r600_context(ctx); - unsigned nconstant = 0, i, type, id; + unsigned nconstant = 0, i, id; struct radeon_state *rstate; struct pipe_transfer *transfer; u32 *ptr; switch (shader) { case PIPE_SHADER_VERTEX: - id = R600_VS_CONSTANT; - type = R600_VS_CONSTANT_TYPE; + id = R600_VS_CONSTANT0; break; case PIPE_SHADER_FRAGMENT: - id = R600_PS_CONSTANT; - type = R600_PS_CONSTANT_TYPE; + id = R600_PS_CONSTANT0; break; default: R600_ERR("unsupported %d\n", shader); @@ -307,7 +305,7 @@ static void r600_set_constant_buffer(struct pipe_context *ctx, if (ptr == NULL) return; for (i = 0; i < nconstant; i++) { - rstate = radeon_state(rscreen->rw, type, id + i); + rstate = radeon_state(rscreen->rw, id + i); if (rstate == NULL) return; rstate->states[R600_PS_CONSTANT__SQ_ALU_CONSTANT0_0] = ptr[i * 4 + 0]; @@ -622,7 +620,7 @@ static struct radeon_state *r600_blend(struct r600_context *rctx) const struct pipe_blend_state *state = &rctx->blend->state.blend; int i; - rstate = radeon_state(rscreen->rw, R600_BLEND_TYPE, R600_BLEND); + rstate = radeon_state(rscreen->rw, R600_BLEND); if (rstate == NULL) return NULL; rstate->states[R600_BLEND__CB_BLEND_RED] = fui(rctx->blend_color.color[0]); @@ -681,14 +679,14 @@ static struct radeon_state *r600_ucp(struct r600_context *rctx, int clip) struct radeon_state *rstate; const struct pipe_clip_state *state = &rctx->clip->state.clip; - rstate = radeon_state(rscreen->rw, R600_CLIP_TYPE, R600_CLIP + clip); + rstate = radeon_state(rscreen->rw, R600_UCP0 + clip); if (rstate == NULL) return NULL; - rstate->states[R600_CLIP__PA_CL_UCP_X_0] = fui(state->ucp[clip][0]); - rstate->states[R600_CLIP__PA_CL_UCP_Y_0] = fui(state->ucp[clip][1]); - rstate->states[R600_CLIP__PA_CL_UCP_Z_0] = fui(state->ucp[clip][2]); - rstate->states[R600_CLIP__PA_CL_UCP_W_0] = fui(state->ucp[clip][3]); + rstate->states[R600_UCP__PA_CL_UCP_X_0] = fui(state->ucp[clip][0]); + rstate->states[R600_UCP__PA_CL_UCP_Y_0] = fui(state->ucp[clip][1]); + rstate->states[R600_UCP__PA_CL_UCP_Z_0] = fui(state->ucp[clip][2]); + rstate->states[R600_UCP__PA_CL_UCP_W_0] = fui(state->ucp[clip][3]); if (radeon_state_pm4(rstate)) { radeon_state_decref(rstate); @@ -711,7 +709,7 @@ static struct radeon_state *r600_cb(struct r600_context *rctx, int cb) unsigned format, swap, ntype; const struct util_format_description *desc; - rstate = radeon_state(rscreen->rw, R600_CB0_TYPE + cb, R600_CB0 + cb); + rstate = radeon_state(rscreen->rw, R600_CB0 + cb); if (rstate == NULL) return NULL; rtex = (struct r600_resource_texture*)state->cbufs[cb]->texture; @@ -722,6 +720,9 @@ static struct radeon_state *r600_cb(struct r600_context *rctx, int cb) rstate->placement[0] = RADEON_GEM_DOMAIN_GTT; rstate->placement[2] = RADEON_GEM_DOMAIN_GTT; rstate->placement[4] = RADEON_GEM_DOMAIN_GTT; + rstate->reloc_pm4_id[0] = R600_CB__CB_COLOR0_BASE_BO_ID; + rstate->reloc_pm4_id[1] = R600_CB__CB_COLOR0_FRAG_BO_ID; + rstate->reloc_pm4_id[2] = R600_CB__CB_COLOR0_TILE_BO_ID; rstate->nbo = 3; pitch = (rtex->pitch[level] / rtex->bpt) / 8 - 1; slice = (rtex->pitch[level] / rtex->bpt) * state->cbufs[cb]->height / 64 - 1; @@ -740,14 +741,14 @@ static struct radeon_state *r600_cb(struct r600_context *rctx, int cb) S_0280A0_SOURCE_FORMAT(1) | S_0280A0_NUMBER_TYPE(ntype); - rstate->states[R600_CB0__CB_COLOR0_BASE] = rtex->offset[level] >> 8; - rstate->states[R600_CB0__CB_COLOR0_INFO] = color_info; - rstate->states[R600_CB0__CB_COLOR0_SIZE] = S_028060_PITCH_TILE_MAX(pitch) | + rstate->states[R600_CB__CB_COLOR0_BASE] = rtex->offset[level] >> 8; + rstate->states[R600_CB__CB_COLOR0_INFO] = color_info; + rstate->states[R600_CB__CB_COLOR0_SIZE] = S_028060_PITCH_TILE_MAX(pitch) | S_028060_SLICE_TILE_MAX(slice); - rstate->states[R600_CB0__CB_COLOR0_VIEW] = 0x00000000; - rstate->states[R600_CB0__CB_COLOR0_FRAG] = 0x00000000; - rstate->states[R600_CB0__CB_COLOR0_TILE] = 0x00000000; - rstate->states[R600_CB0__CB_COLOR0_MASK] = 0x00000000; + rstate->states[R600_CB__CB_COLOR0_VIEW] = 0x00000000; + rstate->states[R600_CB__CB_COLOR0_FRAG] = 0x00000000; + rstate->states[R600_CB__CB_COLOR0_TILE] = 0x00000000; + rstate->states[R600_CB__CB_COLOR0_MASK] = 0x00000000; if (radeon_state_pm4(rstate)) { radeon_state_decref(rstate); return NULL; @@ -768,7 +769,7 @@ static struct radeon_state *r600_db(struct r600_context *rctx) if (state->zsbuf == NULL) return NULL; - rstate = radeon_state(rscreen->rw, R600_DB_TYPE, R600_DB); + rstate = radeon_state(rscreen->rw, R600_DB); if (rstate == NULL) return NULL; @@ -782,6 +783,7 @@ static struct radeon_state *r600_db(struct r600_context *rctx) rstate->bo[0] = radeon_bo_incref(rscreen->rw, rbuffer->bo); rstate->nbo = 1; rstate->placement[0] = RADEON_GEM_DOMAIN_VRAM; + rstate->reloc_pm4_id[0] = R600_DB__DB_DEPTH_BASE_BO_ID; level = state->zsbuf->level; pitch = (rtex->pitch[level] / rtex->bpt) / 8 - 1; slice = (rtex->pitch[level] / rtex->bpt) * state->zsbuf->height / 64 - 1; @@ -844,7 +846,7 @@ static struct radeon_state *r600_rasterizer(struct r600_context *rctx) prov_vtx = 0; rctx->flat_shade = state->flatshade; - rstate = radeon_state(rscreen->rw, R600_RASTERIZER_TYPE, R600_RASTERIZER); + rstate = radeon_state(rscreen->rw, R600_RASTERIZER); if (rstate == NULL) return NULL; rstate->states[R600_RASTERIZER__SPI_INTERP_CONTROL_0] = 0x00000001; @@ -925,7 +927,7 @@ static struct radeon_state *r600_scissor(struct r600_context *rctx) } tl = S_028240_TL_X(minx) | S_028240_TL_Y(miny) | S_028240_WINDOW_OFFSET_DISABLE(1); br = S_028244_BR_X(maxx) | S_028244_BR_Y(maxy); - rstate = radeon_state(rscreen->rw, R600_SCISSOR_TYPE, R600_SCISSOR); + rstate = radeon_state(rscreen->rw, R600_SCISSOR); if (rstate == NULL) return NULL; rstate->states[R600_SCISSOR__PA_SC_SCREEN_SCISSOR_TL] = tl; @@ -960,7 +962,7 @@ static struct radeon_state *r600_viewport(struct r600_context *rctx) struct r600_screen *rscreen = rctx->screen; struct radeon_state *rstate; - rstate = radeon_state(rscreen->rw, R600_VIEWPORT_TYPE, R600_VIEWPORT); + rstate = radeon_state(rscreen->rw, R600_VIEWPORT); if (rstate == NULL) return NULL; rstate->states[R600_VIEWPORT__PA_SC_VPORT_ZMIN_0] = 0x00000000; @@ -993,7 +995,7 @@ static struct radeon_state *r600_dsa(struct r600_context *rctx) if (rctx->ps_shader == NULL) { return NULL; } - rstate = radeon_state(rscreen->rw, R600_DSA_TYPE, R600_DSA); + rstate = radeon_state(rscreen->rw, R600_DSA); if (rstate == NULL) return NULL; @@ -1145,7 +1147,7 @@ static struct radeon_state *r600_sampler(struct r600_context *rctx, struct r600_screen *rscreen = rctx->screen; struct radeon_state *rstate; - rstate = radeon_state(rscreen->rw, R600_PS_SAMPLER_TYPE, id); + rstate = radeon_state(rscreen->rw, id); if (rstate == NULL) return NULL; rstate->states[R600_PS_SAMPLER__SQ_TEX_SAMPLER_WORD0_0] = @@ -1246,7 +1248,7 @@ static struct radeon_state *r600_resource(struct pipe_context *ctx, R600_ERR("unknow format %d\n", view->texture->format); return NULL; } - rstate = radeon_state(rscreen->rw, R600_PS_RESOURCE_TYPE, id); + rstate = radeon_state(rscreen->rw, id); if (rstate == NULL) { return NULL; } @@ -1268,34 +1270,36 @@ static struct radeon_state *r600_resource(struct pipe_context *ctx, rstate->placement[1] = RADEON_GEM_DOMAIN_GTT; rstate->placement[2] = RADEON_GEM_DOMAIN_GTT; rstate->placement[3] = RADEON_GEM_DOMAIN_GTT; + rstate->reloc_pm4_id[0] = R600_RESOURCE__RESOURCE_BO0_ID; + rstate->reloc_pm4_id[1] = R600_RESOURCE__RESOURCE_BO1_ID; pitch = (tmp->pitch[0] / tmp->bpt); pitch = (pitch + 0x7) & ~0x7; /* FIXME properly handle first level != 0 */ - rstate->states[R600_PS_RESOURCE__RESOURCE0_WORD0] = + rstate->states[R600_RESOURCE__RESOURCE_WORD0] = S_038000_DIM(r600_tex_dim(view->texture->target)) | S_038000_TILE_MODE(array_mode) | S_038000_TILE_TYPE(tile_type) | S_038000_PITCH((pitch / 8) - 1) | S_038000_TEX_WIDTH(view->texture->width0 - 1); - rstate->states[R600_PS_RESOURCE__RESOURCE0_WORD1] = + rstate->states[R600_RESOURCE__RESOURCE_WORD1] = S_038004_TEX_HEIGHT(view->texture->height0 - 1) | S_038004_TEX_DEPTH(view->texture->depth0 - 1) | S_038004_DATA_FORMAT(format); - rstate->states[R600_PS_RESOURCE__RESOURCE0_WORD2] = tmp->offset[0] >> 8; - rstate->states[R600_PS_RESOURCE__RESOURCE0_WORD3] = tmp->offset[1] >> 8; - rstate->states[R600_PS_RESOURCE__RESOURCE0_WORD4] = + rstate->states[R600_RESOURCE__RESOURCE_WORD2] = tmp->offset[0] >> 8; + rstate->states[R600_RESOURCE__RESOURCE_WORD3] = tmp->offset[1] >> 8; + rstate->states[R600_RESOURCE__RESOURCE_WORD4] = word4 | S_038010_NUM_FORMAT_ALL(V_038010_SQ_NUM_FORMAT_NORM) | S_038010_SRF_MODE_ALL(V_038010_SFR_MODE_NO_ZERO) | S_038010_REQUEST_SIZE(1) | S_038010_BASE_LEVEL(view->first_level); - rstate->states[R600_PS_RESOURCE__RESOURCE0_WORD5] = + rstate->states[R600_RESOURCE__RESOURCE_WORD5] = S_038014_LAST_LEVEL(view->last_level) | S_038014_BASE_ARRAY(0) | S_038014_LAST_ARRAY(0); - rstate->states[R600_PS_RESOURCE__RESOURCE0_WORD6] = + rstate->states[R600_RESOURCE__RESOURCE_WORD6] = S_038018_TYPE(V_038010_SQ_TEX_VTX_VALID_TEXTURE); if (radeon_state_pm4(rstate)) { radeon_state_decref(rstate); @@ -1342,7 +1346,7 @@ static struct radeon_state *r600_cb_cntl(struct r600_context *rctx) target_mask |= (pbs->rt[0].colormask << (4 * i)); } } - rstate = radeon_state(rscreen->rw, R600_CB_CNTL_TYPE, R600_CB_CNTL); + rstate = radeon_state(rscreen->rw, R600_CB_CNTL); rstate->states[R600_CB_CNTL__CB_SHADER_MASK] = shader_mask; rstate->states[R600_CB_CNTL__CB_TARGET_MASK] = target_mask; rstate->states[R600_CB_CNTL__CB_COLOR_CONTROL] = color_control; @@ -1419,7 +1423,7 @@ int r600_context_hw_states(struct pipe_context *ctx) if (rctx->ps_sampler[i]) { rctx->hw_states.ps_sampler[i] = r600_sampler(rctx, &rctx->ps_sampler[i]->state.sampler, - R600_PS_SAMPLER + i); + R600_PS_SAMPLER0 + i); } } rctx->hw_states.ps_nsampler = rctx->ps_nsampler; @@ -1427,7 +1431,7 @@ int r600_context_hw_states(struct pipe_context *ctx) if (rctx->ps_sampler_view[i]) { rctx->hw_states.ps_resource[i] = r600_resource(ctx, &rctx->ps_sampler_view[i]->state.sampler_view, - R600_PS_RESOURCE + i); + R600_PS_RESOURCE0 + i); } } rctx->hw_states.ps_nresource = rctx->ps_nsampler_view; diff --git a/src/gallium/drivers/r600/r600_texture.c b/src/gallium/drivers/r600/r600_texture.c index fb84ed9cfe..9dc0208eb1 100644 --- a/src/gallium/drivers/r600/r600_texture.c +++ b/src/gallium/drivers/r600/r600_texture.c @@ -663,7 +663,7 @@ static struct radeon_state *r600_texture_state_scissor(struct r600_screen *rscre { struct radeon_state *rstate; - rstate = radeon_state(rscreen->rw, R600_SCISSOR_TYPE, R600_SCISSOR); + rstate = radeon_state(rscreen->rw, R600_SCISSOR); if (rstate == NULL) return NULL; @@ -707,7 +707,7 @@ static struct radeon_state *r600_texture_state_cb0(struct r600_screen *rscreen, unsigned format, swap, ntype; const struct util_format_description *desc; - rstate = radeon_state(rscreen->rw, R600_CB0_TYPE, R600_CB0); + rstate = radeon_state(rscreen->rw, R600_CB0); if (rstate == NULL) return NULL; rbuffer = &rtexture->resource; @@ -742,13 +742,16 @@ static struct radeon_state *r600_texture_state_cb0(struct r600_screen *rscreen, rstate->nbo = 3; color_info = S_0280A0_SOURCE_FORMAT(1); } + rstate->reloc_pm4_id[0] = R600_CB__CB_COLOR0_BASE_BO_ID; + rstate->reloc_pm4_id[1] = R600_CB__CB_COLOR0_FRAG_BO_ID; + rstate->reloc_pm4_id[2] = R600_CB__CB_COLOR0_TILE_BO_ID; color_info |= S_0280A0_FORMAT(format) | S_0280A0_COMP_SWAP(swap) | S_0280A0_BLEND_CLAMP(1) | S_0280A0_NUMBER_TYPE(ntype); - rstate->states[R600_CB0__CB_COLOR0_BASE] = rtexture->offset[level] >> 8; - rstate->states[R600_CB0__CB_COLOR0_INFO] = color_info; - rstate->states[R600_CB0__CB_COLOR0_SIZE] = S_028060_PITCH_TILE_MAX(pitch) | + rstate->states[R600_CB__CB_COLOR0_BASE] = rtexture->offset[level] >> 8; + rstate->states[R600_CB__CB_COLOR0_INFO] = color_info; + rstate->states[R600_CB__CB_COLOR0_SIZE] = S_028060_PITCH_TILE_MAX(pitch) | S_028060_SLICE_TILE_MAX(slice); if (radeon_state_pm4(rstate)) { @@ -766,7 +769,7 @@ static struct radeon_state *r600_texture_state_db(struct r600_screen *rscreen, struct r600_resource *rbuffer; unsigned pitch, slice, format; - rstate = radeon_state(rscreen->rw, R600_DB_TYPE, R600_DB); + rstate = radeon_state(rscreen->rw, R600_DB); if (rstate == NULL) return NULL; rbuffer = &rtexture->resource; @@ -784,6 +787,7 @@ static struct radeon_state *r600_texture_state_db(struct r600_screen *rscreen, rstate->states[R600_DB__DB_PREFETCH_LIMIT] = (rtexture->height[level] / 8) -1; rstate->states[R600_DB__DB_DEPTH_SIZE] = S_028000_PITCH_TILE_MAX(pitch) | S_028000_SLICE_TILE_MAX(slice); + rstate->reloc_pm4_id[0] = R600_DB__DB_DEPTH_BASE_BO_ID; rstate->bo[0] = radeon_bo_incref(rscreen->rw, rbuffer->bo); rstate->placement[0] = RADEON_GEM_DOMAIN_GTT; rstate->nbo = 1; @@ -815,7 +819,7 @@ static struct radeon_state *r600_texture_state_viewport(struct r600_screen *rscr { struct radeon_state *rstate; - rstate = radeon_state(rscreen->rw, R600_VIEWPORT_TYPE, R600_VIEWPORT); + rstate = radeon_state(rscreen->rw, R600_VIEWPORT); if (rstate == NULL) return NULL; diff --git a/src/gallium/drivers/r600/radeon.h b/src/gallium/drivers/r600/radeon.h index b2cc74f696..777fe3e792 100644 --- a/src/gallium/drivers/r600/radeon.h +++ b/src/gallium/drivers/r600/radeon.h @@ -104,26 +104,18 @@ int radeon_bo_wait(struct radeon *radeon, struct radeon_bo *bo); struct radeon_state { struct radeon *radeon; unsigned refcount; - unsigned type; unsigned id; - unsigned nstates; - u32 *states; - unsigned npm4; unsigned cpm4; + u32 states[128]; u32 pm4_crc; - u32 *pm4; - u32 nimmd; - u32 *immd; unsigned nbo; struct radeon_bo *bo[4]; - unsigned nreloc; - unsigned reloc_pm4_id[8]; - unsigned reloc_bo_id[8]; + unsigned reloc_pm4_id[4]; u32 placement[8]; unsigned bo_dirty[4]; }; -struct radeon_state *radeon_state(struct radeon *radeon, u32 type, u32 id); +struct radeon_state *radeon_state(struct radeon *radeon, u32 id); struct radeon_state *radeon_state_incref(struct radeon_state *state); struct radeon_state *radeon_state_decref(struct radeon_state *state); int radeon_state_pm4(struct radeon_state *state); @@ -147,16 +139,6 @@ int radeon_draw_set(struct radeon_draw *draw, struct radeon_state *state); int radeon_draw_set_new(struct radeon_draw *draw, struct radeon_state *state); int radeon_draw_check(struct radeon_draw *draw); -struct radeon_ctx *radeon_ctx(struct radeon *radeon); -struct radeon_ctx *radeon_ctx_decref(struct radeon_ctx *ctx); -struct radeon_ctx *radeon_ctx_incref(struct radeon_ctx *ctx); -int radeon_ctx_set_draw(struct radeon_ctx *ctx, struct radeon_draw *draw); -int radeon_ctx_set_query_state(struct radeon_ctx *ctx, struct radeon_state *state); -int radeon_ctx_set_draw_new(struct radeon_ctx *ctx, struct radeon_draw *draw); -int radeon_ctx_pm4(struct radeon_ctx *ctx); -int radeon_ctx_submit(struct radeon_ctx *ctx); -void radeon_ctx_dump_bof(struct radeon_ctx *ctx, const char *file); - /* * radeon context functions */ @@ -169,261 +151,216 @@ struct radeon_cs_reloc { }; #pragma pack() +struct radeon_ctx_bo { + struct radeon_bo *bo; + u32 bo_flushed; + unsigned state_id; +}; + struct radeon_ctx { int refcount; struct radeon *radeon; u32 *pm4; - u32 cpm4; - u32 draw_cpm4; + int npm4; unsigned id; - unsigned next_id; unsigned nreloc; + unsigned max_reloc; struct radeon_cs_reloc *reloc; unsigned nbo; - struct radeon_bo **bo; - unsigned ndraw; - struct radeon_draw *cdraw; - struct radeon_draw **draw; - unsigned nstate; - struct radeon_state **state; + struct radeon_ctx_bo *bo; + unsigned max_bo; + u32 *state_crc32; }; +struct radeon_ctx *radeon_ctx(struct radeon *radeon); +struct radeon_ctx *radeon_ctx_decref(struct radeon_ctx *ctx); +struct radeon_ctx *radeon_ctx_incref(struct radeon_ctx *ctx); +void radeon_ctx_clear(struct radeon_ctx *ctx); +int radeon_ctx_set_draw(struct radeon_ctx *ctx, struct radeon_draw *draw); +int radeon_ctx_set_query_state(struct radeon_ctx *ctx, struct radeon_state *state); +int radeon_ctx_pm4(struct radeon_ctx *ctx); +int radeon_ctx_submit(struct radeon_ctx *ctx); +void radeon_ctx_dump_bof(struct radeon_ctx *ctx, const char *file); + + /* * R600/R700 */ - -#define R600_NSTATE 1288 -#define R600_NTYPE 35 - -#define R600_CONFIG 0 -#define R600_CONFIG_TYPE 0 -#define R600_CB_CNTL 1 -#define R600_CB_CNTL_TYPE 1 -#define R600_RASTERIZER 2 -#define R600_RASTERIZER_TYPE 2 -#define R600_VIEWPORT 3 -#define R600_VIEWPORT_TYPE 3 -#define R600_SCISSOR 4 -#define R600_SCISSOR_TYPE 4 -#define R600_BLEND 5 -#define R600_BLEND_TYPE 5 -#define R600_DSA 6 -#define R600_DSA_TYPE 6 -#define R600_VS_SHADER 7 -#define R600_VS_SHADER_TYPE 7 -#define R600_PS_SHADER 8 -#define R600_PS_SHADER_TYPE 8 -#define R600_PS_CONSTANT 9 -#define R600_PS_CONSTANT_TYPE 9 -#define R600_VS_CONSTANT 265 -#define R600_VS_CONSTANT_TYPE 10 -#define R600_PS_RESOURCE 521 -#define R600_PS_RESOURCE_TYPE 11 -#define R600_VS_RESOURCE 681 -#define R600_VS_RESOURCE_TYPE 12 -#define R600_FS_RESOURCE 841 -#define R600_FS_RESOURCE_TYPE 13 -#define R600_GS_RESOURCE 1001 -#define R600_GS_RESOURCE_TYPE 14 -#define R600_PS_SAMPLER 1161 -#define R600_PS_SAMPLER_TYPE 15 -#define R600_VS_SAMPLER 1179 -#define R600_VS_SAMPLER_TYPE 16 -#define R600_GS_SAMPLER 1197 -#define R600_GS_SAMPLER_TYPE 17 -#define R600_PS_SAMPLER_BORDER 1215 -#define R600_PS_SAMPLER_BORDER_TYPE 18 -#define R600_VS_SAMPLER_BORDER 1233 -#define R600_VS_SAMPLER_BORDER_TYPE 19 -#define R600_GS_SAMPLER_BORDER 1251 -#define R600_GS_SAMPLER_BORDER_TYPE 20 -#define R600_CB0 1269 -#define R600_CB0_TYPE 21 -#define R600_CB1 1270 -#define R600_CB1_TYPE 22 -#define R600_CB2 1271 -#define R600_CB2_TYPE 23 -#define R600_CB3 1272 -#define R600_CB3_TYPE 24 -#define R600_CB4 1273 -#define R600_CB4_TYPE 25 -#define R600_CB5 1274 -#define R600_CB5_TYPE 26 -#define R600_CB6 1275 -#define R600_CB6_TYPE 27 -#define R600_CB7 1276 -#define R600_CB7_TYPE 28 -#define R600_QUERY_BEGIN 1277 -#define R600_QUERY_BEGIN_TYPE 29 -#define R600_QUERY_END 1278 -#define R600_QUERY_END_TYPE 30 -#define R600_DB 1279 -#define R600_DB_TYPE 31 -#define R600_CLIP 1280 -#define R600_CLIP_TYPE 32 -#define R600_VGT 1286 -#define R600_VGT_TYPE 33 -#define R600_DRAW 1287 -#define R600_DRAW_TYPE 34 +#define R600_CONFIG 0 +#define R600_CB_CNTL 1 +#define R600_RASTERIZER 2 +#define R600_VIEWPORT 3 +#define R600_SCISSOR 4 +#define R600_BLEND 5 +#define R600_DSA 6 +#define R600_VGT 7 +#define R600_QUERY_BEGIN 8 +#define R600_QUERY_END 9 +#define R600_VS_SHADER 10 +#define R600_PS_SHADER 11 +#define R600_DB 12 +#define R600_CB0 13 +#define R600_UCP0 21 +#define R600_PS_RESOURCE0 27 +#define R600_VS_RESOURCE0 187 +#define R600_FS_RESOURCE0 347 +#define R600_GS_RESOURCE0 363 +#define R600_PS_CONSTANT0 523 +#define R600_VS_CONSTANT0 779 +#define R600_PS_SAMPLER0 1035 +#define R600_VS_SAMPLER0 1053 +#define R600_GS_SAMPLER0 1071 +#define R600_PS_SAMPLER_BORDER0 1089 +#define R600_VS_SAMPLER_BORDER0 1107 +#define R600_GS_SAMPLER_BORDER0 1125 +#define R600_DRAW_AUTO 1143 +#define R600_DRAW 1144 +#define R600_NSTATE 1145 /* R600_CONFIG */ -#define R600_CONFIG__SQ_CONFIG 0 +#define R600_CONFIG__SQ_CONFIG 0 #define R600_CONFIG__SQ_GPR_RESOURCE_MGMT_1 1 #define R600_CONFIG__SQ_GPR_RESOURCE_MGMT_2 2 #define R600_CONFIG__SQ_THREAD_RESOURCE_MGMT 3 #define R600_CONFIG__SQ_STACK_RESOURCE_MGMT_1 4 #define R600_CONFIG__SQ_STACK_RESOURCE_MGMT_2 5 -#define R600_CONFIG__SQ_DYN_GPR_CNTL_PS_FLUSH_REQ 6 -#define R600_CONFIG__TA_CNTL_AUX 7 -#define R600_CONFIG__VC_ENHANCE 8 -#define R600_CONFIG__DB_DEBUG 9 -#define R600_CONFIG__DB_WATERMARKS 10 -#define R600_CONFIG__SX_MISC 11 -#define R600_CONFIG__SPI_THREAD_GROUPING 12 -#define R600_CONFIG__CB_SHADER_CONTROL 13 -#define R600_CONFIG__SQ_ESGS_RING_ITEMSIZE 14 -#define R600_CONFIG__SQ_GSVS_RING_ITEMSIZE 15 -#define R600_CONFIG__SQ_ESTMP_RING_ITEMSIZE 16 -#define R600_CONFIG__SQ_GSTMP_RING_ITEMSIZE 17 -#define R600_CONFIG__SQ_VSTMP_RING_ITEMSIZE 18 -#define R600_CONFIG__SQ_PSTMP_RING_ITEMSIZE 19 -#define R600_CONFIG__SQ_FBUF_RING_ITEMSIZE 20 -#define R600_CONFIG__SQ_REDUC_RING_ITEMSIZE 21 -#define R600_CONFIG__SQ_GS_VERT_ITEMSIZE 22 -#define R600_CONFIG__VGT_OUTPUT_PATH_CNTL 23 -#define R600_CONFIG__VGT_HOS_CNTL 24 -#define R600_CONFIG__VGT_HOS_MAX_TESS_LEVEL 25 -#define R600_CONFIG__VGT_HOS_MIN_TESS_LEVEL 26 -#define R600_CONFIG__VGT_HOS_REUSE_DEPTH 27 -#define R600_CONFIG__VGT_GROUP_PRIM_TYPE 28 -#define R600_CONFIG__VGT_GROUP_FIRST_DECR 29 -#define R600_CONFIG__VGT_GROUP_DECR 30 -#define R600_CONFIG__VGT_GROUP_VECT_0_CNTL 31 -#define R600_CONFIG__VGT_GROUP_VECT_1_CNTL 32 -#define R600_CONFIG__VGT_GROUP_VECT_0_FMT_CNTL 33 -#define R600_CONFIG__VGT_GROUP_VECT_1_FMT_CNTL 34 -#define R600_CONFIG__VGT_GS_MODE 35 -#define R600_CONFIG__PA_SC_MODE_CNTL 36 -#define R600_CONFIG__VGT_STRMOUT_EN 37 -#define R600_CONFIG__VGT_REUSE_OFF 38 -#define R600_CONFIG__VGT_VTX_CNT_EN 39 -#define R600_CONFIG__VGT_STRMOUT_BUFFER_EN 40 -#define R600_CONFIG_SIZE 41 -#define R600_CONFIG_PM4 128 +#define R600_CONFIG__SQ_DYN_GPR_CNTL_PS_FLUSH_REQ 8 +#define R600_CONFIG__TA_CNTL_AUX 11 +#define R600_CONFIG__VC_ENHANCE 14 +#define R600_CONFIG__DB_DEBUG 17 +#define R600_CONFIG__DB_WATERMARKS 20 +#define R600_CONFIG__SX_MISC 23 +#define R600_CONFIG__SPI_THREAD_GROUPING 26 +#define R600_CONFIG__CB_SHADER_CONTROL 29 +#define R600_CONFIG__SQ_ESGS_RING_ITEMSIZE 32 +#define R600_CONFIG__SQ_GSVS_RING_ITEMSIZE 33 +#define R600_CONFIG__SQ_ESTMP_RING_ITEMSIZE 34 +#define R600_CONFIG__SQ_GSTMP_RING_ITEMSIZE 35 +#define R600_CONFIG__SQ_VSTMP_RING_ITEMSIZE 36 +#define R600_CONFIG__SQ_PSTMP_RING_ITEMSIZE 37 +#define R600_CONFIG__SQ_FBUF_RING_ITEMSIZE 38 +#define R600_CONFIG__SQ_REDUC_RING_ITEMSIZE 39 +#define R600_CONFIG__SQ_GS_VERT_ITEMSIZE 40 +#define R600_CONFIG__VGT_OUTPUT_PATH_CNTL 43 +#define R600_CONFIG__VGT_HOS_CNTL 44 +#define R600_CONFIG__VGT_HOS_MAX_TESS_LEVEL 45 +#define R600_CONFIG__VGT_HOS_MIN_TESS_LEVEL 46 +#define R600_CONFIG__VGT_HOS_REUSE_DEPTH 47 +#define R600_CONFIG__VGT_GROUP_PRIM_TYPE 48 +#define R600_CONFIG__VGT_GROUP_FIRST_DECR 49 +#define R600_CONFIG__VGT_GROUP_DECR 50 +#define R600_CONFIG__VGT_GROUP_VECT_0_CNTL 51 +#define R600_CONFIG__VGT_GROUP_VECT_1_CNTL 52 +#define R600_CONFIG__VGT_GROUP_VECT_0_FMT_CNTL 53 +#define R600_CONFIG__VGT_GROUP_VECT_1_FMT_CNTL 54 +#define R600_CONFIG__VGT_GS_MODE 55 +#define R600_CONFIG__PA_SC_MODE_CNTL 58 +#define R600_CONFIG__VGT_STRMOUT_EN 61 +#define R600_CONFIG__VGT_REUSE_OFF 62 +#define R600_CONFIG__VGT_VTX_CNT_EN 63 +#define R600_CONFIG__VGT_STRMOUT_BUFFER_EN 66 /* R600_CB_CNTL */ -#define R600_CB_CNTL__CB_CLEAR_RED 0 -#define R600_CB_CNTL__CB_CLEAR_GREEN 1 -#define R600_CB_CNTL__CB_CLEAR_BLUE 2 -#define R600_CB_CNTL__CB_CLEAR_ALPHA 3 -#define R600_CB_CNTL__CB_SHADER_MASK 4 -#define R600_CB_CNTL__CB_TARGET_MASK 5 -#define R600_CB_CNTL__CB_FOG_RED 6 -#define R600_CB_CNTL__CB_FOG_GREEN 7 -#define R600_CB_CNTL__CB_FOG_BLUE 8 -#define R600_CB_CNTL__CB_COLOR_CONTROL 9 -#define R600_CB_CNTL__PA_SC_AA_CONFIG 10 -#define R600_CB_CNTL__PA_SC_AA_SAMPLE_LOCS_MCTX 11 -#define R600_CB_CNTL__PA_SC_AA_SAMPLE_LOCS_8S_WD1_MCTX 12 -#define R600_CB_CNTL__CB_CLRCMP_CONTROL 13 -#define R600_CB_CNTL__CB_CLRCMP_SRC 14 -#define R600_CB_CNTL__CB_CLRCMP_DST 15 -#define R600_CB_CNTL__CB_CLRCMP_MSK 16 -#define R600_CB_CNTL__PA_SC_AA_MASK 17 -#define R600_CB_CNTL_SIZE 18 -#define R600_CB_CNTL_PM4 128 +#define R600_CB_CNTL__CB_CLEAR_RED 0 +#define R600_CB_CNTL__CB_CLEAR_GREEN 1 +#define R600_CB_CNTL__CB_CLEAR_BLUE 2 +#define R600_CB_CNTL__CB_CLEAR_ALPHA 3 +#define R600_CB_CNTL__CB_SHADER_MASK 6 +#define R600_CB_CNTL__CB_TARGET_MASK 7 +#define R600_CB_CNTL__CB_FOG_RED 10 +#define R600_CB_CNTL__CB_FOG_GREEN 11 +#define R600_CB_CNTL__CB_FOG_BLUE 12 +#define R600_CB_CNTL__CB_COLOR_CONTROL 15 +#define R600_CB_CNTL__PA_SC_AA_CONFIG 18 +#define R600_CB_CNTL__PA_SC_AA_SAMPLE_LOCS_MCTX 21 +#define R600_CB_CNTL__PA_SC_AA_SAMPLE_LOCS_8S_WD1_MCTX 22 +#define R600_CB_CNTL__CB_CLRCMP_CONTROL 25 +#define R600_CB_CNTL__CB_CLRCMP_SRC 26 +#define R600_CB_CNTL__CB_CLRCMP_DST 27 +#define R600_CB_CNTL__CB_CLRCMP_MSK 28 +#define R600_CB_CNTL__PA_SC_AA_MASK 31 /* R600_RASTERIZER */ #define R600_RASTERIZER__SPI_INTERP_CONTROL_0 0 -#define R600_RASTERIZER__PA_CL_CLIP_CNTL 1 -#define R600_RASTERIZER__PA_SU_SC_MODE_CNTL 2 -#define R600_RASTERIZER__PA_CL_VS_OUT_CNTL 3 -#define R600_RASTERIZER__PA_CL_NANINF_CNTL 4 -#define R600_RASTERIZER__PA_SU_POINT_SIZE 5 -#define R600_RASTERIZER__PA_SU_POINT_MINMAX 6 -#define R600_RASTERIZER__PA_SU_LINE_CNTL 7 -#define R600_RASTERIZER__PA_SC_LINE_STIPPLE 8 -#define R600_RASTERIZER__PA_SC_MPASS_PS_CNTL 9 -#define R600_RASTERIZER__PA_SC_LINE_CNTL 10 -#define R600_RASTERIZER__PA_CL_GB_VERT_CLIP_ADJ 11 -#define R600_RASTERIZER__PA_CL_GB_VERT_DISC_ADJ 12 -#define R600_RASTERIZER__PA_CL_GB_HORZ_CLIP_ADJ 13 -#define R600_RASTERIZER__PA_CL_GB_HORZ_DISC_ADJ 14 -#define R600_RASTERIZER__PA_SU_POLY_OFFSET_DB_FMT_CNTL 15 -#define R600_RASTERIZER__PA_SU_POLY_OFFSET_CLAMP 16 -#define R600_RASTERIZER__PA_SU_POLY_OFFSET_FRONT_SCALE 17 -#define R600_RASTERIZER__PA_SU_POLY_OFFSET_FRONT_OFFSET 18 -#define R600_RASTERIZER__PA_SU_POLY_OFFSET_BACK_SCALE 19 -#define R600_RASTERIZER__PA_SU_POLY_OFFSET_BACK_OFFSET 20 -#define R600_RASTERIZER_SIZE 21 -#define R600_RASTERIZER_PM4 128 +#define R600_RASTERIZER__PA_CL_CLIP_CNTL 3 +#define R600_RASTERIZER__PA_SU_SC_MODE_CNTL 4 +#define R600_RASTERIZER__PA_CL_VS_OUT_CNTL 7 +#define R600_RASTERIZER__PA_CL_NANINF_CNTL 8 +#define R600_RASTERIZER__PA_SU_POINT_SIZE 11 +#define R600_RASTERIZER__PA_SU_POINT_MINMAX 12 +#define R600_RASTERIZER__PA_SU_LINE_CNTL 13 +#define R600_RASTERIZER__PA_SC_LINE_STIPPLE 14 +#define R600_RASTERIZER__PA_SC_MPASS_PS_CNTL 17 +#define R600_RASTERIZER__PA_SC_LINE_CNTL 20 +#define R600_RASTERIZER__PA_CL_GB_VERT_CLIP_ADJ 23 +#define R600_RASTERIZER__PA_CL_GB_VERT_DISC_ADJ 24 +#define R600_RASTERIZER__PA_CL_GB_HORZ_CLIP_ADJ 25 +#define R600_RASTERIZER__PA_CL_GB_HORZ_DISC_ADJ 26 +#define R600_RASTERIZER__PA_SU_POLY_OFFSET_DB_FMT_CNTL 29 +#define R600_RASTERIZER__PA_SU_POLY_OFFSET_CLAMP 30 +#define R600_RASTERIZER__PA_SU_POLY_OFFSET_FRONT_SCALE 31 +#define R600_RASTERIZER__PA_SU_POLY_OFFSET_FRONT_OFFSET 32 +#define R600_RASTERIZER__PA_SU_POLY_OFFSET_BACK_SCALE 33 +#define R600_RASTERIZER__PA_SU_POLY_OFFSET_BACK_OFFSET 34 /* R600_VIEWPORT */ #define R600_VIEWPORT__PA_SC_VPORT_ZMIN_0 0 #define R600_VIEWPORT__PA_SC_VPORT_ZMAX_0 1 -#define R600_VIEWPORT__PA_CL_VPORT_XSCALE_0 2 -#define R600_VIEWPORT__PA_CL_VPORT_YSCALE_0 3 -#define R600_VIEWPORT__PA_CL_VPORT_ZSCALE_0 4 -#define R600_VIEWPORT__PA_CL_VPORT_XOFFSET_0 5 -#define R600_VIEWPORT__PA_CL_VPORT_YOFFSET_0 6 -#define R600_VIEWPORT__PA_CL_VPORT_ZOFFSET_0 7 -#define R600_VIEWPORT__PA_CL_VTE_CNTL 8 -#define R600_VIEWPORT_SIZE 9 -#define R600_VIEWPORT_PM4 128 +#define R600_VIEWPORT__PA_CL_VPORT_XSCALE_0 4 +#define R600_VIEWPORT__PA_CL_VPORT_YSCALE_0 7 +#define R600_VIEWPORT__PA_CL_VPORT_ZSCALE_0 10 +#define R600_VIEWPORT__PA_CL_VPORT_XOFFSET_0 13 +#define R600_VIEWPORT__PA_CL_VPORT_YOFFSET_0 16 +#define R600_VIEWPORT__PA_CL_VPORT_ZOFFSET_0 19 +#define R600_VIEWPORT__PA_CL_VTE_CNTL 22 /* R600_SCISSOR */ #define R600_SCISSOR__PA_SC_SCREEN_SCISSOR_TL 0 #define R600_SCISSOR__PA_SC_SCREEN_SCISSOR_BR 1 -#define R600_SCISSOR__PA_SC_WINDOW_OFFSET 2 -#define R600_SCISSOR__PA_SC_WINDOW_SCISSOR_TL 3 -#define R600_SCISSOR__PA_SC_WINDOW_SCISSOR_BR 4 -#define R600_SCISSOR__PA_SC_CLIPRECT_RULE 5 -#define R600_SCISSOR__PA_SC_CLIPRECT_0_TL 6 -#define R600_SCISSOR__PA_SC_CLIPRECT_0_BR 7 -#define R600_SCISSOR__PA_SC_CLIPRECT_1_TL 8 -#define R600_SCISSOR__PA_SC_CLIPRECT_1_BR 9 -#define R600_SCISSOR__PA_SC_CLIPRECT_2_TL 10 -#define R600_SCISSOR__PA_SC_CLIPRECT_2_BR 11 -#define R600_SCISSOR__PA_SC_CLIPRECT_3_TL 12 -#define R600_SCISSOR__PA_SC_CLIPRECT_3_BR 13 -#define R600_SCISSOR__PA_SC_EDGERULE 14 -#define R600_SCISSOR__PA_SC_GENERIC_SCISSOR_TL 15 -#define R600_SCISSOR__PA_SC_GENERIC_SCISSOR_BR 16 -#define R600_SCISSOR__PA_SC_VPORT_SCISSOR_0_TL 17 -#define R600_SCISSOR__PA_SC_VPORT_SCISSOR_0_BR 18 -#define R600_SCISSOR_SIZE 19 -#define R600_SCISSOR_PM4 128 +#define R600_SCISSOR__PA_SC_WINDOW_OFFSET 4 +#define R600_SCISSOR__PA_SC_WINDOW_SCISSOR_TL 5 +#define R600_SCISSOR__PA_SC_WINDOW_SCISSOR_BR 6 +#define R600_SCISSOR__PA_SC_CLIPRECT_RULE 7 +#define R600_SCISSOR__PA_SC_CLIPRECT_0_TL 8 +#define R600_SCISSOR__PA_SC_CLIPRECT_0_BR 9 +#define R600_SCISSOR__PA_SC_CLIPRECT_1_TL 10 +#define R600_SCISSOR__PA_SC_CLIPRECT_1_BR 11 +#define R600_SCISSOR__PA_SC_CLIPRECT_2_TL 12 +#define R600_SCISSOR__PA_SC_CLIPRECT_2_BR 13 +#define R600_SCISSOR__PA_SC_CLIPRECT_3_TL 14 +#define R600_SCISSOR__PA_SC_CLIPRECT_3_BR 15 +#define R600_SCISSOR__PA_SC_EDGERULE 16 +#define R600_SCISSOR__PA_SC_GENERIC_SCISSOR_TL 19 +#define R600_SCISSOR__PA_SC_GENERIC_SCISSOR_BR 20 +#define R600_SCISSOR__PA_SC_VPORT_SCISSOR_0_TL 23 +#define R600_SCISSOR__PA_SC_VPORT_SCISSOR_0_BR 24 /* R600_BLEND */ -#define R600_BLEND__CB_BLEND_RED 0 -#define R600_BLEND__CB_BLEND_GREEN 1 -#define R600_BLEND__CB_BLEND_BLUE 2 -#define R600_BLEND__CB_BLEND_ALPHA 3 -#define R600_BLEND__CB_BLEND0_CONTROL 4 -#define R600_BLEND__CB_BLEND1_CONTROL 5 -#define R600_BLEND__CB_BLEND2_CONTROL 6 -#define R600_BLEND__CB_BLEND3_CONTROL 7 -#define R600_BLEND__CB_BLEND4_CONTROL 8 -#define R600_BLEND__CB_BLEND5_CONTROL 9 -#define R600_BLEND__CB_BLEND6_CONTROL 10 -#define R600_BLEND__CB_BLEND7_CONTROL 11 -#define R600_BLEND__CB_BLEND_CONTROL 12 -#define R600_BLEND_SIZE 13 -#define R600_BLEND_PM4 128 +#define R600_BLEND__CB_BLEND_RED 0 +#define R600_BLEND__CB_BLEND_GREEN 1 +#define R600_BLEND__CB_BLEND_BLUE 2 +#define R600_BLEND__CB_BLEND_ALPHA 3 +#define R600_BLEND__CB_BLEND0_CONTROL 6 +#define R600_BLEND__CB_BLEND1_CONTROL 7 +#define R600_BLEND__CB_BLEND2_CONTROL 8 +#define R600_BLEND__CB_BLEND3_CONTROL 9 +#define R600_BLEND__CB_BLEND4_CONTROL 10 +#define R600_BLEND__CB_BLEND5_CONTROL 11 +#define R600_BLEND__CB_BLEND6_CONTROL 12 +#define R600_BLEND__CB_BLEND7_CONTROL 13 +#define R600_BLEND__CB_BLEND_CONTROL 16 /* R600_DSA */ -#define R600_DSA__DB_STENCIL_CLEAR 0 -#define R600_DSA__DB_DEPTH_CLEAR 1 -#define R600_DSA__SX_ALPHA_TEST_CONTROL 2 -#define R600_DSA__DB_STENCILREFMASK 3 -#define R600_DSA__DB_STENCILREFMASK_BF 4 -#define R600_DSA__SX_ALPHA_REF 5 -#define R600_DSA__SPI_FOG_FUNC_SCALE 6 -#define R600_DSA__SPI_FOG_FUNC_BIAS 7 -#define R600_DSA__SPI_FOG_CNTL 8 -#define R600_DSA__DB_DEPTH_CONTROL 9 -#define R600_DSA__DB_SHADER_CONTROL 10 -#define R600_DSA__DB_RENDER_CONTROL 11 -#define R600_DSA__DB_RENDER_OVERRIDE 12 -#define R600_DSA__DB_SRESULTS_COMPARE_STATE1 13 -#define R600_DSA__DB_PRELOAD_CONTROL 14 -#define R600_DSA__DB_ALPHA_TO_MASK 15 -#define R600_DSA_SIZE 16 -#define R600_DSA_PM4 128 +#define R600_DSA__DB_STENCIL_CLEAR 0 +#define R600_DSA__DB_DEPTH_CLEAR 1 +#define R600_DSA__SX_ALPHA_TEST_CONTROL 4 +#define R600_DSA__DB_STENCILREFMASK 7 +#define R600_DSA__DB_STENCILREFMASK_BF 8 +#define R600_DSA__SX_ALPHA_REF 9 +#define R600_DSA__SPI_FOG_FUNC_SCALE 12 +#define R600_DSA__SPI_FOG_FUNC_BIAS 13 +#define R600_DSA__SPI_FOG_CNTL 16 +#define R600_DSA__DB_DEPTH_CONTROL 19 +#define R600_DSA__DB_SHADER_CONTROL 22 +#define R600_DSA__DB_RENDER_CONTROL 25 +#define R600_DSA__DB_RENDER_OVERRIDE 26 +#define R600_DSA__DB_SRESULTS_COMPARE_STATE1 29 +#define R600_DSA__DB_PRELOAD_CONTROL 30 +#define R600_DSA__DB_ALPHA_TO_MASK 33 /* R600_VS_SHADER */ #define R600_VS_SHADER__SQ_VTX_SEMANTIC_0 0 #define R600_VS_SHADER__SQ_VTX_SEMANTIC_1 1 @@ -457,25 +394,25 @@ struct radeon_ctx { #define R600_VS_SHADER__SQ_VTX_SEMANTIC_29 29 #define R600_VS_SHADER__SQ_VTX_SEMANTIC_30 30 #define R600_VS_SHADER__SQ_VTX_SEMANTIC_31 31 -#define R600_VS_SHADER__SPI_VS_OUT_ID_0 32 -#define R600_VS_SHADER__SPI_VS_OUT_ID_1 33 -#define R600_VS_SHADER__SPI_VS_OUT_ID_2 34 -#define R600_VS_SHADER__SPI_VS_OUT_ID_3 35 -#define R600_VS_SHADER__SPI_VS_OUT_ID_4 36 -#define R600_VS_SHADER__SPI_VS_OUT_ID_5 37 -#define R600_VS_SHADER__SPI_VS_OUT_ID_6 38 -#define R600_VS_SHADER__SPI_VS_OUT_ID_7 39 -#define R600_VS_SHADER__SPI_VS_OUT_ID_8 40 -#define R600_VS_SHADER__SPI_VS_OUT_ID_9 41 -#define R600_VS_SHADER__SPI_VS_OUT_CONFIG 42 -#define R600_VS_SHADER__SQ_PGM_START_VS 43 -#define R600_VS_SHADER__SQ_PGM_RESOURCES_VS 44 -#define R600_VS_SHADER__SQ_PGM_START_FS 45 -#define R600_VS_SHADER__SQ_PGM_RESOURCES_FS 46 -#define R600_VS_SHADER__SQ_PGM_CF_OFFSET_VS 47 -#define R600_VS_SHADER__SQ_PGM_CF_OFFSET_FS 48 -#define R600_VS_SHADER_SIZE 49 -#define R600_VS_SHADER_PM4 128 +#define R600_VS_SHADER__SPI_VS_OUT_ID_0 34 +#define R600_VS_SHADER__SPI_VS_OUT_ID_1 35 +#define R600_VS_SHADER__SPI_VS_OUT_ID_2 36 +#define R600_VS_SHADER__SPI_VS_OUT_ID_3 37 +#define R600_VS_SHADER__SPI_VS_OUT_ID_4 38 +#define R600_VS_SHADER__SPI_VS_OUT_ID_5 39 +#define R600_VS_SHADER__SPI_VS_OUT_ID_6 40 +#define R600_VS_SHADER__SPI_VS_OUT_ID_7 41 +#define R600_VS_SHADER__SPI_VS_OUT_ID_8 42 +#define R600_VS_SHADER__SPI_VS_OUT_ID_9 43 +#define R600_VS_SHADER__SPI_VS_OUT_CONFIG 46 +#define R600_VS_SHADER__SQ_PGM_START_VS 49 +#define R600_VS_SHADER__SQ_PGM_START_VS_BO_ID 51 +#define R600_VS_SHADER__SQ_PGM_RESOURCES_VS 54 +#define R600_VS_SHADER__SQ_PGM_START_FS 57 +#define R600_VS_SHADER__SQ_PGM_START_FS_BO_ID 59 +#define R600_VS_SHADER__SQ_PGM_RESOURCES_FS 62 +#define R600_VS_SHADER__SQ_PGM_CF_OFFSET_VS 65 +#define R600_VS_SHADER__SQ_PGM_CF_OFFSET_FS 68 /* R600_PS_SHADER */ #define R600_PS_SHADER__SPI_PS_INPUT_CNTL_0 0 #define R600_PS_SHADER__SPI_PS_INPUT_CNTL_1 1 @@ -509,158 +446,104 @@ struct radeon_ctx { #define R600_PS_SHADER__SPI_PS_INPUT_CNTL_29 29 #define R600_PS_SHADER__SPI_PS_INPUT_CNTL_30 30 #define R600_PS_SHADER__SPI_PS_INPUT_CNTL_31 31 -#define R600_PS_SHADER__SPI_PS_IN_CONTROL_0 32 -#define R600_PS_SHADER__SPI_PS_IN_CONTROL_1 33 -#define R600_PS_SHADER__SPI_INPUT_Z 34 -#define R600_PS_SHADER__SQ_PGM_START_PS 35 -#define R600_PS_SHADER__SQ_PGM_RESOURCES_PS 36 -#define R600_PS_SHADER__SQ_PGM_EXPORTS_PS 37 -#define R600_PS_SHADER__SQ_PGM_CF_OFFSET_PS 38 -#define R600_PS_SHADER_SIZE 39 -#define R600_PS_SHADER_PM4 128 +#define R600_PS_SHADER__SPI_PS_IN_CONTROL_0 34 +#define R600_PS_SHADER__SPI_PS_IN_CONTROL_1 35 +#define R600_PS_SHADER__SPI_INPUT_Z 38 +#define R600_PS_SHADER__SQ_PGM_START_PS 41 +#define R600_PS_SHADER__SQ_PGM_START_PS_BO_ID 43 +#define R600_PS_SHADER__SQ_PGM_RESOURCES_PS 46 +#define R600_PS_SHADER__SQ_PGM_EXPORTS_PS 47 +#define R600_PS_SHADER__SQ_PGM_CF_OFFSET_PS 50 /* R600_PS_CONSTANT */ #define R600_PS_CONSTANT__SQ_ALU_CONSTANT0_0 0 #define R600_PS_CONSTANT__SQ_ALU_CONSTANT1_0 1 #define R600_PS_CONSTANT__SQ_ALU_CONSTANT2_0 2 #define R600_PS_CONSTANT__SQ_ALU_CONSTANT3_0 3 -#define R600_PS_CONSTANT_SIZE 4 -#define R600_PS_CONSTANT_PM4 128 /* R600_VS_CONSTANT */ #define R600_VS_CONSTANT__SQ_ALU_CONSTANT0_256 0 #define R600_VS_CONSTANT__SQ_ALU_CONSTANT1_256 1 #define R600_VS_CONSTANT__SQ_ALU_CONSTANT2_256 2 #define R600_VS_CONSTANT__SQ_ALU_CONSTANT3_256 3 -#define R600_VS_CONSTANT_SIZE 4 -#define R600_VS_CONSTANT_PM4 128 /* R600_PS_RESOURCE */ -#define R600_PS_RESOURCE__RESOURCE0_WORD0 0 -#define R600_PS_RESOURCE__RESOURCE0_WORD1 1 -#define R600_PS_RESOURCE__RESOURCE0_WORD2 2 -#define R600_PS_RESOURCE__RESOURCE0_WORD3 3 -#define R600_PS_RESOURCE__RESOURCE0_WORD4 4 -#define R600_PS_RESOURCE__RESOURCE0_WORD5 5 -#define R600_PS_RESOURCE__RESOURCE0_WORD6 6 -#define R600_PS_RESOURCE_SIZE 7 -#define R600_PS_RESOURCE_PM4 128 -/* R600_VS_RESOURCE */ -#define R600_VS_RESOURCE__RESOURCE160_WORD0 0 -#define R600_VS_RESOURCE__RESOURCE160_WORD1 1 -#define R600_VS_RESOURCE__RESOURCE160_WORD2 2 -#define R600_VS_RESOURCE__RESOURCE160_WORD3 3 -#define R600_VS_RESOURCE__RESOURCE160_WORD4 4 -#define R600_VS_RESOURCE__RESOURCE160_WORD5 5 -#define R600_VS_RESOURCE__RESOURCE160_WORD6 6 -#define R600_VS_RESOURCE_SIZE 7 -#define R600_VS_RESOURCE_PM4 128 -/* R600_FS_RESOURCE */ -#define R600_FS_RESOURCE__RESOURCE320_WORD0 0 -#define R600_FS_RESOURCE__RESOURCE320_WORD1 1 -#define R600_FS_RESOURCE__RESOURCE320_WORD2 2 -#define R600_FS_RESOURCE__RESOURCE320_WORD3 3 -#define R600_FS_RESOURCE__RESOURCE320_WORD4 4 -#define R600_FS_RESOURCE__RESOURCE320_WORD5 5 -#define R600_FS_RESOURCE__RESOURCE320_WORD6 6 -#define R600_FS_RESOURCE_SIZE 7 -#define R600_FS_RESOURCE_PM4 128 -/* R600_GS_RESOURCE */ -#define R600_GS_RESOURCE__RESOURCE336_WORD0 0 -#define R600_GS_RESOURCE__RESOURCE336_WORD1 1 -#define R600_GS_RESOURCE__RESOURCE336_WORD2 2 -#define R600_GS_RESOURCE__RESOURCE336_WORD3 3 -#define R600_GS_RESOURCE__RESOURCE336_WORD4 4 -#define R600_GS_RESOURCE__RESOURCE336_WORD5 5 -#define R600_GS_RESOURCE__RESOURCE336_WORD6 6 -#define R600_GS_RESOURCE_SIZE 7 -#define R600_GS_RESOURCE_PM4 128 +#define R600_RESOURCE__RESOURCE_WORD0 0 +#define R600_RESOURCE__RESOURCE_WORD1 1 +#define R600_RESOURCE__RESOURCE_WORD2 2 +#define R600_RESOURCE__RESOURCE_WORD3 3 +#define R600_RESOURCE__RESOURCE_WORD4 4 +#define R600_RESOURCE__RESOURCE_WORD5 5 +#define R600_RESOURCE__RESOURCE_WORD6 6 +#define R600_RESOURCE__RESOURCE_BO0_ID 8 +#define R600_RESOURCE__RESOURCE_BO1_ID 10 /* R600_PS_SAMPLER */ #define R600_PS_SAMPLER__SQ_TEX_SAMPLER_WORD0_0 0 #define R600_PS_SAMPLER__SQ_TEX_SAMPLER_WORD1_0 1 #define R600_PS_SAMPLER__SQ_TEX_SAMPLER_WORD2_0 2 -#define R600_PS_SAMPLER_SIZE 3 -#define R600_PS_SAMPLER_PM4 128 /* R600_VS_SAMPLER */ -#define R600_VS_SAMPLER__SQ_TEX_SAMPLER_WORD0_18 0 -#define R600_VS_SAMPLER__SQ_TEX_SAMPLER_WORD1_18 1 -#define R600_VS_SAMPLER__SQ_TEX_SAMPLER_WORD2_18 2 -#define R600_VS_SAMPLER_SIZE 3 -#define R600_VS_SAMPLER_PM4 128 +#define R600_VS_SAMPLER__SQ_TEX_SAMPLER_WORD0_18 0 +#define R600_VS_SAMPLER__SQ_TEX_SAMPLER_WORD1_18 1 +#define R600_VS_SAMPLER__SQ_TEX_SAMPLER_WORD2_18 2 /* R600_GS_SAMPLER */ -#define R600_GS_SAMPLER__SQ_TEX_SAMPLER_WORD0_36 0 -#define R600_GS_SAMPLER__SQ_TEX_SAMPLER_WORD1_36 1 -#define R600_GS_SAMPLER__SQ_TEX_SAMPLER_WORD2_36 2 -#define R600_GS_SAMPLER_SIZE 3 -#define R600_GS_SAMPLER_PM4 128 +#define R600_GS_SAMPLER__SQ_TEX_SAMPLER_WORD0_36 0 +#define R600_GS_SAMPLER__SQ_TEX_SAMPLER_WORD1_36 1 +#define R600_GS_SAMPLER__SQ_TEX_SAMPLER_WORD2_36 2 /* R600_PS_SAMPLER_BORDER */ -#define R600_PS_SAMPLER_BORDER__TD_PS_SAMPLER0_BORDER_RED 0 -#define R600_PS_SAMPLER_BORDER__TD_PS_SAMPLER0_BORDER_GREEN 1 -#define R600_PS_SAMPLER_BORDER__TD_PS_SAMPLER0_BORDER_BLUE 2 -#define R600_PS_SAMPLER_BORDER__TD_PS_SAMPLER0_BORDER_ALPHA 3 -#define R600_PS_SAMPLER_BORDER_SIZE 4 -#define R600_PS_SAMPLER_BORDER_PM4 128 +#define R600_PS_SAMPLER_BORDER__TD_PS_SAMPLER0_BORDER_RED 0 +#define R600_PS_SAMPLER_BORDER__TD_PS_SAMPLER0_BORDER_GREEN 1 +#define R600_PS_SAMPLER_BORDER__TD_PS_SAMPLER0_BORDER_BLUE 2 +#define R600_PS_SAMPLER_BORDER__TD_PS_SAMPLER0_BORDER_ALPHA 3 /* R600_VS_SAMPLER_BORDER */ -#define R600_VS_SAMPLER_BORDER__TD_VS_SAMPLER0_BORDER_RED 0 -#define R600_VS_SAMPLER_BORDER__TD_VS_SAMPLER0_BORDER_GREEN 1 -#define R600_VS_SAMPLER_BORDER__TD_VS_SAMPLER0_BORDER_BLUE 2 -#define R600_VS_SAMPLER_BORDER__TD_VS_SAMPLER0_BORDER_ALPHA 3 -#define R600_VS_SAMPLER_BORDER_SIZE 4 -#define R600_VS_SAMPLER_BORDER_PM4 128 +#define R600_VS_SAMPLER_BORDER__TD_VS_SAMPLER0_BORDER_RED 0 +#define R600_VS_SAMPLER_BORDER__TD_VS_SAMPLER0_BORDER_GREEN 1 +#define R600_VS_SAMPLER_BORDER__TD_VS_SAMPLER0_BORDER_BLUE 2 +#define R600_VS_SAMPLER_BORDER__TD_VS_SAMPLER0_BORDER_ALPHA 3 /* R600_GS_SAMPLER_BORDER */ -#define R600_GS_SAMPLER_BORDER__TD_GS_SAMPLER0_BORDER_RED 0 -#define R600_GS_SAMPLER_BORDER__TD_GS_SAMPLER0_BORDER_GREEN 1 -#define R600_GS_SAMPLER_BORDER__TD_GS_SAMPLER0_BORDER_BLUE 2 -#define R600_GS_SAMPLER_BORDER__TD_GS_SAMPLER0_BORDER_ALPHA 3 -#define R600_GS_SAMPLER_BORDER_SIZE 4 -#define R600_GS_SAMPLER_BORDER_PM4 128 -/* R600_CB0 */ -#define R600_CB0__CB_COLOR0_BASE 0 -#define R600_CB0__CB_COLOR0_INFO 1 -#define R600_CB0__CB_COLOR0_SIZE 2 -#define R600_CB0__CB_COLOR0_VIEW 3 -#define R600_CB0__CB_COLOR0_FRAG 4 -#define R600_CB0__CB_COLOR0_TILE 5 -#define R600_CB0__CB_COLOR0_MASK 6 -#define R600_CB0_SIZE 7 -#define R600_CB0_PM4 128 +#define R600_GS_SAMPLER_BORDER__TD_GS_SAMPLER0_BORDER_RED 0 +#define R600_GS_SAMPLER_BORDER__TD_GS_SAMPLER0_BORDER_GREEN 1 +#define R600_GS_SAMPLER_BORDER__TD_GS_SAMPLER0_BORDER_BLUE 2 +#define R600_GS_SAMPLER_BORDER__TD_GS_SAMPLER0_BORDER_ALPHA 3 +/* R600_CB */ +#define R600_CB__CB_COLOR0_BASE 0 +#define R600_CB__CB_COLOR0_BASE_BO_ID 2 +#define R600_CB__CB_COLOR0_INFO 5 +#define R600_CB__CB_COLOR0_SIZE 8 +#define R600_CB__CB_COLOR0_VIEW 11 +#define R600_CB__CB_COLOR0_FRAG 14 +#define R600_CB__CB_COLOR0_FRAG_BO_ID 16 +#define R600_CB__CB_COLOR0_TILE 19 +#define R600_CB__CB_COLOR0_TILE_BO_ID 21 +#define R600_CB__CB_COLOR0_MASK 24 /* R600_DB */ -#define R600_DB__DB_DEPTH_BASE 0 -#define R600_DB__DB_DEPTH_SIZE 1 -#define R600_DB__DB_DEPTH_VIEW 2 -#define R600_DB__DB_DEPTH_INFO 3 -#define R600_DB__DB_HTILE_SURFACE 4 -#define R600_DB__DB_PREFETCH_LIMIT 5 -#define R600_DB_SIZE 6 -#define R600_DB_PM4 128 +#define R600_DB__DB_DEPTH_BASE 0 +#define R600_DB__DB_DEPTH_BASE_BO_ID 2 +#define R600_DB__DB_DEPTH_SIZE 5 +#define R600_DB__DB_DEPTH_VIEW 6 +#define R600_DB__DB_DEPTH_INFO 9 +#define R600_DB__DB_HTILE_SURFACE 12 +#define R600_DB__DB_PREFETCH_LIMIT 15 /* R600_VGT */ -#define R600_VGT__VGT_PRIMITIVE_TYPE 0 -#define R600_VGT__VGT_MAX_VTX_INDX 1 -#define R600_VGT__VGT_MIN_VTX_INDX 2 -#define R600_VGT__VGT_INDX_OFFSET 3 -#define R600_VGT__VGT_MULTI_PRIM_IB_RESET_INDX 4 -#define R600_VGT__VGT_DMA_INDEX_TYPE 5 -#define R600_VGT__VGT_PRIMITIVEID_EN 6 -#define R600_VGT__VGT_DMA_NUM_INSTANCES 7 -#define R600_VGT__VGT_MULTI_PRIM_IB_RESET_EN 8 -#define R600_VGT__VGT_INSTANCE_STEP_RATE_0 9 -#define R600_VGT__VGT_INSTANCE_STEP_RATE_1 10 -#define R600_VGT_SIZE 11 -#define R600_VGT_PM4 128 +#define R600_VGT__VGT_MAX_VTX_INDX 0 +#define R600_VGT__VGT_MIN_VTX_INDX 1 +#define R600_VGT__VGT_INDX_OFFSET 2 +#define R600_VGT__VGT_MULTI_PRIM_IB_RESET_INDX 3 +#define R600_VGT__VGT_PRIMITIVE_TYPE 6 +#define R600_VGT__VGT_DMA_INDEX_TYPE 8 +#define R600_VGT__VGT_DMA_NUM_INSTANCES 10 +/* R600_DRAW_AUTO */ +#define R600_DRAW_AUTO__VGT_NUM_INDICES 0 +#define R600_DRAW_AUTO__VGT_DRAW_INITIATOR 1 /* R600_DRAW */ -#define R600_DRAW__VGT_NUM_INDICES 0 -#define R600_DRAW__VGT_DMA_BASE_HI 1 -#define R600_DRAW__VGT_DMA_BASE 2 -#define R600_DRAW__VGT_DRAW_INITIATOR 3 -#define R600_DRAW_SIZE 4 -#define R600_DRAW_PM4 128 -/* R600_CLIP */ -#define R600_CLIP__PA_CL_UCP_X_0 0 -#define R600_CLIP__PA_CL_UCP_Y_0 1 -#define R600_CLIP__PA_CL_UCP_Z_0 2 -#define R600_CLIP__PA_CL_UCP_W_0 3 -#define R600_CLIP_SIZE 4 -#define R600_CLIP_PM4 128 +#define R600_DRAW__VGT_DMA_BASE 0 +#define R600_DRAW__VGT_DMA_BASE_HI 1 +#define R600_DRAW__VGT_NUM_INDICES 2 +#define R600_DRAW__VGT_DRAW_INITIATOR 3 +#define R600_DRAW__INDICES_BO_ID 5 +/* R600_UCP */ +#define R600_UCP__PA_CL_UCP_X_0 0 +#define R600_UCP__PA_CL_UCP_Y_0 1 +#define R600_UCP__PA_CL_UCP_Z_0 2 +#define R600_UCP__PA_CL_UCP_W_0 3 /* R600 QUERY BEGIN/END */ -#define R600_QUERY__OFFSET 0 -#define R600_QUERY_SIZE 1 -#define R600_QUERY_PM4 128 +#define R600_QUERY__OFFSET 0 +#define R600_QUERY__BO_ID 3 #endif diff --git a/src/gallium/winsys/r600/drm/r600_state.c b/src/gallium/winsys/r600/drm/r600_state.c index 9b7c11bdc0..7941563215 100644 --- a/src/gallium/winsys/r600/drm/r600_state.c +++ b/src/gallium/winsys/r600/drm/r600_state.c @@ -30,377 +30,41 @@ #include "radeon_priv.h" #include "r600d.h" -static int r600_state_pm4_resource(struct radeon_state *state); -static int r600_state_pm4_cb0(struct radeon_state *state); -static int r600_state_pm4_vgt(struct radeon_state *state); -static int r600_state_pm4_db(struct radeon_state *state); -static int r600_state_pm4_shader(struct radeon_state *state); -static int r600_state_pm4_draw(struct radeon_state *state); -static int r600_state_pm4_config(struct radeon_state *state); -static int r600_state_pm4_generic(struct radeon_state *state); -static int r600_state_pm4_query_begin(struct radeon_state *state); -static int r600_state_pm4_query_end(struct radeon_state *state); -static int r700_state_pm4_config(struct radeon_state *state); -static int r700_state_pm4_cb0(struct radeon_state *state); -static int r700_state_pm4_db(struct radeon_state *state); +static const struct radeon_type R600_types[]; +static const struct radeon_type R700_types[]; +#define R600_FLUSH_RESOURCE ((~C_0085F0_TC_ACTION_ENA) | (~C_0085F0_VC_ACTION_ENA)) +#define R600_FLUSH_CB0 (~C_0085F0_CB0_DEST_BASE_ENA) +#define R600_FLUSH_CB1 (~C_0085F0_CB1_DEST_BASE_ENA) +#define R600_FLUSH_CB2 (~C_0085F0_CB2_DEST_BASE_ENA) +#define R600_FLUSH_CB3 (~C_0085F0_CB3_DEST_BASE_ENA) +#define R600_FLUSH_CB4 (~C_0085F0_CB4_DEST_BASE_ENA) +#define R600_FLUSH_CB5 (~C_0085F0_CB5_DEST_BASE_ENA) +#define R600_FLUSH_CB6 (~C_0085F0_CB6_DEST_BASE_ENA) +#define R600_FLUSH_CB7 (~C_0085F0_CB7_DEST_BASE_ENA) +#define R600_FLUSH_DB (~C_0085F0_DB_DEST_BASE_ENA) +#define R600_DIRTY_ALL 0xFFFFFFFF +#define R600_DIRTY_ALL2 (R600_FLUSH_RESOURCE | R600_FLUSH_DB | R600_FLUSH_CB0\ + R600_FLUSH_CB1 | R600_FLUSH_CB2 | R600_FLUSH_CB3\ + R600_FLUSH_CB4 | R600_FLUSH_CB5 | R600_FLUSH_CB6\ + R600_FLUSH_CB7) -#include "r600_states.h" - -/* - * r600/r700 state functions - */ -static int r600_state_pm4_bytecode(struct radeon_state *state, unsigned offset, unsigned id, unsigned nreg) -{ - const struct radeon_register *regs = state->radeon->type[state->type].regs; - unsigned i; - int r; - - if (!offset) { - fprintf(stderr, "%s invalid register for state %d %d\n", - __func__, state->type, id); - return -EINVAL; - } - if (offset >= R600_CONFIG_REG_OFFSET && offset < R600_CONFIG_REG_END) { - state->pm4[state->cpm4++] = PKT3(PKT3_SET_CONFIG_REG, nreg); - state->pm4[state->cpm4++] = (offset - R600_CONFIG_REG_OFFSET) >> 2; - for (i = 0; i < nreg; i++) { - state->pm4[state->cpm4++] = state->states[id + i]; - } - for (i = 0; i < nreg; i++) { - if (regs[id + i].need_reloc) { - state->pm4[state->cpm4++] = PKT3(PKT3_NOP, 0); - r = radeon_state_reloc(state, state->cpm4, regs[id + i].bo_id); - if (r) - return r; - state->pm4[state->cpm4++] = state->bo[regs[id + i].bo_id]->handle; - } - } - return 0; - } - if (offset >= R600_CONTEXT_REG_OFFSET && offset < R600_CONTEXT_REG_END) { - state->pm4[state->cpm4++] = PKT3(PKT3_SET_CONTEXT_REG, nreg); - state->pm4[state->cpm4++] = (offset - R600_CONTEXT_REG_OFFSET) >> 2; - for (i = 0; i < nreg; i++) { - state->pm4[state->cpm4++] = state->states[id + i]; - } - for (i = 0; i < nreg; i++) { - if (regs[id + i].need_reloc) { - state->pm4[state->cpm4++] = PKT3(PKT3_NOP, 0); - r = radeon_state_reloc(state, state->cpm4, regs[id + i].bo_id); - if (r) - return r; - state->pm4[state->cpm4++] = state->bo[regs[id + i].bo_id]->handle; - } - } - return 0; - } - if (offset >= R600_ALU_CONST_OFFSET && offset < R600_ALU_CONST_END) { - state->pm4[state->cpm4++] = PKT3(PKT3_SET_ALU_CONST, nreg); - state->pm4[state->cpm4++] = (offset - R600_ALU_CONST_OFFSET) >> 2; - for (i = 0; i < nreg; i++) { - state->pm4[state->cpm4++] = state->states[id + i]; - } - return 0; - } - if (offset >= R600_SAMPLER_OFFSET && offset < R600_SAMPLER_END) { - state->pm4[state->cpm4++] = PKT3(PKT3_SET_SAMPLER, nreg); - state->pm4[state->cpm4++] = (offset - R600_SAMPLER_OFFSET) >> 2; - for (i = 0; i < nreg; i++) { - state->pm4[state->cpm4++] = state->states[id + i]; - } - return 0; - } - fprintf(stderr, "%s unsupported offset 0x%08X\n", __func__, offset); - return -EINVAL; -} - -static int r600_state_pm4_generic(struct radeon_state *state) -{ - struct radeon *radeon = state->radeon; - unsigned i, offset, nreg, type, coffset, loffset, soffset; - unsigned start; - int r; - - if (!state->nstates) - return 0; - type = state->type; - soffset = (state->id - radeon->type[type].id) * radeon->type[type].stride; - offset = loffset = radeon->type[type].regs[0].offset + soffset; - start = 0; - for (i = 1, nreg = 1; i < state->nstates; i++) { - coffset = radeon->type[type].regs[i].offset + soffset; - if (coffset == (loffset + 4)) { - nreg++; - loffset = coffset; - } else { - r = r600_state_pm4_bytecode(state, offset, start, nreg); - if (r) { - fprintf(stderr, "%s invalid 0x%08X %d\n", __func__, start, nreg); - return r; - } - offset = loffset = coffset; - nreg = 1; - start = i; - } - } - return r600_state_pm4_bytecode(state, offset, start, nreg); -} - -static void r600_state_pm4_with_flush(struct radeon_state *state, u32 flags) -{ - unsigned i, j, add, size; - - state->nreloc = 0; - for (i = 0; i < state->nbo; i++) { - for (j = 0, add = 1; j < state->nreloc; j++) { - if (state->bo[state->reloc_bo_id[j]] == state->bo[i]) { - add = 0; - break; - } - } - if (add) { - state->reloc_bo_id[state->nreloc++] = i; - } - } - for (i = 0; i < state->nreloc; i++) { - size = (state->bo[state->reloc_bo_id[i]]->size + 255) >> 8; - state->pm4[state->cpm4++] = PKT3(PKT3_SURFACE_SYNC, 3); - state->pm4[state->cpm4++] = flags; - state->pm4[state->cpm4++] = size; - state->pm4[state->cpm4++] = 0x00000000; - state->pm4[state->cpm4++] = 0x0000000A; - state->pm4[state->cpm4++] = PKT3(PKT3_NOP, 0); - state->reloc_pm4_id[i] = state->cpm4; - state->pm4[state->cpm4++] = state->bo[state->reloc_bo_id[i]]->handle; - } -} - -static int r600_state_pm4_cb0(struct radeon_state *state) -{ - int r; - - r600_state_pm4_with_flush(state, S_0085F0_CB_ACTION_ENA(1) | - S_0085F0_CB0_DEST_BASE_ENA(1)); - r = r600_state_pm4_generic(state); - if (r) - return r; - state->pm4[state->cpm4++] = PKT3(PKT3_SURFACE_BASE_UPDATE, 0); - state->pm4[state->cpm4++] = 0x00000002; - return 0; -} - -static int r700_state_pm4_cb0(struct radeon_state *state) -{ - int r; - - r600_state_pm4_with_flush(state, S_0085F0_CB_ACTION_ENA(1) | - S_0085F0_CB0_DEST_BASE_ENA(1)); - r = r600_state_pm4_generic(state); - if (r) - return r; - return 0; -} - -static int r600_state_pm4_db(struct radeon_state *state) -{ - int r; - - r600_state_pm4_with_flush(state, S_0085F0_DB_ACTION_ENA(1) | - S_0085F0_DB_DEST_BASE_ENA(1)); - r = r600_state_pm4_generic(state); - if (r) - return r; - state->pm4[state->cpm4++] = PKT3(PKT3_SURFACE_BASE_UPDATE, 0); - state->pm4[state->cpm4++] = 0x00000001; - return 0; -} - -static int r700_state_pm4_db(struct radeon_state *state) -{ - int r; - - r600_state_pm4_with_flush(state, S_0085F0_DB_ACTION_ENA(1) | - S_0085F0_DB_DEST_BASE_ENA(1)); - r = r600_state_pm4_generic(state); - if (r) - return r; - return 0; -} - -static int r600_state_pm4_config(struct radeon_state *state) -{ - state->pm4[state->cpm4++] = PKT3(PKT3_START_3D_CMDBUF, 0); - state->pm4[state->cpm4++] = 0x00000000; - state->pm4[state->cpm4++] = PKT3(PKT3_CONTEXT_CONTROL, 1); - state->pm4[state->cpm4++] = 0x80000000; - state->pm4[state->cpm4++] = 0x80000000; - state->pm4[state->cpm4++] = PKT3(PKT3_EVENT_WRITE, 0); - state->pm4[state->cpm4++] = EVENT_TYPE_CACHE_FLUSH_AND_INV_EVENT; - state->pm4[state->cpm4++] = PKT3(PKT3_SET_CONFIG_REG, 1); - state->pm4[state->cpm4++] = 0x00000010; - state->pm4[state->cpm4++] = 0x00028000; - return r600_state_pm4_generic(state); -} - -static int r600_state_pm4_query_begin(struct radeon_state *state) -{ - int r; - - state->cpm4 = 0; - state->pm4[state->cpm4++] = PKT3(PKT3_EVENT_WRITE, 2); - state->pm4[state->cpm4++] = EVENT_TYPE_ZPASS_DONE; - state->pm4[state->cpm4++] = state->states[0]; - state->pm4[state->cpm4++] = 0x0; - state->pm4[state->cpm4++] = PKT3(PKT3_NOP, 0); - r = radeon_state_reloc(state, state->cpm4, 0); - if (r) - return r; - state->pm4[state->cpm4++] = state->bo[0]->handle; - return 0; -} - -static int r600_state_pm4_query_end(struct radeon_state *state) -{ - int r; - - state->cpm4 = 0; - state->pm4[state->cpm4++] = PKT3(PKT3_EVENT_WRITE, 2); - state->pm4[state->cpm4++] = EVENT_TYPE_ZPASS_DONE; - state->pm4[state->cpm4++] = state->states[0]; - state->pm4[state->cpm4++] = 0x0; - state->pm4[state->cpm4++] = PKT3(PKT3_NOP, 0); - r = radeon_state_reloc(state, state->cpm4, 0); - if (r) - return r; - state->pm4[state->cpm4++] = state->bo[0]->handle; - return 0; -} - -static int r700_state_pm4_config(struct radeon_state *state) -{ - state->pm4[state->cpm4++] = PKT3(PKT3_CONTEXT_CONTROL, 1); - state->pm4[state->cpm4++] = 0x80000000; - state->pm4[state->cpm4++] = 0x80000000; - state->pm4[state->cpm4++] = PKT3(PKT3_EVENT_WRITE, 0); - state->pm4[state->cpm4++] = EVENT_TYPE_CACHE_FLUSH_AND_INV_EVENT; - state->pm4[state->cpm4++] = PKT3(PKT3_SET_CONFIG_REG, 1); - state->pm4[state->cpm4++] = 0x00000010; - state->pm4[state->cpm4++] = 0x00028000; - return r600_state_pm4_generic(state); -} - -static int r600_state_pm4_shader(struct radeon_state *state) -{ - r600_state_pm4_with_flush(state, S_0085F0_SH_ACTION_ENA(1)); - return r600_state_pm4_generic(state); -} - -static int r600_state_pm4_vgt(struct radeon_state *state) -{ - int r; - - r = r600_state_pm4_bytecode(state, R_028400_VGT_MAX_VTX_INDX, R600_VGT__VGT_MAX_VTX_INDX, 1); - if (r) - return r; - r = r600_state_pm4_bytecode(state, R_028404_VGT_MIN_VTX_INDX, R600_VGT__VGT_MIN_VTX_INDX, 1); - if (r) - return r; - r = r600_state_pm4_bytecode(state, R_028408_VGT_INDX_OFFSET, R600_VGT__VGT_INDX_OFFSET, 1); - if (r) - return r; - r = r600_state_pm4_bytecode(state, R_02840C_VGT_MULTI_PRIM_IB_RESET_INDX, R600_VGT__VGT_MULTI_PRIM_IB_RESET_INDX, 1); - if (r) - return r; - r = r600_state_pm4_bytecode(state, R_008958_VGT_PRIMITIVE_TYPE, R600_VGT__VGT_PRIMITIVE_TYPE, 1); - if (r) - return r; - state->pm4[state->cpm4++] = PKT3(PKT3_INDEX_TYPE, 0); - state->pm4[state->cpm4++] = state->states[R600_VGT__VGT_DMA_INDEX_TYPE]; - state->pm4[state->cpm4++] = PKT3(PKT3_NUM_INSTANCES, 0); - state->pm4[state->cpm4++] = state->states[R600_VGT__VGT_DMA_NUM_INSTANCES]; - return 0; -} - -static int r600_state_pm4_draw(struct radeon_state *state) +static int r600_ctx_bo_flush(struct radeon_ctx *ctx, struct radeon_bo *bo, u32 flags, u32 *placement) { - unsigned i; - int r; + unsigned size; - if (state->nbo) { - state->pm4[state->cpm4++] = PKT3(PKT3_DRAW_INDEX, 3); - state->pm4[state->cpm4++] = state->states[R600_DRAW__VGT_DMA_BASE]; - state->pm4[state->cpm4++] = state->states[R600_DRAW__VGT_DMA_BASE_HI]; - state->pm4[state->cpm4++] = state->states[R600_DRAW__VGT_NUM_INDICES]; - state->pm4[state->cpm4++] = state->states[R600_DRAW__VGT_DRAW_INITIATOR]; - state->pm4[state->cpm4++] = PKT3(PKT3_NOP, 0); - r = radeon_state_reloc(state, state->cpm4, 0); - if (r) - return r; - state->pm4[state->cpm4++] = state->bo[0]->handle; - } else if (state->nimmd) { - state->pm4[state->cpm4++] = PKT3(PKT3_DRAW_INDEX_IMMD, state->nimmd + 1); - state->pm4[state->cpm4++] = state->states[R600_DRAW__VGT_NUM_INDICES]; - state->pm4[state->cpm4++] = state->states[R600_DRAW__VGT_DRAW_INITIATOR]; - for (i = 0; i < state->nimmd; i++) { - state->pm4[state->cpm4++] = state->immd[i]; - } - } else { - state->pm4[state->cpm4++] = PKT3(PKT3_DRAW_INDEX_AUTO, 1); - state->pm4[state->cpm4++] = state->states[R600_DRAW__VGT_NUM_INDICES]; - state->pm4[state->cpm4++] = state->states[R600_DRAW__VGT_DRAW_INITIATOR]; + if (7 > ctx->npm4) { + return -EBUSY; } - state->pm4[state->cpm4++] = PKT3(PKT3_EVENT_WRITE, 0); - state->pm4[state->cpm4++] = EVENT_TYPE_CACHE_FLUSH_AND_INV_EVENT; - return 0; -} - -static int r600_state_pm4_resource(struct radeon_state *state) -{ - u32 flags, type, nbo, offset, soffset; - int r; - - soffset = (state->id - state->radeon->type[state->type].id) * state->radeon->type[state->type].stride; - type = G_038018_TYPE(state->states[6]); - switch (type) { - case 2: - flags = S_0085F0_TC_ACTION_ENA(1); - nbo = 2; - break; - case 3: - flags = S_0085F0_VC_ACTION_ENA(1); - nbo = 1; - break; - default: - return 0; - } - if (state->nbo != nbo) { - fprintf(stderr, "%s need %d bo got %d\n", __func__, nbo, state->nbo); - return -EINVAL; - } - r600_state_pm4_with_flush(state, flags); - offset = state->radeon->type[state->type].regs[0].offset + soffset; - state->pm4[state->cpm4++] = PKT3(PKT3_SET_RESOURCE, 7); - state->pm4[state->cpm4++] = (offset - R_038000_SQ_TEX_RESOURCE_WORD0_0) >> 2; - state->pm4[state->cpm4++] = state->states[0]; - state->pm4[state->cpm4++] = state->states[1]; - state->pm4[state->cpm4++] = state->states[2]; - state->pm4[state->cpm4++] = state->states[3]; - state->pm4[state->cpm4++] = state->states[4]; - state->pm4[state->cpm4++] = state->states[5]; - state->pm4[state->cpm4++] = state->states[6]; - state->pm4[state->cpm4++] = PKT3(PKT3_NOP, 0); - r = radeon_state_reloc(state, state->cpm4, 0); - if (r) - return r; - state->pm4[state->cpm4++] = state->bo[0]->handle; - if (type == 2) { - state->pm4[state->cpm4++] = PKT3(PKT3_NOP, 0); - r = radeon_state_reloc(state, state->cpm4, 1); - if (r) - return r; - state->pm4[state->cpm4++] = state->bo[1]->handle; - } - return 0; + size = (bo->size + 255) >> 8; + ctx->pm4[ctx->id++] = PKT3(PKT3_SURFACE_SYNC, 3); + ctx->pm4[ctx->id++] = flags; + ctx->pm4[ctx->id++] = size; + ctx->pm4[ctx->id++] = 0x00000000; + ctx->pm4[ctx->id++] = 0x0000000A; + ctx->pm4[ctx->id++] = PKT3(PKT3_NOP, 0); + ctx->pm4[ctx->id++] = 0x00000000; + ctx->npm4 -= 7; + return radeon_ctx_reloc(ctx, bo, ctx->id - 1, placement); } int r600_init(struct radeon *radeon) @@ -414,7 +78,6 @@ int r600_init(struct radeon *radeon) case CHIP_RV635: case CHIP_RS780: case CHIP_RS880: - radeon->ntype = R600_NTYPE; radeon->nstate = R600_NSTATE; radeon->type = R600_types; break; @@ -422,7 +85,6 @@ int r600_init(struct radeon *radeon) case CHIP_RV730: case CHIP_RV710: case CHIP_RV740: - radeon->ntype = R600_NTYPE; radeon->nstate = R600_NSTATE; radeon->type = R700_types; break; @@ -431,5 +93,7696 @@ int r600_init(struct radeon *radeon) __func__, radeon->device); return -EINVAL; } + radeon->bo_flush = &r600_ctx_bo_flush; return 0; } + +/* CONFIG */ +#define R600_CONFIG_header_cpm4 12 +static const u32 R600_CONFIG_header_pm4[R600_CONFIG_header_cpm4] = { + 0xC0002400, + 0x00000000, + 0xC0012800, + 0x80000000, + 0x80000000, + 0xC0004600, + 0x00000016, + 0xC0016800, + 0x00000010, + 0x00028000, + 0xC0066800, + 0x00000300, +}; +#define R700_CONFIG_header_cpm4 10 +u32 R700_CONFIG_header_pm4[R700_CONFIG_header_cpm4] = { + 0xC0012800, + 0x80000000, + 0x80000000, + 0xC0004600, + 0x00000016, + 0xC0016800, + 0x00000010, + 0x00028000, + 0xC0066800, + 0x00000300, +}; +#define R600_CONFIG_state_cpm4 67 +u32 R600_CONFIG_state_pm4[R600_CONFIG_state_cpm4] = { + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + 0xC0016800, + 0x00000363, + 0x00000000, + 0xC0016800, + 0x00000542, + 0x00000000, + 0xC0016800, + 0x000005C5, + 0x00000000, + 0xC0016800, + 0x0000060C, + 0x00000000, + 0xC0016800, + 0x0000060E, + 0x00000000, + 0xC0016900, + 0x000000D4, + 0x00000000, + 0xC0016900, + 0x000001B2, + 0x00000000, + 0xC0016900, + 0x000001E8, + 0x00000000, + 0xC0096900, + 0x0000022A, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + 0xC00D6900, + 0x00000284, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + 0xC0016900, + 0x00000293, + 0x00000000, + 0xC0036900, + 0x000002AC, + 0x00000000, + 0x00000000, + 0x00000000, + 0xC0016900, + 0x000002C8, + 0x00000000, +}; +#define R600_CB_CNTL_header_cpm4 2 +u32 R600_CB_CNTL_header_pm4[R600_CB_CNTL_header_cpm4] = { + 0xC0046900, + 0x00000048, +}; +#define R600_CB_CNTL_state_cpm4 32 +u32 R600_CB_CNTL_state_pm4[R600_CB_CNTL_state_cpm4] = { + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + 0xC0026900, + 0x0000008E, + 0x00000000, + 0x00000000, + 0xC0036900, + 0x00000109, + 0x00000000, + 0x00000000, + 0x00000000, + 0xC0016900, + 0x00000202, + 0x00000000, + 0xC0016900, + 0x00000301, + 0x00000000, + 0xC0026900, + 0x00000307, + 0x00000000, + 0x00000000, + 0xC0046900, + 0x0000030C, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + 0xC0016900, + 0x00000312, + 0x00000000, +}; +#define R600_RASTERIZER_header_cpm4 2 +u32 R600_RASTERIZER_header_pm4[R600_RASTERIZER_header_cpm4] = { + 0xC0016900, + 0x000001B5, +}; +#define R600_RASTERIZER_state_cpm4 35 +u32 R600_RASTERIZER_state_pm4[R600_RASTERIZER_state_cpm4] = { + 0x00000000, + 0xC0026900, + 0x00000204, + 0x00000000, + 0x00000000, + 0xC0026900, + 0x00000207, + 0x00000000, + 0x00000000, + 0xC0046900, + 0x00000280, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + 0xC0016900, + 0x00000292, + 0x00000000, + 0xC0016900, + 0x00000300, + 0x00000000, + 0xC0046900, + 0x00000303, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + 0xC0066900, + 0x0000037E, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, +}; + +/* R600_VIEWPORT */ +#define R600_VIEWPORT_header_cpm4 2 +u32 R600_VIEWPORT_header_pm4[R600_VIEWPORT_header_cpm4] = { + 0xC0026900, + 0x000000B4, +}; +#define R600_VIEWPORT_state_cpm4 23 +u32 R600_VIEWPORT_state_pm4[R600_VIEWPORT_state_cpm4] = { + 0x00000000, + 0x00000000, + 0xC0016900, + 0x0000010F, + 0x00000000, + 0xC0016900, + 0x00000111, + 0x00000000, + 0xC0016900, + 0x00000113, + 0x00000000, + 0xC0016900, + 0x00000110, + 0x00000000, + 0xC0016900, + 0x00000112, + 0x00000000, + 0xC0016900, + 0x00000114, + 0x00000000, + 0xC0016900, + 0x00000206, + 0x00000000, +}; +#define R600_SCISSOR_header_cpm4 2 +u32 R600_SCISSOR_header_pm4[R600_SCISSOR_header_cpm4] = { + 0xC0026900, + 0x0000000C, +}; +#define R600_SCISSOR_state_cpm4 25 +u32 R600_SCISSOR_state_pm4[R600_SCISSOR_state_cpm4] = { + 0x00000000, + 0x00000000, + 0xC00D6900, + 0x00000080, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + 0xC0026900, + 0x00000090, + 0x00000000, + 0x00000000, + 0xC0026900, + 0x00000094, + 0x00000000, + 0x00000000, +}; + +/* R600_BLEND */ +#define R600_BLEND_header_cpm4 2 +u32 R600_BLEND_header_pm4[R600_BLEND_header_cpm4] = { + 0xC0046900, + 0x00000105, +}; +#define R600_BLEND_state_cpm4 17 +u32 R600_BLEND_state_pm4[R600_BLEND_state_cpm4] = { + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + 0xC0086900, + 0x000001E0, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + 0xC0016900, + 0x00000201, + 0x00000000, +}; + +/* R600_DSA */ +#define R600_DSA_header_cpm4 2 +u32 R600_DSA_header_pm4[R600_DSA_header_cpm4] = { + 0xC0026900, + 0x0000000A, +}; +#define R600_DSA_state_cpm4 34 +u32 R600_DSA_state_pm4[R600_DSA_state_cpm4] = { + 0x00000000, + 0x00000000, + 0xC0016900, + 0x00000104, + 0x00000000, + 0xC0036900, + 0x0000010C, + 0x00000000, + 0x00000000, + 0x00000000, + 0xC0026900, + 0x000001B8, + 0x00000000, + 0x00000000, + 0xC0016900, + 0x000001B7, + 0x00000000, + 0xC0016900, + 0x00000200, + 0x00000000, + 0xC0016900, + 0x00000203, + 0x00000000, + 0xC0026900, + 0x00000343, + 0x00000000, + 0x00000000, + 0xC0026900, + 0x0000034B, + 0x00000000, + 0x00000000, + 0xC0016900, + 0x00000351, + 0x00000000, +}; + +/* R600_UCP */ +#define R600_UCP_header_cpm4 2 +u32 R600_UCP0_header_pm4[R600_UCP_header_cpm4] = { + 0xC0046900, + 0x00000388, +}; +u32 R600_UCP1_header_pm4[R600_UCP_header_cpm4] = { + 0xC0046900, + 0x0000038C, +}; +u32 R600_UCP2_header_pm4[R600_UCP_header_cpm4] = { + 0xC0046900, + 0x00000390, +}; +u32 R600_UCP3_header_pm4[R600_UCP_header_cpm4] = { + 0xC0046900, + 0x00000394, +}; +u32 R600_UCP4_header_pm4[R600_UCP_header_cpm4] = { + 0xC0046900, + 0x00000398, +}; +u32 R600_UCP5_header_pm4[R600_UCP_header_cpm4] = { + 0xC0046900, + 0x0000039C, +}; +#define R600_UCP_state_cpm4 4 +u32 R600_UCP_state_pm4[R600_UCP_state_cpm4] = { + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, +}; + +/* R600_VGT */ +#define R600_VGT_header_cpm4 2 +u32 R600_VGT_header_pm4[R600_VGT_header_cpm4] = { + 0xC0046900, + 0x00000100, +}; +#define R600_VGT_state_cpm4 11 +u32 R600_VGT_state_pm4[R600_VGT_state_cpm4] = { + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + 0xC0016800, + 0x00000256, + 0x00000000, + 0xC0002A00, + 0x00000000, + 0xC0002F00, + 0x00000000, +}; + +/* R600_QUERY */ +#define R600_QUERY_header_cpm4 2 +u32 R600_QUERY_header_pm4[R600_QUERY_header_cpm4] = { + 0xC0024600, + 0x00000015, +}; +#define R600_QUERY_state_cpm4 4 +u32 R600_QUERY_state_pm4[R600_QUERY_state_cpm4] = { + 0x00000000, + 0x00000000, + 0xC0001000, + 0x00000000, +}; + +/* R600_DRAW_AUTO */ +#define R600_DRAW_AUTO_header_cpm4 1 +u32 R600_DRAW_AUTO_header_pm4[R600_DRAW_AUTO_header_cpm4] = { + 0xC0012D00, +}; +#define R600_DRAW_AUTO_state_cpm4 4 +u32 R600_DRAW_AUTO_state_pm4[R600_DRAW_AUTO_state_cpm4] = { + 0x00000000, + 0x00000000, + 0xC0004600, + 0x00000016, +}; + +/* R600_DRAW */ +#define R600_DRAW_header_cpm4 1 +u32 R600_DRAW_header_pm4[R600_DRAW_header_cpm4] = { + 0xC0032B00, +}; +#define R600_DRAW_state_cpm4 8 +u32 R600_DRAW_state_pm4[R600_DRAW_state_cpm4] = { + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + 0xC0001000, + 0x00000000, + 0xC0004600, + 0x00000016, +}; + +/* R600_VS_SHADER */ +#define R600_VS_SHADER_header_cpm4 2 +u32 R600_VS_SHADER_header_pm4[R600_VS_SHADER_header_cpm4] = { + 0xC0206900, + 0x000000E0, +}; +#define R600_VS_SHADER_state_cpm4 69 +u32 R600_VS_SHADER_state_pm4[R600_VS_SHADER_state_cpm4] = { + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + 0xC00A6900, + 0x00000185, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + 0xC0016900, + 0x000001B1, + 0x00000000, + 0xC0016900, + 0x00000216, + 0x00000000, + 0xC0001000, + 0x00000000, + 0xC0016900, + 0x0000021A, + 0x00000000, + 0xC0016900, + 0x00000225, + 0x00000000, + 0xC0001000, + 0x00000000, + 0xC0016900, + 0x00000229, + 0x00000000, + 0xC0016900, + 0x00000234, + 0x00000000, + 0xC0016900, + 0x00000237, + 0x00000000, +}; + +/* R600_PS_SHADER */ +#define R600_PS_SHADER_header_cpm4 2 +u32 R600_PS_SHADER_header_pm4[R600_PS_SHADER_header_cpm4] = { + 0xC0206900, + 0x00000191, +}; +#define R600_PS_SHADER_state_cpm4 51 +u32 R600_PS_SHADER_state_pm4[R600_PS_SHADER_state_cpm4] = { + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + 0xC0026900, + 0x000001B3, + 0x00000000, + 0x00000000, + 0xC0016900, + 0x000001B6, + 0x00000000, + 0xC0016900, + 0x00000210, + 0x00000000, + 0xC0001000, + 0x00000000, + 0xC0026900, + 0x00000214, + 0x00000000, + 0x00000000, + 0xC0016900, + 0x00000233, + 0x00000000, +}; + +/* R600_DB */ +#define R600_DB_header_cpm4 2 +u32 R600_DB_header_pm4[R600_DB_header_cpm4] = { + 0xC0016900, + 0x00000003, +}; +#define R600_DB_state_cpm4 18 +u32 R600_DB_state_pm4[R600_DB_state_cpm4] = { + 0x00000000, + 0xC0001000, + 0x00000000, + 0xC0026900, + 0x00000000, + 0x00000000, + 0x00000000, + 0xC0016900, + 0x00000004, + 0x00000000, + 0xC0016900, + 0x00000349, + 0x00000000, + 0xC0016900, + 0x0000034D, + 0x00000000, + 0xC0007300, + 0x00000001, +}; + +/* R600_CB0 */ +#define R600_CB0_header_cpm4 2 +u32 R600_CB0_header_pm4[R600_CB0_header_cpm4] = { + 0xC0016900, + 0x00000010, +}; +#define R600_CB0_state_cpm4 27 +u32 R600_CB0_state_pm4[R600_CB0_state_cpm4] = { + 0x00000000, + 0xC0001000, + 0x00000000, + 0xC0016900, + 0x00000028, + 0x00000000, + 0xC0016900, + 0x00000018, + 0x00000000, + 0xC0016900, + 0x00000020, + 0x00000000, + 0xC0016900, + 0x00000038, + 0x00000000, + 0xC0001000, + 0x00000000, + 0xC0016900, + 0x00000030, + 0x00000000, + 0xC0001000, + 0x00000000, + 0xC0016900, + 0x00000040, + 0x00000000, + 0xC0007300, + 0x00000002, +}; + +/* R600_CB1 */ +#define R600_CB1_header_cpm4 2 +u32 R600_CB1_header_pm4[R600_CB1_header_cpm4] = { + 0xC0016900, + 0x00000011, +}; +#define R600_CB1_state_cpm4 27 +u32 R600_CB1_state_pm4[R600_CB1_state_cpm4] = { + 0x00000000, + 0xC0001000, + 0x00000000, + 0xC0016900, + 0x00000029, + 0x00000000, + 0xC0016900, + 0x00000019, + 0x00000000, + 0xC0016900, + 0x00000021, + 0x00000000, + 0xC0016900, + 0x00000039, + 0x00000000, + 0xC0001000, + 0x00000000, + 0xC0016900, + 0x00000031, + 0x00000000, + 0xC0001000, + 0x00000000, + 0xC0016900, + 0x00000041, + 0x00000000, + 0xC0007300, + 0x00000002, +}; + +/* R600_CB2 */ +#define R600_CB2_header_cpm4 2 +u32 R600_CB2_header_pm4[R600_CB2_header_cpm4] = { + 0xC0016900, + 0x00000012, +}; +#define R600_CB2_state_cpm4 27 +u32 R600_CB2_state_pm4[R600_CB2_state_cpm4] = { + 0x00000000, + 0xC0001000, + 0x00000004, + 0xC0016900, + 0x0000002A, + 0x00000000, + 0xC0016900, + 0x0000001A, + 0x00000000, + 0xC0016900, + 0x00000022, + 0x00000000, + 0xC0016900, + 0x0000003A, + 0x00000000, + 0xC0001000, + 0x00000000, + 0xC0016900, + 0x00000032, + 0x00000000, + 0xC0001000, + 0x00000000, + 0xC0016900, + 0x00000042, + 0x00000000, + 0xC0007300, + 0x00000002, +}; + +/* R600_CB3 */ +#define R600_CB3_header_cpm4 2 +u32 R600_CB3_header_pm4[R600_CB3_header_cpm4] = { + 0xC0016900, + 0x00000013, +}; +#define R600_CB3_state_cpm4 27 +u32 R600_CB3_state_pm4[R600_CB3_state_cpm4] = { + 0x00000000, + 0xC0001000, + 0x00000004, + 0xC0016900, + 0x0000002B, + 0x00000000, + 0xC0016900, + 0x0000001B, + 0x00000000, + 0xC0016900, + 0x00000023, + 0x00000000, + 0xC0016900, + 0x0000003B, + 0x00000000, + 0xC0001000, + 0x00000000, + 0xC0016900, + 0x00000033, + 0x00000000, + 0xC0001000, + 0x00000000, + 0xC0016900, + 0x00000043, + 0x00000000, + 0xC0007300, + 0x00000002, +}; + +/* R600_CB4 */ +#define R600_CB4_header_cpm4 2 +u32 R600_CB4_header_pm4[R600_CB4_header_cpm4] = { + 0xC0016900, + 0x00000014, +}; +#define R600_CB4_state_cpm4 27 +u32 R600_CB4_state_pm4[R600_CB4_state_cpm4] = { + 0x00000000, + 0xC0001000, + 0x00000004, + 0xC0016900, + 0x0000002C, + 0x00000000, + 0xC0016900, + 0x0000001C, + 0x00000000, + 0xC0016900, + 0x00000024, + 0x00000000, + 0xC0016900, + 0x0000003C, + 0x00000000, + 0xC0001000, + 0x00000000, + 0xC0016900, + 0x00000034, + 0x00000000, + 0xC0001000, + 0x00000000, + 0xC0016900, + 0x00000044, + 0x00000000, + 0xC0007300, + 0x00000002, +}; + +/* R600_CB5 */ +#define R600_CB5_header_cpm4 2 +u32 R600_CB5_header_pm4[R600_CB5_header_cpm4] = { + 0xC0016900, + 0x00000015, +}; +#define R600_CB5_state_cpm4 27 +u32 R600_CB5_state_pm4[R600_CB5_state_cpm4] = { + 0x00000000, + 0xC0001000, + 0x00000004, + 0xC0016900, + 0x0000002D, + 0x00000000, + 0xC0016900, + 0x0000001D, + 0x00000000, + 0xC0016900, + 0x00000025, + 0x00000000, + 0xC0016900, + 0x0000003D, + 0x00000000, + 0xC0001000, + 0x00000000, + 0xC0016900, + 0x00000035, + 0x00000000, + 0xC0001000, + 0x00000000, + 0xC0016900, + 0x00000045, + 0x00000000, + 0xC0007300, + 0x00000002, +}; + +/* R600_CB6 */ +#define R600_CB6_header_cpm4 2 +u32 R600_CB6_header_pm4[R600_CB6_header_cpm4] = { + 0xC0016900, + 0x00000016, +}; +#define R600_CB6_state_cpm4 27 +u32 R600_CB6_state_pm4[R600_CB6_state_cpm4] = { + 0x00000000, + 0xC0001000, + 0x00000004, + 0xC0016900, + 0x0000002E, + 0x00000000, + 0xC0016900, + 0x0000001E, + 0x00000000, + 0xC0016900, + 0x00000026, + 0x00000000, + 0xC0016900, + 0x0000003E, + 0x00000000, + 0xC0001000, + 0x00000000, + 0xC0016900, + 0x00000036, + 0x00000000, + 0xC0001000, + 0x00000000, + 0xC0016900, + 0x00000046, + 0x00000000, + 0xC0007300, + 0x00000002, +}; + +/* R600_CB7 */ +#define R600_CB7_header_cpm4 2 +u32 R600_CB7_header_pm4[R600_CB7_header_cpm4] = { + 0xC0016900, + 0x00000017, +}; +#define R600_CB7_state_cpm4 27 +u32 R600_CB7_state_pm4[R600_CB7_state_cpm4] = { + 0x00000000, + 0xC0001000, + 0x00000004, + 0xC0016900, + 0x0000002F, + 0x00000000, + 0xC0016900, + 0x0000001F, + 0x00000000, + 0xC0016900, + 0x00000027, + 0x00000000, + 0xC0016900, + 0x0000003F, + 0x00000000, + 0xC0001000, + 0x00000000, + 0xC0016900, + 0x00000037, + 0x00000000, + 0xC0001000, + 0x00000000, + 0xC0016900, + 0x00000047, + 0x00000000, + 0xC0007300, + 0x00000002, +}; + +/* R600_CONSTANT */ +#define R600_CONSTANT_header_cpm4 2 +u32 R600_PS_CONSTANT0_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000000, +}; +u32 R600_PS_CONSTANT1_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000004, +}; +u32 R600_PS_CONSTANT2_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000008, +}; +u32 R600_PS_CONSTANT3_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x0000000C, +}; +u32 R600_PS_CONSTANT4_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000010, +}; +u32 R600_PS_CONSTANT5_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000014, +}; +u32 R600_PS_CONSTANT6_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000018, +}; +u32 R600_PS_CONSTANT7_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x0000001C, +}; +u32 R600_PS_CONSTANT8_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000020, +}; +u32 R600_PS_CONSTANT9_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000024, +}; +u32 R600_PS_CONSTANT10_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000028, +}; +u32 R600_PS_CONSTANT11_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x0000002C, +}; +u32 R600_PS_CONSTANT12_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000030, +}; +u32 R600_PS_CONSTANT13_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000034, +}; +u32 R600_PS_CONSTANT14_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000038, +}; +u32 R600_PS_CONSTANT15_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x0000003C, +}; +u32 R600_PS_CONSTANT16_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000040, +}; +u32 R600_PS_CONSTANT17_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000044, +}; +u32 R600_PS_CONSTANT18_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000048, +}; +u32 R600_PS_CONSTANT19_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x0000004C, +}; +u32 R600_PS_CONSTANT20_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000050, +}; +u32 R600_PS_CONSTANT21_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000054, +}; +u32 R600_PS_CONSTANT22_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000058, +}; +u32 R600_PS_CONSTANT23_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x0000005C, +}; +u32 R600_PS_CONSTANT24_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000060, +}; +u32 R600_PS_CONSTANT25_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000064, +}; +u32 R600_PS_CONSTANT26_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000068, +}; +u32 R600_PS_CONSTANT27_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x0000006C, +}; +u32 R600_PS_CONSTANT28_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000070, +}; +u32 R600_PS_CONSTANT29_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000074, +}; +u32 R600_PS_CONSTANT30_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000078, +}; +u32 R600_PS_CONSTANT31_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x0000007C, +}; +u32 R600_PS_CONSTANT32_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000080, +}; +u32 R600_PS_CONSTANT33_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000084, +}; +u32 R600_PS_CONSTANT34_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000088, +}; +u32 R600_PS_CONSTANT35_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x0000008C, +}; +u32 R600_PS_CONSTANT36_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000090, +}; +u32 R600_PS_CONSTANT37_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000094, +}; +u32 R600_PS_CONSTANT38_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000098, +}; +u32 R600_PS_CONSTANT39_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x0000009C, +}; +u32 R600_PS_CONSTANT40_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000000A0, +}; +u32 R600_PS_CONSTANT41_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000000A4, +}; +u32 R600_PS_CONSTANT42_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000000A8, +}; +u32 R600_PS_CONSTANT43_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000000AC, +}; +u32 R600_PS_CONSTANT44_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000000B0, +}; +u32 R600_PS_CONSTANT45_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000000B4, +}; +u32 R600_PS_CONSTANT46_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000000B8, +}; +u32 R600_PS_CONSTANT47_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000000BC, +}; +u32 R600_PS_CONSTANT48_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000000C0, +}; +u32 R600_PS_CONSTANT49_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000000C4, +}; +u32 R600_PS_CONSTANT50_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000000C8, +}; +u32 R600_PS_CONSTANT51_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000000CC, +}; +u32 R600_PS_CONSTANT52_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000000D0, +}; +u32 R600_PS_CONSTANT53_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000000D4, +}; +u32 R600_PS_CONSTANT54_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000000D8, +}; +u32 R600_PS_CONSTANT55_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000000DC, +}; +u32 R600_PS_CONSTANT56_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000000E0, +}; +u32 R600_PS_CONSTANT57_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000000E4, +}; +u32 R600_PS_CONSTANT58_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000000E8, +}; +u32 R600_PS_CONSTANT59_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000000EC, +}; +u32 R600_PS_CONSTANT60_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000000F0, +}; +u32 R600_PS_CONSTANT61_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000000F4, +}; +u32 R600_PS_CONSTANT62_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000000F8, +}; +u32 R600_PS_CONSTANT63_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000000FC, +}; +u32 R600_PS_CONSTANT64_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000100, +}; +u32 R600_PS_CONSTANT65_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000104, +}; +u32 R600_PS_CONSTANT66_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000108, +}; +u32 R600_PS_CONSTANT67_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x0000010C, +}; +u32 R600_PS_CONSTANT68_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000110, +}; +u32 R600_PS_CONSTANT69_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000114, +}; +u32 R600_PS_CONSTANT70_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000118, +}; +u32 R600_PS_CONSTANT71_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x0000011C, +}; +u32 R600_PS_CONSTANT72_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000120, +}; +u32 R600_PS_CONSTANT73_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000124, +}; +u32 R600_PS_CONSTANT74_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000128, +}; +u32 R600_PS_CONSTANT75_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x0000012C, +}; +u32 R600_PS_CONSTANT76_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000130, +}; +u32 R600_PS_CONSTANT77_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000134, +}; +u32 R600_PS_CONSTANT78_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000138, +}; +u32 R600_PS_CONSTANT79_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x0000013C, +}; +u32 R600_PS_CONSTANT80_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000140, +}; +u32 R600_PS_CONSTANT81_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000144, +}; +u32 R600_PS_CONSTANT82_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000148, +}; +u32 R600_PS_CONSTANT83_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x0000014C, +}; +u32 R600_PS_CONSTANT84_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000150, +}; +u32 R600_PS_CONSTANT85_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000154, +}; +u32 R600_PS_CONSTANT86_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000158, +}; +u32 R600_PS_CONSTANT87_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x0000015C, +}; +u32 R600_PS_CONSTANT88_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000160, +}; +u32 R600_PS_CONSTANT89_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000164, +}; +u32 R600_PS_CONSTANT90_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000168, +}; +u32 R600_PS_CONSTANT91_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x0000016C, +}; +u32 R600_PS_CONSTANT92_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000170, +}; +u32 R600_PS_CONSTANT93_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000174, +}; +u32 R600_PS_CONSTANT94_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000178, +}; +u32 R600_PS_CONSTANT95_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x0000017C, +}; +u32 R600_PS_CONSTANT96_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000180, +}; +u32 R600_PS_CONSTANT97_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000184, +}; +u32 R600_PS_CONSTANT98_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000188, +}; +u32 R600_PS_CONSTANT99_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x0000018C, +}; +u32 R600_PS_CONSTANT100_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000190, +}; +u32 R600_PS_CONSTANT101_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000194, +}; +u32 R600_PS_CONSTANT102_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000198, +}; +u32 R600_PS_CONSTANT103_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x0000019C, +}; +u32 R600_PS_CONSTANT104_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000001A0, +}; +u32 R600_PS_CONSTANT105_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000001A4, +}; +u32 R600_PS_CONSTANT106_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000001A8, +}; +u32 R600_PS_CONSTANT107_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000001AC, +}; +u32 R600_PS_CONSTANT108_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000001B0, +}; +u32 R600_PS_CONSTANT109_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000001B4, +}; +u32 R600_PS_CONSTANT110_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000001B8, +}; +u32 R600_PS_CONSTANT111_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000001BC, +}; +u32 R600_PS_CONSTANT112_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000001C0, +}; +u32 R600_PS_CONSTANT113_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000001C4, +}; +u32 R600_PS_CONSTANT114_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000001C8, +}; +u32 R600_PS_CONSTANT115_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000001CC, +}; +u32 R600_PS_CONSTANT116_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000001D0, +}; +u32 R600_PS_CONSTANT117_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000001D4, +}; +u32 R600_PS_CONSTANT118_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000001D8, +}; +u32 R600_PS_CONSTANT119_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000001DC, +}; +u32 R600_PS_CONSTANT120_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000001E0, +}; +u32 R600_PS_CONSTANT121_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000001E4, +}; +u32 R600_PS_CONSTANT122_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000001E8, +}; +u32 R600_PS_CONSTANT123_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000001EC, +}; +u32 R600_PS_CONSTANT124_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000001F0, +}; +u32 R600_PS_CONSTANT125_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000001F4, +}; +u32 R600_PS_CONSTANT126_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000001F8, +}; +u32 R600_PS_CONSTANT127_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000001FC, +}; +u32 R600_PS_CONSTANT128_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000200, +}; +u32 R600_PS_CONSTANT129_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000204, +}; +u32 R600_PS_CONSTANT130_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000208, +}; +u32 R600_PS_CONSTANT131_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x0000020C, +}; +u32 R600_PS_CONSTANT132_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000210, +}; +u32 R600_PS_CONSTANT133_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000214, +}; +u32 R600_PS_CONSTANT134_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000218, +}; +u32 R600_PS_CONSTANT135_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x0000021C, +}; +u32 R600_PS_CONSTANT136_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000220, +}; +u32 R600_PS_CONSTANT137_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000224, +}; +u32 R600_PS_CONSTANT138_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000228, +}; +u32 R600_PS_CONSTANT139_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x0000022C, +}; +u32 R600_PS_CONSTANT140_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000230, +}; +u32 R600_PS_CONSTANT141_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000234, +}; +u32 R600_PS_CONSTANT142_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000238, +}; +u32 R600_PS_CONSTANT143_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x0000023C, +}; +u32 R600_PS_CONSTANT144_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000240, +}; +u32 R600_PS_CONSTANT145_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000244, +}; +u32 R600_PS_CONSTANT146_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000248, +}; +u32 R600_PS_CONSTANT147_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x0000024C, +}; +u32 R600_PS_CONSTANT148_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000250, +}; +u32 R600_PS_CONSTANT149_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000254, +}; +u32 R600_PS_CONSTANT150_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000258, +}; +u32 R600_PS_CONSTANT151_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x0000025C, +}; +u32 R600_PS_CONSTANT152_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000260, +}; +u32 R600_PS_CONSTANT153_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000264, +}; +u32 R600_PS_CONSTANT154_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000268, +}; +u32 R600_PS_CONSTANT155_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x0000026C, +}; +u32 R600_PS_CONSTANT156_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000270, +}; +u32 R600_PS_CONSTANT157_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000274, +}; +u32 R600_PS_CONSTANT158_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000278, +}; +u32 R600_PS_CONSTANT159_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x0000027C, +}; +u32 R600_PS_CONSTANT160_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000280, +}; +u32 R600_PS_CONSTANT161_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000284, +}; +u32 R600_PS_CONSTANT162_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000288, +}; +u32 R600_PS_CONSTANT163_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x0000028C, +}; +u32 R600_PS_CONSTANT164_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000290, +}; +u32 R600_PS_CONSTANT165_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000294, +}; +u32 R600_PS_CONSTANT166_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000298, +}; +u32 R600_PS_CONSTANT167_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x0000029C, +}; +u32 R600_PS_CONSTANT168_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000002A0, +}; +u32 R600_PS_CONSTANT169_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000002A4, +}; +u32 R600_PS_CONSTANT170_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000002A8, +}; +u32 R600_PS_CONSTANT171_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000002AC, +}; +u32 R600_PS_CONSTANT172_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000002B0, +}; +u32 R600_PS_CONSTANT173_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000002B4, +}; +u32 R600_PS_CONSTANT174_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000002B8, +}; +u32 R600_PS_CONSTANT175_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000002BC, +}; +u32 R600_PS_CONSTANT176_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000002C0, +}; +u32 R600_PS_CONSTANT177_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000002C4, +}; +u32 R600_PS_CONSTANT178_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000002C8, +}; +u32 R600_PS_CONSTANT179_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000002CC, +}; +u32 R600_PS_CONSTANT180_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000002D0, +}; +u32 R600_PS_CONSTANT181_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000002D4, +}; +u32 R600_PS_CONSTANT182_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000002D8, +}; +u32 R600_PS_CONSTANT183_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000002DC, +}; +u32 R600_PS_CONSTANT184_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000002E0, +}; +u32 R600_PS_CONSTANT185_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000002E4, +}; +u32 R600_PS_CONSTANT186_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000002E8, +}; +u32 R600_PS_CONSTANT187_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000002EC, +}; +u32 R600_PS_CONSTANT188_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000002F0, +}; +u32 R600_PS_CONSTANT189_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000002F4, +}; +u32 R600_PS_CONSTANT190_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000002F8, +}; +u32 R600_PS_CONSTANT191_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000002FC, +}; +u32 R600_PS_CONSTANT192_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000300, +}; +u32 R600_PS_CONSTANT193_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000304, +}; +u32 R600_PS_CONSTANT194_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000308, +}; +u32 R600_PS_CONSTANT195_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x0000030C, +}; +u32 R600_PS_CONSTANT196_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000310, +}; +u32 R600_PS_CONSTANT197_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000314, +}; +u32 R600_PS_CONSTANT198_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000318, +}; +u32 R600_PS_CONSTANT199_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x0000031C, +}; +u32 R600_PS_CONSTANT200_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000320, +}; +u32 R600_PS_CONSTANT201_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000324, +}; +u32 R600_PS_CONSTANT202_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000328, +}; +u32 R600_PS_CONSTANT203_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x0000032C, +}; +u32 R600_PS_CONSTANT204_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000330, +}; +u32 R600_PS_CONSTANT205_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000334, +}; +u32 R600_PS_CONSTANT206_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000338, +}; +u32 R600_PS_CONSTANT207_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x0000033C, +}; +u32 R600_PS_CONSTANT208_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000340, +}; +u32 R600_PS_CONSTANT209_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000344, +}; +u32 R600_PS_CONSTANT210_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000348, +}; +u32 R600_PS_CONSTANT211_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x0000034C, +}; +u32 R600_PS_CONSTANT212_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000350, +}; +u32 R600_PS_CONSTANT213_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000354, +}; +u32 R600_PS_CONSTANT214_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000358, +}; +u32 R600_PS_CONSTANT215_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x0000035C, +}; +u32 R600_PS_CONSTANT216_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000360, +}; +u32 R600_PS_CONSTANT217_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000364, +}; +u32 R600_PS_CONSTANT218_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000368, +}; +u32 R600_PS_CONSTANT219_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x0000036C, +}; +u32 R600_PS_CONSTANT220_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000370, +}; +u32 R600_PS_CONSTANT221_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000374, +}; +u32 R600_PS_CONSTANT222_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000378, +}; +u32 R600_PS_CONSTANT223_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x0000037C, +}; +u32 R600_PS_CONSTANT224_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000380, +}; +u32 R600_PS_CONSTANT225_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000384, +}; +u32 R600_PS_CONSTANT226_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000388, +}; +u32 R600_PS_CONSTANT227_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x0000038C, +}; +u32 R600_PS_CONSTANT228_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000390, +}; +u32 R600_PS_CONSTANT229_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000394, +}; +u32 R600_PS_CONSTANT230_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000398, +}; +u32 R600_PS_CONSTANT231_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x0000039C, +}; +u32 R600_PS_CONSTANT232_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000003A0, +}; +u32 R600_PS_CONSTANT233_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000003A4, +}; +u32 R600_PS_CONSTANT234_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000003A8, +}; +u32 R600_PS_CONSTANT235_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000003AC, +}; +u32 R600_PS_CONSTANT236_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000003B0, +}; +u32 R600_PS_CONSTANT237_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000003B4, +}; +u32 R600_PS_CONSTANT238_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000003B8, +}; +u32 R600_PS_CONSTANT239_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000003BC, +}; +u32 R600_PS_CONSTANT240_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000003C0, +}; +u32 R600_PS_CONSTANT241_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000003C4, +}; +u32 R600_PS_CONSTANT242_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000003C8, +}; +u32 R600_PS_CONSTANT243_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000003CC, +}; +u32 R600_PS_CONSTANT244_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000003D0, +}; +u32 R600_PS_CONSTANT245_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000003D4, +}; +u32 R600_PS_CONSTANT246_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000003D8, +}; +u32 R600_PS_CONSTANT247_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000003DC, +}; +u32 R600_PS_CONSTANT248_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000003E0, +}; +u32 R600_PS_CONSTANT249_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000003E4, +}; +u32 R600_PS_CONSTANT250_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000003E8, +}; +u32 R600_PS_CONSTANT251_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000003EC, +}; +u32 R600_PS_CONSTANT252_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000003F0, +}; +u32 R600_PS_CONSTANT253_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000003F4, +}; +u32 R600_PS_CONSTANT254_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000003F8, +}; +u32 R600_PS_CONSTANT255_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000003FC, +}; +u32 R600_VS_CONSTANT0_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000400, +}; +u32 R600_VS_CONSTANT1_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000404, +}; +u32 R600_VS_CONSTANT2_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000408, +}; +u32 R600_VS_CONSTANT3_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x0000040C, +}; +u32 R600_VS_CONSTANT4_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000410, +}; +u32 R600_VS_CONSTANT5_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000414, +}; +u32 R600_VS_CONSTANT6_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000418, +}; +u32 R600_VS_CONSTANT7_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x0000041C, +}; +u32 R600_VS_CONSTANT8_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000420, +}; +u32 R600_VS_CONSTANT9_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000424, +}; +u32 R600_VS_CONSTANT10_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000428, +}; +u32 R600_VS_CONSTANT11_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x0000042C, +}; +u32 R600_VS_CONSTANT12_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000430, +}; +u32 R600_VS_CONSTANT13_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000434, +}; +u32 R600_VS_CONSTANT14_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000438, +}; +u32 R600_VS_CONSTANT15_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x0000043C, +}; +u32 R600_VS_CONSTANT16_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000440, +}; +u32 R600_VS_CONSTANT17_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000444, +}; +u32 R600_VS_CONSTANT18_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000448, +}; +u32 R600_VS_CONSTANT19_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x0000044C, +}; +u32 R600_VS_CONSTANT20_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000450, +}; +u32 R600_VS_CONSTANT21_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000454, +}; +u32 R600_VS_CONSTANT22_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000458, +}; +u32 R600_VS_CONSTANT23_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x0000045C, +}; +u32 R600_VS_CONSTANT24_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000460, +}; +u32 R600_VS_CONSTANT25_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000464, +}; +u32 R600_VS_CONSTANT26_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000468, +}; +u32 R600_VS_CONSTANT27_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x0000046C, +}; +u32 R600_VS_CONSTANT28_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000470, +}; +u32 R600_VS_CONSTANT29_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000474, +}; +u32 R600_VS_CONSTANT30_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000478, +}; +u32 R600_VS_CONSTANT31_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x0000047C, +}; +u32 R600_VS_CONSTANT32_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000480, +}; +u32 R600_VS_CONSTANT33_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000484, +}; +u32 R600_VS_CONSTANT34_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000488, +}; +u32 R600_VS_CONSTANT35_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x0000048C, +}; +u32 R600_VS_CONSTANT36_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000490, +}; +u32 R600_VS_CONSTANT37_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000494, +}; +u32 R600_VS_CONSTANT38_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000498, +}; +u32 R600_VS_CONSTANT39_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x0000049C, +}; +u32 R600_VS_CONSTANT40_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000004A0, +}; +u32 R600_VS_CONSTANT41_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000004A4, +}; +u32 R600_VS_CONSTANT42_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000004A8, +}; +u32 R600_VS_CONSTANT43_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000004AC, +}; +u32 R600_VS_CONSTANT44_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000004B0, +}; +u32 R600_VS_CONSTANT45_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000004B4, +}; +u32 R600_VS_CONSTANT46_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000004B8, +}; +u32 R600_VS_CONSTANT47_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000004BC, +}; +u32 R600_VS_CONSTANT48_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000004C0, +}; +u32 R600_VS_CONSTANT49_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000004C4, +}; +u32 R600_VS_CONSTANT50_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000004C8, +}; +u32 R600_VS_CONSTANT51_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000004CC, +}; +u32 R600_VS_CONSTANT52_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000004D0, +}; +u32 R600_VS_CONSTANT53_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000004D4, +}; +u32 R600_VS_CONSTANT54_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000004D8, +}; +u32 R600_VS_CONSTANT55_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000004DC, +}; +u32 R600_VS_CONSTANT56_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000004E0, +}; +u32 R600_VS_CONSTANT57_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000004E4, +}; +u32 R600_VS_CONSTANT58_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000004E8, +}; +u32 R600_VS_CONSTANT59_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000004EC, +}; +u32 R600_VS_CONSTANT60_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000004F0, +}; +u32 R600_VS_CONSTANT61_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000004F4, +}; +u32 R600_VS_CONSTANT62_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000004F8, +}; +u32 R600_VS_CONSTANT63_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000004FC, +}; +u32 R600_VS_CONSTANT64_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000500, +}; +u32 R600_VS_CONSTANT65_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000504, +}; +u32 R600_VS_CONSTANT66_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000508, +}; +u32 R600_VS_CONSTANT67_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x0000050C, +}; +u32 R600_VS_CONSTANT68_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000510, +}; +u32 R600_VS_CONSTANT69_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000514, +}; +u32 R600_VS_CONSTANT70_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000518, +}; +u32 R600_VS_CONSTANT71_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x0000051C, +}; +u32 R600_VS_CONSTANT72_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000520, +}; +u32 R600_VS_CONSTANT73_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000524, +}; +u32 R600_VS_CONSTANT74_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000528, +}; +u32 R600_VS_CONSTANT75_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x0000052C, +}; +u32 R600_VS_CONSTANT76_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000530, +}; +u32 R600_VS_CONSTANT77_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000534, +}; +u32 R600_VS_CONSTANT78_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000538, +}; +u32 R600_VS_CONSTANT79_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x0000053C, +}; +u32 R600_VS_CONSTANT80_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000540, +}; +u32 R600_VS_CONSTANT81_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000544, +}; +u32 R600_VS_CONSTANT82_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000548, +}; +u32 R600_VS_CONSTANT83_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x0000054C, +}; +u32 R600_VS_CONSTANT84_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000550, +}; +u32 R600_VS_CONSTANT85_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000554, +}; +u32 R600_VS_CONSTANT86_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000558, +}; +u32 R600_VS_CONSTANT87_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x0000055C, +}; +u32 R600_VS_CONSTANT88_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000560, +}; +u32 R600_VS_CONSTANT89_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000564, +}; +u32 R600_VS_CONSTANT90_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000568, +}; +u32 R600_VS_CONSTANT91_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x0000056C, +}; +u32 R600_VS_CONSTANT92_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000570, +}; +u32 R600_VS_CONSTANT93_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000574, +}; +u32 R600_VS_CONSTANT94_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000578, +}; +u32 R600_VS_CONSTANT95_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x0000057C, +}; +u32 R600_VS_CONSTANT96_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000580, +}; +u32 R600_VS_CONSTANT97_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000584, +}; +u32 R600_VS_CONSTANT98_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000588, +}; +u32 R600_VS_CONSTANT99_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x0000058C, +}; +u32 R600_VS_CONSTANT100_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000590, +}; +u32 R600_VS_CONSTANT101_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000594, +}; +u32 R600_VS_CONSTANT102_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000598, +}; +u32 R600_VS_CONSTANT103_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x0000059C, +}; +u32 R600_VS_CONSTANT104_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000005A0, +}; +u32 R600_VS_CONSTANT105_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000005A4, +}; +u32 R600_VS_CONSTANT106_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000005A8, +}; +u32 R600_VS_CONSTANT107_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000005AC, +}; +u32 R600_VS_CONSTANT108_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000005B0, +}; +u32 R600_VS_CONSTANT109_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000005B4, +}; +u32 R600_VS_CONSTANT110_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000005B8, +}; +u32 R600_VS_CONSTANT111_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000005BC, +}; +u32 R600_VS_CONSTANT112_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000005C0, +}; +u32 R600_VS_CONSTANT113_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000005C4, +}; +u32 R600_VS_CONSTANT114_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000005C8, +}; +u32 R600_VS_CONSTANT115_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000005CC, +}; +u32 R600_VS_CONSTANT116_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000005D0, +}; +u32 R600_VS_CONSTANT117_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000005D4, +}; +u32 R600_VS_CONSTANT118_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000005D8, +}; +u32 R600_VS_CONSTANT119_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000005DC, +}; +u32 R600_VS_CONSTANT120_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000005E0, +}; +u32 R600_VS_CONSTANT121_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000005E4, +}; +u32 R600_VS_CONSTANT122_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000005E8, +}; +u32 R600_VS_CONSTANT123_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000005EC, +}; +u32 R600_VS_CONSTANT124_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000005F0, +}; +u32 R600_VS_CONSTANT125_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000005F4, +}; +u32 R600_VS_CONSTANT126_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000005F8, +}; +u32 R600_VS_CONSTANT127_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000005FC, +}; +u32 R600_VS_CONSTANT128_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000600, +}; +u32 R600_VS_CONSTANT129_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000604, +}; +u32 R600_VS_CONSTANT130_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000608, +}; +u32 R600_VS_CONSTANT131_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x0000060C, +}; +u32 R600_VS_CONSTANT132_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000610, +}; +u32 R600_VS_CONSTANT133_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000614, +}; +u32 R600_VS_CONSTANT134_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000618, +}; +u32 R600_VS_CONSTANT135_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x0000061C, +}; +u32 R600_VS_CONSTANT136_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000620, +}; +u32 R600_VS_CONSTANT137_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000624, +}; +u32 R600_VS_CONSTANT138_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000628, +}; +u32 R600_VS_CONSTANT139_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x0000062C, +}; +u32 R600_VS_CONSTANT140_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000630, +}; +u32 R600_VS_CONSTANT141_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000634, +}; +u32 R600_VS_CONSTANT142_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000638, +}; +u32 R600_VS_CONSTANT143_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x0000063C, +}; +u32 R600_VS_CONSTANT144_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000640, +}; +u32 R600_VS_CONSTANT145_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000644, +}; +u32 R600_VS_CONSTANT146_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000648, +}; +u32 R600_VS_CONSTANT147_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x0000064C, +}; +u32 R600_VS_CONSTANT148_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000650, +}; +u32 R600_VS_CONSTANT149_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000654, +}; +u32 R600_VS_CONSTANT150_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000658, +}; +u32 R600_VS_CONSTANT151_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x0000065C, +}; +u32 R600_VS_CONSTANT152_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000660, +}; +u32 R600_VS_CONSTANT153_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000664, +}; +u32 R600_VS_CONSTANT154_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000668, +}; +u32 R600_VS_CONSTANT155_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x0000066C, +}; +u32 R600_VS_CONSTANT156_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000670, +}; +u32 R600_VS_CONSTANT157_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000674, +}; +u32 R600_VS_CONSTANT158_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000678, +}; +u32 R600_VS_CONSTANT159_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x0000067C, +}; +u32 R600_VS_CONSTANT160_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000680, +}; +u32 R600_VS_CONSTANT161_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000684, +}; +u32 R600_VS_CONSTANT162_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000688, +}; +u32 R600_VS_CONSTANT163_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x0000068C, +}; +u32 R600_VS_CONSTANT164_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000690, +}; +u32 R600_VS_CONSTANT165_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000694, +}; +u32 R600_VS_CONSTANT166_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000698, +}; +u32 R600_VS_CONSTANT167_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x0000069C, +}; +u32 R600_VS_CONSTANT168_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000006A0, +}; +u32 R600_VS_CONSTANT169_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000006A4, +}; +u32 R600_VS_CONSTANT170_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000006A8, +}; +u32 R600_VS_CONSTANT171_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000006AC, +}; +u32 R600_VS_CONSTANT172_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000006B0, +}; +u32 R600_VS_CONSTANT173_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000006B4, +}; +u32 R600_VS_CONSTANT174_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000006B8, +}; +u32 R600_VS_CONSTANT175_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000006BC, +}; +u32 R600_VS_CONSTANT176_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000006C0, +}; +u32 R600_VS_CONSTANT177_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000006C4, +}; +u32 R600_VS_CONSTANT178_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000006C8, +}; +u32 R600_VS_CONSTANT179_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000006CC, +}; +u32 R600_VS_CONSTANT180_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000006D0, +}; +u32 R600_VS_CONSTANT181_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000006D4, +}; +u32 R600_VS_CONSTANT182_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000006D8, +}; +u32 R600_VS_CONSTANT183_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000006DC, +}; +u32 R600_VS_CONSTANT184_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000006E0, +}; +u32 R600_VS_CONSTANT185_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000006E4, +}; +u32 R600_VS_CONSTANT186_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000006E8, +}; +u32 R600_VS_CONSTANT187_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000006EC, +}; +u32 R600_VS_CONSTANT188_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000006F0, +}; +u32 R600_VS_CONSTANT189_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000006F4, +}; +u32 R600_VS_CONSTANT190_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000006F8, +}; +u32 R600_VS_CONSTANT191_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000006FC, +}; +u32 R600_VS_CONSTANT192_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000700, +}; +u32 R600_VS_CONSTANT193_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000704, +}; +u32 R600_VS_CONSTANT194_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000708, +}; +u32 R600_VS_CONSTANT195_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x0000070C, +}; +u32 R600_VS_CONSTANT196_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000710, +}; +u32 R600_VS_CONSTANT197_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000714, +}; +u32 R600_VS_CONSTANT198_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000718, +}; +u32 R600_VS_CONSTANT199_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x0000071C, +}; +u32 R600_VS_CONSTANT200_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000720, +}; +u32 R600_VS_CONSTANT201_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000724, +}; +u32 R600_VS_CONSTANT202_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000728, +}; +u32 R600_VS_CONSTANT203_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x0000072C, +}; +u32 R600_VS_CONSTANT204_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000730, +}; +u32 R600_VS_CONSTANT205_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000734, +}; +u32 R600_VS_CONSTANT206_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000738, +}; +u32 R600_VS_CONSTANT207_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x0000073C, +}; +u32 R600_VS_CONSTANT208_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000740, +}; +u32 R600_VS_CONSTANT209_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000744, +}; +u32 R600_VS_CONSTANT210_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000748, +}; +u32 R600_VS_CONSTANT211_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x0000074C, +}; +u32 R600_VS_CONSTANT212_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000750, +}; +u32 R600_VS_CONSTANT213_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000754, +}; +u32 R600_VS_CONSTANT214_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000758, +}; +u32 R600_VS_CONSTANT215_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x0000075C, +}; +u32 R600_VS_CONSTANT216_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000760, +}; +u32 R600_VS_CONSTANT217_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000764, +}; +u32 R600_VS_CONSTANT218_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000768, +}; +u32 R600_VS_CONSTANT219_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x0000076C, +}; +u32 R600_VS_CONSTANT220_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000770, +}; +u32 R600_VS_CONSTANT221_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000774, +}; +u32 R600_VS_CONSTANT222_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000778, +}; +u32 R600_VS_CONSTANT223_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x0000077C, +}; +u32 R600_VS_CONSTANT224_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000780, +}; +u32 R600_VS_CONSTANT225_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000784, +}; +u32 R600_VS_CONSTANT226_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000788, +}; +u32 R600_VS_CONSTANT227_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x0000078C, +}; +u32 R600_VS_CONSTANT228_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000790, +}; +u32 R600_VS_CONSTANT229_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000794, +}; +u32 R600_VS_CONSTANT230_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x00000798, +}; +u32 R600_VS_CONSTANT231_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x0000079C, +}; +u32 R600_VS_CONSTANT232_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000007A0, +}; +u32 R600_VS_CONSTANT233_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000007A4, +}; +u32 R600_VS_CONSTANT234_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000007A8, +}; +u32 R600_VS_CONSTANT235_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000007AC, +}; +u32 R600_VS_CONSTANT236_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000007B0, +}; +u32 R600_VS_CONSTANT237_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000007B4, +}; +u32 R600_VS_CONSTANT238_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000007B8, +}; +u32 R600_VS_CONSTANT239_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000007BC, +}; +u32 R600_VS_CONSTANT240_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000007C0, +}; +u32 R600_VS_CONSTANT241_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000007C4, +}; +u32 R600_VS_CONSTANT242_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000007C8, +}; +u32 R600_VS_CONSTANT243_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000007CC, +}; +u32 R600_VS_CONSTANT244_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000007D0, +}; +u32 R600_VS_CONSTANT245_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000007D4, +}; +u32 R600_VS_CONSTANT246_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000007D8, +}; +u32 R600_VS_CONSTANT247_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000007DC, +}; +u32 R600_VS_CONSTANT248_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000007E0, +}; +u32 R600_VS_CONSTANT249_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000007E4, +}; +u32 R600_VS_CONSTANT250_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000007E8, +}; +u32 R600_VS_CONSTANT251_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000007EC, +}; +u32 R600_VS_CONSTANT252_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000007F0, +}; +u32 R600_VS_CONSTANT253_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000007F4, +}; +u32 R600_VS_CONSTANT254_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000007F8, +}; +u32 R600_VS_CONSTANT255_header_pm4[R600_CONSTANT_header_cpm4] = { + 0xC0046A00, + 0x000007FC, +}; +#define R600_CONSTANT_state_cpm4 4 +u32 R600_CONSTANT_state_pm4[R600_CONSTANT_state_cpm4] = { + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, +}; + + +/* R600_RESOURCE */ +#define R600_RESOURCE_header_cpm4 2 +u32 R600_PS_RESOURCE0_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000000, +}; +u32 R600_PS_RESOURCE1_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000007, +}; +u32 R600_PS_RESOURCE2_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x0000000E, +}; +u32 R600_PS_RESOURCE3_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000015, +}; +u32 R600_PS_RESOURCE4_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x0000001C, +}; +u32 R600_PS_RESOURCE5_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000023, +}; +u32 R600_PS_RESOURCE6_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x0000002A, +}; +u32 R600_PS_RESOURCE7_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000031, +}; +u32 R600_PS_RESOURCE8_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000038, +}; +u32 R600_PS_RESOURCE9_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x0000003F, +}; +u32 R600_PS_RESOURCE10_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000046, +}; +u32 R600_PS_RESOURCE11_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x0000004D, +}; +u32 R600_PS_RESOURCE12_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000054, +}; +u32 R600_PS_RESOURCE13_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x0000005B, +}; +u32 R600_PS_RESOURCE14_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000062, +}; +u32 R600_PS_RESOURCE15_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000069, +}; +u32 R600_PS_RESOURCE16_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000070, +}; +u32 R600_PS_RESOURCE17_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000077, +}; +u32 R600_PS_RESOURCE18_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x0000007E, +}; +u32 R600_PS_RESOURCE19_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000085, +}; +u32 R600_PS_RESOURCE20_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x0000008C, +}; +u32 R600_PS_RESOURCE21_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000093, +}; +u32 R600_PS_RESOURCE22_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x0000009A, +}; +u32 R600_PS_RESOURCE23_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x000000A1, +}; +u32 R600_PS_RESOURCE24_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x000000A8, +}; +u32 R600_PS_RESOURCE25_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x000000AF, +}; +u32 R600_PS_RESOURCE26_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x000000B6, +}; +u32 R600_PS_RESOURCE27_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x000000BD, +}; +u32 R600_PS_RESOURCE28_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x000000C4, +}; +u32 R600_PS_RESOURCE29_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x000000CB, +}; +u32 R600_PS_RESOURCE30_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x000000D2, +}; +u32 R600_PS_RESOURCE31_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x000000D9, +}; +u32 R600_PS_RESOURCE32_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x000000E0, +}; +u32 R600_PS_RESOURCE33_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x000000E7, +}; +u32 R600_PS_RESOURCE34_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x000000EE, +}; +u32 R600_PS_RESOURCE35_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x000000F5, +}; +u32 R600_PS_RESOURCE36_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x000000FC, +}; +u32 R600_PS_RESOURCE37_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000103, +}; +u32 R600_PS_RESOURCE38_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x0000010A, +}; +u32 R600_PS_RESOURCE39_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000111, +}; +u32 R600_PS_RESOURCE40_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000118, +}; +u32 R600_PS_RESOURCE41_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x0000011F, +}; +u32 R600_PS_RESOURCE42_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000126, +}; +u32 R600_PS_RESOURCE43_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x0000012D, +}; +u32 R600_PS_RESOURCE44_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000134, +}; +u32 R600_PS_RESOURCE45_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x0000013B, +}; +u32 R600_PS_RESOURCE46_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000142, +}; +u32 R600_PS_RESOURCE47_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000149, +}; +u32 R600_PS_RESOURCE48_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000150, +}; +u32 R600_PS_RESOURCE49_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000157, +}; +u32 R600_PS_RESOURCE50_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x0000015E, +}; +u32 R600_PS_RESOURCE51_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000165, +}; +u32 R600_PS_RESOURCE52_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x0000016C, +}; +u32 R600_PS_RESOURCE53_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000173, +}; +u32 R600_PS_RESOURCE54_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x0000017A, +}; +u32 R600_PS_RESOURCE55_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000181, +}; +u32 R600_PS_RESOURCE56_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000188, +}; +u32 R600_PS_RESOURCE57_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x0000018F, +}; +u32 R600_PS_RESOURCE58_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000196, +}; +u32 R600_PS_RESOURCE59_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x0000019D, +}; +u32 R600_PS_RESOURCE60_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x000001A4, +}; +u32 R600_PS_RESOURCE61_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x000001AB, +}; +u32 R600_PS_RESOURCE62_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x000001B2, +}; +u32 R600_PS_RESOURCE63_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x000001B9, +}; +u32 R600_PS_RESOURCE64_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x000001C0, +}; +u32 R600_PS_RESOURCE65_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x000001C7, +}; +u32 R600_PS_RESOURCE66_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x000001CE, +}; +u32 R600_PS_RESOURCE67_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x000001D5, +}; +u32 R600_PS_RESOURCE68_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x000001DC, +}; +u32 R600_PS_RESOURCE69_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x000001E3, +}; +u32 R600_PS_RESOURCE70_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x000001EA, +}; +u32 R600_PS_RESOURCE71_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x000001F1, +}; +u32 R600_PS_RESOURCE72_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x000001F8, +}; +u32 R600_PS_RESOURCE73_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x000001FF, +}; +u32 R600_PS_RESOURCE74_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000206, +}; +u32 R600_PS_RESOURCE75_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x0000020D, +}; +u32 R600_PS_RESOURCE76_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000214, +}; +u32 R600_PS_RESOURCE77_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x0000021B, +}; +u32 R600_PS_RESOURCE78_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000222, +}; +u32 R600_PS_RESOURCE79_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000229, +}; +u32 R600_PS_RESOURCE80_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000230, +}; +u32 R600_PS_RESOURCE81_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000237, +}; +u32 R600_PS_RESOURCE82_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x0000023E, +}; +u32 R600_PS_RESOURCE83_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000245, +}; +u32 R600_PS_RESOURCE84_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x0000024C, +}; +u32 R600_PS_RESOURCE85_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000253, +}; +u32 R600_PS_RESOURCE86_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x0000025A, +}; +u32 R600_PS_RESOURCE87_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000261, +}; +u32 R600_PS_RESOURCE88_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000268, +}; +u32 R600_PS_RESOURCE89_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x0000026F, +}; +u32 R600_PS_RESOURCE90_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000276, +}; +u32 R600_PS_RESOURCE91_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x0000027D, +}; +u32 R600_PS_RESOURCE92_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000284, +}; +u32 R600_PS_RESOURCE93_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x0000028B, +}; +u32 R600_PS_RESOURCE94_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000292, +}; +u32 R600_PS_RESOURCE95_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000299, +}; +u32 R600_PS_RESOURCE96_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x000002A0, +}; +u32 R600_PS_RESOURCE97_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x000002A7, +}; +u32 R600_PS_RESOURCE98_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x000002AE, +}; +u32 R600_PS_RESOURCE99_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x000002B5, +}; +u32 R600_PS_RESOURCE100_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x000002BC, +}; +u32 R600_PS_RESOURCE101_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x000002C3, +}; +u32 R600_PS_RESOURCE102_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x000002CA, +}; +u32 R600_PS_RESOURCE103_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x000002D1, +}; +u32 R600_PS_RESOURCE104_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x000002D8, +}; +u32 R600_PS_RESOURCE105_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x000002DF, +}; +u32 R600_PS_RESOURCE106_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x000002E6, +}; +u32 R600_PS_RESOURCE107_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x000002ED, +}; +u32 R600_PS_RESOURCE108_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x000002F4, +}; +u32 R600_PS_RESOURCE109_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x000002FB, +}; +u32 R600_PS_RESOURCE110_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000302, +}; +u32 R600_PS_RESOURCE111_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000309, +}; +u32 R600_PS_RESOURCE112_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000310, +}; +u32 R600_PS_RESOURCE113_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000317, +}; +u32 R600_PS_RESOURCE114_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x0000031E, +}; +u32 R600_PS_RESOURCE115_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000325, +}; +u32 R600_PS_RESOURCE116_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x0000032C, +}; +u32 R600_PS_RESOURCE117_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000333, +}; +u32 R600_PS_RESOURCE118_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x0000033A, +}; +u32 R600_PS_RESOURCE119_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000341, +}; +u32 R600_PS_RESOURCE120_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000348, +}; +u32 R600_PS_RESOURCE121_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x0000034F, +}; +u32 R600_PS_RESOURCE122_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000356, +}; +u32 R600_PS_RESOURCE123_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x0000035D, +}; +u32 R600_PS_RESOURCE124_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000364, +}; +u32 R600_PS_RESOURCE125_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x0000036B, +}; +u32 R600_PS_RESOURCE126_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000372, +}; +u32 R600_PS_RESOURCE127_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000379, +}; +u32 R600_PS_RESOURCE128_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000380, +}; +u32 R600_PS_RESOURCE129_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000387, +}; +u32 R600_PS_RESOURCE130_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x0000038E, +}; +u32 R600_PS_RESOURCE131_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000395, +}; +u32 R600_PS_RESOURCE132_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x0000039C, +}; +u32 R600_PS_RESOURCE133_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x000003A3, +}; +u32 R600_PS_RESOURCE134_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x000003AA, +}; +u32 R600_PS_RESOURCE135_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x000003B1, +}; +u32 R600_PS_RESOURCE136_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x000003B8, +}; +u32 R600_PS_RESOURCE137_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x000003BF, +}; +u32 R600_PS_RESOURCE138_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x000003C6, +}; +u32 R600_PS_RESOURCE139_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x000003CD, +}; +u32 R600_PS_RESOURCE140_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x000003D4, +}; +u32 R600_PS_RESOURCE141_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x000003DB, +}; +u32 R600_PS_RESOURCE142_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x000003E2, +}; +u32 R600_PS_RESOURCE143_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x000003E9, +}; +u32 R600_PS_RESOURCE144_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x000003F0, +}; +u32 R600_PS_RESOURCE145_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x000003F7, +}; +u32 R600_PS_RESOURCE146_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x000003FE, +}; +u32 R600_PS_RESOURCE147_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000405, +}; +u32 R600_PS_RESOURCE148_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x0000040C, +}; +u32 R600_PS_RESOURCE149_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000413, +}; +u32 R600_PS_RESOURCE150_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x0000041A, +}; +u32 R600_PS_RESOURCE151_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000421, +}; +u32 R600_PS_RESOURCE152_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000428, +}; +u32 R600_PS_RESOURCE153_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x0000042F, +}; +u32 R600_PS_RESOURCE154_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000436, +}; +u32 R600_PS_RESOURCE155_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x0000043D, +}; +u32 R600_PS_RESOURCE156_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000444, +}; +u32 R600_PS_RESOURCE157_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x0000044B, +}; +u32 R600_PS_RESOURCE158_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000452, +}; +u32 R600_PS_RESOURCE159_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000459, +}; +u32 R600_VS_RESOURCE0_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000460, +}; +u32 R600_VS_RESOURCE1_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000467, +}; +u32 R600_VS_RESOURCE2_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x0000046E, +}; +u32 R600_VS_RESOURCE3_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000475, +}; +u32 R600_VS_RESOURCE4_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x0000047C, +}; +u32 R600_VS_RESOURCE5_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000483, +}; +u32 R600_VS_RESOURCE6_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x0000048A, +}; +u32 R600_VS_RESOURCE7_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000491, +}; +u32 R600_VS_RESOURCE8_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000498, +}; +u32 R600_VS_RESOURCE9_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x0000049F, +}; +u32 R600_VS_RESOURCE10_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x000004A6, +}; +u32 R600_VS_RESOURCE11_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x000004AD, +}; +u32 R600_VS_RESOURCE12_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x000004B4, +}; +u32 R600_VS_RESOURCE13_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x000004BB, +}; +u32 R600_VS_RESOURCE14_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x000004C2, +}; +u32 R600_VS_RESOURCE15_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x000004C9, +}; +u32 R600_VS_RESOURCE16_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x000004D0, +}; +u32 R600_VS_RESOURCE17_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x000004D7, +}; +u32 R600_VS_RESOURCE18_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x000004DE, +}; +u32 R600_VS_RESOURCE19_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x000004E5, +}; +u32 R600_VS_RESOURCE20_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x000004EC, +}; +u32 R600_VS_RESOURCE21_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x000004F3, +}; +u32 R600_VS_RESOURCE22_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x000004FA, +}; +u32 R600_VS_RESOURCE23_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000501, +}; +u32 R600_VS_RESOURCE24_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000508, +}; +u32 R600_VS_RESOURCE25_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x0000050F, +}; +u32 R600_VS_RESOURCE26_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000516, +}; +u32 R600_VS_RESOURCE27_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x0000051D, +}; +u32 R600_VS_RESOURCE28_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000524, +}; +u32 R600_VS_RESOURCE29_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x0000052B, +}; +u32 R600_VS_RESOURCE30_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000532, +}; +u32 R600_VS_RESOURCE31_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000539, +}; +u32 R600_VS_RESOURCE32_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000540, +}; +u32 R600_VS_RESOURCE33_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000547, +}; +u32 R600_VS_RESOURCE34_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x0000054E, +}; +u32 R600_VS_RESOURCE35_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000555, +}; +u32 R600_VS_RESOURCE36_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x0000055C, +}; +u32 R600_VS_RESOURCE37_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000563, +}; +u32 R600_VS_RESOURCE38_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x0000056A, +}; +u32 R600_VS_RESOURCE39_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000571, +}; +u32 R600_VS_RESOURCE40_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000578, +}; +u32 R600_VS_RESOURCE41_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x0000057F, +}; +u32 R600_VS_RESOURCE42_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000586, +}; +u32 R600_VS_RESOURCE43_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x0000058D, +}; +u32 R600_VS_RESOURCE44_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000594, +}; +u32 R600_VS_RESOURCE45_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x0000059B, +}; +u32 R600_VS_RESOURCE46_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x000005A2, +}; +u32 R600_VS_RESOURCE47_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x000005A9, +}; +u32 R600_VS_RESOURCE48_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x000005B0, +}; +u32 R600_VS_RESOURCE49_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x000005B7, +}; +u32 R600_VS_RESOURCE50_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x000005BE, +}; +u32 R600_VS_RESOURCE51_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x000005C5, +}; +u32 R600_VS_RESOURCE52_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x000005CC, +}; +u32 R600_VS_RESOURCE53_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x000005D3, +}; +u32 R600_VS_RESOURCE54_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x000005DA, +}; +u32 R600_VS_RESOURCE55_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x000005E1, +}; +u32 R600_VS_RESOURCE56_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x000005E8, +}; +u32 R600_VS_RESOURCE57_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x000005EF, +}; +u32 R600_VS_RESOURCE58_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x000005F6, +}; +u32 R600_VS_RESOURCE59_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x000005FD, +}; +u32 R600_VS_RESOURCE60_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000604, +}; +u32 R600_VS_RESOURCE61_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x0000060B, +}; +u32 R600_VS_RESOURCE62_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000612, +}; +u32 R600_VS_RESOURCE63_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000619, +}; +u32 R600_VS_RESOURCE64_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000620, +}; +u32 R600_VS_RESOURCE65_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000627, +}; +u32 R600_VS_RESOURCE66_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x0000062E, +}; +u32 R600_VS_RESOURCE67_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000635, +}; +u32 R600_VS_RESOURCE68_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x0000063C, +}; +u32 R600_VS_RESOURCE69_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000643, +}; +u32 R600_VS_RESOURCE70_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x0000064A, +}; +u32 R600_VS_RESOURCE71_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000651, +}; +u32 R600_VS_RESOURCE72_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000658, +}; +u32 R600_VS_RESOURCE73_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x0000065F, +}; +u32 R600_VS_RESOURCE74_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000666, +}; +u32 R600_VS_RESOURCE75_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x0000066D, +}; +u32 R600_VS_RESOURCE76_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000674, +}; +u32 R600_VS_RESOURCE77_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x0000067B, +}; +u32 R600_VS_RESOURCE78_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000682, +}; +u32 R600_VS_RESOURCE79_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000689, +}; +u32 R600_VS_RESOURCE80_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000690, +}; +u32 R600_VS_RESOURCE81_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000697, +}; +u32 R600_VS_RESOURCE82_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x0000069E, +}; +u32 R600_VS_RESOURCE83_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x000006A5, +}; +u32 R600_VS_RESOURCE84_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x000006AC, +}; +u32 R600_VS_RESOURCE85_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x000006B3, +}; +u32 R600_VS_RESOURCE86_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x000006BA, +}; +u32 R600_VS_RESOURCE87_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x000006C1, +}; +u32 R600_VS_RESOURCE88_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x000006C8, +}; +u32 R600_VS_RESOURCE89_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x000006CF, +}; +u32 R600_VS_RESOURCE90_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x000006D6, +}; +u32 R600_VS_RESOURCE91_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x000006DD, +}; +u32 R600_VS_RESOURCE92_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x000006E4, +}; +u32 R600_VS_RESOURCE93_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x000006EB, +}; +u32 R600_VS_RESOURCE94_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x000006F2, +}; +u32 R600_VS_RESOURCE95_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x000006F9, +}; +u32 R600_VS_RESOURCE96_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000700, +}; +u32 R600_VS_RESOURCE97_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000707, +}; +u32 R600_VS_RESOURCE98_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x0000070E, +}; +u32 R600_VS_RESOURCE99_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000715, +}; +u32 R600_VS_RESOURCE100_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x0000071C, +}; +u32 R600_VS_RESOURCE101_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000723, +}; +u32 R600_VS_RESOURCE102_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x0000072A, +}; +u32 R600_VS_RESOURCE103_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000731, +}; +u32 R600_VS_RESOURCE104_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000738, +}; +u32 R600_VS_RESOURCE105_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x0000073F, +}; +u32 R600_VS_RESOURCE106_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000746, +}; +u32 R600_VS_RESOURCE107_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x0000074D, +}; +u32 R600_VS_RESOURCE108_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000754, +}; +u32 R600_VS_RESOURCE109_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x0000075B, +}; +u32 R600_VS_RESOURCE110_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000762, +}; +u32 R600_VS_RESOURCE111_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000769, +}; +u32 R600_VS_RESOURCE112_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000770, +}; +u32 R600_VS_RESOURCE113_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000777, +}; +u32 R600_VS_RESOURCE114_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x0000077E, +}; +u32 R600_VS_RESOURCE115_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000785, +}; +u32 R600_VS_RESOURCE116_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x0000078C, +}; +u32 R600_VS_RESOURCE117_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000793, +}; +u32 R600_VS_RESOURCE118_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x0000079A, +}; +u32 R600_VS_RESOURCE119_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x000007A1, +}; +u32 R600_VS_RESOURCE120_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x000007A8, +}; +u32 R600_VS_RESOURCE121_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x000007AF, +}; +u32 R600_VS_RESOURCE122_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x000007B6, +}; +u32 R600_VS_RESOURCE123_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x000007BD, +}; +u32 R600_VS_RESOURCE124_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x000007C4, +}; +u32 R600_VS_RESOURCE125_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x000007CB, +}; +u32 R600_VS_RESOURCE126_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x000007D2, +}; +u32 R600_VS_RESOURCE127_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x000007D9, +}; +u32 R600_VS_RESOURCE128_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x000007E0, +}; +u32 R600_VS_RESOURCE129_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x000007E7, +}; +u32 R600_VS_RESOURCE130_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x000007EE, +}; +u32 R600_VS_RESOURCE131_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x000007F5, +}; +u32 R600_VS_RESOURCE132_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x000007FC, +}; +u32 R600_VS_RESOURCE133_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000803, +}; +u32 R600_VS_RESOURCE134_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x0000080A, +}; +u32 R600_VS_RESOURCE135_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000811, +}; +u32 R600_VS_RESOURCE136_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000818, +}; +u32 R600_VS_RESOURCE137_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x0000081F, +}; +u32 R600_VS_RESOURCE138_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000826, +}; +u32 R600_VS_RESOURCE139_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x0000082D, +}; +u32 R600_VS_RESOURCE140_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000834, +}; +u32 R600_VS_RESOURCE141_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x0000083B, +}; +u32 R600_VS_RESOURCE142_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000842, +}; +u32 R600_VS_RESOURCE143_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000849, +}; +u32 R600_VS_RESOURCE144_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000850, +}; +u32 R600_VS_RESOURCE145_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000857, +}; +u32 R600_VS_RESOURCE146_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x0000085E, +}; +u32 R600_VS_RESOURCE147_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000865, +}; +u32 R600_VS_RESOURCE148_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x0000086C, +}; +u32 R600_VS_RESOURCE149_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000873, +}; +u32 R600_VS_RESOURCE150_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x0000087A, +}; +u32 R600_VS_RESOURCE151_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000881, +}; +u32 R600_VS_RESOURCE152_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000888, +}; +u32 R600_VS_RESOURCE153_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x0000088F, +}; +u32 R600_VS_RESOURCE154_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000896, +}; +u32 R600_VS_RESOURCE155_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x0000089D, +}; +u32 R600_VS_RESOURCE156_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x000008A4, +}; +u32 R600_VS_RESOURCE157_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x000008AB, +}; +u32 R600_VS_RESOURCE158_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x000008B2, +}; +u32 R600_VS_RESOURCE159_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x000008B9, +}; +u32 R600_FS_RESOURCE0_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x000008C0, +}; +u32 R600_FS_RESOURCE1_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x000008C7, +}; +u32 R600_FS_RESOURCE2_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x000008CE, +}; +u32 R600_FS_RESOURCE3_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x000008D5, +}; +u32 R600_FS_RESOURCE4_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x000008DC, +}; +u32 R600_FS_RESOURCE5_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x000008E3, +}; +u32 R600_FS_RESOURCE6_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x000008EA, +}; +u32 R600_FS_RESOURCE7_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x000008F1, +}; +u32 R600_FS_RESOURCE8_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x000008F8, +}; +u32 R600_FS_RESOURCE9_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x000008FF, +}; +u32 R600_FS_RESOURCE10_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000906, +}; +u32 R600_FS_RESOURCE11_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x0000090D, +}; +u32 R600_FS_RESOURCE12_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000914, +}; +u32 R600_FS_RESOURCE13_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x0000091B, +}; +u32 R600_FS_RESOURCE14_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000922, +}; +u32 R600_FS_RESOURCE15_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000929, +}; +u32 R600_GS_RESOURCE0_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000930, +}; +u32 R600_GS_RESOURCE1_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000937, +}; +u32 R600_GS_RESOURCE2_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x0000093E, +}; +u32 R600_GS_RESOURCE3_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000945, +}; +u32 R600_GS_RESOURCE4_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x0000094C, +}; +u32 R600_GS_RESOURCE5_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000953, +}; +u32 R600_GS_RESOURCE6_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x0000095A, +}; +u32 R600_GS_RESOURCE7_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000961, +}; +u32 R600_GS_RESOURCE8_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000968, +}; +u32 R600_GS_RESOURCE9_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x0000096F, +}; +u32 R600_GS_RESOURCE10_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000976, +}; +u32 R600_GS_RESOURCE11_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x0000097D, +}; +u32 R600_GS_RESOURCE12_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000984, +}; +u32 R600_GS_RESOURCE13_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x0000098B, +}; +u32 R600_GS_RESOURCE14_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000992, +}; +u32 R600_GS_RESOURCE15_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000999, +}; +u32 R600_GS_RESOURCE16_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x000009A0, +}; +u32 R600_GS_RESOURCE17_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x000009A7, +}; +u32 R600_GS_RESOURCE18_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x000009AE, +}; +u32 R600_GS_RESOURCE19_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x000009B5, +}; +u32 R600_GS_RESOURCE20_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x000009BC, +}; +u32 R600_GS_RESOURCE21_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x000009C3, +}; +u32 R600_GS_RESOURCE22_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x000009CA, +}; +u32 R600_GS_RESOURCE23_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x000009D1, +}; +u32 R600_GS_RESOURCE24_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x000009D8, +}; +u32 R600_GS_RESOURCE25_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x000009DF, +}; +u32 R600_GS_RESOURCE26_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x000009E6, +}; +u32 R600_GS_RESOURCE27_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x000009ED, +}; +u32 R600_GS_RESOURCE28_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x000009F4, +}; +u32 R600_GS_RESOURCE29_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x000009FB, +}; +u32 R600_GS_RESOURCE30_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000A02, +}; +u32 R600_GS_RESOURCE31_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000A09, +}; +u32 R600_GS_RESOURCE32_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000A10, +}; +u32 R600_GS_RESOURCE33_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000A17, +}; +u32 R600_GS_RESOURCE34_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000A1E, +}; +u32 R600_GS_RESOURCE35_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000A25, +}; +u32 R600_GS_RESOURCE36_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000A2C, +}; +u32 R600_GS_RESOURCE37_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000A33, +}; +u32 R600_GS_RESOURCE38_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000A3A, +}; +u32 R600_GS_RESOURCE39_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000A41, +}; +u32 R600_GS_RESOURCE40_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000A48, +}; +u32 R600_GS_RESOURCE41_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000A4F, +}; +u32 R600_GS_RESOURCE42_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000A56, +}; +u32 R600_GS_RESOURCE43_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000A5D, +}; +u32 R600_GS_RESOURCE44_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000A64, +}; +u32 R600_GS_RESOURCE45_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000A6B, +}; +u32 R600_GS_RESOURCE46_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000A72, +}; +u32 R600_GS_RESOURCE47_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000A79, +}; +u32 R600_GS_RESOURCE48_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000A80, +}; +u32 R600_GS_RESOURCE49_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000A87, +}; +u32 R600_GS_RESOURCE50_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000A8E, +}; +u32 R600_GS_RESOURCE51_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000A95, +}; +u32 R600_GS_RESOURCE52_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000A9C, +}; +u32 R600_GS_RESOURCE53_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000AA3, +}; +u32 R600_GS_RESOURCE54_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000AAA, +}; +u32 R600_GS_RESOURCE55_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000AB1, +}; +u32 R600_GS_RESOURCE56_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000AB8, +}; +u32 R600_GS_RESOURCE57_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000ABF, +}; +u32 R600_GS_RESOURCE58_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000AC6, +}; +u32 R600_GS_RESOURCE59_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000ACD, +}; +u32 R600_GS_RESOURCE60_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000AD4, +}; +u32 R600_GS_RESOURCE61_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000ADB, +}; +u32 R600_GS_RESOURCE62_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000AE2, +}; +u32 R600_GS_RESOURCE63_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000AE9, +}; +u32 R600_GS_RESOURCE64_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000AF0, +}; +u32 R600_GS_RESOURCE65_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000AF7, +}; +u32 R600_GS_RESOURCE66_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000AFE, +}; +u32 R600_GS_RESOURCE67_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000B05, +}; +u32 R600_GS_RESOURCE68_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000B0C, +}; +u32 R600_GS_RESOURCE69_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000B13, +}; +u32 R600_GS_RESOURCE70_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000B1A, +}; +u32 R600_GS_RESOURCE71_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000B21, +}; +u32 R600_GS_RESOURCE72_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000B28, +}; +u32 R600_GS_RESOURCE73_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000B2F, +}; +u32 R600_GS_RESOURCE74_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000B36, +}; +u32 R600_GS_RESOURCE75_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000B3D, +}; +u32 R600_GS_RESOURCE76_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000B44, +}; +u32 R600_GS_RESOURCE77_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000B4B, +}; +u32 R600_GS_RESOURCE78_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000B52, +}; +u32 R600_GS_RESOURCE79_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000B59, +}; +u32 R600_GS_RESOURCE80_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000B60, +}; +u32 R600_GS_RESOURCE81_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000B67, +}; +u32 R600_GS_RESOURCE82_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000B6E, +}; +u32 R600_GS_RESOURCE83_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000B75, +}; +u32 R600_GS_RESOURCE84_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000B7C, +}; +u32 R600_GS_RESOURCE85_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000B83, +}; +u32 R600_GS_RESOURCE86_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000B8A, +}; +u32 R600_GS_RESOURCE87_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000B91, +}; +u32 R600_GS_RESOURCE88_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000B98, +}; +u32 R600_GS_RESOURCE89_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000B9F, +}; +u32 R600_GS_RESOURCE90_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000BA6, +}; +u32 R600_GS_RESOURCE91_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000BAD, +}; +u32 R600_GS_RESOURCE92_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000BB4, +}; +u32 R600_GS_RESOURCE93_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000BBB, +}; +u32 R600_GS_RESOURCE94_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000BC2, +}; +u32 R600_GS_RESOURCE95_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000BC9, +}; +u32 R600_GS_RESOURCE96_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000BD0, +}; +u32 R600_GS_RESOURCE97_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000BD7, +}; +u32 R600_GS_RESOURCE98_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000BDE, +}; +u32 R600_GS_RESOURCE99_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000BE5, +}; +u32 R600_GS_RESOURCE100_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000BEC, +}; +u32 R600_GS_RESOURCE101_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000BF3, +}; +u32 R600_GS_RESOURCE102_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000BFA, +}; +u32 R600_GS_RESOURCE103_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000C01, +}; +u32 R600_GS_RESOURCE104_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000C08, +}; +u32 R600_GS_RESOURCE105_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000C0F, +}; +u32 R600_GS_RESOURCE106_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000C16, +}; +u32 R600_GS_RESOURCE107_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000C1D, +}; +u32 R600_GS_RESOURCE108_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000C24, +}; +u32 R600_GS_RESOURCE109_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000C2B, +}; +u32 R600_GS_RESOURCE110_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000C32, +}; +u32 R600_GS_RESOURCE111_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000C39, +}; +u32 R600_GS_RESOURCE112_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000C40, +}; +u32 R600_GS_RESOURCE113_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000C47, +}; +u32 R600_GS_RESOURCE114_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000C4E, +}; +u32 R600_GS_RESOURCE115_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000C55, +}; +u32 R600_GS_RESOURCE116_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000C5C, +}; +u32 R600_GS_RESOURCE117_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000C63, +}; +u32 R600_GS_RESOURCE118_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000C6A, +}; +u32 R600_GS_RESOURCE119_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000C71, +}; +u32 R600_GS_RESOURCE120_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000C78, +}; +u32 R600_GS_RESOURCE121_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000C7F, +}; +u32 R600_GS_RESOURCE122_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000C86, +}; +u32 R600_GS_RESOURCE123_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000C8D, +}; +u32 R600_GS_RESOURCE124_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000C94, +}; +u32 R600_GS_RESOURCE125_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000C9B, +}; +u32 R600_GS_RESOURCE126_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000CA2, +}; +u32 R600_GS_RESOURCE127_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000CA9, +}; +u32 R600_GS_RESOURCE128_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000CB0, +}; +u32 R600_GS_RESOURCE129_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000CB7, +}; +u32 R600_GS_RESOURCE130_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000CBE, +}; +u32 R600_GS_RESOURCE131_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000CC5, +}; +u32 R600_GS_RESOURCE132_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000CCC, +}; +u32 R600_GS_RESOURCE133_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000CD3, +}; +u32 R600_GS_RESOURCE134_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000CDA, +}; +u32 R600_GS_RESOURCE135_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000CE1, +}; +u32 R600_GS_RESOURCE136_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000CE8, +}; +u32 R600_GS_RESOURCE137_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000CEF, +}; +u32 R600_GS_RESOURCE138_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000CF6, +}; +u32 R600_GS_RESOURCE139_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000CFD, +}; +u32 R600_GS_RESOURCE140_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000D04, +}; +u32 R600_GS_RESOURCE141_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000D0B, +}; +u32 R600_GS_RESOURCE142_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000D12, +}; +u32 R600_GS_RESOURCE143_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000D19, +}; +u32 R600_GS_RESOURCE144_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000D20, +}; +u32 R600_GS_RESOURCE145_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000D27, +}; +u32 R600_GS_RESOURCE146_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000D2E, +}; +u32 R600_GS_RESOURCE147_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000D35, +}; +u32 R600_GS_RESOURCE148_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000D3C, +}; +u32 R600_GS_RESOURCE149_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000D43, +}; +u32 R600_GS_RESOURCE150_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000D4A, +}; +u32 R600_GS_RESOURCE151_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000D51, +}; +u32 R600_GS_RESOURCE152_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000D58, +}; +u32 R600_GS_RESOURCE153_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000D5F, +}; +u32 R600_GS_RESOURCE154_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000D66, +}; +u32 R600_GS_RESOURCE155_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000D6D, +}; +u32 R600_GS_RESOURCE156_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000D74, +}; +u32 R600_GS_RESOURCE157_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000D7B, +}; +u32 R600_GS_RESOURCE158_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000D82, +}; +u32 R600_GS_RESOURCE159_header_pm4[R600_RESOURCE_header_cpm4] = { + 0xC0076D00, + 0x00000D89, +}; +#define R600_RESOURCE_state_cpm4 11 +u32 R600_RESOURCE_state_pm4[R600_RESOURCE_state_cpm4] = { + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + 0x80000000, + 0xC0001000, + 0x00000000, + 0xC0001000, + 0x00000000, +}; + +/* R600_SAMPLER */ +#define R600_SAMPLER_header_cpm4 2 +u32 R600_PS_SAMPLER0_header_pm4[R600_SAMPLER_header_cpm4] = { + 0xC0036E00, + 0x00000000, +}; +u32 R600_PS_SAMPLER1_header_pm4[R600_SAMPLER_header_cpm4] = { + 0xC0036E00, + 0x00000003, +}; +u32 R600_PS_SAMPLER2_header_pm4[R600_SAMPLER_header_cpm4] = { + 0xC0036E00, + 0x00000006, +}; +u32 R600_PS_SAMPLER3_header_pm4[R600_SAMPLER_header_cpm4] = { + 0xC0036E00, + 0x00000009, +}; +u32 R600_PS_SAMPLER4_header_pm4[R600_SAMPLER_header_cpm4] = { + 0xC0036E00, + 0x0000000C, +}; +u32 R600_PS_SAMPLER5_header_pm4[R600_SAMPLER_header_cpm4] = { + 0xC0036E00, + 0x0000000F, +}; +u32 R600_PS_SAMPLER6_header_pm4[R600_SAMPLER_header_cpm4] = { + 0xC0036E00, + 0x00000012, +}; +u32 R600_PS_SAMPLER7_header_pm4[R600_SAMPLER_header_cpm4] = { + 0xC0036E00, + 0x00000015, +}; +u32 R600_PS_SAMPLER8_header_pm4[R600_SAMPLER_header_cpm4] = { + 0xC0036E00, + 0x00000018, +}; +u32 R600_PS_SAMPLER9_header_pm4[R600_SAMPLER_header_cpm4] = { + 0xC0036E00, + 0x0000001B, +}; +u32 R600_PS_SAMPLER10_header_pm4[R600_SAMPLER_header_cpm4] = { + 0xC0036E00, + 0x0000001E, +}; +u32 R600_PS_SAMPLER11_header_pm4[R600_SAMPLER_header_cpm4] = { + 0xC0036E00, + 0x00000021, +}; +u32 R600_PS_SAMPLER12_header_pm4[R600_SAMPLER_header_cpm4] = { + 0xC0036E00, + 0x00000024, +}; +u32 R600_PS_SAMPLER13_header_pm4[R600_SAMPLER_header_cpm4] = { + 0xC0036E00, + 0x00000027, +}; +u32 R600_PS_SAMPLER14_header_pm4[R600_SAMPLER_header_cpm4] = { + 0xC0036E00, + 0x0000002A, +}; +u32 R600_PS_SAMPLER15_header_pm4[R600_SAMPLER_header_cpm4] = { + 0xC0036E00, + 0x0000002D, +}; +u32 R600_PS_SAMPLER16_header_pm4[R600_SAMPLER_header_cpm4] = { + 0xC0036E00, + 0x00000030, +}; +u32 R600_PS_SAMPLER17_header_pm4[R600_SAMPLER_header_cpm4] = { + 0xC0036E00, + 0x00000033, +}; +u32 R600_VS_SAMPLER0_header_pm4[R600_SAMPLER_header_cpm4] = { + 0xC0036E00, + 0x00000036, +}; +u32 R600_VS_SAMPLER1_header_pm4[R600_SAMPLER_header_cpm4] = { + 0xC0036E00, + 0x00000039, +}; +u32 R600_VS_SAMPLER2_header_pm4[R600_SAMPLER_header_cpm4] = { + 0xC0036E00, + 0x0000003C, +}; +u32 R600_VS_SAMPLER3_header_pm4[R600_SAMPLER_header_cpm4] = { + 0xC0036E00, + 0x0000003F, +}; +u32 R600_VS_SAMPLER4_header_pm4[R600_SAMPLER_header_cpm4] = { + 0xC0036E00, + 0x00000042, +}; +u32 R600_VS_SAMPLER5_header_pm4[R600_SAMPLER_header_cpm4] = { + 0xC0036E00, + 0x00000045, +}; +u32 R600_VS_SAMPLER6_header_pm4[R600_SAMPLER_header_cpm4] = { + 0xC0036E00, + 0x00000048, +}; +u32 R600_VS_SAMPLER7_header_pm4[R600_SAMPLER_header_cpm4] = { + 0xC0036E00, + 0x0000004B, +}; +u32 R600_VS_SAMPLER8_header_pm4[R600_SAMPLER_header_cpm4] = { + 0xC0036E00, + 0x0000004E, +}; +u32 R600_VS_SAMPLER9_header_pm4[R600_SAMPLER_header_cpm4] = { + 0xC0036E00, + 0x00000051, +}; +u32 R600_VS_SAMPLER10_header_pm4[R600_SAMPLER_header_cpm4] = { + 0xC0036E00, + 0x00000054, +}; +u32 R600_VS_SAMPLER11_header_pm4[R600_SAMPLER_header_cpm4] = { + 0xC0036E00, + 0x00000057, +}; +u32 R600_VS_SAMPLER12_header_pm4[R600_SAMPLER_header_cpm4] = { + 0xC0036E00, + 0x0000005A, +}; +u32 R600_VS_SAMPLER13_header_pm4[R600_SAMPLER_header_cpm4] = { + 0xC0036E00, + 0x0000005D, +}; +u32 R600_VS_SAMPLER14_header_pm4[R600_SAMPLER_header_cpm4] = { + 0xC0036E00, + 0x00000060, +}; +u32 R600_VS_SAMPLER15_header_pm4[R600_SAMPLER_header_cpm4] = { + 0xC0036E00, + 0x00000063, +}; +u32 R600_VS_SAMPLER16_header_pm4[R600_SAMPLER_header_cpm4] = { + 0xC0036E00, + 0x00000066, +}; +u32 R600_VS_SAMPLER17_header_pm4[R600_SAMPLER_header_cpm4] = { + 0xC0036E00, + 0x00000069, +}; +u32 R600_GS_SAMPLER0_header_pm4[R600_SAMPLER_header_cpm4] = { + 0xC0036E00, + 0x0000006C, +}; +u32 R600_GS_SAMPLER1_header_pm4[R600_SAMPLER_header_cpm4] = { + 0xC0036E00, + 0x0000006F, +}; +u32 R600_GS_SAMPLER2_header_pm4[R600_SAMPLER_header_cpm4] = { + 0xC0036E00, + 0x00000072, +}; +u32 R600_GS_SAMPLER3_header_pm4[R600_SAMPLER_header_cpm4] = { + 0xC0036E00, + 0x00000075, +}; +u32 R600_GS_SAMPLER4_header_pm4[R600_SAMPLER_header_cpm4] = { + 0xC0036E00, + 0x00000078, +}; +u32 R600_GS_SAMPLER5_header_pm4[R600_SAMPLER_header_cpm4] = { + 0xC0036E00, + 0x0000007B, +}; +u32 R600_GS_SAMPLER6_header_pm4[R600_SAMPLER_header_cpm4] = { + 0xC0036E00, + 0x0000007E, +}; +u32 R600_GS_SAMPLER7_header_pm4[R600_SAMPLER_header_cpm4] = { + 0xC0036E00, + 0x00000081, +}; +u32 R600_GS_SAMPLER8_header_pm4[R600_SAMPLER_header_cpm4] = { + 0xC0036E00, + 0x00000084, +}; +u32 R600_GS_SAMPLER9_header_pm4[R600_SAMPLER_header_cpm4] = { + 0xC0036E00, + 0x00000087, +}; +u32 R600_GS_SAMPLER10_header_pm4[R600_SAMPLER_header_cpm4] = { + 0xC0036E00, + 0x0000008A, +}; +u32 R600_GS_SAMPLER11_header_pm4[R600_SAMPLER_header_cpm4] = { + 0xC0036E00, + 0x0000008D, +}; +u32 R600_GS_SAMPLER12_header_pm4[R600_SAMPLER_header_cpm4] = { + 0xC0036E00, + 0x00000090, +}; +u32 R600_GS_SAMPLER13_header_pm4[R600_SAMPLER_header_cpm4] = { + 0xC0036E00, + 0x00000093, +}; +u32 R600_GS_SAMPLER14_header_pm4[R600_SAMPLER_header_cpm4] = { + 0xC0036E00, + 0x00000096, +}; +u32 R600_GS_SAMPLER15_header_pm4[R600_SAMPLER_header_cpm4] = { + 0xC0036E00, + 0x00000099, +}; +u32 R600_GS_SAMPLER16_header_pm4[R600_SAMPLER_header_cpm4] = { + 0xC0036E00, + 0x0000009C, +}; +u32 R600_GS_SAMPLER17_header_pm4[R600_SAMPLER_header_cpm4] = { + 0xC0036E00, + 0x0000009F, +}; +#define R600_SAMPLER_state_cpm4 3 +u32 R600_SAMPLER_state_pm4[R600_SAMPLER_state_cpm4] = { + 0x00000000, + 0x00000000, + 0x00000000, +}; + +/* R600_SAMPLER_BORDER */ +#define R600_SAMPLER_BORDER_header_cpm4 2 +u32 R600_PS_SAMPLER_BORDER0_header_pm4[R600_SAMPLER_BORDER_header_cpm4] = { + 0xC0046800, + 0x00000900, +}; +u32 R600_PS_SAMPLER_BORDER1_header_pm4[R600_SAMPLER_BORDER_header_cpm4] = { + 0xC0046800, + 0x00000904, +}; +u32 R600_PS_SAMPLER_BORDER2_header_pm4[R600_SAMPLER_BORDER_header_cpm4] = { + 0xC0046800, + 0x00000908, +}; +u32 R600_PS_SAMPLER_BORDER3_header_pm4[R600_SAMPLER_BORDER_header_cpm4] = { + 0xC0046800, + 0x0000090C, +}; +u32 R600_PS_SAMPLER_BORDER4_header_pm4[R600_SAMPLER_BORDER_header_cpm4] = { + 0xC0046800, + 0x00000910, +}; +u32 R600_PS_SAMPLER_BORDER5_header_pm4[R600_SAMPLER_BORDER_header_cpm4] = { + 0xC0046800, + 0x00000914, +}; +u32 R600_PS_SAMPLER_BORDER6_header_pm4[R600_SAMPLER_BORDER_header_cpm4] = { + 0xC0046800, + 0x00000918, +}; +u32 R600_PS_SAMPLER_BORDER7_header_pm4[R600_SAMPLER_BORDER_header_cpm4] = { + 0xC0046800, + 0x0000091C, +}; +u32 R600_PS_SAMPLER_BORDER8_header_pm4[R600_SAMPLER_BORDER_header_cpm4] = { + 0xC0046800, + 0x00000920, +}; +u32 R600_PS_SAMPLER_BORDER9_header_pm4[R600_SAMPLER_BORDER_header_cpm4] = { + 0xC0046800, + 0x00000924, +}; +u32 R600_PS_SAMPLER_BORDER10_header_pm4[R600_SAMPLER_BORDER_header_cpm4] = { + 0xC0046800, + 0x00000928, +}; +u32 R600_PS_SAMPLER_BORDER11_header_pm4[R600_SAMPLER_BORDER_header_cpm4] = { + 0xC0046800, + 0x0000092C, +}; +u32 R600_PS_SAMPLER_BORDER12_header_pm4[R600_SAMPLER_BORDER_header_cpm4] = { + 0xC0046800, + 0x00000930, +}; +u32 R600_PS_SAMPLER_BORDER13_header_pm4[R600_SAMPLER_BORDER_header_cpm4] = { + 0xC0046800, + 0x00000934, +}; +u32 R600_PS_SAMPLER_BORDER14_header_pm4[R600_SAMPLER_BORDER_header_cpm4] = { + 0xC0046800, + 0x00000938, +}; +u32 R600_PS_SAMPLER_BORDER15_header_pm4[R600_SAMPLER_BORDER_header_cpm4] = { + 0xC0046800, + 0x0000093C, +}; +u32 R600_PS_SAMPLER_BORDER16_header_pm4[R600_SAMPLER_BORDER_header_cpm4] = { + 0xC0046800, + 0x00000940, +}; +u32 R600_PS_SAMPLER_BORDER17_header_pm4[R600_SAMPLER_BORDER_header_cpm4] = { + 0xC0046800, + 0x00000944, +}; +u32 R600_VS_SAMPLER_BORDER0_header_pm4[R600_SAMPLER_BORDER_header_cpm4] = { + 0xC0046800, + 0x00000980, +}; +u32 R600_VS_SAMPLER_BORDER1_header_pm4[R600_SAMPLER_BORDER_header_cpm4] = { + 0xC0046800, + 0x00000984, +}; +u32 R600_VS_SAMPLER_BORDER2_header_pm4[R600_SAMPLER_BORDER_header_cpm4] = { + 0xC0046800, + 0x00000988, +}; +u32 R600_VS_SAMPLER_BORDER3_header_pm4[R600_SAMPLER_BORDER_header_cpm4] = { + 0xC0046800, + 0x0000098C, +}; +u32 R600_VS_SAMPLER_BORDER4_header_pm4[R600_SAMPLER_BORDER_header_cpm4] = { + 0xC0046800, + 0x00000990, +}; +u32 R600_VS_SAMPLER_BORDER5_header_pm4[R600_SAMPLER_BORDER_header_cpm4] = { + 0xC0046800, + 0x00000994, +}; +u32 R600_VS_SAMPLER_BORDER6_header_pm4[R600_SAMPLER_BORDER_header_cpm4] = { + 0xC0046800, + 0x00000998, +}; +u32 R600_VS_SAMPLER_BORDER7_header_pm4[R600_SAMPLER_BORDER_header_cpm4] = { + 0xC0046800, + 0x0000099C, +}; +u32 R600_VS_SAMPLER_BORDER8_header_pm4[R600_SAMPLER_BORDER_header_cpm4] = { + 0xC0046800, + 0x000009A0, +}; +u32 R600_VS_SAMPLER_BORDER9_header_pm4[R600_SAMPLER_BORDER_header_cpm4] = { + 0xC0046800, + 0x000009A4, +}; +u32 R600_VS_SAMPLER_BORDER10_header_pm4[R600_SAMPLER_BORDER_header_cpm4] = { + 0xC0046800, + 0x000009A8, +}; +u32 R600_VS_SAMPLER_BORDER11_header_pm4[R600_SAMPLER_BORDER_header_cpm4] = { + 0xC0046800, + 0x000009AC, +}; +u32 R600_VS_SAMPLER_BORDER12_header_pm4[R600_SAMPLER_BORDER_header_cpm4] = { + 0xC0046800, + 0x000009B0, +}; +u32 R600_VS_SAMPLER_BORDER13_header_pm4[R600_SAMPLER_BORDER_header_cpm4] = { + 0xC0046800, + 0x000009B4, +}; +u32 R600_VS_SAMPLER_BORDER14_header_pm4[R600_SAMPLER_BORDER_header_cpm4] = { + 0xC0046800, + 0x000009B8, +}; +u32 R600_VS_SAMPLER_BORDER15_header_pm4[R600_SAMPLER_BORDER_header_cpm4] = { + 0xC0046800, + 0x000009BC, +}; +u32 R600_VS_SAMPLER_BORDER16_header_pm4[R600_SAMPLER_BORDER_header_cpm4] = { + 0xC0046800, + 0x000009C0, +}; +u32 R600_VS_SAMPLER_BORDER17_header_pm4[R600_SAMPLER_BORDER_header_cpm4] = { + 0xC0046800, + 0x000009C4, +}; +u32 R600_GS_SAMPLER_BORDER0_header_pm4[R600_SAMPLER_BORDER_header_cpm4] = { + 0xC0046800, + 0x00000A00, +}; +u32 R600_GS_SAMPLER_BORDER1_header_pm4[R600_SAMPLER_BORDER_header_cpm4] = { + 0xC0046800, + 0x00000A04, +}; +u32 R600_GS_SAMPLER_BORDER2_header_pm4[R600_SAMPLER_BORDER_header_cpm4] = { + 0xC0046800, + 0x00000A08, +}; +u32 R600_GS_SAMPLER_BORDER3_header_pm4[R600_SAMPLER_BORDER_header_cpm4] = { + 0xC0046800, + 0x00000A0C, +}; +u32 R600_GS_SAMPLER_BORDER4_header_pm4[R600_SAMPLER_BORDER_header_cpm4] = { + 0xC0046800, + 0x00000A10, +}; +u32 R600_GS_SAMPLER_BORDER5_header_pm4[R600_SAMPLER_BORDER_header_cpm4] = { + 0xC0046800, + 0x00000A14, +}; +u32 R600_GS_SAMPLER_BORDER6_header_pm4[R600_SAMPLER_BORDER_header_cpm4] = { + 0xC0046800, + 0x00000A18, +}; +u32 R600_GS_SAMPLER_BORDER7_header_pm4[R600_SAMPLER_BORDER_header_cpm4] = { + 0xC0046800, + 0x00000A1C, +}; +u32 R600_GS_SAMPLER_BORDER8_header_pm4[R600_SAMPLER_BORDER_header_cpm4] = { + 0xC0046800, + 0x00000A20, +}; +u32 R600_GS_SAMPLER_BORDER9_header_pm4[R600_SAMPLER_BORDER_header_cpm4] = { + 0xC0046800, + 0x00000A24, +}; +u32 R600_GS_SAMPLER_BORDER10_header_pm4[R600_SAMPLER_BORDER_header_cpm4] = { + 0xC0046800, + 0x00000A28, +}; +u32 R600_GS_SAMPLER_BORDER11_header_pm4[R600_SAMPLER_BORDER_header_cpm4] = { + 0xC0046800, + 0x00000A2C, +}; +u32 R600_GS_SAMPLER_BORDER12_header_pm4[R600_SAMPLER_BORDER_header_cpm4] = { + 0xC0046800, + 0x00000A30, +}; +u32 R600_GS_SAMPLER_BORDER13_header_pm4[R600_SAMPLER_BORDER_header_cpm4] = { + 0xC0046800, + 0x00000A34, +}; +u32 R600_GS_SAMPLER_BORDER14_header_pm4[R600_SAMPLER_BORDER_header_cpm4] = { + 0xC0046800, + 0x00000A38, +}; +u32 R600_GS_SAMPLER_BORDER15_header_pm4[R600_SAMPLER_BORDER_header_cpm4] = { + 0xC0046800, + 0x00000A3C, +}; +u32 R600_GS_SAMPLER_BORDER16_header_pm4[R600_SAMPLER_BORDER_header_cpm4] = { + 0xC0046800, + 0x00000A40, +}; +u32 R600_GS_SAMPLER_BORDER17_header_pm4[R600_SAMPLER_BORDER_header_cpm4] = { + 0xC0046800, + 0x00000A44, +}; +#define R600_SAMPLER_BORDER_state_cpm4 4 +u32 R600_SAMPLER_BORDER_state_pm4[R600_SAMPLER_BORDER_state_cpm4] = { + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, +}; + +static const struct radeon_type R600_types[] = { + {R600_CONFIG_header_pm4, R600_CONFIG_header_cpm4, R600_CONFIG_state_pm4, R600_CONFIG_state_cpm4, 0, 0}, + {R600_CB_CNTL_header_pm4, R600_CB_CNTL_header_cpm4, R600_CB_CNTL_state_pm4, R600_CB_CNTL_state_cpm4, 0, 0}, + {R600_RASTERIZER_header_pm4, R600_RASTERIZER_header_cpm4, R600_RASTERIZER_state_pm4, R600_RASTERIZER_state_cpm4, 0, 0}, + {R600_VIEWPORT_header_pm4, R600_VIEWPORT_header_cpm4, R600_VIEWPORT_state_pm4, R600_VIEWPORT_state_cpm4, 0, 0}, + {R600_SCISSOR_header_pm4, R600_SCISSOR_header_cpm4, R600_SCISSOR_state_pm4, R600_SCISSOR_state_cpm4, 0, 0}, + {R600_BLEND_header_pm4, R600_BLEND_header_cpm4, R600_BLEND_state_pm4, R600_BLEND_state_cpm4, 0, 0}, + {R600_DSA_header_pm4, R600_DSA_header_cpm4, R600_DSA_state_pm4, R600_DSA_state_cpm4, 0, 0}, + {R600_VGT_header_pm4, R600_VGT_header_cpm4, R600_VGT_state_pm4, R600_VGT_state_cpm4, 0, 0}, + {R600_QUERY_header_pm4, R600_QUERY_header_cpm4, R600_QUERY_state_pm4, R600_QUERY_state_cpm4, 0, 0}, + {R600_QUERY_header_pm4, R600_QUERY_header_cpm4, R600_QUERY_state_pm4, R600_QUERY_state_cpm4, 0, 0}, + {R600_VS_SHADER_header_pm4, R600_VS_SHADER_header_cpm4, R600_VS_SHADER_state_pm4, R600_VS_SHADER_state_cpm4, 0, 0}, + {R600_PS_SHADER_header_pm4, R600_PS_SHADER_header_cpm4, R600_PS_SHADER_state_pm4, R600_PS_SHADER_state_cpm4, 0, 0}, + {R600_DB_header_pm4, R600_DB_header_cpm4, R600_DB_state_pm4, R600_DB_state_cpm4, R600_FLUSH_DB, R600_DIRTY_ALL}, + {R600_CB0_header_pm4, R600_CB0_header_cpm4, R600_CB0_state_pm4, R600_CB0_state_cpm4, R600_FLUSH_CB0, R600_DIRTY_ALL}, + {R600_CB1_header_pm4, R600_CB1_header_cpm4, R600_CB1_state_pm4, R600_CB1_state_cpm4, R600_FLUSH_CB1, R600_DIRTY_ALL}, + {R600_CB2_header_pm4, R600_CB2_header_cpm4, R600_CB2_state_pm4, R600_CB2_state_cpm4, R600_FLUSH_CB2, R600_DIRTY_ALL}, + {R600_CB3_header_pm4, R600_CB3_header_cpm4, R600_CB3_state_pm4, R600_CB3_state_cpm4, R600_FLUSH_CB3, R600_DIRTY_ALL}, + {R600_CB4_header_pm4, R600_CB4_header_cpm4, R600_CB4_state_pm4, R600_CB4_state_cpm4, R600_FLUSH_CB4, R600_DIRTY_ALL}, + {R600_CB5_header_pm4, R600_CB5_header_cpm4, R600_CB5_state_pm4, R600_CB5_state_cpm4, R600_FLUSH_CB5, R600_DIRTY_ALL}, + {R600_CB6_header_pm4, R600_CB6_header_cpm4, R600_CB6_state_pm4, R600_CB6_state_cpm4, R600_FLUSH_CB6, R600_DIRTY_ALL}, + {R600_CB7_header_pm4, R600_CB7_header_cpm4, R600_CB7_state_pm4, R600_CB7_state_cpm4, R600_FLUSH_CB7, R600_DIRTY_ALL}, + {R600_UCP0_header_pm4, R600_UCP_header_cpm4, R600_UCP_state_pm4, R600_UCP_state_cpm4, 0, 0}, + {R600_UCP1_header_pm4, R600_UCP_header_cpm4, R600_UCP_state_pm4, R600_UCP_state_cpm4, 0, 0}, + {R600_UCP2_header_pm4, R600_UCP_header_cpm4, R600_UCP_state_pm4, R600_UCP_state_cpm4, 0, 0}, + {R600_UCP3_header_pm4, R600_UCP_header_cpm4, R600_UCP_state_pm4, R600_UCP_state_cpm4, 0, 0}, + {R600_UCP4_header_pm4, R600_UCP_header_cpm4, R600_UCP_state_pm4, R600_UCP_state_cpm4, 0, 0}, + {R600_UCP5_header_pm4, R600_UCP_header_cpm4, R600_UCP_state_pm4, R600_UCP_state_cpm4, 0, 0}, + {R600_PS_RESOURCE0_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE1_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE2_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE3_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE4_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE5_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE6_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE7_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE8_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE9_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE10_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE11_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE12_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE13_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE14_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE15_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE16_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE17_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE18_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE19_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE20_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE21_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE22_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE23_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE24_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE25_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE26_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE27_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE28_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE29_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE30_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE31_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE32_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE33_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE34_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE35_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE36_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE37_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE38_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE39_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE40_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE41_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE42_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE43_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE44_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE45_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE46_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE47_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE48_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE49_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE50_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE51_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE52_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE53_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE54_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE55_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE56_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE57_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE58_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE59_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE60_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE61_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE62_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE63_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE64_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE65_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE66_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE67_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE68_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE69_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE70_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE71_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE72_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE73_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE74_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE75_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE76_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE77_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE78_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE79_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE80_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE81_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE82_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE83_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE84_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE85_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE86_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE87_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE88_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE89_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE90_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE91_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE92_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE93_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE94_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE95_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE96_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE97_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE98_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE99_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE100_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE101_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE102_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE103_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE104_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE105_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE106_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE107_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE108_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE109_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE110_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE111_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE112_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE113_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE114_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE115_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE116_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE117_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE118_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE119_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE120_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE121_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE122_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE123_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE124_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE125_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE126_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE127_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE128_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE129_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE130_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE131_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE132_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE133_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE134_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE135_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE136_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE137_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE138_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE139_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE140_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE141_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE142_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE143_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE144_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE145_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE146_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE147_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE148_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE149_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE150_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE151_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE152_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE153_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE154_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE155_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE156_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE157_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE158_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE159_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE0_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE1_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE2_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE3_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE4_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE5_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE6_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE7_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE8_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE9_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE10_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE11_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE12_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE13_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE14_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE15_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE16_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE17_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE18_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE19_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE20_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE21_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE22_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE23_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE24_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE25_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE26_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE27_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE28_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE29_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE30_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE31_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE32_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE33_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE34_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE35_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE36_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE37_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE38_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE39_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE40_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE41_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE42_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE43_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE44_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE45_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE46_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE47_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE48_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE49_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE50_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE51_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE52_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE53_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE54_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE55_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE56_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE57_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE58_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE59_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE60_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE61_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE62_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE63_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE64_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE65_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE66_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE67_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE68_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE69_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE70_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE71_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE72_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE73_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE74_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE75_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE76_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE77_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE78_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE79_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE80_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE81_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE82_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE83_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE84_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE85_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE86_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE87_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE88_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE89_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE90_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE91_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE92_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE93_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE94_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE95_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE96_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE97_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE98_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE99_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE100_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE101_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE102_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE103_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE104_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE105_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE106_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE107_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE108_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE109_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE110_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE111_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE112_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE113_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE114_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE115_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE116_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE117_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE118_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE119_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE120_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE121_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE122_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE123_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE124_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE125_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE126_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE127_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE128_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE129_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE130_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE131_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE132_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE133_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE134_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE135_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE136_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE137_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE138_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE139_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE140_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE141_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE142_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE143_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE144_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE145_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE146_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE147_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE148_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE149_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE150_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE151_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE152_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE153_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE154_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE155_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE156_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE157_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE158_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE159_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_FS_RESOURCE0_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_FS_RESOURCE1_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_FS_RESOURCE2_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_FS_RESOURCE3_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_FS_RESOURCE4_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_FS_RESOURCE5_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_FS_RESOURCE6_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_FS_RESOURCE7_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_FS_RESOURCE8_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_FS_RESOURCE9_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_FS_RESOURCE10_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_FS_RESOURCE11_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_FS_RESOURCE12_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_FS_RESOURCE13_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_FS_RESOURCE14_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_FS_RESOURCE15_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE0_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE1_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE2_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE3_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE4_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE5_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE6_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE7_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE8_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE9_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE10_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE11_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE12_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE13_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE14_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE15_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE16_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE17_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE18_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE19_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE20_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE21_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE22_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE23_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE24_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE25_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE26_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE27_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE28_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE29_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE30_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE31_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE32_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE33_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE34_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE35_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE36_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE37_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE38_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE39_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE40_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE41_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE42_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE43_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE44_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE45_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE46_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE47_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE48_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE49_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE50_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE51_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE52_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE53_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE54_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE55_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE56_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE57_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE58_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE59_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE60_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE61_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE62_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE63_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE64_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE65_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE66_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE67_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE68_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE69_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE70_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE71_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE72_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE73_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE74_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE75_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE76_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE77_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE78_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE79_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE80_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE81_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE82_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE83_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE84_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE85_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE86_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE87_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE88_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE89_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE90_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE91_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE92_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE93_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE94_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE95_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE96_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE97_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE98_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE99_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE100_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE101_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE102_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE103_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE104_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE105_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE106_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE107_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE108_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE109_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE110_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE111_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE112_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE113_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE114_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE115_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE116_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE117_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE118_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE119_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE120_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE121_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE122_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE123_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE124_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE125_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE126_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE127_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE128_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE129_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE130_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE131_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE132_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE133_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE134_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE135_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE136_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE137_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE138_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE139_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE140_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE141_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE142_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE143_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE144_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE145_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE146_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE147_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE148_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE149_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE150_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE151_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE152_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE153_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE154_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE155_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE156_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE157_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE158_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE159_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_CONSTANT0_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT1_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT2_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT3_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT4_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT5_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT6_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT7_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT8_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT9_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT10_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT11_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT12_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT13_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT14_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT15_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT16_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT17_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT18_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT19_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT20_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT21_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT22_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT23_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT24_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT25_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT26_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT27_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT28_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT29_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT30_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT31_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT32_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT33_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT34_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT35_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT36_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT37_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT38_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT39_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT40_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT41_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT42_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT43_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT44_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT45_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT46_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT47_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT48_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT49_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT50_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT51_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT52_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT53_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT54_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT55_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT56_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT57_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT58_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT59_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT60_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT61_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT62_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT63_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT64_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT65_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT66_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT67_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT68_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT69_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT70_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT71_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT72_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT73_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT74_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT75_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT76_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT77_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT78_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT79_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT80_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT81_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT82_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT83_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT84_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT85_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT86_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT87_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT88_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT89_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT90_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT91_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT92_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT93_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT94_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT95_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT96_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT97_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT98_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT99_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT100_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT101_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT102_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT103_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT104_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT105_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT106_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT107_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT108_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT109_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT110_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT111_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT112_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT113_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT114_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT115_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT116_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT117_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT118_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT119_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT120_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT121_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT122_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT123_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT124_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT125_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT126_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT127_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT128_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT129_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT130_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT131_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT132_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT133_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT134_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT135_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT136_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT137_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT138_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT139_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT140_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT141_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT142_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT143_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT144_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT145_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT146_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT147_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT148_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT149_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT150_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT151_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT152_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT153_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT154_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT155_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT156_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT157_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT158_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT159_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT160_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT161_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT162_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT163_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT164_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT165_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT166_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT167_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT168_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT169_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT170_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT171_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT172_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT173_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT174_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT175_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT176_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT177_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT178_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT179_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT180_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT181_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT182_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT183_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT184_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT185_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT186_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT187_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT188_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT189_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT190_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT191_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT192_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT193_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT194_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT195_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT196_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT197_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT198_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT199_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT200_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT201_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT202_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT203_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT204_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT205_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT206_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT207_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT208_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT209_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT210_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT211_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT212_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT213_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT214_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT215_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT216_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT217_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT218_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT219_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT220_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT221_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT222_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT223_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT224_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT225_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT226_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT227_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT228_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT229_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT230_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT231_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT232_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT233_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT234_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT235_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT236_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT237_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT238_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT239_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT240_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT241_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT242_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT243_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT244_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT245_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT246_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT247_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT248_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT249_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT250_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT251_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT252_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT253_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT254_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT255_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT0_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT1_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT2_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT3_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT4_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT5_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT6_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT7_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT8_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT9_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT10_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT11_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT12_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT13_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT14_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT15_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT16_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT17_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT18_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT19_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT20_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT21_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT22_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT23_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT24_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT25_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT26_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT27_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT28_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT29_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT30_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT31_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT32_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT33_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT34_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT35_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT36_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT37_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT38_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT39_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT40_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT41_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT42_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT43_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT44_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT45_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT46_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT47_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT48_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT49_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT50_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT51_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT52_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT53_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT54_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT55_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT56_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT57_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT58_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT59_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT60_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT61_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT62_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT63_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT64_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT65_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT66_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT67_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT68_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT69_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT70_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT71_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT72_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT73_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT74_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT75_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT76_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT77_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT78_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT79_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT80_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT81_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT82_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT83_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT84_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT85_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT86_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT87_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT88_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT89_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT90_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT91_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT92_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT93_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT94_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT95_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT96_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT97_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT98_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT99_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT100_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT101_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT102_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT103_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT104_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT105_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT106_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT107_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT108_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT109_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT110_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT111_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT112_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT113_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT114_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT115_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT116_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT117_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT118_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT119_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT120_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT121_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT122_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT123_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT124_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT125_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT126_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT127_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT128_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT129_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT130_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT131_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT132_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT133_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT134_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT135_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT136_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT137_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT138_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT139_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT140_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT141_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT142_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT143_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT144_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT145_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT146_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT147_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT148_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT149_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT150_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT151_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT152_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT153_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT154_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT155_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT156_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT157_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT158_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT159_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT160_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT161_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT162_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT163_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT164_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT165_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT166_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT167_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT168_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT169_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT170_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT171_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT172_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT173_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT174_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT175_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT176_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT177_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT178_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT179_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT180_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT181_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT182_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT183_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT184_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT185_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT186_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT187_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT188_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT189_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT190_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT191_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT192_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT193_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT194_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT195_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT196_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT197_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT198_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT199_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT200_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT201_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT202_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT203_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT204_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT205_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT206_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT207_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT208_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT209_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT210_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT211_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT212_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT213_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT214_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT215_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT216_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT217_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT218_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT219_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT220_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT221_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT222_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT223_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT224_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT225_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT226_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT227_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT228_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT229_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT230_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT231_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT232_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT233_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT234_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT235_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT236_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT237_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT238_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT239_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT240_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT241_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT242_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT243_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT244_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT245_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT246_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT247_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT248_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT249_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT250_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT251_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT252_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT253_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT254_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT255_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_SAMPLER0_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, + {R600_PS_SAMPLER1_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, + {R600_PS_SAMPLER2_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, + {R600_PS_SAMPLER3_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, + {R600_PS_SAMPLER4_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, + {R600_PS_SAMPLER5_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, + {R600_PS_SAMPLER6_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, + {R600_PS_SAMPLER7_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, + {R600_PS_SAMPLER8_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, + {R600_PS_SAMPLER9_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, + {R600_PS_SAMPLER10_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, + {R600_PS_SAMPLER11_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, + {R600_PS_SAMPLER12_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, + {R600_PS_SAMPLER13_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, + {R600_PS_SAMPLER14_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, + {R600_PS_SAMPLER15_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, + {R600_PS_SAMPLER16_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, + {R600_PS_SAMPLER17_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, + {R600_VS_SAMPLER0_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, + {R600_VS_SAMPLER1_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, + {R600_VS_SAMPLER2_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, + {R600_VS_SAMPLER3_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, + {R600_VS_SAMPLER4_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, + {R600_VS_SAMPLER5_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, + {R600_VS_SAMPLER6_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, + {R600_VS_SAMPLER7_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, + {R600_VS_SAMPLER8_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, + {R600_VS_SAMPLER9_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, + {R600_VS_SAMPLER10_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, + {R600_VS_SAMPLER11_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, + {R600_VS_SAMPLER12_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, + {R600_VS_SAMPLER13_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, + {R600_VS_SAMPLER14_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, + {R600_VS_SAMPLER15_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, + {R600_VS_SAMPLER16_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, + {R600_VS_SAMPLER17_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, + {R600_GS_SAMPLER0_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, + {R600_GS_SAMPLER1_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, + {R600_GS_SAMPLER2_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, + {R600_GS_SAMPLER3_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, + {R600_GS_SAMPLER4_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, + {R600_GS_SAMPLER5_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, + {R600_GS_SAMPLER6_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, + {R600_GS_SAMPLER7_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, + {R600_GS_SAMPLER8_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, + {R600_GS_SAMPLER9_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, + {R600_GS_SAMPLER10_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, + {R600_GS_SAMPLER11_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, + {R600_GS_SAMPLER12_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, + {R600_GS_SAMPLER13_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, + {R600_GS_SAMPLER14_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, + {R600_GS_SAMPLER15_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, + {R600_GS_SAMPLER16_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, + {R600_GS_SAMPLER17_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, + {R600_PS_SAMPLER_BORDER0_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, + {R600_PS_SAMPLER_BORDER1_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, + {R600_PS_SAMPLER_BORDER2_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, + {R600_PS_SAMPLER_BORDER3_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, + {R600_PS_SAMPLER_BORDER4_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, + {R600_PS_SAMPLER_BORDER5_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, + {R600_PS_SAMPLER_BORDER6_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, + {R600_PS_SAMPLER_BORDER7_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, + {R600_PS_SAMPLER_BORDER8_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, + {R600_PS_SAMPLER_BORDER9_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, + {R600_PS_SAMPLER_BORDER10_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, + {R600_PS_SAMPLER_BORDER11_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, + {R600_PS_SAMPLER_BORDER12_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, + {R600_PS_SAMPLER_BORDER13_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, + {R600_PS_SAMPLER_BORDER14_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, + {R600_PS_SAMPLER_BORDER15_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, + {R600_PS_SAMPLER_BORDER16_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, + {R600_PS_SAMPLER_BORDER17_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, + {R600_VS_SAMPLER_BORDER0_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, + {R600_VS_SAMPLER_BORDER1_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, + {R600_VS_SAMPLER_BORDER2_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, + {R600_VS_SAMPLER_BORDER3_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, + {R600_VS_SAMPLER_BORDER4_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, + {R600_VS_SAMPLER_BORDER5_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, + {R600_VS_SAMPLER_BORDER6_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, + {R600_VS_SAMPLER_BORDER7_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, + {R600_VS_SAMPLER_BORDER8_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, + {R600_VS_SAMPLER_BORDER9_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, + {R600_VS_SAMPLER_BORDER10_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, + {R600_VS_SAMPLER_BORDER11_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, + {R600_VS_SAMPLER_BORDER12_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, + {R600_VS_SAMPLER_BORDER13_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, + {R600_VS_SAMPLER_BORDER14_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, + {R600_VS_SAMPLER_BORDER15_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, + {R600_VS_SAMPLER_BORDER16_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, + {R600_VS_SAMPLER_BORDER17_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, + {R600_GS_SAMPLER_BORDER0_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, + {R600_GS_SAMPLER_BORDER1_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, + {R600_GS_SAMPLER_BORDER2_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, + {R600_GS_SAMPLER_BORDER3_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, + {R600_GS_SAMPLER_BORDER4_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, + {R600_GS_SAMPLER_BORDER5_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, + {R600_GS_SAMPLER_BORDER6_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, + {R600_GS_SAMPLER_BORDER7_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, + {R600_GS_SAMPLER_BORDER8_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, + {R600_GS_SAMPLER_BORDER9_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, + {R600_GS_SAMPLER_BORDER10_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, + {R600_GS_SAMPLER_BORDER11_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, + {R600_GS_SAMPLER_BORDER12_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, + {R600_GS_SAMPLER_BORDER13_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, + {R600_GS_SAMPLER_BORDER14_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, + {R600_GS_SAMPLER_BORDER15_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, + {R600_GS_SAMPLER_BORDER16_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, + {R600_GS_SAMPLER_BORDER17_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, + {R600_DRAW_AUTO_header_pm4, R600_DRAW_AUTO_header_cpm4, R600_DRAW_AUTO_state_pm4, R600_DRAW_AUTO_state_cpm4, 0, 0}, + {R600_DRAW_header_pm4, R600_DRAW_header_cpm4, R600_DRAW_state_pm4, R600_DRAW_state_cpm4, 0, 0} +}; + +static const struct radeon_type R700_types[] = { + {R700_CONFIG_header_pm4, R700_CONFIG_header_cpm4, R600_CONFIG_state_pm4, R600_CONFIG_state_cpm4, 0, 0}, + {R600_CB_CNTL_header_pm4, R600_CB_CNTL_header_cpm4, R600_CB_CNTL_state_pm4, R600_CB_CNTL_state_cpm4, 0, 0}, + {R600_RASTERIZER_header_pm4, R600_RASTERIZER_header_cpm4, R600_RASTERIZER_state_pm4, R600_RASTERIZER_state_cpm4, 0, 0}, + {R600_VIEWPORT_header_pm4, R600_VIEWPORT_header_cpm4, R600_VIEWPORT_state_pm4, R600_VIEWPORT_state_cpm4, 0, 0}, + {R600_SCISSOR_header_pm4, R600_SCISSOR_header_cpm4, R600_SCISSOR_state_pm4, R600_SCISSOR_state_cpm4, 0, 0}, + {R600_BLEND_header_pm4, R600_BLEND_header_cpm4, R600_BLEND_state_pm4, R600_BLEND_state_cpm4, 0, 0}, + {R600_DSA_header_pm4, R600_DSA_header_cpm4, R600_DSA_state_pm4, R600_DSA_state_cpm4, 0, 0}, + {R600_VGT_header_pm4, R600_VGT_header_cpm4, R600_VGT_state_pm4, R600_VGT_state_cpm4, 0, 0}, + {R600_QUERY_header_pm4, R600_QUERY_header_cpm4, R600_QUERY_state_pm4, R600_QUERY_state_cpm4, 0, 0}, + {R600_QUERY_header_pm4, R600_QUERY_header_cpm4, R600_QUERY_state_pm4, R600_QUERY_state_cpm4, 0, 0}, + {R600_VS_SHADER_header_pm4, R600_VS_SHADER_header_cpm4, R600_VS_SHADER_state_pm4, R600_VS_SHADER_state_cpm4, 0, 0}, + {R600_PS_SHADER_header_pm4, R600_PS_SHADER_header_cpm4, R600_PS_SHADER_state_pm4, R600_PS_SHADER_state_cpm4, 0, 0}, + {R600_DB_header_pm4, R600_DB_header_cpm4, R600_DB_state_pm4, R600_DB_state_cpm4, R600_FLUSH_DB, R600_DIRTY_ALL}, + {R600_CB0_header_pm4, R600_CB0_header_cpm4, R600_CB0_state_pm4, R600_CB0_state_cpm4, R600_FLUSH_CB0, R600_DIRTY_ALL}, + {R600_CB1_header_pm4, R600_CB1_header_cpm4, R600_CB1_state_pm4, R600_CB1_state_cpm4, R600_FLUSH_CB1, R600_DIRTY_ALL}, + {R600_CB2_header_pm4, R600_CB2_header_cpm4, R600_CB2_state_pm4, R600_CB2_state_cpm4, R600_FLUSH_CB2, R600_DIRTY_ALL}, + {R600_CB3_header_pm4, R600_CB3_header_cpm4, R600_CB3_state_pm4, R600_CB3_state_cpm4, R600_FLUSH_CB3, R600_DIRTY_ALL}, + {R600_CB4_header_pm4, R600_CB4_header_cpm4, R600_CB4_state_pm4, R600_CB4_state_cpm4, R600_FLUSH_CB4, R600_DIRTY_ALL}, + {R600_CB5_header_pm4, R600_CB5_header_cpm4, R600_CB5_state_pm4, R600_CB5_state_cpm4, R600_FLUSH_CB5, R600_DIRTY_ALL}, + {R600_CB6_header_pm4, R600_CB6_header_cpm4, R600_CB6_state_pm4, R600_CB6_state_cpm4, R600_FLUSH_CB6, R600_DIRTY_ALL}, + {R600_CB7_header_pm4, R600_CB7_header_cpm4, R600_CB7_state_pm4, R600_CB7_state_cpm4, R600_FLUSH_CB7, R600_DIRTY_ALL}, + {R600_UCP0_header_pm4, R600_UCP_header_cpm4, R600_UCP_state_pm4, R600_UCP_state_cpm4, 0, 0}, + {R600_UCP1_header_pm4, R600_UCP_header_cpm4, R600_UCP_state_pm4, R600_UCP_state_cpm4, 0, 0}, + {R600_UCP2_header_pm4, R600_UCP_header_cpm4, R600_UCP_state_pm4, R600_UCP_state_cpm4, 0, 0}, + {R600_UCP3_header_pm4, R600_UCP_header_cpm4, R600_UCP_state_pm4, R600_UCP_state_cpm4, 0, 0}, + {R600_UCP4_header_pm4, R600_UCP_header_cpm4, R600_UCP_state_pm4, R600_UCP_state_cpm4, 0, 0}, + {R600_UCP5_header_pm4, R600_UCP_header_cpm4, R600_UCP_state_pm4, R600_UCP_state_cpm4, 0, 0}, + {R600_PS_RESOURCE0_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE1_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE2_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE3_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE4_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE5_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE6_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE7_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE8_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE9_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE10_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE11_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE12_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE13_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE14_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE15_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE16_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE17_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE18_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE19_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE20_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE21_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE22_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE23_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE24_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE25_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE26_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE27_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE28_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE29_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE30_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE31_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE32_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE33_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE34_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE35_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE36_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE37_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE38_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE39_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE40_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE41_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE42_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE43_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE44_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE45_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE46_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE47_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE48_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE49_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE50_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE51_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE52_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE53_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE54_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE55_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE56_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE57_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE58_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE59_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE60_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE61_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE62_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE63_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE64_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE65_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE66_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE67_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE68_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE69_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE70_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE71_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE72_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE73_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE74_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE75_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE76_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE77_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE78_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE79_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE80_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE81_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE82_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE83_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE84_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE85_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE86_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE87_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE88_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE89_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE90_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE91_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE92_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE93_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE94_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE95_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE96_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE97_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE98_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE99_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE100_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE101_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE102_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE103_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE104_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE105_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE106_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE107_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE108_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE109_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE110_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE111_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE112_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE113_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE114_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE115_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE116_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE117_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE118_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE119_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE120_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE121_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE122_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE123_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE124_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE125_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE126_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE127_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE128_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE129_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE130_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE131_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE132_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE133_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE134_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE135_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE136_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE137_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE138_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE139_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE140_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE141_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE142_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE143_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE144_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE145_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE146_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE147_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE148_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE149_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE150_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE151_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE152_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE153_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE154_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE155_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE156_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE157_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE158_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_RESOURCE159_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE0_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE1_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE2_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE3_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE4_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE5_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE6_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE7_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE8_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE9_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE10_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE11_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE12_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE13_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE14_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE15_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE16_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE17_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE18_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE19_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE20_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE21_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE22_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE23_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE24_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE25_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE26_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE27_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE28_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE29_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE30_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE31_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE32_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE33_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE34_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE35_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE36_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE37_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE38_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE39_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE40_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE41_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE42_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE43_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE44_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE45_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE46_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE47_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE48_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE49_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE50_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE51_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE52_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE53_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE54_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE55_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE56_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE57_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE58_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE59_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE60_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE61_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE62_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE63_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE64_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE65_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE66_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE67_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE68_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE69_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE70_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE71_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE72_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE73_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE74_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE75_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE76_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE77_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE78_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE79_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE80_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE81_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE82_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE83_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE84_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE85_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE86_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE87_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE88_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE89_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE90_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE91_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE92_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE93_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE94_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE95_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE96_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE97_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE98_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE99_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE100_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE101_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE102_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE103_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE104_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE105_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE106_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE107_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE108_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE109_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE110_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE111_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE112_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE113_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE114_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE115_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE116_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE117_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE118_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE119_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE120_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE121_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE122_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE123_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE124_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE125_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE126_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE127_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE128_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE129_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE130_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE131_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE132_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE133_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE134_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE135_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE136_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE137_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE138_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE139_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE140_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE141_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE142_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE143_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE144_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE145_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE146_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE147_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE148_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE149_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE150_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE151_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE152_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE153_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE154_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE155_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE156_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE157_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE158_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_VS_RESOURCE159_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_FS_RESOURCE0_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_FS_RESOURCE1_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_FS_RESOURCE2_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_FS_RESOURCE3_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_FS_RESOURCE4_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_FS_RESOURCE5_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_FS_RESOURCE6_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_FS_RESOURCE7_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_FS_RESOURCE8_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_FS_RESOURCE9_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_FS_RESOURCE10_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_FS_RESOURCE11_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_FS_RESOURCE12_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_FS_RESOURCE13_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_FS_RESOURCE14_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_FS_RESOURCE15_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE0_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE1_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE2_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE3_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE4_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE5_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE6_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE7_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE8_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE9_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE10_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE11_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE12_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE13_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE14_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE15_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE16_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE17_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE18_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE19_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE20_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE21_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE22_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE23_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE24_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE25_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE26_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE27_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE28_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE29_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE30_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE31_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE32_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE33_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE34_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE35_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE36_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE37_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE38_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE39_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE40_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE41_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE42_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE43_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE44_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE45_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE46_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE47_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE48_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE49_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE50_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE51_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE52_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE53_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE54_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE55_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE56_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE57_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE58_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE59_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE60_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE61_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE62_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE63_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE64_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE65_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE66_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE67_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE68_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE69_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE70_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE71_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE72_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE73_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE74_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE75_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE76_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE77_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE78_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE79_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE80_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE81_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE82_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE83_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE84_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE85_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE86_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE87_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE88_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE89_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE90_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE91_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE92_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE93_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE94_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE95_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE96_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE97_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE98_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE99_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE100_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE101_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE102_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE103_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE104_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE105_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE106_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE107_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE108_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE109_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE110_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE111_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE112_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE113_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE114_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE115_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE116_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE117_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE118_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE119_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE120_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE121_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE122_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE123_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE124_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE125_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE126_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE127_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE128_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE129_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE130_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE131_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE132_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE133_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE134_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE135_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE136_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE137_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE138_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE139_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE140_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE141_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE142_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE143_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE144_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE145_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE146_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE147_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE148_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE149_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE150_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE151_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE152_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE153_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE154_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE155_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE156_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE157_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE158_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_GS_RESOURCE159_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, + {R600_PS_CONSTANT0_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT1_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT2_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT3_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT4_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT5_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT6_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT7_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT8_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT9_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT10_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT11_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT12_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT13_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT14_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT15_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT16_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT17_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT18_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT19_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT20_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT21_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT22_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT23_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT24_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT25_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT26_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT27_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT28_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT29_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT30_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT31_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT32_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT33_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT34_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT35_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT36_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT37_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT38_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT39_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT40_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT41_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT42_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT43_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT44_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT45_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT46_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT47_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT48_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT49_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT50_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT51_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT52_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT53_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT54_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT55_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT56_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT57_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT58_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT59_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT60_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT61_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT62_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT63_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT64_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT65_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT66_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT67_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT68_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT69_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT70_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT71_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT72_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT73_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT74_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT75_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT76_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT77_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT78_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT79_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT80_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT81_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT82_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT83_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT84_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT85_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT86_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT87_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT88_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT89_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT90_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT91_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT92_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT93_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT94_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT95_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT96_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT97_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT98_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT99_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT100_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT101_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT102_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT103_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT104_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT105_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT106_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT107_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT108_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT109_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT110_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT111_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT112_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT113_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT114_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT115_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT116_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT117_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT118_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT119_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT120_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT121_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT122_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT123_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT124_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT125_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT126_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT127_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT128_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT129_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT130_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT131_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT132_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT133_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT134_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT135_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT136_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT137_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT138_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT139_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT140_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT141_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT142_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT143_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT144_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT145_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT146_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT147_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT148_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT149_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT150_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT151_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT152_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT153_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT154_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT155_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT156_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT157_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT158_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT159_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT160_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT161_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT162_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT163_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT164_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT165_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT166_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT167_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT168_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT169_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT170_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT171_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT172_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT173_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT174_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT175_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT176_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT177_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT178_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT179_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT180_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT181_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT182_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT183_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT184_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT185_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT186_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT187_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT188_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT189_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT190_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT191_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT192_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT193_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT194_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT195_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT196_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT197_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT198_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT199_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT200_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT201_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT202_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT203_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT204_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT205_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT206_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT207_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT208_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT209_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT210_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT211_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT212_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT213_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT214_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT215_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT216_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT217_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT218_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT219_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT220_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT221_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT222_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT223_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT224_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT225_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT226_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT227_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT228_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT229_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT230_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT231_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT232_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT233_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT234_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT235_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT236_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT237_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT238_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT239_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT240_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT241_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT242_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT243_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT244_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT245_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT246_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT247_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT248_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT249_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT250_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT251_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT252_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT253_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT254_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_CONSTANT255_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT0_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT1_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT2_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT3_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT4_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT5_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT6_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT7_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT8_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT9_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT10_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT11_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT12_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT13_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT14_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT15_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT16_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT17_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT18_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT19_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT20_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT21_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT22_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT23_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT24_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT25_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT26_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT27_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT28_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT29_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT30_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT31_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT32_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT33_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT34_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT35_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT36_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT37_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT38_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT39_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT40_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT41_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT42_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT43_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT44_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT45_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT46_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT47_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT48_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT49_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT50_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT51_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT52_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT53_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT54_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT55_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT56_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT57_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT58_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT59_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT60_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT61_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT62_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT63_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT64_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT65_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT66_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT67_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT68_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT69_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT70_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT71_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT72_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT73_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT74_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT75_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT76_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT77_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT78_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT79_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT80_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT81_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT82_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT83_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT84_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT85_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT86_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT87_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT88_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT89_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT90_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT91_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT92_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT93_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT94_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT95_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT96_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT97_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT98_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT99_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT100_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT101_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT102_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT103_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT104_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT105_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT106_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT107_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT108_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT109_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT110_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT111_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT112_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT113_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT114_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT115_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT116_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT117_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT118_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT119_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT120_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT121_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT122_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT123_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT124_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT125_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT126_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT127_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT128_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT129_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT130_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT131_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT132_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT133_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT134_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT135_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT136_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT137_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT138_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT139_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT140_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT141_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT142_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT143_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT144_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT145_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT146_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT147_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT148_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT149_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT150_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT151_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT152_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT153_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT154_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT155_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT156_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT157_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT158_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT159_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT160_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT161_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT162_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT163_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT164_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT165_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT166_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT167_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT168_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT169_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT170_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT171_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT172_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT173_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT174_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT175_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT176_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT177_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT178_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT179_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT180_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT181_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT182_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT183_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT184_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT185_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT186_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT187_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT188_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT189_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT190_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT191_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT192_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT193_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT194_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT195_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT196_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT197_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT198_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT199_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT200_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT201_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT202_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT203_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT204_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT205_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT206_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT207_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT208_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT209_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT210_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT211_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT212_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT213_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT214_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT215_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT216_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT217_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT218_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT219_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT220_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT221_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT222_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT223_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT224_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT225_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT226_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT227_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT228_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT229_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT230_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT231_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT232_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT233_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT234_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT235_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT236_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT237_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT238_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT239_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT240_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT241_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT242_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT243_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT244_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT245_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT246_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT247_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT248_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT249_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT250_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT251_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT252_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT253_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT254_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_VS_CONSTANT255_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, + {R600_PS_SAMPLER0_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, + {R600_PS_SAMPLER1_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, + {R600_PS_SAMPLER2_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, + {R600_PS_SAMPLER3_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, + {R600_PS_SAMPLER4_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, + {R600_PS_SAMPLER5_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, + {R600_PS_SAMPLER6_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, + {R600_PS_SAMPLER7_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, + {R600_PS_SAMPLER8_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, + {R600_PS_SAMPLER9_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, + {R600_PS_SAMPLER10_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, + {R600_PS_SAMPLER11_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, + {R600_PS_SAMPLER12_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, + {R600_PS_SAMPLER13_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, + {R600_PS_SAMPLER14_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, + {R600_PS_SAMPLER15_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, + {R600_PS_SAMPLER16_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, + {R600_PS_SAMPLER17_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, + {R600_VS_SAMPLER0_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, + {R600_VS_SAMPLER1_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, + {R600_VS_SAMPLER2_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, + {R600_VS_SAMPLER3_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, + {R600_VS_SAMPLER4_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, + {R600_VS_SAMPLER5_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, + {R600_VS_SAMPLER6_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, + {R600_VS_SAMPLER7_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, + {R600_VS_SAMPLER8_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, + {R600_VS_SAMPLER9_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, + {R600_VS_SAMPLER10_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, + {R600_VS_SAMPLER11_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, + {R600_VS_SAMPLER12_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, + {R600_VS_SAMPLER13_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, + {R600_VS_SAMPLER14_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, + {R600_VS_SAMPLER15_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, + {R600_VS_SAMPLER16_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, + {R600_VS_SAMPLER17_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, + {R600_GS_SAMPLER0_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, + {R600_GS_SAMPLER1_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, + {R600_GS_SAMPLER2_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, + {R600_GS_SAMPLER3_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, + {R600_GS_SAMPLER4_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, + {R600_GS_SAMPLER5_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, + {R600_GS_SAMPLER6_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, + {R600_GS_SAMPLER7_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, + {R600_GS_SAMPLER8_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, + {R600_GS_SAMPLER9_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, + {R600_GS_SAMPLER10_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, + {R600_GS_SAMPLER11_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, + {R600_GS_SAMPLER12_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, + {R600_GS_SAMPLER13_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, + {R600_GS_SAMPLER14_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, + {R600_GS_SAMPLER15_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, + {R600_GS_SAMPLER16_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, + {R600_GS_SAMPLER17_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, + {R600_PS_SAMPLER_BORDER0_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, + {R600_PS_SAMPLER_BORDER1_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, + {R600_PS_SAMPLER_BORDER2_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, + {R600_PS_SAMPLER_BORDER3_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, + {R600_PS_SAMPLER_BORDER4_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, + {R600_PS_SAMPLER_BORDER5_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, + {R600_PS_SAMPLER_BORDER6_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, + {R600_PS_SAMPLER_BORDER7_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, + {R600_PS_SAMPLER_BORDER8_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, + {R600_PS_SAMPLER_BORDER9_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, + {R600_PS_SAMPLER_BORDER10_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, + {R600_PS_SAMPLER_BORDER11_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, + {R600_PS_SAMPLER_BORDER12_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, + {R600_PS_SAMPLER_BORDER13_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, + {R600_PS_SAMPLER_BORDER14_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, + {R600_PS_SAMPLER_BORDER15_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, + {R600_PS_SAMPLER_BORDER16_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, + {R600_PS_SAMPLER_BORDER17_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, + {R600_VS_SAMPLER_BORDER0_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, + {R600_VS_SAMPLER_BORDER1_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, + {R600_VS_SAMPLER_BORDER2_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, + {R600_VS_SAMPLER_BORDER3_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, + {R600_VS_SAMPLER_BORDER4_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, + {R600_VS_SAMPLER_BORDER5_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, + {R600_VS_SAMPLER_BORDER6_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, + {R600_VS_SAMPLER_BORDER7_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, + {R600_VS_SAMPLER_BORDER8_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, + {R600_VS_SAMPLER_BORDER9_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, + {R600_VS_SAMPLER_BORDER10_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, + {R600_VS_SAMPLER_BORDER11_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, + {R600_VS_SAMPLER_BORDER12_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, + {R600_VS_SAMPLER_BORDER13_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, + {R600_VS_SAMPLER_BORDER14_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, + {R600_VS_SAMPLER_BORDER15_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, + {R600_VS_SAMPLER_BORDER16_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, + {R600_VS_SAMPLER_BORDER17_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, + {R600_GS_SAMPLER_BORDER0_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, + {R600_GS_SAMPLER_BORDER1_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, + {R600_GS_SAMPLER_BORDER2_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, + {R600_GS_SAMPLER_BORDER3_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, + {R600_GS_SAMPLER_BORDER4_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, + {R600_GS_SAMPLER_BORDER5_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, + {R600_GS_SAMPLER_BORDER6_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, + {R600_GS_SAMPLER_BORDER7_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, + {R600_GS_SAMPLER_BORDER8_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, + {R600_GS_SAMPLER_BORDER9_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, + {R600_GS_SAMPLER_BORDER10_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, + {R600_GS_SAMPLER_BORDER11_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, + {R600_GS_SAMPLER_BORDER12_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, + {R600_GS_SAMPLER_BORDER13_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, + {R600_GS_SAMPLER_BORDER14_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, + {R600_GS_SAMPLER_BORDER15_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, + {R600_GS_SAMPLER_BORDER16_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, + {R600_GS_SAMPLER_BORDER17_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, + {R600_DRAW_AUTO_header_pm4, R600_DRAW_AUTO_header_cpm4, R600_DRAW_AUTO_state_pm4, R600_DRAW_AUTO_state_cpm4, 0, 0}, + {R600_DRAW_header_pm4, R600_DRAW_header_cpm4, R600_DRAW_state_pm4, R600_DRAW_state_cpm4, 0, 0} +}; diff --git a/src/gallium/winsys/r600/drm/r600_states.h b/src/gallium/winsys/r600/drm/r600_states.h deleted file mode 100644 index b5365e4275..0000000000 --- a/src/gallium/winsys/r600/drm/r600_states.h +++ /dev/null @@ -1,562 +0,0 @@ -/* - * Copyright © 2009 Jerome Glisse - * - * This file is free software; you can redistribute it and/or modify - * it under the terms of version 2 of the GNU General Public License - * as published by the Free Software Foundation. - * - * 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, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. - */ -#ifndef R600_STATES_H -#define R600_STATES_H - -static const struct radeon_register R600_CONFIG_names[] = { - {0x00008C00, 0, 0, "SQ_CONFIG"}, - {0x00008C04, 0, 0, "SQ_GPR_RESOURCE_MGMT_1"}, - {0x00008C08, 0, 0, "SQ_GPR_RESOURCE_MGMT_2"}, - {0x00008C0C, 0, 0, "SQ_THREAD_RESOURCE_MGMT"}, - {0x00008C10, 0, 0, "SQ_STACK_RESOURCE_MGMT_1"}, - {0x00008C14, 0, 0, "SQ_STACK_RESOURCE_MGMT_2"}, - {0x00008D8C, 0, 0, "SQ_DYN_GPR_CNTL_PS_FLUSH_REQ"}, - {0x00009508, 0, 0, "TA_CNTL_AUX"}, - {0x00009714, 0, 0, "VC_ENHANCE"}, - {0x00009830, 0, 0, "DB_DEBUG"}, - {0x00009838, 0, 0, "DB_WATERMARKS"}, - {0x00028350, 0, 0, "SX_MISC"}, - {0x000286C8, 0, 0, "SPI_THREAD_GROUPING"}, - {0x000287A0, 0, 0, "CB_SHADER_CONTROL"}, - {0x000288A8, 0, 0, "SQ_ESGS_RING_ITEMSIZE"}, - {0x000288AC, 0, 0, "SQ_GSVS_RING_ITEMSIZE"}, - {0x000288B0, 0, 0, "SQ_ESTMP_RING_ITEMSIZE"}, - {0x000288B4, 0, 0, "SQ_GSTMP_RING_ITEMSIZE"}, - {0x000288B8, 0, 0, "SQ_VSTMP_RING_ITEMSIZE"}, - {0x000288BC, 0, 0, "SQ_PSTMP_RING_ITEMSIZE"}, - {0x000288C0, 0, 0, "SQ_FBUF_RING_ITEMSIZE"}, - {0x000288C4, 0, 0, "SQ_REDUC_RING_ITEMSIZE"}, - {0x000288C8, 0, 0, "SQ_GS_VERT_ITEMSIZE"}, - {0x00028A10, 0, 0, "VGT_OUTPUT_PATH_CNTL"}, - {0x00028A14, 0, 0, "VGT_HOS_CNTL"}, - {0x00028A18, 0, 0, "VGT_HOS_MAX_TESS_LEVEL"}, - {0x00028A1C, 0, 0, "VGT_HOS_MIN_TESS_LEVEL"}, - {0x00028A20, 0, 0, "VGT_HOS_REUSE_DEPTH"}, - {0x00028A24, 0, 0, "VGT_GROUP_PRIM_TYPE"}, - {0x00028A28, 0, 0, "VGT_GROUP_FIRST_DECR"}, - {0x00028A2C, 0, 0, "VGT_GROUP_DECR"}, - {0x00028A30, 0, 0, "VGT_GROUP_VECT_0_CNTL"}, - {0x00028A34, 0, 0, "VGT_GROUP_VECT_1_CNTL"}, - {0x00028A38, 0, 0, "VGT_GROUP_VECT_0_FMT_CNTL"}, - {0x00028A3C, 0, 0, "VGT_GROUP_VECT_1_FMT_CNTL"}, - {0x00028A40, 0, 0, "VGT_GS_MODE"}, - {0x00028A4C, 0, 0, "PA_SC_MODE_CNTL"}, - {0x00028AB0, 0, 0, "VGT_STRMOUT_EN"}, - {0x00028AB4, 0, 0, "VGT_REUSE_OFF"}, - {0x00028AB8, 0, 0, "VGT_VTX_CNT_EN"}, - {0x00028B20, 0, 0, "VGT_STRMOUT_BUFFER_EN"}, -}; - -static const struct radeon_register R600_CB_CNTL_names[] = { - {0x00028120, 0, 0, "CB_CLEAR_RED"}, - {0x00028124, 0, 0, "CB_CLEAR_GREEN"}, - {0x00028128, 0, 0, "CB_CLEAR_BLUE"}, - {0x0002812C, 0, 0, "CB_CLEAR_ALPHA"}, - {0x0002823C, 0, 0, "CB_SHADER_MASK"}, - {0x00028238, 0, 0, "CB_TARGET_MASK"}, - {0x00028424, 0, 0, "CB_FOG_RED"}, - {0x00028428, 0, 0, "CB_FOG_GREEN"}, - {0x0002842C, 0, 0, "CB_FOG_BLUE"}, - {0x00028808, 0, 0, "CB_COLOR_CONTROL"}, - {0x00028C04, 0, 0, "PA_SC_AA_CONFIG"}, - {0x00028C1C, 0, 0, "PA_SC_AA_SAMPLE_LOCS_MCTX"}, - {0x00028C20, 0, 0, "PA_SC_AA_SAMPLE_LOCS_8S_WD1_MCTX"}, - {0x00028C30, 0, 0, "CB_CLRCMP_CONTROL"}, - {0x00028C34, 0, 0, "CB_CLRCMP_SRC"}, - {0x00028C38, 0, 0, "CB_CLRCMP_DST"}, - {0x00028C3C, 0, 0, "CB_CLRCMP_MSK"}, - {0x00028C48, 0, 0, "PA_SC_AA_MASK"}, -}; - -static const struct radeon_register R600_RASTERIZER_names[] = { - {0x000286D4, 0, 0, "SPI_INTERP_CONTROL_0"}, - {0x00028810, 0, 0, "PA_CL_CLIP_CNTL"}, - {0x00028814, 0, 0, "PA_SU_SC_MODE_CNTL"}, - {0x0002881C, 0, 0, "PA_CL_VS_OUT_CNTL"}, - {0x00028820, 0, 0, "PA_CL_NANINF_CNTL"}, - {0x00028A00, 0, 0, "PA_SU_POINT_SIZE"}, - {0x00028A04, 0, 0, "PA_SU_POINT_MINMAX"}, - {0x00028A08, 0, 0, "PA_SU_LINE_CNTL"}, - {0x00028A0C, 0, 0, "PA_SC_LINE_STIPPLE"}, - {0x00028A48, 0, 0, "PA_SC_MPASS_PS_CNTL"}, - {0x00028C00, 0, 0, "PA_SC_LINE_CNTL"}, - {0x00028C0C, 0, 0, "PA_CL_GB_VERT_CLIP_ADJ"}, - {0x00028C10, 0, 0, "PA_CL_GB_VERT_DISC_ADJ"}, - {0x00028C14, 0, 0, "PA_CL_GB_HORZ_CLIP_ADJ"}, - {0x00028C18, 0, 0, "PA_CL_GB_HORZ_DISC_ADJ"}, - {0x00028DF8, 0, 0, "PA_SU_POLY_OFFSET_DB_FMT_CNTL"}, - {0x00028DFC, 0, 0, "PA_SU_POLY_OFFSET_CLAMP"}, - {0x00028E00, 0, 0, "PA_SU_POLY_OFFSET_FRONT_SCALE"}, - {0x00028E04, 0, 0, "PA_SU_POLY_OFFSET_FRONT_OFFSET"}, - {0x00028E08, 0, 0, "PA_SU_POLY_OFFSET_BACK_SCALE"}, - {0x00028E0C, 0, 0, "PA_SU_POLY_OFFSET_BACK_OFFSET"}, -}; - -static const struct radeon_register R600_VIEWPORT_names[] = { - {0x000282D0, 0, 0, "PA_SC_VPORT_ZMIN_0"}, - {0x000282D4, 0, 0, "PA_SC_VPORT_ZMAX_0"}, - {0x0002843C, 0, 0, "PA_CL_VPORT_XSCALE_0"}, - {0x00028444, 0, 0, "PA_CL_VPORT_YSCALE_0"}, - {0x0002844C, 0, 0, "PA_CL_VPORT_ZSCALE_0"}, - {0x00028440, 0, 0, "PA_CL_VPORT_XOFFSET_0"}, - {0x00028448, 0, 0, "PA_CL_VPORT_YOFFSET_0"}, - {0x00028450, 0, 0, "PA_CL_VPORT_ZOFFSET_0"}, - {0x00028818, 0, 0, "PA_CL_VTE_CNTL"}, -}; - -static const struct radeon_register R600_SCISSOR_names[] = { - {0x00028030, 0, 0, "PA_SC_SCREEN_SCISSOR_TL"}, - {0x00028034, 0, 0, "PA_SC_SCREEN_SCISSOR_BR"}, - {0x00028200, 0, 0, "PA_SC_WINDOW_OFFSET"}, - {0x00028204, 0, 0, "PA_SC_WINDOW_SCISSOR_TL"}, - {0x00028208, 0, 0, "PA_SC_WINDOW_SCISSOR_BR"}, - {0x0002820C, 0, 0, "PA_SC_CLIPRECT_RULE"}, - {0x00028210, 0, 0, "PA_SC_CLIPRECT_0_TL"}, - {0x00028214, 0, 0, "PA_SC_CLIPRECT_0_BR"}, - {0x00028218, 0, 0, "PA_SC_CLIPRECT_1_TL"}, - {0x0002821C, 0, 0, "PA_SC_CLIPRECT_1_BR"}, - {0x00028220, 0, 0, "PA_SC_CLIPRECT_2_TL"}, - {0x00028224, 0, 0, "PA_SC_CLIPRECT_2_BR"}, - {0x00028228, 0, 0, "PA_SC_CLIPRECT_3_TL"}, - {0x0002822C, 0, 0, "PA_SC_CLIPRECT_3_BR"}, - {0x00028230, 0, 0, "PA_SC_EDGERULE"}, - {0x00028240, 0, 0, "PA_SC_GENERIC_SCISSOR_TL"}, - {0x00028244, 0, 0, "PA_SC_GENERIC_SCISSOR_BR"}, - {0x00028250, 0, 0, "PA_SC_VPORT_SCISSOR_0_TL"}, - {0x00028254, 0, 0, "PA_SC_VPORT_SCISSOR_0_BR"}, -}; - -static const struct radeon_register R600_BLEND_names[] = { - {0x00028414, 0, 0, "CB_BLEND_RED"}, - {0x00028418, 0, 0, "CB_BLEND_GREEN"}, - {0x0002841C, 0, 0, "CB_BLEND_BLUE"}, - {0x00028420, 0, 0, "CB_BLEND_ALPHA"}, - {0x00028780, 0, 0, "CB_BLEND0_CONTROL"}, - {0x00028784, 0, 0, "CB_BLEND1_CONTROL"}, - {0x00028788, 0, 0, "CB_BLEND2_CONTROL"}, - {0x0002878C, 0, 0, "CB_BLEND3_CONTROL"}, - {0x00028790, 0, 0, "CB_BLEND4_CONTROL"}, - {0x00028794, 0, 0, "CB_BLEND5_CONTROL"}, - {0x00028798, 0, 0, "CB_BLEND6_CONTROL"}, - {0x0002879C, 0, 0, "CB_BLEND7_CONTROL"}, - {0x00028804, 0, 0, "CB_BLEND_CONTROL"}, -}; - -static const struct radeon_register R600_DSA_names[] = { - {0x00028028, 0, 0, "DB_STENCIL_CLEAR"}, - {0x0002802C, 0, 0, "DB_DEPTH_CLEAR"}, - {0x00028410, 0, 0, "SX_ALPHA_TEST_CONTROL"}, - {0x00028430, 0, 0, "DB_STENCILREFMASK"}, - {0x00028434, 0, 0, "DB_STENCILREFMASK_BF"}, - {0x00028438, 0, 0, "SX_ALPHA_REF"}, - {0x000286E0, 0, 0, "SPI_FOG_FUNC_SCALE"}, - {0x000286E4, 0, 0, "SPI_FOG_FUNC_BIAS"}, - {0x000286DC, 0, 0, "SPI_FOG_CNTL"}, - {0x00028800, 0, 0, "DB_DEPTH_CONTROL"}, - {0x0002880C, 0, 0, "DB_SHADER_CONTROL"}, - {0x00028D0C, 0, 0, "DB_RENDER_CONTROL"}, - {0x00028D10, 0, 0, "DB_RENDER_OVERRIDE"}, - {0x00028D2C, 0, 0, "DB_SRESULTS_COMPARE_STATE1"}, - {0x00028D30, 0, 0, "DB_PRELOAD_CONTROL"}, - {0x00028D44, 0, 0, "DB_ALPHA_TO_MASK"}, -}; - -static const struct radeon_register R600_VS_SHADER_names[] = { - {0x00028380, 0, 0, "SQ_VTX_SEMANTIC_0"}, - {0x00028384, 0, 0, "SQ_VTX_SEMANTIC_1"}, - {0x00028388, 0, 0, "SQ_VTX_SEMANTIC_2"}, - {0x0002838C, 0, 0, "SQ_VTX_SEMANTIC_3"}, - {0x00028390, 0, 0, "SQ_VTX_SEMANTIC_4"}, - {0x00028394, 0, 0, "SQ_VTX_SEMANTIC_5"}, - {0x00028398, 0, 0, "SQ_VTX_SEMANTIC_6"}, - {0x0002839C, 0, 0, "SQ_VTX_SEMANTIC_7"}, - {0x000283A0, 0, 0, "SQ_VTX_SEMANTIC_8"}, - {0x000283A4, 0, 0, "SQ_VTX_SEMANTIC_9"}, - {0x000283A8, 0, 0, "SQ_VTX_SEMANTIC_10"}, - {0x000283AC, 0, 0, "SQ_VTX_SEMANTIC_11"}, - {0x000283B0, 0, 0, "SQ_VTX_SEMANTIC_12"}, - {0x000283B4, 0, 0, "SQ_VTX_SEMANTIC_13"}, - {0x000283B8, 0, 0, "SQ_VTX_SEMANTIC_14"}, - {0x000283BC, 0, 0, "SQ_VTX_SEMANTIC_15"}, - {0x000283C0, 0, 0, "SQ_VTX_SEMANTIC_16"}, - {0x000283C4, 0, 0, "SQ_VTX_SEMANTIC_17"}, - {0x000283C8, 0, 0, "SQ_VTX_SEMANTIC_18"}, - {0x000283CC, 0, 0, "SQ_VTX_SEMANTIC_19"}, - {0x000283D0, 0, 0, "SQ_VTX_SEMANTIC_20"}, - {0x000283D4, 0, 0, "SQ_VTX_SEMANTIC_21"}, - {0x000283D8, 0, 0, "SQ_VTX_SEMANTIC_22"}, - {0x000283DC, 0, 0, "SQ_VTX_SEMANTIC_23"}, - {0x000283E0, 0, 0, "SQ_VTX_SEMANTIC_24"}, - {0x000283E4, 0, 0, "SQ_VTX_SEMANTIC_25"}, - {0x000283E8, 0, 0, "SQ_VTX_SEMANTIC_26"}, - {0x000283EC, 0, 0, "SQ_VTX_SEMANTIC_27"}, - {0x000283F0, 0, 0, "SQ_VTX_SEMANTIC_28"}, - {0x000283F4, 0, 0, "SQ_VTX_SEMANTIC_29"}, - {0x000283F8, 0, 0, "SQ_VTX_SEMANTIC_30"}, - {0x000283FC, 0, 0, "SQ_VTX_SEMANTIC_31"}, - {0x00028614, 0, 0, "SPI_VS_OUT_ID_0"}, - {0x00028618, 0, 0, "SPI_VS_OUT_ID_1"}, - {0x0002861C, 0, 0, "SPI_VS_OUT_ID_2"}, - {0x00028620, 0, 0, "SPI_VS_OUT_ID_3"}, - {0x00028624, 0, 0, "SPI_VS_OUT_ID_4"}, - {0x00028628, 0, 0, "SPI_VS_OUT_ID_5"}, - {0x0002862C, 0, 0, "SPI_VS_OUT_ID_6"}, - {0x00028630, 0, 0, "SPI_VS_OUT_ID_7"}, - {0x00028634, 0, 0, "SPI_VS_OUT_ID_8"}, - {0x00028638, 0, 0, "SPI_VS_OUT_ID_9"}, - {0x000286C4, 0, 0, "SPI_VS_OUT_CONFIG"}, - {0x00028858, 1, 0, "SQ_PGM_START_VS"}, - {0x00028868, 0, 0, "SQ_PGM_RESOURCES_VS"}, - {0x00028894, 1, 1, "SQ_PGM_START_FS"}, - {0x000288A4, 0, 0, "SQ_PGM_RESOURCES_FS"}, - {0x000288D0, 0, 0, "SQ_PGM_CF_OFFSET_VS"}, - {0x000288DC, 0, 0, "SQ_PGM_CF_OFFSET_FS"}, -}; - -static const struct radeon_register R600_PS_SHADER_names[] = { - {0x00028644, 0, 0, "SPI_PS_INPUT_CNTL_0"}, - {0x00028648, 0, 0, "SPI_PS_INPUT_CNTL_1"}, - {0x0002864C, 0, 0, "SPI_PS_INPUT_CNTL_2"}, - {0x00028650, 0, 0, "SPI_PS_INPUT_CNTL_3"}, - {0x00028654, 0, 0, "SPI_PS_INPUT_CNTL_4"}, - {0x00028658, 0, 0, "SPI_PS_INPUT_CNTL_5"}, - {0x0002865C, 0, 0, "SPI_PS_INPUT_CNTL_6"}, - {0x00028660, 0, 0, "SPI_PS_INPUT_CNTL_7"}, - {0x00028664, 0, 0, "SPI_PS_INPUT_CNTL_8"}, - {0x00028668, 0, 0, "SPI_PS_INPUT_CNTL_9"}, - {0x0002866C, 0, 0, "SPI_PS_INPUT_CNTL_10"}, - {0x00028670, 0, 0, "SPI_PS_INPUT_CNTL_11"}, - {0x00028674, 0, 0, "SPI_PS_INPUT_CNTL_12"}, - {0x00028678, 0, 0, "SPI_PS_INPUT_CNTL_13"}, - {0x0002867C, 0, 0, "SPI_PS_INPUT_CNTL_14"}, - {0x00028680, 0, 0, "SPI_PS_INPUT_CNTL_15"}, - {0x00028684, 0, 0, "SPI_PS_INPUT_CNTL_16"}, - {0x00028688, 0, 0, "SPI_PS_INPUT_CNTL_17"}, - {0x0002868C, 0, 0, "SPI_PS_INPUT_CNTL_18"}, - {0x00028690, 0, 0, "SPI_PS_INPUT_CNTL_19"}, - {0x00028694, 0, 0, "SPI_PS_INPUT_CNTL_20"}, - {0x00028698, 0, 0, "SPI_PS_INPUT_CNTL_21"}, - {0x0002869C, 0, 0, "SPI_PS_INPUT_CNTL_22"}, - {0x000286A0, 0, 0, "SPI_PS_INPUT_CNTL_23"}, - {0x000286A4, 0, 0, "SPI_PS_INPUT_CNTL_24"}, - {0x000286A8, 0, 0, "SPI_PS_INPUT_CNTL_25"}, - {0x000286AC, 0, 0, "SPI_PS_INPUT_CNTL_26"}, - {0x000286B0, 0, 0, "SPI_PS_INPUT_CNTL_27"}, - {0x000286B4, 0, 0, "SPI_PS_INPUT_CNTL_28"}, - {0x000286B8, 0, 0, "SPI_PS_INPUT_CNTL_29"}, - {0x000286BC, 0, 0, "SPI_PS_INPUT_CNTL_30"}, - {0x000286C0, 0, 0, "SPI_PS_INPUT_CNTL_31"}, - {0x000286CC, 0, 0, "SPI_PS_IN_CONTROL_0"}, - {0x000286D0, 0, 0, "SPI_PS_IN_CONTROL_1"}, - {0x000286D8, 0, 0, "SPI_INPUT_Z"}, - {0x00028840, 1, 0, "SQ_PGM_START_PS"}, - {0x00028850, 0, 0, "SQ_PGM_RESOURCES_PS"}, - {0x00028854, 0, 0, "SQ_PGM_EXPORTS_PS"}, - {0x000288CC, 0, 0, "SQ_PGM_CF_OFFSET_PS"}, -}; - -static const struct radeon_register R600_PS_CONSTANT_names[] = { - {0x00030000, 0, 0, "SQ_ALU_CONSTANT0_0"}, - {0x00030004, 0, 0, "SQ_ALU_CONSTANT1_0"}, - {0x00030008, 0, 0, "SQ_ALU_CONSTANT2_0"}, - {0x0003000C, 0, 0, "SQ_ALU_CONSTANT3_0"}, -}; - -static const struct radeon_register R600_VS_CONSTANT_names[] = { - {0x00031000, 0, 0, "SQ_ALU_CONSTANT0_256"}, - {0x00031004, 0, 0, "SQ_ALU_CONSTANT1_256"}, - {0x00031008, 0, 0, "SQ_ALU_CONSTANT2_256"}, - {0x0003100C, 0, 0, "SQ_ALU_CONSTANT3_256"}, -}; - -static const struct radeon_register R600_UCP_names[] = { - {0x00028e20, 0, 0, "PA_CL_UCP0_X"}, - {0x00028e24, 0, 0, "PA_CL_UCP0_Y"}, - {0x00028e28, 0, 0, "PA_CL_UCP0_Z"}, - {0x00028e2c, 0, 0, "PA_CL_UCP0_W"}, -}; - -static const struct radeon_register R600_PS_RESOURCE_names[] = { - {0x00038000, 0, 0, "RESOURCE0_WORD0"}, - {0x00038004, 0, 0, "RESOURCE0_WORD1"}, - {0x00038008, 0, 0, "RESOURCE0_WORD2"}, - {0x0003800C, 0, 0, "RESOURCE0_WORD3"}, - {0x00038010, 0, 0, "RESOURCE0_WORD4"}, - {0x00038014, 0, 0, "RESOURCE0_WORD5"}, - {0x00038018, 0, 0, "RESOURCE0_WORD6"}, -}; - -static const struct radeon_register R600_VS_RESOURCE_names[] = { - {0x00039180, 0, 0, "RESOURCE160_WORD0"}, - {0x00039184, 0, 0, "RESOURCE160_WORD1"}, - {0x00039188, 0, 0, "RESOURCE160_WORD2"}, - {0x0003918C, 0, 0, "RESOURCE160_WORD3"}, - {0x00039190, 0, 0, "RESOURCE160_WORD4"}, - {0x00039194, 0, 0, "RESOURCE160_WORD5"}, - {0x00039198, 0, 0, "RESOURCE160_WORD6"}, -}; - -static const struct radeon_register R600_FS_RESOURCE_names[] = { - {0x0003A300, 0, 0, "RESOURCE320_WORD0"}, - {0x0003A304, 0, 0, "RESOURCE320_WORD1"}, - {0x0003A308, 0, 0, "RESOURCE320_WORD2"}, - {0x0003A30C, 0, 0, "RESOURCE320_WORD3"}, - {0x0003A310, 0, 0, "RESOURCE320_WORD4"}, - {0x0003A314, 0, 0, "RESOURCE320_WORD5"}, - {0x0003A318, 0, 0, "RESOURCE320_WORD6"}, -}; - -static const struct radeon_register R600_GS_RESOURCE_names[] = { - {0x0003A4C0, 0, 0, "RESOURCE336_WORD0"}, - {0x0003A4C4, 0, 0, "RESOURCE336_WORD1"}, - {0x0003A4C8, 0, 0, "RESOURCE336_WORD2"}, - {0x0003A4CC, 0, 0, "RESOURCE336_WORD3"}, - {0x0003A4D0, 0, 0, "RESOURCE336_WORD4"}, - {0x0003A4D4, 0, 0, "RESOURCE336_WORD5"}, - {0x0003A4D8, 0, 0, "RESOURCE336_WORD6"}, -}; - -static const struct radeon_register R600_PS_SAMPLER_names[] = { - {0x0003C000, 0, 0, "SQ_TEX_SAMPLER_WORD0_0"}, - {0x0003C004, 0, 0, "SQ_TEX_SAMPLER_WORD1_0"}, - {0x0003C008, 0, 0, "SQ_TEX_SAMPLER_WORD2_0"}, -}; - -static const struct radeon_register R600_VS_SAMPLER_names[] = { - {0x0003C0D8, 0, 0, "SQ_TEX_SAMPLER_WORD0_18"}, - {0x0003C0DC, 0, 0, "SQ_TEX_SAMPLER_WORD1_18"}, - {0x0003C0E0, 0, 0, "SQ_TEX_SAMPLER_WORD2_18"}, -}; - -static const struct radeon_register R600_GS_SAMPLER_names[] = { - {0x0003C1B0, 0, 0, "SQ_TEX_SAMPLER_WORD0_36"}, - {0x0003C1B4, 0, 0, "SQ_TEX_SAMPLER_WORD1_36"}, - {0x0003C1B8, 0, 0, "SQ_TEX_SAMPLER_WORD2_36"}, -}; - -static const struct radeon_register R600_PS_SAMPLER_BORDER_names[] = { - {0x0000A400, 0, 0, "TD_PS_SAMPLER0_BORDER_RED"}, - {0x0000A404, 0, 0, "TD_PS_SAMPLER0_BORDER_GREEN"}, - {0x0000A408, 0, 0, "TD_PS_SAMPLER0_BORDER_BLUE"}, - {0x0000A40C, 0, 0, "TD_PS_SAMPLER0_BORDER_ALPHA"}, -}; - -static const struct radeon_register R600_VS_SAMPLER_BORDER_names[] = { - {0x0000A600, 0, 0, "TD_VS_SAMPLER0_BORDER_RED"}, - {0x0000A604, 0, 0, "TD_VS_SAMPLER0_BORDER_GREEN"}, - {0x0000A608, 0, 0, "TD_VS_SAMPLER0_BORDER_BLUE"}, - {0x0000A60C, 0, 0, "TD_VS_SAMPLER0_BORDER_ALPHA"}, -}; - -static const struct radeon_register R600_GS_SAMPLER_BORDER_names[] = { - {0x0000A800, 0, 0, "TD_GS_SAMPLER0_BORDER_RED"}, - {0x0000A804, 0, 0, "TD_GS_SAMPLER0_BORDER_GREEN"}, - {0x0000A808, 0, 0, "TD_GS_SAMPLER0_BORDER_BLUE"}, - {0x0000A80C, 0, 0, "TD_GS_SAMPLER0_BORDER_ALPHA"}, -}; - -static const struct radeon_register R600_CB0_names[] = { - {0x00028040, 1, 0, "CB_COLOR0_BASE"}, - {0x000280A0, 0, 0, "CB_COLOR0_INFO"}, - {0x00028060, 0, 0, "CB_COLOR0_SIZE"}, - {0x00028080, 0, 0, "CB_COLOR0_VIEW"}, - {0x000280E0, 1, 1, "CB_COLOR0_FRAG"}, - {0x000280C0, 1, 2, "CB_COLOR0_TILE"}, - {0x00028100, 0, 0, "CB_COLOR0_MASK"}, -}; - -static const struct radeon_register R600_CB1_names[] = { - {0x00028044, 1, 0, "CB_COLOR1_BASE"}, - {0x000280A4, 0, 0, "CB_COLOR1_INFO"}, - {0x00028064, 0, 0, "CB_COLOR1_SIZE"}, - {0x00028084, 0, 0, "CB_COLOR1_VIEW"}, - {0x000280E4, 1, 1, "CB_COLOR1_FRAG"}, - {0x000280C4, 1, 2, "CB_COLOR1_TILE"}, - {0x00028104, 0, 0, "CB_COLOR1_MASK"}, -}; - -static const struct radeon_register R600_CB2_names[] = { - {0x00028048, 1, 0, "CB_COLOR2_BASE"}, - {0x000280A8, 0, 0, "CB_COLOR2_INFO"}, - {0x00028068, 0, 0, "CB_COLOR2_SIZE"}, - {0x00028088, 0, 0, "CB_COLOR2_VIEW"}, - {0x000280E8, 1, 1, "CB_COLOR2_FRAG"}, - {0x000280C8, 1, 2, "CB_COLOR2_TILE"}, - {0x00028108, 0, 0, "CB_COLOR2_MASK"}, -}; - -static const struct radeon_register R600_CB3_names[] = { - {0x0002804C, 1, 0, "CB_COLOR3_BASE"}, - {0x000280AC, 0, 0, "CB_COLOR3_INFO"}, - {0x0002806C, 0, 0, "CB_COLOR3_SIZE"}, - {0x0002808C, 0, 0, "CB_COLOR3_VIEW"}, - {0x000280EC, 1, 1, "CB_COLOR3_FRAG"}, - {0x000280CC, 1, 2, "CB_COLOR3_TILE"}, - {0x0002810C, 0, 0, "CB_COLOR3_MASK"}, -}; - -static const struct radeon_register R600_CB4_names[] = { - {0x00028050, 1, 0, "CB_COLOR4_BASE"}, - {0x000280B0, 0, 0, "CB_COLOR4_INFO"}, - {0x00028070, 0, 0, "CB_COLOR4_SIZE"}, - {0x00028090, 0, 0, "CB_COLOR4_VIEW"}, - {0x000280F0, 1, 1, "CB_COLOR4_FRAG"}, - {0x000280D0, 1, 2, "CB_COLOR4_TILE"}, - {0x00028110, 0, 0, "CB_COLOR4_MASK"}, -}; - -static const struct radeon_register R600_CB5_names[] = { - {0x00028054, 1, 0, "CB_COLOR5_BASE"}, - {0x000280B4, 0, 0, "CB_COLOR5_INFO"}, - {0x00028074, 0, 0, "CB_COLOR5_SIZE"}, - {0x00028094, 0, 0, "CB_COLOR5_VIEW"}, - {0x000280F4, 1, 1, "CB_COLOR5_FRAG"}, - {0x000280D4, 1, 2, "CB_COLOR5_TILE"}, - {0x00028114, 0, 0, "CB_COLOR5_MASK"}, -}; - -static const struct radeon_register R600_CB6_names[] = { - {0x00028058, 1, 0, "CB_COLOR6_BASE"}, - {0x000280B8, 0, 0, "CB_COLOR6_INFO"}, - {0x00028078, 0, 0, "CB_COLOR6_SIZE"}, - {0x00028098, 0, 0, "CB_COLOR6_VIEW"}, - {0x000280F8, 1, 1, "CB_COLOR6_FRAG"}, - {0x000280D8, 1, 2, "CB_COLOR6_TILE"}, - {0x00028118, 0, 0, "CB_COLOR6_MASK"}, -}; - -static const struct radeon_register R600_CB7_names[] = { - {0x0002805C, 1, 0, "CB_COLOR7_BASE"}, - {0x000280BC, 0, 0, "CB_COLOR7_INFO"}, - {0x0002807C, 0, 0, "CB_COLOR7_SIZE"}, - {0x0002809C, 0, 0, "CB_COLOR7_VIEW"}, - {0x000280FC, 1, 1, "CB_COLOR7_FRAG"}, - {0x000280DC, 1, 2, "CB_COLOR7_TILE"}, - {0x0002811C, 0, 0, "CB_COLOR7_MASK"}, -}; - -static const struct radeon_register R600_DB_names[] = { - {0x0002800C, 1, 0, "DB_DEPTH_BASE"}, - {0x00028000, 0, 0, "DB_DEPTH_SIZE"}, - {0x00028004, 0, 0, "DB_DEPTH_VIEW"}, - {0x00028010, 0, 0, "DB_DEPTH_INFO"}, - {0x00028D24, 0, 0, "DB_HTILE_SURFACE"}, - {0x00028D34, 0, 0, "DB_PREFETCH_LIMIT"}, -}; - -static const struct radeon_register R600_VGT_names[] = { - {0x00008958, 0, 0, "VGT_PRIMITIVE_TYPE"}, - {0x00028400, 0, 0, "VGT_MAX_VTX_INDX"}, - {0x00028404, 0, 0, "VGT_MIN_VTX_INDX"}, - {0x00028408, 0, 0, "VGT_INDX_OFFSET"}, - {0x0002840C, 0, 0, "VGT_MULTI_PRIM_IB_RESET_INDX"}, - {0x00028A7C, 0, 0, "VGT_DMA_INDEX_TYPE"}, - {0x00028A84, 0, 0, "VGT_PRIMITIVEID_EN"}, - {0x00028A88, 0, 0, "VGT_DMA_NUM_INSTANCES"}, - {0x00028A94, 0, 0, "VGT_MULTI_PRIM_IB_RESET_EN"}, - {0x00028AA0, 0, 0, "VGT_INSTANCE_STEP_RATE_0"}, - {0x00028AA4, 0, 0, "VGT_INSTANCE_STEP_RATE_1"}, -}; - -static const struct radeon_register R600_DRAW_names[] = { - {0x00008970, 0, 0, "VGT_NUM_INDICES"}, - {0x000287E4, 0, 0, "VGT_DMA_BASE_HI"}, - {0x000287E8, 1, 0, "VGT_DMA_BASE"}, - {0x000287F0, 0, 0, "VGT_DRAW_INITIATOR"}, -}; - -static const struct radeon_register R600_VGT_EVENT_names[] = { - {0x00028A90, 1, 0, "VGT_EVENT_INITIATOR"}, -}; - -static struct radeon_type R600_types[] = { - { 128, 0, 0x00000000, 0x00000000, 0x0000, 0, "R600_CONFIG", 41, r600_state_pm4_config, R600_CONFIG_names}, - { 128, 1, 0x00000000, 0x00000000, 0x0000, 0, "R600_CB_CNTL", 18, r600_state_pm4_generic, R600_CB_CNTL_names}, - { 128, 2, 0x00000000, 0x00000000, 0x0000, 0, "R600_RASTERIZER", 21, r600_state_pm4_generic, R600_RASTERIZER_names}, - { 128, 3, 0x00000000, 0x00000000, 0x0000, 0, "R600_VIEWPORT", 9, r600_state_pm4_generic, R600_VIEWPORT_names}, - { 128, 4, 0x00000000, 0x00000000, 0x0000, 0, "R600_SCISSOR", 19, r600_state_pm4_generic, R600_SCISSOR_names}, - { 128, 5, 0x00000000, 0x00000000, 0x0000, 0, "R600_BLEND", 13, r600_state_pm4_generic, R600_BLEND_names}, - { 128, 6, 0x00000000, 0x00000000, 0x0000, 0, "R600_DSA", 16, r600_state_pm4_generic, R600_DSA_names}, - { 128, 7, 0x00000000, 0x00000000, 0x0000, 0, "R600_VS_SHADER", 49, r600_state_pm4_shader, R600_VS_SHADER_names}, - { 128, 8, 0x00000000, 0x00000000, 0x0000, 0, "R600_PS_SHADER", 39, r600_state_pm4_shader, R600_PS_SHADER_names}, - { 128, 9, 0x00030000, 0x00031000, 0x0010, 0, "R600_PS_CONSTANT", 4, r600_state_pm4_generic, R600_PS_CONSTANT_names}, - { 128, 265, 0x00031000, 0x00032000, 0x0010, 0, "R600_VS_CONSTANT", 4, r600_state_pm4_generic, R600_VS_CONSTANT_names}, - { 128, 521, 0x00038000, 0x00039180, 0x001C, 0, "R600_PS_RESOURCE", 7, r600_state_pm4_resource, R600_PS_RESOURCE_names}, - { 128, 681, 0x00039180, 0x0003A300, 0x001C, 0, "R600_VS_RESOURCE", 7, r600_state_pm4_resource, R600_VS_RESOURCE_names}, - { 128, 841, 0x00039180, 0x0003A300, 0x001C, 0, "R600_FS_RESOURCE", 7, r600_state_pm4_resource, R600_FS_RESOURCE_names}, - { 128, 1001, 0x00039180, 0x0003A300, 0x001C, 0, "R600_GS_RESOURCE", 7, r600_state_pm4_resource, R600_GS_RESOURCE_names}, - { 128, 1161, 0x0003C000, 0x0003C0D8, 0x000C, 0, "R600_PS_SAMPLER", 3, r600_state_pm4_generic, R600_PS_SAMPLER_names}, - { 128, 1179, 0x0003C0D8, 0x0003C1B0, 0x000C, 0, "R600_VS_SAMPLER", 3, r600_state_pm4_generic, R600_VS_SAMPLER_names}, - { 128, 1197, 0x0003C1B0, 0x0003C288, 0x000C, 0, "R600_GS_SAMPLER", 3, r600_state_pm4_generic, R600_GS_SAMPLER_names}, - { 128, 1215, 0x0000A400, 0x0000A520, 0x0010, 0, "R600_PS_SAMPLER_BORDER", 4, r600_state_pm4_generic, R600_PS_SAMPLER_BORDER_names}, - { 128, 1233, 0x0000A600, 0x0000A720, 0x0010, 0, "R600_VS_SAMPLER_BORDER", 4, r600_state_pm4_generic, R600_VS_SAMPLER_BORDER_names}, - { 128, 1251, 0x0000A800, 0x0000A920, 0x0010, 0, "R600_GS_SAMPLER_BORDER", 4, r600_state_pm4_generic, R600_GS_SAMPLER_BORDER_names}, - { 128, 1269, 0x00000000, 0x00000000, 0x0000, 0, "R600_CB0", 7, r600_state_pm4_cb0, R600_CB0_names}, - { 128, 1270, 0x00000000, 0x00000000, 0x0000, 0, "R600_CB1", 7, r600_state_pm4_cb0, R600_CB1_names}, - { 128, 1271, 0x00000000, 0x00000000, 0x0000, 0, "R600_CB2", 7, r600_state_pm4_cb0, R600_CB2_names}, - { 128, 1272, 0x00000000, 0x00000000, 0x0000, 0, "R600_CB3", 7, r600_state_pm4_cb0, R600_CB3_names}, - { 128, 1273, 0x00000000, 0x00000000, 0x0000, 0, "R600_CB4", 7, r600_state_pm4_cb0, R600_CB4_names}, - { 128, 1274, 0x00000000, 0x00000000, 0x0000, 0, "R600_CB5", 7, r600_state_pm4_cb0, R600_CB5_names}, - { 128, 1275, 0x00000000, 0x00000000, 0x0000, 0, "R600_CB6", 7, r600_state_pm4_cb0, R600_CB6_names}, - { 128, 1276, 0x00000000, 0x00000000, 0x0000, 0, "R600_CB7", 7, r600_state_pm4_cb0, R600_CB7_names}, - { 128, 1277, 0x00000000, 0x00000000, 0x0000, 0, "R600_QUERY_BEGIN", 1, r600_state_pm4_query_begin, R600_VGT_EVENT_names}, - { 128, 1278, 0x00000000, 0x00000000, 0x0000, 0, "R600_QUERY_END", 1, r600_state_pm4_query_end, R600_VGT_EVENT_names}, - { 128, 1279, 0x00000000, 0x00000000, 0x0000, 0, "R600_DB", 6, r600_state_pm4_db, R600_DB_names}, - { 128, 1280, 0x00028e20, 0x00028e70, 0x0010, 0, "R600_UCP", 4, r600_state_pm4_generic, R600_UCP_names}, - { 128, 1286, 0x00000000, 0x00000000, 0x0000, 0, "R600_VGT", 11, r600_state_pm4_vgt, R600_VGT_names}, - { 128, 1287, 0x00000000, 0x00000000, 0x0000, 0, "R600_DRAW", 4, r600_state_pm4_draw, R600_DRAW_names}, -}; - -static struct radeon_type R700_types[] = { - { 128, 0, 0x00000000, 0x00000000, 0x0000, 0, "R600_CONFIG", 41, r700_state_pm4_config, R600_CONFIG_names}, - { 128, 1, 0x00000000, 0x00000000, 0x0000, 0, "R600_CB_CNTL", 18, r600_state_pm4_generic, R600_CB_CNTL_names}, - { 128, 2, 0x00000000, 0x00000000, 0x0000, 0, "R600_RASTERIZER", 21, r600_state_pm4_generic, R600_RASTERIZER_names}, - { 128, 3, 0x00000000, 0x00000000, 0x0000, 0, "R600_VIEWPORT", 9, r600_state_pm4_generic, R600_VIEWPORT_names}, - { 128, 4, 0x00000000, 0x00000000, 0x0000, 0, "R600_SCISSOR", 19, r600_state_pm4_generic, R600_SCISSOR_names}, - { 128, 5, 0x00000000, 0x00000000, 0x0000, 0, "R600_BLEND", 13, r600_state_pm4_generic, R600_BLEND_names}, - { 128, 6, 0x00000000, 0x00000000, 0x0000, 0, "R600_DSA", 16, r600_state_pm4_generic, R600_DSA_names}, - { 128, 7, 0x00000000, 0x00000000, 0x0000, 0, "R600_VS_SHADER", 49, r600_state_pm4_shader, R600_VS_SHADER_names}, - { 128, 8, 0x00000000, 0x00000000, 0x0000, 0, "R600_PS_SHADER", 39, r600_state_pm4_shader, R600_PS_SHADER_names}, - { 128, 9, 0x00030000, 0x00031000, 0x0010, 0, "R600_PS_CONSTANT", 4, r600_state_pm4_generic, R600_PS_CONSTANT_names}, - { 128, 265, 0x00031000, 0x00032000, 0x0010, 0, "R600_VS_CONSTANT", 4, r600_state_pm4_generic, R600_VS_CONSTANT_names}, - { 128, 521, 0x00038000, 0x00039180, 0x001C, 0, "R600_PS_RESOURCE", 7, r600_state_pm4_resource, R600_PS_RESOURCE_names}, - { 128, 681, 0x00039180, 0x0003A300, 0x001C, 0, "R600_VS_RESOURCE", 7, r600_state_pm4_resource, R600_VS_RESOURCE_names}, - { 128, 841, 0x00039180, 0x0003A300, 0x001C, 0, "R600_FS_RESOURCE", 7, r600_state_pm4_resource, R600_FS_RESOURCE_names}, - { 128, 1001, 0x00039180, 0x0003A300, 0x001C, 0, "R600_GS_RESOURCE", 7, r600_state_pm4_resource, R600_GS_RESOURCE_names}, - { 128, 1161, 0x0003C000, 0x0003C0D8, 0x000C, 0, "R600_PS_SAMPLER", 3, r600_state_pm4_generic, R600_PS_SAMPLER_names}, - { 128, 1179, 0x0003C0D8, 0x0003C1B0, 0x000C, 0, "R600_VS_SAMPLER", 3, r600_state_pm4_generic, R600_VS_SAMPLER_names}, - { 128, 1197, 0x0003C1B0, 0x0003C288, 0x000C, 0, "R600_GS_SAMPLER", 3, r600_state_pm4_generic, R600_GS_SAMPLER_names}, - { 128, 1215, 0x0000A400, 0x0000A520, 0x0010, 0, "R600_PS_SAMPLER_BORDER", 4, r600_state_pm4_generic, R600_PS_SAMPLER_BORDER_names}, - { 128, 1233, 0x0000A600, 0x0000A720, 0x0010, 0, "R600_VS_SAMPLER_BORDER", 4, r600_state_pm4_generic, R600_VS_SAMPLER_BORDER_names}, - { 128, 1251, 0x0000A800, 0x0000A920, 0x0010, 0, "R600_GS_SAMPLER_BORDER", 4, r600_state_pm4_generic, R600_GS_SAMPLER_BORDER_names}, - { 128, 1269, 0x00000000, 0x00000000, 0x0000, 0, "R600_CB0", 7, r700_state_pm4_cb0, R600_CB0_names}, - { 128, 1270, 0x00000000, 0x00000000, 0x0000, 0, "R600_CB1", 7, r600_state_pm4_cb0, R600_CB1_names}, - { 128, 1271, 0x00000000, 0x00000000, 0x0000, 0, "R600_CB2", 7, r600_state_pm4_cb0, R600_CB2_names}, - { 128, 1272, 0x00000000, 0x00000000, 0x0000, 0, "R600_CB3", 7, r600_state_pm4_cb0, R600_CB3_names}, - { 128, 1273, 0x00000000, 0x00000000, 0x0000, 0, "R600_CB4", 7, r600_state_pm4_cb0, R600_CB4_names}, - { 128, 1274, 0x00000000, 0x00000000, 0x0000, 0, "R600_CB5", 7, r600_state_pm4_cb0, R600_CB5_names}, - { 128, 1275, 0x00000000, 0x00000000, 0x0000, 0, "R600_CB6", 7, r600_state_pm4_cb0, R600_CB6_names}, - { 128, 1276, 0x00000000, 0x00000000, 0x0000, 0, "R600_CB7", 7, r600_state_pm4_cb0, R600_CB7_names}, - { 128, 1277, 0x00000000, 0x00000000, 0x0000, 0, "R600_QUERY_BEGIN", 1, r600_state_pm4_query_begin, R600_VGT_EVENT_names}, - { 128, 1278, 0x00000000, 0x00000000, 0x0000, 0, "R600_QUERY_END", 1, r600_state_pm4_query_end, R600_VGT_EVENT_names}, - { 128, 1279, 0x00000000, 0x00000000, 0x0000, 0, "R600_DB", 6, r700_state_pm4_db, R600_DB_names}, - { 128, 1280, 0x00028e20, 0x00028e70, 0x0010, 0, "R600_UCP", 4, r600_state_pm4_generic, R600_UCP_names}, - { 128, 1286, 0x00000000, 0x00000000, 0x0000, 0, "R600_VGT", 11, r600_state_pm4_vgt, R600_VGT_names}, - { 128, 1287, 0x00000000, 0x00000000, 0x0000, 0, "R600_DRAW", 4, r600_state_pm4_draw, R600_DRAW_names}, -}; - -#endif diff --git a/src/gallium/winsys/r600/drm/radeon.c b/src/gallium/winsys/r600/drm/radeon.c index 80b0a1d397..2b16e3ce88 100644 --- a/src/gallium/winsys/r600/drm/radeon.c +++ b/src/gallium/winsys/r600/drm/radeon.c @@ -153,47 +153,3 @@ struct radeon *radeon_decref(struct radeon *radeon) free(radeon); return NULL; } - -int radeon_reg_id(struct radeon *radeon, unsigned offset, unsigned *typeid, unsigned *stateid, unsigned *id) -{ - unsigned i, j; - - for (i = 0; i < radeon->ntype; i++) { - if (radeon->type[i].range_start) { - if (offset >= radeon->type[i].range_start && offset < radeon->type[i].range_end) { - *typeid = i; - j = offset - radeon->type[i].range_start; - j /= radeon->type[i].stride; - *stateid = radeon->type[i].id + j; - *id = (offset - radeon->type[i].range_start - radeon->type[i].stride * j) / 4; - return 0; - } - } else { - for (j = 0; j < radeon->type[i].nstates; j++) { - if (radeon->type[i].regs[j].offset == offset) { - *typeid = i; - *stateid = radeon->type[i].id; - *id = j; - return 0; - } - } - } - } - fprintf(stderr, "%s unknown register 0x%08X\n", __func__, offset); - return -EINVAL; -} - -unsigned radeon_type_from_id(struct radeon *radeon, unsigned id) -{ - unsigned i; - - for (i = 0; i < radeon->ntype - 1; i++) { - if (radeon->type[i].id == id) - return i; - if (id > radeon->type[i].id && id < radeon->type[i + 1].id) - return i; - } - if (radeon->type[i].id == id) - return i; - return -1; -} diff --git a/src/gallium/winsys/r600/drm/radeon_ctx.c b/src/gallium/winsys/r600/drm/radeon_ctx.c index bd050c4cf9..b8ba9b552d 100644 --- a/src/gallium/winsys/r600/drm/radeon_ctx.c +++ b/src/gallium/winsys/r600/drm/radeon_ctx.c @@ -26,54 +26,40 @@ #include #include #include +#include #include "radeon_priv.h" #include "radeon_drm.h" #include "bof.h" -int radeon_ctx_set_bo_new(struct radeon_ctx *ctx, struct radeon_bo *bo) +static int radeon_ctx_set_bo_new(struct radeon_ctx *ctx, struct radeon_bo *bo, unsigned state_id) { - void *ptr; - - ptr = realloc(ctx->bo, sizeof(struct radeon_bo) * (ctx->nbo + 1)); - if (ptr == NULL) { - return -ENOMEM; - } - ctx->bo = ptr; - ctx->bo[ctx->nbo] = bo; + ctx->bo[ctx->nbo].bo = bo; + ctx->bo[ctx->nbo].bo_flushed = 0; + ctx->bo[ctx->nbo].state_id = state_id; ctx->nbo++; return 0; } -struct radeon_bo *radeon_ctx_get_bo(struct radeon_ctx *ctx, unsigned reloc) +void radeon_ctx_clear(struct radeon_ctx *ctx) { - struct radeon_cs_reloc *greloc; unsigned i; - greloc = (void *)(((u8 *)ctx->reloc) + reloc * 4); - for (i = 0; i < ctx->nbo; i++) { - if (ctx->bo[i]->handle == greloc->handle) { - return radeon_bo_incref(ctx->radeon, ctx->bo[i]); - } + /* FIXME somethings is wrong, it should be safe to + * delete bo here, kernel should postpone bo deletion + * until bo is no longer referenced by cs (through the + * fence association) + */ + for (i = 0; i < 50; i++) { + usleep(10); } - fprintf(stderr, "%s no bo for reloc[%d 0x%08X] %d\n", __func__, reloc, greloc->handle, ctx->nbo); - return NULL; -} - -void radeon_ctx_get_placement(struct radeon_ctx *ctx, unsigned reloc, u32 *placement) -{ - struct radeon_cs_reloc *greloc; - unsigned i; - - placement[0] = 0; - placement[1] = 0; - greloc = (void *)(((u8 *)ctx->reloc) + reloc * 4); for (i = 0; i < ctx->nbo; i++) { - if (ctx->bo[i]->handle == greloc->handle) { - placement[0] = greloc->read_domain | greloc->write_domain; - placement[1] = placement[0]; - return; - } + ctx->bo[i].bo = radeon_bo_decref(ctx->radeon, ctx->bo[i].bo); } + ctx->id = 0; + ctx->npm4 = RADEON_CTX_MAX_PM4; + ctx->nreloc = 0; + ctx->nbo = 0; + memset(ctx->state_crc32, 0, ctx->radeon->nstate * 4); } struct radeon_ctx *radeon_ctx(struct radeon *radeon) @@ -86,6 +72,25 @@ struct radeon_ctx *radeon_ctx(struct radeon *radeon) if (ctx == NULL) return NULL; ctx->radeon = radeon_incref(radeon); + ctx->max_bo = 4096; + ctx->max_reloc = 4096; + ctx->pm4 = malloc(RADEON_CTX_MAX_PM4 * 4); + if (ctx->pm4 == NULL) { + return radeon_ctx_decref(ctx); + } + ctx->state_crc32 = malloc(ctx->radeon->nstate * 4); + if (ctx->state_crc32 == NULL) { + return radeon_ctx_decref(ctx); + } + ctx->bo = malloc(ctx->max_bo * sizeof(struct radeon_ctx_bo)); + if (ctx->bo == NULL) { + return radeon_ctx_decref(ctx); + } + ctx->reloc = malloc(ctx->max_reloc * sizeof(struct radeon_cs_reloc)); + if (ctx->reloc == NULL) { + return radeon_ctx_decref(ctx); + } + radeon_ctx_clear(ctx); return ctx; } @@ -97,31 +102,33 @@ struct radeon_ctx *radeon_ctx_incref(struct radeon_ctx *ctx) struct radeon_ctx *radeon_ctx_decref(struct radeon_ctx *ctx) { - unsigned i; - if (ctx == NULL) return NULL; if (--ctx->refcount > 0) { return NULL; } - for (i = 0; i < ctx->ndraw; i++) { - ctx->draw[i] = radeon_draw_decref(ctx->draw[i]); - } - for (i = 0; i < ctx->nbo; i++) { - ctx->bo[i] = radeon_bo_decref(ctx->radeon, ctx->bo[i]); - } ctx->radeon = radeon_decref(ctx->radeon); - free(ctx->state); - free(ctx->draw); free(ctx->bo); free(ctx->pm4); free(ctx->reloc); + free(ctx->state_crc32); memset(ctx, 0, sizeof(*ctx)); free(ctx); return NULL; } +static int radeon_ctx_bo_id(struct radeon_ctx *ctx, struct radeon_bo *bo) +{ + unsigned i; + + for (i = 0; i < ctx->nbo; i++) { + if (bo == ctx->bo[i].bo) + return i; + } + return -1; +} + static int radeon_ctx_state_bo(struct radeon_ctx *ctx, struct radeon_state *state) { unsigned i, j; @@ -131,12 +138,15 @@ static int radeon_ctx_state_bo(struct radeon_ctx *ctx, struct radeon_state *stat return 0; for (i = 0; i < state->nbo; i++) { for (j = 0; j < ctx->nbo; j++) { - if (state->bo[i] == ctx->bo[j]) + if (state->bo[i] == ctx->bo[j].bo) break; } if (j == ctx->nbo) { + if (ctx->nbo >= ctx->max_bo) { + return -EBUSY; + } radeon_bo_incref(ctx->radeon, state->bo[i]); - r = radeon_ctx_set_bo_new(ctx, state->bo[i]); + r = radeon_ctx_set_bo_new(ctx, state->bo[i], state->id); if (r) return r; } @@ -144,7 +154,6 @@ static int radeon_ctx_state_bo(struct radeon_ctx *ctx, struct radeon_state *stat return 0; } - int radeon_ctx_submit(struct radeon_ctx *ctx) { struct drm_radeon_cs drmib; @@ -152,17 +161,17 @@ int radeon_ctx_submit(struct radeon_ctx *ctx) uint64_t chunk_array[2]; int r = 0; - if (!ctx->cpm4) + if (!ctx->id) return 0; #if 0 - for (r = 0; r < ctx->cpm4; r++) { + for (r = 0; r < ctx->id; r++) { fprintf(stderr, "0x%08X\n", ctx->pm4[r]); } #endif drmib.num_chunks = 2; drmib.chunks = (uint64_t)(uintptr_t)chunk_array; chunks[0].chunk_id = RADEON_CHUNK_ID_IB; - chunks[0].length_dw = ctx->cpm4; + chunks[0].length_dw = ctx->id; chunks[0].chunk_data = (uint64_t)(uintptr_t)ctx->pm4; chunks[1].chunk_id = RADEON_CHUNK_ID_RELOCS; chunks[1].length_dw = ctx->nreloc * sizeof(struct radeon_cs_reloc) / 4; @@ -176,11 +185,10 @@ int radeon_ctx_submit(struct radeon_ctx *ctx) return r; } -static int radeon_ctx_reloc(struct radeon_ctx *ctx, struct radeon_bo *bo, +int radeon_ctx_reloc(struct radeon_ctx *ctx, struct radeon_bo *bo, unsigned id, unsigned *placement) { unsigned i; - struct radeon_cs_reloc *ptr; for (i = 0; i < ctx->nreloc; i++) { if (ctx->reloc[i].handle == bo->handle) { @@ -188,14 +196,13 @@ static int radeon_ctx_reloc(struct radeon_ctx *ctx, struct radeon_bo *bo, return 0; } } - ptr = realloc(ctx->reloc, sizeof(struct radeon_cs_reloc) * (ctx->nreloc + 1)); - if (ptr == NULL) - return -ENOMEM; - ctx->reloc = ptr; - ptr[ctx->nreloc].handle = bo->handle; - ptr[ctx->nreloc].read_domain = placement[0] | placement [1]; - ptr[ctx->nreloc].write_domain = placement[0] | placement [1]; - ptr[ctx->nreloc].flags = 0; + if (ctx->nreloc >= ctx->max_reloc) { + return -EBUSY; + } + ctx->reloc[ctx->nreloc].handle = bo->handle; + ctx->reloc[ctx->nreloc].read_domain = placement[0] | placement [1]; + ctx->reloc[ctx->nreloc].write_domain = placement[0] | placement [1]; + ctx->reloc[ctx->nreloc].flags = 0; ctx->pm4[id] = ctx->nreloc * sizeof(struct radeon_cs_reloc) / 4; ctx->nreloc++; return 0; @@ -203,75 +210,90 @@ static int radeon_ctx_reloc(struct radeon_ctx *ctx, struct radeon_bo *bo, static int radeon_ctx_state_schedule(struct radeon_ctx *ctx, struct radeon_state *state) { - unsigned i, rid, bid, cid; - int r; + unsigned i, rid, cid; + u32 flags; + int r, bo_id[4]; if (state == NULL) return 0; - memcpy(&ctx->pm4[ctx->id], state->pm4, state->cpm4 * 4); - for (i = 0; i < state->nreloc; i++) { + for (i = 0; i < state->nbo; i++) { + bo_id[i] = radeon_ctx_bo_id(ctx, state->bo[i]); + if (bo_id[i] < 0) { + return -EINVAL; + } + flags = (~ctx->bo[bo_id[i]].bo_flushed) & ctx->radeon->type[state->id].flush_flags; + if (flags) { + r = ctx->radeon->bo_flush(ctx, state->bo[i], flags, &state->placement[i * 2]); + if (r) { + return r; + } + } + ctx->bo[bo_id[i]].bo_flushed |= ctx->radeon->type[state->id].flush_flags; + } + if ((ctx->radeon->type[state->id].header_cpm4 + state->cpm4) > ctx->npm4) { + /* need to flush */ + return -EBUSY; + } + memcpy(&ctx->pm4[ctx->id], ctx->radeon->type[state->id].header_pm4, ctx->radeon->type[state->id].header_cpm4 * 4); + ctx->id += ctx->radeon->type[state->id].header_cpm4; + ctx->npm4 -= ctx->radeon->type[state->id].header_cpm4; + memcpy(&ctx->pm4[ctx->id], state->states, state->cpm4 * 4); + for (i = 0; i < state->nbo; i++) { rid = state->reloc_pm4_id[i]; - bid = state->reloc_bo_id[i]; cid = ctx->id + rid; - r = radeon_ctx_reloc(ctx, state->bo[bid], cid, - &state->placement[bid * 2]); + r = radeon_ctx_reloc(ctx, state->bo[i], cid, + &state->placement[i * 2]); if (r) { - fprintf(stderr, "%s state %d failed to reloc\n", __func__, state->type); + fprintf(stderr, "%s state %d failed to reloc\n", __func__, state->id); return r; } } ctx->id += state->cpm4; + ctx->npm4 -= state->cpm4; + for (i = 0; i < state->nbo; i++) { + ctx->bo[bo_id[i]].bo_flushed &= ~ctx->radeon->type[state->id].dirty_flags; + } return 0; } int radeon_ctx_set_query_state(struct radeon_ctx *ctx, struct radeon_state *state) { - void *tmp; + unsigned ndw = 0; int r = 0; - /* !!! ONLY ACCEPT QUERY STATE HERE !!! */ - if (state->type != R600_QUERY_BEGIN_TYPE && state->type != R600_QUERY_END_TYPE) { - return -EINVAL; - } r = radeon_state_pm4(state); if (r) return r; - if ((ctx->draw_cpm4 + state->cpm4) > RADEON_CTX_MAX_PM4) { - /* need to flush */ - return -EBUSY; - } - if (state->cpm4 >= RADEON_CTX_MAX_PM4) { - fprintf(stderr, "%s single state too big %d, max %d\n", - __func__, state->cpm4, RADEON_CTX_MAX_PM4); + + /* !!! ONLY ACCEPT QUERY STATE HERE !!! */ + ndw = state->cpm4 + ctx->radeon->type[state->id].header_cpm4; + switch (state->id) { + case R600_QUERY_BEGIN: + /* account QUERY_END at same time of QUERY_BEGIN so we know we + * have room left for QUERY_END + */ + if ((ndw * 2) > ctx->npm4) { + /* need to flush */ + return -EBUSY; + } + ctx->npm4 -= ndw; + break; + case R600_QUERY_END: + /* add again ndw from previous accounting */ + ctx->npm4 += ndw; + break; + default: return -EINVAL; } - tmp = realloc(ctx->state, (ctx->nstate + 1) * sizeof(void*)); - if (tmp == NULL) - return -ENOMEM; - ctx->state = tmp; - ctx->state[ctx->nstate++] = radeon_state_incref(state); - /* BEGIN/END query are balanced in the same cs so account for END - * END query when scheduling BEGIN query - */ - if (state->type == R600_QUERY_BEGIN_TYPE) { - ctx->draw_cpm4 += state->cpm4 * 2; - } - return 0; + + return radeon_ctx_state_schedule(ctx, state); } -int radeon_ctx_set_draw_new(struct radeon_ctx *ctx, struct radeon_draw *draw) +int radeon_ctx_set_draw(struct radeon_ctx *ctx, struct radeon_draw *draw) { - struct radeon_draw *pdraw = NULL; - struct radeon_draw **ndraw; - struct radeon_state *nstate, *ostate; - unsigned cpm4, i, cstate; - void *tmp; + unsigned i, previous_id; int r = 0; - ndraw = realloc(ctx->draw, sizeof(void*) * (ctx->ndraw + 1)); - if (ndraw == NULL) - return -ENOMEM; - ctx->draw = ndraw; for (i = 0; i < draw->nstate; i++) { r = radeon_ctx_state_bo(ctx, draw->state[i]); if (r) @@ -285,76 +307,17 @@ int radeon_ctx_set_draw_new(struct radeon_ctx *ctx, struct radeon_draw *draw) __func__, draw->cpm4, RADEON_CTX_MAX_PM4); return -EINVAL; } - tmp = realloc(ctx->state, (ctx->nstate + draw->nstate) * sizeof(void*)); - if (tmp == NULL) - return -ENOMEM; - ctx->state = tmp; - pdraw = ctx->cdraw; - for (i = 0, cpm4 = 0, cstate = ctx->nstate; i < draw->nstate - 1; i++) { - nstate = draw->state[i]; - if (nstate) { - if (pdraw && pdraw->state[i]) { - ostate = pdraw->state[i]; - if (ostate->pm4_crc != nstate->pm4_crc) { - ctx->state[cstate++] = nstate; - cpm4 += nstate->cpm4; - } - } else { - ctx->state[cstate++] = nstate; - cpm4 += nstate->cpm4; + previous_id = ctx->id; + for (i = 0; i < draw->nstate; i++) { + /* FIXME always force draw state to schedule */ + if (draw->state[i] && draw->state[i]->pm4_crc != ctx->state_crc32[draw->state[i]->id]) { + r = radeon_ctx_state_schedule(ctx, draw->state[i]); + if (r) { + ctx->id = previous_id; + return r; } } } - /* The last state is the draw state always add it */ - if (draw->state[i] == NULL) { - fprintf(stderr, "%s no draw command\n", __func__); - return -EINVAL; - } - ctx->state[cstate++] = draw->state[i]; - cpm4 += draw->state[i]->cpm4; - if ((ctx->draw_cpm4 + cpm4) > RADEON_CTX_MAX_PM4) { - /* need to flush */ - return -EBUSY; - } - ctx->draw_cpm4 += cpm4; - ctx->nstate = cstate; - ctx->draw[ctx->ndraw++] = draw; - ctx->cdraw = draw; - return 0; -} - -int radeon_ctx_set_draw(struct radeon_ctx *ctx, struct radeon_draw *draw) -{ - int r; - - radeon_draw_incref(draw); - r = radeon_ctx_set_draw_new(ctx, draw); - if (r) - radeon_draw_decref(draw); - return r; -} - -int radeon_ctx_pm4(struct radeon_ctx *ctx) -{ - unsigned i; - int r; - - free(ctx->pm4); - ctx->cpm4 = 0; - ctx->pm4 = malloc(ctx->draw_cpm4 * 4); - if (ctx->pm4 == NULL) - return -EINVAL; - for (i = 0, ctx->id = 0; i < ctx->nstate; i++) { - r = radeon_ctx_state_schedule(ctx, ctx->state[i]); - if (r) - return r; - } - if (ctx->id != ctx->draw_cpm4) { - fprintf(stderr, "%s miss predicted pm4 size %d for %d\n", - __func__, ctx->draw_cpm4, ctx->id); - return -EINVAL; - } - ctx->cpm4 = ctx->draw_cpm4; return 0; } @@ -384,8 +347,8 @@ printf("%d relocs\n", ctx->nreloc); bof_decref(blob); blob = NULL; /* dump cs */ -printf("%d pm4\n", ctx->cpm4); - blob = bof_blob(ctx->cpm4 * 4, ctx->pm4); +printf("%d pm4\n", ctx->id); + blob = bof_blob(ctx->id * 4, ctx->pm4); if (blob == NULL) goto out_err; if (bof_object_set(root, "pm4", blob)) @@ -400,23 +363,23 @@ printf("%d pm4\n", ctx->cpm4); bo = bof_object(); if (bo == NULL) goto out_err; - size = bof_int32(ctx->bo[i]->size); + size = bof_int32(ctx->bo[i].bo->size); if (size == NULL) goto out_err; if (bof_object_set(bo, "size", size)) goto out_err; bof_decref(size); size = NULL; - handle = bof_int32(ctx->bo[i]->handle); + handle = bof_int32(ctx->bo[i].bo->handle); if (handle == NULL) goto out_err; if (bof_object_set(bo, "handle", handle)) goto out_err; bof_decref(handle); handle = NULL; - radeon_bo_map(ctx->radeon, ctx->bo[i]); - blob = bof_blob(ctx->bo[i]->size, ctx->bo[i]->data); - radeon_bo_unmap(ctx->radeon, ctx->bo[i]); + radeon_bo_map(ctx->radeon, ctx->bo[i].bo); + blob = bof_blob(ctx->bo[i].bo->size, ctx->bo[i].bo->data); + radeon_bo_unmap(ctx->radeon, ctx->bo[i].bo); if (blob == NULL) goto out_err; if (bof_object_set(bo, "data", blob)) diff --git a/src/gallium/winsys/r600/drm/radeon_draw.c b/src/gallium/winsys/r600/drm/radeon_draw.c index 4413ed79fb..1b4e557f28 100644 --- a/src/gallium/winsys/r600/drm/radeon_draw.c +++ b/src/gallium/winsys/r600/drm/radeon_draw.c @@ -76,8 +76,6 @@ int radeon_draw_set_new(struct radeon_draw *draw, struct radeon_state *state) { if (state == NULL) return 0; - if (state->type >= draw->radeon->ntype) - return -EINVAL; draw->state[state->id] = radeon_state_decref(draw->state[state->id]); draw->state[state->id] = state; return 0; @@ -102,6 +100,7 @@ int radeon_draw_check(struct radeon_draw *draw) for (i = 0, draw->cpm4 = 0; i < draw->nstate; i++) { if (draw->state[i]) { draw->cpm4 += draw->state[i]->cpm4; + draw->cpm4 += draw->radeon->type[draw->state[i]->id].header_cpm4; } } return 0; diff --git a/src/gallium/winsys/r600/drm/radeon_priv.h b/src/gallium/winsys/r600/drm/radeon_priv.h index 96c0d060f7..469a5dce01 100644 --- a/src/gallium/winsys/r600/drm/radeon_priv.h +++ b/src/gallium/winsys/r600/drm/radeon_priv.h @@ -30,34 +30,26 @@ struct radeon_ctx; * radeon functions */ typedef int (*radeon_state_pm4_t)(struct radeon_state *state); -struct radeon_register { - unsigned offset; - unsigned need_reloc; - unsigned bo_id; - char name[64]; -}; struct radeon_type { - unsigned npm4; - unsigned id; - unsigned range_start; - unsigned range_end; - unsigned stride; - unsigned immediate; - char name[64]; - unsigned nstates; - radeon_state_pm4_t pm4; - const struct radeon_register *regs; + const u32 *header_pm4; + const u32 header_cpm4; + const u32 *state_pm4; + const u32 state_cpm4; + const u32 flush_flags; + const u32 dirty_flags; }; +typedef int (*radeon_ctx_bo_flush_t)(struct radeon_ctx *ctx, struct radeon_bo *bo, u32 flags, u32 *placement); + struct radeon { int fd; int refcount; unsigned device; unsigned family; unsigned nstate; - unsigned ntype; const struct radeon_type *type; + radeon_ctx_bo_flush_t bo_flush; }; extern struct radeon *radeon_new(int fd, unsigned device); @@ -68,12 +60,9 @@ extern int radeon_is_family_compatible(unsigned family1, unsigned family2); extern int radeon_reg_id(struct radeon *radeon, unsigned offset, unsigned *typeid, unsigned *stateid, unsigned *id); extern unsigned radeon_type_from_id(struct radeon *radeon, unsigned id); - -int radeon_ctx_set_bo_new(struct radeon_ctx *ctx, struct radeon_bo *bo); -struct radeon_bo *radeon_ctx_get_bo(struct radeon_ctx *ctx, unsigned reloc); -void radeon_ctx_get_placement(struct radeon_ctx *ctx, unsigned reloc, u32 *placement); -int radeon_ctx_set_draw_new(struct radeon_ctx *ctx, struct radeon_draw *draw); int radeon_ctx_draw(struct radeon_ctx *ctx); +int radeon_ctx_reloc(struct radeon_ctx *ctx, struct radeon_bo *bo, + unsigned id, unsigned *placement); /* * r600/r700 context functions @@ -90,7 +79,6 @@ extern int radeon_state_register_set(struct radeon_state *state, unsigned offset extern struct radeon_state *radeon_state_duplicate(struct radeon_state *state); extern int radeon_state_replace_always(struct radeon_state *ostate, struct radeon_state *nstate); extern int radeon_state_pm4_generic(struct radeon_state *state); -extern int radeon_state_reloc(struct radeon_state *state, unsigned id, unsigned bo_id); /* * radeon draw functions diff --git a/src/gallium/winsys/r600/drm/radeon_state.c b/src/gallium/winsys/r600/drm/radeon_state.c index 308288557a..c60b12ef67 100644 --- a/src/gallium/winsys/r600/drm/radeon_state.c +++ b/src/gallium/winsys/r600/drm/radeon_state.c @@ -32,52 +32,29 @@ /* * state core functions */ -struct radeon_state *radeon_state(struct radeon *radeon, u32 type, u32 id) +struct radeon_state *radeon_state(struct radeon *radeon, u32 id) { struct radeon_state *state; - if (type > radeon->ntype) { - fprintf(stderr, "%s invalid type %d\n", __func__, type); - return NULL; - } - if (id > radeon->nstate) { - fprintf(stderr, "%s invalid state id %d\n", __func__, id); - return NULL; - } state = calloc(1, sizeof(*state)); if (state == NULL) return NULL; state->radeon = radeon; - state->type = type; state->id = id; state->refcount = 1; - state->npm4 = radeon->type[type].npm4; - state->nstates = radeon->type[type].nstates; - state->states = calloc(1, state->nstates * 4); - state->pm4 = calloc(1, radeon->type[type].npm4 * 4); - if (state->states == NULL || state->pm4 == NULL) { - radeon_state_decref(state); - return NULL; - } + state->cpm4 = radeon->type[id].state_cpm4; + memcpy(state->states, radeon->type[id].state_pm4, radeon->type[id].state_cpm4 * 4); return state; } struct radeon_state *radeon_state_duplicate(struct radeon_state *state) { - struct radeon_state *nstate = radeon_state(state->radeon, state->type, state->id); + struct radeon_state *nstate = radeon_state(state->radeon, state->id); unsigned i; if (state == NULL) return NULL; - nstate->cpm4 = state->cpm4; - nstate->nbo = state->nbo; - nstate->nreloc = state->nreloc; - memcpy(nstate->states, state->states, state->nstates * 4); - memcpy(nstate->pm4, state->pm4, state->npm4 * 4); - memcpy(nstate->placement, state->placement, 8 * 4); - memcpy(nstate->reloc_pm4_id, state->reloc_pm4_id, 8 * 4); - memcpy(nstate->reloc_bo_id, state->reloc_bo_id, 8 * 4); - memcpy(nstate->bo_dirty, state->bo_dirty, 4 * 4); + *nstate = *state; for (i = 0; i < state->nbo; i++) { nstate->bo[i] = radeon_bo_incref(state->radeon, state->bo[i]); } @@ -102,9 +79,6 @@ struct radeon_state *radeon_state_decref(struct radeon_state *state) for (i = 0; i < state->nbo; i++) { state->bo[i] = radeon_bo_decref(state->radeon, state->bo[i]); } - free(state->immd); - free(state->states); - free(state->pm4); memset(state, 0, sizeof(*state)); free(state); return NULL; @@ -145,24 +119,8 @@ static u32 crc32(void *d, size_t len) int radeon_state_pm4(struct radeon_state *state) { - int r; - - if (state == NULL || state->cpm4) + if (state == NULL) return 0; - r = state->radeon->type[state->type].pm4(state); - if (r) { - fprintf(stderr, "%s failed to build PM4 for state(%d %d)\n", - __func__, state->type, state->id); - return r; - } - state->pm4_crc = crc32(state->pm4, state->cpm4 * 4); - return 0; -} - -int radeon_state_reloc(struct radeon_state *state, unsigned id, unsigned bo_id) -{ - state->reloc_pm4_id[state->nreloc] = id; - state->reloc_bo_id[state->nreloc] = bo_id; - state->nreloc++; + state->pm4_crc = crc32(state->states, state->cpm4 * 4); return 0; } -- cgit v1.2.3 From a49167c1c03dab9452165f503251e543dec2be9a Mon Sep 17 00:00:00 2001 From: Marcin Slusarz Date: Mon, 23 Aug 2010 22:40:58 +0200 Subject: nouveau: handle early initialization errors handle very early errors in pipe_screen creation (failure of nouveau_screen_init in nv50_screen_create) Signed-off-by: Francisco Jerez --- src/gallium/drivers/nouveau/nouveau_screen.c | 3 ++- src/gallium/winsys/nouveau/drm/nouveau_drm_winsys.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/nouveau/nouveau_screen.c b/src/gallium/drivers/nouveau/nouveau_screen.c index 513e5e02bc..ebb21a6e5a 100644 --- a/src/gallium/drivers/nouveau/nouveau_screen.c +++ b/src/gallium/drivers/nouveau/nouveau_screen.c @@ -258,6 +258,7 @@ nouveau_screen_fini(struct nouveau_screen *screen) { struct pipe_winsys *ws = screen->base.winsys; nouveau_channel_free(&screen->channel); - ws->destroy(ws); + if (ws) + ws->destroy(ws); } diff --git a/src/gallium/winsys/nouveau/drm/nouveau_drm_winsys.c b/src/gallium/winsys/nouveau/drm/nouveau_drm_winsys.c index 660dbd0c33..d4bf124ce6 100644 --- a/src/gallium/winsys/nouveau/drm/nouveau_drm_winsys.c +++ b/src/gallium/winsys/nouveau/drm/nouveau_drm_winsys.c @@ -19,7 +19,8 @@ nouveau_drm_destroy_winsys(struct pipe_winsys *s) { struct nouveau_winsys *nv_winsys = nouveau_winsys(s); struct nouveau_screen *nv_screen= nouveau_screen(nv_winsys->pscreen); - nouveau_device_close(&nv_screen->device); + if (nv_screen) + nouveau_device_close(&nv_screen->device); FREE(nv_winsys); } -- cgit v1.2.3 From a1f2ac2b37b8291d1521169b171f6c3ea683cae7 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 25 Aug 2010 16:00:09 -0700 Subject: i965: Fix detection of implicit MOVs to message regs in brw_optimize.c. Texcoords in AmbientApertureLighting were getting trashed since the move of math arguments to implied moves, due to the logic for detecting ALU message reg writes overriding the logic for SEND implicit message reg writes. --- src/mesa/drivers/dri/i965/brw_optimize.c | 62 +++++++++++++++++++------------- 1 file changed, 38 insertions(+), 24 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_optimize.c b/src/mesa/drivers/dri/i965/brw_optimize.c index 8aa6fb6cc6..afcd1fc15a 100644 --- a/src/mesa/drivers/dri/i965/brw_optimize.c +++ b/src/mesa/drivers/dri/i965/brw_optimize.c @@ -161,20 +161,19 @@ brw_is_grf_written(const struct brw_instruction *inst, return left < right; } -/* Specific path for message register since we need to handle the compr4 case */ -static INLINE GLboolean -brw_is_mrf_written(const struct brw_instruction *inst, int reg_index, int size) +static GLboolean +brw_is_mrf_written_alu(const struct brw_instruction *inst, + int reg_index, int size) { if (inst_opcode[inst->header.opcode].ndst == 0) return GL_FALSE; - if (inst->bits1.da1.dest_address_mode != BRW_ADDRESS_DIRECT) - if (inst->bits1.ia1.dest_reg_file == BRW_MESSAGE_REGISTER_FILE) - return GL_TRUE; - if (inst->bits1.da1.dest_reg_file != BRW_MESSAGE_REGISTER_FILE) return GL_FALSE; + if (inst->bits1.da1.dest_address_mode != BRW_ADDRESS_DIRECT) + return GL_TRUE; + const int reg_start = reg_index * REG_SIZE; const int reg_end = reg_start + size; @@ -188,8 +187,6 @@ brw_is_mrf_written(const struct brw_instruction *inst, int reg_index, int size) if (is_compr4 && inst->header.execution_size != BRW_EXECUTE_16) return GL_TRUE; - GLboolean is_written = GL_FALSE; - /* Here we write mrf_{i} and mrf_{i+4}. So we read two times 8 elements */ if (is_compr4) { const int length = 8 * type_size * inst->bits1.da1.dest_horiz_stride; @@ -210,7 +207,8 @@ brw_is_mrf_written(const struct brw_instruction *inst, int reg_index, int size) const int left1 = MAX2(write_start1, reg_start); const int right1 = MIN2(write_end1, reg_end); - is_written = left0 < right0 || left1 < right1; + if (left0 < right0 || left1 < right1) + return GL_TRUE; } else { int length; @@ -223,25 +221,41 @@ brw_is_mrf_written(const struct brw_instruction *inst, int reg_index, int size) + inst->bits1.da1.dest_subreg_nr; const int write_end = write_start + length; const int left = MAX2(write_start, reg_start); - const int right = MIN2(write_end, reg_end);; + const int right = MIN2(write_end, reg_end); - is_written = left < right; + if (left < right) + return GL_TRUE; } - /* SEND may perform an implicit mov to a mrf register */ - if (is_written == GL_FALSE && - inst->header.opcode == BRW_OPCODE_SEND && - inst->bits1.da1.src0_reg_file != 0) { + return GL_FALSE; +} - const int mrf_start = inst->header.destreg__conditionalmod; - const int write_start = mrf_start * REG_SIZE; - const int write_end = write_start + REG_SIZE; - const int left = MAX2(write_start, reg_start); - const int right = MIN2(write_end, reg_end);; - is_written = left < right; - } +/* SEND may perform an implicit mov to a mrf register */ +static GLboolean brw_is_mrf_written_send(const struct brw_instruction *inst, + int reg_index, int size) +{ + + const int reg_start = reg_index * REG_SIZE; + const int reg_end = reg_start + size; + const int mrf_start = inst->header.destreg__conditionalmod; + const int write_start = mrf_start * REG_SIZE; + const int write_end = write_start + REG_SIZE; + const int left = MAX2(write_start, reg_start); + const int right = MIN2(write_end, reg_end); + + if (inst->header.opcode != BRW_OPCODE_SEND || + inst->bits1.da1.src0_reg_file == 0) + return GL_FALSE; - return is_written; + return left < right; +} + +/* Specific path for message register since we need to handle the compr4 case */ +static INLINE GLboolean +brw_is_mrf_written(const struct brw_instruction *inst, int reg_index, int size) +{ + return (brw_is_mrf_written_alu(inst, reg_index, size) || + brw_is_mrf_written_send(inst, reg_index, size)); } static INLINE GLboolean -- cgit v1.2.3 From 5226f8c7b0025031e8540adc93ecfe0b36b8f90f Mon Sep 17 00:00:00 2001 From: Aras Pranckevicius Date: Wed, 25 Aug 2010 22:42:13 +0300 Subject: glsl: fix crash with variable indexing into array in a struct Signed-off-by: Ian Romanick --- src/glsl/ast_to_hir.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp index 64b142fa35..2fec02668d 100644 --- a/src/glsl/ast_to_hir.cpp +++ b/src/glsl/ast_to_hir.cpp @@ -1259,8 +1259,14 @@ ast_expression::hir(exec_list *instructions, _mesa_glsl_error(&loc, state, "unsized array index must be constant"); } else { if (array->type->is_array()) { + /* whole_variable_referenced can return NULL if the array is a + * member of a structure. In this case it is safe to not update + * the max_array_access field because it is never used for fields + * of structures. + */ ir_variable *v = array->whole_variable_referenced(); - v->max_array_access = array->type->array_size(); + if (v != NULL) + v->max_array_access = array->type->array_size(); } } -- cgit v1.2.3 From b2872ea353efd117fcc4d22f0ca66a26f95a14c4 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 25 Aug 2010 16:38:37 -0700 Subject: Revert "mesa: Don't add 1 to GL_ACTIVE_UNIFORM_MAX_LENGTH." This reverts commit 001a7bfdfc8b3c8930d5ced21982dbdfb8cd35b3. I hadn't found the section of the spec clarifying that the old behavior was right. Reverting fixes the new version of the testcase, and the Humus demos that could no longer find their uniforms. Bug #29782 Bug #29783 --- src/mesa/main/shaderapi.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/mesa/main/shaderapi.c b/src/mesa/main/shaderapi.c index 1335f0f411..cc350c93b9 100644 --- a/src/mesa/main/shaderapi.c +++ b/src/mesa/main/shaderapi.c @@ -644,6 +644,8 @@ get_programiv(GLcontext *ctx, GLuint program, GLenum pname, GLint *params) break; case GL_ACTIVE_UNIFORM_MAX_LENGTH: *params = _mesa_longest_uniform_name(shProg->Uniforms); + if (*params > 0) + (*params)++; /* add one for terminating zero */ break; case GL_PROGRAM_BINARY_LENGTH_OES: *params = 0; -- cgit v1.2.3 From d430aea8bc0e74a657236d04584607443549b378 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Wed, 25 Aug 2010 18:00:23 -0700 Subject: r300: Remove unnecessary header. --- src/mesa/drivers/dri/r300/r300_fragprog_common.c | 1 - 1 file changed, 1 deletion(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r300/r300_fragprog_common.c b/src/mesa/drivers/dri/r300/r300_fragprog_common.c index 95f4306f60..7b6521c748 100644 --- a/src/mesa/drivers/dri/r300/r300_fragprog_common.c +++ b/src/mesa/drivers/dri/r300/r300_fragprog_common.c @@ -38,7 +38,6 @@ #include "r300_fragprog_common.h" -#include "program/prog_parameter.h" #include "program/prog_print.h" #include "compiler/radeon_compiler.h" -- cgit v1.2.3 From fdf054a585882d5f9497384749bf33842f5d1ec4 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Wed, 25 Aug 2010 18:06:01 -0700 Subject: r600: Remove unnecessary headers. --- src/mesa/drivers/dri/r600/evergreen_chip.c | 1 - src/mesa/drivers/dri/r600/evergreen_context.c | 3 --- src/mesa/drivers/dri/r600/evergreen_fragprog.c | 2 -- src/mesa/drivers/dri/r600/evergreen_render.c | 1 - src/mesa/drivers/dri/r600/evergreen_vertprog.c | 1 - 5 files changed, 8 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r600/evergreen_chip.c b/src/mesa/drivers/dri/r600/evergreen_chip.c index adf2a723c4..f925f215bc 100644 --- a/src/mesa/drivers/dri/r600/evergreen_chip.c +++ b/src/mesa/drivers/dri/r600/evergreen_chip.c @@ -31,7 +31,6 @@ #include "r600_context.h" #include "r600_cmdbuf.h" -#include "evergreen_tex.h" #include "evergreen_chip.h" #include "evergreen_off.h" #include "evergreen_diff.h" diff --git a/src/mesa/drivers/dri/r600/evergreen_context.c b/src/mesa/drivers/dri/r600/evergreen_context.c index 0ec7e3a238..65b5898efa 100644 --- a/src/mesa/drivers/dri/r600/evergreen_context.c +++ b/src/mesa/drivers/dri/r600/evergreen_context.c @@ -29,7 +29,6 @@ #include "main/context.h" #include "main/simple_list.h" #include "main/imports.h" -#include "main/extensions.h" #include "main/bufferobj.h" #include "main/texobj.h" @@ -38,8 +37,6 @@ #include "evergreen_state.h" #include "r600_blit.h" -#include "utils.h" - static void evergreen_get_lock(radeonContextPtr rmesa) { drm_radeon_sarea_t *sarea = rmesa->sarea; diff --git a/src/mesa/drivers/dri/r600/evergreen_fragprog.c b/src/mesa/drivers/dri/r600/evergreen_fragprog.c index 1cf5a908d1..9568f446da 100644 --- a/src/mesa/drivers/dri/r600/evergreen_fragprog.c +++ b/src/mesa/drivers/dri/r600/evergreen_fragprog.c @@ -44,8 +44,6 @@ #include "evergreen_vertprog.h" #include "evergreen_fragprog.h" -#include "r700_debug.h" - void evergreen_insert_wpos_code(GLcontext *ctx, struct gl_fragment_program *fprog) { static const gl_state_index winstate[STATE_LENGTH] diff --git a/src/mesa/drivers/dri/r600/evergreen_render.c b/src/mesa/drivers/dri/r600/evergreen_render.c index b9df3351e1..7f9c95e765 100644 --- a/src/mesa/drivers/dri/r600/evergreen_render.c +++ b/src/mesa/drivers/dri/r600/evergreen_render.c @@ -51,7 +51,6 @@ #include "evergreen_state.h" #include "evergreen_tex.h" -#include "evergreen_off.h" #include "radeon_buffer_objects.h" #include "radeon_common_context.h" diff --git a/src/mesa/drivers/dri/r600/evergreen_vertprog.c b/src/mesa/drivers/dri/r600/evergreen_vertprog.c index c1497f4cf8..5e4844edf9 100644 --- a/src/mesa/drivers/dri/r600/evergreen_vertprog.c +++ b/src/mesa/drivers/dri/r600/evergreen_vertprog.c @@ -45,7 +45,6 @@ #include "r600_emit.h" #include "program/programopt.h" -#include "r700_debug.h" #include "evergreen_vertprog.h" unsigned int evergreen_Map_Vertex_Output(r700_AssemblerBase *pAsm, -- cgit v1.2.3 From c1ab2c327e37119b5dda3de85f672a8af22ad1bb Mon Sep 17 00:00:00 2001 From: Marek Olšák Date: Thu, 26 Aug 2010 03:28:47 +0200 Subject: r300g: fix constant buffer upload once again for r3xx->r4xx --- src/gallium/drivers/r300/r300_emit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_emit.c b/src/gallium/drivers/r300/r300_emit.c index 90bc9c56d3..58d7e4ffe9 100644 --- a/src/gallium/drivers/r300/r300_emit.c +++ b/src/gallium/drivers/r300/r300_emit.c @@ -182,7 +182,7 @@ void r300_emit_fs_constants(struct r300_context* r300, unsigned size, void *stat OUT_CS_REG_SEQ(R300_PFS_PARAM_0_X, count * 4); if (buf->remap_table){ for (i = 0; i < count; i++) { - uint32_t *data = &buf->ptr[buf->remap_table[i]*4]; + float *data = (float*)&buf->ptr[buf->remap_table[i]*4]; for (j = 0; j < 4; j++) OUT_CS(pack_float24(data[j])); } -- cgit v1.2.3 From c65c86cfe73e8cfd903b33a883266b7e08a71723 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Wed, 25 Aug 2010 22:34:31 -0700 Subject: util: Clean up header file inclusion in u_upload_mgr.h. Remove p_defines.h. Remove unnecessary forward declarations. Add forward declaration for pipe_context. --- src/gallium/auxiliary/util/u_upload_mgr.h | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'src') diff --git a/src/gallium/auxiliary/util/u_upload_mgr.h b/src/gallium/auxiliary/util/u_upload_mgr.h index a124924fc8..de016df02e 100644 --- a/src/gallium/auxiliary/util/u_upload_mgr.h +++ b/src/gallium/auxiliary/util/u_upload_mgr.h @@ -32,11 +32,8 @@ #ifndef U_UPLOAD_MGR_H #define U_UPLOAD_MGR_H -#include "pipe/p_defines.h" - -struct pipe_screen; +struct pipe_context; struct pipe_resource; -struct u_upload_mgr; struct u_upload_mgr *u_upload_create( struct pipe_context *pipe, -- cgit v1.2.3 From 58cfbd697d2a6ca8d00ce17b2783023bc3256019 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Wed, 25 Aug 2010 22:41:20 -0700 Subject: util: Include missing headers in u_tile.h. Include p_format.h for enum pipe_format symbol. Include p_state.h for pipe_box symbol. --- src/gallium/auxiliary/util/u_tile.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src') diff --git a/src/gallium/auxiliary/util/u_tile.h b/src/gallium/auxiliary/util/u_tile.h index 986eee0743..558351d0ce 100644 --- a/src/gallium/auxiliary/util/u_tile.h +++ b/src/gallium/auxiliary/util/u_tile.h @@ -29,7 +29,10 @@ #define P_TILE_H #include "pipe/p_compiler.h" +#include "pipe/p_format.h" +#include "pipe/p_state.h" +struct pipe_context; struct pipe_transfer; /** -- cgit v1.2.3 From c32f87c39ce2b2e0ac6ae93d3bd5f286bf345613 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Thu, 26 Aug 2010 06:40:49 +0100 Subject: scons: Fix old script compatability logic. Sconscript could be invoked twice if specified in the command line. --- src/gallium/targets/SConscript | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/gallium/targets/SConscript b/src/gallium/targets/SConscript index f8276b1555..e447d09361 100644 --- a/src/gallium/targets/SConscript +++ b/src/gallium/targets/SConscript @@ -1,18 +1,13 @@ import os Import('*') - + # Compatibility with old build scripts: # if 'mesa' in env['statetrackers']: - if 'xlib' in env['winsys']: - SConscript([ - 'libgl-xlib/SConscript', - ]) - - if 'gdi' in env['winsys']: - SConscript([ - 'libgl-gdi/SConscript', - ]) + if 'xlib' in env['winsys'] and 'libgl-xlib' not in env['targets']: + env['targets'].append('libgl-xlib') + if 'gdi' in env['winsys'] and 'libgl-gdi' not in env['targets']: + env['targets'].append('libgl-gdi') if not 'graw-xlib' in env['targets'] and not 'graw-null' in env['targets'] and not env['msvc']: # XXX: disable until MSVC can link correctly -- cgit v1.2.3 From f0eb02af800ea1c4be6847ead0096d368d9276ff Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Thu, 26 Aug 2010 06:44:02 +0100 Subject: graw: Dynamically load graw libraries. This allows to build multiple graws libs simultaneously and avoid unnecessary rebuilds of the tests. Also remove graw_util.c from inside the graw implementation -- it was only being provided by one implementation, and graw tests were linking against gallium anyway. --- src/gallium/include/state_tracker/graw_dl.h | 152 ++++++++++++++++++++++++++++ src/gallium/targets/graw-xlib/SConscript | 1 - src/gallium/targets/graw-xlib/graw_util.c | 49 --------- src/gallium/tests/graw/SConscript | 9 +- src/gallium/tests/graw/clear.c | 2 +- src/gallium/tests/graw/fs-test.c | 2 +- src/gallium/tests/graw/gs-test.c | 2 +- src/gallium/tests/graw/quad-tex.c | 2 +- src/gallium/tests/graw/tri-gs.c | 2 +- src/gallium/tests/graw/tri-instanced.c | 2 +- src/gallium/tests/graw/tri.c | 2 +- src/gallium/tests/graw/vs-test.c | 2 +- 12 files changed, 161 insertions(+), 66 deletions(-) create mode 100644 src/gallium/include/state_tracker/graw_dl.h delete mode 100644 src/gallium/targets/graw-xlib/graw_util.c (limited to 'src') diff --git a/src/gallium/include/state_tracker/graw_dl.h b/src/gallium/include/state_tracker/graw_dl.h new file mode 100644 index 0000000000..0b326ca9f1 --- /dev/null +++ b/src/gallium/include/state_tracker/graw_dl.h @@ -0,0 +1,152 @@ +#ifndef GALLIUM_RAW_DL_H +#define GALLIUM_RAW_DL_H + +/* This is an API for exercising gallium functionality in a + * platform-neutral fashion. Whatever platform integration is + * necessary to implement this interface is orchestrated by the + * individual target building this entity. + * + * For instance, the graw-xlib target includes code to implent these + * interfaces on top of the X window system. + * + * Programs using this interface may additionally benefit from some of + * the utilities currently in the libgallium.a library, especially + * those for parsing text representations of TGSI shaders. + */ + +#include "pipe/p_compiler.h" +#include "pipe/p_format.h" +#include "pipe/p_context.h" +#include "util/u_dl.h" +#include "tgsi/tgsi_text.h" +#include + + +struct pipe_screen; +struct pipe_context; + + +typedef void * +(*pfn_graw_create_window_and_screen_t)( int x, + int y, + unsigned width, + unsigned height, + enum pipe_format format, + void **handle ); + +typedef void +(*pfn_graw_set_display_func_t)( void (*func)( void ) ); + +typedef void +(*pfn_graw_main_loop_t)( void ); + + +static pfn_graw_create_window_and_screen_t +pfn_graw_create_window_and_screen = NULL; + +static pfn_graw_set_display_func_t +pfn_graw_set_display_func = NULL; + +static pfn_graw_main_loop_t +pfn_graw_main_loop = NULL; + + +static INLINE void * +graw_create_window_and_screen( int x, + int y, + unsigned width, + unsigned height, + enum pipe_format format, + void **handle ) +{ + static struct util_dl_library *lib; + lib = util_dl_open(UTIL_DL_PREFIX "graw" UTIL_DL_EXT); + if (!lib) + goto error; + pfn_graw_create_window_and_screen = (pfn_graw_create_window_and_screen_t) + util_dl_get_proc_address(lib, "graw_create_window_and_screen"); + if (!pfn_graw_create_window_and_screen) + goto error; + pfn_graw_set_display_func = (pfn_graw_set_display_func_t) + util_dl_get_proc_address(lib, "graw_set_display_func"); + if (!pfn_graw_set_display_func) + goto error; + pfn_graw_main_loop = (pfn_graw_main_loop_t) + util_dl_get_proc_address(lib, "graw_main_loop"); + if (!pfn_graw_main_loop) + goto error; + return pfn_graw_create_window_and_screen(x, y, width, height, format, handle ); +error: + fprintf(stderr, "failed to open " UTIL_DL_PREFIX "graw" UTIL_DL_EXT "\n"); + return NULL; +} + +static INLINE void +graw_set_display_func( void (*func)( void ) ) +{ + if (!pfn_graw_set_display_func) + return; + pfn_graw_set_display_func(func); +} + +static INLINE void +graw_main_loop( void ) +{ + if (!pfn_graw_main_loop) + return; + pfn_graw_main_loop(); +} + + +/* + * Helper functions. These are the same for all graw implementations. + * + * XXX: These aren't graw related. If they are useful then should go somwhere + * inside auxiliary/util. + */ + +#define GRAW_MAX_NUM_TOKENS 1024 + +static INLINE void * +graw_parse_geometry_shader(struct pipe_context *pipe, + const char *text) +{ + struct tgsi_token tokens[GRAW_MAX_NUM_TOKENS]; + struct pipe_shader_state state; + + if (!tgsi_text_translate(text, tokens, GRAW_MAX_NUM_TOKENS)) + return NULL; + + state.tokens = tokens; + return pipe->create_gs_state(pipe, &state); +} + +static INLINE void * +graw_parse_vertex_shader(struct pipe_context *pipe, + const char *text) +{ + struct tgsi_token tokens[GRAW_MAX_NUM_TOKENS]; + struct pipe_shader_state state; + + if (!tgsi_text_translate(text, tokens, GRAW_MAX_NUM_TOKENS)) + return NULL; + + state.tokens = tokens; + return pipe->create_vs_state(pipe, &state); +} + +static INLINE void * +graw_parse_fragment_shader(struct pipe_context *pipe, + const char *text) +{ + struct tgsi_token tokens[GRAW_MAX_NUM_TOKENS]; + struct pipe_shader_state state; + + if (!tgsi_text_translate(text, tokens, GRAW_MAX_NUM_TOKENS)) + return NULL; + + state.tokens = tokens; + return pipe->create_fs_state(pipe, &state); +} + +#endif diff --git a/src/gallium/targets/graw-xlib/SConscript b/src/gallium/targets/graw-xlib/SConscript index 21fce948f4..32b98cdef3 100644 --- a/src/gallium/targets/graw-xlib/SConscript +++ b/src/gallium/targets/graw-xlib/SConscript @@ -26,7 +26,6 @@ env.Append(CPPPATH = [ sources = [ 'graw_xlib.c', - 'graw_util.c', ] env.Tool('x11') diff --git a/src/gallium/targets/graw-xlib/graw_util.c b/src/gallium/targets/graw-xlib/graw_util.c deleted file mode 100644 index 47aca4464d..0000000000 --- a/src/gallium/targets/graw-xlib/graw_util.c +++ /dev/null @@ -1,49 +0,0 @@ - -#include "pipe/p_compiler.h" -#include "pipe/p_context.h" -#include "tgsi/tgsi_text.h" -#include "util/u_memory.h" -#include "state_tracker/graw.h" - - -/* Helper functions. These are the same for all graw implementations. - */ -void *graw_parse_geometry_shader(struct pipe_context *pipe, - const char *text) -{ - struct tgsi_token tokens[1024]; - struct pipe_shader_state state; - - if (!tgsi_text_translate(text, tokens, Elements(tokens))) - return NULL; - - state.tokens = tokens; - return pipe->create_gs_state(pipe, &state); -} - -void *graw_parse_vertex_shader(struct pipe_context *pipe, - const char *text) -{ - struct tgsi_token tokens[1024]; - struct pipe_shader_state state; - - if (!tgsi_text_translate(text, tokens, Elements(tokens))) - return NULL; - - state.tokens = tokens; - return pipe->create_vs_state(pipe, &state); -} - -void *graw_parse_fragment_shader(struct pipe_context *pipe, - const char *text) -{ - struct tgsi_token tokens[1024]; - struct pipe_shader_state state; - - if (!tgsi_text_translate(text, tokens, Elements(tokens))) - return NULL; - - state.tokens = tokens; - return pipe->create_fs_state(pipe, &state); -} - diff --git a/src/gallium/tests/graw/SConscript b/src/gallium/tests/graw/SConscript index 860a17e13e..5ef395e033 100644 --- a/src/gallium/tests/graw/SConscript +++ b/src/gallium/tests/graw/SConscript @@ -1,15 +1,8 @@ Import('*') -try: - graw -except NameError: - print 'warning: graw library not avaiable: skipping build of graw test' - Return() - env = env.Clone() -env.Prepend(LIBPATH = [graw.dir]) -env.Prepend(LIBS = ['graw'] + gallium) +env.Prepend(LIBS = gallium) if platform in ('freebsd8', 'sunos5'): env.Append(LIBS = ['m']) diff --git a/src/gallium/tests/graw/clear.c b/src/gallium/tests/graw/clear.c index ce52a93aa1..c9a7b76188 100644 --- a/src/gallium/tests/graw/clear.c +++ b/src/gallium/tests/graw/clear.c @@ -2,7 +2,7 @@ * any utility code, just the graw interface and gallium. */ -#include "state_tracker/graw.h" +#include "state_tracker/graw_dl.h" #include "pipe/p_screen.h" #include "pipe/p_context.h" #include "pipe/p_state.h" diff --git a/src/gallium/tests/graw/fs-test.c b/src/gallium/tests/graw/fs-test.c index 53fbb744d8..c0ed6e06e4 100644 --- a/src/gallium/tests/graw/fs-test.c +++ b/src/gallium/tests/graw/fs-test.c @@ -2,7 +2,7 @@ * any utility code, just the graw interface and gallium. */ -#include "state_tracker/graw.h" +#include "state_tracker/graw_dl.h" #include "pipe/p_screen.h" #include "pipe/p_context.h" #include "pipe/p_shader_tokens.h" diff --git a/src/gallium/tests/graw/gs-test.c b/src/gallium/tests/graw/gs-test.c index 62714900bd..0f029e70c2 100644 --- a/src/gallium/tests/graw/gs-test.c +++ b/src/gallium/tests/graw/gs-test.c @@ -2,7 +2,7 @@ * any utility code, just the graw interface and gallium. */ -#include "state_tracker/graw.h" +#include "state_tracker/graw_dl.h" #include "pipe/p_screen.h" #include "pipe/p_context.h" #include "pipe/p_shader_tokens.h" diff --git a/src/gallium/tests/graw/quad-tex.c b/src/gallium/tests/graw/quad-tex.c index c50ef12ab5..e7379e8c45 100644 --- a/src/gallium/tests/graw/quad-tex.c +++ b/src/gallium/tests/graw/quad-tex.c @@ -2,7 +2,7 @@ * any utility code, just the graw interface and gallium. */ -#include "state_tracker/graw.h" +#include "state_tracker/graw_dl.h" #include "pipe/p_screen.h" #include "pipe/p_context.h" #include "pipe/p_shader_tokens.h" diff --git a/src/gallium/tests/graw/tri-gs.c b/src/gallium/tests/graw/tri-gs.c index 152ae408eb..75466ce889 100644 --- a/src/gallium/tests/graw/tri-gs.c +++ b/src/gallium/tests/graw/tri-gs.c @@ -2,7 +2,7 @@ * any utility code, just the graw interface and gallium. */ -#include "state_tracker/graw.h" +#include "state_tracker/graw_dl.h" #include "pipe/p_screen.h" #include "pipe/p_context.h" #include "pipe/p_state.h" diff --git a/src/gallium/tests/graw/tri-instanced.c b/src/gallium/tests/graw/tri-instanced.c index 8859f745fd..67b40f78f7 100644 --- a/src/gallium/tests/graw/tri-instanced.c +++ b/src/gallium/tests/graw/tri-instanced.c @@ -5,7 +5,7 @@ #include #include -#include "state_tracker/graw.h" +#include "state_tracker/graw_dl.h" #include "pipe/p_screen.h" #include "pipe/p_context.h" #include "pipe/p_state.h" diff --git a/src/gallium/tests/graw/tri.c b/src/gallium/tests/graw/tri.c index 4dbd2c062a..e8f925d2f4 100644 --- a/src/gallium/tests/graw/tri.c +++ b/src/gallium/tests/graw/tri.c @@ -2,7 +2,7 @@ * any utility code, just the graw interface and gallium. */ -#include "state_tracker/graw.h" +#include "state_tracker/graw_dl.h" #include "pipe/p_screen.h" #include "pipe/p_context.h" #include "pipe/p_state.h" diff --git a/src/gallium/tests/graw/vs-test.c b/src/gallium/tests/graw/vs-test.c index e1cd814bf7..e693022526 100644 --- a/src/gallium/tests/graw/vs-test.c +++ b/src/gallium/tests/graw/vs-test.c @@ -2,7 +2,7 @@ * any utility code, just the graw interface and gallium. */ -#include "state_tracker/graw.h" +#include "state_tracker/graw_dl.h" #include "pipe/p_screen.h" #include "pipe/p_context.h" #include "pipe/p_shader_tokens.h" -- cgit v1.2.3 From 43d94dba5f5b316f2156b176009eb07a6acbe3b2 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Thu, 26 Aug 2010 06:47:24 +0100 Subject: graw: Remove graw-null. Pointless now that the graw tests can be built independently of any graw implementation. --- SConstruct | 3 +- src/gallium/targets/SConscript | 5 -- src/gallium/targets/graw-null/SConscript | 58 ------------------- src/gallium/targets/graw-null/graw_null.c | 95 ------------------------------- 4 files changed, 1 insertion(+), 160 deletions(-) delete mode 100644 src/gallium/targets/graw-null/SConscript delete mode 100644 src/gallium/targets/graw-null/graw_null.c (limited to 'src') diff --git a/SConstruct b/SConstruct index bb03e5055e..14663727f5 100644 --- a/SConstruct +++ b/SConstruct @@ -31,7 +31,7 @@ import common # Configuration options default_statetrackers = 'mesa' -default_targets = 'graw-null' +default_targets = 'none' if common.default_platform in ('linux', 'freebsd', 'darwin'): default_drivers = 'softpipe,failover,svga,i915,i965,trace,identity,llvmpipe' @@ -69,7 +69,6 @@ opts.Add(ListVariable('targets', 'driver targets to build', default_targets, 'egl-swrast', 'egl-vmwgfx', 'graw-xlib', - 'graw-null', 'libgl-gdi', 'libgl-xlib', 'xorg-i915', diff --git a/src/gallium/targets/SConscript b/src/gallium/targets/SConscript index e447d09361..7eecdb24c7 100644 --- a/src/gallium/targets/SConscript +++ b/src/gallium/targets/SConscript @@ -9,11 +9,6 @@ if 'mesa' in env['statetrackers']: if 'gdi' in env['winsys'] and 'libgl-gdi' not in env['targets']: env['targets'].append('libgl-gdi') -if not 'graw-xlib' in env['targets'] and not 'graw-null' in env['targets'] and not env['msvc']: - # XXX: disable until MSVC can link correctly - SConscript('graw-null/SConscript') - - if env['dri']: SConscript([ 'SConscript.dri' diff --git a/src/gallium/targets/graw-null/SConscript b/src/gallium/targets/graw-null/SConscript deleted file mode 100644 index 3416989d8e..0000000000 --- a/src/gallium/targets/graw-null/SConscript +++ /dev/null @@ -1,58 +0,0 @@ -####################################################################### -# SConscript for xlib winsys - -Import('*') - -env = env.Clone() - -env.Prepend(LIBS = [ - ws_null, - trace, - rbug, - identity, -# gallium, -]) - -env.Append(CPPPATH = [ - '#src/gallium/drivers', -]) - -if env['platform'] == 'windows': - # For trace - env.Append(LIBS = [ - 'ws2_32', - ]) - -sources = [ - 'graw_null.c', - '../graw-xlib/graw_util.c', -] - -if True: - env.Append(CPPDEFINES = 'GALLIUM_SOFTPIPE') - env.Prepend(LIBS = [softpipe]) - -if env['llvm']: - env.Append(CPPDEFINES = 'GALLIUM_LLVMPIPE') - env.Tool('udis86') - env.Prepend(LIBS = [llvmpipe]) - -# Need this for trace, identity drivers referenced by -# gallium_wrap_screen(). -# -env.Prepend(LIBS = [gallium]) - -# TODO: write a wrapper function http://www.scons.org/wiki/WrapperFunctions -graw = env.SharedLibrary( - target ='graw', - source = sources, -) - -env.InstallSharedLibrary(graw, version=(1, 0)) - -if env['platform'] == 'windows': - graw = env.FindIxes(graw, 'LIBPREFIX', 'LIBSUFFIX') -else: - graw = env.FindIxes(graw, 'SHLIBPREFIX', 'SHLIBSUFFIX') - -Export('graw') diff --git a/src/gallium/targets/graw-null/graw_null.c b/src/gallium/targets/graw-null/graw_null.c deleted file mode 100644 index 5939a5acd3..0000000000 --- a/src/gallium/targets/graw-null/graw_null.c +++ /dev/null @@ -1,95 +0,0 @@ -#include "pipe/p_compiler.h" -#include "util/u_debug.h" -#include "util/u_memory.h" -#include "target-helpers/wrap_screen.h" -#include "sw/null/null_sw_winsys.h" -#include "os/os_time.h" -#include "state_tracker/graw.h" - -#ifdef GALLIUM_SOFTPIPE -#include "softpipe/sp_public.h" -#endif - -#ifdef GALLIUM_LLVMPIPE -#include "llvmpipe/lp_public.h" -#endif - -/* Haven't figured out a decent way to build the helper code yet - - * #include it here temporarily. - */ -#include "sw/sw_public.h" -#include "sw/sw.c" - -#include - - -static struct { - void (*draw)(void); -} graw; - - - -struct pipe_screen * -graw_create_window_and_screen( int x, - int y, - unsigned width, - unsigned height, - enum pipe_format format, - void **handle) -{ - const char *default_driver; - const char *driver; - struct pipe_screen *screen = NULL; - struct sw_winsys *winsys = NULL; - static int dummy; - - - /* Create the underlying winsys, which performs presents to Xlib - * drawables: - */ - winsys = null_sw_create(); - if (winsys == NULL) - return NULL; - -#if defined(GALLIUM_LLVMPIPE) - default_driver = "llvmpipe"; -#elif defined(GALLIUM_SOFTPIPE) - default_driver = "softpipe"; -#else - default_driver = ""; -#endif - - driver = debug_get_option("GALLIUM_DRIVER", default_driver); - -#if defined(GALLIUM_LLVMPIPE) - if (screen == NULL && strcmp(driver, "llvmpipe") == 0) - screen = llvmpipe_create_screen( winsys ); -#endif - -#if defined(GALLIUM_SOFTPIPE) - if (screen == NULL) - screen = softpipe_create_screen( winsys ); -#endif - - *handle = &dummy; - - /* Inject any wrapping layers we want to here: - */ - return gallium_wrap_screen( screen ); -} - - - -void -graw_set_display_func( void (*draw)( void ) ) -{ - graw.draw = draw; -} - - -void -graw_main_loop( void ) -{ - graw.draw(); - os_time_sleep(100000); -} -- cgit v1.2.3 From cc3e322d967e51a8c0fa794a310a93ee4b684a91 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Wed, 25 Aug 2010 22:50:15 -0700 Subject: util: Include missing headers in u_split_prim.h. Include p_compiler.h for boolean symbol. Include u_debug.h for assert symbol. --- src/gallium/auxiliary/util/u_split_prim.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/auxiliary/util/u_split_prim.h b/src/gallium/auxiliary/util/u_split_prim.h index e63a7c1fad..8af8a7e71d 100644 --- a/src/gallium/auxiliary/util/u_split_prim.h +++ b/src/gallium/auxiliary/util/u_split_prim.h @@ -1,5 +1,8 @@ /* Originally written by Ben Skeggs for the nv50 driver*/ -#include +#include "pipe/p_defines.h" +#include "pipe/p_compiler.h" + +#include "util/u_debug.h" struct util_split_prim { void *priv; -- cgit v1.2.3 From c7111f321ca16f2c72cc59975b728a566daae95a Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Wed, 25 Aug 2010 22:55:15 -0700 Subject: util: Add include guard in u_split_prim.h. --- src/gallium/auxiliary/util/u_split_prim.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src') diff --git a/src/gallium/auxiliary/util/u_split_prim.h b/src/gallium/auxiliary/util/u_split_prim.h index 8af8a7e71d..7f80fc1270 100644 --- a/src/gallium/auxiliary/util/u_split_prim.h +++ b/src/gallium/auxiliary/util/u_split_prim.h @@ -1,4 +1,8 @@ /* Originally written by Ben Skeggs for the nv50 driver*/ + +#ifndef U_SPLIT_PRIM_H +#define U_SPLIT_PRIM_H + #include "pipe/p_defines.h" #include "pipe/p_compiler.h" @@ -106,3 +110,5 @@ util_split_prim_next(struct util_split_prim *s, unsigned max_verts) s->p_start += (max_verts - repeat); return FALSE; } + +#endif /* U_SPLIT_PRIM_H */ -- cgit v1.2.3 From d2dd23e85890d697ea6d848f0a3a03fe283edb0a Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Wed, 25 Aug 2010 23:04:39 -0700 Subject: util: Include missing header in u_dirty_surfaces.h. Include p_state.h for pipe_surface symbol. --- src/gallium/auxiliary/util/u_dirty_surfaces.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src') diff --git a/src/gallium/auxiliary/util/u_dirty_surfaces.h b/src/gallium/auxiliary/util/u_dirty_surfaces.h index c157300502..fd1bbe5ffd 100644 --- a/src/gallium/auxiliary/util/u_dirty_surfaces.h +++ b/src/gallium/auxiliary/util/u_dirty_surfaces.h @@ -27,9 +27,13 @@ #ifndef U_DIRTY_SURFACES_H_ #define U_DIRTY_SURFACES_H_ +#include "pipe/p_state.h" + #include "util/u_double_list.h" #include "util/u_math.h" +struct pipe_context; + typedef void (*util_dirty_surface_flush_t) (struct pipe_context *, struct pipe_surface *); struct util_dirty_surfaces -- cgit v1.2.3 From 3e41029d6e4e89a52679303d50b7c6b7c1c58f41 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Wed, 25 Aug 2010 23:31:04 -0700 Subject: util: Include missing header in u_bitmask.h. Include p_compiler.h for boolean symbol. --- src/gallium/auxiliary/util/u_bitmask.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src') diff --git a/src/gallium/auxiliary/util/u_bitmask.h b/src/gallium/auxiliary/util/u_bitmask.h index 87f1110296..98b85ddecd 100644 --- a/src/gallium/auxiliary/util/u_bitmask.h +++ b/src/gallium/auxiliary/util/u_bitmask.h @@ -36,6 +36,9 @@ #define U_HANDLE_BITMASK_H_ +#include "pipe/p_compiler.h" + + #ifdef __cplusplus extern "C" { #endif -- cgit v1.2.3 From d8ad10dc45d39978a25a300a386440a5cb39a40d Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Wed, 25 Aug 2010 23:37:27 -0700 Subject: util: Include missing header in u_blit.h. Include p_compiler.h for uint symbol. Clean up forward declarations. --- src/gallium/auxiliary/util/u_blit.h | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/gallium/auxiliary/util/u_blit.h b/src/gallium/auxiliary/util/u_blit.h index ef95134f32..b8a0dfce13 100644 --- a/src/gallium/auxiliary/util/u_blit.h +++ b/src/gallium/auxiliary/util/u_blit.h @@ -30,18 +30,20 @@ #define U_BLIT_H +#include "pipe/p_compiler.h" + + #ifdef __cplusplus extern "C" { #endif +struct cso_context; struct pipe_context; -struct pipe_surface; struct pipe_resource; -struct cso_context; - - -struct blit_state; +struct pipe_sampler_view; +struct pipe_subresource; +struct pipe_surface; extern struct blit_state * -- cgit v1.2.3 From 0673b46933735cf7a1a923b93ce88e99714decd6 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 25 Aug 2010 23:14:45 -0700 Subject: mesa: Don't warn when the desired result of s3tc lib available occurs. --- src/mesa/main/texcompress_s3tc.c | 1 - 1 file changed, 1 deletion(-) (limited to 'src') diff --git a/src/mesa/main/texcompress_s3tc.c b/src/mesa/main/texcompress_s3tc.c index c70792cab6..8e05980262 100644 --- a/src/mesa/main/texcompress_s3tc.c +++ b/src/mesa/main/texcompress_s3tc.c @@ -149,7 +149,6 @@ _mesa_init_texture_s3tc( GLcontext *ctx ) } if (dxtlibhandle) { ctx->Mesa_DXTn = GL_TRUE; - _mesa_warning(ctx, "software DXTn compression/decompression available"); } #else (void) ctx; -- cgit v1.2.3 From 7af8f7f164dba479de25aed835c890db39351d8d Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 25 Aug 2010 23:24:50 -0700 Subject: mesa: Move the x86 detection debug messages next to the detection. --- src/mesa/x86/common_x86.c | 35 +++++++++++++++++++++++++++++++++++ src/mesa/x86/x86_xform.c | 37 ++++--------------------------------- 2 files changed, 39 insertions(+), 33 deletions(-) (limited to 'src') diff --git a/src/mesa/x86/common_x86.c b/src/mesa/x86/common_x86.c index 5efdb4f24a..e8509a1edd 100644 --- a/src/mesa/x86/common_x86.c +++ b/src/mesa/x86/common_x86.c @@ -289,5 +289,40 @@ _mesa_get_x86_features(void) } } + +#ifdef USE_MMX_ASM + if ( cpu_has_mmx ) { + if ( _mesa_getenv( "MESA_NO_MMX" ) == 0 ) { + _mesa_debug(NULL, "MMX cpu detected.\n"); + } else { + _mesa_x86_cpu_features &= ~(X86_FEATURE_MMX); + } + } +#endif + +#ifdef USE_3DNOW_ASM + if ( cpu_has_3dnow ) { + if ( _mesa_getenv( "MESA_NO_3DNOW" ) == 0 ) { + _mesa_debug(NULL, "3DNow! cpu detected.\n"); + } else { + _mesa_x86_cpu_features &= ~(X86_FEATURE_3DNOW); + } + } +#endif + +#ifdef USE_SSE_ASM + if ( cpu_has_xmm ) { + if ( _mesa_getenv( "MESA_NO_SSE" ) == 0 ) { + _mesa_debug(NULL, "SSE cpu detected.\n"); + if ( _mesa_getenv( "MESA_FORCE_SSE" ) == 0 ) { + _mesa_check_os_sse_support(); + } + } else { + _mesa_debug(NULL, "SSE cpu detected, but switched off by user.\n"); + _mesa_x86_cpu_features &= ~(X86_FEATURE_XMM); + } + } +#endif + #endif /* USE_X86_ASM */ } diff --git a/src/mesa/x86/x86_xform.c b/src/mesa/x86/x86_xform.c index c834e2b468..3dcc55e16b 100644 --- a/src/mesa/x86/x86_xform.c +++ b/src/mesa/x86/x86_xform.c @@ -114,42 +114,13 @@ void _mesa_init_all_x86_transform_asm( void ) _mesa_init_x86_transform_asm(); } -#ifdef USE_MMX_ASM - if ( cpu_has_mmx ) { - if ( _mesa_getenv( "MESA_NO_MMX" ) == 0 ) { - _mesa_debug(NULL, "MMX cpu detected.\n"); - } else { - _mesa_x86_cpu_features &= ~(X86_FEATURE_MMX); - } + if (cpu_has_3dnow) { + _mesa_init_3dnow_transform_asm(); } -#endif - -#ifdef USE_3DNOW_ASM - if ( cpu_has_3dnow ) { - if ( _mesa_getenv( "MESA_NO_3DNOW" ) == 0 ) { - _mesa_debug(NULL, "3DNow! cpu detected.\n"); - _mesa_init_3dnow_transform_asm(); - } else { - _mesa_x86_cpu_features &= ~(X86_FEATURE_3DNOW); - } - } -#endif -#ifdef USE_SSE_ASM if ( cpu_has_xmm ) { - if ( _mesa_getenv( "MESA_NO_SSE" ) == 0 ) { - _mesa_debug(NULL, "SSE cpu detected.\n"); - if ( _mesa_getenv( "MESA_FORCE_SSE" ) == 0 ) { - _mesa_check_os_sse_support(); - } - if ( cpu_has_xmm ) { - _mesa_init_sse_transform_asm(); - } - } else { - _mesa_debug(NULL, "SSE cpu detected, but switched off by user.\n"); - _mesa_x86_cpu_features &= ~(X86_FEATURE_XMM); - } + _mesa_init_sse_transform_asm(); } -#endif + #endif } -- cgit v1.2.3 From aa2f55883b9a4e8a192c5dcc97ae7fdab2a33e0a Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 25 Aug 2010 23:26:29 -0700 Subject: mesa: Disable the debug spam for x86 CPU detection with a compile-time flag. I don't know of any problems with CPU detection in years. Don't spam the user that was just looking to enable assertions with this stuff. --- src/mesa/x86/common_x86.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/mesa/x86/common_x86.c b/src/mesa/x86/common_x86.c index e8509a1edd..f763a3aa8a 100644 --- a/src/mesa/x86/common_x86.c +++ b/src/mesa/x86/common_x86.c @@ -55,7 +55,7 @@ /** Bitmask of X86_FEATURE_x bits */ int _mesa_x86_cpu_features = 0x0; - +static int detection_debug = GL_FALSE; /* No reason for this to be public. */ @@ -190,7 +190,8 @@ void _mesa_check_os_sse_support( void ) #else /* Do nothing on other platforms for now. */ - _mesa_debug(NULL, "Not testing OS support for SSE, leaving enabled.\n"); + if (detection_debug) + _mesa_debug(NULL, "Not testing OS support for SSE, leaving enabled.\n"); #endif /* __FreeBSD__ */ } @@ -232,7 +233,8 @@ _mesa_get_x86_features(void) _mesa_x86_cpuid(0, &result, (GLuint *)(cpu_vendor + 0), (GLuint *)(cpu_vendor + 8), (GLuint *)(cpu_vendor + 4)); cpu_vendor[12] = '\0'; - _mesa_debug(NULL, "CPU vendor: %s\n", cpu_vendor); + if (detection_debug) + _mesa_debug(NULL, "CPU vendor: %s\n", cpu_vendor); /* get cpu features */ cpu_features = _mesa_x86_cpuid_edx(1); @@ -284,7 +286,8 @@ _mesa_get_x86_features(void) _mesa_x86_cpuid(0x80000002+ofs, (GLuint *)(cpu_name + (16*ofs)+0), (GLuint *)(cpu_name + (16*ofs)+4), (GLuint *)(cpu_name + (16*ofs)+8), (GLuint *)(cpu_name + (16*ofs)+12)); cpu_name[48] = '\0'; /* the name should be NULL terminated, but just to be sure */ - _mesa_debug(NULL, "CPU name: %s\n", cpu_name); + if (detection_debug) + _mesa_debug(NULL, "CPU name: %s\n", cpu_name); } } @@ -293,7 +296,8 @@ _mesa_get_x86_features(void) #ifdef USE_MMX_ASM if ( cpu_has_mmx ) { if ( _mesa_getenv( "MESA_NO_MMX" ) == 0 ) { - _mesa_debug(NULL, "MMX cpu detected.\n"); + if (detection_debug) + _mesa_debug(NULL, "MMX cpu detected.\n"); } else { _mesa_x86_cpu_features &= ~(X86_FEATURE_MMX); } @@ -303,7 +307,8 @@ _mesa_get_x86_features(void) #ifdef USE_3DNOW_ASM if ( cpu_has_3dnow ) { if ( _mesa_getenv( "MESA_NO_3DNOW" ) == 0 ) { - _mesa_debug(NULL, "3DNow! cpu detected.\n"); + if (detection_debug) + _mesa_debug(NULL, "3DNow! cpu detected.\n"); } else { _mesa_x86_cpu_features &= ~(X86_FEATURE_3DNOW); } @@ -313,7 +318,8 @@ _mesa_get_x86_features(void) #ifdef USE_SSE_ASM if ( cpu_has_xmm ) { if ( _mesa_getenv( "MESA_NO_SSE" ) == 0 ) { - _mesa_debug(NULL, "SSE cpu detected.\n"); + if (detection_debug) + _mesa_debug(NULL, "SSE cpu detected.\n"); if ( _mesa_getenv( "MESA_FORCE_SSE" ) == 0 ) { _mesa_check_os_sse_support(); } -- cgit v1.2.3 From c735d85395f8f0c0a71b04ebc728390970271fe2 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 25 Aug 2010 23:27:56 -0700 Subject: glsl: Don't consider things with a type containing a sampler as an lvalue. We had ad-hoc handled some common cases by flagging sampler-typed variables as read_only, and rejected initializers of samplers. However, people could sneak them in in all sorts of surprising ways, like using whole-array or structure assignment. Fixes: glslparsertest/glsl2/sampler-01.frag glslparsertest/glsl2/sampler-03.frag glslparsertest/glsl2/sampler-04.frag glslparsertest/glsl2/sampler-06.frag Bug #27403. --- src/glsl/ir.cpp | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'src') diff --git a/src/glsl/ir.cpp b/src/glsl/ir.cpp index e5ed10d3e4..31e40cac8c 100644 --- a/src/glsl/ir.cpp +++ b/src/glsl/ir.cpp @@ -697,6 +697,20 @@ ir_dereference_record::ir_dereference_record(ir_variable *var, ? this->record->type->field_type(field) : glsl_type::error_type; } +bool type_contains_sampler(const glsl_type *type) +{ + if (type->is_array()) { + return type_contains_sampler(type->fields.array); + } else if (type->is_record()) { + for (unsigned int i = 0; i < type->length; i++) { + if (type_contains_sampler(type->fields.structure[i].type)) + return true; + } + return false; + } else { + return type->is_sampler(); + } +} bool ir_dereference::is_lvalue() @@ -711,6 +725,15 @@ ir_dereference::is_lvalue() if (this->type->is_array() && !var->array_lvalue) return false; + /* From page 17 (page 23 of the PDF) of the GLSL 1.20 spec: + * + * "Samplers cannot be treated as l-values; hence cannot be used + * as out or inout function parameters, nor can they be + * assigned into." + */ + if (type_contains_sampler(this->type)) + return false; + return true; } -- cgit v1.2.3 From 9fd2a8d6923a8a7218a714622586bb1dbaaebad5 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 26 Aug 2010 00:07:58 -0700 Subject: glsl2: Move ir_expression_flattening to using the rvalue visitor class. The previous implementation was missing handling of some rvalues, such as "if" conditions, leading to glsl-mat-int-from-ctor-* not getting caught. --- src/glsl/ir_expression_flattening.cpp | 124 ++++------------------------------ 1 file changed, 14 insertions(+), 110 deletions(-) (limited to 'src') diff --git a/src/glsl/ir_expression_flattening.cpp b/src/glsl/ir_expression_flattening.cpp index ccb2e2bce9..7b1b8dbfef 100644 --- a/src/glsl/ir_expression_flattening.cpp +++ b/src/glsl/ir_expression_flattening.cpp @@ -35,15 +35,14 @@ #include "ir.h" #include "ir_visitor.h" +#include "ir_rvalue_visitor.h" #include "ir_expression_flattening.h" #include "glsl_types.h" -class ir_expression_flattening_visitor : public ir_hierarchical_visitor { +class ir_expression_flattening_visitor : public ir_rvalue_visitor { public: - ir_expression_flattening_visitor(ir_instruction *base_ir, - bool (*predicate)(ir_instruction *ir)) + ir_expression_flattening_visitor(bool (*predicate)(ir_instruction *ir)) { - this->base_ir = base_ir; this->predicate = predicate; } @@ -52,42 +51,34 @@ public: /* 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_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); + void handle_rvalue(ir_rvalue **rvalue); bool (*predicate)(ir_instruction *ir); - ir_instruction *base_ir; }; void do_expression_flattening(exec_list *instructions, bool (*predicate)(ir_instruction *ir)) { + ir_expression_flattening_visitor v(predicate); + foreach_iter(exec_list_iterator, iter, *instructions) { ir_instruction *ir = (ir_instruction *)iter.get(); - ir_expression_flattening_visitor v(ir, predicate); ir->accept(&v); } } - -ir_rvalue * -ir_expression_flattening_visitor::operand_to_temp(ir_rvalue *ir) +void +ir_expression_flattening_visitor::handle_rvalue(ir_rvalue **rvalue) { - void *ctx = base_ir; ir_variable *var; ir_assignment *assign; + ir_rvalue *ir = *rvalue; + + if (!ir || !this->predicate(ir)) + return; - if (!this->predicate(ir)) - return ir; + void *ctx = talloc_parent(ir); var = new(ctx) ir_variable(ir->type, "flattening_tmp", ir_var_temporary); base_ir->insert_before(var); @@ -97,92 +88,5 @@ ir_expression_flattening_visitor::operand_to_temp(ir_rvalue *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. - */ - 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(ir->val); - } - - return visit_continue; -} - -ir_visitor_status -ir_expression_flattening_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 = operand_to_temp(ir); - - if (new_ir != ir) { - ir->replace_with(new_ir); - } - } - - return visit_continue; -} - - -ir_visitor_status -ir_expression_flattening_visitor::visit_enter(ir_return *ir) -{ - if (ir->value) - ir->value = operand_to_temp(ir->value); - return visit_continue; + *rvalue = new(ctx) ir_dereference_variable(var); } -- cgit v1.2.3 From 7822f99193cd26558bff29ff8d6d23db2d3a1048 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Thu, 26 Aug 2010 00:22:19 -0700 Subject: pipebuffer: Clean up header file inclusion in pb_bufmgr.h. Remove p_compiler.h and p_defines.h. Include pb_buffer.h for pb_size symbol. --- src/gallium/auxiliary/pipebuffer/pb_bufmgr.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src') diff --git a/src/gallium/auxiliary/pipebuffer/pb_bufmgr.h b/src/gallium/auxiliary/pipebuffer/pb_bufmgr.h index cec2524da2..2ef02160f2 100644 --- a/src/gallium/auxiliary/pipebuffer/pb_bufmgr.h +++ b/src/gallium/auxiliary/pipebuffer/pb_bufmgr.h @@ -50,8 +50,7 @@ #define PB_BUFMGR_H_ -#include "pipe/p_compiler.h" -#include "pipe/p_defines.h" +#include "pb_buffer.h" #ifdef __cplusplus -- cgit v1.2.3 From b47af6ad6d40773141aeee5bbfbfdffb57dd2bd8 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Thu, 26 Aug 2010 00:29:58 -0700 Subject: rtasm: Include missing header in rtasm_x86sse.h. Include p_compiler.h for stdint.h uint*_t symbols. --- src/gallium/auxiliary/rtasm/rtasm_x86sse.h | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/gallium/auxiliary/rtasm/rtasm_x86sse.h b/src/gallium/auxiliary/rtasm/rtasm_x86sse.h index aa77892b2d..2b9678b176 100644 --- a/src/gallium/auxiliary/rtasm/rtasm_x86sse.h +++ b/src/gallium/auxiliary/rtasm/rtasm_x86sse.h @@ -24,6 +24,7 @@ #ifndef _RTASM_X86SSE_H_ #define _RTASM_X86SSE_H_ +#include "pipe/p_compiler.h" #include "pipe/p_config.h" #if defined(PIPE_ARCH_X86) || defined(PIPE_ARCH_X86_64) -- cgit v1.2.3 From f099e73b7b7ce1ae1aa23713c6418deb86b1a17a Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Thu, 26 Aug 2010 00:34:30 -0700 Subject: tgsi: Include missing header in tgsi_sse2.h. Include p_compiler.h for boolean symbol. Clean up forward declarations. --- src/gallium/auxiliary/tgsi/tgsi_sse2.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/auxiliary/tgsi/tgsi_sse2.h b/src/gallium/auxiliary/tgsi/tgsi_sse2.h index d81ee3d00e..00aa8b84fe 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_sse2.h +++ b/src/gallium/auxiliary/tgsi/tgsi_sse2.h @@ -32,9 +32,12 @@ extern "C" { #endif +#include "pipe/p_compiler.h" + +struct tgsi_exec_machine; +struct tgsi_interp_coef; struct tgsi_token; struct x86_function; -struct tgsi_interp_coef; unsigned tgsi_emit_sse2( -- cgit v1.2.3 From 57ce0de8cbdf09d7322e3930c25c0ba5e82ff2a9 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Thu, 26 Aug 2010 01:08:30 -0700 Subject: util: Include missing header in u_simple_shaders.c. Include p_state.h for PIPE_MAX_COLOR_BUFS symbol. --- src/gallium/auxiliary/util/u_simple_shaders.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/gallium/auxiliary/util/u_simple_shaders.c b/src/gallium/auxiliary/util/u_simple_shaders.c index 5b682f496c..58ef68377f 100644 --- a/src/gallium/auxiliary/util/u_simple_shaders.c +++ b/src/gallium/auxiliary/util/u_simple_shaders.c @@ -37,6 +37,7 @@ #include "pipe/p_context.h" #include "pipe/p_shader_tokens.h" +#include "pipe/p_state.h" #include "util/u_simple_shaders.h" #include "util/u_debug.h" #include "tgsi/tgsi_ureg.h" -- cgit v1.2.3 From 2badf0f6422208fd004ae62a58d2b5cdb2c2a174 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Thu, 26 Aug 2010 01:14:28 -0700 Subject: graw: Include missing header in graw_dl.h. Include p_state.h for pipe_shader_state symbol. --- src/gallium/include/state_tracker/graw_dl.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/gallium/include/state_tracker/graw_dl.h b/src/gallium/include/state_tracker/graw_dl.h index 0b326ca9f1..3c5c3d8647 100644 --- a/src/gallium/include/state_tracker/graw_dl.h +++ b/src/gallium/include/state_tracker/graw_dl.h @@ -14,12 +14,13 @@ * those for parsing text representations of TGSI shaders. */ +#include #include "pipe/p_compiler.h" -#include "pipe/p_format.h" #include "pipe/p_context.h" +#include "pipe/p_format.h" +#include "pipe/p_state.h" #include "util/u_dl.h" #include "tgsi/tgsi_text.h" -#include struct pipe_screen; -- cgit v1.2.3 From 81ac08f89d9f52d14aada43f4d00302cd9b32c68 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Thu, 26 Aug 2010 01:21:10 -0700 Subject: gallium: Clean up header file inclusion in p_context.h. Remove p_state.h. Include p_compiler.h for boolean symbol. Add needed forward declarations after removing p_state.h. --- src/gallium/include/pipe/p_context.h | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/gallium/include/pipe/p_context.h b/src/gallium/include/pipe/p_context.h index 0579962ec6..0e53aef6d2 100644 --- a/src/gallium/include/pipe/p_context.h +++ b/src/gallium/include/pipe/p_context.h @@ -28,19 +28,37 @@ #ifndef PIPE_CONTEXT_H #define PIPE_CONTEXT_H -#include "p_state.h" - +#include "p_compiler.h" #ifdef __cplusplus extern "C" { #endif - -struct pipe_screen; + +struct pipe_blend_color; +struct pipe_blend_state; +struct pipe_box; +struct pipe_clip_state; +struct pipe_depth_stencil_alpha_state; +struct pipe_draw_info; struct pipe_fence_handle; -struct pipe_state_cache; +struct pipe_framebuffer_state; +struct pipe_index_buffer; struct pipe_query; -struct pipe_winsys; +struct pipe_poly_stipple; +struct pipe_rasterizer_state; +struct pipe_resource; +struct pipe_sampler_state; +struct pipe_sampler_view; +struct pipe_scissor_state; +struct pipe_shader_state; +struct pipe_stencil_ref; +struct pipe_stream_output_state; +struct pipe_subresource; +struct pipe_surface; +struct pipe_vertex_buffer; +struct pipe_vertex_element; +struct pipe_viewport_state; /** * Gallium rendering context. Basically: -- cgit v1.2.3 From 121b6d68c212bba93d0c89df0fa38cc1dc7c09f2 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Thu, 26 Aug 2010 01:30:07 -0700 Subject: gallium: Clean up header file inclusion in p_defines.h. Remove p_format.h. Include p_compiler.h for boolean and uint64_t symbols. --- src/gallium/include/pipe/p_defines.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/include/pipe/p_defines.h b/src/gallium/include/pipe/p_defines.h index 35eccf1c90..627b5ae538 100644 --- a/src/gallium/include/pipe/p_defines.h +++ b/src/gallium/include/pipe/p_defines.h @@ -28,7 +28,7 @@ #ifndef PIPE_DEFINES_H #define PIPE_DEFINES_H -#include "p_format.h" +#include "p_compiler.h" #ifdef __cplusplus extern "C" { -- cgit v1.2.3 From 038068909fd1dc802bfd45b2154a24d8001daea6 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Thu, 26 Aug 2010 01:38:23 -0700 Subject: r300g: Include missing header in r300_texture_desc.h. Include p_format.h for enum pipe_format symbol. Fixes r300g build. --- src/gallium/drivers/r300/r300_texture_desc.h | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_texture_desc.h b/src/gallium/drivers/r300/r300_texture_desc.h index 95de66f654..3d7fe1fb47 100644 --- a/src/gallium/drivers/r300/r300_texture_desc.h +++ b/src/gallium/drivers/r300/r300_texture_desc.h @@ -24,6 +24,7 @@ #ifndef R300_TEXTURE_DESC_H #define R300_TEXTURE_DESC_H +#include "pipe/p_format.h" #include "r300_defines.h" struct pipe_resource; -- cgit v1.2.3 From c5279fd795eb4a0445285d5a9815de68b0c77626 Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Thu, 26 Aug 2010 00:38:59 +0800 Subject: st/egl: Make KMS support optional in KMS backend. It should be called DRM backend now. --- src/gallium/state_trackers/egl/kms/native_kms.c | 46 +++++++++++++------------ 1 file changed, 24 insertions(+), 22 deletions(-) (limited to 'src') diff --git a/src/gallium/state_trackers/egl/kms/native_kms.c b/src/gallium/state_trackers/egl/kms/native_kms.c index 0a69919328..208f73306c 100644 --- a/src/gallium/state_trackers/egl/kms/native_kms.c +++ b/src/gallium/state_trackers/egl/kms/native_kms.c @@ -588,7 +588,9 @@ kms_display_get_configs(struct native_display *ndpy, int *num_configs) nconf->color_format = format; - nconf->scanout_bit = TRUE; + /* support KMS */ + if (kdpy->resources) + nconf->scanout_bit = TRUE; } configs = MALLOC(sizeof(*configs)); @@ -746,32 +748,32 @@ kms_create_display(int fd, struct native_event_handler *event_handler, return NULL; } + kdpy->base.destroy = kms_display_destroy; + kdpy->base.get_param = kms_display_get_param; + kdpy->base.get_configs = kms_display_get_configs; + /* resources are fixed, unlike crtc, connector, or encoder */ kdpy->resources = drmModeGetResources(kdpy->fd); - if (!kdpy->resources) { - kms_display_destroy(&kdpy->base); - return NULL; - } + if (kdpy->resources) { + kdpy->saved_crtcs = + CALLOC(kdpy->resources->count_crtcs, sizeof(*kdpy->saved_crtcs)); + if (!kdpy->saved_crtcs) { + kms_display_destroy(&kdpy->base); + return NULL; + } - kdpy->saved_crtcs = - CALLOC(kdpy->resources->count_crtcs, sizeof(*kdpy->saved_crtcs)); - if (!kdpy->saved_crtcs) { - kms_display_destroy(&kdpy->base); - return NULL; - } + kdpy->shown_surfaces = + CALLOC(kdpy->resources->count_crtcs, sizeof(*kdpy->shown_surfaces)); + if (!kdpy->shown_surfaces) { + kms_display_destroy(&kdpy->base); + return NULL; + } - kdpy->shown_surfaces = - CALLOC(kdpy->resources->count_crtcs, sizeof(*kdpy->shown_surfaces)); - if (!kdpy->shown_surfaces) { - kms_display_destroy(&kdpy->base); - return NULL; + kdpy->base.modeset = &kms_display_modeset; + } + else { + _eglLog(_EGL_DEBUG, "Failed to get KMS resources. Disable modeset."); } - - kdpy->base.destroy = kms_display_destroy; - kdpy->base.get_param = kms_display_get_param; - kdpy->base.get_configs = kms_display_get_configs; - - kdpy->base.modeset = &kms_display_modeset; return &kdpy->base; } -- cgit v1.2.3 From 41c095bf31cedf4f463e315e8dbad8a007985464 Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Thu, 26 Aug 2010 00:51:28 +0800 Subject: st/mesa: Add support for surfaceless current contexts. A surfaceless current context is a context that is made current without draw and read framebuffers. Such contexts can only render to FBOs. --- src/mesa/state_tracker/st_manager.c | 31 +++++++++++++++++++++++++++---- 1 file changed, 27 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/mesa/state_tracker/st_manager.c b/src/mesa/state_tracker/st_manager.c index 2afc682e0b..ccce574c36 100644 --- a/src/mesa/state_tracker/st_manager.c +++ b/src/mesa/state_tracker/st_manager.c @@ -42,6 +42,7 @@ #include "main/texstate.h" #include "main/texfetch.h" #include "main/framebuffer.h" +#include "main/fbobject.h" #include "main/renderbuffer.h" #include "st_texture.h" @@ -247,6 +248,9 @@ st_framebuffer_add_renderbuffer(struct st_framebuffer *stfb, int samples; boolean sw; + if (!stfb->iface) + return FALSE; + /* do not distinguish depth/stencil buffers */ if (idx == BUFFER_STENCIL) idx = BUFFER_DEPTH; @@ -299,6 +303,10 @@ st_visual_to_context_mode(const struct st_visual *visual, { memset(mode, 0, sizeof(*mode)); + /* FBO-only context */ + if (!visual) + return; + if (st_visual_have_buffers(visual, ST_ATTACHMENT_BACK_LEFT_MASK)) mode->doubleBufferMode = GL_TRUE; if (st_visual_have_buffers(visual, @@ -422,6 +430,15 @@ st_framebuffer_create(struct st_framebuffer_iface *stfbi) if (!stfb) return NULL; + /* for FBO-only context */ + if (!stfbi) { + GLframebuffer *base = _mesa_get_incomplete_framebuffer(); + + stfb->Base = *base; + + return stfb; + } + st_visual_to_context_mode(stfbi->visual, &mode); _mesa_initialize_window_framebuffer(&stfb->Base, &mode); @@ -693,10 +710,14 @@ st_api_make_current(struct st_api *stapi, struct st_context_iface *stctxi, st_framebuffer_validate(stread, st); /* modify the draw/read buffers of the context */ - st_visual_to_default_buffer(stdraw->iface->visual, - &st->ctx->Color.DrawBuffer[0], NULL); - st_visual_to_default_buffer(stread->iface->visual, - &st->ctx->Pixel.ReadBuffer, NULL); + if (stdraw->iface) { + st_visual_to_default_buffer(stdraw->iface->visual, + &st->ctx->Color.DrawBuffer[0], NULL); + } + if (stread->iface) { + st_visual_to_default_buffer(stread->iface->visual, + &st->ctx->Pixel.ReadBuffer, NULL); + } ret = _mesa_make_current(st->ctx, &stdraw->Base, &stread->Base); } @@ -748,6 +769,8 @@ st_manager_flush_frontbuffer(struct st_context *st) if (!strb) return; + /* never a dummy fb */ + assert(stfb->iface); stfb->iface->flush_front(stfb->iface, ST_ATTACHMENT_FRONT_LEFT); } -- cgit v1.2.3 From 9b6a63a0e2271b0b28c89b22c8981ef8f73205c8 Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Thu, 26 Aug 2010 01:10:14 -0600 Subject: st/egl: Add support for EGL_KHR_surfaceless_*. --- src/gallium/state_trackers/egl/common/egl_g3d.c | 4 ++++ src/gallium/state_trackers/egl/common/egl_g3d_api.c | 21 ++++++++++++--------- 2 files changed, 16 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/gallium/state_trackers/egl/common/egl_g3d.c b/src/gallium/state_trackers/egl/common/egl_g3d.c index 02b9f6aec4..80929c3a12 100644 --- a/src/gallium/state_trackers/egl/common/egl_g3d.c +++ b/src/gallium/state_trackers/egl/common/egl_g3d.c @@ -533,6 +533,10 @@ egl_g3d_initialize(_EGLDriver *drv, _EGLDisplay *dpy, dpy->Extensions.KHR_reusable_sync = EGL_TRUE; dpy->Extensions.KHR_fence_sync = EGL_TRUE; + dpy->Extensions.KHR_surfaceless_gles1 = EGL_TRUE; + dpy->Extensions.KHR_surfaceless_gles2 = EGL_TRUE; + dpy->Extensions.KHR_surfaceless_opengl = EGL_TRUE; + if (egl_g3d_add_configs(drv, dpy, 1) == 1) { _eglError(EGL_NOT_INITIALIZED, "eglInitialize(unable to add configs)"); goto fail; diff --git a/src/gallium/state_trackers/egl/common/egl_g3d_api.c b/src/gallium/state_trackers/egl/common/egl_g3d_api.c index 1120945edc..fee9e3cadd 100644 --- a/src/gallium/state_trackers/egl/common/egl_g3d_api.c +++ b/src/gallium/state_trackers/egl/common/egl_g3d_api.c @@ -104,7 +104,7 @@ egl_g3d_create_context(_EGLDriver *drv, _EGLDisplay *dpy, _EGLConfig *conf, } gctx->stctxi = gctx->stapi->create_context(gctx->stapi, gdpy->smapi, - &gconf->stvis, (gshare) ? gshare->stctxi : NULL); + (gconf) ? &gconf->stvis : NULL, (gshare) ? gshare->stctxi : NULL); if (!gctx->stctxi) { FREE(gctx); return NULL; @@ -438,16 +438,19 @@ egl_g3d_make_current(_EGLDriver *drv, _EGLDisplay *dpy, ok = gctx->stapi->make_current(gctx->stapi, gctx->stctxi, (gdraw) ? gdraw->stfbi : NULL, (gread) ? gread->stfbi : NULL); if (ok) { - gctx->stctxi->notify_invalid_framebuffer(gctx->stctxi, gdraw->stfbi); - if (gread != gdraw) { + if (gdraw) { gctx->stctxi->notify_invalid_framebuffer(gctx->stctxi, - gread->stfbi); - } + gdraw->stfbi); - if (gdraw->base.Type == EGL_WINDOW_BIT) { - gctx->base.WindowRenderBuffer = - (gdraw->stvis.render_buffer == ST_ATTACHMENT_FRONT_LEFT) ? - EGL_SINGLE_BUFFER : EGL_BACK_BUFFER; + if (gdraw->base.Type == EGL_WINDOW_BIT) { + gctx->base.WindowRenderBuffer = + (gdraw->stvis.render_buffer == ST_ATTACHMENT_FRONT_LEFT) ? + EGL_SINGLE_BUFFER : EGL_BACK_BUFFER; + } + } + if (gread && gread != gdraw) { + gctx->stctxi->notify_invalid_framebuffer(gctx->stctxi, + gread->stfbi); } } } -- cgit v1.2.3 From 4f6faf65d124bd690c4526f4c8e95de4d041601f Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Thu, 26 Aug 2010 01:49:18 +0800 Subject: st/egl: Add support for EGL_MESA_image_drm. --- src/gallium/state_trackers/egl/common/egl_g3d.c | 3 + .../state_trackers/egl/common/egl_g3d_api.c | 4 + .../state_trackers/egl/common/egl_g3d_image.c | 245 +++++++++++++++++++++ .../state_trackers/egl/common/egl_g3d_image.h | 8 + 4 files changed, 260 insertions(+) (limited to 'src') diff --git a/src/gallium/state_trackers/egl/common/egl_g3d.c b/src/gallium/state_trackers/egl/common/egl_g3d.c index 80929c3a12..2d04695f97 100644 --- a/src/gallium/state_trackers/egl/common/egl_g3d.c +++ b/src/gallium/state_trackers/egl/common/egl_g3d.c @@ -537,6 +537,9 @@ egl_g3d_initialize(_EGLDriver *drv, _EGLDisplay *dpy, dpy->Extensions.KHR_surfaceless_gles2 = EGL_TRUE; dpy->Extensions.KHR_surfaceless_opengl = EGL_TRUE; + if (dpy->Platform == _EGL_PLATFORM_DRM) + dpy->Extensions.MESA_drm_image = EGL_TRUE; + if (egl_g3d_add_configs(drv, dpy, 1) == 1) { _eglError(EGL_NOT_INITIALIZED, "eglInitialize(unable to add configs)"); goto fail; diff --git a/src/gallium/state_trackers/egl/common/egl_g3d_api.c b/src/gallium/state_trackers/egl/common/egl_g3d_api.c index fee9e3cadd..3ec53653f4 100644 --- a/src/gallium/state_trackers/egl/common/egl_g3d_api.c +++ b/src/gallium/state_trackers/egl/common/egl_g3d_api.c @@ -809,6 +809,10 @@ egl_g3d_init_driver_api(_EGLDriver *drv) drv->API.CreateImageKHR = egl_g3d_create_image; drv->API.DestroyImageKHR = egl_g3d_destroy_image; +#ifdef EGL_MESA_drm_image + drv->API.CreateDRMImageMESA = egl_g3d_create_drm_image; + drv->API.ExportDRMImageMESA = egl_g3d_export_drm_image; +#endif #ifdef EGL_KHR_reusable_sync drv->API.CreateSyncKHR = egl_g3d_create_sync; diff --git a/src/gallium/state_trackers/egl/common/egl_g3d_image.c b/src/gallium/state_trackers/egl/common/egl_g3d_image.c index 1e13cfcf7e..558638e72f 100644 --- a/src/gallium/state_trackers/egl/common/egl_g3d_image.c +++ b/src/gallium/state_trackers/egl/common/egl_g3d_image.c @@ -31,12 +31,16 @@ #include "util/u_rect.h" #include "util/u_inlines.h" #include "eglcurrent.h" +#include "egllog.h" #include "native.h" #include "egl_g3d.h" #include "egl_g3d_api.h" #include "egl_g3d_image.h" +/* move this to native display? */ +#include "state_tracker/drm_driver.h" + /** * Reference and return the front left buffer of the native pixmap. */ @@ -67,6 +71,165 @@ egl_g3d_reference_native_pixmap(_EGLDisplay *dpy, EGLNativePixmapType pix) return textures[natt]; } +#ifdef EGL_MESA_drm_image + +static struct pipe_resource * +egl_g3d_create_drm_buffer(_EGLDisplay *dpy, const EGLint *attribs) +{ + struct egl_g3d_display *gdpy = egl_g3d_display(dpy); + struct pipe_screen *screen = gdpy->native->screen; + struct pipe_resource templ; + EGLint width = 0, height = 0, format = 0, use = 0; + EGLint valid_use; + EGLint i, err = EGL_SUCCESS; + + for (i = 0; attribs[i] != EGL_NONE; i++) { + EGLint attr = attribs[i++]; + EGLint val = attribs[i]; + + switch (attr) { + case EGL_WIDTH: + width = val; + break; + case EGL_HEIGHT: + height = val; + break; + case EGL_DRM_BUFFER_FORMAT_MESA: + format = val; + break; + case EGL_DRM_BUFFER_USE_MESA: + use = val; + break; + default: + err = EGL_BAD_ATTRIBUTE; + break; + } + + if (err != EGL_SUCCESS) { + _eglLog(_EGL_DEBUG, "bad image attribute 0x%04x", attr); + return NULL; + } + } + + if (width <= 0 || height <= 0) { + _eglLog(_EGL_DEBUG, "bad width or height (%dx%d)", width, height); + return NULL; + } + + switch (format) { + case EGL_DRM_BUFFER_FORMAT_ARGB32_MESA: + format = PIPE_FORMAT_B8G8R8A8_UNORM; + break; + default: + _eglLog(_EGL_DEBUG, "bad image format value 0x%04x", format); + return NULL; + break; + } + + valid_use = EGL_DRM_BUFFER_USE_SCANOUT_MESA | + EGL_DRM_BUFFER_USE_SHARE_MESA; + if (use & ~valid_use) { + _eglLog(_EGL_DEBUG, "bad image use bit 0x%04x", use); + return NULL; + } + + memset(&templ, 0, sizeof(templ)); + templ.target = PIPE_TEXTURE_2D; + templ.format = format; + templ.bind = PIPE_BIND_RENDER_TARGET | PIPE_BIND_SAMPLER_VIEW; + templ.width0 = width; + templ.height0 = height; + templ.depth0 = 1; + + /* + * XXX fix apps (e.g. wayland) and pipe drivers (e.g. i915) and remove the + * size check + */ + if ((use & EGL_DRM_BUFFER_USE_SCANOUT_MESA) && + width >= 640 && height >= 480) + templ.bind |= PIPE_BIND_SCANOUT; + if (use & EGL_DRM_BUFFER_USE_SHARE_MESA) + templ.bind |= PIPE_BIND_SHARED; + + return screen->resource_create(screen, &templ); +} + +static struct pipe_resource * +egl_g3d_reference_drm_buffer(_EGLDisplay *dpy, EGLint name, + const EGLint *attribs) +{ + struct egl_g3d_display *gdpy = egl_g3d_display(dpy); + struct pipe_screen *screen = gdpy->native->screen; + struct pipe_resource templ; + struct winsys_handle wsh; + EGLint width = 0, height = 0, format = 0, stride = 0; + EGLint i, err = EGL_SUCCESS; + + /* winsys_handle is in theory platform-specific */ + if (dpy->Platform != _EGL_PLATFORM_DRM) + return NULL; + + for (i = 0; attribs[i] != EGL_NONE; i++) { + EGLint attr = attribs[i++]; + EGLint val = attribs[i]; + + switch (attr) { + case EGL_WIDTH: + width = val; + break; + case EGL_HEIGHT: + height = val; + break; + case EGL_DRM_BUFFER_FORMAT_MESA: + format = val; + break; + case EGL_DRM_BUFFER_STRIDE_MESA: + stride = val; + break; + default: + err = EGL_BAD_ATTRIBUTE; + break; + } + + if (err != EGL_SUCCESS) { + _eglLog(_EGL_DEBUG, "bad image attribute 0x%04x", attr); + return NULL; + } + } + + if (width <= 0 || height <= 0 || stride <= 0) { + _eglLog(_EGL_DEBUG, "bad width, height, or stride (%dx%dx%d)", + width, height, stride); + return NULL; + } + + switch (format) { + case EGL_DRM_BUFFER_FORMAT_ARGB32_MESA: + format = PIPE_FORMAT_B8G8R8A8_UNORM; + break; + default: + _eglLog(_EGL_DEBUG, "bad image format value 0x%04x", format); + return NULL; + break; + } + + memset(&templ, 0, sizeof(templ)); + templ.target = PIPE_TEXTURE_2D; + templ.format = format; + templ.bind = PIPE_BIND_RENDER_TARGET | PIPE_BIND_SAMPLER_VIEW; + templ.width0 = width; + templ.height0 = height; + templ.depth0 = 1; + + memset(&wsh, 0, sizeof(wsh)); + wsh.handle = (unsigned) name; + wsh.stride = stride; + + return screen->resource_from_handle(screen, &templ, &wsh); +} + +#endif /* EGL_MESA_drm_image */ + _EGLImage * egl_g3d_create_image(_EGLDriver *drv, _EGLDisplay *dpy, _EGLContext *ctx, EGLenum target, EGLClientBuffer buffer, @@ -92,6 +255,11 @@ egl_g3d_create_image(_EGLDriver *drv, _EGLDisplay *dpy, _EGLContext *ctx, ptex = egl_g3d_reference_native_pixmap(dpy, (EGLNativePixmapType) buffer); break; +#ifdef EGL_MESA_drm_image + case EGL_DRM_BUFFER_MESA: + ptex = egl_g3d_reference_drm_buffer(dpy, (EGLint) buffer, attribs); + break; +#endif default: ptex = NULL; break; @@ -134,3 +302,80 @@ egl_g3d_destroy_image(_EGLDriver *drv, _EGLDisplay *dpy, _EGLImage *img) return EGL_TRUE; } + +_EGLImage * +egl_g3d_create_drm_image(_EGLDriver *drv, _EGLDisplay *dpy, + const EGLint *attribs) +{ + struct egl_g3d_image *gimg; + struct pipe_resource *ptex; + + gimg = CALLOC_STRUCT(egl_g3d_image); + if (!gimg) { + _eglError(EGL_BAD_ALLOC, "eglCreateDRMImageKHR"); + return NULL; + } + + if (!_eglInitImage(&gimg->base, dpy, attribs)) { + FREE(gimg); + return NULL; + } + +#ifdef EGL_MESA_drm_image + ptex = egl_g3d_create_drm_buffer(dpy, attribs); +#else + ptex = NULL; +#endif + if (!ptex) { + FREE(gimg); + return NULL; + } + + /* transfer the ownership to the image */ + gimg->texture = ptex; + gimg->face = 0; + gimg->level = 0; + gimg->zslice = 0; + + return &gimg->base; +} + +EGLBoolean +egl_g3d_export_drm_image(_EGLDriver *drv, _EGLDisplay *dpy, _EGLImage *img, + EGLint *name, EGLint *handle, EGLint *stride) +{ + struct egl_g3d_display *gdpy = egl_g3d_display(dpy); + struct egl_g3d_image *gimg = egl_g3d_image(img); + struct pipe_screen *screen = gdpy->native->screen; + struct winsys_handle wsh; + + /* winsys_handle is in theory platform-specific */ + if (dpy->Platform != _EGL_PLATFORM_DRM) + return EGL_FALSE; + + /* get shared handle */ + if (name) { + memset(&handle, 0, sizeof(handle)); + wsh.type = DRM_API_HANDLE_TYPE_SHARED; + if (!screen->resource_get_handle(screen, gimg->texture, &wsh)) { + return EGL_FALSE; + } + + *name = wsh.handle; + } + + /* get KMS handle */ + if (handle || stride) { + memset(&wsh, 0, sizeof(wsh)); + wsh.type = DRM_API_HANDLE_TYPE_KMS; + if (!screen->resource_get_handle(screen, gimg->texture, &wsh)) + return EGL_FALSE; + + if (handle) + *handle = wsh.handle; + if (stride) + *stride = wsh.stride; + } + + return EGL_TRUE; +} diff --git a/src/gallium/state_trackers/egl/common/egl_g3d_image.h b/src/gallium/state_trackers/egl/common/egl_g3d_image.h index adda933371..f051da8283 100644 --- a/src/gallium/state_trackers/egl/common/egl_g3d_image.h +++ b/src/gallium/state_trackers/egl/common/egl_g3d_image.h @@ -39,4 +39,12 @@ egl_g3d_create_image(_EGLDriver *drv, _EGLDisplay *dpy, _EGLContext *ctx, EGLBoolean egl_g3d_destroy_image(_EGLDriver *drv, _EGLDisplay *dpy, _EGLImage *image); +_EGLImage * +egl_g3d_create_drm_image(_EGLDriver *drv, _EGLDisplay *dpy, + const EGLint *attribs); + +EGLBoolean +egl_g3d_export_drm_image(_EGLDriver *drv, _EGLDisplay *dpy, _EGLImage *img, + EGLint *name, EGLint *handle, EGLint *stride); + #endif /* _EGL_G3D_IMAGE_H_ */ -- cgit v1.2.3 From 0f74efdef05c5c27b3137163d795dc91f34cc114 Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Thu, 26 Aug 2010 02:15:22 +0800 Subject: st/mesa: Fix glEGLImageTargetTexture2DOES. stObj->pt should be set in st_bind_surface, just as in st_TexImage. On the other hand, st_TexImage should unreference stObj->pt. It also needs to initialize the texture image again as _mesa_clear_texture_object clears the image. --- src/mesa/state_tracker/st_cb_eglimage.c | 3 ++- src/mesa/state_tracker/st_cb_texture.c | 8 ++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/state_tracker/st_cb_eglimage.c b/src/mesa/state_tracker/st_cb_eglimage.c index 037e576fab..3145416383 100644 --- a/src/mesa/state_tracker/st_cb_eglimage.c +++ b/src/mesa/state_tracker/st_cb_eglimage.c @@ -128,7 +128,8 @@ st_bind_surface(GLcontext *ctx, GLenum target, _mesa_set_fetch_functions(texImage, 2); /* FIXME create a non-default sampler view from the pipe_surface? */ - pipe_resource_reference(&stImage->pt, ps->texture); + pipe_resource_reference(&stObj->pt, ps->texture); + pipe_resource_reference(&stImage->pt, stObj->pt); stObj->width0 = ps->width; stObj->height0 = ps->height; diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c index a41c780d6e..9eb14033ee 100644 --- a/src/mesa/state_tracker/st_cb_texture.c +++ b/src/mesa/state_tracker/st_cb_texture.c @@ -548,6 +548,14 @@ st_TexImage(GLcontext * ctx, /* switch to "normal" */ if (stObj->surface_based) { _mesa_clear_texture_object(ctx, texObj); + pipe_resource_reference(&stObj->pt, NULL); + + /* oops, need to init this image again */ + _mesa_init_teximage_fields(ctx, target, texImage, + width, height, depth, border, internalFormat); + _mesa_choose_texture_format(ctx, texObj, texImage, target, level, + internalFormat, format, type); + stObj->surface_based = GL_FALSE; } -- cgit v1.2.3 From 90437330e2886fcd351dd11ee0e5aa3e8b523fdc Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Thu, 26 Aug 2010 11:37:42 +0100 Subject: graw: Undo late loading of graw drivers. Keith prefers a clean separation between graw applications and implementations, where apps do not link libgallium.a but instead get all functionality they need via graw interface. Although this is not incompatible with late loading of graw drivers, it it would make it very hard to maintain, as wrappers for every utility symbol exposed in graw would have to be written or generated somehow. --- SConstruct | 3 +- src/gallium/include/state_tracker/graw_dl.h | 153 ---------------------------- src/gallium/targets/SConscript | 5 + src/gallium/targets/graw-null/SConscript | 58 +++++++++++ src/gallium/targets/graw-null/graw_null.c | 95 +++++++++++++++++ src/gallium/targets/graw-xlib/SConscript | 1 + src/gallium/targets/graw-xlib/graw_util.c | 50 +++++++++ src/gallium/tests/graw/SConscript | 9 +- src/gallium/tests/graw/clear.c | 2 +- src/gallium/tests/graw/fs-test.c | 2 +- src/gallium/tests/graw/gs-test.c | 2 +- src/gallium/tests/graw/quad-tex.c | 2 +- src/gallium/tests/graw/tri-gs.c | 2 +- src/gallium/tests/graw/tri-instanced.c | 2 +- src/gallium/tests/graw/tri.c | 2 +- src/gallium/tests/graw/vs-test.c | 2 +- 16 files changed, 227 insertions(+), 163 deletions(-) delete mode 100644 src/gallium/include/state_tracker/graw_dl.h create mode 100644 src/gallium/targets/graw-null/SConscript create mode 100644 src/gallium/targets/graw-null/graw_null.c create mode 100644 src/gallium/targets/graw-xlib/graw_util.c (limited to 'src') diff --git a/SConstruct b/SConstruct index 14663727f5..bb03e5055e 100644 --- a/SConstruct +++ b/SConstruct @@ -31,7 +31,7 @@ import common # Configuration options default_statetrackers = 'mesa' -default_targets = 'none' +default_targets = 'graw-null' if common.default_platform in ('linux', 'freebsd', 'darwin'): default_drivers = 'softpipe,failover,svga,i915,i965,trace,identity,llvmpipe' @@ -69,6 +69,7 @@ opts.Add(ListVariable('targets', 'driver targets to build', default_targets, 'egl-swrast', 'egl-vmwgfx', 'graw-xlib', + 'graw-null', 'libgl-gdi', 'libgl-xlib', 'xorg-i915', diff --git a/src/gallium/include/state_tracker/graw_dl.h b/src/gallium/include/state_tracker/graw_dl.h deleted file mode 100644 index 3c5c3d8647..0000000000 --- a/src/gallium/include/state_tracker/graw_dl.h +++ /dev/null @@ -1,153 +0,0 @@ -#ifndef GALLIUM_RAW_DL_H -#define GALLIUM_RAW_DL_H - -/* This is an API for exercising gallium functionality in a - * platform-neutral fashion. Whatever platform integration is - * necessary to implement this interface is orchestrated by the - * individual target building this entity. - * - * For instance, the graw-xlib target includes code to implent these - * interfaces on top of the X window system. - * - * Programs using this interface may additionally benefit from some of - * the utilities currently in the libgallium.a library, especially - * those for parsing text representations of TGSI shaders. - */ - -#include -#include "pipe/p_compiler.h" -#include "pipe/p_context.h" -#include "pipe/p_format.h" -#include "pipe/p_state.h" -#include "util/u_dl.h" -#include "tgsi/tgsi_text.h" - - -struct pipe_screen; -struct pipe_context; - - -typedef void * -(*pfn_graw_create_window_and_screen_t)( int x, - int y, - unsigned width, - unsigned height, - enum pipe_format format, - void **handle ); - -typedef void -(*pfn_graw_set_display_func_t)( void (*func)( void ) ); - -typedef void -(*pfn_graw_main_loop_t)( void ); - - -static pfn_graw_create_window_and_screen_t -pfn_graw_create_window_and_screen = NULL; - -static pfn_graw_set_display_func_t -pfn_graw_set_display_func = NULL; - -static pfn_graw_main_loop_t -pfn_graw_main_loop = NULL; - - -static INLINE void * -graw_create_window_and_screen( int x, - int y, - unsigned width, - unsigned height, - enum pipe_format format, - void **handle ) -{ - static struct util_dl_library *lib; - lib = util_dl_open(UTIL_DL_PREFIX "graw" UTIL_DL_EXT); - if (!lib) - goto error; - pfn_graw_create_window_and_screen = (pfn_graw_create_window_and_screen_t) - util_dl_get_proc_address(lib, "graw_create_window_and_screen"); - if (!pfn_graw_create_window_and_screen) - goto error; - pfn_graw_set_display_func = (pfn_graw_set_display_func_t) - util_dl_get_proc_address(lib, "graw_set_display_func"); - if (!pfn_graw_set_display_func) - goto error; - pfn_graw_main_loop = (pfn_graw_main_loop_t) - util_dl_get_proc_address(lib, "graw_main_loop"); - if (!pfn_graw_main_loop) - goto error; - return pfn_graw_create_window_and_screen(x, y, width, height, format, handle ); -error: - fprintf(stderr, "failed to open " UTIL_DL_PREFIX "graw" UTIL_DL_EXT "\n"); - return NULL; -} - -static INLINE void -graw_set_display_func( void (*func)( void ) ) -{ - if (!pfn_graw_set_display_func) - return; - pfn_graw_set_display_func(func); -} - -static INLINE void -graw_main_loop( void ) -{ - if (!pfn_graw_main_loop) - return; - pfn_graw_main_loop(); -} - - -/* - * Helper functions. These are the same for all graw implementations. - * - * XXX: These aren't graw related. If they are useful then should go somwhere - * inside auxiliary/util. - */ - -#define GRAW_MAX_NUM_TOKENS 1024 - -static INLINE void * -graw_parse_geometry_shader(struct pipe_context *pipe, - const char *text) -{ - struct tgsi_token tokens[GRAW_MAX_NUM_TOKENS]; - struct pipe_shader_state state; - - if (!tgsi_text_translate(text, tokens, GRAW_MAX_NUM_TOKENS)) - return NULL; - - state.tokens = tokens; - return pipe->create_gs_state(pipe, &state); -} - -static INLINE void * -graw_parse_vertex_shader(struct pipe_context *pipe, - const char *text) -{ - struct tgsi_token tokens[GRAW_MAX_NUM_TOKENS]; - struct pipe_shader_state state; - - if (!tgsi_text_translate(text, tokens, GRAW_MAX_NUM_TOKENS)) - return NULL; - - state.tokens = tokens; - return pipe->create_vs_state(pipe, &state); -} - -static INLINE void * -graw_parse_fragment_shader(struct pipe_context *pipe, - const char *text) -{ - struct tgsi_token tokens[GRAW_MAX_NUM_TOKENS]; - struct pipe_shader_state state; - - if (!tgsi_text_translate(text, tokens, GRAW_MAX_NUM_TOKENS)) - return NULL; - - state.tokens = tokens; - return pipe->create_fs_state(pipe, &state); -} - -#endif diff --git a/src/gallium/targets/SConscript b/src/gallium/targets/SConscript index 7eecdb24c7..e447d09361 100644 --- a/src/gallium/targets/SConscript +++ b/src/gallium/targets/SConscript @@ -9,6 +9,11 @@ if 'mesa' in env['statetrackers']: if 'gdi' in env['winsys'] and 'libgl-gdi' not in env['targets']: env['targets'].append('libgl-gdi') +if not 'graw-xlib' in env['targets'] and not 'graw-null' in env['targets'] and not env['msvc']: + # XXX: disable until MSVC can link correctly + SConscript('graw-null/SConscript') + + if env['dri']: SConscript([ 'SConscript.dri' diff --git a/src/gallium/targets/graw-null/SConscript b/src/gallium/targets/graw-null/SConscript new file mode 100644 index 0000000000..3416989d8e --- /dev/null +++ b/src/gallium/targets/graw-null/SConscript @@ -0,0 +1,58 @@ +####################################################################### +# SConscript for xlib winsys + +Import('*') + +env = env.Clone() + +env.Prepend(LIBS = [ + ws_null, + trace, + rbug, + identity, +# gallium, +]) + +env.Append(CPPPATH = [ + '#src/gallium/drivers', +]) + +if env['platform'] == 'windows': + # For trace + env.Append(LIBS = [ + 'ws2_32', + ]) + +sources = [ + 'graw_null.c', + '../graw-xlib/graw_util.c', +] + +if True: + env.Append(CPPDEFINES = 'GALLIUM_SOFTPIPE') + env.Prepend(LIBS = [softpipe]) + +if env['llvm']: + env.Append(CPPDEFINES = 'GALLIUM_LLVMPIPE') + env.Tool('udis86') + env.Prepend(LIBS = [llvmpipe]) + +# Need this for trace, identity drivers referenced by +# gallium_wrap_screen(). +# +env.Prepend(LIBS = [gallium]) + +# TODO: write a wrapper function http://www.scons.org/wiki/WrapperFunctions +graw = env.SharedLibrary( + target ='graw', + source = sources, +) + +env.InstallSharedLibrary(graw, version=(1, 0)) + +if env['platform'] == 'windows': + graw = env.FindIxes(graw, 'LIBPREFIX', 'LIBSUFFIX') +else: + graw = env.FindIxes(graw, 'SHLIBPREFIX', 'SHLIBSUFFIX') + +Export('graw') diff --git a/src/gallium/targets/graw-null/graw_null.c b/src/gallium/targets/graw-null/graw_null.c new file mode 100644 index 0000000000..5939a5acd3 --- /dev/null +++ b/src/gallium/targets/graw-null/graw_null.c @@ -0,0 +1,95 @@ +#include "pipe/p_compiler.h" +#include "util/u_debug.h" +#include "util/u_memory.h" +#include "target-helpers/wrap_screen.h" +#include "sw/null/null_sw_winsys.h" +#include "os/os_time.h" +#include "state_tracker/graw.h" + +#ifdef GALLIUM_SOFTPIPE +#include "softpipe/sp_public.h" +#endif + +#ifdef GALLIUM_LLVMPIPE +#include "llvmpipe/lp_public.h" +#endif + +/* Haven't figured out a decent way to build the helper code yet - + * #include it here temporarily. + */ +#include "sw/sw_public.h" +#include "sw/sw.c" + +#include + + +static struct { + void (*draw)(void); +} graw; + + + +struct pipe_screen * +graw_create_window_and_screen( int x, + int y, + unsigned width, + unsigned height, + enum pipe_format format, + void **handle) +{ + const char *default_driver; + const char *driver; + struct pipe_screen *screen = NULL; + struct sw_winsys *winsys = NULL; + static int dummy; + + + /* Create the underlying winsys, which performs presents to Xlib + * drawables: + */ + winsys = null_sw_create(); + if (winsys == NULL) + return NULL; + +#if defined(GALLIUM_LLVMPIPE) + default_driver = "llvmpipe"; +#elif defined(GALLIUM_SOFTPIPE) + default_driver = "softpipe"; +#else + default_driver = ""; +#endif + + driver = debug_get_option("GALLIUM_DRIVER", default_driver); + +#if defined(GALLIUM_LLVMPIPE) + if (screen == NULL && strcmp(driver, "llvmpipe") == 0) + screen = llvmpipe_create_screen( winsys ); +#endif + +#if defined(GALLIUM_SOFTPIPE) + if (screen == NULL) + screen = softpipe_create_screen( winsys ); +#endif + + *handle = &dummy; + + /* Inject any wrapping layers we want to here: + */ + return gallium_wrap_screen( screen ); +} + + + +void +graw_set_display_func( void (*draw)( void ) ) +{ + graw.draw = draw; +} + + +void +graw_main_loop( void ) +{ + graw.draw(); + os_time_sleep(100000); +} diff --git a/src/gallium/targets/graw-xlib/SConscript b/src/gallium/targets/graw-xlib/SConscript index 32b98cdef3..21fce948f4 100644 --- a/src/gallium/targets/graw-xlib/SConscript +++ b/src/gallium/targets/graw-xlib/SConscript @@ -26,6 +26,7 @@ env.Append(CPPPATH = [ sources = [ 'graw_xlib.c', + 'graw_util.c', ] env.Tool('x11') diff --git a/src/gallium/targets/graw-xlib/graw_util.c b/src/gallium/targets/graw-xlib/graw_util.c new file mode 100644 index 0000000000..fc7c9ae6f9 --- /dev/null +++ b/src/gallium/targets/graw-xlib/graw_util.c @@ -0,0 +1,50 @@ + +#include "pipe/p_compiler.h" +#include "pipe/p_context.h" +#include "pipe/p_state.h" +#include "tgsi/tgsi_text.h" +#include "util/u_memory.h" +#include "state_tracker/graw.h" + + +/* Helper functions. These are the same for all graw implementations. + */ +void *graw_parse_geometry_shader(struct pipe_context *pipe, + const char *text) +{ + struct tgsi_token tokens[1024]; + struct pipe_shader_state state; + + if (!tgsi_text_translate(text, tokens, Elements(tokens))) + return NULL; + + state.tokens = tokens; + return pipe->create_gs_state(pipe, &state); +} + +void *graw_parse_vertex_shader(struct pipe_context *pipe, + const char *text) +{ + struct tgsi_token tokens[1024]; + struct pipe_shader_state state; + + if (!tgsi_text_translate(text, tokens, Elements(tokens))) + return NULL; + + state.tokens = tokens; + return pipe->create_vs_state(pipe, &state); +} + +void *graw_parse_fragment_shader(struct pipe_context *pipe, + const char *text) +{ + struct tgsi_token tokens[1024]; + struct pipe_shader_state state; + + if (!tgsi_text_translate(text, tokens, Elements(tokens))) + return NULL; + + state.tokens = tokens; + return pipe->create_fs_state(pipe, &state); +} + diff --git a/src/gallium/tests/graw/SConscript b/src/gallium/tests/graw/SConscript index 5ef395e033..860a17e13e 100644 --- a/src/gallium/tests/graw/SConscript +++ b/src/gallium/tests/graw/SConscript @@ -1,8 +1,15 @@ Import('*') +try: + graw +except NameError: + print 'warning: graw library not avaiable: skipping build of graw test' + Return() + env = env.Clone() -env.Prepend(LIBS = gallium) +env.Prepend(LIBPATH = [graw.dir]) +env.Prepend(LIBS = ['graw'] + gallium) if platform in ('freebsd8', 'sunos5'): env.Append(LIBS = ['m']) diff --git a/src/gallium/tests/graw/clear.c b/src/gallium/tests/graw/clear.c index c9a7b76188..ce52a93aa1 100644 --- a/src/gallium/tests/graw/clear.c +++ b/src/gallium/tests/graw/clear.c @@ -2,7 +2,7 @@ * any utility code, just the graw interface and gallium. */ -#include "state_tracker/graw_dl.h" +#include "state_tracker/graw.h" #include "pipe/p_screen.h" #include "pipe/p_context.h" #include "pipe/p_state.h" diff --git a/src/gallium/tests/graw/fs-test.c b/src/gallium/tests/graw/fs-test.c index c0ed6e06e4..53fbb744d8 100644 --- a/src/gallium/tests/graw/fs-test.c +++ b/src/gallium/tests/graw/fs-test.c @@ -2,7 +2,7 @@ * any utility code, just the graw interface and gallium. */ -#include "state_tracker/graw_dl.h" +#include "state_tracker/graw.h" #include "pipe/p_screen.h" #include "pipe/p_context.h" #include "pipe/p_shader_tokens.h" diff --git a/src/gallium/tests/graw/gs-test.c b/src/gallium/tests/graw/gs-test.c index 0f029e70c2..62714900bd 100644 --- a/src/gallium/tests/graw/gs-test.c +++ b/src/gallium/tests/graw/gs-test.c @@ -2,7 +2,7 @@ * any utility code, just the graw interface and gallium. */ -#include "state_tracker/graw_dl.h" +#include "state_tracker/graw.h" #include "pipe/p_screen.h" #include "pipe/p_context.h" #include "pipe/p_shader_tokens.h" diff --git a/src/gallium/tests/graw/quad-tex.c b/src/gallium/tests/graw/quad-tex.c index e7379e8c45..c50ef12ab5 100644 --- a/src/gallium/tests/graw/quad-tex.c +++ b/src/gallium/tests/graw/quad-tex.c @@ -2,7 +2,7 @@ * any utility code, just the graw interface and gallium. */ -#include "state_tracker/graw_dl.h" +#include "state_tracker/graw.h" #include "pipe/p_screen.h" #include "pipe/p_context.h" #include "pipe/p_shader_tokens.h" diff --git a/src/gallium/tests/graw/tri-gs.c b/src/gallium/tests/graw/tri-gs.c index 75466ce889..152ae408eb 100644 --- a/src/gallium/tests/graw/tri-gs.c +++ b/src/gallium/tests/graw/tri-gs.c @@ -2,7 +2,7 @@ * any utility code, just the graw interface and gallium. */ -#include "state_tracker/graw_dl.h" +#include "state_tracker/graw.h" #include "pipe/p_screen.h" #include "pipe/p_context.h" #include "pipe/p_state.h" diff --git a/src/gallium/tests/graw/tri-instanced.c b/src/gallium/tests/graw/tri-instanced.c index 67b40f78f7..8859f745fd 100644 --- a/src/gallium/tests/graw/tri-instanced.c +++ b/src/gallium/tests/graw/tri-instanced.c @@ -5,7 +5,7 @@ #include #include -#include "state_tracker/graw_dl.h" +#include "state_tracker/graw.h" #include "pipe/p_screen.h" #include "pipe/p_context.h" #include "pipe/p_state.h" diff --git a/src/gallium/tests/graw/tri.c b/src/gallium/tests/graw/tri.c index e8f925d2f4..4dbd2c062a 100644 --- a/src/gallium/tests/graw/tri.c +++ b/src/gallium/tests/graw/tri.c @@ -2,7 +2,7 @@ * any utility code, just the graw interface and gallium. */ -#include "state_tracker/graw_dl.h" +#include "state_tracker/graw.h" #include "pipe/p_screen.h" #include "pipe/p_context.h" #include "pipe/p_state.h" diff --git a/src/gallium/tests/graw/vs-test.c b/src/gallium/tests/graw/vs-test.c index e693022526..e1cd814bf7 100644 --- a/src/gallium/tests/graw/vs-test.c +++ b/src/gallium/tests/graw/vs-test.c @@ -2,7 +2,7 @@ * any utility code, just the graw interface and gallium. */ -#include "state_tracker/graw_dl.h" +#include "state_tracker/graw.h" #include "pipe/p_screen.h" #include "pipe/p_context.h" #include "pipe/p_shader_tokens.h" -- cgit v1.2.3 From 0599509fc4e21a69bcbf121deacbc631c38ccfa2 Mon Sep 17 00:00:00 2001 From: Andre Maasikas Date: Thu, 26 Aug 2010 15:22:21 +0300 Subject: r600: fix vertex buffer size calculation when we dont know max_index we cannot calculate vb size from count anymore - just use the bo size. Also added an assert to remind that we dont handle GL_INT GL_DOUBLE upload when we dont' know max_index - will fix later --- src/mesa/drivers/dri/r600/r700_chip.c | 13 +------------ src/mesa/drivers/dri/r600/r700_render.c | 1 + 2 files changed, 2 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r600/r700_chip.c b/src/mesa/drivers/dri/r600/r700_chip.c index d17884f722..71f1af7562 100644 --- a/src/mesa/drivers/dri/r600/r700_chip.c +++ b/src/mesa/drivers/dri/r600/r700_chip.c @@ -173,7 +173,6 @@ static void r700SetupVTXConstants(GLcontext * ctx, { context_t *context = R700_CONTEXT(ctx); struct radeon_aos * paos = (struct radeon_aos *)pAos; - unsigned int nVBsize; BATCH_LOCALS(&context->radeon); unsigned int uSQ_VTX_CONSTANT_WORD0_0; @@ -194,18 +193,8 @@ static void r700SetupVTXConstants(GLcontext * ctx, else r700SyncSurf(context, paos->bo, RADEON_GEM_DOMAIN_GTT, 0, VC_ACTION_ENA_bit); - if(0 == pStreamDesc->stride) - { - nVBsize = paos->count * pStreamDesc->size * getTypeSize(pStreamDesc->type); - } - else - { - nVBsize = (paos->count - 1) * pStreamDesc->stride - + pStreamDesc->size * getTypeSize(pStreamDesc->type); - } - uSQ_VTX_CONSTANT_WORD0_0 = paos->offset; - uSQ_VTX_CONSTANT_WORD1_0 = nVBsize - 1; + uSQ_VTX_CONSTANT_WORD1_0 = paos->bo->size - paos->offset - 1; SETfield(uSQ_VTX_CONSTANT_WORD2_0, 0, BASE_ADDRESS_HI_shift, BASE_ADDRESS_HI_mask); /* TODO */ SETfield(uSQ_VTX_CONSTANT_WORD2_0, pStreamDesc->stride, SQ_VTX_CONSTANT_WORD2_0__STRIDE_shift, diff --git a/src/mesa/drivers/dri/r600/r700_render.c b/src/mesa/drivers/dri/r600/r700_render.c index c5771f9fd0..f90c69c416 100644 --- a/src/mesa/drivers/dri/r600/r700_render.c +++ b/src/mesa/drivers/dri/r600/r700_render.c @@ -644,6 +644,7 @@ static void r700SetupStreams(GLcontext *ctx, const struct gl_client_array *input #endif ) { + assert(count); r700ConvertAttrib(ctx, count, input[i], &context->stream_desc[index]); } else -- cgit v1.2.3 From bda941e1b895547d680b68eaf28ae2db11e6149f Mon Sep 17 00:00:00 2001 From: Nick Bowler Date: Wed, 25 Aug 2010 06:14:42 -0700 Subject: intel: Merge identical cases in switch statement. Signed-off-by: Nick Bowler Signed-off-by: Brian Paul --- src/mesa/drivers/dri/intel/intel_fbo.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/intel/intel_fbo.c b/src/mesa/drivers/dri/intel/intel_fbo.c index 6435857f33..2693b5fa72 100644 --- a/src/mesa/drivers/dri/intel/intel_fbo.c +++ b/src/mesa/drivers/dri/intel/intel_fbo.c @@ -137,27 +137,21 @@ intel_alloc_renderbuffer_storage(GLcontext * ctx, struct gl_renderbuffer *rb, rb->Format = MESA_FORMAT_A8; rb->DataType = GL_UNSIGNED_BYTE; break; + case GL_DEPTH_COMPONENT16: + rb->Format = MESA_FORMAT_Z16; + rb->DataType = GL_UNSIGNED_SHORT; + break; case GL_STENCIL_INDEX: case GL_STENCIL_INDEX1_EXT: case GL_STENCIL_INDEX4_EXT: case GL_STENCIL_INDEX8_EXT: case GL_STENCIL_INDEX16_EXT: - /* alloc a depth+stencil buffer */ - rb->Format = MESA_FORMAT_S8_Z24; - rb->DataType = GL_UNSIGNED_INT_24_8_EXT; - break; - case GL_DEPTH_COMPONENT16: - rb->Format = MESA_FORMAT_Z16; - rb->DataType = GL_UNSIGNED_SHORT; - break; case GL_DEPTH_COMPONENT: case GL_DEPTH_COMPONENT24: case GL_DEPTH_COMPONENT32: - rb->Format = MESA_FORMAT_S8_Z24; - rb->DataType = GL_UNSIGNED_INT_24_8_EXT; - break; case GL_DEPTH_STENCIL_EXT: case GL_DEPTH24_STENCIL8_EXT: + /* alloc a depth+stencil buffer */ rb->Format = MESA_FORMAT_S8_Z24; rb->DataType = GL_UNSIGNED_INT_24_8_EXT; break; -- cgit v1.2.3 From e71a9042cb5e046072d2ea8fbd22a01de625bf8a Mon Sep 17 00:00:00 2001 From: Nick Bowler Date: Thu, 26 Aug 2010 07:26:21 -0700 Subject: mesa: Identify packed depth/stencil buffers using the Format field. Intel sometimes uses packed depth/stencil buffers even when only a depth buffer or only a stencil buffer was requested. Common code currently uses the _BaseFormat field to determine whether a depth/stencil wrapper is necessary. But unless the user explicitly requested a packed depth/stencil buffer, the _BaseFormat field does not encode this information, and the required wrappers are not created. The problem was introduced by commit 45e76d2665b38b ("mesa: remove a bunch of gl_renderbuffer fields"), which killed off the _ActualFormat field upon which the decision to create a wrapper used to be made. This patch changes the logic to use the Format field instead, which is more like the old code. Fixes fdo bug 27590. Signed-off-by: Nick Bowler Signed-off-by: Brian Paul --- src/mesa/main/formats.c | 16 ++++++++++++++++ src/mesa/main/formats.h | 3 +++ src/mesa/main/framebuffer.c | 4 ++-- 3 files changed, 21 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/mesa/main/formats.c b/src/mesa/main/formats.c index 90449cc04f..c5f3e0b21d 100644 --- a/src/mesa/main/formats.c +++ b/src/mesa/main/formats.c @@ -939,6 +939,22 @@ _mesa_is_format_compressed(gl_format format) } +/** + * Determine if the given format represents a packed depth/stencil buffer. + */ +GLboolean +_mesa_is_format_packed_depth_stencil(gl_format format) +{ + if (format == MESA_FORMAT_Z24_S8 + || format == MESA_FORMAT_Z24_X8 + || format == MESA_FORMAT_S8_Z24 + || format == MESA_FORMAT_X8_Z24) + return GL_TRUE; + + return GL_FALSE; +} + + /** * Return color encoding for given format. * \return GL_LINEAR or GL_SRGB diff --git a/src/mesa/main/formats.h b/src/mesa/main/formats.h index ad176caaa0..e9467f486b 100644 --- a/src/mesa/main/formats.h +++ b/src/mesa/main/formats.h @@ -190,6 +190,9 @@ _mesa_get_format_block_size(gl_format format, GLuint *bw, GLuint *bh); extern GLboolean _mesa_is_format_compressed(gl_format format); +extern GLboolean +_mesa_is_format_packed_depth_stencil(gl_format format); + extern GLenum _mesa_get_format_color_encoding(gl_format format); diff --git a/src/mesa/main/framebuffer.c b/src/mesa/main/framebuffer.c index e0aac26f62..3099fc3e7f 100644 --- a/src/mesa/main/framebuffer.c +++ b/src/mesa/main/framebuffer.c @@ -611,7 +611,7 @@ _mesa_update_depth_buffer(GLcontext *ctx, depthRb = fb->Attachment[attIndex].Renderbuffer; - if (depthRb && depthRb->_BaseFormat == GL_DEPTH_STENCIL) { + if (depthRb && _mesa_format_is_packed_depth_stencil(depthRb->Format)) { /* The attached depth buffer is a GL_DEPTH_STENCIL renderbuffer */ if (!fb->_DepthBuffer || fb->_DepthBuffer->Wrapped != depthRb @@ -652,7 +652,7 @@ _mesa_update_stencil_buffer(GLcontext *ctx, stencilRb = fb->Attachment[attIndex].Renderbuffer; - if (stencilRb && stencilRb->_BaseFormat == GL_DEPTH_STENCIL) { + if (stencilRb && _mesa_format_is_packed_depth_stencil(stencilRb->Format)) { /* The attached stencil buffer is a GL_DEPTH_STENCIL renderbuffer */ if (!fb->_StencilBuffer || fb->_StencilBuffer->Wrapped != stencilRb -- cgit v1.2.3 From 7b07674667e8e34c936c417ab6f1c2e33093205b Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 26 Aug 2010 08:59:43 -0600 Subject: mesa: fix mixed-up function call name --- src/mesa/main/framebuffer.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/mesa/main/framebuffer.c b/src/mesa/main/framebuffer.c index 3099fc3e7f..a98c09cfbf 100644 --- a/src/mesa/main/framebuffer.c +++ b/src/mesa/main/framebuffer.c @@ -611,7 +611,7 @@ _mesa_update_depth_buffer(GLcontext *ctx, depthRb = fb->Attachment[attIndex].Renderbuffer; - if (depthRb && _mesa_format_is_packed_depth_stencil(depthRb->Format)) { + if (depthRb && _mesa_is_format_packed_depth_stencil(depthRb->Format)) { /* The attached depth buffer is a GL_DEPTH_STENCIL renderbuffer */ if (!fb->_DepthBuffer || fb->_DepthBuffer->Wrapped != depthRb @@ -652,7 +652,7 @@ _mesa_update_stencil_buffer(GLcontext *ctx, stencilRb = fb->Attachment[attIndex].Renderbuffer; - if (stencilRb && _mesa_format_is_packed_depth_stencil(stencilRb->Format)) { + if (stencilRb && _mesa_is_format_packed_depth_stencil(stencilRb->Format)) { /* The attached stencil buffer is a GL_DEPTH_STENCIL renderbuffer */ if (!fb->_StencilBuffer || fb->_StencilBuffer->Wrapped != stencilRb -- cgit v1.2.3 From 86ddb356e8278423ef41125be627e57e073471d1 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 26 Aug 2010 09:20:18 -0600 Subject: st/mesa: add missing packed depth/stencil formats in st_format_datatype() Fixes llvmpipe regression from one of the prev commits. --- src/mesa/state_tracker/st_format.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/state_tracker/st_format.c b/src/mesa/state_tracker/st_format.c index c9fa7a62e1..86a471f195 100644 --- a/src/mesa/state_tracker/st_format.c +++ b/src/mesa/state_tracker/st_format.c @@ -78,7 +78,9 @@ st_format_datatype(enum pipe_format format) return GL_UNSIGNED_SHORT; } else if (format == PIPE_FORMAT_Z24_UNORM_S8_USCALED || - format == PIPE_FORMAT_S8_USCALED_Z24_UNORM) { + format == PIPE_FORMAT_S8_USCALED_Z24_UNORM || + format == PIPE_FORMAT_Z24X8_UNORM || + format == PIPE_FORMAT_X8Z24_UNORM) { return GL_UNSIGNED_INT_24_8; } else { -- cgit v1.2.3 From e9c7ceed27f6811ad1cae46c93ce9bc3fb3668d8 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Sat, 21 Aug 2010 20:23:18 -0700 Subject: glsl: Use a single shared namespace in the symbol table. As of 1.20, variable names, function names, and structure type names all share a single namespace, and should conflict with one another in the same scope, or hide each other in nested scopes. However, in 1.10, variables and functions can share the same name in the same scope. Structure types, however, conflict with/hide both. Fixes piglit tests redeclaration-06.vert, redeclaration-11.vert, redeclaration-19.vert, and struct-05.vert. --- src/glsl/Makefile | 1 + src/glsl/ast_to_hir.cpp | 12 +- src/glsl/builtin_function.cpp | 1 + src/glsl/builtins/tools/generate_builtins.py | 1 + src/glsl/glsl_parser.cpp | 972 ++++++++++++++------------- src/glsl/glsl_parser.h | 13 +- src/glsl/glsl_parser.ypp | 2 + src/glsl/glsl_symbol_table.cpp | 160 +++++ src/glsl/glsl_symbol_table.h | 85 +-- src/glsl/glsl_types.cpp | 11 +- src/glsl/glsl_types.h | 4 +- 11 files changed, 686 insertions(+), 576 deletions(-) create mode 100644 src/glsl/glsl_symbol_table.cpp (limited to 'src') diff --git a/src/glsl/Makefile b/src/glsl/Makefile index 3fd06bc9cb..aedca0f0d1 100644 --- a/src/glsl/Makefile +++ b/src/glsl/Makefile @@ -28,6 +28,7 @@ CXX_SOURCES = \ glsl_parser.cpp \ glsl_parser_extras.cpp \ glsl_types.cpp \ + glsl_symbol_table.cpp \ hir_field_selection.cpp \ ir_algebraic.cpp \ ir_basic_block.cpp \ diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp index 2fec02668d..8c105e79f7 100644 --- a/src/glsl/ast_to_hir.cpp +++ b/src/glsl/ast_to_hir.cpp @@ -2630,18 +2630,10 @@ ast_struct_specifier::hir(exec_list *instructions, glsl_type::get_record_instance(fields, decl_count, name); YYLTYPE loc = this->get_location(); - if (!state->symbols->add_type(name, t)) { + ir_function *ctor = t->generate_constructor(); + if (!state->symbols->add_type(name, t, ctor)) { _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, diff --git a/src/glsl/builtin_function.cpp b/src/glsl/builtin_function.cpp index a277ed6e8d..292ac428ba 100644 --- a/src/glsl/builtin_function.cpp +++ b/src/glsl/builtin_function.cpp @@ -40,6 +40,7 @@ read_builtins(GLenum target, const char *protos, const char **functions, unsigne new(sh) _mesa_glsl_parse_state(NULL, target, sh); st->language_version = 130; + st->symbols->language_version = 130; st->ARB_texture_rectangle_enable = true; st->EXT_texture_array_enable = true; _mesa_glsl_initialize_types(st); diff --git a/src/glsl/builtins/tools/generate_builtins.py b/src/glsl/builtins/tools/generate_builtins.py index c72b5b3bc1..b9f0ba1ad2 100755 --- a/src/glsl/builtins/tools/generate_builtins.py +++ b/src/glsl/builtins/tools/generate_builtins.py @@ -133,6 +133,7 @@ read_builtins(GLenum target, const char *protos, const char **functions, unsigne new(sh) _mesa_glsl_parse_state(NULL, target, sh); st->language_version = 130; + st->symbols->language_version = 130; st->ARB_texture_rectangle_enable = true; st->EXT_texture_array_enable = true; _mesa_glsl_initialize_types(st); diff --git a/src/glsl/glsl_parser.cpp b/src/glsl/glsl_parser.cpp index 7df9e96d16..188d128526 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.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" @@ -114,7 +113,7 @@ /* Line 189 of yacc.c */ -#line 118 "glsl_parser.cpp" +#line 117 "glsl_parser.cpp" /* Enabling traces. */ #ifndef YYDEBUG @@ -367,7 +366,7 @@ typedef union YYSTYPE /* Line 214 of yacc.c */ -#line 371 "glsl_parser.cpp" +#line 370 "glsl_parser.cpp" } YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ @@ -392,7 +391,7 @@ typedef struct YYLTYPE /* Line 264 of yacc.c */ -#line 396 "glsl_parser.cpp" +#line 395 "glsl_parser.cpp" #ifdef short # undef short @@ -442,7 +441,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) @@ -799,34 +798,34 @@ static const yytype_int16 yyrhs[] = /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ static const yytype_uint16 yyrline[] = { - 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, 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 + 0, 209, 209, 208, 217, 221, 239, 241, 245, 254, + 262, 273, 277, 284, 291, 298, 305, 312, 319, 320, + 326, 330, 337, 343, 352, 356, 360, 361, 370, 371, + 375, 376, 380, 386, 398, 402, 408, 415, 426, 427, + 433, 439, 449, 450, 451, 452, 456, 457, 463, 469, + 478, 479, 485, 494, 495, 501, 510, 511, 517, 523, + 529, 538, 539, 545, 554, 555, 564, 565, 574, 575, + 584, 585, 594, 595, 604, 605, 614, 615, 624, 625, + 634, 635, 636, 637, 638, 639, 640, 641, 642, 643, + 644, 648, 652, 668, 672, 676, 680, 694, 698, 699, + 703, 708, 716, 727, 737, 752, 759, 764, 775, 787, + 788, 789, 790, 794, 798, 799, 808, 817, 826, 835, + 844, 857, 868, 877, 886, 895, 904, 913, 922, 936, + 943, 954, 955, 959, 966, 967, 974, 1008, 1009, 1010, + 1014, 1018, 1019, 1023, 1031, 1032, 1033, 1034, 1035, 1036, + 1037, 1038, 1039, 1043, 1044, 1052, 1053, 1059, 1068, 1074, + 1080, 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 @@ -2020,9 +2019,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) @@ -2079,7 +2087,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, \ @@ -2621,7 +2629,7 @@ YYLTYPE yylloc; YYLTYPE *yylsp; /* The locations where the error started and ended. */ - YYLTYPE yyerror_range[2]; + YYLTYPE yyerror_range[3]; YYSIZE_T yystacksize; @@ -2668,7 +2676,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; @@ -2676,7 +2684,7 @@ YYLTYPE yylloc; /* User initialization code. */ -/* Line 1242 of yacc.c */ +/* Line 1251 of yacc.c */ #line 41 "glsl_parser.ypp" { yylloc.first_line = 1; @@ -2686,8 +2694,8 @@ YYLTYPE yylloc; yylloc.source = 0; } -/* Line 1242 of yacc.c */ -#line 2691 "glsl_parser.cpp" +/* Line 1251 of yacc.c */ +#line 2699 "glsl_parser.cpp" yylsp[0] = yylloc; goto yysetstate; @@ -2874,7 +2882,7 @@ yyreduce: { case 2: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 209 "glsl_parser.ypp" { _mesa_glsl_initialize_types(state); @@ -2883,17 +2891,18 @@ yyreduce: case 4: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 217 "glsl_parser.ypp" { state->language_version = 110; + state->symbols->language_version = 110; ;} break; case 5: -/* Line 1455 of yacc.c */ -#line 221 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 222 "glsl_parser.ypp" { switch ((yyvsp[(2) - (3)].n)) { case 110: @@ -2901,6 +2910,7 @@ yyreduce: case 130: /* FINISHME: Check against implementation support versions. */ state->language_version = (yyvsp[(2) - (3)].n); + state->symbols->language_version = (yyvsp[(2) - (3)].n); break; default: _mesa_glsl_error(& (yylsp[(2) - (3)]), state, "Shading language version" @@ -2912,8 +2922,8 @@ yyreduce: case 8: -/* Line 1455 of yacc.c */ -#line 244 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 246 "glsl_parser.ypp" { if (!_mesa_glsl_process_extension((yyvsp[(2) - (5)].identifier), & (yylsp[(2) - (5)]), (yyvsp[(4) - (5)].identifier), & (yylsp[(4) - (5)]), state)) { YYERROR; @@ -2923,8 +2933,8 @@ yyreduce: case 9: -/* Line 1455 of yacc.c */ -#line 253 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 255 "glsl_parser.ypp" { /* FINISHME: The NULL test is only required because 'precision' * FINISHME: statements are not yet supported. @@ -2936,8 +2946,8 @@ yyreduce: case 10: -/* Line 1455 of yacc.c */ -#line 261 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 263 "glsl_parser.ypp" { /* FINISHME: The NULL test is only required because 'precision' * FINISHME: statements are not yet supported. @@ -2949,8 +2959,8 @@ yyreduce: case 12: -/* Line 1455 of yacc.c */ -#line 276 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 278 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression(ast_identifier, NULL, NULL, NULL); @@ -2961,8 +2971,8 @@ yyreduce: case 13: -/* Line 1455 of yacc.c */ -#line 283 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 285 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression(ast_int_constant, NULL, NULL, NULL); @@ -2973,8 +2983,8 @@ yyreduce: case 14: -/* Line 1455 of yacc.c */ -#line 290 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 292 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression(ast_uint_constant, NULL, NULL, NULL); @@ -2985,8 +2995,8 @@ yyreduce: case 15: -/* Line 1455 of yacc.c */ -#line 297 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 299 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression(ast_float_constant, NULL, NULL, NULL); @@ -2997,8 +3007,8 @@ yyreduce: case 16: -/* Line 1455 of yacc.c */ -#line 304 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 306 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression(ast_bool_constant, NULL, NULL, NULL); @@ -3009,8 +3019,8 @@ yyreduce: case 17: -/* Line 1455 of yacc.c */ -#line 311 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 313 "glsl_parser.ypp" { (yyval.expression) = (yyvsp[(2) - (3)].expression); ;} @@ -3018,8 +3028,8 @@ yyreduce: case 19: -/* Line 1455 of yacc.c */ -#line 319 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 321 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression(ast_array_index, (yyvsp[(1) - (4)].expression), (yyvsp[(3) - (4)].expression), NULL); @@ -3029,8 +3039,8 @@ yyreduce: case 20: -/* Line 1455 of yacc.c */ -#line 325 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 327 "glsl_parser.ypp" { (yyval.expression) = (yyvsp[(1) - (1)].expression); ;} @@ -3038,8 +3048,8 @@ yyreduce: case 21: -/* Line 1455 of yacc.c */ -#line 329 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 331 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression(ast_field_selection, (yyvsp[(1) - (3)].expression), NULL, NULL); @@ -3050,8 +3060,8 @@ yyreduce: case 22: -/* Line 1455 of yacc.c */ -#line 336 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 338 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression(ast_post_inc, (yyvsp[(1) - (2)].expression), NULL, NULL); @@ -3061,8 +3071,8 @@ yyreduce: case 23: -/* Line 1455 of yacc.c */ -#line 342 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 344 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression(ast_post_dec, (yyvsp[(1) - (2)].expression), NULL, NULL); @@ -3072,8 +3082,8 @@ yyreduce: case 27: -/* Line 1455 of yacc.c */ -#line 360 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 362 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression(ast_field_selection, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression), NULL); @@ -3083,8 +3093,8 @@ yyreduce: case 32: -/* Line 1455 of yacc.c */ -#line 379 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 381 "glsl_parser.ypp" { (yyval.expression) = (yyvsp[(1) - (2)].expression); (yyval.expression)->set_location(yylloc); @@ -3094,8 +3104,8 @@ yyreduce: case 33: -/* Line 1455 of yacc.c */ -#line 385 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 387 "glsl_parser.ypp" { (yyval.expression) = (yyvsp[(1) - (3)].expression); (yyval.expression)->set_location(yylloc); @@ -3105,8 +3115,8 @@ yyreduce: case 35: -/* Line 1455 of yacc.c */ -#line 401 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 403 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_function_expression((yyvsp[(1) - (1)].type_specifier)); @@ -3116,8 +3126,8 @@ yyreduce: case 36: -/* Line 1455 of yacc.c */ -#line 407 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 409 "glsl_parser.ypp" { void *ctx = state; ast_expression *callee = new(ctx) ast_expression((yyvsp[(1) - (1)].identifier)); @@ -3128,8 +3138,8 @@ yyreduce: case 37: -/* Line 1455 of yacc.c */ -#line 414 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 416 "glsl_parser.ypp" { void *ctx = state; ast_expression *callee = new(ctx) ast_expression((yyvsp[(1) - (1)].identifier)); @@ -3140,8 +3150,8 @@ yyreduce: case 39: -/* Line 1455 of yacc.c */ -#line 426 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 428 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression(ast_pre_inc, (yyvsp[(2) - (2)].expression), NULL, NULL); @@ -3151,8 +3161,8 @@ yyreduce: case 40: -/* Line 1455 of yacc.c */ -#line 432 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 434 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression(ast_pre_dec, (yyvsp[(2) - (2)].expression), NULL, NULL); @@ -3162,8 +3172,8 @@ yyreduce: case 41: -/* Line 1455 of yacc.c */ -#line 438 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 440 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression((yyvsp[(1) - (2)].n), (yyvsp[(2) - (2)].expression), NULL, NULL); @@ -3173,36 +3183,36 @@ yyreduce: case 42: -/* Line 1455 of yacc.c */ -#line 447 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 449 "glsl_parser.ypp" { (yyval.n) = ast_plus; ;} break; case 43: -/* Line 1455 of yacc.c */ -#line 448 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 450 "glsl_parser.ypp" { (yyval.n) = ast_neg; ;} break; case 44: -/* Line 1455 of yacc.c */ -#line 449 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 451 "glsl_parser.ypp" { (yyval.n) = ast_logic_not; ;} break; case 45: -/* Line 1455 of yacc.c */ -#line 450 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 452 "glsl_parser.ypp" { (yyval.n) = ast_bit_not; ;} break; case 47: -/* Line 1455 of yacc.c */ -#line 456 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 458 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression_bin(ast_mul, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); @@ -3212,8 +3222,8 @@ yyreduce: case 48: -/* Line 1455 of yacc.c */ -#line 462 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 464 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression_bin(ast_div, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); @@ -3223,8 +3233,8 @@ yyreduce: case 49: -/* Line 1455 of yacc.c */ -#line 468 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 470 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression_bin(ast_mod, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); @@ -3234,8 +3244,8 @@ yyreduce: case 51: -/* Line 1455 of yacc.c */ -#line 478 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 480 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression_bin(ast_add, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); @@ -3245,8 +3255,8 @@ yyreduce: case 52: -/* Line 1455 of yacc.c */ -#line 484 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 486 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression_bin(ast_sub, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); @@ -3256,8 +3266,8 @@ yyreduce: case 54: -/* Line 1455 of yacc.c */ -#line 494 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 496 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression_bin(ast_lshift, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); @@ -3267,8 +3277,8 @@ yyreduce: case 55: -/* Line 1455 of yacc.c */ -#line 500 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 502 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression_bin(ast_rshift, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); @@ -3278,8 +3288,8 @@ yyreduce: case 57: -/* Line 1455 of yacc.c */ -#line 510 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 512 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression_bin(ast_less, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); @@ -3289,8 +3299,8 @@ yyreduce: case 58: -/* Line 1455 of yacc.c */ -#line 516 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 518 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression_bin(ast_greater, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); @@ -3300,8 +3310,8 @@ yyreduce: case 59: -/* Line 1455 of yacc.c */ -#line 522 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 524 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression_bin(ast_lequal, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); @@ -3311,8 +3321,8 @@ yyreduce: case 60: -/* Line 1455 of yacc.c */ -#line 528 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 530 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression_bin(ast_gequal, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); @@ -3322,8 +3332,8 @@ yyreduce: case 62: -/* Line 1455 of yacc.c */ -#line 538 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 540 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression_bin(ast_equal, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); @@ -3333,8 +3343,8 @@ yyreduce: case 63: -/* Line 1455 of yacc.c */ -#line 544 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 546 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression_bin(ast_nequal, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); @@ -3344,8 +3354,8 @@ yyreduce: case 65: -/* Line 1455 of yacc.c */ -#line 554 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 556 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression_bin(ast_bit_or, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); @@ -3355,8 +3365,8 @@ yyreduce: case 67: -/* Line 1455 of yacc.c */ -#line 564 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 566 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression_bin(ast_bit_xor, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); @@ -3366,8 +3376,8 @@ yyreduce: case 69: -/* Line 1455 of yacc.c */ -#line 574 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 576 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression_bin(ast_bit_or, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); @@ -3377,8 +3387,8 @@ yyreduce: case 71: -/* Line 1455 of yacc.c */ -#line 584 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 586 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression_bin(ast_logic_and, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); @@ -3388,8 +3398,8 @@ yyreduce: case 73: -/* Line 1455 of yacc.c */ -#line 594 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 596 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression_bin(ast_logic_xor, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); @@ -3399,8 +3409,8 @@ yyreduce: case 75: -/* Line 1455 of yacc.c */ -#line 604 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 606 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression_bin(ast_logic_or, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); @@ -3410,8 +3420,8 @@ yyreduce: case 77: -/* Line 1455 of yacc.c */ -#line 614 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 616 "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)); @@ -3421,8 +3431,8 @@ yyreduce: case 79: -/* Line 1455 of yacc.c */ -#line 624 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 626 "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); @@ -3432,85 +3442,85 @@ yyreduce: case 80: -/* Line 1455 of yacc.c */ -#line 632 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 634 "glsl_parser.ypp" { (yyval.n) = ast_assign; ;} break; case 81: -/* Line 1455 of yacc.c */ -#line 633 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 635 "glsl_parser.ypp" { (yyval.n) = ast_mul_assign; ;} break; case 82: -/* Line 1455 of yacc.c */ -#line 634 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 636 "glsl_parser.ypp" { (yyval.n) = ast_div_assign; ;} break; case 83: -/* Line 1455 of yacc.c */ -#line 635 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 637 "glsl_parser.ypp" { (yyval.n) = ast_mod_assign; ;} break; case 84: -/* Line 1455 of yacc.c */ -#line 636 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 638 "glsl_parser.ypp" { (yyval.n) = ast_add_assign; ;} break; case 85: -/* Line 1455 of yacc.c */ -#line 637 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 639 "glsl_parser.ypp" { (yyval.n) = ast_sub_assign; ;} break; case 86: -/* Line 1455 of yacc.c */ -#line 638 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 640 "glsl_parser.ypp" { (yyval.n) = ast_ls_assign; ;} break; case 87: -/* Line 1455 of yacc.c */ -#line 639 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 641 "glsl_parser.ypp" { (yyval.n) = ast_rs_assign; ;} break; case 88: -/* Line 1455 of yacc.c */ -#line 640 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 642 "glsl_parser.ypp" { (yyval.n) = ast_and_assign; ;} break; case 89: -/* Line 1455 of yacc.c */ -#line 641 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 643 "glsl_parser.ypp" { (yyval.n) = ast_xor_assign; ;} break; case 90: -/* Line 1455 of yacc.c */ -#line 642 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 644 "glsl_parser.ypp" { (yyval.n) = ast_or_assign; ;} break; case 91: -/* Line 1455 of yacc.c */ -#line 647 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 649 "glsl_parser.ypp" { (yyval.expression) = (yyvsp[(1) - (1)].expression); ;} @@ -3518,8 +3528,8 @@ yyreduce: case 92: -/* Line 1455 of yacc.c */ -#line 651 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 653 "glsl_parser.ypp" { void *ctx = state; if ((yyvsp[(1) - (3)].expression)->oper != ast_sequence) { @@ -3536,8 +3546,8 @@ yyreduce: case 94: -/* Line 1455 of yacc.c */ -#line 671 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 673 "glsl_parser.ypp" { (yyval.node) = (yyvsp[(1) - (2)].function); ;} @@ -3545,8 +3555,8 @@ yyreduce: case 95: -/* Line 1455 of yacc.c */ -#line 675 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 677 "glsl_parser.ypp" { (yyval.node) = (yyvsp[(1) - (2)].declarator_list); ;} @@ -3554,8 +3564,8 @@ yyreduce: case 96: -/* Line 1455 of yacc.c */ -#line 679 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 681 "glsl_parser.ypp" { if (((yyvsp[(3) - (4)].type_specifier)->type_specifier != ast_float) && ((yyvsp[(3) - (4)].type_specifier)->type_specifier != ast_int)) { @@ -3570,8 +3580,8 @@ yyreduce: case 100: -/* Line 1455 of yacc.c */ -#line 702 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 704 "glsl_parser.ypp" { (yyval.function) = (yyvsp[(1) - (2)].function); (yyval.function)->parameters.push_tail(& (yyvsp[(2) - (2)].parameter_declarator)->link); @@ -3580,8 +3590,8 @@ yyreduce: case 101: -/* Line 1455 of yacc.c */ -#line 707 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 709 "glsl_parser.ypp" { (yyval.function) = (yyvsp[(1) - (3)].function); (yyval.function)->parameters.push_tail(& (yyvsp[(3) - (3)].parameter_declarator)->link); @@ -3590,8 +3600,8 @@ yyreduce: case 102: -/* Line 1455 of yacc.c */ -#line 715 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 717 "glsl_parser.ypp" { void *ctx = state; (yyval.function) = new(ctx) ast_function(); @@ -3603,8 +3613,8 @@ yyreduce: case 103: -/* Line 1455 of yacc.c */ -#line 726 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 728 "glsl_parser.ypp" { void *ctx = state; (yyval.parameter_declarator) = new(ctx) ast_parameter_declarator(); @@ -3618,8 +3628,8 @@ yyreduce: case 104: -/* Line 1455 of yacc.c */ -#line 736 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 738 "glsl_parser.ypp" { void *ctx = state; (yyval.parameter_declarator) = new(ctx) ast_parameter_declarator(); @@ -3635,8 +3645,8 @@ yyreduce: case 105: -/* Line 1455 of yacc.c */ -#line 751 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 753 "glsl_parser.ypp" { (yyvsp[(1) - (3)].type_qualifier).i |= (yyvsp[(2) - (3)].type_qualifier).i; @@ -3647,8 +3657,8 @@ yyreduce: case 106: -/* Line 1455 of yacc.c */ -#line 758 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 760 "glsl_parser.ypp" { (yyval.parameter_declarator) = (yyvsp[(2) - (2)].parameter_declarator); (yyval.parameter_declarator)->type->qualifier = (yyvsp[(1) - (2)].type_qualifier).q; @@ -3657,8 +3667,8 @@ yyreduce: case 107: -/* Line 1455 of yacc.c */ -#line 763 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 765 "glsl_parser.ypp" { void *ctx = state; (yyvsp[(1) - (3)].type_qualifier).i |= (yyvsp[(2) - (3)].type_qualifier).i; @@ -3673,8 +3683,8 @@ yyreduce: case 108: -/* Line 1455 of yacc.c */ -#line 774 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 776 "glsl_parser.ypp" { void *ctx = state; (yyval.parameter_declarator) = new(ctx) ast_parameter_declarator(); @@ -3687,36 +3697,36 @@ yyreduce: case 109: -/* Line 1455 of yacc.c */ -#line 785 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 787 "glsl_parser.ypp" { (yyval.type_qualifier).i = 0; ;} break; case 110: -/* Line 1455 of yacc.c */ -#line 786 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 788 "glsl_parser.ypp" { (yyval.type_qualifier).i = 0; (yyval.type_qualifier).q.in = 1; ;} break; case 111: -/* Line 1455 of yacc.c */ -#line 787 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 789 "glsl_parser.ypp" { (yyval.type_qualifier).i = 0; (yyval.type_qualifier).q.out = 1; ;} break; case 112: -/* Line 1455 of yacc.c */ -#line 788 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 790 "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 798 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 800 "glsl_parser.ypp" { void *ctx = state; ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(3) - (3)].identifier), false, NULL, NULL); @@ -3729,8 +3739,8 @@ yyreduce: case 116: -/* Line 1455 of yacc.c */ -#line 807 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 809 "glsl_parser.ypp" { void *ctx = state; ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(3) - (5)].identifier), true, NULL, NULL); @@ -3743,8 +3753,8 @@ yyreduce: case 117: -/* Line 1455 of yacc.c */ -#line 816 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 818 "glsl_parser.ypp" { void *ctx = state; ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(3) - (6)].identifier), true, (yyvsp[(5) - (6)].expression), NULL); @@ -3757,8 +3767,8 @@ yyreduce: case 118: -/* Line 1455 of yacc.c */ -#line 825 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 827 "glsl_parser.ypp" { void *ctx = state; ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(3) - (7)].identifier), true, NULL, (yyvsp[(7) - (7)].expression)); @@ -3771,8 +3781,8 @@ yyreduce: case 119: -/* Line 1455 of yacc.c */ -#line 834 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 836 "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)); @@ -3785,8 +3795,8 @@ yyreduce: case 120: -/* Line 1455 of yacc.c */ -#line 843 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 845 "glsl_parser.ypp" { void *ctx = state; ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(3) - (5)].identifier), false, NULL, (yyvsp[(5) - (5)].expression)); @@ -3799,8 +3809,8 @@ yyreduce: case 121: -/* Line 1455 of yacc.c */ -#line 856 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 858 "glsl_parser.ypp" { void *ctx = state; if ((yyvsp[(1) - (1)].fully_specified_type)->specifier->type_specifier != ast_struct) { @@ -3815,8 +3825,8 @@ yyreduce: case 122: -/* Line 1455 of yacc.c */ -#line 867 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 869 "glsl_parser.ypp" { void *ctx = state; ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(2) - (2)].identifier), false, NULL, NULL); @@ -3829,8 +3839,8 @@ yyreduce: case 123: -/* Line 1455 of yacc.c */ -#line 876 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 878 "glsl_parser.ypp" { void *ctx = state; ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(2) - (4)].identifier), true, NULL, NULL); @@ -3843,8 +3853,8 @@ yyreduce: case 124: -/* Line 1455 of yacc.c */ -#line 885 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 887 "glsl_parser.ypp" { void *ctx = state; ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(2) - (5)].identifier), true, (yyvsp[(4) - (5)].expression), NULL); @@ -3857,8 +3867,8 @@ yyreduce: case 125: -/* Line 1455 of yacc.c */ -#line 894 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 896 "glsl_parser.ypp" { void *ctx = state; ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(2) - (6)].identifier), true, NULL, (yyvsp[(6) - (6)].expression)); @@ -3871,8 +3881,8 @@ yyreduce: case 126: -/* Line 1455 of yacc.c */ -#line 903 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 905 "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)); @@ -3885,8 +3895,8 @@ yyreduce: case 127: -/* Line 1455 of yacc.c */ -#line 912 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 914 "glsl_parser.ypp" { void *ctx = state; ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(2) - (4)].identifier), false, NULL, (yyvsp[(4) - (4)].expression)); @@ -3899,8 +3909,8 @@ yyreduce: case 128: -/* Line 1455 of yacc.c */ -#line 921 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 923 "glsl_parser.ypp" { void *ctx = state; ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(2) - (2)].identifier), false, NULL, NULL); @@ -3915,8 +3925,8 @@ yyreduce: case 129: -/* Line 1455 of yacc.c */ -#line 935 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 937 "glsl_parser.ypp" { void *ctx = state; (yyval.fully_specified_type) = new(ctx) ast_fully_specified_type(); @@ -3927,8 +3937,8 @@ yyreduce: case 130: -/* Line 1455 of yacc.c */ -#line 942 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 944 "glsl_parser.ypp" { void *ctx = state; (yyval.fully_specified_type) = new(ctx) ast_fully_specified_type(); @@ -3940,15 +3950,15 @@ yyreduce: case 131: -/* Line 1455 of yacc.c */ -#line 952 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 954 "glsl_parser.ypp" { (yyval.type_qualifier).i = 0; ;} break; case 133: -/* Line 1455 of yacc.c */ -#line 958 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 960 "glsl_parser.ypp" { (yyval.type_qualifier) = (yyvsp[(3) - (4)].type_qualifier); ;} @@ -3956,8 +3966,8 @@ yyreduce: case 135: -/* Line 1455 of yacc.c */ -#line 966 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 968 "glsl_parser.ypp" { (yyval.type_qualifier).i = (yyvsp[(1) - (3)].type_qualifier).i | (yyvsp[(3) - (3)].type_qualifier).i; ;} @@ -3965,8 +3975,8 @@ yyreduce: case 136: -/* Line 1455 of yacc.c */ -#line 973 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 975 "glsl_parser.ypp" { (yyval.type_qualifier).i = 0; @@ -4001,36 +4011,36 @@ yyreduce: case 137: -/* Line 1455 of yacc.c */ -#line 1006 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1008 "glsl_parser.ypp" { (yyval.type_qualifier).i = 0; (yyval.type_qualifier).q.smooth = 1; ;} break; case 138: -/* Line 1455 of yacc.c */ -#line 1007 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1009 "glsl_parser.ypp" { (yyval.type_qualifier).i = 0; (yyval.type_qualifier).q.flat = 1; ;} break; case 139: -/* Line 1455 of yacc.c */ -#line 1008 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1010 "glsl_parser.ypp" { (yyval.type_qualifier).i = 0; (yyval.type_qualifier).q.noperspective = 1; ;} break; case 140: -/* Line 1455 of yacc.c */ -#line 1012 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1014 "glsl_parser.ypp" { (yyval.type_qualifier).i = 0; (yyval.type_qualifier).q.constant = 1; ;} break; case 142: -/* Line 1455 of yacc.c */ -#line 1018 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1020 "glsl_parser.ypp" { (yyval.type_qualifier).i = (yyvsp[(1) - (2)].type_qualifier).i | (yyvsp[(2) - (2)].type_qualifier).i; ;} @@ -4038,8 +4048,8 @@ yyreduce: case 143: -/* Line 1455 of yacc.c */ -#line 1022 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1024 "glsl_parser.ypp" { (yyval.type_qualifier) = (yyvsp[(2) - (2)].type_qualifier); (yyval.type_qualifier).q.invariant = 1; @@ -4048,71 +4058,71 @@ yyreduce: case 144: -/* Line 1455 of yacc.c */ -#line 1029 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1031 "glsl_parser.ypp" { (yyval.type_qualifier).i = 0; (yyval.type_qualifier).q.constant = 1; ;} break; case 145: -/* Line 1455 of yacc.c */ -#line 1030 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1032 "glsl_parser.ypp" { (yyval.type_qualifier).i = 0; (yyval.type_qualifier).q.attribute = 1; ;} break; case 146: -/* Line 1455 of yacc.c */ -#line 1031 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1033 "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 1032 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1034 "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 1033 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1035 "glsl_parser.ypp" { (yyval.type_qualifier).i = 0; (yyval.type_qualifier).q.in = 1; ;} break; case 149: -/* Line 1455 of yacc.c */ -#line 1034 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1036 "glsl_parser.ypp" { (yyval.type_qualifier).i = 0; (yyval.type_qualifier).q.out = 1; ;} break; case 150: -/* Line 1455 of yacc.c */ -#line 1035 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1037 "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 1036 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1038 "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 1037 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1039 "glsl_parser.ypp" { (yyval.type_qualifier).i = 0; (yyval.type_qualifier).q.uniform = 1; ;} break; case 154: -/* Line 1455 of yacc.c */ -#line 1043 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1045 "glsl_parser.ypp" { (yyval.type_specifier) = (yyvsp[(2) - (2)].type_specifier); (yyval.type_specifier)->precision = (yyvsp[(1) - (2)].n); @@ -4121,8 +4131,8 @@ yyreduce: case 156: -/* Line 1455 of yacc.c */ -#line 1052 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1054 "glsl_parser.ypp" { (yyval.type_specifier) = (yyvsp[(1) - (3)].type_specifier); (yyval.type_specifier)->is_array = true; @@ -4132,8 +4142,8 @@ yyreduce: case 157: -/* Line 1455 of yacc.c */ -#line 1058 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1060 "glsl_parser.ypp" { (yyval.type_specifier) = (yyvsp[(1) - (4)].type_specifier); (yyval.type_specifier)->is_array = true; @@ -4143,8 +4153,8 @@ yyreduce: case 158: -/* Line 1455 of yacc.c */ -#line 1067 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1069 "glsl_parser.ypp" { void *ctx = state; (yyval.type_specifier) = new(ctx) ast_type_specifier((yyvsp[(1) - (1)].n)); @@ -4154,8 +4164,8 @@ yyreduce: case 159: -/* Line 1455 of yacc.c */ -#line 1073 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1075 "glsl_parser.ypp" { void *ctx = state; (yyval.type_specifier) = new(ctx) ast_type_specifier((yyvsp[(1) - (1)].struct_specifier)); @@ -4165,8 +4175,8 @@ yyreduce: case 160: -/* Line 1455 of yacc.c */ -#line 1079 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1081 "glsl_parser.ypp" { void *ctx = state; (yyval.type_specifier) = new(ctx) ast_type_specifier((yyvsp[(1) - (1)].identifier)); @@ -4176,365 +4186,365 @@ yyreduce: case 161: -/* Line 1455 of yacc.c */ -#line 1087 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1089 "glsl_parser.ypp" { (yyval.n) = ast_void; ;} break; case 162: -/* Line 1455 of yacc.c */ -#line 1088 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1090 "glsl_parser.ypp" { (yyval.n) = ast_float; ;} break; case 163: -/* Line 1455 of yacc.c */ -#line 1089 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1091 "glsl_parser.ypp" { (yyval.n) = ast_int; ;} break; case 164: -/* Line 1455 of yacc.c */ -#line 1090 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1092 "glsl_parser.ypp" { (yyval.n) = ast_uint; ;} break; case 165: -/* Line 1455 of yacc.c */ -#line 1091 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1093 "glsl_parser.ypp" { (yyval.n) = ast_bool; ;} break; case 166: -/* Line 1455 of yacc.c */ -#line 1092 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1094 "glsl_parser.ypp" { (yyval.n) = ast_vec2; ;} break; case 167: -/* Line 1455 of yacc.c */ -#line 1093 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1095 "glsl_parser.ypp" { (yyval.n) = ast_vec3; ;} break; case 168: -/* Line 1455 of yacc.c */ -#line 1094 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1096 "glsl_parser.ypp" { (yyval.n) = ast_vec4; ;} break; case 169: -/* Line 1455 of yacc.c */ -#line 1095 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1097 "glsl_parser.ypp" { (yyval.n) = ast_bvec2; ;} break; case 170: -/* Line 1455 of yacc.c */ -#line 1096 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1098 "glsl_parser.ypp" { (yyval.n) = ast_bvec3; ;} break; case 171: -/* Line 1455 of yacc.c */ -#line 1097 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1099 "glsl_parser.ypp" { (yyval.n) = ast_bvec4; ;} break; case 172: -/* Line 1455 of yacc.c */ -#line 1098 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1100 "glsl_parser.ypp" { (yyval.n) = ast_ivec2; ;} break; case 173: -/* Line 1455 of yacc.c */ -#line 1099 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1101 "glsl_parser.ypp" { (yyval.n) = ast_ivec3; ;} break; case 174: -/* Line 1455 of yacc.c */ -#line 1100 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1102 "glsl_parser.ypp" { (yyval.n) = ast_ivec4; ;} break; case 175: -/* Line 1455 of yacc.c */ -#line 1101 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1103 "glsl_parser.ypp" { (yyval.n) = ast_uvec2; ;} break; case 176: -/* Line 1455 of yacc.c */ -#line 1102 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1104 "glsl_parser.ypp" { (yyval.n) = ast_uvec3; ;} break; case 177: -/* Line 1455 of yacc.c */ -#line 1103 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1105 "glsl_parser.ypp" { (yyval.n) = ast_uvec4; ;} break; case 178: -/* Line 1455 of yacc.c */ -#line 1104 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1106 "glsl_parser.ypp" { (yyval.n) = ast_mat2; ;} break; case 179: -/* Line 1455 of yacc.c */ -#line 1105 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1107 "glsl_parser.ypp" { (yyval.n) = ast_mat2x3; ;} break; case 180: -/* Line 1455 of yacc.c */ -#line 1106 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1108 "glsl_parser.ypp" { (yyval.n) = ast_mat2x4; ;} break; case 181: -/* Line 1455 of yacc.c */ -#line 1107 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1109 "glsl_parser.ypp" { (yyval.n) = ast_mat3x2; ;} break; case 182: -/* Line 1455 of yacc.c */ -#line 1108 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1110 "glsl_parser.ypp" { (yyval.n) = ast_mat3; ;} break; case 183: -/* Line 1455 of yacc.c */ -#line 1109 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1111 "glsl_parser.ypp" { (yyval.n) = ast_mat3x4; ;} break; case 184: -/* Line 1455 of yacc.c */ -#line 1110 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1112 "glsl_parser.ypp" { (yyval.n) = ast_mat4x2; ;} break; case 185: -/* Line 1455 of yacc.c */ -#line 1111 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1113 "glsl_parser.ypp" { (yyval.n) = ast_mat4x3; ;} break; case 186: -/* Line 1455 of yacc.c */ -#line 1112 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1114 "glsl_parser.ypp" { (yyval.n) = ast_mat4; ;} break; case 187: -/* Line 1455 of yacc.c */ -#line 1113 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1115 "glsl_parser.ypp" { (yyval.n) = ast_sampler1d; ;} break; case 188: -/* Line 1455 of yacc.c */ -#line 1114 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1116 "glsl_parser.ypp" { (yyval.n) = ast_sampler2d; ;} break; case 189: -/* Line 1455 of yacc.c */ -#line 1115 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1117 "glsl_parser.ypp" { (yyval.n) = ast_sampler2drect; ;} break; case 190: -/* Line 1455 of yacc.c */ -#line 1116 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1118 "glsl_parser.ypp" { (yyval.n) = ast_sampler3d; ;} break; case 191: -/* Line 1455 of yacc.c */ -#line 1117 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1119 "glsl_parser.ypp" { (yyval.n) = ast_samplercube; ;} break; case 192: -/* Line 1455 of yacc.c */ -#line 1118 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1120 "glsl_parser.ypp" { (yyval.n) = ast_sampler1dshadow; ;} break; case 193: -/* Line 1455 of yacc.c */ -#line 1119 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1121 "glsl_parser.ypp" { (yyval.n) = ast_sampler2dshadow; ;} break; case 194: -/* Line 1455 of yacc.c */ -#line 1120 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1122 "glsl_parser.ypp" { (yyval.n) = ast_sampler2drectshadow; ;} break; case 195: -/* Line 1455 of yacc.c */ -#line 1121 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1123 "glsl_parser.ypp" { (yyval.n) = ast_samplercubeshadow; ;} break; case 196: -/* Line 1455 of yacc.c */ -#line 1122 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1124 "glsl_parser.ypp" { (yyval.n) = ast_sampler1darray; ;} break; case 197: -/* Line 1455 of yacc.c */ -#line 1123 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1125 "glsl_parser.ypp" { (yyval.n) = ast_sampler2darray; ;} break; case 198: -/* Line 1455 of yacc.c */ -#line 1124 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1126 "glsl_parser.ypp" { (yyval.n) = ast_sampler1darrayshadow; ;} break; case 199: -/* Line 1455 of yacc.c */ -#line 1125 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1127 "glsl_parser.ypp" { (yyval.n) = ast_sampler2darrayshadow; ;} break; case 200: -/* Line 1455 of yacc.c */ -#line 1126 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1128 "glsl_parser.ypp" { (yyval.n) = ast_isampler1d; ;} break; case 201: -/* Line 1455 of yacc.c */ -#line 1127 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1129 "glsl_parser.ypp" { (yyval.n) = ast_isampler2d; ;} break; case 202: -/* Line 1455 of yacc.c */ -#line 1128 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1130 "glsl_parser.ypp" { (yyval.n) = ast_isampler3d; ;} break; case 203: -/* Line 1455 of yacc.c */ -#line 1129 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1131 "glsl_parser.ypp" { (yyval.n) = ast_isamplercube; ;} break; case 204: -/* Line 1455 of yacc.c */ -#line 1130 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1132 "glsl_parser.ypp" { (yyval.n) = ast_isampler1darray; ;} break; case 205: -/* Line 1455 of yacc.c */ -#line 1131 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1133 "glsl_parser.ypp" { (yyval.n) = ast_isampler2darray; ;} break; case 206: -/* Line 1455 of yacc.c */ -#line 1132 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1134 "glsl_parser.ypp" { (yyval.n) = ast_usampler1d; ;} break; case 207: -/* Line 1455 of yacc.c */ -#line 1133 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1135 "glsl_parser.ypp" { (yyval.n) = ast_usampler2d; ;} break; case 208: -/* Line 1455 of yacc.c */ -#line 1134 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1136 "glsl_parser.ypp" { (yyval.n) = ast_usampler3d; ;} break; case 209: -/* Line 1455 of yacc.c */ -#line 1135 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1137 "glsl_parser.ypp" { (yyval.n) = ast_usamplercube; ;} break; case 210: -/* Line 1455 of yacc.c */ -#line 1136 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1138 "glsl_parser.ypp" { (yyval.n) = ast_usampler1darray; ;} break; case 211: -/* Line 1455 of yacc.c */ -#line 1137 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1139 "glsl_parser.ypp" { (yyval.n) = ast_usampler2darray; ;} break; case 212: -/* Line 1455 of yacc.c */ -#line 1141 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1143 "glsl_parser.ypp" { if (state->language_version < 130) _mesa_glsl_error(& (yylsp[(1) - (1)]), state, @@ -4550,8 +4560,8 @@ yyreduce: case 213: -/* Line 1455 of yacc.c */ -#line 1152 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1154 "glsl_parser.ypp" { if (state->language_version < 130) _mesa_glsl_error(& (yylsp[(1) - (1)]), state, @@ -4567,8 +4577,8 @@ yyreduce: case 214: -/* Line 1455 of yacc.c */ -#line 1163 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1165 "glsl_parser.ypp" { if (state->language_version < 130) _mesa_glsl_error(& (yylsp[(1) - (1)]), state, @@ -4584,8 +4594,8 @@ yyreduce: case 215: -/* Line 1455 of yacc.c */ -#line 1178 "glsl_parser.ypp" +/* Line 1464 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)); @@ -4595,8 +4605,8 @@ yyreduce: case 216: -/* Line 1455 of yacc.c */ -#line 1184 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1186 "glsl_parser.ypp" { void *ctx = state; (yyval.struct_specifier) = new(ctx) ast_struct_specifier(NULL, (yyvsp[(3) - (4)].node)); @@ -4606,8 +4616,8 @@ yyreduce: case 217: -/* Line 1455 of yacc.c */ -#line 1193 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1195 "glsl_parser.ypp" { (yyval.node) = (ast_node *) (yyvsp[(1) - (1)].declarator_list); (yyvsp[(1) - (1)].declarator_list)->link.self_link(); @@ -4616,8 +4626,8 @@ yyreduce: case 218: -/* Line 1455 of yacc.c */ -#line 1198 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1200 "glsl_parser.ypp" { (yyval.node) = (ast_node *) (yyvsp[(1) - (2)].node); (yyval.node)->link.insert_before(& (yyvsp[(2) - (2)].declarator_list)->link); @@ -4626,8 +4636,8 @@ yyreduce: case 219: -/* Line 1455 of yacc.c */ -#line 1206 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1208 "glsl_parser.ypp" { void *ctx = state; ast_fully_specified_type *type = new(ctx) ast_fully_specified_type(); @@ -4643,8 +4653,8 @@ yyreduce: case 220: -/* Line 1455 of yacc.c */ -#line 1221 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1223 "glsl_parser.ypp" { (yyval.declaration) = (yyvsp[(1) - (1)].declaration); (yyvsp[(1) - (1)].declaration)->link.self_link(); @@ -4653,8 +4663,8 @@ yyreduce: case 221: -/* Line 1455 of yacc.c */ -#line 1226 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1228 "glsl_parser.ypp" { (yyval.declaration) = (yyvsp[(1) - (3)].declaration); (yyval.declaration)->link.insert_before(& (yyvsp[(3) - (3)].declaration)->link); @@ -4663,8 +4673,8 @@ yyreduce: case 222: -/* Line 1455 of yacc.c */ -#line 1234 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1236 "glsl_parser.ypp" { void *ctx = state; (yyval.declaration) = new(ctx) ast_declaration((yyvsp[(1) - (1)].identifier), false, NULL, NULL); @@ -4674,8 +4684,8 @@ yyreduce: case 223: -/* Line 1455 of yacc.c */ -#line 1240 "glsl_parser.ypp" +/* Line 1464 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); @@ -4685,29 +4695,29 @@ yyreduce: case 228: -/* Line 1455 of yacc.c */ -#line 1263 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1265 "glsl_parser.ypp" { (yyval.node) = (ast_node *) (yyvsp[(1) - (1)].compound_statement); ;} break; case 234: -/* Line 1455 of yacc.c */ -#line 1275 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1277 "glsl_parser.ypp" { (yyval.node) = NULL; ;} break; case 235: -/* Line 1455 of yacc.c */ -#line 1276 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1278 "glsl_parser.ypp" { (yyval.node) = NULL; ;} break; case 238: -/* Line 1455 of yacc.c */ -#line 1283 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1285 "glsl_parser.ypp" { void *ctx = state; (yyval.compound_statement) = new(ctx) ast_compound_statement(true, NULL); @@ -4717,8 +4727,8 @@ yyreduce: case 239: -/* Line 1455 of yacc.c */ -#line 1289 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1291 "glsl_parser.ypp" { void *ctx = state; (yyval.compound_statement) = new(ctx) ast_compound_statement(true, (yyvsp[(2) - (3)].node)); @@ -4728,15 +4738,15 @@ yyreduce: case 240: -/* Line 1455 of yacc.c */ -#line 1297 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1299 "glsl_parser.ypp" { (yyval.node) = (ast_node *) (yyvsp[(1) - (1)].compound_statement); ;} break; case 242: -/* Line 1455 of yacc.c */ -#line 1303 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1305 "glsl_parser.ypp" { void *ctx = state; (yyval.compound_statement) = new(ctx) ast_compound_statement(false, NULL); @@ -4746,8 +4756,8 @@ yyreduce: case 243: -/* Line 1455 of yacc.c */ -#line 1309 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1311 "glsl_parser.ypp" { void *ctx = state; (yyval.compound_statement) = new(ctx) ast_compound_statement(false, (yyvsp[(2) - (3)].node)); @@ -4757,8 +4767,8 @@ yyreduce: case 244: -/* Line 1455 of yacc.c */ -#line 1318 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1320 "glsl_parser.ypp" { if ((yyvsp[(1) - (1)].node) == NULL) { _mesa_glsl_error(& (yylsp[(1) - (1)]), state, " statement\n"); @@ -4772,8 +4782,8 @@ yyreduce: case 245: -/* Line 1455 of yacc.c */ -#line 1328 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1330 "glsl_parser.ypp" { if ((yyvsp[(2) - (2)].node) == NULL) { _mesa_glsl_error(& (yylsp[(2) - (2)]), state, " statement\n"); @@ -4786,8 +4796,8 @@ yyreduce: case 246: -/* Line 1455 of yacc.c */ -#line 1340 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1342 "glsl_parser.ypp" { void *ctx = state; (yyval.node) = new(ctx) ast_expression_statement(NULL); @@ -4797,8 +4807,8 @@ yyreduce: case 247: -/* Line 1455 of yacc.c */ -#line 1346 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1348 "glsl_parser.ypp" { void *ctx = state; (yyval.node) = new(ctx) ast_expression_statement((yyvsp[(1) - (2)].expression)); @@ -4808,8 +4818,8 @@ yyreduce: case 248: -/* Line 1455 of yacc.c */ -#line 1355 "glsl_parser.ypp" +/* Line 1464 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)); @@ -4819,8 +4829,8 @@ yyreduce: case 249: -/* Line 1455 of yacc.c */ -#line 1364 "glsl_parser.ypp" +/* Line 1464 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); @@ -4830,8 +4840,8 @@ yyreduce: case 250: -/* Line 1455 of yacc.c */ -#line 1370 "glsl_parser.ypp" +/* Line 1464 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); @@ -4841,8 +4851,8 @@ yyreduce: case 251: -/* Line 1455 of yacc.c */ -#line 1376 "glsl_parser.ypp" +/* Line 1464 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)); @@ -4852,8 +4862,8 @@ yyreduce: case 252: -/* Line 1455 of yacc.c */ -#line 1385 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1387 "glsl_parser.ypp" { (yyval.node) = (ast_node *) (yyvsp[(1) - (1)].expression); ;} @@ -4861,8 +4871,8 @@ yyreduce: case 253: -/* Line 1455 of yacc.c */ -#line 1389 "glsl_parser.ypp" +/* Line 1464 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)); @@ -4877,8 +4887,8 @@ yyreduce: case 257: -/* Line 1455 of yacc.c */ -#line 1412 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1414 "glsl_parser.ypp" { void *ctx = state; (yyval.node) = new(ctx) ast_iteration_statement(ast_iteration_statement::ast_while, @@ -4889,8 +4899,8 @@ yyreduce: case 258: -/* Line 1455 of yacc.c */ -#line 1419 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1421 "glsl_parser.ypp" { void *ctx = state; (yyval.node) = new(ctx) ast_iteration_statement(ast_iteration_statement::ast_do_while, @@ -4901,8 +4911,8 @@ yyreduce: case 259: -/* Line 1455 of yacc.c */ -#line 1426 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1428 "glsl_parser.ypp" { void *ctx = state; (yyval.node) = new(ctx) ast_iteration_statement(ast_iteration_statement::ast_for, @@ -4913,8 +4923,8 @@ yyreduce: case 263: -/* Line 1455 of yacc.c */ -#line 1442 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1444 "glsl_parser.ypp" { (yyval.node) = NULL; ;} @@ -4922,8 +4932,8 @@ yyreduce: case 264: -/* Line 1455 of yacc.c */ -#line 1449 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1451 "glsl_parser.ypp" { (yyval.for_rest_statement).cond = (yyvsp[(1) - (2)].node); (yyval.for_rest_statement).rest = NULL; @@ -4932,8 +4942,8 @@ yyreduce: case 265: -/* Line 1455 of yacc.c */ -#line 1454 "glsl_parser.ypp" +/* Line 1464 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); @@ -4942,8 +4952,8 @@ yyreduce: case 266: -/* Line 1455 of yacc.c */ -#line 1463 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1465 "glsl_parser.ypp" { void *ctx = state; (yyval.node) = new(ctx) ast_jump_statement(ast_jump_statement::ast_continue, NULL); @@ -4953,8 +4963,8 @@ yyreduce: case 267: -/* Line 1455 of yacc.c */ -#line 1469 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1471 "glsl_parser.ypp" { void *ctx = state; (yyval.node) = new(ctx) ast_jump_statement(ast_jump_statement::ast_break, NULL); @@ -4964,8 +4974,8 @@ yyreduce: case 268: -/* Line 1455 of yacc.c */ -#line 1475 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1477 "glsl_parser.ypp" { void *ctx = state; (yyval.node) = new(ctx) ast_jump_statement(ast_jump_statement::ast_return, NULL); @@ -4975,8 +4985,8 @@ yyreduce: case 269: -/* Line 1455 of yacc.c */ -#line 1481 "glsl_parser.ypp" +/* Line 1464 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)); @@ -4986,8 +4996,8 @@ yyreduce: case 270: -/* Line 1455 of yacc.c */ -#line 1487 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1489 "glsl_parser.ypp" { void *ctx = state; (yyval.node) = new(ctx) ast_jump_statement(ast_jump_statement::ast_discard, NULL); @@ -4997,22 +5007,22 @@ yyreduce: case 271: -/* Line 1455 of yacc.c */ -#line 1495 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1497 "glsl_parser.ypp" { (yyval.node) = (yyvsp[(1) - (1)].function_definition); ;} break; case 272: -/* Line 1455 of yacc.c */ -#line 1496 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1498 "glsl_parser.ypp" { (yyval.node) = (yyvsp[(1) - (1)].node); ;} break; case 273: -/* Line 1455 of yacc.c */ -#line 1501 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1503 "glsl_parser.ypp" { void *ctx = state; (yyval.function_definition) = new(ctx) ast_function_definition(); @@ -5024,8 +5034,8 @@ yyreduce: -/* Line 1455 of yacc.c */ -#line 5029 "glsl_parser.cpp" +/* Line 1464 of yacc.c */ +#line 5039 "glsl_parser.cpp" default: break; } YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); @@ -5097,7 +5107,7 @@ yyerrlab: #endif } - yyerror_range[0] = yylloc; + yyerror_range[1] = yylloc; if (yyerrstatus == 3) { @@ -5134,7 +5144,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); @@ -5168,7 +5178,7 @@ yyerrlab1: if (yyssp == yyss) YYABORT; - yyerror_range[0] = *yylsp; + yyerror_range[1] = *yylsp; yydestruct ("Error: popping", yystos[yystate], yyvsp, yylsp, state); YYPOPSTACK (1); @@ -5178,10 +5188,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. */ diff --git a/src/glsl/glsl_parser.h b/src/glsl/glsl_parser.h index 48a0a5fb3a..96f9df1129 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.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 @@ -233,7 +232,7 @@ typedef union YYSTYPE { -/* Line 1676 of yacc.c */ +/* Line 1685 of yacc.c */ #line 52 "glsl_parser.ypp" int n; @@ -264,8 +263,8 @@ typedef union YYSTYPE -/* Line 1676 of yacc.c */ -#line 269 "glsl_parser.h" +/* Line 1685 of yacc.c */ +#line 268 "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 e0b1d28504..4b6d9fe7ea 100644 --- a/src/glsl/glsl_parser.ypp +++ b/src/glsl/glsl_parser.ypp @@ -216,6 +216,7 @@ version_statement: /* blank - no #version specified */ { state->language_version = 110; + state->symbols->language_version = 110; } | VERSION INTCONSTANT EOL { @@ -225,6 +226,7 @@ version_statement: case 130: /* FINISHME: Check against implementation support versions. */ state->language_version = $2; + state->symbols->language_version = $2; break; default: _mesa_glsl_error(& @2, state, "Shading language version" diff --git a/src/glsl/glsl_symbol_table.cpp b/src/glsl/glsl_symbol_table.cpp new file mode 100644 index 0000000000..76c440c342 --- /dev/null +++ b/src/glsl/glsl_symbol_table.cpp @@ -0,0 +1,160 @@ +/* -*- 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 "glsl_symbol_table.h" + +class symbol_table_entry { +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 *entry = talloc_size(ctx, size); + assert(entry != NULL); + return entry; + } + + /* 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); + } + + symbol_table_entry(ir_variable *v) : v(v), f(0), t(0) {} + symbol_table_entry(ir_function *f) : v(0), f(f), t(0) {} + symbol_table_entry(const glsl_type *t, ir_function *f) : v(0), f(f), t(t) {} + + ir_variable *v; + ir_function *f; + const glsl_type *t; +}; + +glsl_symbol_table::glsl_symbol_table() +{ + this->language_version = 120; + this->table = _mesa_symbol_table_ctor(); + this->mem_ctx = talloc_init("symbol table entries"); +} + +glsl_symbol_table::~glsl_symbol_table() +{ + _mesa_symbol_table_dtor(table); + talloc_free(mem_ctx); +} + +void glsl_symbol_table::push_scope() +{ + _mesa_symbol_table_push_scope(table); +} + +void glsl_symbol_table::pop_scope() +{ + _mesa_symbol_table_pop_scope(table); +} + +bool glsl_symbol_table::name_declared_this_scope(const char *name) +{ + return _mesa_symbol_table_symbol_scope(table, -1, name) == 0; +} + +bool glsl_symbol_table::add_variable(const char *name, ir_variable *v) +{ + if (this->language_version == 110) { + /* In 1.10, functions and variables have separate namespaces. */ + symbol_table_entry *existing = get_entry(name); + if (name_declared_this_scope(name)) { + /* If there's already an existing function (not a constructor!) in + * the current scope, just update the existing entry to include 'v'. + */ + if (existing->v == NULL && existing->t == NULL) { + existing->v = v; + return true; + } + } else { + /* If not declared at this scope, add a new entry. But if an existing + * entry includes a function, propagate that to this block - otherwise + * the new variable declaration would shadow the function. + */ + symbol_table_entry *entry = new(mem_ctx) symbol_table_entry(v); + if (existing != NULL) + entry->f = existing->f; + int added = _mesa_symbol_table_add_symbol(table, -1, name, entry); + assert(added == 0); + return true; + } + return false; + } + + /* 1.20+ rules: */ + symbol_table_entry *entry = new(mem_ctx) symbol_table_entry(v); + return _mesa_symbol_table_add_symbol(table, -1, name, entry) == 0; +} + +bool glsl_symbol_table::add_type(const char *name, const glsl_type *t, + ir_function *constructor) +{ + symbol_table_entry *entry = new(mem_ctx) symbol_table_entry(t, constructor); + return _mesa_symbol_table_add_symbol(table, -1, name, entry) == 0; +} + +bool glsl_symbol_table::add_function(const char *name, ir_function *f) +{ + if (this->language_version == 110 && name_declared_this_scope(name)) { + /* In 1.10, functions and variables have separate namespaces. */ + symbol_table_entry *existing = get_entry(name); + if (existing->f == NULL) { + existing->f = f; + return true; + } + } + symbol_table_entry *entry = new(mem_ctx) symbol_table_entry(f); + return _mesa_symbol_table_add_symbol(table, -1, name, entry) == 0; +} + +ir_variable *glsl_symbol_table::get_variable(const char *name) +{ + symbol_table_entry *entry = get_entry(name); + return entry != NULL ? entry->v : NULL; +} + +const glsl_type *glsl_symbol_table::get_type(const char *name) +{ + symbol_table_entry *entry = get_entry(name); + return entry != NULL ? entry->t : NULL; +} + +ir_function *glsl_symbol_table::get_function(const char *name) +{ + symbol_table_entry *entry = get_entry(name); + return entry != NULL ? entry->f : NULL; +} + +symbol_table_entry *glsl_symbol_table::get_entry(const char *name) +{ + return (symbol_table_entry *) + _mesa_symbol_table_find_symbol(table, -1, name); +} diff --git a/src/glsl/glsl_symbol_table.h b/src/glsl/glsl_symbol_table.h index 4cb7559e9a..d71be5578b 100644 --- a/src/glsl/glsl_symbol_table.h +++ b/src/glsl/glsl_symbol_table.h @@ -34,6 +34,8 @@ extern "C" { #include "ir.h" #include "glsl_types.h" +class symbol_table_entry; + /** * Facade class for _mesa_symbol_table * @@ -42,12 +44,6 @@ extern "C" { */ struct 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) { @@ -80,33 +76,18 @@ public: talloc_free(table); } - glsl_symbol_table() - { - table = _mesa_symbol_table_ctor(); - } + glsl_symbol_table(); + ~glsl_symbol_table(); - ~glsl_symbol_table() - { - _mesa_symbol_table_dtor(table); - } + unsigned int language_version; - void push_scope() - { - _mesa_symbol_table_push_scope(table); - } - - void pop_scope() - { - _mesa_symbol_table_pop_scope(table); - } + void push_scope(); + void pop_scope(); /** * 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; - } + bool name_declared_this_scope(const char *name); /** * \name Methods to add symbols to the table @@ -116,56 +97,26 @@ public: * 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; - } - - bool remove_function(const char *name, ir_function *f) - { - return _mesa_symbol_table_add_symbol(table, glsl_function_name_space, - name, f) == 0; - } + bool add_variable(const char *name, ir_variable *v); + bool add_type(const char *name, const glsl_type *t, + ir_function *constructor = NULL); + bool add_function(const char *name, ir_function *f); /*@}*/ /** * \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); - } + ir_variable *get_variable(const char *name); + const glsl_type *get_type(const char *name); + ir_function *get_function(const char *name); /*@}*/ private: + symbol_table_entry *get_entry(const char *name); + struct _mesa_symbol_table *table; + void *mem_ctx; }; #endif /* GLSL_SYMBOL_TABLE */ diff --git a/src/glsl/glsl_types.cpp b/src/glsl/glsl_types.cpp index 2e5c2ecf04..a7d02e18df 100644 --- a/src/glsl/glsl_types.cpp +++ b/src/glsl/glsl_types.cpp @@ -233,18 +233,11 @@ _mesa_glsl_release_types(void) ir_function * -glsl_type::generate_constructor(glsl_symbol_table *symtab) const +glsl_type::generate_constructor() const { - void *ctx = symtab; + void *ctx = (void *) this; - /* 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); - (void) added; - ir_function_signature *const sig = new(ctx) ir_function_signature(this); f->add_signature(sig); diff --git a/src/glsl/glsl_types.h b/src/glsl/glsl_types.h index 80cec635d9..3e86d2c011 100644 --- a/src/glsl/glsl_types.h +++ b/src/glsl/glsl_types.h @@ -208,9 +208,9 @@ struct glsl_type { unsigned num_fields, const char *name); /** - * Generate the constructor for this type and add it to the symbol table + * Generate the constructor for this type and return it */ - class ir_function *generate_constructor(glsl_symbol_table *) const; + class ir_function *generate_constructor() const; /** * Query the total number of scalars that make up a scalar, vector or matrix -- cgit v1.2.3 From e09591317b2470fe9c104606577d4e10255727c0 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Wed, 25 Aug 2010 16:37:46 -0700 Subject: glsl: Remove name_declared_this_scope check when adding functions. Instead, rely on the symbol table's rules. Fixes redeclaration-02.vert. --- src/glsl/ast_to_hir.cpp | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp index 8c105e79f7..8caf950c2d 100644 --- a/src/glsl/ast_to_hir.cpp +++ b/src/glsl/ast_to_hir.cpp @@ -2197,17 +2197,16 @@ ast_function::hir(exec_list *instructions, _mesa_glsl_error(& loc, state, "function `%s' redefined", name); } } - } 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); - return NULL; } else { f = new(ctx) ir_function(name); - state->symbols->add_function(f->name, f); + if (!state->symbols->add_function(f->name, f)) { + /* 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); + return NULL; + } /* Emit the new function header */ instructions->push_tail(f); -- cgit v1.2.3 From ac2376e6f51677ab321930b0200a79d1683cfbba Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Wed, 25 Aug 2010 17:10:16 -0700 Subject: glsl: Don't add overloads to existing structure constructors. Instead, make a new ir_function and try to add it to the symbol table. Fixes piglit test redeclaration-08.vert. --- src/glsl/ast_to_hir.cpp | 2 +- src/glsl/glsl_symbol_table.cpp | 9 +++++++-- src/glsl/glsl_symbol_table.h | 2 +- 3 files changed, 9 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp index 8caf950c2d..c666da300b 100644 --- a/src/glsl/ast_to_hir.cpp +++ b/src/glsl/ast_to_hir.cpp @@ -2172,7 +2172,7 @@ ast_function::hir(exec_list *instructions, * 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. */ - f = state->symbols->get_function(name); + f = state->symbols->get_function(name, false); if (f != NULL) { sig = f->exact_matching_signature(&hir_parameters); if (sig != NULL) { diff --git a/src/glsl/glsl_symbol_table.cpp b/src/glsl/glsl_symbol_table.cpp index 76c440c342..11e1671335 100644 --- a/src/glsl/glsl_symbol_table.cpp +++ b/src/glsl/glsl_symbol_table.cpp @@ -147,10 +147,15 @@ const glsl_type *glsl_symbol_table::get_type(const char *name) return entry != NULL ? entry->t : NULL; } -ir_function *glsl_symbol_table::get_function(const char *name) +ir_function *glsl_symbol_table::get_function(const char *name, + bool return_constructors) { symbol_table_entry *entry = get_entry(name); - return entry != NULL ? entry->f : NULL; + // If there's a type, the function is a constructor; caller may not want it. + if (entry != NULL && (return_constructors || entry->t == NULL)) + return entry->f; + + return NULL; } symbol_table_entry *glsl_symbol_table::get_entry(const char *name) diff --git a/src/glsl/glsl_symbol_table.h b/src/glsl/glsl_symbol_table.h index d71be5578b..c90fdc3c1d 100644 --- a/src/glsl/glsl_symbol_table.h +++ b/src/glsl/glsl_symbol_table.h @@ -109,7 +109,7 @@ public: /*@{*/ ir_variable *get_variable(const char *name); const glsl_type *get_type(const char *name); - ir_function *get_function(const char *name); + ir_function *get_function(const char *name, bool return_constructors = true); /*@}*/ private: -- cgit v1.2.3 From 5d25746640ee27882b69a962459727cf924443db Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Tue, 24 Aug 2010 01:45:49 -0700 Subject: glsl: Refactor variable declaration handling. Moving the check for an earlier variable declaration helps cleanly separate out the re-declaration vs. new declaration code a bit. With that in place, conflicts between variable names and structure types or function names aren't caught by the earlier "redeclaration" error message, so check the return type on glsl_symbol_table::add_variable and issue an error there. If one occurs, don't emit the initializer. Fixes redeclaration-01.vert and redeclaration-09.vert. Signed-off-by: Ian Romanick --- src/glsl/ast_to_hir.cpp | 77 ++++++++++++++++++++++++++----------------------- 1 file changed, 41 insertions(+), 36 deletions(-) (limited to 'src') diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp index c666da300b..9b723162f6 100644 --- a/src/glsl/ast_to_hir.cpp +++ b/src/glsl/ast_to_hir.cpp @@ -1887,22 +1887,22 @@ 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. + /* Check if this declaration is actually a re-declaration, either to + * resize an array or add qualifiers to an existing variable. * - * 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." + * This is allowed for variables in the current scope. */ - if (state->symbols->name_declared_this_scope(decl->identifier)) { - ir_variable *const earlier = - state->symbols->get_variable(decl->identifier); + ir_variable *earlier = state->symbols->get_variable(decl->identifier); + if (earlier != NULL + && state->symbols->name_declared_this_scope(decl->identifier)) { - if ((earlier != NULL) - && (earlier->type->array_size() == 0) + /* From page 24 (page 30 of the PDF) of the GLSL 1.50 spec, + * + * "It is legal to declare an array without a size and then + * later re-declare the same name as an array of the same + * type and specify a size." + */ + if ((earlier->type->array_size() == 0) && var->type->is_array() && (var->type->element_type() == earlier->type->element_type())) { /* FINISHME: This doesn't match the qualifiers on the two @@ -1934,11 +1934,10 @@ 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) { + } else if (state->extensions->ARB_fragment_coord_conventions + && strcmp(var->name, "gl_FragCoord") == 0 + && earlier->type == var->type + && earlier->mode == var->mode) { /* Allow redeclaration of gl_FragCoord for ARB_fcc layout * qualifiers. */ @@ -1946,15 +1945,16 @@ ast_declarator_list::hir(exec_list *instructions, earlier->pixel_center_integer = var->pixel_center_integer; } else { YYLTYPE loc = this->get_location(); - - _mesa_glsl_error(& loc, state, "`%s' redeclared", - decl->identifier); + _mesa_glsl_error(&loc, state, "`%s' redeclared", decl->identifier); } continue; } - /* From page 15 (page 21 of the PDF) of the GLSL 1.10 spec, + /* By now, we know it's a new variable declaration (we didn't hit the + * above "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 @@ -1969,6 +1969,25 @@ ast_declarator_list::hir(exec_list *instructions, decl->identifier); } + /* Add the variable to the symbol table. Note that the initializer's + * IR was already processed earlier (though it hasn't been emitted yet), + * without the variable in scope. + * + * 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." + */ + if (!state->symbols->add_variable(var->name, var)) { + YYLTYPE loc = this->get_location(); + _mesa_glsl_error(&loc, state, "name `%s' already taken in the " + "current scope", decl->identifier); + continue; + } + /* 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 @@ -1978,20 +1997,6 @@ ast_declarator_list::hir(exec_list *instructions, */ instructions->push_head(var); 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 - * 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(var->name, var); - assert(added_variable); - (void) added_variable; } -- cgit v1.2.3 From b6f15869b324ae64a00d0fe46fa3c8c62c1edb6c Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Fri, 20 Aug 2010 20:04:39 -0700 Subject: glsl: Move is_built_in flag from ir_function_signature to ir_function. Also rename it to "is_builtin" for consistency. Signed-off-by: Ian Romanick --- src/glsl/ir.cpp | 2 +- src/glsl/ir.h | 6 +++--- src/glsl/ir_clone.cpp | 3 ++- src/glsl/ir_constant_expression.cpp | 2 +- src/glsl/ir_import_prototypes.cpp | 2 +- src/glsl/ir_print_visitor.cpp | 10 ++-------- src/glsl/ir_reader.cpp | 2 +- src/glsl/linker.cpp | 4 ++-- 8 files changed, 13 insertions(+), 18 deletions(-) (limited to 'src') diff --git a/src/glsl/ir.cpp b/src/glsl/ir.cpp index 31e40cac8c..8779ec73c9 100644 --- a/src/glsl/ir.cpp +++ b/src/glsl/ir.cpp @@ -982,7 +982,6 @@ 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; } @@ -1034,6 +1033,7 @@ ir_function::ir_function(const char *name) { this->ir_type = ir_type_function; this->name = talloc_strdup(this, name); + this->is_builtin = false; } diff --git a/src/glsl/ir.h b/src/glsl/ir.h index 500b152408..0f887a9327 100644 --- a/src/glsl/ir.h +++ b/src/glsl/ir.h @@ -342,9 +342,6 @@ 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; @@ -410,6 +407,9 @@ public: */ const char *name; + /** Whether or not this function is a built-in. */ + unsigned is_builtin:1; + /** * List of ir_function_signature for each overloaded function with this name. */ diff --git a/src/glsl/ir_clone.cpp b/src/glsl/ir_clone.cpp index 0a9e25a295..1d690a4da7 100644 --- a/src/glsl/ir_clone.cpp +++ b/src/glsl/ir_clone.cpp @@ -249,6 +249,8 @@ ir_function::clone(void *mem_ctx, struct hash_table *ht) const { ir_function *copy = new(mem_ctx) ir_function(this->name); + copy->is_builtin = this->is_builtin; + foreach_list_const(node, &this->signatures) { const ir_function_signature *const sig = (const ir_function_signature *const) node; @@ -271,7 +273,6 @@ ir_function_signature::clone(void *mem_ctx, 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_constant_expression.cpp b/src/glsl/ir_constant_expression.cpp index f1c175c97a..5ec60c522f 100644 --- a/src/glsl/ir_constant_expression.cpp +++ b/src/glsl/ir_constant_expression.cpp @@ -785,7 +785,7 @@ ir_call::constant_expression_value() * "Function calls to user-defined functions (non-built-in functions) * cannot be used to form constant expressions." */ - if (!this->callee->is_built_in) + if (!this->callee->function()->is_builtin) return NULL; unsigned num_parameters = 0; diff --git a/src/glsl/ir_import_prototypes.cpp b/src/glsl/ir_import_prototypes.cpp index e553e12a49..a39b384071 100644 --- a/src/glsl/ir_import_prototypes.cpp +++ b/src/glsl/ir_import_prototypes.cpp @@ -59,6 +59,7 @@ public: this->function = this->symbols->get_function(ir->name); if (!this->function) { this->function = new(this->mem_ctx) ir_function(ir->name); + this->function->is_builtin = ir->is_builtin; list->push_tail(this->function); @@ -86,7 +87,6 @@ public: 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. */ diff --git a/src/glsl/ir_print_visitor.cpp b/src/glsl/ir_print_visitor.cpp index 83e6403272..f47ad87550 100644 --- a/src/glsl/ir_print_visitor.cpp +++ b/src/glsl/ir_print_visitor.cpp @@ -153,14 +153,8 @@ 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) + /* Don't print built-in functions as part of the IR. */ + if (ir->is_builtin) return; printf("(function %s\n", ir->name); diff --git a/src/glsl/ir_reader.cpp b/src/glsl/ir_reader.cpp index 3e221c0e5f..366db32774 100644 --- a/src/glsl/ir_reader.cpp +++ b/src/glsl/ir_reader.cpp @@ -209,6 +209,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()); + f->is_builtin = true; added = st->symbols->add_function(f->name, f); assert(added); } @@ -281,7 +282,6 @@ read_function_sig(_mesa_glsl_parse_state *st, ir_function *f, s_list *list, 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); diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp index 0348bd01e8..3de069b531 100644 --- a/src/glsl/linker.cpp +++ b/src/glsl/linker.cpp @@ -726,14 +726,14 @@ link_intrastage_shaders(GLcontext *ctx, ir_function_signature *sig = (ir_function_signature *) iter.get(); - if (!sig->is_defined || sig->is_built_in) + if (!sig->is_defined || f->is_builtin) 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) { + && !other_sig->function()->is_builtin) { linker_error_printf(prog, "function `%s' is multiply defined", f->name); -- cgit v1.2.3 From a044285e25615f2d97636fe3ba47d580c3537bc4 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Mon, 23 Aug 2010 14:52:06 -0700 Subject: glsl: Move built-ins to live beyond the global scope. Per the GLSL 1.20 specification (presumably a clarification of 1.10). Also, when creating user functions, make a new ir_function that shadows the built-in ir_function, rather than adding new signatures. User functions are supposed to hide built-ins, not overload them. Fixes piglit tests redeclaration-{04, 12, 14}.vert. --- src/glsl/ast_to_hir.cpp | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp index 9b723162f6..548b3d8e5a 100644 --- a/src/glsl/ast_to_hir.cpp +++ b/src/glsl/ast_to_hir.cpp @@ -64,6 +64,21 @@ _mesa_ast_to_hir(exec_list *instructions, struct _mesa_glsl_parse_state *state) state->current_function = NULL; + /* Section 4.2 of the GLSL 1.20 specification states: + * "The built-in functions are scoped in a scope outside the global scope + * users declare global variables in. That is, a shader's global scope, + * available for user-defined functions and global variables, is nested + * inside the scope containing the built-in functions." + * + * Since built-in functions like ftransform() access built-in variables, + * it follows that those must be in the outer scope as well. + * + * We push scope here to create this nesting effect...but don't pop. + * This way, a shader's globals are still in the symbol table for use + * by the linker. + */ + state->symbols->push_scope(); + foreach_list_typed (ast_node, ast, link, & state->translation_unit) ast->hir(instructions, state); } @@ -1890,11 +1905,12 @@ ast_declarator_list::hir(exec_list *instructions, /* Check if this declaration is actually a re-declaration, either to * resize an array or add qualifiers to an existing variable. * - * This is allowed for variables in the current scope. + * This is allowed for variables in the current scope, or when at + * global scope (for built-ins in the implicit outer scope). */ ir_variable *earlier = state->symbols->get_variable(decl->identifier); - if (earlier != NULL - && state->symbols->name_declared_this_scope(decl->identifier)) { + if (earlier != NULL && (state->current_function == NULL || + state->symbols->name_declared_this_scope(decl->identifier))) { /* From page 24 (page 30 of the PDF) of the GLSL 1.50 spec, * @@ -2178,7 +2194,7 @@ ast_function::hir(exec_list *instructions, * that the previously seen signature does not have an associated definition. */ f = state->symbols->get_function(name, false); - if (f != NULL) { + if (f != NULL && !f->is_builtin) { sig = f->exact_matching_signature(&hir_parameters); if (sig != NULL) { const char *badvar = sig->qualifiers_match(&hir_parameters); -- cgit v1.2.3 From de3b40d8cdc42cc1cd71dd65c90d6d569d922fc6 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Thu, 26 Aug 2010 09:24:58 -0700 Subject: glsl2: Remove a couple FINISHME comments that have already been resolved --- src/glsl/ast_to_hir.cpp | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) (limited to 'src') diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp index 548b3d8e5a..e0a510cc45 100644 --- a/src/glsl/ast_to_hir.cpp +++ b/src/glsl/ast_to_hir.cpp @@ -510,7 +510,6 @@ do_assignment(exec_list *instructions, struct _mesa_glsl_parse_state *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; @@ -581,7 +580,6 @@ 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", ir_var_temporary); instructions->push_tail(var); @@ -1976,14 +1974,10 @@ ast_declarator_list::hir(exec_list *instructions, * 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). - */ + if (strncmp(decl->identifier, "gl_", 3) == 0) _mesa_glsl_error(& loc, state, "identifier `%s' uses reserved `gl_' prefix", decl->identifier); - } /* Add the variable to the symbol table. Note that the initializer's * IR was already processed earlier (though it hasn't been emitted yet), -- cgit v1.2.3 From b72c85df5567713293452db6b60c537cd913dcc1 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 26 Aug 2010 09:10:19 -0700 Subject: i965: Fix the test for variable indexing of shader inputs. Shader inputs appear in source registers, not dst registers. Catches unsupported shaders in glsl-fs-varying-array and Humus RaytracedShadows. --- src/mesa/drivers/dri/i965/brw_program.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_program.c b/src/mesa/drivers/dri/i965/brw_program.c index 1cdc8c6411..d5b7bee1b1 100644 --- a/src/mesa/drivers/dri/i965/brw_program.c +++ b/src/mesa/drivers/dri/i965/brw_program.c @@ -168,6 +168,9 @@ static GLboolean brwProgramStringNotify( GLcontext *ctx, * See piglit glsl-{vs,fs}-functions-[23] tests. */ for (i = 0; i < prog->NumInstructions; i++) { + struct prog_instruction *inst = prog->Instructions + i; + int r; + if (prog->Instructions[i].Opcode == OPCODE_CAL) { shader_error(ctx, prog, "i965 driver doesn't yet support uninlined function " @@ -183,12 +186,15 @@ static GLboolean brwProgramStringNotify( GLcontext *ctx, return GL_FALSE; } - if (prog->Instructions[i].DstReg.RelAddr && - prog->Instructions[i].DstReg.File == PROGRAM_INPUT) { - shader_error(ctx, prog, - "Variable indexing of shader inputs unsupported\n"); - return GL_FALSE; + for (r = 0; r < _mesa_num_inst_src_regs(inst->Opcode); r++) { + if (prog->Instructions[i].SrcReg[r].RelAddr && + prog->Instructions[i].SrcReg[r].File == PROGRAM_INPUT) { + shader_error(ctx, prog, + "Variable indexing of shader inputs unsupported\n"); + return GL_FALSE; + } } + if (prog->Instructions[i].DstReg.RelAddr && prog->Instructions[i].DstReg.File == PROGRAM_OUTPUT) { shader_error(ctx, prog, -- cgit v1.2.3 From 9629dbf4f2adc42bbc99f3c830be288a7b150f6a Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 26 Aug 2010 08:47:24 -0700 Subject: i965: Add support for destination RelAddr writes in the VS. Fixes: glsl-vs-varying-array --- src/mesa/drivers/dri/i965/brw_program.c | 5 +-- src/mesa/drivers/dri/i965/brw_vs_emit.c | 56 ++++++++++++++++++++++++++------- 2 files changed, 48 insertions(+), 13 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_program.c b/src/mesa/drivers/dri/i965/brw_program.c index d5b7bee1b1..7e7cd8e696 100644 --- a/src/mesa/drivers/dri/i965/brw_program.c +++ b/src/mesa/drivers/dri/i965/brw_program.c @@ -195,10 +195,11 @@ static GLboolean brwProgramStringNotify( GLcontext *ctx, } } - if (prog->Instructions[i].DstReg.RelAddr && + if (target == GL_FRAGMENT_PROGRAM_ARB && + prog->Instructions[i].DstReg.RelAddr && prog->Instructions[i].DstReg.File == PROGRAM_OUTPUT) { shader_error(ctx, prog, - "Variable indexing of shader outputs unsupported\n"); + "Variable indexing of FS outputs unsupported\n"); return GL_FALSE; } if (target == GL_FRAGMENT_PROGRAM_ARB) { diff --git a/src/mesa/drivers/dri/i965/brw_vs_emit.c b/src/mesa/drivers/dri/i965/brw_vs_emit.c index 2f4653fbda..700e5ab6f6 100644 --- a/src/mesa/drivers/dri/i965/brw_vs_emit.c +++ b/src/mesa/drivers/dri/i965/brw_vs_emit.c @@ -98,6 +98,23 @@ static void release_tmps( struct brw_vs_compile *c ) c->last_tmp = c->first_tmp; } +static int +get_first_reladdr_output(struct gl_vertex_program *vp) +{ + int i; + int first_reladdr_output = VERT_RESULT_MAX; + + for (i = 0; i < vp->Base.NumInstructions; i++) { + struct prog_instruction *inst = vp->Base.Instructions + i; + + if (inst->DstReg.File == PROGRAM_OUTPUT && + inst->DstReg.RelAddr && + inst->DstReg.Index < first_reladdr_output) + first_reladdr_output = inst->DstReg.Index; + } + + return first_reladdr_output; +} /** * Preallocate GRF register before code emit. @@ -109,6 +126,7 @@ static void brw_vs_alloc_regs( struct brw_vs_compile *c ) struct intel_context *intel = &c->func.brw->intel; GLuint i, reg = 0, mrf; int attributes_in_vue; + int first_reladdr_output; /* Determine whether to use a real constant buffer or use a block * of GRF registers for constants. The later is faster but only @@ -226,6 +244,7 @@ static void brw_vs_alloc_regs( struct brw_vs_compile *c ) else mrf = 4; + first_reladdr_output = get_first_reladdr_output(&c->vp->program); for (i = 0; i < VERT_RESULT_MAX; i++) { if (c->prog_data.outputs_written & BITFIELD64_BIT(i)) { c->nr_outputs++; @@ -254,15 +273,16 @@ static void brw_vs_alloc_regs( struct brw_vs_compile *c ) * For attributes beyond the compute-to-MRF, we compute to * GRFs and they will be written in the second URB_WRITE. */ - if (mrf < 15) { + if (first_reladdr_output > i && mrf < 15) { c->regs[PROGRAM_OUTPUT][i] = brw_message_reg(mrf); mrf++; } else { - if (!c->first_overflow_output) + if (mrf >= 15 && !c->first_overflow_output) c->first_overflow_output = i; c->regs[PROGRAM_OUTPUT][i] = brw_vec8_grf(reg, 0); reg++; + mrf++; } } } @@ -1028,13 +1048,11 @@ move_to_reladdr_dst(struct brw_vs_compile *c, int reg_size = 32; struct brw_reg addr_reg = c->regs[PROGRAM_ADDRESS][0]; struct brw_reg vp_address = retype(vec1(addr_reg), BRW_REGISTER_TYPE_D); - struct brw_reg temp_base = c->regs[inst->DstReg.File][0]; - GLuint byte_offset = temp_base.nr * 32 + temp_base.subnr; + struct brw_reg base = c->regs[inst->DstReg.File][inst->DstReg.Index]; + GLuint byte_offset = base.nr * 32 + base.subnr; struct brw_reg indirect = brw_vec4_indirect(0,0); struct brw_reg acc = retype(vec1(get_tmp(c)), BRW_REGISTER_TYPE_UW); - byte_offset += inst->DstReg.Index * reg_size; - brw_push_insn_state(p); brw_set_access_mode(p, BRW_ALIGN_1); @@ -1320,6 +1338,7 @@ static void emit_vertex_write( struct brw_vs_compile *c) struct brw_reg ndc; int eot; GLuint len_vertex_header = 2; + int next_mrf, i; if (c->key.copy_edgeflag) { brw_MOV(p, @@ -1438,6 +1457,23 @@ static void emit_vertex_write( struct brw_vs_compile *c) len_vertex_header = 2; } + /* Move variable-addressed, non-overflow outputs to their MRFs. */ + next_mrf = 2 + len_vertex_header; + for (i = 0; i < VERT_RESULT_MAX; i++) { + if (c->first_overflow_output > 0 && i >= c->first_overflow_output) + break; + if (!(c->prog_data.outputs_written & BITFIELD64_BIT(i))) + continue; + + if (i >= VERT_RESULT_TEX0 && + c->regs[PROGRAM_OUTPUT][i].file == BRW_GENERAL_REGISTER_FILE) { + brw_MOV(p, brw_message_reg(next_mrf), c->regs[PROGRAM_OUTPUT][i]); + next_mrf++; + } else if (c->regs[PROGRAM_OUTPUT][i].file == BRW_MESSAGE_REGISTER_FILE) { + next_mrf = c->regs[PROGRAM_OUTPUT][i].nr + 1; + } + } + eot = (c->first_overflow_output == 0); brw_urb_WRITE(p, @@ -1920,11 +1956,9 @@ void brw_vs_emit(struct brw_vs_compile *c ) } } - if (inst->DstReg.RelAddr && inst->DstReg.File == PROGRAM_TEMPORARY) { - /* We don't do RelAddr of PROGRAM_OUTPUT yet, because of the - * compute-to-mrf and the fact that we are allocating - * registers for only the used PROGRAM_OUTPUTs. - */ + if (inst->DstReg.RelAddr) { + assert(inst->DstReg.File == PROGRAM_TEMPORARY|| + inst->DstReg.File == PROGRAM_OUTPUT); move_to_reladdr_dst(c, inst, dst); } -- cgit v1.2.3 From 58087b8d2722c3a8d1cb09af6c7f8d6726f34f73 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Thu, 26 Aug 2010 18:19:57 +0100 Subject: scons: Add glsl_symbol_table.cpp --- src/glsl/SConscript | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/glsl/SConscript b/src/glsl/SConscript index 96a226d0dd..a808a5bc5d 100644 --- a/src/glsl/SConscript +++ b/src/glsl/SConscript @@ -25,6 +25,7 @@ sources = [ 'glsl_parser.cpp', 'glsl_parser_extras.cpp', 'glsl_types.cpp', + 'glsl_symbol_table.cpp', 'hir_field_selection.cpp', 'ir_algebraic.cpp', 'ir_basic_block.cpp', -- cgit v1.2.3 From 64b5a81e19477f26a9aebf865394e3974e7be3b3 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Thu, 26 Aug 2010 18:28:29 +0100 Subject: scons: Fix inverted logic. --- src/talloc/SConscript | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/talloc/SConscript b/src/talloc/SConscript index a4861a932e..3bf7029bb2 100644 --- a/src/talloc/SConscript +++ b/src/talloc/SConscript @@ -12,7 +12,7 @@ talloc = env.SharedLibrary( env.InstallSharedLibrary(talloc) -if env['platform'] != 'windows': +if env['platform'] == 'windows': talloc = env.FindIxes(talloc, 'LIBPREFIX', 'LIBSUFFIX') else: talloc = env.FindIxes(talloc, 'SHLIBPREFIX', 'SHLIBSUFFIX') -- cgit v1.2.3 From 9b4384c32233c6d75021bcc67552b7ea9dc56de6 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Thu, 26 Aug 2010 10:38:28 -0700 Subject: st/mesa: Remove unnecessary header. --- src/mesa/state_tracker/st_format.c | 1 - 1 file changed, 1 deletion(-) (limited to 'src') diff --git a/src/mesa/state_tracker/st_format.c b/src/mesa/state_tracker/st_format.c index 86a471f195..1ed79524b2 100644 --- a/src/mesa/state_tracker/st_format.c +++ b/src/mesa/state_tracker/st_format.c @@ -35,7 +35,6 @@ #include "main/imports.h" #include "main/context.h" #include "main/texstore.h" -#include "main/enums.h" #include "main/image.h" #include "main/macros.h" -- cgit v1.2.3 From 2db7bb9c665d13fd067109b1171eedd92764791d Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 26 Aug 2010 10:42:47 -0700 Subject: glsl: Add a quick hack to constant folding to reduce duplicated work. Reduces runtime of glsl-max-varyings 92% on my system. --- src/glsl/ir_constant_folding.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src') diff --git a/src/glsl/ir_constant_folding.cpp b/src/glsl/ir_constant_folding.cpp index 3e6934c9a7..554c54fae3 100644 --- a/src/glsl/ir_constant_folding.cpp +++ b/src/glsl/ir_constant_folding.cpp @@ -62,6 +62,19 @@ ir_constant_folding_visitor::handle_rvalue(ir_rvalue **rvalue) if (*rvalue == NULL || (*rvalue)->ir_type == ir_type_constant) return; + /* Note that we do rvalue visitoring on leaving. So if an + * expression has a non-constant operand, no need to go looking + * down it to find if it's constant. This cuts the time of this + * pass down drastically. + */ + ir_expression *expr = (*rvalue)->as_expression(); + if (expr) { + for (unsigned int i = 0; i < expr->get_num_operands(); i++) { + if (!expr->operands[i]->as_constant()) + return; + } + } + ir_constant *constant = (*rvalue)->constant_expression_value(); if (constant) { *rvalue = constant; -- cgit v1.2.3 From 264ba1ab88f273dc92add8018f24edcdd67fa5e5 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 26 Aug 2010 11:23:09 -0700 Subject: ir_to_mesa: Don't assume that an ir_dereference_array is of a variable. Fixes: glsl-array-bounds-02 (software) glsl-array-bounds-04 glsl-array-bounds-06 (software) glsl-array-bounds-08 --- src/mesa/program/ir_to_mesa.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp index 7fb5974946..948f09a851 100644 --- a/src/mesa/program/ir_to_mesa.cpp +++ b/src/mesa/program/ir_to_mesa.cpp @@ -1382,7 +1382,8 @@ ir_to_mesa_visitor::visit(ir_dereference_array *ir) return; } - if (strncmp(var->name, "gl_", 3) == 0 && var->mode == ir_var_uniform && + if (var && + strncmp(var->name, "gl_", 3) == 0 && var->mode == ir_var_uniform && !var->type->is_matrix()) { ir_dereference_record *record = NULL; if (ir->array->ir_type == ir_type_dereference_record) -- cgit v1.2.3 From 98ccee9ea6bd5841784d006fb7cdbbc34895f18b Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Thu, 26 Aug 2010 06:52:12 +0100 Subject: graw: Add copyright headers to the interfaces. --- src/gallium/include/state_tracker/graw.h | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'src') diff --git a/src/gallium/include/state_tracker/graw.h b/src/gallium/include/state_tracker/graw.h index 59b0e337c9..5eaa323085 100644 --- a/src/gallium/include/state_tracker/graw.h +++ b/src/gallium/include/state_tracker/graw.h @@ -1,3 +1,30 @@ +/************************************************************************** + * + * Copyright 2010 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, 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 VMWARE AND/OR ITS 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. + * + **************************************************************************/ + #ifndef GALLIUM_RAW_H #define GALLIUM_RAW_H -- cgit v1.2.3 From 4418a493c2466e734e1ca5ace51535d1dbcf8a46 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 26 Aug 2010 11:45:25 -0600 Subject: llvmpipe: fix PIPE_CAP_MAX_VERTEX_TEXTURE_UNITS query Fixes crashes in glean glsl1 and demos/src/glsl/vert-tex. See comments for details. --- src/gallium/drivers/llvmpipe/lp_screen.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/drivers/llvmpipe/lp_screen.c b/src/gallium/drivers/llvmpipe/lp_screen.c index 9b7e0d51cd..1e65a91fc6 100644 --- a/src/gallium/drivers/llvmpipe/lp_screen.c +++ b/src/gallium/drivers/llvmpipe/lp_screen.c @@ -89,7 +89,14 @@ llvmpipe_get_param(struct pipe_screen *screen, enum pipe_cap param) case PIPE_CAP_MAX_TEXTURE_IMAGE_UNITS: return PIPE_MAX_SAMPLERS; case PIPE_CAP_MAX_VERTEX_TEXTURE_UNITS: - return PIPE_MAX_VERTEX_SAMPLERS; + /* At this time, the draw module and llvmpipe driver only + * support vertex shader texture lookups when LLVM is enabled in + * the draw module. + */ + if (debug_get_bool_option("DRAW_USE_LLVM", TRUE)) + return PIPE_MAX_VERTEX_SAMPLERS; + else + return 0; case PIPE_CAP_MAX_COMBINED_SAMPLERS: return PIPE_MAX_SAMPLERS + PIPE_MAX_VERTEX_SAMPLERS; case PIPE_CAP_NPOT_TEXTURES: -- cgit v1.2.3 From a1bebf73dfdaf2cd23286aa74271b87166589901 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 10 Aug 2010 20:39:06 -0700 Subject: i965: Start building 965 FS backend. --- src/mesa/drivers/dri/Makefile.template | 5 ++ src/mesa/drivers/dri/i965/Makefile | 3 ++ src/mesa/drivers/dri/i965/brw_context.h | 10 ++++ src/mesa/drivers/dri/i965/brw_fs.cpp | 82 +++++++++++++++++++++++++++++++++ src/mesa/drivers/dri/i965/brw_program.c | 3 ++ src/mesa/drivers/dri/i965/brw_wm.h | 6 +++ src/mesa/main/shaderobj.c | 32 ++++++++----- src/mesa/main/shaderobj.h | 5 ++ 8 files changed, 135 insertions(+), 11 deletions(-) create mode 100644 src/mesa/drivers/dri/i965/brw_fs.cpp (limited to 'src') diff --git a/src/mesa/drivers/dri/Makefile.template b/src/mesa/drivers/dri/Makefile.template index 35daacfacd..a00018cafa 100644 --- a/src/mesa/drivers/dri/Makefile.template +++ b/src/mesa/drivers/dri/Makefile.template @@ -17,6 +17,7 @@ COMMON_SOURCES = $(COMMON_GALLIUM_SOURCES) \ INCLUDES = $(SHARED_INCLUDES) $(EXPAT_INCLUDES) OBJECTS = $(C_SOURCES:.c=.o) \ + $(CXX_SOURCES:.cpp=.o) \ $(ASM_SOURCES:.S=.o) @@ -33,12 +34,16 @@ SHARED_INCLUDES = \ $(LIBDRM_CFLAGS) CFLAGS += $(API_DEFINES) +CXXFLAGS += $(API_DEFINES) ##### RULES ##### .c.o: $(CC) -c $(INCLUDES) $(CFLAGS) $(DRIVER_DEFINES) $< -o $@ +.cpp.o: + $(CC) -c $(INCLUDES) $(CXXFLAGS) $(DRIVER_DEFINES) $< -o $@ + .S.o: $(CC) -c $(INCLUDES) $(CFLAGS) $(DRIVER_DEFINES) $< -o $@ diff --git a/src/mesa/drivers/dri/i965/Makefile b/src/mesa/drivers/dri/i965/Makefile index e381a5c714..bc4cfab5c0 100644 --- a/src/mesa/drivers/dri/i965/Makefile +++ b/src/mesa/drivers/dri/i965/Makefile @@ -104,6 +104,9 @@ C_SOURCES = \ $(COMMON_SOURCES) \ $(DRIVER_SOURCES) +CXX_SOURCES = \ + brw_fs.cpp + ASM_SOURCES = DRIVER_DEFINES = -I../intel diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h index 68fc8debc6..3728a7a122 100644 --- a/src/mesa/drivers/dri/i965/brw_context.h +++ b/src/mesa/drivers/dri/i965/brw_context.h @@ -179,6 +179,16 @@ struct brw_fragment_program { GLbitfield tex_units_used; }; +struct brw_shader { + struct gl_shader base; + + /** Shader IR transformed for native compile, at link time. */ + struct exec_list *ir; +}; + +struct brw_shader_program { + struct gl_shader_program base; +}; /* Data about a particular attempt to compile a program. Note that * there can be many of these, each in a different GL state diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp new file mode 100644 index 0000000000..9509d93236 --- /dev/null +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -0,0 +1,82 @@ +/* + * 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. + * + * Authors: + * Eric Anholt + * + */ + +extern "C" { +#include "main/macros.h" +#include "main/shaderobj.h" +#include "program/prog_parameter.h" +#include "program/prog_print.h" +#include "program/prog_optimize.h" +#include "brw_context.h" +#include "brw_eu.h" +#include "brw_wm.h" +#include "talloc.h" +} + +struct gl_shader * +brw_new_shader(GLcontext *ctx, GLuint name, GLuint type) +{ + struct brw_shader *shader; + + shader = talloc_zero(NULL, struct brw_shader); + shader->base.Type = type; + shader->base.Name = name; + if (shader) { + _mesa_init_shader(ctx, &shader->base); + } + + return &shader->base; +} + +struct gl_shader_program * +brw_new_shader_program(GLcontext *ctx, GLuint name) +{ + struct brw_shader_program *prog; + prog = talloc_zero(NULL, struct brw_shader_program); + if (prog) { + _mesa_init_shader_program(ctx, &prog->base); + } + return &prog->base; +} + +GLboolean +brw_compile_shader(GLcontext *ctx, struct gl_shader *shader) +{ + if (!_mesa_ir_compile_shader(ctx, shader)) + return GL_FALSE; + + return GL_TRUE; +} + +GLboolean +brw_link_shader(GLcontext *ctx, struct gl_shader_program *prog) +{ + if (!_mesa_ir_link_shader(ctx, prog)) + return GL_FALSE; + + return GL_TRUE; +} diff --git a/src/mesa/drivers/dri/i965/brw_program.c b/src/mesa/drivers/dri/i965/brw_program.c index 7e7cd8e696..b6cf6c000e 100644 --- a/src/mesa/drivers/dri/i965/brw_program.c +++ b/src/mesa/drivers/dri/i965/brw_program.c @@ -231,5 +231,8 @@ void brwInitFragProgFuncs( struct dd_function_table *functions ) functions->DeleteProgram = brwDeleteProgram; functions->IsProgramNative = brwIsProgramNative; functions->ProgramStringNotify = brwProgramStringNotify; + + functions->CompileShader = brw_compile_shader; + functions->LinkShader = brw_link_shader; } diff --git a/src/mesa/drivers/dri/i965/brw_wm.h b/src/mesa/drivers/dri/i965/brw_wm.h index 34f2d0c3d0..25a72f5dda 100644 --- a/src/mesa/drivers/dri/i965/brw_wm.h +++ b/src/mesa/drivers/dri/i965/brw_wm.h @@ -459,4 +459,10 @@ void emit_xpd(struct brw_compile *p, const struct brw_reg *arg0, const struct brw_reg *arg1); +GLboolean brw_compile_shader(GLcontext *ctx, + struct gl_shader *shader); +GLboolean brw_link_shader(GLcontext *ctx, struct gl_shader_program *prog); +struct gl_shader *brw_new_shader(GLcontext *ctx, GLuint name, GLuint type); +struct gl_shader_program *brw_new_shader_program(GLcontext *ctx, GLuint name); + #endif diff --git a/src/mesa/main/shaderobj.c b/src/mesa/main/shaderobj.c index 1755e8a33c..bcf7d313f9 100644 --- a/src/mesa/main/shaderobj.c +++ b/src/mesa/main/shaderobj.c @@ -87,6 +87,11 @@ _mesa_reference_shader(GLcontext *ctx, struct gl_shader **ptr, } } +void +_mesa_init_shader(GLcontext *ctx, struct gl_shader *shader) +{ + shader->RefCount = 1; +} /** * Allocate a new gl_shader object, initialize it. @@ -99,10 +104,10 @@ _mesa_new_shader(GLcontext *ctx, GLuint name, GLenum type) assert(type == GL_FRAGMENT_SHADER || type == GL_VERTEX_SHADER || type == GL_GEOMETRY_SHADER_ARB); shader = talloc_zero(NULL, struct gl_shader); + shader->Type = type; + shader->Name = name; if (shader) { - shader->Type = type; - shader->Name = name; - shader->RefCount = 1; + _mesa_init_shader(ctx, shader); } return shader; } @@ -224,6 +229,18 @@ _mesa_reference_shader_program(GLcontext *ctx, } } +void +_mesa_init_shader_program(GLcontext *ctx, struct gl_shader_program *prog) +{ + prog->Type = GL_SHADER_PROGRAM_MESA; + prog->RefCount = 1; + prog->Attributes = _mesa_new_parameter_list(); +#if FEATURE_ARB_geometry_shader4 + prog->Geom.VerticesOut = 0; + prog->Geom.InputType = GL_TRIANGLES; + prog->Geom.OutputType = GL_TRIANGLE_STRIP; +#endif +} /** * Allocate a new gl_shader_program object, initialize it. @@ -235,15 +252,8 @@ _mesa_new_shader_program(GLcontext *ctx, GLuint name) struct gl_shader_program *shProg; shProg = talloc_zero(NULL, struct gl_shader_program); if (shProg) { - shProg->Type = GL_SHADER_PROGRAM_MESA; shProg->Name = name; - shProg->RefCount = 1; - shProg->Attributes = _mesa_new_parameter_list(); -#if FEATURE_ARB_geometry_shader4 - shProg->Geom.VerticesOut = 0; - shProg->Geom.InputType = GL_TRIANGLES; - shProg->Geom.OutputType = GL_TRIANGLE_STRIP; -#endif + _mesa_init_shader_program(ctx, shProg); } return shProg; } diff --git a/src/mesa/main/shaderobj.h b/src/mesa/main/shaderobj.h index 1b96316b67..4800046375 100644 --- a/src/mesa/main/shaderobj.h +++ b/src/mesa/main/shaderobj.h @@ -61,10 +61,15 @@ extern void _mesa_reference_shader_program(GLcontext *ctx, struct gl_shader_program **ptr, struct gl_shader_program *shProg); +extern void +_mesa_init_shader(GLcontext *ctx, struct gl_shader *shader); extern struct gl_shader * _mesa_new_shader(GLcontext *ctx, GLuint name, GLenum type); +extern void +_mesa_init_shader_program(GLcontext *ctx, struct gl_shader_program *prog); + extern struct gl_shader_program * _mesa_lookup_shader_program(GLcontext *ctx, GLuint name); -- cgit v1.2.3 From 3a8ad33dde2f059b82ebf09f5cffa66c86f2e734 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Fri, 13 Aug 2010 02:20:40 -0700 Subject: i965: Add a pass for the FS to reduce vector expressions down to scalar. This is a step towards implementing a GLSL IR backend for the 965 fragment shader. Because it has downsides with the current codegen, it is hidden under the environment variable INTEL_NEW_FS. This results in an increase in instruction count at the moment (1444 -> 1752 for glsl-fs-raytrace, 345 -> 359 on my demo), because dot products are turned into a series of multiplies and adds instead of a custom expansion of MULs and MACs, and by not splitting the variable types up we don't get tree grafting and thus there are extra moves of temporary storage. However, register count drops for the non-GLSL path (64 -> 56 on my demo shader) because the register allocator sees all the sub-operations. --- src/mesa/drivers/dri/i965/Makefile | 3 +- src/mesa/drivers/dri/i965/brw_fs.cpp | 15 + .../dri/i965/brw_fs_channel_expressions.cpp | 365 +++++++++++++++++++++ src/mesa/drivers/dri/i965/brw_wm.h | 2 + 4 files changed, 384 insertions(+), 1 deletion(-) create mode 100644 src/mesa/drivers/dri/i965/brw_fs_channel_expressions.cpp (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/Makefile b/src/mesa/drivers/dri/i965/Makefile index bc4cfab5c0..39acae9e43 100644 --- a/src/mesa/drivers/dri/i965/Makefile +++ b/src/mesa/drivers/dri/i965/Makefile @@ -105,7 +105,8 @@ C_SOURCES = \ $(DRIVER_SOURCES) CXX_SOURCES = \ - brw_fs.cpp + brw_fs.cpp \ + brw_fs_channel_expressions.cpp ASM_SOURCES = diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp index 9509d93236..d16e75a2ca 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -36,6 +36,7 @@ extern "C" { #include "brw_wm.h" #include "talloc.h" } +#include "../glsl/ir_optimization.h" struct gl_shader * brw_new_shader(GLcontext *ctx, GLuint name, GLuint type) @@ -75,6 +76,20 @@ brw_compile_shader(GLcontext *ctx, struct gl_shader *shader) GLboolean brw_link_shader(GLcontext *ctx, struct gl_shader_program *prog) { + static int using_new_fs = -1; + + if (using_new_fs == -1) + using_new_fs = getenv("INTEL_NEW_FS") != NULL; + + for (unsigned i = 0; i < prog->_NumLinkedShaders; i++) { + struct gl_shader *shader = prog->_LinkedShaders[i]; + + if (using_new_fs && shader->Type == GL_FRAGMENT_SHADER) { + do_mat_op_to_vec(shader->ir); + brw_do_channel_expressions(shader->ir); + } + } + if (!_mesa_ir_link_shader(ctx, prog)) return GL_FALSE; diff --git a/src/mesa/drivers/dri/i965/brw_fs_channel_expressions.cpp b/src/mesa/drivers/dri/i965/brw_fs_channel_expressions.cpp new file mode 100644 index 0000000000..d8d58a9467 --- /dev/null +++ b/src/mesa/drivers/dri/i965/brw_fs_channel_expressions.cpp @@ -0,0 +1,365 @@ +/* + * 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 brw_wm_channel_expressions.cpp + * + * Breaks vector operations down into operations on each component. + * + * The 965 fragment shader receives 8 or 16 pixels at a time, so each + * channel of a vector is laid out as 1 or 2 8-float registers. Each + * ALU operation operates on one of those channel registers. As a + * result, there is no value to the 965 fragment shader in tracking + * "vector" expressions in the sense of GLSL fragment shaders, when + * doing a channel at a time may help in constant folding, algebraic + * simplification, and reducing the liveness of channel registers. + * + * The exception to the desire to break everything down to floats is + * texturing. The texture sampler returns a writemasked masked + * 4/8-register sequence containing the texture values. We don't want + * to dispatch to the sampler separately for each channel we need, so + * we do retain the vector types in that case. + */ + +extern "C" { +#include "main/core.h" +#include "brw_wm.h" +} +#include "../glsl/ir.h" +#include "../glsl/ir_expression_flattening.h" +#include "../glsl/glsl_types.h" + +class ir_channel_expressions_visitor : public ir_hierarchical_visitor { +public: + ir_channel_expressions_visitor() + { + this->progress = false; + this->mem_ctx = NULL; + } + + ir_visitor_status visit_leave(ir_assignment *); + + ir_rvalue *get_element(ir_variable *var, unsigned int element); + void assign(ir_assignment *ir, int elem, ir_rvalue *val); + + bool progress; + void *mem_ctx; +}; + +static bool +channel_expressions_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_vector()) + return true; + } + + return false; +} + +extern "C" { +GLboolean +brw_do_channel_expressions(exec_list *instructions) +{ + ir_channel_expressions_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, channel_expressions_predicate); + + visit_list_elements(&v, instructions); + + return v.progress; +} +} + +ir_rvalue * +ir_channel_expressions_visitor::get_element(ir_variable *var, unsigned int elem) +{ + ir_dereference *deref; + + if (var->type->is_scalar()) + return new(mem_ctx) ir_dereference_variable(var); + + assert(elem < var->type->components()); + deref = new(mem_ctx) ir_dereference_variable(var); + return new(mem_ctx) ir_swizzle(deref, elem, 0, 0, 0, 1); +} + +void +ir_channel_expressions_visitor::assign(ir_assignment *ir, int elem, ir_rvalue *val) +{ + ir_dereference *lhs = ir->lhs->clone(mem_ctx, NULL); + ir_assignment *assign; + ir_swizzle *val_swiz; + + /* This assign-of-expression should have been generated by the + * expression flattening visitor (since we never short circit to + * not flatten, even for plain assignments of variables), so the + * writemask is always full. + */ + assert(ir->write_mask == (1 << ir->lhs->type->components()) - 1); + + /* Smear the float across all the channels for the masked write. */ + val_swiz = new(mem_ctx) ir_swizzle(val, 0, 0, 0, 0, + ir->lhs->type->components()); + assign = new(mem_ctx) ir_assignment(lhs, val_swiz, NULL, (1 << elem)); + ir->insert_before(assign); +} + +ir_visitor_status +ir_channel_expressions_visitor::visit_leave(ir_assignment *ir) +{ + ir_expression *expr = ir->rhs->as_expression(); + bool found_vector = false; + unsigned int i, vector_elements = 1; + ir_variable *op_var[2]; + + if (!expr) + return visit_continue; + + if (!this->mem_ctx) + this->mem_ctx = talloc_parent(ir); + + for (i = 0; i < expr->get_num_operands(); i++) { + if (expr->operands[i]->type->is_vector()) { + found_vector = true; + vector_elements = expr->operands[i]->type->vector_elements; + break; + } + } + if (!found_vector) + return visit_continue; + + /* 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; + ir_dereference *deref; + + assert(!expr->operands[i]->type->is_matrix()); + + op_var[i] = new(mem_ctx) ir_variable(expr->operands[i]->type, + "channel_expressions", + ir_var_temporary); + ir->insert_before(op_var[i]); + + deref = new(mem_ctx) ir_dereference_variable(op_var[i]); + assign = new(mem_ctx) ir_assignment(deref, + expr->operands[i], + NULL); + ir->insert_before(assign); + } + + const glsl_type *element_type = glsl_type::get_instance(ir->lhs->type->base_type, + 1, 1); + + /* OK, time to break down this vector operation. */ + switch (expr->operation) { + case ir_unop_bit_not: + case ir_unop_logic_not: + 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: + case ir_unop_f2i: + case ir_unop_i2f: + case ir_unop_f2b: + case ir_unop_b2f: + case ir_unop_i2b: + case ir_unop_b2i: + case ir_unop_u2f: + 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: + for (i = 0; i < vector_elements; i++) { + ir_rvalue *op0 = get_element(op_var[0], i); + + assign(ir, i, new(mem_ctx) ir_expression(expr->operation, + element_type, + op0, + NULL)); + } + 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: + case ir_binop_lshift: + case ir_binop_rshift: + case ir_binop_bit_and: + case ir_binop_bit_xor: + case ir_binop_bit_or: + for (i = 0; i < vector_elements; i++) { + ir_rvalue *op0 = get_element(op_var[0], i); + ir_rvalue *op1 = get_element(op_var[1], i); + + assign(ir, i, new(mem_ctx) ir_expression(expr->operation, + element_type, + op0, + op1)); + } + break; + + case ir_unop_any: { + ir_expression *temp; + temp = new(mem_ctx) ir_expression(ir_binop_logic_or, + element_type, + get_element(op_var[0], 0), + get_element(op_var[0], 1)); + + for (i = 2; i < vector_elements; i++) { + temp = new(mem_ctx) ir_expression(ir_binop_logic_or, + element_type, + get_element(op_var[0], i), + temp); + } + assign(ir, 0, temp); + break; + } + + case ir_binop_dot: { + ir_expression *last = NULL; + for (i = 0; i < vector_elements; i++) { + ir_rvalue *op0 = get_element(op_var[0], i); + ir_rvalue *op1 = get_element(op_var[1], i); + ir_expression *temp; + + temp = new(mem_ctx) ir_expression(ir_binop_mul, + element_type, + op0, + op1); + if (last) { + last = new(mem_ctx) ir_expression(ir_binop_add, + element_type, + temp, + last); + } else { + last = temp; + } + } + assign(ir, 0, last); + break; + } + + case ir_binop_cross: { + for (i = 0; i < vector_elements; i++) { + int swiz0 = (i + 1) % 3; + int swiz1 = (i + 2) % 3; + ir_expression *temp1, *temp2; + + temp1 = new(mem_ctx) ir_expression(ir_binop_mul, + element_type, + get_element(op_var[0], swiz0), + get_element(op_var[1], swiz1)); + + temp2 = new(mem_ctx) ir_expression(ir_binop_mul, + element_type, + get_element(op_var[1], swiz0), + get_element(op_var[0], swiz1)); + + temp2 = new(mem_ctx) ir_expression(ir_unop_neg, + element_type, + temp2, + NULL); + + assign(ir, i, new(mem_ctx) ir_expression(ir_binop_add, + element_type, + temp1, temp2)); + } + break; + } + + case ir_binop_less: + case ir_binop_greater: + case ir_binop_lequal: + case ir_binop_gequal: + case ir_binop_logic_and: + case ir_binop_logic_xor: + case ir_binop_logic_or: + ir->print(); + printf("\n"); + assert(!"not reached: expression operates on scalars only"); + break; + case ir_binop_equal: + case ir_binop_nequal: { + ir_expression *last = NULL; + for (i = 0; i < vector_elements; i++) { + ir_rvalue *op0 = get_element(op_var[0], i); + ir_rvalue *op1 = get_element(op_var[1], i); + ir_expression *temp; + ir_expression_operation join; + + if (expr->operation == ir_binop_equal) + join = ir_binop_logic_and; + else + join = ir_binop_logic_or; + + temp = new(mem_ctx) ir_expression(expr->operation, + element_type, + op0, + op1); + if (last) { + last = new(mem_ctx) ir_expression(join, + element_type, + temp, + last); + } else { + last = temp; + } + } + assign(ir, 0, last); + break; + } + } + + ir->remove(); + this->progress = true; + + return visit_continue; +} diff --git a/src/mesa/drivers/dri/i965/brw_wm.h b/src/mesa/drivers/dri/i965/brw_wm.h index 25a72f5dda..438da1af62 100644 --- a/src/mesa/drivers/dri/i965/brw_wm.h +++ b/src/mesa/drivers/dri/i965/brw_wm.h @@ -465,4 +465,6 @@ GLboolean brw_link_shader(GLcontext *ctx, struct gl_shader_program *prog); struct gl_shader *brw_new_shader(GLcontext *ctx, GLuint name, GLuint type); struct gl_shader_program *brw_new_shader_program(GLcontext *ctx, GLuint name); +GLboolean brw_do_channel_expressions(struct exec_list *instructions); + #endif -- cgit v1.2.3 From c1dfdcb93a8991788032d4906c5bf1a5b48cdc48 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 26 Aug 2010 12:02:26 -0700 Subject: i965: Add new pass to split vectors into scalar variables Combined with the previous pass, this lets other optimization passes do their work thanks to ir_tree_grafting. Still have regression in instruction count with INTEL_NEW_FS, but register count is even better. --- src/mesa/drivers/dri/i965/Makefile | 3 +- src/mesa/drivers/dri/i965/brw_fs.cpp | 2 + .../drivers/dri/i965/brw_fs_vector_splitting.cpp | 388 +++++++++++++++++++++ src/mesa/drivers/dri/i965/brw_wm.h | 1 + 4 files changed, 393 insertions(+), 1 deletion(-) create mode 100644 src/mesa/drivers/dri/i965/brw_fs_vector_splitting.cpp (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/Makefile b/src/mesa/drivers/dri/i965/Makefile index 39acae9e43..bea48e1313 100644 --- a/src/mesa/drivers/dri/i965/Makefile +++ b/src/mesa/drivers/dri/i965/Makefile @@ -106,7 +106,8 @@ C_SOURCES = \ CXX_SOURCES = \ brw_fs.cpp \ - brw_fs_channel_expressions.cpp + brw_fs_channel_expressions.cpp \ + brw_fs_vector_splitting.cpp ASM_SOURCES = diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp index d16e75a2ca..9a6ee7a010 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -37,6 +37,7 @@ extern "C" { #include "talloc.h" } #include "../glsl/ir_optimization.h" +#include "../glsl/ir_print_visitor.h" struct gl_shader * brw_new_shader(GLcontext *ctx, GLuint name, GLuint type) @@ -87,6 +88,7 @@ brw_link_shader(GLcontext *ctx, struct gl_shader_program *prog) if (using_new_fs && shader->Type == GL_FRAGMENT_SHADER) { do_mat_op_to_vec(shader->ir); brw_do_channel_expressions(shader->ir); + brw_do_vector_splitting(shader->ir); } } diff --git a/src/mesa/drivers/dri/i965/brw_fs_vector_splitting.cpp b/src/mesa/drivers/dri/i965/brw_fs_vector_splitting.cpp new file mode 100644 index 0000000000..d4da86b3b0 --- /dev/null +++ b/src/mesa/drivers/dri/i965/brw_fs_vector_splitting.cpp @@ -0,0 +1,388 @@ +/* + * 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 brw_wm_vector_splitting.cpp + * + * If a vector 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 vectors in uniforms and varyings, which need to be + * accessible as vectors for their access by the GL. Also, vector + * results of non-variable-derefs in assignments aren't handled + * because to do so we would have to store the vector result to a + * temporary in order to unload each channel, and to do so would just + * loop us back to where we started. For the 965, this is exactly the + * behavior we want for the results of texture lookups, but probably not for + */ + +extern "C" { +#include "main/core.h" +#include "intel_context.h" +} +#include "../glsl/ir.h" +#include "../glsl/ir_visitor.h" +#include "../glsl/ir_print_visitor.h" +#include "../glsl/ir_rvalue_visitor.h" +#include "../glsl/glsl_types.h" + +static bool debug = false; + +class variable_entry : public exec_node +{ +public: + variable_entry(ir_variable *var) + { + this->var = var; + this->whole_vector_access = 0; + this->declaration = false; + this->mem_ctx = NULL; + } + + ir_variable *var; /* The key: the variable's pointer. */ + + /** Number of times the variable is referenced, including assignments. */ + unsigned whole_vector_access; + + bool declaration; /* If the variable had a decl in the instruction stream */ + + ir_variable *components[4]; + + /** talloc_parent(this->var) -- the shader's talloc context. */ + void *mem_ctx; +}; + +class ir_vector_reference_visitor : public ir_hierarchical_visitor { +public: + ir_vector_reference_visitor(void) + { + this->mem_ctx = talloc_new(NULL); + this->variable_list.make_empty(); + } + + ~ir_vector_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_enter(ir_swizzle *); + 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); + + /* List of variable_entry */ + exec_list variable_list; + + void *mem_ctx; +}; + +variable_entry * +ir_vector_reference_visitor::get_variable_entry(ir_variable *var) +{ + assert(var); + + if (!var->type->is_vector()) + return NULL; + + switch (var->mode) { + case ir_var_uniform: + case ir_var_in: + case ir_var_out: + case ir_var_inout: + /* Can't split varyings or uniforms. Function in/outs won't get split + * either, so don't care about the ambiguity. + */ + return NULL; + case ir_var_auto: + case ir_var_temporary: + break; + } + + 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_vector_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_vector_reference_visitor::visit(ir_dereference_variable *ir) +{ + ir_variable *const var = ir->var; + variable_entry *entry = this->get_variable_entry(var); + + if (entry) + entry->whole_vector_access++; + + return visit_continue; +} + +ir_visitor_status +ir_vector_reference_visitor::visit_enter(ir_swizzle *ir) +{ + /* Don't descend into a vector ir_dereference_variable below. */ + if (ir->val->as_dereference_variable() && ir->type->is_scalar()) + return visit_continue_with_parent; + + return visit_continue; +} + +ir_visitor_status +ir_vector_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 vector to copies of channels, so don't + * descend to the ir_dereference_variables. + */ + return visit_continue_with_parent; + } + if (ir->lhs->as_dereference_variable() && + is_power_of_two(ir->write_mask) && + !ir->condition) { + /* If we're writing just a channel, then channel-splitting the LHS is OK. + */ + ir->rhs->accept(this); + return visit_continue_with_parent; + } + return visit_continue; +} + +ir_visitor_status +ir_vector_reference_visitor::visit_enter(ir_function_signature *ir) +{ + /* We don't want to descend into the function parameters and + * split them, so just accept the body here. + */ + visit_list_elements(this, &ir->body); + return visit_continue_with_parent; +} + +class ir_vector_splitting_visitor : public ir_rvalue_visitor { +public: + ir_vector_splitting_visitor(exec_list *vars) + { + this->variable_list = vars; + } + + virtual ir_visitor_status visit_leave(ir_assignment *); + + void handle_rvalue(ir_rvalue **rvalue); + struct variable_entry *get_splitting_entry(ir_variable *var); + + exec_list *variable_list; + void *mem_ctx; +}; + +struct variable_entry * +ir_vector_splitting_visitor::get_splitting_entry(ir_variable *var) +{ + assert(var); + + if (!var->type->is_vector()) + 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_vector_splitting_visitor::handle_rvalue(ir_rvalue **rvalue) +{ + if (!*rvalue) + return; + + ir_swizzle *swiz = (*rvalue)->as_swizzle(); + if (!swiz || !swiz->type->is_scalar()) + return; + + ir_dereference_variable *deref_var = swiz->val->as_dereference_variable(); + if (!deref_var) + return; + + variable_entry *entry = get_splitting_entry(deref_var->var); + if (!entry) + return; + + ir_variable *var = entry->components[swiz->mask.x]; + *rvalue = new(entry->mem_ctx) ir_dereference_variable(var); +} + +ir_visitor_status +ir_vector_splitting_visitor::visit_leave(ir_assignment *ir) +{ + ir_dereference_variable *lhs_deref = ir->lhs->as_dereference_variable(); + ir_dereference_variable *rhs_deref = ir->rhs->as_dereference_variable(); + variable_entry *lhs = lhs_deref ? get_splitting_entry(lhs_deref->var) : NULL; + variable_entry *rhs = rhs_deref ? get_splitting_entry(rhs_deref->var) : NULL; + + if (lhs_deref && rhs_deref && (lhs || rhs) && !ir->condition) { + /* Straight assignment of vector variables. */ + for (unsigned int i = 0; i < ir->rhs->type->vector_elements; i++) { + ir_dereference *new_lhs; + ir_rvalue *new_rhs; + void *mem_ctx = lhs ? lhs->mem_ctx : rhs->mem_ctx; + unsigned int writemask; + + if (lhs) { + new_lhs = new(mem_ctx) ir_dereference_variable(lhs->components[i]); + writemask = (ir->write_mask >> i) & 1; + } else { + new_lhs = ir->lhs->clone(mem_ctx, NULL); + writemask = ir->write_mask & (1 << i); + } + + if (rhs) { + new_rhs = new(mem_ctx) ir_dereference_variable(rhs->components[i]); + } else { + new_rhs = new(mem_ctx) ir_swizzle(ir->rhs->clone(mem_ctx, NULL), + i, i, i, i, 1); + } + + ir->insert_before(new(mem_ctx) ir_assignment(new_lhs, + new_rhs, + NULL, writemask)); + } + ir->remove(); + } else if (lhs) { + int elem = -1; + + switch (ir->write_mask) { + case (1 << 0): + elem = 0; + break; + case (1 << 1): + elem = 1; + break; + case (1 << 2): + elem = 2; + break; + case (1 << 3): + elem = 3; + break; + default: + ir->print(); + assert(!"not reached: non-channelwise dereference of LHS."); + } + + ir->lhs = new(mem_ctx) ir_dereference_variable(lhs->components[elem]); + ir->write_mask = (1 << 0); + + handle_rvalue(&ir->rhs); + ir->rhs = new(mem_ctx) ir_swizzle(ir->rhs, + elem, elem, elem, elem, 1); + } else { + handle_rvalue(&ir->rhs); + } + + handle_rvalue(&ir->condition); + + return visit_continue; +} + +extern "C" { +bool +brw_do_vector_splitting(exec_list *instructions) +{ + ir_vector_reference_visitor refs; + + 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("vector %s@%p: decl %d, whole_access %d\n", + entry->var->name, (void *) entry->var, entry->declaration, + entry->whole_vector_access); + } + + if (!entry->declaration || entry->whole_vector_access) { + entry->remove(); + } + } + + if (refs.variable_list.is_empty()) + return false; + + void *mem_ctx = talloc_new(NULL); + + /* Replace the decls of the vectors 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; + type = glsl_type::get_instance(entry->var->type->base_type, 1, 1); + + entry->mem_ctx = talloc_parent(entry->var); + + for (unsigned int i = 0; i < entry->var->type->vector_elements; i++) { + const char *name = talloc_asprintf(mem_ctx, "%s_%c", + entry->var->name, + "xyzw"[i]); + + entry->components[i] = new(entry->mem_ctx) ir_variable(type, name, + ir_var_temporary); + entry->var->insert_before(entry->components[i]); + } + + entry->var->remove(); + } + + ir_vector_splitting_visitor split(&refs.variable_list); + visit_list_elements(&split, instructions); + + talloc_free(mem_ctx); + + return true; +} +} diff --git a/src/mesa/drivers/dri/i965/brw_wm.h b/src/mesa/drivers/dri/i965/brw_wm.h index 438da1af62..6a761e723b 100644 --- a/src/mesa/drivers/dri/i965/brw_wm.h +++ b/src/mesa/drivers/dri/i965/brw_wm.h @@ -466,5 +466,6 @@ struct gl_shader *brw_new_shader(GLcontext *ctx, GLuint name, GLuint type); struct gl_shader_program *brw_new_shader_program(GLcontext *ctx, GLuint name); GLboolean brw_do_channel_expressions(struct exec_list *instructions); +GLboolean brw_do_vector_splitting(struct exec_list *instructions); #endif -- cgit v1.2.3 From 9763d0a82a1ee605a8794f199d432824fb972b6a Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 26 Aug 2010 12:12:00 -0700 Subject: i965: Start building direct GLSL2 IR to 965 assembly codegen. Our channel-expressions and vector-splitting changes now happen into a private copy of the IR that we maintain for ourselves. Uniform assignment still happens by the core, so we continue using Mesa IR generation not just for swrast fallbacks but also for uniform values (since there's no storage for their contents other than shader_program->FragmentProgram->Parameters->ParameterValues). And most importantly, at the moment no actual codegen is hooked up other than emitting our favorite color to the framebuffer. --- src/mesa/drivers/dri/i965/brw_fs.cpp | 355 ++++++++++++++++++++++++++++++- src/mesa/drivers/dri/i965/brw_wm.c | 24 ++- src/mesa/drivers/dri/i965/brw_wm.h | 1 + src/mesa/drivers/dri/i965/brw_wm_state.c | 18 +- 4 files changed, 381 insertions(+), 17 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp index 9a6ee7a010..5dada65909 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -39,6 +39,20 @@ extern "C" { #include "../glsl/ir_optimization.h" #include "../glsl/ir_print_visitor.h" +enum register_file { + ARF = BRW_ARCHITECTURE_REGISTER_FILE, + GRF = BRW_GENERAL_REGISTER_FILE, + MRF = BRW_MESSAGE_REGISTER_FILE, + IMM = BRW_IMMEDIATE_VALUE, + BAD_FILE +}; + +enum fs_opcodes { + FS_OPCODE_FB_WRITE = 256, +}; + +static int using_new_fs = -1; + struct gl_shader * brw_new_shader(GLcontext *ctx, GLuint name, GLuint type) { @@ -77,18 +91,31 @@ brw_compile_shader(GLcontext *ctx, struct gl_shader *shader) GLboolean brw_link_shader(GLcontext *ctx, struct gl_shader_program *prog) { - static int using_new_fs = -1; - if (using_new_fs == -1) using_new_fs = getenv("INTEL_NEW_FS") != NULL; for (unsigned i = 0; i < prog->_NumLinkedShaders; i++) { - struct gl_shader *shader = prog->_LinkedShaders[i]; + struct brw_shader *shader = (struct brw_shader *)prog->_LinkedShaders[i]; + + if (using_new_fs && shader->base.Type == GL_FRAGMENT_SHADER) { + void *mem_ctx = talloc_new(NULL); + bool progress; + + shader->ir = new(shader) exec_list; + clone_ir_list(mem_ctx, shader->ir, shader->base.ir); - if (using_new_fs && shader->Type == GL_FRAGMENT_SHADER) { do_mat_op_to_vec(shader->ir); brw_do_channel_expressions(shader->ir); brw_do_vector_splitting(shader->ir); + + do { + progress = false; + + progress = do_common_optimization(shader->ir, true) || progress; + } while (progress); + + reparent_ir(shader->ir, shader); + talloc_free(mem_ctx); } } @@ -97,3 +124,323 @@ brw_link_shader(GLcontext *ctx, struct gl_shader_program *prog) return GL_TRUE; } + +class fs_reg { +public: + fs_reg() + { + this->file = BAD_FILE; + this->reg = 0; + this->hw_reg = -1; + } + + fs_reg(float f) + { + this->file = IMM; + this->reg = 0; + this->hw_reg = 0; + this->type = BRW_REGISTER_TYPE_F; + this->imm.f = f; + } + + fs_reg(int32_t i) + { + this->file = IMM; + this->reg = 0; + this->hw_reg = 0; + this->type = BRW_REGISTER_TYPE_D; + this->imm.i = i; + } + + fs_reg(uint32_t u) + { + this->file = IMM; + this->reg = 0; + this->hw_reg = 0; + this->type = BRW_REGISTER_TYPE_UD; + this->imm.u = u; + } + + fs_reg(enum register_file file, int hw_reg) + { + this->file = file; + this->reg = 0; + this->hw_reg = hw_reg; + this->type = BRW_REGISTER_TYPE_F; + } + + /** Register file: ARF, GRF, MRF, IMM. */ + enum register_file file; + /** Abstract register number. 0 = fixed hw reg */ + int reg; + /** HW register number. Generally unset until register allocation. */ + int hw_reg; + /** Register type. BRW_REGISTER_TYPE_* */ + int type; + + /** Value for file == BRW_IMMMEDIATE_FILE */ + union { + int32_t i; + uint32_t u; + float f; + } imm; +}; + +static const fs_reg reg_undef(BAD_FILE, -1); +static const fs_reg reg_null(ARF, BRW_ARF_NULL); + +class fs_inst : public exec_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; + } + + fs_inst() + { + this->opcode = BRW_OPCODE_NOP; + this->dst = reg_undef; + this->src[0] = reg_undef; + this->src[1] = reg_undef; + } + fs_inst(int opcode, fs_reg dst, fs_reg src0) + { + this->opcode = opcode; + this->dst = dst; + this->src[0] = src0; + this->src[1] = reg_undef; + } + fs_inst(int opcode, fs_reg dst, fs_reg src0, fs_reg src1) + { + this->opcode = opcode; + this->dst = dst; + this->src[0] = src0; + this->src[1] = src1; + } + + int opcode; /* BRW_OPCODE_* or FS_OPCODE_* */ + fs_reg dst; + fs_reg src[2]; +}; + +class fs_visitor : public ir_hierarchical_visitor +{ +public: + + fs_visitor(struct brw_wm_compile *c, struct brw_shader *shader) + { + this->c = c; + this->p = &c->func; + this->mem_ctx = talloc_new(NULL); + this->shader = shader; + } + ~fs_visitor() + { + talloc_free(this->mem_ctx); + } + + fs_inst *emit(fs_inst inst); + void generate_code(); + void generate_fb_write(fs_inst *inst); + + void emit_dummy_fs(); + + struct brw_wm_compile *c; + struct brw_compile *p; + struct brw_shader *shader; + void *mem_ctx; + exec_list instructions; + + int grf_used; + +}; + +fs_inst * +fs_visitor::emit(fs_inst inst) +{ + fs_inst *list_inst = new(mem_ctx) fs_inst; + *list_inst = inst; + + this->instructions.push_tail(list_inst); + + return list_inst; +} + +/** Emits a dummy fragment shader consisting of magenta for bringup purposes. */ +void +fs_visitor::emit_dummy_fs() +{ + /* Everyone's favorite color. */ + emit(fs_inst(BRW_OPCODE_MOV, + fs_reg(MRF, 2), + fs_reg(1.0f))); + emit(fs_inst(BRW_OPCODE_MOV, + fs_reg(MRF, 3), + fs_reg(0.0f))); + emit(fs_inst(BRW_OPCODE_MOV, + fs_reg(MRF, 4), + fs_reg(1.0f))); + emit(fs_inst(BRW_OPCODE_MOV, + fs_reg(MRF, 5), + fs_reg(0.0f))); + + fs_inst *write; + write = emit(fs_inst(FS_OPCODE_FB_WRITE, + fs_reg(0), + fs_reg(0))); +} + +void +fs_visitor::generate_fb_write(fs_inst *inst) +{ + GLboolean eot = 1; /* FINISHME: MRT */ + /* FINISHME: AADS */ + + /* Header is 2 regs, g0 and g1 are the contents. g0 will be implied + * move, here's g1. + */ + brw_push_insn_state(p); + brw_set_mask_control(p, BRW_MASK_DISABLE); + brw_set_compression_control(p, BRW_COMPRESSION_NONE); + brw_MOV(p, + brw_message_reg(1), + brw_vec8_grf(1, 0)); + brw_pop_insn_state(p); + + int nr = 2 + 4; + + brw_fb_WRITE(p, + 8, /* dispatch_width */ + retype(vec8(brw_null_reg()), BRW_REGISTER_TYPE_UW), + 0, /* base MRF */ + retype(brw_vec8_grf(0, 0), BRW_REGISTER_TYPE_UW), + 0, /* FINISHME: MRT target */ + nr, + 0, + eot); +} + +void +fs_visitor::generate_code() +{ + this->grf_used = 2; /* header */ + + foreach_iter(exec_list_iterator, iter, this->instructions) { + fs_inst *inst = (fs_inst *)iter.get(); + struct brw_reg src[2], dst; + + for (unsigned int i = 0; i < 2; i++) { + switch (inst->src[i].file) { + case GRF: + case ARF: + case MRF: + src[i] = brw_vec8_reg(inst->src[i].file, + inst->src[i].hw_reg, 0); + src[i] = retype(src[i], inst->src[i].type); + break; + case IMM: + switch (inst->src[i].type) { + case BRW_REGISTER_TYPE_F: + src[i] = brw_imm_f(inst->src[i].imm.f); + break; + case BRW_REGISTER_TYPE_D: + src[i] = brw_imm_f(inst->src[i].imm.i); + break; + case BRW_REGISTER_TYPE_UD: + src[i] = brw_imm_f(inst->src[i].imm.u); + break; + default: + assert(!"not reached"); + break; + } + break; + case BAD_FILE: + /* Probably unused. */ + src[i] = brw_null_reg(); + } + } + dst = brw_vec8_reg(inst->dst.file, inst->dst.hw_reg, 0); + + switch (inst->opcode) { + case BRW_OPCODE_MOV: + brw_MOV(p, dst, src[0]); + break; + case FS_OPCODE_FB_WRITE: + generate_fb_write(inst); + break; + default: + assert(!"not reached"); + } + } +} + +GLboolean +brw_wm_fs_emit(struct brw_context *brw, struct brw_wm_compile *c) +{ + struct brw_compile *p = &c->func; + struct intel_context *intel = &brw->intel; + GLcontext *ctx = &intel->ctx; + struct brw_shader *shader = NULL; + struct gl_shader_program *prog = ctx->Shader.CurrentProgram; + + if (!prog) + return GL_FALSE; + + if (!using_new_fs) + return GL_FALSE; + + for (unsigned int i = 0; i < prog->_NumLinkedShaders; i++) { + if (prog->_LinkedShaders[i]->Type == GL_FRAGMENT_SHADER) { + shader = (struct brw_shader *)prog->_LinkedShaders[i]; + break; + } + } + if (!shader) + return GL_FALSE; + + /* We always use 8-wide mode, at least for now. For one, flow + * control only works in 8-wide. Also, when we're fragment shader + * bound, we're almost always under register pressure as well, so + * 8-wide would save us from the performance cliff of spilling + * regs. + */ + c->dispatch_width = 8; + + if (INTEL_DEBUG & DEBUG_WM) { + printf("GLSL IR for native fragment shader %d:\n", prog->Name); + _mesa_print_ir(shader->ir, NULL); + printf("\n"); + } + + /* Now the main event: Visit the shader IR and generate our FS IR for it. + */ + fs_visitor v(c, shader); + visit_list_elements(&v, shader->ir); + + v.emit_dummy_fs(); + + v.generate_code(); + + if (INTEL_DEBUG & DEBUG_WM) { + printf("Native code for fragment shader %d:\n", prog->Name); + for (unsigned int i = 0; i < p->nr_insn; i++) + brw_disasm(stdout, &p->store[i], intel->gen); + printf("\n"); + } + + c->prog_data.nr_params = 0; /* FINISHME */ + c->prog_data.first_curbe_grf = c->key.nr_payload_regs; + c->prog_data.urb_read_length = 1; /* FINISHME: attrs */ + c->prog_data.curb_read_length = 0; /* FINISHME */ + c->prog_data.total_grf = v.grf_used; + c->prog_data.total_scratch = 0; + + return GL_TRUE; +} diff --git a/src/mesa/drivers/dri/i965/brw_wm.c b/src/mesa/drivers/dri/i965/brw_wm.c index 34cefeea32..899e9b1dfb 100644 --- a/src/mesa/drivers/dri/i965/brw_wm.c +++ b/src/mesa/drivers/dri/i965/brw_wm.c @@ -177,17 +177,19 @@ static void do_wm_prog( struct brw_context *brw, /* temporary sanity check assertion */ ASSERT(fp->isGLSL == brw_wm_is_glsl(&c->fp->program)); - /* - * Shader which use GLSL features such as flow control are handled - * differently from "simple" shaders. - */ - if (fp->isGLSL) { - c->dispatch_width = 8; - brw_wm_glsl_emit(brw, c); - } - else { - c->dispatch_width = 16; - brw_wm_non_glsl_emit(brw, c); + if (!brw_wm_fs_emit(brw, c)) { + /* + * Shader which use GLSL features such as flow control are handled + * differently from "simple" shaders. + */ + if (fp->isGLSL) { + c->dispatch_width = 8; + brw_wm_glsl_emit(brw, c); + } + else { + c->dispatch_width = 16; + brw_wm_non_glsl_emit(brw, c); + } } if (INTEL_DEBUG & DEBUG_WM) diff --git a/src/mesa/drivers/dri/i965/brw_wm.h b/src/mesa/drivers/dri/i965/brw_wm.h index 6a761e723b..2639d4f26b 100644 --- a/src/mesa/drivers/dri/i965/brw_wm.h +++ b/src/mesa/drivers/dri/i965/brw_wm.h @@ -306,6 +306,7 @@ void brw_wm_lookup_iz( GLuint line_aa, GLboolean brw_wm_is_glsl(const struct gl_fragment_program *fp); void brw_wm_glsl_emit(struct brw_context *brw, struct brw_wm_compile *c); +GLboolean brw_wm_fs_emit(struct brw_context *brw, struct brw_wm_compile *c); /* brw_wm_emit.c */ void emit_alu1(struct brw_compile *p, diff --git a/src/mesa/drivers/dri/i965/brw_wm_state.c b/src/mesa/drivers/dri/i965/brw_wm_state.c index c1cf4db1ca..6699d0a73e 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_state.c +++ b/src/mesa/drivers/dri/i965/brw_wm_state.c @@ -104,8 +104,22 @@ wm_unit_populate_key(struct brw_context *brw, struct brw_wm_unit_key *key) key->uses_kill = fp->UsesKill || ctx->Color.AlphaEnabled; key->is_glsl = bfp->isGLSL; - /* temporary sanity check assertion */ - ASSERT(bfp->isGLSL == brw_wm_is_glsl(fp)); + /* If using the fragment shader backend, the program is always + * 8-wide. + */ + if (ctx->Shader.CurrentProgram) { + int i; + + for (i = 0; i < ctx->Shader.CurrentProgram->_NumLinkedShaders; i++) { + struct brw_shader *shader = + (struct brw_shader *)ctx->Shader.CurrentProgram->_LinkedShaders[i];; + + if (shader->base.Type == GL_FRAGMENT_SHADER && + shader->ir != NULL) { + key->is_glsl = GL_TRUE; + } + } + } /* _NEW_DEPTH */ key->stats_wm = intel->stats_wm; -- cgit v1.2.3 From dcb7c0009bf0a1e0c4fb1aae4b7b07efcc0ed173 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Sun, 15 Aug 2010 18:58:58 -0700 Subject: i965: Start building the codegen visitor. This can successfully emit a real program that generates magenta now. --- src/mesa/drivers/dri/i965/brw_fs.cpp | 669 ++++++++++++++++++++++++++++++++++- 1 file changed, 659 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp index 5dada65909..2498b557f7 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -31,11 +31,13 @@ extern "C" { #include "program/prog_parameter.h" #include "program/prog_print.h" #include "program/prog_optimize.h" +#include "program/hash_table.h" #include "brw_context.h" #include "brw_eu.h" #include "brw_wm.h" #include "talloc.h" } +#include "../glsl/glsl_types.h" #include "../glsl/ir_optimization.h" #include "../glsl/ir_print_visitor.h" @@ -49,6 +51,16 @@ enum register_file { enum fs_opcodes { FS_OPCODE_FB_WRITE = 256, + FS_OPCODE_RCP, + FS_OPCODE_RSQ, + FS_OPCODE_SQRT, + FS_OPCODE_EXP2, + FS_OPCODE_LOG2, + FS_OPCODE_POW, + FS_OPCODE_SIN, + FS_OPCODE_COS, + FS_OPCODE_DDX, + FS_OPCODE_DDY, }; static int using_new_fs = -1; @@ -125,15 +137,72 @@ brw_link_shader(GLcontext *ctx, struct gl_shader_program *prog) return GL_TRUE; } +static int +type_size(const struct glsl_type *type) +{ + unsigned int size, i; + + switch (type->base_type) { + case GLSL_TYPE_UINT: + case GLSL_TYPE_INT: + case GLSL_TYPE_FLOAT: + case GLSL_TYPE_BOOL: + if (type->is_matrix()) { + /* In case of incoming uniform/varying matrices, match their + * allocation behavior. FINISHME: We could just use + * glsl_type->components() for variables and temps within the + * shader. + */ + return type->matrix_columns * 4; + } else { + return type->vector_elements; + } + case GLSL_TYPE_ARRAY: + /* FINISHME: uniform/varying arrays. */ + 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; + case GLSL_TYPE_SAMPLER: + /* Samplers take up no register space, since they're baked in at + * link time. + */ + return 0; + default: + assert(!"not reached"); + return 0; + } +} + class fs_reg { 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; + } + + /** Generic unset register constructor. */ fs_reg() { this->file = BAD_FILE; this->reg = 0; + this->reg_offset = 0; this->hw_reg = -1; + this->negate = 0; + this->abs = 0; } + /** Immediate value constructor. */ fs_reg(float f) { this->file = IMM; @@ -141,8 +210,11 @@ public: this->hw_reg = 0; this->type = BRW_REGISTER_TYPE_F; this->imm.f = f; + this->negate = 0; + this->abs = 0; } + /** Immediate value constructor. */ fs_reg(int32_t i) { this->file = IMM; @@ -150,8 +222,11 @@ public: this->hw_reg = 0; this->type = BRW_REGISTER_TYPE_D; this->imm.i = i; + this->negate = 0; + this->abs = 0; } + /** Immediate value constructor. */ fs_reg(uint32_t u) { this->file = IMM; @@ -159,24 +234,25 @@ public: this->hw_reg = 0; this->type = BRW_REGISTER_TYPE_UD; this->imm.u = u; + this->negate = 0; + this->abs = 0; } - fs_reg(enum register_file file, int hw_reg) - { - this->file = file; - this->reg = 0; - this->hw_reg = hw_reg; - this->type = BRW_REGISTER_TYPE_F; - } + fs_reg(enum register_file file, int hw_reg); + fs_reg(class fs_visitor *v, const struct glsl_type *type); /** Register file: ARF, GRF, MRF, IMM. */ enum register_file file; /** Abstract register number. 0 = fixed hw reg */ int reg; + /** Offset within the abstract register. */ + int reg_offset; /** HW register number. Generally unset until register allocation. */ int hw_reg; /** Register type. BRW_REGISTER_TYPE_* */ int type; + bool negate; + bool abs; /** Value for file == BRW_IMMMEDIATE_FILE */ union { @@ -209,6 +285,9 @@ public: this->dst = reg_undef; this->src[0] = reg_undef; this->src[1] = reg_undef; + this->saturate = false; + this->conditional_mod = BRW_CONDITIONAL_NONE; + this->predicated = false; } fs_inst(int opcode, fs_reg dst, fs_reg src0) { @@ -216,6 +295,9 @@ public: this->dst = dst; this->src[0] = src0; this->src[1] = reg_undef; + this->saturate = false; + this->conditional_mod = BRW_CONDITIONAL_NONE; + this->predicated = false; } fs_inst(int opcode, fs_reg dst, fs_reg src0, fs_reg src1) { @@ -223,14 +305,20 @@ public: this->dst = dst; this->src[0] = src0; this->src[1] = src1; + this->saturate = false; + this->conditional_mod = BRW_CONDITIONAL_NONE; + this->predicated = false; } int opcode; /* BRW_OPCODE_* or FS_OPCODE_* */ fs_reg dst; fs_reg src[2]; + bool saturate; + bool predicated; + int conditional_mod; /**< BRW_CONDITIONAL_* */ }; -class fs_visitor : public ir_hierarchical_visitor +class fs_visitor : public ir_visitor { public: @@ -240,28 +328,521 @@ public: this->p = &c->func; this->mem_ctx = talloc_new(NULL); this->shader = shader; + this->fail = false; + this->next_abstract_grf = 1; + this->variable_ht = hash_table_ctor(0, + hash_table_pointer_hash, + hash_table_pointer_compare); + + this->frag_color = NULL; + this->frag_data = NULL; + this->frag_depth = NULL; } ~fs_visitor() { talloc_free(this->mem_ctx); + hash_table_dtor(this->variable_ht); } + fs_reg *variable_storage(ir_variable *var); + + void visit(ir_variable *ir); + void visit(ir_assignment *ir); + void visit(ir_dereference_variable *ir); + void visit(ir_dereference_record *ir); + void visit(ir_dereference_array *ir); + void visit(ir_expression *ir); + void visit(ir_texture *ir); + void visit(ir_if *ir); + void visit(ir_constant *ir); + void visit(ir_swizzle *ir); + void visit(ir_return *ir); + void visit(ir_loop *ir); + void visit(ir_loop_jump *ir); + void visit(ir_discard *ir); + void visit(ir_call *ir); + void visit(ir_function *ir); + void visit(ir_function_signature *ir); + fs_inst *emit(fs_inst inst); + void assign_regs(); void generate_code(); void generate_fb_write(fs_inst *inst); void emit_dummy_fs(); + void emit_fb_writes(); struct brw_wm_compile *c; struct brw_compile *p; struct brw_shader *shader; void *mem_ctx; exec_list instructions; + int next_abstract_grf; + struct hash_table *variable_ht; + ir_variable *frag_color, *frag_data, *frag_depth; + + bool fail; + + /* Result of last visit() method. */ + fs_reg result; int grf_used; }; +/** Fixed HW reg constructor. */ +fs_reg::fs_reg(enum register_file file, int hw_reg) +{ + this->file = file; + this->reg = 0; + this->reg_offset = 0; + this->hw_reg = hw_reg; + this->type = BRW_REGISTER_TYPE_F; + this->negate = 0; + this->abs = 0; +} + +/** Automatic reg constructor. */ +fs_reg::fs_reg(class fs_visitor *v, const struct glsl_type *type) +{ + this->file = GRF; + this->reg = v->next_abstract_grf; + this->reg_offset = 0; + v->next_abstract_grf += type_size(type); + this->hw_reg = -1; + this->negate = 0; + this->abs = 0; + + switch (type->base_type) { + case GLSL_TYPE_FLOAT: + this->type = BRW_REGISTER_TYPE_F; + break; + case GLSL_TYPE_INT: + case GLSL_TYPE_BOOL: + this->type = BRW_REGISTER_TYPE_D; + break; + case GLSL_TYPE_UINT: + this->type = BRW_REGISTER_TYPE_UD; + break; + default: + assert(!"not reached"); + this->type = BRW_REGISTER_TYPE_F; + break; + } +} + +fs_reg * +fs_visitor::variable_storage(ir_variable *var) +{ + return (fs_reg *)hash_table_find(this->variable_ht, var); +} + +void +fs_visitor::visit(ir_variable *ir) +{ + fs_reg *reg; + + /* FINISHME */ + assert(ir->mode != ir_var_uniform && + ir->mode != ir_var_in && + ir->mode != ir_var_inout); + + if (strcmp(ir->name, "gl_FragColor") == 0) { + this->frag_color = ir; + } + + if (strcmp(ir->name, "gl_FragData") == 0) { + this->frag_data = ir; + } + + reg = new(this->mem_ctx) fs_reg(this, ir->type); + + hash_table_insert(this->variable_ht, reg, ir); +} + +void +fs_visitor::visit(ir_dereference_variable *ir) +{ + fs_reg *reg = variable_storage(ir->var); + this->result = *reg; +} + +void +fs_visitor::visit(ir_dereference_record *ir) +{ + assert(!"FINISHME"); +} + +void +fs_visitor::visit(ir_dereference_array *ir) +{ + assert(!"FINISHME"); +} + +void +fs_visitor::visit(ir_expression *ir) +{ + unsigned int operand; + fs_reg op[2], temp; + fs_reg result; + fs_inst *inst; + + for (operand = 0; operand < ir->get_num_operands(); operand++) { + ir->operands[operand]->accept(this); + if (this->result.file == BAD_FILE) { + ir_print_visitor v; + printf("Failed to get tree for expression operand:\n"); + ir->operands[operand]->accept(&v); + this->fail = true; + } + op[operand] = this->result; + + /* Matrix expression operands should have been broken down to vector + * operations already. + */ + assert(!ir->operands[operand]->type->is_matrix()); + /* And then those vector operands should have been broken down to scalar. + */ + assert(!ir->operands[operand]->type->is_vector()); + } + + /* Storage for our result. If our result goes into an assignment, it will + * just get copy-propagated out, so no worries. + */ + this->result = fs_reg(this, ir->type); + + switch (ir->operation) { + case ir_unop_logic_not: + emit(fs_inst(BRW_OPCODE_ADD, this->result, op[0], fs_reg(-1))); + break; + case ir_unop_neg: + this->result = op[0]; + op[0].negate = ~op[0].negate; + break; + case ir_unop_abs: + this->result = op[0]; + op[0].abs = true; + break; + case ir_unop_sign: + temp = fs_reg(this, ir->type); + + inst = emit(fs_inst(BRW_OPCODE_CMP, this->result, op[0], fs_reg(0.0f))); + inst->conditional_mod = BRW_CONDITIONAL_G; + + inst = emit(fs_inst(BRW_OPCODE_CMP, temp, op[0], fs_reg(0.0f))); + inst->conditional_mod = BRW_CONDITIONAL_L; + + temp.negate = true; + emit(fs_inst(BRW_OPCODE_ADD, this->result, this->result, temp)); + + break; + case ir_unop_rcp: + emit(fs_inst(FS_OPCODE_RCP, this->result, op[0])); + break; + + case ir_unop_exp2: + emit(fs_inst(FS_OPCODE_EXP2, this->result, op[0])); + break; + case ir_unop_log2: + emit(fs_inst(FS_OPCODE_LOG2, this->result, op[0])); + break; + case ir_unop_exp: + case ir_unop_log: + assert(!"not reached: should be handled by ir_explog_to_explog2"); + break; + case ir_unop_sin: + emit(fs_inst(FS_OPCODE_SIN, this->result, op[0])); + break; + case ir_unop_cos: + emit(fs_inst(FS_OPCODE_COS, this->result, op[0])); + break; + + case ir_unop_dFdx: + emit(fs_inst(FS_OPCODE_DDX, this->result, op[0])); + break; + case ir_unop_dFdy: + emit(fs_inst(FS_OPCODE_DDY, this->result, op[0])); + break; + + case ir_binop_add: + emit(fs_inst(BRW_OPCODE_ADD, this->result, op[0], op[1])); + break; + case ir_binop_sub: + assert(!"not reached: should be handled by ir_sub_to_add_neg"); + break; + + case ir_binop_mul: + emit(fs_inst(BRW_OPCODE_MUL, this->result, op[0], op[1])); + break; + case ir_binop_div: + 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; + + case ir_binop_less: + inst = emit(fs_inst(BRW_OPCODE_CMP, this->result, op[0], op[1])); + inst->conditional_mod = BRW_CONDITIONAL_L; + break; + case ir_binop_greater: + inst = emit(fs_inst(BRW_OPCODE_CMP, this->result, op[0], op[1])); + inst->conditional_mod = BRW_CONDITIONAL_G; + break; + case ir_binop_lequal: + inst = emit(fs_inst(BRW_OPCODE_CMP, this->result, op[0], op[1])); + inst->conditional_mod = BRW_CONDITIONAL_LE; + break; + case ir_binop_gequal: + inst = emit(fs_inst(BRW_OPCODE_CMP, this->result, op[0], op[1])); + inst->conditional_mod = BRW_CONDITIONAL_GE; + break; + case ir_binop_equal: + inst = emit(fs_inst(BRW_OPCODE_CMP, this->result, op[0], op[1])); + inst->conditional_mod = BRW_CONDITIONAL_Z; + break; + case ir_binop_nequal: + inst = emit(fs_inst(BRW_OPCODE_CMP, this->result, op[0], op[1])); + inst->conditional_mod = BRW_CONDITIONAL_NZ; + break; + + case ir_binop_logic_xor: + emit(fs_inst(BRW_OPCODE_XOR, this->result, op[0], op[1])); + break; + + case ir_binop_logic_or: + emit(fs_inst(BRW_OPCODE_OR, this->result, op[0], op[1])); + break; + + case ir_binop_logic_and: + emit(fs_inst(BRW_OPCODE_AND, this->result, op[0], op[1])); + break; + + case ir_binop_dot: + case ir_binop_cross: + case ir_unop_any: + assert(!"not reached: should be handled by brw_channel_expressions"); + break; + + case ir_unop_sqrt: + emit(fs_inst(FS_OPCODE_SQRT, this->result, op[0])); + break; + + case ir_unop_rsq: + emit(fs_inst(FS_OPCODE_RSQ, this->result, op[0])); + break; + + case ir_unop_i2f: + case ir_unop_b2f: + case ir_unop_b2i: + emit(fs_inst(BRW_OPCODE_MOV, this->result, op[0])); + break; + case ir_unop_f2i: + emit(fs_inst(BRW_OPCODE_RNDZ, this->result, op[0])); + break; + case ir_unop_f2b: + case ir_unop_i2b: + inst = emit(fs_inst(BRW_OPCODE_CMP, this->result, op[0], fs_reg(0.0f))); + inst->conditional_mod = BRW_CONDITIONAL_NZ; + + case ir_unop_trunc: + emit(fs_inst(BRW_OPCODE_RNDD, this->result, op[0])); + break; + case ir_unop_ceil: + op[0].negate = ~op[0].negate; + inst = emit(fs_inst(BRW_OPCODE_RNDD, this->result, op[0])); + this->result.negate = true; + break; + case ir_unop_floor: + inst = emit(fs_inst(BRW_OPCODE_RNDD, this->result, op[0])); + break; + case ir_unop_fract: + inst = emit(fs_inst(BRW_OPCODE_FRC, this->result, op[0])); + break; + + case ir_binop_min: + inst = emit(fs_inst(BRW_OPCODE_CMP, this->result, op[0], op[1])); + inst->conditional_mod = BRW_CONDITIONAL_L; + + inst = emit(fs_inst(BRW_OPCODE_SEL, this->result, op[0], op[1])); + inst->predicated = true; + break; + case ir_binop_max: + inst = emit(fs_inst(BRW_OPCODE_CMP, this->result, op[0], op[1])); + inst->conditional_mod = BRW_CONDITIONAL_G; + + inst = emit(fs_inst(BRW_OPCODE_SEL, this->result, op[0], op[1])); + inst->predicated = true; + break; + + case ir_binop_pow: + inst = emit(fs_inst(FS_OPCODE_POW, this->result, op[0], op[1])); + break; + + case ir_unop_bit_not: + case ir_unop_u2f: + case ir_binop_lshift: + case ir_binop_rshift: + case ir_binop_bit_and: + case ir_binop_bit_xor: + case ir_binop_bit_or: + assert(!"GLSL 1.30 features unsupported"); + break; + } +} + +void +fs_visitor::visit(ir_assignment *ir) +{ + struct fs_reg l, r; + int i; + int write_mask; + fs_inst *inst; + + /* FINISHME: arrays on the lhs */ + ir->lhs->accept(this); + l = this->result; + + ir->rhs->accept(this); + r = this->result; + + /* 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()); + write_mask = WRITEMASK_XYZW; + } else { + assert(ir->lhs->type->is_vector() || ir->lhs->type->is_scalar()); + write_mask = ir->write_mask; + } + + assert(l.file != BAD_FILE); + assert(r.file != BAD_FILE); + + if (ir->condition) { + /* Get the condition bool into the predicate. */ + ir->condition->accept(this); + inst = emit(fs_inst(BRW_OPCODE_CMP, this->result, fs_reg(0))); + inst->conditional_mod = BRW_CONDITIONAL_NZ; + } + + for (i = 0; i < type_size(ir->lhs->type); i++) { + if (i < 4 && !(write_mask & (1 << i))) + continue; + + inst = emit(fs_inst(BRW_OPCODE_MOV, l, r)); + if (ir->condition) + inst->predicated = true; + l.reg_offset++; + r.reg_offset++; + } +} + +void +fs_visitor::visit(ir_texture *ir) +{ + assert(!"FINISHME"); +} + +void +fs_visitor::visit(ir_swizzle *ir) +{ + assert(!"FINISHME"); +} + +void +fs_visitor::visit(ir_discard *ir) +{ + assert(!"FINISHME"); +} + +void +fs_visitor::visit(ir_constant *ir) +{ + fs_reg reg(this, ir->type); + this->result = reg; + + for (unsigned int i = 0; i < ir->type->vector_elements; i++) { + switch (ir->type->base_type) { + case GLSL_TYPE_FLOAT: + emit(fs_inst(BRW_OPCODE_MOV, reg, fs_reg(ir->value.f[i]))); + break; + case GLSL_TYPE_UINT: + emit(fs_inst(BRW_OPCODE_MOV, reg, fs_reg(ir->value.u[i]))); + break; + case GLSL_TYPE_INT: + emit(fs_inst(BRW_OPCODE_MOV, reg, fs_reg(ir->value.i[i]))); + break; + case GLSL_TYPE_BOOL: + emit(fs_inst(BRW_OPCODE_MOV, reg, fs_reg((int)ir->value.b[i]))); + break; + default: + assert(!"Non-float/uint/int/bool constant"); + } + reg.reg_offset++; + } +} + +void +fs_visitor::visit(ir_if *ir) +{ + assert(!"FINISHME"); +} + +void +fs_visitor::visit(ir_loop *ir) +{ + assert(!"FINISHME"); +} + +void +fs_visitor::visit(ir_loop_jump *ir) +{ + assert(!"FINISHME"); +} + +void +fs_visitor::visit(ir_call *ir) +{ + assert(!"FINISHME"); +} + +void +fs_visitor::visit(ir_return *ir) +{ + assert(!"FINISHME"); +} + +void +fs_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 +fs_visitor::visit(ir_function_signature *ir) +{ + assert(!"not reached"); + (void)ir; +} + fs_inst * fs_visitor::emit(fs_inst inst) { @@ -297,6 +878,24 @@ fs_visitor::emit_dummy_fs() fs_reg(0))); } +void +fs_visitor::emit_fb_writes() +{ + assert(this->frag_color || !"FINISHME: MRT"); + fs_reg color = *(variable_storage(this->frag_color)); + + for (int i = 0; i < 4; i++) { + emit(fs_inst(BRW_OPCODE_MOV, + fs_reg(MRF, 2 + i), + color)); + color.reg_offset++; + } + + emit(fs_inst(FS_OPCODE_FB_WRITE, + fs_reg(0), + fs_reg(0))); +} + void fs_visitor::generate_fb_write(fs_inst *inst) { @@ -327,6 +926,37 @@ fs_visitor::generate_fb_write(fs_inst *inst) eot); } +static void +trivial_assign_reg(int header_size, fs_reg *reg) +{ + if (reg->file == GRF && reg->reg != 0) { + reg->hw_reg = header_size + reg->reg + reg->reg_offset; + reg->reg = 0; + } +} + +void +fs_visitor::assign_regs() +{ + int header_size = 2; /* FINISHME: header */ + int last_grf = 0; + + /* FINISHME: trivial assignment of register numbers */ + foreach_iter(exec_list_iterator, iter, this->instructions) { + fs_inst *inst = (fs_inst *)iter.get(); + + trivial_assign_reg(header_size, &inst->dst); + trivial_assign_reg(header_size, &inst->src[0]); + trivial_assign_reg(header_size, &inst->src[1]); + + last_grf = MAX2(last_grf, inst->dst.hw_reg); + last_grf = MAX2(last_grf, inst->src[0].hw_reg); + last_grf = MAX2(last_grf, inst->src[1].hw_reg); + } + + this->grf_used = last_grf; +} + void fs_visitor::generate_code() { @@ -365,9 +995,16 @@ fs_visitor::generate_code() /* Probably unused. */ src[i] = brw_null_reg(); } + if (inst->src[i].abs) + src[i] = brw_abs(src[i]); + if (inst->src[i].negate) + src[i] = negate(src[i]); } dst = brw_vec8_reg(inst->dst.file, inst->dst.hw_reg, 0); + brw_set_conditionalmod(p, inst->conditional_mod); + brw_set_predicate_control(p, inst->predicated); + switch (inst->opcode) { case BRW_OPCODE_MOV: brw_MOV(p, dst, src[0]); @@ -422,9 +1059,21 @@ brw_wm_fs_emit(struct brw_context *brw, struct brw_wm_compile *c) /* Now the main event: Visit the shader IR and generate our FS IR for it. */ fs_visitor v(c, shader); - visit_list_elements(&v, shader->ir); - v.emit_dummy_fs(); + if (0) { + v.emit_dummy_fs(); + } else { + /* Generate FS IR for main(). (the visitor only descends into + * functions called "main"). + */ + visit_exec_list(shader->ir, &v); + + if (v.fail) + return GL_FALSE; + + v.emit_fb_writes(); + v.assign_regs(); + } v.generate_code(); -- cgit v1.2.3 From e85f8272d0757989aeab650fbf929b382d671492 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 16 Aug 2010 21:53:02 -0700 Subject: i965: Add support for in varyings to the new FS codegen. At least some tests, like glsl-vs-sign, now work. --- src/mesa/drivers/dri/i965/brw_fs.cpp | 445 ++++++++++++++++++++++++++++++----- 1 file changed, 390 insertions(+), 55 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp index 2498b557f7..57c5f55341 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -46,6 +46,7 @@ enum register_file { GRF = BRW_GENERAL_REGISTER_FILE, MRF = BRW_MESSAGE_REGISTER_FILE, IMM = BRW_IMMEDIATE_VALUE, + FIXED_HW_REG, BAD_FILE }; @@ -61,6 +62,7 @@ enum fs_opcodes { FS_OPCODE_COS, FS_OPCODE_DDX, FS_OPCODE_DDY, + FS_OPCODE_LINTERP, }; static int using_new_fs = -1; @@ -117,6 +119,10 @@ brw_link_shader(GLcontext *ctx, struct gl_shader_program *prog) clone_ir_list(mem_ctx, shader->ir, shader->base.ir); do_mat_op_to_vec(shader->ir); + do_div_to_mul_rcp(shader->ir); + do_sub_to_add_neg(shader->ir); + do_explog_to_explog2(shader->ir); + brw_do_channel_expressions(shader->ir); brw_do_vector_splitting(shader->ir); @@ -238,6 +244,18 @@ public: this->abs = 0; } + /** Fixed brw_reg Immediate value constructor. */ + fs_reg(struct brw_reg fixed_hw_reg) + { + this->file = FIXED_HW_REG; + this->fixed_hw_reg = fixed_hw_reg; + this->reg = 0; + this->hw_reg = 0; + this->type = fixed_hw_reg.type; + this->negate = 0; + this->abs = 0; + } + fs_reg(enum register_file file, int hw_reg); fs_reg(class fs_visitor *v, const struct glsl_type *type); @@ -253,6 +271,7 @@ public: int type; bool negate; bool abs; + struct brw_reg fixed_hw_reg; /** Value for file == BRW_IMMMEDIATE_FILE */ union { @@ -262,7 +281,7 @@ public: } imm; }; -static const fs_reg reg_undef(BAD_FILE, -1); +static const fs_reg reg_undef; static const fs_reg reg_null(ARF, BRW_ARF_NULL); class fs_inst : public exec_node { @@ -282,23 +301,21 @@ public: fs_inst() { this->opcode = BRW_OPCODE_NOP; - this->dst = reg_undef; - this->src[0] = reg_undef; - this->src[1] = reg_undef; this->saturate = false; this->conditional_mod = BRW_CONDITIONAL_NONE; this->predicated = false; } + fs_inst(int opcode, fs_reg dst, fs_reg src0) { this->opcode = opcode; this->dst = dst; this->src[0] = src0; - this->src[1] = reg_undef; this->saturate = false; this->conditional_mod = BRW_CONDITIONAL_NONE; this->predicated = false; } + fs_inst(int opcode, fs_reg dst, fs_reg src0, fs_reg src1) { this->opcode = opcode; @@ -310,9 +327,21 @@ public: this->predicated = false; } + fs_inst(int opcode, fs_reg dst, fs_reg src0, fs_reg src1, fs_reg src2) + { + this->opcode = opcode; + this->dst = dst; + this->src[0] = src0; + this->src[1] = src1; + this->src[2] = src2; + this->saturate = false; + this->conditional_mod = BRW_CONDITIONAL_NONE; + this->predicated = false; + } + int opcode; /* BRW_OPCODE_* or FS_OPCODE_* */ fs_reg dst; - fs_reg src[2]; + fs_reg src[3]; bool saturate; bool predicated; int conditional_mod; /**< BRW_CONDITIONAL_* */ @@ -326,6 +355,8 @@ public: { this->c = c; this->p = &c->func; + this->brw = p->brw; + this->intel = &brw->intel; this->mem_ctx = talloc_new(NULL); this->shader = shader; this->fail = false; @@ -337,6 +368,7 @@ public: this->frag_color = NULL; this->frag_data = NULL; this->frag_depth = NULL; + this->first_non_payload_grf = 0; } ~fs_visitor() { @@ -365,13 +397,23 @@ public: void visit(ir_function_signature *ir); fs_inst *emit(fs_inst inst); + void assign_urb_setup(); void assign_regs(); void generate_code(); void generate_fb_write(fs_inst *inst); + void generate_linterp(fs_inst *inst, struct brw_reg dst, + struct brw_reg *src); + void generate_math(fs_inst *inst, struct brw_reg dst, struct brw_reg *src); void emit_dummy_fs(); + void emit_interpolation(); + void emit_pinterp(int location); void emit_fb_writes(); + struct brw_reg interp_reg(int location, int channel); + + struct brw_context *brw; + struct intel_context *intel; struct brw_wm_compile *c; struct brw_compile *p; struct brw_shader *shader; @@ -380,12 +422,20 @@ public: int next_abstract_grf; struct hash_table *variable_ht; ir_variable *frag_color, *frag_data, *frag_depth; + int first_non_payload_grf; bool fail; /* Result of last visit() method. */ fs_reg result; + fs_reg pixel_x; + fs_reg pixel_y; + fs_reg pixel_w; + fs_reg delta_x; + fs_reg delta_y; + fs_reg interp_attrs[64]; + int grf_used; }; @@ -440,22 +490,25 @@ fs_visitor::variable_storage(ir_variable *var) void fs_visitor::visit(ir_variable *ir) { - fs_reg *reg; + fs_reg *reg = NULL; /* FINISHME */ - assert(ir->mode != ir_var_uniform && - ir->mode != ir_var_in && - ir->mode != ir_var_inout); + assert(ir->mode != ir_var_uniform); if (strcmp(ir->name, "gl_FragColor") == 0) { this->frag_color = ir; + } else if (strcmp(ir->name, "gl_FragData") == 0) { + this->frag_data = ir; + } else if (strcmp(ir->name, "gl_FragDepth") == 0) { + this->frag_depth = ir; } - if (strcmp(ir->name, "gl_FragData") == 0) { - this->frag_data = ir; + if (ir->mode == ir_var_in) { + reg = &this->interp_attrs[ir->location]; } - reg = new(this->mem_ctx) fs_reg(this, ir->type); + if (!reg) + reg = new(this->mem_ctx) fs_reg(this, ir->type); hash_table_insert(this->variable_ht, reg, ir); } @@ -576,6 +629,7 @@ fs_visitor::visit(ir_expression *ir) break; case ir_binop_div: assert(!"not reached: should be handled by ir_div_to_mul_rcp"); + break; case ir_binop_mod: assert(!"ir_binop_mod should have been converted to b * fract(a/b)"); break; @@ -748,7 +802,35 @@ fs_visitor::visit(ir_texture *ir) void fs_visitor::visit(ir_swizzle *ir) { - assert(!"FINISHME"); + ir->val->accept(this); + fs_reg val = this->result; + + fs_reg result = fs_reg(this, ir->type); + this->result = result; + + for (unsigned int i = 0; i < ir->type->vector_elements; i++) { + fs_reg channel = val; + int swiz = 0; + + switch (i) { + case 0: + swiz = ir->mask.x; + break; + case 1: + swiz = ir->mask.y; + break; + case 2: + swiz = ir->mask.z; + break; + case 3: + swiz = ir->mask.w; + break; + } + + channel.reg_offset += swiz; + emit(fs_inst(BRW_OPCODE_MOV, result, channel)); + result.reg_offset++; + } } void @@ -878,6 +960,118 @@ fs_visitor::emit_dummy_fs() fs_reg(0))); } +/* The register location here is relative to the start of the URB + * data. It will get adjusted to be a real location before + * generate_code() time. + */ +struct brw_reg +fs_visitor::interp_reg(int location, int channel) +{ + int regnr = location * 2 + channel / 2; + int stride = (channel & 1) * 4; + + return brw_vec1_grf(regnr, stride); +} + +/** Emits the interpolation for the varying inputs. */ +void +fs_visitor::emit_interpolation() +{ + struct brw_reg g1_uw = retype(brw_vec1_grf(1, 0), BRW_REGISTER_TYPE_UW); + /* For now, the source regs for the setup URB data will be unset, + * since we don't know until codegen how many push constants we'll + * use, and therefore what the setup URB offset is. + */ + fs_reg src_reg = reg_undef; + + /* Compute the pixel centers. */ + this->pixel_x = fs_reg(this, glsl_type::uint_type); + this->pixel_y = fs_reg(this, glsl_type::uint_type); + emit(fs_inst(BRW_OPCODE_ADD, + this->pixel_x, + fs_reg(stride(suboffset(g1_uw, 4), 2, 4, 0)), + fs_reg(brw_imm_v(0x10101010)))); + emit(fs_inst(BRW_OPCODE_ADD, + this->pixel_y, + fs_reg(stride(suboffset(g1_uw, 5), 2, 4, 0)), + fs_reg(brw_imm_v(0x11001100)))); + + /* Compute the offsets from vertex 0 to the pixel centers */ + this->delta_x = fs_reg(this, glsl_type::float_type); + this->delta_y = fs_reg(this, glsl_type::float_type); + emit(fs_inst(BRW_OPCODE_ADD, + this->delta_x, + this->pixel_x, + fs_reg(negate(brw_vec1_grf(1, 0))))); + emit(fs_inst(BRW_OPCODE_ADD, + this->delta_y, + this->pixel_y, + fs_reg(brw_vec1_grf(1, 1)))); + + /* Compute wpos. Unlike many other varying inputs, we usually need it + * to produce 1/w, and the varying variable wouldn't show up. + */ + fs_reg wpos = fs_reg(this, glsl_type::vec4_type); + this->interp_attrs[FRAG_ATTRIB_WPOS] = wpos; + emit(fs_inst(BRW_OPCODE_MOV, wpos, this->pixel_x)); /* FINISHME: ARB_fcc */ + wpos.reg_offset++; + emit(fs_inst(BRW_OPCODE_MOV, wpos, this->pixel_y)); /* FINISHME: ARB_fcc */ + wpos.reg_offset++; + emit(fs_inst(FS_OPCODE_LINTERP, wpos, this->delta_x, this->delta_y, + interp_reg(FRAG_ATTRIB_WPOS, 2))); + wpos.reg_offset++; + emit(fs_inst(FS_OPCODE_LINTERP, wpos, this->delta_x, this->delta_y, + interp_reg(FRAG_ATTRIB_WPOS, 3))); + /* Compute the pixel W value from wpos.w. */ + this->pixel_w = fs_reg(this, glsl_type::float_type); + emit(fs_inst(FS_OPCODE_RCP, this->pixel_w, wpos)); + + /* FINISHME: gl_FrontFacing */ + + foreach_iter(exec_list_iterator, iter, *this->shader->ir) { + ir_instruction *ir = (ir_instruction *)iter.get(); + ir_variable *var = ir->as_variable(); + + if (!var) + continue; + + if (var->mode != ir_var_in) + continue; + + /* If it's already set up (WPOS), skip. */ + if (var->location == 0) + continue; + + emit_pinterp(var->location); + } +} + +void +fs_visitor::emit_pinterp(int location) +{ + fs_reg interp_attr = fs_reg(this, glsl_type::vec4_type); + this->interp_attrs[location] = interp_attr; + + for (unsigned int i = 0; i < 4; i++) { + struct brw_reg interp = interp_reg(location, i); + emit(fs_inst(FS_OPCODE_LINTERP, + interp_attr, + this->delta_x, + this->delta_y, + fs_reg(interp))); + interp_attr.reg_offset++; + } + interp_attr.reg_offset -= 4; + + for (unsigned int i = 0; i < 4; i++) { + emit(fs_inst(BRW_OPCODE_MUL, + interp_attr, + interp_attr, + this->pixel_w)); + interp_attr.reg_offset++; + } +} + void fs_visitor::emit_fb_writes() { @@ -926,19 +1120,129 @@ fs_visitor::generate_fb_write(fs_inst *inst) eot); } +void +fs_visitor::generate_linterp(fs_inst *inst, + struct brw_reg dst, struct brw_reg *src) +{ + struct brw_reg delta_x = src[0]; + struct brw_reg delta_y = src[1]; + struct brw_reg interp = src[2]; + + if (brw->has_pln && + delta_y.nr == delta_x.nr + 1 && + (intel->gen >= 6 || (delta_x.nr & 1) == 0)) { + brw_PLN(p, dst, interp, delta_x); + } else { + brw_LINE(p, brw_null_reg(), interp, delta_x); + brw_MAC(p, dst, suboffset(interp, 1), delta_y); + } +} + +void +fs_visitor::generate_math(fs_inst *inst, + struct brw_reg dst, struct brw_reg *src) +{ + int op; + + switch (inst->opcode) { + case FS_OPCODE_RCP: + op = BRW_MATH_FUNCTION_INV; + break; + case FS_OPCODE_RSQ: + op = BRW_MATH_FUNCTION_RSQ; + break; + case FS_OPCODE_SQRT: + op = BRW_MATH_FUNCTION_SQRT; + break; + case FS_OPCODE_EXP2: + op = BRW_MATH_FUNCTION_EXP; + break; + case FS_OPCODE_LOG2: + op = BRW_MATH_FUNCTION_LOG; + break; + case FS_OPCODE_POW: + op = BRW_MATH_FUNCTION_POW; + break; + case FS_OPCODE_SIN: + op = BRW_MATH_FUNCTION_SIN; + break; + case FS_OPCODE_COS: + op = BRW_MATH_FUNCTION_COS; + break; + default: + assert(!"not reached: unknown math function"); + op = 0; + break; + } + + brw_MOV(p, brw_message_reg(2), src[0]); + if (inst->opcode == FS_OPCODE_POW) { + brw_MOV(p, brw_message_reg(3), src[1]); + } + + brw_math(p, dst, + op, + inst->saturate ? BRW_MATH_SATURATE_SATURATE : + BRW_MATH_SATURATE_NONE, + 2, brw_null_reg(), + BRW_MATH_DATA_VECTOR, + BRW_MATH_PRECISION_FULL); +} + static void trivial_assign_reg(int header_size, fs_reg *reg) { if (reg->file == GRF && reg->reg != 0) { - reg->hw_reg = header_size + reg->reg + reg->reg_offset; + reg->hw_reg = header_size + reg->reg - 1 + reg->reg_offset; reg->reg = 0; } } +void +fs_visitor::assign_urb_setup() +{ + int urb_start = c->key.nr_payload_regs; /* FINISHME: push constants */ + int interp_reg_nr[FRAG_ATTRIB_MAX]; + + c->prog_data.urb_read_length = 0; + + /* Figure out where each of the incoming setup attributes lands. */ + for (unsigned int i = 0; i < FRAG_ATTRIB_MAX; i++) { + interp_reg_nr[i] = -1; + + if (i != FRAG_ATTRIB_WPOS && + !(brw->fragment_program->Base.InputsRead & BITFIELD64_BIT(i))) + continue; + + /* Each attribute is 4 setup channels, each of which is half a reg. */ + interp_reg_nr[i] = urb_start + c->prog_data.urb_read_length; + c->prog_data.urb_read_length += 2; + } + + /* Map the register numbers for FS_OPCODE_LINTERP so that it uses + * the correct setup input. + */ + foreach_iter(exec_list_iterator, iter, this->instructions) { + fs_inst *inst = (fs_inst *)iter.get(); + + if (inst->opcode != FS_OPCODE_LINTERP) + continue; + + assert(inst->src[2].file == FIXED_HW_REG); + + int location = inst->src[2].fixed_hw_reg.nr / 2; + assert(interp_reg_nr[location] != -1); + inst->src[2].fixed_hw_reg.nr = (interp_reg_nr[location] + + (inst->src[2].fixed_hw_reg.nr & 1)); + } + + this->first_non_payload_grf = urb_start + c->prog_data.urb_read_length; +} + void fs_visitor::assign_regs() { - int header_size = 2; /* FINISHME: header */ + int header_size = this->first_non_payload_grf; int last_grf = 0; /* FINISHME: trivial assignment of register numbers */ @@ -957,50 +1261,60 @@ fs_visitor::assign_regs() this->grf_used = last_grf; } +static struct brw_reg brw_reg_from_fs_reg(fs_reg *reg) +{ + struct brw_reg brw_reg; + + switch (reg->file) { + case GRF: + case ARF: + case MRF: + brw_reg = brw_vec8_reg(reg->file, + reg->hw_reg, 0); + brw_reg = retype(brw_reg, reg->type); + break; + case IMM: + switch (reg->type) { + case BRW_REGISTER_TYPE_F: + brw_reg = brw_imm_f(reg->imm.f); + break; + case BRW_REGISTER_TYPE_D: + brw_reg = brw_imm_f(reg->imm.i); + break; + case BRW_REGISTER_TYPE_UD: + brw_reg = brw_imm_f(reg->imm.u); + break; + default: + assert(!"not reached"); + break; + } + break; + case FIXED_HW_REG: + brw_reg = reg->fixed_hw_reg; + break; + case BAD_FILE: + /* Probably unused. */ + brw_reg = brw_null_reg(); + } + if (reg->abs) + brw_reg = brw_abs(brw_reg); + if (reg->negate) + brw_reg = negate(brw_reg); + + return brw_reg; +} + void fs_visitor::generate_code() { - this->grf_used = 2; /* header */ - foreach_iter(exec_list_iterator, iter, this->instructions) { fs_inst *inst = (fs_inst *)iter.get(); - struct brw_reg src[2], dst; - - for (unsigned int i = 0; i < 2; i++) { - switch (inst->src[i].file) { - case GRF: - case ARF: - case MRF: - src[i] = brw_vec8_reg(inst->src[i].file, - inst->src[i].hw_reg, 0); - src[i] = retype(src[i], inst->src[i].type); - break; - case IMM: - switch (inst->src[i].type) { - case BRW_REGISTER_TYPE_F: - src[i] = brw_imm_f(inst->src[i].imm.f); - break; - case BRW_REGISTER_TYPE_D: - src[i] = brw_imm_f(inst->src[i].imm.i); - break; - case BRW_REGISTER_TYPE_UD: - src[i] = brw_imm_f(inst->src[i].imm.u); - break; - default: - assert(!"not reached"); - break; - } - break; - case BAD_FILE: - /* Probably unused. */ - src[i] = brw_null_reg(); - } - if (inst->src[i].abs) - src[i] = brw_abs(src[i]); - if (inst->src[i].negate) - src[i] = negate(src[i]); + struct brw_reg src[3], dst; + + for (unsigned int i = 0; i < 3; i++) { + src[i] = brw_reg_from_fs_reg(&inst->src[i]); } - dst = brw_vec8_reg(inst->dst.file, inst->dst.hw_reg, 0); + dst = brw_reg_from_fs_reg(&inst->dst); brw_set_conditionalmod(p, inst->conditional_mod); brw_set_predicate_control(p, inst->predicated); @@ -1009,6 +1323,25 @@ fs_visitor::generate_code() case BRW_OPCODE_MOV: brw_MOV(p, dst, src[0]); break; + case BRW_OPCODE_ADD: + brw_ADD(p, dst, src[0], src[1]); + break; + case BRW_OPCODE_MUL: + brw_MUL(p, dst, src[0], src[1]); + break; + case FS_OPCODE_RCP: + case FS_OPCODE_RSQ: + case FS_OPCODE_SQRT: + case FS_OPCODE_EXP2: + case FS_OPCODE_LOG2: + case FS_OPCODE_POW: + case FS_OPCODE_SIN: + case FS_OPCODE_COS: + generate_math(inst, dst, src); + break; + case FS_OPCODE_LINTERP: + generate_linterp(inst, dst, src); + break; case FS_OPCODE_FB_WRITE: generate_fb_write(inst); break; @@ -1063,6 +1396,8 @@ brw_wm_fs_emit(struct brw_context *brw, struct brw_wm_compile *c) if (0) { v.emit_dummy_fs(); } else { + v.emit_interpolation(); + /* Generate FS IR for main(). (the visitor only descends into * functions called "main"). */ @@ -1072,6 +1407,7 @@ brw_wm_fs_emit(struct brw_context *brw, struct brw_wm_compile *c) return GL_FALSE; v.emit_fb_writes(); + v.assign_urb_setup(); v.assign_regs(); } @@ -1086,7 +1422,6 @@ brw_wm_fs_emit(struct brw_context *brw, struct brw_wm_compile *c) c->prog_data.nr_params = 0; /* FINISHME */ c->prog_data.first_curbe_grf = c->key.nr_payload_regs; - c->prog_data.urb_read_length = 1; /* FINISHME: attrs */ c->prog_data.curb_read_length = 0; /* FINISHME */ c->prog_data.total_grf = v.grf_used; c->prog_data.total_scratch = 0; -- cgit v1.2.3 From 7268bd82f60b1c9642a48dcfff6d77b2897222cd Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 26 Aug 2010 14:09:54 -0700 Subject: i965: Use the implied move in brw_math() in the new FS. --- src/mesa/drivers/dri/i965/brw_fs.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp index 57c5f55341..f856ee79fa 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -1175,7 +1175,6 @@ fs_visitor::generate_math(fs_inst *inst, break; } - brw_MOV(p, brw_message_reg(2), src[0]); if (inst->opcode == FS_OPCODE_POW) { brw_MOV(p, brw_message_reg(3), src[1]); } @@ -1184,7 +1183,7 @@ fs_visitor::generate_math(fs_inst *inst, op, inst->saturate ? BRW_MATH_SATURATE_SATURATE : BRW_MATH_SATURATE_NONE, - 2, brw_null_reg(), + 2, src[0], BRW_MATH_DATA_VECTOR, BRW_MATH_PRECISION_FULL); } -- cgit v1.2.3 From 363d0f6774b4c6b825f5b903284da1cd51a91986 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 26 Aug 2010 14:42:06 -0700 Subject: i965: Add GLSL IR-level source annotation and comments to new FS debug. This should make debugging way easier, as now we have context for reading large programs. --- src/mesa/drivers/dri/i965/brw_fs.cpp | 88 ++++++++++++++++++++++++++++++++++-- 1 file changed, 83 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp index f856ee79fa..640f797e9e 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -292,7 +292,7 @@ public: { void *node; - node = talloc_size(ctx, size); + node = talloc_zero_size(ctx, size); assert(node != NULL); return node; @@ -345,6 +345,13 @@ public: bool saturate; bool predicated; int conditional_mod; /**< BRW_CONDITIONAL_* */ + + /** @{ + * Annotation for the generated IR. One of the two can be set. + */ + ir_instruction *ir; + const char *annotation; + /** @} */ }; class fs_visitor : public ir_visitor @@ -369,6 +376,10 @@ public: this->frag_data = NULL; this->frag_depth = NULL; this->first_non_payload_grf = 0; + + this->current_annotation = NULL; + this->annotation_string = NULL; + this->annotation_ir = NULL; } ~fs_visitor() { @@ -424,6 +435,13 @@ public: ir_variable *frag_color, *frag_data, *frag_depth; int first_non_payload_grf; + /** @{ debug annotation info */ + const char *current_annotation; + ir_instruction *base_ir; + const char **annotation_string; + ir_instruction **annotation_ir; + /** @} */ + bool fail; /* Result of last visit() method. */ @@ -912,6 +930,7 @@ fs_visitor::visit(ir_function *ir) foreach_iter(exec_list_iterator, iter, sig->body) { ir_instruction *ir = (ir_instruction *)iter.get(); + this->base_ir = ir; ir->accept(this); } @@ -931,6 +950,9 @@ fs_visitor::emit(fs_inst inst) fs_inst *list_inst = new(mem_ctx) fs_inst; *list_inst = inst; + list_inst->annotation = this->current_annotation; + list_inst->ir = this->base_ir; + this->instructions.push_tail(list_inst); return list_inst; @@ -984,7 +1006,7 @@ fs_visitor::emit_interpolation() */ fs_reg src_reg = reg_undef; - /* Compute the pixel centers. */ + this->current_annotation = "compute pixel centers"; this->pixel_x = fs_reg(this, glsl_type::uint_type); this->pixel_y = fs_reg(this, glsl_type::uint_type); emit(fs_inst(BRW_OPCODE_ADD, @@ -996,7 +1018,7 @@ fs_visitor::emit_interpolation() fs_reg(stride(suboffset(g1_uw, 5), 2, 4, 0)), fs_reg(brw_imm_v(0x11001100)))); - /* Compute the offsets from vertex 0 to the pixel centers */ + this->current_annotation = "compute pixel deltas from v0"; this->delta_x = fs_reg(this, glsl_type::float_type); this->delta_y = fs_reg(this, glsl_type::float_type); emit(fs_inst(BRW_OPCODE_ADD, @@ -1008,6 +1030,7 @@ fs_visitor::emit_interpolation() this->pixel_y, fs_reg(brw_vec1_grf(1, 1)))); + this->current_annotation = "compute pos.w and 1/pos.w"; /* Compute wpos. Unlike many other varying inputs, we usually need it * to produce 1/w, and the varying variable wouldn't show up. */ @@ -1042,8 +1065,14 @@ fs_visitor::emit_interpolation() if (var->location == 0) continue; + this->current_annotation = talloc_asprintf(this->mem_ctx, + "interpolate %s " + "(FRAG_ATTRIB[%d])", + var->name, + var->location); emit_pinterp(var->location); } + this->current_annotation = NULL; } void @@ -1075,6 +1104,8 @@ fs_visitor::emit_pinterp(int location) void fs_visitor::emit_fb_writes() { + this->current_annotation = "FB write"; + assert(this->frag_color || !"FINISHME: MRT"); fs_reg color = *(variable_storage(this->frag_color)); @@ -1088,6 +1119,8 @@ fs_visitor::emit_fb_writes() emit(fs_inst(FS_OPCODE_FB_WRITE, fs_reg(0), fs_reg(0))); + + this->current_annotation = NULL; } void @@ -1306,6 +1339,9 @@ static struct brw_reg brw_reg_from_fs_reg(fs_reg *reg) void fs_visitor::generate_code() { + unsigned int annotation_len = 0; + int last_native_inst = 0; + foreach_iter(exec_list_iterator, iter, this->instructions) { fs_inst *inst = (fs_inst *)iter.get(); struct brw_reg src[3], dst; @@ -1347,6 +1383,27 @@ fs_visitor::generate_code() default: assert(!"not reached"); } + + if (annotation_len < p->nr_insn) { + annotation_len *= 2; + if (annotation_len < 16) + annotation_len = 16; + + this->annotation_string = talloc_realloc(this->mem_ctx, + annotation_string, + const char *, + annotation_len); + this->annotation_ir = talloc_realloc(this->mem_ctx, + annotation_ir, + ir_instruction *, + annotation_len); + } + + for (unsigned int i = last_native_inst; i < p->nr_insn; i++) { + this->annotation_string[i] = inst->annotation; + this->annotation_ir[i] = inst->ir; + } + last_native_inst = p->nr_insn; } } @@ -1400,7 +1457,11 @@ brw_wm_fs_emit(struct brw_context *brw, struct brw_wm_compile *c) /* Generate FS IR for main(). (the visitor only descends into * functions called "main"). */ - visit_exec_list(shader->ir, &v); + foreach_iter(exec_list_iterator, iter, *shader->ir) { + ir_instruction *ir = (ir_instruction *)iter.get(); + v.base_ir = ir; + ir->accept(&v); + } if (v.fail) return GL_FALSE; @@ -1413,9 +1474,26 @@ brw_wm_fs_emit(struct brw_context *brw, struct brw_wm_compile *c) v.generate_code(); if (INTEL_DEBUG & DEBUG_WM) { + const char *last_annotation_string = NULL; + ir_instruction *last_annotation_ir = NULL; + printf("Native code for fragment shader %d:\n", prog->Name); - for (unsigned int i = 0; i < p->nr_insn; i++) + for (unsigned int i = 0; i < p->nr_insn; i++) { + if (last_annotation_ir != v.annotation_ir[i]) { + last_annotation_ir = v.annotation_ir[i]; + if (last_annotation_ir) { + printf(" "); + last_annotation_ir->print(); + printf("\n"); + } + } + if (last_annotation_string != v.annotation_string[i]) { + last_annotation_string = v.annotation_string[i]; + if (last_annotation_string) + printf(" %s\n", last_annotation_string); + } brw_disasm(stdout, &p->store[i], intel->gen); + } printf("\n"); } -- cgit v1.2.3 From fa2deb3ddc8dc9e3eedf7f3dc1d2d2945a95f79b Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 26 Aug 2010 15:43:00 -0700 Subject: i965: Hack in avoidance of c++ reserved keyword in libdrm. I'm also fixing this upstream in libdrm, but this avoids new libdrm dependency for the moment. --- src/mesa/drivers/dri/i965/brw_fs.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp index 640f797e9e..11c79b11bf 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -26,6 +26,14 @@ */ extern "C" { + +#include +/* Evil hack for using libdrm in a c++ compiler. */ +#define virtual virt +#include "i915_drm.h" +#include "intel_bufmgr.h" +#undef virtual + #include "main/macros.h" #include "main/shaderobj.h" #include "program/prog_parameter.h" -- cgit v1.2.3 From 1a3de23509b8170ee87223dc63e992e195a04de5 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 26 Aug 2010 16:59:55 -0700 Subject: i965: Fix up and actually enable the NewShader and NewShaderProgram hooks. --- src/mesa/drivers/dri/i965/brw_fs.cpp | 9 ++++++--- src/mesa/drivers/dri/i965/brw_program.c | 2 ++ 2 files changed, 8 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp index 11c79b11bf..4a313a2e10 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -81,9 +81,9 @@ brw_new_shader(GLcontext *ctx, GLuint name, GLuint type) struct brw_shader *shader; shader = talloc_zero(NULL, struct brw_shader); - shader->base.Type = type; - shader->base.Name = name; if (shader) { + shader->base.Type = type; + shader->base.Name = name; _mesa_init_shader(ctx, &shader->base); } @@ -96,6 +96,7 @@ brw_new_shader_program(GLcontext *ctx, GLuint name) struct brw_shader_program *prog; prog = talloc_zero(NULL, struct brw_shader_program); if (prog) { + prog->base.Name = name; _mesa_init_shader_program(ctx, &prog->base); } return &prog->base; @@ -123,6 +124,8 @@ brw_link_shader(GLcontext *ctx, struct gl_shader_program *prog) void *mem_ctx = talloc_new(NULL); bool progress; + if (shader->ir) + talloc_free(shader->ir); shader->ir = new(shader) exec_list; clone_ir_list(mem_ctx, shader->ir, shader->base.ir); @@ -140,7 +143,7 @@ brw_link_shader(GLcontext *ctx, struct gl_shader_program *prog) progress = do_common_optimization(shader->ir, true) || progress; } while (progress); - reparent_ir(shader->ir, shader); + reparent_ir(shader->ir, shader->ir); talloc_free(mem_ctx); } } diff --git a/src/mesa/drivers/dri/i965/brw_program.c b/src/mesa/drivers/dri/i965/brw_program.c index b6cf6c000e..bc152204a4 100644 --- a/src/mesa/drivers/dri/i965/brw_program.c +++ b/src/mesa/drivers/dri/i965/brw_program.c @@ -232,6 +232,8 @@ void brwInitFragProgFuncs( struct dd_function_table *functions ) functions->IsProgramNative = brwIsProgramNative; functions->ProgramStringNotify = brwProgramStringNotify; + functions->NewShader = brw_new_shader; + functions->NewShaderProgram = brw_new_shader_program; functions->CompileShader = brw_compile_shader; functions->LinkShader = brw_link_shader; } -- cgit v1.2.3 From 3dff682b6595c8771655307ed00bd8844f22238c Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 26 Aug 2010 17:04:30 -0700 Subject: i965: Abort on gl_FragDepth in the new FS backend for now. It hangs the GPU due to FB_WRITE handling being incomplete. There are bigger issues to handle first. --- src/mesa/drivers/dri/i965/brw_fs.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp index 4a313a2e10..af9754064c 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -530,6 +530,7 @@ fs_visitor::visit(ir_variable *ir) this->frag_data = ir; } else if (strcmp(ir->name, "gl_FragDepth") == 0) { this->frag_depth = ir; + assert(!"FINISHME: this hangs currently."); } if (ir->mode == ir_var_in) { -- cgit v1.2.3 From a4d97d3726046fca66f3dbcfbe7b276c5eb80b3b Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 26 Aug 2010 16:39:41 -0700 Subject: i965: Add preliminary support for uniforms to the new FS backend. +269 piglits --- src/mesa/drivers/dri/i965/brw_fs.cpp | 63 +++++++++++++++++++++++++++++++----- 1 file changed, 55 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp index af9754064c..a73509f258 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -54,7 +54,8 @@ enum register_file { GRF = BRW_GENERAL_REGISTER_FILE, MRF = BRW_MESSAGE_REGISTER_FILE, IMM = BRW_IMMEDIATE_VALUE, - FIXED_HW_REG, + FIXED_HW_REG, /* a struct brw_reg */ + UNIFORM, /* prog_data->params[hw_reg] */ BAD_FILE }; @@ -419,6 +420,7 @@ public: void visit(ir_function_signature *ir); fs_inst *emit(fs_inst inst); + void assign_curb_setup(); void assign_urb_setup(); void assign_regs(); void generate_code(); @@ -521,9 +523,6 @@ fs_visitor::visit(ir_variable *ir) { fs_reg *reg = NULL; - /* FINISHME */ - assert(ir->mode != ir_var_uniform); - if (strcmp(ir->name, "gl_FragColor") == 0) { this->frag_color = ir; } else if (strcmp(ir->name, "gl_FragData") == 0) { @@ -537,6 +536,27 @@ fs_visitor::visit(ir_variable *ir) reg = &this->interp_attrs[ir->location]; } + if (ir->mode == ir_var_uniform) { + const float *vec_values; + int param_index = c->prog_data.nr_params; + + /* FINISHME: This is wildly incomplete. */ + assert(ir->type->is_scalar() || ir->type->is_vector()); + + const struct gl_program *fp = &this->brw->fragment_program->Base; + /* Our support for uniforms is piggy-backed on the struct + * gl_fragment_program, because that's where the values actually + * get stored, rather than in some global gl_shader_program uniform + * store. + */ + vec_values = fp->Parameters->ParameterValues[ir->location]; + for (unsigned int i = 0; i < ir->type->vector_elements; i++) { + c->prog_data.param[c->prog_data.nr_params++] = &vec_values[i]; + } + + reg = new(this->mem_ctx) fs_reg(UNIFORM, param_index); + } + if (!reg) reg = new(this->mem_ctx) fs_reg(this, ir->type); @@ -1242,10 +1262,34 @@ trivial_assign_reg(int header_size, fs_reg *reg) } } +void +fs_visitor::assign_curb_setup() +{ + c->prog_data.first_curbe_grf = c->key.nr_payload_regs; + c->prog_data.curb_read_length = ALIGN(c->prog_data.nr_params, 8) / 8; + + /* Map the offsets in the UNIFORM file to fixed HW regs. */ + foreach_iter(exec_list_iterator, iter, this->instructions) { + fs_inst *inst = (fs_inst *)iter.get(); + + for (unsigned int i = 0; i < 3; i++) { + if (inst->src[i].file == UNIFORM) { + int constant_nr = inst->src[i].hw_reg + inst->src[i].reg_offset; + struct brw_reg brw_reg; + + brw_reg = brw_vec1_grf(c->prog_data.first_curbe_grf + + constant_nr / 8, + constant_nr % 8); + inst->src[i] = fs_reg(brw_reg); + } + } + } +} + void fs_visitor::assign_urb_setup() { - int urb_start = c->key.nr_payload_regs; /* FINISHME: push constants */ + int urb_start = c->prog_data.first_curbe_grf + c->prog_data.curb_read_length; int interp_reg_nr[FRAG_ATTRIB_MAX]; c->prog_data.urb_read_length = 0; @@ -1339,6 +1383,11 @@ static struct brw_reg brw_reg_from_fs_reg(fs_reg *reg) case BAD_FILE: /* Probably unused. */ brw_reg = brw_null_reg(); + break; + case UNIFORM: + assert(!"not reached"); + brw_reg = brw_null_reg(); + break; } if (reg->abs) brw_reg = brw_abs(brw_reg); @@ -1479,6 +1528,7 @@ brw_wm_fs_emit(struct brw_context *brw, struct brw_wm_compile *c) return GL_FALSE; v.emit_fb_writes(); + v.assign_curb_setup(); v.assign_urb_setup(); v.assign_regs(); } @@ -1509,9 +1559,6 @@ brw_wm_fs_emit(struct brw_context *brw, struct brw_wm_compile *c) printf("\n"); } - c->prog_data.nr_params = 0; /* FINISHME */ - c->prog_data.first_curbe_grf = c->key.nr_payload_regs; - c->prog_data.curb_read_length = 0; /* FINISHME */ c->prog_data.total_grf = v.grf_used; c->prog_data.total_scratch = 0; -- cgit v1.2.3 From e57437ccd6814ffd4534fd46512afeb0b9e06eed Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Tue, 24 Aug 2010 10:29:33 +1000 Subject: r600g: add DPH support. --- src/gallium/drivers/r600/r600_shader.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/r600_shader.c b/src/gallium/drivers/r600/r600_shader.c index f0b7df5a6f..6195bd5332 100644 --- a/src/gallium/drivers/r600/r600_shader.c +++ b/src/gallium/drivers/r600/r600_shader.c @@ -1265,6 +1265,13 @@ static int tgsi_dp(struct r600_shader_ctx *ctx) alu.src[0].chan = alu.src[1].chan = 0; } break; + case TGSI_OPCODE_DPH: + if (i == 3) { + alu.src[0].sel = V_SQ_ALU_SRC_1; + alu.src[0].chan = 0; + alu.src[0].neg = 0; + } + break; default: break; } @@ -1660,7 +1667,7 @@ static struct r600_shader_tgsi_instruction r600_shader_tgsi_instruction[] = { {32, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported}, {TGSI_OPCODE_ABS, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV, tgsi_op2}, {TGSI_OPCODE_RCC, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported}, - {TGSI_OPCODE_DPH, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported}, + {TGSI_OPCODE_DPH, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_DOT4, tgsi_dp}, {TGSI_OPCODE_COS, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_COS, tgsi_trig}, {TGSI_OPCODE_DDX, 0, SQ_TEX_INST_GET_GRADIENTS_H, tgsi_tex}, {TGSI_OPCODE_DDY, 0, SQ_TEX_INST_GET_GRADIENTS_V, tgsi_tex}, -- cgit v1.2.3 From 36d91be75ea9b79878fdf4b789ea022d781e87f4 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Tue, 24 Aug 2010 11:47:56 +1000 Subject: r600g: add exp support in theory. though it isn't passing the test, and this instruction is pure bonghits. --- src/gallium/drivers/r600/r600_shader.c | 106 ++++++++++++++++++++++++++++++++- 1 file changed, 105 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/r600_shader.c b/src/gallium/drivers/r600/r600_shader.c index 6195bd5332..5b43a1303b 100644 --- a/src/gallium/drivers/r600/r600_shader.c +++ b/src/gallium/drivers/r600/r600_shader.c @@ -1627,6 +1627,110 @@ static int tgsi_xpd(struct r600_shader_ctx *ctx) return 0; } +static int tgsi_exp(struct r600_shader_ctx *ctx) +{ + struct tgsi_full_instruction *inst = &ctx->parse.FullToken.FullInstruction; + struct r600_bc_alu_src r600_src[3]; + struct r600_bc_alu alu; + uint32_t use_temp = 0; + int i, r; + + /* result.x = 2^floor(src); */ + if (inst->Dst[0].Register.WriteMask & 1) { + memset(&alu, 0, sizeof(struct r600_bc_alu)); + + alu.inst = V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FLOOR; + r = tgsi_src(ctx, &inst->Src[0], &alu.src[0]); + if (r) + return r; + + alu.src[0].chan = tgsi_chan(&inst->Src[0], 0); + + alu.dst.sel = ctx->temp_reg; + alu.dst.chan = 0; + alu.dst.write = 1; + alu.last = 1; + r = r600_bc_add_alu(ctx->bc, &alu); + if (r) + return r; + + alu.inst = V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_EXP_IEEE; + alu.src[0].sel = ctx->temp_reg; + alu.src[0].chan = 0; + + alu.dst.sel = ctx->temp_reg; + alu.dst.chan = 0; + alu.dst.write = 1; + alu.last = 1; + r = r600_bc_add_alu(ctx->bc, &alu); + if (r) + return r; + } + + /* result.y = tmp - floor(tmp); */ + if ((inst->Dst[0].Register.WriteMask >> 1) & 1) { + memset(&alu, 0, sizeof(struct r600_bc_alu)); + + alu.inst = V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FRACT; + alu.src[0] = r600_src[0]; + r = tgsi_src(ctx, &inst->Src[0], &alu.src[0]); + if (r) + return r; + alu.src[0].chan = tgsi_chan(&inst->Src[0], 0); + + alu.dst.sel = ctx->temp_reg; +// r = tgsi_dst(ctx, &inst->Dst[0], i, &alu.dst); +// if (r) +// return r; + alu.dst.write = 1; + alu.dst.chan = 1; + + alu.last = 1; + + r = r600_bc_add_alu(ctx->bc, &alu); + if (r) + return r; + } + + /* result.z = RoughApprox2ToX(tmp);*/ + if ((inst->Dst[0].Register.WriteMask >> 2) & 0x1) { + memset(&alu, 0, sizeof(struct r600_bc_alu)); + alu.inst = V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_EXP_IEEE; + r = tgsi_src(ctx, &inst->Src[0], &alu.src[0]); + if (r) + return r; + alu.src[0].chan = tgsi_chan(&inst->Src[0], 0); + + alu.dst.sel = ctx->temp_reg; + alu.dst.write = 1; + alu.dst.chan = 2; + + alu.last = 1; + + r = r600_bc_add_alu(ctx->bc, &alu); + if (r) + return r; + + } + + /* result.w = 1.0;*/ + if ((inst->Dst[0].Register.WriteMask >> 3) & 0x1) { + memset(&alu, 0, sizeof(struct r600_bc_alu)); + + alu.inst = V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV; + alu.src[0].sel = V_SQ_ALU_SRC_1; + alu.src[0].chan = 0; + + alu.dst.sel = ctx->temp_reg; + alu.dst.chan = 3; + alu.dst.write = 1; + alu.last = 1; + r = r600_bc_add_alu(ctx->bc, &alu); + if (r) + return r; + } + return tgsi_helper_copy(ctx, inst); +} static struct r600_shader_tgsi_instruction r600_shader_tgsi_instruction[] = { {TGSI_OPCODE_ARL, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported}, @@ -1634,7 +1738,7 @@ static struct r600_shader_tgsi_instruction r600_shader_tgsi_instruction[] = { {TGSI_OPCODE_LIT, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_lit}, {TGSI_OPCODE_RCP, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RECIP_IEEE, tgsi_trans_srcx_replicate}, {TGSI_OPCODE_RSQ, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RECIPSQRT_IEEE, tgsi_trans_srcx_replicate}, - {TGSI_OPCODE_EXP, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported}, + {TGSI_OPCODE_EXP, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_exp}, {TGSI_OPCODE_LOG, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported}, {TGSI_OPCODE_MUL, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MUL, tgsi_op2}, {TGSI_OPCODE_ADD, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_ADD, tgsi_op2}, -- cgit v1.2.3 From d8fb13bae30b6ff214c5d5158b9bcaf430f56b43 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Wed, 25 Aug 2010 16:02:38 +1000 Subject: r600g: optimise op2 and swapped op2 emission. this makes op2 emission smaller, since it skips instructions that don't write to the dst. not sure if this could have unwanted side effects but try it and see. --- src/gallium/drivers/r600/r600_shader.c | 85 +++++++++++++++------------------- 1 file changed, 37 insertions(+), 48 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/r600_shader.c b/src/gallium/drivers/r600/r600_shader.c index 5b43a1303b..1470bb5072 100644 --- a/src/gallium/drivers/r600/r600_shader.c +++ b/src/gallium/drivers/r600/r600_shader.c @@ -642,30 +642,44 @@ static int tgsi_split_constant(struct r600_shader_ctx *ctx, struct r600_bc_alu_s return 0; } -static int tgsi_op2(struct r600_shader_ctx *ctx) +static int tgsi_op2_s(struct r600_shader_ctx *ctx, int swap) { struct tgsi_full_instruction *inst = &ctx->parse.FullToken.FullInstruction; struct r600_bc_alu_src r600_src[3]; struct r600_bc_alu alu; int i, j, r; + int lasti = 0; + + for (i = 0; i < 4; i++) { + if (inst->Dst[0].Register.WriteMask & (1 << i)) { + lasti = i; + } + } r = tgsi_split_constant(ctx, r600_src); if (r) return r; - for (i = 0; i < 4; i++) { + for (i = 0; i < lasti + 1; i++) { + if (!(inst->Dst[0].Register.WriteMask & (1 << i))) + continue; + memset(&alu, 0, sizeof(struct r600_bc_alu)); - if (!(inst->Dst[0].Register.WriteMask & (1 << i))) { - alu.inst = V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP; - alu.dst.chan = i; - } else { - alu.inst = ctx->inst_info->r600_opcode; + r = tgsi_dst(ctx, &inst->Dst[0], i, &alu.dst); + if (r) + return r; + + alu.inst = ctx->inst_info->r600_opcode; + if (!swap) { for (j = 0; j < inst->Instruction.NumSrcRegs; j++) { alu.src[j] = r600_src[j]; alu.src[j].chan = tgsi_chan(&inst->Src[j], i); } - r = tgsi_dst(ctx, &inst->Dst[0], i, &alu.dst); - if (r) - return r; + } else { + alu.src[0] = r600_src[1]; + alu.src[0].chan = tgsi_chan(&inst->Src[1], i); + + alu.src[1] = r600_src[0]; + alu.src[1].chan = tgsi_chan(&inst->Src[0], i); } /* handle some special cases */ switch (ctx->inst_info->tgsi_opcode) { @@ -678,7 +692,7 @@ static int tgsi_op2(struct r600_shader_ctx *ctx) default: break; } - if (i == 3) { + if (i == lasti) { alu.last = 1; } r = r600_bc_add_alu(ctx->bc, &alu); @@ -688,6 +702,16 @@ static int tgsi_op2(struct r600_shader_ctx *ctx) return 0; } +static int tgsi_op2(struct r600_shader_ctx *ctx) +{ + return tgsi_op2_s(ctx, 0); +} + +static int tgsi_op2_swap(struct r600_shader_ctx *ctx) +{ + return tgsi_op2_s(ctx, 1); +} + /* * r600 - trunc to -PI..PI range * r700 - normalize by dividing by 2PI @@ -833,41 +857,6 @@ static int tgsi_kill(struct r600_shader_ctx *ctx) return 0; } -static int tgsi_slt(struct r600_shader_ctx *ctx) -{ - struct tgsi_full_instruction *inst = &ctx->parse.FullToken.FullInstruction; - struct r600_bc_alu_src r600_src[3]; - struct r600_bc_alu alu; - int i, r; - - r = tgsi_split_constant(ctx, r600_src); - if (r) - return r; - for (i = 0; i < 4; i++) { - memset(&alu, 0, sizeof(struct r600_bc_alu)); - if (!(inst->Dst[0].Register.WriteMask & (1 << i))) { - alu.inst = V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP; - alu.dst.chan = i; - } else { - alu.inst = ctx->inst_info->r600_opcode; - alu.src[1] = r600_src[0]; - alu.src[1].chan = tgsi_chan(&inst->Src[0], i); - alu.src[0] = r600_src[1]; - alu.src[0].chan = tgsi_chan(&inst->Src[1], i); - r = tgsi_dst(ctx, &inst->Dst[0], i, &alu.dst); - if (r) - return r; - } - if (i == 3) { - alu.last = 1; - } - r = r600_bc_add_alu(ctx->bc, &alu); - if (r) - return r; - } - return 0; -} - static int tgsi_lit(struct r600_shader_ctx *ctx) { struct tgsi_full_instruction *inst = &ctx->parse.FullToken.FullInstruction; @@ -1747,7 +1736,7 @@ static struct r600_shader_tgsi_instruction r600_shader_tgsi_instruction[] = { {TGSI_OPCODE_DST, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported}, {TGSI_OPCODE_MIN, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MIN, tgsi_op2}, {TGSI_OPCODE_MAX, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MAX, tgsi_op2}, - {TGSI_OPCODE_SLT, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETGT, tgsi_slt}, + {TGSI_OPCODE_SLT, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETGT, tgsi_op2_swap}, {TGSI_OPCODE_SGE, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETGE, tgsi_op2}, {TGSI_OPCODE_MAD, 1, V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_MULADD, tgsi_op3}, {TGSI_OPCODE_SUB, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_ADD, tgsi_op2}, @@ -1785,7 +1774,7 @@ static struct r600_shader_tgsi_instruction r600_shader_tgsi_instruction[] = { {TGSI_OPCODE_SFL, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported}, {TGSI_OPCODE_SGT, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETGT, tgsi_op2}, {TGSI_OPCODE_SIN, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SIN, tgsi_trig}, - {TGSI_OPCODE_SLE, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETGE, tgsi_slt}, + {TGSI_OPCODE_SLE, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETGE, tgsi_op2_swap}, {TGSI_OPCODE_SNE, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETNE, tgsi_op2}, {TGSI_OPCODE_STR, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported}, {TGSI_OPCODE_TEX, 0, SQ_TEX_INST_SAMPLE, tgsi_tex}, -- cgit v1.2.3 From a03d456f5a41926e39194de70b2d50776e64b8a2 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Wed, 25 Aug 2010 15:57:41 +1000 Subject: r600g: add initial if/else/endif support this adds handling for some more CF instructions and conditions also adds parameter for stack size emission These seem to pass on VS with the stack size hack but not on FS, TODO: fix FS + stack size calcs --- src/gallium/drivers/r600/r600_asm.c | 58 +++++++++++++++++--- src/gallium/drivers/r600/r600_asm.h | 21 +++++++- src/gallium/drivers/r600/r600_shader.c | 98 ++++++++++++++++++++++++++++++++-- src/gallium/drivers/r600/r600_sq.h | 5 ++ 4 files changed, 170 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/r600_asm.c b/src/gallium/drivers/r600/r600_asm.c index e6efae4c56..d83bb34648 100644 --- a/src/gallium/drivers/r600/r600_asm.c +++ b/src/gallium/drivers/r600/r600_asm.c @@ -128,7 +128,7 @@ int r600_bc_add_output(struct r600_bc *bc, const struct r600_bc_output *output) return 0; } -int r600_bc_add_alu(struct r600_bc *bc, const struct r600_bc_alu *alu) +int r600_bc_add_alu_type(struct r600_bc *bc, const struct r600_bc_alu *alu, int type) { struct r600_bc_alu *nalu = r600_bc_alu(); struct r600_bc_alu *lalu; @@ -140,7 +140,7 @@ int r600_bc_add_alu(struct r600_bc *bc, const struct r600_bc_alu *alu) nalu->nliteral = 0; /* cf can contains only alu or only vtx or only tex */ - if (bc->cf_last == NULL || bc->cf_last->inst != (V_SQ_CF_ALU_WORD1_SQ_CF_INST_ALU << 3) || + if (bc->cf_last == NULL || bc->cf_last->inst != (type << 3) || bc->force_add_cf) { /* at most 128 slots, one add alu can add 4 slots + 4 constant worst case */ r = r600_bc_add_cf(bc); @@ -148,7 +148,7 @@ int r600_bc_add_alu(struct r600_bc *bc, const struct r600_bc_alu *alu) free(nalu); return r; } - bc->cf_last->inst = V_SQ_CF_ALU_WORD1_SQ_CF_INST_ALU << 3; + bc->cf_last->inst = (type << 3); } if (alu->last && (bc->cf_last->ndw >> 1) >= 124) { bc->force_add_cf = 1; @@ -183,6 +183,11 @@ int r600_bc_add_alu(struct r600_bc *bc, const struct r600_bc_alu *alu) return 0; } +int r600_bc_add_alu(struct r600_bc *bc, const struct r600_bc_alu *alu) +{ + return r600_bc_add_alu_type(bc, alu, V_SQ_CF_ALU_WORD1_SQ_CF_INST_ALU); +} + int r600_bc_add_literal(struct r600_bc *bc, const u32 *value) { struct r600_bc_alu *alu; @@ -193,7 +198,13 @@ int r600_bc_add_literal(struct r600_bc *bc, const u32 *value) if (bc->cf_last->inst == V_SQ_CF_WORD1_SQ_CF_INST_TEX) { return 0; } - if (bc->cf_last->inst != (V_SQ_CF_ALU_WORD1_SQ_CF_INST_ALU << 3) || + if (bc->cf_last->inst == V_SQ_CF_WORD1_SQ_CF_INST_JUMP || + bc->cf_last->inst == V_SQ_CF_WORD1_SQ_CF_INST_ELSE || + bc->cf_last->inst == V_SQ_CF_WORD1_SQ_CF_INST_POP) { + return 0; + } + if (((bc->cf_last->inst != (V_SQ_CF_ALU_WORD1_SQ_CF_INST_ALU << 3)) && + (bc->cf_last->inst != (V_SQ_CF_ALU_WORD1_SQ_CF_INST_ALU_PUSH_BEFORE << 3))) || LIST_IS_EMPTY(&bc->cf_last->alu)) { R600_ERR("last CF is not ALU (%p)\n", bc->cf_last); return -EINVAL; @@ -262,6 +273,18 @@ int r600_bc_add_tex(struct r600_bc *bc, const struct r600_bc_tex *tex) return 0; } +int r600_bc_add_cfinst(struct r600_bc *bc, int inst) +{ + int r; + r = r600_bc_add_cf(bc); + if (r) + return r; + + bc->cf_last->cond = V_SQ_CF_COND_ACTIVE; + bc->cf_last->inst = inst; + return 0; +} + static int r600_bc_vtx_build(struct r600_bc *bc, struct r600_bc_vtx *vtx, unsigned id) { bc->bytecode[id++] = S_SQ_VTX_WORD0_BUFFER_ID(vtx->buffer_id) | @@ -342,7 +365,9 @@ static int r600_bc_alu_build(struct r600_bc *bc, struct r600_bc_alu *alu, unsign S_SQ_ALU_WORD1_OP2_SRC1_ABS(alu->src[1].abs) | S_SQ_ALU_WORD1_OP2_WRITE_MASK(alu->dst.write) | S_SQ_ALU_WORD1_OP2_ALU_INST(alu->inst) | - S_SQ_ALU_WORD1_BANK_SWIZZLE(0); + S_SQ_ALU_WORD1_BANK_SWIZZLE(0) | + S_SQ_ALU_WORD1_OP2_UPDATE_EXECUTE_MASK(alu->predicate) | + S_SQ_ALU_WORD1_OP2_UPDATE_PRED(alu->predicate); } if (alu->last) { for (i = 0; i < alu->nliteral; i++) { @@ -358,6 +383,7 @@ static int r600_bc_cf_build(struct r600_bc *bc, struct r600_bc_cf *cf) switch (cf->inst) { case (V_SQ_CF_ALU_WORD1_SQ_CF_INST_ALU << 3): + case (V_SQ_CF_ALU_WORD1_SQ_CF_INST_ALU_PUSH_BEFORE << 3): bc->bytecode[id++] = S_SQ_CF_ALU_WORD0_ADDR(cf->addr >> 1); bc->bytecode[id++] = S_SQ_CF_ALU_WORD1_CF_INST(cf->inst >> 3) | S_SQ_CF_ALU_WORD1_BARRIER(1) | @@ -385,6 +411,16 @@ static int r600_bc_cf_build(struct r600_bc *bc, struct r600_bc_cf *cf) S_SQ_CF_ALLOC_EXPORT_WORD1_CF_INST(cf->output.inst) | S_SQ_CF_ALLOC_EXPORT_WORD1_END_OF_PROGRAM(cf->output.end_of_program); break; + case V_SQ_CF_WORD1_SQ_CF_INST_JUMP: + case V_SQ_CF_WORD1_SQ_CF_INST_ELSE: + case V_SQ_CF_WORD1_SQ_CF_INST_POP: + bc->bytecode[id++] = S_SQ_CF_WORD0_ADDR(cf->cf_addr >> 1); + bc->bytecode[id++] = S_SQ_CF_WORD1_CF_INST(cf->inst) | + S_SQ_CF_WORD1_BARRIER(1) | + S_SQ_CF_WORD1_COND(cf->cond) | + S_SQ_CF_WORD1_POP_COUNT(cf->pop_count); + + break; default: R600_ERR("unsupported CF instruction (0x%X)\n", cf->inst); return -EINVAL; @@ -401,13 +437,13 @@ int r600_bc_build(struct r600_bc *bc) unsigned addr; int r; - /* first path compute addr of each CF block */ /* addr start after all the CF instructions */ addr = bc->cf_last->id + 2; LIST_FOR_EACH_ENTRY(cf, &bc->cf, list) { switch (cf->inst) { case (V_SQ_CF_ALU_WORD1_SQ_CF_INST_ALU << 3): + case (V_SQ_CF_ALU_WORD1_SQ_CF_INST_ALU_PUSH_BEFORE << 3): break; case V_SQ_CF_WORD1_SQ_CF_INST_TEX: case V_SQ_CF_WORD1_SQ_CF_INST_VTX: @@ -419,6 +455,12 @@ int r600_bc_build(struct r600_bc *bc) case V_SQ_CF_ALLOC_EXPORT_WORD1_SQ_CF_INST_EXPORT: case V_SQ_CF_ALLOC_EXPORT_WORD1_SQ_CF_INST_EXPORT_DONE: break; + case V_SQ_CF_WORD1_SQ_CF_INST_JUMP: + case V_SQ_CF_WORD1_SQ_CF_INST_ELSE: + case V_SQ_CF_WORD1_SQ_CF_INST_POP: + /* hack */ + bc->nstack = 3; + break; default: R600_ERR("unsupported CF instruction (0x%X)\n", cf->inst); return -EINVAL; @@ -438,6 +480,7 @@ int r600_bc_build(struct r600_bc *bc) return r; switch (cf->inst) { case (V_SQ_CF_ALU_WORD1_SQ_CF_INST_ALU << 3): + case (V_SQ_CF_ALU_WORD1_SQ_CF_INST_ALU_PUSH_BEFORE << 3): LIST_FOR_EACH_ENTRY(alu, &cf->alu, list) { switch(bc->chiprev) { case 0: @@ -477,6 +520,9 @@ int r600_bc_build(struct r600_bc *bc) break; case V_SQ_CF_ALLOC_EXPORT_WORD1_SQ_CF_INST_EXPORT: case V_SQ_CF_ALLOC_EXPORT_WORD1_SQ_CF_INST_EXPORT_DONE: + case V_SQ_CF_WORD1_SQ_CF_INST_JUMP: + case V_SQ_CF_WORD1_SQ_CF_INST_ELSE: + case V_SQ_CF_WORD1_SQ_CF_INST_POP: break; default: R600_ERR("unsupported CF instruction (0x%X)\n", cf->inst); diff --git a/src/gallium/drivers/r600/r600_asm.h b/src/gallium/drivers/r600/r600_asm.h index e944bd02de..dbd885caf9 100644 --- a/src/gallium/drivers/r600/r600_asm.h +++ b/src/gallium/drivers/r600/r600_asm.h @@ -47,6 +47,7 @@ struct r600_bc_alu { unsigned inst; unsigned last; unsigned is_op3; + unsigned predicate; unsigned nliteral; unsigned literal_added; u32 value[4]; @@ -114,12 +115,25 @@ struct r600_bc_cf { unsigned addr; unsigned ndw; unsigned id; + unsigned cond; + unsigned pop_count; + unsigned cf_addr; /* control flow addr */ struct list_head alu; struct list_head tex; struct list_head vtx; struct r600_bc_output output; }; +#define FC_NONE 0 +#define FC_IF 1 +#define FC_LOOP 2 + +struct r600_cf_stack_entry { + int type; + struct r600_bc_cf *start; + struct r600_bc_cf *mid; /* used to store the else point */ +}; + struct r600_bc { enum radeon_family family; int chiprev; /* 0 - r600, 1 - r700, 2 - evergreen */ @@ -128,9 +142,13 @@ struct r600_bc { unsigned ndw; unsigned ncf; unsigned ngpr; + unsigned nstack; unsigned nresource; unsigned force_add_cf; u32 *bytecode; + + u32 fc_sp; + struct r600_cf_stack_entry fc_stack[32]; }; int r600_bc_init(struct r600_bc *bc, enum radeon_family family); @@ -140,5 +158,6 @@ int r600_bc_add_vtx(struct r600_bc *bc, const struct r600_bc_vtx *vtx); int r600_bc_add_tex(struct r600_bc *bc, const struct r600_bc_tex *tex); int r600_bc_add_output(struct r600_bc *bc, const struct r600_bc_output *output); int r600_bc_build(struct r600_bc *bc); - +int r600_bc_add_cfinst(struct r600_bc *bc, int inst); +int r600_bc_add_alu_type(struct r600_bc *bc, const struct r600_bc_alu *alu, int type); #endif diff --git a/src/gallium/drivers/r600/r600_shader.c b/src/gallium/drivers/r600/r600_shader.c index 1470bb5072..052b4971f3 100644 --- a/src/gallium/drivers/r600/r600_shader.c +++ b/src/gallium/drivers/r600/r600_shader.c @@ -144,7 +144,8 @@ static int r600_pipe_shader_vs(struct pipe_context *ctx, struct r600_context_sta state->states[R600_VS_SHADER__SPI_VS_OUT_ID_0 + i / 4] |= tmp; } state->states[R600_VS_SHADER__SPI_VS_OUT_CONFIG] = S_0286C4_VS_EXPORT_COUNT(rshader->noutput - 2); - state->states[R600_VS_SHADER__SQ_PGM_RESOURCES_VS] = S_028868_NUM_GPRS(rshader->bc.ngpr); + state->states[R600_VS_SHADER__SQ_PGM_RESOURCES_VS] = S_028868_NUM_GPRS(rshader->bc.ngpr) | + S_028868_STACK_SIZE(rshader->bc.nstack); rpshader->rstate = state; rpshader->rstate->bo[0] = radeon_bo_incref(rscreen->rw, rpshader->bo); rpshader->rstate->bo[1] = radeon_bo_incref(rscreen->rw, rpshader->bo); @@ -200,7 +201,8 @@ static int r600_pipe_shader_ps(struct pipe_context *ctx, struct r600_context_sta state->states[R600_PS_SHADER__SPI_PS_IN_CONTROL_0] = S_0286CC_NUM_INTERP(rshader->ninput) | S_0286CC_PERSP_GRADIENT_ENA(1); state->states[R600_PS_SHADER__SPI_PS_IN_CONTROL_1] = 0x00000000; - state->states[R600_PS_SHADER__SQ_PGM_RESOURCES_PS] = S_028868_NUM_GPRS(rshader->bc.ngpr); + state->states[R600_PS_SHADER__SQ_PGM_RESOURCES_PS] = S_028868_NUM_GPRS(rshader->bc.ngpr) | + S_028868_STACK_SIZE(rshader->bc.nstack); state->states[R600_PS_SHADER__SQ_PGM_EXPORTS_PS] = exports_ps; rpshader->rstate = state; rpshader->rstate->bo[0] = radeon_bo_incref(rscreen->rw, rpshader->bo); @@ -276,10 +278,12 @@ static int tgsi_is_supported(struct r600_shader_ctx *ctx) R600_ERR("predicate unsupported\n"); return -EINVAL; } +#if 0 if (i->Instruction.Label) { R600_ERR("label unsupported\n"); return -EINVAL; } +#endif for (j = 0; j < i->Instruction.NumSrcRegs; j++) { if (i->Src[j].Register.Indirect || i->Src[j].Register.Dimension || @@ -1721,6 +1725,90 @@ static int tgsi_exp(struct r600_shader_ctx *ctx) return tgsi_helper_copy(ctx, inst); } +static int emit_logic_pred(struct r600_shader_ctx *ctx, int opcode) +{ + struct tgsi_full_instruction *inst = &ctx->parse.FullToken.FullInstruction; + struct r600_bc_alu alu, *lalu; + struct r600_bc_cf *last; + int r; + + memset(&alu, 0, sizeof(struct r600_bc_alu)); + alu.inst = opcode; + alu.predicate = 1; + + alu.dst.sel = ctx->temp_reg; + alu.dst.write = 1; + alu.dst.chan = 0; + + r = tgsi_src(ctx, &inst->Src[0], &alu.src[0]); + if (r) + return r; + alu.src[0].chan = tgsi_chan(&inst->Src[0], 0); + alu.src[1].sel = V_SQ_ALU_SRC_0; + alu.src[1].chan = 0; + + alu.last = 1; + + r = r600_bc_add_alu_type(ctx->bc, &alu, V_SQ_CF_ALU_WORD1_SQ_CF_INST_ALU_PUSH_BEFORE); + if (r) + return r; + + return 0; +} + +static int pops(struct r600_shader_ctx *ctx, int pops) +{ + r600_bc_add_cfinst(ctx->bc, V_SQ_CF_WORD1_SQ_CF_INST_POP); + ctx->bc->cf_last->pop_count = pops; + return 0; +} + +static int tgsi_if(struct r600_shader_ctx *ctx) +{ + struct tgsi_full_instruction *inst = &ctx->parse.FullToken.FullInstruction; + + emit_logic_pred(ctx, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_PRED_SETNE); + + ctx->bc->fc_sp++; + ctx->bc->fc_stack[ctx->bc->fc_sp].type = FC_IF; + ctx->bc->fc_stack[ctx->bc->fc_sp].mid = NULL; + r600_bc_add_cfinst(ctx->bc, V_SQ_CF_WORD1_SQ_CF_INST_JUMP); + + ctx->bc->fc_stack[ctx->bc->fc_sp].start = ctx->bc->cf_last; + return 0; +} + +static int tgsi_else(struct r600_shader_ctx *ctx) +{ + struct tgsi_full_instruction *inst = &ctx->parse.FullToken.FullInstruction; + r600_bc_add_cfinst(ctx->bc, V_SQ_CF_WORD1_SQ_CF_INST_ELSE); + ctx->bc->cf_last->pop_count = 1; + + /* fixup mid */ + ctx->bc->fc_stack[ctx->bc->fc_sp].mid = ctx->bc->cf_last; + ctx->bc->fc_stack[ctx->bc->fc_sp].start->cf_addr = ctx->bc->cf_last->id; + return 0; +} + +static int tgsi_endif(struct r600_shader_ctx *ctx) +{ + pops(ctx, 1); + if (ctx->bc->fc_stack[ctx->bc->fc_sp].type != FC_IF) { + R600_ERR("if/endif unbalanced in shader\n"); + return -1; + } + + if (ctx->bc->fc_stack[ctx->bc->fc_sp].mid == NULL) { + ctx->bc->fc_stack[ctx->bc->fc_sp].start->cf_addr = ctx->bc->cf_last->id + 2; + ctx->bc->fc_stack[ctx->bc->fc_sp].start->pop_count = 1; + } else { + ctx->bc->fc_stack[ctx->bc->fc_sp].mid->cf_addr = ctx->bc->cf_last->id + 2; + } + ctx->bc->fc_sp--; + + return 0; +} + static struct r600_shader_tgsi_instruction r600_shader_tgsi_instruction[] = { {TGSI_OPCODE_ARL, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported}, {TGSI_OPCODE_MOV, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV, tgsi_op2}, @@ -1799,12 +1887,12 @@ static struct r600_shader_tgsi_instruction r600_shader_tgsi_instruction[] = { {TGSI_OPCODE_DP2, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_DOT4, tgsi_dp}, {TGSI_OPCODE_TXL, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported}, {TGSI_OPCODE_BRK, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported}, - {TGSI_OPCODE_IF, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported}, + {TGSI_OPCODE_IF, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_if}, /* gap */ {75, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported}, {76, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported}, - {TGSI_OPCODE_ELSE, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported}, - {TGSI_OPCODE_ENDIF, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported}, + {TGSI_OPCODE_ELSE, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_else}, + {TGSI_OPCODE_ENDIF, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_endif}, /* gap */ {79, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported}, {80, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported}, diff --git a/src/gallium/drivers/r600/r600_sq.h b/src/gallium/drivers/r600/r600_sq.h index ad4de0b072..b4ed435e91 100644 --- a/src/gallium/drivers/r600/r600_sq.h +++ b/src/gallium/drivers/r600/r600_sq.h @@ -603,4 +603,9 @@ #define G_SQ_TEX_WORD2_SRC_SEL_W(x) (((x) >> 29) & 0x7) #define C_SQ_TEX_WORD2_SRC_SEL_W 0x1FFFFFFF +#define V_SQ_CF_COND_ACTIVE 0x00 +#define V_SQ_CF_COND_FALSE 0x01 +#define V_SQ_CF_COND_BOOL 0x02 +#define V_SQ_CF_COND_NOT_BOOL 0x03 + #endif -- cgit v1.2.3 From 2184f3ec3059eaf8a9a2b04c995162543f000862 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Fri, 27 Aug 2010 15:45:58 +1000 Subject: Revert "r600g: simplify states" This reverts commit bd25e23bf3740f59ce8859848c715daeb9e9821f. Apart from introducing a lot of hex magic numbers and being highly impenetable code, it causes lots of lockups on an average piglit run that always runs without lockups. Always run piglit before/after doing big things like this. --- src/gallium/drivers/r600/r600_blit.c | 61 +- src/gallium/drivers/r600/r600_context.c | 9 +- src/gallium/drivers/r600/r600_draw.c | 46 +- src/gallium/drivers/r600/r600_query.c | 6 +- src/gallium/drivers/r600/r600_shader.c | 7 +- src/gallium/drivers/r600/r600_state.c | 78 +- src/gallium/drivers/r600/r600_texture.c | 18 +- src/gallium/drivers/r600/radeon.h | 669 ++- src/gallium/winsys/r600/drm/r600_state.c | 8091 ++-------------------------- src/gallium/winsys/r600/drm/r600_states.h | 562 ++ src/gallium/winsys/r600/drm/radeon.c | 44 + src/gallium/winsys/r600/drm/radeon_ctx.c | 313 +- src/gallium/winsys/r600/drm/radeon_draw.c | 3 +- src/gallium/winsys/r600/drm/radeon_priv.h | 34 +- src/gallium/winsys/r600/drm/radeon_state.c | 56 +- 15 files changed, 1720 insertions(+), 8277 deletions(-) create mode 100644 src/gallium/winsys/r600/drm/r600_states.h (limited to 'src') diff --git a/src/gallium/drivers/r600/r600_blit.c b/src/gallium/drivers/r600/r600_blit.c index d3b722c82f..72175fbbd5 100644 --- a/src/gallium/drivers/r600/r600_blit.c +++ b/src/gallium/drivers/r600/r600_blit.c @@ -132,7 +132,7 @@ static void r600_resource_copy_region(struct pipe_context *ctx, unsigned srcx, unsigned srcy, unsigned srcz, unsigned width, unsigned height) { - util_resource_copy_region(ctx, dst, subdst, dstx, dsty, dstz, + util_resource_copy_region(pipe, dst, subdst, dstx, dsty, dstz, src, subsrc, srcx, srcy, srcz, width, height); } @@ -190,7 +190,7 @@ static int r600_blit_state_vs_resources(struct r600_screen *rscreen, struct r600 memcpy(bo->data, vbo, 128); radeon_bo_unmap(rscreen->rw, bo); - rstate = radeon_state(rscreen->rw, R600_VS_RESOURCE0 + 0); + rstate = radeon_state(rscreen->rw, R600_VS_RESOURCE_TYPE, R600_VS_RESOURCE + 0); if (rstate == NULL) { radeon_bo_decref(rscreen->rw, bo); return -ENOMEM; @@ -199,35 +199,33 @@ static int r600_blit_state_vs_resources(struct r600_screen *rscreen, struct r600 /* set states (most default value are 0 and struct already * initialized to 0, thus avoid resetting them) */ - rstate->states[R600_RESOURCE__RESOURCE_WORD0] = 0x00000000; - rstate->states[R600_RESOURCE__RESOURCE_WORD1] = 0x00000080; - rstate->states[R600_RESOURCE__RESOURCE_WORD2] = 0x02302000; - rstate->states[R600_RESOURCE__RESOURCE_WORD3] = 0x00000000; - rstate->states[R600_RESOURCE__RESOURCE_WORD4] = 0x00000000; - rstate->states[R600_RESOURCE__RESOURCE_WORD5] = 0x00000000; - rstate->states[R600_RESOURCE__RESOURCE_WORD6] = 0xC0000000; + rstate->states[R600_VS_RESOURCE__RESOURCE160_WORD0] = 0x00000000; + rstate->states[R600_VS_RESOURCE__RESOURCE160_WORD1] = 0x00000080; + rstate->states[R600_VS_RESOURCE__RESOURCE160_WORD2] = 0x02302000; + rstate->states[R600_VS_RESOURCE__RESOURCE160_WORD3] = 0x00000000; + rstate->states[R600_VS_RESOURCE__RESOURCE160_WORD4] = 0x00000000; + rstate->states[R600_VS_RESOURCE__RESOURCE160_WORD5] = 0x00000000; + rstate->states[R600_VS_RESOURCE__RESOURCE160_WORD6] = 0xC0000000; rstate->bo[0] = bo; rstate->nbo = 1; rstate->placement[0] = RADEON_GEM_DOMAIN_GTT; - rstate->reloc_pm4_id[0] = R600_RESOURCE__RESOURCE_BO0_ID; - rstate->reloc_pm4_id[1] = R600_RESOURCE__RESOURCE_BO1_ID; if (radeon_state_pm4(rstate)) { radeon_state_decref(rstate); return -ENOMEM; } bstates->vs_resource0 = rstate; - rstate = radeon_state(rscreen->rw, R600_VS_RESOURCE0 + 1); + rstate = radeon_state(rscreen->rw, R600_VS_RESOURCE_TYPE, R600_VS_RESOURCE + 1); if (rstate == NULL) { return -ENOMEM; } - rstate->states[R600_RESOURCE__RESOURCE_WORD0] = 0x00000010; - rstate->states[R600_RESOURCE__RESOURCE_WORD1] = 0x00000070; - rstate->states[R600_RESOURCE__RESOURCE_WORD2] = 0x02302000; - rstate->states[R600_RESOURCE__RESOURCE_WORD3] = 0x00000000; - rstate->states[R600_RESOURCE__RESOURCE_WORD4] = 0x00000000; - rstate->states[R600_RESOURCE__RESOURCE_WORD5] = 0x00000000; - rstate->states[R600_RESOURCE__RESOURCE_WORD6] = 0xC0000000; + rstate->states[R600_VS_RESOURCE__RESOURCE160_WORD0] = 0x00000010; + rstate->states[R600_VS_RESOURCE__RESOURCE160_WORD1] = 0x00000070; + rstate->states[R600_VS_RESOURCE__RESOURCE160_WORD2] = 0x02302000; + rstate->states[R600_VS_RESOURCE__RESOURCE160_WORD3] = 0x00000000; + rstate->states[R600_VS_RESOURCE__RESOURCE160_WORD4] = 0x00000000; + rstate->states[R600_VS_RESOURCE__RESOURCE160_WORD5] = 0x00000000; + rstate->states[R600_VS_RESOURCE__RESOURCE160_WORD6] = 0xC0000000; rstate->bo[0] = radeon_bo_incref(rscreen->rw, bo); rstate->nbo = 1; rstate->placement[0] = RADEON_GEM_DOMAIN_GTT; @@ -305,7 +303,7 @@ static struct radeon_state *r600_blit_state_vs_shader(struct r600_screen *rscree } radeon_bo_unmap(rscreen->rw, bo); - rstate = radeon_state(rscreen->rw, R600_VS_SHADER); + rstate = radeon_state(rscreen->rw, R600_VS_SHADER_TYPE, R600_VS_SHADER); if (rstate == NULL) { radeon_bo_decref(rscreen->rw, bo); return NULL; @@ -323,8 +321,6 @@ static struct radeon_state *r600_blit_state_vs_shader(struct r600_screen *rscree rstate->nbo = 2; rstate->placement[0] = RADEON_GEM_DOMAIN_GTT; rstate->placement[2] = RADEON_GEM_DOMAIN_GTT; - rstate->reloc_pm4_id[0] = R600_VS_SHADER__SQ_PGM_START_VS_BO_ID; - rstate->reloc_pm4_id[1] = R600_VS_SHADER__SQ_PGM_START_FS_BO_ID; if (radeon_state_pm4(rstate)) { radeon_state_decref(rstate); @@ -378,7 +374,7 @@ static struct radeon_state *r600_blit_state_ps_shader(struct r600_screen *rscree } radeon_bo_unmap(rscreen->rw, bo); - rstate = radeon_state(rscreen->rw, R600_PS_SHADER); + rstate = radeon_state(rscreen->rw, R600_PS_SHADER_TYPE, R600_PS_SHADER); if (rstate == NULL) { radeon_bo_decref(rscreen->rw, bo); return NULL; @@ -395,7 +391,6 @@ static struct radeon_state *r600_blit_state_ps_shader(struct r600_screen *rscree rstate->bo[0] = bo; rstate->nbo = 1; rstate->placement[0] = RADEON_GEM_DOMAIN_GTT; - rstate->reloc_pm4_id[0] = R600_PS_SHADER__SQ_PGM_START_PS_BO_ID; if (radeon_state_pm4(rstate)) { radeon_state_decref(rstate); @@ -408,7 +403,7 @@ static struct radeon_state *r600_blit_state_vgt(struct r600_screen *rscreen) { struct radeon_state *rstate; - rstate = radeon_state(rscreen->rw, R600_VGT); + rstate = radeon_state(rscreen->rw, R600_VGT_TYPE, R600_VGT); if (rstate == NULL) return NULL; @@ -430,7 +425,7 @@ static struct radeon_state *r600_blit_state_draw(struct r600_screen *rscreen) { struct radeon_state *rstate; - rstate = radeon_state(rscreen->rw, R600_DRAW); + rstate = radeon_state(rscreen->rw, R600_DRAW_TYPE, R600_DRAW); if (rstate == NULL) return NULL; @@ -453,7 +448,7 @@ static struct radeon_state *r600_blit_state_vs_constant(struct r600_screen *rscr { struct radeon_state *rstate; - rstate = radeon_state(rscreen->rw, R600_VS_CONSTANT0 + id); + rstate = radeon_state(rscreen->rw, R600_VS_CONSTANT_TYPE, R600_VS_CONSTANT + id); if (rstate == NULL) return NULL; @@ -476,7 +471,7 @@ static struct radeon_state *r600_blit_state_rasterizer(struct r600_screen *rscre { struct radeon_state *rstate; - rstate = radeon_state(rscreen->rw, R600_RASTERIZER); + rstate = radeon_state(rscreen->rw, R600_RASTERIZER_TYPE, R600_RASTERIZER); if (rstate == NULL) return NULL; @@ -505,7 +500,7 @@ static struct radeon_state *r600_blit_state_dsa(struct r600_screen *rscreen) { struct radeon_state *rstate; - rstate = radeon_state(rscreen->rw, R600_DSA); + rstate = radeon_state(rscreen->rw, R600_DSA_TYPE, R600_DSA); if (rstate == NULL) return NULL; @@ -529,7 +524,7 @@ static struct radeon_state *r600_blit_state_blend(struct r600_screen *rscreen) { struct radeon_state *rstate; - rstate = radeon_state(rscreen->rw, R600_BLEND); + rstate = radeon_state(rscreen->rw, R600_BLEND_TYPE, R600_BLEND); if (rstate == NULL) return NULL; @@ -548,7 +543,7 @@ static struct radeon_state *r600_blit_state_cb_cntl(struct r600_screen *rscreen) { struct radeon_state *rstate; - rstate = radeon_state(rscreen->rw, R600_CB_CNTL); + rstate = radeon_state(rscreen->rw, R600_CB_CNTL_TYPE, R600_CB_CNTL); if (rstate == NULL) return NULL; @@ -791,10 +786,10 @@ int r600_blit_uncompress_depth(struct pipe_context *ctx, struct r600_resource_te r600_queries_suspend(ctx); /* schedule draw*/ - r = radeon_ctx_set_draw(rctx->ctx, draw); + r = radeon_ctx_set_draw_new(rctx->ctx, draw); if (r == -EBUSY) { r600_flush(ctx, 0, NULL); - r = radeon_ctx_set_draw(rctx->ctx, draw); + r = radeon_ctx_set_draw_new(rctx->ctx, draw); } if (r) { goto out; diff --git a/src/gallium/drivers/r600/r600_context.c b/src/gallium/drivers/r600/r600_context.c index 790a85110b..9af28356c5 100644 --- a/src/gallium/drivers/r600/r600_context.c +++ b/src/gallium/drivers/r600/r600_context.c @@ -53,10 +53,12 @@ void r600_flush(struct pipe_context *ctx, unsigned flags, /* suspend queries */ r600_queries_suspend(ctx); + if (radeon_ctx_pm4(rctx->ctx)) + goto out; /* FIXME dumping should be removed once shader support instructions * without throwing bad code */ - if (!rctx->ctx->id) + if (!rctx->ctx->cpm4) goto out; sprintf(dname, "gallium-%08d.bof", dc); if (dc < 2) { @@ -71,7 +73,8 @@ void r600_flush(struct pipe_context *ctx, unsigned flags, } dc++; out: - radeon_ctx_clear(rctx->ctx); + rctx->ctx = radeon_ctx_decref(rctx->ctx); + rctx->ctx = radeon_ctx(rscreen->rw); /* resume queries */ r600_queries_resume(ctx); } @@ -215,7 +218,7 @@ static void r600_init_config(struct r600_context *rctx) num_es_stack_entries = 0; break; } - rctx->hw_states.config = radeon_state(rctx->rw, R600_CONFIG); + rctx->hw_states.config = radeon_state(rctx->rw, R600_CONFIG_TYPE, R600_CONFIG); rctx->hw_states.config->states[R600_CONFIG__SQ_CONFIG] = 0x00000000; switch (family) { diff --git a/src/gallium/drivers/r600/r600_draw.c b/src/gallium/drivers/r600/r600_draw.c index a1a392ad2b..1eb868c4c7 100644 --- a/src/gallium/drivers/r600/r600_draw.c +++ b/src/gallium/drivers/r600/r600_draw.c @@ -101,21 +101,19 @@ static int r600_draw_common(struct r600_draw *draw) rbuffer = (struct r600_resource*)vertex_buffer->buffer; offset = rctx->vertex_elements->elements[i].src_offset + vertex_buffer->buffer_offset; format = r600_translate_colorformat(rctx->vertex_elements->elements[i].src_format); - vs_resource = radeon_state(rscreen->rw, R600_VS_RESOURCE0 + i); + vs_resource = radeon_state(rscreen->rw, R600_VS_RESOURCE_TYPE, R600_VS_RESOURCE + i); if (vs_resource == NULL) return -ENOMEM; vs_resource->bo[0] = radeon_bo_incref(rscreen->rw, rbuffer->bo); vs_resource->nbo = 1; - vs_resource->reloc_pm4_id[0] = R600_RESOURCE__RESOURCE_BO0_ID; - vs_resource->reloc_pm4_id[1] = R600_RESOURCE__RESOURCE_BO1_ID; - vs_resource->states[R600_RESOURCE__RESOURCE_WORD0] = offset; - vs_resource->states[R600_RESOURCE__RESOURCE_WORD1] = rbuffer->bo->size - offset; - vs_resource->states[R600_RESOURCE__RESOURCE_WORD2] = S_038008_STRIDE(vertex_buffer->stride) | + vs_resource->states[R600_PS_RESOURCE__RESOURCE0_WORD0] = offset; + vs_resource->states[R600_PS_RESOURCE__RESOURCE0_WORD1] = rbuffer->bo->size - offset; + vs_resource->states[R600_PS_RESOURCE__RESOURCE0_WORD2] = S_038008_STRIDE(vertex_buffer->stride) | S_038008_DATA_FORMAT(format); - vs_resource->states[R600_RESOURCE__RESOURCE_WORD3] = 0x00000000; - vs_resource->states[R600_RESOURCE__RESOURCE_WORD4] = 0x00000000; - vs_resource->states[R600_RESOURCE__RESOURCE_WORD5] = 0x00000000; - vs_resource->states[R600_RESOURCE__RESOURCE_WORD6] = 0xC0000000; + vs_resource->states[R600_PS_RESOURCE__RESOURCE0_WORD3] = 0x00000000; + vs_resource->states[R600_PS_RESOURCE__RESOURCE0_WORD4] = 0x00000000; + vs_resource->states[R600_PS_RESOURCE__RESOURCE0_WORD5] = 0x00000000; + vs_resource->states[R600_PS_RESOURCE__RESOURCE0_WORD6] = 0xC0000000; vs_resource->placement[0] = RADEON_GEM_DOMAIN_GTT; vs_resource->placement[1] = RADEON_GEM_DOMAIN_GTT; r = radeon_draw_set_new(rctx->draw, vs_resource); @@ -123,29 +121,22 @@ static int r600_draw_common(struct r600_draw *draw) return r; } /* FIXME start need to change winsys */ + draw->draw = radeon_state(rscreen->rw, R600_DRAW_TYPE, R600_DRAW); + if (draw->draw == NULL) + return -ENOMEM; + draw->draw->states[R600_DRAW__VGT_NUM_INDICES] = draw->count; + draw->draw->states[R600_DRAW__VGT_DRAW_INITIATOR] = vgt_draw_initiator; if (draw->index_buffer) { - draw->draw = radeon_state(rscreen->rw, R600_DRAW); - if (draw->draw == NULL) - return -ENOMEM; - draw->draw->states[R600_DRAW__VGT_NUM_INDICES] = draw->count; - draw->draw->states[R600_DRAW__VGT_DRAW_INITIATOR] = vgt_draw_initiator; rbuffer = (struct r600_resource*)draw->index_buffer; draw->draw->bo[0] = radeon_bo_incref(rscreen->rw, rbuffer->bo); draw->draw->placement[0] = RADEON_GEM_DOMAIN_GTT; draw->draw->placement[1] = RADEON_GEM_DOMAIN_GTT; draw->draw->nbo = 1; - draw->draw->reloc_pm4_id[0] = R600_DRAW__INDICES_BO_ID; - } else { - draw->draw = radeon_state(rscreen->rw, R600_DRAW_AUTO); - if (draw->draw == NULL) - return -ENOMEM; - draw->draw->states[R600_DRAW_AUTO__VGT_NUM_INDICES] = draw->count; - draw->draw->states[R600_DRAW_AUTO__VGT_DRAW_INITIATOR] = vgt_draw_initiator; } r = radeon_draw_set_new(rctx->draw, draw->draw); if (r) return r; - draw->vgt = radeon_state(rscreen->rw, R600_VGT); + draw->vgt = radeon_state(rscreen->rw, R600_VGT_TYPE, R600_VGT); if (draw->vgt == NULL) return -ENOMEM; draw->vgt->states[R600_VGT__VGT_PRIMITIVE_TYPE] = prim; @@ -154,18 +145,23 @@ static int r600_draw_common(struct r600_draw *draw) draw->vgt->states[R600_VGT__VGT_INDX_OFFSET] = draw->start; draw->vgt->states[R600_VGT__VGT_MULTI_PRIM_IB_RESET_INDX] = 0x00000000; draw->vgt->states[R600_VGT__VGT_DMA_INDEX_TYPE] = vgt_dma_index_type; + draw->vgt->states[R600_VGT__VGT_PRIMITIVEID_EN] = 0x00000000; draw->vgt->states[R600_VGT__VGT_DMA_NUM_INSTANCES] = 0x00000001; + draw->vgt->states[R600_VGT__VGT_MULTI_PRIM_IB_RESET_EN] = 0x00000000; + draw->vgt->states[R600_VGT__VGT_INSTANCE_STEP_RATE_0] = 0x00000000; + draw->vgt->states[R600_VGT__VGT_INSTANCE_STEP_RATE_1] = 0x00000000; r = radeon_draw_set_new(rctx->draw, draw->vgt); if (r) return r; /* FIXME */ - r = radeon_ctx_set_draw(rctx->ctx, rctx->draw); + r = radeon_ctx_set_draw_new(rctx->ctx, rctx->draw); if (r == -EBUSY) { r600_flush(draw->ctx, 0, NULL); - r = radeon_ctx_set_draw(rctx->ctx, rctx->draw); + r = radeon_ctx_set_draw_new(rctx->ctx, rctx->draw); } if (r) return r; + rctx->draw = radeon_draw_duplicate(rctx->draw); return 0; } diff --git a/src/gallium/drivers/r600/r600_query.c b/src/gallium/drivers/r600/r600_query.c index 8b4fe8999f..5929606cd2 100644 --- a/src/gallium/drivers/r600/r600_query.c +++ b/src/gallium/drivers/r600/r600_query.c @@ -36,11 +36,10 @@ static struct radeon_state *r600_query_begin(struct r600_context *rctx, struct r struct r600_screen *rscreen = rctx->screen; struct radeon_state *rstate; - rstate = radeon_state(rscreen->rw, R600_QUERY_BEGIN); + rstate = radeon_state(rscreen->rw, R600_QUERY_BEGIN_TYPE, R600_QUERY_BEGIN); if (rstate == NULL) return NULL; rstate->states[R600_QUERY__OFFSET] = rquery->num_results; - rstate->reloc_pm4_id[0] = R600_QUERY__BO_ID; rstate->bo[0] = radeon_bo_incref(rscreen->rw, rquery->buffer); rstate->nbo = 1; rstate->placement[0] = RADEON_GEM_DOMAIN_GTT; @@ -56,11 +55,10 @@ static struct radeon_state *r600_query_end(struct r600_context *rctx, struct r60 struct r600_screen *rscreen = rctx->screen; struct radeon_state *rstate; - rstate = radeon_state(rscreen->rw, R600_QUERY_END); + rstate = radeon_state(rscreen->rw, R600_QUERY_END_TYPE, R600_QUERY_END); if (rstate == NULL) return NULL; rstate->states[R600_QUERY__OFFSET] = rquery->num_results + 8; - rstate->reloc_pm4_id[0] = R600_QUERY__BO_ID; rstate->bo[0] = radeon_bo_incref(rscreen->rw, rquery->buffer); rstate->nbo = 1; rstate->placement[0] = RADEON_GEM_DOMAIN_GTT; diff --git a/src/gallium/drivers/r600/r600_shader.c b/src/gallium/drivers/r600/r600_shader.c index 052b4971f3..ebcf19c12b 100644 --- a/src/gallium/drivers/r600/r600_shader.c +++ b/src/gallium/drivers/r600/r600_shader.c @@ -132,7 +132,7 @@ static int r600_pipe_shader_vs(struct pipe_context *ctx, struct r600_context_sta unsigned i, tmp; rpshader->rstate = radeon_state_decref(rpshader->rstate); - state = radeon_state(rscreen->rw, R600_VS_SHADER); + state = radeon_state(rscreen->rw, R600_VS_SHADER_TYPE, R600_VS_SHADER); if (state == NULL) return -ENOMEM; for (i = 0; i < 10; i++) { @@ -152,8 +152,6 @@ static int r600_pipe_shader_vs(struct pipe_context *ctx, struct r600_context_sta rpshader->rstate->nbo = 2; rpshader->rstate->placement[0] = RADEON_GEM_DOMAIN_GTT; rpshader->rstate->placement[2] = RADEON_GEM_DOMAIN_GTT; - state->reloc_pm4_id[0] = R600_VS_SHADER__SQ_PGM_START_VS_BO_ID; - state->reloc_pm4_id[1] = R600_VS_SHADER__SQ_PGM_START_FS_BO_ID; return radeon_state_pm4(state); } @@ -168,7 +166,7 @@ static int r600_pipe_shader_ps(struct pipe_context *ctx, struct r600_context_sta rasterizer = &rctx->rasterizer->state.rasterizer; rpshader->rstate = radeon_state_decref(rpshader->rstate); - state = radeon_state(rscreen->rw, R600_PS_SHADER); + state = radeon_state(rscreen->rw, R600_PS_SHADER_TYPE, R600_PS_SHADER); if (state == NULL) return -ENOMEM; for (i = 0; i < rshader->ninput; i++) { @@ -208,7 +206,6 @@ static int r600_pipe_shader_ps(struct pipe_context *ctx, struct r600_context_sta rpshader->rstate->bo[0] = radeon_bo_incref(rscreen->rw, rpshader->bo); rpshader->rstate->nbo = 1; rpshader->rstate->placement[0] = RADEON_GEM_DOMAIN_GTT; - state->reloc_pm4_id[0] = R600_PS_SHADER__SQ_PGM_START_PS_BO_ID; return radeon_state_pm4(state); } diff --git a/src/gallium/drivers/r600/r600_state.c b/src/gallium/drivers/r600/r600_state.c index e75575da79..b5e5346163 100644 --- a/src/gallium/drivers/r600/r600_state.c +++ b/src/gallium/drivers/r600/r600_state.c @@ -283,17 +283,19 @@ static void r600_set_constant_buffer(struct pipe_context *ctx, { struct r600_screen *rscreen = r600_screen(ctx->screen); struct r600_context *rctx = r600_context(ctx); - unsigned nconstant = 0, i, id; + unsigned nconstant = 0, i, type, id; struct radeon_state *rstate; struct pipe_transfer *transfer; u32 *ptr; switch (shader) { case PIPE_SHADER_VERTEX: - id = R600_VS_CONSTANT0; + id = R600_VS_CONSTANT; + type = R600_VS_CONSTANT_TYPE; break; case PIPE_SHADER_FRAGMENT: - id = R600_PS_CONSTANT0; + id = R600_PS_CONSTANT; + type = R600_PS_CONSTANT_TYPE; break; default: R600_ERR("unsupported %d\n", shader); @@ -305,7 +307,7 @@ static void r600_set_constant_buffer(struct pipe_context *ctx, if (ptr == NULL) return; for (i = 0; i < nconstant; i++) { - rstate = radeon_state(rscreen->rw, id + i); + rstate = radeon_state(rscreen->rw, type, id + i); if (rstate == NULL) return; rstate->states[R600_PS_CONSTANT__SQ_ALU_CONSTANT0_0] = ptr[i * 4 + 0]; @@ -620,7 +622,7 @@ static struct radeon_state *r600_blend(struct r600_context *rctx) const struct pipe_blend_state *state = &rctx->blend->state.blend; int i; - rstate = radeon_state(rscreen->rw, R600_BLEND); + rstate = radeon_state(rscreen->rw, R600_BLEND_TYPE, R600_BLEND); if (rstate == NULL) return NULL; rstate->states[R600_BLEND__CB_BLEND_RED] = fui(rctx->blend_color.color[0]); @@ -679,14 +681,14 @@ static struct radeon_state *r600_ucp(struct r600_context *rctx, int clip) struct radeon_state *rstate; const struct pipe_clip_state *state = &rctx->clip->state.clip; - rstate = radeon_state(rscreen->rw, R600_UCP0 + clip); + rstate = radeon_state(rscreen->rw, R600_CLIP_TYPE, R600_CLIP + clip); if (rstate == NULL) return NULL; - rstate->states[R600_UCP__PA_CL_UCP_X_0] = fui(state->ucp[clip][0]); - rstate->states[R600_UCP__PA_CL_UCP_Y_0] = fui(state->ucp[clip][1]); - rstate->states[R600_UCP__PA_CL_UCP_Z_0] = fui(state->ucp[clip][2]); - rstate->states[R600_UCP__PA_CL_UCP_W_0] = fui(state->ucp[clip][3]); + rstate->states[R600_CLIP__PA_CL_UCP_X_0] = fui(state->ucp[clip][0]); + rstate->states[R600_CLIP__PA_CL_UCP_Y_0] = fui(state->ucp[clip][1]); + rstate->states[R600_CLIP__PA_CL_UCP_Z_0] = fui(state->ucp[clip][2]); + rstate->states[R600_CLIP__PA_CL_UCP_W_0] = fui(state->ucp[clip][3]); if (radeon_state_pm4(rstate)) { radeon_state_decref(rstate); @@ -709,7 +711,7 @@ static struct radeon_state *r600_cb(struct r600_context *rctx, int cb) unsigned format, swap, ntype; const struct util_format_description *desc; - rstate = radeon_state(rscreen->rw, R600_CB0 + cb); + rstate = radeon_state(rscreen->rw, R600_CB0_TYPE + cb, R600_CB0 + cb); if (rstate == NULL) return NULL; rtex = (struct r600_resource_texture*)state->cbufs[cb]->texture; @@ -720,9 +722,6 @@ static struct radeon_state *r600_cb(struct r600_context *rctx, int cb) rstate->placement[0] = RADEON_GEM_DOMAIN_GTT; rstate->placement[2] = RADEON_GEM_DOMAIN_GTT; rstate->placement[4] = RADEON_GEM_DOMAIN_GTT; - rstate->reloc_pm4_id[0] = R600_CB__CB_COLOR0_BASE_BO_ID; - rstate->reloc_pm4_id[1] = R600_CB__CB_COLOR0_FRAG_BO_ID; - rstate->reloc_pm4_id[2] = R600_CB__CB_COLOR0_TILE_BO_ID; rstate->nbo = 3; pitch = (rtex->pitch[level] / rtex->bpt) / 8 - 1; slice = (rtex->pitch[level] / rtex->bpt) * state->cbufs[cb]->height / 64 - 1; @@ -741,14 +740,14 @@ static struct radeon_state *r600_cb(struct r600_context *rctx, int cb) S_0280A0_SOURCE_FORMAT(1) | S_0280A0_NUMBER_TYPE(ntype); - rstate->states[R600_CB__CB_COLOR0_BASE] = rtex->offset[level] >> 8; - rstate->states[R600_CB__CB_COLOR0_INFO] = color_info; - rstate->states[R600_CB__CB_COLOR0_SIZE] = S_028060_PITCH_TILE_MAX(pitch) | + rstate->states[R600_CB0__CB_COLOR0_BASE] = rtex->offset[level] >> 8; + rstate->states[R600_CB0__CB_COLOR0_INFO] = color_info; + rstate->states[R600_CB0__CB_COLOR0_SIZE] = S_028060_PITCH_TILE_MAX(pitch) | S_028060_SLICE_TILE_MAX(slice); - rstate->states[R600_CB__CB_COLOR0_VIEW] = 0x00000000; - rstate->states[R600_CB__CB_COLOR0_FRAG] = 0x00000000; - rstate->states[R600_CB__CB_COLOR0_TILE] = 0x00000000; - rstate->states[R600_CB__CB_COLOR0_MASK] = 0x00000000; + rstate->states[R600_CB0__CB_COLOR0_VIEW] = 0x00000000; + rstate->states[R600_CB0__CB_COLOR0_FRAG] = 0x00000000; + rstate->states[R600_CB0__CB_COLOR0_TILE] = 0x00000000; + rstate->states[R600_CB0__CB_COLOR0_MASK] = 0x00000000; if (radeon_state_pm4(rstate)) { radeon_state_decref(rstate); return NULL; @@ -769,7 +768,7 @@ static struct radeon_state *r600_db(struct r600_context *rctx) if (state->zsbuf == NULL) return NULL; - rstate = radeon_state(rscreen->rw, R600_DB); + rstate = radeon_state(rscreen->rw, R600_DB_TYPE, R600_DB); if (rstate == NULL) return NULL; @@ -783,7 +782,6 @@ static struct radeon_state *r600_db(struct r600_context *rctx) rstate->bo[0] = radeon_bo_incref(rscreen->rw, rbuffer->bo); rstate->nbo = 1; rstate->placement[0] = RADEON_GEM_DOMAIN_VRAM; - rstate->reloc_pm4_id[0] = R600_DB__DB_DEPTH_BASE_BO_ID; level = state->zsbuf->level; pitch = (rtex->pitch[level] / rtex->bpt) / 8 - 1; slice = (rtex->pitch[level] / rtex->bpt) * state->zsbuf->height / 64 - 1; @@ -846,7 +844,7 @@ static struct radeon_state *r600_rasterizer(struct r600_context *rctx) prov_vtx = 0; rctx->flat_shade = state->flatshade; - rstate = radeon_state(rscreen->rw, R600_RASTERIZER); + rstate = radeon_state(rscreen->rw, R600_RASTERIZER_TYPE, R600_RASTERIZER); if (rstate == NULL) return NULL; rstate->states[R600_RASTERIZER__SPI_INTERP_CONTROL_0] = 0x00000001; @@ -927,7 +925,7 @@ static struct radeon_state *r600_scissor(struct r600_context *rctx) } tl = S_028240_TL_X(minx) | S_028240_TL_Y(miny) | S_028240_WINDOW_OFFSET_DISABLE(1); br = S_028244_BR_X(maxx) | S_028244_BR_Y(maxy); - rstate = radeon_state(rscreen->rw, R600_SCISSOR); + rstate = radeon_state(rscreen->rw, R600_SCISSOR_TYPE, R600_SCISSOR); if (rstate == NULL) return NULL; rstate->states[R600_SCISSOR__PA_SC_SCREEN_SCISSOR_TL] = tl; @@ -962,7 +960,7 @@ static struct radeon_state *r600_viewport(struct r600_context *rctx) struct r600_screen *rscreen = rctx->screen; struct radeon_state *rstate; - rstate = radeon_state(rscreen->rw, R600_VIEWPORT); + rstate = radeon_state(rscreen->rw, R600_VIEWPORT_TYPE, R600_VIEWPORT); if (rstate == NULL) return NULL; rstate->states[R600_VIEWPORT__PA_SC_VPORT_ZMIN_0] = 0x00000000; @@ -995,7 +993,7 @@ static struct radeon_state *r600_dsa(struct r600_context *rctx) if (rctx->ps_shader == NULL) { return NULL; } - rstate = radeon_state(rscreen->rw, R600_DSA); + rstate = radeon_state(rscreen->rw, R600_DSA_TYPE, R600_DSA); if (rstate == NULL) return NULL; @@ -1147,7 +1145,7 @@ static struct radeon_state *r600_sampler(struct r600_context *rctx, struct r600_screen *rscreen = rctx->screen; struct radeon_state *rstate; - rstate = radeon_state(rscreen->rw, id); + rstate = radeon_state(rscreen->rw, R600_PS_SAMPLER_TYPE, id); if (rstate == NULL) return NULL; rstate->states[R600_PS_SAMPLER__SQ_TEX_SAMPLER_WORD0_0] = @@ -1248,7 +1246,7 @@ static struct radeon_state *r600_resource(struct pipe_context *ctx, R600_ERR("unknow format %d\n", view->texture->format); return NULL; } - rstate = radeon_state(rscreen->rw, id); + rstate = radeon_state(rscreen->rw, R600_PS_RESOURCE_TYPE, id); if (rstate == NULL) { return NULL; } @@ -1270,36 +1268,34 @@ static struct radeon_state *r600_resource(struct pipe_context *ctx, rstate->placement[1] = RADEON_GEM_DOMAIN_GTT; rstate->placement[2] = RADEON_GEM_DOMAIN_GTT; rstate->placement[3] = RADEON_GEM_DOMAIN_GTT; - rstate->reloc_pm4_id[0] = R600_RESOURCE__RESOURCE_BO0_ID; - rstate->reloc_pm4_id[1] = R600_RESOURCE__RESOURCE_BO1_ID; pitch = (tmp->pitch[0] / tmp->bpt); pitch = (pitch + 0x7) & ~0x7; /* FIXME properly handle first level != 0 */ - rstate->states[R600_RESOURCE__RESOURCE_WORD0] = + rstate->states[R600_PS_RESOURCE__RESOURCE0_WORD0] = S_038000_DIM(r600_tex_dim(view->texture->target)) | S_038000_TILE_MODE(array_mode) | S_038000_TILE_TYPE(tile_type) | S_038000_PITCH((pitch / 8) - 1) | S_038000_TEX_WIDTH(view->texture->width0 - 1); - rstate->states[R600_RESOURCE__RESOURCE_WORD1] = + rstate->states[R600_PS_RESOURCE__RESOURCE0_WORD1] = S_038004_TEX_HEIGHT(view->texture->height0 - 1) | S_038004_TEX_DEPTH(view->texture->depth0 - 1) | S_038004_DATA_FORMAT(format); - rstate->states[R600_RESOURCE__RESOURCE_WORD2] = tmp->offset[0] >> 8; - rstate->states[R600_RESOURCE__RESOURCE_WORD3] = tmp->offset[1] >> 8; - rstate->states[R600_RESOURCE__RESOURCE_WORD4] = + rstate->states[R600_PS_RESOURCE__RESOURCE0_WORD2] = tmp->offset[0] >> 8; + rstate->states[R600_PS_RESOURCE__RESOURCE0_WORD3] = tmp->offset[1] >> 8; + rstate->states[R600_PS_RESOURCE__RESOURCE0_WORD4] = word4 | S_038010_NUM_FORMAT_ALL(V_038010_SQ_NUM_FORMAT_NORM) | S_038010_SRF_MODE_ALL(V_038010_SFR_MODE_NO_ZERO) | S_038010_REQUEST_SIZE(1) | S_038010_BASE_LEVEL(view->first_level); - rstate->states[R600_RESOURCE__RESOURCE_WORD5] = + rstate->states[R600_PS_RESOURCE__RESOURCE0_WORD5] = S_038014_LAST_LEVEL(view->last_level) | S_038014_BASE_ARRAY(0) | S_038014_LAST_ARRAY(0); - rstate->states[R600_RESOURCE__RESOURCE_WORD6] = + rstate->states[R600_PS_RESOURCE__RESOURCE0_WORD6] = S_038018_TYPE(V_038010_SQ_TEX_VTX_VALID_TEXTURE); if (radeon_state_pm4(rstate)) { radeon_state_decref(rstate); @@ -1346,7 +1342,7 @@ static struct radeon_state *r600_cb_cntl(struct r600_context *rctx) target_mask |= (pbs->rt[0].colormask << (4 * i)); } } - rstate = radeon_state(rscreen->rw, R600_CB_CNTL); + rstate = radeon_state(rscreen->rw, R600_CB_CNTL_TYPE, R600_CB_CNTL); rstate->states[R600_CB_CNTL__CB_SHADER_MASK] = shader_mask; rstate->states[R600_CB_CNTL__CB_TARGET_MASK] = target_mask; rstate->states[R600_CB_CNTL__CB_COLOR_CONTROL] = color_control; @@ -1423,7 +1419,7 @@ int r600_context_hw_states(struct pipe_context *ctx) if (rctx->ps_sampler[i]) { rctx->hw_states.ps_sampler[i] = r600_sampler(rctx, &rctx->ps_sampler[i]->state.sampler, - R600_PS_SAMPLER0 + i); + R600_PS_SAMPLER + i); } } rctx->hw_states.ps_nsampler = rctx->ps_nsampler; @@ -1431,7 +1427,7 @@ int r600_context_hw_states(struct pipe_context *ctx) if (rctx->ps_sampler_view[i]) { rctx->hw_states.ps_resource[i] = r600_resource(ctx, &rctx->ps_sampler_view[i]->state.sampler_view, - R600_PS_RESOURCE0 + i); + R600_PS_RESOURCE + i); } } rctx->hw_states.ps_nresource = rctx->ps_nsampler_view; diff --git a/src/gallium/drivers/r600/r600_texture.c b/src/gallium/drivers/r600/r600_texture.c index 9dc0208eb1..fb84ed9cfe 100644 --- a/src/gallium/drivers/r600/r600_texture.c +++ b/src/gallium/drivers/r600/r600_texture.c @@ -663,7 +663,7 @@ static struct radeon_state *r600_texture_state_scissor(struct r600_screen *rscre { struct radeon_state *rstate; - rstate = radeon_state(rscreen->rw, R600_SCISSOR); + rstate = radeon_state(rscreen->rw, R600_SCISSOR_TYPE, R600_SCISSOR); if (rstate == NULL) return NULL; @@ -707,7 +707,7 @@ static struct radeon_state *r600_texture_state_cb0(struct r600_screen *rscreen, unsigned format, swap, ntype; const struct util_format_description *desc; - rstate = radeon_state(rscreen->rw, R600_CB0); + rstate = radeon_state(rscreen->rw, R600_CB0_TYPE, R600_CB0); if (rstate == NULL) return NULL; rbuffer = &rtexture->resource; @@ -742,16 +742,13 @@ static struct radeon_state *r600_texture_state_cb0(struct r600_screen *rscreen, rstate->nbo = 3; color_info = S_0280A0_SOURCE_FORMAT(1); } - rstate->reloc_pm4_id[0] = R600_CB__CB_COLOR0_BASE_BO_ID; - rstate->reloc_pm4_id[1] = R600_CB__CB_COLOR0_FRAG_BO_ID; - rstate->reloc_pm4_id[2] = R600_CB__CB_COLOR0_TILE_BO_ID; color_info |= S_0280A0_FORMAT(format) | S_0280A0_COMP_SWAP(swap) | S_0280A0_BLEND_CLAMP(1) | S_0280A0_NUMBER_TYPE(ntype); - rstate->states[R600_CB__CB_COLOR0_BASE] = rtexture->offset[level] >> 8; - rstate->states[R600_CB__CB_COLOR0_INFO] = color_info; - rstate->states[R600_CB__CB_COLOR0_SIZE] = S_028060_PITCH_TILE_MAX(pitch) | + rstate->states[R600_CB0__CB_COLOR0_BASE] = rtexture->offset[level] >> 8; + rstate->states[R600_CB0__CB_COLOR0_INFO] = color_info; + rstate->states[R600_CB0__CB_COLOR0_SIZE] = S_028060_PITCH_TILE_MAX(pitch) | S_028060_SLICE_TILE_MAX(slice); if (radeon_state_pm4(rstate)) { @@ -769,7 +766,7 @@ static struct radeon_state *r600_texture_state_db(struct r600_screen *rscreen, struct r600_resource *rbuffer; unsigned pitch, slice, format; - rstate = radeon_state(rscreen->rw, R600_DB); + rstate = radeon_state(rscreen->rw, R600_DB_TYPE, R600_DB); if (rstate == NULL) return NULL; rbuffer = &rtexture->resource; @@ -787,7 +784,6 @@ static struct radeon_state *r600_texture_state_db(struct r600_screen *rscreen, rstate->states[R600_DB__DB_PREFETCH_LIMIT] = (rtexture->height[level] / 8) -1; rstate->states[R600_DB__DB_DEPTH_SIZE] = S_028000_PITCH_TILE_MAX(pitch) | S_028000_SLICE_TILE_MAX(slice); - rstate->reloc_pm4_id[0] = R600_DB__DB_DEPTH_BASE_BO_ID; rstate->bo[0] = radeon_bo_incref(rscreen->rw, rbuffer->bo); rstate->placement[0] = RADEON_GEM_DOMAIN_GTT; rstate->nbo = 1; @@ -819,7 +815,7 @@ static struct radeon_state *r600_texture_state_viewport(struct r600_screen *rscr { struct radeon_state *rstate; - rstate = radeon_state(rscreen->rw, R600_VIEWPORT); + rstate = radeon_state(rscreen->rw, R600_VIEWPORT_TYPE, R600_VIEWPORT); if (rstate == NULL) return NULL; diff --git a/src/gallium/drivers/r600/radeon.h b/src/gallium/drivers/r600/radeon.h index 777fe3e792..b2cc74f696 100644 --- a/src/gallium/drivers/r600/radeon.h +++ b/src/gallium/drivers/r600/radeon.h @@ -104,18 +104,26 @@ int radeon_bo_wait(struct radeon *radeon, struct radeon_bo *bo); struct radeon_state { struct radeon *radeon; unsigned refcount; + unsigned type; unsigned id; + unsigned nstates; + u32 *states; + unsigned npm4; unsigned cpm4; - u32 states[128]; u32 pm4_crc; + u32 *pm4; + u32 nimmd; + u32 *immd; unsigned nbo; struct radeon_bo *bo[4]; - unsigned reloc_pm4_id[4]; + unsigned nreloc; + unsigned reloc_pm4_id[8]; + unsigned reloc_bo_id[8]; u32 placement[8]; unsigned bo_dirty[4]; }; -struct radeon_state *radeon_state(struct radeon *radeon, u32 id); +struct radeon_state *radeon_state(struct radeon *radeon, u32 type, u32 id); struct radeon_state *radeon_state_incref(struct radeon_state *state); struct radeon_state *radeon_state_decref(struct radeon_state *state); int radeon_state_pm4(struct radeon_state *state); @@ -139,6 +147,16 @@ int radeon_draw_set(struct radeon_draw *draw, struct radeon_state *state); int radeon_draw_set_new(struct radeon_draw *draw, struct radeon_state *state); int radeon_draw_check(struct radeon_draw *draw); +struct radeon_ctx *radeon_ctx(struct radeon *radeon); +struct radeon_ctx *radeon_ctx_decref(struct radeon_ctx *ctx); +struct radeon_ctx *radeon_ctx_incref(struct radeon_ctx *ctx); +int radeon_ctx_set_draw(struct radeon_ctx *ctx, struct radeon_draw *draw); +int radeon_ctx_set_query_state(struct radeon_ctx *ctx, struct radeon_state *state); +int radeon_ctx_set_draw_new(struct radeon_ctx *ctx, struct radeon_draw *draw); +int radeon_ctx_pm4(struct radeon_ctx *ctx); +int radeon_ctx_submit(struct radeon_ctx *ctx); +void radeon_ctx_dump_bof(struct radeon_ctx *ctx, const char *file); + /* * radeon context functions */ @@ -151,216 +169,261 @@ struct radeon_cs_reloc { }; #pragma pack() -struct radeon_ctx_bo { - struct radeon_bo *bo; - u32 bo_flushed; - unsigned state_id; -}; - struct radeon_ctx { int refcount; struct radeon *radeon; u32 *pm4; - int npm4; + u32 cpm4; + u32 draw_cpm4; unsigned id; + unsigned next_id; unsigned nreloc; - unsigned max_reloc; struct radeon_cs_reloc *reloc; unsigned nbo; - struct radeon_ctx_bo *bo; - unsigned max_bo; - u32 *state_crc32; + struct radeon_bo **bo; + unsigned ndraw; + struct radeon_draw *cdraw; + struct radeon_draw **draw; + unsigned nstate; + struct radeon_state **state; }; -struct radeon_ctx *radeon_ctx(struct radeon *radeon); -struct radeon_ctx *radeon_ctx_decref(struct radeon_ctx *ctx); -struct radeon_ctx *radeon_ctx_incref(struct radeon_ctx *ctx); -void radeon_ctx_clear(struct radeon_ctx *ctx); -int radeon_ctx_set_draw(struct radeon_ctx *ctx, struct radeon_draw *draw); -int radeon_ctx_set_query_state(struct radeon_ctx *ctx, struct radeon_state *state); -int radeon_ctx_pm4(struct radeon_ctx *ctx); -int radeon_ctx_submit(struct radeon_ctx *ctx); -void radeon_ctx_dump_bof(struct radeon_ctx *ctx, const char *file); - - /* * R600/R700 */ -#define R600_CONFIG 0 -#define R600_CB_CNTL 1 -#define R600_RASTERIZER 2 -#define R600_VIEWPORT 3 -#define R600_SCISSOR 4 -#define R600_BLEND 5 -#define R600_DSA 6 -#define R600_VGT 7 -#define R600_QUERY_BEGIN 8 -#define R600_QUERY_END 9 -#define R600_VS_SHADER 10 -#define R600_PS_SHADER 11 -#define R600_DB 12 -#define R600_CB0 13 -#define R600_UCP0 21 -#define R600_PS_RESOURCE0 27 -#define R600_VS_RESOURCE0 187 -#define R600_FS_RESOURCE0 347 -#define R600_GS_RESOURCE0 363 -#define R600_PS_CONSTANT0 523 -#define R600_VS_CONSTANT0 779 -#define R600_PS_SAMPLER0 1035 -#define R600_VS_SAMPLER0 1053 -#define R600_GS_SAMPLER0 1071 -#define R600_PS_SAMPLER_BORDER0 1089 -#define R600_VS_SAMPLER_BORDER0 1107 -#define R600_GS_SAMPLER_BORDER0 1125 -#define R600_DRAW_AUTO 1143 -#define R600_DRAW 1144 -#define R600_NSTATE 1145 + +#define R600_NSTATE 1288 +#define R600_NTYPE 35 + +#define R600_CONFIG 0 +#define R600_CONFIG_TYPE 0 +#define R600_CB_CNTL 1 +#define R600_CB_CNTL_TYPE 1 +#define R600_RASTERIZER 2 +#define R600_RASTERIZER_TYPE 2 +#define R600_VIEWPORT 3 +#define R600_VIEWPORT_TYPE 3 +#define R600_SCISSOR 4 +#define R600_SCISSOR_TYPE 4 +#define R600_BLEND 5 +#define R600_BLEND_TYPE 5 +#define R600_DSA 6 +#define R600_DSA_TYPE 6 +#define R600_VS_SHADER 7 +#define R600_VS_SHADER_TYPE 7 +#define R600_PS_SHADER 8 +#define R600_PS_SHADER_TYPE 8 +#define R600_PS_CONSTANT 9 +#define R600_PS_CONSTANT_TYPE 9 +#define R600_VS_CONSTANT 265 +#define R600_VS_CONSTANT_TYPE 10 +#define R600_PS_RESOURCE 521 +#define R600_PS_RESOURCE_TYPE 11 +#define R600_VS_RESOURCE 681 +#define R600_VS_RESOURCE_TYPE 12 +#define R600_FS_RESOURCE 841 +#define R600_FS_RESOURCE_TYPE 13 +#define R600_GS_RESOURCE 1001 +#define R600_GS_RESOURCE_TYPE 14 +#define R600_PS_SAMPLER 1161 +#define R600_PS_SAMPLER_TYPE 15 +#define R600_VS_SAMPLER 1179 +#define R600_VS_SAMPLER_TYPE 16 +#define R600_GS_SAMPLER 1197 +#define R600_GS_SAMPLER_TYPE 17 +#define R600_PS_SAMPLER_BORDER 1215 +#define R600_PS_SAMPLER_BORDER_TYPE 18 +#define R600_VS_SAMPLER_BORDER 1233 +#define R600_VS_SAMPLER_BORDER_TYPE 19 +#define R600_GS_SAMPLER_BORDER 1251 +#define R600_GS_SAMPLER_BORDER_TYPE 20 +#define R600_CB0 1269 +#define R600_CB0_TYPE 21 +#define R600_CB1 1270 +#define R600_CB1_TYPE 22 +#define R600_CB2 1271 +#define R600_CB2_TYPE 23 +#define R600_CB3 1272 +#define R600_CB3_TYPE 24 +#define R600_CB4 1273 +#define R600_CB4_TYPE 25 +#define R600_CB5 1274 +#define R600_CB5_TYPE 26 +#define R600_CB6 1275 +#define R600_CB6_TYPE 27 +#define R600_CB7 1276 +#define R600_CB7_TYPE 28 +#define R600_QUERY_BEGIN 1277 +#define R600_QUERY_BEGIN_TYPE 29 +#define R600_QUERY_END 1278 +#define R600_QUERY_END_TYPE 30 +#define R600_DB 1279 +#define R600_DB_TYPE 31 +#define R600_CLIP 1280 +#define R600_CLIP_TYPE 32 +#define R600_VGT 1286 +#define R600_VGT_TYPE 33 +#define R600_DRAW 1287 +#define R600_DRAW_TYPE 34 /* R600_CONFIG */ -#define R600_CONFIG__SQ_CONFIG 0 +#define R600_CONFIG__SQ_CONFIG 0 #define R600_CONFIG__SQ_GPR_RESOURCE_MGMT_1 1 #define R600_CONFIG__SQ_GPR_RESOURCE_MGMT_2 2 #define R600_CONFIG__SQ_THREAD_RESOURCE_MGMT 3 #define R600_CONFIG__SQ_STACK_RESOURCE_MGMT_1 4 #define R600_CONFIG__SQ_STACK_RESOURCE_MGMT_2 5 -#define R600_CONFIG__SQ_DYN_GPR_CNTL_PS_FLUSH_REQ 8 -#define R600_CONFIG__TA_CNTL_AUX 11 -#define R600_CONFIG__VC_ENHANCE 14 -#define R600_CONFIG__DB_DEBUG 17 -#define R600_CONFIG__DB_WATERMARKS 20 -#define R600_CONFIG__SX_MISC 23 -#define R600_CONFIG__SPI_THREAD_GROUPING 26 -#define R600_CONFIG__CB_SHADER_CONTROL 29 -#define R600_CONFIG__SQ_ESGS_RING_ITEMSIZE 32 -#define R600_CONFIG__SQ_GSVS_RING_ITEMSIZE 33 -#define R600_CONFIG__SQ_ESTMP_RING_ITEMSIZE 34 -#define R600_CONFIG__SQ_GSTMP_RING_ITEMSIZE 35 -#define R600_CONFIG__SQ_VSTMP_RING_ITEMSIZE 36 -#define R600_CONFIG__SQ_PSTMP_RING_ITEMSIZE 37 -#define R600_CONFIG__SQ_FBUF_RING_ITEMSIZE 38 -#define R600_CONFIG__SQ_REDUC_RING_ITEMSIZE 39 -#define R600_CONFIG__SQ_GS_VERT_ITEMSIZE 40 -#define R600_CONFIG__VGT_OUTPUT_PATH_CNTL 43 -#define R600_CONFIG__VGT_HOS_CNTL 44 -#define R600_CONFIG__VGT_HOS_MAX_TESS_LEVEL 45 -#define R600_CONFIG__VGT_HOS_MIN_TESS_LEVEL 46 -#define R600_CONFIG__VGT_HOS_REUSE_DEPTH 47 -#define R600_CONFIG__VGT_GROUP_PRIM_TYPE 48 -#define R600_CONFIG__VGT_GROUP_FIRST_DECR 49 -#define R600_CONFIG__VGT_GROUP_DECR 50 -#define R600_CONFIG__VGT_GROUP_VECT_0_CNTL 51 -#define R600_CONFIG__VGT_GROUP_VECT_1_CNTL 52 -#define R600_CONFIG__VGT_GROUP_VECT_0_FMT_CNTL 53 -#define R600_CONFIG__VGT_GROUP_VECT_1_FMT_CNTL 54 -#define R600_CONFIG__VGT_GS_MODE 55 -#define R600_CONFIG__PA_SC_MODE_CNTL 58 -#define R600_CONFIG__VGT_STRMOUT_EN 61 -#define R600_CONFIG__VGT_REUSE_OFF 62 -#define R600_CONFIG__VGT_VTX_CNT_EN 63 -#define R600_CONFIG__VGT_STRMOUT_BUFFER_EN 66 +#define R600_CONFIG__SQ_DYN_GPR_CNTL_PS_FLUSH_REQ 6 +#define R600_CONFIG__TA_CNTL_AUX 7 +#define R600_CONFIG__VC_ENHANCE 8 +#define R600_CONFIG__DB_DEBUG 9 +#define R600_CONFIG__DB_WATERMARKS 10 +#define R600_CONFIG__SX_MISC 11 +#define R600_CONFIG__SPI_THREAD_GROUPING 12 +#define R600_CONFIG__CB_SHADER_CONTROL 13 +#define R600_CONFIG__SQ_ESGS_RING_ITEMSIZE 14 +#define R600_CONFIG__SQ_GSVS_RING_ITEMSIZE 15 +#define R600_CONFIG__SQ_ESTMP_RING_ITEMSIZE 16 +#define R600_CONFIG__SQ_GSTMP_RING_ITEMSIZE 17 +#define R600_CONFIG__SQ_VSTMP_RING_ITEMSIZE 18 +#define R600_CONFIG__SQ_PSTMP_RING_ITEMSIZE 19 +#define R600_CONFIG__SQ_FBUF_RING_ITEMSIZE 20 +#define R600_CONFIG__SQ_REDUC_RING_ITEMSIZE 21 +#define R600_CONFIG__SQ_GS_VERT_ITEMSIZE 22 +#define R600_CONFIG__VGT_OUTPUT_PATH_CNTL 23 +#define R600_CONFIG__VGT_HOS_CNTL 24 +#define R600_CONFIG__VGT_HOS_MAX_TESS_LEVEL 25 +#define R600_CONFIG__VGT_HOS_MIN_TESS_LEVEL 26 +#define R600_CONFIG__VGT_HOS_REUSE_DEPTH 27 +#define R600_CONFIG__VGT_GROUP_PRIM_TYPE 28 +#define R600_CONFIG__VGT_GROUP_FIRST_DECR 29 +#define R600_CONFIG__VGT_GROUP_DECR 30 +#define R600_CONFIG__VGT_GROUP_VECT_0_CNTL 31 +#define R600_CONFIG__VGT_GROUP_VECT_1_CNTL 32 +#define R600_CONFIG__VGT_GROUP_VECT_0_FMT_CNTL 33 +#define R600_CONFIG__VGT_GROUP_VECT_1_FMT_CNTL 34 +#define R600_CONFIG__VGT_GS_MODE 35 +#define R600_CONFIG__PA_SC_MODE_CNTL 36 +#define R600_CONFIG__VGT_STRMOUT_EN 37 +#define R600_CONFIG__VGT_REUSE_OFF 38 +#define R600_CONFIG__VGT_VTX_CNT_EN 39 +#define R600_CONFIG__VGT_STRMOUT_BUFFER_EN 40 +#define R600_CONFIG_SIZE 41 +#define R600_CONFIG_PM4 128 /* R600_CB_CNTL */ -#define R600_CB_CNTL__CB_CLEAR_RED 0 -#define R600_CB_CNTL__CB_CLEAR_GREEN 1 -#define R600_CB_CNTL__CB_CLEAR_BLUE 2 -#define R600_CB_CNTL__CB_CLEAR_ALPHA 3 -#define R600_CB_CNTL__CB_SHADER_MASK 6 -#define R600_CB_CNTL__CB_TARGET_MASK 7 -#define R600_CB_CNTL__CB_FOG_RED 10 -#define R600_CB_CNTL__CB_FOG_GREEN 11 -#define R600_CB_CNTL__CB_FOG_BLUE 12 -#define R600_CB_CNTL__CB_COLOR_CONTROL 15 -#define R600_CB_CNTL__PA_SC_AA_CONFIG 18 -#define R600_CB_CNTL__PA_SC_AA_SAMPLE_LOCS_MCTX 21 -#define R600_CB_CNTL__PA_SC_AA_SAMPLE_LOCS_8S_WD1_MCTX 22 -#define R600_CB_CNTL__CB_CLRCMP_CONTROL 25 -#define R600_CB_CNTL__CB_CLRCMP_SRC 26 -#define R600_CB_CNTL__CB_CLRCMP_DST 27 -#define R600_CB_CNTL__CB_CLRCMP_MSK 28 -#define R600_CB_CNTL__PA_SC_AA_MASK 31 +#define R600_CB_CNTL__CB_CLEAR_RED 0 +#define R600_CB_CNTL__CB_CLEAR_GREEN 1 +#define R600_CB_CNTL__CB_CLEAR_BLUE 2 +#define R600_CB_CNTL__CB_CLEAR_ALPHA 3 +#define R600_CB_CNTL__CB_SHADER_MASK 4 +#define R600_CB_CNTL__CB_TARGET_MASK 5 +#define R600_CB_CNTL__CB_FOG_RED 6 +#define R600_CB_CNTL__CB_FOG_GREEN 7 +#define R600_CB_CNTL__CB_FOG_BLUE 8 +#define R600_CB_CNTL__CB_COLOR_CONTROL 9 +#define R600_CB_CNTL__PA_SC_AA_CONFIG 10 +#define R600_CB_CNTL__PA_SC_AA_SAMPLE_LOCS_MCTX 11 +#define R600_CB_CNTL__PA_SC_AA_SAMPLE_LOCS_8S_WD1_MCTX 12 +#define R600_CB_CNTL__CB_CLRCMP_CONTROL 13 +#define R600_CB_CNTL__CB_CLRCMP_SRC 14 +#define R600_CB_CNTL__CB_CLRCMP_DST 15 +#define R600_CB_CNTL__CB_CLRCMP_MSK 16 +#define R600_CB_CNTL__PA_SC_AA_MASK 17 +#define R600_CB_CNTL_SIZE 18 +#define R600_CB_CNTL_PM4 128 /* R600_RASTERIZER */ #define R600_RASTERIZER__SPI_INTERP_CONTROL_0 0 -#define R600_RASTERIZER__PA_CL_CLIP_CNTL 3 -#define R600_RASTERIZER__PA_SU_SC_MODE_CNTL 4 -#define R600_RASTERIZER__PA_CL_VS_OUT_CNTL 7 -#define R600_RASTERIZER__PA_CL_NANINF_CNTL 8 -#define R600_RASTERIZER__PA_SU_POINT_SIZE 11 -#define R600_RASTERIZER__PA_SU_POINT_MINMAX 12 -#define R600_RASTERIZER__PA_SU_LINE_CNTL 13 -#define R600_RASTERIZER__PA_SC_LINE_STIPPLE 14 -#define R600_RASTERIZER__PA_SC_MPASS_PS_CNTL 17 -#define R600_RASTERIZER__PA_SC_LINE_CNTL 20 -#define R600_RASTERIZER__PA_CL_GB_VERT_CLIP_ADJ 23 -#define R600_RASTERIZER__PA_CL_GB_VERT_DISC_ADJ 24 -#define R600_RASTERIZER__PA_CL_GB_HORZ_CLIP_ADJ 25 -#define R600_RASTERIZER__PA_CL_GB_HORZ_DISC_ADJ 26 -#define R600_RASTERIZER__PA_SU_POLY_OFFSET_DB_FMT_CNTL 29 -#define R600_RASTERIZER__PA_SU_POLY_OFFSET_CLAMP 30 -#define R600_RASTERIZER__PA_SU_POLY_OFFSET_FRONT_SCALE 31 -#define R600_RASTERIZER__PA_SU_POLY_OFFSET_FRONT_OFFSET 32 -#define R600_RASTERIZER__PA_SU_POLY_OFFSET_BACK_SCALE 33 -#define R600_RASTERIZER__PA_SU_POLY_OFFSET_BACK_OFFSET 34 +#define R600_RASTERIZER__PA_CL_CLIP_CNTL 1 +#define R600_RASTERIZER__PA_SU_SC_MODE_CNTL 2 +#define R600_RASTERIZER__PA_CL_VS_OUT_CNTL 3 +#define R600_RASTERIZER__PA_CL_NANINF_CNTL 4 +#define R600_RASTERIZER__PA_SU_POINT_SIZE 5 +#define R600_RASTERIZER__PA_SU_POINT_MINMAX 6 +#define R600_RASTERIZER__PA_SU_LINE_CNTL 7 +#define R600_RASTERIZER__PA_SC_LINE_STIPPLE 8 +#define R600_RASTERIZER__PA_SC_MPASS_PS_CNTL 9 +#define R600_RASTERIZER__PA_SC_LINE_CNTL 10 +#define R600_RASTERIZER__PA_CL_GB_VERT_CLIP_ADJ 11 +#define R600_RASTERIZER__PA_CL_GB_VERT_DISC_ADJ 12 +#define R600_RASTERIZER__PA_CL_GB_HORZ_CLIP_ADJ 13 +#define R600_RASTERIZER__PA_CL_GB_HORZ_DISC_ADJ 14 +#define R600_RASTERIZER__PA_SU_POLY_OFFSET_DB_FMT_CNTL 15 +#define R600_RASTERIZER__PA_SU_POLY_OFFSET_CLAMP 16 +#define R600_RASTERIZER__PA_SU_POLY_OFFSET_FRONT_SCALE 17 +#define R600_RASTERIZER__PA_SU_POLY_OFFSET_FRONT_OFFSET 18 +#define R600_RASTERIZER__PA_SU_POLY_OFFSET_BACK_SCALE 19 +#define R600_RASTERIZER__PA_SU_POLY_OFFSET_BACK_OFFSET 20 +#define R600_RASTERIZER_SIZE 21 +#define R600_RASTERIZER_PM4 128 /* R600_VIEWPORT */ #define R600_VIEWPORT__PA_SC_VPORT_ZMIN_0 0 #define R600_VIEWPORT__PA_SC_VPORT_ZMAX_0 1 -#define R600_VIEWPORT__PA_CL_VPORT_XSCALE_0 4 -#define R600_VIEWPORT__PA_CL_VPORT_YSCALE_0 7 -#define R600_VIEWPORT__PA_CL_VPORT_ZSCALE_0 10 -#define R600_VIEWPORT__PA_CL_VPORT_XOFFSET_0 13 -#define R600_VIEWPORT__PA_CL_VPORT_YOFFSET_0 16 -#define R600_VIEWPORT__PA_CL_VPORT_ZOFFSET_0 19 -#define R600_VIEWPORT__PA_CL_VTE_CNTL 22 +#define R600_VIEWPORT__PA_CL_VPORT_XSCALE_0 2 +#define R600_VIEWPORT__PA_CL_VPORT_YSCALE_0 3 +#define R600_VIEWPORT__PA_CL_VPORT_ZSCALE_0 4 +#define R600_VIEWPORT__PA_CL_VPORT_XOFFSET_0 5 +#define R600_VIEWPORT__PA_CL_VPORT_YOFFSET_0 6 +#define R600_VIEWPORT__PA_CL_VPORT_ZOFFSET_0 7 +#define R600_VIEWPORT__PA_CL_VTE_CNTL 8 +#define R600_VIEWPORT_SIZE 9 +#define R600_VIEWPORT_PM4 128 /* R600_SCISSOR */ #define R600_SCISSOR__PA_SC_SCREEN_SCISSOR_TL 0 #define R600_SCISSOR__PA_SC_SCREEN_SCISSOR_BR 1 -#define R600_SCISSOR__PA_SC_WINDOW_OFFSET 4 -#define R600_SCISSOR__PA_SC_WINDOW_SCISSOR_TL 5 -#define R600_SCISSOR__PA_SC_WINDOW_SCISSOR_BR 6 -#define R600_SCISSOR__PA_SC_CLIPRECT_RULE 7 -#define R600_SCISSOR__PA_SC_CLIPRECT_0_TL 8 -#define R600_SCISSOR__PA_SC_CLIPRECT_0_BR 9 -#define R600_SCISSOR__PA_SC_CLIPRECT_1_TL 10 -#define R600_SCISSOR__PA_SC_CLIPRECT_1_BR 11 -#define R600_SCISSOR__PA_SC_CLIPRECT_2_TL 12 -#define R600_SCISSOR__PA_SC_CLIPRECT_2_BR 13 -#define R600_SCISSOR__PA_SC_CLIPRECT_3_TL 14 -#define R600_SCISSOR__PA_SC_CLIPRECT_3_BR 15 -#define R600_SCISSOR__PA_SC_EDGERULE 16 -#define R600_SCISSOR__PA_SC_GENERIC_SCISSOR_TL 19 -#define R600_SCISSOR__PA_SC_GENERIC_SCISSOR_BR 20 -#define R600_SCISSOR__PA_SC_VPORT_SCISSOR_0_TL 23 -#define R600_SCISSOR__PA_SC_VPORT_SCISSOR_0_BR 24 +#define R600_SCISSOR__PA_SC_WINDOW_OFFSET 2 +#define R600_SCISSOR__PA_SC_WINDOW_SCISSOR_TL 3 +#define R600_SCISSOR__PA_SC_WINDOW_SCISSOR_BR 4 +#define R600_SCISSOR__PA_SC_CLIPRECT_RULE 5 +#define R600_SCISSOR__PA_SC_CLIPRECT_0_TL 6 +#define R600_SCISSOR__PA_SC_CLIPRECT_0_BR 7 +#define R600_SCISSOR__PA_SC_CLIPRECT_1_TL 8 +#define R600_SCISSOR__PA_SC_CLIPRECT_1_BR 9 +#define R600_SCISSOR__PA_SC_CLIPRECT_2_TL 10 +#define R600_SCISSOR__PA_SC_CLIPRECT_2_BR 11 +#define R600_SCISSOR__PA_SC_CLIPRECT_3_TL 12 +#define R600_SCISSOR__PA_SC_CLIPRECT_3_BR 13 +#define R600_SCISSOR__PA_SC_EDGERULE 14 +#define R600_SCISSOR__PA_SC_GENERIC_SCISSOR_TL 15 +#define R600_SCISSOR__PA_SC_GENERIC_SCISSOR_BR 16 +#define R600_SCISSOR__PA_SC_VPORT_SCISSOR_0_TL 17 +#define R600_SCISSOR__PA_SC_VPORT_SCISSOR_0_BR 18 +#define R600_SCISSOR_SIZE 19 +#define R600_SCISSOR_PM4 128 /* R600_BLEND */ -#define R600_BLEND__CB_BLEND_RED 0 -#define R600_BLEND__CB_BLEND_GREEN 1 -#define R600_BLEND__CB_BLEND_BLUE 2 -#define R600_BLEND__CB_BLEND_ALPHA 3 -#define R600_BLEND__CB_BLEND0_CONTROL 6 -#define R600_BLEND__CB_BLEND1_CONTROL 7 -#define R600_BLEND__CB_BLEND2_CONTROL 8 -#define R600_BLEND__CB_BLEND3_CONTROL 9 -#define R600_BLEND__CB_BLEND4_CONTROL 10 -#define R600_BLEND__CB_BLEND5_CONTROL 11 -#define R600_BLEND__CB_BLEND6_CONTROL 12 -#define R600_BLEND__CB_BLEND7_CONTROL 13 -#define R600_BLEND__CB_BLEND_CONTROL 16 +#define R600_BLEND__CB_BLEND_RED 0 +#define R600_BLEND__CB_BLEND_GREEN 1 +#define R600_BLEND__CB_BLEND_BLUE 2 +#define R600_BLEND__CB_BLEND_ALPHA 3 +#define R600_BLEND__CB_BLEND0_CONTROL 4 +#define R600_BLEND__CB_BLEND1_CONTROL 5 +#define R600_BLEND__CB_BLEND2_CONTROL 6 +#define R600_BLEND__CB_BLEND3_CONTROL 7 +#define R600_BLEND__CB_BLEND4_CONTROL 8 +#define R600_BLEND__CB_BLEND5_CONTROL 9 +#define R600_BLEND__CB_BLEND6_CONTROL 10 +#define R600_BLEND__CB_BLEND7_CONTROL 11 +#define R600_BLEND__CB_BLEND_CONTROL 12 +#define R600_BLEND_SIZE 13 +#define R600_BLEND_PM4 128 /* R600_DSA */ -#define R600_DSA__DB_STENCIL_CLEAR 0 -#define R600_DSA__DB_DEPTH_CLEAR 1 -#define R600_DSA__SX_ALPHA_TEST_CONTROL 4 -#define R600_DSA__DB_STENCILREFMASK 7 -#define R600_DSA__DB_STENCILREFMASK_BF 8 -#define R600_DSA__SX_ALPHA_REF 9 -#define R600_DSA__SPI_FOG_FUNC_SCALE 12 -#define R600_DSA__SPI_FOG_FUNC_BIAS 13 -#define R600_DSA__SPI_FOG_CNTL 16 -#define R600_DSA__DB_DEPTH_CONTROL 19 -#define R600_DSA__DB_SHADER_CONTROL 22 -#define R600_DSA__DB_RENDER_CONTROL 25 -#define R600_DSA__DB_RENDER_OVERRIDE 26 -#define R600_DSA__DB_SRESULTS_COMPARE_STATE1 29 -#define R600_DSA__DB_PRELOAD_CONTROL 30 -#define R600_DSA__DB_ALPHA_TO_MASK 33 +#define R600_DSA__DB_STENCIL_CLEAR 0 +#define R600_DSA__DB_DEPTH_CLEAR 1 +#define R600_DSA__SX_ALPHA_TEST_CONTROL 2 +#define R600_DSA__DB_STENCILREFMASK 3 +#define R600_DSA__DB_STENCILREFMASK_BF 4 +#define R600_DSA__SX_ALPHA_REF 5 +#define R600_DSA__SPI_FOG_FUNC_SCALE 6 +#define R600_DSA__SPI_FOG_FUNC_BIAS 7 +#define R600_DSA__SPI_FOG_CNTL 8 +#define R600_DSA__DB_DEPTH_CONTROL 9 +#define R600_DSA__DB_SHADER_CONTROL 10 +#define R600_DSA__DB_RENDER_CONTROL 11 +#define R600_DSA__DB_RENDER_OVERRIDE 12 +#define R600_DSA__DB_SRESULTS_COMPARE_STATE1 13 +#define R600_DSA__DB_PRELOAD_CONTROL 14 +#define R600_DSA__DB_ALPHA_TO_MASK 15 +#define R600_DSA_SIZE 16 +#define R600_DSA_PM4 128 /* R600_VS_SHADER */ #define R600_VS_SHADER__SQ_VTX_SEMANTIC_0 0 #define R600_VS_SHADER__SQ_VTX_SEMANTIC_1 1 @@ -394,25 +457,25 @@ void radeon_ctx_dump_bof(struct radeon_ctx *ctx, const char *file); #define R600_VS_SHADER__SQ_VTX_SEMANTIC_29 29 #define R600_VS_SHADER__SQ_VTX_SEMANTIC_30 30 #define R600_VS_SHADER__SQ_VTX_SEMANTIC_31 31 -#define R600_VS_SHADER__SPI_VS_OUT_ID_0 34 -#define R600_VS_SHADER__SPI_VS_OUT_ID_1 35 -#define R600_VS_SHADER__SPI_VS_OUT_ID_2 36 -#define R600_VS_SHADER__SPI_VS_OUT_ID_3 37 -#define R600_VS_SHADER__SPI_VS_OUT_ID_4 38 -#define R600_VS_SHADER__SPI_VS_OUT_ID_5 39 -#define R600_VS_SHADER__SPI_VS_OUT_ID_6 40 -#define R600_VS_SHADER__SPI_VS_OUT_ID_7 41 -#define R600_VS_SHADER__SPI_VS_OUT_ID_8 42 -#define R600_VS_SHADER__SPI_VS_OUT_ID_9 43 -#define R600_VS_SHADER__SPI_VS_OUT_CONFIG 46 -#define R600_VS_SHADER__SQ_PGM_START_VS 49 -#define R600_VS_SHADER__SQ_PGM_START_VS_BO_ID 51 -#define R600_VS_SHADER__SQ_PGM_RESOURCES_VS 54 -#define R600_VS_SHADER__SQ_PGM_START_FS 57 -#define R600_VS_SHADER__SQ_PGM_START_FS_BO_ID 59 -#define R600_VS_SHADER__SQ_PGM_RESOURCES_FS 62 -#define R600_VS_SHADER__SQ_PGM_CF_OFFSET_VS 65 -#define R600_VS_SHADER__SQ_PGM_CF_OFFSET_FS 68 +#define R600_VS_SHADER__SPI_VS_OUT_ID_0 32 +#define R600_VS_SHADER__SPI_VS_OUT_ID_1 33 +#define R600_VS_SHADER__SPI_VS_OUT_ID_2 34 +#define R600_VS_SHADER__SPI_VS_OUT_ID_3 35 +#define R600_VS_SHADER__SPI_VS_OUT_ID_4 36 +#define R600_VS_SHADER__SPI_VS_OUT_ID_5 37 +#define R600_VS_SHADER__SPI_VS_OUT_ID_6 38 +#define R600_VS_SHADER__SPI_VS_OUT_ID_7 39 +#define R600_VS_SHADER__SPI_VS_OUT_ID_8 40 +#define R600_VS_SHADER__SPI_VS_OUT_ID_9 41 +#define R600_VS_SHADER__SPI_VS_OUT_CONFIG 42 +#define R600_VS_SHADER__SQ_PGM_START_VS 43 +#define R600_VS_SHADER__SQ_PGM_RESOURCES_VS 44 +#define R600_VS_SHADER__SQ_PGM_START_FS 45 +#define R600_VS_SHADER__SQ_PGM_RESOURCES_FS 46 +#define R600_VS_SHADER__SQ_PGM_CF_OFFSET_VS 47 +#define R600_VS_SHADER__SQ_PGM_CF_OFFSET_FS 48 +#define R600_VS_SHADER_SIZE 49 +#define R600_VS_SHADER_PM4 128 /* R600_PS_SHADER */ #define R600_PS_SHADER__SPI_PS_INPUT_CNTL_0 0 #define R600_PS_SHADER__SPI_PS_INPUT_CNTL_1 1 @@ -446,104 +509,158 @@ void radeon_ctx_dump_bof(struct radeon_ctx *ctx, const char *file); #define R600_PS_SHADER__SPI_PS_INPUT_CNTL_29 29 #define R600_PS_SHADER__SPI_PS_INPUT_CNTL_30 30 #define R600_PS_SHADER__SPI_PS_INPUT_CNTL_31 31 -#define R600_PS_SHADER__SPI_PS_IN_CONTROL_0 34 -#define R600_PS_SHADER__SPI_PS_IN_CONTROL_1 35 -#define R600_PS_SHADER__SPI_INPUT_Z 38 -#define R600_PS_SHADER__SQ_PGM_START_PS 41 -#define R600_PS_SHADER__SQ_PGM_START_PS_BO_ID 43 -#define R600_PS_SHADER__SQ_PGM_RESOURCES_PS 46 -#define R600_PS_SHADER__SQ_PGM_EXPORTS_PS 47 -#define R600_PS_SHADER__SQ_PGM_CF_OFFSET_PS 50 +#define R600_PS_SHADER__SPI_PS_IN_CONTROL_0 32 +#define R600_PS_SHADER__SPI_PS_IN_CONTROL_1 33 +#define R600_PS_SHADER__SPI_INPUT_Z 34 +#define R600_PS_SHADER__SQ_PGM_START_PS 35 +#define R600_PS_SHADER__SQ_PGM_RESOURCES_PS 36 +#define R600_PS_SHADER__SQ_PGM_EXPORTS_PS 37 +#define R600_PS_SHADER__SQ_PGM_CF_OFFSET_PS 38 +#define R600_PS_SHADER_SIZE 39 +#define R600_PS_SHADER_PM4 128 /* R600_PS_CONSTANT */ #define R600_PS_CONSTANT__SQ_ALU_CONSTANT0_0 0 #define R600_PS_CONSTANT__SQ_ALU_CONSTANT1_0 1 #define R600_PS_CONSTANT__SQ_ALU_CONSTANT2_0 2 #define R600_PS_CONSTANT__SQ_ALU_CONSTANT3_0 3 +#define R600_PS_CONSTANT_SIZE 4 +#define R600_PS_CONSTANT_PM4 128 /* R600_VS_CONSTANT */ #define R600_VS_CONSTANT__SQ_ALU_CONSTANT0_256 0 #define R600_VS_CONSTANT__SQ_ALU_CONSTANT1_256 1 #define R600_VS_CONSTANT__SQ_ALU_CONSTANT2_256 2 #define R600_VS_CONSTANT__SQ_ALU_CONSTANT3_256 3 +#define R600_VS_CONSTANT_SIZE 4 +#define R600_VS_CONSTANT_PM4 128 /* R600_PS_RESOURCE */ -#define R600_RESOURCE__RESOURCE_WORD0 0 -#define R600_RESOURCE__RESOURCE_WORD1 1 -#define R600_RESOURCE__RESOURCE_WORD2 2 -#define R600_RESOURCE__RESOURCE_WORD3 3 -#define R600_RESOURCE__RESOURCE_WORD4 4 -#define R600_RESOURCE__RESOURCE_WORD5 5 -#define R600_RESOURCE__RESOURCE_WORD6 6 -#define R600_RESOURCE__RESOURCE_BO0_ID 8 -#define R600_RESOURCE__RESOURCE_BO1_ID 10 +#define R600_PS_RESOURCE__RESOURCE0_WORD0 0 +#define R600_PS_RESOURCE__RESOURCE0_WORD1 1 +#define R600_PS_RESOURCE__RESOURCE0_WORD2 2 +#define R600_PS_RESOURCE__RESOURCE0_WORD3 3 +#define R600_PS_RESOURCE__RESOURCE0_WORD4 4 +#define R600_PS_RESOURCE__RESOURCE0_WORD5 5 +#define R600_PS_RESOURCE__RESOURCE0_WORD6 6 +#define R600_PS_RESOURCE_SIZE 7 +#define R600_PS_RESOURCE_PM4 128 +/* R600_VS_RESOURCE */ +#define R600_VS_RESOURCE__RESOURCE160_WORD0 0 +#define R600_VS_RESOURCE__RESOURCE160_WORD1 1 +#define R600_VS_RESOURCE__RESOURCE160_WORD2 2 +#define R600_VS_RESOURCE__RESOURCE160_WORD3 3 +#define R600_VS_RESOURCE__RESOURCE160_WORD4 4 +#define R600_VS_RESOURCE__RESOURCE160_WORD5 5 +#define R600_VS_RESOURCE__RESOURCE160_WORD6 6 +#define R600_VS_RESOURCE_SIZE 7 +#define R600_VS_RESOURCE_PM4 128 +/* R600_FS_RESOURCE */ +#define R600_FS_RESOURCE__RESOURCE320_WORD0 0 +#define R600_FS_RESOURCE__RESOURCE320_WORD1 1 +#define R600_FS_RESOURCE__RESOURCE320_WORD2 2 +#define R600_FS_RESOURCE__RESOURCE320_WORD3 3 +#define R600_FS_RESOURCE__RESOURCE320_WORD4 4 +#define R600_FS_RESOURCE__RESOURCE320_WORD5 5 +#define R600_FS_RESOURCE__RESOURCE320_WORD6 6 +#define R600_FS_RESOURCE_SIZE 7 +#define R600_FS_RESOURCE_PM4 128 +/* R600_GS_RESOURCE */ +#define R600_GS_RESOURCE__RESOURCE336_WORD0 0 +#define R600_GS_RESOURCE__RESOURCE336_WORD1 1 +#define R600_GS_RESOURCE__RESOURCE336_WORD2 2 +#define R600_GS_RESOURCE__RESOURCE336_WORD3 3 +#define R600_GS_RESOURCE__RESOURCE336_WORD4 4 +#define R600_GS_RESOURCE__RESOURCE336_WORD5 5 +#define R600_GS_RESOURCE__RESOURCE336_WORD6 6 +#define R600_GS_RESOURCE_SIZE 7 +#define R600_GS_RESOURCE_PM4 128 /* R600_PS_SAMPLER */ #define R600_PS_SAMPLER__SQ_TEX_SAMPLER_WORD0_0 0 #define R600_PS_SAMPLER__SQ_TEX_SAMPLER_WORD1_0 1 #define R600_PS_SAMPLER__SQ_TEX_SAMPLER_WORD2_0 2 +#define R600_PS_SAMPLER_SIZE 3 +#define R600_PS_SAMPLER_PM4 128 /* R600_VS_SAMPLER */ -#define R600_VS_SAMPLER__SQ_TEX_SAMPLER_WORD0_18 0 -#define R600_VS_SAMPLER__SQ_TEX_SAMPLER_WORD1_18 1 -#define R600_VS_SAMPLER__SQ_TEX_SAMPLER_WORD2_18 2 +#define R600_VS_SAMPLER__SQ_TEX_SAMPLER_WORD0_18 0 +#define R600_VS_SAMPLER__SQ_TEX_SAMPLER_WORD1_18 1 +#define R600_VS_SAMPLER__SQ_TEX_SAMPLER_WORD2_18 2 +#define R600_VS_SAMPLER_SIZE 3 +#define R600_VS_SAMPLER_PM4 128 /* R600_GS_SAMPLER */ -#define R600_GS_SAMPLER__SQ_TEX_SAMPLER_WORD0_36 0 -#define R600_GS_SAMPLER__SQ_TEX_SAMPLER_WORD1_36 1 -#define R600_GS_SAMPLER__SQ_TEX_SAMPLER_WORD2_36 2 +#define R600_GS_SAMPLER__SQ_TEX_SAMPLER_WORD0_36 0 +#define R600_GS_SAMPLER__SQ_TEX_SAMPLER_WORD1_36 1 +#define R600_GS_SAMPLER__SQ_TEX_SAMPLER_WORD2_36 2 +#define R600_GS_SAMPLER_SIZE 3 +#define R600_GS_SAMPLER_PM4 128 /* R600_PS_SAMPLER_BORDER */ -#define R600_PS_SAMPLER_BORDER__TD_PS_SAMPLER0_BORDER_RED 0 -#define R600_PS_SAMPLER_BORDER__TD_PS_SAMPLER0_BORDER_GREEN 1 -#define R600_PS_SAMPLER_BORDER__TD_PS_SAMPLER0_BORDER_BLUE 2 -#define R600_PS_SAMPLER_BORDER__TD_PS_SAMPLER0_BORDER_ALPHA 3 +#define R600_PS_SAMPLER_BORDER__TD_PS_SAMPLER0_BORDER_RED 0 +#define R600_PS_SAMPLER_BORDER__TD_PS_SAMPLER0_BORDER_GREEN 1 +#define R600_PS_SAMPLER_BORDER__TD_PS_SAMPLER0_BORDER_BLUE 2 +#define R600_PS_SAMPLER_BORDER__TD_PS_SAMPLER0_BORDER_ALPHA 3 +#define R600_PS_SAMPLER_BORDER_SIZE 4 +#define R600_PS_SAMPLER_BORDER_PM4 128 /* R600_VS_SAMPLER_BORDER */ -#define R600_VS_SAMPLER_BORDER__TD_VS_SAMPLER0_BORDER_RED 0 -#define R600_VS_SAMPLER_BORDER__TD_VS_SAMPLER0_BORDER_GREEN 1 -#define R600_VS_SAMPLER_BORDER__TD_VS_SAMPLER0_BORDER_BLUE 2 -#define R600_VS_SAMPLER_BORDER__TD_VS_SAMPLER0_BORDER_ALPHA 3 +#define R600_VS_SAMPLER_BORDER__TD_VS_SAMPLER0_BORDER_RED 0 +#define R600_VS_SAMPLER_BORDER__TD_VS_SAMPLER0_BORDER_GREEN 1 +#define R600_VS_SAMPLER_BORDER__TD_VS_SAMPLER0_BORDER_BLUE 2 +#define R600_VS_SAMPLER_BORDER__TD_VS_SAMPLER0_BORDER_ALPHA 3 +#define R600_VS_SAMPLER_BORDER_SIZE 4 +#define R600_VS_SAMPLER_BORDER_PM4 128 /* R600_GS_SAMPLER_BORDER */ -#define R600_GS_SAMPLER_BORDER__TD_GS_SAMPLER0_BORDER_RED 0 -#define R600_GS_SAMPLER_BORDER__TD_GS_SAMPLER0_BORDER_GREEN 1 -#define R600_GS_SAMPLER_BORDER__TD_GS_SAMPLER0_BORDER_BLUE 2 -#define R600_GS_SAMPLER_BORDER__TD_GS_SAMPLER0_BORDER_ALPHA 3 -/* R600_CB */ -#define R600_CB__CB_COLOR0_BASE 0 -#define R600_CB__CB_COLOR0_BASE_BO_ID 2 -#define R600_CB__CB_COLOR0_INFO 5 -#define R600_CB__CB_COLOR0_SIZE 8 -#define R600_CB__CB_COLOR0_VIEW 11 -#define R600_CB__CB_COLOR0_FRAG 14 -#define R600_CB__CB_COLOR0_FRAG_BO_ID 16 -#define R600_CB__CB_COLOR0_TILE 19 -#define R600_CB__CB_COLOR0_TILE_BO_ID 21 -#define R600_CB__CB_COLOR0_MASK 24 +#define R600_GS_SAMPLER_BORDER__TD_GS_SAMPLER0_BORDER_RED 0 +#define R600_GS_SAMPLER_BORDER__TD_GS_SAMPLER0_BORDER_GREEN 1 +#define R600_GS_SAMPLER_BORDER__TD_GS_SAMPLER0_BORDER_BLUE 2 +#define R600_GS_SAMPLER_BORDER__TD_GS_SAMPLER0_BORDER_ALPHA 3 +#define R600_GS_SAMPLER_BORDER_SIZE 4 +#define R600_GS_SAMPLER_BORDER_PM4 128 +/* R600_CB0 */ +#define R600_CB0__CB_COLOR0_BASE 0 +#define R600_CB0__CB_COLOR0_INFO 1 +#define R600_CB0__CB_COLOR0_SIZE 2 +#define R600_CB0__CB_COLOR0_VIEW 3 +#define R600_CB0__CB_COLOR0_FRAG 4 +#define R600_CB0__CB_COLOR0_TILE 5 +#define R600_CB0__CB_COLOR0_MASK 6 +#define R600_CB0_SIZE 7 +#define R600_CB0_PM4 128 /* R600_DB */ -#define R600_DB__DB_DEPTH_BASE 0 -#define R600_DB__DB_DEPTH_BASE_BO_ID 2 -#define R600_DB__DB_DEPTH_SIZE 5 -#define R600_DB__DB_DEPTH_VIEW 6 -#define R600_DB__DB_DEPTH_INFO 9 -#define R600_DB__DB_HTILE_SURFACE 12 -#define R600_DB__DB_PREFETCH_LIMIT 15 +#define R600_DB__DB_DEPTH_BASE 0 +#define R600_DB__DB_DEPTH_SIZE 1 +#define R600_DB__DB_DEPTH_VIEW 2 +#define R600_DB__DB_DEPTH_INFO 3 +#define R600_DB__DB_HTILE_SURFACE 4 +#define R600_DB__DB_PREFETCH_LIMIT 5 +#define R600_DB_SIZE 6 +#define R600_DB_PM4 128 /* R600_VGT */ -#define R600_VGT__VGT_MAX_VTX_INDX 0 -#define R600_VGT__VGT_MIN_VTX_INDX 1 -#define R600_VGT__VGT_INDX_OFFSET 2 -#define R600_VGT__VGT_MULTI_PRIM_IB_RESET_INDX 3 -#define R600_VGT__VGT_PRIMITIVE_TYPE 6 -#define R600_VGT__VGT_DMA_INDEX_TYPE 8 -#define R600_VGT__VGT_DMA_NUM_INSTANCES 10 -/* R600_DRAW_AUTO */ -#define R600_DRAW_AUTO__VGT_NUM_INDICES 0 -#define R600_DRAW_AUTO__VGT_DRAW_INITIATOR 1 +#define R600_VGT__VGT_PRIMITIVE_TYPE 0 +#define R600_VGT__VGT_MAX_VTX_INDX 1 +#define R600_VGT__VGT_MIN_VTX_INDX 2 +#define R600_VGT__VGT_INDX_OFFSET 3 +#define R600_VGT__VGT_MULTI_PRIM_IB_RESET_INDX 4 +#define R600_VGT__VGT_DMA_INDEX_TYPE 5 +#define R600_VGT__VGT_PRIMITIVEID_EN 6 +#define R600_VGT__VGT_DMA_NUM_INSTANCES 7 +#define R600_VGT__VGT_MULTI_PRIM_IB_RESET_EN 8 +#define R600_VGT__VGT_INSTANCE_STEP_RATE_0 9 +#define R600_VGT__VGT_INSTANCE_STEP_RATE_1 10 +#define R600_VGT_SIZE 11 +#define R600_VGT_PM4 128 /* R600_DRAW */ -#define R600_DRAW__VGT_DMA_BASE 0 -#define R600_DRAW__VGT_DMA_BASE_HI 1 -#define R600_DRAW__VGT_NUM_INDICES 2 -#define R600_DRAW__VGT_DRAW_INITIATOR 3 -#define R600_DRAW__INDICES_BO_ID 5 -/* R600_UCP */ -#define R600_UCP__PA_CL_UCP_X_0 0 -#define R600_UCP__PA_CL_UCP_Y_0 1 -#define R600_UCP__PA_CL_UCP_Z_0 2 -#define R600_UCP__PA_CL_UCP_W_0 3 +#define R600_DRAW__VGT_NUM_INDICES 0 +#define R600_DRAW__VGT_DMA_BASE_HI 1 +#define R600_DRAW__VGT_DMA_BASE 2 +#define R600_DRAW__VGT_DRAW_INITIATOR 3 +#define R600_DRAW_SIZE 4 +#define R600_DRAW_PM4 128 +/* R600_CLIP */ +#define R600_CLIP__PA_CL_UCP_X_0 0 +#define R600_CLIP__PA_CL_UCP_Y_0 1 +#define R600_CLIP__PA_CL_UCP_Z_0 2 +#define R600_CLIP__PA_CL_UCP_W_0 3 +#define R600_CLIP_SIZE 4 +#define R600_CLIP_PM4 128 /* R600 QUERY BEGIN/END */ -#define R600_QUERY__OFFSET 0 -#define R600_QUERY__BO_ID 3 +#define R600_QUERY__OFFSET 0 +#define R600_QUERY_SIZE 1 +#define R600_QUERY_PM4 128 #endif diff --git a/src/gallium/winsys/r600/drm/r600_state.c b/src/gallium/winsys/r600/drm/r600_state.c index 7941563215..9b7c11bdc0 100644 --- a/src/gallium/winsys/r600/drm/r600_state.c +++ b/src/gallium/winsys/r600/drm/r600_state.c @@ -30,41 +30,377 @@ #include "radeon_priv.h" #include "r600d.h" -static const struct radeon_type R600_types[]; -static const struct radeon_type R700_types[]; -#define R600_FLUSH_RESOURCE ((~C_0085F0_TC_ACTION_ENA) | (~C_0085F0_VC_ACTION_ENA)) -#define R600_FLUSH_CB0 (~C_0085F0_CB0_DEST_BASE_ENA) -#define R600_FLUSH_CB1 (~C_0085F0_CB1_DEST_BASE_ENA) -#define R600_FLUSH_CB2 (~C_0085F0_CB2_DEST_BASE_ENA) -#define R600_FLUSH_CB3 (~C_0085F0_CB3_DEST_BASE_ENA) -#define R600_FLUSH_CB4 (~C_0085F0_CB4_DEST_BASE_ENA) -#define R600_FLUSH_CB5 (~C_0085F0_CB5_DEST_BASE_ENA) -#define R600_FLUSH_CB6 (~C_0085F0_CB6_DEST_BASE_ENA) -#define R600_FLUSH_CB7 (~C_0085F0_CB7_DEST_BASE_ENA) -#define R600_FLUSH_DB (~C_0085F0_DB_DEST_BASE_ENA) -#define R600_DIRTY_ALL 0xFFFFFFFF -#define R600_DIRTY_ALL2 (R600_FLUSH_RESOURCE | R600_FLUSH_DB | R600_FLUSH_CB0\ - R600_FLUSH_CB1 | R600_FLUSH_CB2 | R600_FLUSH_CB3\ - R600_FLUSH_CB4 | R600_FLUSH_CB5 | R600_FLUSH_CB6\ - R600_FLUSH_CB7) +static int r600_state_pm4_resource(struct radeon_state *state); +static int r600_state_pm4_cb0(struct radeon_state *state); +static int r600_state_pm4_vgt(struct radeon_state *state); +static int r600_state_pm4_db(struct radeon_state *state); +static int r600_state_pm4_shader(struct radeon_state *state); +static int r600_state_pm4_draw(struct radeon_state *state); +static int r600_state_pm4_config(struct radeon_state *state); +static int r600_state_pm4_generic(struct radeon_state *state); +static int r600_state_pm4_query_begin(struct radeon_state *state); +static int r600_state_pm4_query_end(struct radeon_state *state); +static int r700_state_pm4_config(struct radeon_state *state); +static int r700_state_pm4_cb0(struct radeon_state *state); +static int r700_state_pm4_db(struct radeon_state *state); -static int r600_ctx_bo_flush(struct radeon_ctx *ctx, struct radeon_bo *bo, u32 flags, u32 *placement) +#include "r600_states.h" + +/* + * r600/r700 state functions + */ +static int r600_state_pm4_bytecode(struct radeon_state *state, unsigned offset, unsigned id, unsigned nreg) +{ + const struct radeon_register *regs = state->radeon->type[state->type].regs; + unsigned i; + int r; + + if (!offset) { + fprintf(stderr, "%s invalid register for state %d %d\n", + __func__, state->type, id); + return -EINVAL; + } + if (offset >= R600_CONFIG_REG_OFFSET && offset < R600_CONFIG_REG_END) { + state->pm4[state->cpm4++] = PKT3(PKT3_SET_CONFIG_REG, nreg); + state->pm4[state->cpm4++] = (offset - R600_CONFIG_REG_OFFSET) >> 2; + for (i = 0; i < nreg; i++) { + state->pm4[state->cpm4++] = state->states[id + i]; + } + for (i = 0; i < nreg; i++) { + if (regs[id + i].need_reloc) { + state->pm4[state->cpm4++] = PKT3(PKT3_NOP, 0); + r = radeon_state_reloc(state, state->cpm4, regs[id + i].bo_id); + if (r) + return r; + state->pm4[state->cpm4++] = state->bo[regs[id + i].bo_id]->handle; + } + } + return 0; + } + if (offset >= R600_CONTEXT_REG_OFFSET && offset < R600_CONTEXT_REG_END) { + state->pm4[state->cpm4++] = PKT3(PKT3_SET_CONTEXT_REG, nreg); + state->pm4[state->cpm4++] = (offset - R600_CONTEXT_REG_OFFSET) >> 2; + for (i = 0; i < nreg; i++) { + state->pm4[state->cpm4++] = state->states[id + i]; + } + for (i = 0; i < nreg; i++) { + if (regs[id + i].need_reloc) { + state->pm4[state->cpm4++] = PKT3(PKT3_NOP, 0); + r = radeon_state_reloc(state, state->cpm4, regs[id + i].bo_id); + if (r) + return r; + state->pm4[state->cpm4++] = state->bo[regs[id + i].bo_id]->handle; + } + } + return 0; + } + if (offset >= R600_ALU_CONST_OFFSET && offset < R600_ALU_CONST_END) { + state->pm4[state->cpm4++] = PKT3(PKT3_SET_ALU_CONST, nreg); + state->pm4[state->cpm4++] = (offset - R600_ALU_CONST_OFFSET) >> 2; + for (i = 0; i < nreg; i++) { + state->pm4[state->cpm4++] = state->states[id + i]; + } + return 0; + } + if (offset >= R600_SAMPLER_OFFSET && offset < R600_SAMPLER_END) { + state->pm4[state->cpm4++] = PKT3(PKT3_SET_SAMPLER, nreg); + state->pm4[state->cpm4++] = (offset - R600_SAMPLER_OFFSET) >> 2; + for (i = 0; i < nreg; i++) { + state->pm4[state->cpm4++] = state->states[id + i]; + } + return 0; + } + fprintf(stderr, "%s unsupported offset 0x%08X\n", __func__, offset); + return -EINVAL; +} + +static int r600_state_pm4_generic(struct radeon_state *state) +{ + struct radeon *radeon = state->radeon; + unsigned i, offset, nreg, type, coffset, loffset, soffset; + unsigned start; + int r; + + if (!state->nstates) + return 0; + type = state->type; + soffset = (state->id - radeon->type[type].id) * radeon->type[type].stride; + offset = loffset = radeon->type[type].regs[0].offset + soffset; + start = 0; + for (i = 1, nreg = 1; i < state->nstates; i++) { + coffset = radeon->type[type].regs[i].offset + soffset; + if (coffset == (loffset + 4)) { + nreg++; + loffset = coffset; + } else { + r = r600_state_pm4_bytecode(state, offset, start, nreg); + if (r) { + fprintf(stderr, "%s invalid 0x%08X %d\n", __func__, start, nreg); + return r; + } + offset = loffset = coffset; + nreg = 1; + start = i; + } + } + return r600_state_pm4_bytecode(state, offset, start, nreg); +} + +static void r600_state_pm4_with_flush(struct radeon_state *state, u32 flags) +{ + unsigned i, j, add, size; + + state->nreloc = 0; + for (i = 0; i < state->nbo; i++) { + for (j = 0, add = 1; j < state->nreloc; j++) { + if (state->bo[state->reloc_bo_id[j]] == state->bo[i]) { + add = 0; + break; + } + } + if (add) { + state->reloc_bo_id[state->nreloc++] = i; + } + } + for (i = 0; i < state->nreloc; i++) { + size = (state->bo[state->reloc_bo_id[i]]->size + 255) >> 8; + state->pm4[state->cpm4++] = PKT3(PKT3_SURFACE_SYNC, 3); + state->pm4[state->cpm4++] = flags; + state->pm4[state->cpm4++] = size; + state->pm4[state->cpm4++] = 0x00000000; + state->pm4[state->cpm4++] = 0x0000000A; + state->pm4[state->cpm4++] = PKT3(PKT3_NOP, 0); + state->reloc_pm4_id[i] = state->cpm4; + state->pm4[state->cpm4++] = state->bo[state->reloc_bo_id[i]]->handle; + } +} + +static int r600_state_pm4_cb0(struct radeon_state *state) +{ + int r; + + r600_state_pm4_with_flush(state, S_0085F0_CB_ACTION_ENA(1) | + S_0085F0_CB0_DEST_BASE_ENA(1)); + r = r600_state_pm4_generic(state); + if (r) + return r; + state->pm4[state->cpm4++] = PKT3(PKT3_SURFACE_BASE_UPDATE, 0); + state->pm4[state->cpm4++] = 0x00000002; + return 0; +} + +static int r700_state_pm4_cb0(struct radeon_state *state) +{ + int r; + + r600_state_pm4_with_flush(state, S_0085F0_CB_ACTION_ENA(1) | + S_0085F0_CB0_DEST_BASE_ENA(1)); + r = r600_state_pm4_generic(state); + if (r) + return r; + return 0; +} + +static int r600_state_pm4_db(struct radeon_state *state) +{ + int r; + + r600_state_pm4_with_flush(state, S_0085F0_DB_ACTION_ENA(1) | + S_0085F0_DB_DEST_BASE_ENA(1)); + r = r600_state_pm4_generic(state); + if (r) + return r; + state->pm4[state->cpm4++] = PKT3(PKT3_SURFACE_BASE_UPDATE, 0); + state->pm4[state->cpm4++] = 0x00000001; + return 0; +} + +static int r700_state_pm4_db(struct radeon_state *state) +{ + int r; + + r600_state_pm4_with_flush(state, S_0085F0_DB_ACTION_ENA(1) | + S_0085F0_DB_DEST_BASE_ENA(1)); + r = r600_state_pm4_generic(state); + if (r) + return r; + return 0; +} + +static int r600_state_pm4_config(struct radeon_state *state) +{ + state->pm4[state->cpm4++] = PKT3(PKT3_START_3D_CMDBUF, 0); + state->pm4[state->cpm4++] = 0x00000000; + state->pm4[state->cpm4++] = PKT3(PKT3_CONTEXT_CONTROL, 1); + state->pm4[state->cpm4++] = 0x80000000; + state->pm4[state->cpm4++] = 0x80000000; + state->pm4[state->cpm4++] = PKT3(PKT3_EVENT_WRITE, 0); + state->pm4[state->cpm4++] = EVENT_TYPE_CACHE_FLUSH_AND_INV_EVENT; + state->pm4[state->cpm4++] = PKT3(PKT3_SET_CONFIG_REG, 1); + state->pm4[state->cpm4++] = 0x00000010; + state->pm4[state->cpm4++] = 0x00028000; + return r600_state_pm4_generic(state); +} + +static int r600_state_pm4_query_begin(struct radeon_state *state) +{ + int r; + + state->cpm4 = 0; + state->pm4[state->cpm4++] = PKT3(PKT3_EVENT_WRITE, 2); + state->pm4[state->cpm4++] = EVENT_TYPE_ZPASS_DONE; + state->pm4[state->cpm4++] = state->states[0]; + state->pm4[state->cpm4++] = 0x0; + state->pm4[state->cpm4++] = PKT3(PKT3_NOP, 0); + r = radeon_state_reloc(state, state->cpm4, 0); + if (r) + return r; + state->pm4[state->cpm4++] = state->bo[0]->handle; + return 0; +} + +static int r600_state_pm4_query_end(struct radeon_state *state) +{ + int r; + + state->cpm4 = 0; + state->pm4[state->cpm4++] = PKT3(PKT3_EVENT_WRITE, 2); + state->pm4[state->cpm4++] = EVENT_TYPE_ZPASS_DONE; + state->pm4[state->cpm4++] = state->states[0]; + state->pm4[state->cpm4++] = 0x0; + state->pm4[state->cpm4++] = PKT3(PKT3_NOP, 0); + r = radeon_state_reloc(state, state->cpm4, 0); + if (r) + return r; + state->pm4[state->cpm4++] = state->bo[0]->handle; + return 0; +} + +static int r700_state_pm4_config(struct radeon_state *state) +{ + state->pm4[state->cpm4++] = PKT3(PKT3_CONTEXT_CONTROL, 1); + state->pm4[state->cpm4++] = 0x80000000; + state->pm4[state->cpm4++] = 0x80000000; + state->pm4[state->cpm4++] = PKT3(PKT3_EVENT_WRITE, 0); + state->pm4[state->cpm4++] = EVENT_TYPE_CACHE_FLUSH_AND_INV_EVENT; + state->pm4[state->cpm4++] = PKT3(PKT3_SET_CONFIG_REG, 1); + state->pm4[state->cpm4++] = 0x00000010; + state->pm4[state->cpm4++] = 0x00028000; + return r600_state_pm4_generic(state); +} + +static int r600_state_pm4_shader(struct radeon_state *state) +{ + r600_state_pm4_with_flush(state, S_0085F0_SH_ACTION_ENA(1)); + return r600_state_pm4_generic(state); +} + +static int r600_state_pm4_vgt(struct radeon_state *state) +{ + int r; + + r = r600_state_pm4_bytecode(state, R_028400_VGT_MAX_VTX_INDX, R600_VGT__VGT_MAX_VTX_INDX, 1); + if (r) + return r; + r = r600_state_pm4_bytecode(state, R_028404_VGT_MIN_VTX_INDX, R600_VGT__VGT_MIN_VTX_INDX, 1); + if (r) + return r; + r = r600_state_pm4_bytecode(state, R_028408_VGT_INDX_OFFSET, R600_VGT__VGT_INDX_OFFSET, 1); + if (r) + return r; + r = r600_state_pm4_bytecode(state, R_02840C_VGT_MULTI_PRIM_IB_RESET_INDX, R600_VGT__VGT_MULTI_PRIM_IB_RESET_INDX, 1); + if (r) + return r; + r = r600_state_pm4_bytecode(state, R_008958_VGT_PRIMITIVE_TYPE, R600_VGT__VGT_PRIMITIVE_TYPE, 1); + if (r) + return r; + state->pm4[state->cpm4++] = PKT3(PKT3_INDEX_TYPE, 0); + state->pm4[state->cpm4++] = state->states[R600_VGT__VGT_DMA_INDEX_TYPE]; + state->pm4[state->cpm4++] = PKT3(PKT3_NUM_INSTANCES, 0); + state->pm4[state->cpm4++] = state->states[R600_VGT__VGT_DMA_NUM_INSTANCES]; + return 0; +} + +static int r600_state_pm4_draw(struct radeon_state *state) { - unsigned size; + unsigned i; + int r; - if (7 > ctx->npm4) { - return -EBUSY; + if (state->nbo) { + state->pm4[state->cpm4++] = PKT3(PKT3_DRAW_INDEX, 3); + state->pm4[state->cpm4++] = state->states[R600_DRAW__VGT_DMA_BASE]; + state->pm4[state->cpm4++] = state->states[R600_DRAW__VGT_DMA_BASE_HI]; + state->pm4[state->cpm4++] = state->states[R600_DRAW__VGT_NUM_INDICES]; + state->pm4[state->cpm4++] = state->states[R600_DRAW__VGT_DRAW_INITIATOR]; + state->pm4[state->cpm4++] = PKT3(PKT3_NOP, 0); + r = radeon_state_reloc(state, state->cpm4, 0); + if (r) + return r; + state->pm4[state->cpm4++] = state->bo[0]->handle; + } else if (state->nimmd) { + state->pm4[state->cpm4++] = PKT3(PKT3_DRAW_INDEX_IMMD, state->nimmd + 1); + state->pm4[state->cpm4++] = state->states[R600_DRAW__VGT_NUM_INDICES]; + state->pm4[state->cpm4++] = state->states[R600_DRAW__VGT_DRAW_INITIATOR]; + for (i = 0; i < state->nimmd; i++) { + state->pm4[state->cpm4++] = state->immd[i]; + } + } else { + state->pm4[state->cpm4++] = PKT3(PKT3_DRAW_INDEX_AUTO, 1); + state->pm4[state->cpm4++] = state->states[R600_DRAW__VGT_NUM_INDICES]; + state->pm4[state->cpm4++] = state->states[R600_DRAW__VGT_DRAW_INITIATOR]; } - size = (bo->size + 255) >> 8; - ctx->pm4[ctx->id++] = PKT3(PKT3_SURFACE_SYNC, 3); - ctx->pm4[ctx->id++] = flags; - ctx->pm4[ctx->id++] = size; - ctx->pm4[ctx->id++] = 0x00000000; - ctx->pm4[ctx->id++] = 0x0000000A; - ctx->pm4[ctx->id++] = PKT3(PKT3_NOP, 0); - ctx->pm4[ctx->id++] = 0x00000000; - ctx->npm4 -= 7; - return radeon_ctx_reloc(ctx, bo, ctx->id - 1, placement); + state->pm4[state->cpm4++] = PKT3(PKT3_EVENT_WRITE, 0); + state->pm4[state->cpm4++] = EVENT_TYPE_CACHE_FLUSH_AND_INV_EVENT; + return 0; +} + +static int r600_state_pm4_resource(struct radeon_state *state) +{ + u32 flags, type, nbo, offset, soffset; + int r; + + soffset = (state->id - state->radeon->type[state->type].id) * state->radeon->type[state->type].stride; + type = G_038018_TYPE(state->states[6]); + switch (type) { + case 2: + flags = S_0085F0_TC_ACTION_ENA(1); + nbo = 2; + break; + case 3: + flags = S_0085F0_VC_ACTION_ENA(1); + nbo = 1; + break; + default: + return 0; + } + if (state->nbo != nbo) { + fprintf(stderr, "%s need %d bo got %d\n", __func__, nbo, state->nbo); + return -EINVAL; + } + r600_state_pm4_with_flush(state, flags); + offset = state->radeon->type[state->type].regs[0].offset + soffset; + state->pm4[state->cpm4++] = PKT3(PKT3_SET_RESOURCE, 7); + state->pm4[state->cpm4++] = (offset - R_038000_SQ_TEX_RESOURCE_WORD0_0) >> 2; + state->pm4[state->cpm4++] = state->states[0]; + state->pm4[state->cpm4++] = state->states[1]; + state->pm4[state->cpm4++] = state->states[2]; + state->pm4[state->cpm4++] = state->states[3]; + state->pm4[state->cpm4++] = state->states[4]; + state->pm4[state->cpm4++] = state->states[5]; + state->pm4[state->cpm4++] = state->states[6]; + state->pm4[state->cpm4++] = PKT3(PKT3_NOP, 0); + r = radeon_state_reloc(state, state->cpm4, 0); + if (r) + return r; + state->pm4[state->cpm4++] = state->bo[0]->handle; + if (type == 2) { + state->pm4[state->cpm4++] = PKT3(PKT3_NOP, 0); + r = radeon_state_reloc(state, state->cpm4, 1); + if (r) + return r; + state->pm4[state->cpm4++] = state->bo[1]->handle; + } + return 0; } int r600_init(struct radeon *radeon) @@ -78,6 +414,7 @@ int r600_init(struct radeon *radeon) case CHIP_RV635: case CHIP_RS780: case CHIP_RS880: + radeon->ntype = R600_NTYPE; radeon->nstate = R600_NSTATE; radeon->type = R600_types; break; @@ -85,6 +422,7 @@ int r600_init(struct radeon *radeon) case CHIP_RV730: case CHIP_RV710: case CHIP_RV740: + radeon->ntype = R600_NTYPE; radeon->nstate = R600_NSTATE; radeon->type = R700_types; break; @@ -93,7696 +431,5 @@ int r600_init(struct radeon *radeon) __func__, radeon->device); return -EINVAL; } - radeon->bo_flush = &r600_ctx_bo_flush; return 0; } - -/* CONFIG */ -#define R600_CONFIG_header_cpm4 12 -static const u32 R600_CONFIG_header_pm4[R600_CONFIG_header_cpm4] = { - 0xC0002400, - 0x00000000, - 0xC0012800, - 0x80000000, - 0x80000000, - 0xC0004600, - 0x00000016, - 0xC0016800, - 0x00000010, - 0x00028000, - 0xC0066800, - 0x00000300, -}; -#define R700_CONFIG_header_cpm4 10 -u32 R700_CONFIG_header_pm4[R700_CONFIG_header_cpm4] = { - 0xC0012800, - 0x80000000, - 0x80000000, - 0xC0004600, - 0x00000016, - 0xC0016800, - 0x00000010, - 0x00028000, - 0xC0066800, - 0x00000300, -}; -#define R600_CONFIG_state_cpm4 67 -u32 R600_CONFIG_state_pm4[R600_CONFIG_state_cpm4] = { - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0xC0016800, - 0x00000363, - 0x00000000, - 0xC0016800, - 0x00000542, - 0x00000000, - 0xC0016800, - 0x000005C5, - 0x00000000, - 0xC0016800, - 0x0000060C, - 0x00000000, - 0xC0016800, - 0x0000060E, - 0x00000000, - 0xC0016900, - 0x000000D4, - 0x00000000, - 0xC0016900, - 0x000001B2, - 0x00000000, - 0xC0016900, - 0x000001E8, - 0x00000000, - 0xC0096900, - 0x0000022A, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0xC00D6900, - 0x00000284, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0xC0016900, - 0x00000293, - 0x00000000, - 0xC0036900, - 0x000002AC, - 0x00000000, - 0x00000000, - 0x00000000, - 0xC0016900, - 0x000002C8, - 0x00000000, -}; -#define R600_CB_CNTL_header_cpm4 2 -u32 R600_CB_CNTL_header_pm4[R600_CB_CNTL_header_cpm4] = { - 0xC0046900, - 0x00000048, -}; -#define R600_CB_CNTL_state_cpm4 32 -u32 R600_CB_CNTL_state_pm4[R600_CB_CNTL_state_cpm4] = { - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0xC0026900, - 0x0000008E, - 0x00000000, - 0x00000000, - 0xC0036900, - 0x00000109, - 0x00000000, - 0x00000000, - 0x00000000, - 0xC0016900, - 0x00000202, - 0x00000000, - 0xC0016900, - 0x00000301, - 0x00000000, - 0xC0026900, - 0x00000307, - 0x00000000, - 0x00000000, - 0xC0046900, - 0x0000030C, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0xC0016900, - 0x00000312, - 0x00000000, -}; -#define R600_RASTERIZER_header_cpm4 2 -u32 R600_RASTERIZER_header_pm4[R600_RASTERIZER_header_cpm4] = { - 0xC0016900, - 0x000001B5, -}; -#define R600_RASTERIZER_state_cpm4 35 -u32 R600_RASTERIZER_state_pm4[R600_RASTERIZER_state_cpm4] = { - 0x00000000, - 0xC0026900, - 0x00000204, - 0x00000000, - 0x00000000, - 0xC0026900, - 0x00000207, - 0x00000000, - 0x00000000, - 0xC0046900, - 0x00000280, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0xC0016900, - 0x00000292, - 0x00000000, - 0xC0016900, - 0x00000300, - 0x00000000, - 0xC0046900, - 0x00000303, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0xC0066900, - 0x0000037E, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, -}; - -/* R600_VIEWPORT */ -#define R600_VIEWPORT_header_cpm4 2 -u32 R600_VIEWPORT_header_pm4[R600_VIEWPORT_header_cpm4] = { - 0xC0026900, - 0x000000B4, -}; -#define R600_VIEWPORT_state_cpm4 23 -u32 R600_VIEWPORT_state_pm4[R600_VIEWPORT_state_cpm4] = { - 0x00000000, - 0x00000000, - 0xC0016900, - 0x0000010F, - 0x00000000, - 0xC0016900, - 0x00000111, - 0x00000000, - 0xC0016900, - 0x00000113, - 0x00000000, - 0xC0016900, - 0x00000110, - 0x00000000, - 0xC0016900, - 0x00000112, - 0x00000000, - 0xC0016900, - 0x00000114, - 0x00000000, - 0xC0016900, - 0x00000206, - 0x00000000, -}; -#define R600_SCISSOR_header_cpm4 2 -u32 R600_SCISSOR_header_pm4[R600_SCISSOR_header_cpm4] = { - 0xC0026900, - 0x0000000C, -}; -#define R600_SCISSOR_state_cpm4 25 -u32 R600_SCISSOR_state_pm4[R600_SCISSOR_state_cpm4] = { - 0x00000000, - 0x00000000, - 0xC00D6900, - 0x00000080, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0xC0026900, - 0x00000090, - 0x00000000, - 0x00000000, - 0xC0026900, - 0x00000094, - 0x00000000, - 0x00000000, -}; - -/* R600_BLEND */ -#define R600_BLEND_header_cpm4 2 -u32 R600_BLEND_header_pm4[R600_BLEND_header_cpm4] = { - 0xC0046900, - 0x00000105, -}; -#define R600_BLEND_state_cpm4 17 -u32 R600_BLEND_state_pm4[R600_BLEND_state_cpm4] = { - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0xC0086900, - 0x000001E0, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0xC0016900, - 0x00000201, - 0x00000000, -}; - -/* R600_DSA */ -#define R600_DSA_header_cpm4 2 -u32 R600_DSA_header_pm4[R600_DSA_header_cpm4] = { - 0xC0026900, - 0x0000000A, -}; -#define R600_DSA_state_cpm4 34 -u32 R600_DSA_state_pm4[R600_DSA_state_cpm4] = { - 0x00000000, - 0x00000000, - 0xC0016900, - 0x00000104, - 0x00000000, - 0xC0036900, - 0x0000010C, - 0x00000000, - 0x00000000, - 0x00000000, - 0xC0026900, - 0x000001B8, - 0x00000000, - 0x00000000, - 0xC0016900, - 0x000001B7, - 0x00000000, - 0xC0016900, - 0x00000200, - 0x00000000, - 0xC0016900, - 0x00000203, - 0x00000000, - 0xC0026900, - 0x00000343, - 0x00000000, - 0x00000000, - 0xC0026900, - 0x0000034B, - 0x00000000, - 0x00000000, - 0xC0016900, - 0x00000351, - 0x00000000, -}; - -/* R600_UCP */ -#define R600_UCP_header_cpm4 2 -u32 R600_UCP0_header_pm4[R600_UCP_header_cpm4] = { - 0xC0046900, - 0x00000388, -}; -u32 R600_UCP1_header_pm4[R600_UCP_header_cpm4] = { - 0xC0046900, - 0x0000038C, -}; -u32 R600_UCP2_header_pm4[R600_UCP_header_cpm4] = { - 0xC0046900, - 0x00000390, -}; -u32 R600_UCP3_header_pm4[R600_UCP_header_cpm4] = { - 0xC0046900, - 0x00000394, -}; -u32 R600_UCP4_header_pm4[R600_UCP_header_cpm4] = { - 0xC0046900, - 0x00000398, -}; -u32 R600_UCP5_header_pm4[R600_UCP_header_cpm4] = { - 0xC0046900, - 0x0000039C, -}; -#define R600_UCP_state_cpm4 4 -u32 R600_UCP_state_pm4[R600_UCP_state_cpm4] = { - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, -}; - -/* R600_VGT */ -#define R600_VGT_header_cpm4 2 -u32 R600_VGT_header_pm4[R600_VGT_header_cpm4] = { - 0xC0046900, - 0x00000100, -}; -#define R600_VGT_state_cpm4 11 -u32 R600_VGT_state_pm4[R600_VGT_state_cpm4] = { - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0xC0016800, - 0x00000256, - 0x00000000, - 0xC0002A00, - 0x00000000, - 0xC0002F00, - 0x00000000, -}; - -/* R600_QUERY */ -#define R600_QUERY_header_cpm4 2 -u32 R600_QUERY_header_pm4[R600_QUERY_header_cpm4] = { - 0xC0024600, - 0x00000015, -}; -#define R600_QUERY_state_cpm4 4 -u32 R600_QUERY_state_pm4[R600_QUERY_state_cpm4] = { - 0x00000000, - 0x00000000, - 0xC0001000, - 0x00000000, -}; - -/* R600_DRAW_AUTO */ -#define R600_DRAW_AUTO_header_cpm4 1 -u32 R600_DRAW_AUTO_header_pm4[R600_DRAW_AUTO_header_cpm4] = { - 0xC0012D00, -}; -#define R600_DRAW_AUTO_state_cpm4 4 -u32 R600_DRAW_AUTO_state_pm4[R600_DRAW_AUTO_state_cpm4] = { - 0x00000000, - 0x00000000, - 0xC0004600, - 0x00000016, -}; - -/* R600_DRAW */ -#define R600_DRAW_header_cpm4 1 -u32 R600_DRAW_header_pm4[R600_DRAW_header_cpm4] = { - 0xC0032B00, -}; -#define R600_DRAW_state_cpm4 8 -u32 R600_DRAW_state_pm4[R600_DRAW_state_cpm4] = { - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0xC0001000, - 0x00000000, - 0xC0004600, - 0x00000016, -}; - -/* R600_VS_SHADER */ -#define R600_VS_SHADER_header_cpm4 2 -u32 R600_VS_SHADER_header_pm4[R600_VS_SHADER_header_cpm4] = { - 0xC0206900, - 0x000000E0, -}; -#define R600_VS_SHADER_state_cpm4 69 -u32 R600_VS_SHADER_state_pm4[R600_VS_SHADER_state_cpm4] = { - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0xC00A6900, - 0x00000185, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0xC0016900, - 0x000001B1, - 0x00000000, - 0xC0016900, - 0x00000216, - 0x00000000, - 0xC0001000, - 0x00000000, - 0xC0016900, - 0x0000021A, - 0x00000000, - 0xC0016900, - 0x00000225, - 0x00000000, - 0xC0001000, - 0x00000000, - 0xC0016900, - 0x00000229, - 0x00000000, - 0xC0016900, - 0x00000234, - 0x00000000, - 0xC0016900, - 0x00000237, - 0x00000000, -}; - -/* R600_PS_SHADER */ -#define R600_PS_SHADER_header_cpm4 2 -u32 R600_PS_SHADER_header_pm4[R600_PS_SHADER_header_cpm4] = { - 0xC0206900, - 0x00000191, -}; -#define R600_PS_SHADER_state_cpm4 51 -u32 R600_PS_SHADER_state_pm4[R600_PS_SHADER_state_cpm4] = { - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0xC0026900, - 0x000001B3, - 0x00000000, - 0x00000000, - 0xC0016900, - 0x000001B6, - 0x00000000, - 0xC0016900, - 0x00000210, - 0x00000000, - 0xC0001000, - 0x00000000, - 0xC0026900, - 0x00000214, - 0x00000000, - 0x00000000, - 0xC0016900, - 0x00000233, - 0x00000000, -}; - -/* R600_DB */ -#define R600_DB_header_cpm4 2 -u32 R600_DB_header_pm4[R600_DB_header_cpm4] = { - 0xC0016900, - 0x00000003, -}; -#define R600_DB_state_cpm4 18 -u32 R600_DB_state_pm4[R600_DB_state_cpm4] = { - 0x00000000, - 0xC0001000, - 0x00000000, - 0xC0026900, - 0x00000000, - 0x00000000, - 0x00000000, - 0xC0016900, - 0x00000004, - 0x00000000, - 0xC0016900, - 0x00000349, - 0x00000000, - 0xC0016900, - 0x0000034D, - 0x00000000, - 0xC0007300, - 0x00000001, -}; - -/* R600_CB0 */ -#define R600_CB0_header_cpm4 2 -u32 R600_CB0_header_pm4[R600_CB0_header_cpm4] = { - 0xC0016900, - 0x00000010, -}; -#define R600_CB0_state_cpm4 27 -u32 R600_CB0_state_pm4[R600_CB0_state_cpm4] = { - 0x00000000, - 0xC0001000, - 0x00000000, - 0xC0016900, - 0x00000028, - 0x00000000, - 0xC0016900, - 0x00000018, - 0x00000000, - 0xC0016900, - 0x00000020, - 0x00000000, - 0xC0016900, - 0x00000038, - 0x00000000, - 0xC0001000, - 0x00000000, - 0xC0016900, - 0x00000030, - 0x00000000, - 0xC0001000, - 0x00000000, - 0xC0016900, - 0x00000040, - 0x00000000, - 0xC0007300, - 0x00000002, -}; - -/* R600_CB1 */ -#define R600_CB1_header_cpm4 2 -u32 R600_CB1_header_pm4[R600_CB1_header_cpm4] = { - 0xC0016900, - 0x00000011, -}; -#define R600_CB1_state_cpm4 27 -u32 R600_CB1_state_pm4[R600_CB1_state_cpm4] = { - 0x00000000, - 0xC0001000, - 0x00000000, - 0xC0016900, - 0x00000029, - 0x00000000, - 0xC0016900, - 0x00000019, - 0x00000000, - 0xC0016900, - 0x00000021, - 0x00000000, - 0xC0016900, - 0x00000039, - 0x00000000, - 0xC0001000, - 0x00000000, - 0xC0016900, - 0x00000031, - 0x00000000, - 0xC0001000, - 0x00000000, - 0xC0016900, - 0x00000041, - 0x00000000, - 0xC0007300, - 0x00000002, -}; - -/* R600_CB2 */ -#define R600_CB2_header_cpm4 2 -u32 R600_CB2_header_pm4[R600_CB2_header_cpm4] = { - 0xC0016900, - 0x00000012, -}; -#define R600_CB2_state_cpm4 27 -u32 R600_CB2_state_pm4[R600_CB2_state_cpm4] = { - 0x00000000, - 0xC0001000, - 0x00000004, - 0xC0016900, - 0x0000002A, - 0x00000000, - 0xC0016900, - 0x0000001A, - 0x00000000, - 0xC0016900, - 0x00000022, - 0x00000000, - 0xC0016900, - 0x0000003A, - 0x00000000, - 0xC0001000, - 0x00000000, - 0xC0016900, - 0x00000032, - 0x00000000, - 0xC0001000, - 0x00000000, - 0xC0016900, - 0x00000042, - 0x00000000, - 0xC0007300, - 0x00000002, -}; - -/* R600_CB3 */ -#define R600_CB3_header_cpm4 2 -u32 R600_CB3_header_pm4[R600_CB3_header_cpm4] = { - 0xC0016900, - 0x00000013, -}; -#define R600_CB3_state_cpm4 27 -u32 R600_CB3_state_pm4[R600_CB3_state_cpm4] = { - 0x00000000, - 0xC0001000, - 0x00000004, - 0xC0016900, - 0x0000002B, - 0x00000000, - 0xC0016900, - 0x0000001B, - 0x00000000, - 0xC0016900, - 0x00000023, - 0x00000000, - 0xC0016900, - 0x0000003B, - 0x00000000, - 0xC0001000, - 0x00000000, - 0xC0016900, - 0x00000033, - 0x00000000, - 0xC0001000, - 0x00000000, - 0xC0016900, - 0x00000043, - 0x00000000, - 0xC0007300, - 0x00000002, -}; - -/* R600_CB4 */ -#define R600_CB4_header_cpm4 2 -u32 R600_CB4_header_pm4[R600_CB4_header_cpm4] = { - 0xC0016900, - 0x00000014, -}; -#define R600_CB4_state_cpm4 27 -u32 R600_CB4_state_pm4[R600_CB4_state_cpm4] = { - 0x00000000, - 0xC0001000, - 0x00000004, - 0xC0016900, - 0x0000002C, - 0x00000000, - 0xC0016900, - 0x0000001C, - 0x00000000, - 0xC0016900, - 0x00000024, - 0x00000000, - 0xC0016900, - 0x0000003C, - 0x00000000, - 0xC0001000, - 0x00000000, - 0xC0016900, - 0x00000034, - 0x00000000, - 0xC0001000, - 0x00000000, - 0xC0016900, - 0x00000044, - 0x00000000, - 0xC0007300, - 0x00000002, -}; - -/* R600_CB5 */ -#define R600_CB5_header_cpm4 2 -u32 R600_CB5_header_pm4[R600_CB5_header_cpm4] = { - 0xC0016900, - 0x00000015, -}; -#define R600_CB5_state_cpm4 27 -u32 R600_CB5_state_pm4[R600_CB5_state_cpm4] = { - 0x00000000, - 0xC0001000, - 0x00000004, - 0xC0016900, - 0x0000002D, - 0x00000000, - 0xC0016900, - 0x0000001D, - 0x00000000, - 0xC0016900, - 0x00000025, - 0x00000000, - 0xC0016900, - 0x0000003D, - 0x00000000, - 0xC0001000, - 0x00000000, - 0xC0016900, - 0x00000035, - 0x00000000, - 0xC0001000, - 0x00000000, - 0xC0016900, - 0x00000045, - 0x00000000, - 0xC0007300, - 0x00000002, -}; - -/* R600_CB6 */ -#define R600_CB6_header_cpm4 2 -u32 R600_CB6_header_pm4[R600_CB6_header_cpm4] = { - 0xC0016900, - 0x00000016, -}; -#define R600_CB6_state_cpm4 27 -u32 R600_CB6_state_pm4[R600_CB6_state_cpm4] = { - 0x00000000, - 0xC0001000, - 0x00000004, - 0xC0016900, - 0x0000002E, - 0x00000000, - 0xC0016900, - 0x0000001E, - 0x00000000, - 0xC0016900, - 0x00000026, - 0x00000000, - 0xC0016900, - 0x0000003E, - 0x00000000, - 0xC0001000, - 0x00000000, - 0xC0016900, - 0x00000036, - 0x00000000, - 0xC0001000, - 0x00000000, - 0xC0016900, - 0x00000046, - 0x00000000, - 0xC0007300, - 0x00000002, -}; - -/* R600_CB7 */ -#define R600_CB7_header_cpm4 2 -u32 R600_CB7_header_pm4[R600_CB7_header_cpm4] = { - 0xC0016900, - 0x00000017, -}; -#define R600_CB7_state_cpm4 27 -u32 R600_CB7_state_pm4[R600_CB7_state_cpm4] = { - 0x00000000, - 0xC0001000, - 0x00000004, - 0xC0016900, - 0x0000002F, - 0x00000000, - 0xC0016900, - 0x0000001F, - 0x00000000, - 0xC0016900, - 0x00000027, - 0x00000000, - 0xC0016900, - 0x0000003F, - 0x00000000, - 0xC0001000, - 0x00000000, - 0xC0016900, - 0x00000037, - 0x00000000, - 0xC0001000, - 0x00000000, - 0xC0016900, - 0x00000047, - 0x00000000, - 0xC0007300, - 0x00000002, -}; - -/* R600_CONSTANT */ -#define R600_CONSTANT_header_cpm4 2 -u32 R600_PS_CONSTANT0_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000000, -}; -u32 R600_PS_CONSTANT1_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000004, -}; -u32 R600_PS_CONSTANT2_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000008, -}; -u32 R600_PS_CONSTANT3_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x0000000C, -}; -u32 R600_PS_CONSTANT4_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000010, -}; -u32 R600_PS_CONSTANT5_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000014, -}; -u32 R600_PS_CONSTANT6_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000018, -}; -u32 R600_PS_CONSTANT7_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x0000001C, -}; -u32 R600_PS_CONSTANT8_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000020, -}; -u32 R600_PS_CONSTANT9_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000024, -}; -u32 R600_PS_CONSTANT10_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000028, -}; -u32 R600_PS_CONSTANT11_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x0000002C, -}; -u32 R600_PS_CONSTANT12_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000030, -}; -u32 R600_PS_CONSTANT13_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000034, -}; -u32 R600_PS_CONSTANT14_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000038, -}; -u32 R600_PS_CONSTANT15_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x0000003C, -}; -u32 R600_PS_CONSTANT16_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000040, -}; -u32 R600_PS_CONSTANT17_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000044, -}; -u32 R600_PS_CONSTANT18_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000048, -}; -u32 R600_PS_CONSTANT19_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x0000004C, -}; -u32 R600_PS_CONSTANT20_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000050, -}; -u32 R600_PS_CONSTANT21_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000054, -}; -u32 R600_PS_CONSTANT22_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000058, -}; -u32 R600_PS_CONSTANT23_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x0000005C, -}; -u32 R600_PS_CONSTANT24_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000060, -}; -u32 R600_PS_CONSTANT25_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000064, -}; -u32 R600_PS_CONSTANT26_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000068, -}; -u32 R600_PS_CONSTANT27_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x0000006C, -}; -u32 R600_PS_CONSTANT28_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000070, -}; -u32 R600_PS_CONSTANT29_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000074, -}; -u32 R600_PS_CONSTANT30_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000078, -}; -u32 R600_PS_CONSTANT31_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x0000007C, -}; -u32 R600_PS_CONSTANT32_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000080, -}; -u32 R600_PS_CONSTANT33_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000084, -}; -u32 R600_PS_CONSTANT34_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000088, -}; -u32 R600_PS_CONSTANT35_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x0000008C, -}; -u32 R600_PS_CONSTANT36_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000090, -}; -u32 R600_PS_CONSTANT37_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000094, -}; -u32 R600_PS_CONSTANT38_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000098, -}; -u32 R600_PS_CONSTANT39_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x0000009C, -}; -u32 R600_PS_CONSTANT40_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000000A0, -}; -u32 R600_PS_CONSTANT41_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000000A4, -}; -u32 R600_PS_CONSTANT42_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000000A8, -}; -u32 R600_PS_CONSTANT43_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000000AC, -}; -u32 R600_PS_CONSTANT44_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000000B0, -}; -u32 R600_PS_CONSTANT45_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000000B4, -}; -u32 R600_PS_CONSTANT46_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000000B8, -}; -u32 R600_PS_CONSTANT47_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000000BC, -}; -u32 R600_PS_CONSTANT48_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000000C0, -}; -u32 R600_PS_CONSTANT49_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000000C4, -}; -u32 R600_PS_CONSTANT50_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000000C8, -}; -u32 R600_PS_CONSTANT51_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000000CC, -}; -u32 R600_PS_CONSTANT52_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000000D0, -}; -u32 R600_PS_CONSTANT53_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000000D4, -}; -u32 R600_PS_CONSTANT54_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000000D8, -}; -u32 R600_PS_CONSTANT55_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000000DC, -}; -u32 R600_PS_CONSTANT56_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000000E0, -}; -u32 R600_PS_CONSTANT57_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000000E4, -}; -u32 R600_PS_CONSTANT58_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000000E8, -}; -u32 R600_PS_CONSTANT59_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000000EC, -}; -u32 R600_PS_CONSTANT60_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000000F0, -}; -u32 R600_PS_CONSTANT61_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000000F4, -}; -u32 R600_PS_CONSTANT62_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000000F8, -}; -u32 R600_PS_CONSTANT63_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000000FC, -}; -u32 R600_PS_CONSTANT64_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000100, -}; -u32 R600_PS_CONSTANT65_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000104, -}; -u32 R600_PS_CONSTANT66_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000108, -}; -u32 R600_PS_CONSTANT67_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x0000010C, -}; -u32 R600_PS_CONSTANT68_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000110, -}; -u32 R600_PS_CONSTANT69_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000114, -}; -u32 R600_PS_CONSTANT70_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000118, -}; -u32 R600_PS_CONSTANT71_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x0000011C, -}; -u32 R600_PS_CONSTANT72_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000120, -}; -u32 R600_PS_CONSTANT73_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000124, -}; -u32 R600_PS_CONSTANT74_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000128, -}; -u32 R600_PS_CONSTANT75_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x0000012C, -}; -u32 R600_PS_CONSTANT76_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000130, -}; -u32 R600_PS_CONSTANT77_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000134, -}; -u32 R600_PS_CONSTANT78_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000138, -}; -u32 R600_PS_CONSTANT79_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x0000013C, -}; -u32 R600_PS_CONSTANT80_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000140, -}; -u32 R600_PS_CONSTANT81_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000144, -}; -u32 R600_PS_CONSTANT82_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000148, -}; -u32 R600_PS_CONSTANT83_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x0000014C, -}; -u32 R600_PS_CONSTANT84_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000150, -}; -u32 R600_PS_CONSTANT85_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000154, -}; -u32 R600_PS_CONSTANT86_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000158, -}; -u32 R600_PS_CONSTANT87_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x0000015C, -}; -u32 R600_PS_CONSTANT88_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000160, -}; -u32 R600_PS_CONSTANT89_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000164, -}; -u32 R600_PS_CONSTANT90_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000168, -}; -u32 R600_PS_CONSTANT91_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x0000016C, -}; -u32 R600_PS_CONSTANT92_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000170, -}; -u32 R600_PS_CONSTANT93_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000174, -}; -u32 R600_PS_CONSTANT94_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000178, -}; -u32 R600_PS_CONSTANT95_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x0000017C, -}; -u32 R600_PS_CONSTANT96_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000180, -}; -u32 R600_PS_CONSTANT97_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000184, -}; -u32 R600_PS_CONSTANT98_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000188, -}; -u32 R600_PS_CONSTANT99_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x0000018C, -}; -u32 R600_PS_CONSTANT100_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000190, -}; -u32 R600_PS_CONSTANT101_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000194, -}; -u32 R600_PS_CONSTANT102_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000198, -}; -u32 R600_PS_CONSTANT103_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x0000019C, -}; -u32 R600_PS_CONSTANT104_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000001A0, -}; -u32 R600_PS_CONSTANT105_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000001A4, -}; -u32 R600_PS_CONSTANT106_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000001A8, -}; -u32 R600_PS_CONSTANT107_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000001AC, -}; -u32 R600_PS_CONSTANT108_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000001B0, -}; -u32 R600_PS_CONSTANT109_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000001B4, -}; -u32 R600_PS_CONSTANT110_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000001B8, -}; -u32 R600_PS_CONSTANT111_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000001BC, -}; -u32 R600_PS_CONSTANT112_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000001C0, -}; -u32 R600_PS_CONSTANT113_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000001C4, -}; -u32 R600_PS_CONSTANT114_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000001C8, -}; -u32 R600_PS_CONSTANT115_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000001CC, -}; -u32 R600_PS_CONSTANT116_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000001D0, -}; -u32 R600_PS_CONSTANT117_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000001D4, -}; -u32 R600_PS_CONSTANT118_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000001D8, -}; -u32 R600_PS_CONSTANT119_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000001DC, -}; -u32 R600_PS_CONSTANT120_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000001E0, -}; -u32 R600_PS_CONSTANT121_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000001E4, -}; -u32 R600_PS_CONSTANT122_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000001E8, -}; -u32 R600_PS_CONSTANT123_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000001EC, -}; -u32 R600_PS_CONSTANT124_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000001F0, -}; -u32 R600_PS_CONSTANT125_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000001F4, -}; -u32 R600_PS_CONSTANT126_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000001F8, -}; -u32 R600_PS_CONSTANT127_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000001FC, -}; -u32 R600_PS_CONSTANT128_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000200, -}; -u32 R600_PS_CONSTANT129_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000204, -}; -u32 R600_PS_CONSTANT130_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000208, -}; -u32 R600_PS_CONSTANT131_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x0000020C, -}; -u32 R600_PS_CONSTANT132_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000210, -}; -u32 R600_PS_CONSTANT133_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000214, -}; -u32 R600_PS_CONSTANT134_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000218, -}; -u32 R600_PS_CONSTANT135_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x0000021C, -}; -u32 R600_PS_CONSTANT136_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000220, -}; -u32 R600_PS_CONSTANT137_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000224, -}; -u32 R600_PS_CONSTANT138_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000228, -}; -u32 R600_PS_CONSTANT139_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x0000022C, -}; -u32 R600_PS_CONSTANT140_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000230, -}; -u32 R600_PS_CONSTANT141_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000234, -}; -u32 R600_PS_CONSTANT142_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000238, -}; -u32 R600_PS_CONSTANT143_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x0000023C, -}; -u32 R600_PS_CONSTANT144_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000240, -}; -u32 R600_PS_CONSTANT145_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000244, -}; -u32 R600_PS_CONSTANT146_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000248, -}; -u32 R600_PS_CONSTANT147_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x0000024C, -}; -u32 R600_PS_CONSTANT148_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000250, -}; -u32 R600_PS_CONSTANT149_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000254, -}; -u32 R600_PS_CONSTANT150_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000258, -}; -u32 R600_PS_CONSTANT151_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x0000025C, -}; -u32 R600_PS_CONSTANT152_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000260, -}; -u32 R600_PS_CONSTANT153_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000264, -}; -u32 R600_PS_CONSTANT154_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000268, -}; -u32 R600_PS_CONSTANT155_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x0000026C, -}; -u32 R600_PS_CONSTANT156_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000270, -}; -u32 R600_PS_CONSTANT157_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000274, -}; -u32 R600_PS_CONSTANT158_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000278, -}; -u32 R600_PS_CONSTANT159_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x0000027C, -}; -u32 R600_PS_CONSTANT160_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000280, -}; -u32 R600_PS_CONSTANT161_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000284, -}; -u32 R600_PS_CONSTANT162_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000288, -}; -u32 R600_PS_CONSTANT163_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x0000028C, -}; -u32 R600_PS_CONSTANT164_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000290, -}; -u32 R600_PS_CONSTANT165_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000294, -}; -u32 R600_PS_CONSTANT166_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000298, -}; -u32 R600_PS_CONSTANT167_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x0000029C, -}; -u32 R600_PS_CONSTANT168_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000002A0, -}; -u32 R600_PS_CONSTANT169_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000002A4, -}; -u32 R600_PS_CONSTANT170_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000002A8, -}; -u32 R600_PS_CONSTANT171_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000002AC, -}; -u32 R600_PS_CONSTANT172_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000002B0, -}; -u32 R600_PS_CONSTANT173_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000002B4, -}; -u32 R600_PS_CONSTANT174_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000002B8, -}; -u32 R600_PS_CONSTANT175_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000002BC, -}; -u32 R600_PS_CONSTANT176_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000002C0, -}; -u32 R600_PS_CONSTANT177_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000002C4, -}; -u32 R600_PS_CONSTANT178_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000002C8, -}; -u32 R600_PS_CONSTANT179_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000002CC, -}; -u32 R600_PS_CONSTANT180_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000002D0, -}; -u32 R600_PS_CONSTANT181_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000002D4, -}; -u32 R600_PS_CONSTANT182_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000002D8, -}; -u32 R600_PS_CONSTANT183_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000002DC, -}; -u32 R600_PS_CONSTANT184_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000002E0, -}; -u32 R600_PS_CONSTANT185_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000002E4, -}; -u32 R600_PS_CONSTANT186_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000002E8, -}; -u32 R600_PS_CONSTANT187_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000002EC, -}; -u32 R600_PS_CONSTANT188_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000002F0, -}; -u32 R600_PS_CONSTANT189_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000002F4, -}; -u32 R600_PS_CONSTANT190_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000002F8, -}; -u32 R600_PS_CONSTANT191_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000002FC, -}; -u32 R600_PS_CONSTANT192_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000300, -}; -u32 R600_PS_CONSTANT193_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000304, -}; -u32 R600_PS_CONSTANT194_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000308, -}; -u32 R600_PS_CONSTANT195_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x0000030C, -}; -u32 R600_PS_CONSTANT196_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000310, -}; -u32 R600_PS_CONSTANT197_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000314, -}; -u32 R600_PS_CONSTANT198_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000318, -}; -u32 R600_PS_CONSTANT199_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x0000031C, -}; -u32 R600_PS_CONSTANT200_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000320, -}; -u32 R600_PS_CONSTANT201_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000324, -}; -u32 R600_PS_CONSTANT202_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000328, -}; -u32 R600_PS_CONSTANT203_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x0000032C, -}; -u32 R600_PS_CONSTANT204_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000330, -}; -u32 R600_PS_CONSTANT205_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000334, -}; -u32 R600_PS_CONSTANT206_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000338, -}; -u32 R600_PS_CONSTANT207_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x0000033C, -}; -u32 R600_PS_CONSTANT208_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000340, -}; -u32 R600_PS_CONSTANT209_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000344, -}; -u32 R600_PS_CONSTANT210_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000348, -}; -u32 R600_PS_CONSTANT211_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x0000034C, -}; -u32 R600_PS_CONSTANT212_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000350, -}; -u32 R600_PS_CONSTANT213_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000354, -}; -u32 R600_PS_CONSTANT214_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000358, -}; -u32 R600_PS_CONSTANT215_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x0000035C, -}; -u32 R600_PS_CONSTANT216_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000360, -}; -u32 R600_PS_CONSTANT217_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000364, -}; -u32 R600_PS_CONSTANT218_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000368, -}; -u32 R600_PS_CONSTANT219_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x0000036C, -}; -u32 R600_PS_CONSTANT220_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000370, -}; -u32 R600_PS_CONSTANT221_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000374, -}; -u32 R600_PS_CONSTANT222_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000378, -}; -u32 R600_PS_CONSTANT223_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x0000037C, -}; -u32 R600_PS_CONSTANT224_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000380, -}; -u32 R600_PS_CONSTANT225_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000384, -}; -u32 R600_PS_CONSTANT226_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000388, -}; -u32 R600_PS_CONSTANT227_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x0000038C, -}; -u32 R600_PS_CONSTANT228_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000390, -}; -u32 R600_PS_CONSTANT229_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000394, -}; -u32 R600_PS_CONSTANT230_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000398, -}; -u32 R600_PS_CONSTANT231_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x0000039C, -}; -u32 R600_PS_CONSTANT232_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000003A0, -}; -u32 R600_PS_CONSTANT233_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000003A4, -}; -u32 R600_PS_CONSTANT234_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000003A8, -}; -u32 R600_PS_CONSTANT235_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000003AC, -}; -u32 R600_PS_CONSTANT236_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000003B0, -}; -u32 R600_PS_CONSTANT237_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000003B4, -}; -u32 R600_PS_CONSTANT238_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000003B8, -}; -u32 R600_PS_CONSTANT239_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000003BC, -}; -u32 R600_PS_CONSTANT240_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000003C0, -}; -u32 R600_PS_CONSTANT241_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000003C4, -}; -u32 R600_PS_CONSTANT242_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000003C8, -}; -u32 R600_PS_CONSTANT243_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000003CC, -}; -u32 R600_PS_CONSTANT244_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000003D0, -}; -u32 R600_PS_CONSTANT245_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000003D4, -}; -u32 R600_PS_CONSTANT246_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000003D8, -}; -u32 R600_PS_CONSTANT247_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000003DC, -}; -u32 R600_PS_CONSTANT248_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000003E0, -}; -u32 R600_PS_CONSTANT249_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000003E4, -}; -u32 R600_PS_CONSTANT250_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000003E8, -}; -u32 R600_PS_CONSTANT251_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000003EC, -}; -u32 R600_PS_CONSTANT252_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000003F0, -}; -u32 R600_PS_CONSTANT253_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000003F4, -}; -u32 R600_PS_CONSTANT254_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000003F8, -}; -u32 R600_PS_CONSTANT255_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000003FC, -}; -u32 R600_VS_CONSTANT0_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000400, -}; -u32 R600_VS_CONSTANT1_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000404, -}; -u32 R600_VS_CONSTANT2_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000408, -}; -u32 R600_VS_CONSTANT3_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x0000040C, -}; -u32 R600_VS_CONSTANT4_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000410, -}; -u32 R600_VS_CONSTANT5_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000414, -}; -u32 R600_VS_CONSTANT6_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000418, -}; -u32 R600_VS_CONSTANT7_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x0000041C, -}; -u32 R600_VS_CONSTANT8_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000420, -}; -u32 R600_VS_CONSTANT9_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000424, -}; -u32 R600_VS_CONSTANT10_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000428, -}; -u32 R600_VS_CONSTANT11_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x0000042C, -}; -u32 R600_VS_CONSTANT12_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000430, -}; -u32 R600_VS_CONSTANT13_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000434, -}; -u32 R600_VS_CONSTANT14_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000438, -}; -u32 R600_VS_CONSTANT15_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x0000043C, -}; -u32 R600_VS_CONSTANT16_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000440, -}; -u32 R600_VS_CONSTANT17_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000444, -}; -u32 R600_VS_CONSTANT18_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000448, -}; -u32 R600_VS_CONSTANT19_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x0000044C, -}; -u32 R600_VS_CONSTANT20_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000450, -}; -u32 R600_VS_CONSTANT21_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000454, -}; -u32 R600_VS_CONSTANT22_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000458, -}; -u32 R600_VS_CONSTANT23_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x0000045C, -}; -u32 R600_VS_CONSTANT24_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000460, -}; -u32 R600_VS_CONSTANT25_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000464, -}; -u32 R600_VS_CONSTANT26_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000468, -}; -u32 R600_VS_CONSTANT27_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x0000046C, -}; -u32 R600_VS_CONSTANT28_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000470, -}; -u32 R600_VS_CONSTANT29_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000474, -}; -u32 R600_VS_CONSTANT30_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000478, -}; -u32 R600_VS_CONSTANT31_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x0000047C, -}; -u32 R600_VS_CONSTANT32_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000480, -}; -u32 R600_VS_CONSTANT33_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000484, -}; -u32 R600_VS_CONSTANT34_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000488, -}; -u32 R600_VS_CONSTANT35_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x0000048C, -}; -u32 R600_VS_CONSTANT36_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000490, -}; -u32 R600_VS_CONSTANT37_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000494, -}; -u32 R600_VS_CONSTANT38_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000498, -}; -u32 R600_VS_CONSTANT39_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x0000049C, -}; -u32 R600_VS_CONSTANT40_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000004A0, -}; -u32 R600_VS_CONSTANT41_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000004A4, -}; -u32 R600_VS_CONSTANT42_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000004A8, -}; -u32 R600_VS_CONSTANT43_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000004AC, -}; -u32 R600_VS_CONSTANT44_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000004B0, -}; -u32 R600_VS_CONSTANT45_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000004B4, -}; -u32 R600_VS_CONSTANT46_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000004B8, -}; -u32 R600_VS_CONSTANT47_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000004BC, -}; -u32 R600_VS_CONSTANT48_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000004C0, -}; -u32 R600_VS_CONSTANT49_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000004C4, -}; -u32 R600_VS_CONSTANT50_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000004C8, -}; -u32 R600_VS_CONSTANT51_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000004CC, -}; -u32 R600_VS_CONSTANT52_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000004D0, -}; -u32 R600_VS_CONSTANT53_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000004D4, -}; -u32 R600_VS_CONSTANT54_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000004D8, -}; -u32 R600_VS_CONSTANT55_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000004DC, -}; -u32 R600_VS_CONSTANT56_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000004E0, -}; -u32 R600_VS_CONSTANT57_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000004E4, -}; -u32 R600_VS_CONSTANT58_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000004E8, -}; -u32 R600_VS_CONSTANT59_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000004EC, -}; -u32 R600_VS_CONSTANT60_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000004F0, -}; -u32 R600_VS_CONSTANT61_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000004F4, -}; -u32 R600_VS_CONSTANT62_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000004F8, -}; -u32 R600_VS_CONSTANT63_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000004FC, -}; -u32 R600_VS_CONSTANT64_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000500, -}; -u32 R600_VS_CONSTANT65_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000504, -}; -u32 R600_VS_CONSTANT66_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000508, -}; -u32 R600_VS_CONSTANT67_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x0000050C, -}; -u32 R600_VS_CONSTANT68_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000510, -}; -u32 R600_VS_CONSTANT69_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000514, -}; -u32 R600_VS_CONSTANT70_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000518, -}; -u32 R600_VS_CONSTANT71_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x0000051C, -}; -u32 R600_VS_CONSTANT72_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000520, -}; -u32 R600_VS_CONSTANT73_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000524, -}; -u32 R600_VS_CONSTANT74_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000528, -}; -u32 R600_VS_CONSTANT75_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x0000052C, -}; -u32 R600_VS_CONSTANT76_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000530, -}; -u32 R600_VS_CONSTANT77_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000534, -}; -u32 R600_VS_CONSTANT78_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000538, -}; -u32 R600_VS_CONSTANT79_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x0000053C, -}; -u32 R600_VS_CONSTANT80_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000540, -}; -u32 R600_VS_CONSTANT81_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000544, -}; -u32 R600_VS_CONSTANT82_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000548, -}; -u32 R600_VS_CONSTANT83_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x0000054C, -}; -u32 R600_VS_CONSTANT84_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000550, -}; -u32 R600_VS_CONSTANT85_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000554, -}; -u32 R600_VS_CONSTANT86_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000558, -}; -u32 R600_VS_CONSTANT87_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x0000055C, -}; -u32 R600_VS_CONSTANT88_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000560, -}; -u32 R600_VS_CONSTANT89_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000564, -}; -u32 R600_VS_CONSTANT90_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000568, -}; -u32 R600_VS_CONSTANT91_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x0000056C, -}; -u32 R600_VS_CONSTANT92_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000570, -}; -u32 R600_VS_CONSTANT93_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000574, -}; -u32 R600_VS_CONSTANT94_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000578, -}; -u32 R600_VS_CONSTANT95_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x0000057C, -}; -u32 R600_VS_CONSTANT96_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000580, -}; -u32 R600_VS_CONSTANT97_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000584, -}; -u32 R600_VS_CONSTANT98_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000588, -}; -u32 R600_VS_CONSTANT99_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x0000058C, -}; -u32 R600_VS_CONSTANT100_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000590, -}; -u32 R600_VS_CONSTANT101_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000594, -}; -u32 R600_VS_CONSTANT102_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000598, -}; -u32 R600_VS_CONSTANT103_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x0000059C, -}; -u32 R600_VS_CONSTANT104_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000005A0, -}; -u32 R600_VS_CONSTANT105_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000005A4, -}; -u32 R600_VS_CONSTANT106_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000005A8, -}; -u32 R600_VS_CONSTANT107_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000005AC, -}; -u32 R600_VS_CONSTANT108_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000005B0, -}; -u32 R600_VS_CONSTANT109_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000005B4, -}; -u32 R600_VS_CONSTANT110_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000005B8, -}; -u32 R600_VS_CONSTANT111_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000005BC, -}; -u32 R600_VS_CONSTANT112_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000005C0, -}; -u32 R600_VS_CONSTANT113_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000005C4, -}; -u32 R600_VS_CONSTANT114_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000005C8, -}; -u32 R600_VS_CONSTANT115_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000005CC, -}; -u32 R600_VS_CONSTANT116_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000005D0, -}; -u32 R600_VS_CONSTANT117_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000005D4, -}; -u32 R600_VS_CONSTANT118_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000005D8, -}; -u32 R600_VS_CONSTANT119_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000005DC, -}; -u32 R600_VS_CONSTANT120_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000005E0, -}; -u32 R600_VS_CONSTANT121_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000005E4, -}; -u32 R600_VS_CONSTANT122_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000005E8, -}; -u32 R600_VS_CONSTANT123_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000005EC, -}; -u32 R600_VS_CONSTANT124_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000005F0, -}; -u32 R600_VS_CONSTANT125_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000005F4, -}; -u32 R600_VS_CONSTANT126_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000005F8, -}; -u32 R600_VS_CONSTANT127_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000005FC, -}; -u32 R600_VS_CONSTANT128_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000600, -}; -u32 R600_VS_CONSTANT129_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000604, -}; -u32 R600_VS_CONSTANT130_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000608, -}; -u32 R600_VS_CONSTANT131_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x0000060C, -}; -u32 R600_VS_CONSTANT132_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000610, -}; -u32 R600_VS_CONSTANT133_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000614, -}; -u32 R600_VS_CONSTANT134_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000618, -}; -u32 R600_VS_CONSTANT135_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x0000061C, -}; -u32 R600_VS_CONSTANT136_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000620, -}; -u32 R600_VS_CONSTANT137_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000624, -}; -u32 R600_VS_CONSTANT138_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000628, -}; -u32 R600_VS_CONSTANT139_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x0000062C, -}; -u32 R600_VS_CONSTANT140_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000630, -}; -u32 R600_VS_CONSTANT141_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000634, -}; -u32 R600_VS_CONSTANT142_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000638, -}; -u32 R600_VS_CONSTANT143_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x0000063C, -}; -u32 R600_VS_CONSTANT144_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000640, -}; -u32 R600_VS_CONSTANT145_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000644, -}; -u32 R600_VS_CONSTANT146_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000648, -}; -u32 R600_VS_CONSTANT147_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x0000064C, -}; -u32 R600_VS_CONSTANT148_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000650, -}; -u32 R600_VS_CONSTANT149_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000654, -}; -u32 R600_VS_CONSTANT150_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000658, -}; -u32 R600_VS_CONSTANT151_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x0000065C, -}; -u32 R600_VS_CONSTANT152_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000660, -}; -u32 R600_VS_CONSTANT153_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000664, -}; -u32 R600_VS_CONSTANT154_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000668, -}; -u32 R600_VS_CONSTANT155_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x0000066C, -}; -u32 R600_VS_CONSTANT156_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000670, -}; -u32 R600_VS_CONSTANT157_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000674, -}; -u32 R600_VS_CONSTANT158_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000678, -}; -u32 R600_VS_CONSTANT159_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x0000067C, -}; -u32 R600_VS_CONSTANT160_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000680, -}; -u32 R600_VS_CONSTANT161_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000684, -}; -u32 R600_VS_CONSTANT162_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000688, -}; -u32 R600_VS_CONSTANT163_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x0000068C, -}; -u32 R600_VS_CONSTANT164_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000690, -}; -u32 R600_VS_CONSTANT165_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000694, -}; -u32 R600_VS_CONSTANT166_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000698, -}; -u32 R600_VS_CONSTANT167_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x0000069C, -}; -u32 R600_VS_CONSTANT168_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000006A0, -}; -u32 R600_VS_CONSTANT169_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000006A4, -}; -u32 R600_VS_CONSTANT170_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000006A8, -}; -u32 R600_VS_CONSTANT171_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000006AC, -}; -u32 R600_VS_CONSTANT172_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000006B0, -}; -u32 R600_VS_CONSTANT173_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000006B4, -}; -u32 R600_VS_CONSTANT174_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000006B8, -}; -u32 R600_VS_CONSTANT175_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000006BC, -}; -u32 R600_VS_CONSTANT176_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000006C0, -}; -u32 R600_VS_CONSTANT177_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000006C4, -}; -u32 R600_VS_CONSTANT178_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000006C8, -}; -u32 R600_VS_CONSTANT179_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000006CC, -}; -u32 R600_VS_CONSTANT180_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000006D0, -}; -u32 R600_VS_CONSTANT181_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000006D4, -}; -u32 R600_VS_CONSTANT182_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000006D8, -}; -u32 R600_VS_CONSTANT183_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000006DC, -}; -u32 R600_VS_CONSTANT184_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000006E0, -}; -u32 R600_VS_CONSTANT185_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000006E4, -}; -u32 R600_VS_CONSTANT186_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000006E8, -}; -u32 R600_VS_CONSTANT187_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000006EC, -}; -u32 R600_VS_CONSTANT188_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000006F0, -}; -u32 R600_VS_CONSTANT189_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000006F4, -}; -u32 R600_VS_CONSTANT190_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000006F8, -}; -u32 R600_VS_CONSTANT191_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000006FC, -}; -u32 R600_VS_CONSTANT192_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000700, -}; -u32 R600_VS_CONSTANT193_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000704, -}; -u32 R600_VS_CONSTANT194_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000708, -}; -u32 R600_VS_CONSTANT195_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x0000070C, -}; -u32 R600_VS_CONSTANT196_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000710, -}; -u32 R600_VS_CONSTANT197_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000714, -}; -u32 R600_VS_CONSTANT198_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000718, -}; -u32 R600_VS_CONSTANT199_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x0000071C, -}; -u32 R600_VS_CONSTANT200_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000720, -}; -u32 R600_VS_CONSTANT201_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000724, -}; -u32 R600_VS_CONSTANT202_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000728, -}; -u32 R600_VS_CONSTANT203_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x0000072C, -}; -u32 R600_VS_CONSTANT204_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000730, -}; -u32 R600_VS_CONSTANT205_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000734, -}; -u32 R600_VS_CONSTANT206_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000738, -}; -u32 R600_VS_CONSTANT207_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x0000073C, -}; -u32 R600_VS_CONSTANT208_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000740, -}; -u32 R600_VS_CONSTANT209_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000744, -}; -u32 R600_VS_CONSTANT210_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000748, -}; -u32 R600_VS_CONSTANT211_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x0000074C, -}; -u32 R600_VS_CONSTANT212_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000750, -}; -u32 R600_VS_CONSTANT213_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000754, -}; -u32 R600_VS_CONSTANT214_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000758, -}; -u32 R600_VS_CONSTANT215_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x0000075C, -}; -u32 R600_VS_CONSTANT216_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000760, -}; -u32 R600_VS_CONSTANT217_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000764, -}; -u32 R600_VS_CONSTANT218_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000768, -}; -u32 R600_VS_CONSTANT219_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x0000076C, -}; -u32 R600_VS_CONSTANT220_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000770, -}; -u32 R600_VS_CONSTANT221_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000774, -}; -u32 R600_VS_CONSTANT222_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000778, -}; -u32 R600_VS_CONSTANT223_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x0000077C, -}; -u32 R600_VS_CONSTANT224_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000780, -}; -u32 R600_VS_CONSTANT225_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000784, -}; -u32 R600_VS_CONSTANT226_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000788, -}; -u32 R600_VS_CONSTANT227_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x0000078C, -}; -u32 R600_VS_CONSTANT228_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000790, -}; -u32 R600_VS_CONSTANT229_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000794, -}; -u32 R600_VS_CONSTANT230_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x00000798, -}; -u32 R600_VS_CONSTANT231_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x0000079C, -}; -u32 R600_VS_CONSTANT232_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000007A0, -}; -u32 R600_VS_CONSTANT233_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000007A4, -}; -u32 R600_VS_CONSTANT234_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000007A8, -}; -u32 R600_VS_CONSTANT235_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000007AC, -}; -u32 R600_VS_CONSTANT236_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000007B0, -}; -u32 R600_VS_CONSTANT237_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000007B4, -}; -u32 R600_VS_CONSTANT238_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000007B8, -}; -u32 R600_VS_CONSTANT239_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000007BC, -}; -u32 R600_VS_CONSTANT240_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000007C0, -}; -u32 R600_VS_CONSTANT241_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000007C4, -}; -u32 R600_VS_CONSTANT242_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000007C8, -}; -u32 R600_VS_CONSTANT243_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000007CC, -}; -u32 R600_VS_CONSTANT244_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000007D0, -}; -u32 R600_VS_CONSTANT245_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000007D4, -}; -u32 R600_VS_CONSTANT246_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000007D8, -}; -u32 R600_VS_CONSTANT247_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000007DC, -}; -u32 R600_VS_CONSTANT248_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000007E0, -}; -u32 R600_VS_CONSTANT249_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000007E4, -}; -u32 R600_VS_CONSTANT250_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000007E8, -}; -u32 R600_VS_CONSTANT251_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000007EC, -}; -u32 R600_VS_CONSTANT252_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000007F0, -}; -u32 R600_VS_CONSTANT253_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000007F4, -}; -u32 R600_VS_CONSTANT254_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000007F8, -}; -u32 R600_VS_CONSTANT255_header_pm4[R600_CONSTANT_header_cpm4] = { - 0xC0046A00, - 0x000007FC, -}; -#define R600_CONSTANT_state_cpm4 4 -u32 R600_CONSTANT_state_pm4[R600_CONSTANT_state_cpm4] = { - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, -}; - - -/* R600_RESOURCE */ -#define R600_RESOURCE_header_cpm4 2 -u32 R600_PS_RESOURCE0_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000000, -}; -u32 R600_PS_RESOURCE1_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000007, -}; -u32 R600_PS_RESOURCE2_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x0000000E, -}; -u32 R600_PS_RESOURCE3_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000015, -}; -u32 R600_PS_RESOURCE4_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x0000001C, -}; -u32 R600_PS_RESOURCE5_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000023, -}; -u32 R600_PS_RESOURCE6_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x0000002A, -}; -u32 R600_PS_RESOURCE7_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000031, -}; -u32 R600_PS_RESOURCE8_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000038, -}; -u32 R600_PS_RESOURCE9_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x0000003F, -}; -u32 R600_PS_RESOURCE10_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000046, -}; -u32 R600_PS_RESOURCE11_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x0000004D, -}; -u32 R600_PS_RESOURCE12_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000054, -}; -u32 R600_PS_RESOURCE13_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x0000005B, -}; -u32 R600_PS_RESOURCE14_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000062, -}; -u32 R600_PS_RESOURCE15_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000069, -}; -u32 R600_PS_RESOURCE16_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000070, -}; -u32 R600_PS_RESOURCE17_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000077, -}; -u32 R600_PS_RESOURCE18_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x0000007E, -}; -u32 R600_PS_RESOURCE19_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000085, -}; -u32 R600_PS_RESOURCE20_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x0000008C, -}; -u32 R600_PS_RESOURCE21_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000093, -}; -u32 R600_PS_RESOURCE22_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x0000009A, -}; -u32 R600_PS_RESOURCE23_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x000000A1, -}; -u32 R600_PS_RESOURCE24_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x000000A8, -}; -u32 R600_PS_RESOURCE25_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x000000AF, -}; -u32 R600_PS_RESOURCE26_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x000000B6, -}; -u32 R600_PS_RESOURCE27_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x000000BD, -}; -u32 R600_PS_RESOURCE28_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x000000C4, -}; -u32 R600_PS_RESOURCE29_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x000000CB, -}; -u32 R600_PS_RESOURCE30_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x000000D2, -}; -u32 R600_PS_RESOURCE31_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x000000D9, -}; -u32 R600_PS_RESOURCE32_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x000000E0, -}; -u32 R600_PS_RESOURCE33_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x000000E7, -}; -u32 R600_PS_RESOURCE34_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x000000EE, -}; -u32 R600_PS_RESOURCE35_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x000000F5, -}; -u32 R600_PS_RESOURCE36_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x000000FC, -}; -u32 R600_PS_RESOURCE37_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000103, -}; -u32 R600_PS_RESOURCE38_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x0000010A, -}; -u32 R600_PS_RESOURCE39_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000111, -}; -u32 R600_PS_RESOURCE40_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000118, -}; -u32 R600_PS_RESOURCE41_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x0000011F, -}; -u32 R600_PS_RESOURCE42_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000126, -}; -u32 R600_PS_RESOURCE43_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x0000012D, -}; -u32 R600_PS_RESOURCE44_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000134, -}; -u32 R600_PS_RESOURCE45_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x0000013B, -}; -u32 R600_PS_RESOURCE46_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000142, -}; -u32 R600_PS_RESOURCE47_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000149, -}; -u32 R600_PS_RESOURCE48_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000150, -}; -u32 R600_PS_RESOURCE49_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000157, -}; -u32 R600_PS_RESOURCE50_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x0000015E, -}; -u32 R600_PS_RESOURCE51_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000165, -}; -u32 R600_PS_RESOURCE52_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x0000016C, -}; -u32 R600_PS_RESOURCE53_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000173, -}; -u32 R600_PS_RESOURCE54_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x0000017A, -}; -u32 R600_PS_RESOURCE55_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000181, -}; -u32 R600_PS_RESOURCE56_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000188, -}; -u32 R600_PS_RESOURCE57_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x0000018F, -}; -u32 R600_PS_RESOURCE58_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000196, -}; -u32 R600_PS_RESOURCE59_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x0000019D, -}; -u32 R600_PS_RESOURCE60_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x000001A4, -}; -u32 R600_PS_RESOURCE61_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x000001AB, -}; -u32 R600_PS_RESOURCE62_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x000001B2, -}; -u32 R600_PS_RESOURCE63_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x000001B9, -}; -u32 R600_PS_RESOURCE64_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x000001C0, -}; -u32 R600_PS_RESOURCE65_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x000001C7, -}; -u32 R600_PS_RESOURCE66_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x000001CE, -}; -u32 R600_PS_RESOURCE67_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x000001D5, -}; -u32 R600_PS_RESOURCE68_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x000001DC, -}; -u32 R600_PS_RESOURCE69_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x000001E3, -}; -u32 R600_PS_RESOURCE70_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x000001EA, -}; -u32 R600_PS_RESOURCE71_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x000001F1, -}; -u32 R600_PS_RESOURCE72_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x000001F8, -}; -u32 R600_PS_RESOURCE73_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x000001FF, -}; -u32 R600_PS_RESOURCE74_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000206, -}; -u32 R600_PS_RESOURCE75_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x0000020D, -}; -u32 R600_PS_RESOURCE76_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000214, -}; -u32 R600_PS_RESOURCE77_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x0000021B, -}; -u32 R600_PS_RESOURCE78_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000222, -}; -u32 R600_PS_RESOURCE79_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000229, -}; -u32 R600_PS_RESOURCE80_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000230, -}; -u32 R600_PS_RESOURCE81_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000237, -}; -u32 R600_PS_RESOURCE82_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x0000023E, -}; -u32 R600_PS_RESOURCE83_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000245, -}; -u32 R600_PS_RESOURCE84_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x0000024C, -}; -u32 R600_PS_RESOURCE85_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000253, -}; -u32 R600_PS_RESOURCE86_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x0000025A, -}; -u32 R600_PS_RESOURCE87_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000261, -}; -u32 R600_PS_RESOURCE88_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000268, -}; -u32 R600_PS_RESOURCE89_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x0000026F, -}; -u32 R600_PS_RESOURCE90_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000276, -}; -u32 R600_PS_RESOURCE91_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x0000027D, -}; -u32 R600_PS_RESOURCE92_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000284, -}; -u32 R600_PS_RESOURCE93_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x0000028B, -}; -u32 R600_PS_RESOURCE94_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000292, -}; -u32 R600_PS_RESOURCE95_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000299, -}; -u32 R600_PS_RESOURCE96_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x000002A0, -}; -u32 R600_PS_RESOURCE97_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x000002A7, -}; -u32 R600_PS_RESOURCE98_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x000002AE, -}; -u32 R600_PS_RESOURCE99_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x000002B5, -}; -u32 R600_PS_RESOURCE100_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x000002BC, -}; -u32 R600_PS_RESOURCE101_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x000002C3, -}; -u32 R600_PS_RESOURCE102_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x000002CA, -}; -u32 R600_PS_RESOURCE103_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x000002D1, -}; -u32 R600_PS_RESOURCE104_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x000002D8, -}; -u32 R600_PS_RESOURCE105_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x000002DF, -}; -u32 R600_PS_RESOURCE106_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x000002E6, -}; -u32 R600_PS_RESOURCE107_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x000002ED, -}; -u32 R600_PS_RESOURCE108_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x000002F4, -}; -u32 R600_PS_RESOURCE109_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x000002FB, -}; -u32 R600_PS_RESOURCE110_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000302, -}; -u32 R600_PS_RESOURCE111_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000309, -}; -u32 R600_PS_RESOURCE112_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000310, -}; -u32 R600_PS_RESOURCE113_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000317, -}; -u32 R600_PS_RESOURCE114_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x0000031E, -}; -u32 R600_PS_RESOURCE115_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000325, -}; -u32 R600_PS_RESOURCE116_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x0000032C, -}; -u32 R600_PS_RESOURCE117_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000333, -}; -u32 R600_PS_RESOURCE118_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x0000033A, -}; -u32 R600_PS_RESOURCE119_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000341, -}; -u32 R600_PS_RESOURCE120_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000348, -}; -u32 R600_PS_RESOURCE121_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x0000034F, -}; -u32 R600_PS_RESOURCE122_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000356, -}; -u32 R600_PS_RESOURCE123_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x0000035D, -}; -u32 R600_PS_RESOURCE124_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000364, -}; -u32 R600_PS_RESOURCE125_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x0000036B, -}; -u32 R600_PS_RESOURCE126_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000372, -}; -u32 R600_PS_RESOURCE127_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000379, -}; -u32 R600_PS_RESOURCE128_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000380, -}; -u32 R600_PS_RESOURCE129_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000387, -}; -u32 R600_PS_RESOURCE130_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x0000038E, -}; -u32 R600_PS_RESOURCE131_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000395, -}; -u32 R600_PS_RESOURCE132_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x0000039C, -}; -u32 R600_PS_RESOURCE133_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x000003A3, -}; -u32 R600_PS_RESOURCE134_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x000003AA, -}; -u32 R600_PS_RESOURCE135_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x000003B1, -}; -u32 R600_PS_RESOURCE136_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x000003B8, -}; -u32 R600_PS_RESOURCE137_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x000003BF, -}; -u32 R600_PS_RESOURCE138_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x000003C6, -}; -u32 R600_PS_RESOURCE139_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x000003CD, -}; -u32 R600_PS_RESOURCE140_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x000003D4, -}; -u32 R600_PS_RESOURCE141_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x000003DB, -}; -u32 R600_PS_RESOURCE142_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x000003E2, -}; -u32 R600_PS_RESOURCE143_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x000003E9, -}; -u32 R600_PS_RESOURCE144_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x000003F0, -}; -u32 R600_PS_RESOURCE145_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x000003F7, -}; -u32 R600_PS_RESOURCE146_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x000003FE, -}; -u32 R600_PS_RESOURCE147_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000405, -}; -u32 R600_PS_RESOURCE148_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x0000040C, -}; -u32 R600_PS_RESOURCE149_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000413, -}; -u32 R600_PS_RESOURCE150_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x0000041A, -}; -u32 R600_PS_RESOURCE151_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000421, -}; -u32 R600_PS_RESOURCE152_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000428, -}; -u32 R600_PS_RESOURCE153_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x0000042F, -}; -u32 R600_PS_RESOURCE154_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000436, -}; -u32 R600_PS_RESOURCE155_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x0000043D, -}; -u32 R600_PS_RESOURCE156_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000444, -}; -u32 R600_PS_RESOURCE157_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x0000044B, -}; -u32 R600_PS_RESOURCE158_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000452, -}; -u32 R600_PS_RESOURCE159_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000459, -}; -u32 R600_VS_RESOURCE0_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000460, -}; -u32 R600_VS_RESOURCE1_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000467, -}; -u32 R600_VS_RESOURCE2_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x0000046E, -}; -u32 R600_VS_RESOURCE3_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000475, -}; -u32 R600_VS_RESOURCE4_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x0000047C, -}; -u32 R600_VS_RESOURCE5_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000483, -}; -u32 R600_VS_RESOURCE6_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x0000048A, -}; -u32 R600_VS_RESOURCE7_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000491, -}; -u32 R600_VS_RESOURCE8_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000498, -}; -u32 R600_VS_RESOURCE9_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x0000049F, -}; -u32 R600_VS_RESOURCE10_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x000004A6, -}; -u32 R600_VS_RESOURCE11_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x000004AD, -}; -u32 R600_VS_RESOURCE12_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x000004B4, -}; -u32 R600_VS_RESOURCE13_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x000004BB, -}; -u32 R600_VS_RESOURCE14_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x000004C2, -}; -u32 R600_VS_RESOURCE15_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x000004C9, -}; -u32 R600_VS_RESOURCE16_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x000004D0, -}; -u32 R600_VS_RESOURCE17_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x000004D7, -}; -u32 R600_VS_RESOURCE18_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x000004DE, -}; -u32 R600_VS_RESOURCE19_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x000004E5, -}; -u32 R600_VS_RESOURCE20_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x000004EC, -}; -u32 R600_VS_RESOURCE21_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x000004F3, -}; -u32 R600_VS_RESOURCE22_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x000004FA, -}; -u32 R600_VS_RESOURCE23_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000501, -}; -u32 R600_VS_RESOURCE24_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000508, -}; -u32 R600_VS_RESOURCE25_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x0000050F, -}; -u32 R600_VS_RESOURCE26_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000516, -}; -u32 R600_VS_RESOURCE27_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x0000051D, -}; -u32 R600_VS_RESOURCE28_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000524, -}; -u32 R600_VS_RESOURCE29_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x0000052B, -}; -u32 R600_VS_RESOURCE30_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000532, -}; -u32 R600_VS_RESOURCE31_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000539, -}; -u32 R600_VS_RESOURCE32_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000540, -}; -u32 R600_VS_RESOURCE33_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000547, -}; -u32 R600_VS_RESOURCE34_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x0000054E, -}; -u32 R600_VS_RESOURCE35_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000555, -}; -u32 R600_VS_RESOURCE36_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x0000055C, -}; -u32 R600_VS_RESOURCE37_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000563, -}; -u32 R600_VS_RESOURCE38_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x0000056A, -}; -u32 R600_VS_RESOURCE39_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000571, -}; -u32 R600_VS_RESOURCE40_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000578, -}; -u32 R600_VS_RESOURCE41_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x0000057F, -}; -u32 R600_VS_RESOURCE42_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000586, -}; -u32 R600_VS_RESOURCE43_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x0000058D, -}; -u32 R600_VS_RESOURCE44_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000594, -}; -u32 R600_VS_RESOURCE45_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x0000059B, -}; -u32 R600_VS_RESOURCE46_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x000005A2, -}; -u32 R600_VS_RESOURCE47_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x000005A9, -}; -u32 R600_VS_RESOURCE48_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x000005B0, -}; -u32 R600_VS_RESOURCE49_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x000005B7, -}; -u32 R600_VS_RESOURCE50_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x000005BE, -}; -u32 R600_VS_RESOURCE51_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x000005C5, -}; -u32 R600_VS_RESOURCE52_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x000005CC, -}; -u32 R600_VS_RESOURCE53_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x000005D3, -}; -u32 R600_VS_RESOURCE54_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x000005DA, -}; -u32 R600_VS_RESOURCE55_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x000005E1, -}; -u32 R600_VS_RESOURCE56_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x000005E8, -}; -u32 R600_VS_RESOURCE57_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x000005EF, -}; -u32 R600_VS_RESOURCE58_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x000005F6, -}; -u32 R600_VS_RESOURCE59_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x000005FD, -}; -u32 R600_VS_RESOURCE60_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000604, -}; -u32 R600_VS_RESOURCE61_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x0000060B, -}; -u32 R600_VS_RESOURCE62_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000612, -}; -u32 R600_VS_RESOURCE63_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000619, -}; -u32 R600_VS_RESOURCE64_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000620, -}; -u32 R600_VS_RESOURCE65_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000627, -}; -u32 R600_VS_RESOURCE66_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x0000062E, -}; -u32 R600_VS_RESOURCE67_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000635, -}; -u32 R600_VS_RESOURCE68_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x0000063C, -}; -u32 R600_VS_RESOURCE69_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000643, -}; -u32 R600_VS_RESOURCE70_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x0000064A, -}; -u32 R600_VS_RESOURCE71_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000651, -}; -u32 R600_VS_RESOURCE72_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000658, -}; -u32 R600_VS_RESOURCE73_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x0000065F, -}; -u32 R600_VS_RESOURCE74_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000666, -}; -u32 R600_VS_RESOURCE75_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x0000066D, -}; -u32 R600_VS_RESOURCE76_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000674, -}; -u32 R600_VS_RESOURCE77_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x0000067B, -}; -u32 R600_VS_RESOURCE78_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000682, -}; -u32 R600_VS_RESOURCE79_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000689, -}; -u32 R600_VS_RESOURCE80_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000690, -}; -u32 R600_VS_RESOURCE81_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000697, -}; -u32 R600_VS_RESOURCE82_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x0000069E, -}; -u32 R600_VS_RESOURCE83_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x000006A5, -}; -u32 R600_VS_RESOURCE84_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x000006AC, -}; -u32 R600_VS_RESOURCE85_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x000006B3, -}; -u32 R600_VS_RESOURCE86_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x000006BA, -}; -u32 R600_VS_RESOURCE87_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x000006C1, -}; -u32 R600_VS_RESOURCE88_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x000006C8, -}; -u32 R600_VS_RESOURCE89_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x000006CF, -}; -u32 R600_VS_RESOURCE90_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x000006D6, -}; -u32 R600_VS_RESOURCE91_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x000006DD, -}; -u32 R600_VS_RESOURCE92_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x000006E4, -}; -u32 R600_VS_RESOURCE93_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x000006EB, -}; -u32 R600_VS_RESOURCE94_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x000006F2, -}; -u32 R600_VS_RESOURCE95_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x000006F9, -}; -u32 R600_VS_RESOURCE96_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000700, -}; -u32 R600_VS_RESOURCE97_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000707, -}; -u32 R600_VS_RESOURCE98_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x0000070E, -}; -u32 R600_VS_RESOURCE99_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000715, -}; -u32 R600_VS_RESOURCE100_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x0000071C, -}; -u32 R600_VS_RESOURCE101_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000723, -}; -u32 R600_VS_RESOURCE102_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x0000072A, -}; -u32 R600_VS_RESOURCE103_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000731, -}; -u32 R600_VS_RESOURCE104_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000738, -}; -u32 R600_VS_RESOURCE105_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x0000073F, -}; -u32 R600_VS_RESOURCE106_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000746, -}; -u32 R600_VS_RESOURCE107_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x0000074D, -}; -u32 R600_VS_RESOURCE108_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000754, -}; -u32 R600_VS_RESOURCE109_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x0000075B, -}; -u32 R600_VS_RESOURCE110_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000762, -}; -u32 R600_VS_RESOURCE111_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000769, -}; -u32 R600_VS_RESOURCE112_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000770, -}; -u32 R600_VS_RESOURCE113_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000777, -}; -u32 R600_VS_RESOURCE114_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x0000077E, -}; -u32 R600_VS_RESOURCE115_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000785, -}; -u32 R600_VS_RESOURCE116_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x0000078C, -}; -u32 R600_VS_RESOURCE117_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000793, -}; -u32 R600_VS_RESOURCE118_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x0000079A, -}; -u32 R600_VS_RESOURCE119_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x000007A1, -}; -u32 R600_VS_RESOURCE120_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x000007A8, -}; -u32 R600_VS_RESOURCE121_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x000007AF, -}; -u32 R600_VS_RESOURCE122_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x000007B6, -}; -u32 R600_VS_RESOURCE123_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x000007BD, -}; -u32 R600_VS_RESOURCE124_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x000007C4, -}; -u32 R600_VS_RESOURCE125_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x000007CB, -}; -u32 R600_VS_RESOURCE126_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x000007D2, -}; -u32 R600_VS_RESOURCE127_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x000007D9, -}; -u32 R600_VS_RESOURCE128_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x000007E0, -}; -u32 R600_VS_RESOURCE129_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x000007E7, -}; -u32 R600_VS_RESOURCE130_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x000007EE, -}; -u32 R600_VS_RESOURCE131_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x000007F5, -}; -u32 R600_VS_RESOURCE132_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x000007FC, -}; -u32 R600_VS_RESOURCE133_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000803, -}; -u32 R600_VS_RESOURCE134_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x0000080A, -}; -u32 R600_VS_RESOURCE135_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000811, -}; -u32 R600_VS_RESOURCE136_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000818, -}; -u32 R600_VS_RESOURCE137_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x0000081F, -}; -u32 R600_VS_RESOURCE138_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000826, -}; -u32 R600_VS_RESOURCE139_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x0000082D, -}; -u32 R600_VS_RESOURCE140_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000834, -}; -u32 R600_VS_RESOURCE141_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x0000083B, -}; -u32 R600_VS_RESOURCE142_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000842, -}; -u32 R600_VS_RESOURCE143_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000849, -}; -u32 R600_VS_RESOURCE144_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000850, -}; -u32 R600_VS_RESOURCE145_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000857, -}; -u32 R600_VS_RESOURCE146_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x0000085E, -}; -u32 R600_VS_RESOURCE147_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000865, -}; -u32 R600_VS_RESOURCE148_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x0000086C, -}; -u32 R600_VS_RESOURCE149_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000873, -}; -u32 R600_VS_RESOURCE150_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x0000087A, -}; -u32 R600_VS_RESOURCE151_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000881, -}; -u32 R600_VS_RESOURCE152_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000888, -}; -u32 R600_VS_RESOURCE153_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x0000088F, -}; -u32 R600_VS_RESOURCE154_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000896, -}; -u32 R600_VS_RESOURCE155_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x0000089D, -}; -u32 R600_VS_RESOURCE156_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x000008A4, -}; -u32 R600_VS_RESOURCE157_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x000008AB, -}; -u32 R600_VS_RESOURCE158_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x000008B2, -}; -u32 R600_VS_RESOURCE159_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x000008B9, -}; -u32 R600_FS_RESOURCE0_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x000008C0, -}; -u32 R600_FS_RESOURCE1_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x000008C7, -}; -u32 R600_FS_RESOURCE2_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x000008CE, -}; -u32 R600_FS_RESOURCE3_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x000008D5, -}; -u32 R600_FS_RESOURCE4_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x000008DC, -}; -u32 R600_FS_RESOURCE5_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x000008E3, -}; -u32 R600_FS_RESOURCE6_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x000008EA, -}; -u32 R600_FS_RESOURCE7_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x000008F1, -}; -u32 R600_FS_RESOURCE8_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x000008F8, -}; -u32 R600_FS_RESOURCE9_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x000008FF, -}; -u32 R600_FS_RESOURCE10_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000906, -}; -u32 R600_FS_RESOURCE11_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x0000090D, -}; -u32 R600_FS_RESOURCE12_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000914, -}; -u32 R600_FS_RESOURCE13_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x0000091B, -}; -u32 R600_FS_RESOURCE14_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000922, -}; -u32 R600_FS_RESOURCE15_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000929, -}; -u32 R600_GS_RESOURCE0_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000930, -}; -u32 R600_GS_RESOURCE1_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000937, -}; -u32 R600_GS_RESOURCE2_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x0000093E, -}; -u32 R600_GS_RESOURCE3_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000945, -}; -u32 R600_GS_RESOURCE4_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x0000094C, -}; -u32 R600_GS_RESOURCE5_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000953, -}; -u32 R600_GS_RESOURCE6_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x0000095A, -}; -u32 R600_GS_RESOURCE7_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000961, -}; -u32 R600_GS_RESOURCE8_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000968, -}; -u32 R600_GS_RESOURCE9_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x0000096F, -}; -u32 R600_GS_RESOURCE10_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000976, -}; -u32 R600_GS_RESOURCE11_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x0000097D, -}; -u32 R600_GS_RESOURCE12_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000984, -}; -u32 R600_GS_RESOURCE13_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x0000098B, -}; -u32 R600_GS_RESOURCE14_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000992, -}; -u32 R600_GS_RESOURCE15_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000999, -}; -u32 R600_GS_RESOURCE16_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x000009A0, -}; -u32 R600_GS_RESOURCE17_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x000009A7, -}; -u32 R600_GS_RESOURCE18_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x000009AE, -}; -u32 R600_GS_RESOURCE19_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x000009B5, -}; -u32 R600_GS_RESOURCE20_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x000009BC, -}; -u32 R600_GS_RESOURCE21_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x000009C3, -}; -u32 R600_GS_RESOURCE22_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x000009CA, -}; -u32 R600_GS_RESOURCE23_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x000009D1, -}; -u32 R600_GS_RESOURCE24_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x000009D8, -}; -u32 R600_GS_RESOURCE25_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x000009DF, -}; -u32 R600_GS_RESOURCE26_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x000009E6, -}; -u32 R600_GS_RESOURCE27_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x000009ED, -}; -u32 R600_GS_RESOURCE28_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x000009F4, -}; -u32 R600_GS_RESOURCE29_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x000009FB, -}; -u32 R600_GS_RESOURCE30_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000A02, -}; -u32 R600_GS_RESOURCE31_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000A09, -}; -u32 R600_GS_RESOURCE32_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000A10, -}; -u32 R600_GS_RESOURCE33_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000A17, -}; -u32 R600_GS_RESOURCE34_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000A1E, -}; -u32 R600_GS_RESOURCE35_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000A25, -}; -u32 R600_GS_RESOURCE36_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000A2C, -}; -u32 R600_GS_RESOURCE37_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000A33, -}; -u32 R600_GS_RESOURCE38_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000A3A, -}; -u32 R600_GS_RESOURCE39_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000A41, -}; -u32 R600_GS_RESOURCE40_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000A48, -}; -u32 R600_GS_RESOURCE41_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000A4F, -}; -u32 R600_GS_RESOURCE42_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000A56, -}; -u32 R600_GS_RESOURCE43_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000A5D, -}; -u32 R600_GS_RESOURCE44_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000A64, -}; -u32 R600_GS_RESOURCE45_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000A6B, -}; -u32 R600_GS_RESOURCE46_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000A72, -}; -u32 R600_GS_RESOURCE47_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000A79, -}; -u32 R600_GS_RESOURCE48_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000A80, -}; -u32 R600_GS_RESOURCE49_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000A87, -}; -u32 R600_GS_RESOURCE50_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000A8E, -}; -u32 R600_GS_RESOURCE51_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000A95, -}; -u32 R600_GS_RESOURCE52_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000A9C, -}; -u32 R600_GS_RESOURCE53_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000AA3, -}; -u32 R600_GS_RESOURCE54_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000AAA, -}; -u32 R600_GS_RESOURCE55_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000AB1, -}; -u32 R600_GS_RESOURCE56_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000AB8, -}; -u32 R600_GS_RESOURCE57_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000ABF, -}; -u32 R600_GS_RESOURCE58_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000AC6, -}; -u32 R600_GS_RESOURCE59_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000ACD, -}; -u32 R600_GS_RESOURCE60_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000AD4, -}; -u32 R600_GS_RESOURCE61_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000ADB, -}; -u32 R600_GS_RESOURCE62_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000AE2, -}; -u32 R600_GS_RESOURCE63_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000AE9, -}; -u32 R600_GS_RESOURCE64_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000AF0, -}; -u32 R600_GS_RESOURCE65_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000AF7, -}; -u32 R600_GS_RESOURCE66_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000AFE, -}; -u32 R600_GS_RESOURCE67_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000B05, -}; -u32 R600_GS_RESOURCE68_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000B0C, -}; -u32 R600_GS_RESOURCE69_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000B13, -}; -u32 R600_GS_RESOURCE70_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000B1A, -}; -u32 R600_GS_RESOURCE71_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000B21, -}; -u32 R600_GS_RESOURCE72_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000B28, -}; -u32 R600_GS_RESOURCE73_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000B2F, -}; -u32 R600_GS_RESOURCE74_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000B36, -}; -u32 R600_GS_RESOURCE75_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000B3D, -}; -u32 R600_GS_RESOURCE76_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000B44, -}; -u32 R600_GS_RESOURCE77_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000B4B, -}; -u32 R600_GS_RESOURCE78_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000B52, -}; -u32 R600_GS_RESOURCE79_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000B59, -}; -u32 R600_GS_RESOURCE80_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000B60, -}; -u32 R600_GS_RESOURCE81_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000B67, -}; -u32 R600_GS_RESOURCE82_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000B6E, -}; -u32 R600_GS_RESOURCE83_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000B75, -}; -u32 R600_GS_RESOURCE84_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000B7C, -}; -u32 R600_GS_RESOURCE85_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000B83, -}; -u32 R600_GS_RESOURCE86_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000B8A, -}; -u32 R600_GS_RESOURCE87_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000B91, -}; -u32 R600_GS_RESOURCE88_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000B98, -}; -u32 R600_GS_RESOURCE89_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000B9F, -}; -u32 R600_GS_RESOURCE90_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000BA6, -}; -u32 R600_GS_RESOURCE91_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000BAD, -}; -u32 R600_GS_RESOURCE92_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000BB4, -}; -u32 R600_GS_RESOURCE93_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000BBB, -}; -u32 R600_GS_RESOURCE94_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000BC2, -}; -u32 R600_GS_RESOURCE95_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000BC9, -}; -u32 R600_GS_RESOURCE96_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000BD0, -}; -u32 R600_GS_RESOURCE97_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000BD7, -}; -u32 R600_GS_RESOURCE98_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000BDE, -}; -u32 R600_GS_RESOURCE99_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000BE5, -}; -u32 R600_GS_RESOURCE100_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000BEC, -}; -u32 R600_GS_RESOURCE101_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000BF3, -}; -u32 R600_GS_RESOURCE102_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000BFA, -}; -u32 R600_GS_RESOURCE103_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000C01, -}; -u32 R600_GS_RESOURCE104_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000C08, -}; -u32 R600_GS_RESOURCE105_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000C0F, -}; -u32 R600_GS_RESOURCE106_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000C16, -}; -u32 R600_GS_RESOURCE107_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000C1D, -}; -u32 R600_GS_RESOURCE108_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000C24, -}; -u32 R600_GS_RESOURCE109_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000C2B, -}; -u32 R600_GS_RESOURCE110_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000C32, -}; -u32 R600_GS_RESOURCE111_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000C39, -}; -u32 R600_GS_RESOURCE112_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000C40, -}; -u32 R600_GS_RESOURCE113_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000C47, -}; -u32 R600_GS_RESOURCE114_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000C4E, -}; -u32 R600_GS_RESOURCE115_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000C55, -}; -u32 R600_GS_RESOURCE116_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000C5C, -}; -u32 R600_GS_RESOURCE117_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000C63, -}; -u32 R600_GS_RESOURCE118_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000C6A, -}; -u32 R600_GS_RESOURCE119_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000C71, -}; -u32 R600_GS_RESOURCE120_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000C78, -}; -u32 R600_GS_RESOURCE121_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000C7F, -}; -u32 R600_GS_RESOURCE122_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000C86, -}; -u32 R600_GS_RESOURCE123_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000C8D, -}; -u32 R600_GS_RESOURCE124_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000C94, -}; -u32 R600_GS_RESOURCE125_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000C9B, -}; -u32 R600_GS_RESOURCE126_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000CA2, -}; -u32 R600_GS_RESOURCE127_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000CA9, -}; -u32 R600_GS_RESOURCE128_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000CB0, -}; -u32 R600_GS_RESOURCE129_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000CB7, -}; -u32 R600_GS_RESOURCE130_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000CBE, -}; -u32 R600_GS_RESOURCE131_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000CC5, -}; -u32 R600_GS_RESOURCE132_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000CCC, -}; -u32 R600_GS_RESOURCE133_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000CD3, -}; -u32 R600_GS_RESOURCE134_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000CDA, -}; -u32 R600_GS_RESOURCE135_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000CE1, -}; -u32 R600_GS_RESOURCE136_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000CE8, -}; -u32 R600_GS_RESOURCE137_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000CEF, -}; -u32 R600_GS_RESOURCE138_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000CF6, -}; -u32 R600_GS_RESOURCE139_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000CFD, -}; -u32 R600_GS_RESOURCE140_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000D04, -}; -u32 R600_GS_RESOURCE141_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000D0B, -}; -u32 R600_GS_RESOURCE142_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000D12, -}; -u32 R600_GS_RESOURCE143_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000D19, -}; -u32 R600_GS_RESOURCE144_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000D20, -}; -u32 R600_GS_RESOURCE145_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000D27, -}; -u32 R600_GS_RESOURCE146_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000D2E, -}; -u32 R600_GS_RESOURCE147_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000D35, -}; -u32 R600_GS_RESOURCE148_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000D3C, -}; -u32 R600_GS_RESOURCE149_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000D43, -}; -u32 R600_GS_RESOURCE150_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000D4A, -}; -u32 R600_GS_RESOURCE151_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000D51, -}; -u32 R600_GS_RESOURCE152_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000D58, -}; -u32 R600_GS_RESOURCE153_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000D5F, -}; -u32 R600_GS_RESOURCE154_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000D66, -}; -u32 R600_GS_RESOURCE155_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000D6D, -}; -u32 R600_GS_RESOURCE156_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000D74, -}; -u32 R600_GS_RESOURCE157_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000D7B, -}; -u32 R600_GS_RESOURCE158_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000D82, -}; -u32 R600_GS_RESOURCE159_header_pm4[R600_RESOURCE_header_cpm4] = { - 0xC0076D00, - 0x00000D89, -}; -#define R600_RESOURCE_state_cpm4 11 -u32 R600_RESOURCE_state_pm4[R600_RESOURCE_state_cpm4] = { - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x80000000, - 0xC0001000, - 0x00000000, - 0xC0001000, - 0x00000000, -}; - -/* R600_SAMPLER */ -#define R600_SAMPLER_header_cpm4 2 -u32 R600_PS_SAMPLER0_header_pm4[R600_SAMPLER_header_cpm4] = { - 0xC0036E00, - 0x00000000, -}; -u32 R600_PS_SAMPLER1_header_pm4[R600_SAMPLER_header_cpm4] = { - 0xC0036E00, - 0x00000003, -}; -u32 R600_PS_SAMPLER2_header_pm4[R600_SAMPLER_header_cpm4] = { - 0xC0036E00, - 0x00000006, -}; -u32 R600_PS_SAMPLER3_header_pm4[R600_SAMPLER_header_cpm4] = { - 0xC0036E00, - 0x00000009, -}; -u32 R600_PS_SAMPLER4_header_pm4[R600_SAMPLER_header_cpm4] = { - 0xC0036E00, - 0x0000000C, -}; -u32 R600_PS_SAMPLER5_header_pm4[R600_SAMPLER_header_cpm4] = { - 0xC0036E00, - 0x0000000F, -}; -u32 R600_PS_SAMPLER6_header_pm4[R600_SAMPLER_header_cpm4] = { - 0xC0036E00, - 0x00000012, -}; -u32 R600_PS_SAMPLER7_header_pm4[R600_SAMPLER_header_cpm4] = { - 0xC0036E00, - 0x00000015, -}; -u32 R600_PS_SAMPLER8_header_pm4[R600_SAMPLER_header_cpm4] = { - 0xC0036E00, - 0x00000018, -}; -u32 R600_PS_SAMPLER9_header_pm4[R600_SAMPLER_header_cpm4] = { - 0xC0036E00, - 0x0000001B, -}; -u32 R600_PS_SAMPLER10_header_pm4[R600_SAMPLER_header_cpm4] = { - 0xC0036E00, - 0x0000001E, -}; -u32 R600_PS_SAMPLER11_header_pm4[R600_SAMPLER_header_cpm4] = { - 0xC0036E00, - 0x00000021, -}; -u32 R600_PS_SAMPLER12_header_pm4[R600_SAMPLER_header_cpm4] = { - 0xC0036E00, - 0x00000024, -}; -u32 R600_PS_SAMPLER13_header_pm4[R600_SAMPLER_header_cpm4] = { - 0xC0036E00, - 0x00000027, -}; -u32 R600_PS_SAMPLER14_header_pm4[R600_SAMPLER_header_cpm4] = { - 0xC0036E00, - 0x0000002A, -}; -u32 R600_PS_SAMPLER15_header_pm4[R600_SAMPLER_header_cpm4] = { - 0xC0036E00, - 0x0000002D, -}; -u32 R600_PS_SAMPLER16_header_pm4[R600_SAMPLER_header_cpm4] = { - 0xC0036E00, - 0x00000030, -}; -u32 R600_PS_SAMPLER17_header_pm4[R600_SAMPLER_header_cpm4] = { - 0xC0036E00, - 0x00000033, -}; -u32 R600_VS_SAMPLER0_header_pm4[R600_SAMPLER_header_cpm4] = { - 0xC0036E00, - 0x00000036, -}; -u32 R600_VS_SAMPLER1_header_pm4[R600_SAMPLER_header_cpm4] = { - 0xC0036E00, - 0x00000039, -}; -u32 R600_VS_SAMPLER2_header_pm4[R600_SAMPLER_header_cpm4] = { - 0xC0036E00, - 0x0000003C, -}; -u32 R600_VS_SAMPLER3_header_pm4[R600_SAMPLER_header_cpm4] = { - 0xC0036E00, - 0x0000003F, -}; -u32 R600_VS_SAMPLER4_header_pm4[R600_SAMPLER_header_cpm4] = { - 0xC0036E00, - 0x00000042, -}; -u32 R600_VS_SAMPLER5_header_pm4[R600_SAMPLER_header_cpm4] = { - 0xC0036E00, - 0x00000045, -}; -u32 R600_VS_SAMPLER6_header_pm4[R600_SAMPLER_header_cpm4] = { - 0xC0036E00, - 0x00000048, -}; -u32 R600_VS_SAMPLER7_header_pm4[R600_SAMPLER_header_cpm4] = { - 0xC0036E00, - 0x0000004B, -}; -u32 R600_VS_SAMPLER8_header_pm4[R600_SAMPLER_header_cpm4] = { - 0xC0036E00, - 0x0000004E, -}; -u32 R600_VS_SAMPLER9_header_pm4[R600_SAMPLER_header_cpm4] = { - 0xC0036E00, - 0x00000051, -}; -u32 R600_VS_SAMPLER10_header_pm4[R600_SAMPLER_header_cpm4] = { - 0xC0036E00, - 0x00000054, -}; -u32 R600_VS_SAMPLER11_header_pm4[R600_SAMPLER_header_cpm4] = { - 0xC0036E00, - 0x00000057, -}; -u32 R600_VS_SAMPLER12_header_pm4[R600_SAMPLER_header_cpm4] = { - 0xC0036E00, - 0x0000005A, -}; -u32 R600_VS_SAMPLER13_header_pm4[R600_SAMPLER_header_cpm4] = { - 0xC0036E00, - 0x0000005D, -}; -u32 R600_VS_SAMPLER14_header_pm4[R600_SAMPLER_header_cpm4] = { - 0xC0036E00, - 0x00000060, -}; -u32 R600_VS_SAMPLER15_header_pm4[R600_SAMPLER_header_cpm4] = { - 0xC0036E00, - 0x00000063, -}; -u32 R600_VS_SAMPLER16_header_pm4[R600_SAMPLER_header_cpm4] = { - 0xC0036E00, - 0x00000066, -}; -u32 R600_VS_SAMPLER17_header_pm4[R600_SAMPLER_header_cpm4] = { - 0xC0036E00, - 0x00000069, -}; -u32 R600_GS_SAMPLER0_header_pm4[R600_SAMPLER_header_cpm4] = { - 0xC0036E00, - 0x0000006C, -}; -u32 R600_GS_SAMPLER1_header_pm4[R600_SAMPLER_header_cpm4] = { - 0xC0036E00, - 0x0000006F, -}; -u32 R600_GS_SAMPLER2_header_pm4[R600_SAMPLER_header_cpm4] = { - 0xC0036E00, - 0x00000072, -}; -u32 R600_GS_SAMPLER3_header_pm4[R600_SAMPLER_header_cpm4] = { - 0xC0036E00, - 0x00000075, -}; -u32 R600_GS_SAMPLER4_header_pm4[R600_SAMPLER_header_cpm4] = { - 0xC0036E00, - 0x00000078, -}; -u32 R600_GS_SAMPLER5_header_pm4[R600_SAMPLER_header_cpm4] = { - 0xC0036E00, - 0x0000007B, -}; -u32 R600_GS_SAMPLER6_header_pm4[R600_SAMPLER_header_cpm4] = { - 0xC0036E00, - 0x0000007E, -}; -u32 R600_GS_SAMPLER7_header_pm4[R600_SAMPLER_header_cpm4] = { - 0xC0036E00, - 0x00000081, -}; -u32 R600_GS_SAMPLER8_header_pm4[R600_SAMPLER_header_cpm4] = { - 0xC0036E00, - 0x00000084, -}; -u32 R600_GS_SAMPLER9_header_pm4[R600_SAMPLER_header_cpm4] = { - 0xC0036E00, - 0x00000087, -}; -u32 R600_GS_SAMPLER10_header_pm4[R600_SAMPLER_header_cpm4] = { - 0xC0036E00, - 0x0000008A, -}; -u32 R600_GS_SAMPLER11_header_pm4[R600_SAMPLER_header_cpm4] = { - 0xC0036E00, - 0x0000008D, -}; -u32 R600_GS_SAMPLER12_header_pm4[R600_SAMPLER_header_cpm4] = { - 0xC0036E00, - 0x00000090, -}; -u32 R600_GS_SAMPLER13_header_pm4[R600_SAMPLER_header_cpm4] = { - 0xC0036E00, - 0x00000093, -}; -u32 R600_GS_SAMPLER14_header_pm4[R600_SAMPLER_header_cpm4] = { - 0xC0036E00, - 0x00000096, -}; -u32 R600_GS_SAMPLER15_header_pm4[R600_SAMPLER_header_cpm4] = { - 0xC0036E00, - 0x00000099, -}; -u32 R600_GS_SAMPLER16_header_pm4[R600_SAMPLER_header_cpm4] = { - 0xC0036E00, - 0x0000009C, -}; -u32 R600_GS_SAMPLER17_header_pm4[R600_SAMPLER_header_cpm4] = { - 0xC0036E00, - 0x0000009F, -}; -#define R600_SAMPLER_state_cpm4 3 -u32 R600_SAMPLER_state_pm4[R600_SAMPLER_state_cpm4] = { - 0x00000000, - 0x00000000, - 0x00000000, -}; - -/* R600_SAMPLER_BORDER */ -#define R600_SAMPLER_BORDER_header_cpm4 2 -u32 R600_PS_SAMPLER_BORDER0_header_pm4[R600_SAMPLER_BORDER_header_cpm4] = { - 0xC0046800, - 0x00000900, -}; -u32 R600_PS_SAMPLER_BORDER1_header_pm4[R600_SAMPLER_BORDER_header_cpm4] = { - 0xC0046800, - 0x00000904, -}; -u32 R600_PS_SAMPLER_BORDER2_header_pm4[R600_SAMPLER_BORDER_header_cpm4] = { - 0xC0046800, - 0x00000908, -}; -u32 R600_PS_SAMPLER_BORDER3_header_pm4[R600_SAMPLER_BORDER_header_cpm4] = { - 0xC0046800, - 0x0000090C, -}; -u32 R600_PS_SAMPLER_BORDER4_header_pm4[R600_SAMPLER_BORDER_header_cpm4] = { - 0xC0046800, - 0x00000910, -}; -u32 R600_PS_SAMPLER_BORDER5_header_pm4[R600_SAMPLER_BORDER_header_cpm4] = { - 0xC0046800, - 0x00000914, -}; -u32 R600_PS_SAMPLER_BORDER6_header_pm4[R600_SAMPLER_BORDER_header_cpm4] = { - 0xC0046800, - 0x00000918, -}; -u32 R600_PS_SAMPLER_BORDER7_header_pm4[R600_SAMPLER_BORDER_header_cpm4] = { - 0xC0046800, - 0x0000091C, -}; -u32 R600_PS_SAMPLER_BORDER8_header_pm4[R600_SAMPLER_BORDER_header_cpm4] = { - 0xC0046800, - 0x00000920, -}; -u32 R600_PS_SAMPLER_BORDER9_header_pm4[R600_SAMPLER_BORDER_header_cpm4] = { - 0xC0046800, - 0x00000924, -}; -u32 R600_PS_SAMPLER_BORDER10_header_pm4[R600_SAMPLER_BORDER_header_cpm4] = { - 0xC0046800, - 0x00000928, -}; -u32 R600_PS_SAMPLER_BORDER11_header_pm4[R600_SAMPLER_BORDER_header_cpm4] = { - 0xC0046800, - 0x0000092C, -}; -u32 R600_PS_SAMPLER_BORDER12_header_pm4[R600_SAMPLER_BORDER_header_cpm4] = { - 0xC0046800, - 0x00000930, -}; -u32 R600_PS_SAMPLER_BORDER13_header_pm4[R600_SAMPLER_BORDER_header_cpm4] = { - 0xC0046800, - 0x00000934, -}; -u32 R600_PS_SAMPLER_BORDER14_header_pm4[R600_SAMPLER_BORDER_header_cpm4] = { - 0xC0046800, - 0x00000938, -}; -u32 R600_PS_SAMPLER_BORDER15_header_pm4[R600_SAMPLER_BORDER_header_cpm4] = { - 0xC0046800, - 0x0000093C, -}; -u32 R600_PS_SAMPLER_BORDER16_header_pm4[R600_SAMPLER_BORDER_header_cpm4] = { - 0xC0046800, - 0x00000940, -}; -u32 R600_PS_SAMPLER_BORDER17_header_pm4[R600_SAMPLER_BORDER_header_cpm4] = { - 0xC0046800, - 0x00000944, -}; -u32 R600_VS_SAMPLER_BORDER0_header_pm4[R600_SAMPLER_BORDER_header_cpm4] = { - 0xC0046800, - 0x00000980, -}; -u32 R600_VS_SAMPLER_BORDER1_header_pm4[R600_SAMPLER_BORDER_header_cpm4] = { - 0xC0046800, - 0x00000984, -}; -u32 R600_VS_SAMPLER_BORDER2_header_pm4[R600_SAMPLER_BORDER_header_cpm4] = { - 0xC0046800, - 0x00000988, -}; -u32 R600_VS_SAMPLER_BORDER3_header_pm4[R600_SAMPLER_BORDER_header_cpm4] = { - 0xC0046800, - 0x0000098C, -}; -u32 R600_VS_SAMPLER_BORDER4_header_pm4[R600_SAMPLER_BORDER_header_cpm4] = { - 0xC0046800, - 0x00000990, -}; -u32 R600_VS_SAMPLER_BORDER5_header_pm4[R600_SAMPLER_BORDER_header_cpm4] = { - 0xC0046800, - 0x00000994, -}; -u32 R600_VS_SAMPLER_BORDER6_header_pm4[R600_SAMPLER_BORDER_header_cpm4] = { - 0xC0046800, - 0x00000998, -}; -u32 R600_VS_SAMPLER_BORDER7_header_pm4[R600_SAMPLER_BORDER_header_cpm4] = { - 0xC0046800, - 0x0000099C, -}; -u32 R600_VS_SAMPLER_BORDER8_header_pm4[R600_SAMPLER_BORDER_header_cpm4] = { - 0xC0046800, - 0x000009A0, -}; -u32 R600_VS_SAMPLER_BORDER9_header_pm4[R600_SAMPLER_BORDER_header_cpm4] = { - 0xC0046800, - 0x000009A4, -}; -u32 R600_VS_SAMPLER_BORDER10_header_pm4[R600_SAMPLER_BORDER_header_cpm4] = { - 0xC0046800, - 0x000009A8, -}; -u32 R600_VS_SAMPLER_BORDER11_header_pm4[R600_SAMPLER_BORDER_header_cpm4] = { - 0xC0046800, - 0x000009AC, -}; -u32 R600_VS_SAMPLER_BORDER12_header_pm4[R600_SAMPLER_BORDER_header_cpm4] = { - 0xC0046800, - 0x000009B0, -}; -u32 R600_VS_SAMPLER_BORDER13_header_pm4[R600_SAMPLER_BORDER_header_cpm4] = { - 0xC0046800, - 0x000009B4, -}; -u32 R600_VS_SAMPLER_BORDER14_header_pm4[R600_SAMPLER_BORDER_header_cpm4] = { - 0xC0046800, - 0x000009B8, -}; -u32 R600_VS_SAMPLER_BORDER15_header_pm4[R600_SAMPLER_BORDER_header_cpm4] = { - 0xC0046800, - 0x000009BC, -}; -u32 R600_VS_SAMPLER_BORDER16_header_pm4[R600_SAMPLER_BORDER_header_cpm4] = { - 0xC0046800, - 0x000009C0, -}; -u32 R600_VS_SAMPLER_BORDER17_header_pm4[R600_SAMPLER_BORDER_header_cpm4] = { - 0xC0046800, - 0x000009C4, -}; -u32 R600_GS_SAMPLER_BORDER0_header_pm4[R600_SAMPLER_BORDER_header_cpm4] = { - 0xC0046800, - 0x00000A00, -}; -u32 R600_GS_SAMPLER_BORDER1_header_pm4[R600_SAMPLER_BORDER_header_cpm4] = { - 0xC0046800, - 0x00000A04, -}; -u32 R600_GS_SAMPLER_BORDER2_header_pm4[R600_SAMPLER_BORDER_header_cpm4] = { - 0xC0046800, - 0x00000A08, -}; -u32 R600_GS_SAMPLER_BORDER3_header_pm4[R600_SAMPLER_BORDER_header_cpm4] = { - 0xC0046800, - 0x00000A0C, -}; -u32 R600_GS_SAMPLER_BORDER4_header_pm4[R600_SAMPLER_BORDER_header_cpm4] = { - 0xC0046800, - 0x00000A10, -}; -u32 R600_GS_SAMPLER_BORDER5_header_pm4[R600_SAMPLER_BORDER_header_cpm4] = { - 0xC0046800, - 0x00000A14, -}; -u32 R600_GS_SAMPLER_BORDER6_header_pm4[R600_SAMPLER_BORDER_header_cpm4] = { - 0xC0046800, - 0x00000A18, -}; -u32 R600_GS_SAMPLER_BORDER7_header_pm4[R600_SAMPLER_BORDER_header_cpm4] = { - 0xC0046800, - 0x00000A1C, -}; -u32 R600_GS_SAMPLER_BORDER8_header_pm4[R600_SAMPLER_BORDER_header_cpm4] = { - 0xC0046800, - 0x00000A20, -}; -u32 R600_GS_SAMPLER_BORDER9_header_pm4[R600_SAMPLER_BORDER_header_cpm4] = { - 0xC0046800, - 0x00000A24, -}; -u32 R600_GS_SAMPLER_BORDER10_header_pm4[R600_SAMPLER_BORDER_header_cpm4] = { - 0xC0046800, - 0x00000A28, -}; -u32 R600_GS_SAMPLER_BORDER11_header_pm4[R600_SAMPLER_BORDER_header_cpm4] = { - 0xC0046800, - 0x00000A2C, -}; -u32 R600_GS_SAMPLER_BORDER12_header_pm4[R600_SAMPLER_BORDER_header_cpm4] = { - 0xC0046800, - 0x00000A30, -}; -u32 R600_GS_SAMPLER_BORDER13_header_pm4[R600_SAMPLER_BORDER_header_cpm4] = { - 0xC0046800, - 0x00000A34, -}; -u32 R600_GS_SAMPLER_BORDER14_header_pm4[R600_SAMPLER_BORDER_header_cpm4] = { - 0xC0046800, - 0x00000A38, -}; -u32 R600_GS_SAMPLER_BORDER15_header_pm4[R600_SAMPLER_BORDER_header_cpm4] = { - 0xC0046800, - 0x00000A3C, -}; -u32 R600_GS_SAMPLER_BORDER16_header_pm4[R600_SAMPLER_BORDER_header_cpm4] = { - 0xC0046800, - 0x00000A40, -}; -u32 R600_GS_SAMPLER_BORDER17_header_pm4[R600_SAMPLER_BORDER_header_cpm4] = { - 0xC0046800, - 0x00000A44, -}; -#define R600_SAMPLER_BORDER_state_cpm4 4 -u32 R600_SAMPLER_BORDER_state_pm4[R600_SAMPLER_BORDER_state_cpm4] = { - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, -}; - -static const struct radeon_type R600_types[] = { - {R600_CONFIG_header_pm4, R600_CONFIG_header_cpm4, R600_CONFIG_state_pm4, R600_CONFIG_state_cpm4, 0, 0}, - {R600_CB_CNTL_header_pm4, R600_CB_CNTL_header_cpm4, R600_CB_CNTL_state_pm4, R600_CB_CNTL_state_cpm4, 0, 0}, - {R600_RASTERIZER_header_pm4, R600_RASTERIZER_header_cpm4, R600_RASTERIZER_state_pm4, R600_RASTERIZER_state_cpm4, 0, 0}, - {R600_VIEWPORT_header_pm4, R600_VIEWPORT_header_cpm4, R600_VIEWPORT_state_pm4, R600_VIEWPORT_state_cpm4, 0, 0}, - {R600_SCISSOR_header_pm4, R600_SCISSOR_header_cpm4, R600_SCISSOR_state_pm4, R600_SCISSOR_state_cpm4, 0, 0}, - {R600_BLEND_header_pm4, R600_BLEND_header_cpm4, R600_BLEND_state_pm4, R600_BLEND_state_cpm4, 0, 0}, - {R600_DSA_header_pm4, R600_DSA_header_cpm4, R600_DSA_state_pm4, R600_DSA_state_cpm4, 0, 0}, - {R600_VGT_header_pm4, R600_VGT_header_cpm4, R600_VGT_state_pm4, R600_VGT_state_cpm4, 0, 0}, - {R600_QUERY_header_pm4, R600_QUERY_header_cpm4, R600_QUERY_state_pm4, R600_QUERY_state_cpm4, 0, 0}, - {R600_QUERY_header_pm4, R600_QUERY_header_cpm4, R600_QUERY_state_pm4, R600_QUERY_state_cpm4, 0, 0}, - {R600_VS_SHADER_header_pm4, R600_VS_SHADER_header_cpm4, R600_VS_SHADER_state_pm4, R600_VS_SHADER_state_cpm4, 0, 0}, - {R600_PS_SHADER_header_pm4, R600_PS_SHADER_header_cpm4, R600_PS_SHADER_state_pm4, R600_PS_SHADER_state_cpm4, 0, 0}, - {R600_DB_header_pm4, R600_DB_header_cpm4, R600_DB_state_pm4, R600_DB_state_cpm4, R600_FLUSH_DB, R600_DIRTY_ALL}, - {R600_CB0_header_pm4, R600_CB0_header_cpm4, R600_CB0_state_pm4, R600_CB0_state_cpm4, R600_FLUSH_CB0, R600_DIRTY_ALL}, - {R600_CB1_header_pm4, R600_CB1_header_cpm4, R600_CB1_state_pm4, R600_CB1_state_cpm4, R600_FLUSH_CB1, R600_DIRTY_ALL}, - {R600_CB2_header_pm4, R600_CB2_header_cpm4, R600_CB2_state_pm4, R600_CB2_state_cpm4, R600_FLUSH_CB2, R600_DIRTY_ALL}, - {R600_CB3_header_pm4, R600_CB3_header_cpm4, R600_CB3_state_pm4, R600_CB3_state_cpm4, R600_FLUSH_CB3, R600_DIRTY_ALL}, - {R600_CB4_header_pm4, R600_CB4_header_cpm4, R600_CB4_state_pm4, R600_CB4_state_cpm4, R600_FLUSH_CB4, R600_DIRTY_ALL}, - {R600_CB5_header_pm4, R600_CB5_header_cpm4, R600_CB5_state_pm4, R600_CB5_state_cpm4, R600_FLUSH_CB5, R600_DIRTY_ALL}, - {R600_CB6_header_pm4, R600_CB6_header_cpm4, R600_CB6_state_pm4, R600_CB6_state_cpm4, R600_FLUSH_CB6, R600_DIRTY_ALL}, - {R600_CB7_header_pm4, R600_CB7_header_cpm4, R600_CB7_state_pm4, R600_CB7_state_cpm4, R600_FLUSH_CB7, R600_DIRTY_ALL}, - {R600_UCP0_header_pm4, R600_UCP_header_cpm4, R600_UCP_state_pm4, R600_UCP_state_cpm4, 0, 0}, - {R600_UCP1_header_pm4, R600_UCP_header_cpm4, R600_UCP_state_pm4, R600_UCP_state_cpm4, 0, 0}, - {R600_UCP2_header_pm4, R600_UCP_header_cpm4, R600_UCP_state_pm4, R600_UCP_state_cpm4, 0, 0}, - {R600_UCP3_header_pm4, R600_UCP_header_cpm4, R600_UCP_state_pm4, R600_UCP_state_cpm4, 0, 0}, - {R600_UCP4_header_pm4, R600_UCP_header_cpm4, R600_UCP_state_pm4, R600_UCP_state_cpm4, 0, 0}, - {R600_UCP5_header_pm4, R600_UCP_header_cpm4, R600_UCP_state_pm4, R600_UCP_state_cpm4, 0, 0}, - {R600_PS_RESOURCE0_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE1_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE2_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE3_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE4_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE5_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE6_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE7_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE8_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE9_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE10_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE11_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE12_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE13_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE14_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE15_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE16_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE17_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE18_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE19_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE20_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE21_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE22_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE23_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE24_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE25_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE26_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE27_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE28_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE29_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE30_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE31_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE32_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE33_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE34_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE35_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE36_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE37_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE38_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE39_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE40_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE41_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE42_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE43_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE44_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE45_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE46_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE47_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE48_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE49_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE50_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE51_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE52_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE53_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE54_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE55_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE56_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE57_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE58_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE59_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE60_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE61_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE62_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE63_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE64_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE65_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE66_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE67_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE68_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE69_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE70_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE71_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE72_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE73_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE74_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE75_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE76_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE77_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE78_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE79_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE80_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE81_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE82_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE83_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE84_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE85_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE86_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE87_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE88_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE89_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE90_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE91_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE92_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE93_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE94_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE95_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE96_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE97_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE98_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE99_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE100_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE101_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE102_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE103_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE104_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE105_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE106_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE107_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE108_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE109_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE110_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE111_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE112_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE113_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE114_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE115_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE116_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE117_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE118_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE119_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE120_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE121_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE122_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE123_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE124_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE125_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE126_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE127_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE128_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE129_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE130_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE131_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE132_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE133_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE134_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE135_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE136_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE137_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE138_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE139_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE140_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE141_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE142_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE143_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE144_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE145_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE146_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE147_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE148_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE149_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE150_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE151_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE152_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE153_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE154_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE155_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE156_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE157_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE158_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE159_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE0_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE1_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE2_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE3_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE4_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE5_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE6_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE7_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE8_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE9_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE10_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE11_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE12_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE13_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE14_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE15_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE16_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE17_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE18_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE19_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE20_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE21_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE22_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE23_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE24_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE25_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE26_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE27_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE28_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE29_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE30_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE31_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE32_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE33_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE34_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE35_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE36_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE37_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE38_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE39_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE40_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE41_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE42_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE43_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE44_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE45_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE46_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE47_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE48_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE49_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE50_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE51_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE52_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE53_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE54_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE55_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE56_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE57_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE58_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE59_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE60_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE61_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE62_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE63_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE64_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE65_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE66_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE67_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE68_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE69_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE70_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE71_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE72_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE73_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE74_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE75_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE76_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE77_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE78_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE79_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE80_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE81_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE82_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE83_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE84_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE85_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE86_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE87_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE88_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE89_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE90_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE91_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE92_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE93_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE94_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE95_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE96_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE97_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE98_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE99_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE100_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE101_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE102_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE103_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE104_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE105_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE106_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE107_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE108_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE109_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE110_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE111_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE112_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE113_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE114_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE115_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE116_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE117_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE118_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE119_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE120_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE121_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE122_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE123_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE124_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE125_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE126_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE127_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE128_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE129_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE130_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE131_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE132_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE133_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE134_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE135_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE136_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE137_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE138_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE139_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE140_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE141_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE142_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE143_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE144_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE145_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE146_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE147_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE148_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE149_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE150_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE151_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE152_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE153_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE154_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE155_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE156_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE157_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE158_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE159_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_FS_RESOURCE0_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_FS_RESOURCE1_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_FS_RESOURCE2_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_FS_RESOURCE3_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_FS_RESOURCE4_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_FS_RESOURCE5_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_FS_RESOURCE6_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_FS_RESOURCE7_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_FS_RESOURCE8_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_FS_RESOURCE9_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_FS_RESOURCE10_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_FS_RESOURCE11_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_FS_RESOURCE12_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_FS_RESOURCE13_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_FS_RESOURCE14_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_FS_RESOURCE15_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE0_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE1_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE2_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE3_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE4_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE5_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE6_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE7_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE8_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE9_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE10_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE11_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE12_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE13_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE14_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE15_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE16_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE17_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE18_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE19_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE20_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE21_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE22_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE23_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE24_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE25_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE26_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE27_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE28_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE29_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE30_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE31_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE32_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE33_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE34_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE35_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE36_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE37_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE38_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE39_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE40_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE41_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE42_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE43_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE44_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE45_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE46_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE47_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE48_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE49_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE50_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE51_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE52_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE53_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE54_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE55_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE56_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE57_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE58_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE59_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE60_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE61_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE62_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE63_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE64_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE65_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE66_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE67_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE68_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE69_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE70_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE71_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE72_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE73_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE74_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE75_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE76_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE77_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE78_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE79_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE80_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE81_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE82_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE83_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE84_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE85_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE86_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE87_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE88_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE89_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE90_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE91_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE92_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE93_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE94_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE95_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE96_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE97_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE98_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE99_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE100_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE101_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE102_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE103_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE104_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE105_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE106_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE107_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE108_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE109_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE110_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE111_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE112_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE113_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE114_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE115_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE116_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE117_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE118_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE119_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE120_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE121_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE122_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE123_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE124_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE125_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE126_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE127_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE128_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE129_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE130_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE131_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE132_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE133_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE134_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE135_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE136_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE137_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE138_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE139_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE140_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE141_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE142_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE143_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE144_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE145_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE146_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE147_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE148_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE149_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE150_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE151_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE152_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE153_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE154_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE155_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE156_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE157_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE158_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE159_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_CONSTANT0_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT1_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT2_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT3_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT4_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT5_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT6_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT7_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT8_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT9_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT10_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT11_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT12_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT13_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT14_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT15_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT16_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT17_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT18_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT19_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT20_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT21_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT22_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT23_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT24_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT25_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT26_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT27_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT28_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT29_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT30_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT31_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT32_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT33_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT34_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT35_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT36_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT37_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT38_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT39_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT40_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT41_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT42_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT43_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT44_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT45_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT46_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT47_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT48_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT49_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT50_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT51_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT52_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT53_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT54_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT55_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT56_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT57_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT58_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT59_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT60_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT61_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT62_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT63_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT64_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT65_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT66_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT67_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT68_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT69_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT70_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT71_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT72_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT73_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT74_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT75_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT76_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT77_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT78_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT79_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT80_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT81_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT82_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT83_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT84_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT85_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT86_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT87_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT88_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT89_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT90_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT91_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT92_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT93_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT94_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT95_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT96_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT97_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT98_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT99_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT100_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT101_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT102_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT103_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT104_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT105_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT106_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT107_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT108_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT109_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT110_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT111_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT112_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT113_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT114_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT115_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT116_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT117_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT118_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT119_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT120_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT121_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT122_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT123_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT124_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT125_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT126_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT127_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT128_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT129_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT130_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT131_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT132_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT133_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT134_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT135_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT136_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT137_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT138_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT139_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT140_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT141_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT142_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT143_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT144_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT145_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT146_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT147_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT148_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT149_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT150_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT151_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT152_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT153_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT154_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT155_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT156_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT157_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT158_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT159_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT160_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT161_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT162_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT163_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT164_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT165_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT166_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT167_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT168_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT169_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT170_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT171_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT172_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT173_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT174_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT175_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT176_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT177_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT178_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT179_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT180_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT181_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT182_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT183_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT184_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT185_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT186_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT187_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT188_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT189_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT190_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT191_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT192_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT193_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT194_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT195_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT196_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT197_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT198_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT199_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT200_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT201_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT202_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT203_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT204_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT205_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT206_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT207_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT208_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT209_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT210_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT211_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT212_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT213_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT214_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT215_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT216_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT217_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT218_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT219_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT220_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT221_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT222_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT223_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT224_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT225_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT226_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT227_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT228_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT229_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT230_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT231_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT232_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT233_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT234_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT235_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT236_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT237_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT238_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT239_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT240_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT241_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT242_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT243_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT244_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT245_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT246_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT247_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT248_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT249_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT250_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT251_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT252_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT253_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT254_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT255_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT0_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT1_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT2_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT3_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT4_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT5_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT6_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT7_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT8_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT9_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT10_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT11_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT12_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT13_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT14_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT15_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT16_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT17_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT18_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT19_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT20_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT21_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT22_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT23_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT24_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT25_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT26_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT27_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT28_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT29_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT30_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT31_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT32_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT33_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT34_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT35_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT36_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT37_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT38_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT39_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT40_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT41_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT42_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT43_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT44_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT45_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT46_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT47_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT48_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT49_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT50_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT51_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT52_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT53_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT54_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT55_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT56_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT57_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT58_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT59_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT60_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT61_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT62_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT63_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT64_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT65_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT66_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT67_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT68_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT69_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT70_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT71_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT72_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT73_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT74_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT75_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT76_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT77_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT78_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT79_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT80_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT81_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT82_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT83_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT84_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT85_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT86_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT87_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT88_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT89_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT90_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT91_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT92_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT93_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT94_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT95_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT96_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT97_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT98_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT99_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT100_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT101_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT102_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT103_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT104_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT105_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT106_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT107_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT108_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT109_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT110_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT111_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT112_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT113_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT114_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT115_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT116_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT117_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT118_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT119_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT120_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT121_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT122_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT123_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT124_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT125_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT126_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT127_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT128_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT129_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT130_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT131_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT132_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT133_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT134_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT135_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT136_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT137_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT138_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT139_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT140_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT141_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT142_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT143_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT144_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT145_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT146_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT147_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT148_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT149_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT150_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT151_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT152_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT153_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT154_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT155_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT156_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT157_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT158_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT159_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT160_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT161_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT162_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT163_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT164_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT165_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT166_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT167_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT168_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT169_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT170_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT171_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT172_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT173_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT174_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT175_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT176_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT177_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT178_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT179_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT180_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT181_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT182_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT183_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT184_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT185_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT186_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT187_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT188_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT189_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT190_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT191_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT192_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT193_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT194_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT195_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT196_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT197_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT198_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT199_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT200_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT201_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT202_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT203_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT204_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT205_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT206_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT207_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT208_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT209_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT210_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT211_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT212_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT213_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT214_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT215_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT216_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT217_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT218_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT219_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT220_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT221_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT222_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT223_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT224_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT225_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT226_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT227_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT228_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT229_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT230_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT231_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT232_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT233_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT234_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT235_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT236_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT237_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT238_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT239_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT240_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT241_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT242_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT243_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT244_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT245_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT246_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT247_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT248_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT249_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT250_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT251_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT252_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT253_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT254_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT255_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_SAMPLER0_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, - {R600_PS_SAMPLER1_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, - {R600_PS_SAMPLER2_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, - {R600_PS_SAMPLER3_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, - {R600_PS_SAMPLER4_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, - {R600_PS_SAMPLER5_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, - {R600_PS_SAMPLER6_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, - {R600_PS_SAMPLER7_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, - {R600_PS_SAMPLER8_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, - {R600_PS_SAMPLER9_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, - {R600_PS_SAMPLER10_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, - {R600_PS_SAMPLER11_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, - {R600_PS_SAMPLER12_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, - {R600_PS_SAMPLER13_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, - {R600_PS_SAMPLER14_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, - {R600_PS_SAMPLER15_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, - {R600_PS_SAMPLER16_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, - {R600_PS_SAMPLER17_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, - {R600_VS_SAMPLER0_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, - {R600_VS_SAMPLER1_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, - {R600_VS_SAMPLER2_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, - {R600_VS_SAMPLER3_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, - {R600_VS_SAMPLER4_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, - {R600_VS_SAMPLER5_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, - {R600_VS_SAMPLER6_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, - {R600_VS_SAMPLER7_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, - {R600_VS_SAMPLER8_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, - {R600_VS_SAMPLER9_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, - {R600_VS_SAMPLER10_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, - {R600_VS_SAMPLER11_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, - {R600_VS_SAMPLER12_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, - {R600_VS_SAMPLER13_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, - {R600_VS_SAMPLER14_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, - {R600_VS_SAMPLER15_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, - {R600_VS_SAMPLER16_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, - {R600_VS_SAMPLER17_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, - {R600_GS_SAMPLER0_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, - {R600_GS_SAMPLER1_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, - {R600_GS_SAMPLER2_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, - {R600_GS_SAMPLER3_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, - {R600_GS_SAMPLER4_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, - {R600_GS_SAMPLER5_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, - {R600_GS_SAMPLER6_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, - {R600_GS_SAMPLER7_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, - {R600_GS_SAMPLER8_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, - {R600_GS_SAMPLER9_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, - {R600_GS_SAMPLER10_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, - {R600_GS_SAMPLER11_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, - {R600_GS_SAMPLER12_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, - {R600_GS_SAMPLER13_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, - {R600_GS_SAMPLER14_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, - {R600_GS_SAMPLER15_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, - {R600_GS_SAMPLER16_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, - {R600_GS_SAMPLER17_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, - {R600_PS_SAMPLER_BORDER0_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, - {R600_PS_SAMPLER_BORDER1_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, - {R600_PS_SAMPLER_BORDER2_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, - {R600_PS_SAMPLER_BORDER3_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, - {R600_PS_SAMPLER_BORDER4_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, - {R600_PS_SAMPLER_BORDER5_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, - {R600_PS_SAMPLER_BORDER6_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, - {R600_PS_SAMPLER_BORDER7_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, - {R600_PS_SAMPLER_BORDER8_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, - {R600_PS_SAMPLER_BORDER9_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, - {R600_PS_SAMPLER_BORDER10_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, - {R600_PS_SAMPLER_BORDER11_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, - {R600_PS_SAMPLER_BORDER12_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, - {R600_PS_SAMPLER_BORDER13_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, - {R600_PS_SAMPLER_BORDER14_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, - {R600_PS_SAMPLER_BORDER15_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, - {R600_PS_SAMPLER_BORDER16_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, - {R600_PS_SAMPLER_BORDER17_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, - {R600_VS_SAMPLER_BORDER0_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, - {R600_VS_SAMPLER_BORDER1_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, - {R600_VS_SAMPLER_BORDER2_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, - {R600_VS_SAMPLER_BORDER3_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, - {R600_VS_SAMPLER_BORDER4_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, - {R600_VS_SAMPLER_BORDER5_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, - {R600_VS_SAMPLER_BORDER6_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, - {R600_VS_SAMPLER_BORDER7_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, - {R600_VS_SAMPLER_BORDER8_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, - {R600_VS_SAMPLER_BORDER9_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, - {R600_VS_SAMPLER_BORDER10_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, - {R600_VS_SAMPLER_BORDER11_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, - {R600_VS_SAMPLER_BORDER12_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, - {R600_VS_SAMPLER_BORDER13_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, - {R600_VS_SAMPLER_BORDER14_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, - {R600_VS_SAMPLER_BORDER15_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, - {R600_VS_SAMPLER_BORDER16_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, - {R600_VS_SAMPLER_BORDER17_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, - {R600_GS_SAMPLER_BORDER0_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, - {R600_GS_SAMPLER_BORDER1_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, - {R600_GS_SAMPLER_BORDER2_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, - {R600_GS_SAMPLER_BORDER3_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, - {R600_GS_SAMPLER_BORDER4_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, - {R600_GS_SAMPLER_BORDER5_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, - {R600_GS_SAMPLER_BORDER6_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, - {R600_GS_SAMPLER_BORDER7_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, - {R600_GS_SAMPLER_BORDER8_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, - {R600_GS_SAMPLER_BORDER9_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, - {R600_GS_SAMPLER_BORDER10_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, - {R600_GS_SAMPLER_BORDER11_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, - {R600_GS_SAMPLER_BORDER12_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, - {R600_GS_SAMPLER_BORDER13_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, - {R600_GS_SAMPLER_BORDER14_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, - {R600_GS_SAMPLER_BORDER15_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, - {R600_GS_SAMPLER_BORDER16_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, - {R600_GS_SAMPLER_BORDER17_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, - {R600_DRAW_AUTO_header_pm4, R600_DRAW_AUTO_header_cpm4, R600_DRAW_AUTO_state_pm4, R600_DRAW_AUTO_state_cpm4, 0, 0}, - {R600_DRAW_header_pm4, R600_DRAW_header_cpm4, R600_DRAW_state_pm4, R600_DRAW_state_cpm4, 0, 0} -}; - -static const struct radeon_type R700_types[] = { - {R700_CONFIG_header_pm4, R700_CONFIG_header_cpm4, R600_CONFIG_state_pm4, R600_CONFIG_state_cpm4, 0, 0}, - {R600_CB_CNTL_header_pm4, R600_CB_CNTL_header_cpm4, R600_CB_CNTL_state_pm4, R600_CB_CNTL_state_cpm4, 0, 0}, - {R600_RASTERIZER_header_pm4, R600_RASTERIZER_header_cpm4, R600_RASTERIZER_state_pm4, R600_RASTERIZER_state_cpm4, 0, 0}, - {R600_VIEWPORT_header_pm4, R600_VIEWPORT_header_cpm4, R600_VIEWPORT_state_pm4, R600_VIEWPORT_state_cpm4, 0, 0}, - {R600_SCISSOR_header_pm4, R600_SCISSOR_header_cpm4, R600_SCISSOR_state_pm4, R600_SCISSOR_state_cpm4, 0, 0}, - {R600_BLEND_header_pm4, R600_BLEND_header_cpm4, R600_BLEND_state_pm4, R600_BLEND_state_cpm4, 0, 0}, - {R600_DSA_header_pm4, R600_DSA_header_cpm4, R600_DSA_state_pm4, R600_DSA_state_cpm4, 0, 0}, - {R600_VGT_header_pm4, R600_VGT_header_cpm4, R600_VGT_state_pm4, R600_VGT_state_cpm4, 0, 0}, - {R600_QUERY_header_pm4, R600_QUERY_header_cpm4, R600_QUERY_state_pm4, R600_QUERY_state_cpm4, 0, 0}, - {R600_QUERY_header_pm4, R600_QUERY_header_cpm4, R600_QUERY_state_pm4, R600_QUERY_state_cpm4, 0, 0}, - {R600_VS_SHADER_header_pm4, R600_VS_SHADER_header_cpm4, R600_VS_SHADER_state_pm4, R600_VS_SHADER_state_cpm4, 0, 0}, - {R600_PS_SHADER_header_pm4, R600_PS_SHADER_header_cpm4, R600_PS_SHADER_state_pm4, R600_PS_SHADER_state_cpm4, 0, 0}, - {R600_DB_header_pm4, R600_DB_header_cpm4, R600_DB_state_pm4, R600_DB_state_cpm4, R600_FLUSH_DB, R600_DIRTY_ALL}, - {R600_CB0_header_pm4, R600_CB0_header_cpm4, R600_CB0_state_pm4, R600_CB0_state_cpm4, R600_FLUSH_CB0, R600_DIRTY_ALL}, - {R600_CB1_header_pm4, R600_CB1_header_cpm4, R600_CB1_state_pm4, R600_CB1_state_cpm4, R600_FLUSH_CB1, R600_DIRTY_ALL}, - {R600_CB2_header_pm4, R600_CB2_header_cpm4, R600_CB2_state_pm4, R600_CB2_state_cpm4, R600_FLUSH_CB2, R600_DIRTY_ALL}, - {R600_CB3_header_pm4, R600_CB3_header_cpm4, R600_CB3_state_pm4, R600_CB3_state_cpm4, R600_FLUSH_CB3, R600_DIRTY_ALL}, - {R600_CB4_header_pm4, R600_CB4_header_cpm4, R600_CB4_state_pm4, R600_CB4_state_cpm4, R600_FLUSH_CB4, R600_DIRTY_ALL}, - {R600_CB5_header_pm4, R600_CB5_header_cpm4, R600_CB5_state_pm4, R600_CB5_state_cpm4, R600_FLUSH_CB5, R600_DIRTY_ALL}, - {R600_CB6_header_pm4, R600_CB6_header_cpm4, R600_CB6_state_pm4, R600_CB6_state_cpm4, R600_FLUSH_CB6, R600_DIRTY_ALL}, - {R600_CB7_header_pm4, R600_CB7_header_cpm4, R600_CB7_state_pm4, R600_CB7_state_cpm4, R600_FLUSH_CB7, R600_DIRTY_ALL}, - {R600_UCP0_header_pm4, R600_UCP_header_cpm4, R600_UCP_state_pm4, R600_UCP_state_cpm4, 0, 0}, - {R600_UCP1_header_pm4, R600_UCP_header_cpm4, R600_UCP_state_pm4, R600_UCP_state_cpm4, 0, 0}, - {R600_UCP2_header_pm4, R600_UCP_header_cpm4, R600_UCP_state_pm4, R600_UCP_state_cpm4, 0, 0}, - {R600_UCP3_header_pm4, R600_UCP_header_cpm4, R600_UCP_state_pm4, R600_UCP_state_cpm4, 0, 0}, - {R600_UCP4_header_pm4, R600_UCP_header_cpm4, R600_UCP_state_pm4, R600_UCP_state_cpm4, 0, 0}, - {R600_UCP5_header_pm4, R600_UCP_header_cpm4, R600_UCP_state_pm4, R600_UCP_state_cpm4, 0, 0}, - {R600_PS_RESOURCE0_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE1_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE2_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE3_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE4_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE5_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE6_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE7_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE8_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE9_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE10_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE11_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE12_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE13_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE14_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE15_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE16_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE17_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE18_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE19_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE20_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE21_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE22_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE23_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE24_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE25_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE26_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE27_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE28_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE29_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE30_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE31_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE32_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE33_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE34_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE35_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE36_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE37_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE38_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE39_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE40_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE41_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE42_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE43_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE44_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE45_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE46_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE47_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE48_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE49_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE50_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE51_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE52_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE53_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE54_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE55_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE56_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE57_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE58_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE59_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE60_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE61_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE62_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE63_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE64_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE65_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE66_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE67_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE68_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE69_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE70_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE71_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE72_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE73_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE74_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE75_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE76_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE77_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE78_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE79_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE80_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE81_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE82_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE83_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE84_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE85_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE86_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE87_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE88_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE89_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE90_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE91_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE92_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE93_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE94_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE95_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE96_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE97_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE98_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE99_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE100_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE101_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE102_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE103_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE104_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE105_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE106_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE107_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE108_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE109_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE110_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE111_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE112_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE113_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE114_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE115_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE116_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE117_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE118_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE119_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE120_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE121_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE122_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE123_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE124_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE125_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE126_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE127_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE128_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE129_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE130_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE131_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE132_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE133_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE134_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE135_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE136_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE137_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE138_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE139_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE140_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE141_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE142_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE143_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE144_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE145_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE146_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE147_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE148_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE149_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE150_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE151_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE152_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE153_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE154_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE155_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE156_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE157_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE158_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_RESOURCE159_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE0_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE1_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE2_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE3_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE4_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE5_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE6_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE7_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE8_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE9_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE10_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE11_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE12_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE13_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE14_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE15_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE16_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE17_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE18_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE19_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE20_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE21_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE22_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE23_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE24_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE25_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE26_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE27_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE28_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE29_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE30_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE31_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE32_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE33_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE34_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE35_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE36_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE37_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE38_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE39_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE40_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE41_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE42_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE43_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE44_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE45_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE46_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE47_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE48_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE49_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE50_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE51_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE52_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE53_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE54_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE55_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE56_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE57_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE58_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE59_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE60_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE61_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE62_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE63_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE64_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE65_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE66_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE67_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE68_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE69_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE70_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE71_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE72_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE73_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE74_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE75_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE76_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE77_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE78_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE79_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE80_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE81_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE82_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE83_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE84_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE85_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE86_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE87_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE88_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE89_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE90_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE91_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE92_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE93_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE94_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE95_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE96_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE97_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE98_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE99_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE100_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE101_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE102_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE103_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE104_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE105_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE106_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE107_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE108_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE109_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE110_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE111_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE112_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE113_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE114_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE115_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE116_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE117_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE118_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE119_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE120_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE121_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE122_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE123_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE124_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE125_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE126_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE127_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE128_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE129_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE130_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE131_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE132_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE133_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE134_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE135_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE136_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE137_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE138_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE139_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE140_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE141_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE142_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE143_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE144_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE145_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE146_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE147_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE148_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE149_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE150_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE151_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE152_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE153_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE154_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE155_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE156_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE157_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE158_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_VS_RESOURCE159_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_FS_RESOURCE0_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_FS_RESOURCE1_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_FS_RESOURCE2_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_FS_RESOURCE3_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_FS_RESOURCE4_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_FS_RESOURCE5_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_FS_RESOURCE6_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_FS_RESOURCE7_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_FS_RESOURCE8_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_FS_RESOURCE9_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_FS_RESOURCE10_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_FS_RESOURCE11_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_FS_RESOURCE12_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_FS_RESOURCE13_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_FS_RESOURCE14_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_FS_RESOURCE15_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE0_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE1_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE2_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE3_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE4_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE5_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE6_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE7_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE8_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE9_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE10_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE11_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE12_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE13_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE14_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE15_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE16_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE17_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE18_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE19_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE20_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE21_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE22_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE23_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE24_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE25_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE26_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE27_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE28_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE29_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE30_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE31_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE32_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE33_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE34_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE35_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE36_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE37_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE38_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE39_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE40_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE41_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE42_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE43_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE44_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE45_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE46_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE47_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE48_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE49_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE50_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE51_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE52_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE53_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE54_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE55_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE56_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE57_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE58_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE59_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE60_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE61_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE62_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE63_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE64_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE65_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE66_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE67_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE68_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE69_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE70_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE71_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE72_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE73_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE74_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE75_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE76_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE77_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE78_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE79_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE80_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE81_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE82_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE83_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE84_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE85_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE86_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE87_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE88_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE89_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE90_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE91_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE92_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE93_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE94_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE95_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE96_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE97_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE98_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE99_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE100_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE101_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE102_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE103_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE104_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE105_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE106_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE107_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE108_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE109_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE110_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE111_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE112_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE113_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE114_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE115_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE116_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE117_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE118_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE119_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE120_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE121_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE122_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE123_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE124_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE125_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE126_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE127_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE128_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE129_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE130_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE131_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE132_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE133_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE134_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE135_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE136_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE137_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE138_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE139_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE140_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE141_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE142_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE143_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE144_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE145_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE146_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE147_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE148_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE149_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE150_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE151_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE152_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE153_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE154_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE155_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE156_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE157_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE158_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_GS_RESOURCE159_header_pm4, R600_RESOURCE_header_cpm4, R600_RESOURCE_state_pm4, R600_RESOURCE_state_cpm4, R600_FLUSH_RESOURCE, 0}, - {R600_PS_CONSTANT0_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT1_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT2_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT3_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT4_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT5_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT6_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT7_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT8_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT9_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT10_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT11_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT12_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT13_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT14_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT15_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT16_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT17_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT18_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT19_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT20_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT21_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT22_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT23_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT24_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT25_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT26_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT27_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT28_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT29_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT30_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT31_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT32_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT33_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT34_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT35_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT36_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT37_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT38_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT39_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT40_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT41_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT42_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT43_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT44_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT45_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT46_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT47_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT48_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT49_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT50_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT51_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT52_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT53_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT54_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT55_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT56_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT57_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT58_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT59_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT60_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT61_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT62_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT63_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT64_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT65_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT66_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT67_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT68_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT69_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT70_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT71_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT72_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT73_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT74_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT75_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT76_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT77_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT78_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT79_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT80_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT81_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT82_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT83_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT84_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT85_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT86_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT87_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT88_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT89_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT90_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT91_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT92_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT93_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT94_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT95_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT96_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT97_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT98_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT99_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT100_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT101_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT102_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT103_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT104_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT105_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT106_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT107_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT108_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT109_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT110_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT111_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT112_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT113_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT114_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT115_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT116_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT117_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT118_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT119_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT120_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT121_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT122_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT123_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT124_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT125_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT126_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT127_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT128_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT129_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT130_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT131_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT132_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT133_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT134_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT135_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT136_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT137_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT138_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT139_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT140_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT141_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT142_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT143_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT144_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT145_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT146_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT147_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT148_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT149_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT150_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT151_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT152_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT153_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT154_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT155_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT156_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT157_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT158_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT159_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT160_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT161_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT162_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT163_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT164_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT165_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT166_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT167_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT168_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT169_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT170_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT171_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT172_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT173_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT174_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT175_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT176_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT177_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT178_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT179_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT180_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT181_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT182_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT183_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT184_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT185_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT186_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT187_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT188_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT189_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT190_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT191_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT192_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT193_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT194_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT195_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT196_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT197_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT198_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT199_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT200_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT201_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT202_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT203_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT204_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT205_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT206_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT207_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT208_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT209_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT210_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT211_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT212_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT213_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT214_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT215_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT216_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT217_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT218_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT219_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT220_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT221_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT222_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT223_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT224_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT225_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT226_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT227_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT228_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT229_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT230_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT231_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT232_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT233_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT234_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT235_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT236_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT237_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT238_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT239_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT240_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT241_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT242_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT243_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT244_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT245_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT246_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT247_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT248_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT249_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT250_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT251_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT252_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT253_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT254_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_CONSTANT255_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT0_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT1_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT2_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT3_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT4_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT5_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT6_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT7_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT8_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT9_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT10_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT11_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT12_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT13_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT14_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT15_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT16_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT17_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT18_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT19_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT20_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT21_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT22_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT23_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT24_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT25_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT26_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT27_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT28_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT29_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT30_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT31_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT32_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT33_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT34_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT35_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT36_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT37_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT38_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT39_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT40_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT41_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT42_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT43_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT44_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT45_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT46_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT47_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT48_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT49_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT50_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT51_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT52_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT53_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT54_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT55_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT56_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT57_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT58_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT59_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT60_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT61_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT62_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT63_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT64_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT65_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT66_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT67_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT68_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT69_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT70_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT71_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT72_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT73_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT74_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT75_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT76_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT77_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT78_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT79_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT80_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT81_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT82_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT83_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT84_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT85_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT86_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT87_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT88_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT89_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT90_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT91_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT92_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT93_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT94_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT95_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT96_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT97_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT98_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT99_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT100_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT101_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT102_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT103_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT104_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT105_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT106_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT107_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT108_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT109_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT110_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT111_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT112_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT113_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT114_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT115_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT116_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT117_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT118_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT119_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT120_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT121_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT122_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT123_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT124_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT125_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT126_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT127_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT128_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT129_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT130_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT131_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT132_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT133_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT134_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT135_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT136_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT137_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT138_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT139_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT140_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT141_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT142_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT143_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT144_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT145_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT146_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT147_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT148_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT149_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT150_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT151_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT152_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT153_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT154_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT155_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT156_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT157_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT158_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT159_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT160_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT161_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT162_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT163_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT164_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT165_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT166_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT167_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT168_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT169_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT170_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT171_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT172_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT173_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT174_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT175_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT176_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT177_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT178_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT179_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT180_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT181_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT182_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT183_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT184_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT185_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT186_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT187_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT188_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT189_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT190_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT191_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT192_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT193_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT194_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT195_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT196_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT197_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT198_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT199_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT200_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT201_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT202_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT203_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT204_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT205_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT206_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT207_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT208_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT209_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT210_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT211_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT212_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT213_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT214_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT215_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT216_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT217_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT218_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT219_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT220_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT221_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT222_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT223_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT224_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT225_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT226_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT227_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT228_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT229_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT230_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT231_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT232_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT233_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT234_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT235_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT236_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT237_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT238_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT239_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT240_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT241_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT242_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT243_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT244_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT245_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT246_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT247_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT248_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT249_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT250_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT251_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT252_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT253_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT254_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_VS_CONSTANT255_header_pm4, R600_CONSTANT_header_cpm4, R600_CONSTANT_state_pm4, R600_CONSTANT_state_cpm4, 0, 0}, - {R600_PS_SAMPLER0_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, - {R600_PS_SAMPLER1_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, - {R600_PS_SAMPLER2_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, - {R600_PS_SAMPLER3_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, - {R600_PS_SAMPLER4_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, - {R600_PS_SAMPLER5_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, - {R600_PS_SAMPLER6_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, - {R600_PS_SAMPLER7_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, - {R600_PS_SAMPLER8_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, - {R600_PS_SAMPLER9_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, - {R600_PS_SAMPLER10_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, - {R600_PS_SAMPLER11_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, - {R600_PS_SAMPLER12_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, - {R600_PS_SAMPLER13_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, - {R600_PS_SAMPLER14_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, - {R600_PS_SAMPLER15_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, - {R600_PS_SAMPLER16_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, - {R600_PS_SAMPLER17_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, - {R600_VS_SAMPLER0_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, - {R600_VS_SAMPLER1_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, - {R600_VS_SAMPLER2_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, - {R600_VS_SAMPLER3_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, - {R600_VS_SAMPLER4_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, - {R600_VS_SAMPLER5_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, - {R600_VS_SAMPLER6_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, - {R600_VS_SAMPLER7_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, - {R600_VS_SAMPLER8_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, - {R600_VS_SAMPLER9_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, - {R600_VS_SAMPLER10_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, - {R600_VS_SAMPLER11_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, - {R600_VS_SAMPLER12_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, - {R600_VS_SAMPLER13_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, - {R600_VS_SAMPLER14_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, - {R600_VS_SAMPLER15_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, - {R600_VS_SAMPLER16_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, - {R600_VS_SAMPLER17_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, - {R600_GS_SAMPLER0_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, - {R600_GS_SAMPLER1_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, - {R600_GS_SAMPLER2_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, - {R600_GS_SAMPLER3_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, - {R600_GS_SAMPLER4_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, - {R600_GS_SAMPLER5_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, - {R600_GS_SAMPLER6_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, - {R600_GS_SAMPLER7_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, - {R600_GS_SAMPLER8_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, - {R600_GS_SAMPLER9_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, - {R600_GS_SAMPLER10_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, - {R600_GS_SAMPLER11_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, - {R600_GS_SAMPLER12_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, - {R600_GS_SAMPLER13_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, - {R600_GS_SAMPLER14_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, - {R600_GS_SAMPLER15_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, - {R600_GS_SAMPLER16_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, - {R600_GS_SAMPLER17_header_pm4, R600_SAMPLER_header_cpm4, R600_SAMPLER_state_pm4, R600_SAMPLER_state_cpm4, 0, 0}, - {R600_PS_SAMPLER_BORDER0_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, - {R600_PS_SAMPLER_BORDER1_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, - {R600_PS_SAMPLER_BORDER2_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, - {R600_PS_SAMPLER_BORDER3_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, - {R600_PS_SAMPLER_BORDER4_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, - {R600_PS_SAMPLER_BORDER5_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, - {R600_PS_SAMPLER_BORDER6_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, - {R600_PS_SAMPLER_BORDER7_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, - {R600_PS_SAMPLER_BORDER8_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, - {R600_PS_SAMPLER_BORDER9_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, - {R600_PS_SAMPLER_BORDER10_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, - {R600_PS_SAMPLER_BORDER11_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, - {R600_PS_SAMPLER_BORDER12_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, - {R600_PS_SAMPLER_BORDER13_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, - {R600_PS_SAMPLER_BORDER14_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, - {R600_PS_SAMPLER_BORDER15_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, - {R600_PS_SAMPLER_BORDER16_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, - {R600_PS_SAMPLER_BORDER17_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, - {R600_VS_SAMPLER_BORDER0_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, - {R600_VS_SAMPLER_BORDER1_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, - {R600_VS_SAMPLER_BORDER2_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, - {R600_VS_SAMPLER_BORDER3_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, - {R600_VS_SAMPLER_BORDER4_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, - {R600_VS_SAMPLER_BORDER5_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, - {R600_VS_SAMPLER_BORDER6_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, - {R600_VS_SAMPLER_BORDER7_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, - {R600_VS_SAMPLER_BORDER8_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, - {R600_VS_SAMPLER_BORDER9_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, - {R600_VS_SAMPLER_BORDER10_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, - {R600_VS_SAMPLER_BORDER11_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, - {R600_VS_SAMPLER_BORDER12_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, - {R600_VS_SAMPLER_BORDER13_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, - {R600_VS_SAMPLER_BORDER14_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, - {R600_VS_SAMPLER_BORDER15_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, - {R600_VS_SAMPLER_BORDER16_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, - {R600_VS_SAMPLER_BORDER17_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, - {R600_GS_SAMPLER_BORDER0_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, - {R600_GS_SAMPLER_BORDER1_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, - {R600_GS_SAMPLER_BORDER2_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, - {R600_GS_SAMPLER_BORDER3_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, - {R600_GS_SAMPLER_BORDER4_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, - {R600_GS_SAMPLER_BORDER5_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, - {R600_GS_SAMPLER_BORDER6_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, - {R600_GS_SAMPLER_BORDER7_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, - {R600_GS_SAMPLER_BORDER8_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, - {R600_GS_SAMPLER_BORDER9_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, - {R600_GS_SAMPLER_BORDER10_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, - {R600_GS_SAMPLER_BORDER11_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, - {R600_GS_SAMPLER_BORDER12_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, - {R600_GS_SAMPLER_BORDER13_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, - {R600_GS_SAMPLER_BORDER14_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, - {R600_GS_SAMPLER_BORDER15_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, - {R600_GS_SAMPLER_BORDER16_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, - {R600_GS_SAMPLER_BORDER17_header_pm4, R600_SAMPLER_BORDER_header_cpm4, R600_SAMPLER_BORDER_state_pm4, R600_SAMPLER_BORDER_state_cpm4, 0, 0}, - {R600_DRAW_AUTO_header_pm4, R600_DRAW_AUTO_header_cpm4, R600_DRAW_AUTO_state_pm4, R600_DRAW_AUTO_state_cpm4, 0, 0}, - {R600_DRAW_header_pm4, R600_DRAW_header_cpm4, R600_DRAW_state_pm4, R600_DRAW_state_cpm4, 0, 0} -}; diff --git a/src/gallium/winsys/r600/drm/r600_states.h b/src/gallium/winsys/r600/drm/r600_states.h new file mode 100644 index 0000000000..b5365e4275 --- /dev/null +++ b/src/gallium/winsys/r600/drm/r600_states.h @@ -0,0 +1,562 @@ +/* + * Copyright © 2009 Jerome Glisse + * + * This file is free software; you can redistribute it and/or modify + * it under the terms of version 2 of the GNU General Public License + * as published by the Free Software Foundation. + * + * 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, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. + */ +#ifndef R600_STATES_H +#define R600_STATES_H + +static const struct radeon_register R600_CONFIG_names[] = { + {0x00008C00, 0, 0, "SQ_CONFIG"}, + {0x00008C04, 0, 0, "SQ_GPR_RESOURCE_MGMT_1"}, + {0x00008C08, 0, 0, "SQ_GPR_RESOURCE_MGMT_2"}, + {0x00008C0C, 0, 0, "SQ_THREAD_RESOURCE_MGMT"}, + {0x00008C10, 0, 0, "SQ_STACK_RESOURCE_MGMT_1"}, + {0x00008C14, 0, 0, "SQ_STACK_RESOURCE_MGMT_2"}, + {0x00008D8C, 0, 0, "SQ_DYN_GPR_CNTL_PS_FLUSH_REQ"}, + {0x00009508, 0, 0, "TA_CNTL_AUX"}, + {0x00009714, 0, 0, "VC_ENHANCE"}, + {0x00009830, 0, 0, "DB_DEBUG"}, + {0x00009838, 0, 0, "DB_WATERMARKS"}, + {0x00028350, 0, 0, "SX_MISC"}, + {0x000286C8, 0, 0, "SPI_THREAD_GROUPING"}, + {0x000287A0, 0, 0, "CB_SHADER_CONTROL"}, + {0x000288A8, 0, 0, "SQ_ESGS_RING_ITEMSIZE"}, + {0x000288AC, 0, 0, "SQ_GSVS_RING_ITEMSIZE"}, + {0x000288B0, 0, 0, "SQ_ESTMP_RING_ITEMSIZE"}, + {0x000288B4, 0, 0, "SQ_GSTMP_RING_ITEMSIZE"}, + {0x000288B8, 0, 0, "SQ_VSTMP_RING_ITEMSIZE"}, + {0x000288BC, 0, 0, "SQ_PSTMP_RING_ITEMSIZE"}, + {0x000288C0, 0, 0, "SQ_FBUF_RING_ITEMSIZE"}, + {0x000288C4, 0, 0, "SQ_REDUC_RING_ITEMSIZE"}, + {0x000288C8, 0, 0, "SQ_GS_VERT_ITEMSIZE"}, + {0x00028A10, 0, 0, "VGT_OUTPUT_PATH_CNTL"}, + {0x00028A14, 0, 0, "VGT_HOS_CNTL"}, + {0x00028A18, 0, 0, "VGT_HOS_MAX_TESS_LEVEL"}, + {0x00028A1C, 0, 0, "VGT_HOS_MIN_TESS_LEVEL"}, + {0x00028A20, 0, 0, "VGT_HOS_REUSE_DEPTH"}, + {0x00028A24, 0, 0, "VGT_GROUP_PRIM_TYPE"}, + {0x00028A28, 0, 0, "VGT_GROUP_FIRST_DECR"}, + {0x00028A2C, 0, 0, "VGT_GROUP_DECR"}, + {0x00028A30, 0, 0, "VGT_GROUP_VECT_0_CNTL"}, + {0x00028A34, 0, 0, "VGT_GROUP_VECT_1_CNTL"}, + {0x00028A38, 0, 0, "VGT_GROUP_VECT_0_FMT_CNTL"}, + {0x00028A3C, 0, 0, "VGT_GROUP_VECT_1_FMT_CNTL"}, + {0x00028A40, 0, 0, "VGT_GS_MODE"}, + {0x00028A4C, 0, 0, "PA_SC_MODE_CNTL"}, + {0x00028AB0, 0, 0, "VGT_STRMOUT_EN"}, + {0x00028AB4, 0, 0, "VGT_REUSE_OFF"}, + {0x00028AB8, 0, 0, "VGT_VTX_CNT_EN"}, + {0x00028B20, 0, 0, "VGT_STRMOUT_BUFFER_EN"}, +}; + +static const struct radeon_register R600_CB_CNTL_names[] = { + {0x00028120, 0, 0, "CB_CLEAR_RED"}, + {0x00028124, 0, 0, "CB_CLEAR_GREEN"}, + {0x00028128, 0, 0, "CB_CLEAR_BLUE"}, + {0x0002812C, 0, 0, "CB_CLEAR_ALPHA"}, + {0x0002823C, 0, 0, "CB_SHADER_MASK"}, + {0x00028238, 0, 0, "CB_TARGET_MASK"}, + {0x00028424, 0, 0, "CB_FOG_RED"}, + {0x00028428, 0, 0, "CB_FOG_GREEN"}, + {0x0002842C, 0, 0, "CB_FOG_BLUE"}, + {0x00028808, 0, 0, "CB_COLOR_CONTROL"}, + {0x00028C04, 0, 0, "PA_SC_AA_CONFIG"}, + {0x00028C1C, 0, 0, "PA_SC_AA_SAMPLE_LOCS_MCTX"}, + {0x00028C20, 0, 0, "PA_SC_AA_SAMPLE_LOCS_8S_WD1_MCTX"}, + {0x00028C30, 0, 0, "CB_CLRCMP_CONTROL"}, + {0x00028C34, 0, 0, "CB_CLRCMP_SRC"}, + {0x00028C38, 0, 0, "CB_CLRCMP_DST"}, + {0x00028C3C, 0, 0, "CB_CLRCMP_MSK"}, + {0x00028C48, 0, 0, "PA_SC_AA_MASK"}, +}; + +static const struct radeon_register R600_RASTERIZER_names[] = { + {0x000286D4, 0, 0, "SPI_INTERP_CONTROL_0"}, + {0x00028810, 0, 0, "PA_CL_CLIP_CNTL"}, + {0x00028814, 0, 0, "PA_SU_SC_MODE_CNTL"}, + {0x0002881C, 0, 0, "PA_CL_VS_OUT_CNTL"}, + {0x00028820, 0, 0, "PA_CL_NANINF_CNTL"}, + {0x00028A00, 0, 0, "PA_SU_POINT_SIZE"}, + {0x00028A04, 0, 0, "PA_SU_POINT_MINMAX"}, + {0x00028A08, 0, 0, "PA_SU_LINE_CNTL"}, + {0x00028A0C, 0, 0, "PA_SC_LINE_STIPPLE"}, + {0x00028A48, 0, 0, "PA_SC_MPASS_PS_CNTL"}, + {0x00028C00, 0, 0, "PA_SC_LINE_CNTL"}, + {0x00028C0C, 0, 0, "PA_CL_GB_VERT_CLIP_ADJ"}, + {0x00028C10, 0, 0, "PA_CL_GB_VERT_DISC_ADJ"}, + {0x00028C14, 0, 0, "PA_CL_GB_HORZ_CLIP_ADJ"}, + {0x00028C18, 0, 0, "PA_CL_GB_HORZ_DISC_ADJ"}, + {0x00028DF8, 0, 0, "PA_SU_POLY_OFFSET_DB_FMT_CNTL"}, + {0x00028DFC, 0, 0, "PA_SU_POLY_OFFSET_CLAMP"}, + {0x00028E00, 0, 0, "PA_SU_POLY_OFFSET_FRONT_SCALE"}, + {0x00028E04, 0, 0, "PA_SU_POLY_OFFSET_FRONT_OFFSET"}, + {0x00028E08, 0, 0, "PA_SU_POLY_OFFSET_BACK_SCALE"}, + {0x00028E0C, 0, 0, "PA_SU_POLY_OFFSET_BACK_OFFSET"}, +}; + +static const struct radeon_register R600_VIEWPORT_names[] = { + {0x000282D0, 0, 0, "PA_SC_VPORT_ZMIN_0"}, + {0x000282D4, 0, 0, "PA_SC_VPORT_ZMAX_0"}, + {0x0002843C, 0, 0, "PA_CL_VPORT_XSCALE_0"}, + {0x00028444, 0, 0, "PA_CL_VPORT_YSCALE_0"}, + {0x0002844C, 0, 0, "PA_CL_VPORT_ZSCALE_0"}, + {0x00028440, 0, 0, "PA_CL_VPORT_XOFFSET_0"}, + {0x00028448, 0, 0, "PA_CL_VPORT_YOFFSET_0"}, + {0x00028450, 0, 0, "PA_CL_VPORT_ZOFFSET_0"}, + {0x00028818, 0, 0, "PA_CL_VTE_CNTL"}, +}; + +static const struct radeon_register R600_SCISSOR_names[] = { + {0x00028030, 0, 0, "PA_SC_SCREEN_SCISSOR_TL"}, + {0x00028034, 0, 0, "PA_SC_SCREEN_SCISSOR_BR"}, + {0x00028200, 0, 0, "PA_SC_WINDOW_OFFSET"}, + {0x00028204, 0, 0, "PA_SC_WINDOW_SCISSOR_TL"}, + {0x00028208, 0, 0, "PA_SC_WINDOW_SCISSOR_BR"}, + {0x0002820C, 0, 0, "PA_SC_CLIPRECT_RULE"}, + {0x00028210, 0, 0, "PA_SC_CLIPRECT_0_TL"}, + {0x00028214, 0, 0, "PA_SC_CLIPRECT_0_BR"}, + {0x00028218, 0, 0, "PA_SC_CLIPRECT_1_TL"}, + {0x0002821C, 0, 0, "PA_SC_CLIPRECT_1_BR"}, + {0x00028220, 0, 0, "PA_SC_CLIPRECT_2_TL"}, + {0x00028224, 0, 0, "PA_SC_CLIPRECT_2_BR"}, + {0x00028228, 0, 0, "PA_SC_CLIPRECT_3_TL"}, + {0x0002822C, 0, 0, "PA_SC_CLIPRECT_3_BR"}, + {0x00028230, 0, 0, "PA_SC_EDGERULE"}, + {0x00028240, 0, 0, "PA_SC_GENERIC_SCISSOR_TL"}, + {0x00028244, 0, 0, "PA_SC_GENERIC_SCISSOR_BR"}, + {0x00028250, 0, 0, "PA_SC_VPORT_SCISSOR_0_TL"}, + {0x00028254, 0, 0, "PA_SC_VPORT_SCISSOR_0_BR"}, +}; + +static const struct radeon_register R600_BLEND_names[] = { + {0x00028414, 0, 0, "CB_BLEND_RED"}, + {0x00028418, 0, 0, "CB_BLEND_GREEN"}, + {0x0002841C, 0, 0, "CB_BLEND_BLUE"}, + {0x00028420, 0, 0, "CB_BLEND_ALPHA"}, + {0x00028780, 0, 0, "CB_BLEND0_CONTROL"}, + {0x00028784, 0, 0, "CB_BLEND1_CONTROL"}, + {0x00028788, 0, 0, "CB_BLEND2_CONTROL"}, + {0x0002878C, 0, 0, "CB_BLEND3_CONTROL"}, + {0x00028790, 0, 0, "CB_BLEND4_CONTROL"}, + {0x00028794, 0, 0, "CB_BLEND5_CONTROL"}, + {0x00028798, 0, 0, "CB_BLEND6_CONTROL"}, + {0x0002879C, 0, 0, "CB_BLEND7_CONTROL"}, + {0x00028804, 0, 0, "CB_BLEND_CONTROL"}, +}; + +static const struct radeon_register R600_DSA_names[] = { + {0x00028028, 0, 0, "DB_STENCIL_CLEAR"}, + {0x0002802C, 0, 0, "DB_DEPTH_CLEAR"}, + {0x00028410, 0, 0, "SX_ALPHA_TEST_CONTROL"}, + {0x00028430, 0, 0, "DB_STENCILREFMASK"}, + {0x00028434, 0, 0, "DB_STENCILREFMASK_BF"}, + {0x00028438, 0, 0, "SX_ALPHA_REF"}, + {0x000286E0, 0, 0, "SPI_FOG_FUNC_SCALE"}, + {0x000286E4, 0, 0, "SPI_FOG_FUNC_BIAS"}, + {0x000286DC, 0, 0, "SPI_FOG_CNTL"}, + {0x00028800, 0, 0, "DB_DEPTH_CONTROL"}, + {0x0002880C, 0, 0, "DB_SHADER_CONTROL"}, + {0x00028D0C, 0, 0, "DB_RENDER_CONTROL"}, + {0x00028D10, 0, 0, "DB_RENDER_OVERRIDE"}, + {0x00028D2C, 0, 0, "DB_SRESULTS_COMPARE_STATE1"}, + {0x00028D30, 0, 0, "DB_PRELOAD_CONTROL"}, + {0x00028D44, 0, 0, "DB_ALPHA_TO_MASK"}, +}; + +static const struct radeon_register R600_VS_SHADER_names[] = { + {0x00028380, 0, 0, "SQ_VTX_SEMANTIC_0"}, + {0x00028384, 0, 0, "SQ_VTX_SEMANTIC_1"}, + {0x00028388, 0, 0, "SQ_VTX_SEMANTIC_2"}, + {0x0002838C, 0, 0, "SQ_VTX_SEMANTIC_3"}, + {0x00028390, 0, 0, "SQ_VTX_SEMANTIC_4"}, + {0x00028394, 0, 0, "SQ_VTX_SEMANTIC_5"}, + {0x00028398, 0, 0, "SQ_VTX_SEMANTIC_6"}, + {0x0002839C, 0, 0, "SQ_VTX_SEMANTIC_7"}, + {0x000283A0, 0, 0, "SQ_VTX_SEMANTIC_8"}, + {0x000283A4, 0, 0, "SQ_VTX_SEMANTIC_9"}, + {0x000283A8, 0, 0, "SQ_VTX_SEMANTIC_10"}, + {0x000283AC, 0, 0, "SQ_VTX_SEMANTIC_11"}, + {0x000283B0, 0, 0, "SQ_VTX_SEMANTIC_12"}, + {0x000283B4, 0, 0, "SQ_VTX_SEMANTIC_13"}, + {0x000283B8, 0, 0, "SQ_VTX_SEMANTIC_14"}, + {0x000283BC, 0, 0, "SQ_VTX_SEMANTIC_15"}, + {0x000283C0, 0, 0, "SQ_VTX_SEMANTIC_16"}, + {0x000283C4, 0, 0, "SQ_VTX_SEMANTIC_17"}, + {0x000283C8, 0, 0, "SQ_VTX_SEMANTIC_18"}, + {0x000283CC, 0, 0, "SQ_VTX_SEMANTIC_19"}, + {0x000283D0, 0, 0, "SQ_VTX_SEMANTIC_20"}, + {0x000283D4, 0, 0, "SQ_VTX_SEMANTIC_21"}, + {0x000283D8, 0, 0, "SQ_VTX_SEMANTIC_22"}, + {0x000283DC, 0, 0, "SQ_VTX_SEMANTIC_23"}, + {0x000283E0, 0, 0, "SQ_VTX_SEMANTIC_24"}, + {0x000283E4, 0, 0, "SQ_VTX_SEMANTIC_25"}, + {0x000283E8, 0, 0, "SQ_VTX_SEMANTIC_26"}, + {0x000283EC, 0, 0, "SQ_VTX_SEMANTIC_27"}, + {0x000283F0, 0, 0, "SQ_VTX_SEMANTIC_28"}, + {0x000283F4, 0, 0, "SQ_VTX_SEMANTIC_29"}, + {0x000283F8, 0, 0, "SQ_VTX_SEMANTIC_30"}, + {0x000283FC, 0, 0, "SQ_VTX_SEMANTIC_31"}, + {0x00028614, 0, 0, "SPI_VS_OUT_ID_0"}, + {0x00028618, 0, 0, "SPI_VS_OUT_ID_1"}, + {0x0002861C, 0, 0, "SPI_VS_OUT_ID_2"}, + {0x00028620, 0, 0, "SPI_VS_OUT_ID_3"}, + {0x00028624, 0, 0, "SPI_VS_OUT_ID_4"}, + {0x00028628, 0, 0, "SPI_VS_OUT_ID_5"}, + {0x0002862C, 0, 0, "SPI_VS_OUT_ID_6"}, + {0x00028630, 0, 0, "SPI_VS_OUT_ID_7"}, + {0x00028634, 0, 0, "SPI_VS_OUT_ID_8"}, + {0x00028638, 0, 0, "SPI_VS_OUT_ID_9"}, + {0x000286C4, 0, 0, "SPI_VS_OUT_CONFIG"}, + {0x00028858, 1, 0, "SQ_PGM_START_VS"}, + {0x00028868, 0, 0, "SQ_PGM_RESOURCES_VS"}, + {0x00028894, 1, 1, "SQ_PGM_START_FS"}, + {0x000288A4, 0, 0, "SQ_PGM_RESOURCES_FS"}, + {0x000288D0, 0, 0, "SQ_PGM_CF_OFFSET_VS"}, + {0x000288DC, 0, 0, "SQ_PGM_CF_OFFSET_FS"}, +}; + +static const struct radeon_register R600_PS_SHADER_names[] = { + {0x00028644, 0, 0, "SPI_PS_INPUT_CNTL_0"}, + {0x00028648, 0, 0, "SPI_PS_INPUT_CNTL_1"}, + {0x0002864C, 0, 0, "SPI_PS_INPUT_CNTL_2"}, + {0x00028650, 0, 0, "SPI_PS_INPUT_CNTL_3"}, + {0x00028654, 0, 0, "SPI_PS_INPUT_CNTL_4"}, + {0x00028658, 0, 0, "SPI_PS_INPUT_CNTL_5"}, + {0x0002865C, 0, 0, "SPI_PS_INPUT_CNTL_6"}, + {0x00028660, 0, 0, "SPI_PS_INPUT_CNTL_7"}, + {0x00028664, 0, 0, "SPI_PS_INPUT_CNTL_8"}, + {0x00028668, 0, 0, "SPI_PS_INPUT_CNTL_9"}, + {0x0002866C, 0, 0, "SPI_PS_INPUT_CNTL_10"}, + {0x00028670, 0, 0, "SPI_PS_INPUT_CNTL_11"}, + {0x00028674, 0, 0, "SPI_PS_INPUT_CNTL_12"}, + {0x00028678, 0, 0, "SPI_PS_INPUT_CNTL_13"}, + {0x0002867C, 0, 0, "SPI_PS_INPUT_CNTL_14"}, + {0x00028680, 0, 0, "SPI_PS_INPUT_CNTL_15"}, + {0x00028684, 0, 0, "SPI_PS_INPUT_CNTL_16"}, + {0x00028688, 0, 0, "SPI_PS_INPUT_CNTL_17"}, + {0x0002868C, 0, 0, "SPI_PS_INPUT_CNTL_18"}, + {0x00028690, 0, 0, "SPI_PS_INPUT_CNTL_19"}, + {0x00028694, 0, 0, "SPI_PS_INPUT_CNTL_20"}, + {0x00028698, 0, 0, "SPI_PS_INPUT_CNTL_21"}, + {0x0002869C, 0, 0, "SPI_PS_INPUT_CNTL_22"}, + {0x000286A0, 0, 0, "SPI_PS_INPUT_CNTL_23"}, + {0x000286A4, 0, 0, "SPI_PS_INPUT_CNTL_24"}, + {0x000286A8, 0, 0, "SPI_PS_INPUT_CNTL_25"}, + {0x000286AC, 0, 0, "SPI_PS_INPUT_CNTL_26"}, + {0x000286B0, 0, 0, "SPI_PS_INPUT_CNTL_27"}, + {0x000286B4, 0, 0, "SPI_PS_INPUT_CNTL_28"}, + {0x000286B8, 0, 0, "SPI_PS_INPUT_CNTL_29"}, + {0x000286BC, 0, 0, "SPI_PS_INPUT_CNTL_30"}, + {0x000286C0, 0, 0, "SPI_PS_INPUT_CNTL_31"}, + {0x000286CC, 0, 0, "SPI_PS_IN_CONTROL_0"}, + {0x000286D0, 0, 0, "SPI_PS_IN_CONTROL_1"}, + {0x000286D8, 0, 0, "SPI_INPUT_Z"}, + {0x00028840, 1, 0, "SQ_PGM_START_PS"}, + {0x00028850, 0, 0, "SQ_PGM_RESOURCES_PS"}, + {0x00028854, 0, 0, "SQ_PGM_EXPORTS_PS"}, + {0x000288CC, 0, 0, "SQ_PGM_CF_OFFSET_PS"}, +}; + +static const struct radeon_register R600_PS_CONSTANT_names[] = { + {0x00030000, 0, 0, "SQ_ALU_CONSTANT0_0"}, + {0x00030004, 0, 0, "SQ_ALU_CONSTANT1_0"}, + {0x00030008, 0, 0, "SQ_ALU_CONSTANT2_0"}, + {0x0003000C, 0, 0, "SQ_ALU_CONSTANT3_0"}, +}; + +static const struct radeon_register R600_VS_CONSTANT_names[] = { + {0x00031000, 0, 0, "SQ_ALU_CONSTANT0_256"}, + {0x00031004, 0, 0, "SQ_ALU_CONSTANT1_256"}, + {0x00031008, 0, 0, "SQ_ALU_CONSTANT2_256"}, + {0x0003100C, 0, 0, "SQ_ALU_CONSTANT3_256"}, +}; + +static const struct radeon_register R600_UCP_names[] = { + {0x00028e20, 0, 0, "PA_CL_UCP0_X"}, + {0x00028e24, 0, 0, "PA_CL_UCP0_Y"}, + {0x00028e28, 0, 0, "PA_CL_UCP0_Z"}, + {0x00028e2c, 0, 0, "PA_CL_UCP0_W"}, +}; + +static const struct radeon_register R600_PS_RESOURCE_names[] = { + {0x00038000, 0, 0, "RESOURCE0_WORD0"}, + {0x00038004, 0, 0, "RESOURCE0_WORD1"}, + {0x00038008, 0, 0, "RESOURCE0_WORD2"}, + {0x0003800C, 0, 0, "RESOURCE0_WORD3"}, + {0x00038010, 0, 0, "RESOURCE0_WORD4"}, + {0x00038014, 0, 0, "RESOURCE0_WORD5"}, + {0x00038018, 0, 0, "RESOURCE0_WORD6"}, +}; + +static const struct radeon_register R600_VS_RESOURCE_names[] = { + {0x00039180, 0, 0, "RESOURCE160_WORD0"}, + {0x00039184, 0, 0, "RESOURCE160_WORD1"}, + {0x00039188, 0, 0, "RESOURCE160_WORD2"}, + {0x0003918C, 0, 0, "RESOURCE160_WORD3"}, + {0x00039190, 0, 0, "RESOURCE160_WORD4"}, + {0x00039194, 0, 0, "RESOURCE160_WORD5"}, + {0x00039198, 0, 0, "RESOURCE160_WORD6"}, +}; + +static const struct radeon_register R600_FS_RESOURCE_names[] = { + {0x0003A300, 0, 0, "RESOURCE320_WORD0"}, + {0x0003A304, 0, 0, "RESOURCE320_WORD1"}, + {0x0003A308, 0, 0, "RESOURCE320_WORD2"}, + {0x0003A30C, 0, 0, "RESOURCE320_WORD3"}, + {0x0003A310, 0, 0, "RESOURCE320_WORD4"}, + {0x0003A314, 0, 0, "RESOURCE320_WORD5"}, + {0x0003A318, 0, 0, "RESOURCE320_WORD6"}, +}; + +static const struct radeon_register R600_GS_RESOURCE_names[] = { + {0x0003A4C0, 0, 0, "RESOURCE336_WORD0"}, + {0x0003A4C4, 0, 0, "RESOURCE336_WORD1"}, + {0x0003A4C8, 0, 0, "RESOURCE336_WORD2"}, + {0x0003A4CC, 0, 0, "RESOURCE336_WORD3"}, + {0x0003A4D0, 0, 0, "RESOURCE336_WORD4"}, + {0x0003A4D4, 0, 0, "RESOURCE336_WORD5"}, + {0x0003A4D8, 0, 0, "RESOURCE336_WORD6"}, +}; + +static const struct radeon_register R600_PS_SAMPLER_names[] = { + {0x0003C000, 0, 0, "SQ_TEX_SAMPLER_WORD0_0"}, + {0x0003C004, 0, 0, "SQ_TEX_SAMPLER_WORD1_0"}, + {0x0003C008, 0, 0, "SQ_TEX_SAMPLER_WORD2_0"}, +}; + +static const struct radeon_register R600_VS_SAMPLER_names[] = { + {0x0003C0D8, 0, 0, "SQ_TEX_SAMPLER_WORD0_18"}, + {0x0003C0DC, 0, 0, "SQ_TEX_SAMPLER_WORD1_18"}, + {0x0003C0E0, 0, 0, "SQ_TEX_SAMPLER_WORD2_18"}, +}; + +static const struct radeon_register R600_GS_SAMPLER_names[] = { + {0x0003C1B0, 0, 0, "SQ_TEX_SAMPLER_WORD0_36"}, + {0x0003C1B4, 0, 0, "SQ_TEX_SAMPLER_WORD1_36"}, + {0x0003C1B8, 0, 0, "SQ_TEX_SAMPLER_WORD2_36"}, +}; + +static const struct radeon_register R600_PS_SAMPLER_BORDER_names[] = { + {0x0000A400, 0, 0, "TD_PS_SAMPLER0_BORDER_RED"}, + {0x0000A404, 0, 0, "TD_PS_SAMPLER0_BORDER_GREEN"}, + {0x0000A408, 0, 0, "TD_PS_SAMPLER0_BORDER_BLUE"}, + {0x0000A40C, 0, 0, "TD_PS_SAMPLER0_BORDER_ALPHA"}, +}; + +static const struct radeon_register R600_VS_SAMPLER_BORDER_names[] = { + {0x0000A600, 0, 0, "TD_VS_SAMPLER0_BORDER_RED"}, + {0x0000A604, 0, 0, "TD_VS_SAMPLER0_BORDER_GREEN"}, + {0x0000A608, 0, 0, "TD_VS_SAMPLER0_BORDER_BLUE"}, + {0x0000A60C, 0, 0, "TD_VS_SAMPLER0_BORDER_ALPHA"}, +}; + +static const struct radeon_register R600_GS_SAMPLER_BORDER_names[] = { + {0x0000A800, 0, 0, "TD_GS_SAMPLER0_BORDER_RED"}, + {0x0000A804, 0, 0, "TD_GS_SAMPLER0_BORDER_GREEN"}, + {0x0000A808, 0, 0, "TD_GS_SAMPLER0_BORDER_BLUE"}, + {0x0000A80C, 0, 0, "TD_GS_SAMPLER0_BORDER_ALPHA"}, +}; + +static const struct radeon_register R600_CB0_names[] = { + {0x00028040, 1, 0, "CB_COLOR0_BASE"}, + {0x000280A0, 0, 0, "CB_COLOR0_INFO"}, + {0x00028060, 0, 0, "CB_COLOR0_SIZE"}, + {0x00028080, 0, 0, "CB_COLOR0_VIEW"}, + {0x000280E0, 1, 1, "CB_COLOR0_FRAG"}, + {0x000280C0, 1, 2, "CB_COLOR0_TILE"}, + {0x00028100, 0, 0, "CB_COLOR0_MASK"}, +}; + +static const struct radeon_register R600_CB1_names[] = { + {0x00028044, 1, 0, "CB_COLOR1_BASE"}, + {0x000280A4, 0, 0, "CB_COLOR1_INFO"}, + {0x00028064, 0, 0, "CB_COLOR1_SIZE"}, + {0x00028084, 0, 0, "CB_COLOR1_VIEW"}, + {0x000280E4, 1, 1, "CB_COLOR1_FRAG"}, + {0x000280C4, 1, 2, "CB_COLOR1_TILE"}, + {0x00028104, 0, 0, "CB_COLOR1_MASK"}, +}; + +static const struct radeon_register R600_CB2_names[] = { + {0x00028048, 1, 0, "CB_COLOR2_BASE"}, + {0x000280A8, 0, 0, "CB_COLOR2_INFO"}, + {0x00028068, 0, 0, "CB_COLOR2_SIZE"}, + {0x00028088, 0, 0, "CB_COLOR2_VIEW"}, + {0x000280E8, 1, 1, "CB_COLOR2_FRAG"}, + {0x000280C8, 1, 2, "CB_COLOR2_TILE"}, + {0x00028108, 0, 0, "CB_COLOR2_MASK"}, +}; + +static const struct radeon_register R600_CB3_names[] = { + {0x0002804C, 1, 0, "CB_COLOR3_BASE"}, + {0x000280AC, 0, 0, "CB_COLOR3_INFO"}, + {0x0002806C, 0, 0, "CB_COLOR3_SIZE"}, + {0x0002808C, 0, 0, "CB_COLOR3_VIEW"}, + {0x000280EC, 1, 1, "CB_COLOR3_FRAG"}, + {0x000280CC, 1, 2, "CB_COLOR3_TILE"}, + {0x0002810C, 0, 0, "CB_COLOR3_MASK"}, +}; + +static const struct radeon_register R600_CB4_names[] = { + {0x00028050, 1, 0, "CB_COLOR4_BASE"}, + {0x000280B0, 0, 0, "CB_COLOR4_INFO"}, + {0x00028070, 0, 0, "CB_COLOR4_SIZE"}, + {0x00028090, 0, 0, "CB_COLOR4_VIEW"}, + {0x000280F0, 1, 1, "CB_COLOR4_FRAG"}, + {0x000280D0, 1, 2, "CB_COLOR4_TILE"}, + {0x00028110, 0, 0, "CB_COLOR4_MASK"}, +}; + +static const struct radeon_register R600_CB5_names[] = { + {0x00028054, 1, 0, "CB_COLOR5_BASE"}, + {0x000280B4, 0, 0, "CB_COLOR5_INFO"}, + {0x00028074, 0, 0, "CB_COLOR5_SIZE"}, + {0x00028094, 0, 0, "CB_COLOR5_VIEW"}, + {0x000280F4, 1, 1, "CB_COLOR5_FRAG"}, + {0x000280D4, 1, 2, "CB_COLOR5_TILE"}, + {0x00028114, 0, 0, "CB_COLOR5_MASK"}, +}; + +static const struct radeon_register R600_CB6_names[] = { + {0x00028058, 1, 0, "CB_COLOR6_BASE"}, + {0x000280B8, 0, 0, "CB_COLOR6_INFO"}, + {0x00028078, 0, 0, "CB_COLOR6_SIZE"}, + {0x00028098, 0, 0, "CB_COLOR6_VIEW"}, + {0x000280F8, 1, 1, "CB_COLOR6_FRAG"}, + {0x000280D8, 1, 2, "CB_COLOR6_TILE"}, + {0x00028118, 0, 0, "CB_COLOR6_MASK"}, +}; + +static const struct radeon_register R600_CB7_names[] = { + {0x0002805C, 1, 0, "CB_COLOR7_BASE"}, + {0x000280BC, 0, 0, "CB_COLOR7_INFO"}, + {0x0002807C, 0, 0, "CB_COLOR7_SIZE"}, + {0x0002809C, 0, 0, "CB_COLOR7_VIEW"}, + {0x000280FC, 1, 1, "CB_COLOR7_FRAG"}, + {0x000280DC, 1, 2, "CB_COLOR7_TILE"}, + {0x0002811C, 0, 0, "CB_COLOR7_MASK"}, +}; + +static const struct radeon_register R600_DB_names[] = { + {0x0002800C, 1, 0, "DB_DEPTH_BASE"}, + {0x00028000, 0, 0, "DB_DEPTH_SIZE"}, + {0x00028004, 0, 0, "DB_DEPTH_VIEW"}, + {0x00028010, 0, 0, "DB_DEPTH_INFO"}, + {0x00028D24, 0, 0, "DB_HTILE_SURFACE"}, + {0x00028D34, 0, 0, "DB_PREFETCH_LIMIT"}, +}; + +static const struct radeon_register R600_VGT_names[] = { + {0x00008958, 0, 0, "VGT_PRIMITIVE_TYPE"}, + {0x00028400, 0, 0, "VGT_MAX_VTX_INDX"}, + {0x00028404, 0, 0, "VGT_MIN_VTX_INDX"}, + {0x00028408, 0, 0, "VGT_INDX_OFFSET"}, + {0x0002840C, 0, 0, "VGT_MULTI_PRIM_IB_RESET_INDX"}, + {0x00028A7C, 0, 0, "VGT_DMA_INDEX_TYPE"}, + {0x00028A84, 0, 0, "VGT_PRIMITIVEID_EN"}, + {0x00028A88, 0, 0, "VGT_DMA_NUM_INSTANCES"}, + {0x00028A94, 0, 0, "VGT_MULTI_PRIM_IB_RESET_EN"}, + {0x00028AA0, 0, 0, "VGT_INSTANCE_STEP_RATE_0"}, + {0x00028AA4, 0, 0, "VGT_INSTANCE_STEP_RATE_1"}, +}; + +static const struct radeon_register R600_DRAW_names[] = { + {0x00008970, 0, 0, "VGT_NUM_INDICES"}, + {0x000287E4, 0, 0, "VGT_DMA_BASE_HI"}, + {0x000287E8, 1, 0, "VGT_DMA_BASE"}, + {0x000287F0, 0, 0, "VGT_DRAW_INITIATOR"}, +}; + +static const struct radeon_register R600_VGT_EVENT_names[] = { + {0x00028A90, 1, 0, "VGT_EVENT_INITIATOR"}, +}; + +static struct radeon_type R600_types[] = { + { 128, 0, 0x00000000, 0x00000000, 0x0000, 0, "R600_CONFIG", 41, r600_state_pm4_config, R600_CONFIG_names}, + { 128, 1, 0x00000000, 0x00000000, 0x0000, 0, "R600_CB_CNTL", 18, r600_state_pm4_generic, R600_CB_CNTL_names}, + { 128, 2, 0x00000000, 0x00000000, 0x0000, 0, "R600_RASTERIZER", 21, r600_state_pm4_generic, R600_RASTERIZER_names}, + { 128, 3, 0x00000000, 0x00000000, 0x0000, 0, "R600_VIEWPORT", 9, r600_state_pm4_generic, R600_VIEWPORT_names}, + { 128, 4, 0x00000000, 0x00000000, 0x0000, 0, "R600_SCISSOR", 19, r600_state_pm4_generic, R600_SCISSOR_names}, + { 128, 5, 0x00000000, 0x00000000, 0x0000, 0, "R600_BLEND", 13, r600_state_pm4_generic, R600_BLEND_names}, + { 128, 6, 0x00000000, 0x00000000, 0x0000, 0, "R600_DSA", 16, r600_state_pm4_generic, R600_DSA_names}, + { 128, 7, 0x00000000, 0x00000000, 0x0000, 0, "R600_VS_SHADER", 49, r600_state_pm4_shader, R600_VS_SHADER_names}, + { 128, 8, 0x00000000, 0x00000000, 0x0000, 0, "R600_PS_SHADER", 39, r600_state_pm4_shader, R600_PS_SHADER_names}, + { 128, 9, 0x00030000, 0x00031000, 0x0010, 0, "R600_PS_CONSTANT", 4, r600_state_pm4_generic, R600_PS_CONSTANT_names}, + { 128, 265, 0x00031000, 0x00032000, 0x0010, 0, "R600_VS_CONSTANT", 4, r600_state_pm4_generic, R600_VS_CONSTANT_names}, + { 128, 521, 0x00038000, 0x00039180, 0x001C, 0, "R600_PS_RESOURCE", 7, r600_state_pm4_resource, R600_PS_RESOURCE_names}, + { 128, 681, 0x00039180, 0x0003A300, 0x001C, 0, "R600_VS_RESOURCE", 7, r600_state_pm4_resource, R600_VS_RESOURCE_names}, + { 128, 841, 0x00039180, 0x0003A300, 0x001C, 0, "R600_FS_RESOURCE", 7, r600_state_pm4_resource, R600_FS_RESOURCE_names}, + { 128, 1001, 0x00039180, 0x0003A300, 0x001C, 0, "R600_GS_RESOURCE", 7, r600_state_pm4_resource, R600_GS_RESOURCE_names}, + { 128, 1161, 0x0003C000, 0x0003C0D8, 0x000C, 0, "R600_PS_SAMPLER", 3, r600_state_pm4_generic, R600_PS_SAMPLER_names}, + { 128, 1179, 0x0003C0D8, 0x0003C1B0, 0x000C, 0, "R600_VS_SAMPLER", 3, r600_state_pm4_generic, R600_VS_SAMPLER_names}, + { 128, 1197, 0x0003C1B0, 0x0003C288, 0x000C, 0, "R600_GS_SAMPLER", 3, r600_state_pm4_generic, R600_GS_SAMPLER_names}, + { 128, 1215, 0x0000A400, 0x0000A520, 0x0010, 0, "R600_PS_SAMPLER_BORDER", 4, r600_state_pm4_generic, R600_PS_SAMPLER_BORDER_names}, + { 128, 1233, 0x0000A600, 0x0000A720, 0x0010, 0, "R600_VS_SAMPLER_BORDER", 4, r600_state_pm4_generic, R600_VS_SAMPLER_BORDER_names}, + { 128, 1251, 0x0000A800, 0x0000A920, 0x0010, 0, "R600_GS_SAMPLER_BORDER", 4, r600_state_pm4_generic, R600_GS_SAMPLER_BORDER_names}, + { 128, 1269, 0x00000000, 0x00000000, 0x0000, 0, "R600_CB0", 7, r600_state_pm4_cb0, R600_CB0_names}, + { 128, 1270, 0x00000000, 0x00000000, 0x0000, 0, "R600_CB1", 7, r600_state_pm4_cb0, R600_CB1_names}, + { 128, 1271, 0x00000000, 0x00000000, 0x0000, 0, "R600_CB2", 7, r600_state_pm4_cb0, R600_CB2_names}, + { 128, 1272, 0x00000000, 0x00000000, 0x0000, 0, "R600_CB3", 7, r600_state_pm4_cb0, R600_CB3_names}, + { 128, 1273, 0x00000000, 0x00000000, 0x0000, 0, "R600_CB4", 7, r600_state_pm4_cb0, R600_CB4_names}, + { 128, 1274, 0x00000000, 0x00000000, 0x0000, 0, "R600_CB5", 7, r600_state_pm4_cb0, R600_CB5_names}, + { 128, 1275, 0x00000000, 0x00000000, 0x0000, 0, "R600_CB6", 7, r600_state_pm4_cb0, R600_CB6_names}, + { 128, 1276, 0x00000000, 0x00000000, 0x0000, 0, "R600_CB7", 7, r600_state_pm4_cb0, R600_CB7_names}, + { 128, 1277, 0x00000000, 0x00000000, 0x0000, 0, "R600_QUERY_BEGIN", 1, r600_state_pm4_query_begin, R600_VGT_EVENT_names}, + { 128, 1278, 0x00000000, 0x00000000, 0x0000, 0, "R600_QUERY_END", 1, r600_state_pm4_query_end, R600_VGT_EVENT_names}, + { 128, 1279, 0x00000000, 0x00000000, 0x0000, 0, "R600_DB", 6, r600_state_pm4_db, R600_DB_names}, + { 128, 1280, 0x00028e20, 0x00028e70, 0x0010, 0, "R600_UCP", 4, r600_state_pm4_generic, R600_UCP_names}, + { 128, 1286, 0x00000000, 0x00000000, 0x0000, 0, "R600_VGT", 11, r600_state_pm4_vgt, R600_VGT_names}, + { 128, 1287, 0x00000000, 0x00000000, 0x0000, 0, "R600_DRAW", 4, r600_state_pm4_draw, R600_DRAW_names}, +}; + +static struct radeon_type R700_types[] = { + { 128, 0, 0x00000000, 0x00000000, 0x0000, 0, "R600_CONFIG", 41, r700_state_pm4_config, R600_CONFIG_names}, + { 128, 1, 0x00000000, 0x00000000, 0x0000, 0, "R600_CB_CNTL", 18, r600_state_pm4_generic, R600_CB_CNTL_names}, + { 128, 2, 0x00000000, 0x00000000, 0x0000, 0, "R600_RASTERIZER", 21, r600_state_pm4_generic, R600_RASTERIZER_names}, + { 128, 3, 0x00000000, 0x00000000, 0x0000, 0, "R600_VIEWPORT", 9, r600_state_pm4_generic, R600_VIEWPORT_names}, + { 128, 4, 0x00000000, 0x00000000, 0x0000, 0, "R600_SCISSOR", 19, r600_state_pm4_generic, R600_SCISSOR_names}, + { 128, 5, 0x00000000, 0x00000000, 0x0000, 0, "R600_BLEND", 13, r600_state_pm4_generic, R600_BLEND_names}, + { 128, 6, 0x00000000, 0x00000000, 0x0000, 0, "R600_DSA", 16, r600_state_pm4_generic, R600_DSA_names}, + { 128, 7, 0x00000000, 0x00000000, 0x0000, 0, "R600_VS_SHADER", 49, r600_state_pm4_shader, R600_VS_SHADER_names}, + { 128, 8, 0x00000000, 0x00000000, 0x0000, 0, "R600_PS_SHADER", 39, r600_state_pm4_shader, R600_PS_SHADER_names}, + { 128, 9, 0x00030000, 0x00031000, 0x0010, 0, "R600_PS_CONSTANT", 4, r600_state_pm4_generic, R600_PS_CONSTANT_names}, + { 128, 265, 0x00031000, 0x00032000, 0x0010, 0, "R600_VS_CONSTANT", 4, r600_state_pm4_generic, R600_VS_CONSTANT_names}, + { 128, 521, 0x00038000, 0x00039180, 0x001C, 0, "R600_PS_RESOURCE", 7, r600_state_pm4_resource, R600_PS_RESOURCE_names}, + { 128, 681, 0x00039180, 0x0003A300, 0x001C, 0, "R600_VS_RESOURCE", 7, r600_state_pm4_resource, R600_VS_RESOURCE_names}, + { 128, 841, 0x00039180, 0x0003A300, 0x001C, 0, "R600_FS_RESOURCE", 7, r600_state_pm4_resource, R600_FS_RESOURCE_names}, + { 128, 1001, 0x00039180, 0x0003A300, 0x001C, 0, "R600_GS_RESOURCE", 7, r600_state_pm4_resource, R600_GS_RESOURCE_names}, + { 128, 1161, 0x0003C000, 0x0003C0D8, 0x000C, 0, "R600_PS_SAMPLER", 3, r600_state_pm4_generic, R600_PS_SAMPLER_names}, + { 128, 1179, 0x0003C0D8, 0x0003C1B0, 0x000C, 0, "R600_VS_SAMPLER", 3, r600_state_pm4_generic, R600_VS_SAMPLER_names}, + { 128, 1197, 0x0003C1B0, 0x0003C288, 0x000C, 0, "R600_GS_SAMPLER", 3, r600_state_pm4_generic, R600_GS_SAMPLER_names}, + { 128, 1215, 0x0000A400, 0x0000A520, 0x0010, 0, "R600_PS_SAMPLER_BORDER", 4, r600_state_pm4_generic, R600_PS_SAMPLER_BORDER_names}, + { 128, 1233, 0x0000A600, 0x0000A720, 0x0010, 0, "R600_VS_SAMPLER_BORDER", 4, r600_state_pm4_generic, R600_VS_SAMPLER_BORDER_names}, + { 128, 1251, 0x0000A800, 0x0000A920, 0x0010, 0, "R600_GS_SAMPLER_BORDER", 4, r600_state_pm4_generic, R600_GS_SAMPLER_BORDER_names}, + { 128, 1269, 0x00000000, 0x00000000, 0x0000, 0, "R600_CB0", 7, r700_state_pm4_cb0, R600_CB0_names}, + { 128, 1270, 0x00000000, 0x00000000, 0x0000, 0, "R600_CB1", 7, r600_state_pm4_cb0, R600_CB1_names}, + { 128, 1271, 0x00000000, 0x00000000, 0x0000, 0, "R600_CB2", 7, r600_state_pm4_cb0, R600_CB2_names}, + { 128, 1272, 0x00000000, 0x00000000, 0x0000, 0, "R600_CB3", 7, r600_state_pm4_cb0, R600_CB3_names}, + { 128, 1273, 0x00000000, 0x00000000, 0x0000, 0, "R600_CB4", 7, r600_state_pm4_cb0, R600_CB4_names}, + { 128, 1274, 0x00000000, 0x00000000, 0x0000, 0, "R600_CB5", 7, r600_state_pm4_cb0, R600_CB5_names}, + { 128, 1275, 0x00000000, 0x00000000, 0x0000, 0, "R600_CB6", 7, r600_state_pm4_cb0, R600_CB6_names}, + { 128, 1276, 0x00000000, 0x00000000, 0x0000, 0, "R600_CB7", 7, r600_state_pm4_cb0, R600_CB7_names}, + { 128, 1277, 0x00000000, 0x00000000, 0x0000, 0, "R600_QUERY_BEGIN", 1, r600_state_pm4_query_begin, R600_VGT_EVENT_names}, + { 128, 1278, 0x00000000, 0x00000000, 0x0000, 0, "R600_QUERY_END", 1, r600_state_pm4_query_end, R600_VGT_EVENT_names}, + { 128, 1279, 0x00000000, 0x00000000, 0x0000, 0, "R600_DB", 6, r700_state_pm4_db, R600_DB_names}, + { 128, 1280, 0x00028e20, 0x00028e70, 0x0010, 0, "R600_UCP", 4, r600_state_pm4_generic, R600_UCP_names}, + { 128, 1286, 0x00000000, 0x00000000, 0x0000, 0, "R600_VGT", 11, r600_state_pm4_vgt, R600_VGT_names}, + { 128, 1287, 0x00000000, 0x00000000, 0x0000, 0, "R600_DRAW", 4, r600_state_pm4_draw, R600_DRAW_names}, +}; + +#endif diff --git a/src/gallium/winsys/r600/drm/radeon.c b/src/gallium/winsys/r600/drm/radeon.c index 2b16e3ce88..80b0a1d397 100644 --- a/src/gallium/winsys/r600/drm/radeon.c +++ b/src/gallium/winsys/r600/drm/radeon.c @@ -153,3 +153,47 @@ struct radeon *radeon_decref(struct radeon *radeon) free(radeon); return NULL; } + +int radeon_reg_id(struct radeon *radeon, unsigned offset, unsigned *typeid, unsigned *stateid, unsigned *id) +{ + unsigned i, j; + + for (i = 0; i < radeon->ntype; i++) { + if (radeon->type[i].range_start) { + if (offset >= radeon->type[i].range_start && offset < radeon->type[i].range_end) { + *typeid = i; + j = offset - radeon->type[i].range_start; + j /= radeon->type[i].stride; + *stateid = radeon->type[i].id + j; + *id = (offset - radeon->type[i].range_start - radeon->type[i].stride * j) / 4; + return 0; + } + } else { + for (j = 0; j < radeon->type[i].nstates; j++) { + if (radeon->type[i].regs[j].offset == offset) { + *typeid = i; + *stateid = radeon->type[i].id; + *id = j; + return 0; + } + } + } + } + fprintf(stderr, "%s unknown register 0x%08X\n", __func__, offset); + return -EINVAL; +} + +unsigned radeon_type_from_id(struct radeon *radeon, unsigned id) +{ + unsigned i; + + for (i = 0; i < radeon->ntype - 1; i++) { + if (radeon->type[i].id == id) + return i; + if (id > radeon->type[i].id && id < radeon->type[i + 1].id) + return i; + } + if (radeon->type[i].id == id) + return i; + return -1; +} diff --git a/src/gallium/winsys/r600/drm/radeon_ctx.c b/src/gallium/winsys/r600/drm/radeon_ctx.c index b8ba9b552d..bd050c4cf9 100644 --- a/src/gallium/winsys/r600/drm/radeon_ctx.c +++ b/src/gallium/winsys/r600/drm/radeon_ctx.c @@ -26,40 +26,54 @@ #include #include #include -#include #include "radeon_priv.h" #include "radeon_drm.h" #include "bof.h" -static int radeon_ctx_set_bo_new(struct radeon_ctx *ctx, struct radeon_bo *bo, unsigned state_id) +int radeon_ctx_set_bo_new(struct radeon_ctx *ctx, struct radeon_bo *bo) { - ctx->bo[ctx->nbo].bo = bo; - ctx->bo[ctx->nbo].bo_flushed = 0; - ctx->bo[ctx->nbo].state_id = state_id; + void *ptr; + + ptr = realloc(ctx->bo, sizeof(struct radeon_bo) * (ctx->nbo + 1)); + if (ptr == NULL) { + return -ENOMEM; + } + ctx->bo = ptr; + ctx->bo[ctx->nbo] = bo; ctx->nbo++; return 0; } -void radeon_ctx_clear(struct radeon_ctx *ctx) +struct radeon_bo *radeon_ctx_get_bo(struct radeon_ctx *ctx, unsigned reloc) { + struct radeon_cs_reloc *greloc; unsigned i; - /* FIXME somethings is wrong, it should be safe to - * delete bo here, kernel should postpone bo deletion - * until bo is no longer referenced by cs (through the - * fence association) - */ - for (i = 0; i < 50; i++) { - usleep(10); + greloc = (void *)(((u8 *)ctx->reloc) + reloc * 4); + for (i = 0; i < ctx->nbo; i++) { + if (ctx->bo[i]->handle == greloc->handle) { + return radeon_bo_incref(ctx->radeon, ctx->bo[i]); + } } + fprintf(stderr, "%s no bo for reloc[%d 0x%08X] %d\n", __func__, reloc, greloc->handle, ctx->nbo); + return NULL; +} + +void radeon_ctx_get_placement(struct radeon_ctx *ctx, unsigned reloc, u32 *placement) +{ + struct radeon_cs_reloc *greloc; + unsigned i; + + placement[0] = 0; + placement[1] = 0; + greloc = (void *)(((u8 *)ctx->reloc) + reloc * 4); for (i = 0; i < ctx->nbo; i++) { - ctx->bo[i].bo = radeon_bo_decref(ctx->radeon, ctx->bo[i].bo); + if (ctx->bo[i]->handle == greloc->handle) { + placement[0] = greloc->read_domain | greloc->write_domain; + placement[1] = placement[0]; + return; + } } - ctx->id = 0; - ctx->npm4 = RADEON_CTX_MAX_PM4; - ctx->nreloc = 0; - ctx->nbo = 0; - memset(ctx->state_crc32, 0, ctx->radeon->nstate * 4); } struct radeon_ctx *radeon_ctx(struct radeon *radeon) @@ -72,25 +86,6 @@ struct radeon_ctx *radeon_ctx(struct radeon *radeon) if (ctx == NULL) return NULL; ctx->radeon = radeon_incref(radeon); - ctx->max_bo = 4096; - ctx->max_reloc = 4096; - ctx->pm4 = malloc(RADEON_CTX_MAX_PM4 * 4); - if (ctx->pm4 == NULL) { - return radeon_ctx_decref(ctx); - } - ctx->state_crc32 = malloc(ctx->radeon->nstate * 4); - if (ctx->state_crc32 == NULL) { - return radeon_ctx_decref(ctx); - } - ctx->bo = malloc(ctx->max_bo * sizeof(struct radeon_ctx_bo)); - if (ctx->bo == NULL) { - return radeon_ctx_decref(ctx); - } - ctx->reloc = malloc(ctx->max_reloc * sizeof(struct radeon_cs_reloc)); - if (ctx->reloc == NULL) { - return radeon_ctx_decref(ctx); - } - radeon_ctx_clear(ctx); return ctx; } @@ -102,33 +97,31 @@ struct radeon_ctx *radeon_ctx_incref(struct radeon_ctx *ctx) struct radeon_ctx *radeon_ctx_decref(struct radeon_ctx *ctx) { + unsigned i; + if (ctx == NULL) return NULL; if (--ctx->refcount > 0) { return NULL; } + for (i = 0; i < ctx->ndraw; i++) { + ctx->draw[i] = radeon_draw_decref(ctx->draw[i]); + } + for (i = 0; i < ctx->nbo; i++) { + ctx->bo[i] = radeon_bo_decref(ctx->radeon, ctx->bo[i]); + } ctx->radeon = radeon_decref(ctx->radeon); + free(ctx->state); + free(ctx->draw); free(ctx->bo); free(ctx->pm4); free(ctx->reloc); - free(ctx->state_crc32); memset(ctx, 0, sizeof(*ctx)); free(ctx); return NULL; } -static int radeon_ctx_bo_id(struct radeon_ctx *ctx, struct radeon_bo *bo) -{ - unsigned i; - - for (i = 0; i < ctx->nbo; i++) { - if (bo == ctx->bo[i].bo) - return i; - } - return -1; -} - static int radeon_ctx_state_bo(struct radeon_ctx *ctx, struct radeon_state *state) { unsigned i, j; @@ -138,15 +131,12 @@ static int radeon_ctx_state_bo(struct radeon_ctx *ctx, struct radeon_state *stat return 0; for (i = 0; i < state->nbo; i++) { for (j = 0; j < ctx->nbo; j++) { - if (state->bo[i] == ctx->bo[j].bo) + if (state->bo[i] == ctx->bo[j]) break; } if (j == ctx->nbo) { - if (ctx->nbo >= ctx->max_bo) { - return -EBUSY; - } radeon_bo_incref(ctx->radeon, state->bo[i]); - r = radeon_ctx_set_bo_new(ctx, state->bo[i], state->id); + r = radeon_ctx_set_bo_new(ctx, state->bo[i]); if (r) return r; } @@ -154,6 +144,7 @@ static int radeon_ctx_state_bo(struct radeon_ctx *ctx, struct radeon_state *stat return 0; } + int radeon_ctx_submit(struct radeon_ctx *ctx) { struct drm_radeon_cs drmib; @@ -161,17 +152,17 @@ int radeon_ctx_submit(struct radeon_ctx *ctx) uint64_t chunk_array[2]; int r = 0; - if (!ctx->id) + if (!ctx->cpm4) return 0; #if 0 - for (r = 0; r < ctx->id; r++) { + for (r = 0; r < ctx->cpm4; r++) { fprintf(stderr, "0x%08X\n", ctx->pm4[r]); } #endif drmib.num_chunks = 2; drmib.chunks = (uint64_t)(uintptr_t)chunk_array; chunks[0].chunk_id = RADEON_CHUNK_ID_IB; - chunks[0].length_dw = ctx->id; + chunks[0].length_dw = ctx->cpm4; chunks[0].chunk_data = (uint64_t)(uintptr_t)ctx->pm4; chunks[1].chunk_id = RADEON_CHUNK_ID_RELOCS; chunks[1].length_dw = ctx->nreloc * sizeof(struct radeon_cs_reloc) / 4; @@ -185,10 +176,11 @@ int radeon_ctx_submit(struct radeon_ctx *ctx) return r; } -int radeon_ctx_reloc(struct radeon_ctx *ctx, struct radeon_bo *bo, +static int radeon_ctx_reloc(struct radeon_ctx *ctx, struct radeon_bo *bo, unsigned id, unsigned *placement) { unsigned i; + struct radeon_cs_reloc *ptr; for (i = 0; i < ctx->nreloc; i++) { if (ctx->reloc[i].handle == bo->handle) { @@ -196,13 +188,14 @@ int radeon_ctx_reloc(struct radeon_ctx *ctx, struct radeon_bo *bo, return 0; } } - if (ctx->nreloc >= ctx->max_reloc) { - return -EBUSY; - } - ctx->reloc[ctx->nreloc].handle = bo->handle; - ctx->reloc[ctx->nreloc].read_domain = placement[0] | placement [1]; - ctx->reloc[ctx->nreloc].write_domain = placement[0] | placement [1]; - ctx->reloc[ctx->nreloc].flags = 0; + ptr = realloc(ctx->reloc, sizeof(struct radeon_cs_reloc) * (ctx->nreloc + 1)); + if (ptr == NULL) + return -ENOMEM; + ctx->reloc = ptr; + ptr[ctx->nreloc].handle = bo->handle; + ptr[ctx->nreloc].read_domain = placement[0] | placement [1]; + ptr[ctx->nreloc].write_domain = placement[0] | placement [1]; + ptr[ctx->nreloc].flags = 0; ctx->pm4[id] = ctx->nreloc * sizeof(struct radeon_cs_reloc) / 4; ctx->nreloc++; return 0; @@ -210,90 +203,75 @@ int radeon_ctx_reloc(struct radeon_ctx *ctx, struct radeon_bo *bo, static int radeon_ctx_state_schedule(struct radeon_ctx *ctx, struct radeon_state *state) { - unsigned i, rid, cid; - u32 flags; - int r, bo_id[4]; + unsigned i, rid, bid, cid; + int r; if (state == NULL) return 0; - for (i = 0; i < state->nbo; i++) { - bo_id[i] = radeon_ctx_bo_id(ctx, state->bo[i]); - if (bo_id[i] < 0) { - return -EINVAL; - } - flags = (~ctx->bo[bo_id[i]].bo_flushed) & ctx->radeon->type[state->id].flush_flags; - if (flags) { - r = ctx->radeon->bo_flush(ctx, state->bo[i], flags, &state->placement[i * 2]); - if (r) { - return r; - } - } - ctx->bo[bo_id[i]].bo_flushed |= ctx->radeon->type[state->id].flush_flags; - } - if ((ctx->radeon->type[state->id].header_cpm4 + state->cpm4) > ctx->npm4) { - /* need to flush */ - return -EBUSY; - } - memcpy(&ctx->pm4[ctx->id], ctx->radeon->type[state->id].header_pm4, ctx->radeon->type[state->id].header_cpm4 * 4); - ctx->id += ctx->radeon->type[state->id].header_cpm4; - ctx->npm4 -= ctx->radeon->type[state->id].header_cpm4; - memcpy(&ctx->pm4[ctx->id], state->states, state->cpm4 * 4); - for (i = 0; i < state->nbo; i++) { + memcpy(&ctx->pm4[ctx->id], state->pm4, state->cpm4 * 4); + for (i = 0; i < state->nreloc; i++) { rid = state->reloc_pm4_id[i]; + bid = state->reloc_bo_id[i]; cid = ctx->id + rid; - r = radeon_ctx_reloc(ctx, state->bo[i], cid, - &state->placement[i * 2]); + r = radeon_ctx_reloc(ctx, state->bo[bid], cid, + &state->placement[bid * 2]); if (r) { - fprintf(stderr, "%s state %d failed to reloc\n", __func__, state->id); + fprintf(stderr, "%s state %d failed to reloc\n", __func__, state->type); return r; } } ctx->id += state->cpm4; - ctx->npm4 -= state->cpm4; - for (i = 0; i < state->nbo; i++) { - ctx->bo[bo_id[i]].bo_flushed &= ~ctx->radeon->type[state->id].dirty_flags; - } return 0; } int radeon_ctx_set_query_state(struct radeon_ctx *ctx, struct radeon_state *state) { - unsigned ndw = 0; + void *tmp; int r = 0; + /* !!! ONLY ACCEPT QUERY STATE HERE !!! */ + if (state->type != R600_QUERY_BEGIN_TYPE && state->type != R600_QUERY_END_TYPE) { + return -EINVAL; + } r = radeon_state_pm4(state); if (r) return r; - - /* !!! ONLY ACCEPT QUERY STATE HERE !!! */ - ndw = state->cpm4 + ctx->radeon->type[state->id].header_cpm4; - switch (state->id) { - case R600_QUERY_BEGIN: - /* account QUERY_END at same time of QUERY_BEGIN so we know we - * have room left for QUERY_END - */ - if ((ndw * 2) > ctx->npm4) { - /* need to flush */ - return -EBUSY; - } - ctx->npm4 -= ndw; - break; - case R600_QUERY_END: - /* add again ndw from previous accounting */ - ctx->npm4 += ndw; - break; - default: + if ((ctx->draw_cpm4 + state->cpm4) > RADEON_CTX_MAX_PM4) { + /* need to flush */ + return -EBUSY; + } + if (state->cpm4 >= RADEON_CTX_MAX_PM4) { + fprintf(stderr, "%s single state too big %d, max %d\n", + __func__, state->cpm4, RADEON_CTX_MAX_PM4); return -EINVAL; } - - return radeon_ctx_state_schedule(ctx, state); + tmp = realloc(ctx->state, (ctx->nstate + 1) * sizeof(void*)); + if (tmp == NULL) + return -ENOMEM; + ctx->state = tmp; + ctx->state[ctx->nstate++] = radeon_state_incref(state); + /* BEGIN/END query are balanced in the same cs so account for END + * END query when scheduling BEGIN query + */ + if (state->type == R600_QUERY_BEGIN_TYPE) { + ctx->draw_cpm4 += state->cpm4 * 2; + } + return 0; } -int radeon_ctx_set_draw(struct radeon_ctx *ctx, struct radeon_draw *draw) +int radeon_ctx_set_draw_new(struct radeon_ctx *ctx, struct radeon_draw *draw) { - unsigned i, previous_id; + struct radeon_draw *pdraw = NULL; + struct radeon_draw **ndraw; + struct radeon_state *nstate, *ostate; + unsigned cpm4, i, cstate; + void *tmp; int r = 0; + ndraw = realloc(ctx->draw, sizeof(void*) * (ctx->ndraw + 1)); + if (ndraw == NULL) + return -ENOMEM; + ctx->draw = ndraw; for (i = 0; i < draw->nstate; i++) { r = radeon_ctx_state_bo(ctx, draw->state[i]); if (r) @@ -307,17 +285,76 @@ int radeon_ctx_set_draw(struct radeon_ctx *ctx, struct radeon_draw *draw) __func__, draw->cpm4, RADEON_CTX_MAX_PM4); return -EINVAL; } - previous_id = ctx->id; - for (i = 0; i < draw->nstate; i++) { - /* FIXME always force draw state to schedule */ - if (draw->state[i] && draw->state[i]->pm4_crc != ctx->state_crc32[draw->state[i]->id]) { - r = radeon_ctx_state_schedule(ctx, draw->state[i]); - if (r) { - ctx->id = previous_id; - return r; + tmp = realloc(ctx->state, (ctx->nstate + draw->nstate) * sizeof(void*)); + if (tmp == NULL) + return -ENOMEM; + ctx->state = tmp; + pdraw = ctx->cdraw; + for (i = 0, cpm4 = 0, cstate = ctx->nstate; i < draw->nstate - 1; i++) { + nstate = draw->state[i]; + if (nstate) { + if (pdraw && pdraw->state[i]) { + ostate = pdraw->state[i]; + if (ostate->pm4_crc != nstate->pm4_crc) { + ctx->state[cstate++] = nstate; + cpm4 += nstate->cpm4; + } + } else { + ctx->state[cstate++] = nstate; + cpm4 += nstate->cpm4; } } } + /* The last state is the draw state always add it */ + if (draw->state[i] == NULL) { + fprintf(stderr, "%s no draw command\n", __func__); + return -EINVAL; + } + ctx->state[cstate++] = draw->state[i]; + cpm4 += draw->state[i]->cpm4; + if ((ctx->draw_cpm4 + cpm4) > RADEON_CTX_MAX_PM4) { + /* need to flush */ + return -EBUSY; + } + ctx->draw_cpm4 += cpm4; + ctx->nstate = cstate; + ctx->draw[ctx->ndraw++] = draw; + ctx->cdraw = draw; + return 0; +} + +int radeon_ctx_set_draw(struct radeon_ctx *ctx, struct radeon_draw *draw) +{ + int r; + + radeon_draw_incref(draw); + r = radeon_ctx_set_draw_new(ctx, draw); + if (r) + radeon_draw_decref(draw); + return r; +} + +int radeon_ctx_pm4(struct radeon_ctx *ctx) +{ + unsigned i; + int r; + + free(ctx->pm4); + ctx->cpm4 = 0; + ctx->pm4 = malloc(ctx->draw_cpm4 * 4); + if (ctx->pm4 == NULL) + return -EINVAL; + for (i = 0, ctx->id = 0; i < ctx->nstate; i++) { + r = radeon_ctx_state_schedule(ctx, ctx->state[i]); + if (r) + return r; + } + if (ctx->id != ctx->draw_cpm4) { + fprintf(stderr, "%s miss predicted pm4 size %d for %d\n", + __func__, ctx->draw_cpm4, ctx->id); + return -EINVAL; + } + ctx->cpm4 = ctx->draw_cpm4; return 0; } @@ -347,8 +384,8 @@ printf("%d relocs\n", ctx->nreloc); bof_decref(blob); blob = NULL; /* dump cs */ -printf("%d pm4\n", ctx->id); - blob = bof_blob(ctx->id * 4, ctx->pm4); +printf("%d pm4\n", ctx->cpm4); + blob = bof_blob(ctx->cpm4 * 4, ctx->pm4); if (blob == NULL) goto out_err; if (bof_object_set(root, "pm4", blob)) @@ -363,23 +400,23 @@ printf("%d pm4\n", ctx->id); bo = bof_object(); if (bo == NULL) goto out_err; - size = bof_int32(ctx->bo[i].bo->size); + size = bof_int32(ctx->bo[i]->size); if (size == NULL) goto out_err; if (bof_object_set(bo, "size", size)) goto out_err; bof_decref(size); size = NULL; - handle = bof_int32(ctx->bo[i].bo->handle); + handle = bof_int32(ctx->bo[i]->handle); if (handle == NULL) goto out_err; if (bof_object_set(bo, "handle", handle)) goto out_err; bof_decref(handle); handle = NULL; - radeon_bo_map(ctx->radeon, ctx->bo[i].bo); - blob = bof_blob(ctx->bo[i].bo->size, ctx->bo[i].bo->data); - radeon_bo_unmap(ctx->radeon, ctx->bo[i].bo); + radeon_bo_map(ctx->radeon, ctx->bo[i]); + blob = bof_blob(ctx->bo[i]->size, ctx->bo[i]->data); + radeon_bo_unmap(ctx->radeon, ctx->bo[i]); if (blob == NULL) goto out_err; if (bof_object_set(bo, "data", blob)) diff --git a/src/gallium/winsys/r600/drm/radeon_draw.c b/src/gallium/winsys/r600/drm/radeon_draw.c index 1b4e557f28..4413ed79fb 100644 --- a/src/gallium/winsys/r600/drm/radeon_draw.c +++ b/src/gallium/winsys/r600/drm/radeon_draw.c @@ -76,6 +76,8 @@ int radeon_draw_set_new(struct radeon_draw *draw, struct radeon_state *state) { if (state == NULL) return 0; + if (state->type >= draw->radeon->ntype) + return -EINVAL; draw->state[state->id] = radeon_state_decref(draw->state[state->id]); draw->state[state->id] = state; return 0; @@ -100,7 +102,6 @@ int radeon_draw_check(struct radeon_draw *draw) for (i = 0, draw->cpm4 = 0; i < draw->nstate; i++) { if (draw->state[i]) { draw->cpm4 += draw->state[i]->cpm4; - draw->cpm4 += draw->radeon->type[draw->state[i]->id].header_cpm4; } } return 0; diff --git a/src/gallium/winsys/r600/drm/radeon_priv.h b/src/gallium/winsys/r600/drm/radeon_priv.h index 469a5dce01..96c0d060f7 100644 --- a/src/gallium/winsys/r600/drm/radeon_priv.h +++ b/src/gallium/winsys/r600/drm/radeon_priv.h @@ -30,26 +30,34 @@ struct radeon_ctx; * radeon functions */ typedef int (*radeon_state_pm4_t)(struct radeon_state *state); +struct radeon_register { + unsigned offset; + unsigned need_reloc; + unsigned bo_id; + char name[64]; +}; struct radeon_type { - const u32 *header_pm4; - const u32 header_cpm4; - const u32 *state_pm4; - const u32 state_cpm4; - const u32 flush_flags; - const u32 dirty_flags; + unsigned npm4; + unsigned id; + unsigned range_start; + unsigned range_end; + unsigned stride; + unsigned immediate; + char name[64]; + unsigned nstates; + radeon_state_pm4_t pm4; + const struct radeon_register *regs; }; -typedef int (*radeon_ctx_bo_flush_t)(struct radeon_ctx *ctx, struct radeon_bo *bo, u32 flags, u32 *placement); - struct radeon { int fd; int refcount; unsigned device; unsigned family; unsigned nstate; + unsigned ntype; const struct radeon_type *type; - radeon_ctx_bo_flush_t bo_flush; }; extern struct radeon *radeon_new(int fd, unsigned device); @@ -60,9 +68,12 @@ extern int radeon_is_family_compatible(unsigned family1, unsigned family2); extern int radeon_reg_id(struct radeon *radeon, unsigned offset, unsigned *typeid, unsigned *stateid, unsigned *id); extern unsigned radeon_type_from_id(struct radeon *radeon, unsigned id); + +int radeon_ctx_set_bo_new(struct radeon_ctx *ctx, struct radeon_bo *bo); +struct radeon_bo *radeon_ctx_get_bo(struct radeon_ctx *ctx, unsigned reloc); +void radeon_ctx_get_placement(struct radeon_ctx *ctx, unsigned reloc, u32 *placement); +int radeon_ctx_set_draw_new(struct radeon_ctx *ctx, struct radeon_draw *draw); int radeon_ctx_draw(struct radeon_ctx *ctx); -int radeon_ctx_reloc(struct radeon_ctx *ctx, struct radeon_bo *bo, - unsigned id, unsigned *placement); /* * r600/r700 context functions @@ -79,6 +90,7 @@ extern int radeon_state_register_set(struct radeon_state *state, unsigned offset extern struct radeon_state *radeon_state_duplicate(struct radeon_state *state); extern int radeon_state_replace_always(struct radeon_state *ostate, struct radeon_state *nstate); extern int radeon_state_pm4_generic(struct radeon_state *state); +extern int radeon_state_reloc(struct radeon_state *state, unsigned id, unsigned bo_id); /* * radeon draw functions diff --git a/src/gallium/winsys/r600/drm/radeon_state.c b/src/gallium/winsys/r600/drm/radeon_state.c index c60b12ef67..308288557a 100644 --- a/src/gallium/winsys/r600/drm/radeon_state.c +++ b/src/gallium/winsys/r600/drm/radeon_state.c @@ -32,29 +32,52 @@ /* * state core functions */ -struct radeon_state *radeon_state(struct radeon *radeon, u32 id) +struct radeon_state *radeon_state(struct radeon *radeon, u32 type, u32 id) { struct radeon_state *state; + if (type > radeon->ntype) { + fprintf(stderr, "%s invalid type %d\n", __func__, type); + return NULL; + } + if (id > radeon->nstate) { + fprintf(stderr, "%s invalid state id %d\n", __func__, id); + return NULL; + } state = calloc(1, sizeof(*state)); if (state == NULL) return NULL; state->radeon = radeon; + state->type = type; state->id = id; state->refcount = 1; - state->cpm4 = radeon->type[id].state_cpm4; - memcpy(state->states, radeon->type[id].state_pm4, radeon->type[id].state_cpm4 * 4); + state->npm4 = radeon->type[type].npm4; + state->nstates = radeon->type[type].nstates; + state->states = calloc(1, state->nstates * 4); + state->pm4 = calloc(1, radeon->type[type].npm4 * 4); + if (state->states == NULL || state->pm4 == NULL) { + radeon_state_decref(state); + return NULL; + } return state; } struct radeon_state *radeon_state_duplicate(struct radeon_state *state) { - struct radeon_state *nstate = radeon_state(state->radeon, state->id); + struct radeon_state *nstate = radeon_state(state->radeon, state->type, state->id); unsigned i; if (state == NULL) return NULL; - *nstate = *state; + nstate->cpm4 = state->cpm4; + nstate->nbo = state->nbo; + nstate->nreloc = state->nreloc; + memcpy(nstate->states, state->states, state->nstates * 4); + memcpy(nstate->pm4, state->pm4, state->npm4 * 4); + memcpy(nstate->placement, state->placement, 8 * 4); + memcpy(nstate->reloc_pm4_id, state->reloc_pm4_id, 8 * 4); + memcpy(nstate->reloc_bo_id, state->reloc_bo_id, 8 * 4); + memcpy(nstate->bo_dirty, state->bo_dirty, 4 * 4); for (i = 0; i < state->nbo; i++) { nstate->bo[i] = radeon_bo_incref(state->radeon, state->bo[i]); } @@ -79,6 +102,9 @@ struct radeon_state *radeon_state_decref(struct radeon_state *state) for (i = 0; i < state->nbo; i++) { state->bo[i] = radeon_bo_decref(state->radeon, state->bo[i]); } + free(state->immd); + free(state->states); + free(state->pm4); memset(state, 0, sizeof(*state)); free(state); return NULL; @@ -119,8 +145,24 @@ static u32 crc32(void *d, size_t len) int radeon_state_pm4(struct radeon_state *state) { - if (state == NULL) + int r; + + if (state == NULL || state->cpm4) return 0; - state->pm4_crc = crc32(state->states, state->cpm4 * 4); + r = state->radeon->type[state->type].pm4(state); + if (r) { + fprintf(stderr, "%s failed to build PM4 for state(%d %d)\n", + __func__, state->type, state->id); + return r; + } + state->pm4_crc = crc32(state->pm4, state->cpm4 * 4); + return 0; +} + +int radeon_state_reloc(struct radeon_state *state, unsigned id, unsigned bo_id) +{ + state->reloc_pm4_id[state->nreloc] = id; + state->reloc_bo_id[state->nreloc] = bo_id; + state->nreloc++; return 0; } -- cgit v1.2.3 From 67ffbbbb5db88f936d54bacab971d20e44a83da1 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Thu, 26 Aug 2010 23:07:45 -0700 Subject: Fix typo in function name "shading_laguage_version". --- src/mesa/main/getstring.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/mesa/main/getstring.c b/src/mesa/main/getstring.c index 7961ad7e7d..5e4fcd599c 100644 --- a/src/mesa/main/getstring.c +++ b/src/mesa/main/getstring.c @@ -31,7 +31,7 @@ #include "extensions.h" static const GLubyte * -shading_laguage_version(GLcontext *ctx) +shading_language_version(GLcontext *ctx) { switch (ctx->API) { #if FEATURE_ARB_shading_language_100 @@ -98,7 +98,7 @@ _mesa_GetString( GLenum name ) return (const GLubyte *) ctx->Extensions.String; #if FEATURE_ARB_shading_language_100 || FEATURE_ES2 case GL_SHADING_LANGUAGE_VERSION: - return shading_laguage_version(ctx); + return shading_language_version(ctx); #endif #if FEATURE_NV_fragment_program || FEATURE_ARB_fragment_program || \ FEATURE_NV_vertex_program || FEATURE_ARB_vertex_program -- cgit v1.2.3 From 677623a6c80c96dc6b2c8f49fbb8bddff1054a77 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Fri, 27 Aug 2010 00:04:50 -0700 Subject: r300g: Include missing header in r300_texture.h. Include p_compiler.h for uint32_t and boolean symbols. --- src/gallium/drivers/r300/r300_texture.h | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_texture.h b/src/gallium/drivers/r300/r300_texture.h index a4524320fd..5a371a54a8 100644 --- a/src/gallium/drivers/r300/r300_texture.h +++ b/src/gallium/drivers/r300/r300_texture.h @@ -23,6 +23,7 @@ #ifndef R300_TEXTURE_H #define R300_TEXTURE_H +#include "pipe/p_compiler.h" #include "pipe/p_format.h" struct pipe_screen; -- cgit v1.2.3 From 1b83ede8cc68c01eaade6ceffab00cef5a1fb2df Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Fri, 27 Aug 2010 00:07:38 -0700 Subject: graw: Include missing header in graw.h. Include p_compiler.h for PUBLIC symbol. --- src/gallium/include/state_tracker/graw.h | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/gallium/include/state_tracker/graw.h b/src/gallium/include/state_tracker/graw.h index 5eaa323085..6a99b234aa 100644 --- a/src/gallium/include/state_tracker/graw.h +++ b/src/gallium/include/state_tracker/graw.h @@ -41,6 +41,7 @@ * those for parsing text representations of TGSI shaders. */ +#include "pipe/p_compiler.h" #include "pipe/p_format.h" struct pipe_screen; -- cgit v1.2.3 From 43ed82bdb2feddd38884514dc00c348d7f1ec0f9 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Fri, 27 Aug 2010 00:15:04 -0700 Subject: gallium: Remove unnecessary header from p_format.h. Remove p_compiler.h. --- src/gallium/include/pipe/p_format.h | 2 -- 1 file changed, 2 deletions(-) (limited to 'src') diff --git a/src/gallium/include/pipe/p_format.h b/src/gallium/include/pipe/p_format.h index 436c3f627a..06412f4894 100644 --- a/src/gallium/include/pipe/p_format.h +++ b/src/gallium/include/pipe/p_format.h @@ -29,8 +29,6 @@ #ifndef PIPE_FORMAT_H #define PIPE_FORMAT_H -#include "p_compiler.h" - #ifdef __cplusplus extern "C" { #endif -- cgit v1.2.3 From 0b9b8694d9c3295436561331f03f0d59effe26c4 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Fri, 27 Aug 2010 00:26:59 -0700 Subject: tgsi: Include missing header in tgsi_dump.h. Include p_compiler.h for uint symbol. --- src/gallium/auxiliary/tgsi/tgsi_dump.h | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/gallium/auxiliary/tgsi/tgsi_dump.h b/src/gallium/auxiliary/tgsi/tgsi_dump.h index 4cd27317b3..dd78b36100 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_dump.h +++ b/src/gallium/auxiliary/tgsi/tgsi_dump.h @@ -28,6 +28,7 @@ #ifndef TGSI_DUMP_H #define TGSI_DUMP_H +#include "pipe/p_compiler.h" #include "pipe/p_shader_tokens.h" #if defined __cplusplus -- cgit v1.2.3 From 57421cb464c63ed65f5e0438ad4c13c527f41118 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Fri, 27 Aug 2010 00:31:27 -0700 Subject: tgsi: Include missing header in tgsi_info.h. Include p_compiler.h for uint symbol. --- src/gallium/auxiliary/tgsi/tgsi_info.h | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/gallium/auxiliary/tgsi/tgsi_info.h b/src/gallium/auxiliary/tgsi/tgsi_info.h index 50248884fd..1992d11bbe 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_info.h +++ b/src/gallium/auxiliary/tgsi/tgsi_info.h @@ -28,6 +28,7 @@ #ifndef TGSI_INFO_H #define TGSI_INFO_H +#include "pipe/p_compiler.h" #include "pipe/p_shader_tokens.h" #if defined __cplusplus -- cgit v1.2.3 From ec21ed1ce7963551d824b8b1f4c4ffa8d6cb3363 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Fri, 27 Aug 2010 00:34:32 -0700 Subject: tgsi: Include missing header in tgsi_parse.h. Include p_compiler.h for boolean and INLINE symbols. --- src/gallium/auxiliary/tgsi/tgsi_parse.h | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/gallium/auxiliary/tgsi/tgsi_parse.h b/src/gallium/auxiliary/tgsi/tgsi_parse.h index bb2bb0d3d3..d4df585176 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_parse.h +++ b/src/gallium/auxiliary/tgsi/tgsi_parse.h @@ -28,6 +28,7 @@ #ifndef TGSI_PARSE_H #define TGSI_PARSE_H +#include "pipe/p_compiler.h" #include "pipe/p_shader_tokens.h" #if defined __cplusplus -- cgit v1.2.3 From af8f037db2cea78e6c5a1ed5fb63fcb90cebdd9b Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Fri, 27 Aug 2010 00:40:42 -0700 Subject: gallium: Remove unnecessary header from p_shader_tokens.h. Remove p_compiler.h. --- src/gallium/include/pipe/p_shader_tokens.h | 2 -- 1 file changed, 2 deletions(-) (limited to 'src') diff --git a/src/gallium/include/pipe/p_shader_tokens.h b/src/gallium/include/pipe/p_shader_tokens.h index 9df20ea858..c4bd17e92b 100644 --- a/src/gallium/include/pipe/p_shader_tokens.h +++ b/src/gallium/include/pipe/p_shader_tokens.h @@ -33,8 +33,6 @@ extern "C" { #endif -#include "p_compiler.h" - struct tgsi_header { -- cgit v1.2.3 From 0be0ad5d58806bc12ec2c7bb3c00e7f8c7a6d6c4 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Sun, 22 Aug 2010 10:57:12 +0100 Subject: llvmpipe: intrinsics version of triangle coeficient calculation Looks nice, but makes almost no impact on performance - maybe a percent or so in isosurf, nothing elsewhere. May be of use later on. --- src/gallium/drivers/llvmpipe/SConscript | 2 + src/gallium/drivers/llvmpipe/lp_setup_coef.c | 258 +++++++++++++++ src/gallium/drivers/llvmpipe/lp_setup_coef.h | 61 ++++ .../drivers/llvmpipe/lp_setup_coef_intrin.c | 208 ++++++++++++ src/gallium/drivers/llvmpipe/lp_setup_tri.c | 348 +++------------------ 5 files changed, 577 insertions(+), 300 deletions(-) create mode 100644 src/gallium/drivers/llvmpipe/lp_setup_coef.c create mode 100644 src/gallium/drivers/llvmpipe/lp_setup_coef.h create mode 100644 src/gallium/drivers/llvmpipe/lp_setup_coef_intrin.c (limited to 'src') diff --git a/src/gallium/drivers/llvmpipe/SConscript b/src/gallium/drivers/llvmpipe/SConscript index 5583fca38e..8d57db72cf 100644 --- a/src/gallium/drivers/llvmpipe/SConscript +++ b/src/gallium/drivers/llvmpipe/SConscript @@ -63,6 +63,8 @@ llvmpipe = env.ConvenienceLibrary( 'lp_setup_line.c', 'lp_setup_point.c', 'lp_setup_tri.c', + 'lp_setup_coef.c', + 'lp_setup_coef_intrin.c', 'lp_setup_vbuf.c', 'lp_state_blend.c', 'lp_state_clip.c', diff --git a/src/gallium/drivers/llvmpipe/lp_setup_coef.c b/src/gallium/drivers/llvmpipe/lp_setup_coef.c new file mode 100644 index 0000000000..95e3e8fffe --- /dev/null +++ b/src/gallium/drivers/llvmpipe/lp_setup_coef.c @@ -0,0 +1,258 @@ +/************************************************************************** + * + * Copyright 2010, VMware. + * 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, 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 VMWARE AND/OR ITS 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. + * + **************************************************************************/ + +/* + * Binning code for triangles + */ + +#include "util/u_math.h" +#include "util/u_memory.h" +#include "lp_perf.h" +#include "lp_setup_context.h" +#include "lp_setup_coef.h" +#include "lp_rast.h" +#include "lp_state_fs.h" + +#if !defined(PIPE_ARCH_SSE) + +/** + * Compute a0 for a constant-valued coefficient (GL_FLAT shading). + */ +static void constant_coef( struct lp_rast_shader_inputs *inputs, + unsigned slot, + const float value, + unsigned i ) +{ + inputs->a0[slot][i] = value; + inputs->dadx[slot][i] = 0.0f; + inputs->dady[slot][i] = 0.0f; +} + + + +static void linear_coef( struct lp_rast_shader_inputs *inputs, + const struct lp_tri_info *info, + unsigned slot, + unsigned vert_attr, + unsigned i) +{ + float a0 = info->v0[vert_attr][i]; + float a1 = info->v1[vert_attr][i]; + float a2 = info->v2[vert_attr][i]; + + float da01 = a0 - a1; + float da20 = a2 - a0; + float dadx = (da01 * info->dy20_ooa - info->dy01_ooa * da20); + float dady = (da20 * info->dx01_ooa - info->dx20_ooa * da01); + + inputs->dadx[slot][i] = dadx; + inputs->dady[slot][i] = dady; + + /* calculate a0 as the value which would be sampled for the + * fragment at (0,0), taking into account that we want to sample at + * pixel centers, in other words (0.5, 0.5). + * + * this is neat but unfortunately not a good way to do things for + * triangles with very large values of dadx or dady as it will + * result in the subtraction and re-addition from a0 of a very + * large number, which means we'll end up loosing a lot of the + * fractional bits and precision from a0. the way to fix this is + * to define a0 as the sample at a pixel center somewhere near vmin + * instead - i'll switch to this later. + */ + inputs->a0[slot][i] = a0 - (dadx * info->x0_center + + dady * info->y0_center); +} + + +/** + * Compute a0, dadx and dady for a perspective-corrected interpolant, + * for a triangle. + * We basically multiply the vertex value by 1/w before computing + * the plane coefficients (a0, dadx, dady). + * Later, when we compute the value at a particular fragment position we'll + * divide the interpolated value by the interpolated W at that fragment. + */ +static void perspective_coef( struct lp_rast_shader_inputs *inputs, + const struct lp_tri_info *info, + unsigned slot, + unsigned vert_attr, + unsigned i) +{ + /* premultiply by 1/w (v[0][3] is always 1/w): + */ + float a0 = info->v0[vert_attr][i] * info->v0[0][3]; + float a1 = info->v1[vert_attr][i] * info->v1[0][3]; + float a2 = info->v2[vert_attr][i] * info->v2[0][3]; + float da01 = a0 - a1; + float da20 = a2 - a0; + float dadx = da01 * info->dy20_ooa - info->dy01_ooa * da20; + float dady = da20 * info->dx01_ooa - info->dx20_ooa * da01; + + inputs->dadx[slot][i] = dadx; + inputs->dady[slot][i] = dady; + inputs->a0[slot][i] = a0 - (dadx * info->x0_center + + dady * info->y0_center); +} + + +/** + * Special coefficient setup for gl_FragCoord. + * X and Y are trivial + * Z and W are copied from position_coef which should have already been computed. + * We could do a bit less work if we'd examine gl_FragCoord's swizzle mask. + */ +static void +setup_fragcoord_coef(struct lp_rast_shader_inputs *inputs, + const struct lp_tri_info *info, + unsigned slot, + unsigned usage_mask) +{ + /*X*/ + if (usage_mask & TGSI_WRITEMASK_X) { + inputs->a0[slot][0] = 0.0; + inputs->dadx[slot][0] = 1.0; + inputs->dady[slot][0] = 0.0; + } + + /*Y*/ + if (usage_mask & TGSI_WRITEMASK_Y) { + inputs->a0[slot][1] = 0.0; + inputs->dadx[slot][1] = 0.0; + inputs->dady[slot][1] = 1.0; + } + + /*Z*/ + if (usage_mask & TGSI_WRITEMASK_Z) { + linear_coef(inputs, info, slot, 0, 2); + } + + /*W*/ + if (usage_mask & TGSI_WRITEMASK_W) { + linear_coef(inputs, info, slot, 0, 3); + } +} + + +/** + * Setup the fragment input attribute with the front-facing value. + * \param frontface is the triangle front facing? + */ +static void setup_facing_coef( struct lp_rast_shader_inputs *inputs, + unsigned slot, + boolean frontface, + unsigned usage_mask) +{ + /* convert TRUE to 1.0 and FALSE to -1.0 */ + if (usage_mask & TGSI_WRITEMASK_X) + constant_coef( inputs, slot, 2.0f * frontface - 1.0f, 0 ); + + if (usage_mask & TGSI_WRITEMASK_Y) + constant_coef( inputs, slot, 0.0f, 1 ); /* wasted */ + + if (usage_mask & TGSI_WRITEMASK_Z) + constant_coef( inputs, slot, 0.0f, 2 ); /* wasted */ + + if (usage_mask & TGSI_WRITEMASK_W) + constant_coef( inputs, slot, 0.0f, 3 ); /* wasted */ +} + + +/** + * Compute the tri->coef[] array dadx, dady, a0 values. + */ +void lp_setup_tri_coef( struct lp_setup_context *setup, + struct lp_rast_shader_inputs *inputs, + const struct lp_tri_info *info) +{ + unsigned fragcoord_usage_mask = TGSI_WRITEMASK_XYZ; + unsigned slot; + unsigned i; + + /* setup interpolation for all the remaining attributes: + */ + for (slot = 0; slot < setup->fs.nr_inputs; slot++) { + unsigned vert_attr = setup->fs.input[slot].src_index; + unsigned usage_mask = setup->fs.input[slot].usage_mask; + + switch (setup->fs.input[slot].interp) { + case LP_INTERP_CONSTANT: + if (setup->flatshade_first) { + for (i = 0; i < NUM_CHANNELS; i++) + if (usage_mask & (1 << i)) + constant_coef(inputs, slot+1, info->v0[vert_attr][i], i); + } + else { + for (i = 0; i < NUM_CHANNELS; i++) + if (usage_mask & (1 << i)) + constant_coef(inputs, slot+1, info->v2[vert_attr][i], i); + } + break; + + case LP_INTERP_LINEAR: + for (i = 0; i < NUM_CHANNELS; i++) + if (usage_mask & (1 << i)) + linear_coef(inputs, info, slot+1, vert_attr, i); + break; + + case LP_INTERP_PERSPECTIVE: + for (i = 0; i < NUM_CHANNELS; i++) + if (usage_mask & (1 << i)) + perspective_coef(inputs, info, slot+1, vert_attr, i); + fragcoord_usage_mask |= TGSI_WRITEMASK_W; + break; + + case LP_INTERP_POSITION: + /* + * The generated pixel interpolators will pick up the coeffs from + * slot 0, so all need to ensure that the usage mask is covers all + * usages. + */ + fragcoord_usage_mask |= usage_mask; + break; + + case LP_INTERP_FACING: + setup_facing_coef(inputs, slot+1, info->frontfacing, usage_mask); + break; + + default: + assert(0); + } + } + + /* The internal position input is in slot zero: + */ + setup_fragcoord_coef(inputs, info, 0, fragcoord_usage_mask); +} + +#else +extern void lp_setup_coef_dummy(void); +void lp_setup_coef_dummy(void) +{ +} + +#endif diff --git a/src/gallium/drivers/llvmpipe/lp_setup_coef.h b/src/gallium/drivers/llvmpipe/lp_setup_coef.h new file mode 100644 index 0000000000..d68b39c603 --- /dev/null +++ b/src/gallium/drivers/llvmpipe/lp_setup_coef.h @@ -0,0 +1,61 @@ +/************************************************************************** + * + * Copyright 2010 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, 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 VMWARE AND/OR ITS 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. + * + **************************************************************************/ + + +/** + * The setup code is concerned with point/line/triangle setup and + * putting commands/data into the bins. + */ + + +#ifndef LP_SETUP_COEF_H +#define LP_SETUP_COEF_H + + +struct lp_tri_info { + + float x0_center; + float y0_center; + + /* turn these into an aligned float[4] */ + float dy01_ooa; + float dy20_ooa; + float dx01_ooa; + float dx20_ooa; + + const float (*v0)[4]; + const float (*v1)[4]; + const float (*v2)[4]; + + boolean frontfacing; /* remove eventually */ +}; + +void lp_setup_tri_coef( struct lp_setup_context *setup, + struct lp_rast_shader_inputs *inputs, + const struct lp_tri_info *info); + +#endif diff --git a/src/gallium/drivers/llvmpipe/lp_setup_coef_intrin.c b/src/gallium/drivers/llvmpipe/lp_setup_coef_intrin.c new file mode 100644 index 0000000000..b477bc2113 --- /dev/null +++ b/src/gallium/drivers/llvmpipe/lp_setup_coef_intrin.c @@ -0,0 +1,208 @@ +/************************************************************************** + * + * Copyright 2010 VMware. + * 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, 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 VMWARE AND/OR ITS 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. + * + **************************************************************************/ + +/* + * Binning code for triangles + */ + +#include "util/u_math.h" +#include "util/u_memory.h" +#include "lp_perf.h" +#include "lp_setup_context.h" +#include "lp_setup_coef.h" +#include "lp_rast.h" +#include "lp_state_fs.h" + +#if defined(PIPE_ARCH_SSE) +#include + + +static void constant_coef4( struct lp_rast_shader_inputs *inputs, + const struct lp_tri_info *info, + unsigned slot, + const float *attr) +{ + *(__m128 *)inputs->a0[slot] = *(__m128 *)attr; + *(__m128 *)inputs->dadx[slot] = _mm_set1_ps(0.0); + *(__m128 *)inputs->dady[slot] = _mm_set1_ps(0.0); +} + + + +/** + * Setup the fragment input attribute with the front-facing value. + * \param frontface is the triangle front facing? + */ +static void setup_facing_coef( struct lp_rast_shader_inputs *inputs, + const struct lp_tri_info *info, + unsigned slot ) +{ + /* XXX: just pass frontface directly to the shader, don't bother + * treating it as an input. + */ + __m128 a0 = _mm_setr_ps(info->frontfacing ? 1.0 : -1.0, + 0, 0, 0); + + *(__m128 *)inputs->a0[slot] = a0; + *(__m128 *)inputs->dadx[slot] = _mm_set1_ps(0.0); + *(__m128 *)inputs->dady[slot] = _mm_set1_ps(0.0); +} + + + +static void calc_coef4( struct lp_rast_shader_inputs *inputs, + const struct lp_tri_info *info, + unsigned slot, + __m128 a0, + __m128 a1, + __m128 a2) +{ + __m128 da01 = _mm_sub_ps(a0, a1); + __m128 da20 = _mm_sub_ps(a2, a0); + + __m128 da01_dy20_ooa = _mm_mul_ps(da01, _mm_set1_ps(info->dy20_ooa)); + __m128 da20_dy01_ooa = _mm_mul_ps(da20, _mm_set1_ps(info->dy01_ooa)); + __m128 dadx = _mm_sub_ps(da01_dy20_ooa, da20_dy01_ooa); + + __m128 da01_dx20_ooa = _mm_mul_ps(da01, _mm_set1_ps(info->dx20_ooa)); + __m128 da20_dx01_ooa = _mm_mul_ps(da20, _mm_set1_ps(info->dx01_ooa)); + __m128 dady = _mm_sub_ps(da20_dx01_ooa, da01_dx20_ooa); + + __m128 dadx_x0 = _mm_mul_ps(dadx, _mm_set1_ps(info->x0_center)); + __m128 dady_y0 = _mm_mul_ps(dady, _mm_set1_ps(info->y0_center)); + __m128 attr_v0 = _mm_add_ps(dadx_x0, dady_y0); + __m128 attr_0 = _mm_sub_ps(a0, attr_v0); + + *(__m128 *)inputs->a0[slot] = attr_0; + *(__m128 *)inputs->dadx[slot] = dadx; + *(__m128 *)inputs->dady[slot] = dady; +} + + +static void linear_coef( struct lp_rast_shader_inputs *inputs, + const struct lp_tri_info *info, + unsigned slot, + unsigned vert_attr) +{ + __m128 a0 = *(const __m128 *)info->v0[vert_attr]; + __m128 a1 = *(const __m128 *)info->v1[vert_attr]; + __m128 a2 = *(const __m128 *)info->v2[vert_attr]; + + calc_coef4(inputs, info, slot, a0, a1, a2); +} + + + +/** + * Compute a0, dadx and dady for a perspective-corrected interpolant, + * for a triangle. + * We basically multiply the vertex value by 1/w before computing + * the plane coefficients (a0, dadx, dady). + * Later, when we compute the value at a particular fragment position we'll + * divide the interpolated value by the interpolated W at that fragment. + */ +static void perspective_coef( struct lp_rast_shader_inputs *inputs, + const struct lp_tri_info *info, + unsigned slot, + unsigned vert_attr) +{ + /* premultiply by 1/w (v[0][3] is always 1/w): + */ + __m128 a0 = *(const __m128 *)info->v0[vert_attr]; + __m128 a1 = *(const __m128 *)info->v1[vert_attr]; + __m128 a2 = *(const __m128 *)info->v2[vert_attr]; + + __m128 a0_oow = _mm_mul_ps(a0, _mm_set1_ps(info->v0[0][3])); + __m128 a1_oow = _mm_mul_ps(a1, _mm_set1_ps(info->v1[0][3])); + __m128 a2_oow = _mm_mul_ps(a2, _mm_set1_ps(info->v2[0][3])); + + calc_coef4(inputs, info, slot, a0_oow, a1_oow, a2_oow); +} + + + + + +/** + * Compute the inputs-> dadx, dady, a0 values. + */ +void lp_setup_tri_coef( struct lp_setup_context *setup, + struct lp_rast_shader_inputs *inputs, + const struct lp_tri_info *info) +{ + unsigned slot; + + /* The internal position input is in slot zero: + */ + linear_coef(inputs, info, 0, 0); + + /* setup interpolation for all the remaining attributes: + */ + for (slot = 0; slot < setup->fs.nr_inputs; slot++) { + unsigned vert_attr = setup->fs.input[slot].src_index; + + switch (setup->fs.input[slot].interp) { + case LP_INTERP_CONSTANT: + if (setup->flatshade_first) { + constant_coef4(inputs, info, slot+1, info->v0[vert_attr]); + } + else { + constant_coef4(inputs, info, slot+1, info->v2[vert_attr]); + } + break; + + case LP_INTERP_LINEAR: + linear_coef(inputs, info, slot+1, vert_attr); + break; + + case LP_INTERP_PERSPECTIVE: + perspective_coef(inputs, info, slot+1, vert_attr); + break; + + case LP_INTERP_POSITION: + /* + * The generated pixel interpolators will pick up the coeffs from + * slot 0. + */ + break; + + case LP_INTERP_FACING: + setup_facing_coef(inputs, info, slot+1); + break; + + default: + assert(0); + } + } +} + +#else +extern void lp_setup_coef_dummy(void); +void lp_setup_coef_dummy(void) +{ +} +#endif diff --git a/src/gallium/drivers/llvmpipe/lp_setup_tri.c b/src/gallium/drivers/llvmpipe/lp_setup_tri.c index fe5c9358dd..d86fb8652a 100644 --- a/src/gallium/drivers/llvmpipe/lp_setup_tri.c +++ b/src/gallium/drivers/llvmpipe/lp_setup_tri.c @@ -34,33 +34,12 @@ #include "util/u_rect.h" #include "lp_perf.h" #include "lp_setup_context.h" +#include "lp_setup_coef.h" #include "lp_rast.h" #include "lp_state_fs.h" #define NUM_CHANNELS 4 -struct tri_info { - - float pixel_offset; - - /* fixed point vertex coordinates */ - int x[3]; - int y[3]; - - /* float x,y deltas - all from the original coordinates - */ - float dy01, dy20; - float dx01, dx20; - float oneoverarea; - - const float (*v0)[4]; - const float (*v1)[4]; - const float (*v2)[4]; - - boolean frontfacing; -}; - - static INLINE int @@ -77,247 +56,6 @@ fixed_to_float(int a) -/** - * Compute a0 for a constant-valued coefficient (GL_FLAT shading). - */ -static void constant_coef( struct lp_rast_triangle *tri, - unsigned slot, - const float value, - unsigned i ) -{ - tri->inputs.a0[slot][i] = value; - tri->inputs.dadx[slot][i] = 0.0f; - tri->inputs.dady[slot][i] = 0.0f; -} - - - -static void linear_coef( struct lp_rast_triangle *tri, - const struct tri_info *info, - unsigned slot, - unsigned vert_attr, - unsigned i) -{ - float a0 = info->v0[vert_attr][i]; - float a1 = info->v1[vert_attr][i]; - float a2 = info->v2[vert_attr][i]; - - float da01 = a0 - a1; - float da20 = a2 - a0; - float dadx = (da01 * info->dy20 - info->dy01 * da20) * info->oneoverarea; - float dady = (da20 * info->dx01 - info->dx20 * da01) * info->oneoverarea; - - tri->inputs.dadx[slot][i] = dadx; - tri->inputs.dady[slot][i] = dady; - - /* calculate a0 as the value which would be sampled for the - * fragment at (0,0), taking into account that we want to sample at - * pixel centers, in other words (0.5, 0.5). - * - * this is neat but unfortunately not a good way to do things for - * triangles with very large values of dadx or dady as it will - * result in the subtraction and re-addition from a0 of a very - * large number, which means we'll end up loosing a lot of the - * fractional bits and precision from a0. the way to fix this is - * to define a0 as the sample at a pixel center somewhere near vmin - * instead - i'll switch to this later. - */ - tri->inputs.a0[slot][i] = (a0 - - (dadx * (info->v0[0][0] - info->pixel_offset) + - dady * (info->v0[0][1] - info->pixel_offset))); -} - - -/** - * Compute a0, dadx and dady for a perspective-corrected interpolant, - * for a triangle. - * We basically multiply the vertex value by 1/w before computing - * the plane coefficients (a0, dadx, dady). - * Later, when we compute the value at a particular fragment position we'll - * divide the interpolated value by the interpolated W at that fragment. - */ -static void perspective_coef( struct lp_rast_triangle *tri, - const struct tri_info *info, - unsigned slot, - unsigned vert_attr, - unsigned i) -{ - /* premultiply by 1/w (v[0][3] is always 1/w): - */ - float a0 = info->v0[vert_attr][i] * info->v0[0][3]; - float a1 = info->v1[vert_attr][i] * info->v1[0][3]; - float a2 = info->v2[vert_attr][i] * info->v2[0][3]; - float da01 = a0 - a1; - float da20 = a2 - a0; - float dadx = (da01 * info->dy20 - info->dy01 * da20) * info->oneoverarea; - float dady = (da20 * info->dx01 - info->dx20 * da01) * info->oneoverarea; - - tri->inputs.dadx[slot][i] = dadx; - tri->inputs.dady[slot][i] = dady; - tri->inputs.a0[slot][i] = (a0 - - (dadx * (info->v0[0][0] - info->pixel_offset) + - dady * (info->v0[0][1] - info->pixel_offset))); -} - - -/** - * Special coefficient setup for gl_FragCoord. - * X and Y are trivial - * Z and W are copied from position_coef which should have already been computed. - * We could do a bit less work if we'd examine gl_FragCoord's swizzle mask. - */ -static void -setup_fragcoord_coef(struct lp_rast_triangle *tri, - const struct tri_info *info, - unsigned slot, - unsigned usage_mask) -{ - /*X*/ - if (usage_mask & TGSI_WRITEMASK_X) { - tri->inputs.a0[slot][0] = 0.0; - tri->inputs.dadx[slot][0] = 1.0; - tri->inputs.dady[slot][0] = 0.0; - } - - /*Y*/ - if (usage_mask & TGSI_WRITEMASK_Y) { - tri->inputs.a0[slot][1] = 0.0; - tri->inputs.dadx[slot][1] = 0.0; - tri->inputs.dady[slot][1] = 1.0; - } - - /*Z*/ - if (usage_mask & TGSI_WRITEMASK_Z) { - linear_coef(tri, info, slot, 0, 2); - } - - /*W*/ - if (usage_mask & TGSI_WRITEMASK_W) { - linear_coef(tri, info, slot, 0, 3); - } -} - - -/** - * Setup the fragment input attribute with the front-facing value. - * \param frontface is the triangle front facing? - */ -static void setup_facing_coef( struct lp_rast_triangle *tri, - unsigned slot, - boolean frontface, - unsigned usage_mask) -{ - /* convert TRUE to 1.0 and FALSE to -1.0 */ - if (usage_mask & TGSI_WRITEMASK_X) - constant_coef( tri, slot, 2.0f * frontface - 1.0f, 0 ); - - if (usage_mask & TGSI_WRITEMASK_Y) - constant_coef( tri, slot, 0.0f, 1 ); /* wasted */ - - if (usage_mask & TGSI_WRITEMASK_Z) - constant_coef( tri, slot, 0.0f, 2 ); /* wasted */ - - if (usage_mask & TGSI_WRITEMASK_W) - constant_coef( tri, slot, 0.0f, 3 ); /* wasted */ -} - - -/** - * Compute the tri->coef[] array dadx, dady, a0 values. - */ -static void setup_tri_coefficients( struct lp_setup_context *setup, - struct lp_rast_triangle *tri, - const struct tri_info *info) -{ - unsigned fragcoord_usage_mask = TGSI_WRITEMASK_XYZ; - unsigned slot; - unsigned i; - - /* setup interpolation for all the remaining attributes: - */ - for (slot = 0; slot < setup->fs.nr_inputs; slot++) { - unsigned vert_attr = setup->fs.input[slot].src_index; - unsigned usage_mask = setup->fs.input[slot].usage_mask; - - switch (setup->fs.input[slot].interp) { - case LP_INTERP_CONSTANT: - if (setup->flatshade_first) { - for (i = 0; i < NUM_CHANNELS; i++) - if (usage_mask & (1 << i)) - constant_coef(tri, slot+1, info->v0[vert_attr][i], i); - } - else { - for (i = 0; i < NUM_CHANNELS; i++) - if (usage_mask & (1 << i)) - constant_coef(tri, slot+1, info->v2[vert_attr][i], i); - } - break; - - case LP_INTERP_LINEAR: - for (i = 0; i < NUM_CHANNELS; i++) - if (usage_mask & (1 << i)) - linear_coef(tri, info, slot+1, vert_attr, i); - break; - - case LP_INTERP_PERSPECTIVE: - for (i = 0; i < NUM_CHANNELS; i++) - if (usage_mask & (1 << i)) - perspective_coef(tri, info, slot+1, vert_attr, i); - fragcoord_usage_mask |= TGSI_WRITEMASK_W; - break; - - case LP_INTERP_POSITION: - /* - * The generated pixel interpolators will pick up the coeffs from - * slot 0, so all need to ensure that the usage mask is covers all - * usages. - */ - fragcoord_usage_mask |= usage_mask; - break; - - case LP_INTERP_FACING: - setup_facing_coef(tri, slot+1, info->frontfacing, usage_mask); - break; - - default: - assert(0); - } - } - - /* The internal position input is in slot zero: - */ - setup_fragcoord_coef(tri, info, 0, fragcoord_usage_mask); - - if (0) { - for (i = 0; i < NUM_CHANNELS; i++) { - float a0 = tri->inputs.a0 [0][i]; - float dadx = tri->inputs.dadx[0][i]; - float dady = tri->inputs.dady[0][i]; - - debug_printf("POS.%c: a0 = %f, dadx = %f, dady = %f\n", - "xyzw"[i], - a0, dadx, dady); - } - - for (slot = 0; slot < setup->fs.nr_inputs; slot++) { - unsigned usage_mask = setup->fs.input[slot].usage_mask; - for (i = 0; i < NUM_CHANNELS; i++) { - if (usage_mask & (1 << i)) { - float a0 = tri->inputs.a0 [1 + slot][i]; - float dadx = tri->inputs.dadx[1 + slot][i]; - float dady = tri->inputs.dady[1 + slot][i]; - - debug_printf("IN[%u].%c: a0 = %f, dadx = %f, dady = %f\n", - slot, - "xyzw"[i], - a0, dadx, dady); - } - } - } - } -} - - @@ -440,16 +178,21 @@ lp_rast_cmd lp_rast_tri_tab[8] = { */ static void do_triangle_ccw(struct lp_setup_context *setup, + const float (*v0)[4], const float (*v1)[4], const float (*v2)[4], - const float (*v3)[4], boolean frontfacing ) { struct lp_scene *scene = lp_setup_get_current_scene(setup); struct lp_fragment_shader_variant *variant = setup->fs.current.variant; struct lp_rast_triangle *tri; - struct tri_info info; + int x[3]; + int y[3]; + float dy01, dy20; + float dx01, dx20; + float oneoverarea; + struct lp_tri_info info; int area; struct u_rect bbox; int ix0, ix1, iy0, iy1; @@ -458,7 +201,7 @@ do_triangle_ccw(struct lp_setup_context *setup, int nr_planes = 3; if (0) - lp_setup_print_triangle(setup, v1, v2, v3); + lp_setup_print_triangle(setup, v0, v1, v2); if (setup->scissor_test) { nr_planes = 7; @@ -468,13 +211,12 @@ do_triangle_ccw(struct lp_setup_context *setup, } /* x/y positions in fixed point */ - info.x[0] = subpixel_snap(v1[0][0] - setup->pixel_offset); - info.x[1] = subpixel_snap(v2[0][0] - setup->pixel_offset); - info.x[2] = subpixel_snap(v3[0][0] - setup->pixel_offset); - info.y[0] = subpixel_snap(v1[0][1] - setup->pixel_offset); - info.y[1] = subpixel_snap(v2[0][1] - setup->pixel_offset); - info.y[2] = subpixel_snap(v3[0][1] - setup->pixel_offset); - + x[0] = subpixel_snap(v0[0][0] - setup->pixel_offset); + x[1] = subpixel_snap(v1[0][0] - setup->pixel_offset); + x[2] = subpixel_snap(v2[0][0] - setup->pixel_offset); + y[0] = subpixel_snap(v0[0][1] - setup->pixel_offset); + y[1] = subpixel_snap(v1[0][1] - setup->pixel_offset); + y[2] = subpixel_snap(v2[0][1] - setup->pixel_offset); /* Bounding rectangle (in pixels) */ @@ -486,10 +228,10 @@ do_triangle_ccw(struct lp_setup_context *setup, */ int adj = (setup->pixel_offset != 0) ? 1 : 0; - bbox.x0 = (MIN3(info.x[0], info.x[1], info.x[2]) + (FIXED_ONE-1)) >> FIXED_ORDER; - bbox.x1 = (MAX3(info.x[0], info.x[1], info.x[2]) + (FIXED_ONE-1)) >> FIXED_ORDER; - bbox.y0 = (MIN3(info.y[0], info.y[1], info.y[2]) + (FIXED_ONE-1) + adj) >> FIXED_ORDER; - bbox.y1 = (MAX3(info.y[0], info.y[1], info.y[2]) + (FIXED_ONE-1) + adj) >> FIXED_ORDER; + bbox.x0 = (MIN3(x[0], x[1], x[2]) + (FIXED_ONE-1)) >> FIXED_ORDER; + bbox.x1 = (MAX3(x[0], x[1], x[2]) + (FIXED_ONE-1)) >> FIXED_ORDER; + bbox.y0 = (MIN3(y[0], y[1], y[2]) + (FIXED_ONE-1) + adj) >> FIXED_ORDER; + bbox.y1 = (MAX3(y[0], y[1], y[2]) + (FIXED_ONE-1) + adj) >> FIXED_ORDER; /* Inclusive coordinates: */ @@ -520,21 +262,21 @@ do_triangle_ccw(struct lp_setup_context *setup, return; #ifdef DEBUG - tri->v[0][0] = v1[0][0]; - tri->v[1][0] = v2[0][0]; - tri->v[2][0] = v3[0][0]; - tri->v[0][1] = v1[0][1]; - tri->v[1][1] = v2[0][1]; - tri->v[2][1] = v3[0][1]; + tri->v[0][0] = v0[0][0]; + tri->v[1][0] = v1[0][0]; + tri->v[2][0] = v2[0][0]; + tri->v[0][1] = v0[0][1]; + tri->v[1][1] = v1[0][1]; + tri->v[2][1] = v2[0][1]; #endif - tri->plane[0].dcdy = info.x[0] - info.x[1]; - tri->plane[1].dcdy = info.x[1] - info.x[2]; - tri->plane[2].dcdy = info.x[2] - info.x[0]; + tri->plane[0].dcdy = x[0] - x[1]; + tri->plane[1].dcdy = x[1] - x[2]; + tri->plane[2].dcdy = x[2] - x[0]; - tri->plane[0].dcdx = info.y[0] - info.y[1]; - tri->plane[1].dcdx = info.y[1] - info.y[2]; - tri->plane[2].dcdx = info.y[2] - info.y[0]; + tri->plane[0].dcdx = y[0] - y[1]; + tri->plane[1].dcdx = y[1] - y[2]; + tri->plane[2].dcdx = y[2] - y[0]; area = (tri->plane[0].dcdy * tri->plane[2].dcdx - tri->plane[2].dcdy * tri->plane[0].dcdx); @@ -554,20 +296,26 @@ do_triangle_ccw(struct lp_setup_context *setup, /* */ - info.pixel_offset = setup->pixel_offset; - info.v0 = v1; - info.v1 = v2; - info.v2 = v3; - info.dx01 = info.v0[0][0] - info.v1[0][0]; - info.dx20 = info.v2[0][0] - info.v0[0][0]; - info.dy01 = info.v0[0][1] - info.v1[0][1]; - info.dy20 = info.v2[0][1] - info.v0[0][1]; - info.oneoverarea = 1.0f / (info.dx01 * info.dy20 - info.dx20 * info.dy01); + dx01 = v0[0][0] - v1[0][0]; + dy01 = v0[0][1] - v1[0][1]; + dx20 = v2[0][0] - v0[0][0]; + dy20 = v2[0][1] - v0[0][1]; + oneoverarea = 1.0f / (dx01 * dy20 - dx20 * dy01); + + info.v0 = v0; + info.v1 = v1; + info.v2 = v2; info.frontfacing = frontfacing; + info.x0_center = v0[0][0] - setup->pixel_offset; + info.y0_center = v0[0][1] - setup->pixel_offset; + info.dx01_ooa = dx01 * oneoverarea; + info.dx20_ooa = dx20 * oneoverarea; + info.dy01_ooa = dy01 * oneoverarea; + info.dy20_ooa = dy20 * oneoverarea; /* Setup parameter interpolants: */ - setup_tri_coefficients( setup, tri, &info ); + lp_setup_tri_coef( setup, &tri->inputs, &info ); tri->inputs.facing = frontfacing ? 1.0F : -1.0F; tri->inputs.state = setup->fs.stored; @@ -580,7 +328,7 @@ do_triangle_ccw(struct lp_setup_context *setup, /* half-edge constants, will be interated over the whole render * target. */ - plane->c = plane->dcdx * info.x[i] - plane->dcdy * info.y[i]; + plane->c = plane->dcdx * x[i] - plane->dcdy * y[i]; /* correct for top-left vs. bottom-left fill convention. * -- cgit v1.2.3 From c95ca04b63eadb61add249531c1041aaf5b525d6 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Fri, 27 Aug 2010 11:18:11 +0100 Subject: llvmpipe: add lp_setup_coef to makefile --- src/gallium/drivers/llvmpipe/Makefile | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/gallium/drivers/llvmpipe/Makefile b/src/gallium/drivers/llvmpipe/Makefile index 2892b62920..dec874623e 100644 --- a/src/gallium/drivers/llvmpipe/Makefile +++ b/src/gallium/drivers/llvmpipe/Makefile @@ -27,6 +27,8 @@ C_SOURCES = \ lp_scene_queue.c \ lp_screen.c \ lp_setup.c \ + lp_setup_coef.c \ + lp_setup_coef_intrin.c \ lp_setup_line.c \ lp_setup_point.c \ lp_setup_tri.c \ -- cgit v1.2.3 From 5286dd701640976ffc328e8e85fb3830746851a1 Mon Sep 17 00:00:00 2001 From: Hui Qi Tay Date: Mon, 19 Jul 2010 15:23:09 +0100 Subject: llvmpipe: native rasterization for lines Rasterize lines directly by treating them as 4-sided polygons. Still need to check the exact pixel rasteration. --- src/gallium/drivers/llvmpipe/lp_context.c | 2 +- src/gallium/drivers/llvmpipe/lp_rast.h | 4 +- src/gallium/drivers/llvmpipe/lp_rast_tri.c | 4 + src/gallium/drivers/llvmpipe/lp_rast_tri_tmp.h | 2 +- src/gallium/drivers/llvmpipe/lp_setup.c | 7 + src/gallium/drivers/llvmpipe/lp_setup.h | 4 + src/gallium/drivers/llvmpipe/lp_setup_context.h | 38 ++ src/gallium/drivers/llvmpipe/lp_setup_line.c | 617 ++++++++++++++++++++- src/gallium/drivers/llvmpipe/lp_setup_point.c | 4 +- src/gallium/drivers/llvmpipe/lp_setup_tri.c | 23 +- src/gallium/drivers/llvmpipe/lp_state_rasterizer.c | 2 + 11 files changed, 685 insertions(+), 22 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/llvmpipe/lp_context.c b/src/gallium/drivers/llvmpipe/lp_context.c index 086a2d5898..a6873abbee 100644 --- a/src/gallium/drivers/llvmpipe/lp_context.c +++ b/src/gallium/drivers/llvmpipe/lp_context.c @@ -157,7 +157,7 @@ llvmpipe_create_context( struct pipe_screen *screen, void *priv ) /* convert points and lines into triangles: */ draw_wide_point_threshold(llvmpipe->draw, 0.0); - draw_wide_line_threshold(llvmpipe->draw, 0.0); + draw_wide_line_threshold(llvmpipe->draw, 10000.0); #if USE_DRAW_STAGE_PSTIPPLE /* Do polygon stipple w/ texture map + frag prog? */ diff --git a/src/gallium/drivers/llvmpipe/lp_rast.h b/src/gallium/drivers/llvmpipe/lp_rast.h index 102e902d02..b4564ef33b 100644 --- a/src/gallium/drivers/llvmpipe/lp_rast.h +++ b/src/gallium/drivers/llvmpipe/lp_rast.h @@ -120,7 +120,7 @@ struct lp_rast_triangle { float v[3][2]; #endif - struct lp_rast_plane plane[7]; /* NOTE: may allocate fewer planes */ + struct lp_rast_plane plane[8]; /* NOTE: may allocate fewer planes */ }; @@ -236,6 +236,8 @@ void lp_rast_triangle_6( struct lp_rasterizer_task *, const union lp_rast_cmd_arg ); void lp_rast_triangle_7( struct lp_rasterizer_task *, const union lp_rast_cmd_arg ); +void lp_rast_triangle_8( struct lp_rasterizer_task *, + const union lp_rast_cmd_arg ); void lp_rast_shade_tile( struct lp_rasterizer_task *, const union lp_rast_cmd_arg ); diff --git a/src/gallium/drivers/llvmpipe/lp_rast_tri.c b/src/gallium/drivers/llvmpipe/lp_rast_tri.c index 673f67386b..8d729c7481 100644 --- a/src/gallium/drivers/llvmpipe/lp_rast_tri.c +++ b/src/gallium/drivers/llvmpipe/lp_rast_tri.c @@ -157,6 +157,10 @@ build_mask_linear(int c, int dcdx, int dcdy) #define NR_PLANES 7 #include "lp_rast_tri_tmp.h" +#define TAG(x) x##_8 +#define NR_PLANES 8 +#include "lp_rast_tri_tmp.h" + /* Special case for 3 plane triangle which is contained entirely * within a 16x16 block. diff --git a/src/gallium/drivers/llvmpipe/lp_rast_tri_tmp.h b/src/gallium/drivers/llvmpipe/lp_rast_tri_tmp.h index 70a4b64c8d..0def5f7243 100644 --- a/src/gallium/drivers/llvmpipe/lp_rast_tri_tmp.h +++ b/src/gallium/drivers/llvmpipe/lp_rast_tri_tmp.h @@ -32,7 +32,7 @@ /** - * Prototype for a 7 plane rasterizer function. Will codegenerate + * Prototype for a 8 plane rasterizer function. Will codegenerate * several of these. * * XXX: Varients for more/fewer planes. diff --git a/src/gallium/drivers/llvmpipe/lp_setup.c b/src/gallium/drivers/llvmpipe/lp_setup.c index 9aa6c4bf38..4c8275665e 100644 --- a/src/gallium/drivers/llvmpipe/lp_setup.c +++ b/src/gallium/drivers/llvmpipe/lp_setup.c @@ -485,7 +485,14 @@ lp_setup_set_triangle_state( struct lp_setup_context *setup, } } +void +lp_setup_set_line_state( struct lp_setup_context *setup, + float line_width) +{ + LP_DBG(DEBUG_SETUP, "%s\n", __FUNCTION__); + setup->line_width = line_width; +} void lp_setup_set_fs_inputs( struct lp_setup_context *setup, diff --git a/src/gallium/drivers/llvmpipe/lp_setup.h b/src/gallium/drivers/llvmpipe/lp_setup.h index a41bb8863b..693550b8c8 100644 --- a/src/gallium/drivers/llvmpipe/lp_setup.h +++ b/src/gallium/drivers/llvmpipe/lp_setup.h @@ -100,6 +100,10 @@ lp_setup_set_triangle_state( struct lp_setup_context *setup, boolean scissor, boolean gl_rasterization_rules ); +void +lp_setup_set_line_state( struct lp_setup_context *setup, + float line_width); + void lp_setup_set_fs_inputs( struct lp_setup_context *setup, const struct lp_shader_input *interp, diff --git a/src/gallium/drivers/llvmpipe/lp_setup_context.h b/src/gallium/drivers/llvmpipe/lp_setup_context.h index 1a147e0353..a4838d59a5 100644 --- a/src/gallium/drivers/llvmpipe/lp_setup_context.h +++ b/src/gallium/drivers/llvmpipe/lp_setup_context.h @@ -91,6 +91,7 @@ struct lp_setup_context boolean scissor_test; unsigned cullmode; float pixel_offset; + float line_width; struct pipe_framebuffer_state fb; struct u_rect framebuffer; @@ -170,5 +171,42 @@ lp_setup_print_vertex(struct lp_setup_context *setup, const char *name, const float (*v)[4]); +/** shared code between lp_setup_line and lp_setup_tri */ +extern lp_rast_cmd lp_rast_tri_tab[]; + +void +do_triangle_ccw_whole_tile(struct lp_setup_context *setup, + struct lp_scene *scene, + struct lp_rast_triangle *tri, + int x, int y, + boolean opaque, + int *is_blit); + + +void +lp_setup_tri_coefficients( struct lp_setup_context *setup, + struct lp_rast_triangle *tri, + float oneoverarea, + const float (*v1)[4], + const float (*v2)[4], + const float (*v3)[4], + boolean frontface); + +struct lp_rast_triangle * +lp_setup_alloc_triangle(struct lp_scene *scene, + unsigned nr_inputs, + unsigned nr_planes, + unsigned *tri_size); + +void +lp_setup_fragcoord_coef(struct lp_setup_context *setup, + struct lp_rast_triangle *tri, + float oneoverarea, + unsigned slot, + const float (*v1)[4], + const float (*v2)[4], + const float (*v3)[4], + unsigned usage_mask); + #endif diff --git a/src/gallium/drivers/llvmpipe/lp_setup_line.c b/src/gallium/drivers/llvmpipe/lp_setup_line.c index be41c44e6f..930207ae33 100644 --- a/src/gallium/drivers/llvmpipe/lp_setup_line.c +++ b/src/gallium/drivers/llvmpipe/lp_setup_line.c @@ -29,19 +29,624 @@ * Binning code for lines */ +#include "util/u_math.h" +#include "util/u_memory.h" +#include "lp_perf.h" #include "lp_setup_context.h" +#include "lp_rast.h" +#include "lp_state_fs.h" -static void line_nop( struct lp_setup_context *setup, - const float (*v0)[4], - const float (*v1)[4] ) +#define NUM_CHANNELS 4 + + +static const int step_scissor_minx[16] = { + 0, 1, 0, 1, + 2, 3, 2, 3, + 0, 1, 0, 1, + 2, 3, 2, 3 +}; + +static const int step_scissor_maxx[16] = { + 0, -1, 0, -1, + -2, -3, -2, -3, + 0, -1, 0, -1, + -2, -3, -2, -3 +}; + +static const int step_scissor_miny[16] = { + 0, 0, 1, 1, + 0, 0, 1, 1, + 2, 2, 3, 3, + 2, 2, 3, 3 +}; + +static const int step_scissor_maxy[16] = { + 0, 0, -1, -1, + 0, 0, -1, -1, + -2, -2, -3, -3, + -2, -2, -3, -3 +}; + + + +/** + * Compute a0 for a constant-valued coefficient (GL_FLAT shading). + */ +static void constant_coef( struct lp_setup_context *setup, + struct lp_rast_triangle *tri, + unsigned slot, + const float value, + unsigned i ) +{ + tri->inputs.a0[slot][i] = value; + tri->inputs.dadx[slot][i] = 0.0f; + tri->inputs.dady[slot][i] = 0.0f; +} + + +/** + * Compute a0, dadx and dady for a linearly interpolated coefficient, + * for a triangle. + */ +static void linear_coef( struct lp_setup_context *setup, + struct lp_rast_triangle *tri, + float oneoverarea, + unsigned slot, + const float (*v1)[4], + const float (*v2)[4], + unsigned vert_attr, + unsigned i) +{ + float a1 = v1[vert_attr][i]; + float a2 = v2[vert_attr][i]; + + float da21 = a1 - a2; + float dadx = da21 * tri->dx * oneoverarea; + float dady = da21 * tri->dy * oneoverarea; + + tri->inputs.dadx[slot][i] = dadx; + tri->inputs.dady[slot][i] = dady; + + tri->inputs.a0[slot][i] = (a1 - + (dadx * (v1[0][0] - setup->pixel_offset) + + dady * (v1[0][1] - setup->pixel_offset))); +} + + +/** + * Compute a0, dadx and dady for a perspective-corrected interpolant, + * for a triangle. + * We basically multiply the vertex value by 1/w before computing + * the plane coefficients (a0, dadx, dady). + * Later, when we compute the value at a particular fragment position we'll + * divide the interpolated value by the interpolated W at that fragment. + */ +static void perspective_coef( struct lp_setup_context *setup, + struct lp_rast_triangle *tri, + float oneoverarea, + unsigned slot, + const float (*v1)[4], + const float (*v2)[4], + unsigned vert_attr, + unsigned i) +{ + /* premultiply by 1/w (v[0][3] is always 1/w): + */ + float a1 = v1[vert_attr][i] * v1[0][3]; + float a2 = v2[vert_attr][i] * v2[0][3]; + + float da21 = a1 - a2; + float dadx = da21 * tri->dx * oneoverarea; + float dady = da21 * tri->dy * oneoverarea; + + tri->inputs.dadx[slot][i] = dadx; + tri->inputs.dady[slot][i] = dady; + + tri->inputs.a0[slot][i] = (a1 - + (dadx * (v1[0][0] - setup->pixel_offset) + + dady * (v1[0][1] - setup->pixel_offset))); +} + +/** + * Compute the tri->coef[] array dadx, dady, a0 values. + */ +static void setup_line_coefficients( struct lp_setup_context *setup, + struct lp_rast_triangle *tri, + float oneoverarea, + const float (*v1)[4], + const float (*v2)[4]) { + unsigned fragcoord_usage_mask = TGSI_WRITEMASK_XYZ; + unsigned slot; + + /* setup interpolation for all the remaining attributes: + */ + for (slot = 0; slot < setup->fs.nr_inputs; slot++) { + unsigned vert_attr = setup->fs.input[slot].src_index; + unsigned usage_mask = setup->fs.input[slot].usage_mask; + unsigned i; + + switch (setup->fs.input[slot].interp) { + case LP_INTERP_CONSTANT: + if (setup->flatshade_first) { + for (i = 0; i < NUM_CHANNELS; i++) + if (usage_mask & (1 << i)) + constant_coef(setup, tri, slot+1, v1[vert_attr][i], i); + } + else { + for (i = 0; i < NUM_CHANNELS; i++) + if (usage_mask & (1 << i)) + constant_coef(setup, tri, slot+1, v2[vert_attr][i], i); + } + break; + + case LP_INTERP_LINEAR: + for (i = 0; i < NUM_CHANNELS; i++) + if (usage_mask & (1 << i)) + linear_coef(setup, tri, oneoverarea, slot+1, v1, v2, vert_attr, i); + break; + + case LP_INTERP_PERSPECTIVE: + for (i = 0; i < NUM_CHANNELS; i++) + if (usage_mask & (1 << i)) + perspective_coef(setup, tri, oneoverarea, slot+1, v1, v2, vert_attr, i); + fragcoord_usage_mask |= TGSI_WRITEMASK_W; + break; + + case LP_INTERP_POSITION: + /* + * The generated pixel interpolators will pick up the coeffs from + * slot 0, so all need to ensure that the usage mask is covers all + * usages. + */ + fragcoord_usage_mask |= usage_mask; + break; + + default: + assert(0); + } + } + + /* The internal position input is in slot zero: + */ + lp_setup_fragcoord_coef(setup, tri, oneoverarea, 0, v1, v2, v2, + fragcoord_usage_mask); } -void -lp_setup_choose_line( struct lp_setup_context *setup ) + +static INLINE int subpixel_snap( float a ) { - setup->line = line_nop; + return util_iround(FIXED_ONE * a); +} + + +/** + * Print line vertex attribs (for debug). + */ +static void +print_line(struct lp_setup_context *setup, + const float (*v1)[4], + const float (*v2)[4]) +{ + uint i; + + debug_printf("llvmpipe line\n"); + for (i = 0; i < 1 + setup->fs.nr_inputs; i++) { + debug_printf(" v1[%d]: %f %f %f %f\n", i, + v1[i][0], v1[i][1], v1[i][2], v1[i][3]); + } + for (i = 0; i < 1 + setup->fs.nr_inputs; i++) { + debug_printf(" v2[%d]: %f %f %f %f\n", i, + v2[i][0], v2[i][1], v2[i][2], v2[i][3]); + } +} + + +static void +lp_setup_line( struct lp_setup_context *setup, + const float (*v1)[4], + const float (*v2)[4]) +{ + struct lp_scene *scene = lp_setup_get_current_scene(setup); + struct lp_rast_triangle *line; + float oneoverarea; + float half_width = setup->line_width / 2; + int minx, maxx, miny, maxy; + int ix0, ix1, iy0, iy1; + unsigned tri_bytes; + int x[4]; + int y[4]; + int i; + int nr_planes = 4; + boolean opaque; + + if (0) + print_line(setup, v1, v2); + + if (setup->scissor_test) { + nr_planes = 8; + } + else { + nr_planes = 4; + } + + line = lp_setup_alloc_triangle(scene, + setup->fs.nr_inputs, + nr_planes, + &tri_bytes); + if (!line) + return; + +#ifndef DEBUG + line->v[0][0] = v1[0][0]; + line->v[1][0] = v2[0][0]; + line->v[0][1] = v1[0][1]; + line->v[1][1] = v2[0][1]; +#endif + + /* pre-calculation(based on given vertices) to determine if line is + * more horizontal or more vertical + */ + line->dx = v1[0][0] - v2[0][0]; + line->dy = v1[0][1] - v2[0][1]; + + /* x-major line */ + if (fabsf(line->dx) >= fabsf(line->dy)) { + if (line->dx < 0) { + /* if v2 is to the right of v1, swap pointers */ + const float (*temp)[4] = v1; + v1 = v2; + v2 = temp; + line->dx = -line->dx; + line->dy = -line->dy; + } + + /* x/y positions in fixed point */ + x[0] = subpixel_snap(v1[0][0] - setup->pixel_offset); + x[1] = subpixel_snap(v2[0][0] - setup->pixel_offset); + x[2] = subpixel_snap(v2[0][0] - setup->pixel_offset); + x[3] = subpixel_snap(v1[0][0] - setup->pixel_offset); + + y[0] = subpixel_snap(v1[0][1] - half_width - setup->pixel_offset); + y[1] = subpixel_snap(v2[0][1] - half_width - setup->pixel_offset); + y[2] = subpixel_snap(v2[0][1] + half_width - setup->pixel_offset); + y[3] = subpixel_snap(v1[0][1] + half_width - setup->pixel_offset); + } + else{ + /* y-major line */ + if (line->dy > 0) { + /* if v2 is on top of v1, swap pointers */ + const float (*temp)[4] = v1; + v1 = v2; + v2 = temp; + line->dx = -line->dx; + line->dy = -line->dy; + } + + x[0] = subpixel_snap(v1[0][0] - half_width - setup->pixel_offset); + x[1] = subpixel_snap(v2[0][0] - half_width - setup->pixel_offset); + x[2] = subpixel_snap(v2[0][0] + half_width - setup->pixel_offset); + x[3] = subpixel_snap(v1[0][0] + half_width - setup->pixel_offset); + + y[0] = subpixel_snap(v1[0][1] - setup->pixel_offset); + y[1] = subpixel_snap(v2[0][1] - setup->pixel_offset); + y[2] = subpixel_snap(v2[0][1] - setup->pixel_offset); + y[3] = subpixel_snap(v1[0][1] - setup->pixel_offset); + } + + /* calculate the deltas */ + line->plane[0].dcdy = x[0] - x[1]; + line->plane[1].dcdy = x[1] - x[2]; + line->plane[2].dcdy = x[2] - x[3]; + line->plane[3].dcdy = x[3] - x[0]; + + line->plane[0].dcdx = y[0] - y[1]; + line->plane[1].dcdx = y[1] - y[2]; + line->plane[2].dcdx = y[2] - y[3]; + line->plane[3].dcdx = y[3] - y[0]; + + + LP_COUNT(nr_tris); + + + /* Bounding rectangle (in pixels) */ + { + /* Yes this is necessary to accurately calculate bounding boxes + * with the two fill-conventions we support. GL (normally) ends + * up needing a bottom-left fill convention, which requires + * slightly different rounding. + */ + int adj = (setup->pixel_offset != 0) ? 1 : 0; + + minx = (MIN4(x[0], x[1], x[2], x[3]) + (FIXED_ONE-1)) >> FIXED_ORDER; + maxx = (MAX4(x[0], x[1], x[2], x[3]) + (FIXED_ONE-1)) >> FIXED_ORDER; + miny = (MIN4(y[0], y[1], y[3], y[3]) + (FIXED_ONE-1) + adj) >> FIXED_ORDER; + maxy = (MAX4(y[0], y[1], y[3], y[3]) + (FIXED_ONE-1) + adj) >> FIXED_ORDER; + } + + if (setup->scissor_test) { + minx = MAX2(minx, setup->scissor.current.minx); + maxx = MIN2(maxx, setup->scissor.current.maxx); + miny = MAX2(miny, setup->scissor.current.miny); + maxy = MIN2(maxy, setup->scissor.current.maxy); + } + else { + minx = MAX2(minx, 0); + miny = MAX2(miny, 0); + maxx = MIN2(maxx, scene->fb.width); + maxy = MIN2(maxy, scene->fb.height); + } + + + if (miny >= maxy || minx >= maxx) { + lp_scene_putback_data( scene, tri_bytes ); + return; + } + + oneoverarea = 1.0f / (line->dx * line->dx + line->dy * line->dy); + + /* Setup parameter interpolants: + */ + setup_line_coefficients( setup, line, oneoverarea, v1, v2); + + for (i = 0; i < 4; i++) { + struct lp_rast_plane *plane = &line->plane[i]; + + /* half-edge constants, will be interated over the whole render + * target. + */ + plane->c = plane->dcdx * x[i] - plane->dcdy * y[i]; + + + /* correct for top-left vs. bottom-left fill convention. + * + * note that we're overloading gl_rasterization_rules to mean + * both (0.5,0.5) pixel centers *and* bottom-left filling + * convention. + * + * GL actually has a top-left filling convention, but GL's + * notion of "top" differs from gallium's... + * + * Also, sometimes (in FBO cases) GL will render upside down + * to its usual method, in which case it will probably want + * to use the opposite, top-left convention. + */ + if (plane->dcdx < 0) { + /* both fill conventions want this - adjust for left edges */ + plane->c++; + } + else if (plane->dcdx == 0) { + if (setup->pixel_offset == 0) { + /* correct for top-left fill convention: + */ + if (plane->dcdy > 0) plane->c++; + } + else { + /* correct for bottom-left fill convention: + */ + if (plane->dcdy < 0) plane->c++; + } + } + + plane->dcdx *= FIXED_ONE; + plane->dcdy *= FIXED_ONE; + + /* find trivial reject offsets for each edge for a single-pixel + * sized block. These will be scaled up at each recursive level to + * match the active blocksize. Scaling in this way works best if + * the blocks are square. + */ + plane->eo = 0; + if (plane->dcdx < 0) plane->eo -= plane->dcdx; + if (plane->dcdy > 0) plane->eo += plane->dcdy; + + /* Calculate trivial accept offsets from the above. + */ + plane->ei = plane->dcdy - plane->dcdx - plane->eo; + + plane->step = line->step[i]; + + /* Fill in the inputs.step[][] arrays. + * We've manually unrolled some loops here. + */ +#define SETUP_STEP(j, x, y) \ + line->step[i][j] = y * plane->dcdy - x * plane->dcdx + + SETUP_STEP(0, 0, 0); + SETUP_STEP(1, 1, 0); + SETUP_STEP(2, 0, 1); + SETUP_STEP(3, 1, 1); + + SETUP_STEP(4, 2, 0); + SETUP_STEP(5, 3, 0); + SETUP_STEP(6, 2, 1); + SETUP_STEP(7, 3, 1); + + SETUP_STEP(8, 0, 2); + SETUP_STEP(9, 1, 2); + SETUP_STEP(10, 0, 3); + SETUP_STEP(11, 1, 3); + + SETUP_STEP(12, 2, 2); + SETUP_STEP(13, 3, 2); + SETUP_STEP(14, 2, 3); + SETUP_STEP(15, 3, 3); +#undef STEP + } + + + /* + * When rasterizing scissored tris, use the intersection of the + * triangle bounding box and the scissor rect to generate the + * scissor planes. + * + * This permits us to cut off the triangle "tails" that are present + * in the intermediate recursive levels caused when two of the + * triangles edges don't diverge quickly enough to trivially reject + * exterior blocks from the triangle. + * + * It's not really clear if it's worth worrying about these tails, + * but since we generate the planes for each scissored tri, it's + * free to trim them in this case. + * + * Note that otherwise, the scissor planes only vary in 'C' value, + * and even then only on state-changes. Could alternatively store + * these planes elsewhere. + */ + if (nr_planes == 8) { + line->plane[4].step = step_scissor_maxx; + line->plane[4].dcdx = 1; + line->plane[4].dcdy = 0; + line->plane[4].c = maxx; + line->plane[4].ei = -1; + line->plane[4].eo = 0; + + line->plane[5].step = step_scissor_miny; + line->plane[5].dcdx = 0; + line->plane[5].dcdy = 1; + line->plane[5].c = 1-miny; + line->plane[5].ei = 0; + line->plane[5].eo = 1; + + line->plane[6].step = step_scissor_maxy; + line->plane[6].dcdx = 0; + line->plane[6].dcdy = -1; + line->plane[6].c = maxy; + line->plane[6].ei = -1; + line->plane[6].eo = 0; + + line->plane[7].step = step_scissor_minx; + line->plane[7].dcdx = -1; + line->plane[7].dcdy = 0; + line->plane[7].c = 1-minx; + line->plane[7].ei = 0; + line->plane[7].eo = 1; + } + + + /* + * All fields of 'tri' are now set. The remaining code here is + * concerned with binning. + */ + + /* Convert to tile coordinates, and inclusive ranges: + */ + ix0 = minx / TILE_SIZE; + iy0 = miny / TILE_SIZE; + ix1 = (maxx-1) / TILE_SIZE; + iy1 = (maxy-1) / TILE_SIZE; + + /* + * Clamp to framebuffer size + */ + assert(ix0 == MAX2(ix0, 0)); + assert(iy0 == MAX2(iy0, 0)); + assert(ix1 == MIN2(ix1, scene->tiles_x - 1)); + assert(iy1 == MIN2(iy1, scene->tiles_y - 1)); + + /* Determine which tile(s) intersect the triangle's bounding box + */ + if (iy0 == iy1 && ix0 == ix1) + { + /* Triangle is contained in a single tile: + */ + lp_scene_bin_command( scene, ix0, iy0, + lp_rast_tri_tab[nr_planes], + lp_rast_arg_triangle(line, (1<plane[i].c + + line->plane[i].dcdy * iy0 * TILE_SIZE - + line->plane[i].dcdx * ix0 * TILE_SIZE); + + ei[i] = line->plane[i].ei << TILE_ORDER; + eo[i] = line->plane[i].eo << TILE_ORDER; + xstep[i] = -(line->plane[i].dcdx << TILE_ORDER); + ystep[i] = line->plane[i].dcdy << TILE_ORDER; + } + + + + /* Test tile-sized blocks against the triangle. + * Discard blocks fully outside the tri. If the block is fully + * contained inside the tri, bin an lp_rast_shade_tile command. + * Else, bin a lp_rast_triangle command. + */ + for (y = iy0; y <= iy1; y++) + { + boolean in = FALSE; /* are we inside the triangle? */ + int cx[8]; + + for (i = 0; i < nr_planes; i++) + cx[i] = c[i]; + + for (x = ix0; x <= ix1; x++) + { + int out = 0; + int partial = 0; + + for (i = 0; i < nr_planes; i++) { + int planeout = cx[i] + eo[i]; + int planepartial = cx[i] + ei[i] - 1; + out |= (planeout >> 31); + partial |= (planepartial >> 31) & (1<line = lp_setup_line; } diff --git a/src/gallium/drivers/llvmpipe/lp_setup_point.c b/src/gallium/drivers/llvmpipe/lp_setup_point.c index 9f69e6c5ce..709c3e2fd2 100644 --- a/src/gallium/drivers/llvmpipe/lp_setup_point.c +++ b/src/gallium/drivers/llvmpipe/lp_setup_point.c @@ -31,7 +31,7 @@ #include "lp_setup_context.h" -static void point_nop( struct lp_setup_context *setup, +static void lp_setup_point( struct lp_setup_context *setup, const float (*v0)[4] ) { } @@ -40,7 +40,7 @@ static void point_nop( struct lp_setup_context *setup, void lp_setup_choose_point( struct lp_setup_context *setup ) { - setup->point = point_nop; + setup->point = lp_setup_point; } diff --git a/src/gallium/drivers/llvmpipe/lp_setup_tri.c b/src/gallium/drivers/llvmpipe/lp_setup_tri.c index d86fb8652a..212bb3ab90 100644 --- a/src/gallium/drivers/llvmpipe/lp_setup_tri.c +++ b/src/gallium/drivers/llvmpipe/lp_setup_tri.c @@ -68,11 +68,11 @@ fixed_to_float(int a) * \param nr_inputs number of fragment shader inputs * \return pointer to triangle space */ -static INLINE struct lp_rast_triangle * -alloc_triangle(struct lp_scene *scene, - unsigned nr_inputs, - unsigned nr_planes, - unsigned *tri_size) +struct lp_rast_triangle * +lp_setup_alloc_triangle(struct lp_scene *scene, + unsigned nr_inputs, + unsigned nr_planes, + unsigned *tri_size) { unsigned input_array_sz = NUM_CHANNELS * (nr_inputs + 1) * sizeof(float); struct lp_rast_triangle *tri; @@ -160,7 +160,7 @@ lp_setup_print_triangle(struct lp_setup_context *setup, } -lp_rast_cmd lp_rast_tri_tab[8] = { +lp_rast_cmd lp_rast_tri_tab[9] = { NULL, /* should be impossible */ lp_rast_triangle_1, lp_rast_triangle_2, @@ -168,7 +168,8 @@ lp_rast_cmd lp_rast_tri_tab[8] = { lp_rast_triangle_4, lp_rast_triangle_5, lp_rast_triangle_6, - lp_rast_triangle_7 + lp_rast_triangle_7, + lp_rast_triangle_8 }; /** @@ -254,10 +255,10 @@ do_triangle_ccw(struct lp_setup_context *setup, u_rect_find_intersection(&setup->draw_region, &bbox); - tri = alloc_triangle(scene, - setup->fs.nr_inputs, - nr_planes, - &tri_bytes); + tri = lp_setup_alloc_triangle(scene, + setup->fs.nr_inputs, + nr_planes, + &tri_bytes); if (!tri) return; diff --git a/src/gallium/drivers/llvmpipe/lp_state_rasterizer.c b/src/gallium/drivers/llvmpipe/lp_state_rasterizer.c index afd3e0b21c..67b985aa24 100644 --- a/src/gallium/drivers/llvmpipe/lp_state_rasterizer.c +++ b/src/gallium/drivers/llvmpipe/lp_state_rasterizer.c @@ -73,6 +73,8 @@ llvmpipe_bind_rasterizer_state(struct pipe_context *pipe, void *handle) llvmpipe->rasterizer->gl_rasterization_rules); lp_setup_set_flatshade_first( llvmpipe->setup, llvmpipe->rasterizer->flatshade_first); + lp_setup_set_line_state( llvmpipe->setup, + llvmpipe->rasterizer->line_width); } llvmpipe->dirty |= LP_NEW_RASTERIZER; -- cgit v1.2.3 From b91553355f848f2174d53429699b116734781ad7 Mon Sep 17 00:00:00 2001 From: Hui Qi Tay Date: Wed, 4 Aug 2010 17:13:39 +0100 Subject: llvmpipe: native line rasterization with correct pixel rasterization Line rasterization that follows diamond exit rule. Can still optimize logic for start/endpoints. --- src/gallium/drivers/llvmpipe/lp_setup_line.c | 242 +++++++++++++++++++++++---- 1 file changed, 213 insertions(+), 29 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/llvmpipe/lp_setup_line.c b/src/gallium/drivers/llvmpipe/lp_setup_line.c index 930207ae33..1566203117 100644 --- a/src/gallium/drivers/llvmpipe/lp_setup_line.c +++ b/src/gallium/drivers/llvmpipe/lp_setup_line.c @@ -243,6 +243,11 @@ print_line(struct lp_setup_context *setup, } +static INLINE boolean sign(float x){ + return x >= 0; +} + + static void lp_setup_line( struct lp_setup_context *setup, const float (*v1)[4], @@ -251,7 +256,7 @@ lp_setup_line( struct lp_setup_context *setup, struct lp_scene *scene = lp_setup_get_current_scene(setup); struct lp_rast_triangle *line; float oneoverarea; - float half_width = setup->line_width / 2; + float width = MAX2(1.0, setup->line_width); int minx, maxx, miny, maxy; int ix0, ix1, iy0, iy1; unsigned tri_bytes; @@ -260,7 +265,25 @@ lp_setup_line( struct lp_setup_context *setup, int i; int nr_planes = 4; boolean opaque; - + + /* linewidth should be interpreted as integer */ + int fixed_width = subpixel_snap(round(width)); + + float xdiamond_offset=0; + float ydiamond_offset=0; + float xdiamond_offset_end=0; + float ydiamond_offset_end=0; + + float x1diff; + float y1diff; + float x2diff; + float y2diff; + + boolean draw_start; + boolean draw_end; + boolean will_draw_start; + boolean will_draw_end; + if (0) print_line(setup, v1, v2); @@ -278,21 +301,76 @@ lp_setup_line( struct lp_setup_context *setup, if (!line) return; -#ifndef DEBUG +#ifdef DEBUG line->v[0][0] = v1[0][0]; line->v[1][0] = v2[0][0]; line->v[0][1] = v1[0][1]; line->v[1][1] = v2[0][1]; #endif - /* pre-calculation(based on given vertices) to determine if line is - * more horizontal or more vertical - */ line->dx = v1[0][0] - v2[0][0]; line->dy = v1[0][1] - v2[0][1]; - - /* x-major line */ + +/* X-MAJOR LINE */ if (fabsf(line->dx) >= fabsf(line->dy)) { + + x1diff = v1[0][0] - (float) floor(v1[0][0]) - 0.5; + y1diff = v1[0][1] - (float) floor(v1[0][1]) - 0.5; + x2diff = v2[0][0] - (float) floor(v2[0][0]) - 0.5; + y2diff = v2[0][1] - (float) floor(v2[0][1]) - 0.5; + + if (y2diff==-0.5 && line->dy<0){ + y2diff = 0.5; + } + + /* + * Diamond exit rule test for starting point + */ + if (fabsf(x1diff) + fabsf(y1diff) < 0.5) { + draw_start = TRUE; + } + else if (sign(x1diff) == sign(-line->dx)) { + draw_start = FALSE; + } + else if (sign(-y1diff) != sign(line->dy)) { + draw_start = TRUE; + } + else { + /* do intersection test */ + float yintersect = v1[0][1] + x1diff*((float)line->dy/(float)line->dx); + if (yintersect < ceil(v1[0][1]) && yintersect > floor(v1[0][1])){ + draw_start = TRUE; + } + else draw_start = FALSE; + } + + + /* + * Diamond exit rule test for ending point + */ + if (fabsf(x2diff) + fabsf(y2diff) < 0.5) { + draw_end = FALSE; + } + else if (sign(x2diff) != sign(-line->dx)) { + draw_end = FALSE; + } + else if (sign(-y2diff) == sign(line->dy)) { + draw_end = TRUE; + } + else { + /* do intersection test */ + float yintersect = v2[0][1] + x2diff*((float)line->dy/(float)line->dx); + if (yintersect < ceil(v2[0][1]) && yintersect > floor(v2[0][1])){ + draw_end = TRUE; + } + else draw_end = FALSE; + } + + /* Are we already drawing start/end? + */ + will_draw_start = sign(-x1diff) != sign(line->dx); + will_draw_end = (sign(x2diff) == sign(-line->dx)) || x2diff==0; + if (line->dx < 0) { /* if v2 is to the right of v1, swap pointers */ const float (*temp)[4] = v1; @@ -300,21 +378,102 @@ lp_setup_line( struct lp_setup_context *setup, v2 = temp; line->dx = -line->dx; line->dy = -line->dy; + /* Otherwise shift planes appropriately */ + if (will_draw_start != draw_start) { + xdiamond_offset_end = - x1diff - 0.5; + ydiamond_offset_end = xdiamond_offset_end*(float)line->dy/(float)line->dx; + + } + if (will_draw_end != draw_end) { + xdiamond_offset = - x2diff - 0.5; + ydiamond_offset = xdiamond_offset*(float)line->dy/(float)line->dx; + } + } - + else{ + /* Otherwise shift planes appropriately */ + if (will_draw_start != draw_start) { + xdiamond_offset = - x1diff + 0.5; + ydiamond_offset = xdiamond_offset*(float)line->dy/(float)line->dx; + } + if (will_draw_end != draw_end) { + xdiamond_offset_end = - x2diff + 0.5; + ydiamond_offset_end = xdiamond_offset_end*(float)line->dy/(float)line->dx; + } + } + /* x/y positions in fixed point */ - x[0] = subpixel_snap(v1[0][0] - setup->pixel_offset); - x[1] = subpixel_snap(v2[0][0] - setup->pixel_offset); - x[2] = subpixel_snap(v2[0][0] - setup->pixel_offset); - x[3] = subpixel_snap(v1[0][0] - setup->pixel_offset); + x[0] = subpixel_snap(v1[0][0] + xdiamond_offset - setup->pixel_offset); + x[1] = subpixel_snap(v2[0][0] + xdiamond_offset_end - setup->pixel_offset); + x[2] = subpixel_snap(v2[0][0] + xdiamond_offset_end - setup->pixel_offset); + x[3] = subpixel_snap(v1[0][0] + xdiamond_offset - setup->pixel_offset); + + y[0] = subpixel_snap(v1[0][1] + ydiamond_offset - setup->pixel_offset) - fixed_width/2; + y[1] = subpixel_snap(v2[0][1] + ydiamond_offset_end - setup->pixel_offset) - fixed_width/2; + y[2] = subpixel_snap(v2[0][1] + ydiamond_offset_end - setup->pixel_offset) + fixed_width/2; + y[3] = subpixel_snap(v1[0][1] + ydiamond_offset - setup->pixel_offset) + fixed_width/2; - y[0] = subpixel_snap(v1[0][1] - half_width - setup->pixel_offset); - y[1] = subpixel_snap(v2[0][1] - half_width - setup->pixel_offset); - y[2] = subpixel_snap(v2[0][1] + half_width - setup->pixel_offset); - y[3] = subpixel_snap(v1[0][1] + half_width - setup->pixel_offset); } + + else{ - /* y-major line */ +/* Y-MAJOR LINE */ + x1diff = v1[0][0] - (float) floor(v1[0][0]) - 0.5; + y1diff = v1[0][1] - (float) floor(v1[0][1]) - 0.5; + x2diff = v2[0][0] - (float) floor(v2[0][0]) - 0.5; + y2diff = v2[0][1] - (float) floor(v2[0][1]) - 0.5; + + if (x2diff==-0.5 && line->dx<0){ + x2diff = 0.5; + } + +/* + * Diamond exit rule test for starting point + */ + if (fabsf(x1diff) + fabsf(y1diff) < 0.5) { + draw_start = TRUE; + } + else if (sign(-y1diff) == sign(line->dy)) { + draw_start = FALSE; + } + else if (sign(x1diff) != sign(-line->dx)) { + draw_start = TRUE; + } + else { + /* do intersection test */ + float xintersect = v1[0][0] + y1diff*((float)line->dx/(float)line->dy); + if (xintersect < ceil(v1[0][0]) && xintersect > floor(v1[0][0])){ + draw_start = TRUE; + } + else draw_start = FALSE; + } + + /* + * Diamond exit rule test for ending point + */ + if (fabsf(x2diff) + fabsf(y2diff) < 0.5) { + draw_end = FALSE; + } + else if (sign(-y2diff) != sign(line->dy) ) { + draw_end = FALSE; + } + else if (sign(x2diff) == sign(-line->dx) ) { + draw_end = TRUE; + } + else { + /* do intersection test */ + float xintersect = v2[0][0] + y2diff*((float)line->dx/(float)line->dy); + if (xintersect < ceil(v2[0][0]) && xintersect > floor(v2[0][0])){ + draw_end = TRUE; + } + else draw_end = FALSE; + } + + /* Are we already drawing start/end? + */ + will_draw_start = sign(y1diff) == sign(line->dy); + will_draw_end = (sign(-y2diff) == sign(line->dy)) || y2diff==0; + if (line->dy > 0) { /* if v2 is on top of v1, swap pointers */ const float (*temp)[4] = v1; @@ -322,19 +481,44 @@ lp_setup_line( struct lp_setup_context *setup, v2 = temp; line->dx = -line->dx; line->dy = -line->dy; + + /* Otherwise shift planes appropriately */ + if (will_draw_start != draw_start) { + ydiamond_offset_end = - y1diff + 0.5; + xdiamond_offset_end = ydiamond_offset_end*(float)line->dx/(float)line->dy; + } + if (will_draw_end != draw_end) { + ydiamond_offset = - y2diff + 0.5; + xdiamond_offset = ydiamond_offset*(float)line->dx/(float)line->dy; + } + } + + else{ + /* Otherwise shift planes appropriately */ + if (will_draw_start != draw_start) { + ydiamond_offset = - y1diff - 0.5; + xdiamond_offset = ydiamond_offset*(float)line->dx/(float)line->dy; + + } + if (will_draw_end != draw_end) { + ydiamond_offset_end = - y2diff - 0.5; + xdiamond_offset_end = ydiamond_offset_end*(float)line->dx/(float)line->dy; + } } - x[0] = subpixel_snap(v1[0][0] - half_width - setup->pixel_offset); - x[1] = subpixel_snap(v2[0][0] - half_width - setup->pixel_offset); - x[2] = subpixel_snap(v2[0][0] + half_width - setup->pixel_offset); - x[3] = subpixel_snap(v1[0][0] + half_width - setup->pixel_offset); + /* x/y positions in fixed point */ + x[0] = subpixel_snap(v1[0][0] + xdiamond_offset - setup->pixel_offset) - fixed_width/2; + x[1] = subpixel_snap(v2[0][0] + xdiamond_offset_end - setup->pixel_offset) - fixed_width/2; + x[2] = subpixel_snap(v2[0][0] + xdiamond_offset_end - setup->pixel_offset) + fixed_width/2; + x[3] = subpixel_snap(v1[0][0] + xdiamond_offset - setup->pixel_offset) + fixed_width/2; - y[0] = subpixel_snap(v1[0][1] - setup->pixel_offset); - y[1] = subpixel_snap(v2[0][1] - setup->pixel_offset); - y[2] = subpixel_snap(v2[0][1] - setup->pixel_offset); - y[3] = subpixel_snap(v1[0][1] - setup->pixel_offset); + y[0] = subpixel_snap(v1[0][1] + ydiamond_offset - setup->pixel_offset); + y[1] = subpixel_snap(v2[0][1] + ydiamond_offset_end - setup->pixel_offset); + y[2] = subpixel_snap(v2[0][1] + ydiamond_offset_end - setup->pixel_offset); + y[3] = subpixel_snap(v1[0][1] + ydiamond_offset - setup->pixel_offset); } + /* calculate the deltas */ line->plane[0].dcdy = x[0] - x[1]; line->plane[1].dcdy = x[1] - x[2]; @@ -361,8 +545,8 @@ lp_setup_line( struct lp_setup_context *setup, minx = (MIN4(x[0], x[1], x[2], x[3]) + (FIXED_ONE-1)) >> FIXED_ORDER; maxx = (MAX4(x[0], x[1], x[2], x[3]) + (FIXED_ONE-1)) >> FIXED_ORDER; - miny = (MIN4(y[0], y[1], y[3], y[3]) + (FIXED_ONE-1) + adj) >> FIXED_ORDER; - maxy = (MAX4(y[0], y[1], y[3], y[3]) + (FIXED_ONE-1) + adj) >> FIXED_ORDER; + miny = (MIN4(y[0], y[1], y[2], y[3]) + (FIXED_ONE-1) + adj) >> FIXED_ORDER; + maxy = (MAX4(y[0], y[1], y[2], y[3]) + (FIXED_ONE-1) + adj) >> FIXED_ORDER; } if (setup->scissor_test) { @@ -526,7 +710,7 @@ lp_setup_line( struct lp_setup_context *setup, /* - * All fields of 'tri' are now set. The remaining code here is + * All fields of 'line' are now set. The remaining code here is * concerned with binning. */ -- cgit v1.2.3 From e826d0e8170028da553d2018b833af7c26b8dc1b Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Thu, 26 Aug 2010 20:03:03 +0100 Subject: util: add MIN4, MAX4 --- src/gallium/auxiliary/util/u_math.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src') diff --git a/src/gallium/auxiliary/util/u_math.h b/src/gallium/auxiliary/util/u_math.h index fe19466436..6ba4e24f4c 100644 --- a/src/gallium/auxiliary/util/u_math.h +++ b/src/gallium/auxiliary/util/u_math.h @@ -566,6 +566,9 @@ util_bswap16(uint16_t n) #define MIN3( A, B, C ) MIN2( MIN2( A, B ), C ) #define MAX3( A, B, C ) MAX2( MAX2( A, B ), C ) +#define MIN4( A, B, C, D ) MIN2( MIN2( A, B ), MIN2(C, D) ) +#define MAX4( A, B, C, D ) MAX2( MAX2( A, B ), MIN2(C, D) ) + /** * Align a value, only works pot alignemnts. -- cgit v1.2.3 From 3783053fa59fceef59fe0356af5c8dbc095e9adf Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Thu, 26 Aug 2010 20:09:22 +0100 Subject: llvmpipe: update line rasterization code to current master --- src/gallium/drivers/llvmpipe/lp_rast.h | 5 + src/gallium/drivers/llvmpipe/lp_setup_context.h | 32 +- src/gallium/drivers/llvmpipe/lp_setup_line.c | 531 +++++++++--------------- src/gallium/drivers/llvmpipe/lp_setup_tri.c | 33 +- 4 files changed, 227 insertions(+), 374 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/llvmpipe/lp_rast.h b/src/gallium/drivers/llvmpipe/lp_rast.h index b4564ef33b..37b4fdc31e 100644 --- a/src/gallium/drivers/llvmpipe/lp_rast.h +++ b/src/gallium/drivers/llvmpipe/lp_rast.h @@ -116,6 +116,11 @@ struct lp_rast_triangle { /* inputs for the shader */ struct lp_rast_shader_inputs inputs; + /* XXX: temporarily use these additional fields for line + * coefficient setup + */ + float dx, dy; + #ifdef DEBUG float v[3][2]; #endif diff --git a/src/gallium/drivers/llvmpipe/lp_setup_context.h b/src/gallium/drivers/llvmpipe/lp_setup_context.h index a4838d59a5..97919c09d4 100644 --- a/src/gallium/drivers/llvmpipe/lp_setup_context.h +++ b/src/gallium/drivers/llvmpipe/lp_setup_context.h @@ -171,26 +171,6 @@ lp_setup_print_vertex(struct lp_setup_context *setup, const char *name, const float (*v)[4]); -/** shared code between lp_setup_line and lp_setup_tri */ -extern lp_rast_cmd lp_rast_tri_tab[]; - -void -do_triangle_ccw_whole_tile(struct lp_setup_context *setup, - struct lp_scene *scene, - struct lp_rast_triangle *tri, - int x, int y, - boolean opaque, - int *is_blit); - - -void -lp_setup_tri_coefficients( struct lp_setup_context *setup, - struct lp_rast_triangle *tri, - float oneoverarea, - const float (*v1)[4], - const float (*v2)[4], - const float (*v3)[4], - boolean frontface); struct lp_rast_triangle * lp_setup_alloc_triangle(struct lp_scene *scene, @@ -199,14 +179,10 @@ lp_setup_alloc_triangle(struct lp_scene *scene, unsigned *tri_size); void -lp_setup_fragcoord_coef(struct lp_setup_context *setup, - struct lp_rast_triangle *tri, - float oneoverarea, - unsigned slot, - const float (*v1)[4], - const float (*v2)[4], - const float (*v3)[4], - unsigned usage_mask); +lp_setup_bin_triangle( struct lp_setup_context *setup, + struct lp_rast_triangle *tri, + const struct u_rect *bbox, + int nr_planes ); #endif diff --git a/src/gallium/drivers/llvmpipe/lp_setup_line.c b/src/gallium/drivers/llvmpipe/lp_setup_line.c index 1566203117..ebf000dd19 100644 --- a/src/gallium/drivers/llvmpipe/lp_setup_line.c +++ b/src/gallium/drivers/llvmpipe/lp_setup_line.c @@ -39,35 +39,6 @@ #define NUM_CHANNELS 4 -static const int step_scissor_minx[16] = { - 0, 1, 0, 1, - 2, 3, 2, 3, - 0, 1, 0, 1, - 2, 3, 2, 3 -}; - -static const int step_scissor_maxx[16] = { - 0, -1, 0, -1, - -2, -3, -2, -3, - 0, -1, 0, -1, - -2, -3, -2, -3 -}; - -static const int step_scissor_miny[16] = { - 0, 0, 1, 1, - 0, 0, 1, 1, - 2, 2, 3, 3, - 2, 2, 3, 3 -}; - -static const int step_scissor_maxy[16] = { - 0, 0, -1, -1, - 0, 0, -1, -1, - -2, -2, -3, -3, - -2, -2, -3, -3 -}; - - /** * Compute a0 for a constant-valued coefficient (GL_FLAT shading). @@ -147,6 +118,40 @@ static void perspective_coef( struct lp_setup_context *setup, dady * (v1[0][1] - setup->pixel_offset))); } +static void +setup_fragcoord_coef( struct lp_setup_context *setup, + struct lp_rast_triangle *tri, + float oneoverarea, + unsigned slot, + const float (*v1)[4], + const float (*v2)[4], + unsigned usage_mask) +{ + /*X*/ + if (usage_mask & TGSI_WRITEMASK_X) { + tri->inputs.a0[slot][0] = 0.0; + tri->inputs.dadx[slot][0] = 1.0; + tri->inputs.dady[slot][0] = 0.0; + } + + /*Y*/ + if (usage_mask & TGSI_WRITEMASK_Y) { + tri->inputs.a0[slot][1] = 0.0; + tri->inputs.dadx[slot][1] = 0.0; + tri->inputs.dady[slot][1] = 1.0; + } + + /*Z*/ + if (usage_mask & TGSI_WRITEMASK_Z) { + linear_coef(setup, tri, oneoverarea, slot, v1, v2, 0, 2); + } + + /*W*/ + if (usage_mask & TGSI_WRITEMASK_W) { + linear_coef(setup, tri, oneoverarea, slot, v1, v2, 0, 3); + } +} + /** * Compute the tri->coef[] array dadx, dady, a0 values. */ @@ -209,8 +214,8 @@ static void setup_line_coefficients( struct lp_setup_context *setup, /* The internal position input is in slot zero: */ - lp_setup_fragcoord_coef(setup, tri, oneoverarea, 0, v1, v2, v2, - fragcoord_usage_mask); + setup_fragcoord_coef(setup, tri, oneoverarea, 0, v1, v2, + fragcoord_usage_mask); } @@ -248,6 +253,15 @@ static INLINE boolean sign(float x){ } +/* Used on positive floats only: + */ +static INLINE float fracf(float f) +{ + return f - floorf(f); +} + + + static void lp_setup_line( struct lp_setup_context *setup, const float (*v1)[4], @@ -257,27 +271,26 @@ lp_setup_line( struct lp_setup_context *setup, struct lp_rast_triangle *line; float oneoverarea; float width = MAX2(1.0, setup->line_width); - int minx, maxx, miny, maxy; - int ix0, ix1, iy0, iy1; + struct u_rect bbox; unsigned tri_bytes; int x[4]; int y[4]; int i; int nr_planes = 4; - boolean opaque; /* linewidth should be interpreted as integer */ int fixed_width = subpixel_snap(round(width)); - float xdiamond_offset=0; - float ydiamond_offset=0; - float xdiamond_offset_end=0; - float ydiamond_offset_end=0; + float x_offset=0; + float y_offset=0; + float x_offset_end=0; + float y_offset_end=0; float x1diff; float y1diff; float x2diff; float y2diff; + float dx, dy; boolean draw_start; boolean draw_end; @@ -294,32 +307,20 @@ lp_setup_line( struct lp_setup_context *setup, nr_planes = 4; } - line = lp_setup_alloc_triangle(scene, - setup->fs.nr_inputs, - nr_planes, - &tri_bytes); - if (!line) - return; - -#ifdef DEBUG - line->v[0][0] = v1[0][0]; - line->v[1][0] = v2[0][0]; - line->v[0][1] = v1[0][1]; - line->v[1][1] = v2[0][1]; -#endif - line->dx = v1[0][0] - v2[0][0]; - line->dy = v1[0][1] - v2[0][1]; + dx = v1[0][0] - v2[0][0]; + dy = v1[0][1] - v2[0][1]; -/* X-MAJOR LINE */ - if (fabsf(line->dx) >= fabsf(line->dy)) { + /* X-MAJOR LINE */ + if (fabsf(dx) >= fabsf(dy)) { + float dydx = dy / dx; x1diff = v1[0][0] - (float) floor(v1[0][0]) - 0.5; y1diff = v1[0][1] - (float) floor(v1[0][1]) - 0.5; x2diff = v2[0][0] - (float) floor(v2[0][0]) - 0.5; y2diff = v2[0][1] - (float) floor(v2[0][1]) - 0.5; - if (y2diff==-0.5 && line->dy<0){ + if (y2diff==-0.5 && dy<0){ y2diff = 0.5; } @@ -329,19 +330,16 @@ lp_setup_line( struct lp_setup_context *setup, if (fabsf(x1diff) + fabsf(y1diff) < 0.5) { draw_start = TRUE; } - else if (sign(x1diff) == sign(-line->dx)) { + else if (sign(x1diff) == sign(-dx)) { draw_start = FALSE; } - else if (sign(-y1diff) != sign(line->dy)) { + else if (sign(-y1diff) != sign(dy)) { draw_start = TRUE; } else { /* do intersection test */ - float yintersect = v1[0][1] + x1diff*((float)line->dy/(float)line->dx); - if (yintersect < ceil(v1[0][1]) && yintersect > floor(v1[0][1])){ - draw_start = TRUE; - } - else draw_start = FALSE; + float yintersect = fracf(v1[0][1]) + x1diff * dydx; + draw_start = (yintersect < 1.0 && yintersect > 0.0); } @@ -351,101 +349,95 @@ lp_setup_line( struct lp_setup_context *setup, if (fabsf(x2diff) + fabsf(y2diff) < 0.5) { draw_end = FALSE; } - else if (sign(x2diff) != sign(-line->dx)) { + else if (sign(x2diff) != sign(-dx)) { draw_end = FALSE; } - else if (sign(-y2diff) == sign(line->dy)) { + else if (sign(-y2diff) == sign(dy)) { draw_end = TRUE; } else { /* do intersection test */ - float yintersect = v2[0][1] + x2diff*((float)line->dy/(float)line->dx); - if (yintersect < ceil(v2[0][1]) && yintersect > floor(v2[0][1])){ - draw_end = TRUE; - } - else draw_end = FALSE; + float yintersect = fracf(v2[0][1]) + x2diff * dydx; + draw_end = (yintersect < 1.0 && yintersect > 0.0); } /* Are we already drawing start/end? */ - will_draw_start = sign(-x1diff) != sign(line->dx); - will_draw_end = (sign(x2diff) == sign(-line->dx)) || x2diff==0; + will_draw_start = sign(-x1diff) != sign(dx); + will_draw_end = (sign(x2diff) == sign(-dx)) || x2diff==0; - if (line->dx < 0) { + if (dx < 0) { /* if v2 is to the right of v1, swap pointers */ const float (*temp)[4] = v1; v1 = v2; v2 = temp; - line->dx = -line->dx; - line->dy = -line->dy; + dx = -dx; + dy = -dy; /* Otherwise shift planes appropriately */ if (will_draw_start != draw_start) { - xdiamond_offset_end = - x1diff - 0.5; - ydiamond_offset_end = xdiamond_offset_end*(float)line->dy/(float)line->dx; + x_offset_end = - x1diff - 0.5; + y_offset_end = x_offset_end * dydx; } if (will_draw_end != draw_end) { - xdiamond_offset = - x2diff - 0.5; - ydiamond_offset = xdiamond_offset*(float)line->dy/(float)line->dx; + x_offset = - x2diff - 0.5; + y_offset = x_offset * dydx; } } else{ /* Otherwise shift planes appropriately */ if (will_draw_start != draw_start) { - xdiamond_offset = - x1diff + 0.5; - ydiamond_offset = xdiamond_offset*(float)line->dy/(float)line->dx; + x_offset = - x1diff + 0.5; + y_offset = x_offset * dydx; } if (will_draw_end != draw_end) { - xdiamond_offset_end = - x2diff + 0.5; - ydiamond_offset_end = xdiamond_offset_end*(float)line->dy/(float)line->dx; + x_offset_end = - x2diff + 0.5; + y_offset_end = x_offset_end * dydx; } } /* x/y positions in fixed point */ - x[0] = subpixel_snap(v1[0][0] + xdiamond_offset - setup->pixel_offset); - x[1] = subpixel_snap(v2[0][0] + xdiamond_offset_end - setup->pixel_offset); - x[2] = subpixel_snap(v2[0][0] + xdiamond_offset_end - setup->pixel_offset); - x[3] = subpixel_snap(v1[0][0] + xdiamond_offset - setup->pixel_offset); + x[0] = subpixel_snap(v1[0][0] + x_offset - setup->pixel_offset); + x[1] = subpixel_snap(v2[0][0] + x_offset_end - setup->pixel_offset); + x[2] = subpixel_snap(v2[0][0] + x_offset_end - setup->pixel_offset); + x[3] = subpixel_snap(v1[0][0] + x_offset - setup->pixel_offset); - y[0] = subpixel_snap(v1[0][1] + ydiamond_offset - setup->pixel_offset) - fixed_width/2; - y[1] = subpixel_snap(v2[0][1] + ydiamond_offset_end - setup->pixel_offset) - fixed_width/2; - y[2] = subpixel_snap(v2[0][1] + ydiamond_offset_end - setup->pixel_offset) + fixed_width/2; - y[3] = subpixel_snap(v1[0][1] + ydiamond_offset - setup->pixel_offset) + fixed_width/2; + y[0] = subpixel_snap(v1[0][1] + y_offset - setup->pixel_offset) - fixed_width/2; + y[1] = subpixel_snap(v2[0][1] + y_offset_end - setup->pixel_offset) - fixed_width/2; + y[2] = subpixel_snap(v2[0][1] + y_offset_end - setup->pixel_offset) + fixed_width/2; + y[3] = subpixel_snap(v1[0][1] + y_offset - setup->pixel_offset) + fixed_width/2; } + else { + const float dxdy = dx / dy; - - else{ -/* Y-MAJOR LINE */ + /* Y-MAJOR LINE */ x1diff = v1[0][0] - (float) floor(v1[0][0]) - 0.5; y1diff = v1[0][1] - (float) floor(v1[0][1]) - 0.5; x2diff = v2[0][0] - (float) floor(v2[0][0]) - 0.5; y2diff = v2[0][1] - (float) floor(v2[0][1]) - 0.5; - if (x2diff==-0.5 && line->dx<0){ + if (x2diff==-0.5 && dx<0) { x2diff = 0.5; } -/* - * Diamond exit rule test for starting point - */ + /* + * Diamond exit rule test for starting point + */ if (fabsf(x1diff) + fabsf(y1diff) < 0.5) { draw_start = TRUE; } - else if (sign(-y1diff) == sign(line->dy)) { + else if (sign(-y1diff) == sign(dy)) { draw_start = FALSE; } - else if (sign(x1diff) != sign(-line->dx)) { + else if (sign(x1diff) != sign(-dx)) { draw_start = TRUE; } else { /* do intersection test */ - float xintersect = v1[0][0] + y1diff*((float)line->dx/(float)line->dy); - if (xintersect < ceil(v1[0][0]) && xintersect > floor(v1[0][0])){ - draw_start = TRUE; - } - else draw_start = FALSE; + float xintersect = fracf(v1[0][0]) + y1diff * dxdy; + draw_start = (xintersect < 1.0 && xintersect > 0.0); } /* @@ -454,82 +446,67 @@ lp_setup_line( struct lp_setup_context *setup, if (fabsf(x2diff) + fabsf(y2diff) < 0.5) { draw_end = FALSE; } - else if (sign(-y2diff) != sign(line->dy) ) { + else if (sign(-y2diff) != sign(dy) ) { draw_end = FALSE; } - else if (sign(x2diff) == sign(-line->dx) ) { + else if (sign(x2diff) == sign(-dx) ) { draw_end = TRUE; } else { /* do intersection test */ - float xintersect = v2[0][0] + y2diff*((float)line->dx/(float)line->dy); - if (xintersect < ceil(v2[0][0]) && xintersect > floor(v2[0][0])){ - draw_end = TRUE; - } - else draw_end = FALSE; + float xintersect = fracf(v2[0][0]) + y2diff * dxdy; + draw_end = (xintersect < 1.0 && xintersect > 0.0); } /* Are we already drawing start/end? */ - will_draw_start = sign(y1diff) == sign(line->dy); - will_draw_end = (sign(-y2diff) == sign(line->dy)) || y2diff==0; + will_draw_start = sign(y1diff) == sign(dy); + will_draw_end = (sign(-y2diff) == sign(dy)) || y2diff==0; - if (line->dy > 0) { + if (dy > 0) { /* if v2 is on top of v1, swap pointers */ const float (*temp)[4] = v1; v1 = v2; v2 = temp; - line->dx = -line->dx; - line->dy = -line->dy; + dx = -dx; + dy = -dy; /* Otherwise shift planes appropriately */ if (will_draw_start != draw_start) { - ydiamond_offset_end = - y1diff + 0.5; - xdiamond_offset_end = ydiamond_offset_end*(float)line->dx/(float)line->dy; + y_offset_end = - y1diff + 0.5; + x_offset_end = y_offset_end * dxdy; } if (will_draw_end != draw_end) { - ydiamond_offset = - y2diff + 0.5; - xdiamond_offset = ydiamond_offset*(float)line->dx/(float)line->dy; + y_offset = - y2diff + 0.5; + x_offset = y_offset * dxdy; } } - - else{ + else { /* Otherwise shift planes appropriately */ if (will_draw_start != draw_start) { - ydiamond_offset = - y1diff - 0.5; - xdiamond_offset = ydiamond_offset*(float)line->dx/(float)line->dy; + y_offset = - y1diff - 0.5; + x_offset = y_offset * dxdy; } if (will_draw_end != draw_end) { - ydiamond_offset_end = - y2diff - 0.5; - xdiamond_offset_end = ydiamond_offset_end*(float)line->dx/(float)line->dy; + y_offset_end = - y2diff - 0.5; + x_offset_end = y_offset_end * dxdy; } } /* x/y positions in fixed point */ - x[0] = subpixel_snap(v1[0][0] + xdiamond_offset - setup->pixel_offset) - fixed_width/2; - x[1] = subpixel_snap(v2[0][0] + xdiamond_offset_end - setup->pixel_offset) - fixed_width/2; - x[2] = subpixel_snap(v2[0][0] + xdiamond_offset_end - setup->pixel_offset) + fixed_width/2; - x[3] = subpixel_snap(v1[0][0] + xdiamond_offset - setup->pixel_offset) + fixed_width/2; + x[0] = subpixel_snap(v1[0][0] + x_offset - setup->pixel_offset) - fixed_width/2; + x[1] = subpixel_snap(v2[0][0] + x_offset_end - setup->pixel_offset) - fixed_width/2; + x[2] = subpixel_snap(v2[0][0] + x_offset_end - setup->pixel_offset) + fixed_width/2; + x[3] = subpixel_snap(v1[0][0] + x_offset - setup->pixel_offset) + fixed_width/2; - y[0] = subpixel_snap(v1[0][1] + ydiamond_offset - setup->pixel_offset); - y[1] = subpixel_snap(v2[0][1] + ydiamond_offset_end - setup->pixel_offset); - y[2] = subpixel_snap(v2[0][1] + ydiamond_offset_end - setup->pixel_offset); - y[3] = subpixel_snap(v1[0][1] + ydiamond_offset - setup->pixel_offset); + y[0] = subpixel_snap(v1[0][1] + y_offset - setup->pixel_offset); + y[1] = subpixel_snap(v2[0][1] + y_offset_end - setup->pixel_offset); + y[2] = subpixel_snap(v2[0][1] + y_offset_end - setup->pixel_offset); + y[3] = subpixel_snap(v1[0][1] + y_offset - setup->pixel_offset); } - /* calculate the deltas */ - line->plane[0].dcdy = x[0] - x[1]; - line->plane[1].dcdy = x[1] - x[2]; - line->plane[2].dcdy = x[2] - x[3]; - line->plane[3].dcdy = x[3] - x[0]; - - line->plane[0].dcdx = y[0] - y[1]; - line->plane[1].dcdx = y[1] - y[2]; - line->plane[2].dcdx = y[2] - y[3]; - line->plane[3].dcdx = y[3] - y[0]; - LP_COUNT(nr_tris); @@ -543,37 +520,70 @@ lp_setup_line( struct lp_setup_context *setup, */ int adj = (setup->pixel_offset != 0) ? 1 : 0; - minx = (MIN4(x[0], x[1], x[2], x[3]) + (FIXED_ONE-1)) >> FIXED_ORDER; - maxx = (MAX4(x[0], x[1], x[2], x[3]) + (FIXED_ONE-1)) >> FIXED_ORDER; - miny = (MIN4(y[0], y[1], y[2], y[3]) + (FIXED_ONE-1) + adj) >> FIXED_ORDER; - maxy = (MAX4(y[0], y[1], y[2], y[3]) + (FIXED_ONE-1) + adj) >> FIXED_ORDER; + bbox.x0 = (MIN4(x[0], x[1], x[2], x[3]) + (FIXED_ONE-1)) >> FIXED_ORDER; + bbox.x1 = (MAX4(x[0], x[1], x[2], x[3]) + (FIXED_ONE-1)) >> FIXED_ORDER; + bbox.y0 = (MIN4(y[0], y[1], y[2], y[3]) + (FIXED_ONE-1) + adj) >> FIXED_ORDER; + bbox.y1 = (MAX4(y[0], y[1], y[2], y[3]) + (FIXED_ONE-1) + adj) >> FIXED_ORDER; + + /* Inclusive coordinates: + */ + bbox.x1--; + bbox.y1--; } - if (setup->scissor_test) { - minx = MAX2(minx, setup->scissor.current.minx); - maxx = MIN2(maxx, setup->scissor.current.maxx); - miny = MAX2(miny, setup->scissor.current.miny); - maxy = MIN2(maxy, setup->scissor.current.maxy); + if (bbox.x1 < bbox.x0 || + bbox.y1 < bbox.y0) { + if (0) debug_printf("empty bounding box\n"); + LP_COUNT(nr_culled_tris); + return; } - else { - minx = MAX2(minx, 0); - miny = MAX2(miny, 0); - maxx = MIN2(maxx, scene->fb.width); - maxy = MIN2(maxy, scene->fb.height); + + if (!u_rect_test_intersection(&setup->draw_region, &bbox)) { + if (0) debug_printf("offscreen\n"); + LP_COUNT(nr_culled_tris); + return; } + u_rect_find_intersection(&setup->draw_region, &bbox); - if (miny >= maxy || minx >= maxx) { - lp_scene_putback_data( scene, tri_bytes ); + line = lp_setup_alloc_triangle(scene, + setup->fs.nr_inputs, + nr_planes, + &tri_bytes); + if (!line) return; - } - oneoverarea = 1.0f / (line->dx * line->dx + line->dy * line->dy); +#ifdef DEBUG + line->v[0][0] = v1[0][0]; + line->v[1][0] = v2[0][0]; + line->v[0][1] = v1[0][1]; + line->v[1][1] = v2[0][1]; +#endif + + line->dx = dx; + line->dy = dy; + + /* calculate the deltas */ + line->plane[0].dcdy = x[0] - x[1]; + line->plane[1].dcdy = x[1] - x[2]; + line->plane[2].dcdy = x[2] - x[3]; + line->plane[3].dcdy = x[3] - x[0]; + + line->plane[0].dcdx = y[0] - y[1]; + line->plane[1].dcdx = y[1] - y[2]; + line->plane[2].dcdx = y[2] - y[3]; + line->plane[3].dcdx = y[3] - y[0]; + + + oneoverarea = 1.0f / (dx * dx + dy * dy); /* Setup parameter interpolants: */ setup_line_coefficients( setup, line, oneoverarea, v1, v2); + line->inputs.facing = 1.0F; + line->inputs.state = setup->fs.stored; + for (i = 0; i < 4; i++) { struct lp_rast_plane *plane = &line->plane[i]; @@ -628,35 +638,6 @@ lp_setup_line( struct lp_setup_context *setup, /* Calculate trivial accept offsets from the above. */ plane->ei = plane->dcdy - plane->dcdx - plane->eo; - - plane->step = line->step[i]; - - /* Fill in the inputs.step[][] arrays. - * We've manually unrolled some loops here. - */ -#define SETUP_STEP(j, x, y) \ - line->step[i][j] = y * plane->dcdy - x * plane->dcdx - - SETUP_STEP(0, 0, 0); - SETUP_STEP(1, 1, 0); - SETUP_STEP(2, 0, 1); - SETUP_STEP(3, 1, 1); - - SETUP_STEP(4, 2, 0); - SETUP_STEP(5, 3, 0); - SETUP_STEP(6, 2, 1); - SETUP_STEP(7, 3, 1); - - SETUP_STEP(8, 0, 2); - SETUP_STEP(9, 1, 2); - SETUP_STEP(10, 0, 3); - SETUP_STEP(11, 1, 3); - - SETUP_STEP(12, 2, 2); - SETUP_STEP(13, 3, 2); - SETUP_STEP(14, 2, 3); - SETUP_STEP(15, 3, 3); -#undef STEP } @@ -679,154 +660,34 @@ lp_setup_line( struct lp_setup_context *setup, * these planes elsewhere. */ if (nr_planes == 8) { - line->plane[4].step = step_scissor_maxx; - line->plane[4].dcdx = 1; + line->plane[4].dcdx = -1; line->plane[4].dcdy = 0; - line->plane[4].c = maxx; - line->plane[4].ei = -1; - line->plane[4].eo = 0; - - line->plane[5].step = step_scissor_miny; - line->plane[5].dcdx = 0; - line->plane[5].dcdy = 1; - line->plane[5].c = 1-miny; - line->plane[5].ei = 0; - line->plane[5].eo = 1; - - line->plane[6].step = step_scissor_maxy; - line->plane[6].dcdx = 0; - line->plane[6].dcdy = -1; - line->plane[6].c = maxy; - line->plane[6].ei = -1; - line->plane[6].eo = 0; - - line->plane[7].step = step_scissor_minx; - line->plane[7].dcdx = -1; - line->plane[7].dcdy = 0; - line->plane[7].c = 1-minx; - line->plane[7].ei = 0; - line->plane[7].eo = 1; - } - + line->plane[4].c = 1-bbox.x0; + line->plane[4].ei = 0; + line->plane[4].eo = 1; - /* - * All fields of 'line' are now set. The remaining code here is - * concerned with binning. - */ + line->plane[5].dcdx = 1; + line->plane[5].dcdy = 0; + line->plane[5].c = bbox.x1+1; + line->plane[5].ei = -1; + line->plane[5].eo = 0; - /* Convert to tile coordinates, and inclusive ranges: - */ - ix0 = minx / TILE_SIZE; - iy0 = miny / TILE_SIZE; - ix1 = (maxx-1) / TILE_SIZE; - iy1 = (maxy-1) / TILE_SIZE; - - /* - * Clamp to framebuffer size - */ - assert(ix0 == MAX2(ix0, 0)); - assert(iy0 == MAX2(iy0, 0)); - assert(ix1 == MIN2(ix1, scene->tiles_x - 1)); - assert(iy1 == MIN2(iy1, scene->tiles_y - 1)); - - /* Determine which tile(s) intersect the triangle's bounding box - */ - if (iy0 == iy1 && ix0 == ix1) - { - /* Triangle is contained in a single tile: - */ - lp_scene_bin_command( scene, ix0, iy0, - lp_rast_tri_tab[nr_planes], - lp_rast_arg_triangle(line, (1<plane[6].dcdx = 0; + line->plane[6].dcdy = 1; + line->plane[6].c = 1-bbox.y0; + line->plane[6].ei = 0; + line->plane[6].eo = 1; + + line->plane[7].dcdx = 0; + line->plane[7].dcdy = -1; + line->plane[7].c = bbox.y1+1; + line->plane[7].ei = -1; + line->plane[7].eo = 0; } - else - { - int c[8]; - int ei[8]; - int eo[8]; - int xstep[8]; - int ystep[8]; - int x, y; - int is_blit = -1; /* undetermined */ - - for (i = 0; i < nr_planes; i++) { - c[i] = (line->plane[i].c + - line->plane[i].dcdy * iy0 * TILE_SIZE - - line->plane[i].dcdx * ix0 * TILE_SIZE); - - ei[i] = line->plane[i].ei << TILE_ORDER; - eo[i] = line->plane[i].eo << TILE_ORDER; - xstep[i] = -(line->plane[i].dcdx << TILE_ORDER); - ystep[i] = line->plane[i].dcdy << TILE_ORDER; - } - - - /* Test tile-sized blocks against the triangle. - * Discard blocks fully outside the tri. If the block is fully - * contained inside the tri, bin an lp_rast_shade_tile command. - * Else, bin a lp_rast_triangle command. - */ - for (y = iy0; y <= iy1; y++) - { - boolean in = FALSE; /* are we inside the triangle? */ - int cx[8]; - - for (i = 0; i < nr_planes; i++) - cx[i] = c[i]; - - for (x = ix0; x <= ix1; x++) - { - int out = 0; - int partial = 0; - - for (i = 0; i < nr_planes; i++) { - int planeout = cx[i] + eo[i]; - int planepartial = cx[i] + ei[i] - 1; - out |= (planeout >> 31); - partial |= (planepartial >> 31) & (1<fs.current.variant; struct lp_rast_triangle *tri; int x[3]; int y[3]; @@ -196,7 +194,6 @@ do_triangle_ccw(struct lp_setup_context *setup, struct lp_tri_info info; int area; struct u_rect bbox; - int ix0, ix1, iy0, iy1; unsigned tri_bytes; int i; int nr_planes = 3; @@ -423,6 +420,20 @@ do_triangle_ccw(struct lp_setup_context *setup, tri->plane[6].eo = 0; } + lp_setup_bin_triangle( setup, tri, &bbox, nr_planes ); +} + + +void +lp_setup_bin_triangle( struct lp_setup_context *setup, + struct lp_rast_triangle *tri, + const struct u_rect *bbox, + int nr_planes ) +{ + struct lp_scene *scene = setup->scene; + struct lp_fragment_shader_variant *variant = setup->fs.current.variant; + int ix0, ix1, iy0, iy1; + int i; /* * All fields of 'tri' are now set. The remaining code here is @@ -432,10 +443,10 @@ do_triangle_ccw(struct lp_setup_context *setup, /* Convert to tile coordinates, and inclusive ranges: */ if (nr_planes == 3) { - int ix0 = bbox.x0 / 16; - int iy0 = bbox.y0 / 16; - int ix1 = bbox.x1 / 16; - int iy1 = bbox.y1 / 16; + int ix0 = bbox->x0 / 16; + int iy0 = bbox->y0 / 16; + int ix1 = bbox->x1 / 16; + int iy1 = bbox->y1 / 16; if (iy0 == iy1 && ix0 == ix1) { @@ -451,10 +462,10 @@ do_triangle_ccw(struct lp_setup_context *setup, } } - ix0 = bbox.x0 / TILE_SIZE; - iy0 = bbox.y0 / TILE_SIZE; - ix1 = bbox.x1 / TILE_SIZE; - iy1 = bbox.y1 / TILE_SIZE; + ix0 = bbox->x0 / TILE_SIZE; + iy0 = bbox->y0 / TILE_SIZE; + ix1 = bbox->x1 / TILE_SIZE; + iy1 = bbox->y1 / TILE_SIZE; /* * Clamp to framebuffer size -- cgit v1.2.3 From 57d84d9ca4a645ca326b66ff3b82bee0db18ac97 Mon Sep 17 00:00:00 2001 From: Hui Qi Tay Date: Fri, 27 Aug 2010 10:37:09 +0100 Subject: llvmpipe: native point rasterization Conflicts: src/gallium/drivers/llvmpipe/lp_setup_context.h src/gallium/drivers/llvmpipe/lp_setup_line.c src/gallium/drivers/llvmpipe/lp_setup_tri.c --- src/gallium/drivers/llvmpipe/lp_context.c | 6 +- src/gallium/drivers/llvmpipe/lp_context.h | 3 + src/gallium/drivers/llvmpipe/lp_setup.c | 15 ++ src/gallium/drivers/llvmpipe/lp_setup.h | 4 + src/gallium/drivers/llvmpipe/lp_setup_context.h | 2 + src/gallium/drivers/llvmpipe/lp_setup_point.c | 225 ++++++++++++++++++++- src/gallium/drivers/llvmpipe/lp_state_derived.c | 10 + src/gallium/drivers/llvmpipe/lp_state_rasterizer.c | 2 + 8 files changed, 262 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/llvmpipe/lp_context.c b/src/gallium/drivers/llvmpipe/lp_context.c index a6873abbee..c52b17b298 100644 --- a/src/gallium/drivers/llvmpipe/lp_context.c +++ b/src/gallium/drivers/llvmpipe/lp_context.c @@ -155,8 +155,10 @@ llvmpipe_create_context( struct pipe_screen *screen, void *priv ) draw_install_aapoint_stage(llvmpipe->draw, &llvmpipe->pipe); draw_install_pstipple_stage(llvmpipe->draw, &llvmpipe->pipe); - /* convert points and lines into triangles: */ - draw_wide_point_threshold(llvmpipe->draw, 0.0); + /* convert points and lines into triangles: + * (otherwise, draw points and lines natively) + */ + draw_wide_point_threshold(llvmpipe->draw, 10000.0); draw_wide_line_threshold(llvmpipe->draw, 10000.0); #if USE_DRAW_STAGE_PSTIPPLE diff --git a/src/gallium/drivers/llvmpipe/lp_context.h b/src/gallium/drivers/llvmpipe/lp_context.h index 50f9091c3c..34fa20e204 100644 --- a/src/gallium/drivers/llvmpipe/lp_context.h +++ b/src/gallium/drivers/llvmpipe/lp_context.h @@ -101,6 +101,9 @@ struct llvmpipe_context { /** Vertex format */ struct vertex_info vertex_info; + + /** Which vertex shader output slot contains point size */ + int psize_slot; /** Fragment shader input interpolation info */ unsigned num_inputs; diff --git a/src/gallium/drivers/llvmpipe/lp_setup.c b/src/gallium/drivers/llvmpipe/lp_setup.c index 4c8275665e..778bfb4f6e 100644 --- a/src/gallium/drivers/llvmpipe/lp_setup.c +++ b/src/gallium/drivers/llvmpipe/lp_setup.c @@ -494,6 +494,15 @@ lp_setup_set_line_state( struct lp_setup_context *setup, setup->line_width = line_width; } +void +lp_setup_set_point_state( struct lp_setup_context *setup, + float point_size) +{ + LP_DBG(DEBUG_SETUP, "%s\n", __FUNCTION__); + + setup->point_size = point_size; +} + void lp_setup_set_fs_inputs( struct lp_setup_context *setup, const struct lp_shader_input *input, @@ -733,6 +742,12 @@ lp_setup_update_state( struct lp_setup_context *setup ) */ { struct llvmpipe_context *lp = llvmpipe_context(scene->pipe); + + /* Will probably need to move this somewhere else, just need + * to know about vertex shader point size attribute. + */ + setup->psize = lp->psize_slot; + if (lp->dirty) { llvmpipe_update_derived(lp); } diff --git a/src/gallium/drivers/llvmpipe/lp_setup.h b/src/gallium/drivers/llvmpipe/lp_setup.h index 693550b8c8..6b041e7071 100644 --- a/src/gallium/drivers/llvmpipe/lp_setup.h +++ b/src/gallium/drivers/llvmpipe/lp_setup.h @@ -104,6 +104,10 @@ void lp_setup_set_line_state( struct lp_setup_context *setup, float line_width); +void +lp_setup_set_point_state( struct lp_setup_context *setup, + float point_size); + void lp_setup_set_fs_inputs( struct lp_setup_context *setup, const struct lp_shader_input *interp, diff --git a/src/gallium/drivers/llvmpipe/lp_setup_context.h b/src/gallium/drivers/llvmpipe/lp_setup_context.h index 97919c09d4..7d486afbbf 100644 --- a/src/gallium/drivers/llvmpipe/lp_setup_context.h +++ b/src/gallium/drivers/llvmpipe/lp_setup_context.h @@ -92,6 +92,8 @@ struct lp_setup_context unsigned cullmode; float pixel_offset; float line_width; + float point_size; + float psize; struct pipe_framebuffer_state fb; struct u_rect framebuffer; diff --git a/src/gallium/drivers/llvmpipe/lp_setup_point.c b/src/gallium/drivers/llvmpipe/lp_setup_point.c index 709c3e2fd2..07a28fc6e3 100644 --- a/src/gallium/drivers/llvmpipe/lp_setup_point.c +++ b/src/gallium/drivers/llvmpipe/lp_setup_point.c @@ -1,6 +1,6 @@ /************************************************************************** * - * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas. + * Copyright 2010, VMware Inc. * All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a @@ -18,7 +18,7 @@ * 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 TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR + * IN NO EVENT SHALL VMWARE AND/OR ITS 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. @@ -30,10 +30,229 @@ */ #include "lp_setup_context.h" +#include "util/u_math.h" +#include "util/u_memory.h" +#include "lp_perf.h" +#include "lp_setup_context.h" +#include "lp_rast.h" +#include "lp_state_fs.h" + +#define NUM_CHANNELS 4 + +struct point_info { + /* x,y deltas */ + int dy01, dy12; + int dx01, dx12; + + const float (*v0)[4]; +}; + + +/** + * Compute a0 for a constant-valued coefficient (GL_FLAT shading). + */ +static void constant_coef( struct lp_setup_context *setup, + struct lp_rast_triangle *point, + unsigned slot, + const float value, + unsigned i ) +{ + point->inputs.a0[slot][i] = value; + point->inputs.dadx[slot][i] = 0.0f; + point->inputs.dady[slot][i] = 0.0f; +} + +/** + * Special coefficient setup for gl_FragCoord. + * X and Y are trivial + * Z and W are copied from position_coef which should have already been computed. + * We could do a bit less work if we'd examine gl_FragCoord's swizzle mask. + */ +static void +setup_point_fragcoord_coef(struct lp_setup_context *setup, + struct lp_rast_triangle *point, + const struct point_info *info, + unsigned slot, + unsigned usage_mask) +{ + /*X*/ + if (usage_mask & TGSI_WRITEMASK_X) { + point->inputs.a0[slot][0] = 0.0; + point->inputs.dadx[slot][0] = 1.0; + point->inputs.dady[slot][0] = 0.0; + } + + /*Y*/ + if (usage_mask & TGSI_WRITEMASK_Y) { + point->inputs.a0[slot][1] = 0.0; + point->inputs.dadx[slot][1] = 0.0; + point->inputs.dady[slot][1] = 1.0; + } + + /*Z*/ + if (usage_mask & TGSI_WRITEMASK_Z) { + constant_coef(setup, point, slot, info->v0[0][2], 2); + } + + /*W*/ + if (usage_mask & TGSI_WRITEMASK_W) { + constant_coef(setup, point, slot, info->v0[0][3], 3); + } +} + +/** + * Compute the point->coef[] array dadx, dady, a0 values. + */ +static void +setup_point_coefficients( struct lp_setup_context *setup, + struct lp_rast_triangle *point, + const struct point_info *info) +{ + unsigned fragcoord_usage_mask = TGSI_WRITEMASK_XYZ; + unsigned slot; + + /* setup interpolation for all the remaining attributes: + */ + for (slot = 0; slot < setup->fs.nr_inputs; slot++) { + unsigned vert_attr = setup->fs.input[slot].src_index; + unsigned usage_mask = setup->fs.input[slot].usage_mask; + unsigned i; + + switch (setup->fs.input[slot].interp) { + case LP_INTERP_POSITION: + /* + * The generated pixel interpolators will pick up the coeffs from + * slot 0, so all need to ensure that the usage mask is covers all + * usages. + */ + fragcoord_usage_mask |= usage_mask; + break; + + default: + for (i = 0; i < NUM_CHANNELS; i++) { + if (usage_mask & (1 << i)) + constant_coef(setup, point, slot+1, info->v0[vert_attr][i], i); + } + } + } + + /* The internal position input is in slot zero: + */ + setup_point_fragcoord_coef(setup, point, info, 0, + fragcoord_usage_mask); +} + +static INLINE int +subpixel_snap(float a) +{ + return util_iround(FIXED_ONE * a); +} + static void lp_setup_point( struct lp_setup_context *setup, - const float (*v0)[4] ) + const float (*v0)[4] ) { + /* x/y positions in fixed point */ + const int sizeAttr = setup->psize; + const float size + = sizeAttr > 0 ? v0[sizeAttr][0] + : setup->point_size; + const float half_width = 0.5F * size; + + const int x0 = subpixel_snap(v0[0][0] - half_width - setup->pixel_offset); + const int x1 = subpixel_snap(v0[0][0] - half_width - setup->pixel_offset); + const int x2 = subpixel_snap(v0[0][0] + half_width - setup->pixel_offset); + const int y0 = subpixel_snap(v0[0][1] - half_width - setup->pixel_offset); + const int y1 = subpixel_snap(v0[0][1] + half_width - setup->pixel_offset); + const int y2 = subpixel_snap(v0[0][1] + half_width - setup->pixel_offset); + struct lp_scene *scene = lp_setup_get_current_scene(setup); + struct lp_rast_triangle *point; + unsigned bytes; + struct u_rect bbox; + unsigned nr_planes = 4; + struct point_info info; + + + /* Bounding rectangle (in pixels) */ + { + /* Yes this is necessary to accurately calculate bounding boxes + * with the two fill-conventions we support. GL (normally) ends + * up needing a bottom-left fill convention, which requires + * slightly different rounding. + */ + int adj = (setup->pixel_offset != 0) ? 1 : 0; + + bbox.x0 = (MIN3(x0, x1, x2) + (FIXED_ONE-1)) >> FIXED_ORDER; + bbox.x1 = (MAX3(x0, x1, x2) + (FIXED_ONE-1)) >> FIXED_ORDER; + bbox.y0 = (MIN3(y0, y1, y2) + (FIXED_ONE-1) + adj) >> FIXED_ORDER; + bbox.y1 = (MAX3(y0, y1, y2) + (FIXED_ONE-1) + adj) >> FIXED_ORDER; + + /* Inclusive coordinates: + */ + bbox.x1--; + bbox.y1--; + } + + if (!u_rect_test_intersection(&setup->draw_region, &bbox)) { + if (0) debug_printf("offscreen\n"); + LP_COUNT(nr_culled_tris); + return; + } + + u_rect_find_intersection(&setup->draw_region, &bbox); + + point = lp_setup_alloc_triangle(scene, + setup->fs.nr_inputs, + nr_planes, + &bytes); + if (!point) + return; + +#ifdef DEBUG + point->v[0][0] = v0[0][0]; + point->v[0][1] = v0[0][1]; +#endif + + info.v0 = v0; + info.dx01 = x1 - x0; + info.dx12 = x2 - x1; + info.dy01 = y1 - y0; + info.dy12 = y2 - y1; + + /* Setup parameter interpolants: + */ + setup_point_coefficients(setup, point, &info); + + point->inputs.facing = 1.0F; + point->inputs.state = setup->fs.stored; + + { + point->plane[0].dcdx = -1; + point->plane[0].dcdy = 0; + point->plane[0].c = 1-bbox.x0; + point->plane[0].ei = 0; + point->plane[0].eo = 1; + + point->plane[1].dcdx = 1; + point->plane[1].dcdy = 0; + point->plane[1].c = bbox.x1+1; + point->plane[1].ei = -1; + point->plane[1].eo = 0; + + point->plane[2].dcdx = 0; + point->plane[2].dcdy = 1; + point->plane[2].c = 1-bbox.y0; + point->plane[2].ei = 0; + point->plane[2].eo = 1; + + point->plane[3].dcdx = 0; + point->plane[3].dcdy = -1; + point->plane[3].c = bbox.y1+1; + point->plane[3].ei = -1; + point->plane[3].eo = 0; + } + + lp_setup_bin_triangle(setup, point, &bbox, nr_planes); } diff --git a/src/gallium/drivers/llvmpipe/lp_state_derived.c b/src/gallium/drivers/llvmpipe/lp_state_derived.c index 77bec4640b..9ef9983307 100644 --- a/src/gallium/drivers/llvmpipe/lp_state_derived.c +++ b/src/gallium/drivers/llvmpipe/lp_state_derived.c @@ -125,6 +125,16 @@ compute_vertex_info(struct llvmpipe_context *llvmpipe) inputs[i].src_index = vinfo->num_attribs; draw_emit_vertex_attr(vinfo, EMIT_4F, INTERP_PERSPECTIVE, vs_index); } + + /* Figure out if we need pointsize as well. + */ + llvmpipe->psize_slot = draw_find_shader_output(llvmpipe->draw, + TGSI_SEMANTIC_PSIZE, 0); + if (llvmpipe->psize_slot > 0) { + draw_emit_vertex_attr(vinfo, EMIT_4F, INTERP_CONSTANT, + llvmpipe->psize_slot); + } + llvmpipe->num_inputs = lpfs->info.num_inputs; draw_compute_vertex_size(vinfo); diff --git a/src/gallium/drivers/llvmpipe/lp_state_rasterizer.c b/src/gallium/drivers/llvmpipe/lp_state_rasterizer.c index 67b985aa24..f845a0c6e5 100644 --- a/src/gallium/drivers/llvmpipe/lp_state_rasterizer.c +++ b/src/gallium/drivers/llvmpipe/lp_state_rasterizer.c @@ -75,6 +75,8 @@ llvmpipe_bind_rasterizer_state(struct pipe_context *pipe, void *handle) llvmpipe->rasterizer->flatshade_first); lp_setup_set_line_state( llvmpipe->setup, llvmpipe->rasterizer->line_width); + lp_setup_set_point_state( llvmpipe->setup, + llvmpipe->rasterizer->point_size); } llvmpipe->dirty |= LP_NEW_RASTERIZER; -- cgit v1.2.3 From 2cd72dd4590b4510931854ed776c72563603f7ff Mon Sep 17 00:00:00 2001 From: Hui Qi Tay Date: Fri, 27 Aug 2010 10:46:19 +0100 Subject: llvmpipe: native point rasterization with better pixel rasterization A few subpixel_snap and fixed width changes. Conflicts: src/gallium/drivers/llvmpipe/lp_setup_point.c --- src/gallium/drivers/llvmpipe/lp_setup_point.c | 34 ++++++++++++++------------- 1 file changed, 18 insertions(+), 16 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/llvmpipe/lp_setup_point.c b/src/gallium/drivers/llvmpipe/lp_setup_point.c index 07a28fc6e3..afbc816fb9 100644 --- a/src/gallium/drivers/llvmpipe/lp_setup_point.c +++ b/src/gallium/drivers/llvmpipe/lp_setup_point.c @@ -157,14 +157,16 @@ static void lp_setup_point( struct lp_setup_context *setup, const float size = sizeAttr > 0 ? v0[sizeAttr][0] : setup->point_size; - const float half_width = 0.5F * size; - - const int x0 = subpixel_snap(v0[0][0] - half_width - setup->pixel_offset); - const int x1 = subpixel_snap(v0[0][0] - half_width - setup->pixel_offset); - const int x2 = subpixel_snap(v0[0][0] + half_width - setup->pixel_offset); - const int y0 = subpixel_snap(v0[0][1] - half_width - setup->pixel_offset); - const int y1 = subpixel_snap(v0[0][1] + half_width - setup->pixel_offset); - const int y2 = subpixel_snap(v0[0][1] + half_width - setup->pixel_offset); + + /* Point size as fixed point integer, remove rounding errors + * and gives minimum width for very small points + */ + int fixed_width = MAX2(FIXED_ONE, + (subpixel_snap(size) + FIXED_ONE/2 - 1) & ~(FIXED_ONE-1)); + + const int x0 = subpixel_snap(v0[0][0] - setup->pixel_offset) - fixed_width/2; + const int y0 = subpixel_snap(v0[0][1] - setup->pixel_offset) - fixed_width/2; + struct lp_scene *scene = lp_setup_get_current_scene(setup); struct lp_rast_triangle *point; unsigned bytes; @@ -182,10 +184,10 @@ static void lp_setup_point( struct lp_setup_context *setup, */ int adj = (setup->pixel_offset != 0) ? 1 : 0; - bbox.x0 = (MIN3(x0, x1, x2) + (FIXED_ONE-1)) >> FIXED_ORDER; - bbox.x1 = (MAX3(x0, x1, x2) + (FIXED_ONE-1)) >> FIXED_ORDER; - bbox.y0 = (MIN3(y0, y1, y2) + (FIXED_ONE-1) + adj) >> FIXED_ORDER; - bbox.y1 = (MAX3(y0, y1, y2) + (FIXED_ONE-1) + adj) >> FIXED_ORDER; + bbox.x0 = (x0 + (FIXED_ONE-1) + adj) >> FIXED_ORDER; + bbox.x1 = (x0 + fixed_width + (FIXED_ONE-1) + adj) >> FIXED_ORDER; + bbox.y0 = (y0 + (FIXED_ONE-1)) >> FIXED_ORDER; + bbox.y1 = (y0 + fixed_width + (FIXED_ONE-1)) >> FIXED_ORDER; /* Inclusive coordinates: */ @@ -214,10 +216,10 @@ static void lp_setup_point( struct lp_setup_context *setup, #endif info.v0 = v0; - info.dx01 = x1 - x0; - info.dx12 = x2 - x1; - info.dy01 = y1 - y0; - info.dy12 = y2 - y1; + info.dx01 = 0; + info.dx12 = fixed_width; + info.dy01 = fixed_width; + info.dy12 = 0; /* Setup parameter interpolants: */ -- cgit v1.2.3 From 29ec116e8f21c65250f1083830b82ff59859496d Mon Sep 17 00:00:00 2001 From: Hui Qi Tay Date: Tue, 10 Aug 2010 11:41:32 +0100 Subject: llvmpipe: point sprites rasterization Point sprites now done in the rasterizer setup code instead of going through the draw module. --- src/gallium/drivers/llvmpipe/lp_context.c | 2 + src/gallium/drivers/llvmpipe/lp_setup.c | 6 ++- src/gallium/drivers/llvmpipe/lp_setup.h | 4 +- src/gallium/drivers/llvmpipe/lp_setup_context.h | 2 + src/gallium/drivers/llvmpipe/lp_setup_point.c | 63 +++++++++++++++++++++- src/gallium/drivers/llvmpipe/lp_state_derived.c | 20 +++++-- src/gallium/drivers/llvmpipe/lp_state_rasterizer.c | 6 ++- 7 files changed, 93 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/llvmpipe/lp_context.c b/src/gallium/drivers/llvmpipe/lp_context.c index c52b17b298..39f2c6085e 100644 --- a/src/gallium/drivers/llvmpipe/lp_context.c +++ b/src/gallium/drivers/llvmpipe/lp_context.c @@ -158,6 +158,8 @@ llvmpipe_create_context( struct pipe_screen *screen, void *priv ) /* convert points and lines into triangles: * (otherwise, draw points and lines natively) */ + draw_wide_point_sprites(llvmpipe->draw, FALSE); + draw_enable_point_sprites(llvmpipe->draw, FALSE); draw_wide_point_threshold(llvmpipe->draw, 10000.0); draw_wide_line_threshold(llvmpipe->draw, 10000.0); diff --git a/src/gallium/drivers/llvmpipe/lp_setup.c b/src/gallium/drivers/llvmpipe/lp_setup.c index 778bfb4f6e..3da9097154 100644 --- a/src/gallium/drivers/llvmpipe/lp_setup.c +++ b/src/gallium/drivers/llvmpipe/lp_setup.c @@ -496,11 +496,15 @@ lp_setup_set_line_state( struct lp_setup_context *setup, void lp_setup_set_point_state( struct lp_setup_context *setup, - float point_size) + float point_size, + boolean point_size_per_vertex, + uint sprite) { LP_DBG(DEBUG_SETUP, "%s\n", __FUNCTION__); setup->point_size = point_size; + setup->sprite = sprite; + setup->point_size_per_vertex = point_size_per_vertex; } void diff --git a/src/gallium/drivers/llvmpipe/lp_setup.h b/src/gallium/drivers/llvmpipe/lp_setup.h index 6b041e7071..821ebb1087 100644 --- a/src/gallium/drivers/llvmpipe/lp_setup.h +++ b/src/gallium/drivers/llvmpipe/lp_setup.h @@ -106,7 +106,9 @@ lp_setup_set_line_state( struct lp_setup_context *setup, void lp_setup_set_point_state( struct lp_setup_context *setup, - float point_size); + float point_size, + boolean point_size_per_vertex, + uint sprite); void lp_setup_set_fs_inputs( struct lp_setup_context *setup, diff --git a/src/gallium/drivers/llvmpipe/lp_setup_context.h b/src/gallium/drivers/llvmpipe/lp_setup_context.h index 7d486afbbf..877a492c6d 100644 --- a/src/gallium/drivers/llvmpipe/lp_setup_context.h +++ b/src/gallium/drivers/llvmpipe/lp_setup_context.h @@ -74,6 +74,7 @@ struct lp_setup_context uint prim; uint vertex_size; uint nr_vertices; + uint sprite; uint vertex_buffer_size; void *vertex_buffer; @@ -89,6 +90,7 @@ struct lp_setup_context boolean flatshade_first; boolean ccw_is_frontface; boolean scissor_test; + boolean point_size_per_vertex; unsigned cullmode; float pixel_offset; float line_width; diff --git a/src/gallium/drivers/llvmpipe/lp_setup_point.c b/src/gallium/drivers/llvmpipe/lp_setup_point.c index afbc816fb9..6ae318d328 100644 --- a/src/gallium/drivers/llvmpipe/lp_setup_point.c +++ b/src/gallium/drivers/llvmpipe/lp_setup_point.c @@ -36,6 +36,7 @@ #include "lp_setup_context.h" #include "lp_rast.h" #include "lp_state_fs.h" +#include "tgsi/tgsi_scan.h" #define NUM_CHANNELS 4 @@ -62,6 +63,49 @@ static void constant_coef( struct lp_setup_context *setup, point->inputs.dady[slot][i] = 0.0f; } +static void perspective_coef( struct lp_setup_context *setup, + struct lp_rast_triangle *point, + const struct point_info *info, + unsigned slot, + unsigned vert_attr, + unsigned i) +{ + if (i == 0) { + float dadx = FIXED_ONE / (float)info->dx12; + float dady = 0.0f; + point->inputs.dadx[slot][i] = dadx; + point->inputs.dady[slot][i] = dady; + point->inputs.a0[slot][i] = (0.5 - + (dadx * ((float)info->v0[0][0] - setup->pixel_offset) + + dady * ((float)info->v0[0][1] - setup->pixel_offset))); + } + + else if (i == 1) { + float dadx = 0.0f; + float dady = FIXED_ONE / (float)info->dx12; + + point->inputs.dadx[slot][i] = dadx; + point->inputs.dady[slot][i] = dady; + point->inputs.a0[slot][i] = (0.5 - + (dadx * ((float)info->v0[0][0] - setup->pixel_offset) + + dady * ((float)info->v0[0][1] - setup->pixel_offset))); + } + + else if (i == 2) { + point->inputs.a0[slot][i] = 0.0f; + point->inputs.dadx[slot][i] = 0.0f; + point->inputs.dady[slot][i] = 0.0f; + } + + else if (i == 3) { + point->inputs.a0[slot][i] = 1.0f; + point->inputs.dadx[slot][i] = 0.0f; + point->inputs.dady[slot][i] = 0.0f; + } + +} + + /** * Special coefficient setup for gl_FragCoord. * X and Y are trivial @@ -128,6 +172,23 @@ setup_point_coefficients( struct lp_setup_context *setup, fragcoord_usage_mask |= usage_mask; break; + case LP_INTERP_PERSPECTIVE: + /* For point sprite textures */ + if (setup->fs.current.variant->shader->info.input_semantic_name[slot] + == TGSI_SEMANTIC_GENERIC) + { + int index = setup->fs.current.variant->shader->info.input_semantic_index[slot]; + + if (setup->sprite & (1 << index)) { + for (i = 0; i < NUM_CHANNELS; i++) + if (usage_mask & (1 << i)) + perspective_coef(setup, point, info, slot+1, vert_attr, i); + fragcoord_usage_mask |= TGSI_WRITEMASK_W; + break; + } + } + + /* Otherwise fallthrough */ default: for (i = 0; i < NUM_CHANNELS; i++) { if (usage_mask & (1 << i)) @@ -155,7 +216,7 @@ static void lp_setup_point( struct lp_setup_context *setup, /* x/y positions in fixed point */ const int sizeAttr = setup->psize; const float size - = sizeAttr > 0 ? v0[sizeAttr][0] + = (setup->point_size_per_vertex && sizeAttr > 0) ? v0[sizeAttr][0] : setup->point_size; /* Point size as fixed point integer, remove rounding errors diff --git a/src/gallium/drivers/llvmpipe/lp_state_derived.c b/src/gallium/drivers/llvmpipe/lp_state_derived.c index 9ef9983307..edd723f65f 100644 --- a/src/gallium/drivers/llvmpipe/lp_state_derived.c +++ b/src/gallium/drivers/llvmpipe/lp_state_derived.c @@ -74,6 +74,15 @@ compute_vertex_info(struct llvmpipe_context *llvmpipe) vs_index = draw_find_shader_output(llvmpipe->draw, lpfs->info.input_semantic_name[i], lpfs->info.input_semantic_index[i]); + if (vs_index < 0) { + /* + * This can happen with sprite coordinates - the vertex + * shader doesn't need to provide an output as we generate + * them internally. However, lets keep pretending that there + * is something there to not confuse other code. + */ + vs_index = 0; + } /* This can be pre-computed, except for flatshade: */ @@ -128,11 +137,12 @@ compute_vertex_info(struct llvmpipe_context *llvmpipe) /* Figure out if we need pointsize as well. */ - llvmpipe->psize_slot = draw_find_shader_output(llvmpipe->draw, - TGSI_SEMANTIC_PSIZE, 0); - if (llvmpipe->psize_slot > 0) { - draw_emit_vertex_attr(vinfo, EMIT_4F, INTERP_CONSTANT, - llvmpipe->psize_slot); + vs_index = draw_find_shader_output(llvmpipe->draw, + TGSI_SEMANTIC_PSIZE, 0); + + if (vs_index > 0) { + llvmpipe->psize_slot = vinfo->num_attribs; + draw_emit_vertex_attr(vinfo, EMIT_4F, INTERP_CONSTANT, vs_index); } llvmpipe->num_inputs = lpfs->info.num_inputs; diff --git a/src/gallium/drivers/llvmpipe/lp_state_rasterizer.c b/src/gallium/drivers/llvmpipe/lp_state_rasterizer.c index f845a0c6e5..0bad7320f3 100644 --- a/src/gallium/drivers/llvmpipe/lp_state_rasterizer.c +++ b/src/gallium/drivers/llvmpipe/lp_state_rasterizer.c @@ -76,8 +76,10 @@ llvmpipe_bind_rasterizer_state(struct pipe_context *pipe, void *handle) lp_setup_set_line_state( llvmpipe->setup, llvmpipe->rasterizer->line_width); lp_setup_set_point_state( llvmpipe->setup, - llvmpipe->rasterizer->point_size); - } + llvmpipe->rasterizer->point_size, + llvmpipe->rasterizer->point_size_per_vertex, + llvmpipe->rasterizer->sprite_coord_enable); + } llvmpipe->dirty |= LP_NEW_RASTERIZER; } -- cgit v1.2.3 From aea6b415deffd7613d67dc85876afab151b7460e Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Fri, 27 Aug 2010 11:03:58 +0100 Subject: llvmpipe: eliminate tri->dx, tri->dy values Use an internal struct for line setup information. --- src/gallium/drivers/llvmpipe/lp_rast.h | 5 -- src/gallium/drivers/llvmpipe/lp_setup_line.c | 76 ++++++++++++++-------------- 2 files changed, 39 insertions(+), 42 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/llvmpipe/lp_rast.h b/src/gallium/drivers/llvmpipe/lp_rast.h index 37b4fdc31e..b4564ef33b 100644 --- a/src/gallium/drivers/llvmpipe/lp_rast.h +++ b/src/gallium/drivers/llvmpipe/lp_rast.h @@ -116,11 +116,6 @@ struct lp_rast_triangle { /* inputs for the shader */ struct lp_rast_shader_inputs inputs; - /* XXX: temporarily use these additional fields for line - * coefficient setup - */ - float dx, dy; - #ifdef DEBUG float v[3][2]; #endif diff --git a/src/gallium/drivers/llvmpipe/lp_setup_line.c b/src/gallium/drivers/llvmpipe/lp_setup_line.c index ebf000dd19..cf770f521d 100644 --- a/src/gallium/drivers/llvmpipe/lp_setup_line.c +++ b/src/gallium/drivers/llvmpipe/lp_setup_line.c @@ -38,6 +38,15 @@ #define NUM_CHANNELS 4 +struct lp_line_info { + + float dx; + float dy; + float oneoverarea; + + const float (*v1)[4]; + const float (*v2)[4]; +}; /** @@ -61,26 +70,24 @@ static void constant_coef( struct lp_setup_context *setup, */ static void linear_coef( struct lp_setup_context *setup, struct lp_rast_triangle *tri, - float oneoverarea, + struct lp_line_info *info, unsigned slot, - const float (*v1)[4], - const float (*v2)[4], unsigned vert_attr, unsigned i) { - float a1 = v1[vert_attr][i]; - float a2 = v2[vert_attr][i]; + float a1 = info->v1[vert_attr][i]; + float a2 = info->v2[vert_attr][i]; float da21 = a1 - a2; - float dadx = da21 * tri->dx * oneoverarea; - float dady = da21 * tri->dy * oneoverarea; + float dadx = da21 * info->dx * info->oneoverarea; + float dady = da21 * info->dy * info->oneoverarea; tri->inputs.dadx[slot][i] = dadx; tri->inputs.dady[slot][i] = dady; tri->inputs.a0[slot][i] = (a1 - - (dadx * (v1[0][0] - setup->pixel_offset) + - dady * (v1[0][1] - setup->pixel_offset))); + (dadx * (info->v1[0][0] - setup->pixel_offset) + + dady * (info->v1[0][1] - setup->pixel_offset))); } @@ -94,37 +101,33 @@ static void linear_coef( struct lp_setup_context *setup, */ static void perspective_coef( struct lp_setup_context *setup, struct lp_rast_triangle *tri, - float oneoverarea, + struct lp_line_info *info, unsigned slot, - const float (*v1)[4], - const float (*v2)[4], unsigned vert_attr, unsigned i) { /* premultiply by 1/w (v[0][3] is always 1/w): */ - float a1 = v1[vert_attr][i] * v1[0][3]; - float a2 = v2[vert_attr][i] * v2[0][3]; + float a1 = info->v1[vert_attr][i] * info->v1[0][3]; + float a2 = info->v2[vert_attr][i] * info->v2[0][3]; float da21 = a1 - a2; - float dadx = da21 * tri->dx * oneoverarea; - float dady = da21 * tri->dy * oneoverarea; + float dadx = da21 * info->dx * info->oneoverarea; + float dady = da21 * info->dy * info->oneoverarea; tri->inputs.dadx[slot][i] = dadx; tri->inputs.dady[slot][i] = dady; tri->inputs.a0[slot][i] = (a1 - - (dadx * (v1[0][0] - setup->pixel_offset) + - dady * (v1[0][1] - setup->pixel_offset))); + (dadx * (info->v1[0][0] - setup->pixel_offset) + + dady * (info->v1[0][1] - setup->pixel_offset))); } static void setup_fragcoord_coef( struct lp_setup_context *setup, struct lp_rast_triangle *tri, - float oneoverarea, + struct lp_line_info *info, unsigned slot, - const float (*v1)[4], - const float (*v2)[4], unsigned usage_mask) { /*X*/ @@ -143,12 +146,12 @@ setup_fragcoord_coef( struct lp_setup_context *setup, /*Z*/ if (usage_mask & TGSI_WRITEMASK_Z) { - linear_coef(setup, tri, oneoverarea, slot, v1, v2, 0, 2); + linear_coef(setup, tri, info, slot, 0, 2); } /*W*/ if (usage_mask & TGSI_WRITEMASK_W) { - linear_coef(setup, tri, oneoverarea, slot, v1, v2, 0, 3); + linear_coef(setup, tri, info, slot, 0, 3); } } @@ -157,9 +160,7 @@ setup_fragcoord_coef( struct lp_setup_context *setup, */ static void setup_line_coefficients( struct lp_setup_context *setup, struct lp_rast_triangle *tri, - float oneoverarea, - const float (*v1)[4], - const float (*v2)[4]) + struct lp_line_info *info) { unsigned fragcoord_usage_mask = TGSI_WRITEMASK_XYZ; unsigned slot; @@ -176,25 +177,25 @@ static void setup_line_coefficients( struct lp_setup_context *setup, if (setup->flatshade_first) { for (i = 0; i < NUM_CHANNELS; i++) if (usage_mask & (1 << i)) - constant_coef(setup, tri, slot+1, v1[vert_attr][i], i); + constant_coef(setup, tri, slot+1, info->v1[vert_attr][i], i); } else { for (i = 0; i < NUM_CHANNELS; i++) if (usage_mask & (1 << i)) - constant_coef(setup, tri, slot+1, v2[vert_attr][i], i); + constant_coef(setup, tri, slot+1, info->v2[vert_attr][i], i); } break; case LP_INTERP_LINEAR: for (i = 0; i < NUM_CHANNELS; i++) if (usage_mask & (1 << i)) - linear_coef(setup, tri, oneoverarea, slot+1, v1, v2, vert_attr, i); + linear_coef(setup, tri, info, slot+1, vert_attr, i); break; case LP_INTERP_PERSPECTIVE: for (i = 0; i < NUM_CHANNELS; i++) if (usage_mask & (1 << i)) - perspective_coef(setup, tri, oneoverarea, slot+1, v1, v2, vert_attr, i); + perspective_coef(setup, tri, info, slot+1, vert_attr, i); fragcoord_usage_mask |= TGSI_WRITEMASK_W; break; @@ -214,7 +215,7 @@ static void setup_line_coefficients( struct lp_setup_context *setup, /* The internal position input is in slot zero: */ - setup_fragcoord_coef(setup, tri, oneoverarea, 0, v1, v2, + setup_fragcoord_coef(setup, tri, info, 0, fragcoord_usage_mask); } @@ -269,7 +270,7 @@ lp_setup_line( struct lp_setup_context *setup, { struct lp_scene *scene = lp_setup_get_current_scene(setup); struct lp_rast_triangle *line; - float oneoverarea; + struct lp_line_info info; float width = MAX2(1.0, setup->line_width); struct u_rect bbox; unsigned tri_bytes; @@ -560,9 +561,6 @@ lp_setup_line( struct lp_setup_context *setup, line->v[1][1] = v2[0][1]; #endif - line->dx = dx; - line->dy = dy; - /* calculate the deltas */ line->plane[0].dcdy = x[0] - x[1]; line->plane[1].dcdy = x[1] - x[2]; @@ -575,11 +573,15 @@ lp_setup_line( struct lp_setup_context *setup, line->plane[3].dcdx = y[3] - y[0]; - oneoverarea = 1.0f / (dx * dx + dy * dy); + info.oneoverarea = 1.0f / (dx * dx + dy * dy); + info.dx = dx; + info.dy = dy; + info.v1 = v1; + info.v2 = v2; /* Setup parameter interpolants: */ - setup_line_coefficients( setup, line, oneoverarea, v1, v2); + setup_line_coefficients( setup, line, &info); line->inputs.facing = 1.0F; line->inputs.state = setup->fs.stored; -- cgit v1.2.3 From 04f8560dd826b62e96da5deed43910f767953707 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Fri, 27 Aug 2010 13:29:00 +0100 Subject: util: fix typo in MAX4 Thanks to Michal for spotting it. --- src/gallium/auxiliary/util/u_math.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/auxiliary/util/u_math.h b/src/gallium/auxiliary/util/u_math.h index 6ba4e24f4c..af510dac51 100644 --- a/src/gallium/auxiliary/util/u_math.h +++ b/src/gallium/auxiliary/util/u_math.h @@ -567,7 +567,7 @@ util_bswap16(uint16_t n) #define MAX3( A, B, C ) MAX2( MAX2( A, B ), C ) #define MIN4( A, B, C, D ) MIN2( MIN2( A, B ), MIN2(C, D) ) -#define MAX4( A, B, C, D ) MAX2( MAX2( A, B ), MIN2(C, D) ) +#define MAX4( A, B, C, D ) MAX2( MAX2( A, B ), MAX2(C, D) ) /** -- cgit v1.2.3 From 55f4eab93cf964a2ffa540fef9485b6f737a6f41 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Fri, 27 Aug 2010 13:40:23 +0100 Subject: llvmpipe: use util_iround in place of round Fix mingw build. --- src/gallium/drivers/llvmpipe/lp_setup_line.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/drivers/llvmpipe/lp_setup_line.c b/src/gallium/drivers/llvmpipe/lp_setup_line.c index cf770f521d..ce2da55cf4 100644 --- a/src/gallium/drivers/llvmpipe/lp_setup_line.c +++ b/src/gallium/drivers/llvmpipe/lp_setup_line.c @@ -280,7 +280,7 @@ lp_setup_line( struct lp_setup_context *setup, int nr_planes = 4; /* linewidth should be interpreted as integer */ - int fixed_width = subpixel_snap(round(width)); + int fixed_width = util_iround(width) * FIXED_ONE; float x_offset=0; float y_offset=0; -- cgit v1.2.3 From 476adf796b150ca93fcfaf6c6d97a9eedd678561 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 27 Aug 2010 10:21:59 -0600 Subject: mesa: fix double-underscore naming --- src/mesa/main/shaderobj.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/mesa/main/shaderobj.c b/src/mesa/main/shaderobj.c index bcf7d313f9..65d8d116db 100644 --- a/src/mesa/main/shaderobj.c +++ b/src/mesa/main/shaderobj.c @@ -118,7 +118,7 @@ _mesa_new_shader(GLcontext *ctx, GLuint name, GLenum type) * Called via ctx->Driver.DeleteShader(). */ static void -__mesa_delete_shader(GLcontext *ctx, struct gl_shader *sh) +_mesa_delete_shader(GLcontext *ctx, struct gl_shader *sh) { if (sh->Source) free((void *) sh->Source); @@ -338,7 +338,7 @@ _mesa_free_shader_program_data(GLcontext *ctx, * Called via ctx->Driver.DeleteShaderProgram(). */ static void -__mesa_delete_shader_program(GLcontext *ctx, struct gl_shader_program *shProg) +_mesa_delete_shader_program(GLcontext *ctx, struct gl_shader_program *shProg) { _mesa_free_shader_program_data(ctx, shProg); @@ -400,9 +400,9 @@ void _mesa_init_shader_object_functions(struct dd_function_table *driver) { driver->NewShader = _mesa_new_shader; - driver->DeleteShader = __mesa_delete_shader; + driver->DeleteShader = _mesa_delete_shader; driver->NewShaderProgram = _mesa_new_shader_program; - driver->DeleteShaderProgram = __mesa_delete_shader_program; + driver->DeleteShaderProgram = _mesa_delete_shader_program; driver->CompileShader = _mesa_ir_compile_shader; driver->LinkShader = _mesa_ir_link_shader; } -- cgit v1.2.3 From c8e0970667d2b4d92abe22bf099cafee4acb717b Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 27 Aug 2010 10:51:47 -0600 Subject: mesa: free the fallback texture object in free_shared_state() --- src/mesa/main/shared.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src') diff --git a/src/mesa/main/shared.c b/src/mesa/main/shared.c index cbe004518a..ea7e503cf3 100644 --- a/src/mesa/main/shared.c +++ b/src/mesa/main/shared.c @@ -288,6 +288,10 @@ free_shared_state(GLcontext *ctx, struct gl_shared_state *shared) { GLuint i; + /* Free the dummy/fallback texture object */ + if (shared->FallbackTex) + ctx->Driver.DeleteTexture(ctx, shared->FallbackTex); + /* * Free display lists */ -- cgit v1.2.3 From 83e3a2d97095d0ef062f210673eb23031fe1cb9a Mon Sep 17 00:00:00 2001 From: Zack Rusin Date: Fri, 27 Aug 2010 13:09:38 -0400 Subject: graw: fix the build (missing header) --- src/gallium/targets/graw-xlib/graw_xlib.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/gallium/targets/graw-xlib/graw_xlib.c b/src/gallium/targets/graw-xlib/graw_xlib.c index 41120ba3c7..8b64a0b819 100644 --- a/src/gallium/targets/graw-xlib/graw_xlib.c +++ b/src/gallium/targets/graw-xlib/graw_xlib.c @@ -1,5 +1,6 @@ #include "pipe/p_compiler.h" #include "pipe/p_context.h" +#include "pipe/p_screen.h" #include "util/u_debug.h" #include "util/u_memory.h" #include "target-helpers/wrap_screen.h" -- cgit v1.2.3 From 0435cb348aaa8f2d8163a38517a098e27a81adef Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Fri, 27 Aug 2010 12:00:29 -0700 Subject: i965: Fix swizzling in vector splitting for the new FS backend. We weren't smearing a component of a split RHS out to reach an unsplit LHS's writemask, so gl_FragColor (always unsplit) would often get uninitialized values. Fixes: glsl-algebraic-add-add-1 (and probably many others). --- src/mesa/drivers/dri/i965/brw_fs_vector_splitting.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_fs_vector_splitting.cpp b/src/mesa/drivers/dri/i965/brw_fs_vector_splitting.cpp index d4da86b3b0..00d5c20248 100644 --- a/src/mesa/drivers/dri/i965/brw_fs_vector_splitting.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs_vector_splitting.cpp @@ -281,6 +281,9 @@ ir_vector_splitting_visitor::visit_leave(ir_assignment *ir) if (rhs) { new_rhs = new(mem_ctx) ir_dereference_variable(rhs->components[i]); + /* If we're writing into a writemask, smear it out to that channel. */ + if (!lhs) + new_rhs = new(mem_ctx) ir_swizzle(new_rhs, i, i, i, i, i + 1); } else { new_rhs = new(mem_ctx) ir_swizzle(ir->rhs->clone(mem_ctx, NULL), i, i, i, i, 1); -- cgit v1.2.3 From 91a037b5e1374fe0574480a579bd36c71b75f9c2 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Fri, 27 Aug 2010 11:05:47 -0700 Subject: i965: Fix destination writemasking in the new FS. --- src/mesa/drivers/dri/i965/brw_fs.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp index a73509f258..a2284e431a 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -832,12 +832,11 @@ fs_visitor::visit(ir_assignment *ir) } for (i = 0; i < type_size(ir->lhs->type); i++) { - if (i < 4 && !(write_mask & (1 << i))) - continue; - - inst = emit(fs_inst(BRW_OPCODE_MOV, l, r)); - if (ir->condition) - inst->predicated = true; + if (i >= 4 || (write_mask & (1 << i))) { + inst = emit(fs_inst(BRW_OPCODE_MOV, l, r)); + if (ir->condition) + inst->predicated = true; + } l.reg_offset++; r.reg_offset++; } -- cgit v1.2.3 From 55ced3367543994bd21b48326c64edb743001145 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Fri, 27 Aug 2010 10:44:04 -0700 Subject: i965: Add a bit of support for matrices to the new FS. --- src/mesa/drivers/dri/i965/brw_fs.cpp | 32 +++++++++++++++++++++----------- 1 file changed, 21 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp index a2284e431a..749a2f2eb7 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -165,16 +165,7 @@ type_size(const struct glsl_type *type) case GLSL_TYPE_INT: case GLSL_TYPE_FLOAT: case GLSL_TYPE_BOOL: - if (type->is_matrix()) { - /* In case of incoming uniform/varying matrices, match their - * allocation behavior. FINISHME: We could just use - * glsl_type->components() for variables and temps within the - * shader. - */ - return type->matrix_columns * 4; - } else { - return type->vector_elements; - } + return type->components(); case GLSL_TYPE_ARRAY: /* FINISHME: uniform/varying arrays. */ return type_size(type->fields.array) * type->length; @@ -579,7 +570,26 @@ fs_visitor::visit(ir_dereference_record *ir) void fs_visitor::visit(ir_dereference_array *ir) { - assert(!"FINISHME"); + ir_constant *index; + int element_size; + + ir->array->accept(this); + index = ir->array_index->as_constant(); + + if (ir->type->is_matrix()) { + element_size = ir->type->vector_elements; + } else { + element_size = type_size(ir->type); + } + + if (index) { + assert(this->result.file == UNIFORM || + (this->result.file == GRF && + this->result.reg != 0)); + this->result.reg_offset += index->value.i[0] * element_size; + } else { + assert(!"FINISHME: non-constant matrix column"); + } } void -- cgit v1.2.3 From 166b3fa29d4b5af8d4e8c410ed71e4348b65bbd9 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Fri, 27 Aug 2010 12:02:53 -0700 Subject: i965: Validate the IR tree after doing our custom optimization passes. This wouldn't catch the last failure fixed in them, because we don't validate assignments well (due to the fact that we've got a pretty glaring inconsistency in how we handle assignment writemasking), but it could catch other failure we may produce. --- src/mesa/drivers/dri/i965/brw_fs.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp index 749a2f2eb7..f8b06226d7 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -144,6 +144,8 @@ brw_link_shader(GLcontext *ctx, struct gl_shader_program *prog) progress = do_common_optimization(shader->ir, true) || progress; } while (progress); + validate_ir_tree(shader->ir); + reparent_ir(shader->ir, shader->ir); talloc_free(mem_ctx); } -- cgit v1.2.3 From 40932c1752b0fa918d764e3367f5ab450033304a Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Fri, 27 Aug 2010 12:19:30 -0700 Subject: i965: Fix the maximum grf counting in the new FS backend. glsl-algebraic-rcp-rsq managed to use 33 registers, and we claimed to only use 32, so the write to g32 would go stomping over the precious g0 of some other thread. --- src/mesa/drivers/dri/i965/brw_fs.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp index f8b06226d7..673a31c1dd 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -1357,7 +1357,7 @@ fs_visitor::assign_regs() last_grf = MAX2(last_grf, inst->src[1].hw_reg); } - this->grf_used = last_grf; + this->grf_used = last_grf + 1; } static struct brw_reg brw_reg_from_fs_reg(fs_reg *reg) -- cgit v1.2.3 From a0ffee2cd79deb5a437784e25de6512d7f8e6bb8 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Fri, 27 Aug 2010 12:53:48 -0700 Subject: i965: When encountering an unknown opcode in new FS backend, print its name. --- src/mesa/drivers/dri/i965/brw_context.h | 8 +++++++- src/mesa/drivers/dri/i965/brw_fs.cpp | 10 +++++++++- src/mesa/drivers/dri/i965/brw_optimize.c | 19 +++++++------------ 3 files changed, 23 insertions(+), 14 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h index 3728a7a122..703a7de78d 100644 --- a/src/mesa/drivers/dri/i965/brw_context.h +++ b/src/mesa/drivers/dri/i965/brw_context.h @@ -702,7 +702,13 @@ struct brw_context #define BRW_PACKCOLOR8888(r,g,b,a) ((r<<24) | (g<<16) | (b<<8) | a) - +struct brw_instruction_info { + char *name; + int nsrc; + int ndst; + GLboolean is_arith; +}; +extern const struct brw_instruction_info brw_opcodes[128]; /*====================================================================== * brw_vtbl.c diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp index 673a31c1dd..41b8ecd681 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -369,6 +369,7 @@ public: this->p = &c->func; this->brw = p->brw; this->intel = &brw->intel; + this->ctx = &intel->ctx; this->mem_ctx = talloc_new(NULL); this->shader = shader; this->fail = false; @@ -431,6 +432,7 @@ public: struct brw_context *brw; struct intel_context *intel; + GLcontext *ctx; struct brw_wm_compile *c; struct brw_compile *p; struct brw_shader *shader; @@ -1453,7 +1455,13 @@ fs_visitor::generate_code() generate_fb_write(inst); break; default: - assert(!"not reached"); + if (inst->opcode < (int)ARRAY_SIZE(brw_opcodes)) { + _mesa_problem(ctx, "Unsupported opcode `%s' in FS", + brw_opcodes[inst->opcode].name); + } else { + _mesa_problem(ctx, "Unsupported opcode %d in FS", inst->opcode); + } + this->fail = true; } if (annotation_len < p->nr_insn) { diff --git a/src/mesa/drivers/dri/i965/brw_optimize.c b/src/mesa/drivers/dri/i965/brw_optimize.c index afcd1fc15a..cbed2bd5cb 100644 --- a/src/mesa/drivers/dri/i965/brw_optimize.c +++ b/src/mesa/drivers/dri/i965/brw_optimize.c @@ -32,12 +32,7 @@ #include "brw_defines.h" #include "brw_eu.h" -static const struct { - char *name; - int nsrc; - int ndst; - GLboolean is_arith; -} inst_opcode[128] = { +const struct brw_instruction_info brw_opcodes[128] = { [BRW_OPCODE_MOV] = { .name = "mov", .nsrc = 1, .ndst = 1, .is_arith = 1 }, [BRW_OPCODE_FRC] = { .name = "frc", .nsrc = 1, .ndst = 1, .is_arith = 1 }, [BRW_OPCODE_RNDU] = { .name = "rndu", .nsrc = 1, .ndst = 1, .is_arith = 1 }, @@ -94,7 +89,7 @@ static const struct { static INLINE GLboolean brw_is_arithmetic_inst(const struct brw_instruction *inst) { - return inst_opcode[inst->header.opcode].is_arith; + return brw_opcodes[inst->header.opcode].is_arith; } static const GLuint inst_stride[7] = { @@ -122,7 +117,7 @@ brw_is_grf_written(const struct brw_instruction *inst, int reg_index, int size, int gen) { - if (inst_opcode[inst->header.opcode].ndst == 0) + if (brw_opcodes[inst->header.opcode].ndst == 0) return GL_FALSE; if (inst->bits1.da1.dest_address_mode != BRW_ADDRESS_DIRECT) @@ -165,7 +160,7 @@ static GLboolean brw_is_mrf_written_alu(const struct brw_instruction *inst, int reg_index, int size) { - if (inst_opcode[inst->header.opcode].ndst == 0) + if (brw_opcodes[inst->header.opcode].ndst == 0) return GL_FALSE; if (inst->bits1.da1.dest_reg_file != BRW_MESSAGE_REGISTER_FILE) @@ -298,7 +293,7 @@ static INLINE GLboolean brw_is_grf_read(const struct brw_instruction *inst, int reg_index, int size) { int i, j; - if (inst_opcode[inst->header.opcode].nsrc == 0) + if (brw_opcodes[inst->header.opcode].nsrc == 0) return GL_FALSE; /* Look at first source. We must take into account register regions to @@ -306,7 +301,7 @@ brw_is_grf_read(const struct brw_instruction *inst, int reg_index, int size) * since we do not take into account the fact that some complete registers * may be skipped */ - if (inst_opcode[inst->header.opcode].nsrc >= 1) { + if (brw_opcodes[inst->header.opcode].nsrc >= 1) { if (inst->bits2.da1.src0_address_mode != BRW_ADDRESS_DIRECT) if (inst->bits1.ia1.src0_reg_file == BRW_GENERAL_REGISTER_FILE) @@ -341,7 +336,7 @@ brw_is_grf_read(const struct brw_instruction *inst, int reg_index, int size) } /* Second src register */ - if (inst_opcode[inst->header.opcode].nsrc >= 2) { + if (brw_opcodes[inst->header.opcode].nsrc >= 2) { if (inst->bits3.da1.src1_address_mode != BRW_ADDRESS_DIRECT) if (inst->bits1.ia1.src1_reg_file == BRW_GENERAL_REGISTER_FILE) -- cgit v1.2.3 From 130368f910a806a12287c7561df7dddd0fc8be40 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Fri, 27 Aug 2010 12:54:12 -0700 Subject: i965: Add support for if instructions in the new FS backend. 20 more piglit tests pass. --- src/mesa/drivers/dri/i965/brw_fs.cpp | 62 +++++++++++++++++++++++++++++++++++- 1 file changed, 61 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp index 41b8ecd681..7600060940 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -311,6 +311,14 @@ public: this->predicated = false; } + fs_inst(int opcode) + { + this->opcode = opcode; + this->saturate = false; + this->conditional_mod = BRW_CONDITIONAL_NONE; + this->predicated = false; + } + fs_inst(int opcode, fs_reg dst, fs_reg src0) { this->opcode = opcode; @@ -932,7 +940,40 @@ fs_visitor::visit(ir_constant *ir) void fs_visitor::visit(ir_if *ir) { - assert(!"FINISHME"); + fs_inst *inst; + + /* Don't point the annotation at the if statement, because then it plus + * the then and else blocks get printed. + */ + this->base_ir = ir->condition; + + /* Generate the condition into the condition code. */ + ir->condition->accept(this); + inst = emit(fs_inst(BRW_OPCODE_MOV, fs_reg(brw_null_reg()), this->result)); + inst->conditional_mod = BRW_CONDITIONAL_NZ; + + inst = emit(fs_inst(BRW_OPCODE_IF)); + inst->predicated = true; + + foreach_iter(exec_list_iterator, iter, ir->then_instructions) { + ir_instruction *ir = (ir_instruction *)iter.get(); + this->base_ir = ir; + + ir->accept(this); + } + + if (!ir->else_instructions.is_empty()) { + emit(fs_inst(BRW_OPCODE_ELSE)); + + foreach_iter(exec_list_iterator, iter, ir->else_instructions) { + ir_instruction *ir = (ir_instruction *)iter.get(); + this->base_ir = ir; + + ir->accept(this); + } + } + + emit(fs_inst(BRW_OPCODE_ENDIF)); } void @@ -1415,7 +1456,10 @@ fs_visitor::generate_code() { unsigned int annotation_len = 0; int last_native_inst = 0; + struct brw_instruction *if_stack[16]; + int if_stack_depth = 0; + memset(&if_stack, 0, sizeof(if_stack)); foreach_iter(exec_list_iterator, iter, this->instructions) { fs_inst *inst = (fs_inst *)iter.get(); struct brw_reg src[3], dst; @@ -1438,6 +1482,22 @@ fs_visitor::generate_code() case BRW_OPCODE_MUL: brw_MUL(p, dst, src[0], src[1]); break; + case BRW_OPCODE_CMP: + brw_CMP(p, dst, inst->conditional_mod, src[0], src[1]); + break; + case BRW_OPCODE_IF: + assert(if_stack_depth < 16); + if_stack[if_stack_depth] = brw_IF(p, BRW_EXECUTE_8); + if_stack_depth++; + break; + case BRW_OPCODE_ELSE: + if_stack[if_stack_depth - 1] = + brw_ELSE(p, if_stack[if_stack_depth - 1]); + break; + case BRW_OPCODE_ENDIF: + if_stack_depth--; + brw_ENDIF(p , if_stack[if_stack_depth]); + break; case FS_OPCODE_RCP: case FS_OPCODE_RSQ: case FS_OPCODE_SQRT: -- cgit v1.2.3 From 2776ad2641469d3bdb6f53b99fbd748efd277c51 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Fri, 27 Aug 2010 13:14:15 -0700 Subject: i965: Add generate() handling for AND, OR, XOR. 10 more piglit tests pass. --- src/mesa/drivers/dri/i965/brw_fs.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp index 7600060940..336dbd63f3 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -1482,6 +1482,17 @@ fs_visitor::generate_code() case BRW_OPCODE_MUL: brw_MUL(p, dst, src[0], src[1]); break; + + case BRW_OPCODE_AND: + brw_AND(p, dst, src[0], src[1]); + break; + case BRW_OPCODE_OR: + brw_OR(p, dst, src[0], src[1]); + break; + case BRW_OPCODE_XOR: + brw_XOR(p, dst, src[0], src[1]); + break; + case BRW_OPCODE_CMP: brw_CMP(p, dst, inst->conditional_mod, src[0], src[1]); break; -- cgit v1.2.3 From 53290900db2f13fd9ab56b8f9780fa309d31780f Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Fri, 27 Aug 2010 13:19:28 -0700 Subject: i965: Fix swapped instructions in ir_unop_abs and ir_unop_neg. Fixes glsl-fs-neg and 5 other tests. --- src/mesa/drivers/dri/i965/brw_fs.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp index 336dbd63f3..d8369868ad 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -641,12 +641,12 @@ fs_visitor::visit(ir_expression *ir) emit(fs_inst(BRW_OPCODE_ADD, this->result, op[0], fs_reg(-1))); break; case ir_unop_neg: - this->result = op[0]; op[0].negate = ~op[0].negate; + this->result = op[0]; break; case ir_unop_abs: - this->result = op[0]; op[0].abs = true; + this->result = op[0]; break; case ir_unop_sign: temp = fs_reg(this, ir->type); -- cgit v1.2.3 From 1be5d1c887b3308865c8f4770138a9d70251392f Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 27 Aug 2010 11:15:03 -0600 Subject: glsl2: remove 'extern' keyword in .c file --- src/glsl/glcpp/pp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/glsl/glcpp/pp.c b/src/glsl/glcpp/pp.c index 8769f4f7e5..a1d00c4193 100644 --- a/src/glsl/glcpp/pp.c +++ b/src/glsl/glcpp/pp.c @@ -141,7 +141,7 @@ remove_line_continuations(glcpp_parser_t *ctx, const char *shader) return clean; } -extern int +int preprocess(void *talloc_ctx, const char **shader, char **info_log, const struct gl_extensions *extensions) { -- cgit v1.2.3 From b820bf979a1c308d8d6fe6ad89e8ae7c77226603 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 27 Aug 2010 11:53:19 -0600 Subject: glsl2: restructure header file for C++ and C inclusion As it was, the header could not be cleanly #included by a C source. --- src/glsl/glsl_parser_extras.h | 36 ++++++++++++++++++++++++++++-------- 1 file changed, 28 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/glsl/glsl_parser_extras.h b/src/glsl/glsl_parser_extras.h index b0b1bc31d0..3ccdab4ef2 100644 --- a/src/glsl/glsl_parser_extras.h +++ b/src/glsl/glsl_parser_extras.h @@ -25,6 +25,12 @@ #ifndef GLSL_PARSER_EXTRAS_H #define GLSL_PARSER_EXTRAS_H +/* + * Most of the definitions here only apply to C++ + */ +#ifdef __cplusplus + + #include #include "glsl_symbol_table.h" @@ -175,14 +181,6 @@ 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, - const struct gl_extensions *extensions); - -extern void _mesa_destroy_shader_compiler(); -extern void _mesa_destroy_shader_compiler_caches(); -} - extern void _mesa_glsl_lexer_ctor(struct _mesa_glsl_parse_state *state, const char *string); @@ -212,4 +210,26 @@ extern bool _mesa_glsl_process_extension(const char *name, YYLTYPE *name_locp, extern const char * _mesa_glsl_shader_target_name(enum _mesa_glsl_parser_targets target); + +#endif /* __cplusplus */ + + +/* + * These definitions apply to C and C++ + */ +#ifdef __cplusplus +extern "C" { +#endif + +extern int preprocess(void *ctx, const char **shader, char **info_log, + const struct gl_extensions *extensions); + +extern void _mesa_destroy_shader_compiler(); +extern void _mesa_destroy_shader_compiler_caches(); + +#ifdef __cplusplus +} +#endif + + #endif /* GLSL_PARSER_EXTRAS_H */ -- cgit v1.2.3 From 579fce252413f39830ee379076fddf0580ea9b16 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 27 Aug 2010 11:54:32 -0600 Subject: mesa: use atexit() handler to release GLSL compiler memory This releases a bunch of memory that was showing up as leaks with valgrind. If atexit() isn't widely supported we may need to add some #ifdef tests around the call. --- src/mesa/main/context.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src') diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index 6205d3456a..4852f46646 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -140,6 +140,10 @@ #include "sparc/sparc.h" #endif +#include "glsl_parser_extras.h" + + + #ifndef MESA_VERBOSE int MESA_VERBOSE = 0; #endif @@ -434,6 +438,11 @@ one_time_init( GLcontext *ctx ) } _glthread_UNLOCK_MUTEX(OneTimeLock); + /* Hopefully atexit() is widely available. If not, we may need some + * #ifdef tests here. + */ + atexit(_mesa_destroy_shader_compiler); + dummy_enum_func(); } -- cgit v1.2.3 From f57df7f2130dfe20a6f7e75cfc1f5d4e1717d098 Mon Sep 17 00:00:00 2001 From: Nick Bowler Date: Thu, 26 Aug 2010 17:52:30 -0700 Subject: mesa: Use the format info to identify packed depth/stencil formats. Due to a misunderstanding of the Z24_X8 and X8_Z24 formats, the earlier patch created depth/stencil wrappers for them. This broke swrast. Use the format info instead, which only identifies Z24_S8 and S8_Z24 as packed depth/stencil. It also has the advantage of being nicer code. Signed-off-by: Nick Bowler Signed-off-by: Brian Paul --- src/mesa/main/formats.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/mesa/main/formats.c b/src/mesa/main/formats.c index c5f3e0b21d..112d7a0088 100644 --- a/src/mesa/main/formats.c +++ b/src/mesa/main/formats.c @@ -945,13 +945,9 @@ _mesa_is_format_compressed(gl_format format) GLboolean _mesa_is_format_packed_depth_stencil(gl_format format) { - if (format == MESA_FORMAT_Z24_S8 - || format == MESA_FORMAT_Z24_X8 - || format == MESA_FORMAT_S8_Z24 - || format == MESA_FORMAT_X8_Z24) - return GL_TRUE; + const struct gl_format_info *info = _mesa_get_format_info(format); - return GL_FALSE; + return info->BaseFormat == GL_DEPTH_STENCIL; } -- cgit v1.2.3 From 9ce0d92ae70362a1cd8c07c9f7ac25bcbcd09959 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 27 Aug 2010 14:35:52 -0600 Subject: mesa: move null ptr check (fdo bug 29843) --- src/mesa/main/shaderobj.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/mesa/main/shaderobj.c b/src/mesa/main/shaderobj.c index 65d8d116db..59198d788b 100644 --- a/src/mesa/main/shaderobj.c +++ b/src/mesa/main/shaderobj.c @@ -104,9 +104,9 @@ _mesa_new_shader(GLcontext *ctx, GLuint name, GLenum type) assert(type == GL_FRAGMENT_SHADER || type == GL_VERTEX_SHADER || type == GL_GEOMETRY_SHADER_ARB); shader = talloc_zero(NULL, struct gl_shader); - shader->Type = type; - shader->Name = name; if (shader) { + shader->Type = type; + shader->Name = name; _mesa_init_shader(ctx, shader); } return shader; -- cgit v1.2.3 From 48d8814c03cc7f270985abe7efdaec1f18d120aa Mon Sep 17 00:00:00 2001 From: Jerome Glisse Date: Fri, 27 Aug 2010 16:52:29 -0400 Subject: r600g: fix vbo size Silence the kernel, vbo size is size - 1. Signed-off-by: Jerome Glisse --- src/gallium/drivers/r600/r600_draw.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/r600_draw.c b/src/gallium/drivers/r600/r600_draw.c index 1eb868c4c7..1c426f755d 100644 --- a/src/gallium/drivers/r600/r600_draw.c +++ b/src/gallium/drivers/r600/r600_draw.c @@ -107,7 +107,7 @@ static int r600_draw_common(struct r600_draw *draw) vs_resource->bo[0] = radeon_bo_incref(rscreen->rw, rbuffer->bo); vs_resource->nbo = 1; vs_resource->states[R600_PS_RESOURCE__RESOURCE0_WORD0] = offset; - vs_resource->states[R600_PS_RESOURCE__RESOURCE0_WORD1] = rbuffer->bo->size - offset; + vs_resource->states[R600_PS_RESOURCE__RESOURCE0_WORD1] = rbuffer->bo->size - offset - 1; vs_resource->states[R600_PS_RESOURCE__RESOURCE0_WORD2] = S_038008_STRIDE(vertex_buffer->stride) | S_038008_DATA_FORMAT(format); vs_resource->states[R600_PS_RESOURCE__RESOURCE0_WORD3] = 0x00000000; -- cgit v1.2.3 From 31c9f468f35637ce3b82e59a43c49c949d59ee9e Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Fri, 27 Aug 2010 13:24:41 -0700 Subject: i965: Add support for ir_binop_mod using do_mod_to_fract. Fixes glsl-fs-mod. --- src/mesa/drivers/dri/i965/brw_fs.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp index d8369868ad..bb6c456eed 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -131,6 +131,7 @@ brw_link_shader(GLcontext *ctx, struct gl_shader_program *prog) clone_ir_list(mem_ctx, shader->ir, shader->base.ir); 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); do_explog_to_explog2(shader->ir); @@ -1482,6 +1483,9 @@ fs_visitor::generate_code() case BRW_OPCODE_MUL: brw_MUL(p, dst, src[0], src[1]); break; + case BRW_OPCODE_FRC: + brw_FRC(p, dst, src[0]); + break; case BRW_OPCODE_AND: brw_AND(p, dst, src[0], src[1]); -- cgit v1.2.3 From 41e75cde2605e62ab691fd725a8a7259f40f5122 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Fri, 27 Aug 2010 13:29:45 -0700 Subject: i965: Add translation for RNDD and RNDZ. Fixes: glsl-fs-any. glsl1-integer division with uniform var --- src/mesa/drivers/dri/i965/brw_fs.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp index bb6c456eed..cf02b214f5 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -1483,9 +1483,16 @@ fs_visitor::generate_code() case BRW_OPCODE_MUL: brw_MUL(p, dst, src[0], src[1]); break; + case BRW_OPCODE_FRC: brw_FRC(p, dst, src[0]); break; + case BRW_OPCODE_RNDD: + brw_RNDD(p, dst, src[0]); + break; + case BRW_OPCODE_RNDZ: + brw_RNDZ(p, dst, src[0]); + break; case BRW_OPCODE_AND: brw_AND(p, dst, src[0], src[1]); -- cgit v1.2.3 From 4229a93cc756b3ade02dcf93d806610f95497ad3 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Fri, 27 Aug 2010 13:47:37 -0700 Subject: i965: Fix the types of immediate integer values. When we're trying to do integer ops, handing a float in doesn't help. --- src/mesa/drivers/dri/i965/brw_fs.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp index cf02b214f5..98d5d65940 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -1422,10 +1422,10 @@ static struct brw_reg brw_reg_from_fs_reg(fs_reg *reg) brw_reg = brw_imm_f(reg->imm.f); break; case BRW_REGISTER_TYPE_D: - brw_reg = brw_imm_f(reg->imm.i); + brw_reg = brw_imm_d(reg->imm.i); break; case BRW_REGISTER_TYPE_UD: - brw_reg = brw_imm_f(reg->imm.u); + brw_reg = brw_imm_ud(reg->imm.u); break; default: assert(!"not reached"); -- cgit v1.2.3 From 38d01c5b272d28a805e7598bad2f2ef5c8da732a Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Fri, 27 Aug 2010 13:49:09 -0700 Subject: i965: Mask out higher bits of the result of BRW_CMP producing a boolean. When it says it sets the LSB, that's not just a hint as to where the result goes. Only the LSB is modified. Fixes 20 piglit cases. --- src/mesa/drivers/dri/i965/brw_fs.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp index 98d5d65940..3f41a55331 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -710,26 +710,32 @@ fs_visitor::visit(ir_expression *ir) case ir_binop_less: inst = emit(fs_inst(BRW_OPCODE_CMP, this->result, op[0], op[1])); inst->conditional_mod = BRW_CONDITIONAL_L; + emit(fs_inst(BRW_OPCODE_AND, this->result, this->result, fs_reg(0x1))); break; case ir_binop_greater: inst = emit(fs_inst(BRW_OPCODE_CMP, this->result, op[0], op[1])); inst->conditional_mod = BRW_CONDITIONAL_G; + emit(fs_inst(BRW_OPCODE_AND, this->result, this->result, fs_reg(0x1))); break; case ir_binop_lequal: inst = emit(fs_inst(BRW_OPCODE_CMP, this->result, op[0], op[1])); inst->conditional_mod = BRW_CONDITIONAL_LE; + emit(fs_inst(BRW_OPCODE_AND, this->result, this->result, fs_reg(0x1))); break; case ir_binop_gequal: inst = emit(fs_inst(BRW_OPCODE_CMP, this->result, op[0], op[1])); inst->conditional_mod = BRW_CONDITIONAL_GE; + emit(fs_inst(BRW_OPCODE_AND, this->result, this->result, fs_reg(0x1))); break; case ir_binop_equal: inst = emit(fs_inst(BRW_OPCODE_CMP, this->result, op[0], op[1])); inst->conditional_mod = BRW_CONDITIONAL_Z; + emit(fs_inst(BRW_OPCODE_AND, this->result, this->result, fs_reg(0x1))); break; case ir_binop_nequal: inst = emit(fs_inst(BRW_OPCODE_CMP, this->result, op[0], op[1])); inst->conditional_mod = BRW_CONDITIONAL_NZ; + emit(fs_inst(BRW_OPCODE_AND, this->result, this->result, fs_reg(0x1))); break; case ir_binop_logic_xor: -- cgit v1.2.3 From f0aa2d6118b1af7434b7551227cd72c588568e65 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Fri, 27 Aug 2010 14:09:05 -0700 Subject: i965: Add missing handling for BRW_OPCODE_SEL. Fixes 4 piglit tests about min, max, and clamp. --- src/mesa/drivers/dri/i965/brw_fs.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp index 3f41a55331..63f3cd0816 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -1513,6 +1513,10 @@ fs_visitor::generate_code() case BRW_OPCODE_CMP: brw_CMP(p, dst, inst->conditional_mod, src[0], src[1]); break; + case BRW_OPCODE_SEL: + brw_SEL(p, dst, src[0], src[1]); + break; + case BRW_OPCODE_IF: assert(if_stack_depth < 16); if_stack[if_stack_depth] = brw_IF(p, BRW_EXECUTE_8); -- cgit v1.2.3 From d20c2766182b632fba296eff7328bf14c802096e Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Fri, 27 Aug 2010 14:15:42 -0700 Subject: i965: Don't strip negate/abs flags when assigning uniform locations. Fixes glsl-algebraic-sub-zero-4. --- src/mesa/drivers/dri/i965/brw_fs.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp index 63f3cd0816..63eae840c2 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -1336,12 +1336,12 @@ fs_visitor::assign_curb_setup() for (unsigned int i = 0; i < 3; i++) { if (inst->src[i].file == UNIFORM) { int constant_nr = inst->src[i].hw_reg + inst->src[i].reg_offset; - struct brw_reg brw_reg; + struct brw_reg brw_reg = brw_vec1_grf(c->prog_data.first_curbe_grf + + constant_nr / 8, + constant_nr % 8); - brw_reg = brw_vec1_grf(c->prog_data.first_curbe_grf + - constant_nr / 8, - constant_nr % 8); - inst->src[i] = fs_reg(brw_reg); + inst->src[i].file = FIXED_HW_REG; + inst->src[i].fixed_hw_reg = brw_reg; } } } -- cgit v1.2.3 From ae6e112c69cf42fb81ef4ed5bdeb3b280647f141 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Fri, 27 Aug 2010 14:43:39 -0700 Subject: dri: Get prototype for _mesa_destroy_compiler(). Bug #29665. --- src/mesa/drivers/dri/common/dri_util.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/mesa/drivers/dri/common/dri_util.c b/src/mesa/drivers/dri/common/dri_util.c index b1a7b3ed34..a581c6663f 100644 --- a/src/mesa/drivers/dri/common/dri_util.c +++ b/src/mesa/drivers/dri/common/dri_util.c @@ -32,6 +32,7 @@ #include "drm_sarea.h" #include "utils.h" #include "xmlpool.h" +#include "../glsl/glsl_parser_extras.h" PUBLIC const char __dri2ConfigOptions[] = DRI_CONF_BEGIN -- cgit v1.2.3 From d539c69044c735618bf85485df7733e9f0491d18 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Fri, 27 Aug 2010 15:23:29 -0700 Subject: glsl: Protect against double compiler-destroy. DRI was doing teardown when we close the last screen, then an atexit() was added to call it as well. --- src/glsl/builtins/tools/generate_builtins.py | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/glsl/builtins/tools/generate_builtins.py b/src/glsl/builtins/tools/generate_builtins.py index b9f0ba1ad2..ab5b3777cb 100755 --- a/src/glsl/builtins/tools/generate_builtins.py +++ b/src/glsl/builtins/tools/generate_builtins.py @@ -175,6 +175,7 @@ void _mesa_glsl_release_functions(void) { talloc_free(builtin_mem_ctx); + builtin_mem_ctx = NULL; } void -- cgit v1.2.3 From 681492cbe2b3bef26b11bf978e4d0a502a37bc35 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Fri, 27 Aug 2010 15:24:23 -0700 Subject: glsl: Regenerate for double destroy fix. --- src/glsl/builtin_function.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/glsl/builtin_function.cpp b/src/glsl/builtin_function.cpp index 292ac428ba..975e092807 100644 --- a/src/glsl/builtin_function.cpp +++ b/src/glsl/builtin_function.cpp @@ -16766,6 +16766,7 @@ void _mesa_glsl_release_functions(void) { talloc_free(builtin_mem_ctx); + builtin_mem_ctx = NULL; } void -- cgit v1.2.3 From d17faf726ecfd18f5a1f9a1c2b54eec4348ee053 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Fri, 27 Aug 2010 16:04:16 -0700 Subject: i965: Set the pop count on BRK/CONT inside of an if statement in the FS. This is the same as 8de8c97275e9555183a7e8f2238143657bbe60b2 for the VS, and fixes glsl-fs-if-nested-loop and the mandelbrot demo. Bug #29498 --- src/mesa/drivers/dri/i965/brw_wm_glsl.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_wm_glsl.c b/src/mesa/drivers/dri/i965/brw_wm_glsl.c index 7a31b9a837..d72bd0825c 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_glsl.c +++ b/src/mesa/drivers/dri/i965/brw_wm_glsl.c @@ -1803,12 +1803,15 @@ static void brw_wm_emit_glsl(struct brw_context *brw, struct brw_wm_compile *c) #define MAX_IF_DEPTH 32 #define MAX_LOOP_DEPTH 32 struct brw_instruction *if_inst[MAX_IF_DEPTH], *loop_inst[MAX_LOOP_DEPTH]; + int if_depth_in_loop[MAX_LOOP_DEPTH]; GLuint i, if_depth = 0, loop_depth = 0; struct brw_compile *p = &c->func; struct brw_indirect stack_index = brw_indirect(0, 0); c->out_of_regs = GL_FALSE; + if_depth_in_loop[loop_depth] = 0; + prealloc_reg(c); brw_set_compression_control(p, BRW_COMPRESSION_NONE); brw_MOV(p, get_addr_reg(stack_index), brw_address(c->stack)); @@ -1819,6 +1822,7 @@ static void brw_wm_emit_glsl(struct brw_context *brw, struct brw_wm_compile *c) struct brw_reg args[3][4], dst[4]; int j; int mark = mark_tmps( c ); + struct brw_instruction *temp; c->cur_inst = i; @@ -2020,6 +2024,7 @@ static void brw_wm_emit_glsl(struct brw_context *brw, struct brw_wm_compile *c) case OPCODE_IF: assert(if_depth < MAX_IF_DEPTH); if_inst[if_depth++] = brw_IF(p, BRW_EXECUTE_8); + if_depth_in_loop[loop_depth]++; break; case OPCODE_ELSE: assert(if_depth > 0); @@ -2028,6 +2033,7 @@ static void brw_wm_emit_glsl(struct brw_context *brw, struct brw_wm_compile *c) case OPCODE_ENDIF: assert(if_depth > 0); brw_ENDIF(p, if_inst[--if_depth]); + if_depth_in_loop[loop_depth]--; break; case OPCODE_BGNSUB: brw_save_label(p, inst->Comment, p->nr_insn); @@ -2062,13 +2068,16 @@ static void brw_wm_emit_glsl(struct brw_context *brw, struct brw_wm_compile *c) case OPCODE_BGNLOOP: /* XXX may need to invalidate the current_constant regs */ loop_inst[loop_depth++] = brw_DO(p, BRW_EXECUTE_8); + if_depth_in_loop[loop_depth] = 0; break; case OPCODE_BRK: - brw_BREAK(p); + temp = brw_BREAK(p); + temp->bits3.if_else.pop_count = if_depth_in_loop[loop_depth]; brw_set_predicate_control(p, BRW_PREDICATE_NONE); break; case OPCODE_CONT: - brw_CONT(p); + temp = brw_CONT(p); + temp->bits3.if_else.pop_count = if_depth_in_loop[loop_depth]; brw_set_predicate_control(p, BRW_PREDICATE_NONE); break; case OPCODE_ENDLOOP: @@ -2088,12 +2097,10 @@ static void brw_wm_emit_glsl(struct brw_context *brw, struct brw_wm_compile *c) if (inst0->header.opcode == BRW_OPCODE_BREAK && inst0->bits3.if_else.jump_count == 0) { inst0->bits3.if_else.jump_count = br * (inst1 - inst0 + 1); - inst0->bits3.if_else.pop_count = 0; } else if (inst0->header.opcode == BRW_OPCODE_CONTINUE && inst0->bits3.if_else.jump_count == 0) { inst0->bits3.if_else.jump_count = br * (inst1 - inst0); - inst0->bits3.if_else.pop_count = 0; } } } -- cgit v1.2.3 From 3c96ef1f07f202312e1b7ae349b8bcbe7aed9e75 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Fri, 27 Aug 2010 15:32:59 -0700 Subject: glsl: Make mat_op_to_vec allocate out of the IR's parent. This will reduce memory consumption of compiled shaders by not dragging optimized-out children around. --- src/glsl/ir_mat_op_to_vec.cpp | 68 +++++++++++++++++++++++-------------------- 1 file changed, 36 insertions(+), 32 deletions(-) (limited to 'src') diff --git a/src/glsl/ir_mat_op_to_vec.cpp b/src/glsl/ir_mat_op_to_vec.cpp index 80e0579986..13f5d76963 100644 --- a/src/glsl/ir_mat_op_to_vec.cpp +++ b/src/glsl/ir_mat_op_to_vec.cpp @@ -40,6 +40,7 @@ public: ir_mat_op_to_vec_visitor() { this->made_progress = false; + this->mem_ctx = NULL; } ir_visitor_status visit_leave(ir_assignment *); @@ -56,6 +57,7 @@ public: void do_mul_mat_scalar(ir_variable *result_var, ir_variable *a_var, ir_variable *b_var); + void *mem_ctx; bool made_progress; }; @@ -97,16 +99,16 @@ 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); + deref = new(mem_ctx) ir_dereference_variable(var); if (var->type->is_matrix()) { - deref = new(base_ir) ir_dereference_array(var, - new(base_ir) ir_constant(col)); + deref = new(mem_ctx) ir_dereference_array(var, + new(mem_ctx) ir_constant(col)); } else { assert(col == 0); } - return new(base_ir) ir_swizzle(deref, row, 0, 0, 0, 1); + return new(mem_ctx) ir_swizzle(deref, row, 0, 0, 0, 1); } ir_dereference * @@ -115,11 +117,11 @@ ir_mat_op_to_vec_visitor::get_column(ir_variable *var, int row) ir_dereference *deref; if (!var->type->is_matrix()) { - deref = new(base_ir) ir_dereference_variable(var); + deref = new(mem_ctx) 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(row)); + deref = new(mem_ctx) ir_dereference_variable(var); + deref = new(mem_ctx) ir_dereference_array(deref, + new(mem_ctx) ir_constant(row)); } return deref; @@ -139,7 +141,7 @@ ir_mat_op_to_vec_visitor::do_mul_mat_mat(ir_variable *result_var, ir_rvalue *b = get_element(b_var, b_col, 0); /* first column */ - expr = new(base_ir) ir_expression(ir_binop_mul, + expr = new(mem_ctx) ir_expression(ir_binop_mul, a->type, a, b); @@ -151,18 +153,18 @@ ir_mat_op_to_vec_visitor::do_mul_mat_mat(ir_variable *result_var, a = get_column(a_var, i); b = get_element(b_var, b_col, i); - mul_expr = new(base_ir) ir_expression(ir_binop_mul, + mul_expr = new(mem_ctx) ir_expression(ir_binop_mul, a->type, a, b); - expr = new(base_ir) ir_expression(ir_binop_add, + expr = new(mem_ctx) 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, + assign = new(mem_ctx) ir_assignment(result, expr, NULL); base_ir->insert_before(assign); @@ -181,7 +183,7 @@ ir_mat_op_to_vec_visitor::do_mul_mat_vec(ir_variable *result_var, ir_expression *expr; /* first column */ - expr = new(base_ir) ir_expression(ir_binop_mul, + expr = new(mem_ctx) ir_expression(ir_binop_mul, result_var->type, a, b); @@ -193,18 +195,18 @@ ir_mat_op_to_vec_visitor::do_mul_mat_vec(ir_variable *result_var, a = get_column(a_var, i); b = get_element(b_var, 0, i); - mul_expr = new(base_ir) ir_expression(ir_binop_mul, + mul_expr = new(mem_ctx) ir_expression(ir_binop_mul, result_var->type, a, b); - expr = new(base_ir) ir_expression(ir_binop_add, + expr = new(mem_ctx) 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, + ir_rvalue *result = new(mem_ctx) ir_dereference_variable(result_var); + assign = new(mem_ctx) ir_assignment(result, expr, NULL); base_ir->insert_before(assign); @@ -218,21 +220,21 @@ ir_mat_op_to_vec_visitor::do_mul_vec_mat(ir_variable *result_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 *a = new(mem_ctx) 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); + result = new(mem_ctx) ir_dereference_variable(result_var); + result = new(mem_ctx) ir_swizzle(result, i, 0, 0, 0, 1); - column_expr = new(base_ir) ir_expression(ir_binop_dot, + column_expr = new(mem_ctx) ir_expression(ir_binop_dot, result->type, a, b); - column_assign = new(base_ir) ir_assignment(result, + column_assign = new(mem_ctx) ir_assignment(result, column_expr, NULL); base_ir->insert_before(column_assign); @@ -248,17 +250,17 @@ ir_mat_op_to_vec_visitor::do_mul_mat_scalar(ir_variable *result_var, 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 *b = new(mem_ctx) 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, + column_expr = new(mem_ctx) ir_expression(ir_binop_mul, result->type, a, b); - column_assign = new(base_ir) ir_assignment(result, + column_assign = new(mem_ctx) ir_assignment(result, column_expr, NULL); base_ir->insert_before(column_assign); @@ -286,6 +288,8 @@ ir_mat_op_to_vec_visitor::visit_leave(ir_assignment *assign) if (!found_matrix) return visit_continue; + mem_ctx = talloc_parent(assign); + ir_dereference_variable *lhs_deref = assign->lhs->as_dereference_variable(); assert(lhs_deref); @@ -297,13 +301,13 @@ ir_mat_op_to_vec_visitor::visit_leave(ir_assignment *assign) for (i = 0; i < expr->get_num_operands(); i++) { ir_assignment *assign; - op_var[i] = new(base_ir) ir_variable(expr->operands[i]->type, + op_var[i] = new(mem_ctx) ir_variable(expr->operands[i]->type, "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]); - assign = new(base_ir) ir_assignment(lhs_deref, + lhs_deref = new(mem_ctx) ir_dereference_variable(op_var[i]); + assign = new(mem_ctx) ir_assignment(lhs_deref, expr->operands[i], NULL); base_ir->insert_before(assign); @@ -321,12 +325,12 @@ ir_mat_op_to_vec_visitor::visit_leave(ir_assignment *assign) ir_expression *column_expr; ir_assignment *column_assign; - column_expr = new(base_ir) ir_expression(expr->operation, + column_expr = new(mem_ctx) ir_expression(expr->operation, result->type, op0, NULL); - column_assign = new(base_ir) ir_assignment(result, + column_assign = new(mem_ctx) ir_assignment(result, column_expr, NULL, mask); @@ -352,12 +356,12 @@ ir_mat_op_to_vec_visitor::visit_leave(ir_assignment *assign) ir_expression *column_expr; ir_assignment *column_assign; - column_expr = new(base_ir) ir_expression(expr->operation, + column_expr = new(mem_ctx) ir_expression(expr->operation, result->type, op0, op1); - column_assign = new(base_ir) ir_assignment(result, + column_assign = new(mem_ctx) ir_assignment(result, column_expr, NULL, mask); -- cgit v1.2.3 From c7adb4ff1e7183d476680617d130b7dfed80d6c0 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Fri, 27 Aug 2010 15:34:42 -0700 Subject: glsl: Rename a couple of common variable names in mat_op_to_vec. It was easy while typing implementations to accidentally overwrite the original expression or assignment variables. --- src/glsl/ir_mat_op_to_vec.cpp | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) (limited to 'src') diff --git a/src/glsl/ir_mat_op_to_vec.cpp b/src/glsl/ir_mat_op_to_vec.cpp index 13f5d76963..5dba99f685 100644 --- a/src/glsl/ir_mat_op_to_vec.cpp +++ b/src/glsl/ir_mat_op_to_vec.cpp @@ -268,29 +268,30 @@ ir_mat_op_to_vec_visitor::do_mul_mat_scalar(ir_variable *result_var, } ir_visitor_status -ir_mat_op_to_vec_visitor::visit_leave(ir_assignment *assign) +ir_mat_op_to_vec_visitor::visit_leave(ir_assignment *orig_assign) { - ir_expression *expr = assign->rhs->as_expression(); + ir_expression *orig_expr = orig_assign->rhs->as_expression(); bool found_matrix = false; unsigned int i, matrix_columns = 1; ir_variable *op_var[2]; - if (!expr) + if (!orig_expr) return visit_continue; - for (i = 0; i < expr->get_num_operands(); i++) { - if (expr->operands[i]->type->is_matrix()) { + for (i = 0; i < orig_expr->get_num_operands(); i++) { + if (orig_expr->operands[i]->type->is_matrix()) { found_matrix = true; - matrix_columns = expr->operands[i]->type->matrix_columns; + matrix_columns = orig_expr->operands[i]->type->matrix_columns; break; } } if (!found_matrix) return visit_continue; - mem_ctx = talloc_parent(assign); + mem_ctx = talloc_parent(orig_assign); - ir_dereference_variable *lhs_deref = assign->lhs->as_dereference_variable(); + ir_dereference_variable *lhs_deref = + orig_assign->lhs->as_dereference_variable(); assert(lhs_deref); ir_variable *result_var = lhs_deref->var; @@ -298,23 +299,23 @@ ir_mat_op_to_vec_visitor::visit_leave(ir_assignment *assign) /* Store the expression operands in temps so we can use them * multiple times. */ - for (i = 0; i < expr->get_num_operands(); i++) { + for (i = 0; i < orig_expr->get_num_operands(); i++) { ir_assignment *assign; - op_var[i] = new(mem_ctx) ir_variable(expr->operands[i]->type, + op_var[i] = new(mem_ctx) ir_variable(orig_expr->operands[i]->type, "mat_op_to_vec", ir_var_temporary); base_ir->insert_before(op_var[i]); lhs_deref = new(mem_ctx) ir_dereference_variable(op_var[i]); assign = new(mem_ctx) ir_assignment(lhs_deref, - expr->operands[i], + orig_expr->operands[i], NULL); base_ir->insert_before(assign); } /* OK, time to break down this matrix operation. */ - switch (expr->operation) { + switch (orig_expr->operation) { case ir_unop_neg: { const unsigned mask = (1U << result_var->type->vector_elements) - 1; @@ -325,7 +326,7 @@ ir_mat_op_to_vec_visitor::visit_leave(ir_assignment *assign) ir_expression *column_expr; ir_assignment *column_assign; - column_expr = new(mem_ctx) ir_expression(expr->operation, + column_expr = new(mem_ctx) ir_expression(orig_expr->operation, result->type, op0, NULL); @@ -356,7 +357,7 @@ ir_mat_op_to_vec_visitor::visit_leave(ir_assignment *assign) ir_expression *column_expr; ir_assignment *column_assign; - column_expr = new(mem_ctx) ir_expression(expr->operation, + column_expr = new(mem_ctx) ir_expression(orig_expr->operation, result->type, op0, op1); @@ -391,10 +392,11 @@ ir_mat_op_to_vec_visitor::visit_leave(ir_assignment *assign) } break; default: - printf("FINISHME: Handle matrix operation for %s\n", expr->operator_string()); + printf("FINISHME: Handle matrix operation for %s\n", + orig_expr->operator_string()); abort(); } - assign->remove(); + orig_assign->remove(); this->made_progress = true; return visit_continue; -- cgit v1.2.3 From 977f7d48eefee281cc6bb3ccfb462290854b05cd Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Sat, 28 Aug 2010 00:30:00 +0100 Subject: trace: Don't try to dump the rgba array if null --- src/gallium/drivers/trace/tr_context.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/drivers/trace/tr_context.c b/src/gallium/drivers/trace/tr_context.c index 9e8a23d35c..271cd4aff5 100644 --- a/src/gallium/drivers/trace/tr_context.c +++ b/src/gallium/drivers/trace/tr_context.c @@ -1063,7 +1063,10 @@ trace_context_clear(struct pipe_context *_pipe, trace_dump_arg(ptr, pipe); trace_dump_arg(uint, buffers); - trace_dump_arg_array(float, rgba, 4); + if (rgba) + trace_dump_arg_array(float, rgba, 4); + else + trace_dump_null(); trace_dump_arg(float, depth); trace_dump_arg(uint, stencil); -- cgit v1.2.3 From 120d5a95cb983b0b983089ba415486c55a9196e3 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Wed, 18 Aug 2010 17:53:47 -0700 Subject: glsl2: Decompose matrix comparison into vector operations --- src/glsl/ir_mat_op_to_vec.cpp | 106 ++++++++++++++++++++++++++++++++++++++---- 1 file changed, 97 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/glsl/ir_mat_op_to_vec.cpp b/src/glsl/ir_mat_op_to_vec.cpp index 5dba99f685..da6de9492b 100644 --- a/src/glsl/ir_mat_op_to_vec.cpp +++ b/src/glsl/ir_mat_op_to_vec.cpp @@ -56,6 +56,8 @@ public: 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); + void do_equal_mat_mat(ir_variable *result_var, ir_variable *a_var, + ir_variable *b_var, bool test_equal); void *mem_ctx; bool made_progress; @@ -267,25 +269,104 @@ ir_mat_op_to_vec_visitor::do_mul_mat_scalar(ir_variable *result_var, } } +void +ir_mat_op_to_vec_visitor::do_equal_mat_mat(ir_variable *result_var, + ir_variable *a_var, + ir_variable *b_var, + bool test_equal) +{ + /* This essentially implements the following GLSL: + * + * bool equal(mat4 a, mat4 b) + * { + * return !any(bvec4(a[0] != b[0], + * a[1] != b[1], + * a[2] != b[2], + * a[3] != b[3]); + * } + * + * bool nequal(mat4 a, mat4 b) + * { + * return any(bvec4(a[0] != b[0], + * a[1] != b[1], + * a[2] != b[2], + * a[3] != b[3]); + * } + */ + const unsigned columns = a_var->type->matrix_columns; + const glsl_type *const bvec_type = + glsl_type::get_instance(GLSL_TYPE_BOOL, columns, 1); + + ir_variable *const tmp_bvec = + new(this->mem_ctx) ir_variable(bvec_type, "mat_cmp_bvec", + ir_var_temporary); + this->base_ir->insert_before(tmp_bvec); + + for (unsigned i = 0; i < columns; i++) { + ir_dereference *const op0 = get_column(a_var, i); + ir_dereference *const op1 = get_column(b_var, i); + + ir_expression *const cmp = + new(this->mem_ctx) ir_expression(ir_binop_nequal, + glsl_type::bool_type, op0, op1); + + ir_rvalue *const swiz = + new(this->mem_ctx) ir_swizzle(cmp, i, i, i, i, columns); + + ir_dereference *const lhs = + new(this->mem_ctx) ir_dereference_variable(tmp_bvec); + + ir_assignment *const assign = + new(this->mem_ctx) ir_assignment(lhs, swiz, NULL, (1U << i)); + + this->base_ir->insert_before(assign); + } + + ir_rvalue *const val = + new(this->mem_ctx) ir_dereference_variable(tmp_bvec); + + ir_expression *any = + new(this->mem_ctx) ir_expression(ir_unop_any, glsl_type::bool_type, + val, NULL); + + if (test_equal) + any = new(this->mem_ctx) ir_expression(ir_unop_logic_not, + glsl_type::bool_type, + any, NULL); + + ir_rvalue *const result = + new(this->mem_ctx) ir_dereference_variable(result_var); + + ir_assignment *const assign = + new(mem_ctx) ir_assignment(result, any, NULL); + base_ir->insert_before(assign); +} + +static bool +has_matrix_operand(const ir_expression *expr, unsigned &columns) +{ + for (unsigned i = 0; i < expr->get_num_operands(); i++) { + if (expr->operands[i]->type->is_matrix()) { + columns = expr->operands[i]->type->matrix_columns; + return true; + } + } + + return false; +} + + ir_visitor_status ir_mat_op_to_vec_visitor::visit_leave(ir_assignment *orig_assign) { ir_expression *orig_expr = orig_assign->rhs->as_expression(); - bool found_matrix = false; unsigned int i, matrix_columns = 1; ir_variable *op_var[2]; if (!orig_expr) return visit_continue; - for (i = 0; i < orig_expr->get_num_operands(); i++) { - if (orig_expr->operands[i]->type->is_matrix()) { - found_matrix = true; - matrix_columns = orig_expr->operands[i]->type->matrix_columns; - break; - } - } - if (!found_matrix) + if (!has_matrix_operand(orig_expr, matrix_columns)) return visit_continue; mem_ctx = talloc_parent(orig_assign); @@ -391,6 +472,13 @@ ir_mat_op_to_vec_visitor::visit_leave(ir_assignment *orig_assign) } } break; + + case ir_binop_equal: + case ir_binop_nequal: + do_equal_mat_mat(result_var, op_var[1], op_var[0], + (orig_expr->operation == ir_binop_equal)); + break; + default: printf("FINISHME: Handle matrix operation for %s\n", orig_expr->operator_string()); -- cgit v1.2.3 From f7579f2f28999e585ee9a51635c38d57d25c6193 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Sat, 28 Aug 2010 00:29:02 -0700 Subject: llvmpipe: Remove unnecessary header. --- src/gallium/drivers/llvmpipe/lp_setup_coef_intrin.c | 1 - 1 file changed, 1 deletion(-) (limited to 'src') diff --git a/src/gallium/drivers/llvmpipe/lp_setup_coef_intrin.c b/src/gallium/drivers/llvmpipe/lp_setup_coef_intrin.c index b477bc2113..73fb70599c 100644 --- a/src/gallium/drivers/llvmpipe/lp_setup_coef_intrin.c +++ b/src/gallium/drivers/llvmpipe/lp_setup_coef_intrin.c @@ -35,7 +35,6 @@ #include "lp_setup_context.h" #include "lp_setup_coef.h" #include "lp_rast.h" -#include "lp_state_fs.h" #if defined(PIPE_ARCH_SSE) #include -- cgit v1.2.3 From 97cbb563f82f9242a4d7588e502eb2d289eb1b36 Mon Sep 17 00:00:00 2001 From: Marek Olšák Date: Sat, 28 Aug 2010 07:51:55 +0200 Subject: r300g: set the correct value in PVS_NUM_CNTLRS As per docs. --- src/gallium/drivers/r300/r300_emit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_emit.c b/src/gallium/drivers/r300/r300_emit.c index 58d7e4ffe9..232259e21d 100644 --- a/src/gallium/drivers/r300/r300_emit.c +++ b/src/gallium/drivers/r300/r300_emit.c @@ -909,7 +909,7 @@ void r300_emit_vs_state(struct r300_context* r300, unsigned size, void* state) unsigned pvs_num_slots = MIN3(vtx_mem_size / input_count, vtx_mem_size / output_count, 10); - unsigned pvs_num_controllers = MIN2(vtx_mem_size / temp_count, 6); + unsigned pvs_num_controllers = MIN2(vtx_mem_size / temp_count, 5); unsigned imm_first = vs->externals_count; unsigned imm_end = vs->code.constants.Count; -- cgit v1.2.3 From c0f0eb866880ff3e701cd3a532d49417f2743283 Mon Sep 17 00:00:00 2001 From: Mathias Fröhlich Date: Sat, 28 Aug 2010 18:16:41 +0200 Subject: r300g: fix min/max lod computation --- src/gallium/drivers/r300/r300_state.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c index 2240011368..9adaea3235 100644 --- a/src/gallium/drivers/r300/r300_state.c +++ b/src/gallium/drivers/r300/r300_state.c @@ -1213,8 +1213,8 @@ static void* /* Unfortunately, r300-r500 don't support floating-point mipmap lods. */ /* We must pass these to the merge function to clamp them properly. */ - sampler->min_lod = MAX2((unsigned)state->min_lod, 0); - sampler->max_lod = MAX2((unsigned)ceilf(state->max_lod), 0); + sampler->min_lod = (unsigned)MAX2(state->min_lod, 0); + sampler->max_lod = (unsigned)MAX2(ceilf(state->max_lod), 0); lod_bias = CLAMP((int)(state->lod_bias * 32 + 1), -(1 << 9), (1 << 9) - 1); -- cgit v1.2.3 From c5b8ba9368fe935af9f350874f3c03f5a230d4b5 Mon Sep 17 00:00:00 2001 From: Marek Olšák Date: Sat, 28 Aug 2010 07:54:36 +0200 Subject: r300g: fix blitting between 2D NPOT mipmaps Even though MIP filtering is not supported, we can bind an arbitrary mipmap as the zero mipmap level. NPOT textures now follow GL_TEXTURE_BASE_LEVEL and GL_TEXTURE_MIN_LOD. This fixes piglit/fbo-copyteximage. --- src/gallium/drivers/r300/r300_reg.h | 1 + src/gallium/drivers/r300/r300_state_derived.c | 24 +++++++++++---- src/gallium/drivers/r300/r300_texture.c | 43 ++++++++++++++++----------- src/gallium/drivers/r300/r300_texture.h | 6 ++++ 4 files changed, 51 insertions(+), 23 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_reg.h b/src/gallium/drivers/r300/r300_reg.h index 60d3b600cb..6bea783f69 100644 --- a/src/gallium/drivers/r300/r300_reg.h +++ b/src/gallium/drivers/r300/r300_reg.h @@ -1607,6 +1607,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. # define R300_TX_FORMAT_3D (1 << 25) # define R300_TX_FORMAT_CUBIC_MAP (2 << 25) +# define R300_TX_FORMAT_TEX_COORD_TYPE_MASK (0x3 << 25) /* alpha modes, convenience mostly */ /* if you have alpha, pick constant appropriate to the diff --git a/src/gallium/drivers/r300/r300_state_derived.c b/src/gallium/drivers/r300/r300_state_derived.c index c8de3e1c52..960dfdbaf0 100644 --- a/src/gallium/drivers/r300/r300_state_derived.c +++ b/src/gallium/drivers/r300/r300_state_derived.c @@ -592,6 +592,25 @@ static void r300_merge_textures_and_samplers(struct r300_context* r300) texstate->filter1 = sampler->filter1; texstate->border_color = sampler->border_color; + /* determine min/max levels */ + max_level = MIN3(sampler->max_lod + view->base.first_level, + tex->desc.b.b.last_level, view->base.last_level); + min_level = MIN2(sampler->min_lod + view->base.first_level, + max_level); + + if (tex->desc.is_npot && min_level > 0) { + /* Even though we do not implement mipmapping for NPOT + * textures, we should at least honor the minimum level + * which is allowed to be displayed. We do this by setting up + * an i-th mipmap level as the zero level. */ + r300_texture_setup_format_state(r300->screen, &tex->desc, + min_level, + &texstate->format); + texstate->format.tile_config |= + tex->desc.offset_in_bytes[min_level] & 0xffffffe0; + assert((tex->desc.offset_in_bytes[min_level] & 0x1f) == 0); + } + /* Assign a texture cache region. */ texstate->format.format1 |= view->texcache_region; @@ -654,12 +673,7 @@ static void r300_merge_textures_and_samplers(struct r300_context* r300) texstate->filter0 |= R300_TX_WRAP_T(R300_TX_CLAMP_TO_EDGE); } } else { - /* determine min/max levels */ /* the MAX_MIP level is the largest (finest) one */ - max_level = MIN3(sampler->max_lod + view->base.first_level, - tex->desc.b.b.last_level, view->base.last_level); - min_level = MIN2(sampler->min_lod + view->base.first_level, - max_level); texstate->format.format0 |= R300_TX_NUM_LEVELS(max_level); texstate->filter0 |= R300_TX_MAX_MIP_LEVEL(min_level); } diff --git a/src/gallium/drivers/r300/r300_texture.c b/src/gallium/drivers/r300/r300_texture.c index 852acdd462..66f6d80bd0 100644 --- a/src/gallium/drivers/r300/r300_texture.c +++ b/src/gallium/drivers/r300/r300_texture.c @@ -541,48 +541,55 @@ boolean r300_is_sampler_format_supported(enum pipe_format format) return r300_translate_texformat(format, 0, TRUE) != ~0; } -static void r300_texture_setup_immutable_state(struct r300_screen* screen, - struct r300_texture* tex) +void r300_texture_setup_format_state(struct r300_screen *screen, + struct r300_texture_desc *desc, + unsigned level, + struct r300_texture_format_state *out) { - struct r300_texture_format_state* f = &tex->tx_format; - struct pipe_resource *pt = &tex->desc.b.b; + struct pipe_resource *pt = &desc->b.b; boolean is_r500 = screen->caps.is_r500; + /* Mask out all the fields we change. */ + out->format0 = 0; + out->format1 &= ~R300_TX_FORMAT_TEX_COORD_TYPE_MASK; + out->format2 &= R500_TXFORMAT_MSB; + out->tile_config = 0; + /* Set sampler state. */ - f->format0 = R300_TX_WIDTH((pt->width0 - 1) & 0x7ff) | - R300_TX_HEIGHT((pt->height0 - 1) & 0x7ff); + out->format0 = R300_TX_WIDTH((u_minify(pt->width0, level) - 1) & 0x7ff) | + R300_TX_HEIGHT((u_minify(pt->height0, level) - 1) & 0x7ff); - if (tex->desc.uses_stride_addressing) { + if (desc->uses_stride_addressing) { /* rectangles love this */ - f->format0 |= R300_TX_PITCH_EN; - f->format2 = (tex->desc.stride_in_pixels[0] - 1) & 0x1fff; + out->format0 |= R300_TX_PITCH_EN; + out->format2 = (desc->stride_in_pixels[level] - 1) & 0x1fff; } else { /* Power of two textures (3D, mipmaps, and no pitch), * also NPOT textures with a width being POT. */ - f->format0 |= R300_TX_DEPTH(util_logbase2(pt->depth0) & 0xf); + out->format0 |= + R300_TX_DEPTH(util_logbase2(u_minify(pt->depth0, level)) & 0xf); } - f->format1 = 0; if (pt->target == PIPE_TEXTURE_CUBE) { - f->format1 |= R300_TX_FORMAT_CUBIC_MAP; + out->format1 |= R300_TX_FORMAT_CUBIC_MAP; } if (pt->target == PIPE_TEXTURE_3D) { - f->format1 |= R300_TX_FORMAT_3D; + out->format1 |= R300_TX_FORMAT_3D; } /* large textures on r500 */ if (is_r500) { if (pt->width0 > 2048) { - f->format2 |= R500_TXWIDTH_BIT11; + out->format2 |= R500_TXWIDTH_BIT11; } if (pt->height0 > 2048) { - f->format2 |= R500_TXHEIGHT_BIT11; + out->format2 |= R500_TXHEIGHT_BIT11; } } - f->tile_config = R300_TXO_MACRO_TILE(tex->desc.macrotile[0]) | - R300_TXO_MICRO_TILE(tex->desc.microtile); + out->tile_config = R300_TXO_MACRO_TILE(desc->macrotile[level]) | + R300_TXO_MICRO_TILE(desc->microtile); } static void r300_texture_setup_fb_state(struct r300_screen* screen, @@ -716,7 +723,7 @@ r300_texture_create_object(struct r300_screen *rscreen, return NULL; } /* Initialize the hardware state. */ - r300_texture_setup_immutable_state(rscreen, tex); + r300_texture_setup_format_state(rscreen, &tex->desc, 0, &tex->tx_format); r300_texture_setup_fb_state(rscreen, tex); tex->desc.b.vtbl = &r300_texture_vtbl; diff --git a/src/gallium/drivers/r300/r300_texture.h b/src/gallium/drivers/r300/r300_texture.h index 5a371a54a8..c4588a0c90 100644 --- a/src/gallium/drivers/r300/r300_texture.h +++ b/src/gallium/drivers/r300/r300_texture.h @@ -29,6 +29,8 @@ struct pipe_screen; struct pipe_resource; struct winsys_handle; +struct r300_texture_format_state; +struct r300_texture_desc; struct r300_texture; struct r300_screen; @@ -51,6 +53,10 @@ boolean r300_is_zs_format_supported(enum pipe_format format); boolean r300_is_sampler_format_supported(enum pipe_format format); +void r300_texture_setup_format_state(struct r300_screen *screen, + struct r300_texture_desc *desc, + unsigned level, + struct r300_texture_format_state *out); struct pipe_resource* r300_texture_from_handle(struct pipe_screen* screen, -- cgit v1.2.3 From cf1e4b15a4d21342320fed0fdb19ba6211e4628b Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Sat, 28 Aug 2010 14:14:33 -0700 Subject: llvmpipe: Include missing header in lp_flush.c. Include p_screen.h for complete type to pipe_screen. --- src/gallium/drivers/llvmpipe/lp_flush.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/gallium/drivers/llvmpipe/lp_flush.c b/src/gallium/drivers/llvmpipe/lp_flush.c index 040fe0ba9a..e2c723b7a8 100644 --- a/src/gallium/drivers/llvmpipe/lp_flush.c +++ b/src/gallium/drivers/llvmpipe/lp_flush.c @@ -31,6 +31,7 @@ #include "pipe/p_defines.h" +#include "pipe/p_screen.h" #include "util/u_string.h" #include "draw/draw_context.h" #include "lp_flush.h" -- cgit v1.2.3 From 9112e531d4c26ea88a31c05fe2bc8cc613b76b65 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Sat, 28 Aug 2010 14:18:57 -0700 Subject: draw: Include missing header in draw_vs_llvm.c. Include p_screen.h for completely type to pipe_screen. --- src/gallium/auxiliary/draw/draw_vs_llvm.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/gallium/auxiliary/draw/draw_vs_llvm.c b/src/gallium/auxiliary/draw/draw_vs_llvm.c index 0014863454..fa9992db78 100644 --- a/src/gallium/auxiliary/draw/draw_vs_llvm.c +++ b/src/gallium/auxiliary/draw/draw_vs_llvm.c @@ -28,6 +28,7 @@ #include "util/u_math.h" #include "util/u_memory.h" #include "pipe/p_shader_tokens.h" +#include "pipe/p_screen.h" #include "draw_private.h" #include "draw_context.h" -- cgit v1.2.3 From d42b7d5f8d5eef73c89c2362beab94647ce12281 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Sat, 28 Aug 2010 14:21:28 -0700 Subject: softpipe: Include missing header in sp_flush.c. Include p_screen.h for complete type to pipe_screen. --- src/gallium/drivers/softpipe/sp_flush.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/gallium/drivers/softpipe/sp_flush.c b/src/gallium/drivers/softpipe/sp_flush.c index 4a53ef048f..1071011db0 100644 --- a/src/gallium/drivers/softpipe/sp_flush.c +++ b/src/gallium/drivers/softpipe/sp_flush.c @@ -31,6 +31,7 @@ #include "pipe/p_defines.h" +#include "pipe/p_screen.h" #include "draw/draw_context.h" #include "sp_flush.h" #include "sp_context.h" -- cgit v1.2.3 From 2dfd348e33f0152e3ab693ec3b53911331f5c349 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Sat, 28 Aug 2010 14:24:42 -0700 Subject: st/mesa: Include missing header in st_mesa_to_tgsi.c. Include p_screen.h for complete type to pipe_screen. --- src/mesa/state_tracker/st_mesa_to_tgsi.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/state_tracker/st_mesa_to_tgsi.c b/src/mesa/state_tracker/st_mesa_to_tgsi.c index a19dcc9253..0ed822b8c2 100644 --- a/src/mesa/state_tracker/st_mesa_to_tgsi.c +++ b/src/mesa/state_tracker/st_mesa_to_tgsi.c @@ -32,9 +32,10 @@ */ #include "pipe/p_compiler.h" +#include "pipe/p_context.h" +#include "pipe/p_screen.h" #include "pipe/p_shader_tokens.h" #include "pipe/p_state.h" -#include "pipe/p_context.h" #include "tgsi/tgsi_ureg.h" #include "st_mesa_to_tgsi.h" #include "st_context.h" -- cgit v1.2.3 From 3d4597f9d4c93d285825d5a6505d4ee7ce6e2c3e Mon Sep 17 00:00:00 2001 From: Cedric Vivier Date: Sat, 28 Aug 2010 20:01:46 -0700 Subject: i965: Move libdrm/C++ hack introduced in fa2deb3d to intel_context.h Fixes build on Linux/GCC 4.4 as libdrm includes are also used by other brw_fs_*.cpp files. Bug #29855 --- src/mesa/drivers/dri/i965/brw_fs.cpp | 5 ----- 1 file changed, 5 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp index 63eae840c2..ede1848520 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -28,11 +28,6 @@ extern "C" { #include -/* Evil hack for using libdrm in a c++ compiler. */ -#define virtual virt -#include "i915_drm.h" -#include "intel_bufmgr.h" -#undef virtual #include "main/macros.h" #include "main/shaderobj.h" -- cgit v1.2.3 From af62060ef264998f96eb977d6e0a5de9fe2bd651 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Sat, 28 Aug 2010 19:55:53 -0700 Subject: i965: Add disasm for gen5 sampler messages. --- src/mesa/drivers/dri/i965/brw_disasm.c | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_disasm.c b/src/mesa/drivers/dri/i965/brw_disasm.c index b54638058b..f74a236834 100644 --- a/src/mesa/drivers/dri/i965/brw_disasm.c +++ b/src/mesa/drivers/dri/i965/brw_disasm.c @@ -888,12 +888,25 @@ int brw_disasm (FILE *file, struct brw_instruction *inst, int gen) inst->bits3.math.precision, &space); break; case BRW_MESSAGE_TARGET_SAMPLER: - format (file, " (%d, %d, ", - inst->bits3.sampler.binding_table_index, - inst->bits3.sampler.sampler); - err |= control (file, "sampler target format", sampler_target_format, - inst->bits3.sampler.return_format, NULL); - string (file, ")"); + if (gen >= 5) { + format (file, " (%d, %d, %d, %d)", + inst->bits3.sampler_gen5.binding_table_index, + inst->bits3.sampler_gen5.sampler, + inst->bits3.sampler_gen5.msg_type, + inst->bits3.sampler_gen5.simd_mode); + } else if (0 /* FINISHME: is_g4x */) { + format (file, " (%d, %d)", + inst->bits3.sampler_g4x.binding_table_index, + inst->bits3.sampler_g4x.sampler); + } else { + format (file, " (%d, %d, ", + inst->bits3.sampler.binding_table_index, + inst->bits3.sampler.sampler); + err |= control (file, "sampler target format", + sampler_target_format, + inst->bits3.sampler.return_format, NULL); + string (file, ")"); + } break; case BRW_MESSAGE_TARGET_DATAPORT_READ: if (gen >= 6) { -- cgit v1.2.3 From 735af3959f4a4eb5940835c5a4117a020f103414 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Sat, 28 Aug 2010 14:43:50 -0700 Subject: i965: Add initial support for texturing to the new FS backend. Fixes 11 piglit tests. --- src/mesa/drivers/dri/i965/brw_fs.cpp | 143 +++++++++++++++++++++++++++++++---- 1 file changed, 128 insertions(+), 15 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp index ede1848520..1ef27ce9ce 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -67,6 +67,7 @@ enum fs_opcodes { FS_OPCODE_DDX, FS_OPCODE_DDY, FS_OPCODE_LINTERP, + FS_OPCODE_TEX, }; static int using_new_fs = -1; @@ -299,53 +300,52 @@ public: return node; } - fs_inst() + void init() { this->opcode = BRW_OPCODE_NOP; this->saturate = false; this->conditional_mod = BRW_CONDITIONAL_NONE; this->predicated = false; + this->sampler = 0; + this->shadow_compare = false; + } + + fs_inst() + { + init(); } fs_inst(int opcode) { + init(); this->opcode = opcode; - this->saturate = false; - this->conditional_mod = BRW_CONDITIONAL_NONE; - this->predicated = false; } fs_inst(int opcode, fs_reg dst, fs_reg src0) { + init(); this->opcode = opcode; this->dst = dst; this->src[0] = src0; - this->saturate = false; - this->conditional_mod = BRW_CONDITIONAL_NONE; - this->predicated = false; } fs_inst(int opcode, fs_reg dst, fs_reg src0, fs_reg src1) { + init(); this->opcode = opcode; this->dst = dst; this->src[0] = src0; this->src[1] = src1; - this->saturate = false; - this->conditional_mod = BRW_CONDITIONAL_NONE; - this->predicated = false; } fs_inst(int opcode, fs_reg dst, fs_reg src0, fs_reg src1, fs_reg src2) { + init(); this->opcode = opcode; this->dst = dst; this->src[0] = src0; this->src[1] = src1; this->src[2] = src2; - this->saturate = false; - this->conditional_mod = BRW_CONDITIONAL_NONE; - this->predicated = false; } int opcode; /* BRW_OPCODE_* or FS_OPCODE_* */ @@ -355,6 +355,10 @@ public: bool predicated; int conditional_mod; /**< BRW_CONDITIONAL_* */ + int mlen; /** SEND message length */ + int sampler; + bool shadow_compare; + /** @{ * Annotation for the generated IR. One of the two can be set. */ @@ -425,6 +429,7 @@ public: void generate_fb_write(fs_inst *inst); void generate_linterp(fs_inst *inst, struct brw_reg dst, struct brw_reg *src); + void generate_tex(fs_inst *inst, struct brw_reg dst, struct brw_reg src); void generate_math(fs_inst *inst, struct brw_reg dst, struct brw_reg *src); void emit_dummy_fs(); @@ -540,7 +545,8 @@ fs_visitor::visit(ir_variable *ir) int param_index = c->prog_data.nr_params; /* FINISHME: This is wildly incomplete. */ - assert(ir->type->is_scalar() || ir->type->is_vector()); + assert(ir->type->is_scalar() || ir->type->is_vector() || + ir->type->is_sampler()); const struct gl_program *fp = &this->brw->fragment_program->Base; /* Our support for uniforms is piggy-backed on the struct @@ -869,7 +875,71 @@ fs_visitor::visit(ir_assignment *ir) void fs_visitor::visit(ir_texture *ir) { - assert(!"FINISHME"); + int base_mrf = 2; + fs_inst *inst = NULL; + unsigned int mlen = 0; + + ir->coordinate->accept(this); + fs_reg coordinate = this->result; + + if (ir->projector) { + fs_reg inv_proj = fs_reg(this, glsl_type::float_type); + + ir->projector->accept(this); + emit(fs_inst(FS_OPCODE_RCP, inv_proj, this->result)); + + fs_reg proj_coordinate = fs_reg(this, ir->coordinate->type); + for (unsigned int i = 0; i < ir->coordinate->type->vector_elements; i++) { + emit(fs_inst(BRW_OPCODE_MUL, proj_coordinate, coordinate, inv_proj)); + coordinate.reg_offset++; + proj_coordinate.reg_offset++; + } + proj_coordinate.reg_offset = 0; + + coordinate = proj_coordinate; + } + + for (mlen = 0; mlen < ir->coordinate->type->vector_elements; mlen++) { + emit(fs_inst(BRW_OPCODE_MOV, fs_reg(MRF, base_mrf + mlen), coordinate)); + coordinate.reg_offset++; + } + + /* Pre-Ironlake, the 8-wide sampler always took u,v,r. */ + if (intel->gen < 5) + mlen = 3; + + if (ir->shadow_comparitor) { + /* For shadow comparisons, we have to supply u,v,r. */ + mlen = 3; + + ir->shadow_comparitor->accept(this); + emit(fs_inst(BRW_OPCODE_MOV, fs_reg(MRF, base_mrf + mlen), this->result)); + mlen++; + } + + /* Do we ever want to handle writemasking on texture samples? Is it + * performance relevant? + */ + fs_reg dst = fs_reg(this, glsl_type::vec4_type); + this->result = dst; + + switch (ir->op) { + case ir_tex: + inst = emit(fs_inst(FS_OPCODE_TEX, dst, fs_reg(MRF, base_mrf))); + break; + case ir_txb: + case ir_txl: + assert(!"FINISHME"); + break; + case ir_txd: + case ir_txf: + assert(!"GLSL 1.30 features unsupported"); + break; + } + + if (ir->shadow_comparitor) + inst->shadow_compare = true; + inst->mlen = mlen; } void @@ -1309,6 +1379,46 @@ fs_visitor::generate_math(fs_inst *inst, BRW_MATH_PRECISION_FULL); } +void +fs_visitor::generate_tex(fs_inst *inst, struct brw_reg dst, struct brw_reg src) +{ + int msg_type; + + if (intel->gen == 5) { + if (inst->shadow_compare) + msg_type = BRW_SAMPLER_MESSAGE_SAMPLE_COMPARE_GEN5; + else + msg_type = BRW_SAMPLER_MESSAGE_SAMPLE_GEN5; + } else { + /* Note that G45 and older determines shadow compare and dispatch width + * from message length for most messages. + */ + if (inst->shadow_compare) + msg_type = BRW_SAMPLER_MESSAGE_SIMD16_SAMPLE_COMPARE; + else + msg_type = BRW_SAMPLER_MESSAGE_SIMD16_SAMPLE; + } + + int response_length = 4; + + /* g0 header. */ + src.nr--; + + brw_SAMPLE(p, + retype(dst, BRW_REGISTER_TYPE_UW), + src.nr, + retype(brw_vec8_grf(0, 0), BRW_REGISTER_TYPE_UW), + SURF_INDEX_TEXTURE(inst->sampler), + inst->sampler, + WRITEMASK_XYZW, + msg_type, + response_length, + inst->mlen + 1, + 0, + 1, + BRW_SAMPLER_SIMD_MODE_SIMD8); +} + static void trivial_assign_reg(int header_size, fs_reg *reg) { @@ -1538,6 +1648,9 @@ fs_visitor::generate_code() case FS_OPCODE_LINTERP: generate_linterp(inst, dst, src); break; + case FS_OPCODE_TEX: + generate_tex(inst, dst, src[0]); + break; case FS_OPCODE_FB_WRITE: generate_fb_write(inst); break; -- cgit v1.2.3 From 89b2897220acfacdc431f138377fbcec9f0ea812 Mon Sep 17 00:00:00 2001 From: Marek Olšák Date: Sun, 29 Aug 2010 06:03:39 +0200 Subject: util: remove util_is_pot in favor of util_is_power_of_two The function was duplicated. --- src/gallium/auxiliary/gallivm/lp_bld_arit.c | 2 +- src/gallium/auxiliary/gallivm/lp_bld_debug.c | 2 +- src/gallium/auxiliary/gallivm/lp_bld_format_aos.c | 4 ++-- src/gallium/auxiliary/gallivm/lp_bld_sample.c | 6 +++--- src/gallium/auxiliary/util/u_math.h | 10 ---------- src/gallium/drivers/galahad/glhd_screen.c | 2 +- 6 files changed, 8 insertions(+), 18 deletions(-) (limited to 'src') diff --git a/src/gallium/auxiliary/gallivm/lp_bld_arit.c b/src/gallium/auxiliary/gallivm/lp_bld_arit.c index bb30e6e9df..7bb57061f5 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_arit.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_arit.c @@ -538,7 +538,7 @@ lp_build_mul_imm(struct lp_build_context *bld, if(b == 2 && bld->type.floating) return lp_build_add(bld, a, a); - if(util_is_pot(b)) { + if(util_is_power_of_two(b)) { unsigned shift = ffs(b) - 1; if(bld->type.floating) { diff --git a/src/gallium/auxiliary/gallivm/lp_bld_debug.c b/src/gallium/auxiliary/gallivm/lp_bld_debug.c index 39dfc51e50..d3a5afff8c 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_debug.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_debug.c @@ -46,7 +46,7 @@ boolean lp_check_alignment(const void *ptr, unsigned alignment) { - assert(util_is_pot(alignment)); + assert(util_is_power_of_two(alignment)); return ((uintptr_t)ptr & (alignment - 1)) == 0; } diff --git a/src/gallium/auxiliary/gallivm/lp_bld_format_aos.c b/src/gallium/auxiliary/gallivm/lp_bld_format_aos.c index 247cb83ce6..92123e09d3 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_format_aos.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_format_aos.c @@ -388,7 +388,7 @@ lp_build_fetch_rgba_aos(LLVMBuilderRef builder, if (format_matches_type(format_desc, type) && format_desc->block.bits <= type.width * 4 && - util_is_pot(format_desc->block.bits)) { + util_is_power_of_two(format_desc->block.bits)) { LLVMValueRef packed; /* @@ -416,7 +416,7 @@ lp_build_fetch_rgba_aos(LLVMBuilderRef builder, format_desc->colorspace == UTIL_FORMAT_COLORSPACE_ZS) && format_desc->block.width == 1 && format_desc->block.height == 1 && - util_is_pot(format_desc->block.bits) && + util_is_power_of_two(format_desc->block.bits) && format_desc->block.bits <= 32 && format_desc->is_bitmask && !format_desc->is_mixed && diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample.c b/src/gallium/auxiliary/gallivm/lp_bld_sample.c index 0fd014ab9b..3c4992b25e 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_sample.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_sample.c @@ -82,9 +82,9 @@ lp_sampler_static_state(struct lp_sampler_static_state *state, state->swizzle_a = view->swizzle_a; state->target = texture->target; - state->pot_width = util_is_pot(texture->width0); - state->pot_height = util_is_pot(texture->height0); - state->pot_depth = util_is_pot(texture->depth0); + state->pot_width = util_is_power_of_two(texture->width0); + state->pot_height = util_is_power_of_two(texture->height0); + state->pot_depth = util_is_power_of_two(texture->depth0); state->wrap_s = sampler->wrap_s; state->wrap_t = sampler->wrap_t; diff --git a/src/gallium/auxiliary/util/u_math.h b/src/gallium/auxiliary/util/u_math.h index af510dac51..69a7681494 100644 --- a/src/gallium/auxiliary/util/u_math.h +++ b/src/gallium/auxiliary/util/u_math.h @@ -360,16 +360,6 @@ util_is_inf_or_nan(float x) } -/** - * Test whether x is a power of two. - */ -static INLINE boolean -util_is_pot(unsigned x) -{ - return (x & (x - 1)) == 0; -} - - /** * Find first bit set in word. Least significant bit is 1. * Return 0 if no bits set. diff --git a/src/gallium/drivers/galahad/glhd_screen.c b/src/gallium/drivers/galahad/glhd_screen.c index a4eac11ae3..75e4c2d82e 100644 --- a/src/gallium/drivers/galahad/glhd_screen.c +++ b/src/gallium/drivers/galahad/glhd_screen.c @@ -140,7 +140,7 @@ galahad_screen_resource_create(struct pipe_screen *_screen, if(templat->target != PIPE_TEXTURE_RECT && templat->target != PIPE_BUFFER && !screen->get_param(screen, PIPE_CAP_NPOT_TEXTURES)) { - if(!util_is_pot(templat->width0) || !util_is_pot(templat->height0)) + if(!util_is_power_of_two(templat->width0) || !util_is_power_of_two(templat->height0)) glhd_warn("Requested NPOT (%ux%u) non-rectangle texture without NPOT support", templat->width0, templat->height0); } -- cgit v1.2.3 From a922725118333e016a357008f37105c23c6f54bc Mon Sep 17 00:00:00 2001 From: Marek Olšák Date: Sun, 29 Aug 2010 06:08:24 +0200 Subject: r300g,u_blitter: use u_framebuffer Removing another function duplication in u_blitter. --- src/gallium/auxiliary/util/u_blitter.c | 2 +- src/gallium/auxiliary/util/u_blitter.h | 36 ++------------------------------- src/gallium/drivers/r300/r300_context.c | 2 +- src/gallium/drivers/r300/r300_state.c | 4 ++-- 4 files changed, 6 insertions(+), 38 deletions(-) (limited to 'src') diff --git a/src/gallium/auxiliary/util/u_blitter.c b/src/gallium/auxiliary/util/u_blitter.c index 8f93dac011..f93ef26ae7 100644 --- a/src/gallium/auxiliary/util/u_blitter.c +++ b/src/gallium/auxiliary/util/u_blitter.c @@ -320,7 +320,7 @@ static void blitter_restore_CSOs(struct blitter_context_priv *ctx) */ if (ctx->base.saved_fb_state.nr_cbufs != ~0) { pipe->set_framebuffer_state(pipe, &ctx->base.saved_fb_state); - util_assign_framebuffer_state(&ctx->base.saved_fb_state, NULL); + util_unreference_framebuffer_state(&ctx->base.saved_fb_state); ctx->base.saved_fb_state.nr_cbufs = ~0; } diff --git a/src/gallium/auxiliary/util/u_blitter.h b/src/gallium/auxiliary/util/u_blitter.h index f316587dea..e33d2e283f 100644 --- a/src/gallium/auxiliary/util/u_blitter.h +++ b/src/gallium/auxiliary/util/u_blitter.h @@ -27,6 +27,7 @@ #ifndef U_BLITTER_H #define U_BLITTER_H +#include "util/u_framebuffer.h" #include "util/u_inlines.h" #include "util/u_memory.h" @@ -258,45 +259,12 @@ void util_blitter_save_vertex_shader(struct blitter_context *blitter, blitter->saved_vs = vs; } -/* XXX This should probably be moved elsewhere. */ -static INLINE -void util_assign_framebuffer_state(struct pipe_framebuffer_state *dst, - const struct pipe_framebuffer_state *src) -{ - unsigned i; - - if (src) { - /* Reference all surfaces. */ - for (i = 0; i < src->nr_cbufs; i++) { - pipe_surface_reference(&dst->cbufs[i], src->cbufs[i]); - } - for (; i < dst->nr_cbufs; i++) { - pipe_surface_reference(&dst->cbufs[i], NULL); - } - - pipe_surface_reference(&dst->zsbuf, src->zsbuf); - - dst->nr_cbufs = src->nr_cbufs; - dst->width = src->width; - dst->height = src->height; - } else { - /* Set all surfaces to NULL. */ - for (i = 0; i < dst->nr_cbufs; i++) { - pipe_surface_reference(&dst->cbufs[i], NULL); - } - - pipe_surface_reference(&dst->zsbuf, NULL); - - dst->nr_cbufs = 0; - } -} - static INLINE void util_blitter_save_framebuffer(struct blitter_context *blitter, const struct pipe_framebuffer_state *state) { blitter->saved_fb_state.nr_cbufs = 0; /* It's ~0 now, meaning it's unsaved. */ - util_assign_framebuffer_state(&blitter->saved_fb_state, state); + util_copy_framebuffer_state(&blitter->saved_fb_state, state); } static INLINE diff --git a/src/gallium/drivers/r300/r300_context.c b/src/gallium/drivers/r300/r300_context.c index 05f7d09316..624dadd07d 100644 --- a/src/gallium/drivers/r300/r300_context.c +++ b/src/gallium/drivers/r300/r300_context.c @@ -65,7 +65,7 @@ static void r300_release_referenced_objects(struct r300_context *r300) unsigned i; /* Framebuffer state. */ - util_assign_framebuffer_state(fb, NULL); + util_unreference_framebuffer_state(fb); /* Textures. */ for (i = 0; i < textures->sampler_view_count; i++) diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c index 9adaea3235..8ccb63964e 100644 --- a/src/gallium/drivers/r300/r300_state.c +++ b/src/gallium/drivers/r300/r300_state.c @@ -23,7 +23,7 @@ #include "draw/draw_context.h" -#include "util/u_blitter.h" +#include "util/u_framebuffer.h" #include "util/u_math.h" #include "util/u_mm.h" #include "util/u_memory.h" @@ -748,7 +748,7 @@ static void /* The tiling flags are dependent on the surface miplevel, unfortunately. */ r300_fb_set_tiling_flags(r300, state); - util_assign_framebuffer_state(r300->fb_state.state, state); + util_copy_framebuffer_state(r300->fb_state.state, state); r300_mark_fb_state_dirty(r300, R300_CHANGED_FB_STATE); -- cgit v1.2.3 From 1f3e6e9726e3b41f4deeacbb34b9e23c5b3d6f76 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Sat, 28 Aug 2010 21:42:28 -0700 Subject: util: Add forward declaration in u_transfer.h. --- src/gallium/auxiliary/util/u_transfer.h | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/gallium/auxiliary/util/u_transfer.h b/src/gallium/auxiliary/util/u_transfer.h index eb07945d15..e3a38730f2 100644 --- a/src/gallium/auxiliary/util/u_transfer.h +++ b/src/gallium/auxiliary/util/u_transfer.h @@ -8,6 +8,7 @@ #include "pipe/p_state.h" struct pipe_context; +struct winsys_handle; boolean u_default_resource_get_handle(struct pipe_screen *screen, struct pipe_resource *resource, -- cgit v1.2.3 From b812ff8f9e5c9d292c0fb9518df1d35165542556 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Sat, 28 Aug 2010 21:46:41 -0700 Subject: util: Include missing header in u_draw.h. Include p_state.h for complete type to pipe_draw_info. --- src/gallium/auxiliary/util/u_draw.h | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/gallium/auxiliary/util/u_draw.h b/src/gallium/auxiliary/util/u_draw.h index 2a91ea0f9a..f06d09ef91 100644 --- a/src/gallium/auxiliary/util/u_draw.h +++ b/src/gallium/auxiliary/util/u_draw.h @@ -31,6 +31,7 @@ #include "pipe/p_compiler.h" #include "pipe/p_context.h" +#include "pipe/p_state.h" static INLINE void -- cgit v1.2.3 From 1fc396204b5676d7ebdbc20089d6442ab3dbcef4 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Sat, 28 Aug 2010 22:12:55 -0700 Subject: nvfx: Remove util_is_pot in favor of util_is_power_of_two. This is a follow up to commit 89b2897220acfacdc431f138377fbcec9f0ea812. --- src/gallium/drivers/nvfx/nvfx_miptree.c | 8 ++++---- src/gallium/drivers/nvfx/nvfx_surface.c | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/nvfx/nvfx_miptree.c b/src/gallium/drivers/nvfx/nvfx_miptree.c index 46e1f9e4f4..0916aaa828 100644 --- a/src/gallium/drivers/nvfx/nvfx_miptree.c +++ b/src/gallium/drivers/nvfx/nvfx_miptree.c @@ -20,9 +20,9 @@ nvfx_miptree_choose_format(struct nvfx_miptree *mt) if(no_swizzle < 0) no_swizzle = debug_get_bool_option("NV40_NO_SWIZZLE", FALSE); /* this will break things on nv30 */ - if (!util_is_pot(pt->width0) || - !util_is_pot(pt->height0) || - !util_is_pot(pt->depth0) || + if (!util_is_power_of_two(pt->width0) || + !util_is_power_of_two(pt->height0) || + !util_is_power_of_two(pt->depth0) || (!nvfx_screen(pt->screen)->is_nv4x && pt->target == PIPE_TEXTURE_RECT) ) uniform_pitch = 1; @@ -69,7 +69,7 @@ nvfx_miptree_layout(struct nvfx_miptree *mt) if(!nvfx_screen(pt->screen)->is_nv4x) { assert(pt->target == PIPE_TEXTURE_RECT - || (util_is_pot(pt->width0) && util_is_pot(pt->height0))); + || (util_is_power_of_two(pt->width0) && util_is_power_of_two(pt->height0))); } for (unsigned l = 0; l <= pt->last_level; l++) diff --git a/src/gallium/drivers/nvfx/nvfx_surface.c b/src/gallium/drivers/nvfx/nvfx_surface.c index f6cc985673..a5931b6e15 100644 --- a/src/gallium/drivers/nvfx/nvfx_surface.c +++ b/src/gallium/drivers/nvfx/nvfx_surface.c @@ -61,7 +61,7 @@ nvfx_region_set_format(struct nv04_region* rgn, enum pipe_format format) default: { int shift; - assert(util_is_pot(bits)); + assert(util_is_power_of_two(bits)); shift = util_logbase2(bits) - 3; assert(shift >= 2); rgn->bpps = 2; -- cgit v1.2.3 From 182d6350609408fa167d4a76ad02cdb93f10dcdd Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Sat, 28 Aug 2010 22:15:37 -0700 Subject: gallium: Remove unnecessary header from p_state.h. Remove p_screen.h. --- src/gallium/include/pipe/p_state.h | 1 - 1 file changed, 1 deletion(-) (limited to 'src') diff --git a/src/gallium/include/pipe/p_state.h b/src/gallium/include/pipe/p_state.h index 0f1a44cde4..9a2b31da50 100644 --- a/src/gallium/include/pipe/p_state.h +++ b/src/gallium/include/pipe/p_state.h @@ -43,7 +43,6 @@ #include "p_compiler.h" #include "p_defines.h" #include "p_format.h" -#include "p_screen.h" #ifdef __cplusplus -- cgit v1.2.3 From f67400d4671ce7776f71cafced6546dddecba42c Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Sat, 28 Aug 2010 23:55:51 -0700 Subject: glsl: Initialize the rest of values of ir_constant::value. Fixes valgrind uninitialized value errors in the piglit shader tests for softpipe and llvmpipe. --- src/glsl/ir.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src') diff --git a/src/glsl/ir.cpp b/src/glsl/ir.cpp index 8779ec73c9..d56b603116 100644 --- a/src/glsl/ir.cpp +++ b/src/glsl/ir.cpp @@ -326,6 +326,9 @@ ir_constant::ir_constant(float f) this->ir_type = ir_type_constant; this->type = glsl_type::float_type; this->value.f[0] = f; + for (int i = 1; i < 16; i++) { + this->value.f[i] = 0; + } } ir_constant::ir_constant(unsigned int u) @@ -333,6 +336,9 @@ ir_constant::ir_constant(unsigned int u) this->ir_type = ir_type_constant; this->type = glsl_type::uint_type; this->value.u[0] = u; + for (int i = 1; i < 16; i++) { + this->value.u[i] = 0; + } } ir_constant::ir_constant(int i) @@ -340,6 +346,9 @@ ir_constant::ir_constant(int i) this->ir_type = ir_type_constant; this->type = glsl_type::int_type; this->value.i[0] = i; + for (int i = 1; i < 16; i++) { + this->value.i[i] = 0; + } } ir_constant::ir_constant(bool b) @@ -347,6 +356,9 @@ ir_constant::ir_constant(bool b) this->ir_type = ir_type_constant; this->type = glsl_type::bool_type; this->value.b[0] = b; + for (int i = 1; i < 16; i++) { + this->value.b[i] = false; + } } ir_constant::ir_constant(const ir_constant *c, unsigned i) -- cgit v1.2.3 From c48ae0b6eddc71831ea0ea480a0177523ae6ee76 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Sat, 28 Aug 2010 19:01:49 +1000 Subject: r600g: drop file I added by mistake in a previous commit --- src/gallium/winsys/r600/drm/radeon_bo_pb.c | 186 ----------------------------- 1 file changed, 186 deletions(-) delete mode 100644 src/gallium/winsys/r600/drm/radeon_bo_pb.c (limited to 'src') diff --git a/src/gallium/winsys/r600/drm/radeon_bo_pb.c b/src/gallium/winsys/r600/drm/radeon_bo_pb.c deleted file mode 100644 index e8e53a971f..0000000000 --- a/src/gallium/winsys/r600/drm/radeon_bo_pb.c +++ /dev/null @@ -1,186 +0,0 @@ -#include "radeon_priv.h" - -#include "util/u_inlines.h" -#include "util/u_memory.h" -#include "util/u_double_list.h" -#include "pipebuffer/pb_buffer.h" -#include "pipebuffer/pb_bufmgr.h" - -struct radeon_bo_pb { - struct pb_buffer b; - struct radeon_bo *bo; - - struct radeon_bo_pbmgr *mgr; - struct list_head maplist; -}; - -extern const struct pb_vtbl radeon_bo_pb_vtbl; - -static INLINE struct radeon_bo_pb *radeon_bo_pb(struct pb_buffer *buf) -{ - assert(buf); - assert(buf->vtbl == &radeon_bo_pb_vtbl); - return (struct radeon_bo_pb *)buf; -} - -struct radeon_bo_pbmgr { - struct pb_manager b; - struct radeon *radeon; - struct list_head buffer_map_list; -}; - -static INLINE struct radeon_bo_pbmgr *radeon_bo_pbmgr(struct pb_manager *mgr) -{ - assert(mgr); - return (struct radeon_bo_pbmgr *)mgr; -} - -static void radeon_bo_pb_destroy(struct pb_buffer *_buf) -{ - struct radeon_bo_pb *buf = radeon_bo_pb(_buf); - - if (buf->bo->data != NULL) { - LIST_DEL(&buf->maplist); - radeon_bo_unmap(buf->mgr->radeon, buf->bo); - } - radeon_bo_decref(buf->mgr->radeon, buf->bo); - FREE(buf); -} - -static void * -radeon_bo_pb_map_internal(struct pb_buffer *_buf, - unsigned flags) -{ - struct radeon_bo_pb *buf = radeon_bo_pb(_buf); - - if (buf->bo->data != NULL) - return buf->bo->data; - - if (flags & PB_USAGE_DONTBLOCK) { - uint32_t domain; - if (radeon_bo_busy(buf->mgr->radeon, buf->bo, &domain)) - return NULL; - } - - if (radeon_bo_map(buf->mgr->radeon, buf->bo)) { - return NULL; - } - LIST_ADDTAIL(&buf->maplist, &buf->mgr->buffer_map_list); - return buf->bo->data; -} - -static void radeon_bo_pb_unmap_internal(struct pb_buffer *_buf) -{ - (void)_buf; -} - -static void -radeon_bo_pb_get_base_buffer(struct pb_buffer *buf, - struct pb_buffer **base_buf, - unsigned *offset) -{ - *base_buf = buf; - *offset = 0; -} - -static enum pipe_error -radeon_bo_pb_validate(struct pb_buffer *_buf, - struct pb_validate *vl, - unsigned flags) -{ - /* Always pinned */ - return PIPE_OK; -} - -static void -radeon_bo_pb_fence(struct pb_buffer *buf, - struct pipe_fence_handle *fence) -{ -} - -const struct pb_vtbl radeon_bo_pb_vtbl = { - radeon_bo_pb_destroy, - radeon_bo_pb_map_internal, - radeon_bo_pb_unmap_internal, - radeon_bo_pb_validate, - radeon_bo_pb_fence, - radeon_bo_pb_get_base_buffer, -}; - -static struct pb_buffer * -radeon_bo_pb_create_buffer(struct pb_manager *_mgr, - pb_size size, - const struct pb_desc *desc) -{ - struct radeon_bo_pbmgr *mgr = radeon_bo_pbmgr(_mgr); - struct radeon *radeon = mgr->radeon; - struct radeon_bo_pb *bo; - uint32_t domain; - - bo = CALLOC_STRUCT(radeon_bo_pb); - if (!bo) - goto error1; - - pipe_reference_init(&bo->b.base.reference, 1); - bo->b.base.alignment = desc->alignment; - bo->b.base.usage = desc->usage; - bo->b.base.size = size; - bo->b.vtbl = &radeon_bo_pb_vtbl; - bo->mgr = mgr; - - LIST_INITHEAD(&bo->maplist); - - bo->bo = radeon_bo(radeon, 0, size, - desc->alignment, NULL); - if (bo->bo == NULL) - goto error2; - return &bo->b; - -error2: - FREE(bo); -error1: - return NULL; -} - -static void -radeon_bo_pbmgr_flush(struct pb_manager *mgr) -{ - /* NOP */ -} - -static void -radeon_bo_pbmgr_destroy(struct pb_manager *_mgr) -{ - struct radeon_bo_pbmgr *mgr = radeon_bo_pbmgr(_mgr); - FREE(mgr); -} - -struct pb_manager *radeon_bo_pbmgr_create(struct radeon *radeon) -{ - struct radeon_bo_pbmgr *mgr; - - mgr = CALLOC_STRUCT(radeon_bo_pbmgr); - if (!mgr) - return NULL; - - mgr->b.destroy = radeon_bo_pbmgr_destroy; - mgr->b.create_buffer = radeon_bo_pb_create_buffer; - mgr->b.flush = radeon_bo_pbmgr_flush; - - mgr->radeon = radeon; - LIST_INITHEAD(&mgr->buffer_map_list); - return &mgr->b; -} - -void radeon_bo_pbmgr_flush_maps(struct pb_manager *_mgr) -{ - struct radeon_bo_pbmgr *mgr = radeon_bo_pbmgr(_mgr); - struct radeon_bo_pb *rpb, *t_rpb; - - LIST_FOR_EACH_ENTRY_SAFE(rpb, t_rpb, &mgr->buffer_map_list, maplist) { - radeon_bo_unmap(mgr->radeon, rpb->bo); - LIST_DEL(&rpb->maplist); - } - - LIST_INITHEAD(&mgr->buffer_map_list); -} -- cgit v1.2.3 From 0a46497a4ee3325fab47929cb17cfe2525e1fc33 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Sun, 29 Aug 2010 11:31:33 -0700 Subject: ir_to_mesa: Initialize variable in ir_to_mesa_visitor::visit. Fixes piglit glsl-fs-loop valgrind uninitialized value error on softpipe and llvmpipe. --- src/mesa/program/ir_to_mesa.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp index 948f09a851..19f3847ab5 100644 --- a/src/mesa/program/ir_to_mesa.cpp +++ b/src/mesa/program/ir_to_mesa.cpp @@ -1553,7 +1553,7 @@ void ir_to_mesa_visitor::visit(ir_constant *ir) { ir_to_mesa_src_reg src_reg; - GLfloat stack_vals[4]; + GLfloat stack_vals[4] = { 0 }; GLfloat *values = stack_vals; unsigned int i; -- cgit v1.2.3 From b43611b79c1f0a5caff80c17c9e7840a718f07c9 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Sun, 29 Aug 2010 11:48:02 -0700 Subject: glsl: Initialize data in read_constant. Completely initialize data that is passed into a ir_constant constructor. Fixes piglit glsl-fs-mix valgrind uninitialized variable error on softpipe and llvmpipe. --- src/glsl/ir_reader.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/glsl/ir_reader.cpp b/src/glsl/ir_reader.cpp index 366db32774..e57e03c307 100644 --- a/src/glsl/ir_reader.cpp +++ b/src/glsl/ir_reader.cpp @@ -803,7 +803,7 @@ read_constant(_mesa_glsl_parse_state *st, s_list *list) const glsl_type *const base_type = type->get_base_type(); - ir_constant_data data; + ir_constant_data data = { { 0 } }; // Read in list of values (at most 16). int k = 0; -- cgit v1.2.3 From 2d0ef6bfee64b6889cbfb69762f167a6dfc20131 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Sun, 29 Aug 2010 12:19:57 -0700 Subject: glsl: Initialize variable in ir_swizzle::constant_expression_value. Complete initialize data passed to ir_constant constructor. Fixes piglit glsl-mat-from-int-ctor-02 valgrind unintialized variable error with softpipe and llvmpipe. --- src/glsl/ir_constant_expression.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/glsl/ir_constant_expression.cpp b/src/glsl/ir_constant_expression.cpp index 5ec60c522f..458dca7977 100644 --- a/src/glsl/ir_constant_expression.cpp +++ b/src/glsl/ir_constant_expression.cpp @@ -653,7 +653,7 @@ ir_swizzle::constant_expression_value() ir_constant *v = this->val->constant_expression_value(); if (v != NULL) { - ir_constant_data data; + ir_constant_data data = { { 0 } }; const unsigned swiz_idx[4] = { this->mask.x, this->mask.y, this->mask.z, this->mask.w -- cgit v1.2.3 From 30a086552827b82738421ff2d562e3c8c1da2735 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Sun, 29 Aug 2010 13:15:56 -0700 Subject: glsl: Completely initialize value member in ir_constant constructor. The ir_constant::ir_constant(const struct glsl_type *type, exec_list *value_list) did not completely initialize the entire value member. Fixes piglit glsl-fs-sampler-numbering-2 valgrind uninitialized value error in softpipe and llvmpipe. --- src/glsl/ir.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src') diff --git a/src/glsl/ir.cpp b/src/glsl/ir.cpp index d56b603116..992853c046 100644 --- a/src/glsl/ir.cpp +++ b/src/glsl/ir.cpp @@ -409,6 +409,9 @@ ir_constant::ir_constant(const struct glsl_type *type, exec_list *value_list) return; } + for (unsigned i = 0; i < 16; i++) { + this->value.u[i] = 0; + } ir_constant *value = (ir_constant *) (value_list->head); -- cgit v1.2.3 From 0c93e69b25559225d3124d5a0deaaeceabf8cb12 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Sun, 29 Aug 2010 14:05:07 -0700 Subject: glsl: Initialize data in ast_function_expression::hir. Completely initialize data that is passed to ir_constant constructor. Fixes piglit glsl-orangebook-ch06-bump valgrind uninitialized variable error on softpipe and llvmpipe. --- src/glsl/ast_function.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/glsl/ast_function.cpp b/src/glsl/ast_function.cpp index 34b0f70d41..c2e526cf89 100644 --- a/src/glsl/ast_function.cpp +++ b/src/glsl/ast_function.cpp @@ -1193,7 +1193,7 @@ ast_function_expression::hir(exec_list *instructions, * causes the matrix to be filled with 0 and the diagonal to be * filled with the value. */ - ir_constant_data data; + ir_constant_data data = { { 0 } }; ir_constant *const initializer = (ir_constant *) actual_parameters.head; if (constructor_type->is_matrix()) -- cgit v1.2.3 From b3d41844c7704a4b937f4eb5925e71f35547cd4a Mon Sep 17 00:00:00 2001 From: Richard Li Date: Sun, 29 Aug 2010 19:27:46 -0400 Subject: evergreen : fix shader const allocation and instruction bugs. --- src/mesa/drivers/dri/r600/evergreen_fragprog.c | 26 ++++++++++++++++++-------- src/mesa/drivers/dri/r600/evergreen_fragprog.h | 2 ++ src/mesa/drivers/dri/r600/evergreen_render.c | 8 ++++---- src/mesa/drivers/dri/r600/evergreen_vertprog.c | 21 ++++++++++++++------- src/mesa/drivers/dri/r600/evergreen_vertprog.h | 2 ++ src/mesa/drivers/dri/r600/r700_assembler.c | 9 ++++++++- 6 files changed, 48 insertions(+), 20 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r600/evergreen_fragprog.c b/src/mesa/drivers/dri/r600/evergreen_fragprog.c index 9568f446da..b53ff424a0 100644 --- a/src/mesa/drivers/dri/r600/evergreen_fragprog.c +++ b/src/mesa/drivers/dri/r600/evergreen_fragprog.c @@ -501,9 +501,7 @@ GLboolean evergreenSetupFragmentProgram(GLcontext * ctx) struct evergreen_fragment_program *fp = (struct evergreen_fragment_program *) (ctx->FragmentProgram._Current); r700_AssemblerBase *pAsm = &(fp->r700AsmCode); - struct gl_fragment_program *mesa_fp = &(fp->mesa_program); - struct gl_program_parameter_list *paramList; - unsigned int unNumParamData; + struct gl_fragment_program *mesa_fp = &(fp->mesa_program); unsigned int ui, i; unsigned int unNumOfReg; unsigned int unBit; @@ -742,7 +740,22 @@ GLboolean evergreenSetupFragmentProgram(GLcontext * ctx) } exportCount = (evergreen->SQ_PGM_EXPORTS_PS.u32All & EXPORT_MODE_mask) / (1 << EXPORT_MODE_shift); - + + return GL_TRUE; +} + +GLboolean evergreenSetupFPconstants(GLcontext * ctx) +{ + context_t *context = EVERGREEN_CONTEXT(ctx); + EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); + struct evergreen_fragment_program *fp = (struct evergreen_fragment_program *) + (ctx->FragmentProgram._Current); + r700_AssemblerBase *pAsm = &(fp->r700AsmCode); + + struct gl_program_parameter_list *paramList; + unsigned int unNumParamData; + unsigned int ui; + /* sent out shader constants. */ paramList = fp->mesa_program.Base.Parameters; @@ -801,7 +814,4 @@ GLboolean evergreenSetupFragmentProgram(GLcontext * ctx) } unConstOffset += pCompiledSub->NumParameters; } - - return GL_TRUE; -} - +} \ No newline at end of file diff --git a/src/mesa/drivers/dri/r600/evergreen_fragprog.h b/src/mesa/drivers/dri/r600/evergreen_fragprog.h index 0547d1f63d..0e200bf383 100644 --- a/src/mesa/drivers/dri/r600/evergreen_fragprog.h +++ b/src/mesa/drivers/dri/r600/evergreen_fragprog.h @@ -68,6 +68,8 @@ extern void evergreenSelectFragmentShader(GLcontext *ctx); extern GLboolean evergreenSetupFragmentProgram(GLcontext * ctx); +extern GLboolean evergreenSetupFPconstants(GLcontext * ctx); + extern void * evergreenGetActiveFpShaderBo(GLcontext * ctx); extern void * evergreenGetActiveFpShaderConstBo(GLcontext * ctx); diff --git a/src/mesa/drivers/dri/r600/evergreen_render.c b/src/mesa/drivers/dri/r600/evergreen_render.c index 7f9c95e765..85b2f9d6ab 100644 --- a/src/mesa/drivers/dri/r600/evergreen_render.c +++ b/src/mesa/drivers/dri/r600/evergreen_render.c @@ -839,6 +839,10 @@ static GLboolean evergreenTryDrawPrims(GLcontext *ctx, GLuint emit_end = evergreenPredictRenderSize(ctx, prim, ib, nr_prims) + context->radeon.cmdbuf.cs->cdw; + /* evergreenPredictRenderSize will call radeonReleaseDmaRegions, so update VP/FP const buf after it. */ + evergreenSetupVPconstants(ctx); + evergreenSetupFPconstants(ctx); + evergreenSetupIndexBuffer(ctx, ib); evergreenSetupStreams(ctx, arrays, max_index + 1); @@ -849,16 +853,12 @@ static GLboolean evergreenTryDrawPrims(GLcontext *ctx, for (i = 0; i < nr_prims; ++i) { -/* richard test disable */ -#if 0 if (context->ind_buf.bo) evergreenRunRenderPrimitive(ctx, prim[i].start, prim[i].start + prim[i].count, prim[i].mode); else -#endif //0 -//------------- evergreenRunRenderPrimitiveImmediate(ctx, prim[i].start, prim[i].start + prim[i].count, diff --git a/src/mesa/drivers/dri/r600/evergreen_vertprog.c b/src/mesa/drivers/dri/r600/evergreen_vertprog.c index 5e4844edf9..4f3db00c7d 100644 --- a/src/mesa/drivers/dri/r600/evergreen_vertprog.c +++ b/src/mesa/drivers/dri/r600/evergreen_vertprog.c @@ -599,10 +599,6 @@ GLboolean evergreenSetupVertexProgram(GLcontext * ctx) EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); struct evergreen_vertex_program *vp = context->selected_vp; - struct gl_program_parameter_list *paramList; - unsigned int unNumParamData; - unsigned int ui; - if(GL_FALSE == vp->loaded) { if(vp->r700Shader.bNeedsAssembly == GL_TRUE) @@ -655,6 +651,19 @@ GLboolean evergreenSetupVertexProgram(GLcontext * ctx) CLEARbit(evergreen->SPI_PS_IN_CONTROL_0.u32All, LINEAR_GRADIENT_ENA_bit); */ + return GL_TRUE; +} + +GLboolean evergreenSetupVPconstants(GLcontext * ctx) +{ + context_t *context = EVERGREEN_CONTEXT(ctx); + EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); + struct evergreen_vertex_program *vp = context->selected_vp; + + struct gl_program_parameter_list *paramList; + unsigned int unNumParamData; + unsigned int ui; + /* sent out shader constants. */ paramList = vp->mesa_program->Base.Parameters; @@ -724,6 +733,4 @@ GLboolean evergreenSetupVertexProgram(GLcontext * ctx) } unConstOffset += pCompiledSub->NumParameters; } - - return GL_TRUE; -} +} \ No newline at end of file diff --git a/src/mesa/drivers/dri/r600/evergreen_vertprog.h b/src/mesa/drivers/dri/r600/evergreen_vertprog.h index 4c2626de77..5853902115 100644 --- a/src/mesa/drivers/dri/r600/evergreen_vertprog.h +++ b/src/mesa/drivers/dri/r600/evergreen_vertprog.h @@ -98,6 +98,8 @@ extern void evergreenSetVertexFormat(GLcontext *ctx, const struct gl_client_arra extern GLboolean evergreenSetupVertexProgram(GLcontext * ctx); +extern GLboolean evergreenSetupVPconstants(GLcontext * ctx); + extern void * evergreenGetActiveVpShaderBo(GLcontext * ctx); extern void * evergreenGetActiveVpShaderConstBo(GLcontext * ctx); diff --git a/src/mesa/drivers/dri/r600/r700_assembler.c b/src/mesa/drivers/dri/r600/r700_assembler.c index fbd8c45d25..45ff9c0624 100644 --- a/src/mesa/drivers/dri/r600/r700_assembler.c +++ b/src/mesa/drivers/dri/r600/r700_assembler.c @@ -4408,7 +4408,14 @@ GLboolean assemble_LIT(r700_AssemblerBase *pAsm) swizzleagain_PVSSRC(&(pAsm->S[2].src), SQ_SEL_X, SQ_SEL_X, SQ_SEL_X, SQ_SEL_X); /* tmp.x = amd MUL_LIT(src.w, dst.z, src.x ) */ - pAsm->D.dst.opcode = SQ_OP3_INST_MUL_LIT; + if(8 == pAsm->unAsic) + { + pAsm->D.dst.opcode = EG_OP3_INST_MUL_LIT; + } + else + { + pAsm->D.dst.opcode = SQ_OP3_INST_MUL_LIT; + } pAsm->D.dst.math = 1; pAsm->D.dst.op3 = 1; pAsm->D.dst.rtype = DST_REG_TEMPORARY; -- cgit v1.2.3 From e77b1e777d585254db62e872a74e23351bb36f85 Mon Sep 17 00:00:00 2001 From: Bas Nieuwenhuizen Date: Sun, 29 Aug 2010 11:19:22 +0200 Subject: r600g: added literals where needed for POW instruction Fixes size calculation for the bytecode buffer. Signed-off-by: Dave Airlie --- src/gallium/drivers/r600/r600_shader.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src') diff --git a/src/gallium/drivers/r600/r600_shader.c b/src/gallium/drivers/r600/r600_shader.c index ebcf19c12b..bf5f28fd9c 100644 --- a/src/gallium/drivers/r600/r600_shader.c +++ b/src/gallium/drivers/r600/r600_shader.c @@ -1069,6 +1069,9 @@ static int tgsi_pow(struct r600_shader_ctx *ctx) alu.dst.write = 1; alu.last = 1; r = r600_bc_add_alu(ctx->bc, &alu); + if (r) + return r; + r = r600_bc_add_literal(ctx->bc,ctx->value); if (r) return r; /* b * LOG2(a) */ @@ -1083,6 +1086,9 @@ static int tgsi_pow(struct r600_shader_ctx *ctx) alu.dst.write = 1; alu.last = 1; r = r600_bc_add_alu(ctx->bc, &alu); + if (r) + return r; + r = r600_bc_add_literal(ctx->bc,ctx->value); if (r) return r; /* POW(a,b) = EXP2(b * LOG2(a))*/ @@ -1093,6 +1099,9 @@ static int tgsi_pow(struct r600_shader_ctx *ctx) alu.dst.write = 1; alu.last = 1; r = r600_bc_add_alu(ctx->bc, &alu); + if (r) + return r; + r = r600_bc_add_literal(ctx->bc,ctx->value); if (r) return r; return tgsi_helper_tempx_replicate(ctx); -- cgit v1.2.3 From cd4bd4fb53f82361480f388923ef9e2fa7379d68 Mon Sep 17 00:00:00 2001 From: Bas Nieuwenhuizen Date: Sun, 29 Aug 2010 11:19:23 +0200 Subject: r600g: use the values from the correct literals Created an array for literals as we should not always use the last declared literal. Signed-off-by: Dave Airlie --- src/gallium/drivers/r600/r600_shader.c | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/r600_shader.c b/src/gallium/drivers/r600/r600_shader.c index bf5f28fd9c..dabc7bec30 100644 --- a/src/gallium/drivers/r600/r600_shader.c +++ b/src/gallium/drivers/r600/r600_shader.c @@ -48,6 +48,8 @@ struct r600_shader_ctx { struct r600_bc *bc; struct r600_shader *shader; u32 value[4]; + u32 *literals; + u32 nliterals; }; struct r600_shader_tgsi_instruction { @@ -404,15 +406,24 @@ int r600_shader_from_tgsi(const struct tgsi_token *tokens, struct r600_shader *s ctx.temp_reg = ctx.file_offset[TGSI_FILE_TEMPORARY] + ctx.info.file_count[TGSI_FILE_TEMPORARY]; + ctx.nliterals = 0; + ctx.literals = NULL; + while (!tgsi_parse_end_of_tokens(&ctx.parse)) { tgsi_parse_token(&ctx.parse); switch (ctx.parse.FullToken.Token.Type) { case TGSI_TOKEN_TYPE_IMMEDIATE: immediate = &ctx.parse.FullToken.FullImmediate; - ctx.value[0] = immediate->u[0].Uint; - ctx.value[1] = immediate->u[1].Uint; - ctx.value[2] = immediate->u[2].Uint; - ctx.value[3] = immediate->u[3].Uint; + ctx.literals = realloc(ctx.literals, (ctx.nliterals + 1) * 16); + if(ctx.literals == NULL) { + r = -ENOMEM; + goto out_err; + } + ctx.literals[ctx.nliterals * 4 + 0] = immediate->u[0].Uint; + ctx.literals[ctx.nliterals * 4 + 1] = immediate->u[1].Uint; + ctx.literals[ctx.nliterals * 4 + 2] = immediate->u[2].Uint; + ctx.literals[ctx.nliterals * 4 + 3] = immediate->u[3].Uint; + ctx.nliterals++; break; case TGSI_TOKEN_TYPE_DECLARATION: r = tgsi_declaration(&ctx); @@ -540,9 +551,11 @@ int r600_shader_from_tgsi(const struct tgsi_token *tokens, struct r600_shader *s if (r) goto out_err; } + free(ctx.literals); tgsi_parse_free(&ctx.parse); return 0; out_err: + free(ctx.literals); tgsi_parse_free(&ctx.parse); return r; } @@ -562,10 +575,16 @@ static int tgsi_src(struct r600_shader_ctx *ctx, const struct tgsi_full_src_register *tgsi_src, struct r600_bc_alu_src *r600_src) { + int index; memset(r600_src, 0, sizeof(struct r600_bc_alu_src)); r600_src->sel = tgsi_src->Register.Index; if (tgsi_src->Register.File == TGSI_FILE_IMMEDIATE) { r600_src->sel = 0; + index = tgsi_src->Register.Index; + ctx->value[0] = ctx->literals[index * 4 + 0]; + ctx->value[1] = ctx->literals[index * 4 + 1]; + ctx->value[2] = ctx->literals[index * 4 + 2]; + ctx->value[3] = ctx->literals[index * 4 + 3]; } r600_src->neg = tgsi_src->Register.Negate; r600_src->sel += ctx->file_offset[tgsi_src->Register.File]; -- cgit v1.2.3 From 09547e1bcee7df3444dd8682770d1b31da1a5822 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Fri, 27 Aug 2010 16:08:55 +1000 Subject: r600g : add basic loop support. Adds BGNLOOP, BRK, CONT, ENDLOOP support, ported from r600c. 17 piglits more on r300g.tests. --- src/gallium/drivers/r600/r600_asm.c | 21 ++- src/gallium/drivers/r600/r600_asm.h | 17 ++- src/gallium/drivers/r600/r600_shader.c | 232 ++++++++++++++++++++++++++++++--- 3 files changed, 247 insertions(+), 23 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/r600_asm.c b/src/gallium/drivers/r600/r600_asm.c index d83bb34648..03fe950186 100644 --- a/src/gallium/drivers/r600/r600_asm.c +++ b/src/gallium/drivers/r600/r600_asm.c @@ -200,6 +200,10 @@ int r600_bc_add_literal(struct r600_bc *bc, const u32 *value) } if (bc->cf_last->inst == V_SQ_CF_WORD1_SQ_CF_INST_JUMP || bc->cf_last->inst == V_SQ_CF_WORD1_SQ_CF_INST_ELSE || + bc->cf_last->inst == V_SQ_CF_WORD1_SQ_CF_INST_LOOP_START_NO_AL || + bc->cf_last->inst == V_SQ_CF_WORD1_SQ_CF_INST_LOOP_BREAK || + bc->cf_last->inst == V_SQ_CF_WORD1_SQ_CF_INST_LOOP_CONTINUE || + bc->cf_last->inst == V_SQ_CF_WORD1_SQ_CF_INST_LOOP_END || bc->cf_last->inst == V_SQ_CF_WORD1_SQ_CF_INST_POP) { return 0; } @@ -414,6 +418,10 @@ static int r600_bc_cf_build(struct r600_bc *bc, struct r600_bc_cf *cf) case V_SQ_CF_WORD1_SQ_CF_INST_JUMP: case V_SQ_CF_WORD1_SQ_CF_INST_ELSE: case V_SQ_CF_WORD1_SQ_CF_INST_POP: + case V_SQ_CF_WORD1_SQ_CF_INST_LOOP_START_NO_AL: + case V_SQ_CF_WORD1_SQ_CF_INST_LOOP_END: + case V_SQ_CF_WORD1_SQ_CF_INST_LOOP_CONTINUE: + case V_SQ_CF_WORD1_SQ_CF_INST_LOOP_BREAK: bc->bytecode[id++] = S_SQ_CF_WORD0_ADDR(cf->cf_addr >> 1); bc->bytecode[id++] = S_SQ_CF_WORD1_CF_INST(cf->inst) | S_SQ_CF_WORD1_BARRIER(1) | @@ -437,6 +445,9 @@ int r600_bc_build(struct r600_bc *bc) unsigned addr; int r; + if (bc->callstack[0].max > 0) + bc->nstack = ((bc->callstack[0].max + 3) >> 2) + 2; + /* first path compute addr of each CF block */ /* addr start after all the CF instructions */ addr = bc->cf_last->id + 2; @@ -458,8 +469,10 @@ int r600_bc_build(struct r600_bc *bc) case V_SQ_CF_WORD1_SQ_CF_INST_JUMP: case V_SQ_CF_WORD1_SQ_CF_INST_ELSE: case V_SQ_CF_WORD1_SQ_CF_INST_POP: - /* hack */ - bc->nstack = 3; + case V_SQ_CF_WORD1_SQ_CF_INST_LOOP_START_NO_AL: + case V_SQ_CF_WORD1_SQ_CF_INST_LOOP_END: + case V_SQ_CF_WORD1_SQ_CF_INST_LOOP_CONTINUE: + case V_SQ_CF_WORD1_SQ_CF_INST_LOOP_BREAK: break; default: R600_ERR("unsupported CF instruction (0x%X)\n", cf->inst); @@ -520,6 +533,10 @@ int r600_bc_build(struct r600_bc *bc) break; case V_SQ_CF_ALLOC_EXPORT_WORD1_SQ_CF_INST_EXPORT: case V_SQ_CF_ALLOC_EXPORT_WORD1_SQ_CF_INST_EXPORT_DONE: + case V_SQ_CF_WORD1_SQ_CF_INST_LOOP_START_NO_AL: + case V_SQ_CF_WORD1_SQ_CF_INST_LOOP_END: + case V_SQ_CF_WORD1_SQ_CF_INST_LOOP_CONTINUE: + case V_SQ_CF_WORD1_SQ_CF_INST_LOOP_BREAK: case V_SQ_CF_WORD1_SQ_CF_INST_JUMP: case V_SQ_CF_WORD1_SQ_CF_INST_ELSE: case V_SQ_CF_WORD1_SQ_CF_INST_POP: diff --git a/src/gallium/drivers/r600/r600_asm.h b/src/gallium/drivers/r600/r600_asm.h index dbd885caf9..bb4f4b77b3 100644 --- a/src/gallium/drivers/r600/r600_asm.h +++ b/src/gallium/drivers/r600/r600_asm.h @@ -127,11 +127,23 @@ struct r600_bc_cf { #define FC_NONE 0 #define FC_IF 1 #define FC_LOOP 2 +#define FC_REP 3 +#define FC_PUSH_VPM 4 +#define FC_PUSH_WQM 5 struct r600_cf_stack_entry { int type; struct r600_bc_cf *start; - struct r600_bc_cf *mid; /* used to store the else point */ + struct r600_bc_cf **mid; /* used to store the else point */ + int num_mid; +}; + +#define SQ_MAX_CALL_DEPTH 0x00000020 +struct r600_cf_callstack { + unsigned fc_sp_before_entry; + int sub_desc_index; + int current; + int max; }; struct r600_bc { @@ -149,6 +161,9 @@ struct r600_bc { u32 fc_sp; struct r600_cf_stack_entry fc_stack[32]; + + unsigned call_sp; + struct r600_cf_callstack callstack[SQ_MAX_CALL_DEPTH]; }; int r600_bc_init(struct r600_bc *bc, enum radeon_family family); diff --git a/src/gallium/drivers/r600/r600_shader.c b/src/gallium/drivers/r600/r600_shader.c index dabc7bec30..82f4d73e43 100644 --- a/src/gallium/drivers/r600/r600_shader.c +++ b/src/gallium/drivers/r600/r600_shader.c @@ -1650,8 +1650,7 @@ static int tgsi_exp(struct r600_shader_ctx *ctx) struct tgsi_full_instruction *inst = &ctx->parse.FullToken.FullInstruction; struct r600_bc_alu_src r600_src[3]; struct r600_bc_alu alu; - uint32_t use_temp = 0; - int i, r; + int r; /* result.x = 2^floor(src); */ if (inst->Dst[0].Register.WriteMask & 1) { @@ -1753,8 +1752,7 @@ static int tgsi_exp(struct r600_shader_ctx *ctx) static int emit_logic_pred(struct r600_shader_ctx *ctx, int opcode) { struct tgsi_full_instruction *inst = &ctx->parse.FullToken.FullInstruction; - struct r600_bc_alu alu, *lalu; - struct r600_bc_cf *last; + struct r600_bc_alu alu; int r; memset(&alu, 0, sizeof(struct r600_bc_alu)); @@ -1777,7 +1775,6 @@ static int emit_logic_pred(struct r600_shader_ctx *ctx, int opcode) r = r600_bc_add_alu_type(ctx->bc, &alu, V_SQ_CF_ALU_WORD1_SQ_CF_INST_ALU_PUSH_BEFORE); if (r) return r; - return 0; } @@ -1788,29 +1785,158 @@ static int pops(struct r600_shader_ctx *ctx, int pops) return 0; } -static int tgsi_if(struct r600_shader_ctx *ctx) +static inline void callstack_decrease_current(struct r600_shader_ctx *ctx, unsigned reason) { - struct tgsi_full_instruction *inst = &ctx->parse.FullToken.FullInstruction; + switch(reason) { + case FC_PUSH_VPM: + ctx->bc->callstack[ctx->bc->call_sp].current--; + break; + case FC_PUSH_WQM: + case FC_LOOP: + ctx->bc->callstack[ctx->bc->call_sp].current -= 4; + break; + case FC_REP: + /* TOODO : for 16 vp asic should -= 2; */ + ctx->bc->callstack[ctx->bc->call_sp].current --; + break; + } +} - emit_logic_pred(ctx, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_PRED_SETNE); +static inline void callstack_check_depth(struct r600_shader_ctx *ctx, unsigned reason, unsigned check_max_only) +{ + if (check_max_only) { + int diff; + switch (reason) { + case FC_PUSH_VPM: + diff = 1; + break; + case FC_PUSH_WQM: + diff = 4; + break; + } + if ((ctx->bc->callstack[ctx->bc->call_sp].current + diff) > + ctx->bc->callstack[ctx->bc->call_sp].max) { + ctx->bc->callstack[ctx->bc->call_sp].max = + ctx->bc->callstack[ctx->bc->call_sp].current + diff; + } + return; + } + switch (reason) { + case FC_PUSH_VPM: + ctx->bc->callstack[ctx->bc->call_sp].current++; + break; + case FC_PUSH_WQM: + case FC_LOOP: + ctx->bc->callstack[ctx->bc->call_sp].current += 4; + break; + case FC_REP: + ctx->bc->callstack[ctx->bc->call_sp].current++; + break; + } + + if ((ctx->bc->callstack[ctx->bc->call_sp].current) > + ctx->bc->callstack[ctx->bc->call_sp].max) { + ctx->bc->callstack[ctx->bc->call_sp].max = + ctx->bc->callstack[ctx->bc->call_sp].current; + } +} + +static void fc_set_mid(struct r600_shader_ctx *ctx, int fc_sp) +{ + struct r600_cf_stack_entry *sp = &ctx->bc->fc_stack[fc_sp]; + + sp->mid = (struct r600_bc_cf **)realloc((void *)sp->mid, + sizeof(struct r600_bc_cf *) * (sp->num_mid + 1)); + sp->mid[sp->num_mid] = ctx->bc->cf_last; + sp->num_mid++; +} +static void fc_pushlevel(struct r600_shader_ctx *ctx, int type) +{ ctx->bc->fc_sp++; - ctx->bc->fc_stack[ctx->bc->fc_sp].type = FC_IF; - ctx->bc->fc_stack[ctx->bc->fc_sp].mid = NULL; + ctx->bc->fc_stack[ctx->bc->fc_sp].type = type; + ctx->bc->fc_stack[ctx->bc->fc_sp].start = ctx->bc->cf_last; +} + +static void fc_poplevel(struct r600_shader_ctx *ctx) +{ + struct r600_cf_stack_entry *sp = &ctx->bc->fc_stack[ctx->bc->fc_sp]; + if (sp->mid) { + free(sp->mid); + sp->mid = NULL; + } + sp->num_mid = 0; + sp->start = NULL; + sp->type = 0; + ctx->bc->fc_sp--; +} + +#if 0 +static int emit_return(struct r600_shader_ctx *ctx) +{ + r600_bc_add_cfinst(ctx->bc, V_SQ_CF_WORD1_SQ_CF_INST_RETURN); + return 0; +} + +static int emit_jump_to_offset(struct r600_shader_ctx *ctx, int pops, int offset) +{ + r600_bc_add_cfinst(ctx->bc, V_SQ_CF_WORD1_SQ_CF_INST_JUMP); + ctx->bc->cf_last->pop_count = pops; + /* TODO work out offset */ + return 0; +} - ctx->bc->fc_stack[ctx->bc->fc_sp].start = ctx->bc->cf_last; +static int emit_setret_in_loop_flag(struct r600_shader_ctx *ctx, unsigned flag_value) +{ + return 0; +} + +static void emit_testflag(struct r600_shader_ctx *ctx) +{ + +} + +static void emit_return_on_flag(struct r600_shader_ctx *ctx, unsigned ifidx) +{ + emit_testflag(ctx); + emit_jump_to_offset(ctx, 1, 4); + emit_setret_in_loop_flag(ctx, V_SQ_ALU_SRC_0); + pops(ctx, ifidx + 1); + emit_return(ctx); +} + +static void break_loop_on_flag(struct r600_shader_ctx *ctx, unsigned fc_sp) +{ + emit_testflag(ctx); + + r600_bc_add_cfinst(ctx->bc, ctx->inst_info->r600_opcode); + ctx->bc->cf_last->pop_count = 1; + + fc_set_mid(ctx, fc_sp); + + pops(ctx, 1); +} +#endif + +static int tgsi_if(struct r600_shader_ctx *ctx) +{ + emit_logic_pred(ctx, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_PRED_SETNE); + + r600_bc_add_cfinst(ctx->bc, V_SQ_CF_WORD1_SQ_CF_INST_JUMP); + + fc_pushlevel(ctx, FC_IF); + + callstack_check_depth(ctx, FC_PUSH_VPM, 0); return 0; } static int tgsi_else(struct r600_shader_ctx *ctx) { - struct tgsi_full_instruction *inst = &ctx->parse.FullToken.FullInstruction; r600_bc_add_cfinst(ctx->bc, V_SQ_CF_WORD1_SQ_CF_INST_ELSE); ctx->bc->cf_last->pop_count = 1; - /* fixup mid */ - ctx->bc->fc_stack[ctx->bc->fc_sp].mid = ctx->bc->cf_last; + fc_set_mid(ctx, ctx->bc->fc_sp); ctx->bc->fc_stack[ctx->bc->fc_sp].start->cf_addr = ctx->bc->cf_last->id; return 0; } @@ -1827,10 +1953,76 @@ static int tgsi_endif(struct r600_shader_ctx *ctx) ctx->bc->fc_stack[ctx->bc->fc_sp].start->cf_addr = ctx->bc->cf_last->id + 2; ctx->bc->fc_stack[ctx->bc->fc_sp].start->pop_count = 1; } else { - ctx->bc->fc_stack[ctx->bc->fc_sp].mid->cf_addr = ctx->bc->cf_last->id + 2; + ctx->bc->fc_stack[ctx->bc->fc_sp].mid[0]->cf_addr = ctx->bc->cf_last->id + 2; } - ctx->bc->fc_sp--; + fc_poplevel(ctx); + + callstack_decrease_current(ctx, FC_PUSH_VPM); + return 0; +} + +static int tgsi_bgnloop(struct r600_shader_ctx *ctx) +{ + r600_bc_add_cfinst(ctx->bc, V_SQ_CF_WORD1_SQ_CF_INST_LOOP_START_NO_AL); + + fc_pushlevel(ctx, FC_LOOP); + /* check stack depth */ + callstack_check_depth(ctx, FC_LOOP, 0); + return 0; +} + +static int tgsi_endloop(struct r600_shader_ctx *ctx) +{ + int i; + + r600_bc_add_cfinst(ctx->bc, V_SQ_CF_WORD1_SQ_CF_INST_LOOP_END); + + if (ctx->bc->fc_stack[ctx->bc->fc_sp].type != FC_LOOP) { + R600_ERR("loop/endloop in shader code are not paired.\n"); + return -EINVAL; + } + + /* fixup loop pointers - from r600isa + LOOP END points to CF after LOOP START, + LOOP START point to CF after LOOP END + BRK/CONT point to LOOP END CF + */ + ctx->bc->cf_last->cf_addr = ctx->bc->fc_stack[ctx->bc->fc_sp].start->id + 2; + + ctx->bc->fc_stack[ctx->bc->fc_sp].start->cf_addr = ctx->bc->cf_last->id + 2; + + for (i = 0; i < ctx->bc->fc_stack[ctx->bc->fc_sp].num_mid; i++) { + ctx->bc->fc_stack[ctx->bc->fc_sp].mid[i]->cf_addr = ctx->bc->cf_last->id; + } + /* TODO add LOOPRET support */ + fc_poplevel(ctx); + callstack_decrease_current(ctx, FC_LOOP); + return 0; +} + +static int tgsi_loop_brk_cont(struct r600_shader_ctx *ctx) +{ + unsigned int fscp; + + for (fscp = ctx->bc->fc_sp; fscp > 0; fscp--) + { + if (FC_LOOP == ctx->bc->fc_stack[fscp].type) + break; + } + + if (fscp == 0) { + R600_ERR("Break not inside loop/endloop pair\n"); + return -EINVAL; + } + + r600_bc_add_cfinst(ctx->bc, ctx->inst_info->r600_opcode); + ctx->bc->cf_last->pop_count = 1; + + fc_set_mid(ctx, fscp); + + pops(ctx, 1); + callstack_check_depth(ctx, FC_PUSH_VPM, 1); return 0; } @@ -1911,7 +2103,7 @@ static struct r600_shader_tgsi_instruction r600_shader_tgsi_instruction[] = { {TGSI_OPCODE_DIV, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported}, {TGSI_OPCODE_DP2, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_DOT4, tgsi_dp}, {TGSI_OPCODE_TXL, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported}, - {TGSI_OPCODE_BRK, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported}, + {TGSI_OPCODE_BRK, 0, V_SQ_CF_WORD1_SQ_CF_INST_LOOP_BREAK, tgsi_loop_brk_cont}, {TGSI_OPCODE_IF, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_if}, /* gap */ {75, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported}, @@ -1937,12 +2129,12 @@ static struct r600_shader_tgsi_instruction r600_shader_tgsi_instruction[] = { {TGSI_OPCODE_SAD, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported}, {TGSI_OPCODE_TXF, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported}, {TGSI_OPCODE_TXQ, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported}, - {TGSI_OPCODE_CONT, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported}, + {TGSI_OPCODE_CONT, 0, V_SQ_CF_WORD1_SQ_CF_INST_LOOP_CONTINUE, tgsi_loop_brk_cont}, {TGSI_OPCODE_EMIT, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported}, {TGSI_OPCODE_ENDPRIM, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported}, - {TGSI_OPCODE_BGNLOOP, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported}, + {TGSI_OPCODE_BGNLOOP, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_bgnloop}, {TGSI_OPCODE_BGNSUB, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported}, - {TGSI_OPCODE_ENDLOOP, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported}, + {TGSI_OPCODE_ENDLOOP, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_endloop}, {TGSI_OPCODE_ENDSUB, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported}, /* gap */ {103, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported}, -- cgit v1.2.3 From cb08b9fa84bf432dcca2e685daadd2df651b3025 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Mon, 30 Aug 2010 14:13:01 +1000 Subject: r600g: fix SSG and op3 neg writing 8 more piglits, mainly the two SSG tests. --- src/gallium/drivers/r600/r600_asm.c | 20 ++++++++------------ src/gallium/drivers/r600/r600_shader.c | 9 +++++++-- 2 files changed, 15 insertions(+), 14 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/r600_asm.c b/src/gallium/drivers/r600/r600_asm.c index 03fe950186..d3a9c6ca1f 100644 --- a/src/gallium/drivers/r600/r600_asm.c +++ b/src/gallium/drivers/r600/r600_asm.c @@ -340,12 +340,15 @@ static int r600_bc_alu_build(struct r600_bc *bc, struct r600_bc_alu *alu, unsign unsigned i; /* don't replace gpr by pv or ps for destination register */ + bc->bytecode[id++] = S_SQ_ALU_WORD0_SRC0_SEL(alu->src[0].sel) | + S_SQ_ALU_WORD0_SRC0_CHAN(alu->src[0].chan) | + S_SQ_ALU_WORD0_SRC0_NEG(alu->src[0].neg) | + S_SQ_ALU_WORD0_SRC1_SEL(alu->src[1].sel) | + S_SQ_ALU_WORD0_SRC1_CHAN(alu->src[1].chan) | + S_SQ_ALU_WORD0_SRC1_NEG(alu->src[1].neg) | + S_SQ_ALU_WORD0_LAST(alu->last); + if (alu->is_op3) { - bc->bytecode[id++] = S_SQ_ALU_WORD0_SRC0_SEL(alu->src[0].sel) | - S_SQ_ALU_WORD0_SRC0_CHAN(alu->src[0].chan) | - S_SQ_ALU_WORD0_SRC1_SEL(alu->src[1].sel) | - S_SQ_ALU_WORD0_SRC1_CHAN(alu->src[1].chan) | - S_SQ_ALU_WORD0_LAST(alu->last); bc->bytecode[id++] = S_SQ_ALU_WORD1_DST_GPR(alu->dst.sel) | S_SQ_ALU_WORD1_DST_CHAN(alu->dst.chan) | S_SQ_ALU_WORD1_CLAMP(alu->dst.clamp) | @@ -355,13 +358,6 @@ static int r600_bc_alu_build(struct r600_bc *bc, struct r600_bc_alu *alu, unsign S_SQ_ALU_WORD1_OP3_ALU_INST(alu->inst) | S_SQ_ALU_WORD1_BANK_SWIZZLE(0); } else { - bc->bytecode[id++] = S_SQ_ALU_WORD0_SRC0_SEL(alu->src[0].sel) | - S_SQ_ALU_WORD0_SRC0_CHAN(alu->src[0].chan) | - S_SQ_ALU_WORD0_SRC0_NEG(alu->src[0].neg) | - S_SQ_ALU_WORD0_SRC1_SEL(alu->src[1].sel) | - S_SQ_ALU_WORD0_SRC1_CHAN(alu->src[1].chan) | - S_SQ_ALU_WORD0_SRC1_NEG(alu->src[1].neg) | - S_SQ_ALU_WORD0_LAST(alu->last); bc->bytecode[id++] = S_SQ_ALU_WORD1_DST_GPR(alu->dst.sel) | S_SQ_ALU_WORD1_DST_CHAN(alu->dst.chan) | S_SQ_ALU_WORD1_CLAMP(alu->dst.clamp) | diff --git a/src/gallium/drivers/r600/r600_shader.c b/src/gallium/drivers/r600/r600_shader.c index 82f4d73e43..4ff705622e 100644 --- a/src/gallium/drivers/r600/r600_shader.c +++ b/src/gallium/drivers/r600/r600_shader.c @@ -1142,8 +1142,9 @@ static int tgsi_ssg(struct r600_shader_ctx *ctx) memset(&alu, 0, sizeof(struct r600_bc_alu)); alu.inst = V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_CNDGT; alu.is_op3 = 1; + alu.dst.sel = ctx->temp_reg; - alu.dst.write = 1; + alu.dst.chan = i; alu.src[0] = r600_src[0]; alu.src[0].chan = tgsi_chan(&inst->Src[0], i); @@ -1158,6 +1159,9 @@ static int tgsi_ssg(struct r600_shader_ctx *ctx) if (r) return r; } + r = r600_bc_add_literal(ctx->bc, ctx->value); + if (r) + return r; /* dst = (-tmp > 0 ? -1 : tmp) */ for (i = 0; i < 4; i++) { @@ -1169,14 +1173,15 @@ static int tgsi_ssg(struct r600_shader_ctx *ctx) return r; alu.src[0].sel = ctx->temp_reg; + alu.src[0].chan = i; alu.src[0].neg = 1; alu.src[1].sel = V_SQ_ALU_SRC_1; alu.src[1].neg = 1; alu.src[2].sel = ctx->temp_reg; + alu.src[2].chan = i; - alu.dst.write = 1; if (i == 3) alu.last = 1; r = r600_bc_add_alu(ctx->bc, &alu); -- cgit v1.2.3 From 4502b17901ad491e0598ee59a12d372c008ae03b Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Mon, 30 Aug 2010 14:41:09 +1000 Subject: r600g: add KILP support passes glsl1-discard tests --- src/gallium/drivers/r600/r600_shader.c | 25 ++++++++++++++++++++----- src/gallium/drivers/r600/r600_shader.h | 1 + src/gallium/drivers/r600/r600_state.c | 2 ++ 3 files changed, 23 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/r600_shader.c b/src/gallium/drivers/r600/r600_shader.c index 4ff705622e..514288bc8c 100644 --- a/src/gallium/drivers/r600/r600_shader.c +++ b/src/gallium/drivers/r600/r600_shader.c @@ -861,12 +861,20 @@ static int tgsi_kill(struct r600_shader_ctx *ctx) for (i = 0; i < 4; i++) { memset(&alu, 0, sizeof(struct r600_bc_alu)); alu.inst = ctx->inst_info->r600_opcode; + alu.dst.chan = i; + alu.src[0].sel = V_SQ_ALU_SRC_0; - r = tgsi_src(ctx, &inst->Src[0], &alu.src[1]); - if (r) - return r; - alu.src[1].chan = tgsi_chan(&inst->Src[0], i); + + if (ctx->inst_info->tgsi_opcode == TGSI_OPCODE_KILP) { + alu.src[1].sel = V_SQ_ALU_SRC_1; + alu.src[1].neg = 1; + } else { + r = tgsi_src(ctx, &inst->Src[0], &alu.src[1]); + if (r) + return r; + alu.src[1].chan = tgsi_chan(&inst->Src[0], i); + } if (i == 3) { alu.last = 1; } @@ -874,6 +882,13 @@ static int tgsi_kill(struct r600_shader_ctx *ctx) if (r) return r; } + r = r600_bc_add_literal(ctx->bc, ctx->value); + if (r) + return r; + + /* kill must be last in ALU */ + ctx->bc->force_add_cf = 1; + ctx->shader->uses_kill = TRUE; return 0; } @@ -2074,7 +2089,7 @@ static struct r600_shader_tgsi_instruction r600_shader_tgsi_instruction[] = { {TGSI_OPCODE_COS, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_COS, tgsi_trig}, {TGSI_OPCODE_DDX, 0, SQ_TEX_INST_GET_GRADIENTS_H, tgsi_tex}, {TGSI_OPCODE_DDY, 0, SQ_TEX_INST_GET_GRADIENTS_V, tgsi_tex}, - {TGSI_OPCODE_KILP, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported}, /* predicated kill */ + {TGSI_OPCODE_KILP, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_KILLGT, tgsi_kill}, /* predicated kill */ {TGSI_OPCODE_PK2H, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported}, {TGSI_OPCODE_PK2US, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported}, {TGSI_OPCODE_PK4B, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported}, diff --git a/src/gallium/drivers/r600/r600_shader.h b/src/gallium/drivers/r600/r600_shader.h index 2ee7780ead..7c722c07cb 100644 --- a/src/gallium/drivers/r600/r600_shader.h +++ b/src/gallium/drivers/r600/r600_shader.h @@ -42,6 +42,7 @@ struct r600_shader { struct r600_shader_io input[32]; struct r600_shader_io output[32]; enum radeon_family family; + boolean uses_kill; }; #endif diff --git a/src/gallium/drivers/r600/r600_state.c b/src/gallium/drivers/r600/r600_state.c index b5e5346163..441be8fd6d 100644 --- a/src/gallium/drivers/r600/r600_state.c +++ b/src/gallium/drivers/r600/r600_state.c @@ -999,6 +999,8 @@ static struct radeon_state *r600_dsa(struct r600_context *rctx) db_shader_control = 0x210; rshader = &rctx->ps_shader->shader; + if (rshader->uses_kill) + db_shader_control |= (1 << 6); for (i = 0; i < rshader->noutput; i++) { if (rshader->output[i].name == TGSI_SEMANTIC_POSITION) db_shader_control |= 1; -- cgit v1.2.3 From a2711d69686a6c7f2cabe174cfefeefc718ce335 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Sun, 29 Aug 2010 22:07:49 -0700 Subject: linker: Treat sized and unsized array types as the same If two shaders contain variables declared with array types that have the same base type but one is sized and the other is not, linking should succeed. I'm not super pleased with the way this is implemented, and I am more convinced than ever that we need more linker tests. We especially need "negative" tests. Fixes bugzilla #29697 and piglit test glsl-link-array-01. --- src/glsl/linker.cpp | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp index 3de069b531..56e0bfd238 100644 --- a/src/glsl/linker.cpp +++ b/src/glsl/linker.cpp @@ -343,12 +343,26 @@ cross_validate_globals(struct gl_shader_program *prog, ir_variable *const existing = variables.get_variable(var->name); if (existing != NULL) { if (var->type != existing->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; + /* Consider the types to be "the same" if both types are arrays + * of the same type and one of the arrays is implicitly sized. + * In addition, set the type of the linked variable to the + * explicitly sized array. + */ + if (var->type->is_array() + && existing->type->is_array() + && (var->type->fields.array == existing->type->fields.array) + && ((var->type->length == 0) + || (existing->type->length == 0))) { + if (existing->type->length == 0) + existing->type = var->type; + } else { + 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. -- cgit v1.2.3 From 47d5a19df1e7760c4f5f0e340bfc56355c2e428b Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Mon, 30 Aug 2010 15:19:20 +1000 Subject: r600g: add initial relative support to assembler passes another ~20 piglits. /me starts to run out low hanging fruit around now. --- src/gallium/drivers/r600/r600_asm.c | 5 ++++ src/gallium/drivers/r600/r600_asm.h | 2 ++ src/gallium/drivers/r600/r600_shader.c | 42 +++++++++++++++++++++++++++++----- src/gallium/drivers/r600/r600_sq.h | 2 ++ 4 files changed, 45 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/r600_asm.c b/src/gallium/drivers/r600/r600_asm.c index d3a9c6ca1f..1a354a6293 100644 --- a/src/gallium/drivers/r600/r600_asm.c +++ b/src/gallium/drivers/r600/r600_asm.c @@ -341,9 +341,11 @@ static int r600_bc_alu_build(struct r600_bc *bc, struct r600_bc_alu *alu, unsign /* don't replace gpr by pv or ps for destination register */ bc->bytecode[id++] = S_SQ_ALU_WORD0_SRC0_SEL(alu->src[0].sel) | + S_SQ_ALU_WORD0_SRC0_REL(alu->src[0].rel) | S_SQ_ALU_WORD0_SRC0_CHAN(alu->src[0].chan) | S_SQ_ALU_WORD0_SRC0_NEG(alu->src[0].neg) | S_SQ_ALU_WORD0_SRC1_SEL(alu->src[1].sel) | + S_SQ_ALU_WORD0_SRC1_REL(alu->src[1].rel) | S_SQ_ALU_WORD0_SRC1_CHAN(alu->src[1].chan) | S_SQ_ALU_WORD0_SRC1_NEG(alu->src[1].neg) | S_SQ_ALU_WORD0_LAST(alu->last); @@ -351,8 +353,10 @@ static int r600_bc_alu_build(struct r600_bc *bc, struct r600_bc_alu *alu, unsign if (alu->is_op3) { bc->bytecode[id++] = S_SQ_ALU_WORD1_DST_GPR(alu->dst.sel) | S_SQ_ALU_WORD1_DST_CHAN(alu->dst.chan) | + S_SQ_ALU_WORD1_DST_REL(alu->dst.rel) | S_SQ_ALU_WORD1_CLAMP(alu->dst.clamp) | S_SQ_ALU_WORD1_OP3_SRC2_SEL(alu->src[2].sel) | + S_SQ_ALU_WORD1_OP3_SRC2_REL(alu->src[2].rel) | S_SQ_ALU_WORD1_OP3_SRC2_CHAN(alu->src[2].chan) | S_SQ_ALU_WORD1_OP3_SRC2_NEG(alu->src[2].neg) | S_SQ_ALU_WORD1_OP3_ALU_INST(alu->inst) | @@ -360,6 +364,7 @@ static int r600_bc_alu_build(struct r600_bc *bc, struct r600_bc_alu *alu, unsign } else { bc->bytecode[id++] = S_SQ_ALU_WORD1_DST_GPR(alu->dst.sel) | S_SQ_ALU_WORD1_DST_CHAN(alu->dst.chan) | + S_SQ_ALU_WORD1_DST_REL(alu->dst.rel) | S_SQ_ALU_WORD1_CLAMP(alu->dst.clamp) | S_SQ_ALU_WORD1_OP2_SRC0_ABS(alu->src[0].abs) | S_SQ_ALU_WORD1_OP2_SRC1_ABS(alu->src[1].abs) | diff --git a/src/gallium/drivers/r600/r600_asm.h b/src/gallium/drivers/r600/r600_asm.h index bb4f4b77b3..9e65fcdd4f 100644 --- a/src/gallium/drivers/r600/r600_asm.h +++ b/src/gallium/drivers/r600/r600_asm.h @@ -31,6 +31,7 @@ struct r600_bc_alu_src { unsigned chan; unsigned neg; unsigned abs; + unsigned rel; }; struct r600_bc_alu_dst { @@ -38,6 +39,7 @@ struct r600_bc_alu_dst { unsigned chan; unsigned clamp; unsigned write; + unsigned rel; }; struct r600_bc_alu { diff --git a/src/gallium/drivers/r600/r600_shader.c b/src/gallium/drivers/r600/r600_shader.c index 514288bc8c..bda829af2b 100644 --- a/src/gallium/drivers/r600/r600_shader.c +++ b/src/gallium/drivers/r600/r600_shader.c @@ -284,16 +284,18 @@ static int tgsi_is_supported(struct r600_shader_ctx *ctx) } #endif for (j = 0; j < i->Instruction.NumSrcRegs; j++) { - if (i->Src[j].Register.Indirect || - i->Src[j].Register.Dimension || + if (i->Src[j].Register.Dimension || i->Src[j].Register.Absolute) { - R600_ERR("unsupported src (indirect|dimension|absolute)\n"); + R600_ERR("unsupported src %d (dimension %d|absolute %d)\n", j, + i->Src[j].Register.Indirect, + i->Src[j].Register.Dimension, + i->Src[j].Register.Absolute); return -EINVAL; } } for (j = 0; j < i->Instruction.NumDstRegs; j++) { - if (i->Dst[j].Register.Indirect || i->Dst[j].Register.Dimension) { - R600_ERR("unsupported dst (indirect|dimension)\n"); + if (i->Dst[j].Register.Dimension) { + R600_ERR("unsupported dst (dimension)\n"); return -EINVAL; } } @@ -344,6 +346,7 @@ static int tgsi_declaration(struct r600_shader_ctx *ctx) case TGSI_FILE_CONSTANT: case TGSI_FILE_TEMPORARY: case TGSI_FILE_SAMPLER: + case TGSI_FILE_ADDRESS: break; default: R600_ERR("unsupported file %d declaration\n", d->Declaration.File); @@ -586,6 +589,8 @@ static int tgsi_src(struct r600_shader_ctx *ctx, ctx->value[2] = ctx->literals[index * 4 + 2]; ctx->value[3] = ctx->literals[index * 4 + 3]; } + if (tgsi_src->Register.Indirect) + r600_src->rel = V_SQ_REL_RELATIVE; r600_src->neg = tgsi_src->Register.Negate; r600_src->sel += ctx->file_offset[tgsi_src->Register.File]; return 0; @@ -602,6 +607,8 @@ static int tgsi_dst(struct r600_shader_ctx *ctx, r600_dst->sel += ctx->file_offset[tgsi_dst->Register.File]; r600_dst->chan = swizzle; r600_dst->write = 1; + if (tgsi_dst->Register.Indirect) + r600_dst->rel = V_SQ_REL_RELATIVE; if (inst->Instruction.Saturate) { r600_dst->clamp = 1; } @@ -1769,6 +1776,29 @@ static int tgsi_exp(struct r600_shader_ctx *ctx) return tgsi_helper_copy(ctx, inst); } +static int tgsi_arl(struct r600_shader_ctx *ctx) +{ + /* TODO from r600c, ar values don't persist between clauses */ + struct tgsi_full_instruction *inst = &ctx->parse.FullToken.FullInstruction; + struct r600_bc_alu alu; + int r; + memset(&alu, 0, sizeof(struct r600_bc_alu)); + + alu.inst = V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOVA_FLOOR; + + r = tgsi_src(ctx, &inst->Src[0], &alu.src[0]); + if (r) + return r; + alu.src[0].chan = tgsi_chan(&inst->Src[0], 0); + + alu.last = 1; + + r = r600_bc_add_alu_type(ctx->bc, &alu, V_SQ_CF_ALU_WORD1_SQ_CF_INST_ALU); + if (r) + return r; + return 0; +} + static int emit_logic_pred(struct r600_shader_ctx *ctx, int opcode) { struct tgsi_full_instruction *inst = &ctx->parse.FullToken.FullInstruction; @@ -2047,7 +2077,7 @@ static int tgsi_loop_brk_cont(struct r600_shader_ctx *ctx) } static struct r600_shader_tgsi_instruction r600_shader_tgsi_instruction[] = { - {TGSI_OPCODE_ARL, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported}, + {TGSI_OPCODE_ARL, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_arl}, {TGSI_OPCODE_MOV, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV, tgsi_op2}, {TGSI_OPCODE_LIT, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_lit}, {TGSI_OPCODE_RCP, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RECIP_IEEE, tgsi_trans_srcx_replicate}, diff --git a/src/gallium/drivers/r600/r600_sq.h b/src/gallium/drivers/r600/r600_sq.h index b4ed435e91..fa7a31742a 100644 --- a/src/gallium/drivers/r600/r600_sq.h +++ b/src/gallium/drivers/r600/r600_sq.h @@ -608,4 +608,6 @@ #define V_SQ_CF_COND_BOOL 0x02 #define V_SQ_CF_COND_NOT_BOOL 0x03 +#define V_SQ_REL_ABSOLUTE 0 +#define V_SQ_REL_RELATIVE 1 #endif -- cgit v1.2.3 From db92a03aacc0c0e13377af4f54ef5303400b4810 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Mon, 30 Aug 2010 15:50:33 +1000 Subject: r600g: fix warning introduced by last commit. --- src/gallium/drivers/r600/r600_shader.c | 1 - 1 file changed, 1 deletion(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/r600_shader.c b/src/gallium/drivers/r600/r600_shader.c index bda829af2b..9a4e39e2cc 100644 --- a/src/gallium/drivers/r600/r600_shader.c +++ b/src/gallium/drivers/r600/r600_shader.c @@ -287,7 +287,6 @@ static int tgsi_is_supported(struct r600_shader_ctx *ctx) if (i->Src[j].Register.Dimension || i->Src[j].Register.Absolute) { R600_ERR("unsupported src %d (dimension %d|absolute %d)\n", j, - i->Src[j].Register.Indirect, i->Src[j].Register.Dimension, i->Src[j].Register.Absolute); return -EINVAL; -- cgit v1.2.3 From 92f5c7a597aaf098f4e6b4793e4b89ae539e328a Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Mon, 30 Aug 2010 16:09:39 +1000 Subject: r600g: add SCS support. --- src/gallium/drivers/r600/r600_shader.c | 75 +++++++++++++++++++++++++++++++--- 1 file changed, 69 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/r600_shader.c b/src/gallium/drivers/r600/r600_shader.c index 9a4e39e2cc..15dc406479 100644 --- a/src/gallium/drivers/r600/r600_shader.c +++ b/src/gallium/drivers/r600/r600_shader.c @@ -743,14 +743,14 @@ static int tgsi_op2_swap(struct r600_shader_ctx *ctx) * r700 - normalize by dividing by 2PI * see fdo bug 27901 */ -static int tgsi_trig(struct r600_shader_ctx *ctx) +static int tgsi_setup_trig(struct r600_shader_ctx *ctx, + struct r600_bc_alu_src r600_src[3]) { struct tgsi_full_instruction *inst = &ctx->parse.FullToken.FullInstruction; - struct r600_bc_alu_src r600_src[3]; - struct r600_bc_alu alu; - int i, r; + int r; uint32_t lit_vals[4]; - + struct r600_bc_alu alu; + memset(lit_vals, 0, 4*4); r = tgsi_split_constant(ctx, r600_src); if (r) @@ -823,6 +823,23 @@ static int tgsi_trig(struct r600_shader_ctx *ctx) if (r) return r; r = r600_bc_add_literal(ctx->bc, lit_vals); + if (r) + return r; + return 0; +} + +static int tgsi_trig(struct r600_shader_ctx *ctx) +{ + struct tgsi_full_instruction *inst = &ctx->parse.FullToken.FullInstruction; + struct r600_bc_alu_src r600_src[3]; + struct r600_bc_alu alu; + int i, r; + + r = tgsi_split_constant(ctx, r600_src); + if (r) + return r; + + r = tgsi_setup_trig(ctx, r600_src); if (r) return r; @@ -858,6 +875,52 @@ static int tgsi_trig(struct r600_shader_ctx *ctx) return 0; } +static int tgsi_scs(struct r600_shader_ctx *ctx) +{ + struct tgsi_full_instruction *inst = &ctx->parse.FullToken.FullInstruction; + struct r600_bc_alu_src r600_src[3]; + struct r600_bc_alu alu; + int r; + + r = tgsi_split_constant(ctx, r600_src); + if (r) + return r; + + r = tgsi_setup_trig(ctx, r600_src); + if (r) + return r; + + + /* dst.x = COS */ + memset(&alu, 0, sizeof(struct r600_bc_alu)); + alu.inst = V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_COS; + r = tgsi_dst(ctx, &inst->Dst[0], 0, &alu.dst); + if (r) + return r; + + alu.src[0].sel = ctx->temp_reg; + alu.src[0].chan = 0; + alu.last = 1; + r = r600_bc_add_alu(ctx->bc, &alu); + if (r) + return r; + + /* dst.y = SIN */ + memset(&alu, 0, sizeof(struct r600_bc_alu)); + alu.inst = V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SIN; + r = tgsi_dst(ctx, &inst->Dst[0], 1, &alu.dst); + if (r) + return r; + + alu.src[0].sel = ctx->temp_reg; + alu.src[0].chan = 0; + alu.last = 1; + r = r600_bc_add_alu(ctx->bc, &alu); + if (r) + return r; + return 0; +} + static int tgsi_kill(struct r600_shader_ctx *ctx) { struct tgsi_full_instruction *inst = &ctx->parse.FullToken.FullInstruction; @@ -2146,7 +2209,7 @@ static struct r600_shader_tgsi_instruction r600_shader_tgsi_instruction[] = { {TGSI_OPCODE_RET, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported}, {TGSI_OPCODE_SSG, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_ssg}, {TGSI_OPCODE_CMP, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_cmp}, - {TGSI_OPCODE_SCS, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported}, + {TGSI_OPCODE_SCS, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_scs}, {TGSI_OPCODE_TXB, 0, SQ_TEX_INST_SAMPLE_L, tgsi_tex}, {TGSI_OPCODE_NRM, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported}, {TGSI_OPCODE_DIV, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported}, -- cgit v1.2.3 From 57eecbbf6c57fbf5a46b8b81d8d4fbb6bd78ea12 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Mon, 30 Aug 2010 16:22:54 +1000 Subject: r600g: add DST opcode support. --- src/gallium/drivers/r600/r600_shader.c | 42 +++++++++++++++++++++++++++++++++- 1 file changed, 41 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/r600_shader.c b/src/gallium/drivers/r600/r600_shader.c index 15dc406479..23b3eabf52 100644 --- a/src/gallium/drivers/r600/r600_shader.c +++ b/src/gallium/drivers/r600/r600_shader.c @@ -1861,6 +1861,46 @@ static int tgsi_arl(struct r600_shader_ctx *ctx) return 0; } +static int tgsi_opdst(struct r600_shader_ctx *ctx) +{ + struct tgsi_full_instruction *inst = &ctx->parse.FullToken.FullInstruction; + struct r600_bc_alu alu; + int i, r = 0; + + for (i = 0; i < 4; i++) { + memset(&alu, 0, sizeof(struct r600_bc_alu)); + + alu.inst = V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MUL; + r = tgsi_dst(ctx, &inst->Dst[0], i, &alu.dst); + if (r) + return r; + + if (i == 0 || i == 3) { + alu.src[0].sel = V_SQ_ALU_SRC_1; + } else { + r = tgsi_src(ctx, &inst->Src[0], &alu.src[0]); + if (r) + return r; + alu.src[0].chan = tgsi_chan(&inst->Src[0], i); + } + + if (i == 0 || i == 2) { + alu.src[1].sel = V_SQ_ALU_SRC_1; + } else { + r = tgsi_src(ctx, &inst->Src[1], &alu.src[1]); + if (r) + return r; + alu.src[1].chan = tgsi_chan(&inst->Src[1], i); + } + if (i == 3) + alu.last = 1; + r = r600_bc_add_alu(ctx->bc, &alu); + if (r) + return r; + } + return 0; +} + static int emit_logic_pred(struct r600_shader_ctx *ctx, int opcode) { struct tgsi_full_instruction *inst = &ctx->parse.FullToken.FullInstruction; @@ -2150,7 +2190,7 @@ static struct r600_shader_tgsi_instruction r600_shader_tgsi_instruction[] = { {TGSI_OPCODE_ADD, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_ADD, tgsi_op2}, {TGSI_OPCODE_DP3, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_DOT4, tgsi_dp}, {TGSI_OPCODE_DP4, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_DOT4, tgsi_dp}, - {TGSI_OPCODE_DST, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported}, + {TGSI_OPCODE_DST, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_opdst}, {TGSI_OPCODE_MIN, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MIN, tgsi_op2}, {TGSI_OPCODE_MAX, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MAX, tgsi_op2}, {TGSI_OPCODE_SLT, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETGT, tgsi_op2_swap}, -- cgit v1.2.3 From 77dac1945f0f8122dc933b45e407f6137c757f1d Mon Sep 17 00:00:00 2001 From: Marek Olšák Date: Mon, 30 Aug 2010 13:25:07 +0200 Subject: r300g: fix warning in winsys --- src/gallium/drivers/r300/r300_winsys.h | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_winsys.h b/src/gallium/drivers/r300/r300_winsys.h index 187780750f..4597332399 100644 --- a/src/gallium/drivers/r300/r300_winsys.h +++ b/src/gallium/drivers/r300/r300_winsys.h @@ -33,6 +33,7 @@ #include "r300_defines.h" +struct winsys_handle; struct r300_winsys_screen; struct r300_winsys_buffer; -- cgit v1.2.3 From 007bac83312b29061753e625edfd45ccab9ecc9c Mon Sep 17 00:00:00 2001 From: Marek Olšák Date: Wed, 25 Aug 2010 05:25:41 +0200 Subject: st/mesa: set the MaxVarying GLSL constant --- src/mesa/state_tracker/st_extensions.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src') diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c index 90e78679e4..6cd74db897 100644 --- a/src/mesa/state_tracker/st_extensions.c +++ b/src/mesa/state_tracker/st_extensions.c @@ -161,6 +161,13 @@ void st_init_limits(struct st_context *st) pc->MaxNativeTemps = screen->get_param(screen, PIPE_CAP_MAX_VS_TEMPS); pc->MaxNativeAddressRegs = screen->get_param(screen, PIPE_CAP_MAX_VS_ADDRS); pc->MaxNativeParameters = screen->get_param(screen, PIPE_CAP_MAX_VS_CONSTS); + + /* PIPE_CAP_MAX_FS_INPUTS specifies the number of COLORn + GENERICn inputs + * and is set in MaxNativeAttribs. It's always 2 colors + N generic + * attributes. The GLSL compiler never uses COLORn for varyings, so we + * subtract the 2 colors to get the maximum number of varyings (generic + * attributes) supported by a driver. */ + c->MaxVarying = screen->get_param(screen, PIPE_CAP_MAX_FS_INPUTS) - 2; } -- cgit v1.2.3 From 5a70db643295e99ca3f821a34abe474d56a6c872 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Sun, 15 Aug 2010 13:36:02 +0100 Subject: svga: Re-emit bound rendertargets and texture samplers at the beginning of every command buffer. Only non null resources. To ensure that relocations are emitted for every resource currently referred. --- src/gallium/drivers/svga/svga_context.c | 5 +++++ src/gallium/drivers/svga/svga_context.h | 1 + src/gallium/drivers/svga/svga_state_framebuffer.c | 15 ++++++++++----- src/gallium/drivers/svga/svga_state_tss.c | 14 +++++++++++--- 4 files changed, 27 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/svga/svga_context.c b/src/gallium/drivers/svga/svga_context.c index 3b30b9e341..cd3f6b8982 100644 --- a/src/gallium/drivers/svga/svga_context.c +++ b/src/gallium/drivers/svga/svga_context.c @@ -214,6 +214,11 @@ void svga_context_flush( struct svga_context *svga, svga_screen_cache_flush(svgascreen, fence); + /* To force the reemission of rendertargets and texture bindings at + * the beginning of every command buffer. + */ + svga->dirty |= SVGA_NEW_COMMAND_BUFFER; + if (SVGA_DEBUG & DEBUG_SYNC) { if (fence) svga->pipe.screen->fence_finish( svga->pipe.screen, fence, 0); diff --git a/src/gallium/drivers/svga/svga_context.h b/src/gallium/drivers/svga/svga_context.h index 67a7614c8a..1fb5a04887 100644 --- a/src/gallium/drivers/svga/svga_context.h +++ b/src/gallium/drivers/svga/svga_context.h @@ -382,6 +382,7 @@ struct svga_context #define SVGA_NEW_ZERO_STRIDE 0x2000000 #define SVGA_NEW_TEXTURE_FLAGS 0x4000000 #define SVGA_NEW_STENCIL_REF 0x8000000 +#define SVGA_NEW_COMMAND_BUFFER 0x10000000 diff --git a/src/gallium/drivers/svga/svga_state_framebuffer.c b/src/gallium/drivers/svga/svga_state_framebuffer.c index bd92f00343..fcbb35e797 100644 --- a/src/gallium/drivers/svga/svga_state_framebuffer.c +++ b/src/gallium/drivers/svga/svga_state_framebuffer.c @@ -43,15 +43,18 @@ static int emit_framebuffer( struct svga_context *svga, { const struct pipe_framebuffer_state *curr = &svga->curr.framebuffer; struct pipe_framebuffer_state *hw = &svga->state.hw_clear.framebuffer; + boolean reemit = !!(dirty & SVGA_NEW_COMMAND_BUFFER); unsigned i; enum pipe_error ret; - /* XXX: Need shadow state in svga->hw to eliminate redundant - * uploads, especially of NULL buffers. + /* + * We need to reemit non-null surface bindings, even when they are not + * dirty, to ensure that the resources are paged in. */ for(i = 0; i < PIPE_MAX_COLOR_BUFS; ++i) { - if (curr->cbufs[i] != hw->cbufs[i]) { + if (curr->cbufs[i] != hw->cbufs[i] || + (reemit && hw->cbufs[i])) { if (svga->curr.nr_fbs++ > 8) return PIPE_ERROR_OUT_OF_MEMORY; @@ -64,7 +67,8 @@ static int emit_framebuffer( struct svga_context *svga, } - if (curr->zsbuf != hw->zsbuf) { + if (curr->zsbuf != hw->zsbuf || + (reemit && hw->zsbuf)) { ret = SVGA3D_SetRenderTarget(svga->swc, SVGA3D_RT_DEPTH, curr->zsbuf); if (ret != PIPE_OK) return ret; @@ -92,7 +96,8 @@ static int emit_framebuffer( struct svga_context *svga, struct svga_tracked_state svga_hw_framebuffer = { "hw framebuffer state", - SVGA_NEW_FRAME_BUFFER, + SVGA_NEW_FRAME_BUFFER | + SVGA_NEW_COMMAND_BUFFER, emit_framebuffer }; diff --git a/src/gallium/drivers/svga/svga_state_tss.c b/src/gallium/drivers/svga/svga_state_tss.c index e42c4f7fce..4a50b19474 100644 --- a/src/gallium/drivers/svga/svga_state_tss.c +++ b/src/gallium/drivers/svga/svga_state_tss.c @@ -56,6 +56,7 @@ static int update_tss_binding(struct svga_context *svga, unsigned dirty ) { + boolean reemit = !!(dirty & SVGA_NEW_COMMAND_BUFFER); unsigned i; unsigned count = MAX2( svga->curr.num_sampler_views, svga->state.hw_draw.num_views ); @@ -107,12 +108,18 @@ update_tss_binding(struct svga_context *svga, max_lod); } - if (view->dirty) { + /* + * We need to reemit non-null texture bindings, even when they are not + * dirty, to ensure that the resources are paged in. + */ + + if (view->dirty || + (reemit && view->v)) { queue.bind[queue.bind_count].unit = i; queue.bind[queue.bind_count].view = view; queue.bind_count++; } - else if (view->v) { + if (!view->dirty && view->v) { svga_validate_sampler_view(svga, view->v); } } @@ -160,7 +167,8 @@ fail: struct svga_tracked_state svga_hw_tss_binding = { "texture binding emit", SVGA_NEW_TEXTURE_BINDING | - SVGA_NEW_SAMPLER, + SVGA_NEW_SAMPLER | + SVGA_NEW_COMMAND_BUFFER, update_tss_binding }; -- cgit v1.2.3 From 1bb97610e969918015f46efe6fe32c6c71a8293a Mon Sep 17 00:00:00 2001 From: Michal Krol Date: Fri, 27 Aug 2010 13:24:47 +0200 Subject: svga: Fix CMP translation for vertex shader targets. SVGA3DOP_CMP is not supported for vertex shaders; use SLT + LRP instead. --- src/gallium/drivers/svga/svga_tgsi_insn.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'src') diff --git a/src/gallium/drivers/svga/svga_tgsi_insn.c b/src/gallium/drivers/svga/svga_tgsi_insn.c index 67e1f22a70..72dccdf150 100644 --- a/src/gallium/drivers/svga/svga_tgsi_insn.c +++ b/src/gallium/drivers/svga/svga_tgsi_insn.c @@ -806,6 +806,20 @@ static boolean emit_cmp(struct svga_shader_emitter *emit, const struct src_register src2 = translate_src_register( emit, &insn->Src[2] ); + if (emit->unit == PIPE_SHADER_VERTEX) { + SVGA3dShaderDestToken temp = get_temp(emit); + struct src_register zero = scalar(get_zero_immediate(emit), TGSI_SWIZZLE_X); + + /* Since vertex shaders don't support the CMP instruction, + * simulate it with SLT and LRP instructions. + * SLT TMP, SRC0, 0.0 + * LRP DST, TMP, SRC1, SRC2 + */ + if (!submit_op2(emit, inst_token(SVGA3DOP_SLT), temp, src0, zero)) + return FALSE; + return submit_op3(emit, inst_token(SVGA3DOP_LRP), dst, src(temp), src1, src2); + } + /* CMP DST, SRC0, SRC2, SRC1 */ return submit_op3( emit, inst_token( SVGA3DOP_CMP ), dst, src0, src2, src1); } @@ -2682,6 +2696,11 @@ needs_to_create_zero( struct svga_shader_emitter *emit ) return TRUE; } + if (emit->unit == PIPE_SHADER_VERTEX) { + if (emit->info.opcode_count[TGSI_OPCODE_CMP] >= 1) + return TRUE; + } + if (emit->info.opcode_count[TGSI_OPCODE_IF] >= 1 || emit->info.opcode_count[TGSI_OPCODE_BGNLOOP] >= 1 || emit->info.opcode_count[TGSI_OPCODE_DDX] >= 1 || -- cgit v1.2.3 From e18c7f68b4a18ba3f9ebfd0a4a24e3528cf44800 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Sat, 21 Aug 2010 11:31:22 +0100 Subject: gallivm: Fix lp_build_sum_vector. The result is scalar, so when argument is zero/undef we can pass vector zero/undef. Also, support the scalar case. --- src/gallium/auxiliary/gallivm/lp_bld_arit.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/gallium/auxiliary/gallivm/lp_bld_arit.c b/src/gallium/auxiliary/gallivm/lp_bld_arit.c index 7bb57061f5..e0d30be98d 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_arit.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_arit.c @@ -259,7 +259,7 @@ lp_build_add(struct lp_build_context *bld, } -/** Return the sum of the elements of a */ +/** Return the scalar sum of the elements of a */ LLVMValueRef lp_build_sum_vector(struct lp_build_context *bld, LLVMValueRef a) @@ -270,11 +270,9 @@ lp_build_sum_vector(struct lp_build_context *bld, assert(lp_check_value(type, a)); - if (a == bld->zero) - return bld->zero; - if (a == bld->undef) - return bld->undef; - assert(type.length > 1); + if (type.length == 1) { + return a; + } assert(!bld->type.norm); -- cgit v1.2.3 From 7a08dbcf55d4c959907086a5e4851e0cab0b9f67 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Sat, 21 Aug 2010 11:29:41 +0100 Subject: gallivm: Correct copy'n'pasted comments. --- src/gallium/auxiliary/gallivm/lp_bld_type.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/gallium/auxiliary/gallivm/lp_bld_type.h b/src/gallium/auxiliary/gallivm/lp_bld_type.h index 3ffe916f8e..fec1d3dfbc 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_type.h +++ b/src/gallium/auxiliary/gallivm/lp_bld_type.h @@ -128,16 +128,16 @@ struct lp_build_context */ struct lp_type type; - /** Same as lp_build_undef(type) */ + /** Same as lp_build_elem_type(type) */ LLVMTypeRef elem_type; - /** Same as lp_build_undef(type) */ + /** Same as lp_build_vec_type(type) */ LLVMTypeRef vec_type; - /** Same as lp_build_undef(type) */ + /** Same as lp_build_int_elem_type(type) */ LLVMTypeRef int_elem_type; - /** Same as lp_build_undef(type) */ + /** Same as lp_build_int_vec_type(type) */ LLVMTypeRef int_vec_type; /** Same as lp_build_undef(type) */ -- cgit v1.2.3 From e4c3e7f9d8eae05c83f6e1fc54dc63ded3c12d12 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Sun, 29 Aug 2010 12:05:36 +0100 Subject: gallivm: Disable LLVM's pretty stack trace dumper. By default LLVM adds a signal handler to output a pretty stack trace. This signal handler is never removed, causing problems when unloading the shared object where the gallium driver resides. Thanks to Chris Li for finding this. --- src/gallium/auxiliary/gallivm/lp_bld_misc.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src') diff --git a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp index 92f9adfc18..48baf7c425 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp +++ b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp @@ -40,6 +40,7 @@ #include #include #include +#include #include "pipe/p_config.h" #include "util/u_debug.h" @@ -161,6 +162,13 @@ lp_set_target_options(void) llvm::cl::ParseCommandLineOptions(2, const_cast(options)); first = FALSE; } + + /* + * By default LLVM adds a signal handler to output a pretty stack trace. + * This signal handler is never removed, causing problems when unloading the + * shared object where the gallium driver resides. + */ + llvm::DisablePrettyStackTrace = true; } -- cgit v1.2.3 From 128237927d6fa4ffb23e52c59150f57520004c00 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Mon, 30 Aug 2010 13:48:21 +0100 Subject: mesa: Fix _mesa_lookup_parameter_constant's return value. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes gcc warning In function ‘_mesa_add_unnamed_constant’: warning: ‘pos’ may be used uninitialized in this function but also what appears to be a bug. --- src/mesa/program/prog_parameter.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/mesa/program/prog_parameter.c b/src/mesa/program/prog_parameter.c index 40dc92cb20..6bf8a081b0 100644 --- a/src/mesa/program/prog_parameter.c +++ b/src/mesa/program/prog_parameter.c @@ -482,8 +482,10 @@ _mesa_lookup_parameter_constant(const struct gl_program_parameter_list *list, assert(vSize >= 1); assert(vSize <= 4); - if (!list) - return -1; + if (!list) { + *posOut = -1; + return GL_FALSE; + } for (i = 0; i < list->NumParameters; i++) { if (list->Parameters[i].Type == PROGRAM_CONSTANT) { -- cgit v1.2.3 From ccd8b935e484d267ea864b5e8c65f826d015f708 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Mon, 30 Aug 2010 13:53:15 +0100 Subject: glsl: Silence unused variable warning. --- src/glsl/glsl_symbol_table.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/glsl/glsl_symbol_table.cpp b/src/glsl/glsl_symbol_table.cpp index 11e1671335..ed71244cbf 100644 --- a/src/glsl/glsl_symbol_table.cpp +++ b/src/glsl/glsl_symbol_table.cpp @@ -104,6 +104,7 @@ bool glsl_symbol_table::add_variable(const char *name, ir_variable *v) entry->f = existing->f; int added = _mesa_symbol_table_add_symbol(table, -1, name, entry); assert(added == 0); + (void)added; return true; } return false; -- cgit v1.2.3 From 0a6c908e0d2d1721421f7b26d73975f4f61e24a2 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Mon, 7 Jun 2010 12:05:18 +0100 Subject: gallivm: Compute the 4 texel offsets for linear filtering en ensemble. --- src/gallium/auxiliary/gallivm/lp_bld_sample.c | 97 ++++--- src/gallium/auxiliary/gallivm/lp_bld_sample.h | 9 + src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c | 300 +++++++++++++++------- 3 files changed, 280 insertions(+), 126 deletions(-) (limited to 'src') diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample.c b/src/gallium/auxiliary/gallivm/lp_bld_sample.c index 3c4992b25e..259b1142e3 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_sample.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_sample.c @@ -123,6 +123,52 @@ lp_sampler_static_state(struct lp_sampler_static_state *state, } +/** + * Compute the partial offset of a pixel block along an arbitrary axis. + * + * @param coord coordinate in pixels + * @param stride number of bytes between rows of successive pixel blocks + * @param block_length number of pixels in a pixels block along the coordinate + * axis + * @param out_offset resulting relative offset of the pixel block in bytes + * @param out_subcoord resulting sub-block pixel coordinate + */ +void +lp_build_sample_partial_offset(struct lp_build_context *bld, + unsigned block_length, + LLVMValueRef coord, + LLVMValueRef stride, + LLVMValueRef *out_offset, + LLVMValueRef *out_subcoord) +{ + LLVMValueRef offset; + LLVMValueRef subcoord; + + if (block_length == 1) { + subcoord = bld->zero; + } + else { + /* + * Pixel blocks have power of two dimensions. LLVM should convert the + * rem/div to bit arithmetic. + * TODO: Verify this. + */ + + LLVMValueRef block_width = lp_build_const_int_vec(bld->type, block_length); + subcoord = LLVMBuildURem(bld->builder, coord, block_width, ""); + coord = LLVMBuildUDiv(bld->builder, coord, block_width, ""); + } + + offset = lp_build_mul(bld, coord, stride); + + assert(out_offset); + assert(out_subcoord); + + *out_offset = offset; + *out_subcoord = subcoord; +} + + /** * Compute the offset of a pixel block. * @@ -144,48 +190,35 @@ lp_build_sample_offset(struct lp_build_context *bld, { LLVMValueRef x_stride; LLVMValueRef offset; - LLVMValueRef i; - LLVMValueRef j; - - /* - * Describe the coordinates in terms of pixel blocks. - * - * TODO: pixel blocks are power of two. LLVM should convert rem/div to - * bit arithmetic. Verify this. - */ - - if (format_desc->block.width == 1) { - i = bld->zero; - } - else { - LLVMValueRef block_width = lp_build_const_int_vec(bld->type, format_desc->block.width); - i = LLVMBuildURem(bld->builder, x, block_width, ""); - x = LLVMBuildUDiv(bld->builder, x, block_width, ""); - } - - if (format_desc->block.height == 1) { - j = bld->zero; - } - else { - LLVMValueRef block_height = lp_build_const_int_vec(bld->type, format_desc->block.height); - j = LLVMBuildURem(bld->builder, y, block_height, ""); - y = LLVMBuildUDiv(bld->builder, y, block_height, ""); - } x_stride = lp_build_const_vec(bld->type, format_desc->block.bits/8); - offset = lp_build_mul(bld, x, x_stride); + + lp_build_sample_partial_offset(bld, + format_desc->block.width, + x, x_stride, + &offset, out_i); if (y && y_stride) { - LLVMValueRef y_offset = lp_build_mul(bld, y, y_stride); + LLVMValueRef y_offset; + lp_build_sample_partial_offset(bld, + format_desc->block.height, + y, y_stride, + &y_offset, out_j); offset = lp_build_add(bld, offset, y_offset); } + else { + *out_j = bld->zero; + } if (z && z_stride) { - LLVMValueRef z_offset = lp_build_mul(bld, z, z_stride); + LLVMValueRef z_offset; + LLVMValueRef k; + lp_build_sample_partial_offset(bld, + 1, /* pixel blocks are always 2D */ + z, z_stride, + &z_offset, &k); offset = lp_build_add(bld, offset, z_offset); } *out_offset = offset; - *out_i = i; - *out_j = j; } diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample.h b/src/gallium/auxiliary/gallivm/lp_bld_sample.h index aff7bb2a4d..caafc4eca0 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_sample.h +++ b/src/gallium/auxiliary/gallivm/lp_bld_sample.h @@ -148,6 +148,15 @@ lp_sampler_static_state(struct lp_sampler_static_state *state, const struct pipe_sampler_state *sampler); +void +lp_build_sample_partial_offset(struct lp_build_context *bld, + unsigned block_length, + LLVMValueRef coord, + LLVMValueRef stride, + LLVMValueRef *out_offset, + LLVMValueRef *out_i); + + void lp_build_sample_offset(struct lp_build_context *bld, const struct util_format_description *format_desc, diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c index f6b6162f63..1f39d9c98b 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c @@ -322,59 +322,6 @@ lp_build_sample_texel_soa(struct lp_build_sample_context *bld, } -/** - * Fetch the texels as <4n x i8> in AoS form. - */ -static LLVMValueRef -lp_build_sample_packed(struct lp_build_sample_context *bld, - LLVMValueRef x, - LLVMValueRef y, - LLVMValueRef y_stride, - LLVMValueRef data_array) -{ - LLVMValueRef offset, i, j; - LLVMValueRef data_ptr; - LLVMValueRef res; - - /* convert x,y,z coords to linear offset from start of texture, in bytes */ - lp_build_sample_offset(&bld->uint_coord_bld, - bld->format_desc, - x, y, NULL, y_stride, NULL, - &offset, &i, &j); - - /* get pointer to mipmap level 0 data */ - data_ptr = lp_build_get_const_mipmap_level(bld, data_array, 0); - - if (util_format_is_rgba8_variant(bld->format_desc)) { - /* Just fetch the data directly without swizzling */ - assert(bld->format_desc->block.width == 1); - assert(bld->format_desc->block.height == 1); - assert(bld->format_desc->block.bits <= bld->texel_type.width); - - res = lp_build_gather(bld->builder, - bld->texel_type.length, - bld->format_desc->block.bits, - bld->texel_type.width, - data_ptr, offset); - } - else { - struct lp_type type; - - assert(bld->texel_type.width == 32); - - memset(&type, 0, sizeof type); - type.width = 8; - type.length = bld->texel_type.length*4; - type.norm = TRUE; - - res = lp_build_fetch_rgba_aos(bld->builder, bld->format_desc, type, - data_ptr, offset, i, j); - } - - return res; -} - - /** * Helper to compute the mirror function for the PIPE_WRAP_MIRROR modes. */ @@ -409,7 +356,7 @@ lp_build_coord_mirror(struct lp_build_sample_context *bld, /** - * We only support a few wrap modes in lp_build_sample_wrap_int() at this time. + * We only support a few wrap modes in lp_build_sample_wrap_linear_int() at this time. * Return whether the given mode is supported by that function. */ static boolean @@ -431,13 +378,18 @@ is_simple_wrap_mode(unsigned mode) * \param length the texture size along one dimension * \param is_pot if TRUE, length is a power of two * \param wrap_mode one of PIPE_TEX_WRAP_x + * \param i0 resulting sub-block pixel coordinate for coord0 */ -static LLVMValueRef -lp_build_sample_wrap_int(struct lp_build_sample_context *bld, - LLVMValueRef coord, - LLVMValueRef length, - boolean is_pot, - unsigned wrap_mode) +static void +lp_build_sample_wrap_nearest_int(struct lp_build_sample_context *bld, + unsigned block_length, + LLVMValueRef coord, + LLVMValueRef length, + LLVMValueRef stride, + boolean is_pot, + unsigned wrap_mode, + LLVMValueRef *out_offset, + LLVMValueRef *out_i) { struct lp_build_context *uint_coord_bld = &bld->uint_coord_bld; struct lp_build_context *int_coord_bld = &bld->int_coord_bld; @@ -470,7 +422,134 @@ lp_build_sample_wrap_int(struct lp_build_sample_context *bld, assert(0); } - return coord; + lp_build_sample_partial_offset(uint_coord_bld, block_length, coord, stride, + out_offset, out_i); +} + + +/** + * Build LLVM code for texture wrap mode, for scaled integer texcoords. + * \param coord0 the incoming texcoord (s,t,r or q) scaled to the texture size + * \param length the texture size along one dimension + * \param stride pixel stride along the coordinate axis + * \param block_length is the length of the pixel block along the + * coordinate axis + * \param is_pot if TRUE, length is a power of two + * \param wrap_mode one of PIPE_TEX_WRAP_x + * \param offset0 resulting relative offset for coord0 + * \param offset1 resulting relative offset for coord0 + 1 + * \param i0 resulting sub-block pixel coordinate for coord0 + * \param i1 resulting sub-block pixel coordinate for coord0 + 1 + */ +static void +lp_build_sample_wrap_linear_int(struct lp_build_sample_context *bld, + unsigned block_length, + LLVMValueRef coord0, + LLVMValueRef length, + LLVMValueRef stride, + boolean is_pot, + unsigned wrap_mode, + LLVMValueRef *offset0, + LLVMValueRef *offset1, + LLVMValueRef *i0, + LLVMValueRef *i1) +{ + struct lp_build_context *uint_coord_bld = &bld->uint_coord_bld; + struct lp_build_context *int_coord_bld = &bld->int_coord_bld; + LLVMValueRef length_minus_one; + LLVMValueRef lmask, umask, mask; + + if (block_length != 1) { + /* + * If the pixel block covers more than one pixel then there is no easy + * way to calculate offset1 relative to offset0. Instead, compute them + * independently. + */ + + LLVMValueRef coord1; + + lp_build_sample_wrap_nearest_int(bld, + block_length, + coord0, + length, + stride, + is_pot, + wrap_mode, + offset0, i0); + + coord1 = lp_build_add(int_coord_bld, coord0, int_coord_bld->one); + + lp_build_sample_wrap_nearest_int(bld, + block_length, + coord1, + length, + stride, + is_pot, + wrap_mode, + offset1, i1); + + return; + } + + /* + * Scalar pixels -- try to compute offset0 and offset1 with a single stride + * multiplication. + */ + + *i0 = uint_coord_bld->zero; + *i1 = uint_coord_bld->zero; + + length_minus_one = lp_build_sub(int_coord_bld, length, int_coord_bld->one); + + switch(wrap_mode) { + case PIPE_TEX_WRAP_REPEAT: + if (is_pot) { + coord0 = LLVMBuildAnd(bld->builder, coord0, length_minus_one, ""); + } + else { + /* Signed remainder won't give the right results for negative + * dividends but unsigned remainder does.*/ + coord0 = LLVMBuildURem(bld->builder, coord0, length, ""); + } + + mask = lp_build_compare(bld->builder, int_coord_bld->type, + PIPE_FUNC_NOTEQUAL, coord0, length_minus_one); + + *offset0 = lp_build_mul(uint_coord_bld, coord0, stride); + *offset1 = LLVMBuildAnd(bld->builder, + lp_build_add(uint_coord_bld, *offset0, stride), + mask, ""); + break; + + case PIPE_TEX_WRAP_CLAMP_TO_EDGE: + lmask = lp_build_compare(int_coord_bld->builder, int_coord_bld->type, + PIPE_FUNC_GEQUAL, coord0, int_coord_bld->zero); + umask = lp_build_compare(int_coord_bld->builder, int_coord_bld->type, + PIPE_FUNC_LESS, coord0, length_minus_one); + + coord0 = lp_build_select(int_coord_bld, lmask, coord0, int_coord_bld->zero); + coord0 = lp_build_select(int_coord_bld, umask, coord0, length_minus_one); + + mask = LLVMBuildAnd(bld->builder, lmask, umask, ""); + + *offset0 = lp_build_mul(uint_coord_bld, coord0, stride); + *offset1 = lp_build_add(uint_coord_bld, + *offset0, + LLVMBuildAnd(bld->builder, stride, mask, "")); + break; + + case PIPE_TEX_WRAP_CLAMP: + case PIPE_TEX_WRAP_CLAMP_TO_BORDER: + case PIPE_TEX_WRAP_MIRROR_REPEAT: + case PIPE_TEX_WRAP_MIRROR_CLAMP: + case PIPE_TEX_WRAP_MIRROR_CLAMP_TO_EDGE: + case PIPE_TEX_WRAP_MIRROR_CLAMP_TO_BORDER: + default: + assert(0); + *offset0 = uint_coord_bld->zero; + *offset1 = uint_coord_bld->zero; + break; + } } @@ -1741,14 +1820,18 @@ lp_build_sample_2d_linear_aos(struct lp_build_sample_context *bld, LLVMValueRef i32_c8, i32_c128, i32_c255; LLVMValueRef s_ipart, s_fpart, s_fpart_lo, s_fpart_hi; LLVMValueRef t_ipart, t_fpart, t_fpart_lo, t_fpart_hi; - LLVMValueRef x0, x1; - LLVMValueRef y0, y1; - LLVMValueRef neighbors[2][2]; + LLVMValueRef data_ptr; + LLVMValueRef x_stride, y_stride; + LLVMValueRef x_offset0, x_offset1; + LLVMValueRef y_offset0, y_offset1; + LLVMValueRef offset[2][2]; + LLVMValueRef x_subcoord[2], y_subcoord[2]; LLVMValueRef neighbors_lo[2][2]; LLVMValueRef neighbors_hi[2][2]; LLVMValueRef packed, packed_lo, packed_hi; LLVMValueRef unswizzled[4]; - LLVMValueRef stride; + const unsigned level = 0; + unsigned i, j; assert(bld->static_state->target == PIPE_TEXTURE_2D || bld->static_state->target == PIPE_TEXTURE_RECT); @@ -1795,21 +1878,30 @@ lp_build_sample_2d_linear_aos(struct lp_build_sample_context *bld, s_fpart = LLVMBuildAnd(builder, s, i32_c255, ""); t_fpart = LLVMBuildAnd(builder, t, i32_c255, ""); - x0 = s_ipart; - y0 = t_ipart; - - x1 = lp_build_add(&bld->int_coord_bld, x0, bld->int_coord_bld.one); - y1 = lp_build_add(&bld->int_coord_bld, y0, bld->int_coord_bld.one); - - x0 = lp_build_sample_wrap_int(bld, x0, width, bld->static_state->pot_width, - bld->static_state->wrap_s); - y0 = lp_build_sample_wrap_int(bld, y0, height, bld->static_state->pot_height, - bld->static_state->wrap_t); - - x1 = lp_build_sample_wrap_int(bld, x1, width, bld->static_state->pot_width, - bld->static_state->wrap_s); - y1 = lp_build_sample_wrap_int(bld, y1, height, bld->static_state->pot_height, - bld->static_state->wrap_t); + x_stride = lp_build_const_vec(bld->uint_coord_bld.type, + bld->format_desc->block.bits/8); + + y_stride = lp_build_get_const_level_stride_vec(bld, stride_array, level); + + lp_build_sample_wrap_linear_int(bld, + bld->format_desc->block.width, + s_ipart, width, x_stride, + bld->static_state->pot_width, + bld->static_state->wrap_s, + &x_offset0, &x_offset1, + &x_subcoord[0], &x_subcoord[1]); + lp_build_sample_wrap_linear_int(bld, + bld->format_desc->block.height, + t_ipart, height, y_stride, + bld->static_state->pot_height, + bld->static_state->wrap_t, + &y_offset0, &y_offset1, + &y_subcoord[0], &y_subcoord[1]); + + offset[0][0] = lp_build_add(&bld->uint_coord_bld, x_offset0, y_offset0); + offset[0][1] = lp_build_add(&bld->uint_coord_bld, x_offset1, y_offset0); + offset[1][0] = lp_build_add(&bld->uint_coord_bld, x_offset0, y_offset1); + offset[1][1] = lp_build_add(&bld->uint_coord_bld, x_offset1, y_offset1); /* * Transform 4 x i32 in @@ -1838,7 +1930,6 @@ lp_build_sample_2d_linear_aos(struct lp_build_sample_context *bld, LLVMValueRef shuffles_hi[LP_MAX_VECTOR_LENGTH]; LLVMValueRef shuffle_lo; LLVMValueRef shuffle_hi; - unsigned i, j; for(j = 0; j < h16.type.length; j += 4) { #ifdef PIPE_ARCH_LITTLE_ENDIAN @@ -1866,7 +1957,10 @@ lp_build_sample_2d_linear_aos(struct lp_build_sample_context *bld, t_fpart_hi = LLVMBuildShuffleVector(builder, t_fpart, h16.undef, shuffle_hi, ""); } - stride = lp_build_get_const_level_stride_vec(bld, stride_array, 0); + /* + * get pointer to mipmap level 0 data + */ + data_ptr = lp_build_get_const_mipmap_level(bld, data_array, level); /* * Fetch the pixels as 4 x 32bit (rgba order might differ): @@ -1885,20 +1979,38 @@ lp_build_sample_2d_linear_aos(struct lp_build_sample_context *bld, * The higher 8 bits of the resulting elements will be zero. */ - neighbors[0][0] = lp_build_sample_packed(bld, x0, y0, stride, data_array); - neighbors[0][1] = lp_build_sample_packed(bld, x1, y0, stride, data_array); - neighbors[1][0] = lp_build_sample_packed(bld, x0, y1, stride, data_array); - neighbors[1][1] = lp_build_sample_packed(bld, x1, y1, stride, data_array); + for (j = 0; j < 2; ++j) { + for (i = 0; i < 2; ++i) { + LLVMValueRef rgba8; - neighbors[0][0] = LLVMBuildBitCast(builder, neighbors[0][0], u8n_vec_type, ""); - neighbors[0][1] = LLVMBuildBitCast(builder, neighbors[0][1], u8n_vec_type, ""); - neighbors[1][0] = LLVMBuildBitCast(builder, neighbors[1][0], u8n_vec_type, ""); - neighbors[1][1] = LLVMBuildBitCast(builder, neighbors[1][1], u8n_vec_type, ""); + if (util_format_is_rgba8_variant(bld->format_desc)) { + /* + * Given the format is a rgba8, just read the pixels as is, + * without any swizzling. Swizzling will be done later. + */ + rgba8 = lp_build_gather(bld->builder, + bld->texel_type.length, + bld->format_desc->block.bits, + bld->texel_type.width, + data_ptr, offset[j][i]); - lp_build_unpack2(builder, u8n.type, h16.type, neighbors[0][0], &neighbors_lo[0][0], &neighbors_hi[0][0]); - lp_build_unpack2(builder, u8n.type, h16.type, neighbors[0][1], &neighbors_lo[0][1], &neighbors_hi[0][1]); - lp_build_unpack2(builder, u8n.type, h16.type, neighbors[1][0], &neighbors_lo[1][0], &neighbors_hi[1][0]); - lp_build_unpack2(builder, u8n.type, h16.type, neighbors[1][1], &neighbors_lo[1][1], &neighbors_hi[1][1]); + rgba8 = LLVMBuildBitCast(builder, rgba8, u8n_vec_type, ""); + + } + else { + rgba8 = lp_build_fetch_rgba_aos(bld->builder, + bld->format_desc, + u8n.type, + data_ptr, offset[j][i], + x_subcoord[i], + y_subcoord[j]); + } + + lp_build_unpack2(builder, u8n.type, h16.type, + rgba8, + &neighbors_lo[j][i], &neighbors_hi[j][i]); + } + } /* * Linear interpolate with 8.8 fixed point. -- cgit v1.2.3 From 4841c0a15adcc722e67d7d246987cd686d3f7a17 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Mon, 30 Aug 2010 13:59:24 +0100 Subject: mesa: Return after assertion failure. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Addresses the warnings: warning: ‘target’ may be used uninitialized in this function warning: ‘target_string’ may be used uninitialized in this function --- src/mesa/program/ir_to_mesa.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp index 19f3847ab5..af6d7345a5 100644 --- a/src/mesa/program/ir_to_mesa.cpp +++ b/src/mesa/program/ir_to_mesa.cpp @@ -2456,7 +2456,7 @@ get_mesa_program(GLcontext *ctx, struct gl_shader_program *shader_program, break; default: assert(!"should not be reached"); - break; + return NULL; } validate_ir_tree(shader->ir); -- cgit v1.2.3 From f3eebb846587b96da280659c7dea6457a886ab85 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Mon, 30 Aug 2010 14:12:01 +0100 Subject: glut: Silence missing initializer warning. --- src/glut/glx/glut_init.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/glut/glx/glut_init.c b/src/glut/glx/glut_init.c index 842aefc93c..213819e751 100644 --- a/src/glut/glx/glut_init.c +++ b/src/glut/glx/glut_init.c @@ -44,7 +44,7 @@ unsigned int __glutDisplayMode = GLUT_RGB | GLUT_SINGLE | GLUT_DEPTH; char *__glutDisplayString = NULL; int __glutConnectionFD; -XSizeHints __glutSizeHints = {0}; +XSizeHints __glutSizeHints; int __glutInitWidth = 300, __glutInitHeight = 300; int __glutInitX = -1, __glutInitY = -1; GLboolean __glutForceDirect = GL_FALSE, -- cgit v1.2.3 From 40aadafa91ef5b931436d400fedafd720d59deff Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Sat, 28 Aug 2010 22:34:30 -0700 Subject: i965: Add support for texturing with bias to i965 FS backend. Fixes 5 piglit tests for bias. Note that LOD is a 1.30 feature and not yet supported. --- src/mesa/drivers/dri/i965/brw_defines.h | 3 ++ src/mesa/drivers/dri/i965/brw_fs.cpp | 74 +++++++++++++++++++++++++-------- 2 files changed, 60 insertions(+), 17 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_defines.h b/src/mesa/drivers/dri/i965/brw_defines.h index f7a68cead7..6b8e9e05d0 100644 --- a/src/mesa/drivers/dri/i965/brw_defines.h +++ b/src/mesa/drivers/dri/i965/brw_defines.h @@ -686,6 +686,9 @@ #define BRW_SAMPLER_MESSAGE_SAMPLE_BIAS_GEN5 1 #define BRW_SAMPLER_MESSAGE_SAMPLE_LOD_GEN5 2 #define BRW_SAMPLER_MESSAGE_SAMPLE_COMPARE_GEN5 3 +#define BRW_SAMPLER_MESSAGE_SAMPLE_DERIVS_GEN5 4 +#define BRW_SAMPLER_MESSAGE_SAMPLE_BIAS_COMPARE_GEN5 5 +#define BRW_SAMPLER_MESSAGE_SAMPLE_LOD_COMPARE_GEN5 6 /* for GEN5 only */ #define BRW_SAMPLER_SIMD_MODE_SIMD4X2 0 diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp index 1ef27ce9ce..233fee47dc 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -68,6 +68,8 @@ enum fs_opcodes { FS_OPCODE_DDY, FS_OPCODE_LINTERP, FS_OPCODE_TEX, + FS_OPCODE_TXB, + FS_OPCODE_TXL, }; static int using_new_fs = -1; @@ -921,15 +923,24 @@ fs_visitor::visit(ir_texture *ir) * performance relevant? */ fs_reg dst = fs_reg(this, glsl_type::vec4_type); - this->result = dst; switch (ir->op) { case ir_tex: inst = emit(fs_inst(FS_OPCODE_TEX, dst, fs_reg(MRF, base_mrf))); break; case ir_txb: + ir->lod_info.bias->accept(this); + emit(fs_inst(BRW_OPCODE_MOV, fs_reg(MRF, base_mrf + mlen), this->result)); + mlen++; + + inst = emit(fs_inst(FS_OPCODE_TXB, dst, fs_reg(MRF, base_mrf))); + break; case ir_txl: - assert(!"FINISHME"); + ir->lod_info.lod->accept(this); + emit(fs_inst(BRW_OPCODE_MOV, fs_reg(MRF, base_mrf + mlen), this->result)); + mlen++; + + inst = emit(fs_inst(FS_OPCODE_TXL, dst, fs_reg(MRF, base_mrf))); break; case ir_txd: case ir_txf: @@ -937,6 +948,8 @@ fs_visitor::visit(ir_texture *ir) break; } + this->result = dst; + if (ir->shadow_comparitor) inst->shadow_compare = true; inst->mlen = mlen; @@ -1382,24 +1395,49 @@ fs_visitor::generate_math(fs_inst *inst, void fs_visitor::generate_tex(fs_inst *inst, struct brw_reg dst, struct brw_reg src) { - int msg_type; + int msg_type = -1; + int rlen = 4; if (intel->gen == 5) { - if (inst->shadow_compare) - msg_type = BRW_SAMPLER_MESSAGE_SAMPLE_COMPARE_GEN5; - else - msg_type = BRW_SAMPLER_MESSAGE_SAMPLE_GEN5; + switch (inst->opcode) { + case FS_OPCODE_TEX: + if (inst->shadow_compare) { + msg_type = BRW_SAMPLER_MESSAGE_SAMPLE_COMPARE_GEN5; + } else { + msg_type = BRW_SAMPLER_MESSAGE_SAMPLE_GEN5; + } + break; + case FS_OPCODE_TXB: + if (inst->shadow_compare) { + msg_type = BRW_SAMPLER_MESSAGE_SAMPLE_BIAS_COMPARE_GEN5; + } else { + msg_type = BRW_SAMPLER_MESSAGE_SAMPLE_BIAS_GEN5; + } + break; + } } else { - /* Note that G45 and older determines shadow compare and dispatch width - * from message length for most messages. - */ - if (inst->shadow_compare) - msg_type = BRW_SAMPLER_MESSAGE_SIMD16_SAMPLE_COMPARE; - else - msg_type = BRW_SAMPLER_MESSAGE_SIMD16_SAMPLE; + switch (inst->opcode) { + case FS_OPCODE_TEX: + /* Note that G45 and older determines shadow compare and dispatch width + * from message length for most messages. + */ + if (inst->shadow_compare) { + msg_type = BRW_SAMPLER_MESSAGE_SIMD16_SAMPLE_COMPARE; + } else { + msg_type = BRW_SAMPLER_MESSAGE_SIMD16_SAMPLE; + } + case FS_OPCODE_TXB: + if (inst->shadow_compare) { + assert(!"FINISHME: shadow compare with bias."); + msg_type = BRW_SAMPLER_MESSAGE_SIMD16_SAMPLE_BIAS; + } else { + msg_type = BRW_SAMPLER_MESSAGE_SIMD16_SAMPLE_BIAS; + rlen = 8; + } + break; + } } - - int response_length = 4; + assert(msg_type != -1); /* g0 header. */ src.nr--; @@ -1412,7 +1450,7 @@ fs_visitor::generate_tex(fs_inst *inst, struct brw_reg dst, struct brw_reg src) inst->sampler, WRITEMASK_XYZW, msg_type, - response_length, + rlen, inst->mlen + 1, 0, 1, @@ -1649,6 +1687,8 @@ fs_visitor::generate_code() generate_linterp(inst, dst, src); break; case FS_OPCODE_TEX: + case FS_OPCODE_TXB: + case FS_OPCODE_TXL: generate_tex(inst, dst, src[0]); break; case FS_OPCODE_FB_WRITE: -- cgit v1.2.3 From 4ff25c2106fb981334bdc1b032fcf37d8753ba62 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Sat, 28 Aug 2010 22:42:01 -0700 Subject: i965: Fix the new implementation of ir_unop_sign to match brw_wm_emit.c Like the comparison operations, this suffered from CMP only setting the low bit. Doing the AND instructions would be the same instruction count as the more obvious conditional moves, so do cond moves. Fixes glsl-fs-sign and 6 other cases, like trig functions that use sign() internally. --- src/mesa/drivers/dri/i965/brw_fs.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp index 233fee47dc..0d29c86ce2 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -655,14 +655,17 @@ fs_visitor::visit(ir_expression *ir) case ir_unop_sign: temp = fs_reg(this, ir->type); - inst = emit(fs_inst(BRW_OPCODE_CMP, this->result, op[0], fs_reg(0.0f))); + emit(fs_inst(BRW_OPCODE_MOV, this->result, fs_reg(0.0f))); + + inst = emit(fs_inst(BRW_OPCODE_CMP, reg_null, op[0], fs_reg(0.0f))); inst->conditional_mod = BRW_CONDITIONAL_G; + inst = emit(fs_inst(BRW_OPCODE_MOV, this->result, fs_reg(1.0f))); + inst->predicated = true; - inst = emit(fs_inst(BRW_OPCODE_CMP, temp, op[0], fs_reg(0.0f))); + inst = emit(fs_inst(BRW_OPCODE_CMP, reg_null, op[0], fs_reg(0.0f))); inst->conditional_mod = BRW_CONDITIONAL_L; - - temp.negate = true; - emit(fs_inst(BRW_OPCODE_ADD, this->result, this->result, temp)); + inst = emit(fs_inst(BRW_OPCODE_MOV, this->result, fs_reg(-1.0f))); + inst->predicated = true; break; case ir_unop_rcp: -- cgit v1.2.3 From b0a933a4d91c47e697459921073f8afe668bac31 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Sat, 28 Aug 2010 22:56:33 -0700 Subject: i965: Add "discard" support to the new FS backend. Fixes 3 testcases related to discard. --- src/mesa/drivers/dri/i965/brw_fs.cpp | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp index 0d29c86ce2..fd65ab2fa7 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -70,6 +70,7 @@ enum fs_opcodes { FS_OPCODE_TEX, FS_OPCODE_TXB, FS_OPCODE_TXL, + FS_OPCODE_DISCARD, }; static int using_new_fs = -1; @@ -433,6 +434,7 @@ public: struct brw_reg *src); void generate_tex(fs_inst *inst, struct brw_reg dst, struct brw_reg src); void generate_math(fs_inst *inst, struct brw_reg dst, struct brw_reg *src); + void generate_discard(fs_inst *inst); void emit_dummy_fs(); void emit_interpolation(); @@ -995,7 +997,9 @@ fs_visitor::visit(ir_swizzle *ir) void fs_visitor::visit(ir_discard *ir) { - assert(!"FINISHME"); + assert(ir->condition == NULL); /* FINISHME */ + + emit(fs_inst(FS_OPCODE_DISCARD)); } void @@ -1460,6 +1464,17 @@ fs_visitor::generate_tex(fs_inst *inst, struct brw_reg dst, struct brw_reg src) BRW_SAMPLER_SIMD_MODE_SIMD8); } +void +fs_visitor::generate_discard(fs_inst *inst) +{ + struct brw_reg g0 = retype(brw_vec1_grf(0, 0), BRW_REGISTER_TYPE_UW); + brw_push_insn_state(p); + brw_set_mask_control(p, BRW_MASK_DISABLE); + brw_NOT(p, c->emit_mask_reg, brw_mask_reg(1)); /* IMASK */ + brw_AND(p, g0, c->emit_mask_reg, g0); + brw_pop_insn_state(p); +} + static void trivial_assign_reg(int header_size, fs_reg *reg) { @@ -1694,6 +1709,9 @@ fs_visitor::generate_code() case FS_OPCODE_TXL: generate_tex(inst, dst, src[0]); break; + case FS_OPCODE_DISCARD: + generate_discard(inst); + break; case FS_OPCODE_FB_WRITE: generate_fb_write(inst); break; -- cgit v1.2.3 From 352dff62f8005add9e71e6b5ba3b3321cb953d73 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Sat, 28 Aug 2010 23:18:18 -0700 Subject: i965: Make brw_CONT and brw_BREAK take the pop count. We always need to set it, so pass it in. --- src/mesa/drivers/dri/i965/brw_eu.h | 4 ++-- src/mesa/drivers/dri/i965/brw_eu_emit.c | 6 ++++-- src/mesa/drivers/dri/i965/brw_vs_emit.c | 7 ++----- src/mesa/drivers/dri/i965/brw_wm_glsl.c | 7 ++----- 4 files changed, 10 insertions(+), 14 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_eu.h b/src/mesa/drivers/dri/i965/brw_eu.h index 6e9e210cf1..c63db16460 100644 --- a/src/mesa/drivers/dri/i965/brw_eu.h +++ b/src/mesa/drivers/dri/i965/brw_eu.h @@ -931,8 +931,8 @@ struct brw_instruction *brw_DO(struct brw_compile *p, struct brw_instruction *brw_WHILE(struct brw_compile *p, struct brw_instruction *patch_insn); -struct brw_instruction *brw_BREAK(struct brw_compile *p); -struct brw_instruction *brw_CONT(struct brw_compile *p); +struct brw_instruction *brw_BREAK(struct brw_compile *p, int pop_count); +struct brw_instruction *brw_CONT(struct brw_compile *p, int pop_count); /* Forward jumps: */ void brw_land_fwd_jump(struct brw_compile *p, diff --git a/src/mesa/drivers/dri/i965/brw_eu_emit.c b/src/mesa/drivers/dri/i965/brw_eu_emit.c index a6ca030afe..0906150613 100644 --- a/src/mesa/drivers/dri/i965/brw_eu_emit.c +++ b/src/mesa/drivers/dri/i965/brw_eu_emit.c @@ -777,7 +777,7 @@ void brw_ENDIF(struct brw_compile *p, } } -struct brw_instruction *brw_BREAK(struct brw_compile *p) +struct brw_instruction *brw_BREAK(struct brw_compile *p, int pop_count) { struct brw_instruction *insn; insn = next_insn(p, BRW_OPCODE_BREAK); @@ -788,10 +788,11 @@ struct brw_instruction *brw_BREAK(struct brw_compile *p) insn->header.execution_size = BRW_EXECUTE_8; /* insn->header.mask_control = BRW_MASK_DISABLE; */ insn->bits3.if_else.pad0 = 0; + insn->bits3.if_else.pop_count = pop_count; return insn; } -struct brw_instruction *brw_CONT(struct brw_compile *p) +struct brw_instruction *brw_CONT(struct brw_compile *p, int pop_count) { struct brw_instruction *insn; insn = next_insn(p, BRW_OPCODE_CONTINUE); @@ -802,6 +803,7 @@ struct brw_instruction *brw_CONT(struct brw_compile *p) insn->header.execution_size = BRW_EXECUTE_8; /* insn->header.mask_control = BRW_MASK_DISABLE; */ insn->bits3.if_else.pad0 = 0; + insn->bits3.if_else.pop_count = pop_count; return insn; } diff --git a/src/mesa/drivers/dri/i965/brw_vs_emit.c b/src/mesa/drivers/dri/i965/brw_vs_emit.c index 700e5ab6f6..720a6566fd 100644 --- a/src/mesa/drivers/dri/i965/brw_vs_emit.c +++ b/src/mesa/drivers/dri/i965/brw_vs_emit.c @@ -1654,7 +1654,6 @@ void brw_vs_emit(struct brw_vs_compile *c ) const struct prog_instruction *inst = &c->vp->program.Base.Instructions[insn]; struct brw_reg args[3], dst; GLuint i; - struct brw_instruction *temp; #if 0 printf("%d: ", insn); @@ -1841,14 +1840,12 @@ void brw_vs_emit(struct brw_vs_compile *c ) break; case OPCODE_BRK: brw_set_predicate_control(p, get_predicate(inst)); - temp = brw_BREAK(p); - temp->bits3.if_else.pop_count = if_depth_in_loop[loop_depth]; + brw_BREAK(p, if_depth_in_loop[loop_depth]); brw_set_predicate_control(p, BRW_PREDICATE_NONE); break; case OPCODE_CONT: brw_set_predicate_control(p, get_predicate(inst)); - temp = brw_CONT(p); - temp->bits3.if_else.pop_count = if_depth_in_loop[loop_depth]; + brw_CONT(p, if_depth_in_loop[loop_depth]); brw_set_predicate_control(p, BRW_PREDICATE_NONE); break; case OPCODE_ENDLOOP: diff --git a/src/mesa/drivers/dri/i965/brw_wm_glsl.c b/src/mesa/drivers/dri/i965/brw_wm_glsl.c index d72bd0825c..c1083c5942 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_glsl.c +++ b/src/mesa/drivers/dri/i965/brw_wm_glsl.c @@ -1822,7 +1822,6 @@ static void brw_wm_emit_glsl(struct brw_context *brw, struct brw_wm_compile *c) struct brw_reg args[3][4], dst[4]; int j; int mark = mark_tmps( c ); - struct brw_instruction *temp; c->cur_inst = i; @@ -2071,13 +2070,11 @@ static void brw_wm_emit_glsl(struct brw_context *brw, struct brw_wm_compile *c) if_depth_in_loop[loop_depth] = 0; break; case OPCODE_BRK: - temp = brw_BREAK(p); - temp->bits3.if_else.pop_count = if_depth_in_loop[loop_depth]; + brw_BREAK(p, if_depth_in_loop[loop_depth]); brw_set_predicate_control(p, BRW_PREDICATE_NONE); break; case OPCODE_CONT: - temp = brw_CONT(p); - temp->bits3.if_else.pop_count = if_depth_in_loop[loop_depth]; + brw_CONT(p, if_depth_in_loop[loop_depth]); brw_set_predicate_control(p, BRW_PREDICATE_NONE); break; case OPCODE_ENDLOOP: -- cgit v1.2.3 From 1fcb5a9858b7513c5130006933edc224b69be82d Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Sat, 28 Aug 2010 23:31:09 -0700 Subject: i965: Add support for loops to the new FS backend. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This includes a handy little safety check to prevent the loop from going "too long", as permitted by the spec. I haven't gone out of my way to test it, though… Fixes 20 more piglit tests. --- src/mesa/drivers/dri/i965/brw_fs.cpp | 86 ++++++++++++++++++++++++++++++++++-- 1 file changed, 82 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp index fd65ab2fa7..34c5d5262f 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -1071,13 +1071,48 @@ fs_visitor::visit(ir_if *ir) void fs_visitor::visit(ir_loop *ir) { - assert(!"FINISHME"); + assert(!ir->from); + assert(!ir->to); + assert(!ir->increment); + assert(!ir->counter); + + emit(fs_inst(BRW_OPCODE_DO)); + + /* Start a safety counter. If the user messed up their loop + * counting, we don't want to hang the GPU. + */ + fs_reg max_iter = fs_reg(this, glsl_type::int_type); + emit(fs_inst(BRW_OPCODE_MOV, max_iter, fs_reg(10000))); + + foreach_iter(exec_list_iterator, iter, ir->body_instructions) { + ir_instruction *ir = (ir_instruction *)iter.get(); + fs_inst *inst; + + this->base_ir = ir; + ir->accept(this); + + /* Check the maximum loop iters counter. */ + inst = emit(fs_inst(BRW_OPCODE_ADD, max_iter, max_iter, fs_reg(-1))); + inst->conditional_mod = BRW_CONDITIONAL_Z; + + inst = emit(fs_inst(BRW_OPCODE_BREAK)); + inst->predicated = true; + } + + emit(fs_inst(BRW_OPCODE_WHILE)); } void fs_visitor::visit(ir_loop_jump *ir) { - assert(!"FINISHME"); + switch (ir->mode) { + case ir_loop_jump::jump_break: + emit(fs_inst(BRW_OPCODE_BREAK)); + break; + case ir_loop_jump::jump_continue: + emit(fs_inst(BRW_OPCODE_CONTINUE)); + break; + } } void @@ -1624,8 +1659,11 @@ fs_visitor::generate_code() { unsigned int annotation_len = 0; int last_native_inst = 0; - struct brw_instruction *if_stack[16]; - int if_stack_depth = 0; + struct brw_instruction *if_stack[16], *loop_stack[16]; + int if_stack_depth = 0, loop_stack_depth = 0; + int if_depth_in_loop[16]; + + if_depth_in_loop[loop_stack_depth] = 0; memset(&if_stack, 0, sizeof(if_stack)); foreach_iter(exec_list_iterator, iter, this->instructions) { @@ -1691,6 +1729,46 @@ fs_visitor::generate_code() if_stack_depth--; brw_ENDIF(p , if_stack[if_stack_depth]); break; + + case BRW_OPCODE_DO: + loop_stack[loop_stack_depth++] = brw_DO(p, BRW_EXECUTE_8); + if_depth_in_loop[loop_stack_depth] = 0; + break; + + case BRW_OPCODE_BREAK: + brw_BREAK(p, if_depth_in_loop[loop_stack_depth]); + brw_set_predicate_control(p, BRW_PREDICATE_NONE); + break; + case BRW_OPCODE_CONTINUE: + brw_CONT(p, if_depth_in_loop[loop_stack_depth]); + brw_set_predicate_control(p, BRW_PREDICATE_NONE); + break; + + case BRW_OPCODE_WHILE: { + struct brw_instruction *inst0, *inst1; + GLuint br = 1; + + if (intel->gen == 5) + br = 2; + + assert(loop_stack_depth > 0); + loop_stack_depth--; + inst0 = inst1 = brw_WHILE(p, loop_stack[loop_stack_depth]); + /* patch all the BREAK/CONT instructions from last BGNLOOP */ + while (inst0 > loop_stack[loop_stack_depth]) { + inst0--; + if (inst0->header.opcode == BRW_OPCODE_BREAK && + inst0->bits3.if_else.jump_count == 0) { + inst0->bits3.if_else.jump_count = br * (inst1 - inst0 + 1); + } + else if (inst0->header.opcode == BRW_OPCODE_CONTINUE && + inst0->bits3.if_else.jump_count == 0) { + inst0->bits3.if_else.jump_count = br * (inst1 - inst0); + } + } + } + break; + case FS_OPCODE_RCP: case FS_OPCODE_RSQ: case FS_OPCODE_SQRT: -- cgit v1.2.3 From e1aa3c234fcc30c5c07f4b896adf304414558604 Mon Sep 17 00:00:00 2001 From: Cedric Vivier Date: Mon, 30 Aug 2010 10:40:39 -0700 Subject: i965: Apply the rest of the old-libdrm guard patch. Bug #29855 --- src/mesa/drivers/dri/intel/intel_context.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src') diff --git a/src/mesa/drivers/dri/intel/intel_context.h b/src/mesa/drivers/dri/intel/intel_context.h index f245ba843b..28d53284fd 100644 --- a/src/mesa/drivers/dri/intel/intel_context.h +++ b/src/mesa/drivers/dri/intel/intel_context.h @@ -33,12 +33,25 @@ #include "main/mtypes.h" #include "main/mm.h" #include "dri_metaops.h" + +#ifdef __cplusplus +extern "C" { + /* Evil hack for using libdrm in a c++ compiler. */ + #define virtual virt +#endif + #include "drm.h" #include "intel_bufmgr.h" #include "intel_screen.h" #include "intel_tex_obj.h" #include "i915_drm.h" + +#ifdef __cplusplus + #undef virtual +} +#endif + #include "tnl/t_vertex.h" #define TAG(x) intel##x -- cgit v1.2.3 From 3bae20bbc9b8255044edf2223079363bb2b94d4a Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 30 Aug 2010 10:47:05 -0700 Subject: i965: Align the number of payload regs to 2 again in 16-wide mode. Fixes a regression in point-line-no-cull and glean/paths tests since 501c9dc62774a73c080d500a1eab773b0da9577e. --- src/mesa/drivers/dri/i965/brw_wm_pass2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_wm_pass2.c b/src/mesa/drivers/dri/i965/brw_wm_pass2.c index 0499506ec0..54acb3038b 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_pass2.c +++ b/src/mesa/drivers/dri/i965/brw_wm_pass2.c @@ -101,7 +101,7 @@ static void init_registers( struct brw_wm_compile *c ) assert(nr_interp_regs >= 1); - c->prog_data.first_curbe_grf = c->key.nr_payload_regs; + c->prog_data.first_curbe_grf = ALIGN(c->key.nr_payload_regs, 2); c->prog_data.urb_read_length = nr_interp_regs * 2; c->prog_data.curb_read_length = c->nr_creg * 2; -- cgit v1.2.3 From 5360c48317f5806c7ea8814002e9aac2041960a7 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 30 Aug 2010 11:19:30 -0700 Subject: i965: Clear the cached constant buffer entry in the VS at control flow. Fixes the 7 regressions with constant buffers forced on with piglit -t glsl (glsl-vs-if-*). --- src/mesa/drivers/dri/i965/brw_vs_emit.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_vs_emit.c b/src/mesa/drivers/dri/i965/brw_vs_emit.c index 720a6566fd..1d88c6b5a4 100644 --- a/src/mesa/drivers/dri/i965/brw_vs_emit.c +++ b/src/mesa/drivers/dri/i965/brw_vs_emit.c @@ -116,6 +116,22 @@ get_first_reladdr_output(struct gl_vertex_program *vp) return first_reladdr_output; } +/* Clears the record of which vp_const_buffer elements have been + * loaded into our constant buffer registers, for the starts of new + * blocks after control flow. + */ +static void +clear_current_const(struct brw_vs_compile *c) +{ + unsigned int i; + + if (c->vp->use_const_buffer) { + for (i = 0; i < 3; i++) { + c->current_const[i].index = -1; + } + } +} + /** * Preallocate GRF register before code emit. * Do things as simply as possible. Allocate and populate all regs @@ -313,10 +329,10 @@ static void brw_vs_alloc_regs( struct brw_vs_compile *c ) if (c->vp->use_const_buffer) { for (i = 0; i < 3; i++) { - c->current_const[i].index = -1; c->current_const[i].reg = brw_vec8_grf(reg, 0); reg++; } + clear_current_const(c); } for (i = 0; i < 128; i++) { @@ -1826,15 +1842,18 @@ void brw_vs_emit(struct brw_vs_compile *c ) if_depth++; break; case OPCODE_ELSE: + clear_current_const(c); assert(if_depth > 0); if_inst[if_depth-1] = brw_ELSE(p, if_inst[if_depth-1]); break; case OPCODE_ENDIF: + clear_current_const(c); assert(if_depth > 0); brw_ENDIF(p, if_inst[--if_depth]); if_depth_in_loop[loop_depth]--; break; case OPCODE_BGNLOOP: + clear_current_const(c); loop_inst[loop_depth++] = brw_DO(p, BRW_EXECUTE_8); if_depth_in_loop[loop_depth] = 0; break; @@ -1850,6 +1869,7 @@ void brw_vs_emit(struct brw_vs_compile *c ) break; case OPCODE_ENDLOOP: { + clear_current_const(c); struct brw_instruction *inst0, *inst1; GLuint br = 1; -- cgit v1.2.3 From 699c82e30ce78c3975b3ce1a6fba148c70a9a78a Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Mon, 30 Aug 2010 20:48:49 +0200 Subject: glapi: fix generator which got out of sync with the codebase The __GLapi typedef was removed in c356f5867f2c1fad7155df538b9affa8dbdcf869, but the code generator hasn't been updated. --- src/mapi/glapi/gen/glX_proto_send.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/mapi/glapi/gen/glX_proto_send.py b/src/mapi/glapi/gen/glX_proto_send.py index 0ca0ff92a6..bd41c9e667 100644 --- a/src/mapi/glapi/gen/glX_proto_send.py +++ b/src/mapi/glapi/gen/glX_proto_send.py @@ -895,13 +895,13 @@ static int NoOp(void) * Create and initialize a new GL dispatch table. The table is initialized * with GLX indirect rendering protocol functions. */ -__GLapi * __glXNewIndirectAPI( void ) +struct _glapi_table * __glXNewIndirectAPI( void ) { - __GLapi *glAPI; + struct _glapi_table *glAPI; GLuint entries; entries = _glapi_get_dispatch_table_size(); - glAPI = (__GLapi *) Xmalloc(entries * sizeof(void *)); + glAPI = (struct _glapi_table *) Xmalloc(entries * sizeof(void *)); /* first, set all entries to point to no-op functions */ { -- cgit v1.2.3 From 69c30f5d6d429be4f7e211867984dab1a33da79c Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Thu, 26 Aug 2010 14:55:48 +1000 Subject: r600g: fixup states generation in winsys. The current states code had an unhealthy relationship between that had to somehow magically align themselves, editing either place meant renumbering all states after the one you were on, and it was pretty unapproachable code. This replaces the huge types structures with a simple type + sub type struct, which is keyed on an stype enum in radeon.h. Each stype can have a per-shader type subclassing (4 types supported, PS/VS/GS/FS), and also has a number of states per-subtype. So you have 256 constants per 4 shaders per one CONSTANT stype. The interface from the driver is changed to pass in the tuple, (stype, id, shader_type), and we look for this. If radeon_state_shader ever shows up on profile, it could use a hashtable based on stype/shader_type to speed things up. Signed-off-by: Dave Airlie --- src/gallium/drivers/r600/r600_blit.c | 23 +++-- src/gallium/drivers/r600/r600_context.c | 2 +- src/gallium/drivers/r600/r600_draw.c | 11 ++- src/gallium/drivers/r600/r600_query.c | 4 +- src/gallium/drivers/r600/r600_shader.c | 4 +- src/gallium/drivers/r600/r600_state.c | 38 ++++---- src/gallium/drivers/r600/r600_texture.c | 8 +- src/gallium/drivers/r600/radeon.h | 112 ++++++++-------------- src/gallium/winsys/r600/drm/r600_state.c | 133 ++++++++++++++++++++------ src/gallium/winsys/r600/drm/r600_states.h | 144 +++++++---------------------- src/gallium/winsys/r600/drm/radeon.c | 44 --------- src/gallium/winsys/r600/drm/radeon_ctx.c | 6 +- src/gallium/winsys/r600/drm/radeon_draw.c | 11 ++- src/gallium/winsys/r600/drm/radeon_priv.h | 32 +++---- src/gallium/winsys/r600/drm/radeon_state.c | 58 +++++++++--- 15 files changed, 295 insertions(+), 335 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/r600_blit.c b/src/gallium/drivers/r600/r600_blit.c index 72175fbbd5..6b8487695c 100644 --- a/src/gallium/drivers/r600/r600_blit.c +++ b/src/gallium/drivers/r600/r600_blit.c @@ -190,7 +190,7 @@ static int r600_blit_state_vs_resources(struct r600_screen *rscreen, struct r600 memcpy(bo->data, vbo, 128); radeon_bo_unmap(rscreen->rw, bo); - rstate = radeon_state(rscreen->rw, R600_VS_RESOURCE_TYPE, R600_VS_RESOURCE + 0); + rstate = radeon_state_shader(rscreen->rw, R600_STATE_RESOURCE, 0, R600_SHADER_VS); if (rstate == NULL) { radeon_bo_decref(rscreen->rw, bo); return -ENOMEM; @@ -215,7 +215,7 @@ static int r600_blit_state_vs_resources(struct r600_screen *rscreen, struct r600 } bstates->vs_resource0 = rstate; - rstate = radeon_state(rscreen->rw, R600_VS_RESOURCE_TYPE, R600_VS_RESOURCE + 1); + rstate = radeon_state_shader(rscreen->rw, R600_STATE_RESOURCE, 0, R600_SHADER_VS); if (rstate == NULL) { return -ENOMEM; } @@ -303,7 +303,7 @@ static struct radeon_state *r600_blit_state_vs_shader(struct r600_screen *rscree } radeon_bo_unmap(rscreen->rw, bo); - rstate = radeon_state(rscreen->rw, R600_VS_SHADER_TYPE, R600_VS_SHADER); + rstate = radeon_state_shader(rscreen->rw, R600_STATE_SHADER, 0, R600_SHADER_VS); if (rstate == NULL) { radeon_bo_decref(rscreen->rw, bo); return NULL; @@ -374,7 +374,7 @@ static struct radeon_state *r600_blit_state_ps_shader(struct r600_screen *rscree } radeon_bo_unmap(rscreen->rw, bo); - rstate = radeon_state(rscreen->rw, R600_PS_SHADER_TYPE, R600_PS_SHADER); + rstate = radeon_state_shader(rscreen->rw, R600_STATE_SHADER, 0, R600_SHADER_PS); if (rstate == NULL) { radeon_bo_decref(rscreen->rw, bo); return NULL; @@ -403,8 +403,7 @@ static struct radeon_state *r600_blit_state_vgt(struct r600_screen *rscreen) { struct radeon_state *rstate; - rstate = radeon_state(rscreen->rw, R600_VGT_TYPE, R600_VGT); - if (rstate == NULL) + rstate = radeon_state(rscreen->rw, R600_STATE_VGT, 0); if (rstate == NULL) return NULL; /* set states (most default value are 0 and struct already @@ -425,7 +424,7 @@ static struct radeon_state *r600_blit_state_draw(struct r600_screen *rscreen) { struct radeon_state *rstate; - rstate = radeon_state(rscreen->rw, R600_DRAW_TYPE, R600_DRAW); + rstate = radeon_state(rscreen->rw, R600_STATE_DRAW, 0); if (rstate == NULL) return NULL; @@ -448,7 +447,7 @@ static struct radeon_state *r600_blit_state_vs_constant(struct r600_screen *rscr { struct radeon_state *rstate; - rstate = radeon_state(rscreen->rw, R600_VS_CONSTANT_TYPE, R600_VS_CONSTANT + id); + rstate = radeon_state_shader(rscreen->rw, R600_STATE_CONSTANT, id, R600_SHADER_VS); if (rstate == NULL) return NULL; @@ -471,7 +470,7 @@ static struct radeon_state *r600_blit_state_rasterizer(struct r600_screen *rscre { struct radeon_state *rstate; - rstate = radeon_state(rscreen->rw, R600_RASTERIZER_TYPE, R600_RASTERIZER); + rstate = radeon_state(rscreen->rw, R600_STATE_RASTERIZER, 0); if (rstate == NULL) return NULL; @@ -500,7 +499,7 @@ static struct radeon_state *r600_blit_state_dsa(struct r600_screen *rscreen) { struct radeon_state *rstate; - rstate = radeon_state(rscreen->rw, R600_DSA_TYPE, R600_DSA); + rstate = radeon_state(rscreen->rw, R600_STATE_DSA, 0); if (rstate == NULL) return NULL; @@ -524,7 +523,7 @@ static struct radeon_state *r600_blit_state_blend(struct r600_screen *rscreen) { struct radeon_state *rstate; - rstate = radeon_state(rscreen->rw, R600_BLEND_TYPE, R600_BLEND); + rstate = radeon_state(rscreen->rw, R600_STATE_BLEND, 0); if (rstate == NULL) return NULL; @@ -543,7 +542,7 @@ static struct radeon_state *r600_blit_state_cb_cntl(struct r600_screen *rscreen) { struct radeon_state *rstate; - rstate = radeon_state(rscreen->rw, R600_CB_CNTL_TYPE, R600_CB_CNTL); + rstate = radeon_state(rscreen->rw, R600_STATE_CB_CNTL, 0); if (rstate == NULL) return NULL; diff --git a/src/gallium/drivers/r600/r600_context.c b/src/gallium/drivers/r600/r600_context.c index 9af28356c5..db170122dd 100644 --- a/src/gallium/drivers/r600/r600_context.c +++ b/src/gallium/drivers/r600/r600_context.c @@ -218,7 +218,7 @@ static void r600_init_config(struct r600_context *rctx) num_es_stack_entries = 0; break; } - rctx->hw_states.config = radeon_state(rctx->rw, R600_CONFIG_TYPE, R600_CONFIG); + rctx->hw_states.config = radeon_state(rctx->rw, R600_STATE_CONFIG, 0); rctx->hw_states.config->states[R600_CONFIG__SQ_CONFIG] = 0x00000000; switch (family) { diff --git a/src/gallium/drivers/r600/r600_draw.c b/src/gallium/drivers/r600/r600_draw.c index 1c426f755d..88f93bca7b 100644 --- a/src/gallium/drivers/r600/r600_draw.c +++ b/src/gallium/drivers/r600/r600_draw.c @@ -101,7 +101,7 @@ static int r600_draw_common(struct r600_draw *draw) rbuffer = (struct r600_resource*)vertex_buffer->buffer; offset = rctx->vertex_elements->elements[i].src_offset + vertex_buffer->buffer_offset; format = r600_translate_colorformat(rctx->vertex_elements->elements[i].src_format); - vs_resource = radeon_state(rscreen->rw, R600_VS_RESOURCE_TYPE, R600_VS_RESOURCE + i); + vs_resource = radeon_state_shader(rscreen->rw, R600_STATE_RESOURCE, i, R600_SHADER_VS); if (vs_resource == NULL) return -ENOMEM; vs_resource->bo[0] = radeon_bo_incref(rscreen->rw, rbuffer->bo); @@ -121,7 +121,7 @@ static int r600_draw_common(struct r600_draw *draw) return r; } /* FIXME start need to change winsys */ - draw->draw = radeon_state(rscreen->rw, R600_DRAW_TYPE, R600_DRAW); + draw->draw = radeon_state(rscreen->rw, R600_STATE_DRAW, 0); if (draw->draw == NULL) return -ENOMEM; draw->draw->states[R600_DRAW__VGT_NUM_INDICES] = draw->count; @@ -136,7 +136,7 @@ static int r600_draw_common(struct r600_draw *draw) r = radeon_draw_set_new(rctx->draw, draw->draw); if (r) return r; - draw->vgt = radeon_state(rscreen->rw, R600_VGT_TYPE, R600_VGT); + draw->vgt = radeon_state(rscreen->rw, R600_STATE_VGT, 0); if (draw->vgt == NULL) return -ENOMEM; draw->vgt->states[R600_VGT__VGT_PRIMITIVE_TYPE] = prim; @@ -169,6 +169,7 @@ void r600_draw_vbo(struct pipe_context *ctx, const struct pipe_draw_info *info) { struct r600_context *rctx = r600_context(ctx); struct r600_draw draw; + int r; assert(info->index_bias == 0); @@ -189,5 +190,7 @@ void r600_draw_vbo(struct pipe_context *ctx, const struct pipe_draw_info *info) draw.index_size = 0; draw.index_buffer = NULL; } - r600_draw_common(&draw); + r = r600_draw_common(&draw); + if (r) + fprintf(stderr,"draw common failed %d\n", r); } diff --git a/src/gallium/drivers/r600/r600_query.c b/src/gallium/drivers/r600/r600_query.c index 5929606cd2..af857101e3 100644 --- a/src/gallium/drivers/r600/r600_query.c +++ b/src/gallium/drivers/r600/r600_query.c @@ -36,7 +36,7 @@ static struct radeon_state *r600_query_begin(struct r600_context *rctx, struct r struct r600_screen *rscreen = rctx->screen; struct radeon_state *rstate; - rstate = radeon_state(rscreen->rw, R600_QUERY_BEGIN_TYPE, R600_QUERY_BEGIN); + rstate = radeon_state(rscreen->rw, R600_STATE_QUERY_BEGIN, 0); if (rstate == NULL) return NULL; rstate->states[R600_QUERY__OFFSET] = rquery->num_results; @@ -55,7 +55,7 @@ static struct radeon_state *r600_query_end(struct r600_context *rctx, struct r60 struct r600_screen *rscreen = rctx->screen; struct radeon_state *rstate; - rstate = radeon_state(rscreen->rw, R600_QUERY_END_TYPE, R600_QUERY_END); + rstate = radeon_state(rscreen->rw, R600_STATE_QUERY_END, 0); if (rstate == NULL) return NULL; rstate->states[R600_QUERY__OFFSET] = rquery->num_results + 8; diff --git a/src/gallium/drivers/r600/r600_shader.c b/src/gallium/drivers/r600/r600_shader.c index 23b3eabf52..652d4035cc 100644 --- a/src/gallium/drivers/r600/r600_shader.c +++ b/src/gallium/drivers/r600/r600_shader.c @@ -134,7 +134,7 @@ static int r600_pipe_shader_vs(struct pipe_context *ctx, struct r600_context_sta unsigned i, tmp; rpshader->rstate = radeon_state_decref(rpshader->rstate); - state = radeon_state(rscreen->rw, R600_VS_SHADER_TYPE, R600_VS_SHADER); + state = radeon_state_shader(rscreen->rw, R600_STATE_SHADER, 0, R600_SHADER_VS); if (state == NULL) return -ENOMEM; for (i = 0; i < 10; i++) { @@ -168,7 +168,7 @@ static int r600_pipe_shader_ps(struct pipe_context *ctx, struct r600_context_sta rasterizer = &rctx->rasterizer->state.rasterizer; rpshader->rstate = radeon_state_decref(rpshader->rstate); - state = radeon_state(rscreen->rw, R600_PS_SHADER_TYPE, R600_PS_SHADER); + state = radeon_state_shader(rscreen->rw, R600_STATE_SHADER, 0, R600_SHADER_PS); if (state == NULL) return -ENOMEM; for (i = 0; i < rshader->ninput; i++) { diff --git a/src/gallium/drivers/r600/r600_state.c b/src/gallium/drivers/r600/r600_state.c index 441be8fd6d..b5db848e35 100644 --- a/src/gallium/drivers/r600/r600_state.c +++ b/src/gallium/drivers/r600/r600_state.c @@ -283,19 +283,19 @@ static void r600_set_constant_buffer(struct pipe_context *ctx, { struct r600_screen *rscreen = r600_screen(ctx->screen); struct r600_context *rctx = r600_context(ctx); - unsigned nconstant = 0, i, type, id; + unsigned nconstant = 0, i, type, shader_class; struct radeon_state *rstate; struct pipe_transfer *transfer; u32 *ptr; + type = R600_STATE_CONSTANT; + switch (shader) { case PIPE_SHADER_VERTEX: - id = R600_VS_CONSTANT; - type = R600_VS_CONSTANT_TYPE; + shader_class = R600_SHADER_VS; break; case PIPE_SHADER_FRAGMENT: - id = R600_PS_CONSTANT; - type = R600_PS_CONSTANT_TYPE; + shader_class = R600_SHADER_PS; break; default: R600_ERR("unsupported %d\n", shader); @@ -307,7 +307,7 @@ static void r600_set_constant_buffer(struct pipe_context *ctx, if (ptr == NULL) return; for (i = 0; i < nconstant; i++) { - rstate = radeon_state(rscreen->rw, type, id + i); + rstate = radeon_state_shader(rscreen->rw, type, i, shader_class); if (rstate == NULL) return; rstate->states[R600_PS_CONSTANT__SQ_ALU_CONSTANT0_0] = ptr[i * 4 + 0]; @@ -622,7 +622,7 @@ static struct radeon_state *r600_blend(struct r600_context *rctx) const struct pipe_blend_state *state = &rctx->blend->state.blend; int i; - rstate = radeon_state(rscreen->rw, R600_BLEND_TYPE, R600_BLEND); + rstate = radeon_state(rscreen->rw, R600_STATE_BLEND, 0); if (rstate == NULL) return NULL; rstate->states[R600_BLEND__CB_BLEND_RED] = fui(rctx->blend_color.color[0]); @@ -681,7 +681,7 @@ static struct radeon_state *r600_ucp(struct r600_context *rctx, int clip) struct radeon_state *rstate; const struct pipe_clip_state *state = &rctx->clip->state.clip; - rstate = radeon_state(rscreen->rw, R600_CLIP_TYPE, R600_CLIP + clip); + rstate = radeon_state(rscreen->rw, R600_STATE_CLIP, clip); if (rstate == NULL) return NULL; @@ -711,7 +711,7 @@ static struct radeon_state *r600_cb(struct r600_context *rctx, int cb) unsigned format, swap, ntype; const struct util_format_description *desc; - rstate = radeon_state(rscreen->rw, R600_CB0_TYPE + cb, R600_CB0 + cb); + rstate = radeon_state(rscreen->rw, R600_STATE_CB0 + cb, 0); if (rstate == NULL) return NULL; rtex = (struct r600_resource_texture*)state->cbufs[cb]->texture; @@ -768,7 +768,7 @@ static struct radeon_state *r600_db(struct r600_context *rctx) if (state->zsbuf == NULL) return NULL; - rstate = radeon_state(rscreen->rw, R600_DB_TYPE, R600_DB); + rstate = radeon_state(rscreen->rw, R600_STATE_DB, 0); if (rstate == NULL) return NULL; @@ -844,7 +844,7 @@ static struct radeon_state *r600_rasterizer(struct r600_context *rctx) prov_vtx = 0; rctx->flat_shade = state->flatshade; - rstate = radeon_state(rscreen->rw, R600_RASTERIZER_TYPE, R600_RASTERIZER); + rstate = radeon_state(rscreen->rw, R600_STATE_RASTERIZER, 0); if (rstate == NULL) return NULL; rstate->states[R600_RASTERIZER__SPI_INTERP_CONTROL_0] = 0x00000001; @@ -925,7 +925,7 @@ static struct radeon_state *r600_scissor(struct r600_context *rctx) } tl = S_028240_TL_X(minx) | S_028240_TL_Y(miny) | S_028240_WINDOW_OFFSET_DISABLE(1); br = S_028244_BR_X(maxx) | S_028244_BR_Y(maxy); - rstate = radeon_state(rscreen->rw, R600_SCISSOR_TYPE, R600_SCISSOR); + rstate = radeon_state(rscreen->rw, R600_STATE_SCISSOR, 0); if (rstate == NULL) return NULL; rstate->states[R600_SCISSOR__PA_SC_SCREEN_SCISSOR_TL] = tl; @@ -960,7 +960,7 @@ static struct radeon_state *r600_viewport(struct r600_context *rctx) struct r600_screen *rscreen = rctx->screen; struct radeon_state *rstate; - rstate = radeon_state(rscreen->rw, R600_VIEWPORT_TYPE, R600_VIEWPORT); + rstate = radeon_state(rscreen->rw, R600_STATE_VIEWPORT, 0); if (rstate == NULL) return NULL; rstate->states[R600_VIEWPORT__PA_SC_VPORT_ZMIN_0] = 0x00000000; @@ -993,7 +993,7 @@ static struct radeon_state *r600_dsa(struct r600_context *rctx) if (rctx->ps_shader == NULL) { return NULL; } - rstate = radeon_state(rscreen->rw, R600_DSA_TYPE, R600_DSA); + rstate = radeon_state(rscreen->rw, R600_STATE_DSA, 0); if (rstate == NULL) return NULL; @@ -1147,7 +1147,7 @@ static struct radeon_state *r600_sampler(struct r600_context *rctx, struct r600_screen *rscreen = rctx->screen; struct radeon_state *rstate; - rstate = radeon_state(rscreen->rw, R600_PS_SAMPLER_TYPE, id); + rstate = radeon_state_shader(rscreen->rw, R600_STATE_SAMPLER, id, R600_SHADER_PS); if (rstate == NULL) return NULL; rstate->states[R600_PS_SAMPLER__SQ_TEX_SAMPLER_WORD0_0] = @@ -1248,7 +1248,7 @@ static struct radeon_state *r600_resource(struct pipe_context *ctx, R600_ERR("unknow format %d\n", view->texture->format); return NULL; } - rstate = radeon_state(rscreen->rw, R600_PS_RESOURCE_TYPE, id); + rstate = radeon_state_shader(rscreen->rw, R600_STATE_RESOURCE, id, R600_SHADER_PS); if (rstate == NULL) { return NULL; } @@ -1344,7 +1344,7 @@ static struct radeon_state *r600_cb_cntl(struct r600_context *rctx) target_mask |= (pbs->rt[0].colormask << (4 * i)); } } - rstate = radeon_state(rscreen->rw, R600_CB_CNTL_TYPE, R600_CB_CNTL); + rstate = radeon_state(rscreen->rw, R600_STATE_CB_CNTL, 0); rstate->states[R600_CB_CNTL__CB_SHADER_MASK] = shader_mask; rstate->states[R600_CB_CNTL__CB_TARGET_MASK] = target_mask; rstate->states[R600_CB_CNTL__CB_COLOR_CONTROL] = color_control; @@ -1421,7 +1421,7 @@ int r600_context_hw_states(struct pipe_context *ctx) if (rctx->ps_sampler[i]) { rctx->hw_states.ps_sampler[i] = r600_sampler(rctx, &rctx->ps_sampler[i]->state.sampler, - R600_PS_SAMPLER + i); + i); } } rctx->hw_states.ps_nsampler = rctx->ps_nsampler; @@ -1429,7 +1429,7 @@ int r600_context_hw_states(struct pipe_context *ctx) if (rctx->ps_sampler_view[i]) { rctx->hw_states.ps_resource[i] = r600_resource(ctx, &rctx->ps_sampler_view[i]->state.sampler_view, - R600_PS_RESOURCE + i); + i); } } rctx->hw_states.ps_nresource = rctx->ps_nsampler_view; diff --git a/src/gallium/drivers/r600/r600_texture.c b/src/gallium/drivers/r600/r600_texture.c index fb84ed9cfe..77d627cdc8 100644 --- a/src/gallium/drivers/r600/r600_texture.c +++ b/src/gallium/drivers/r600/r600_texture.c @@ -663,7 +663,7 @@ static struct radeon_state *r600_texture_state_scissor(struct r600_screen *rscre { struct radeon_state *rstate; - rstate = radeon_state(rscreen->rw, R600_SCISSOR_TYPE, R600_SCISSOR); + rstate = radeon_state(rscreen->rw, R600_STATE_SCISSOR, 0); if (rstate == NULL) return NULL; @@ -707,7 +707,7 @@ static struct radeon_state *r600_texture_state_cb0(struct r600_screen *rscreen, unsigned format, swap, ntype; const struct util_format_description *desc; - rstate = radeon_state(rscreen->rw, R600_CB0_TYPE, R600_CB0); + rstate = radeon_state(rscreen->rw, R600_STATE_CB0, 0); if (rstate == NULL) return NULL; rbuffer = &rtexture->resource; @@ -766,7 +766,7 @@ static struct radeon_state *r600_texture_state_db(struct r600_screen *rscreen, struct r600_resource *rbuffer; unsigned pitch, slice, format; - rstate = radeon_state(rscreen->rw, R600_DB_TYPE, R600_DB); + rstate = radeon_state(rscreen->rw, R600_STATE_DB, 0); if (rstate == NULL) return NULL; rbuffer = &rtexture->resource; @@ -815,7 +815,7 @@ static struct radeon_state *r600_texture_state_viewport(struct r600_screen *rscr { struct radeon_state *rstate; - rstate = radeon_state(rscreen->rw, R600_VIEWPORT_TYPE, R600_VIEWPORT); + rstate = radeon_state(rscreen->rw, R600_STATE_VIEWPORT, 0); if (rstate == NULL) return NULL; diff --git a/src/gallium/drivers/r600/radeon.h b/src/gallium/drivers/r600/radeon.h index b2cc74f696..046c264c04 100644 --- a/src/gallium/drivers/r600/radeon.h +++ b/src/gallium/drivers/r600/radeon.h @@ -98,14 +98,16 @@ struct radeon_bo *radeon_bo_incref(struct radeon *radeon, struct radeon_bo *bo); struct radeon_bo *radeon_bo_decref(struct radeon *radeon, struct radeon_bo *bo); int radeon_bo_wait(struct radeon *radeon, struct radeon_bo *bo); +struct radeon_stype_info; /* * states functions */ struct radeon_state { struct radeon *radeon; unsigned refcount; - unsigned type; + struct radeon_stype_info *stype; unsigned id; + unsigned shader_index; unsigned nstates; u32 *states; unsigned npm4; @@ -124,6 +126,7 @@ struct radeon_state { }; struct radeon_state *radeon_state(struct radeon *radeon, u32 type, u32 id); +struct radeon_state *radeon_state_shader(struct radeon *radeon, u32 type, u32 id, u32 shader_class); struct radeon_state *radeon_state_incref(struct radeon_state *state); struct radeon_state *radeon_state_decref(struct radeon_state *state); int radeon_state_pm4(struct radeon_state *state); @@ -192,79 +195,42 @@ struct radeon_ctx { * R600/R700 */ -#define R600_NSTATE 1288 -#define R600_NTYPE 35 +enum r600_stype { + R600_STATE_CONFIG, + R600_STATE_CB_CNTL, + R600_STATE_RASTERIZER, + R600_STATE_VIEWPORT, + R600_STATE_SCISSOR, + R600_STATE_BLEND, + R600_STATE_DSA, + R600_STATE_SHADER, /* has PS,VS,GS,FS variants */ + R600_STATE_CONSTANT, /* has PS,VS,GS,FS variants */ + R600_STATE_RESOURCE, /* has PS,VS,GS,FS variants */ + R600_STATE_SAMPLER, /* has PS,VS,GS,FS variants */ + R600_STATE_SAMPLER_BORDER, /* has PS,VS,GS,FS variants */ + R600_STATE_CB0, + R600_STATE_CB1, + R600_STATE_CB2, + R600_STATE_CB3, + R600_STATE_CB4, + R600_STATE_CB5, + R600_STATE_CB6, + R600_STATE_CB7, + R600_STATE_DB, + R600_STATE_QUERY_BEGIN, + R600_STATE_QUERY_END, + R600_STATE_CLIP, + R600_STATE_VGT, + R600_STATE_DRAW, +}; -#define R600_CONFIG 0 -#define R600_CONFIG_TYPE 0 -#define R600_CB_CNTL 1 -#define R600_CB_CNTL_TYPE 1 -#define R600_RASTERIZER 2 -#define R600_RASTERIZER_TYPE 2 -#define R600_VIEWPORT 3 -#define R600_VIEWPORT_TYPE 3 -#define R600_SCISSOR 4 -#define R600_SCISSOR_TYPE 4 -#define R600_BLEND 5 -#define R600_BLEND_TYPE 5 -#define R600_DSA 6 -#define R600_DSA_TYPE 6 -#define R600_VS_SHADER 7 -#define R600_VS_SHADER_TYPE 7 -#define R600_PS_SHADER 8 -#define R600_PS_SHADER_TYPE 8 -#define R600_PS_CONSTANT 9 -#define R600_PS_CONSTANT_TYPE 9 -#define R600_VS_CONSTANT 265 -#define R600_VS_CONSTANT_TYPE 10 -#define R600_PS_RESOURCE 521 -#define R600_PS_RESOURCE_TYPE 11 -#define R600_VS_RESOURCE 681 -#define R600_VS_RESOURCE_TYPE 12 -#define R600_FS_RESOURCE 841 -#define R600_FS_RESOURCE_TYPE 13 -#define R600_GS_RESOURCE 1001 -#define R600_GS_RESOURCE_TYPE 14 -#define R600_PS_SAMPLER 1161 -#define R600_PS_SAMPLER_TYPE 15 -#define R600_VS_SAMPLER 1179 -#define R600_VS_SAMPLER_TYPE 16 -#define R600_GS_SAMPLER 1197 -#define R600_GS_SAMPLER_TYPE 17 -#define R600_PS_SAMPLER_BORDER 1215 -#define R600_PS_SAMPLER_BORDER_TYPE 18 -#define R600_VS_SAMPLER_BORDER 1233 -#define R600_VS_SAMPLER_BORDER_TYPE 19 -#define R600_GS_SAMPLER_BORDER 1251 -#define R600_GS_SAMPLER_BORDER_TYPE 20 -#define R600_CB0 1269 -#define R600_CB0_TYPE 21 -#define R600_CB1 1270 -#define R600_CB1_TYPE 22 -#define R600_CB2 1271 -#define R600_CB2_TYPE 23 -#define R600_CB3 1272 -#define R600_CB3_TYPE 24 -#define R600_CB4 1273 -#define R600_CB4_TYPE 25 -#define R600_CB5 1274 -#define R600_CB5_TYPE 26 -#define R600_CB6 1275 -#define R600_CB6_TYPE 27 -#define R600_CB7 1276 -#define R600_CB7_TYPE 28 -#define R600_QUERY_BEGIN 1277 -#define R600_QUERY_BEGIN_TYPE 29 -#define R600_QUERY_END 1278 -#define R600_QUERY_END_TYPE 30 -#define R600_DB 1279 -#define R600_DB_TYPE 31 -#define R600_CLIP 1280 -#define R600_CLIP_TYPE 32 -#define R600_VGT 1286 -#define R600_VGT_TYPE 33 -#define R600_DRAW 1287 -#define R600_DRAW_TYPE 34 +enum { + R600_SHADER_PS = 1, + R600_SHADER_VS, + R600_SHADER_GS, + R600_SHADER_FS, + R600_SHADER_MAX = R600_SHADER_FS, +}; /* R600_CONFIG */ #define R600_CONFIG__SQ_CONFIG 0 diff --git a/src/gallium/winsys/r600/drm/r600_state.c b/src/gallium/winsys/r600/drm/r600_state.c index 9b7c11bdc0..e3d0116a2d 100644 --- a/src/gallium/winsys/r600/drm/r600_state.c +++ b/src/gallium/winsys/r600/drm/r600_state.c @@ -30,6 +30,8 @@ #include "radeon_priv.h" #include "r600d.h" +#include "util/u_memory.h" + static int r600_state_pm4_resource(struct radeon_state *state); static int r600_state_pm4_cb0(struct radeon_state *state); static int r600_state_pm4_vgt(struct radeon_state *state); @@ -46,18 +48,61 @@ static int r700_state_pm4_db(struct radeon_state *state); #include "r600_states.h" + +#define SUB_NONE(param) { { 0, R600_names_##param, (sizeof(R600_names_##param)/sizeof(struct radeon_register)) } } +#define SUB_PS(param) { R600_SHADER_PS, R600_names_##param, (sizeof(R600_names_##param)/sizeof(struct radeon_register)) } +#define SUB_VS(param) { R600_SHADER_VS, R600_names_##param, (sizeof(R600_names_##param)/sizeof(struct radeon_register)) } +#define SUB_GS(param) { R600_SHADER_GS, R600_names_##param, (sizeof(R600_names_##param)/sizeof(struct radeon_register)) } +#define SUB_FS(param) { R600_SHADER_FS, R600_names_##param, (sizeof(R600_names_##param)/sizeof(struct radeon_register)) } + +/* some of these are overriden at runtime for R700 */ +struct radeon_stype_info r600_stypes[] = { + { R600_STATE_CONFIG, 1, 0, r600_state_pm4_config, SUB_NONE(CONFIG), }, + { R600_STATE_CB_CNTL, 1, 0, r600_state_pm4_generic, SUB_NONE(CB_CNTL) }, + { R600_STATE_RASTERIZER, 1, 0, r600_state_pm4_generic, SUB_NONE(RASTERIZER) }, + { R600_STATE_VIEWPORT, 1, 0, r600_state_pm4_generic, SUB_NONE(VIEWPORT) }, + { R600_STATE_SCISSOR, 1, 0, r600_state_pm4_generic, SUB_NONE(SCISSOR) }, + { R600_STATE_BLEND, 1, 0, r600_state_pm4_generic, SUB_NONE(BLEND), }, + { R600_STATE_DSA, 1, 0, r600_state_pm4_generic, SUB_NONE(DSA), }, + { R600_STATE_SHADER, 1, 0, r600_state_pm4_shader, { SUB_PS(PS_SHADER), SUB_VS(VS_SHADER) } }, + { R600_STATE_CONSTANT, 256, 0x10, r600_state_pm4_generic, { SUB_PS(PS_CONSTANT), SUB_VS(VS_CONSTANT) } }, + { R600_STATE_RESOURCE, 160, 0x1c, r600_state_pm4_resource, { SUB_PS(PS_RESOURCE), SUB_VS(VS_RESOURCE), SUB_GS(GS_RESOURCE), SUB_FS(FS_RESOURCE)} }, + { R600_STATE_SAMPLER, 18, 0xc, r600_state_pm4_generic, { SUB_PS(PS_SAMPLER), SUB_VS(VS_SAMPLER), SUB_GS(GS_SAMPLER) } }, + { R600_STATE_SAMPLER_BORDER, 18, 0x10, r600_state_pm4_generic, { SUB_PS(PS_SAMPLER_BORDER), SUB_VS(VS_SAMPLER_BORDER), SUB_GS(GS_SAMPLER_BORDER) } }, + { R600_STATE_CB0, 1, 0, r600_state_pm4_cb0, SUB_NONE(CB0) }, + { R600_STATE_CB1, 1, 0, r600_state_pm4_cb0, SUB_NONE(CB1) }, + { R600_STATE_CB2, 1, 0, r600_state_pm4_cb0, SUB_NONE(CB2) }, + { R600_STATE_CB3, 1, 0, r600_state_pm4_cb0, SUB_NONE(CB3) }, + { R600_STATE_CB4, 1, 0, r600_state_pm4_cb0, SUB_NONE(CB4) }, + { R600_STATE_CB5, 1, 0, r600_state_pm4_cb0, SUB_NONE(CB5) }, + { R600_STATE_CB6, 1, 0, r600_state_pm4_cb0, SUB_NONE(CB6) }, + { R600_STATE_CB7, 1, 0, r600_state_pm4_cb0, SUB_NONE(CB7) }, + { R600_STATE_QUERY_BEGIN, 1, 0, r600_state_pm4_query_begin, SUB_NONE(VGT_EVENT) }, + { R600_STATE_QUERY_END, 1, 0, r600_state_pm4_query_end, SUB_NONE(VGT_EVENT) }, + { R600_STATE_DB, 1, 0, r600_state_pm4_db, SUB_NONE(DB) }, + { R600_STATE_CLIP, 6, 0, r600_state_pm4_generic, SUB_NONE(UCP) }, + { R600_STATE_VGT, 1, 0, r600_state_pm4_vgt, SUB_NONE(VGT) }, + { R600_STATE_DRAW, 1, 0, r600_state_pm4_draw, SUB_NONE(DRAW) }, +}; +#define STYPES_SIZE Elements(r600_stypes) + +static const struct radeon_register *get_regs(struct radeon_state *state) +{ + return state->stype->reginfo[state->shader_index].regs; +} + /* * r600/r700 state functions */ static int r600_state_pm4_bytecode(struct radeon_state *state, unsigned offset, unsigned id, unsigned nreg) { - const struct radeon_register *regs = state->radeon->type[state->type].regs; + const struct radeon_register *regs = get_regs(state); unsigned i; int r; if (!offset) { fprintf(stderr, "%s invalid register for state %d %d\n", - __func__, state->type, id); + __func__, state->stype->stype, id); return -EINVAL; } if (offset >= R600_CONFIG_REG_OFFSET && offset < R600_CONFIG_REG_END) { @@ -116,19 +161,18 @@ static int r600_state_pm4_bytecode(struct radeon_state *state, unsigned offset, static int r600_state_pm4_generic(struct radeon_state *state) { - struct radeon *radeon = state->radeon; - unsigned i, offset, nreg, type, coffset, loffset, soffset; + const struct radeon_register *regs = get_regs(state); + unsigned i, offset, nreg, coffset, loffset, soffset; unsigned start; int r; if (!state->nstates) return 0; - type = state->type; - soffset = (state->id - radeon->type[type].id) * radeon->type[type].stride; - offset = loffset = radeon->type[type].regs[0].offset + soffset; + soffset = state->id * state->stype->stride; + offset = loffset = regs[0].offset + soffset; start = 0; for (i = 1, nreg = 1; i < state->nstates; i++) { - coffset = radeon->type[type].regs[i].offset + soffset; + coffset = regs[i].offset + soffset; if (coffset == (loffset + 4)) { nreg++; loffset = coffset; @@ -358,8 +402,9 @@ static int r600_state_pm4_resource(struct radeon_state *state) { u32 flags, type, nbo, offset, soffset; int r; + const struct radeon_register *regs = get_regs(state); - soffset = (state->id - state->radeon->type[state->type].id) * state->radeon->type[state->type].stride; + soffset = state->id * state->stype->stride; type = G_038018_TYPE(state->states[6]); switch (type) { case 2: @@ -378,7 +423,7 @@ static int r600_state_pm4_resource(struct radeon_state *state) return -EINVAL; } r600_state_pm4_with_flush(state, flags); - offset = state->radeon->type[state->type].regs[0].offset + soffset; + offset = regs[0].offset + soffset; state->pm4[state->cpm4++] = PKT3(PKT3_SET_RESOURCE, 7); state->pm4[state->cpm4++] = (offset - R_038000_SQ_TEX_RESOURCE_WORD0_0) >> 2; state->pm4[state->cpm4++] = state->states[0]; @@ -403,33 +448,63 @@ static int r600_state_pm4_resource(struct radeon_state *state) return 0; } -int r600_init(struct radeon *radeon) + +static void r600_modify_type_array(struct radeon *radeon) { + int i; switch (radeon->family) { - case CHIP_R600: - case CHIP_RV610: - case CHIP_RV630: - case CHIP_RV670: - case CHIP_RV620: - case CHIP_RV635: - case CHIP_RS780: - case CHIP_RS880: - radeon->ntype = R600_NTYPE; - radeon->nstate = R600_NSTATE; - radeon->type = R600_types; - break; case CHIP_RV770: case CHIP_RV730: case CHIP_RV710: case CHIP_RV740: - radeon->ntype = R600_NTYPE; - radeon->nstate = R600_NSTATE; - radeon->type = R700_types; break; default: - fprintf(stderr, "%s unknown or unsupported chipset 0x%04X\n", - __func__, radeon->device); - return -EINVAL; + return; + } + + /* r700 needs some mods */ + for (i = 0; i < radeon->nstype; i++) { + struct radeon_stype_info *info = &radeon->stype[i]; + + switch(info->stype) { + case R600_STATE_CONFIG: + info->pm4 = r700_state_pm4_config; + break; + case R600_STATE_CB0: + info->pm4 = r700_state_pm4_cb0; + break; + case R600_STATE_DB: + info->pm4 = r700_state_pm4_db; + }; } +} + +static void r600_build_types_array(struct radeon *radeon) +{ + int i, j; + int id = 0; + + for (i = 0; i < STYPES_SIZE; i++) { + r600_stypes[i].base_id = id; + r600_stypes[i].npm4 = 128; + if (r600_stypes[i].reginfo[0].shader_type == 0) { + id += r600_stypes[i].num; + } else { + for (j = 0; j < R600_SHADER_MAX; j++) { + if (r600_stypes[i].reginfo[j].shader_type) + id += r600_stypes[i].num; + } + } + } + radeon->nstate = id; + radeon->stype = r600_stypes; + radeon->nstype = STYPES_SIZE; + + r600_modify_type_array(radeon); +} + +int r600_init(struct radeon *radeon) +{ + r600_build_types_array(radeon); return 0; } diff --git a/src/gallium/winsys/r600/drm/r600_states.h b/src/gallium/winsys/r600/drm/r600_states.h index b5365e4275..51b69b9220 100644 --- a/src/gallium/winsys/r600/drm/r600_states.h +++ b/src/gallium/winsys/r600/drm/r600_states.h @@ -17,7 +17,7 @@ #ifndef R600_STATES_H #define R600_STATES_H -static const struct radeon_register R600_CONFIG_names[] = { +static const struct radeon_register R600_names_CONFIG[] = { {0x00008C00, 0, 0, "SQ_CONFIG"}, {0x00008C04, 0, 0, "SQ_GPR_RESOURCE_MGMT_1"}, {0x00008C08, 0, 0, "SQ_GPR_RESOURCE_MGMT_2"}, @@ -61,7 +61,7 @@ static const struct radeon_register R600_CONFIG_names[] = { {0x00028B20, 0, 0, "VGT_STRMOUT_BUFFER_EN"}, }; -static const struct radeon_register R600_CB_CNTL_names[] = { +static const struct radeon_register R600_names_CB_CNTL[] = { {0x00028120, 0, 0, "CB_CLEAR_RED"}, {0x00028124, 0, 0, "CB_CLEAR_GREEN"}, {0x00028128, 0, 0, "CB_CLEAR_BLUE"}, @@ -82,7 +82,7 @@ static const struct radeon_register R600_CB_CNTL_names[] = { {0x00028C48, 0, 0, "PA_SC_AA_MASK"}, }; -static const struct radeon_register R600_RASTERIZER_names[] = { +static const struct radeon_register R600_names_RASTERIZER[] = { {0x000286D4, 0, 0, "SPI_INTERP_CONTROL_0"}, {0x00028810, 0, 0, "PA_CL_CLIP_CNTL"}, {0x00028814, 0, 0, "PA_SU_SC_MODE_CNTL"}, @@ -106,7 +106,7 @@ static const struct radeon_register R600_RASTERIZER_names[] = { {0x00028E0C, 0, 0, "PA_SU_POLY_OFFSET_BACK_OFFSET"}, }; -static const struct radeon_register R600_VIEWPORT_names[] = { +static const struct radeon_register R600_names_VIEWPORT[] = { {0x000282D0, 0, 0, "PA_SC_VPORT_ZMIN_0"}, {0x000282D4, 0, 0, "PA_SC_VPORT_ZMAX_0"}, {0x0002843C, 0, 0, "PA_CL_VPORT_XSCALE_0"}, @@ -118,7 +118,7 @@ static const struct radeon_register R600_VIEWPORT_names[] = { {0x00028818, 0, 0, "PA_CL_VTE_CNTL"}, }; -static const struct radeon_register R600_SCISSOR_names[] = { +static const struct radeon_register R600_names_SCISSOR[] = { {0x00028030, 0, 0, "PA_SC_SCREEN_SCISSOR_TL"}, {0x00028034, 0, 0, "PA_SC_SCREEN_SCISSOR_BR"}, {0x00028200, 0, 0, "PA_SC_WINDOW_OFFSET"}, @@ -140,7 +140,7 @@ static const struct radeon_register R600_SCISSOR_names[] = { {0x00028254, 0, 0, "PA_SC_VPORT_SCISSOR_0_BR"}, }; -static const struct radeon_register R600_BLEND_names[] = { +static const struct radeon_register R600_names_BLEND[] = { {0x00028414, 0, 0, "CB_BLEND_RED"}, {0x00028418, 0, 0, "CB_BLEND_GREEN"}, {0x0002841C, 0, 0, "CB_BLEND_BLUE"}, @@ -156,7 +156,7 @@ static const struct radeon_register R600_BLEND_names[] = { {0x00028804, 0, 0, "CB_BLEND_CONTROL"}, }; -static const struct radeon_register R600_DSA_names[] = { +static const struct radeon_register R600_names_DSA[] = { {0x00028028, 0, 0, "DB_STENCIL_CLEAR"}, {0x0002802C, 0, 0, "DB_DEPTH_CLEAR"}, {0x00028410, 0, 0, "SX_ALPHA_TEST_CONTROL"}, @@ -175,7 +175,7 @@ static const struct radeon_register R600_DSA_names[] = { {0x00028D44, 0, 0, "DB_ALPHA_TO_MASK"}, }; -static const struct radeon_register R600_VS_SHADER_names[] = { +static const struct radeon_register R600_names_VS_SHADER[] = { {0x00028380, 0, 0, "SQ_VTX_SEMANTIC_0"}, {0x00028384, 0, 0, "SQ_VTX_SEMANTIC_1"}, {0x00028388, 0, 0, "SQ_VTX_SEMANTIC_2"}, @@ -227,7 +227,7 @@ static const struct radeon_register R600_VS_SHADER_names[] = { {0x000288DC, 0, 0, "SQ_PGM_CF_OFFSET_FS"}, }; -static const struct radeon_register R600_PS_SHADER_names[] = { +static const struct radeon_register R600_names_PS_SHADER[] = { {0x00028644, 0, 0, "SPI_PS_INPUT_CNTL_0"}, {0x00028648, 0, 0, "SPI_PS_INPUT_CNTL_1"}, {0x0002864C, 0, 0, "SPI_PS_INPUT_CNTL_2"}, @@ -269,28 +269,28 @@ static const struct radeon_register R600_PS_SHADER_names[] = { {0x000288CC, 0, 0, "SQ_PGM_CF_OFFSET_PS"}, }; -static const struct radeon_register R600_PS_CONSTANT_names[] = { +static const struct radeon_register R600_names_PS_CONSTANT[] = { {0x00030000, 0, 0, "SQ_ALU_CONSTANT0_0"}, {0x00030004, 0, 0, "SQ_ALU_CONSTANT1_0"}, {0x00030008, 0, 0, "SQ_ALU_CONSTANT2_0"}, {0x0003000C, 0, 0, "SQ_ALU_CONSTANT3_0"}, }; -static const struct radeon_register R600_VS_CONSTANT_names[] = { +static const struct radeon_register R600_names_VS_CONSTANT[] = { {0x00031000, 0, 0, "SQ_ALU_CONSTANT0_256"}, {0x00031004, 0, 0, "SQ_ALU_CONSTANT1_256"}, {0x00031008, 0, 0, "SQ_ALU_CONSTANT2_256"}, {0x0003100C, 0, 0, "SQ_ALU_CONSTANT3_256"}, }; -static const struct radeon_register R600_UCP_names[] = { +static const struct radeon_register R600_names_UCP[] = { {0x00028e20, 0, 0, "PA_CL_UCP0_X"}, {0x00028e24, 0, 0, "PA_CL_UCP0_Y"}, {0x00028e28, 0, 0, "PA_CL_UCP0_Z"}, {0x00028e2c, 0, 0, "PA_CL_UCP0_W"}, }; -static const struct radeon_register R600_PS_RESOURCE_names[] = { +static const struct radeon_register R600_names_PS_RESOURCE[] = { {0x00038000, 0, 0, "RESOURCE0_WORD0"}, {0x00038004, 0, 0, "RESOURCE0_WORD1"}, {0x00038008, 0, 0, "RESOURCE0_WORD2"}, @@ -300,7 +300,7 @@ static const struct radeon_register R600_PS_RESOURCE_names[] = { {0x00038018, 0, 0, "RESOURCE0_WORD6"}, }; -static const struct radeon_register R600_VS_RESOURCE_names[] = { +static const struct radeon_register R600_names_VS_RESOURCE[] = { {0x00039180, 0, 0, "RESOURCE160_WORD0"}, {0x00039184, 0, 0, "RESOURCE160_WORD1"}, {0x00039188, 0, 0, "RESOURCE160_WORD2"}, @@ -310,7 +310,7 @@ static const struct radeon_register R600_VS_RESOURCE_names[] = { {0x00039198, 0, 0, "RESOURCE160_WORD6"}, }; -static const struct radeon_register R600_FS_RESOURCE_names[] = { +static const struct radeon_register R600_names_FS_RESOURCE[] = { {0x0003A300, 0, 0, "RESOURCE320_WORD0"}, {0x0003A304, 0, 0, "RESOURCE320_WORD1"}, {0x0003A308, 0, 0, "RESOURCE320_WORD2"}, @@ -320,7 +320,7 @@ static const struct radeon_register R600_FS_RESOURCE_names[] = { {0x0003A318, 0, 0, "RESOURCE320_WORD6"}, }; -static const struct radeon_register R600_GS_RESOURCE_names[] = { +static const struct radeon_register R600_names_GS_RESOURCE[] = { {0x0003A4C0, 0, 0, "RESOURCE336_WORD0"}, {0x0003A4C4, 0, 0, "RESOURCE336_WORD1"}, {0x0003A4C8, 0, 0, "RESOURCE336_WORD2"}, @@ -330,46 +330,46 @@ static const struct radeon_register R600_GS_RESOURCE_names[] = { {0x0003A4D8, 0, 0, "RESOURCE336_WORD6"}, }; -static const struct radeon_register R600_PS_SAMPLER_names[] = { +static const struct radeon_register R600_names_PS_SAMPLER[] = { {0x0003C000, 0, 0, "SQ_TEX_SAMPLER_WORD0_0"}, {0x0003C004, 0, 0, "SQ_TEX_SAMPLER_WORD1_0"}, {0x0003C008, 0, 0, "SQ_TEX_SAMPLER_WORD2_0"}, }; -static const struct radeon_register R600_VS_SAMPLER_names[] = { +static const struct radeon_register R600_names_VS_SAMPLER[] = { {0x0003C0D8, 0, 0, "SQ_TEX_SAMPLER_WORD0_18"}, {0x0003C0DC, 0, 0, "SQ_TEX_SAMPLER_WORD1_18"}, {0x0003C0E0, 0, 0, "SQ_TEX_SAMPLER_WORD2_18"}, }; -static const struct radeon_register R600_GS_SAMPLER_names[] = { +static const struct radeon_register R600_names_GS_SAMPLER[] = { {0x0003C1B0, 0, 0, "SQ_TEX_SAMPLER_WORD0_36"}, {0x0003C1B4, 0, 0, "SQ_TEX_SAMPLER_WORD1_36"}, {0x0003C1B8, 0, 0, "SQ_TEX_SAMPLER_WORD2_36"}, }; -static const struct radeon_register R600_PS_SAMPLER_BORDER_names[] = { +static const struct radeon_register R600_names_PS_SAMPLER_BORDER[] = { {0x0000A400, 0, 0, "TD_PS_SAMPLER0_BORDER_RED"}, {0x0000A404, 0, 0, "TD_PS_SAMPLER0_BORDER_GREEN"}, {0x0000A408, 0, 0, "TD_PS_SAMPLER0_BORDER_BLUE"}, {0x0000A40C, 0, 0, "TD_PS_SAMPLER0_BORDER_ALPHA"}, }; -static const struct radeon_register R600_VS_SAMPLER_BORDER_names[] = { +static const struct radeon_register R600_names_VS_SAMPLER_BORDER[] = { {0x0000A600, 0, 0, "TD_VS_SAMPLER0_BORDER_RED"}, {0x0000A604, 0, 0, "TD_VS_SAMPLER0_BORDER_GREEN"}, {0x0000A608, 0, 0, "TD_VS_SAMPLER0_BORDER_BLUE"}, {0x0000A60C, 0, 0, "TD_VS_SAMPLER0_BORDER_ALPHA"}, }; -static const struct radeon_register R600_GS_SAMPLER_BORDER_names[] = { +static const struct radeon_register R600_names_GS_SAMPLER_BORDER[] = { {0x0000A800, 0, 0, "TD_GS_SAMPLER0_BORDER_RED"}, {0x0000A804, 0, 0, "TD_GS_SAMPLER0_BORDER_GREEN"}, {0x0000A808, 0, 0, "TD_GS_SAMPLER0_BORDER_BLUE"}, {0x0000A80C, 0, 0, "TD_GS_SAMPLER0_BORDER_ALPHA"}, }; -static const struct radeon_register R600_CB0_names[] = { +static const struct radeon_register R600_names_CB0[] = { {0x00028040, 1, 0, "CB_COLOR0_BASE"}, {0x000280A0, 0, 0, "CB_COLOR0_INFO"}, {0x00028060, 0, 0, "CB_COLOR0_SIZE"}, @@ -379,7 +379,7 @@ static const struct radeon_register R600_CB0_names[] = { {0x00028100, 0, 0, "CB_COLOR0_MASK"}, }; -static const struct radeon_register R600_CB1_names[] = { +static const struct radeon_register R600_names_CB1[] = { {0x00028044, 1, 0, "CB_COLOR1_BASE"}, {0x000280A4, 0, 0, "CB_COLOR1_INFO"}, {0x00028064, 0, 0, "CB_COLOR1_SIZE"}, @@ -389,7 +389,7 @@ static const struct radeon_register R600_CB1_names[] = { {0x00028104, 0, 0, "CB_COLOR1_MASK"}, }; -static const struct radeon_register R600_CB2_names[] = { +static const struct radeon_register R600_names_CB2[] = { {0x00028048, 1, 0, "CB_COLOR2_BASE"}, {0x000280A8, 0, 0, "CB_COLOR2_INFO"}, {0x00028068, 0, 0, "CB_COLOR2_SIZE"}, @@ -399,7 +399,7 @@ static const struct radeon_register R600_CB2_names[] = { {0x00028108, 0, 0, "CB_COLOR2_MASK"}, }; -static const struct radeon_register R600_CB3_names[] = { +static const struct radeon_register R600_names_CB3[] = { {0x0002804C, 1, 0, "CB_COLOR3_BASE"}, {0x000280AC, 0, 0, "CB_COLOR3_INFO"}, {0x0002806C, 0, 0, "CB_COLOR3_SIZE"}, @@ -409,7 +409,7 @@ static const struct radeon_register R600_CB3_names[] = { {0x0002810C, 0, 0, "CB_COLOR3_MASK"}, }; -static const struct radeon_register R600_CB4_names[] = { +static const struct radeon_register R600_names_CB4[] = { {0x00028050, 1, 0, "CB_COLOR4_BASE"}, {0x000280B0, 0, 0, "CB_COLOR4_INFO"}, {0x00028070, 0, 0, "CB_COLOR4_SIZE"}, @@ -419,7 +419,7 @@ static const struct radeon_register R600_CB4_names[] = { {0x00028110, 0, 0, "CB_COLOR4_MASK"}, }; -static const struct radeon_register R600_CB5_names[] = { +static const struct radeon_register R600_names_CB5[] = { {0x00028054, 1, 0, "CB_COLOR5_BASE"}, {0x000280B4, 0, 0, "CB_COLOR5_INFO"}, {0x00028074, 0, 0, "CB_COLOR5_SIZE"}, @@ -429,7 +429,7 @@ static const struct radeon_register R600_CB5_names[] = { {0x00028114, 0, 0, "CB_COLOR5_MASK"}, }; -static const struct radeon_register R600_CB6_names[] = { +static const struct radeon_register R600_names_CB6[] = { {0x00028058, 1, 0, "CB_COLOR6_BASE"}, {0x000280B8, 0, 0, "CB_COLOR6_INFO"}, {0x00028078, 0, 0, "CB_COLOR6_SIZE"}, @@ -439,7 +439,7 @@ static const struct radeon_register R600_CB6_names[] = { {0x00028118, 0, 0, "CB_COLOR6_MASK"}, }; -static const struct radeon_register R600_CB7_names[] = { +static const struct radeon_register R600_names_CB7[] = { {0x0002805C, 1, 0, "CB_COLOR7_BASE"}, {0x000280BC, 0, 0, "CB_COLOR7_INFO"}, {0x0002807C, 0, 0, "CB_COLOR7_SIZE"}, @@ -449,7 +449,7 @@ static const struct radeon_register R600_CB7_names[] = { {0x0002811C, 0, 0, "CB_COLOR7_MASK"}, }; -static const struct radeon_register R600_DB_names[] = { +static const struct radeon_register R600_names_DB[] = { {0x0002800C, 1, 0, "DB_DEPTH_BASE"}, {0x00028000, 0, 0, "DB_DEPTH_SIZE"}, {0x00028004, 0, 0, "DB_DEPTH_VIEW"}, @@ -458,7 +458,7 @@ static const struct radeon_register R600_DB_names[] = { {0x00028D34, 0, 0, "DB_PREFETCH_LIMIT"}, }; -static const struct radeon_register R600_VGT_names[] = { +static const struct radeon_register R600_names_VGT[] = { {0x00008958, 0, 0, "VGT_PRIMITIVE_TYPE"}, {0x00028400, 0, 0, "VGT_MAX_VTX_INDX"}, {0x00028404, 0, 0, "VGT_MIN_VTX_INDX"}, @@ -472,91 +472,15 @@ static const struct radeon_register R600_VGT_names[] = { {0x00028AA4, 0, 0, "VGT_INSTANCE_STEP_RATE_1"}, }; -static const struct radeon_register R600_DRAW_names[] = { +static const struct radeon_register R600_names_DRAW[] = { {0x00008970, 0, 0, "VGT_NUM_INDICES"}, {0x000287E4, 0, 0, "VGT_DMA_BASE_HI"}, {0x000287E8, 1, 0, "VGT_DMA_BASE"}, {0x000287F0, 0, 0, "VGT_DRAW_INITIATOR"}, }; -static const struct radeon_register R600_VGT_EVENT_names[] = { +static const struct radeon_register R600_names_VGT_EVENT[] = { {0x00028A90, 1, 0, "VGT_EVENT_INITIATOR"}, }; -static struct radeon_type R600_types[] = { - { 128, 0, 0x00000000, 0x00000000, 0x0000, 0, "R600_CONFIG", 41, r600_state_pm4_config, R600_CONFIG_names}, - { 128, 1, 0x00000000, 0x00000000, 0x0000, 0, "R600_CB_CNTL", 18, r600_state_pm4_generic, R600_CB_CNTL_names}, - { 128, 2, 0x00000000, 0x00000000, 0x0000, 0, "R600_RASTERIZER", 21, r600_state_pm4_generic, R600_RASTERIZER_names}, - { 128, 3, 0x00000000, 0x00000000, 0x0000, 0, "R600_VIEWPORT", 9, r600_state_pm4_generic, R600_VIEWPORT_names}, - { 128, 4, 0x00000000, 0x00000000, 0x0000, 0, "R600_SCISSOR", 19, r600_state_pm4_generic, R600_SCISSOR_names}, - { 128, 5, 0x00000000, 0x00000000, 0x0000, 0, "R600_BLEND", 13, r600_state_pm4_generic, R600_BLEND_names}, - { 128, 6, 0x00000000, 0x00000000, 0x0000, 0, "R600_DSA", 16, r600_state_pm4_generic, R600_DSA_names}, - { 128, 7, 0x00000000, 0x00000000, 0x0000, 0, "R600_VS_SHADER", 49, r600_state_pm4_shader, R600_VS_SHADER_names}, - { 128, 8, 0x00000000, 0x00000000, 0x0000, 0, "R600_PS_SHADER", 39, r600_state_pm4_shader, R600_PS_SHADER_names}, - { 128, 9, 0x00030000, 0x00031000, 0x0010, 0, "R600_PS_CONSTANT", 4, r600_state_pm4_generic, R600_PS_CONSTANT_names}, - { 128, 265, 0x00031000, 0x00032000, 0x0010, 0, "R600_VS_CONSTANT", 4, r600_state_pm4_generic, R600_VS_CONSTANT_names}, - { 128, 521, 0x00038000, 0x00039180, 0x001C, 0, "R600_PS_RESOURCE", 7, r600_state_pm4_resource, R600_PS_RESOURCE_names}, - { 128, 681, 0x00039180, 0x0003A300, 0x001C, 0, "R600_VS_RESOURCE", 7, r600_state_pm4_resource, R600_VS_RESOURCE_names}, - { 128, 841, 0x00039180, 0x0003A300, 0x001C, 0, "R600_FS_RESOURCE", 7, r600_state_pm4_resource, R600_FS_RESOURCE_names}, - { 128, 1001, 0x00039180, 0x0003A300, 0x001C, 0, "R600_GS_RESOURCE", 7, r600_state_pm4_resource, R600_GS_RESOURCE_names}, - { 128, 1161, 0x0003C000, 0x0003C0D8, 0x000C, 0, "R600_PS_SAMPLER", 3, r600_state_pm4_generic, R600_PS_SAMPLER_names}, - { 128, 1179, 0x0003C0D8, 0x0003C1B0, 0x000C, 0, "R600_VS_SAMPLER", 3, r600_state_pm4_generic, R600_VS_SAMPLER_names}, - { 128, 1197, 0x0003C1B0, 0x0003C288, 0x000C, 0, "R600_GS_SAMPLER", 3, r600_state_pm4_generic, R600_GS_SAMPLER_names}, - { 128, 1215, 0x0000A400, 0x0000A520, 0x0010, 0, "R600_PS_SAMPLER_BORDER", 4, r600_state_pm4_generic, R600_PS_SAMPLER_BORDER_names}, - { 128, 1233, 0x0000A600, 0x0000A720, 0x0010, 0, "R600_VS_SAMPLER_BORDER", 4, r600_state_pm4_generic, R600_VS_SAMPLER_BORDER_names}, - { 128, 1251, 0x0000A800, 0x0000A920, 0x0010, 0, "R600_GS_SAMPLER_BORDER", 4, r600_state_pm4_generic, R600_GS_SAMPLER_BORDER_names}, - { 128, 1269, 0x00000000, 0x00000000, 0x0000, 0, "R600_CB0", 7, r600_state_pm4_cb0, R600_CB0_names}, - { 128, 1270, 0x00000000, 0x00000000, 0x0000, 0, "R600_CB1", 7, r600_state_pm4_cb0, R600_CB1_names}, - { 128, 1271, 0x00000000, 0x00000000, 0x0000, 0, "R600_CB2", 7, r600_state_pm4_cb0, R600_CB2_names}, - { 128, 1272, 0x00000000, 0x00000000, 0x0000, 0, "R600_CB3", 7, r600_state_pm4_cb0, R600_CB3_names}, - { 128, 1273, 0x00000000, 0x00000000, 0x0000, 0, "R600_CB4", 7, r600_state_pm4_cb0, R600_CB4_names}, - { 128, 1274, 0x00000000, 0x00000000, 0x0000, 0, "R600_CB5", 7, r600_state_pm4_cb0, R600_CB5_names}, - { 128, 1275, 0x00000000, 0x00000000, 0x0000, 0, "R600_CB6", 7, r600_state_pm4_cb0, R600_CB6_names}, - { 128, 1276, 0x00000000, 0x00000000, 0x0000, 0, "R600_CB7", 7, r600_state_pm4_cb0, R600_CB7_names}, - { 128, 1277, 0x00000000, 0x00000000, 0x0000, 0, "R600_QUERY_BEGIN", 1, r600_state_pm4_query_begin, R600_VGT_EVENT_names}, - { 128, 1278, 0x00000000, 0x00000000, 0x0000, 0, "R600_QUERY_END", 1, r600_state_pm4_query_end, R600_VGT_EVENT_names}, - { 128, 1279, 0x00000000, 0x00000000, 0x0000, 0, "R600_DB", 6, r600_state_pm4_db, R600_DB_names}, - { 128, 1280, 0x00028e20, 0x00028e70, 0x0010, 0, "R600_UCP", 4, r600_state_pm4_generic, R600_UCP_names}, - { 128, 1286, 0x00000000, 0x00000000, 0x0000, 0, "R600_VGT", 11, r600_state_pm4_vgt, R600_VGT_names}, - { 128, 1287, 0x00000000, 0x00000000, 0x0000, 0, "R600_DRAW", 4, r600_state_pm4_draw, R600_DRAW_names}, -}; - -static struct radeon_type R700_types[] = { - { 128, 0, 0x00000000, 0x00000000, 0x0000, 0, "R600_CONFIG", 41, r700_state_pm4_config, R600_CONFIG_names}, - { 128, 1, 0x00000000, 0x00000000, 0x0000, 0, "R600_CB_CNTL", 18, r600_state_pm4_generic, R600_CB_CNTL_names}, - { 128, 2, 0x00000000, 0x00000000, 0x0000, 0, "R600_RASTERIZER", 21, r600_state_pm4_generic, R600_RASTERIZER_names}, - { 128, 3, 0x00000000, 0x00000000, 0x0000, 0, "R600_VIEWPORT", 9, r600_state_pm4_generic, R600_VIEWPORT_names}, - { 128, 4, 0x00000000, 0x00000000, 0x0000, 0, "R600_SCISSOR", 19, r600_state_pm4_generic, R600_SCISSOR_names}, - { 128, 5, 0x00000000, 0x00000000, 0x0000, 0, "R600_BLEND", 13, r600_state_pm4_generic, R600_BLEND_names}, - { 128, 6, 0x00000000, 0x00000000, 0x0000, 0, "R600_DSA", 16, r600_state_pm4_generic, R600_DSA_names}, - { 128, 7, 0x00000000, 0x00000000, 0x0000, 0, "R600_VS_SHADER", 49, r600_state_pm4_shader, R600_VS_SHADER_names}, - { 128, 8, 0x00000000, 0x00000000, 0x0000, 0, "R600_PS_SHADER", 39, r600_state_pm4_shader, R600_PS_SHADER_names}, - { 128, 9, 0x00030000, 0x00031000, 0x0010, 0, "R600_PS_CONSTANT", 4, r600_state_pm4_generic, R600_PS_CONSTANT_names}, - { 128, 265, 0x00031000, 0x00032000, 0x0010, 0, "R600_VS_CONSTANT", 4, r600_state_pm4_generic, R600_VS_CONSTANT_names}, - { 128, 521, 0x00038000, 0x00039180, 0x001C, 0, "R600_PS_RESOURCE", 7, r600_state_pm4_resource, R600_PS_RESOURCE_names}, - { 128, 681, 0x00039180, 0x0003A300, 0x001C, 0, "R600_VS_RESOURCE", 7, r600_state_pm4_resource, R600_VS_RESOURCE_names}, - { 128, 841, 0x00039180, 0x0003A300, 0x001C, 0, "R600_FS_RESOURCE", 7, r600_state_pm4_resource, R600_FS_RESOURCE_names}, - { 128, 1001, 0x00039180, 0x0003A300, 0x001C, 0, "R600_GS_RESOURCE", 7, r600_state_pm4_resource, R600_GS_RESOURCE_names}, - { 128, 1161, 0x0003C000, 0x0003C0D8, 0x000C, 0, "R600_PS_SAMPLER", 3, r600_state_pm4_generic, R600_PS_SAMPLER_names}, - { 128, 1179, 0x0003C0D8, 0x0003C1B0, 0x000C, 0, "R600_VS_SAMPLER", 3, r600_state_pm4_generic, R600_VS_SAMPLER_names}, - { 128, 1197, 0x0003C1B0, 0x0003C288, 0x000C, 0, "R600_GS_SAMPLER", 3, r600_state_pm4_generic, R600_GS_SAMPLER_names}, - { 128, 1215, 0x0000A400, 0x0000A520, 0x0010, 0, "R600_PS_SAMPLER_BORDER", 4, r600_state_pm4_generic, R600_PS_SAMPLER_BORDER_names}, - { 128, 1233, 0x0000A600, 0x0000A720, 0x0010, 0, "R600_VS_SAMPLER_BORDER", 4, r600_state_pm4_generic, R600_VS_SAMPLER_BORDER_names}, - { 128, 1251, 0x0000A800, 0x0000A920, 0x0010, 0, "R600_GS_SAMPLER_BORDER", 4, r600_state_pm4_generic, R600_GS_SAMPLER_BORDER_names}, - { 128, 1269, 0x00000000, 0x00000000, 0x0000, 0, "R600_CB0", 7, r700_state_pm4_cb0, R600_CB0_names}, - { 128, 1270, 0x00000000, 0x00000000, 0x0000, 0, "R600_CB1", 7, r600_state_pm4_cb0, R600_CB1_names}, - { 128, 1271, 0x00000000, 0x00000000, 0x0000, 0, "R600_CB2", 7, r600_state_pm4_cb0, R600_CB2_names}, - { 128, 1272, 0x00000000, 0x00000000, 0x0000, 0, "R600_CB3", 7, r600_state_pm4_cb0, R600_CB3_names}, - { 128, 1273, 0x00000000, 0x00000000, 0x0000, 0, "R600_CB4", 7, r600_state_pm4_cb0, R600_CB4_names}, - { 128, 1274, 0x00000000, 0x00000000, 0x0000, 0, "R600_CB5", 7, r600_state_pm4_cb0, R600_CB5_names}, - { 128, 1275, 0x00000000, 0x00000000, 0x0000, 0, "R600_CB6", 7, r600_state_pm4_cb0, R600_CB6_names}, - { 128, 1276, 0x00000000, 0x00000000, 0x0000, 0, "R600_CB7", 7, r600_state_pm4_cb0, R600_CB7_names}, - { 128, 1277, 0x00000000, 0x00000000, 0x0000, 0, "R600_QUERY_BEGIN", 1, r600_state_pm4_query_begin, R600_VGT_EVENT_names}, - { 128, 1278, 0x00000000, 0x00000000, 0x0000, 0, "R600_QUERY_END", 1, r600_state_pm4_query_end, R600_VGT_EVENT_names}, - { 128, 1279, 0x00000000, 0x00000000, 0x0000, 0, "R600_DB", 6, r700_state_pm4_db, R600_DB_names}, - { 128, 1280, 0x00028e20, 0x00028e70, 0x0010, 0, "R600_UCP", 4, r600_state_pm4_generic, R600_UCP_names}, - { 128, 1286, 0x00000000, 0x00000000, 0x0000, 0, "R600_VGT", 11, r600_state_pm4_vgt, R600_VGT_names}, - { 128, 1287, 0x00000000, 0x00000000, 0x0000, 0, "R600_DRAW", 4, r600_state_pm4_draw, R600_DRAW_names}, -}; - #endif diff --git a/src/gallium/winsys/r600/drm/radeon.c b/src/gallium/winsys/r600/drm/radeon.c index 80b0a1d397..2b16e3ce88 100644 --- a/src/gallium/winsys/r600/drm/radeon.c +++ b/src/gallium/winsys/r600/drm/radeon.c @@ -153,47 +153,3 @@ struct radeon *radeon_decref(struct radeon *radeon) free(radeon); return NULL; } - -int radeon_reg_id(struct radeon *radeon, unsigned offset, unsigned *typeid, unsigned *stateid, unsigned *id) -{ - unsigned i, j; - - for (i = 0; i < radeon->ntype; i++) { - if (radeon->type[i].range_start) { - if (offset >= radeon->type[i].range_start && offset < radeon->type[i].range_end) { - *typeid = i; - j = offset - radeon->type[i].range_start; - j /= radeon->type[i].stride; - *stateid = radeon->type[i].id + j; - *id = (offset - radeon->type[i].range_start - radeon->type[i].stride * j) / 4; - return 0; - } - } else { - for (j = 0; j < radeon->type[i].nstates; j++) { - if (radeon->type[i].regs[j].offset == offset) { - *typeid = i; - *stateid = radeon->type[i].id; - *id = j; - return 0; - } - } - } - } - fprintf(stderr, "%s unknown register 0x%08X\n", __func__, offset); - return -EINVAL; -} - -unsigned radeon_type_from_id(struct radeon *radeon, unsigned id) -{ - unsigned i; - - for (i = 0; i < radeon->ntype - 1; i++) { - if (radeon->type[i].id == id) - return i; - if (id > radeon->type[i].id && id < radeon->type[i + 1].id) - return i; - } - if (radeon->type[i].id == id) - return i; - return -1; -} diff --git a/src/gallium/winsys/r600/drm/radeon_ctx.c b/src/gallium/winsys/r600/drm/radeon_ctx.c index bd050c4cf9..1a12c1023e 100644 --- a/src/gallium/winsys/r600/drm/radeon_ctx.c +++ b/src/gallium/winsys/r600/drm/radeon_ctx.c @@ -216,7 +216,7 @@ static int radeon_ctx_state_schedule(struct radeon_ctx *ctx, struct radeon_state r = radeon_ctx_reloc(ctx, state->bo[bid], cid, &state->placement[bid * 2]); if (r) { - fprintf(stderr, "%s state %d failed to reloc\n", __func__, state->type); + fprintf(stderr, "%s state %d failed to reloc\n", __func__, state->stype->stype); return r; } } @@ -230,7 +230,7 @@ int radeon_ctx_set_query_state(struct radeon_ctx *ctx, struct radeon_state *stat int r = 0; /* !!! ONLY ACCEPT QUERY STATE HERE !!! */ - if (state->type != R600_QUERY_BEGIN_TYPE && state->type != R600_QUERY_END_TYPE) { + if (state->stype->stype != R600_STATE_QUERY_BEGIN && state->stype->stype != R600_STATE_QUERY_END) { return -EINVAL; } r = radeon_state_pm4(state); @@ -253,7 +253,7 @@ int radeon_ctx_set_query_state(struct radeon_ctx *ctx, struct radeon_state *stat /* BEGIN/END query are balanced in the same cs so account for END * END query when scheduling BEGIN query */ - if (state->type == R600_QUERY_BEGIN_TYPE) { + if (state->stype->stype == R600_STATE_QUERY_BEGIN) { ctx->draw_cpm4 += state->cpm4 * 2; } return 0; diff --git a/src/gallium/winsys/r600/drm/radeon_draw.c b/src/gallium/winsys/r600/drm/radeon_draw.c index 4413ed79fb..0eacdc74a0 100644 --- a/src/gallium/winsys/r600/drm/radeon_draw.c +++ b/src/gallium/winsys/r600/drm/radeon_draw.c @@ -74,12 +74,17 @@ struct radeon_draw *radeon_draw_decref(struct radeon_draw *draw) int radeon_draw_set_new(struct radeon_draw *draw, struct radeon_state *state) { + int id; if (state == NULL) return 0; - if (state->type >= draw->radeon->ntype) + + id = state->stype->base_id + (state->id + (state->stype->num * state->shader_index)); + if (id > draw->radeon->nstate) + { return -EINVAL; - draw->state[state->id] = radeon_state_decref(draw->state[state->id]); - draw->state[state->id] = state; + } + draw->state[id] = radeon_state_decref(draw->state[id]); + draw->state[id] = state; return 0; } diff --git a/src/gallium/winsys/r600/drm/radeon_priv.h b/src/gallium/winsys/r600/drm/radeon_priv.h index 96c0d060f7..66ee5f2177 100644 --- a/src/gallium/winsys/r600/drm/radeon_priv.h +++ b/src/gallium/winsys/r600/drm/radeon_priv.h @@ -37,17 +37,20 @@ struct radeon_register { char name[64]; }; -struct radeon_type { - unsigned npm4; - unsigned id; - unsigned range_start; - unsigned range_end; - unsigned stride; - unsigned immediate; - char name[64]; - unsigned nstates; - radeon_state_pm4_t pm4; - const struct radeon_register *regs; +struct radeon_sub_type { + int shader_type; + const struct radeon_register *regs; + unsigned nstates; +}; + +struct radeon_stype_info { + unsigned stype; + unsigned num; + unsigned stride; + radeon_state_pm4_t pm4; + struct radeon_sub_type reginfo[R600_SHADER_MAX]; + unsigned base_id; + unsigned npm4; }; struct radeon { @@ -56,8 +59,8 @@ struct radeon { unsigned device; unsigned family; unsigned nstate; - unsigned ntype; - const struct radeon_type *type; + unsigned nstype; + struct radeon_stype_info *stype; }; extern struct radeon *radeon_new(int fd, unsigned device); @@ -65,9 +68,6 @@ extern struct radeon *radeon_incref(struct radeon *radeon); extern struct radeon *radeon_decref(struct radeon *radeon); extern unsigned radeon_family_from_device(unsigned device); extern int radeon_is_family_compatible(unsigned family1, unsigned family2); -extern int radeon_reg_id(struct radeon *radeon, unsigned offset, unsigned *typeid, unsigned *stateid, unsigned *id); -extern unsigned radeon_type_from_id(struct radeon *radeon, unsigned id); - int radeon_ctx_set_bo_new(struct radeon_ctx *ctx, struct radeon_bo *bo); struct radeon_bo *radeon_ctx_get_bo(struct radeon_ctx *ctx, unsigned reloc); diff --git a/src/gallium/winsys/r600/drm/radeon_state.c b/src/gallium/winsys/r600/drm/radeon_state.c index 308288557a..ef09fdfb96 100644 --- a/src/gallium/winsys/r600/drm/radeon_state.c +++ b/src/gallium/winsys/r600/drm/radeon_state.c @@ -32,29 +32,56 @@ /* * state core functions */ -struct radeon_state *radeon_state(struct radeon *radeon, u32 type, u32 id) +struct radeon_state *radeon_state_shader(struct radeon *radeon, u32 stype, u32 id, u32 shader_type) { struct radeon_state *state; + struct radeon_stype_info *found = NULL; + int i, j, shader_index = -1; - if (type > radeon->ntype) { - fprintf(stderr, "%s invalid type %d\n", __func__, type); - return NULL; + /* traverse the stype array */ + for (i = 0; i < radeon->nstype; i++) { + /* if the type doesn't match, if the shader doesn't match */ + if (stype != radeon->stype[i].stype) + continue; + if (shader_type) { + for (j = 0; j < 4; j++) { + if (radeon->stype[i].reginfo[j].shader_type == shader_type) { + shader_index = j; + break; + } + } + if (shader_index == -1) + continue; + } else { + if (radeon->stype[i].reginfo[0].shader_type) + continue; + else + shader_index = 0; + } + if (id > radeon->stype[i].num) + continue; + + found = &radeon->stype[i]; + break; } - if (id > radeon->nstate) { - fprintf(stderr, "%s invalid state id %d\n", __func__, id); + + if (!found) { + fprintf(stderr, "%s invalid type %d/id %d/shader class %d\n", __func__, stype, id, shader_type); return NULL; } + state = calloc(1, sizeof(*state)); if (state == NULL) return NULL; + state->stype = found; state->radeon = radeon; - state->type = type; state->id = id; + state->shader_index = shader_index; state->refcount = 1; - state->npm4 = radeon->type[type].npm4; - state->nstates = radeon->type[type].nstates; + state->npm4 = found->npm4; + state->nstates = found->reginfo[shader_index].nstates; state->states = calloc(1, state->nstates * 4); - state->pm4 = calloc(1, radeon->type[type].npm4 * 4); + state->pm4 = calloc(1, found->npm4 * 4); if (state->states == NULL || state->pm4 == NULL) { radeon_state_decref(state); return NULL; @@ -62,9 +89,14 @@ struct radeon_state *radeon_state(struct radeon *radeon, u32 type, u32 id) return state; } +struct radeon_state *radeon_state(struct radeon *radeon, u32 type, u32 id) +{ + return radeon_state_shader(radeon, type, id, 0); +} + struct radeon_state *radeon_state_duplicate(struct radeon_state *state) { - struct radeon_state *nstate = radeon_state(state->radeon, state->type, state->id); + struct radeon_state *nstate = radeon_state_shader(state->radeon, state->stype->stype, state->id, (1 << state->shader_index)); unsigned i; if (state == NULL) @@ -149,10 +181,10 @@ int radeon_state_pm4(struct radeon_state *state) if (state == NULL || state->cpm4) return 0; - r = state->radeon->type[state->type].pm4(state); + r = state->stype->pm4(state); if (r) { fprintf(stderr, "%s failed to build PM4 for state(%d %d)\n", - __func__, state->type, state->id); + __func__, state->stype->stype, state->id); return r; } state->pm4_crc = crc32(state->pm4, state->cpm4 * 4); -- cgit v1.2.3 From 0bba7796a33d3c47295a9676dc82984da1615fe5 Mon Sep 17 00:00:00 2001 From: Jerome Glisse Date: Sat, 28 Aug 2010 17:47:13 -0400 Subject: r600g: fix depth buffer decompression after states rework Signed-off-by: Jerome Glisse --- src/gallium/drivers/r600/r600_blit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/r600_blit.c b/src/gallium/drivers/r600/r600_blit.c index 6b8487695c..be1fcf9662 100644 --- a/src/gallium/drivers/r600/r600_blit.c +++ b/src/gallium/drivers/r600/r600_blit.c @@ -215,7 +215,7 @@ static int r600_blit_state_vs_resources(struct r600_screen *rscreen, struct r600 } bstates->vs_resource0 = rstate; - rstate = radeon_state_shader(rscreen->rw, R600_STATE_RESOURCE, 0, R600_SHADER_VS); + rstate = radeon_state_shader(rscreen->rw, R600_STATE_RESOURCE, 1, R600_SHADER_VS); if (rstate == NULL) { return -ENOMEM; } -- cgit v1.2.3 From de0b76cab22caa9fc7260f80acb8f151ccced6c5 Mon Sep 17 00:00:00 2001 From: Jerome Glisse Date: Sun, 29 Aug 2010 21:01:51 -0400 Subject: r600g: precompute some of the hw state Idea is to build hw state at pipe state creation and reuse them while keeping a non PM4 packet interface btw winsys & pipe driver. This commit also force rebuild of pm4 packet on each call to radeon_state_pm4 which in turn slow down everythings, this will be addressed. Signed-off-by: Jerome Glisse --- src/gallium/drivers/r600/r600_blit.c | 4 +- src/gallium/drivers/r600/r600_context.h | 2 +- src/gallium/drivers/r600/r600_resource.h | 2 +- src/gallium/drivers/r600/r600_screen.h | 2 +- src/gallium/drivers/r600/r600_state.c | 226 ++++++++++------------------- src/gallium/drivers/r600/r600_texture.c | 43 ++++-- src/gallium/drivers/r600/radeon.h | 47 ++++-- src/gallium/winsys/r600/drm/r600_state.c | 9 +- src/gallium/winsys/r600/drm/r600_states.h | 28 +++- src/gallium/winsys/r600/drm/radeon_priv.h | 20 +-- src/gallium/winsys/r600/drm/radeon_state.c | 62 ++++++-- 11 files changed, 229 insertions(+), 216 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/r600_blit.c b/src/gallium/drivers/r600/r600_blit.c index be1fcf9662..dbcd6cdea8 100644 --- a/src/gallium/drivers/r600/r600_blit.c +++ b/src/gallium/drivers/r600/r600_blit.c @@ -670,7 +670,7 @@ int r600_blit_uncompress_depth(struct pipe_context *ctx, struct r600_resource_te if (r) { return r; } - r = r600_texture_cb0(ctx, rtexture, level); + r = r600_texture_cb(ctx, rtexture, 0, level); if (r) { return r; } @@ -772,7 +772,7 @@ int r600_blit_uncompress_depth(struct pipe_context *ctx, struct r600_resource_te if (r) { goto out; } - r = radeon_draw_set(draw, rtexture->cb0[level]); + r = radeon_draw_set(draw, rtexture->cb[0][level]); if (r) { goto out; } diff --git a/src/gallium/drivers/r600/r600_context.h b/src/gallium/drivers/r600/r600_context.h index d96d5b513f..e9495f0017 100644 --- a/src/gallium/drivers/r600/r600_context.h +++ b/src/gallium/drivers/r600/r600_context.h @@ -121,7 +121,7 @@ struct r600_context_hw_states { struct radeon_state *config; struct radeon_state *cb_cntl; struct radeon_state *db; - struct radeon_state *ucp[6]; + struct radeon_state *ucp; unsigned ps_nresource; unsigned ps_nsampler; struct radeon_state *ps_resource[160]; diff --git a/src/gallium/drivers/r600/r600_resource.h b/src/gallium/drivers/r600/r600_resource.h index b880f9369c..8078a83c35 100644 --- a/src/gallium/drivers/r600/r600_resource.h +++ b/src/gallium/drivers/r600/r600_resource.h @@ -57,7 +57,7 @@ struct r600_resource_texture { unsigned dirty; struct radeon_bo *uncompressed; struct radeon_state *scissor[PIPE_MAX_TEXTURE_LEVELS]; - struct radeon_state *cb0[PIPE_MAX_TEXTURE_LEVELS]; + struct radeon_state *cb[8][PIPE_MAX_TEXTURE_LEVELS]; struct radeon_state *db[PIPE_MAX_TEXTURE_LEVELS]; struct radeon_state *viewport[PIPE_MAX_TEXTURE_LEVELS]; }; diff --git a/src/gallium/drivers/r600/r600_screen.h b/src/gallium/drivers/r600/r600_screen.h index 438976f654..b9938f117a 100644 --- a/src/gallium/drivers/r600/r600_screen.h +++ b/src/gallium/drivers/r600/r600_screen.h @@ -84,7 +84,7 @@ void* r600_texture_transfer_map(struct pipe_context *ctx, void r600_texture_transfer_unmap(struct pipe_context *ctx, struct pipe_transfer* transfer); int r600_texture_scissor(struct pipe_context *ctx, struct r600_resource_texture *rtexture, unsigned level); -int r600_texture_cb0(struct pipe_context *ctx, struct r600_resource_texture *rtexture, unsigned level); +int r600_texture_cb(struct pipe_context *ctx, struct r600_resource_texture *rtexture, unsigned cb, unsigned level); int r600_texture_db(struct pipe_context *ctx, struct r600_resource_texture *rtexture, unsigned level); int r600_texture_from_depth(struct pipe_context *ctx, struct r600_resource_texture *rtexture, unsigned level); int r600_texture_viewport(struct pipe_context *ctx, struct r600_resource_texture *rtexture, unsigned level); diff --git a/src/gallium/drivers/r600/r600_state.c b/src/gallium/drivers/r600/r600_state.c index b5db848e35..6049e1328e 100644 --- a/src/gallium/drivers/r600/r600_state.c +++ b/src/gallium/drivers/r600/r600_state.c @@ -34,6 +34,16 @@ #include "r600d.h" #include "r600_state_inlines.h" +static struct radeon_state *r600_blend(struct r600_context *rctx, const struct pipe_blend_state *state); +static struct radeon_state *r600_viewport(struct r600_context *rctx, const struct pipe_viewport_state *state); +static struct radeon_state *r600_ucp(struct r600_context *rctx, const struct pipe_clip_state *state); +static struct radeon_state *r600_sampler(struct r600_context *rctx, + const struct pipe_sampler_state *state, + unsigned id); +static struct radeon_state *r600_resource(struct pipe_context *ctx, + const struct pipe_sampler_view *view, + unsigned id); + static void *r600_create_blend_state(struct pipe_context *ctx, const struct pipe_blend_state *state) { @@ -86,6 +96,7 @@ static struct pipe_sampler_view *r600_create_sampler_view(struct pipe_context *c rstate->state.sampler_view.texture = texture; rstate->state.sampler_view.reference.count = 1; rstate->state.sampler_view.context = ctx; + rstate->rstate = r600_resource(ctx, &rstate->state.sampler_view, 0); return &rstate->state.sampler_view; } @@ -229,6 +240,9 @@ static void r600_bind_ps_sampler(struct pipe_context *ctx, for (i = 0; i < count; i++) { rstate = (struct r600_context_state *)states[i]; rctx->ps_sampler[i] = r600_context_state_incref(rstate); + if (rstate) { + radeon_state_convert(rstate->rstate, R600_STATE_SAMPLER, i, R600_SHADER_PS); + } } rctx->ps_nsampler = count; } @@ -246,6 +260,9 @@ static void r600_bind_vs_sampler(struct pipe_context *ctx, for (i = 0; i < count; i++) { rstate = (struct r600_context_state *)states[i]; rctx->vs_sampler[i] = r600_context_state_incref(rstate); + if (rstate) { + radeon_state_convert(rstate->rstate, R600_STATE_SAMPLER, i, R600_SHADER_VS); + } } rctx->vs_nsampler = count; } @@ -337,6 +354,9 @@ static void r600_set_ps_sampler_view(struct pipe_context *ctx, for (i = 0; i < count; i++) { rstate = (struct r600_context_state *)views[i]; rctx->ps_sampler_view[i] = r600_context_state_incref(rstate); + if (rstate) { + radeon_state_convert(rstate->rstate, R600_STATE_RESOURCE, i, R600_SHADER_PS); + } } rctx->ps_nsampler_view = count; } @@ -355,6 +375,9 @@ static void r600_set_vs_sampler_view(struct pipe_context *ctx, for (i = 0; i < count; i++) { rstate = (struct r600_context_state *)views[i]; rctx->vs_sampler_view[i] = r600_context_state_incref(rstate); + if (rstate) { + radeon_state_convert(rstate->rstate, R600_STATE_RESOURCE, i, R600_SHADER_VS); + } } rctx->vs_nsampler_view = count; } @@ -363,10 +386,19 @@ static void r600_set_framebuffer_state(struct pipe_context *ctx, const struct pipe_framebuffer_state *state) { struct r600_context *rctx = r600_context(ctx); + struct r600_resource_texture *rtexture; struct r600_context_state *rstate; rstate = r600_context_state(rctx, pipe_framebuffer_type, state); r600_bind_state(ctx, rstate); + for (int i = 0; i < state->nr_cbufs; i++) { + rtexture = (struct r600_resource_texture*)state->cbufs[i]->texture; + r600_texture_cb(ctx, rtexture, i, state->cbufs[i]->level); + } + if (state->zsbuf) { + rtexture = (struct r600_resource_texture*)state->zsbuf->texture; + r600_texture_db(ctx, rtexture, state->zsbuf->level); + } } static void r600_set_polygon_stipple(struct pipe_context *ctx, @@ -565,6 +597,7 @@ struct r600_context_state *r600_context_state(struct r600_context *rctx, unsigne break; case pipe_viewport_type: rstate->state.viewport = (*states).viewport; + rstate->rstate = r600_viewport(rctx, &rstate->state.viewport); break; case pipe_depth_type: rstate->state.depth = (*states).depth; @@ -580,6 +613,7 @@ struct r600_context_state *r600_context_state(struct r600_context *rctx, unsigne break; case pipe_clip_type: rstate->state.clip = (*states).clip; + rstate->rstate = r600_ucp(rctx, &rstate->state.clip); break; case pipe_stencil_type: rstate->state.stencil = (*states).stencil; @@ -592,6 +626,7 @@ struct r600_context_state *r600_context_state(struct r600_context *rctx, unsigne break; case pipe_blend_type: rstate->state.blend = (*states).blend; + rstate->rstate = r600_blend(rctx, &rstate->state.blend); break; case pipe_stencil_ref_type: rstate->state.stencil_ref = (*states).stencil_ref; @@ -606,6 +641,7 @@ struct r600_context_state *r600_context_state(struct r600_context *rctx, unsigne break; case pipe_sampler_type: rstate->state.sampler = (*states).sampler; + rstate->rstate = r600_sampler(rctx, &rstate->state.sampler, 0); break; default: R600_ERR("invalid type %d\n", rstate->type); @@ -615,11 +651,10 @@ struct r600_context_state *r600_context_state(struct r600_context *rctx, unsigne return rstate; } -static struct radeon_state *r600_blend(struct r600_context *rctx) +static struct radeon_state *r600_blend(struct r600_context *rctx, const struct pipe_blend_state *state) { struct r600_screen *rscreen = rctx->screen; struct radeon_state *rstate; - const struct pipe_blend_state *state = &rctx->blend->state.blend; int i; rstate = radeon_state(rscreen->rw, R600_STATE_BLEND, 0); @@ -675,129 +710,28 @@ static struct radeon_state *r600_blend(struct r600_context *rctx) return rstate; } -static struct radeon_state *r600_ucp(struct r600_context *rctx, int clip) +static struct radeon_state *r600_ucp(struct r600_context *rctx, const struct pipe_clip_state *state) { struct r600_screen *rscreen = rctx->screen; struct radeon_state *rstate; - const struct pipe_clip_state *state = &rctx->clip->state.clip; - rstate = radeon_state(rscreen->rw, R600_STATE_CLIP, clip); + rstate = radeon_state(rscreen->rw, R600_STATE_UCP, 0); if (rstate == NULL) return NULL; - rstate->states[R600_CLIP__PA_CL_UCP_X_0] = fui(state->ucp[clip][0]); - rstate->states[R600_CLIP__PA_CL_UCP_Y_0] = fui(state->ucp[clip][1]); - rstate->states[R600_CLIP__PA_CL_UCP_Z_0] = fui(state->ucp[clip][2]); - rstate->states[R600_CLIP__PA_CL_UCP_W_0] = fui(state->ucp[clip][3]); - - if (radeon_state_pm4(rstate)) { - radeon_state_decref(rstate); - return NULL; + for (int i = 0; i < state->nr; i++) { + rstate->states[i * 4 + 0] = fui(state->ucp[i][0]); + rstate->states[i * 4 + 1] = fui(state->ucp[i][1]); + rstate->states[i * 4 + 2] = fui(state->ucp[i][2]); + rstate->states[i * 4 + 3] = fui(state->ucp[i][3]); } - return rstate; -} - -static struct radeon_state *r600_cb(struct r600_context *rctx, int cb) -{ - struct r600_screen *rscreen = rctx->screen; - struct r600_resource_texture *rtex; - struct r600_resource *rbuffer; - struct radeon_state *rstate; - const struct pipe_framebuffer_state *state = &rctx->framebuffer->state.framebuffer; - unsigned level = state->cbufs[cb]->level; - unsigned pitch, slice; - unsigned color_info; - unsigned format, swap, ntype; - const struct util_format_description *desc; - - rstate = radeon_state(rscreen->rw, R600_STATE_CB0 + cb, 0); - if (rstate == NULL) - return NULL; - rtex = (struct r600_resource_texture*)state->cbufs[cb]->texture; - rbuffer = &rtex->resource; - rstate->bo[0] = radeon_bo_incref(rscreen->rw, rbuffer->bo); - rstate->bo[1] = radeon_bo_incref(rscreen->rw, rbuffer->bo); - rstate->bo[2] = radeon_bo_incref(rscreen->rw, rbuffer->bo); - rstate->placement[0] = RADEON_GEM_DOMAIN_GTT; - rstate->placement[2] = RADEON_GEM_DOMAIN_GTT; - rstate->placement[4] = RADEON_GEM_DOMAIN_GTT; - rstate->nbo = 3; - pitch = (rtex->pitch[level] / rtex->bpt) / 8 - 1; - slice = (rtex->pitch[level] / rtex->bpt) * state->cbufs[cb]->height / 64 - 1; - - ntype = 0; - desc = util_format_description(rtex->resource.base.b.format); - if (desc->colorspace == UTIL_FORMAT_COLORSPACE_SRGB) - ntype = V_0280A0_NUMBER_SRGB; - - format = r600_translate_colorformat(rtex->resource.base.b.format); - swap = r600_translate_colorswap(rtex->resource.base.b.format); - - color_info = S_0280A0_FORMAT(format) | - S_0280A0_COMP_SWAP(swap) | - S_0280A0_BLEND_CLAMP(1) | - S_0280A0_SOURCE_FORMAT(1) | - S_0280A0_NUMBER_TYPE(ntype); - - rstate->states[R600_CB0__CB_COLOR0_BASE] = rtex->offset[level] >> 8; - rstate->states[R600_CB0__CB_COLOR0_INFO] = color_info; - rstate->states[R600_CB0__CB_COLOR0_SIZE] = S_028060_PITCH_TILE_MAX(pitch) | - S_028060_SLICE_TILE_MAX(slice); - rstate->states[R600_CB0__CB_COLOR0_VIEW] = 0x00000000; - rstate->states[R600_CB0__CB_COLOR0_FRAG] = 0x00000000; - rstate->states[R600_CB0__CB_COLOR0_TILE] = 0x00000000; - rstate->states[R600_CB0__CB_COLOR0_MASK] = 0x00000000; if (radeon_state_pm4(rstate)) { radeon_state_decref(rstate); return NULL; } return rstate; -} -static struct radeon_state *r600_db(struct r600_context *rctx) -{ - struct r600_screen *rscreen = rctx->screen; - struct r600_resource_texture *rtex; - struct r600_resource *rbuffer; - struct radeon_state *rstate; - const struct pipe_framebuffer_state *state = &rctx->framebuffer->state.framebuffer; - unsigned level; - unsigned pitch, slice, format; - - if (state->zsbuf == NULL) - return NULL; - - rstate = radeon_state(rscreen->rw, R600_STATE_DB, 0); - if (rstate == NULL) - return NULL; - - rtex = (struct r600_resource_texture*)state->zsbuf->texture; - rtex->tilled = 1; - rtex->array_mode = 2; - rtex->tile_type = 1; - rtex->depth = 1; - rbuffer = &rtex->resource; - - rstate->bo[0] = radeon_bo_incref(rscreen->rw, rbuffer->bo); - rstate->nbo = 1; - rstate->placement[0] = RADEON_GEM_DOMAIN_VRAM; - level = state->zsbuf->level; - pitch = (rtex->pitch[level] / rtex->bpt) / 8 - 1; - slice = (rtex->pitch[level] / rtex->bpt) * state->zsbuf->height / 64 - 1; - format = r600_translate_dbformat(state->zsbuf->texture->format); - rstate->states[R600_DB__DB_DEPTH_BASE] = rtex->offset[level] >> 8; - rstate->states[R600_DB__DB_DEPTH_INFO] = S_028010_ARRAY_MODE(rtex->array_mode) | - S_028010_FORMAT(format); - rstate->states[R600_DB__DB_DEPTH_VIEW] = 0x00000000; - rstate->states[R600_DB__DB_PREFETCH_LIMIT] = (state->zsbuf->height / 8) -1; - rstate->states[R600_DB__DB_DEPTH_SIZE] = S_028000_PITCH_TILE_MAX(pitch) | - S_028000_SLICE_TILE_MAX(slice); - if (radeon_state_pm4(rstate)) { - radeon_state_decref(rstate); - return NULL; - } - return rstate; } static struct radeon_state *r600_rasterizer(struct r600_context *rctx) @@ -954,9 +888,8 @@ static struct radeon_state *r600_scissor(struct r600_context *rctx) return rstate; } -static struct radeon_state *r600_viewport(struct r600_context *rctx) +static struct radeon_state *r600_viewport(struct r600_context *rctx, const struct pipe_viewport_state *state) { - const struct pipe_viewport_state *state = &rctx->viewport->state.viewport; struct r600_screen *rscreen = rctx->screen; struct radeon_state *rstate; @@ -1366,6 +1299,7 @@ static struct radeon_state *r600_cb_cntl(struct r600_context *rctx) int r600_context_hw_states(struct pipe_context *ctx) { struct r600_context *rctx = r600_context(ctx); + struct r600_resource_texture *rtexture; unsigned i; int r; int nr_cbufs = rctx->framebuffer->state.framebuffer.nr_cbufs; @@ -1377,69 +1311,59 @@ int r600_context_hw_states(struct pipe_context *ctx) /* free previous TODO determine what need to be updated, what * doesn't */ - //radeon_state_decref(rctx->hw_states.config); rctx->hw_states.cb_cntl = radeon_state_decref(rctx->hw_states.cb_cntl); - rctx->hw_states.db = radeon_state_decref(rctx->hw_states.db); rctx->hw_states.rasterizer = radeon_state_decref(rctx->hw_states.rasterizer); rctx->hw_states.scissor = radeon_state_decref(rctx->hw_states.scissor); rctx->hw_states.dsa = radeon_state_decref(rctx->hw_states.dsa); - rctx->hw_states.blend = radeon_state_decref(rctx->hw_states.blend); - rctx->hw_states.viewport = radeon_state_decref(rctx->hw_states.viewport); - for (i = 0; i < 8; i++) { - rctx->hw_states.cb[i] = radeon_state_decref(rctx->hw_states.cb[i]); - } - for (i = 0; i < 6; i++) { - rctx->hw_states.ucp[i] = radeon_state_decref(rctx->hw_states.ucp[i]); - } - for (i = 0; i < rctx->hw_states.ps_nresource; i++) { - radeon_state_decref(rctx->hw_states.ps_resource[i]); - rctx->hw_states.ps_resource[i] = NULL; - } - rctx->hw_states.ps_nresource = 0; - for (i = 0; i < rctx->hw_states.ps_nsampler; i++) { - radeon_state_decref(rctx->hw_states.ps_sampler[i]); - rctx->hw_states.ps_sampler[i] = NULL; - } - rctx->hw_states.ps_nsampler = 0; /* build new states */ + rctx->hw_states.blend = NULL; + rctx->hw_states.viewport = NULL; + rctx->hw_states.ucp = NULL; rctx->hw_states.rasterizer = r600_rasterizer(rctx); rctx->hw_states.scissor = r600_scissor(rctx); rctx->hw_states.dsa = r600_dsa(rctx); - rctx->hw_states.blend = r600_blend(rctx); - rctx->hw_states.viewport = r600_viewport(rctx); - for (i = 0; i < nr_cbufs; i++) { - rctx->hw_states.cb[i] = r600_cb(rctx, i); + rctx->hw_states.cb_cntl = r600_cb_cntl(rctx); + if (rctx->viewport) { + rctx->hw_states.viewport = rctx->viewport->rstate; } - for (i = 0; i < ucp_nclip; i++) { - rctx->hw_states.ucp[i] = r600_ucp(rctx, i); + if (rctx->blend) { + rctx->hw_states.blend = rctx->blend->rstate; } - rctx->hw_states.db = r600_db(rctx); - rctx->hw_states.cb_cntl = r600_cb_cntl(rctx); + if (rctx->clip) { + rctx->hw_states.ucp = rctx->clip->rstate; + } + for (i = 0; i < rctx->framebuffer->state.framebuffer.nr_cbufs; i++) { + rtexture = (struct r600_resource_texture*)rctx->framebuffer->state.framebuffer.cbufs[i]->texture; + rctx->hw_states.cb[i] = rtexture->cb[i][rctx->framebuffer->state.framebuffer.cbufs[i]->level]; + } + if (rctx->framebuffer->state.framebuffer.zsbuf) { + rtexture = (struct r600_resource_texture*)rctx->framebuffer->state.framebuffer.zsbuf->texture; + rctx->hw_states.db = rtexture->db[rctx->framebuffer->state.framebuffer.zsbuf->level]; + } + for (i = 0; i < rctx->ps_nsampler; i++) { if (rctx->ps_sampler[i]) { - rctx->hw_states.ps_sampler[i] = r600_sampler(rctx, - &rctx->ps_sampler[i]->state.sampler, - i); + rctx->hw_states.ps_sampler[i] = rctx->ps_sampler[i]->rstate; + } else { + rctx->hw_states.ps_sampler[i] = NULL; } } rctx->hw_states.ps_nsampler = rctx->ps_nsampler; for (i = 0; i < rctx->ps_nsampler_view; i++) { if (rctx->ps_sampler_view[i]) { - rctx->hw_states.ps_resource[i] = r600_resource(ctx, - &rctx->ps_sampler_view[i]->state.sampler_view, - i); + rctx->hw_states.ps_resource[i] = rctx->ps_sampler_view[i]->rstate; + } else { + rctx->hw_states.ps_resource[i] = NULL; } } rctx->hw_states.ps_nresource = rctx->ps_nsampler_view; /* bind states */ - for (i = 0; i < ucp_nclip; i++) { - r = radeon_draw_set(rctx->draw, rctx->hw_states.ucp[i]); - if (r) - return r; - } + r = radeon_draw_set(rctx->draw, rctx->hw_states.ucp); + if (r) + return r; r = radeon_draw_set(rctx->draw, rctx->hw_states.db); if (r) return r; diff --git a/src/gallium/drivers/r600/r600_texture.c b/src/gallium/drivers/r600/r600_texture.c index 77d627cdc8..ec1d50566a 100644 --- a/src/gallium/drivers/r600/r600_texture.c +++ b/src/gallium/drivers/r600/r600_texture.c @@ -128,13 +128,25 @@ struct pipe_resource *r600_texture_create(struct pipe_screen *screen, return &resource->base.b; } +static void r600_texture_destroy_state(struct pipe_resource *ptexture) +{ + struct r600_resource_texture *rtexture = (struct r600_resource_texture*)ptexture; + + for (int i = 0; i < PIPE_MAX_TEXTURE_LEVELS; i++) { + radeon_state_decref(rtexture->scissor[i]); + radeon_state_decref(rtexture->db[i]); + for (int j = 0; j < 8; j++) { + radeon_state_decref(rtexture->cb[j][i]); + } + } +} + static void r600_texture_destroy(struct pipe_screen *screen, struct pipe_resource *ptex) { struct r600_resource_texture *rtex = (struct r600_resource_texture*)ptex; struct r600_resource *resource = &rtex->resource; struct r600_screen *rscreen = r600_screen(screen); - unsigned i; if (resource->bo) { radeon_bo_decref(rscreen->rw, resource->bo); @@ -142,11 +154,7 @@ static void r600_texture_destroy(struct pipe_screen *screen, if (rtex->uncompressed) { radeon_bo_decref(rscreen->rw, rtex->uncompressed); } - for (i = 0; i < PIPE_MAX_TEXTURE_LEVELS; i++) { - radeon_state_decref(rtex->scissor[i]); - radeon_state_decref(rtex->cb0[i]); - radeon_state_decref(rtex->db[i]); - } + r600_texture_destroy_state(ptex); FREE(rtex); } @@ -211,9 +219,12 @@ struct pipe_resource *r600_texture_from_handle(struct pipe_screen *screen, pipe_reference_init(&resource->base.b.reference, 1); resource->base.b.screen = screen; resource->bo = bo; + rtex->depth = 0; rtex->pitch_override = whandle->stride; rtex->bpt = util_format_get_blocksize(templ->format); rtex->pitch[0] = whandle->stride; + rtex->width[0] = templ->width0; + rtex->height[0] = templ->height0; rtex->offset[0] = 0; rtex->size = align(rtex->pitch[0] * templ->height0, 64); @@ -696,9 +707,9 @@ static struct radeon_state *r600_texture_state_scissor(struct r600_screen *rscre return rstate; } -static struct radeon_state *r600_texture_state_cb0(struct r600_screen *rscreen, +static struct radeon_state *r600_texture_state_cb(struct r600_screen *rscreen, struct r600_resource_texture *rtexture, - unsigned level) + unsigned cb, unsigned level) { struct radeon_state *rstate; struct r600_resource *rbuffer; @@ -707,7 +718,7 @@ static struct radeon_state *r600_texture_state_cb0(struct r600_screen *rscreen, unsigned format, swap, ntype; const struct util_format_description *desc; - rstate = radeon_state(rscreen->rw, R600_STATE_CB0, 0); + rstate = radeon_state(rscreen->rw, R600_STATE_CB0 + cb, 0); if (rstate == NULL) return NULL; rbuffer = &rtexture->resource; @@ -770,6 +781,10 @@ static struct radeon_state *r600_texture_state_db(struct r600_screen *rscreen, if (rstate == NULL) return NULL; rbuffer = &rtexture->resource; + rtexture->tilled = 1; + rtexture->array_mode = 2; + rtexture->tile_type = 1; + rtexture->depth = 1; /* set states (most default value are 0 and struct already * initialized to 0, thus avoid resetting them) @@ -838,14 +853,14 @@ static struct radeon_state *r600_texture_state_viewport(struct r600_screen *rscr return rstate; } -int r600_texture_cb0(struct pipe_context *ctx, struct r600_resource_texture *rtexture, unsigned level) +int r600_texture_cb(struct pipe_context *ctx, struct r600_resource_texture *rtexture, unsigned cb, unsigned level) { struct r600_screen *rscreen = r600_screen(ctx->screen); - if (rtexture->cb0[level] == NULL) { - rtexture->cb0[level] = r600_texture_state_cb0(rscreen, rtexture, level); - if (rtexture->cb0[level] == NULL) { - R600_ERR("failed to create cb0 state for texture\n"); + if (rtexture->cb[cb][level] == NULL) { + rtexture->cb[cb][level] = r600_texture_state_cb(rscreen, rtexture, cb, level); + if (rtexture->cb[cb][level] == NULL) { + R600_ERR("failed to create cb%d state for texture\n", cb); return -ENOMEM; } } diff --git a/src/gallium/drivers/r600/radeon.h b/src/gallium/drivers/r600/radeon.h index 046c264c04..3f1ca95f69 100644 --- a/src/gallium/drivers/r600/radeon.h +++ b/src/gallium/drivers/r600/radeon.h @@ -109,13 +109,11 @@ struct radeon_state { unsigned id; unsigned shader_index; unsigned nstates; - u32 *states; + u32 states[64]; unsigned npm4; unsigned cpm4; u32 pm4_crc; - u32 *pm4; - u32 nimmd; - u32 *immd; + u32 pm4[128]; unsigned nbo; struct radeon_bo *bo[4]; unsigned nreloc; @@ -130,6 +128,7 @@ struct radeon_state *radeon_state_shader(struct radeon *radeon, u32 type, u32 id struct radeon_state *radeon_state_incref(struct radeon_state *state); struct radeon_state *radeon_state_decref(struct radeon_state *state); int radeon_state_pm4(struct radeon_state *state); +int radeon_state_convert(struct radeon_state *state, u32 stype, u32 id, u32 shader_type); /* * draw functions @@ -219,7 +218,7 @@ enum r600_stype { R600_STATE_DB, R600_STATE_QUERY_BEGIN, R600_STATE_QUERY_END, - R600_STATE_CLIP, + R600_STATE_UCP, R600_STATE_VGT, R600_STATE_DRAW, }; @@ -613,17 +612,37 @@ enum { /* R600_DRAW */ #define R600_DRAW__VGT_NUM_INDICES 0 #define R600_DRAW__VGT_DMA_BASE_HI 1 -#define R600_DRAW__VGT_DMA_BASE 2 +#define R600_DRAW__VGT_DMA_BASE 2 #define R600_DRAW__VGT_DRAW_INITIATOR 3 -#define R600_DRAW_SIZE 4 -#define R600_DRAW_PM4 128 +#define R600_DRAW_SIZE 4 +#define R600_DRAW_PM4 128 /* R600_CLIP */ -#define R600_CLIP__PA_CL_UCP_X_0 0 -#define R600_CLIP__PA_CL_UCP_Y_0 1 -#define R600_CLIP__PA_CL_UCP_Z_0 2 -#define R600_CLIP__PA_CL_UCP_W_0 3 -#define R600_CLIP_SIZE 4 -#define R600_CLIP_PM4 128 +#define R600_CLIP__PA_CL_UCP_X_0 0 +#define R600_CLIP__PA_CL_UCP_Y_0 1 +#define R600_CLIP__PA_CL_UCP_Z_0 2 +#define R600_CLIP__PA_CL_UCP_W_0 3 +#define R600_CLIP__PA_CL_UCP_X_1 4 +#define R600_CLIP__PA_CL_UCP_Y_1 5 +#define R600_CLIP__PA_CL_UCP_Z_1 6 +#define R600_CLIP__PA_CL_UCP_W_1 7 +#define R600_CLIP__PA_CL_UCP_X_2 8 +#define R600_CLIP__PA_CL_UCP_Y_2 9 +#define R600_CLIP__PA_CL_UCP_Z_2 10 +#define R600_CLIP__PA_CL_UCP_W_2 11 +#define R600_CLIP__PA_CL_UCP_X_3 12 +#define R600_CLIP__PA_CL_UCP_Y_3 13 +#define R600_CLIP__PA_CL_UCP_Z_3 14 +#define R600_CLIP__PA_CL_UCP_W_3 15 +#define R600_CLIP__PA_CL_UCP_X_4 16 +#define R600_CLIP__PA_CL_UCP_Y_4 17 +#define R600_CLIP__PA_CL_UCP_Z_4 18 +#define R600_CLIP__PA_CL_UCP_W_4 19 +#define R600_CLIP__PA_CL_UCP_X_5 20 +#define R600_CLIP__PA_CL_UCP_Y_5 21 +#define R600_CLIP__PA_CL_UCP_Z_5 22 +#define R600_CLIP__PA_CL_UCP_W_5 23 +#define R600_CLIP_SIZE 24 +#define R600_CLIP_PM4 128 /* R600 QUERY BEGIN/END */ #define R600_QUERY__OFFSET 0 #define R600_QUERY_SIZE 1 diff --git a/src/gallium/winsys/r600/drm/r600_state.c b/src/gallium/winsys/r600/drm/r600_state.c index e3d0116a2d..f6a428e884 100644 --- a/src/gallium/winsys/r600/drm/r600_state.c +++ b/src/gallium/winsys/r600/drm/r600_state.c @@ -80,7 +80,7 @@ struct radeon_stype_info r600_stypes[] = { { R600_STATE_QUERY_BEGIN, 1, 0, r600_state_pm4_query_begin, SUB_NONE(VGT_EVENT) }, { R600_STATE_QUERY_END, 1, 0, r600_state_pm4_query_end, SUB_NONE(VGT_EVENT) }, { R600_STATE_DB, 1, 0, r600_state_pm4_db, SUB_NONE(DB) }, - { R600_STATE_CLIP, 6, 0, r600_state_pm4_generic, SUB_NONE(UCP) }, + { R600_STATE_UCP, 1, 0, r600_state_pm4_generic, SUB_NONE(UCP) }, { R600_STATE_VGT, 1, 0, r600_state_pm4_vgt, SUB_NONE(VGT) }, { R600_STATE_DRAW, 1, 0, r600_state_pm4_draw, SUB_NONE(DRAW) }, }; @@ -381,13 +381,6 @@ static int r600_state_pm4_draw(struct radeon_state *state) if (r) return r; state->pm4[state->cpm4++] = state->bo[0]->handle; - } else if (state->nimmd) { - state->pm4[state->cpm4++] = PKT3(PKT3_DRAW_INDEX_IMMD, state->nimmd + 1); - state->pm4[state->cpm4++] = state->states[R600_DRAW__VGT_NUM_INDICES]; - state->pm4[state->cpm4++] = state->states[R600_DRAW__VGT_DRAW_INITIATOR]; - for (i = 0; i < state->nimmd; i++) { - state->pm4[state->cpm4++] = state->immd[i]; - } } else { state->pm4[state->cpm4++] = PKT3(PKT3_DRAW_INDEX_AUTO, 1); state->pm4[state->cpm4++] = state->states[R600_DRAW__VGT_NUM_INDICES]; diff --git a/src/gallium/winsys/r600/drm/r600_states.h b/src/gallium/winsys/r600/drm/r600_states.h index 51b69b9220..09d79d498d 100644 --- a/src/gallium/winsys/r600/drm/r600_states.h +++ b/src/gallium/winsys/r600/drm/r600_states.h @@ -284,10 +284,30 @@ static const struct radeon_register R600_names_VS_CONSTANT[] = { }; static const struct radeon_register R600_names_UCP[] = { - {0x00028e20, 0, 0, "PA_CL_UCP0_X"}, - {0x00028e24, 0, 0, "PA_CL_UCP0_Y"}, - {0x00028e28, 0, 0, "PA_CL_UCP0_Z"}, - {0x00028e2c, 0, 0, "PA_CL_UCP0_W"}, + {0x00028E20, 0, 0, "PA_CL_UCP0_X"}, + {0x00028E24, 0, 0, "PA_CL_UCP0_Y"}, + {0x00028E28, 0, 0, "PA_CL_UCP0_Z"}, + {0x00028E2C, 0, 0, "PA_CL_UCP0_W"}, + {0x00028E30, 0, 0, "PA_CL_UCP1_X"}, + {0x00028E34, 0, 0, "PA_CL_UCP1_Y"}, + {0x00028E38, 0, 0, "PA_CL_UCP1_Z"}, + {0x00028E3C, 0, 0, "PA_CL_UCP1_W"}, + {0x00028E40, 0, 0, "PA_CL_UCP2_X"}, + {0x00028E44, 0, 0, "PA_CL_UCP2_Y"}, + {0x00028E48, 0, 0, "PA_CL_UCP2_Z"}, + {0x00028E4C, 0, 0, "PA_CL_UCP2_W"}, + {0x00028E50, 0, 0, "PA_CL_UCP3_X"}, + {0x00028E54, 0, 0, "PA_CL_UCP3_Y"}, + {0x00028E58, 0, 0, "PA_CL_UCP3_Z"}, + {0x00028E5C, 0, 0, "PA_CL_UCP3_W"}, + {0x00028E60, 0, 0, "PA_CL_UCP4_X"}, + {0x00028E64, 0, 0, "PA_CL_UCP4_Y"}, + {0x00028E68, 0, 0, "PA_CL_UCP4_Z"}, + {0x00028E6C, 0, 0, "PA_CL_UCP4_W"}, + {0x00028E70, 0, 0, "PA_CL_UCP5_X"}, + {0x00028E74, 0, 0, "PA_CL_UCP5_Y"}, + {0x00028E78, 0, 0, "PA_CL_UCP5_Z"}, + {0x00028E7C, 0, 0, "PA_CL_UCP5_W"}, }; static const struct radeon_register R600_names_PS_RESOURCE[] = { diff --git a/src/gallium/winsys/r600/drm/radeon_priv.h b/src/gallium/winsys/r600/drm/radeon_priv.h index 66ee5f2177..af5319efd1 100644 --- a/src/gallium/winsys/r600/drm/radeon_priv.h +++ b/src/gallium/winsys/r600/drm/radeon_priv.h @@ -38,19 +38,19 @@ struct radeon_register { }; struct radeon_sub_type { - int shader_type; - const struct radeon_register *regs; - unsigned nstates; + int shader_type; + const struct radeon_register *regs; + unsigned nstates; }; struct radeon_stype_info { - unsigned stype; - unsigned num; - unsigned stride; - radeon_state_pm4_t pm4; - struct radeon_sub_type reginfo[R600_SHADER_MAX]; - unsigned base_id; - unsigned npm4; + unsigned stype; + unsigned num; + unsigned stride; + radeon_state_pm4_t pm4; + struct radeon_sub_type reginfo[R600_SHADER_MAX]; + unsigned base_id; + unsigned npm4; }; struct radeon { diff --git a/src/gallium/winsys/r600/drm/radeon_state.c b/src/gallium/winsys/r600/drm/radeon_state.c index ef09fdfb96..d4e622cf7f 100644 --- a/src/gallium/winsys/r600/drm/radeon_state.c +++ b/src/gallium/winsys/r600/drm/radeon_state.c @@ -80,15 +80,59 @@ struct radeon_state *radeon_state_shader(struct radeon *radeon, u32 stype, u32 i state->refcount = 1; state->npm4 = found->npm4; state->nstates = found->reginfo[shader_index].nstates; - state->states = calloc(1, state->nstates * 4); - state->pm4 = calloc(1, found->npm4 * 4); - if (state->states == NULL || state->pm4 == NULL) { - radeon_state_decref(state); - return NULL; - } return state; } +int radeon_state_convert(struct radeon_state *state, u32 stype, u32 id, u32 shader_type) +{ + struct radeon_stype_info *found = NULL; + int i, j, shader_index = -1; + + if (state == NULL) + return 0; + /* traverse the stype array */ + for (i = 0; i < state->radeon->nstype; i++) { + /* if the type doesn't match, if the shader doesn't match */ + if (stype != state->radeon->stype[i].stype) + continue; + if (shader_type) { + for (j = 0; j < 4; j++) { + if (state->radeon->stype[i].reginfo[j].shader_type == shader_type) { + shader_index = j; + break; + } + } + if (shader_index == -1) + continue; + } else { + if (state->radeon->stype[i].reginfo[0].shader_type) + continue; + else + shader_index = 0; + } + if (id > state->radeon->stype[i].num) + continue; + + found = &state->radeon->stype[i]; + break; + } + + if (!found) { + fprintf(stderr, "%s invalid type %d/id %d/shader class %d\n", __func__, stype, id, shader_type); + return -EINVAL; + } + + if (found->reginfo[shader_index].nstates != state->nstates) { + fprintf(stderr, "invalid type change from (%d %d %d) to (%d %d %d)\n", + state->stype->stype, state->id, state->shader_index, stype, id, shader_index); + } + + state->stype = found; + state->id = id; + state->shader_index = shader_index; + return radeon_state_pm4(state); +} + struct radeon_state *radeon_state(struct radeon *radeon, u32 type, u32 id) { return radeon_state_shader(radeon, type, id, 0); @@ -134,9 +178,6 @@ struct radeon_state *radeon_state_decref(struct radeon_state *state) for (i = 0; i < state->nbo; i++) { state->bo[i] = radeon_bo_decref(state->radeon, state->bo[i]); } - free(state->immd); - free(state->states); - free(state->pm4); memset(state, 0, sizeof(*state)); free(state); return NULL; @@ -179,8 +220,9 @@ int radeon_state_pm4(struct radeon_state *state) { int r; - if (state == NULL || state->cpm4) + if (state == NULL) return 0; + state->cpm4 = 0; r = state->stype->pm4(state); if (r) { fprintf(stderr, "%s failed to build PM4 for state(%d %d)\n", -- cgit v1.2.3 From 9b0ba68b4489557c48efa088c3884120dabc68fb Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Mon, 30 Aug 2010 12:22:39 -0700 Subject: Fix inverted version checks in check_extra. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Previously, if an attribute was enabled by either a specific GL version or an extension, the check would require -both- to be enabled. This bug was not discovered earlier because version checks are currently only ever used on their own. Signed-off-by: Kristian Høgsberg Signed-off-by: Kenneth Graunke --- src/mesa/main/get.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c index 632dadd1a5..a3cb5ec168 100644 --- a/src/mesa/main/get.c +++ b/src/mesa/main/get.c @@ -1661,16 +1661,22 @@ check_extra(GLcontext *ctx, const char *func, const struct value_desc *d) for (e = d->extra; *e != EXTRA_END; e++) switch (*e) { case EXTRA_VERSION_30: - if (version < 30) - return GL_FALSE; + if (version >= 30) { + total++; + enabled++; + } break; case EXTRA_VERSION_31: - if (version < 31) - return GL_FALSE; + if (version >= 31) { + total++; + enabled++; + } break; case EXTRA_VERSION_32: - if (version < 32) - return GL_FALSE; + if (version >= 32) { + total++; + enabled++; + } break; case EXTRA_NEW_BUFFERS: if (ctx->NewState & _NEW_BUFFERS) -- cgit v1.2.3 From bea3963f59fb8da0687c3e3fbc6f15de8be7fddb Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Mon, 30 Aug 2010 11:58:04 -0700 Subject: glsl2: Parse #pragma lines All pragmas are currently ignored. Also, the error messages when a pragma is used incorrectly (i.e., '#pragma debug(on)' inside a function) are crap, but I think this is sufficient for now. Fixes piglit test cases pragma-0[1-8].(vert|frag). --- src/glsl/glsl_lexer.lpp | 24 ++++++++++++++++++++++-- src/glsl/glsl_parser.ypp | 12 +++++++++++- 2 files changed, 33 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/glsl/glsl_lexer.lpp b/src/glsl/glsl_lexer.lpp index 3128cdd3a7..1de1fb4cf7 100644 --- a/src/glsl/glsl_lexer.lpp +++ b/src/glsl/glsl_lexer.lpp @@ -64,7 +64,7 @@ %option prefix="_mesa_glsl_" %option extra-type="struct _mesa_glsl_parse_state *" -%x PP +%x PP PRAGMA DEC_INT [1-9][0-9]* HEX_INT 0[xX][0-9a-fA-F]+ @@ -110,7 +110,27 @@ HASH ^{SPC}#{SPC} */ yylineno = strtol(ptr, &ptr, 0) - 1; } -^[ \t]*#[ \t]*pragma { BEGIN PP; return PRAGMA; } +^{SPC}#{SPC}pragma{SPCP}debug{SPC}\({SPC}on{SPC}\) { + BEGIN PP; + return PRAGMA_DEBUG_ON; + } +^{SPC}#{SPC}pragma{SPCP}debug{SPC}\({SPC}off{SPC}\) { + BEGIN PP; + return PRAGMA_DEBUG_OFF; + } +^{SPC}#{SPC}pragma{SPCP}optimize{SPC}\({SPC}on{SPC}\) { + BEGIN PP; + return PRAGMA_OPTIMIZE_ON; + } +^{SPC}#{SPC}pragma{SPCP}optimize{SPC}\({SPC}off{SPC}\) { + BEGIN PP; + return PRAGMA_OPTIMIZE_OFF; + } +^{SPC}#{SPC}pragma{SPCP} { BEGIN PRAGMA; } + +\n { BEGIN 0; yylineno++; yycolumn = 0; } +. { } + \/\/[^\n]* { } [ \t\r]* { } : return COLON; diff --git a/src/glsl/glsl_parser.ypp b/src/glsl/glsl_parser.ypp index 4b6d9fe7ea..6d99c52503 100644 --- a/src/glsl/glsl_parser.ypp +++ b/src/glsl/glsl_parser.ypp @@ -103,7 +103,9 @@ %token INVARIANT %token LOWP MEDIUMP HIGHP SUPERP PRECISION -%token VERSION EXTENSION LINE PRAGMA COLON EOL INTERFACE OUTPUT +%token VERSION EXTENSION LINE COLON EOL INTERFACE OUTPUT +%token PRAGMA_DEBUG_ON PRAGMA_DEBUG_OFF +%token PRAGMA_OPTIMIZE_ON PRAGMA_OPTIMIZE_OFF %token LAYOUT_TOK /* Reserved words that are not actually used in the grammar. @@ -236,6 +238,13 @@ version_statement: } ; +pragma_statement: + PRAGMA_DEBUG_ON EOL + | PRAGMA_DEBUG_OFF EOL + | PRAGMA_OPTIMIZE_ON EOL + | PRAGMA_OPTIMIZE_OFF EOL + ; + extension_statement_list: | extension_statement_list extension_statement @@ -1496,6 +1505,7 @@ jump_statement: external_declaration: function_definition { $$ = $1; } | declaration { $$ = $1; } + | pragma_statement { $$ = NULL; } ; function_definition: -- cgit v1.2.3 From 33fe364e5aa7de3ce5f46077ff0868dcec4084bb Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Mon, 30 Aug 2010 11:59:48 -0700 Subject: glsl2: Commit generated files changed by previous commit --- src/glsl/glsl_lexer.cpp | 1718 ++++++++++++------------ src/glsl/glsl_parser.cpp | 3313 +++++++++++++++++++++++----------------------- src/glsl/glsl_parser.h | 168 +-- 3 files changed, 2646 insertions(+), 2553 deletions(-) (limited to 'src') diff --git a/src/glsl/glsl_lexer.cpp b/src/glsl/glsl_lexer.cpp index 3cdce995e2..873df609d3 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 177 -#define YY_END_OF_BUFFER 178 +#define YY_NUM_RULES 183 +#define YY_END_OF_BUFFER 184 /* This struct is not used in this scanner, but its presence is necessary. */ struct yy_trans_info @@ -367,81 +367,86 @@ struct yy_trans_info flex_int32_t yy_verify; flex_int32_t yy_nxt; }; -static yyconst flex_int16_t yy_accept[668] = +static yyconst flex_int16_t yy_accept[708] = { 0, - 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, 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 + 0, 0, 15, 15, 0, 0, 184, 182, 1, 20, + 182, 182, 182, 182, 182, 182, 182, 182, 96, 94, + 182, 182, 182, 181, 182, 181, 181, 181, 181, 181, + 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, + 181, 181, 181, 181, 181, 182, 1, 182, 91, 183, + 15, 19, 183, 18, 16, 17, 13, 12, 1, 80, + 87, 81, 90, 84, 75, 86, 76, 93, 98, 85, + 99, 96, 0, 0, 101, 0, 94, 0, 77, 79, + 78, 0, 181, 83, 181, 181, 181, 181, 181, 181, + 181, 181, 181, 181, 181, 181, 28, 181, 181, 181, + + 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, + 32, 181, 181, 56, 181, 181, 181, 181, 181, 181, + 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, + 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, + 181, 181, 181, 181, 181, 92, 82, 1, 0, 0, + 2, 0, 0, 0, 0, 15, 14, 18, 17, 0, + 98, 97, 0, 99, 0, 100, 95, 88, 89, 181, + 104, 181, 181, 181, 181, 181, 181, 181, 181, 181, + 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, + 181, 181, 31, 181, 181, 181, 181, 181, 181, 181, + + 181, 181, 181, 25, 181, 181, 181, 181, 181, 181, + 181, 181, 181, 181, 57, 181, 181, 181, 181, 181, + 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, + 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, + 181, 181, 0, 0, 0, 0, 14, 0, 98, 0, + 97, 0, 99, 100, 181, 181, 23, 181, 181, 144, + 181, 181, 181, 181, 181, 181, 181, 181, 181, 30, + 107, 181, 181, 181, 181, 63, 181, 181, 112, 126, + 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, + 181, 123, 147, 44, 45, 46, 181, 181, 181, 181, + + 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, + 181, 181, 181, 181, 181, 181, 110, 102, 181, 181, + 181, 181, 181, 181, 181, 41, 42, 43, 73, 181, + 181, 0, 0, 0, 0, 0, 97, 181, 181, 26, + 35, 36, 37, 181, 105, 181, 22, 181, 181, 181, + 181, 134, 135, 136, 181, 103, 181, 127, 24, 137, + 138, 139, 149, 131, 132, 133, 181, 181, 181, 58, + 129, 181, 181, 38, 39, 40, 181, 181, 181, 181, + 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, + 181, 181, 124, 181, 181, 181, 181, 181, 181, 181, + + 181, 181, 181, 106, 181, 146, 181, 181, 29, 0, + 0, 0, 0, 153, 181, 181, 151, 181, 181, 181, + 125, 120, 156, 181, 181, 181, 181, 181, 181, 115, + 181, 181, 74, 47, 48, 49, 50, 51, 52, 53, + 54, 55, 181, 181, 181, 181, 130, 111, 181, 181, + 118, 34, 181, 181, 143, 64, 119, 72, 154, 113, + 181, 181, 181, 181, 181, 181, 181, 0, 0, 0, + 0, 181, 181, 181, 114, 33, 181, 181, 181, 181, + 181, 181, 157, 158, 159, 181, 181, 181, 181, 148, + 181, 181, 181, 181, 181, 181, 181, 181, 108, 181, + + 181, 181, 181, 181, 59, 181, 60, 181, 0, 0, + 0, 0, 0, 181, 61, 27, 121, 161, 162, 163, + 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, + 181, 116, 181, 181, 181, 181, 181, 181, 181, 181, + 181, 109, 165, 166, 167, 181, 181, 128, 117, 0, + 0, 6, 0, 0, 0, 11, 3, 21, 181, 181, + 181, 181, 181, 181, 181, 181, 181, 160, 122, 62, + 145, 181, 152, 150, 180, 66, 67, 68, 181, 181, + 181, 181, 181, 181, 0, 0, 0, 0, 0, 0, + 181, 181, 181, 164, 181, 181, 181, 181, 181, 181, + + 181, 181, 181, 181, 181, 181, 181, 181, 181, 168, + 4, 0, 5, 0, 0, 0, 0, 0, 181, 181, + 181, 181, 181, 181, 181, 177, 181, 181, 181, 181, + 181, 181, 69, 181, 181, 181, 0, 0, 0, 181, + 181, 178, 169, 181, 170, 181, 181, 181, 181, 181, + 181, 181, 181, 181, 179, 0, 0, 171, 172, 175, + 176, 65, 181, 140, 181, 141, 155, 173, 174, 0, + 0, 181, 181, 181, 0, 0, 0, 70, 181, 71, + 0, 0, 0, 181, 0, 0, 0, 181, 0, 0, + 7, 0, 0, 181, 0, 8, 0, 0, 142, 0, + + 0, 0, 0, 9, 0, 10, 0 } ; static yyconst flex_int32_t yy_ec[256] = @@ -449,17 +454,17 @@ static yyconst flex_int32_t yy_ec[256] = 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, 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, 2, 5, 1, 6, 1, 7, 8, 1, 9, + 10, 11, 12, 1, 13, 14, 15, 16, 17, 18, + 19, 20, 21, 21, 21, 22, 22, 23, 1, 24, + 25, 26, 1, 1, 27, 28, 29, 30, 31, 32, + 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, + 33, 34, 35, 33, 33, 33, 33, 36, 33, 33, + 1, 1, 1, 37, 38, 1, 39, 40, 41, 42, + + 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, + 53, 54, 33, 55, 56, 57, 58, 59, 60, 61, + 62, 63, 1, 64, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, @@ -476,296 +481,314 @@ static yyconst flex_int32_t yy_ec[256] = 1, 1, 1, 1, 1 } ; -static yyconst flex_int32_t yy_meta[63] = +static yyconst flex_int32_t yy_meta[65] = { 0, 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 + 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[678] = +static yyconst flex_int16_t yy_base[719] = { 0, - 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 + 0, 63, 88, 0, 1076, 1075, 1077, 1080, 64, 1080, + 1051, 1050, 59, 1049, 58, 60, 58, 1048, 139, 187, + 47, 1047, 56, 0, 1034, 121, 110, 137, 138, 134, + 163, 1017, 173, 177, 115, 149, 140, 1011, 159, 121, + 187, 194, 194, 172, 1022, 171, 249, 240, 1042, 1080, + 250, 1080, 1051, 241, 1080, 0, 1080, 1080, 262, 1080, + 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 236, 1080, + 238, 187, 286, 303, 1080, 0, 0, 1040, 1080, 1080, + 1080, 1039, 0, 1080, 1006, 1011, 1004, 1007, 1016, 1015, + 1001, 1004, 1016, 35, 1010, 997, 994, 1008, 994, 991, + + 991, 997, 215, 232, 991, 1002, 987, 993, 997, 998, + 0, 989, 1000, 234, 995, 975, 226, 979, 993, 983, + 119, 976, 234, 989, 991, 973, 969, 977, 974, 963, + 972, 256, 970, 976, 971, 974, 962, 965, 967, 245, + 970, 961, 974, 227, 967, 1080, 1080, 308, 294, 324, + 1080, 952, 965, 956, 967, 329, 0, 338, 0, 368, + 1080, 303, 379, 1080, 386, 393, 0, 1080, 1080, 962, + 0, 953, 957, 967, 964, 947, 946, 946, 950, 216, + 961, 958, 958, 956, 953, 944, 951, 937, 935, 948, + 933, 950, 0, 947, 934, 942, 939, 943, 944, 937, + + 934, 922, 921, 935, 938, 935, 922, 929, 919, 320, + 925, 928, 918, 926, 914, 918, 909, 924, 914, 905, + 924, 907, 905, 916, 905, 900, 898, 912, 897, 899, + 896, 908, 907, 910, 288, 901, 895, 884, 331, 903, + 905, 893, 885, 889, 901, 884, 0, 400, 410, 427, + 1080, 439, 446, 1080, 879, 890, 0, 887, 343, 0, + 880, 878, 880, 875, 884, 872, 890, 878, 346, 0, + 0, 872, 883, 882, 882, 0, 866, 350, 0, 0, + 868, 353, 876, 877, 867, 861, 860, 861, 860, 357, + 856, 0, 0, 852, 851, 850, 852, 853, 858, 852, + + 848, 862, 857, 856, 855, 846, 849, 849, 841, 844, + 839, 848, 853, 838, 851, 841, 0, 0, 848, 844, + 835, 835, 841, 840, 837, 0, 0, 0, 0, 826, + 839, 838, 837, 834, 822, 453, 463, 834, 836, 0, + 0, 0, 0, 822, 0, 822, 0, 821, 822, 816, + 827, 0, 0, 0, 817, 0, 813, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 824, 469, 823, 0, + 0, 821, 817, 0, 0, 0, 806, 415, 432, 473, + 811, 807, 813, 803, 801, 815, 799, 799, 813, 801, + 813, 808, 0, 806, 803, 807, 790, 792, 799, 805, + + 800, 799, 786, 0, 788, 0, 787, 791, 0, 785, + 834, 784, 787, 0, 775, 785, 0, 773, 773, 787, + 0, 789, 0, 482, 797, 796, 795, 766, 765, 0, + 783, 782, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 766, 780, 766, 763, 0, 0, 769, 768, + 0, 0, 766, 758, 0, 0, 0, 0, 0, 0, + 755, 767, 485, 759, 766, 763, 757, 750, 503, 766, + 751, 746, 760, 758, 0, 0, 750, 769, 768, 767, + 738, 737, 301, 481, 0, 750, 753, 751, 739, 0, + 749, 746, 745, 734, 733, 732, 509, 741, 0, 753, + + 752, 751, 722, 721, 0, 736, 0, 734, 729, 515, + 527, 773, 722, 730, 0, 0, 0, 745, 744, 0, + 726, 729, 713, 721, 711, 719, 720, 720, 719, 704, + 717, 0, 718, 706, 705, 701, 725, 724, 723, 694, + 693, 0, 723, 722, 0, 704, 707, 0, 0, 693, + 537, 1080, 561, 0, 567, 340, 1080, 0, 690, 689, + 699, 699, 686, 701, 684, 699, 694, 0, 0, 0, + 0, 679, 0, 0, 0, 700, 389, 700, 689, 692, + 676, 675, 685, 685, 675, 529, 589, 474, 683, 671, + 669, 668, 679, 0, 682, 678, 680, 676, 662, 669, + + 669, 671, 667, 669, 667, 667, 654, 653, 664, 0, + 1080, 531, 1080, 596, 0, 616, 666, 648, 665, 664, + 647, 635, 643, 633, 634, 0, 627, 646, 635, 607, + 604, 601, 0, 604, 603, 586, 533, 572, 580, 564, + 563, 0, 0, 564, 0, 540, 554, 552, 516, 530, + 505, 486, 453, 450, 0, 461, 443, 0, 0, 0, + 0, 0, 400, 406, 385, 0, 0, 0, 0, 343, + 389, 319, 267, 249, 487, 341, 235, 0, 200, 0, + 507, 498, 184, 157, 150, 564, 559, 136, 565, 591, + 1080, 593, 550, 112, 594, 1080, 569, 576, 0, 123, + + 619, 621, 637, 1080, 638, 1080, 1080, 648, 653, 658, + 663, 665, 667, 673, 680, 685, 690, 695 } ; -static yyconst flex_int16_t yy_def[678] = +static yyconst flex_int16_t yy_def[719] = { 0, - 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 + 707, 1, 707, 3, 708, 708, 707, 707, 707, 707, + 707, 707, 707, 707, 707, 707, 707, 707, 707, 707, + 707, 707, 707, 709, 707, 709, 709, 709, 709, 709, + 709, 709, 709, 709, 709, 709, 709, 709, 709, 709, + 709, 709, 709, 709, 709, 707, 707, 707, 707, 707, + 707, 707, 707, 707, 707, 710, 707, 707, 707, 707, + 707, 707, 707, 707, 707, 707, 707, 707, 711, 707, + 712, 19, 707, 707, 707, 713, 20, 707, 707, 707, + 707, 707, 709, 707, 709, 709, 709, 709, 709, 709, + 709, 709, 709, 709, 709, 709, 709, 709, 709, 709, + + 709, 709, 709, 709, 709, 709, 709, 709, 709, 709, + 709, 709, 709, 709, 709, 709, 709, 709, 709, 709, + 709, 709, 709, 709, 709, 709, 709, 709, 709, 709, + 709, 709, 709, 709, 709, 709, 709, 709, 709, 709, + 709, 709, 709, 709, 709, 707, 707, 707, 707, 707, + 707, 707, 707, 707, 707, 707, 714, 707, 710, 707, + 707, 712, 707, 707, 707, 707, 713, 707, 707, 709, + 709, 709, 709, 709, 709, 709, 709, 709, 709, 709, + 709, 709, 709, 709, 709, 709, 709, 709, 709, 709, + 709, 709, 709, 709, 709, 709, 709, 709, 709, 709, + + 709, 709, 709, 709, 709, 709, 709, 709, 709, 709, + 709, 709, 709, 709, 709, 709, 709, 709, 709, 709, + 709, 709, 709, 709, 709, 709, 709, 709, 709, 709, + 709, 709, 709, 709, 709, 709, 709, 709, 709, 709, + 709, 709, 707, 707, 707, 707, 714, 707, 707, 707, + 707, 707, 707, 707, 709, 709, 709, 709, 709, 709, + 709, 709, 709, 709, 709, 709, 709, 709, 709, 709, + 709, 709, 709, 709, 709, 709, 709, 709, 709, 709, + 709, 709, 709, 709, 709, 709, 709, 709, 709, 709, + 709, 709, 709, 709, 709, 709, 709, 709, 709, 709, + + 709, 709, 709, 709, 709, 709, 709, 709, 709, 709, + 709, 709, 709, 709, 709, 709, 709, 709, 709, 709, + 709, 709, 709, 709, 709, 709, 709, 709, 709, 709, + 709, 707, 707, 707, 707, 707, 707, 709, 709, 709, + 709, 709, 709, 709, 709, 709, 709, 709, 709, 709, + 709, 709, 709, 709, 709, 709, 709, 709, 709, 709, + 709, 709, 709, 709, 709, 709, 709, 709, 709, 709, + 709, 709, 709, 709, 709, 709, 709, 709, 709, 709, + 709, 709, 709, 709, 709, 709, 709, 709, 709, 709, + 709, 709, 709, 709, 709, 709, 709, 709, 709, 709, + + 709, 709, 709, 709, 709, 709, 709, 709, 709, 707, + 707, 707, 707, 709, 709, 709, 709, 709, 709, 709, + 709, 709, 709, 709, 709, 709, 709, 709, 709, 709, + 709, 709, 709, 709, 709, 709, 709, 709, 709, 709, + 709, 709, 709, 709, 709, 709, 709, 709, 709, 709, + 709, 709, 709, 709, 709, 709, 709, 709, 709, 709, + 709, 709, 709, 709, 709, 709, 709, 707, 707, 707, + 707, 709, 709, 709, 709, 709, 709, 709, 709, 709, + 709, 709, 709, 709, 709, 709, 709, 709, 709, 709, + 709, 709, 709, 709, 709, 709, 709, 709, 709, 709, + + 709, 709, 709, 709, 709, 709, 709, 709, 707, 715, + 707, 707, 707, 709, 709, 709, 709, 709, 709, 709, + 709, 709, 709, 709, 709, 709, 709, 709, 709, 709, + 709, 709, 709, 709, 709, 709, 709, 709, 709, 709, + 709, 709, 709, 709, 709, 709, 709, 709, 709, 707, + 707, 707, 707, 716, 707, 707, 707, 709, 709, 709, + 709, 709, 709, 709, 709, 709, 709, 709, 709, 709, + 709, 709, 709, 709, 709, 709, 709, 709, 709, 709, + 709, 709, 709, 709, 707, 717, 707, 716, 707, 707, + 709, 709, 709, 709, 709, 709, 709, 709, 709, 709, + + 709, 709, 709, 709, 709, 709, 709, 709, 709, 709, + 707, 707, 707, 707, 718, 707, 707, 707, 709, 709, + 709, 709, 709, 709, 709, 709, 709, 709, 709, 709, + 709, 709, 709, 709, 709, 709, 718, 707, 707, 709, + 709, 709, 709, 709, 709, 709, 709, 709, 709, 709, + 709, 709, 709, 709, 709, 707, 707, 709, 709, 709, + 709, 709, 709, 709, 709, 709, 709, 709, 709, 707, + 707, 709, 709, 709, 707, 707, 707, 709, 709, 709, + 707, 707, 707, 709, 707, 707, 707, 709, 707, 707, + 707, 707, 707, 709, 707, 707, 707, 707, 709, 707, + + 707, 707, 707, 707, 707, 707, 0, 707, 707, 707, + 707, 707, 707, 707, 707, 707, 707, 707 } ; -static yyconst flex_int16_t yy_nxt[1076] = +static yyconst flex_int16_t yy_nxt[1145] = { 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, 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, 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 + 8, 9, 10, 9, 11, 8, 12, 13, 8, 8, + 14, 15, 16, 17, 18, 19, 20, 20, 20, 20, + 20, 20, 8, 21, 22, 23, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 25, 24, 26, 27, + 28, 29, 30, 31, 32, 33, 34, 24, 24, 35, + 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, + 24, 24, 24, 46, 47, 59, 62, 59, 48, 65, + 78, 79, 67, 69, 69, 69, 69, 69, 69, 69, + 81, 82, 66, 63, 68, 179, 180, 49, 50, 51, + 52, 51, 50, 50, 50, 50, 50, 50, 50, 50, + + 50, 50, 53, 50, 54, 54, 54, 54, 54, 54, + 55, 50, 50, 50, 56, 56, 56, 56, 56, 56, + 56, 56, 56, 56, 50, 56, 56, 56, 56, 56, + 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, + 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, + 56, 50, 71, 116, 72, 72, 72, 72, 72, 72, + 73, 85, 88, 126, 89, 213, 702, 117, 90, 74, + 75, 699, 214, 127, 76, 91, 86, 87, 120, 92, + 95, 74, 75, 99, 96, 100, 93, 118, 694, 94, + 97, 119, 121, 689, 101, 146, 98, 123, 688, 76, + + 71, 102, 77, 77, 77, 77, 77, 77, 77, 103, + 142, 108, 104, 124, 143, 105, 125, 74, 75, 109, + 111, 106, 707, 112, 144, 128, 687, 113, 114, 74, + 75, 110, 129, 130, 147, 115, 135, 131, 684, 136, + 139, 150, 151, 132, 133, 140, 134, 707, 137, 141, + 148, 156, 59, 156, 149, 138, 158, 158, 158, 158, + 158, 158, 158, 59, 189, 59, 160, 161, 163, 164, + 191, 264, 265, 240, 216, 190, 241, 208, 160, 161, + 163, 164, 152, 201, 192, 209, 202, 203, 217, 153, + 204, 235, 205, 154, 226, 150, 151, 683, 155, 71, + + 236, 73, 73, 73, 73, 73, 73, 73, 680, 148, + 227, 59, 679, 149, 165, 165, 74, 75, 166, 166, + 166, 166, 166, 166, 166, 150, 151, 523, 74, 75, + 156, 321, 156, 250, 251, 524, 152, 294, 295, 296, + 322, 556, 681, 153, 675, 250, 251, 154, 326, 327, + 328, 676, 155, 158, 158, 158, 158, 158, 158, 158, + 341, 342, 343, 352, 353, 354, 152, 360, 361, 362, + 364, 365, 366, 153, 374, 375, 376, 154, 678, 248, + 248, 589, 155, 249, 249, 249, 249, 249, 249, 249, + 252, 252, 590, 682, 253, 253, 253, 253, 253, 253, + + 253, 166, 166, 166, 166, 166, 166, 166, 166, 166, + 166, 166, 166, 166, 166, 249, 249, 249, 249, 249, + 249, 249, 602, 603, 254, 249, 249, 249, 249, 249, + 249, 249, 434, 435, 436, 677, 254, 674, 336, 336, + 673, 161, 337, 337, 337, 337, 337, 337, 337, 437, + 438, 439, 672, 161, 253, 253, 253, 253, 253, 253, + 253, 253, 253, 253, 253, 253, 253, 253, 337, 337, + 337, 337, 337, 337, 337, 551, 552, 164, 337, 337, + 337, 337, 337, 337, 337, 425, 426, 427, 675, 164, + 440, 441, 442, 671, 251, 676, 428, 429, 478, 479, + + 480, 500, 501, 502, 469, 670, 251, 525, 681, 481, + 482, 669, 503, 504, 668, 526, 551, 552, 510, 511, + 511, 511, 511, 511, 511, 537, 538, 539, 551, 552, + 612, 613, 612, 613, 612, 613, 540, 541, 551, 552, + 667, 685, 555, 555, 555, 555, 555, 555, 555, 686, + 554, 697, 586, 587, 587, 587, 587, 587, 587, 682, + 692, 666, 551, 552, 615, 690, 695, 693, 551, 552, + 697, 665, 664, 691, 696, 554, 553, 553, 553, 553, + 553, 553, 555, 555, 555, 555, 555, 555, 555, 615, + 612, 613, 690, 663, 692, 695, 662, 612, 613, 661, + + 691, 693, 698, 696, 616, 616, 616, 616, 616, 616, + 616, 614, 614, 614, 614, 614, 614, 612, 613, 700, + 703, 698, 705, 660, 659, 658, 657, 701, 704, 656, + 706, 616, 616, 616, 616, 616, 616, 616, 703, 705, + 655, 654, 653, 652, 651, 650, 704, 706, 57, 57, + 57, 57, 57, 57, 57, 57, 83, 83, 83, 83, + 83, 159, 159, 159, 159, 159, 69, 69, 162, 162, + 167, 167, 167, 247, 247, 649, 247, 247, 247, 247, + 247, 553, 553, 553, 648, 647, 646, 553, 588, 588, + 588, 614, 614, 614, 645, 644, 643, 614, 637, 637, + + 637, 642, 641, 640, 639, 638, 636, 635, 634, 633, + 632, 631, 630, 629, 628, 627, 626, 625, 624, 623, + 622, 621, 620, 619, 618, 617, 611, 610, 609, 608, + 607, 606, 605, 604, 601, 600, 599, 598, 597, 596, + 595, 594, 593, 592, 591, 585, 584, 583, 582, 581, + 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, 550, 549, 548, 547, 546, + 545, 544, 543, 542, 536, 535, 534, 533, 532, 531, + 530, 529, 528, 527, 522, 521, 520, 519, 518, 517, + + 516, 515, 514, 513, 512, 509, 508, 507, 506, 505, + 499, 498, 497, 496, 495, 494, 493, 492, 491, 490, + 489, 488, 487, 486, 485, 484, 483, 477, 476, 475, + 474, 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, 433, 432, 431, 430, 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, 395, 394, 393, 392, 391, + + 390, 389, 388, 387, 386, 385, 384, 383, 382, 381, + 380, 379, 378, 377, 373, 372, 371, 370, 369, 368, + 367, 363, 359, 358, 357, 356, 355, 351, 350, 349, + 348, 347, 346, 345, 344, 340, 339, 338, 335, 334, + 333, 332, 331, 330, 329, 325, 324, 323, 320, 319, + 318, 317, 316, 315, 314, 313, 312, 311, 310, 309, + 308, 307, 306, 305, 304, 303, 302, 301, 300, 299, + 298, 297, 293, 292, 291, 290, 289, 288, 287, 286, + 285, 284, 283, 282, 281, 280, 279, 278, 277, 276, + 275, 274, 273, 272, 271, 270, 269, 268, 267, 266, + + 263, 262, 261, 260, 259, 258, 257, 256, 255, 246, + 245, 244, 243, 242, 239, 238, 237, 234, 233, 232, + 231, 230, 229, 228, 225, 224, 223, 222, 221, 220, + 219, 218, 215, 212, 211, 210, 207, 206, 200, 199, + 198, 197, 196, 195, 194, 193, 188, 187, 186, 185, + 184, 183, 182, 181, 178, 177, 176, 175, 174, 173, + 172, 171, 170, 169, 168, 157, 80, 145, 122, 107, + 84, 80, 70, 64, 61, 60, 707, 58, 58, 7, + 707, 707, 707, 707, 707, 707, 707, 707, 707, 707, + 707, 707, 707, 707, 707, 707, 707, 707, 707, 707, + + 707, 707, 707, 707, 707, 707, 707, 707, 707, 707, + 707, 707, 707, 707, 707, 707, 707, 707, 707, 707, + 707, 707, 707, 707, 707, 707, 707, 707, 707, 707, + 707, 707, 707, 707, 707, 707, 707, 707, 707, 707, + 707, 707, 707, 707 } ; -static yyconst flex_int16_t yy_chk[1076] = +static yyconst flex_int16_t yy_chk[1145] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, @@ -773,118 +796,126 @@ static yyconst flex_int16_t yy_chk[1076] = 1, 1, 1, 1, 1, 1, 1, 1, 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, 33, 14, - 15, 15, 15, 15, 15, 15, 15, 19, 19, 11, - 13, 14, 33, 2, 3, 3, 3, 3, 3, 3, + 1, 1, 1, 1, 2, 9, 13, 9, 2, 15, + 21, 21, 16, 17, 17, 17, 17, 17, 17, 17, + 23, 23, 15, 13, 16, 94, 94, 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, 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 + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 19, 35, 19, 19, 19, 19, 19, 19, + 19, 26, 27, 40, 27, 121, 700, 35, 27, 19, + 19, 694, 121, 40, 19, 28, 26, 26, 37, 28, + 29, 19, 19, 30, 29, 30, 28, 36, 688, 28, + 29, 36, 37, 685, 30, 46, 29, 39, 684, 19, + + 20, 31, 20, 20, 20, 20, 20, 20, 20, 31, + 44, 33, 31, 39, 44, 31, 39, 20, 20, 33, + 34, 31, 72, 34, 44, 41, 683, 34, 34, 20, + 20, 33, 41, 41, 46, 34, 42, 41, 679, 42, + 43, 48, 48, 41, 41, 43, 41, 72, 42, 43, + 47, 51, 47, 51, 47, 42, 54, 54, 54, 54, + 54, 54, 54, 59, 103, 59, 69, 69, 71, 71, + 104, 180, 180, 144, 123, 103, 144, 117, 69, 69, + 71, 71, 48, 114, 104, 117, 114, 114, 123, 48, + 114, 140, 114, 48, 132, 149, 149, 677, 48, 73, + + 140, 73, 73, 73, 73, 73, 73, 73, 674, 148, + 132, 148, 673, 148, 74, 74, 73, 73, 74, 74, + 74, 74, 74, 74, 74, 150, 150, 483, 73, 73, + 156, 235, 156, 162, 162, 483, 149, 210, 210, 210, + 235, 556, 676, 149, 670, 162, 162, 149, 239, 239, + 239, 670, 149, 158, 158, 158, 158, 158, 158, 158, + 259, 259, 259, 269, 269, 269, 150, 278, 278, 278, + 282, 282, 282, 150, 290, 290, 290, 150, 672, 160, + 160, 556, 150, 160, 160, 160, 160, 160, 160, 160, + 163, 163, 556, 676, 163, 163, 163, 163, 163, 163, + + 163, 165, 165, 165, 165, 165, 165, 165, 166, 166, + 166, 166, 166, 166, 166, 248, 248, 248, 248, 248, + 248, 248, 577, 577, 166, 249, 249, 249, 249, 249, + 249, 249, 378, 378, 378, 671, 166, 665, 250, 250, + 664, 249, 250, 250, 250, 250, 250, 250, 250, 379, + 379, 379, 663, 249, 252, 252, 252, 252, 252, 252, + 252, 253, 253, 253, 253, 253, 253, 253, 336, 336, + 336, 336, 336, 336, 336, 588, 588, 253, 337, 337, + 337, 337, 337, 337, 337, 368, 368, 368, 675, 253, + 380, 380, 380, 657, 337, 675, 368, 368, 424, 424, + + 424, 463, 463, 463, 469, 656, 337, 484, 681, 424, + 424, 654, 463, 463, 653, 484, 510, 510, 469, 469, + 469, 469, 469, 469, 469, 497, 497, 497, 511, 511, + 586, 586, 612, 612, 637, 637, 497, 497, 551, 551, + 652, 682, 511, 511, 511, 511, 511, 511, 511, 682, + 510, 693, 551, 551, 551, 551, 551, 551, 551, 681, + 687, 651, 553, 553, 586, 686, 689, 687, 555, 555, + 697, 650, 649, 686, 689, 510, 553, 553, 553, 553, + 553, 553, 555, 555, 555, 555, 555, 555, 555, 586, + 587, 587, 690, 648, 692, 695, 647, 614, 614, 646, + + 690, 692, 693, 695, 587, 587, 587, 587, 587, 587, + 587, 614, 614, 614, 614, 614, 614, 616, 616, 698, + 701, 697, 702, 644, 641, 640, 639, 698, 701, 638, + 702, 616, 616, 616, 616, 616, 616, 616, 703, 705, + 636, 635, 634, 632, 631, 630, 703, 705, 708, 708, + 708, 708, 708, 708, 708, 708, 709, 709, 709, 709, + 709, 710, 710, 710, 710, 710, 711, 711, 712, 712, + 713, 713, 713, 714, 714, 629, 714, 714, 714, 714, + 714, 715, 715, 715, 628, 627, 625, 715, 716, 716, + 716, 717, 717, 717, 624, 623, 622, 717, 718, 718, + + 718, 621, 620, 619, 618, 617, 609, 608, 607, 606, + 605, 604, 603, 602, 601, 600, 599, 598, 597, 596, + 595, 593, 592, 591, 590, 589, 585, 584, 583, 582, + 581, 580, 579, 578, 576, 572, 567, 566, 565, 564, + 563, 562, 561, 560, 559, 550, 547, 546, 544, 543, + 541, 540, 539, 538, 537, 536, 535, 534, 533, 531, + 530, 529, 528, 527, 526, 525, 524, 523, 522, 521, + 519, 518, 514, 513, 512, 509, 508, 506, 504, 503, + 502, 501, 500, 498, 496, 495, 494, 493, 492, 491, + 489, 488, 487, 486, 482, 481, 480, 479, 478, 477, + + 474, 473, 472, 471, 470, 468, 467, 466, 465, 464, + 462, 461, 454, 453, 450, 449, 446, 445, 444, 443, + 432, 431, 429, 428, 427, 426, 425, 422, 420, 419, + 418, 416, 415, 413, 412, 411, 410, 408, 407, 405, + 403, 402, 401, 400, 399, 398, 397, 396, 395, 394, + 392, 391, 390, 389, 388, 387, 386, 385, 384, 383, + 382, 381, 377, 373, 372, 369, 367, 357, 355, 351, + 350, 349, 348, 346, 344, 339, 338, 335, 334, 333, + 332, 331, 330, 325, 324, 323, 322, 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, 291, 289, 288, 287, 286, 285, 284, + 283, 281, 277, 275, 274, 273, 272, 268, 267, 266, + 265, 264, 263, 262, 261, 258, 256, 255, 246, 245, + 244, 243, 242, 241, 240, 238, 237, 236, 234, 233, + 232, 231, 230, 229, 228, 227, 226, 225, 224, 223, + 222, 221, 220, 219, 218, 217, 216, 215, 214, 213, + 212, 211, 209, 208, 207, 206, 205, 204, 203, 202, + 201, 200, 199, 198, 197, 196, 195, 194, 192, 191, + 190, 189, 188, 187, 186, 185, 184, 183, 182, 181, + + 179, 178, 177, 176, 175, 174, 173, 172, 170, 155, + 154, 153, 152, 145, 143, 142, 141, 139, 138, 137, + 136, 135, 134, 133, 131, 130, 129, 128, 127, 126, + 125, 124, 122, 120, 119, 118, 116, 115, 113, 112, + 110, 109, 108, 107, 106, 105, 102, 101, 100, 99, + 98, 97, 96, 95, 93, 92, 91, 90, 89, 88, + 87, 86, 85, 82, 78, 53, 49, 45, 38, 32, + 25, 22, 18, 14, 12, 11, 7, 6, 5, 707, + 707, 707, 707, 707, 707, 707, 707, 707, 707, 707, + 707, 707, 707, 707, 707, 707, 707, 707, 707, 707, + + 707, 707, 707, 707, 707, 707, 707, 707, 707, 707, + 707, 707, 707, 707, 707, 707, 707, 707, 707, 707, + 707, 707, 707, 707, 707, 707, 707, 707, 707, 707, + 707, 707, 707, 707, 707, 707, 707, 707, 707, 707, + 707, 707, 707, 707 } ; /* The intent behind this definition is that it'll catch @@ -954,10 +985,11 @@ static yyconst flex_int16_t yy_chk[1076] = } \ } while (0) -#line 958 "glsl_lexer.cpp" +#line 989 "glsl_lexer.cpp" #define INITIAL 0 #define PP 1 +#define PRAGMA 2 #define YY_EXTRA_TYPE struct _mesa_glsl_parse_state * @@ -1195,7 +1227,7 @@ YY_DECL #line 76 "glsl_lexer.lpp" -#line 1199 "glsl_lexer.cpp" +#line 1231 "glsl_lexer.cpp" yylval = yylval_param; @@ -1253,13 +1285,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 >= 668 ) + if ( yy_current_state >= 708 ) 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 != 667 ); + while ( yy_current_state != 707 ); yy_cp = yyg->yy_last_accepting_cpos; yy_current_state = yyg->yy_last_accepting_state; @@ -1349,319 +1381,362 @@ YY_RULE_SETUP case 7: YY_RULE_SETUP #line 113 "glsl_lexer.lpp" -{ BEGIN PP; return PRAGMA; } +{ + BEGIN PP; + return PRAGMA_DEBUG_ON; + } YY_BREAK case 8: YY_RULE_SETUP -#line 114 "glsl_lexer.lpp" -{ } +#line 117 "glsl_lexer.lpp" +{ + BEGIN PP; + return PRAGMA_DEBUG_OFF; + } YY_BREAK case 9: YY_RULE_SETUP -#line 115 "glsl_lexer.lpp" -{ } +#line 121 "glsl_lexer.lpp" +{ + BEGIN PP; + return PRAGMA_OPTIMIZE_ON; + } YY_BREAK case 10: YY_RULE_SETUP -#line 116 "glsl_lexer.lpp" -return COLON; +#line 125 "glsl_lexer.lpp" +{ + BEGIN PP; + return PRAGMA_OPTIMIZE_OFF; + } YY_BREAK case 11: YY_RULE_SETUP -#line 117 "glsl_lexer.lpp" +#line 129 "glsl_lexer.lpp" +{ BEGIN PRAGMA; } + YY_BREAK +case 12: +/* rule 12 can match eol */ +YY_RULE_SETUP +#line 131 "glsl_lexer.lpp" +{ BEGIN 0; yylineno++; yycolumn = 0; } + YY_BREAK +case 13: +YY_RULE_SETUP +#line 132 "glsl_lexer.lpp" +{ } + YY_BREAK +case 14: +YY_RULE_SETUP +#line 134 "glsl_lexer.lpp" +{ } + YY_BREAK +case 15: +YY_RULE_SETUP +#line 135 "glsl_lexer.lpp" +{ } + YY_BREAK +case 16: +YY_RULE_SETUP +#line 136 "glsl_lexer.lpp" +return COLON; + YY_BREAK +case 17: +YY_RULE_SETUP +#line 137 "glsl_lexer.lpp" { yylval->identifier = strdup(yytext); return IDENTIFIER; } YY_BREAK -case 12: +case 18: YY_RULE_SETUP -#line 121 "glsl_lexer.lpp" +#line 141 "glsl_lexer.lpp" { yylval->n = strtol(yytext, NULL, 10); return INTCONSTANT; } YY_BREAK -case 13: -/* rule 13 can match eol */ +case 19: +/* rule 19 can match eol */ YY_RULE_SETUP -#line 125 "glsl_lexer.lpp" +#line 145 "glsl_lexer.lpp" { BEGIN 0; yylineno++; yycolumn = 0; return EOL; } YY_BREAK -case 14: -/* rule 14 can match eol */ +case 20: +/* rule 20 can match eol */ YY_RULE_SETUP -#line 127 "glsl_lexer.lpp" +#line 147 "glsl_lexer.lpp" { yylineno++; yycolumn = 0; } YY_BREAK -case 15: +case 21: YY_RULE_SETUP -#line 129 "glsl_lexer.lpp" +#line 149 "glsl_lexer.lpp" return ATTRIBUTE; YY_BREAK -case 16: +case 22: YY_RULE_SETUP -#line 130 "glsl_lexer.lpp" +#line 150 "glsl_lexer.lpp" return CONST_TOK; YY_BREAK -case 17: +case 23: YY_RULE_SETUP -#line 131 "glsl_lexer.lpp" +#line 151 "glsl_lexer.lpp" return BOOL_TOK; YY_BREAK -case 18: +case 24: YY_RULE_SETUP -#line 132 "glsl_lexer.lpp" +#line 152 "glsl_lexer.lpp" return FLOAT_TOK; YY_BREAK -case 19: +case 25: YY_RULE_SETUP -#line 133 "glsl_lexer.lpp" +#line 153 "glsl_lexer.lpp" return INT_TOK; YY_BREAK -case 20: +case 26: YY_RULE_SETUP -#line 135 "glsl_lexer.lpp" +#line 155 "glsl_lexer.lpp" return BREAK; YY_BREAK -case 21: +case 27: YY_RULE_SETUP -#line 136 "glsl_lexer.lpp" +#line 156 "glsl_lexer.lpp" return CONTINUE; YY_BREAK -case 22: +case 28: YY_RULE_SETUP -#line 137 "glsl_lexer.lpp" +#line 157 "glsl_lexer.lpp" return DO; YY_BREAK -case 23: +case 29: YY_RULE_SETUP -#line 138 "glsl_lexer.lpp" +#line 158 "glsl_lexer.lpp" return WHILE; YY_BREAK -case 24: +case 30: YY_RULE_SETUP -#line 139 "glsl_lexer.lpp" +#line 159 "glsl_lexer.lpp" return ELSE; YY_BREAK -case 25: +case 31: YY_RULE_SETUP -#line 140 "glsl_lexer.lpp" +#line 160 "glsl_lexer.lpp" return FOR; YY_BREAK -case 26: +case 32: YY_RULE_SETUP -#line 141 "glsl_lexer.lpp" +#line 161 "glsl_lexer.lpp" return IF; YY_BREAK -case 27: +case 33: YY_RULE_SETUP -#line 142 "glsl_lexer.lpp" +#line 162 "glsl_lexer.lpp" return DISCARD; YY_BREAK -case 28: +case 34: YY_RULE_SETUP -#line 143 "glsl_lexer.lpp" +#line 163 "glsl_lexer.lpp" return RETURN; YY_BREAK -case 29: +case 35: YY_RULE_SETUP -#line 145 "glsl_lexer.lpp" +#line 165 "glsl_lexer.lpp" return BVEC2; YY_BREAK -case 30: +case 36: YY_RULE_SETUP -#line 146 "glsl_lexer.lpp" +#line 166 "glsl_lexer.lpp" return BVEC3; YY_BREAK -case 31: +case 37: YY_RULE_SETUP -#line 147 "glsl_lexer.lpp" +#line 167 "glsl_lexer.lpp" return BVEC4; YY_BREAK -case 32: +case 38: YY_RULE_SETUP -#line 148 "glsl_lexer.lpp" +#line 168 "glsl_lexer.lpp" return IVEC2; YY_BREAK -case 33: +case 39: YY_RULE_SETUP -#line 149 "glsl_lexer.lpp" +#line 169 "glsl_lexer.lpp" return IVEC3; YY_BREAK -case 34: +case 40: YY_RULE_SETUP -#line 150 "glsl_lexer.lpp" +#line 170 "glsl_lexer.lpp" return IVEC4; YY_BREAK -case 35: +case 41: YY_RULE_SETUP -#line 151 "glsl_lexer.lpp" +#line 171 "glsl_lexer.lpp" return VEC2; YY_BREAK -case 36: +case 42: YY_RULE_SETUP -#line 152 "glsl_lexer.lpp" +#line 172 "glsl_lexer.lpp" return VEC3; YY_BREAK -case 37: +case 43: YY_RULE_SETUP -#line 153 "glsl_lexer.lpp" +#line 173 "glsl_lexer.lpp" return VEC4; YY_BREAK -case 38: +case 44: YY_RULE_SETUP -#line 154 "glsl_lexer.lpp" +#line 174 "glsl_lexer.lpp" return MAT2X2; YY_BREAK -case 39: +case 45: YY_RULE_SETUP -#line 155 "glsl_lexer.lpp" +#line 175 "glsl_lexer.lpp" return MAT3X3; YY_BREAK -case 40: +case 46: YY_RULE_SETUP -#line 156 "glsl_lexer.lpp" +#line 176 "glsl_lexer.lpp" return MAT4X4; YY_BREAK -case 41: +case 47: YY_RULE_SETUP -#line 157 "glsl_lexer.lpp" +#line 177 "glsl_lexer.lpp" TOKEN_OR_IDENTIFIER(120, MAT2X2); YY_BREAK -case 42: +case 48: YY_RULE_SETUP -#line 158 "glsl_lexer.lpp" +#line 178 "glsl_lexer.lpp" TOKEN_OR_IDENTIFIER(120, MAT2X3); YY_BREAK -case 43: +case 49: YY_RULE_SETUP -#line 159 "glsl_lexer.lpp" +#line 179 "glsl_lexer.lpp" TOKEN_OR_IDENTIFIER(120, MAT2X4); YY_BREAK -case 44: +case 50: YY_RULE_SETUP -#line 160 "glsl_lexer.lpp" +#line 180 "glsl_lexer.lpp" TOKEN_OR_IDENTIFIER(120, MAT3X2); YY_BREAK -case 45: +case 51: YY_RULE_SETUP -#line 161 "glsl_lexer.lpp" +#line 181 "glsl_lexer.lpp" TOKEN_OR_IDENTIFIER(120, MAT3X3); YY_BREAK -case 46: +case 52: YY_RULE_SETUP -#line 162 "glsl_lexer.lpp" +#line 182 "glsl_lexer.lpp" TOKEN_OR_IDENTIFIER(120, MAT3X4); YY_BREAK -case 47: +case 53: YY_RULE_SETUP -#line 163 "glsl_lexer.lpp" +#line 183 "glsl_lexer.lpp" TOKEN_OR_IDENTIFIER(120, MAT4X2); YY_BREAK -case 48: +case 54: YY_RULE_SETUP -#line 164 "glsl_lexer.lpp" +#line 184 "glsl_lexer.lpp" TOKEN_OR_IDENTIFIER(120, MAT4X3); YY_BREAK -case 49: +case 55: YY_RULE_SETUP -#line 165 "glsl_lexer.lpp" +#line 185 "glsl_lexer.lpp" TOKEN_OR_IDENTIFIER(120, MAT4X4); YY_BREAK -case 50: +case 56: YY_RULE_SETUP -#line 167 "glsl_lexer.lpp" +#line 187 "glsl_lexer.lpp" return IN_TOK; YY_BREAK -case 51: +case 57: YY_RULE_SETUP -#line 168 "glsl_lexer.lpp" +#line 188 "glsl_lexer.lpp" return OUT_TOK; YY_BREAK -case 52: +case 58: YY_RULE_SETUP -#line 169 "glsl_lexer.lpp" +#line 189 "glsl_lexer.lpp" return INOUT_TOK; YY_BREAK -case 53: +case 59: YY_RULE_SETUP -#line 170 "glsl_lexer.lpp" +#line 190 "glsl_lexer.lpp" return UNIFORM; YY_BREAK -case 54: +case 60: YY_RULE_SETUP -#line 171 "glsl_lexer.lpp" +#line 191 "glsl_lexer.lpp" return VARYING; YY_BREAK -case 55: +case 61: YY_RULE_SETUP -#line 172 "glsl_lexer.lpp" +#line 192 "glsl_lexer.lpp" TOKEN_OR_IDENTIFIER(120, CENTROID); YY_BREAK -case 56: +case 62: YY_RULE_SETUP -#line 173 "glsl_lexer.lpp" +#line 193 "glsl_lexer.lpp" TOKEN_OR_IDENTIFIER(120, INVARIANT); YY_BREAK -case 57: +case 63: YY_RULE_SETUP -#line 175 "glsl_lexer.lpp" +#line 195 "glsl_lexer.lpp" TOKEN_OR_IDENTIFIER(130, FLAT); YY_BREAK -case 58: +case 64: YY_RULE_SETUP -#line 176 "glsl_lexer.lpp" +#line 196 "glsl_lexer.lpp" TOKEN_OR_IDENTIFIER(130, SMOOTH); YY_BREAK -case 59: +case 65: YY_RULE_SETUP -#line 177 "glsl_lexer.lpp" +#line 197 "glsl_lexer.lpp" TOKEN_OR_IDENTIFIER(130, NOPERSPECTIVE); YY_BREAK -case 60: +case 66: YY_RULE_SETUP -#line 179 "glsl_lexer.lpp" +#line 199 "glsl_lexer.lpp" return SAMPLER1D; YY_BREAK -case 61: +case 67: YY_RULE_SETUP -#line 180 "glsl_lexer.lpp" +#line 200 "glsl_lexer.lpp" return SAMPLER2D; YY_BREAK -case 62: +case 68: YY_RULE_SETUP -#line 181 "glsl_lexer.lpp" +#line 201 "glsl_lexer.lpp" return SAMPLER3D; YY_BREAK -case 63: +case 69: YY_RULE_SETUP -#line 182 "glsl_lexer.lpp" +#line 202 "glsl_lexer.lpp" return SAMPLERCUBE; YY_BREAK -case 64: +case 70: YY_RULE_SETUP -#line 183 "glsl_lexer.lpp" +#line 203 "glsl_lexer.lpp" return SAMPLER1DSHADOW; YY_BREAK -case 65: +case 71: YY_RULE_SETUP -#line 184 "glsl_lexer.lpp" +#line 204 "glsl_lexer.lpp" return SAMPLER2DSHADOW; YY_BREAK -case 66: +case 72: YY_RULE_SETUP -#line 186 "glsl_lexer.lpp" +#line 206 "glsl_lexer.lpp" return STRUCT; YY_BREAK -case 67: +case 73: YY_RULE_SETUP -#line 187 "glsl_lexer.lpp" +#line 207 "glsl_lexer.lpp" return VOID_TOK; YY_BREAK -case 68: +case 74: YY_RULE_SETUP -#line 189 "glsl_lexer.lpp" +#line 209 "glsl_lexer.lpp" { if ((yyextra->language_version >= 140) || (yyextra->ARB_fragment_coord_conventions_enable)){ @@ -1672,572 +1747,572 @@ YY_RULE_SETUP } } YY_BREAK -case 69: +case 75: YY_RULE_SETUP -#line 199 "glsl_lexer.lpp" +#line 219 "glsl_lexer.lpp" return INC_OP; YY_BREAK -case 70: +case 76: YY_RULE_SETUP -#line 200 "glsl_lexer.lpp" +#line 220 "glsl_lexer.lpp" return DEC_OP; YY_BREAK -case 71: +case 77: YY_RULE_SETUP -#line 201 "glsl_lexer.lpp" +#line 221 "glsl_lexer.lpp" return LE_OP; YY_BREAK -case 72: +case 78: YY_RULE_SETUP -#line 202 "glsl_lexer.lpp" +#line 222 "glsl_lexer.lpp" return GE_OP; YY_BREAK -case 73: +case 79: YY_RULE_SETUP -#line 203 "glsl_lexer.lpp" +#line 223 "glsl_lexer.lpp" return EQ_OP; YY_BREAK -case 74: +case 80: YY_RULE_SETUP -#line 204 "glsl_lexer.lpp" +#line 224 "glsl_lexer.lpp" return NE_OP; YY_BREAK -case 75: +case 81: YY_RULE_SETUP -#line 205 "glsl_lexer.lpp" +#line 225 "glsl_lexer.lpp" return AND_OP; YY_BREAK -case 76: +case 82: YY_RULE_SETUP -#line 206 "glsl_lexer.lpp" +#line 226 "glsl_lexer.lpp" return OR_OP; YY_BREAK -case 77: +case 83: YY_RULE_SETUP -#line 207 "glsl_lexer.lpp" +#line 227 "glsl_lexer.lpp" return XOR_OP; YY_BREAK -case 78: +case 84: YY_RULE_SETUP -#line 209 "glsl_lexer.lpp" +#line 229 "glsl_lexer.lpp" return MUL_ASSIGN; YY_BREAK -case 79: +case 85: YY_RULE_SETUP -#line 210 "glsl_lexer.lpp" +#line 230 "glsl_lexer.lpp" return DIV_ASSIGN; YY_BREAK -case 80: +case 86: YY_RULE_SETUP -#line 211 "glsl_lexer.lpp" +#line 231 "glsl_lexer.lpp" return ADD_ASSIGN; YY_BREAK -case 81: +case 87: YY_RULE_SETUP -#line 212 "glsl_lexer.lpp" +#line 232 "glsl_lexer.lpp" return MOD_ASSIGN; YY_BREAK -case 82: +case 88: YY_RULE_SETUP -#line 213 "glsl_lexer.lpp" +#line 233 "glsl_lexer.lpp" return LEFT_ASSIGN; YY_BREAK -case 83: +case 89: YY_RULE_SETUP -#line 214 "glsl_lexer.lpp" +#line 234 "glsl_lexer.lpp" return RIGHT_ASSIGN; YY_BREAK -case 84: +case 90: YY_RULE_SETUP -#line 215 "glsl_lexer.lpp" +#line 235 "glsl_lexer.lpp" return AND_ASSIGN; YY_BREAK -case 85: +case 91: YY_RULE_SETUP -#line 216 "glsl_lexer.lpp" +#line 236 "glsl_lexer.lpp" return XOR_ASSIGN; YY_BREAK -case 86: +case 92: YY_RULE_SETUP -#line 217 "glsl_lexer.lpp" +#line 237 "glsl_lexer.lpp" return OR_ASSIGN; YY_BREAK -case 87: +case 93: YY_RULE_SETUP -#line 218 "glsl_lexer.lpp" +#line 238 "glsl_lexer.lpp" return SUB_ASSIGN; YY_BREAK -case 88: +case 94: YY_RULE_SETUP -#line 220 "glsl_lexer.lpp" +#line 240 "glsl_lexer.lpp" { yylval->n = strtol(yytext, NULL, 10); return INTCONSTANT; } YY_BREAK -case 89: +case 95: YY_RULE_SETUP -#line 224 "glsl_lexer.lpp" +#line 244 "glsl_lexer.lpp" { yylval->n = strtol(yytext + 2, NULL, 16); return INTCONSTANT; } YY_BREAK -case 90: +case 96: YY_RULE_SETUP -#line 228 "glsl_lexer.lpp" +#line 248 "glsl_lexer.lpp" { yylval->n = strtol(yytext, NULL, 8); return INTCONSTANT; } YY_BREAK -case 91: +case 97: YY_RULE_SETUP -#line 233 "glsl_lexer.lpp" +#line 253 "glsl_lexer.lpp" { yylval->real = strtod(yytext, NULL); return FLOATCONSTANT; } YY_BREAK -case 92: +case 98: YY_RULE_SETUP -#line 237 "glsl_lexer.lpp" +#line 257 "glsl_lexer.lpp" { yylval->real = strtod(yytext, NULL); return FLOATCONSTANT; } YY_BREAK -case 93: +case 99: YY_RULE_SETUP -#line 241 "glsl_lexer.lpp" +#line 261 "glsl_lexer.lpp" { yylval->real = strtod(yytext, NULL); return FLOATCONSTANT; } YY_BREAK -case 94: +case 100: YY_RULE_SETUP -#line 245 "glsl_lexer.lpp" +#line 265 "glsl_lexer.lpp" { yylval->real = strtod(yytext, NULL); return FLOATCONSTANT; } YY_BREAK -case 95: +case 101: YY_RULE_SETUP -#line 249 "glsl_lexer.lpp" +#line 269 "glsl_lexer.lpp" { yylval->real = strtod(yytext, NULL); return FLOATCONSTANT; } YY_BREAK -case 96: +case 102: YY_RULE_SETUP -#line 254 "glsl_lexer.lpp" +#line 274 "glsl_lexer.lpp" { yylval->n = 1; return BOOLCONSTANT; } YY_BREAK -case 97: +case 103: YY_RULE_SETUP -#line 258 "glsl_lexer.lpp" +#line 278 "glsl_lexer.lpp" { yylval->n = 0; return BOOLCONSTANT; } YY_BREAK /* Reserved words in GLSL 1.10. */ -case 98: +case 104: YY_RULE_SETUP -#line 265 "glsl_lexer.lpp" +#line 285 "glsl_lexer.lpp" RESERVED_WORD(999, ASM); YY_BREAK -case 99: +case 105: YY_RULE_SETUP -#line 266 "glsl_lexer.lpp" +#line 286 "glsl_lexer.lpp" RESERVED_WORD(999, CLASS); YY_BREAK -case 100: +case 106: YY_RULE_SETUP -#line 267 "glsl_lexer.lpp" +#line 287 "glsl_lexer.lpp" RESERVED_WORD(999, UNION); YY_BREAK -case 101: +case 107: YY_RULE_SETUP -#line 268 "glsl_lexer.lpp" +#line 288 "glsl_lexer.lpp" RESERVED_WORD(999, ENUM); YY_BREAK -case 102: +case 108: YY_RULE_SETUP -#line 269 "glsl_lexer.lpp" +#line 289 "glsl_lexer.lpp" RESERVED_WORD(999, TYPEDEF); YY_BREAK -case 103: +case 109: YY_RULE_SETUP -#line 270 "glsl_lexer.lpp" +#line 290 "glsl_lexer.lpp" RESERVED_WORD(999, TEMPLATE); YY_BREAK -case 104: +case 110: YY_RULE_SETUP -#line 271 "glsl_lexer.lpp" +#line 291 "glsl_lexer.lpp" RESERVED_WORD(999, THIS); YY_BREAK -case 105: +case 111: YY_RULE_SETUP -#line 272 "glsl_lexer.lpp" +#line 292 "glsl_lexer.lpp" RESERVED_WORD(999, PACKED_TOK); YY_BREAK -case 106: +case 112: YY_RULE_SETUP -#line 273 "glsl_lexer.lpp" +#line 293 "glsl_lexer.lpp" RESERVED_WORD(999, GOTO); YY_BREAK -case 107: +case 113: YY_RULE_SETUP -#line 274 "glsl_lexer.lpp" +#line 294 "glsl_lexer.lpp" RESERVED_WORD(130, SWITCH); YY_BREAK -case 108: +case 114: YY_RULE_SETUP -#line 275 "glsl_lexer.lpp" +#line 295 "glsl_lexer.lpp" RESERVED_WORD(130, DEFAULT); YY_BREAK -case 109: +case 115: YY_RULE_SETUP -#line 276 "glsl_lexer.lpp" +#line 296 "glsl_lexer.lpp" RESERVED_WORD(999, INLINE_TOK); YY_BREAK -case 110: +case 116: YY_RULE_SETUP -#line 277 "glsl_lexer.lpp" +#line 297 "glsl_lexer.lpp" RESERVED_WORD(999, NOINLINE); YY_BREAK -case 111: +case 117: YY_RULE_SETUP -#line 278 "glsl_lexer.lpp" +#line 298 "glsl_lexer.lpp" RESERVED_WORD(999, VOLATILE); YY_BREAK -case 112: +case 118: YY_RULE_SETUP -#line 279 "glsl_lexer.lpp" +#line 299 "glsl_lexer.lpp" RESERVED_WORD(999, PUBLIC_TOK); YY_BREAK -case 113: +case 119: YY_RULE_SETUP -#line 280 "glsl_lexer.lpp" +#line 300 "glsl_lexer.lpp" RESERVED_WORD(999, STATIC); YY_BREAK -case 114: +case 120: YY_RULE_SETUP -#line 281 "glsl_lexer.lpp" +#line 301 "glsl_lexer.lpp" RESERVED_WORD(999, EXTERN); YY_BREAK -case 115: +case 121: YY_RULE_SETUP -#line 282 "glsl_lexer.lpp" +#line 302 "glsl_lexer.lpp" RESERVED_WORD(999, EXTERNAL); YY_BREAK -case 116: +case 122: YY_RULE_SETUP -#line 283 "glsl_lexer.lpp" +#line 303 "glsl_lexer.lpp" RESERVED_WORD(999, INTERFACE); YY_BREAK -case 117: +case 123: YY_RULE_SETUP -#line 284 "glsl_lexer.lpp" +#line 304 "glsl_lexer.lpp" RESERVED_WORD(999, LONG_TOK); YY_BREAK -case 118: +case 124: YY_RULE_SETUP -#line 285 "glsl_lexer.lpp" +#line 305 "glsl_lexer.lpp" RESERVED_WORD(999, SHORT_TOK); YY_BREAK -case 119: +case 125: YY_RULE_SETUP -#line 286 "glsl_lexer.lpp" +#line 306 "glsl_lexer.lpp" RESERVED_WORD(999, DOUBLE_TOK); YY_BREAK -case 120: +case 126: YY_RULE_SETUP -#line 287 "glsl_lexer.lpp" +#line 307 "glsl_lexer.lpp" RESERVED_WORD(999, HALF); YY_BREAK -case 121: +case 127: YY_RULE_SETUP -#line 288 "glsl_lexer.lpp" +#line 308 "glsl_lexer.lpp" RESERVED_WORD(999, FIXED_TOK); YY_BREAK -case 122: +case 128: YY_RULE_SETUP -#line 289 "glsl_lexer.lpp" +#line 309 "glsl_lexer.lpp" RESERVED_WORD(999, UNSIGNED); YY_BREAK -case 123: +case 129: YY_RULE_SETUP -#line 290 "glsl_lexer.lpp" +#line 310 "glsl_lexer.lpp" RESERVED_WORD(999, INPUT_TOK); YY_BREAK -case 124: +case 130: YY_RULE_SETUP -#line 291 "glsl_lexer.lpp" +#line 311 "glsl_lexer.lpp" RESERVED_WORD(999, OUTPUT); YY_BREAK -case 125: +case 131: YY_RULE_SETUP -#line 292 "glsl_lexer.lpp" +#line 312 "glsl_lexer.lpp" RESERVED_WORD(999, HVEC2); YY_BREAK -case 126: +case 132: YY_RULE_SETUP -#line 293 "glsl_lexer.lpp" +#line 313 "glsl_lexer.lpp" RESERVED_WORD(999, HVEC3); YY_BREAK -case 127: +case 133: YY_RULE_SETUP -#line 294 "glsl_lexer.lpp" +#line 314 "glsl_lexer.lpp" RESERVED_WORD(999, HVEC4); YY_BREAK -case 128: +case 134: YY_RULE_SETUP -#line 295 "glsl_lexer.lpp" +#line 315 "glsl_lexer.lpp" RESERVED_WORD(999, DVEC2); YY_BREAK -case 129: +case 135: YY_RULE_SETUP -#line 296 "glsl_lexer.lpp" +#line 316 "glsl_lexer.lpp" RESERVED_WORD(999, DVEC3); YY_BREAK -case 130: +case 136: YY_RULE_SETUP -#line 297 "glsl_lexer.lpp" +#line 317 "glsl_lexer.lpp" RESERVED_WORD(999, DVEC4); YY_BREAK -case 131: +case 137: YY_RULE_SETUP -#line 298 "glsl_lexer.lpp" +#line 318 "glsl_lexer.lpp" RESERVED_WORD(999, FVEC2); YY_BREAK -case 132: +case 138: YY_RULE_SETUP -#line 299 "glsl_lexer.lpp" +#line 319 "glsl_lexer.lpp" RESERVED_WORD(999, FVEC3); YY_BREAK -case 133: +case 139: YY_RULE_SETUP -#line 300 "glsl_lexer.lpp" +#line 320 "glsl_lexer.lpp" RESERVED_WORD(999, FVEC4); YY_BREAK -case 134: +case 140: YY_RULE_SETUP -#line 301 "glsl_lexer.lpp" +#line 321 "glsl_lexer.lpp" return SAMPLER2DRECT; YY_BREAK -case 135: +case 141: YY_RULE_SETUP -#line 302 "glsl_lexer.lpp" +#line 322 "glsl_lexer.lpp" RESERVED_WORD(999, SAMPLER3DRECT); YY_BREAK -case 136: +case 142: YY_RULE_SETUP -#line 303 "glsl_lexer.lpp" +#line 323 "glsl_lexer.lpp" return SAMPLER2DRECTSHADOW; YY_BREAK -case 137: +case 143: YY_RULE_SETUP -#line 304 "glsl_lexer.lpp" +#line 324 "glsl_lexer.lpp" RESERVED_WORD(999, SIZEOF); YY_BREAK -case 138: +case 144: YY_RULE_SETUP -#line 305 "glsl_lexer.lpp" +#line 325 "glsl_lexer.lpp" RESERVED_WORD(999, CAST); YY_BREAK -case 139: +case 145: YY_RULE_SETUP -#line 306 "glsl_lexer.lpp" +#line 326 "glsl_lexer.lpp" RESERVED_WORD(999, NAMESPACE); YY_BREAK -case 140: +case 146: YY_RULE_SETUP -#line 307 "glsl_lexer.lpp" +#line 327 "glsl_lexer.lpp" RESERVED_WORD(999, USING); YY_BREAK /* Additional reserved words in GLSL 1.20. */ -case 141: +case 147: YY_RULE_SETUP -#line 310 "glsl_lexer.lpp" +#line 330 "glsl_lexer.lpp" TOKEN_OR_IDENTIFIER(120, LOWP); YY_BREAK -case 142: +case 148: YY_RULE_SETUP -#line 311 "glsl_lexer.lpp" +#line 331 "glsl_lexer.lpp" TOKEN_OR_IDENTIFIER(120, MEDIUMP); YY_BREAK -case 143: +case 149: YY_RULE_SETUP -#line 312 "glsl_lexer.lpp" +#line 332 "glsl_lexer.lpp" TOKEN_OR_IDENTIFIER(120, HIGHP); YY_BREAK -case 144: +case 150: YY_RULE_SETUP -#line 313 "glsl_lexer.lpp" +#line 333 "glsl_lexer.lpp" TOKEN_OR_IDENTIFIER(120, PRECISION); YY_BREAK /* Additional reserved words in GLSL 1.30. */ -case 145: +case 151: YY_RULE_SETUP -#line 316 "glsl_lexer.lpp" +#line 336 "glsl_lexer.lpp" TOKEN_OR_IDENTIFIER(130, COMMON); YY_BREAK -case 146: +case 152: YY_RULE_SETUP -#line 317 "glsl_lexer.lpp" +#line 337 "glsl_lexer.lpp" TOKEN_OR_IDENTIFIER(130, PARTITION); YY_BREAK -case 147: +case 153: YY_RULE_SETUP -#line 318 "glsl_lexer.lpp" +#line 338 "glsl_lexer.lpp" TOKEN_OR_IDENTIFIER(130, ACTIVE); YY_BREAK -case 148: +case 154: YY_RULE_SETUP -#line 319 "glsl_lexer.lpp" +#line 339 "glsl_lexer.lpp" TOKEN_OR_IDENTIFIER(130, SUPERP); YY_BREAK -case 149: +case 155: YY_RULE_SETUP -#line 320 "glsl_lexer.lpp" +#line 340 "glsl_lexer.lpp" TOKEN_OR_IDENTIFIER(130, SAMPLERBUFFER); YY_BREAK -case 150: +case 156: YY_RULE_SETUP -#line 321 "glsl_lexer.lpp" +#line 341 "glsl_lexer.lpp" TOKEN_OR_IDENTIFIER(130, FILTER); YY_BREAK -case 151: +case 157: YY_RULE_SETUP -#line 322 "glsl_lexer.lpp" +#line 342 "glsl_lexer.lpp" TOKEN_OR_IDENTIFIER(130, IMAGE1D); YY_BREAK -case 152: +case 158: YY_RULE_SETUP -#line 323 "glsl_lexer.lpp" +#line 343 "glsl_lexer.lpp" TOKEN_OR_IDENTIFIER(130, IMAGE2D); YY_BREAK -case 153: +case 159: YY_RULE_SETUP -#line 324 "glsl_lexer.lpp" +#line 344 "glsl_lexer.lpp" TOKEN_OR_IDENTIFIER(130, IMAGE3D); YY_BREAK -case 154: +case 160: YY_RULE_SETUP -#line 325 "glsl_lexer.lpp" +#line 345 "glsl_lexer.lpp" TOKEN_OR_IDENTIFIER(130, IMAGECUBE); YY_BREAK -case 155: +case 161: YY_RULE_SETUP -#line 326 "glsl_lexer.lpp" +#line 346 "glsl_lexer.lpp" TOKEN_OR_IDENTIFIER(130, IIMAGE1D); YY_BREAK -case 156: +case 162: YY_RULE_SETUP -#line 327 "glsl_lexer.lpp" +#line 347 "glsl_lexer.lpp" TOKEN_OR_IDENTIFIER(130, IIMAGE2D); YY_BREAK -case 157: +case 163: YY_RULE_SETUP -#line 328 "glsl_lexer.lpp" +#line 348 "glsl_lexer.lpp" TOKEN_OR_IDENTIFIER(130, IIMAGE3D); YY_BREAK -case 158: +case 164: YY_RULE_SETUP -#line 329 "glsl_lexer.lpp" +#line 349 "glsl_lexer.lpp" TOKEN_OR_IDENTIFIER(130, IIMAGECUBE); YY_BREAK -case 159: +case 165: YY_RULE_SETUP -#line 330 "glsl_lexer.lpp" +#line 350 "glsl_lexer.lpp" TOKEN_OR_IDENTIFIER(130, UIMAGE1D); YY_BREAK -case 160: +case 166: YY_RULE_SETUP -#line 331 "glsl_lexer.lpp" +#line 351 "glsl_lexer.lpp" TOKEN_OR_IDENTIFIER(130, UIMAGE2D); YY_BREAK -case 161: +case 167: YY_RULE_SETUP -#line 332 "glsl_lexer.lpp" +#line 352 "glsl_lexer.lpp" TOKEN_OR_IDENTIFIER(130, UIMAGE3D); YY_BREAK -case 162: +case 168: YY_RULE_SETUP -#line 333 "glsl_lexer.lpp" +#line 353 "glsl_lexer.lpp" TOKEN_OR_IDENTIFIER(130, UIMAGECUBE); YY_BREAK -case 163: +case 169: YY_RULE_SETUP -#line 334 "glsl_lexer.lpp" +#line 354 "glsl_lexer.lpp" TOKEN_OR_IDENTIFIER(130, IMAGE1DARRAY); YY_BREAK -case 164: +case 170: YY_RULE_SETUP -#line 335 "glsl_lexer.lpp" +#line 355 "glsl_lexer.lpp" TOKEN_OR_IDENTIFIER(130, IMAGE2DARRAY); YY_BREAK -case 165: +case 171: YY_RULE_SETUP -#line 336 "glsl_lexer.lpp" +#line 356 "glsl_lexer.lpp" TOKEN_OR_IDENTIFIER(130, IIMAGE1DARRAY); YY_BREAK -case 166: +case 172: YY_RULE_SETUP -#line 337 "glsl_lexer.lpp" +#line 357 "glsl_lexer.lpp" TOKEN_OR_IDENTIFIER(130, IIMAGE2DARRAY); YY_BREAK -case 167: +case 173: YY_RULE_SETUP -#line 338 "glsl_lexer.lpp" +#line 358 "glsl_lexer.lpp" TOKEN_OR_IDENTIFIER(130, UIMAGE1DARRAY); YY_BREAK -case 168: +case 174: YY_RULE_SETUP -#line 339 "glsl_lexer.lpp" +#line 359 "glsl_lexer.lpp" TOKEN_OR_IDENTIFIER(130, UIMAGE2DARRAY); YY_BREAK -case 169: +case 175: YY_RULE_SETUP -#line 340 "glsl_lexer.lpp" +#line 360 "glsl_lexer.lpp" TOKEN_OR_IDENTIFIER(130, IMAGE1DSHADOW); YY_BREAK -case 170: +case 176: YY_RULE_SETUP -#line 341 "glsl_lexer.lpp" +#line 361 "glsl_lexer.lpp" TOKEN_OR_IDENTIFIER(130, IMAGE2DSHADOW); YY_BREAK -case 171: +case 177: YY_RULE_SETUP -#line 342 "glsl_lexer.lpp" +#line 362 "glsl_lexer.lpp" TOKEN_OR_IDENTIFIER(130, IMAGEBUFFER); YY_BREAK -case 172: +case 178: YY_RULE_SETUP -#line 343 "glsl_lexer.lpp" +#line 363 "glsl_lexer.lpp" TOKEN_OR_IDENTIFIER(130, IIMAGEBUFFER); YY_BREAK -case 173: +case 179: YY_RULE_SETUP -#line 344 "glsl_lexer.lpp" +#line 364 "glsl_lexer.lpp" TOKEN_OR_IDENTIFIER(130, UIMAGEBUFFER); YY_BREAK -case 174: +case 180: YY_RULE_SETUP -#line 345 "glsl_lexer.lpp" +#line 365 "glsl_lexer.lpp" TOKEN_OR_IDENTIFIER(130, ROW_MAJOR); YY_BREAK -case 175: +case 181: YY_RULE_SETUP -#line 347 "glsl_lexer.lpp" +#line 367 "glsl_lexer.lpp" { struct _mesa_glsl_parse_state *state = yyextra; void *ctx = state; @@ -2245,19 +2320,20 @@ YY_RULE_SETUP return IDENTIFIER; } YY_BREAK -case 176: +case 182: YY_RULE_SETUP -#line 354 "glsl_lexer.lpp" +#line 374 "glsl_lexer.lpp" { return yytext[0]; } YY_BREAK -case 177: +case 183: YY_RULE_SETUP -#line 356 "glsl_lexer.lpp" +#line 376 "glsl_lexer.lpp" ECHO; YY_BREAK -#line 2259 "glsl_lexer.cpp" +#line 2334 "glsl_lexer.cpp" case YY_STATE_EOF(INITIAL): case YY_STATE_EOF(PP): +case YY_STATE_EOF(PRAGMA): yyterminate(); case YY_END_OF_BUFFER: @@ -2552,7 +2628,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 >= 668 ) + if ( yy_current_state >= 708 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; @@ -2581,11 +2657,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 >= 668 ) + if ( yy_current_state >= 708 ) 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 == 667); + yy_is_jam = (yy_current_state == 707); return yy_is_jam ? 0 : yy_current_state; } @@ -3397,7 +3473,7 @@ void _mesa_glsl_free (void * ptr , yyscan_t yyscanner) #define YYTABLES_NAME "yytables" -#line 356 "glsl_lexer.lpp" +#line 376 "glsl_lexer.lpp" diff --git a/src/glsl/glsl_parser.cpp b/src/glsl/glsl_parser.cpp index 188d128526..e36bb03c43 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.3. */ + +/* 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, - 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.3" +#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 @@ -249,82 +250,85 @@ 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 + COLON = 367, + EOL = 368, + INTERFACE = 369, + OUTPUT = 370, + PRAGMA_DEBUG_ON = 371, + PRAGMA_DEBUG_OFF = 372, + PRAGMA_OPTIMIZE_ON = 373, + PRAGMA_OPTIMIZE_OFF = 374, + LAYOUT_TOK = 375, + ASM = 376, + CLASS = 377, + UNION = 378, + ENUM = 379, + TYPEDEF = 380, + TEMPLATE = 381, + THIS = 382, + PACKED_TOK = 383, + GOTO = 384, + INLINE_TOK = 385, + NOINLINE = 386, + VOLATILE = 387, + PUBLIC_TOK = 388, + STATIC = 389, + EXTERN = 390, + EXTERNAL = 391, + LONG_TOK = 392, + SHORT_TOK = 393, + DOUBLE_TOK = 394, + HALF = 395, + FIXED_TOK = 396, + UNSIGNED = 397, + INPUT_TOK = 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 }; #endif @@ -366,7 +370,7 @@ typedef union YYSTYPE /* Line 214 of yacc.c */ -#line 370 "glsl_parser.cpp" +#line 374 "glsl_parser.cpp" } YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ @@ -391,7 +395,7 @@ typedef struct YYLTYPE /* Line 264 of yacc.c */ -#line 395 "glsl_parser.cpp" +#line 399 "glsl_parser.cpp" #ifdef short # undef short @@ -441,7 +445,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) @@ -608,20 +612,20 @@ union yyalloc /* YYFINAL -- State number of the termination state. */ #define YYFINAL 5 /* YYLAST -- Last index in YYTABLE. */ -#define YYLAST 4096 +#define YYLAST 4115 /* YYNTOKENS -- Number of terminals. */ -#define YYNTOKENS 212 +#define YYNTOKENS 215 /* YYNNTS -- Number of nonterminals. */ -#define YYNNTS 89 +#define YYNNTS 90 /* YYNRULES -- Number of rules. */ -#define YYNRULES 273 +#define YYNRULES 278 /* YYNRULES -- Number of states. */ -#define YYNSTATES 410 +#define YYNSTATES 419 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ #define YYUNDEFTOK 2 -#define YYMAXUTOK 442 +#define YYMAXUTOK 445 #define YYTRANSLATE(YYX) \ ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) @@ -632,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, 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, 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, 190, 2, 191, 204, 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, 210, 205, 211, 197, 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, @@ -673,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 + 185, 186, 187, 188, 189, 190 }; #if YYDEBUG @@ -681,151 +685,153 @@ static const yytype_uint8 yytranslate[] = 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, 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, 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 + 0, 0, 3, 4, 9, 10, 14, 17, 20, 23, + 26, 27, 30, 36, 38, 41, 43, 45, 47, 49, + 51, 53, 57, 59, 64, 66, 70, 73, 76, 78, + 80, 82, 86, 89, 92, 95, 97, 100, 104, 107, + 109, 111, 113, 115, 118, 121, 124, 126, 128, 130, + 132, 134, 138, 142, 146, 148, 152, 156, 158, 162, + 166, 168, 172, 176, 180, 184, 186, 190, 194, 196, + 200, 202, 206, 208, 212, 214, 218, 220, 224, 226, + 230, 232, 238, 240, 244, 246, 248, 250, 252, 254, + 256, 258, 260, 262, 264, 266, 268, 272, 274, 277, + 280, 285, 288, 290, 292, 295, 299, 303, 306, 312, + 316, 319, 323, 326, 327, 329, 331, 333, 335, 337, + 341, 347, 354, 362, 371, 377, 379, 382, 387, 393, + 400, 408, 413, 416, 418, 421, 422, 424, 429, 431, + 435, 437, 439, 441, 443, 445, 447, 450, 453, 455, + 457, 460, 463, 466, 468, 471, 474, 476, 478, 481, + 483, 487, 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, 602, 604, 606, + 612, 617, 619, 622, 626, 628, 632, 634, 639, 641, + 643, 645, 647, 649, 651, 653, 655, 657, 659, 661, + 663, 665, 667, 670, 674, 676, 678, 681, 685, 687, + 690, 692, 695, 703, 709, 715, 723, 725, 730, 736, + 740, 743, 749, 757, 764, 766, 768, 770, 771, 774, + 778, 781, 784, 787, 791, 794, 796, 798, 800 }; /* YYRHS -- A `-1'-separated list of the rules' RHS. */ static const yytype_int16 yyrhs[] = { - 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, - 41, -1, 42, -1, 43, -1, 44, -1, 45, -1, - 46, -1, 47, -1, 48, -1, 49, -1, 50, -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, 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 + 216, 0, -1, -1, 218, 220, 217, 222, -1, -1, + 109, 78, 113, -1, 116, 113, -1, 117, 113, -1, + 118, 113, -1, 119, 113, -1, -1, 220, 221, -1, + 110, 76, 112, 76, 113, -1, 303, -1, 222, 303, + -1, 76, -1, 223, -1, 78, -1, 79, -1, 77, + -1, 80, -1, 191, 250, 192, -1, 224, -1, 225, + 193, 226, 194, -1, 227, -1, 225, 195, 76, -1, + 225, 84, -1, 225, 85, -1, 250, -1, 228, -1, + 229, -1, 225, 195, 229, -1, 231, 192, -1, 230, + 192, -1, 232, 74, -1, 232, -1, 232, 248, -1, + 231, 196, 248, -1, 233, 191, -1, 272, -1, 76, + -1, 81, -1, 225, -1, 84, 234, -1, 85, 234, + -1, 235, 234, -1, 197, -1, 198, -1, 199, -1, + 200, -1, 234, -1, 236, 201, 234, -1, 236, 202, + 234, -1, 236, 203, 234, -1, 236, -1, 237, 197, + 236, -1, 237, 198, 236, -1, 237, -1, 238, 82, + 237, -1, 238, 83, 237, -1, 238, -1, 239, 204, + 238, -1, 239, 205, 238, -1, 239, 86, 238, -1, + 239, 87, 238, -1, 239, -1, 240, 88, 239, -1, + 240, 89, 239, -1, 240, -1, 241, 206, 240, -1, + 241, -1, 242, 207, 241, -1, 242, -1, 243, 208, + 242, -1, 243, -1, 244, 90, 243, -1, 244, -1, + 245, 92, 244, -1, 245, -1, 246, 91, 245, -1, + 246, -1, 246, 209, 250, 210, 248, -1, 247, -1, + 234, 249, 248, -1, 211, -1, 93, -1, 94, -1, + 96, -1, 95, -1, 102, -1, 97, -1, 98, -1, + 99, -1, 100, -1, 101, -1, 248, -1, 250, 196, + 248, -1, 247, -1, 253, 212, -1, 261, 212, -1, + 108, 276, 273, 212, -1, 254, 192, -1, 256, -1, + 255, -1, 256, 258, -1, 255, 196, 258, -1, 263, + 76, 191, -1, 272, 76, -1, 272, 76, 193, 251, + 194, -1, 269, 259, 257, -1, 259, 257, -1, 269, + 259, 260, -1, 259, 260, -1, -1, 33, -1, 34, + -1, 35, -1, 272, -1, 262, -1, 261, 196, 76, + -1, 261, 196, 76, 193, 194, -1, 261, 196, 76, + 193, 251, 194, -1, 261, 196, 76, 193, 194, 211, + 282, -1, 261, 196, 76, 193, 251, 194, 211, 282, + -1, 261, 196, 76, 211, 282, -1, 263, -1, 263, + 76, -1, 263, 76, 193, 194, -1, 263, 76, 193, + 251, 194, -1, 263, 76, 193, 194, 211, 282, -1, + 263, 76, 193, 251, 194, 211, 282, -1, 263, 76, + 211, 282, -1, 103, 76, -1, 272, -1, 270, 272, + -1, -1, 265, -1, 120, 191, 266, 192, -1, 267, + -1, 266, 196, 267, -1, 76, -1, 40, -1, 39, + -1, 38, -1, 4, -1, 271, -1, 268, 270, -1, + 103, 270, -1, 4, -1, 3, -1, 264, 37, -1, + 32, 37, -1, 264, 33, -1, 34, -1, 32, 33, + -1, 32, 34, -1, 36, -1, 273, -1, 276, 273, + -1, 274, -1, 274, 193, 194, -1, 274, 193, 251, + 194, -1, 275, -1, 277, -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, 41, -1, 42, -1, 43, -1, 44, -1, + 45, -1, 46, -1, 47, -1, 48, -1, 49, -1, + 50, -1, 51, -1, 154, -1, 52, -1, 53, -1, + 54, -1, 55, -1, 156, -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, + 106, -1, 105, -1, 104, -1, 73, 76, 213, 278, + 214, -1, 73, 213, 278, 214, -1, 279, -1, 278, + 279, -1, 272, 280, 212, -1, 281, -1, 280, 196, + 281, -1, 76, -1, 76, 193, 251, 194, -1, 248, + -1, 252, -1, 285, -1, 286, -1, 288, -1, 287, + -1, 294, -1, 283, -1, 292, -1, 293, -1, 296, + -1, 297, -1, 298, -1, 302, -1, 213, 214, -1, + 213, 291, 214, -1, 290, -1, 287, -1, 213, 214, + -1, 213, 291, 214, -1, 284, -1, 291, 284, -1, + 212, -1, 250, 212, -1, 14, 191, 250, 192, 285, + 12, 285, -1, 14, 191, 250, 192, 285, -1, 14, + 191, 250, 192, 286, -1, 14, 191, 250, 192, 285, + 12, 286, -1, 250, -1, 263, 76, 211, 282, -1, + 17, 191, 250, 192, 288, -1, 18, 250, 210, -1, + 19, 210, -1, 75, 191, 295, 192, 289, -1, 11, + 284, 75, 191, 250, 192, 212, -1, 13, 191, 299, + 301, 192, 289, -1, 292, -1, 283, -1, 295, -1, + -1, 300, 212, -1, 300, 212, 250, -1, 10, 212, + -1, 9, 212, -1, 16, 212, -1, 16, 250, 212, + -1, 15, 212, -1, 304, -1, 252, -1, 219, -1, + 253, 290, -1 }; /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ static const yytype_uint16 yyrline[] = { - 0, 209, 209, 208, 217, 221, 239, 241, 245, 254, - 262, 273, 277, 284, 291, 298, 305, 312, 319, 320, - 326, 330, 337, 343, 352, 356, 360, 361, 370, 371, - 375, 376, 380, 386, 398, 402, 408, 415, 426, 427, - 433, 439, 449, 450, 451, 452, 456, 457, 463, 469, - 478, 479, 485, 494, 495, 501, 510, 511, 517, 523, - 529, 538, 539, 545, 554, 555, 564, 565, 574, 575, - 584, 585, 594, 595, 604, 605, 614, 615, 624, 625, - 634, 635, 636, 637, 638, 639, 640, 641, 642, 643, - 644, 648, 652, 668, 672, 676, 680, 694, 698, 699, - 703, 708, 716, 727, 737, 752, 759, 764, 775, 787, - 788, 789, 790, 794, 798, 799, 808, 817, 826, 835, - 844, 857, 868, 877, 886, 895, 904, 913, 922, 936, - 943, 954, 955, 959, 966, 967, 974, 1008, 1009, 1010, - 1014, 1018, 1019, 1023, 1031, 1032, 1033, 1034, 1035, 1036, - 1037, 1038, 1039, 1043, 1044, 1052, 1053, 1059, 1068, 1074, - 1080, 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, 211, 211, 210, 219, 223, 242, 243, 244, 245, + 248, 250, 254, 263, 271, 282, 286, 293, 300, 307, + 314, 321, 328, 329, 335, 339, 346, 352, 361, 365, + 369, 370, 379, 380, 384, 385, 389, 395, 407, 411, + 417, 424, 435, 436, 442, 448, 458, 459, 460, 461, + 465, 466, 472, 478, 487, 488, 494, 503, 504, 510, + 519, 520, 526, 532, 538, 547, 548, 554, 563, 564, + 573, 574, 583, 584, 593, 594, 603, 604, 613, 614, + 623, 624, 633, 634, 643, 644, 645, 646, 647, 648, + 649, 650, 651, 652, 653, 657, 661, 677, 681, 685, + 689, 703, 707, 708, 712, 717, 725, 736, 746, 761, + 768, 773, 784, 796, 797, 798, 799, 803, 807, 808, + 817, 826, 835, 844, 853, 866, 877, 886, 895, 904, + 913, 922, 931, 945, 952, 963, 964, 968, 975, 976, + 983, 1017, 1018, 1019, 1023, 1027, 1028, 1032, 1040, 1041, + 1042, 1043, 1044, 1045, 1046, 1047, 1048, 1052, 1053, 1061, + 1062, 1068, 1077, 1083, 1089, 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, 1142, + 1143, 1144, 1145, 1146, 1147, 1148, 1152, 1163, 1174, 1188, + 1194, 1203, 1208, 1216, 1231, 1236, 1244, 1250, 1259, 1263, + 1269, 1270, 1274, 1275, 1279, 1283, 1284, 1285, 1286, 1287, + 1288, 1289, 1293, 1299, 1308, 1309, 1313, 1319, 1328, 1338, + 1350, 1356, 1365, 1374, 1380, 1386, 1395, 1399, 1413, 1417, + 1418, 1422, 1429, 1436, 1446, 1447, 1451, 1453, 1459, 1464, + 1473, 1479, 1485, 1491, 1497, 1506, 1507, 1508, 1512 }; #endif @@ -854,23 +860,25 @@ 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", "SUPERP", "PRECISION", "VERSION", - "EXTENSION", "LINE", "PRAGMA", "COLON", "EOL", "INTERFACE", "OUTPUT", - "LAYOUT_TOK", "ASM", "CLASS", "UNION", "ENUM", "TYPEDEF", "TEMPLATE", - "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", "LINE", "COLON", "EOL", "INTERFACE", "OUTPUT", + "PRAGMA_DEBUG_ON", "PRAGMA_DEBUG_OFF", "PRAGMA_OPTIMIZE_ON", + "PRAGMA_OPTIMIZE_OFF", "LAYOUT_TOK", "ASM", "CLASS", "UNION", "ENUM", + "TYPEDEF", "TEMPLATE", "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", "pragma_statement", "extension_statement_list", "extension_statement", "external_declaration_list", "variable_identifier", "primary_expression", "postfix_expression", "integer_expression", "function_call", @@ -930,77 +938,77 @@ 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, 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, 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 }; # endif /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ static const yytype_uint16 yyr1[] = { - 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 + 0, 215, 217, 216, 218, 218, 219, 219, 219, 219, + 220, 220, 221, 222, 222, 223, 224, 224, 224, 224, + 224, 224, 225, 225, 225, 225, 225, 225, 226, 227, + 228, 228, 229, 229, 230, 230, 231, 231, 232, 233, + 233, 233, 234, 234, 234, 234, 235, 235, 235, 235, + 236, 236, 236, 236, 237, 237, 237, 238, 238, 238, + 239, 239, 239, 239, 239, 240, 240, 240, 241, 241, + 242, 242, 243, 243, 244, 244, 245, 245, 246, 246, + 247, 247, 248, 248, 249, 249, 249, 249, 249, 249, + 249, 249, 249, 249, 249, 250, 250, 251, 252, 252, + 252, 253, 254, 254, 255, 255, 256, 257, 257, 258, + 258, 258, 258, 259, 259, 259, 259, 260, 261, 261, + 261, 261, 261, 261, 261, 262, 262, 262, 262, 262, + 262, 262, 262, 263, 263, 264, 264, 265, 266, 266, + 267, 268, 268, 268, 269, 270, 270, 270, 271, 271, + 271, 271, 271, 271, 271, 271, 271, 272, 272, 273, + 273, 273, 274, 274, 274, 275, 275, 275, 275, 275, + 275, 275, 275, 275, 275, 275, 275, 275, 275, 275, + 275, 275, 275, 275, 275, 275, 275, 275, 275, 275, + 275, 275, 275, 275, 275, 275, 275, 275, 275, 275, + 275, 275, 275, 275, 275, 275, 275, 275, 275, 275, + 275, 275, 275, 275, 275, 275, 276, 276, 276, 277, + 277, 278, 278, 279, 280, 280, 281, 281, 282, 283, + 284, 284, 285, 285, 286, 287, 287, 287, 287, 287, + 287, 287, 288, 288, 289, 289, 290, 290, 291, 291, + 292, 292, 293, 294, 294, 294, 295, 295, 296, 297, + 297, 298, 298, 298, 299, 299, 300, 300, 301, 301, + 302, 302, 302, 302, 302, 303, 303, 303, 304 }; /* 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, 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, + 0, 2, 0, 4, 0, 3, 2, 2, 2, 2, + 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, 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, 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, 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, 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, 1, 2 }; /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state @@ -1008,628 +1016,621 @@ 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, 131, - 7, 0, 145, 144, 165, 162, 163, 164, 169, 170, - 171, 172, 173, 174, 175, 176, 177, 166, 167, 168, - 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, + 4, 0, 0, 10, 0, 1, 2, 5, 0, 135, + 11, 0, 149, 148, 169, 166, 167, 168, 173, 174, + 175, 176, 177, 178, 179, 180, 181, 170, 171, 172, + 0, 153, 156, 143, 142, 141, 182, 183, 184, 185, + 186, 187, 188, 189, 190, 191, 192, 194, 195, 196, + 197, 199, 200, 201, 202, 203, 204, 205, 206, 207, + 208, 209, 210, 211, 212, 213, 214, 215, 0, 165, + 164, 135, 218, 217, 216, 0, 0, 0, 0, 0, + 0, 193, 198, 277, 135, 276, 0, 0, 103, 113, + 0, 118, 125, 0, 136, 135, 0, 145, 133, 157, + 159, 162, 0, 163, 13, 275, 0, 154, 155, 151, + 0, 0, 132, 135, 147, 0, 6, 7, 8, 9, + 0, 14, 98, 135, 278, 101, 113, 144, 114, 115, + 116, 104, 0, 113, 0, 99, 126, 152, 150, 146, + 134, 0, 158, 0, 0, 0, 0, 221, 0, 140, + 0, 138, 0, 0, 135, 0, 0, 0, 0, 0, + 0, 0, 0, 15, 19, 17, 18, 20, 41, 0, + 0, 0, 46, 47, 48, 49, 250, 135, 246, 16, + 22, 42, 24, 29, 30, 0, 0, 35, 0, 50, + 0, 54, 57, 60, 65, 68, 70, 72, 74, 76, + 78, 80, 82, 95, 0, 229, 0, 133, 235, 248, + 230, 231, 233, 232, 135, 236, 237, 234, 238, 239, + 240, 241, 105, 110, 112, 117, 0, 119, 106, 0, + 0, 160, 50, 97, 0, 39, 12, 0, 226, 0, + 224, 220, 222, 100, 137, 0, 271, 270, 0, 135, + 0, 274, 272, 0, 0, 0, 260, 135, 43, 44, + 0, 242, 135, 26, 27, 0, 0, 33, 32, 0, + 165, 36, 38, 85, 86, 88, 87, 90, 91, 92, + 93, 94, 89, 84, 0, 45, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 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 + 0, 0, 0, 0, 0, 0, 0, 251, 247, 249, + 107, 109, 111, 0, 0, 127, 0, 228, 131, 161, + 219, 0, 0, 223, 139, 0, 265, 264, 135, 0, + 273, 0, 259, 256, 0, 0, 21, 243, 0, 28, + 25, 31, 37, 83, 51, 52, 53, 55, 56, 58, + 59, 63, 64, 61, 62, 66, 67, 69, 71, 73, + 75, 77, 79, 0, 96, 0, 120, 0, 124, 0, + 128, 0, 225, 0, 266, 0, 0, 135, 0, 0, + 135, 23, 0, 0, 0, 121, 129, 0, 227, 0, + 268, 135, 253, 254, 258, 0, 0, 245, 261, 244, + 81, 108, 122, 0, 130, 0, 269, 263, 135, 257, + 0, 123, 262, 252, 255, 0, 135, 0, 135 }; /* YYDEFGOTO[NTERM-NUM]. */ static const yytype_int16 yydefgoto[] = { - -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 + -1, 2, 9, 3, 83, 6, 10, 84, 179, 180, + 181, 338, 182, 183, 184, 185, 186, 187, 188, 189, + 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, + 200, 201, 202, 203, 284, 204, 234, 205, 206, 87, + 88, 89, 223, 131, 132, 224, 90, 91, 92, 93, + 94, 150, 151, 95, 133, 96, 97, 235, 99, 100, + 101, 102, 103, 146, 147, 239, 240, 318, 208, 209, + 210, 211, 212, 213, 398, 399, 214, 215, 216, 217, + 335, 218, 219, 220, 328, 375, 376, 221, 104, 105 }; /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing STATE-NUM. */ -#define YYPACT_NINF -345 +#define YYPACT_NINF -367 static const yytype_int16 yypact[] = { - -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 + -88, -21, 24, -367, -53, -367, -3, -367, 9, 3699, + -367, 0, -367, -367, -367, -367, -367, -367, -367, -367, + -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, + 126, -367, -367, -367, -367, -367, -367, -367, -367, -367, + -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, + -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, + -367, -367, -367, -367, -367, -367, -367, -367, -75, -367, + -367, 29, -367, -367, -367, 92, 4, 12, 20, 26, + -49, -367, -367, -367, 3580, -367, -197, -45, -46, 3, + -134, -367, 82, 71, -367, 52, 3887, -367, -367, -367, + -29, -367, 3959, -367, -367, -367, 97, -367, -367, -367, + -19, 3887, -367, 52, -367, 3959, -367, -367, -367, -367, + 130, -367, -367, 282, -367, -367, 47, -367, -367, -367, + -367, -367, 3887, 187, 139, -367, -162, -367, -367, -367, + -367, 2675, -367, 105, 3887, 154, 2064, -367, 23, -367, + -62, -367, 27, 31, 1130, 50, 53, 33, 2296, 55, + 3218, 37, 58, -67, -367, -367, -367, -367, -367, 3218, + 3218, 3218, -367, -367, -367, -367, -367, 494, -367, -367, + -367, -66, -367, -367, -367, 60, -56, 3399, 64, -54, + 3218, 22, 6, 118, -84, 120, 51, 54, 56, 168, + 167, -83, -367, -367, -103, -367, 48, 72, -367, -367, + -367, -367, -367, -367, 706, -367, -367, -367, -367, -367, + -367, -367, -367, -367, -367, 186, 3887, -139, -367, 2856, + 3218, -367, -367, -367, 73, -367, -367, 2180, 75, -102, + -367, -367, -367, -367, -367, 130, -367, -367, 190, 1750, + 3218, -367, -367, -90, 3218, -146, -367, 2494, -367, -367, + -48, -367, 918, -367, -367, 3218, 3815, -367, -367, 3218, + 74, -367, -367, -367, -367, -367, -367, -367, -367, -367, + -367, -367, -367, -367, 3218, -367, 3218, 3218, 3218, 3218, + 3218, 3218, 3218, 3218, 3218, 3218, 3218, 3218, 3218, 3218, + 3218, 3218, 3218, 3218, 3218, 3218, 3218, -367, -367, -367, + 76, -367, -367, 3037, 3218, 59, 77, -367, -367, -367, + -367, 3218, 154, -367, -367, 81, -367, -367, 1948, -40, + -367, -27, -367, 78, 197, 83, -367, -367, 84, 78, + 85, -367, -367, -367, -367, -367, -367, 22, 22, 6, + 6, 118, 118, 118, 118, -84, -84, 120, 51, 54, + 56, 168, 167, -97, -367, 3218, 66, 86, -367, 3218, + 68, 87, -367, 3218, -367, 70, 91, 1130, 102, 106, + 1341, -367, 3218, 90, 3218, 153, -367, 3218, -367, -26, + 3218, 1341, 353, -367, -367, 3218, 103, -367, -367, -367, + -367, -367, -367, 3218, -367, 157, 78, -367, 1130, -367, + 3218, -367, -367, -367, -367, -25, 1552, 358, 1552 }; /* YYPGOTO[NTERM-NUM]. */ static const yytype_int16 yypgoto[] = { - -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 + -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, + -367, -367, -367, -367, 107, -367, -367, -367, -367, -111, + -367, -63, -59, -82, -60, 79, 80, 88, 89, 69, + 93, -367, -114, -153, -367, -154, -224, 11, 14, -367, + -367, -367, 148, 249, 243, 151, -367, -367, -245, -367, + -367, -367, 134, -367, -367, -43, -367, -9, -89, -367, + -367, 306, -367, 239, -136, -367, 62, -241, 143, -143, + -342, -355, -366, 15, 5, 308, 218, 149, -367, -367, + 94, -367, -367, -367, -367, -367, -367, -367, 316, -367 }; /* 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 -264 +#define YYTABLE_NINF -268 static const yytype_int16 yytable[] = { - 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, 71, 72, 73, 74, 0, 75, 0, 0, 0, - 0, 0, 0, 0, 0, 76, 0, 0, 0, 0, + 98, 110, 293, 294, 253, 316, 255, 127, 304, -164, + 242, 248, 334, 142, 397, 122, 123, 260, 263, 264, + 85, 1, 393, 86, 5, 397, 148, 233, 114, 228, + 232, 229, 12, 13, 271, 392, 128, 129, 130, 273, + 274, 275, 276, 277, 278, 279, 280, 281, 282, 230, + 306, 127, 139, 414, 313, 12, 13, 4, 258, 259, + 7, 30, 134, 31, 332, 32, 413, 33, 34, 35, + 114, 309, 314, 368, 417, 98, 413, 317, 135, 285, + 128, 129, 130, 334, 30, 11, 31, 140, 32, 367, + 33, 34, 35, 306, 322, 85, 329, 371, 86, 306, + 331, 242, 145, 333, 137, 112, 306, 8, 138, 307, + 323, 339, 106, 382, 207, 233, 342, 116, 232, 309, + 295, 296, 330, 225, -40, 117, 305, 265, 386, 266, + 244, 343, 113, 118, 245, 145, 268, 145, 111, 119, + 269, 383, 120, 402, 336, 207, 404, 125, 306, 80, + 126, 363, 377, 364, 409, 113, 306, 283, 136, 107, + 108, 317, 411, 109, 141, 378, 405, 416, 207, 306, + 306, 306, 80, 143, 333, 344, 345, 346, 232, 232, + 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, + 232, 232, 232, 232, 144, -102, 72, 73, 74, 233, + 291, 292, 232, 289, 290, 207, 149, 233, 297, 298, + 232, 351, 352, 353, 354, 227, 317, 225, 236, 389, + 128, 129, 130, 286, 287, 288, 347, 348, 145, 400, + 238, 317, 349, 350, 317, 243, 406, 355, 356, 246, + 207, 249, 317, 247, 250, 251, 254, 256, 207, 257, + 317, 233, 267, 207, 232, 272, 415, 299, 302, 303, + 122, 300, 310, -39, 301, 325, -34, 319, 321, 365, + 369, 370, 373, 379, 306, 380, -40, 384, 381, 387, + 385, 388, 390, 391, 401, 12, 13, 14, 15, 16, + 17, 152, 153, 154, 410, 155, 156, 157, 158, 159, + 160, 161, 18, 19, 20, 21, 22, 23, 24, 25, + 26, 27, 28, 29, 30, 177, 31, 395, 32, 207, + 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, 162, 163, 164, + 165, 166, 167, 168, 403, 408, 169, 170, 207, 412, + 418, 207, 361, 341, 311, 222, 226, 312, 357, 324, + 358, 115, 207, 237, 372, 71, 72, 73, 74, 359, + 75, 360, 326, 394, 124, 262, 407, 362, 327, 207, + 121, 0, 80, 0, 0, 0, 0, 207, 0, 207, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 374, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 81, 0, 82, 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, 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, 171, 0, 0, 0, 0, 0, 172, + 173, 174, 175, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 176, 177, 178, 12, 13, 14, + 15, 16, 17, 152, 153, 154, 0, 155, 156, 157, + 158, 159, 160, 161, 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, 162, + 163, 164, 165, 166, 167, 168, 0, 0, 169, 170, 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, 71, 72, 73, + 74, 0, 75, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 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, 77, 0, - 78, 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, 0, 0, 0, 0, 0, 0, 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, 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, + 0, 0, 0, 0, 0, 171, 0, 0, 0, 0, + 0, 172, 173, 174, 175, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 176, 177, 261, 12, + 13, 14, 15, 16, 17, 152, 153, 154, 0, 155, + 156, 157, 158, 159, 160, 161, 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, + 69, 162, 163, 164, 165, 166, 167, 168, 0, 0, + 169, 170, 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, 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, 77, 0, 78, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 81, 0, 82, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 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, - 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, 171, 0, 0, + 0, 0, 0, 172, 173, 174, 175, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 176, 177, + 308, 12, 13, 14, 15, 16, 17, 152, 153, 154, + 0, 155, 156, 157, 158, 159, 160, 161, 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, 162, 163, 164, 165, 166, 167, 168, + 0, 0, 169, 170, 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, 0, 0, 0, 80, 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, 81, 0, 82, 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, 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, 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, 171, + 0, 0, 0, 0, 0, 172, 173, 174, 175, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 176, 177, 337, 12, 13, 14, 15, 16, 17, 152, + 153, 154, 0, 155, 156, 157, 158, 159, 160, 161, + 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, 162, 163, 164, 165, 166, + 167, 168, 0, 0, 169, 170, 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, 0, 0, 0, + 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, 77, 0, 78, 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, 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, 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, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 171, 0, 0, 0, 0, 0, 172, 173, 174, + 175, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 176, 177, 12, 13, 14, 15, 16, 17, + 152, 153, 154, 0, 155, 396, 157, 158, 159, 160, + 161, 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, 162, 163, 164, 165, + 166, 167, 168, 0, 0, 169, 170, 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, 0, 0, + 0, 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, 81, 0, 82, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 171, 0, 0, 0, 0, 0, 172, 173, + 174, 175, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 176, 123, 12, 13, 14, 15, 16, + 17, 152, 153, 154, 0, 155, 396, 157, 158, 159, + 160, 161, 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, + 63, 64, 65, 66, 67, 68, 69, 162, 163, 164, + 165, 166, 167, 168, 0, 0, 169, 170, 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, + 75, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 80, 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, 81, 0, 82, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 167, 114, 12, 13, 14, 15, 16, 17, 143, - 144, 145, 0, 146, 387, 148, 149, 150, 151, 152, + 0, 0, 0, 171, 0, 0, 0, 0, 0, 172, + 173, 174, 175, 12, 13, 14, 15, 16, 17, 0, + 0, 0, 0, 0, 176, 177, 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, 153, 154, 155, 156, 157, - 158, 159, 0, 0, 160, 161, 0, 0, 0, 0, + 65, 66, 67, 68, 69, 0, 163, 164, 165, 166, + 167, 168, 0, 0, 169, 170, 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, + 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, 77, 0, 78, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 81, 0, 82, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 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, 0, 0, 0, 0, 77, 0, 78, 0, + 0, 171, 0, 0, 0, 0, 0, 172, 173, 174, + 175, 12, 13, 14, 15, 16, 17, 0, 0, 0, + 0, 0, 176, 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, 163, 164, 165, 166, 167, 168, + 0, 0, 169, 170, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 113, 72, 73, 74, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 80, 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, 0, 0, 0, 0, + 0, 0, 81, 0, 82, 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, 171, + 70, 0, 0, 0, 0, 172, 173, 174, 175, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + -267, 0, 0, 0, 0, 0, 0, 0, 72, 73, + 74, 0, 0, 0, 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, - 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, + 28, 29, 0, 0, 0, 0, 0, 0, 81, 0, + 82, 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, + 65, 66, 67, 68, 69, 0, 70, 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, 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, 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, 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, 241, 0, + 0, 0, 0, 0, 72, 73, 74, 0, 0, 0, 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, 0, 0, - 0, 0, 0, 0, 77, 0, 78, 36, 37, 38, + 0, 0, 0, 0, 81, 0, 82, 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, 0, 0, 0, 232, 0, 0, 0, 0, 0, + 69, 0, 163, 164, 165, 166, 167, 168, 0, 0, + 169, 170, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 320, 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, 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, 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, 0, 0, 0, 0, 0, 0, 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, + 81, 0, 82, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 0, 0, 0, 171, 0, 0, + 0, 0, 0, 172, 173, 174, 175, 12, 13, 14, + 15, 16, 17, 0, 0, 0, 0, 0, 252, 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, + 163, 164, 165, 166, 167, 168, 0, 0, 169, 170, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 108, 72, 73, + 0, 0, 0, 0, 0, 0, 0, 113, 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, 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, 77, 0, 78, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 81, 0, + 82, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, + 14, 15, 16, 17, 0, 171, 0, 0, 0, 0, + 0, 172, 173, 174, 175, 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, 163, 164, 165, 166, 167, 168, 0, 0, 169, + 170, 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, 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, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 72, 73, 74, 0, + 0, 14, 15, 16, 17, 0, 171, 0, 0, 231, + 0, 0, 172, 173, 174, 175, 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, 163, 164, 165, 166, 167, 168, 0, 0, + 169, 170, 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, 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, + 81, 0, 82, 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, 0, 0, 72, 73, 74, 0, 0, 0, + 0, 0, 14, 15, 16, 17, 0, 171, 0, 0, + 315, 0, 0, 172, 173, 174, 175, 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, 163, 164, 165, 166, 167, 168, 0, + 0, 169, 170, 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, 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, 81, 0, 82, 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, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 14, 15, 16, 17, 0, 171, 0, + 0, 366, 0, 0, 172, 173, 174, 175, 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, + 67, 68, 69, 0, 163, 164, 165, 166, 167, 168, + 0, 0, 169, 170, 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, 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, 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, 81, 0, 82, 0, 0, 0, 0, 0, 0, 0, 0, 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, - 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, 14, 15, 16, 17, 0, 171, + 0, 0, 0, 0, 0, 172, 173, 174, 175, 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, 270, 0, 163, 164, 165, 166, 167, + 168, 0, 0, 169, 170, 0, 0, 0, 0, 0, 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, 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, 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, 81, 0, 82, 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, + -3, 0, 0, 12, 13, 14, 15, 16, 17, 0, + 171, 0, 0, 0, 0, 0, 172, 173, 174, 175, + 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, 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, 71, 72, 73, 74, 0, 75, 0, + 0, 0, 0, 0, 0, 0, 76, 77, 78, 79, + 80, 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, 81, 32, 82, 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, 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, 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, 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, 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, 0, 70, - 0, 0, 77, 0, 78, 0, 0, 0, 0, 0, + 0, 0, 71, 72, 73, 74, 0, 75, 0, 0, + 0, 0, 0, 0, 0, 76, 77, 78, 79, 80, + 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, 0, 0, 0, + 0, 0, 0, 81, 0, 82, 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, 340, 14, 15, 16, 17, 168, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 18, 19, 20, + 21, 22, 23, 24, 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, 0, 70, 14, 15, 16, 17, 0, 81, + 0, 82, 0, 0, 0, 0, 0, 0, 0, 18, + 19, 20, 21, 22, 23, 24, 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, 0, 70, 0, 0, 0, 0, + 0, 81, 0, 82, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 81, 0, 82 }; static const yytype_int16 yycheck[] = { - 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, 103, 104, 105, 106, -1, 108, -1, -1, -1, - -1, -1, -1, -1, -1, 117, -1, -1, -1, -1, + 9, 76, 86, 87, 158, 229, 160, 4, 91, 76, + 146, 154, 257, 102, 380, 212, 213, 171, 84, 85, + 9, 109, 377, 9, 0, 391, 115, 141, 71, 191, + 141, 193, 3, 4, 187, 377, 33, 34, 35, 93, + 94, 95, 96, 97, 98, 99, 100, 101, 102, 211, + 196, 4, 95, 408, 193, 3, 4, 78, 169, 170, + 113, 32, 196, 34, 210, 36, 408, 38, 39, 40, + 113, 214, 211, 314, 416, 84, 418, 230, 212, 190, + 33, 34, 35, 328, 32, 76, 34, 96, 36, 313, + 38, 39, 40, 196, 196, 84, 250, 321, 84, 196, + 254, 237, 111, 257, 33, 76, 196, 110, 37, 212, + 212, 265, 112, 210, 123, 229, 269, 113, 229, 262, + 204, 205, 212, 132, 191, 113, 209, 193, 369, 195, + 192, 284, 103, 113, 196, 144, 192, 146, 213, 113, + 196, 365, 191, 384, 192, 154, 387, 192, 196, 120, + 196, 305, 192, 306, 395, 103, 196, 211, 76, 33, + 34, 314, 403, 37, 193, 192, 192, 192, 177, 196, + 196, 196, 120, 76, 328, 286, 287, 288, 289, 290, + 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, + 301, 302, 303, 304, 213, 192, 104, 105, 106, 313, + 82, 83, 313, 197, 198, 214, 76, 321, 88, 89, + 321, 293, 294, 295, 296, 76, 369, 226, 113, 373, + 33, 34, 35, 201, 202, 203, 289, 290, 237, 382, + 76, 384, 291, 292, 387, 212, 390, 297, 298, 212, + 249, 191, 395, 212, 191, 212, 191, 210, 257, 191, + 403, 365, 192, 262, 365, 191, 410, 206, 90, 92, + 212, 207, 76, 191, 208, 75, 192, 194, 193, 193, + 211, 194, 191, 76, 196, 192, 191, 211, 194, 211, + 194, 194, 212, 192, 194, 3, 4, 5, 6, 7, + 8, 9, 10, 11, 191, 13, 14, 15, 16, 17, + 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, + 28, 29, 30, 31, 32, 213, 34, 211, 36, 328, + 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, 211, 12, 84, 85, 377, 212, + 12, 380, 303, 266, 226, 126, 133, 226, 299, 245, + 300, 75, 391, 144, 322, 103, 104, 105, 106, 301, + 108, 302, 249, 378, 86, 177, 391, 304, 249, 408, + 84, -1, 120, -1, -1, -1, -1, 416, -1, 418, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 328, -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, -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, 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, -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, - 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, 103, 104, 105, + 106, -1, 108, -1, -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, 151, -1, - 153, -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, 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, + -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, -1, @@ -1641,58 +1642,80 @@ static const yytype_int16 yycheck[] = 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, 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, 151, -1, 153, -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, 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, 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, -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, -1, -1, -1, 120, -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, 154, -1, 156, -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, -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, 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, -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, -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, -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, -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, -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, 151, -1, 153, -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, 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, + -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, -1, 34, -1, 36, -1, @@ -1703,110 +1726,91 @@ static const yytype_int16 yycheck[] = 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, + 108, -1, -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, 151, -1, 153, -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, - 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, + -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, -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, + 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, + 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, 151, -1, 153, -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, 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, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 151, -1, 153, -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, -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, -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, -1, -1, -1, -1, + -1, -1, 154, -1, 156, 41, 42, 43, 44, 45, + 46, 47, 48, 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, 191, + 76, -1, -1, -1, -1, 197, 198, 199, 200, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 212, -1, -1, -1, -1, -1, -1, -1, 104, 105, + 106, -1, -1, -1, -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, - -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, + 30, 31, -1, -1, -1, -1, -1, -1, 154, -1, + 156, 41, 42, 43, 44, 45, 46, 47, 48, 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, + 70, 71, 72, 73, 74, -1, 76, -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, 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, -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, 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, 214, -1, + -1, -1, -1, -1, 104, 105, 106, -1, -1, -1, -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, -1, -1, - -1, -1, -1, -1, 151, -1, 153, 41, 42, 43, + -1, -1, -1, -1, 154, -1, 156, 41, 42, 43, 44, 45, 46, 47, 48, 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, -1, -1, -1, 211, -1, -1, -1, -1, -1, + 74, -1, 76, 77, 78, 79, 80, 81, -1, -1, + 84, 85, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 214, -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, -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, -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, -1, -1, -1, -1, -1, -1, -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, + 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, 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, -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, -1, 34, -1, 36, -1, 38, 39, 40, 41, 42, 43, 44, 45, @@ -1817,50 +1821,69 @@ static const yytype_int16 yycheck[] = -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, 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, 151, -1, 153, -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, 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, + 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, -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, 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, 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, 151, -1, 153, -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, -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, 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, + 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, -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, 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, + -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, @@ -1873,138 +1896,130 @@ 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, -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, 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, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 151, -1, 153, + -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, 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, 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, -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, -1, -1, -1, -1, -1, 104, 105, - 106, -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, - -1, -1, -1, -1, -1, 151, -1, 153, -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, 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, -1, 76, -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, -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, -1, -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, 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, 103, 104, 105, 106, -1, 108, -1, + -1, -1, -1, -1, -1, -1, 116, 117, 118, 119, + 120, -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, 154, 36, 156, 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, 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, -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, -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, 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, -1, 76, - -1, -1, 151, -1, 153, -1, -1, -1, -1, -1, + -1, -1, 103, 104, 105, 106, -1, 108, -1, -1, + -1, -1, -1, -1, -1, 116, 117, 118, 119, 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, -1, -1, -1, + -1, -1, -1, 154, -1, 156, 41, 42, 43, 44, + 45, 46, 47, 48, 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, 5, 6, 7, 8, 81, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 20, 21, 22, + 23, 24, 25, 26, 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, -1, 76, 5, 6, 7, 8, -1, 154, + -1, 156, -1, -1, -1, -1, -1, -1, -1, 20, + 21, 22, 23, 24, 25, 26, 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, -1, 76, -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -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, 154, -1, 156 }; /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing symbol of state STATE-NUM. */ static const yytype_uint16 yystos[] = { - 0, 109, 213, 215, 78, 0, 216, 114, 110, 214, - 217, 76, 3, 4, 5, 6, 7, 8, 20, 21, + 0, 109, 216, 218, 78, 0, 220, 113, 110, 217, + 221, 76, 3, 4, 5, 6, 7, 8, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 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, - 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, 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 + 76, 103, 104, 105, 106, 108, 116, 117, 118, 119, + 120, 154, 156, 219, 222, 252, 253, 254, 255, 256, + 261, 262, 263, 264, 265, 268, 270, 271, 272, 273, + 274, 275, 276, 277, 303, 304, 112, 33, 34, 37, + 76, 213, 76, 103, 270, 276, 113, 113, 113, 113, + 191, 303, 212, 213, 290, 192, 196, 4, 33, 34, + 35, 258, 259, 269, 196, 212, 76, 33, 37, 270, + 272, 193, 273, 76, 213, 272, 278, 279, 273, 76, + 266, 267, 9, 10, 11, 13, 14, 15, 16, 17, + 18, 19, 75, 76, 77, 78, 79, 80, 81, 84, + 85, 191, 197, 198, 199, 200, 212, 213, 214, 223, + 224, 225, 227, 228, 229, 230, 231, 232, 233, 234, + 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, + 245, 246, 247, 248, 250, 252, 253, 272, 283, 284, + 285, 286, 287, 288, 291, 292, 293, 294, 296, 297, + 298, 302, 258, 257, 260, 272, 259, 76, 191, 193, + 211, 194, 234, 247, 251, 272, 113, 278, 76, 280, + 281, 214, 279, 212, 192, 196, 212, 212, 284, 191, + 191, 212, 212, 250, 191, 250, 210, 191, 234, 234, + 250, 214, 291, 84, 85, 193, 195, 192, 192, 196, + 74, 248, 191, 93, 94, 95, 96, 97, 98, 99, + 100, 101, 102, 211, 249, 234, 201, 202, 203, 197, + 198, 82, 83, 86, 87, 204, 205, 88, 89, 206, + 207, 208, 90, 92, 91, 209, 196, 212, 214, 284, + 76, 257, 260, 193, 211, 194, 251, 248, 282, 194, + 214, 193, 196, 212, 267, 75, 283, 292, 299, 250, + 212, 250, 210, 250, 263, 295, 192, 214, 226, 250, + 76, 229, 248, 248, 234, 234, 234, 236, 236, 237, + 237, 238, 238, 238, 238, 239, 239, 240, 241, 242, + 243, 244, 245, 250, 248, 193, 194, 251, 282, 211, + 194, 251, 281, 191, 295, 300, 301, 192, 192, 76, + 192, 194, 210, 251, 211, 194, 282, 211, 194, 250, + 212, 192, 285, 286, 288, 211, 14, 287, 289, 290, + 248, 194, 282, 211, 282, 192, 250, 289, 12, 282, + 191, 282, 212, 285, 286, 250, 192, 285, 12 }; #define yyerrok (yyerrstatus = 0) @@ -2019,18 +2034,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) @@ -2087,7 +2093,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, \ @@ -2629,7 +2635,7 @@ YYLTYPE yylloc; YYLTYPE *yylsp; /* The locations where the error started and ended. */ - YYLTYPE yyerror_range[3]; + YYLTYPE yyerror_range[2]; YYSIZE_T yystacksize; @@ -2676,7 +2682,7 @@ 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; @@ -2684,7 +2690,7 @@ YYLTYPE yylloc; /* User initialization code. */ -/* Line 1251 of yacc.c */ +/* Line 1242 of yacc.c */ #line 41 "glsl_parser.ypp" { yylloc.first_line = 1; @@ -2694,8 +2700,8 @@ YYLTYPE yylloc; yylloc.source = 0; } -/* Line 1251 of yacc.c */ -#line 2699 "glsl_parser.cpp" +/* Line 1242 of yacc.c */ +#line 2705 "glsl_parser.cpp" yylsp[0] = yylloc; goto yysetstate; @@ -2882,8 +2888,8 @@ yyreduce: { case 2: -/* Line 1464 of yacc.c */ -#line 209 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 211 "glsl_parser.ypp" { _mesa_glsl_initialize_types(state); ;} @@ -2891,8 +2897,8 @@ yyreduce: case 4: -/* Line 1464 of yacc.c */ -#line 217 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 219 "glsl_parser.ypp" { state->language_version = 110; state->symbols->language_version = 110; @@ -2901,8 +2907,8 @@ yyreduce: case 5: -/* Line 1464 of yacc.c */ -#line 222 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 224 "glsl_parser.ypp" { switch ((yyvsp[(2) - (3)].n)) { case 110: @@ -2920,10 +2926,10 @@ yyreduce: ;} break; - case 8: + case 12: -/* Line 1464 of yacc.c */ -#line 246 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 255 "glsl_parser.ypp" { if (!_mesa_glsl_process_extension((yyvsp[(2) - (5)].identifier), & (yylsp[(2) - (5)]), (yyvsp[(4) - (5)].identifier), & (yylsp[(4) - (5)]), state)) { YYERROR; @@ -2931,10 +2937,10 @@ yyreduce: ;} break; - case 9: + case 13: -/* Line 1464 of yacc.c */ -#line 255 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 264 "glsl_parser.ypp" { /* FINISHME: The NULL test is only required because 'precision' * FINISHME: statements are not yet supported. @@ -2944,10 +2950,10 @@ yyreduce: ;} break; - case 10: + case 14: -/* Line 1464 of yacc.c */ -#line 263 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 272 "glsl_parser.ypp" { /* FINISHME: The NULL test is only required because 'precision' * FINISHME: statements are not yet supported. @@ -2957,10 +2963,10 @@ yyreduce: ;} break; - case 12: + case 16: -/* Line 1464 of yacc.c */ -#line 278 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 287 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression(ast_identifier, NULL, NULL, NULL); @@ -2969,10 +2975,10 @@ yyreduce: ;} break; - case 13: + case 17: -/* Line 1464 of yacc.c */ -#line 285 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 294 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression(ast_int_constant, NULL, NULL, NULL); @@ -2981,10 +2987,10 @@ yyreduce: ;} break; - case 14: + case 18: -/* Line 1464 of yacc.c */ -#line 292 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 301 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression(ast_uint_constant, NULL, NULL, NULL); @@ -2993,10 +2999,10 @@ yyreduce: ;} break; - case 15: + case 19: -/* Line 1464 of yacc.c */ -#line 299 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 308 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression(ast_float_constant, NULL, NULL, NULL); @@ -3005,10 +3011,10 @@ yyreduce: ;} break; - case 16: + case 20: -/* Line 1464 of yacc.c */ -#line 306 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 315 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression(ast_bool_constant, NULL, NULL, NULL); @@ -3017,19 +3023,19 @@ yyreduce: ;} break; - case 17: + case 21: -/* Line 1464 of yacc.c */ -#line 313 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 322 "glsl_parser.ypp" { (yyval.expression) = (yyvsp[(2) - (3)].expression); ;} break; - case 19: + case 23: -/* Line 1464 of yacc.c */ -#line 321 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 330 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression(ast_array_index, (yyvsp[(1) - (4)].expression), (yyvsp[(3) - (4)].expression), NULL); @@ -3037,19 +3043,19 @@ yyreduce: ;} break; - case 20: + case 24: -/* Line 1464 of yacc.c */ -#line 327 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 336 "glsl_parser.ypp" { (yyval.expression) = (yyvsp[(1) - (1)].expression); ;} break; - case 21: + case 25: -/* Line 1464 of yacc.c */ -#line 331 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 340 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression(ast_field_selection, (yyvsp[(1) - (3)].expression), NULL, NULL); @@ -3058,10 +3064,10 @@ yyreduce: ;} break; - case 22: + case 26: -/* Line 1464 of yacc.c */ -#line 338 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 347 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression(ast_post_inc, (yyvsp[(1) - (2)].expression), NULL, NULL); @@ -3069,10 +3075,10 @@ yyreduce: ;} break; - case 23: + case 27: -/* Line 1464 of yacc.c */ -#line 344 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 353 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression(ast_post_dec, (yyvsp[(1) - (2)].expression), NULL, NULL); @@ -3080,10 +3086,10 @@ yyreduce: ;} break; - case 27: + case 31: -/* Line 1464 of yacc.c */ -#line 362 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 371 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression(ast_field_selection, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression), NULL); @@ -3091,10 +3097,10 @@ yyreduce: ;} break; - case 32: + case 36: -/* Line 1464 of yacc.c */ -#line 381 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 390 "glsl_parser.ypp" { (yyval.expression) = (yyvsp[(1) - (2)].expression); (yyval.expression)->set_location(yylloc); @@ -3102,10 +3108,10 @@ yyreduce: ;} break; - case 33: + case 37: -/* Line 1464 of yacc.c */ -#line 387 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 396 "glsl_parser.ypp" { (yyval.expression) = (yyvsp[(1) - (3)].expression); (yyval.expression)->set_location(yylloc); @@ -3113,10 +3119,10 @@ yyreduce: ;} break; - case 35: + case 39: -/* Line 1464 of yacc.c */ -#line 403 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 412 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_function_expression((yyvsp[(1) - (1)].type_specifier)); @@ -3124,10 +3130,10 @@ yyreduce: ;} break; - case 36: + case 40: -/* Line 1464 of yacc.c */ -#line 409 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 418 "glsl_parser.ypp" { void *ctx = state; ast_expression *callee = new(ctx) ast_expression((yyvsp[(1) - (1)].identifier)); @@ -3136,10 +3142,10 @@ yyreduce: ;} break; - case 37: + case 41: -/* Line 1464 of yacc.c */ -#line 416 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 425 "glsl_parser.ypp" { void *ctx = state; ast_expression *callee = new(ctx) ast_expression((yyvsp[(1) - (1)].identifier)); @@ -3148,10 +3154,10 @@ yyreduce: ;} break; - case 39: + case 43: -/* Line 1464 of yacc.c */ -#line 428 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 437 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression(ast_pre_inc, (yyvsp[(2) - (2)].expression), NULL, NULL); @@ -3159,10 +3165,10 @@ yyreduce: ;} break; - case 40: + case 44: -/* Line 1464 of yacc.c */ -#line 434 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 443 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression(ast_pre_dec, (yyvsp[(2) - (2)].expression), NULL, NULL); @@ -3170,10 +3176,10 @@ yyreduce: ;} break; - case 41: + case 45: -/* Line 1464 of yacc.c */ -#line 440 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 449 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression((yyvsp[(1) - (2)].n), (yyvsp[(2) - (2)].expression), NULL, NULL); @@ -3181,38 +3187,38 @@ yyreduce: ;} break; - case 42: + case 46: -/* Line 1464 of yacc.c */ -#line 449 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 458 "glsl_parser.ypp" { (yyval.n) = ast_plus; ;} break; - case 43: + case 47: -/* Line 1464 of yacc.c */ -#line 450 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 459 "glsl_parser.ypp" { (yyval.n) = ast_neg; ;} break; - case 44: + case 48: -/* Line 1464 of yacc.c */ -#line 451 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 460 "glsl_parser.ypp" { (yyval.n) = ast_logic_not; ;} break; - case 45: + case 49: -/* Line 1464 of yacc.c */ -#line 452 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 461 "glsl_parser.ypp" { (yyval.n) = ast_bit_not; ;} break; - case 47: + case 51: -/* Line 1464 of yacc.c */ -#line 458 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 467 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression_bin(ast_mul, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); @@ -3220,10 +3226,10 @@ yyreduce: ;} break; - case 48: + case 52: -/* Line 1464 of yacc.c */ -#line 464 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 473 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression_bin(ast_div, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); @@ -3231,10 +3237,10 @@ yyreduce: ;} break; - case 49: + case 53: -/* Line 1464 of yacc.c */ -#line 470 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 479 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression_bin(ast_mod, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); @@ -3242,10 +3248,10 @@ yyreduce: ;} break; - case 51: + case 55: -/* Line 1464 of yacc.c */ -#line 480 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 489 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression_bin(ast_add, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); @@ -3253,10 +3259,10 @@ yyreduce: ;} break; - case 52: + case 56: -/* Line 1464 of yacc.c */ -#line 486 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 495 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression_bin(ast_sub, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); @@ -3264,10 +3270,10 @@ yyreduce: ;} break; - case 54: + case 58: -/* Line 1464 of yacc.c */ -#line 496 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 505 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression_bin(ast_lshift, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); @@ -3275,10 +3281,10 @@ yyreduce: ;} break; - case 55: + case 59: -/* Line 1464 of yacc.c */ -#line 502 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 511 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression_bin(ast_rshift, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); @@ -3286,10 +3292,10 @@ yyreduce: ;} break; - case 57: + case 61: -/* Line 1464 of yacc.c */ -#line 512 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 521 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression_bin(ast_less, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); @@ -3297,10 +3303,10 @@ yyreduce: ;} break; - case 58: + case 62: -/* Line 1464 of yacc.c */ -#line 518 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 527 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression_bin(ast_greater, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); @@ -3308,10 +3314,10 @@ yyreduce: ;} break; - case 59: + case 63: -/* Line 1464 of yacc.c */ -#line 524 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 533 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression_bin(ast_lequal, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); @@ -3319,10 +3325,10 @@ yyreduce: ;} break; - case 60: + case 64: -/* Line 1464 of yacc.c */ -#line 530 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 539 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression_bin(ast_gequal, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); @@ -3330,10 +3336,10 @@ yyreduce: ;} break; - case 62: + case 66: -/* Line 1464 of yacc.c */ -#line 540 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 549 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression_bin(ast_equal, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); @@ -3341,10 +3347,10 @@ yyreduce: ;} break; - case 63: + case 67: -/* Line 1464 of yacc.c */ -#line 546 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 555 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression_bin(ast_nequal, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); @@ -3352,10 +3358,10 @@ yyreduce: ;} break; - case 65: + case 69: -/* Line 1464 of yacc.c */ -#line 556 "glsl_parser.ypp" +/* Line 1455 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)); @@ -3363,10 +3369,10 @@ yyreduce: ;} break; - case 67: + case 71: -/* Line 1464 of yacc.c */ -#line 566 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 575 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression_bin(ast_bit_xor, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); @@ -3374,10 +3380,10 @@ yyreduce: ;} break; - case 69: + case 73: -/* Line 1464 of yacc.c */ -#line 576 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 585 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression_bin(ast_bit_or, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); @@ -3385,10 +3391,10 @@ yyreduce: ;} break; - case 71: + case 75: -/* Line 1464 of yacc.c */ -#line 586 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 595 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression_bin(ast_logic_and, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); @@ -3396,10 +3402,10 @@ yyreduce: ;} break; - case 73: + case 77: -/* Line 1464 of yacc.c */ -#line 596 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 605 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression_bin(ast_logic_xor, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); @@ -3407,10 +3413,10 @@ yyreduce: ;} break; - case 75: + case 79: -/* Line 1464 of yacc.c */ -#line 606 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 615 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression_bin(ast_logic_or, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); @@ -3418,10 +3424,10 @@ yyreduce: ;} break; - case 77: + case 81: -/* Line 1464 of yacc.c */ -#line 616 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 625 "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)); @@ -3429,10 +3435,10 @@ yyreduce: ;} break; - case 79: + case 83: -/* Line 1464 of yacc.c */ -#line 626 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 635 "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); @@ -3440,96 +3446,96 @@ yyreduce: ;} break; - case 80: + case 84: -/* Line 1464 of yacc.c */ -#line 634 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 643 "glsl_parser.ypp" { (yyval.n) = ast_assign; ;} break; - case 81: + case 85: -/* Line 1464 of yacc.c */ -#line 635 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 644 "glsl_parser.ypp" { (yyval.n) = ast_mul_assign; ;} break; - case 82: + case 86: -/* Line 1464 of yacc.c */ -#line 636 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 645 "glsl_parser.ypp" { (yyval.n) = ast_div_assign; ;} break; - case 83: + case 87: -/* Line 1464 of yacc.c */ -#line 637 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 646 "glsl_parser.ypp" { (yyval.n) = ast_mod_assign; ;} break; - case 84: + case 88: -/* Line 1464 of yacc.c */ -#line 638 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 647 "glsl_parser.ypp" { (yyval.n) = ast_add_assign; ;} break; - case 85: + case 89: -/* Line 1464 of yacc.c */ -#line 639 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 648 "glsl_parser.ypp" { (yyval.n) = ast_sub_assign; ;} break; - case 86: + case 90: -/* Line 1464 of yacc.c */ -#line 640 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 649 "glsl_parser.ypp" { (yyval.n) = ast_ls_assign; ;} break; - case 87: + case 91: -/* Line 1464 of yacc.c */ -#line 641 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 650 "glsl_parser.ypp" { (yyval.n) = ast_rs_assign; ;} break; - case 88: + case 92: -/* Line 1464 of yacc.c */ -#line 642 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 651 "glsl_parser.ypp" { (yyval.n) = ast_and_assign; ;} break; - case 89: + case 93: -/* Line 1464 of yacc.c */ -#line 643 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 652 "glsl_parser.ypp" { (yyval.n) = ast_xor_assign; ;} break; - case 90: + case 94: -/* Line 1464 of yacc.c */ -#line 644 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 653 "glsl_parser.ypp" { (yyval.n) = ast_or_assign; ;} break; - case 91: + case 95: -/* Line 1464 of yacc.c */ -#line 649 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 658 "glsl_parser.ypp" { (yyval.expression) = (yyvsp[(1) - (1)].expression); ;} break; - case 92: + case 96: -/* Line 1464 of yacc.c */ -#line 653 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 662 "glsl_parser.ypp" { void *ctx = state; if ((yyvsp[(1) - (3)].expression)->oper != ast_sequence) { @@ -3544,28 +3550,28 @@ yyreduce: ;} break; - case 94: + case 98: -/* Line 1464 of yacc.c */ -#line 673 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 682 "glsl_parser.ypp" { (yyval.node) = (yyvsp[(1) - (2)].function); ;} break; - case 95: + case 99: -/* Line 1464 of yacc.c */ -#line 677 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 686 "glsl_parser.ypp" { (yyval.node) = (yyvsp[(1) - (2)].declarator_list); ;} break; - case 96: + case 100: -/* Line 1464 of yacc.c */ -#line 681 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 690 "glsl_parser.ypp" { if (((yyvsp[(3) - (4)].type_specifier)->type_specifier != ast_float) && ((yyvsp[(3) - (4)].type_specifier)->type_specifier != ast_int)) { @@ -3578,30 +3584,30 @@ yyreduce: ;} break; - case 100: + case 104: -/* Line 1464 of yacc.c */ -#line 704 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 713 "glsl_parser.ypp" { (yyval.function) = (yyvsp[(1) - (2)].function); (yyval.function)->parameters.push_tail(& (yyvsp[(2) - (2)].parameter_declarator)->link); ;} break; - case 101: + case 105: -/* Line 1464 of yacc.c */ -#line 709 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 718 "glsl_parser.ypp" { (yyval.function) = (yyvsp[(1) - (3)].function); (yyval.function)->parameters.push_tail(& (yyvsp[(3) - (3)].parameter_declarator)->link); ;} break; - case 102: + case 106: -/* Line 1464 of yacc.c */ -#line 717 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 726 "glsl_parser.ypp" { void *ctx = state; (yyval.function) = new(ctx) ast_function(); @@ -3611,10 +3617,10 @@ yyreduce: ;} break; - case 103: + case 107: -/* Line 1464 of yacc.c */ -#line 728 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 737 "glsl_parser.ypp" { void *ctx = state; (yyval.parameter_declarator) = new(ctx) ast_parameter_declarator(); @@ -3626,10 +3632,10 @@ yyreduce: ;} break; - case 104: + case 108: -/* Line 1464 of yacc.c */ -#line 738 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 747 "glsl_parser.ypp" { void *ctx = state; (yyval.parameter_declarator) = new(ctx) ast_parameter_declarator(); @@ -3643,10 +3649,10 @@ yyreduce: ;} break; - case 105: + case 109: -/* Line 1464 of yacc.c */ -#line 753 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 762 "glsl_parser.ypp" { (yyvsp[(1) - (3)].type_qualifier).i |= (yyvsp[(2) - (3)].type_qualifier).i; @@ -3655,20 +3661,20 @@ yyreduce: ;} break; - case 106: + case 110: -/* Line 1464 of yacc.c */ -#line 760 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 769 "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: + case 111: -/* Line 1464 of yacc.c */ -#line 765 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 774 "glsl_parser.ypp" { void *ctx = state; (yyvsp[(1) - (3)].type_qualifier).i |= (yyvsp[(2) - (3)].type_qualifier).i; @@ -3681,10 +3687,10 @@ yyreduce: ;} break; - case 108: + case 112: -/* Line 1464 of yacc.c */ -#line 776 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 785 "glsl_parser.ypp" { void *ctx = state; (yyval.parameter_declarator) = new(ctx) ast_parameter_declarator(); @@ -3695,38 +3701,38 @@ yyreduce: ;} break; - case 109: + case 113: -/* Line 1464 of yacc.c */ -#line 787 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 796 "glsl_parser.ypp" { (yyval.type_qualifier).i = 0; ;} break; - case 110: + case 114: -/* Line 1464 of yacc.c */ -#line 788 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 797 "glsl_parser.ypp" { (yyval.type_qualifier).i = 0; (yyval.type_qualifier).q.in = 1; ;} break; - case 111: + case 115: -/* Line 1464 of yacc.c */ -#line 789 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 798 "glsl_parser.ypp" { (yyval.type_qualifier).i = 0; (yyval.type_qualifier).q.out = 1; ;} break; - case 112: + case 116: -/* Line 1464 of yacc.c */ -#line 790 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 799 "glsl_parser.ypp" { (yyval.type_qualifier).i = 0; (yyval.type_qualifier).q.in = 1; (yyval.type_qualifier).q.out = 1; ;} break; - case 115: + case 119: -/* Line 1464 of yacc.c */ -#line 800 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 809 "glsl_parser.ypp" { void *ctx = state; ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(3) - (3)].identifier), false, NULL, NULL); @@ -3737,10 +3743,10 @@ yyreduce: ;} break; - case 116: + case 120: -/* Line 1464 of yacc.c */ -#line 809 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 818 "glsl_parser.ypp" { void *ctx = state; ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(3) - (5)].identifier), true, NULL, NULL); @@ -3751,10 +3757,10 @@ yyreduce: ;} break; - case 117: + case 121: -/* Line 1464 of yacc.c */ -#line 818 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 827 "glsl_parser.ypp" { void *ctx = state; ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(3) - (6)].identifier), true, (yyvsp[(5) - (6)].expression), NULL); @@ -3765,10 +3771,10 @@ yyreduce: ;} break; - case 118: + case 122: -/* Line 1464 of yacc.c */ -#line 827 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 836 "glsl_parser.ypp" { void *ctx = state; ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(3) - (7)].identifier), true, NULL, (yyvsp[(7) - (7)].expression)); @@ -3779,10 +3785,10 @@ yyreduce: ;} break; - case 119: + case 123: -/* Line 1464 of yacc.c */ -#line 836 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 845 "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)); @@ -3793,10 +3799,10 @@ yyreduce: ;} break; - case 120: + case 124: -/* Line 1464 of yacc.c */ -#line 845 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 854 "glsl_parser.ypp" { void *ctx = state; ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(3) - (5)].identifier), false, NULL, (yyvsp[(5) - (5)].expression)); @@ -3807,10 +3813,10 @@ yyreduce: ;} break; - case 121: + case 125: -/* Line 1464 of yacc.c */ -#line 858 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 867 "glsl_parser.ypp" { void *ctx = state; if ((yyvsp[(1) - (1)].fully_specified_type)->specifier->type_specifier != ast_struct) { @@ -3823,10 +3829,10 @@ yyreduce: ;} break; - case 122: + case 126: -/* Line 1464 of yacc.c */ -#line 869 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 878 "glsl_parser.ypp" { void *ctx = state; ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(2) - (2)].identifier), false, NULL, NULL); @@ -3837,10 +3843,10 @@ yyreduce: ;} break; - case 123: + case 127: -/* Line 1464 of yacc.c */ -#line 878 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 887 "glsl_parser.ypp" { void *ctx = state; ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(2) - (4)].identifier), true, NULL, NULL); @@ -3851,10 +3857,10 @@ yyreduce: ;} break; - case 124: + case 128: -/* Line 1464 of yacc.c */ -#line 887 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 896 "glsl_parser.ypp" { void *ctx = state; ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(2) - (5)].identifier), true, (yyvsp[(4) - (5)].expression), NULL); @@ -3865,10 +3871,10 @@ yyreduce: ;} break; - case 125: + case 129: -/* Line 1464 of yacc.c */ -#line 896 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 905 "glsl_parser.ypp" { void *ctx = state; ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(2) - (6)].identifier), true, NULL, (yyvsp[(6) - (6)].expression)); @@ -3879,10 +3885,10 @@ yyreduce: ;} break; - case 126: + case 130: -/* Line 1464 of yacc.c */ -#line 905 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 914 "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)); @@ -3893,10 +3899,10 @@ yyreduce: ;} break; - case 127: + case 131: -/* Line 1464 of yacc.c */ -#line 914 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 923 "glsl_parser.ypp" { void *ctx = state; ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(2) - (4)].identifier), false, NULL, (yyvsp[(4) - (4)].expression)); @@ -3907,10 +3913,10 @@ yyreduce: ;} break; - case 128: + case 132: -/* Line 1464 of yacc.c */ -#line 923 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 932 "glsl_parser.ypp" { void *ctx = state; ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(2) - (2)].identifier), false, NULL, NULL); @@ -3923,10 +3929,10 @@ yyreduce: ;} break; - case 129: + case 133: -/* Line 1464 of yacc.c */ -#line 937 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 946 "glsl_parser.ypp" { void *ctx = state; (yyval.fully_specified_type) = new(ctx) ast_fully_specified_type(); @@ -3935,10 +3941,10 @@ yyreduce: ;} break; - case 130: + case 134: -/* Line 1464 of yacc.c */ -#line 944 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 953 "glsl_parser.ypp" { void *ctx = state; (yyval.fully_specified_type) = new(ctx) ast_fully_specified_type(); @@ -3948,35 +3954,35 @@ yyreduce: ;} break; - case 131: + case 135: -/* Line 1464 of yacc.c */ -#line 954 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 963 "glsl_parser.ypp" { (yyval.type_qualifier).i = 0; ;} break; - case 133: + case 137: -/* Line 1464 of yacc.c */ -#line 960 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 969 "glsl_parser.ypp" { (yyval.type_qualifier) = (yyvsp[(3) - (4)].type_qualifier); ;} break; - case 135: + case 139: -/* Line 1464 of yacc.c */ -#line 968 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 977 "glsl_parser.ypp" { (yyval.type_qualifier).i = (yyvsp[(1) - (3)].type_qualifier).i | (yyvsp[(3) - (3)].type_qualifier).i; ;} break; - case 136: + case 140: -/* Line 1464 of yacc.c */ -#line 975 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 984 "glsl_parser.ypp" { (yyval.type_qualifier).i = 0; @@ -4009,130 +4015,130 @@ yyreduce: ;} break; - case 137: + case 141: -/* Line 1464 of yacc.c */ -#line 1008 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1017 "glsl_parser.ypp" { (yyval.type_qualifier).i = 0; (yyval.type_qualifier).q.smooth = 1; ;} break; - case 138: + case 142: -/* Line 1464 of yacc.c */ -#line 1009 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1018 "glsl_parser.ypp" { (yyval.type_qualifier).i = 0; (yyval.type_qualifier).q.flat = 1; ;} break; - case 139: + case 143: -/* Line 1464 of yacc.c */ -#line 1010 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1019 "glsl_parser.ypp" { (yyval.type_qualifier).i = 0; (yyval.type_qualifier).q.noperspective = 1; ;} break; - case 140: + case 144: -/* Line 1464 of yacc.c */ -#line 1014 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1023 "glsl_parser.ypp" { (yyval.type_qualifier).i = 0; (yyval.type_qualifier).q.constant = 1; ;} break; - case 142: + case 146: -/* Line 1464 of yacc.c */ -#line 1020 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1029 "glsl_parser.ypp" { (yyval.type_qualifier).i = (yyvsp[(1) - (2)].type_qualifier).i | (yyvsp[(2) - (2)].type_qualifier).i; ;} break; - case 143: + case 147: -/* Line 1464 of yacc.c */ -#line 1024 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1033 "glsl_parser.ypp" { (yyval.type_qualifier) = (yyvsp[(2) - (2)].type_qualifier); (yyval.type_qualifier).q.invariant = 1; ;} break; - case 144: + case 148: -/* Line 1464 of yacc.c */ -#line 1031 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1040 "glsl_parser.ypp" { (yyval.type_qualifier).i = 0; (yyval.type_qualifier).q.constant = 1; ;} break; - case 145: + case 149: -/* Line 1464 of yacc.c */ -#line 1032 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1041 "glsl_parser.ypp" { (yyval.type_qualifier).i = 0; (yyval.type_qualifier).q.attribute = 1; ;} break; - case 146: + case 150: -/* Line 1464 of yacc.c */ -#line 1033 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1042 "glsl_parser.ypp" { (yyval.type_qualifier).i = (yyvsp[(1) - (2)].type_qualifier).i; (yyval.type_qualifier).q.varying = 1; ;} break; - case 147: + case 151: -/* Line 1464 of yacc.c */ -#line 1034 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1043 "glsl_parser.ypp" { (yyval.type_qualifier).i = 0; (yyval.type_qualifier).q.centroid = 1; (yyval.type_qualifier).q.varying = 1; ;} break; - case 148: + case 152: -/* Line 1464 of yacc.c */ -#line 1035 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1044 "glsl_parser.ypp" { (yyval.type_qualifier).i = 0; (yyval.type_qualifier).q.in = 1; ;} break; - case 149: + case 153: -/* Line 1464 of yacc.c */ -#line 1036 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1045 "glsl_parser.ypp" { (yyval.type_qualifier).i = 0; (yyval.type_qualifier).q.out = 1; ;} break; - case 150: + case 154: -/* Line 1464 of yacc.c */ -#line 1037 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1046 "glsl_parser.ypp" { (yyval.type_qualifier).i = 0; (yyval.type_qualifier).q.centroid = 1; (yyval.type_qualifier).q.in = 1; ;} break; - case 151: + case 155: -/* Line 1464 of yacc.c */ -#line 1038 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1047 "glsl_parser.ypp" { (yyval.type_qualifier).i = 0; (yyval.type_qualifier).q.centroid = 1; (yyval.type_qualifier).q.out = 1; ;} break; - case 152: + case 156: -/* Line 1464 of yacc.c */ -#line 1039 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1048 "glsl_parser.ypp" { (yyval.type_qualifier).i = 0; (yyval.type_qualifier).q.uniform = 1; ;} break; - case 154: + case 158: -/* Line 1464 of yacc.c */ -#line 1045 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1054 "glsl_parser.ypp" { (yyval.type_specifier) = (yyvsp[(2) - (2)].type_specifier); (yyval.type_specifier)->precision = (yyvsp[(1) - (2)].n); ;} break; - case 156: + case 160: -/* Line 1464 of yacc.c */ -#line 1054 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1063 "glsl_parser.ypp" { (yyval.type_specifier) = (yyvsp[(1) - (3)].type_specifier); (yyval.type_specifier)->is_array = true; @@ -4140,10 +4146,10 @@ yyreduce: ;} break; - case 157: + case 161: -/* Line 1464 of yacc.c */ -#line 1060 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1069 "glsl_parser.ypp" { (yyval.type_specifier) = (yyvsp[(1) - (4)].type_specifier); (yyval.type_specifier)->is_array = true; @@ -4151,10 +4157,10 @@ yyreduce: ;} break; - case 158: + case 162: -/* Line 1464 of yacc.c */ -#line 1069 "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)].n)); @@ -4162,10 +4168,10 @@ yyreduce: ;} break; - case 159: + case 163: -/* Line 1464 of yacc.c */ -#line 1075 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1084 "glsl_parser.ypp" { void *ctx = state; (yyval.type_specifier) = new(ctx) ast_type_specifier((yyvsp[(1) - (1)].struct_specifier)); @@ -4173,10 +4179,10 @@ yyreduce: ;} break; - case 160: + case 164: -/* Line 1464 of yacc.c */ -#line 1081 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1090 "glsl_parser.ypp" { void *ctx = state; (yyval.type_specifier) = new(ctx) ast_type_specifier((yyvsp[(1) - (1)].identifier)); @@ -4184,367 +4190,367 @@ yyreduce: ;} break; - case 161: + case 165: -/* Line 1464 of yacc.c */ -#line 1089 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1098 "glsl_parser.ypp" { (yyval.n) = ast_void; ;} break; - case 162: + case 166: -/* Line 1464 of yacc.c */ -#line 1090 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1099 "glsl_parser.ypp" { (yyval.n) = ast_float; ;} break; - case 163: + case 167: -/* Line 1464 of yacc.c */ -#line 1091 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1100 "glsl_parser.ypp" { (yyval.n) = ast_int; ;} break; - case 164: + case 168: -/* Line 1464 of yacc.c */ -#line 1092 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1101 "glsl_parser.ypp" { (yyval.n) = ast_uint; ;} break; - case 165: + case 169: -/* Line 1464 of yacc.c */ -#line 1093 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1102 "glsl_parser.ypp" { (yyval.n) = ast_bool; ;} break; - case 166: + case 170: -/* Line 1464 of yacc.c */ -#line 1094 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1103 "glsl_parser.ypp" { (yyval.n) = ast_vec2; ;} break; - case 167: + case 171: -/* Line 1464 of yacc.c */ -#line 1095 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1104 "glsl_parser.ypp" { (yyval.n) = ast_vec3; ;} break; - case 168: + case 172: -/* Line 1464 of yacc.c */ -#line 1096 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1105 "glsl_parser.ypp" { (yyval.n) = ast_vec4; ;} break; - case 169: + case 173: -/* Line 1464 of yacc.c */ -#line 1097 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1106 "glsl_parser.ypp" { (yyval.n) = ast_bvec2; ;} break; - case 170: + case 174: -/* Line 1464 of yacc.c */ -#line 1098 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1107 "glsl_parser.ypp" { (yyval.n) = ast_bvec3; ;} break; - case 171: + case 175: -/* Line 1464 of yacc.c */ -#line 1099 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1108 "glsl_parser.ypp" { (yyval.n) = ast_bvec4; ;} break; - case 172: + case 176: -/* Line 1464 of yacc.c */ -#line 1100 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1109 "glsl_parser.ypp" { (yyval.n) = ast_ivec2; ;} break; - case 173: + case 177: -/* Line 1464 of yacc.c */ -#line 1101 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1110 "glsl_parser.ypp" { (yyval.n) = ast_ivec3; ;} break; - case 174: + case 178: -/* Line 1464 of yacc.c */ -#line 1102 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1111 "glsl_parser.ypp" { (yyval.n) = ast_ivec4; ;} break; - case 175: + case 179: -/* Line 1464 of yacc.c */ -#line 1103 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1112 "glsl_parser.ypp" { (yyval.n) = ast_uvec2; ;} break; - case 176: + case 180: -/* Line 1464 of yacc.c */ -#line 1104 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1113 "glsl_parser.ypp" { (yyval.n) = ast_uvec3; ;} break; - case 177: + case 181: -/* Line 1464 of yacc.c */ -#line 1105 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1114 "glsl_parser.ypp" { (yyval.n) = ast_uvec4; ;} break; - case 178: + case 182: -/* Line 1464 of yacc.c */ -#line 1106 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1115 "glsl_parser.ypp" { (yyval.n) = ast_mat2; ;} break; - case 179: + case 183: -/* Line 1464 of yacc.c */ -#line 1107 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1116 "glsl_parser.ypp" { (yyval.n) = ast_mat2x3; ;} break; - case 180: + case 184: -/* Line 1464 of yacc.c */ -#line 1108 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1117 "glsl_parser.ypp" { (yyval.n) = ast_mat2x4; ;} break; - case 181: + case 185: -/* Line 1464 of yacc.c */ -#line 1109 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1118 "glsl_parser.ypp" { (yyval.n) = ast_mat3x2; ;} break; - case 182: + case 186: -/* Line 1464 of yacc.c */ -#line 1110 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1119 "glsl_parser.ypp" { (yyval.n) = ast_mat3; ;} break; - case 183: + case 187: -/* Line 1464 of yacc.c */ -#line 1111 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1120 "glsl_parser.ypp" { (yyval.n) = ast_mat3x4; ;} break; - case 184: + case 188: -/* Line 1464 of yacc.c */ -#line 1112 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1121 "glsl_parser.ypp" { (yyval.n) = ast_mat4x2; ;} break; - case 185: + case 189: -/* Line 1464 of yacc.c */ -#line 1113 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1122 "glsl_parser.ypp" { (yyval.n) = ast_mat4x3; ;} break; - case 186: + case 190: -/* Line 1464 of yacc.c */ -#line 1114 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1123 "glsl_parser.ypp" { (yyval.n) = ast_mat4; ;} break; - case 187: + case 191: -/* Line 1464 of yacc.c */ -#line 1115 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1124 "glsl_parser.ypp" { (yyval.n) = ast_sampler1d; ;} break; - case 188: + case 192: -/* Line 1464 of yacc.c */ -#line 1116 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1125 "glsl_parser.ypp" { (yyval.n) = ast_sampler2d; ;} break; - case 189: + case 193: -/* Line 1464 of yacc.c */ -#line 1117 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1126 "glsl_parser.ypp" { (yyval.n) = ast_sampler2drect; ;} break; - case 190: + case 194: -/* Line 1464 of yacc.c */ -#line 1118 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1127 "glsl_parser.ypp" { (yyval.n) = ast_sampler3d; ;} break; - case 191: + case 195: -/* Line 1464 of yacc.c */ -#line 1119 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1128 "glsl_parser.ypp" { (yyval.n) = ast_samplercube; ;} break; - case 192: + case 196: -/* Line 1464 of yacc.c */ -#line 1120 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1129 "glsl_parser.ypp" { (yyval.n) = ast_sampler1dshadow; ;} break; - case 193: + case 197: -/* Line 1464 of yacc.c */ -#line 1121 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1130 "glsl_parser.ypp" { (yyval.n) = ast_sampler2dshadow; ;} break; - case 194: + case 198: -/* Line 1464 of yacc.c */ -#line 1122 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1131 "glsl_parser.ypp" { (yyval.n) = ast_sampler2drectshadow; ;} break; - case 195: + case 199: -/* Line 1464 of yacc.c */ -#line 1123 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1132 "glsl_parser.ypp" { (yyval.n) = ast_samplercubeshadow; ;} break; - case 196: + case 200: -/* Line 1464 of yacc.c */ -#line 1124 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1133 "glsl_parser.ypp" { (yyval.n) = ast_sampler1darray; ;} break; - case 197: + case 201: -/* Line 1464 of yacc.c */ -#line 1125 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1134 "glsl_parser.ypp" { (yyval.n) = ast_sampler2darray; ;} break; - case 198: + case 202: -/* Line 1464 of yacc.c */ -#line 1126 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1135 "glsl_parser.ypp" { (yyval.n) = ast_sampler1darrayshadow; ;} break; - case 199: + case 203: -/* Line 1464 of yacc.c */ -#line 1127 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1136 "glsl_parser.ypp" { (yyval.n) = ast_sampler2darrayshadow; ;} break; - case 200: + case 204: -/* Line 1464 of yacc.c */ -#line 1128 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1137 "glsl_parser.ypp" { (yyval.n) = ast_isampler1d; ;} break; - case 201: + case 205: -/* Line 1464 of yacc.c */ -#line 1129 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1138 "glsl_parser.ypp" { (yyval.n) = ast_isampler2d; ;} break; - case 202: + case 206: -/* Line 1464 of yacc.c */ -#line 1130 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1139 "glsl_parser.ypp" { (yyval.n) = ast_isampler3d; ;} break; - case 203: + case 207: -/* Line 1464 of yacc.c */ -#line 1131 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1140 "glsl_parser.ypp" { (yyval.n) = ast_isamplercube; ;} break; - case 204: + case 208: -/* Line 1464 of yacc.c */ -#line 1132 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1141 "glsl_parser.ypp" { (yyval.n) = ast_isampler1darray; ;} break; - case 205: + case 209: -/* Line 1464 of yacc.c */ -#line 1133 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1142 "glsl_parser.ypp" { (yyval.n) = ast_isampler2darray; ;} break; - case 206: + case 210: -/* Line 1464 of yacc.c */ -#line 1134 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1143 "glsl_parser.ypp" { (yyval.n) = ast_usampler1d; ;} break; - case 207: + case 211: -/* Line 1464 of yacc.c */ -#line 1135 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1144 "glsl_parser.ypp" { (yyval.n) = ast_usampler2d; ;} break; - case 208: + case 212: -/* Line 1464 of yacc.c */ -#line 1136 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1145 "glsl_parser.ypp" { (yyval.n) = ast_usampler3d; ;} break; - case 209: + case 213: -/* Line 1464 of yacc.c */ -#line 1137 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1146 "glsl_parser.ypp" { (yyval.n) = ast_usamplercube; ;} break; - case 210: + case 214: -/* Line 1464 of yacc.c */ -#line 1138 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1147 "glsl_parser.ypp" { (yyval.n) = ast_usampler1darray; ;} break; - case 211: + case 215: -/* Line 1464 of yacc.c */ -#line 1139 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1148 "glsl_parser.ypp" { (yyval.n) = ast_usampler2darray; ;} break; - case 212: + case 216: -/* Line 1464 of yacc.c */ -#line 1143 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1152 "glsl_parser.ypp" { if (state->language_version < 130) _mesa_glsl_error(& (yylsp[(1) - (1)]), state, @@ -4558,10 +4564,10 @@ yyreduce: ;} break; - case 213: + case 217: -/* Line 1464 of yacc.c */ -#line 1154 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1163 "glsl_parser.ypp" { if (state->language_version < 130) _mesa_glsl_error(& (yylsp[(1) - (1)]), state, @@ -4575,10 +4581,10 @@ yyreduce: ;} break; - case 214: + case 218: -/* Line 1464 of yacc.c */ -#line 1165 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1174 "glsl_parser.ypp" { if (state->language_version < 130) _mesa_glsl_error(& (yylsp[(1) - (1)]), state, @@ -4592,10 +4598,10 @@ yyreduce: ;} break; - case 215: + case 219: -/* Line 1464 of yacc.c */ -#line 1180 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1189 "glsl_parser.ypp" { void *ctx = state; (yyval.struct_specifier) = new(ctx) ast_struct_specifier((yyvsp[(2) - (5)].identifier), (yyvsp[(4) - (5)].node)); @@ -4603,10 +4609,10 @@ yyreduce: ;} break; - case 216: + case 220: -/* Line 1464 of yacc.c */ -#line 1186 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1195 "glsl_parser.ypp" { void *ctx = state; (yyval.struct_specifier) = new(ctx) ast_struct_specifier(NULL, (yyvsp[(3) - (4)].node)); @@ -4614,30 +4620,30 @@ yyreduce: ;} break; - case 217: + case 221: -/* Line 1464 of yacc.c */ -#line 1195 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1204 "glsl_parser.ypp" { (yyval.node) = (ast_node *) (yyvsp[(1) - (1)].declarator_list); (yyvsp[(1) - (1)].declarator_list)->link.self_link(); ;} break; - case 218: + case 222: -/* Line 1464 of yacc.c */ -#line 1200 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1209 "glsl_parser.ypp" { (yyval.node) = (ast_node *) (yyvsp[(1) - (2)].node); (yyval.node)->link.insert_before(& (yyvsp[(2) - (2)].declarator_list)->link); ;} break; - case 219: + case 223: -/* Line 1464 of yacc.c */ -#line 1208 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1217 "glsl_parser.ypp" { void *ctx = state; ast_fully_specified_type *type = new(ctx) ast_fully_specified_type(); @@ -4651,30 +4657,30 @@ yyreduce: ;} break; - case 220: + case 224: -/* Line 1464 of yacc.c */ -#line 1223 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1232 "glsl_parser.ypp" { (yyval.declaration) = (yyvsp[(1) - (1)].declaration); (yyvsp[(1) - (1)].declaration)->link.self_link(); ;} break; - case 221: + case 225: -/* Line 1464 of yacc.c */ -#line 1228 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1237 "glsl_parser.ypp" { (yyval.declaration) = (yyvsp[(1) - (3)].declaration); (yyval.declaration)->link.insert_before(& (yyvsp[(3) - (3)].declaration)->link); ;} break; - case 222: + case 226: -/* Line 1464 of yacc.c */ -#line 1236 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1245 "glsl_parser.ypp" { void *ctx = state; (yyval.declaration) = new(ctx) ast_declaration((yyvsp[(1) - (1)].identifier), false, NULL, NULL); @@ -4682,10 +4688,10 @@ yyreduce: ;} break; - case 223: + case 227: -/* Line 1464 of yacc.c */ -#line 1242 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1251 "glsl_parser.ypp" { void *ctx = state; (yyval.declaration) = new(ctx) ast_declaration((yyvsp[(1) - (4)].identifier), true, (yyvsp[(3) - (4)].expression), NULL); @@ -4693,31 +4699,31 @@ yyreduce: ;} break; - case 228: + case 232: -/* Line 1464 of yacc.c */ -#line 1265 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1274 "glsl_parser.ypp" { (yyval.node) = (ast_node *) (yyvsp[(1) - (1)].compound_statement); ;} break; - case 234: + case 238: -/* Line 1464 of yacc.c */ -#line 1277 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1286 "glsl_parser.ypp" { (yyval.node) = NULL; ;} break; - case 235: + case 239: -/* Line 1464 of yacc.c */ -#line 1278 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1287 "glsl_parser.ypp" { (yyval.node) = NULL; ;} break; - case 238: + case 242: -/* Line 1464 of yacc.c */ -#line 1285 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1294 "glsl_parser.ypp" { void *ctx = state; (yyval.compound_statement) = new(ctx) ast_compound_statement(true, NULL); @@ -4725,10 +4731,10 @@ yyreduce: ;} break; - case 239: + case 243: -/* Line 1464 of yacc.c */ -#line 1291 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1300 "glsl_parser.ypp" { void *ctx = state; (yyval.compound_statement) = new(ctx) ast_compound_statement(true, (yyvsp[(2) - (3)].node)); @@ -4736,17 +4742,17 @@ yyreduce: ;} break; - case 240: + case 244: -/* Line 1464 of yacc.c */ -#line 1299 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1308 "glsl_parser.ypp" { (yyval.node) = (ast_node *) (yyvsp[(1) - (1)].compound_statement); ;} break; - case 242: + case 246: -/* Line 1464 of yacc.c */ -#line 1305 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1314 "glsl_parser.ypp" { void *ctx = state; (yyval.compound_statement) = new(ctx) ast_compound_statement(false, NULL); @@ -4754,10 +4760,10 @@ yyreduce: ;} break; - case 243: + case 247: -/* Line 1464 of yacc.c */ -#line 1311 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1320 "glsl_parser.ypp" { void *ctx = state; (yyval.compound_statement) = new(ctx) ast_compound_statement(false, (yyvsp[(2) - (3)].node)); @@ -4765,10 +4771,10 @@ yyreduce: ;} break; - case 244: + case 248: -/* Line 1464 of yacc.c */ -#line 1320 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1329 "glsl_parser.ypp" { if ((yyvsp[(1) - (1)].node) == NULL) { _mesa_glsl_error(& (yylsp[(1) - (1)]), state, " statement\n"); @@ -4780,10 +4786,10 @@ yyreduce: ;} break; - case 245: + case 249: -/* Line 1464 of yacc.c */ -#line 1330 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1339 "glsl_parser.ypp" { if ((yyvsp[(2) - (2)].node) == NULL) { _mesa_glsl_error(& (yylsp[(2) - (2)]), state, " statement\n"); @@ -4794,10 +4800,10 @@ yyreduce: ;} break; - case 246: + case 250: -/* Line 1464 of yacc.c */ -#line 1342 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1351 "glsl_parser.ypp" { void *ctx = state; (yyval.node) = new(ctx) ast_expression_statement(NULL); @@ -4805,10 +4811,10 @@ yyreduce: ;} break; - case 247: + case 251: -/* Line 1464 of yacc.c */ -#line 1348 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1357 "glsl_parser.ypp" { void *ctx = state; (yyval.node) = new(ctx) ast_expression_statement((yyvsp[(1) - (2)].expression)); @@ -4816,10 +4822,10 @@ yyreduce: ;} break; - case 248: + case 252: -/* Line 1464 of yacc.c */ -#line 1357 "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) - (7)].expression), (yyvsp[(5) - (7)].node), (yyvsp[(7) - (7)].node)); @@ -4827,10 +4833,10 @@ yyreduce: ;} break; - case 249: + case 253: -/* Line 1464 of yacc.c */ -#line 1366 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1375 "glsl_parser.ypp" { void *ctx = state; (yyval.node) = new(ctx) ast_selection_statement((yyvsp[(3) - (5)].expression), (yyvsp[(5) - (5)].node), NULL); @@ -4838,10 +4844,10 @@ yyreduce: ;} break; - case 250: + case 254: -/* Line 1464 of yacc.c */ -#line 1372 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1381 "glsl_parser.ypp" { void *ctx = state; (yyval.node) = new(ctx) ast_selection_statement((yyvsp[(3) - (5)].expression), (yyvsp[(5) - (5)].node), NULL); @@ -4849,10 +4855,10 @@ yyreduce: ;} break; - case 251: + case 255: -/* Line 1464 of yacc.c */ -#line 1378 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1387 "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)); @@ -4860,19 +4866,19 @@ yyreduce: ;} break; - case 252: + case 256: -/* Line 1464 of yacc.c */ -#line 1387 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1396 "glsl_parser.ypp" { (yyval.node) = (ast_node *) (yyvsp[(1) - (1)].expression); ;} break; - case 253: + case 257: -/* Line 1464 of yacc.c */ -#line 1391 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1400 "glsl_parser.ypp" { void *ctx = state; ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(2) - (4)].identifier), false, NULL, (yyvsp[(4) - (4)].expression)); @@ -4885,10 +4891,10 @@ yyreduce: ;} break; - case 257: + case 261: -/* Line 1464 of yacc.c */ -#line 1414 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1423 "glsl_parser.ypp" { void *ctx = state; (yyval.node) = new(ctx) ast_iteration_statement(ast_iteration_statement::ast_while, @@ -4897,10 +4903,10 @@ yyreduce: ;} break; - case 258: + case 262: -/* Line 1464 of yacc.c */ -#line 1421 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1430 "glsl_parser.ypp" { void *ctx = state; (yyval.node) = new(ctx) ast_iteration_statement(ast_iteration_statement::ast_do_while, @@ -4909,10 +4915,10 @@ yyreduce: ;} break; - case 259: + case 263: -/* Line 1464 of yacc.c */ -#line 1428 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1437 "glsl_parser.ypp" { void *ctx = state; (yyval.node) = new(ctx) ast_iteration_statement(ast_iteration_statement::ast_for, @@ -4921,39 +4927,39 @@ yyreduce: ;} break; - case 263: + case 267: -/* Line 1464 of yacc.c */ -#line 1444 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1453 "glsl_parser.ypp" { (yyval.node) = NULL; ;} break; - case 264: + case 268: -/* Line 1464 of yacc.c */ -#line 1451 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1460 "glsl_parser.ypp" { (yyval.for_rest_statement).cond = (yyvsp[(1) - (2)].node); (yyval.for_rest_statement).rest = NULL; ;} break; - case 265: + case 269: -/* Line 1464 of yacc.c */ -#line 1456 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1465 "glsl_parser.ypp" { (yyval.for_rest_statement).cond = (yyvsp[(1) - (3)].node); (yyval.for_rest_statement).rest = (yyvsp[(3) - (3)].expression); ;} break; - case 266: + case 270: -/* Line 1464 of yacc.c */ -#line 1465 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1474 "glsl_parser.ypp" { void *ctx = state; (yyval.node) = new(ctx) ast_jump_statement(ast_jump_statement::ast_continue, NULL); @@ -4961,10 +4967,10 @@ yyreduce: ;} break; - case 267: + case 271: -/* Line 1464 of yacc.c */ -#line 1471 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1480 "glsl_parser.ypp" { void *ctx = state; (yyval.node) = new(ctx) ast_jump_statement(ast_jump_statement::ast_break, NULL); @@ -4972,10 +4978,10 @@ yyreduce: ;} break; - case 268: + case 272: -/* Line 1464 of yacc.c */ -#line 1477 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1486 "glsl_parser.ypp" { void *ctx = state; (yyval.node) = new(ctx) ast_jump_statement(ast_jump_statement::ast_return, NULL); @@ -4983,10 +4989,10 @@ yyreduce: ;} break; - case 269: + case 273: -/* Line 1464 of yacc.c */ -#line 1483 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1492 "glsl_parser.ypp" { void *ctx = state; (yyval.node) = new(ctx) ast_jump_statement(ast_jump_statement::ast_return, (yyvsp[(2) - (3)].expression)); @@ -4994,10 +5000,10 @@ yyreduce: ;} break; - case 270: + case 274: -/* Line 1464 of yacc.c */ -#line 1489 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1498 "glsl_parser.ypp" { void *ctx = state; (yyval.node) = new(ctx) ast_jump_statement(ast_jump_statement::ast_discard, NULL); @@ -5005,24 +5011,31 @@ yyreduce: ;} break; - case 271: + case 275: -/* Line 1464 of yacc.c */ -#line 1497 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1506 "glsl_parser.ypp" { (yyval.node) = (yyvsp[(1) - (1)].function_definition); ;} break; - case 272: + case 276: -/* Line 1464 of yacc.c */ -#line 1498 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1507 "glsl_parser.ypp" { (yyval.node) = (yyvsp[(1) - (1)].node); ;} break; - case 273: + case 277: -/* Line 1464 of yacc.c */ -#line 1503 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1508 "glsl_parser.ypp" + { (yyval.node) = NULL; ;} + break; + + case 278: + +/* Line 1455 of yacc.c */ +#line 1513 "glsl_parser.ypp" { void *ctx = state; (yyval.function_definition) = new(ctx) ast_function_definition(); @@ -5034,8 +5047,8 @@ yyreduce: -/* Line 1464 of yacc.c */ -#line 5039 "glsl_parser.cpp" +/* Line 1455 of yacc.c */ +#line 5052 "glsl_parser.cpp" default: break; } YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); @@ -5107,7 +5120,7 @@ yyerrlab: #endif } - yyerror_range[1] = yylloc; + yyerror_range[0] = yylloc; if (yyerrstatus == 3) { @@ -5144,7 +5157,7 @@ yyerrorlab: if (/*CONSTCOND*/ 0) goto yyerrorlab; - yyerror_range[1] = yylsp[1-yylen]; + yyerror_range[0] = yylsp[1-yylen]; /* Do not reclaim the symbols of the rule which action triggered this YYERROR. */ YYPOPSTACK (yylen); @@ -5178,7 +5191,7 @@ yyerrlab1: if (yyssp == yyss) YYABORT; - yyerror_range[1] = *yylsp; + yyerror_range[0] = *yylsp; yydestruct ("Error: popping", yystos[yystate], yyvsp, yylsp, state); YYPOPSTACK (1); @@ -5188,10 +5201,10 @@ yyerrlab1: *++yyvsp = yylval; - yyerror_range[2] = yylloc; + 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, 2); + YYLLOC_DEFAULT (yyloc, (yyerror_range - 1), 2); *++yylsp = yyloc; /* Shift the error token. */ diff --git a/src/glsl/glsl_parser.h b/src/glsl/glsl_parser.h index 96f9df1129..3ed90853ad 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.3. */ + +/* 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, - 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 @@ -147,82 +148,85 @@ 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 + COLON = 367, + EOL = 368, + INTERFACE = 369, + OUTPUT = 370, + PRAGMA_DEBUG_ON = 371, + PRAGMA_DEBUG_OFF = 372, + PRAGMA_OPTIMIZE_ON = 373, + PRAGMA_OPTIMIZE_OFF = 374, + LAYOUT_TOK = 375, + ASM = 376, + CLASS = 377, + UNION = 378, + ENUM = 379, + TYPEDEF = 380, + TEMPLATE = 381, + THIS = 382, + PACKED_TOK = 383, + GOTO = 384, + INLINE_TOK = 385, + NOINLINE = 386, + VOLATILE = 387, + PUBLIC_TOK = 388, + STATIC = 389, + EXTERN = 390, + EXTERNAL = 391, + LONG_TOK = 392, + SHORT_TOK = 393, + DOUBLE_TOK = 394, + HALF = 395, + FIXED_TOK = 396, + UNSIGNED = 397, + INPUT_TOK = 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 }; #endif @@ -232,7 +236,7 @@ typedef union YYSTYPE { -/* Line 1685 of yacc.c */ +/* Line 1676 of yacc.c */ #line 52 "glsl_parser.ypp" int n; @@ -263,8 +267,8 @@ typedef union YYSTYPE -/* Line 1685 of yacc.c */ -#line 268 "glsl_parser.h" +/* Line 1676 of yacc.c */ +#line 272 "glsl_parser.h" } YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ -- cgit v1.2.3 From 8b3d36d56378355f188dd419e35676b2e4086a73 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 30 Aug 2010 12:20:25 -0700 Subject: glsl: Clear the static values of builtin function profiles at release. When releasing the builtin functions, we were just freeing the memory, not telling the builtin function loader that we had freed its memory. I wish I had done ARB_ES2_compatibility so we had regression testing of this path. Fixes segfault on changing video options in nexuiz. --- src/glsl/builtin_function.cpp | 200 +++++++++------------------ src/glsl/builtins/tools/generate_builtins.py | 56 +++++--- 2 files changed, 104 insertions(+), 152 deletions(-) (limited to 'src') diff --git a/src/glsl/builtin_function.cpp b/src/glsl/builtin_function.cpp index 975e092807..d3484cbcd3 100644 --- a/src/glsl/builtin_function.cpp +++ b/src/glsl/builtin_function.cpp @@ -16759,183 +16759,117 @@ static const char *functions_for_EXT_texture_array_vert [] = { builtin_texture2DArray, builtin_texture2DArrayLod, }; +static gl_shader *builtin_profiles[10]; void *builtin_mem_ctx = NULL; void _mesa_glsl_release_functions(void) { - talloc_free(builtin_mem_ctx); - builtin_mem_ctx = NULL; + talloc_free(builtin_mem_ctx); + builtin_mem_ctx = NULL; +} + +static void +_mesa_read_profile(struct _mesa_glsl_parse_state *state, + exec_list *instructions, + int profile_index, + const char *prototypes, + const char **functions, + int count) +{ + gl_shader *sh = builtin_profiles[profile_index]; + + if (sh == NULL) { + sh = read_builtins(GL_VERTEX_SHADER, prototypes, functions, count); + talloc_steal(builtin_mem_ctx, sh); + builtin_profiles[profile_index] = sh; + } + + import_prototypes(sh->ir, instructions, state->symbols, state); + state->builtins_to_link[state->num_builtins_to_link] = sh; + state->num_builtins_to_link++; } void _mesa_glsl_initialize_functions(exec_list *instructions, struct _mesa_glsl_parse_state *state) { - if (builtin_mem_ctx == NULL) + if (builtin_mem_ctx == NULL) { builtin_mem_ctx = talloc_init("GLSL built-in functions"); + memset(&builtin_profiles, 0, sizeof(builtin_profiles)); + } state->num_builtins_to_link = 0; if (state->target == fragment_shader && state->language_version == 110) { - static gl_shader *sh = NULL; - if (sh == NULL) { - 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); - state->builtins_to_link[state->num_builtins_to_link] = sh; - state->num_builtins_to_link++; + _mesa_read_profile(state, instructions, 0, + prototypes_for_110_frag, + functions_for_110_frag, + Elements(functions_for_110_frag)); } if (state->target == vertex_shader && state->language_version == 110) { - static gl_shader *sh = NULL; - if (sh == NULL) { - 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); - state->builtins_to_link[state->num_builtins_to_link] = sh; - state->num_builtins_to_link++; + _mesa_read_profile(state, instructions, 1, + prototypes_for_110_vert, + functions_for_110_vert, + Elements(functions_for_110_vert)); } if (state->target == fragment_shader && state->language_version == 120) { - static gl_shader *sh = NULL; - if (sh == NULL) { - 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); - state->builtins_to_link[state->num_builtins_to_link] = sh; - state->num_builtins_to_link++; + _mesa_read_profile(state, instructions, 2, + prototypes_for_120_frag, + functions_for_120_frag, + Elements(functions_for_120_frag)); } if (state->target == vertex_shader && state->language_version == 120) { - static gl_shader *sh = NULL; - if (sh == NULL) { - 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); - state->builtins_to_link[state->num_builtins_to_link] = sh; - state->num_builtins_to_link++; + _mesa_read_profile(state, instructions, 3, + prototypes_for_120_vert, + functions_for_120_vert, + Elements(functions_for_120_vert)); } 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++; + _mesa_read_profile(state, instructions, 4, + prototypes_for_130_frag, + functions_for_130_frag, + Elements(functions_for_130_frag)); } 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++; + _mesa_read_profile(state, instructions, 5, + prototypes_for_130_vert, + functions_for_130_vert, + Elements(functions_for_130_vert)); } if (state->target == fragment_shader && state->ARB_texture_rectangle_enable) { - static gl_shader *sh = NULL; - if (sh == NULL) { - 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); - state->builtins_to_link[state->num_builtins_to_link] = sh; - state->num_builtins_to_link++; + _mesa_read_profile(state, instructions, 6, + prototypes_for_ARB_texture_rectangle_frag, + functions_for_ARB_texture_rectangle_frag, + Elements(functions_for_ARB_texture_rectangle_frag)); } if (state->target == vertex_shader && state->ARB_texture_rectangle_enable) { - static gl_shader *sh = NULL; - if (sh == NULL) { - 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); - state->builtins_to_link[state->num_builtins_to_link] = sh; - state->num_builtins_to_link++; + _mesa_read_profile(state, instructions, 7, + prototypes_for_ARB_texture_rectangle_vert, + functions_for_ARB_texture_rectangle_vert, + Elements(functions_for_ARB_texture_rectangle_vert)); } if (state->target == fragment_shader && state->EXT_texture_array_enable) { - static gl_shader *sh = NULL; - if (sh == NULL) { - 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); - state->builtins_to_link[state->num_builtins_to_link] = sh; - state->num_builtins_to_link++; + _mesa_read_profile(state, instructions, 8, + prototypes_for_EXT_texture_array_frag, + functions_for_EXT_texture_array_frag, + Elements(functions_for_EXT_texture_array_frag)); } if (state->target == vertex_shader && state->EXT_texture_array_enable) { - static gl_shader *sh = NULL; - if (sh == NULL) { - 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); - state->builtins_to_link[state->num_builtins_to_link] = sh; - state->num_builtins_to_link++; + _mesa_read_profile(state, instructions, 9, + prototypes_for_EXT_texture_array_vert, + functions_for_EXT_texture_array_vert, + Elements(functions_for_EXT_texture_array_vert)); } } diff --git a/src/glsl/builtins/tools/generate_builtins.py b/src/glsl/builtins/tools/generate_builtins.py index ab5b3777cb..5accc1b120 100755 --- a/src/glsl/builtins/tools/generate_builtins.py +++ b/src/glsl/builtins/tools/generate_builtins.py @@ -1,5 +1,5 @@ #!/usr/bin/python -# -*- coding: UTF-8 -*- +# -*- coding: utf-8 -*- import re from glob import glob @@ -168,27 +168,54 @@ read_builtins(GLenum target, const char *protos, const char **functions, unsigne write_function_definitions() write_profiles() + profiles = get_profile_list() + + print 'static gl_shader *builtin_profiles[%d];' % len(profiles) + print """ void *builtin_mem_ctx = NULL; void _mesa_glsl_release_functions(void) { - talloc_free(builtin_mem_ctx); - builtin_mem_ctx = NULL; + talloc_free(builtin_mem_ctx); + builtin_mem_ctx = NULL; +} + +static void +_mesa_read_profile(struct _mesa_glsl_parse_state *state, + exec_list *instructions, + int profile_index, + const char *prototypes, + const char **functions, + int count) +{ + gl_shader *sh = builtin_profiles[profile_index]; + + if (sh == NULL) { + sh = read_builtins(GL_VERTEX_SHADER, prototypes, functions, count); + talloc_steal(builtin_mem_ctx, sh); + builtin_profiles[profile_index] = sh; + } + + import_prototypes(sh->ir, instructions, state->symbols, state); + state->builtins_to_link[state->num_builtins_to_link] = sh; + state->num_builtins_to_link++; } void _mesa_glsl_initialize_functions(exec_list *instructions, struct _mesa_glsl_parse_state *state) { - if (builtin_mem_ctx == NULL) + if (builtin_mem_ctx == NULL) { builtin_mem_ctx = talloc_init("GLSL built-in functions"); + memset(&builtin_profiles, 0, sizeof(builtin_profiles)); + } state->num_builtins_to_link = 0; """ - profiles = get_profile_list() + i=0 for (filename, profile) in profiles: if profile.endswith('_vert'): check = 'state->target == vertex_shader && ' @@ -202,21 +229,12 @@ _mesa_glsl_initialize_functions(exec_list *instructions, 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 ' _mesa_read_profile(state, instructions, %d,' % i + print ' prototypes_for_' + profile + ',' + print ' functions_for_' + profile + ',' + print ' Elements(functions_for_' + profile + '));' print ' }' print + i = i + 1 print '}' -- cgit v1.2.3 From e637f8b40c426d6ae79e0215fa8865d50326812f Mon Sep 17 00:00:00 2001 From: Jon TURNEY Date: Mon, 30 Aug 2010 12:41:16 +0100 Subject: Add talloc to osmesa library dependencies also link osmesa with C++ standard libraries, as it now contains C++ code Signed-off-by: Jon TURNEY --- configure.ac | 4 ++-- src/mesa/drivers/osmesa/Makefile | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/configure.ac b/configure.ac index 757571a9bf..45188544fb 100644 --- a/configure.ac +++ b/configure.ac @@ -935,12 +935,12 @@ case "$DRIVER_DIRS" in *osmesa*) # only link libraries with osmesa if shared if test "$enable_static" = no; then - OSMESA_LIB_DEPS="-lm -lpthread $SELINUX_LIBS $DLOPEN_LIBS" + OSMESA_LIB_DEPS="-lm -lpthread $SELINUX_LIBS $DLOPEN_LIBS $TALLOC_LIBS" else OSMESA_LIB_DEPS="" fi OSMESA_MESA_DEPS="" - OSMESA_PC_LIB_PRIV="-lm -lpthread $SELINUX_LIBS $DLOPEN_LIBS" + OSMESA_PC_LIB_PRIV="-lm -lpthread $SELINUX_LIBS $DLOPEN_LIBS $TALLOC_LIBS" ;; esac AC_SUBST([OSMESA_LIB_DEPS]) diff --git a/src/mesa/drivers/osmesa/Makefile b/src/mesa/drivers/osmesa/Makefile index 091e6f66d9..39ab09af80 100644 --- a/src/mesa/drivers/osmesa/Makefile +++ b/src/mesa/drivers/osmesa/Makefile @@ -36,9 +36,9 @@ default: $(TOP)/$(LIB_DIR)/$(OSMESA_LIB_NAME) # sources. We can also build libOSMesa16/libOSMesa32 by setting # -DCHAN_BITS=16/32. $(TOP)/$(LIB_DIR)/$(OSMESA_LIB_NAME): $(OBJECTS) $(CORE_MESA) - $(MKLIB) -o $(OSMESA_LIB) -linker '$(CC)' -ldflags '$(LDFLAGS)' \ + $(MKLIB) -o $(OSMESA_LIB) -linker '$(CXX)' -ldflags '$(LDFLAGS)' \ -major $(MESA_MAJOR) -minor $(MESA_MINOR) -patch $(MESA_TINY) \ - -install $(TOP)/$(LIB_DIR) $(MKLIB_OPTIONS) \ + -install $(TOP)/$(LIB_DIR) -cplusplus $(MKLIB_OPTIONS) \ -id $(INSTALL_LIB_DIR)/lib$(OSMESA_LIB).$(MESA_MAJOR).dylib \ $(OSMESA_LIB_DEPS) $(OBJECTS) $(CORE_MESA) -- cgit v1.2.3 From df869d916308759fbacb227f60b1b6eda73131e2 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Mon, 30 Aug 2010 15:37:44 -0700 Subject: linker: Handle varying arrays, matrices, and arrays of matrices Fixes piglit test case glsl-array-varying-01. --- src/glsl/linker.cpp | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp index 56e0bfd238..e0823c3af4 100644 --- a/src/glsl/linker.cpp +++ b/src/glsl/linker.cpp @@ -1296,15 +1296,24 @@ assign_varying_locations(struct gl_shader_program *prog, 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++; + /* FINISHME: Support for "varying" records in GLSL 1.50. */ + assert(!output_var->type->is_record()); + + if (output_var->type->is_array()) { + const unsigned slots = output_var->type->length + * output_var->type->fields.array->matrix_columns; + + output_index += slots; + input_index += slots; + } else { + const unsigned slots = output_var->type->matrix_columns; + + output_index += slots; + input_index += slots; + } } demote_unread_shader_outputs(producer); -- cgit v1.2.3 From 5ea238b7991331c854e66a16911d616d36965dc9 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Tue, 31 Aug 2010 09:02:02 +1000 Subject: r600g: add missing literals Also add an error if we hit this problem again, we need to do this better possibly tying the literal addition to the last flag. Signed-off-by: Dave Airlie --- src/gallium/drivers/r600/r600_asm.c | 3 +++ src/gallium/drivers/r600/r600_shader.c | 31 ++++++++++++++++++++++++++++++- 2 files changed, 33 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/r600_asm.c b/src/gallium/drivers/r600/r600_asm.c index 1a354a6293..6483dac703 100644 --- a/src/gallium/drivers/r600/r600_asm.c +++ b/src/gallium/drivers/r600/r600_asm.c @@ -375,6 +375,9 @@ static int r600_bc_alu_build(struct r600_bc *bc, struct r600_bc_alu *alu, unsign S_SQ_ALU_WORD1_OP2_UPDATE_PRED(alu->predicate); } if (alu->last) { + if (alu->nliteral && !alu->literal_added) { + R600_ERR("Bug in ALU processing for instruction 0x%08x, literal not added correctly\n"); + } for (i = 0; i < alu->nliteral; i++) { bc->bytecode[id++] = alu->value[i]; } diff --git a/src/gallium/drivers/r600/r600_shader.c b/src/gallium/drivers/r600/r600_shader.c index 652d4035cc..4834eaa9de 100644 --- a/src/gallium/drivers/r600/r600_shader.c +++ b/src/gallium/drivers/r600/r600_shader.c @@ -1018,6 +1018,10 @@ static int tgsi_lit(struct r600_shader_ctx *ctx) if (r) return r; + r = r600_bc_add_literal(ctx->bc, ctx->value); + if (r) + return r; + if (inst->Dst[0].Register.WriteMask & (1 << 2)) { int chan; @@ -1038,6 +1042,9 @@ static int tgsi_lit(struct r600_shader_ctx *ctx) if (r) return r; + r = r600_bc_add_literal(ctx->bc, ctx->value); + if (r) + return r; chan = alu.dst.chan; sel = alu.dst.sel; @@ -1063,6 +1070,9 @@ static int tgsi_lit(struct r600_shader_ctx *ctx) if (r) return r; + r = r600_bc_add_literal(ctx->bc, ctx->value); + if (r) + return r; /* dst.z = exp(tmp.x) */ memset(&alu, 0, sizeof(struct r600_bc_alu)); alu.inst = V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_EXP_IEEE; @@ -1149,6 +1159,9 @@ static int tgsi_trans_srcx_replicate(struct r600_shader_ctx *ctx) alu.dst.write = 1; alu.last = 1; r = r600_bc_add_alu(ctx->bc, &alu); + if (r) + return r; + r = r600_bc_add_literal(ctx->bc, ctx->value); if (r) return r; /* replicate result */ @@ -1760,6 +1773,10 @@ static int tgsi_exp(struct r600_shader_ctx *ctx) if (r) return r; + r = r600_bc_add_literal(ctx->bc, ctx->value); + if (r) + return r; + alu.inst = V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_EXP_IEEE; alu.src[0].sel = ctx->temp_reg; alu.src[0].chan = 0; @@ -1771,6 +1788,10 @@ static int tgsi_exp(struct r600_shader_ctx *ctx) r = r600_bc_add_alu(ctx->bc, &alu); if (r) return r; + + r = r600_bc_add_literal(ctx->bc, ctx->value); + if (r) + return r; } /* result.y = tmp - floor(tmp); */ @@ -1796,6 +1817,9 @@ static int tgsi_exp(struct r600_shader_ctx *ctx) r = r600_bc_add_alu(ctx->bc, &alu); if (r) return r; + r = r600_bc_add_literal(ctx->bc, ctx->value); + if (r) + return r; } /* result.z = RoughApprox2ToX(tmp);*/ @@ -1816,7 +1840,9 @@ static int tgsi_exp(struct r600_shader_ctx *ctx) r = r600_bc_add_alu(ctx->bc, &alu); if (r) return r; - + r = r600_bc_add_literal(ctx->bc, ctx->value); + if (r) + return r; } /* result.w = 1.0;*/ @@ -1834,6 +1860,9 @@ static int tgsi_exp(struct r600_shader_ctx *ctx) r = r600_bc_add_alu(ctx->bc, &alu); if (r) return r; + r = r600_bc_add_literal(ctx->bc, ctx->value); + if (r) + return r; } return tgsi_helper_copy(ctx, inst); } -- cgit v1.2.3 From 85e401d8bfd80450a31eac234e13008e33e64227 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Tue, 31 Aug 2010 09:56:35 +1000 Subject: r600g: fix LIT tests --- src/gallium/drivers/r600/r600_shader.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/r600_shader.c b/src/gallium/drivers/r600/r600_shader.c index 4834eaa9de..2210f83283 100644 --- a/src/gallium/drivers/r600/r600_shader.c +++ b/src/gallium/drivers/r600/r600_shader.c @@ -987,7 +987,7 @@ static int tgsi_lit(struct r600_shader_ctx *ctx) if (r) return r; alu.src[1].sel = V_SQ_ALU_SRC_0; /*0.0*/ - alu.src[1].chan = tgsi_chan(&inst->Src[0], 0); + alu.src[1].chan = 0; r = tgsi_dst(ctx, &inst->Dst[0], 1, &alu.dst); if (r) return r; @@ -1033,7 +1033,7 @@ static int tgsi_lit(struct r600_shader_ctx *ctx) r = tgsi_src(ctx, &inst->Src[0], &alu.src[0]); if (r) return r; - alu.src[0].chan = tgsi_chan(&inst->Src[0], 1); + alu.src[0].chan = tgsi_chan(&inst->Src[0], 3); r = tgsi_dst(ctx, &inst->Dst[0], 2, &alu.dst); if (r) return r; @@ -1045,6 +1045,7 @@ static int tgsi_lit(struct r600_shader_ctx *ctx) r = r600_bc_add_literal(ctx->bc, ctx->value); if (r) return r; + chan = alu.dst.chan; sel = alu.dst.sel; -- cgit v1.2.3 From 9bbc54a10d225679a180a085f7ca5bb88ee2bd15 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Tue, 31 Aug 2010 10:43:04 +1000 Subject: r600g: fix constant splitting constant splitting was broken for multi-constant cases, fixes fp1 CMP+MAD, vp1 CMP. --- src/gallium/drivers/r600/r600_shader.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/r600_shader.c b/src/gallium/drivers/r600/r600_shader.c index 2210f83283..2197a1610f 100644 --- a/src/gallium/drivers/r600/r600_shader.c +++ b/src/gallium/drivers/r600/r600_shader.c @@ -650,7 +650,7 @@ static int tgsi_split_constant(struct r600_shader_ctx *ctx, struct r600_bc_alu_s for (k = 0; k < 4; k++) { memset(&alu, 0, sizeof(struct r600_bc_alu)); alu.inst = V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV; - alu.src[0].sel = r600_src[0].sel; + alu.src[0].sel = r600_src[j].sel; alu.src[0].chan = k; alu.dst.sel = ctx->temp_reg + j; alu.dst.chan = k; @@ -661,7 +661,7 @@ static int tgsi_split_constant(struct r600_shader_ctx *ctx, struct r600_bc_alu_s if (r) return r; } - r600_src[0].sel = ctx->temp_reg + j; + r600_src[j].sel = ctx->temp_reg + j; j--; } } -- cgit v1.2.3 From ee0153f891bb75ee14db579e6628d592032d6801 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Tue, 31 Aug 2010 10:43:54 +1000 Subject: r600g: make sure LIT splits constants --- src/gallium/drivers/r600/r600_shader.c | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/r600_shader.c b/src/gallium/drivers/r600/r600_shader.c index 2197a1610f..be6023268a 100644 --- a/src/gallium/drivers/r600/r600_shader.c +++ b/src/gallium/drivers/r600/r600_shader.c @@ -861,7 +861,6 @@ static int tgsi_trig(struct r600_shader_ctx *ctx) memset(&alu, 0, sizeof(struct r600_bc_alu)); alu.src[0].sel = ctx->temp_reg; alu.inst = V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV; - alu.dst.chan = i; r = tgsi_dst(ctx, &inst->Dst[0], i, &alu.dst); if (r) return r; @@ -965,8 +964,13 @@ static int tgsi_lit(struct r600_shader_ctx *ctx) { struct tgsi_full_instruction *inst = &ctx->parse.FullToken.FullInstruction; struct r600_bc_alu alu; + struct r600_bc_alu_src r600_src[3]; int r; + r = tgsi_split_constant(ctx, r600_src); + if (r) + return r; + /* dst.x, <- 1.0 */ memset(&alu, 0, sizeof(struct r600_bc_alu)); alu.inst = V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV; @@ -983,9 +987,7 @@ static int tgsi_lit(struct r600_shader_ctx *ctx) /* dst.y = max(src.x, 0.0) */ memset(&alu, 0, sizeof(struct r600_bc_alu)); alu.inst = V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MAX; - r = tgsi_src(ctx, &inst->Src[0], &alu.src[0]); - if (r) - return r; + alu.src[0] = r600_src[0]; alu.src[1].sel = V_SQ_ALU_SRC_0; /*0.0*/ alu.src[1].chan = 0; r = tgsi_dst(ctx, &inst->Dst[0], 1, &alu.dst); @@ -1030,10 +1032,8 @@ static int tgsi_lit(struct r600_shader_ctx *ctx) /* dst.z = log(src.y) */ memset(&alu, 0, sizeof(struct r600_bc_alu)); alu.inst = V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_LOG_CLAMPED; - r = tgsi_src(ctx, &inst->Src[0], &alu.src[0]); - if (r) - return r; - alu.src[0].chan = tgsi_chan(&inst->Src[0], 3); + alu.src[0] = r600_src[0]; + alu.src[0].chan = tgsi_chan(&inst->Src[0], 1); r = tgsi_dst(ctx, &inst->Dst[0], 2, &alu.dst); if (r) return r; @@ -1052,15 +1052,12 @@ static int tgsi_lit(struct r600_shader_ctx *ctx) /* tmp.x = amd MUL_LIT(src.w, dst.z, src.x ) */ memset(&alu, 0, sizeof(struct r600_bc_alu)); alu.inst = V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_MUL_LIT; - r = tgsi_src(ctx, &inst->Src[0], &alu.src[0]); - if (r) - return r; + alu.src[0] = r600_src[0]; alu.src[0].chan = tgsi_chan(&inst->Src[0], 3); alu.src[1].sel = sel; alu.src[1].chan = chan; - r = tgsi_src(ctx, &inst->Src[0], &alu.src[2]); - if (r) - return r; + + alu.src[2] = r600_src[0]; alu.src[2].chan = tgsi_chan(&inst->Src[0], 0); alu.dst.sel = ctx->temp_reg; alu.dst.chan = 0; -- cgit v1.2.3 From be7816f2b7f0b064a47fb3f101477ad5dba74017 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Tue, 31 Aug 2010 11:42:01 +1000 Subject: r600g: fixup trig functions when input is a literal So as the trig functions used up the literal spots for the PI work, if the arg0 was an immediate we'd hit failure, so copy the literal before starting. add some tracking of max temp used to avoid trashing temp regs. 5 more piglits, fp1 COS,SCS,SIN tests --- src/gallium/drivers/r600/r600_shader.c | 76 ++++++++++++++++++++++++++++++---- 1 file changed, 67 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/r600_shader.c b/src/gallium/drivers/r600/r600_shader.c index be6023268a..ed953d3f1d 100644 --- a/src/gallium/drivers/r600/r600_shader.c +++ b/src/gallium/drivers/r600/r600_shader.c @@ -50,6 +50,7 @@ struct r600_shader_ctx { u32 value[4]; u32 *literals; u32 nliterals; + u32 max_driver_temp_used; }; struct r600_shader_tgsi_instruction { @@ -354,6 +355,11 @@ static int tgsi_declaration(struct r600_shader_ctx *ctx) return 0; } +static int r600_get_temp(struct r600_shader_ctx *ctx) +{ + return ctx->temp_reg + ctx->max_driver_temp_used++; +} + int r600_shader_from_tgsi(const struct tgsi_token *tokens, struct r600_shader *shader) { struct tgsi_full_immediate *immediate; @@ -436,6 +442,9 @@ int r600_shader_from_tgsi(const struct tgsi_token *tokens, struct r600_shader *s r = tgsi_is_supported(&ctx); if (r) goto out_err; + ctx.max_driver_temp_used = 0; + /* reserve first tmp for everyone */ + r600_get_temp(&ctx); opcode = ctx.parse.FullToken.FullInstruction.Instruction.Opcode; ctx.inst_info = &r600_shader_tgsi_instruction[opcode]; r = ctx.inst_info->process(&ctx); @@ -647,12 +656,13 @@ static int tgsi_split_constant(struct r600_shader_ctx *ctx, struct r600_bc_alu_s } for (i = 0, j = nconst - 1; i < inst->Instruction.NumSrcRegs; i++) { if (inst->Src[j].Register.File == TGSI_FILE_CONSTANT && j > 0) { + int treg = r600_get_temp(ctx); for (k = 0; k < 4; k++) { memset(&alu, 0, sizeof(struct r600_bc_alu)); alu.inst = V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV; alu.src[0].sel = r600_src[j].sel; alu.src[0].chan = k; - alu.dst.sel = ctx->temp_reg + j; + alu.dst.sel = treg; alu.dst.chan = k; alu.dst.write = 1; if (k == 3) @@ -661,13 +671,52 @@ static int tgsi_split_constant(struct r600_shader_ctx *ctx, struct r600_bc_alu_s if (r) return r; } - r600_src[j].sel = ctx->temp_reg + j; + r600_src[j].sel = treg; j--; } } return 0; } +/* need to move any immediate into a temp - for trig functions which use literal for PI stuff */ +static int tgsi_split_literal_constant(struct r600_shader_ctx *ctx, struct r600_bc_alu_src r600_src[3]) +{ + struct tgsi_full_instruction *inst = &ctx->parse.FullToken.FullInstruction; + struct r600_bc_alu alu; + int i, j, k, nliteral, r; + + for (i = 0, nliteral = 0; i < inst->Instruction.NumSrcRegs; i++) { + if (inst->Src[i].Register.File == TGSI_FILE_IMMEDIATE) { + nliteral++; + } + } + for (i = 0, j = 0; i < inst->Instruction.NumSrcRegs; i++) { + if (inst->Src[j].Register.File == TGSI_FILE_IMMEDIATE) { + int treg = r600_get_temp(ctx); + for (k = 0; k < 4; k++) { + memset(&alu, 0, sizeof(struct r600_bc_alu)); + alu.inst = V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV; + alu.src[0].sel = r600_src[j].sel; + alu.src[0].chan = k; + alu.dst.sel = treg; + alu.dst.chan = k; + alu.dst.write = 1; + if (k == 3) + alu.last = 1; + r = r600_bc_add_alu(ctx->bc, &alu); + if (r) + return r; + } + r = r600_bc_add_literal(ctx->bc, ctx->value); + if (r) + return r; + r600_src[j].sel = treg; + j++; + } + } + return 0; +} + static int tgsi_op2_s(struct r600_shader_ctx *ctx, int swap) { struct tgsi_full_instruction *inst = &ctx->parse.FullToken.FullInstruction; @@ -755,6 +804,11 @@ static int tgsi_setup_trig(struct r600_shader_ctx *ctx, r = tgsi_split_constant(ctx, r600_src); if (r) return r; + + r = tgsi_split_literal_constant(ctx, r600_src); + if (r) + return r; + lit_vals[0] = fui(1.0 /(3.1415926535 * 2)); lit_vals[1] = fui(0.5f); @@ -834,10 +888,7 @@ static int tgsi_trig(struct r600_shader_ctx *ctx) struct r600_bc_alu_src r600_src[3]; struct r600_bc_alu alu; int i, r; - - r = tgsi_split_constant(ctx, r600_src); - if (r) - return r; + int lasti = 0; r = tgsi_setup_trig(ctx, r600_src); if (r) @@ -858,14 +909,21 @@ static int tgsi_trig(struct r600_shader_ctx *ctx) /* replicate result */ for (i = 0; i < 4; i++) { + if (inst->Dst[0].Register.WriteMask & (1 << i)) + lasti = i; + } + for (i = 0; i < lasti + 1; i++) { + if (!(inst->Dst[0].Register.WriteMask & (1 << i))) + continue; + memset(&alu, 0, sizeof(struct r600_bc_alu)); - alu.src[0].sel = ctx->temp_reg; alu.inst = V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV; + + alu.src[0].sel = ctx->temp_reg; r = tgsi_dst(ctx, &inst->Dst[0], i, &alu.dst); if (r) return r; - alu.dst.write = (inst->Dst[0].Register.WriteMask >> i) & 1; - if (i == 3) + if (i == lasti) alu.last = 1; r = r600_bc_add_alu(ctx->bc, &alu); if (r) -- cgit v1.2.3 From 24ff42e7d56ac489caeca6b5ffcc3091cc8194b5 Mon Sep 17 00:00:00 2001 From: Zhenyu Wang Date: Tue, 31 Aug 2010 09:54:44 +0800 Subject: i965: fix depth test on sandybridge This includes several corrections for fixing depth test on sandybridge. Fix wrong bits definition in depth stencil state. Fix wrong order of state buffer offset in 3DSTATE_CC_STATE_POINTERS command. Correctly use buffer width parameter in depth buffer setting. Signed-off-by: Zhenyu Wang --- src/mesa/drivers/dri/i965/brw_misc_state.c | 2 +- src/mesa/drivers/dri/i965/brw_structs.h | 2 +- src/mesa/drivers/dri/i965/gen6_cc.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_misc_state.c b/src/mesa/drivers/dri/i965/brw_misc_state.c index 565a9e3ee1..6eeaba7772 100644 --- a/src/mesa/drivers/dri/i965/brw_misc_state.c +++ b/src/mesa/drivers/dri/i965/brw_misc_state.c @@ -295,7 +295,7 @@ static void emit_depthbuffer(struct brw_context *brw) I915_GEM_DOMAIN_RENDER, I915_GEM_DOMAIN_RENDER, 0); OUT_BATCH((BRW_SURFACE_MIPMAPLAYOUT_BELOW << 1) | - ((region->pitch - 1) << 6) | + ((region->width - 1) << 6) | ((region->height - 1) << 19)); OUT_BATCH(0); diff --git a/src/mesa/drivers/dri/i965/brw_structs.h b/src/mesa/drivers/dri/i965/brw_structs.h index cdd2998627..2a118e01c5 100644 --- a/src/mesa/drivers/dri/i965/brw_structs.h +++ b/src/mesa/drivers/dri/i965/brw_structs.h @@ -750,7 +750,7 @@ struct gen6_depth_stencil_state } ds1; struct { - GLuint pad0:25; + GLuint pad0:26; GLuint depth_write_enable:1; GLuint depth_test_func:3; GLuint pad1:1; diff --git a/src/mesa/drivers/dri/i965/gen6_cc.c b/src/mesa/drivers/dri/i965/gen6_cc.c index f7acad6912..26f1070a16 100644 --- a/src/mesa/drivers/dri/i965/gen6_cc.c +++ b/src/mesa/drivers/dri/i965/gen6_cc.c @@ -267,9 +267,9 @@ static void upload_cc_state_pointers(struct brw_context *brw) BEGIN_BATCH(4); OUT_BATCH(CMD_3D_CC_STATE_POINTERS << 16 | (4 - 2)); - OUT_RELOC(brw->cc.state_bo, I915_GEM_DOMAIN_INSTRUCTION, 0, 1); OUT_RELOC(brw->cc.blend_state_bo, I915_GEM_DOMAIN_INSTRUCTION, 0, 1); OUT_RELOC(brw->cc.depth_stencil_state_bo, I915_GEM_DOMAIN_INSTRUCTION, 0, 1); + OUT_RELOC(brw->cc.state_bo, I915_GEM_DOMAIN_INSTRUCTION, 0, 1); ADVANCE_BATCH(); intel_batchbuffer_emit_mi_flush(intel->batch); -- cgit v1.2.3 From d3fa92584b109bf59dce32501eec73f8de74f42b Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Tue, 31 Aug 2010 11:57:04 +1000 Subject: r600g: make LIT work properly this is a bit of a workaround, something is wrong with the literal emits here so we just use the trig copy function to copy the immd to a temp at start of op. fix VP/FP LIT tests --- src/gallium/drivers/r600/r600_shader.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/r600_shader.c b/src/gallium/drivers/r600/r600_shader.c index ed953d3f1d..bac96e8a30 100644 --- a/src/gallium/drivers/r600/r600_shader.c +++ b/src/gallium/drivers/r600/r600_shader.c @@ -1026,6 +1026,9 @@ static int tgsi_lit(struct r600_shader_ctx *ctx) int r; r = tgsi_split_constant(ctx, r600_src); + if (r) + return r; + r = tgsi_split_literal_constant(ctx, r600_src); if (r) return r; @@ -1056,14 +1059,6 @@ static int tgsi_lit(struct r600_shader_ctx *ctx) if (r) return r; - /* dst.z = NOP - fill Z slot */ - memset(&alu, 0, sizeof(struct r600_bc_alu)); - alu.inst = V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP; - alu.dst.chan = 2; - r = r600_bc_add_alu(ctx->bc, &alu); - if (r) - return r; - /* dst.w, <- 1.0 */ memset(&alu, 0, sizeof(struct r600_bc_alu)); alu.inst = V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV; -- cgit v1.2.3 From 2619b1c96feed72444499021d8a870eab1c37e00 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Mon, 30 Aug 2010 20:42:19 -0700 Subject: linker: Require an exact matching signature when looking for prototypes. Fixes piglit test glsl-override-builtin. The linker incorrectly found the prototype for the float signature, rather than adding a new prototype with the int return type. This caused ir_calls with type int to have their callees set to the float signature, triggering an assert. --- src/glsl/link_functions.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/glsl/link_functions.cpp b/src/glsl/link_functions.cpp index 6374573e61..78c8b48cf1 100644 --- a/src/glsl/link_functions.cpp +++ b/src/glsl/link_functions.cpp @@ -111,7 +111,7 @@ public: f = new(linked) ir_function(name); ir_function_signature *linked_sig = - f->matching_signature(&callee->parameters); + f->exact_matching_signature(&callee->parameters); if (linked_sig == NULL) { linked_sig = new(linked) ir_function_signature(callee->return_type); f->add_signature(linked_sig); -- cgit v1.2.3 From 4f189b3bf57a6500953dac49105f160af5fa6468 Mon Sep 17 00:00:00 2001 From: Marek Olšák Date: Tue, 31 Aug 2010 05:38:50 +0200 Subject: ir_to_mesa: use RSQ+MUL instead of RSQ+RCP for SQRT sqrt(x) = 1/rsq(x) = x*rsq(x) This optimization already was in the old GLSL compiler. Acked on irc by Eric Anholt. --- src/mesa/program/ir_to_mesa.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp index af6d7345a5..516c991855 100644 --- a/src/mesa/program/ir_to_mesa.cpp +++ b/src/mesa/program/ir_to_mesa.cpp @@ -880,8 +880,9 @@ ir_to_mesa_visitor::visit(ir_expression *ir) break; case ir_unop_sqrt: + /* sqrt(x) = x * rsq(x). */ 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); + ir_to_mesa_emit_op2(ir, OPCODE_MUL, result_dst, result_src, op[0]); /* For incoming channels < 0, set the result to 0. */ ir_to_mesa_emit_op3(ir, OPCODE_CMP, result_dst, op[0], src_reg_for_float(0.0), result_src); -- cgit v1.2.3 From 4e61f085d04c5d182989c6cb388c375b007e6b76 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Tue, 31 Aug 2010 13:54:19 +1000 Subject: r600g: remove unneeded function call from scs --- src/gallium/drivers/r600/r600_shader.c | 4 ---- 1 file changed, 4 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/r600_shader.c b/src/gallium/drivers/r600/r600_shader.c index bac96e8a30..b760ee70ea 100644 --- a/src/gallium/drivers/r600/r600_shader.c +++ b/src/gallium/drivers/r600/r600_shader.c @@ -939,10 +939,6 @@ static int tgsi_scs(struct r600_shader_ctx *ctx) struct r600_bc_alu alu; int r; - r = tgsi_split_constant(ctx, r600_src); - if (r) - return r; - r = tgsi_setup_trig(ctx, r600_src); if (r) return r; -- cgit v1.2.3 From 5d66a8606d68caf0fb4754c144c5fb7d87fbf7df Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Tue, 31 Aug 2010 14:52:52 +1000 Subject: r600g: fix position input to fragment shader. this fixes a few if the fs shader tests, 10 more piglits --- src/gallium/drivers/r600/r600_shader.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src') diff --git a/src/gallium/drivers/r600/r600_shader.c b/src/gallium/drivers/r600/r600_shader.c index b760ee70ea..5675e39542 100644 --- a/src/gallium/drivers/r600/r600_shader.c +++ b/src/gallium/drivers/r600/r600_shader.c @@ -166,6 +166,7 @@ static int r600_pipe_shader_ps(struct pipe_context *ctx, struct r600_context_sta struct r600_context *rctx = r600_context(ctx); struct radeon_state *state; unsigned i, tmp, exports_ps, num_cout; + boolean have_pos = FALSE; rasterizer = &rctx->rasterizer->state.rasterizer; rpshader->rstate = radeon_state_decref(rpshader->rstate); @@ -175,6 +176,8 @@ static int r600_pipe_shader_ps(struct pipe_context *ctx, struct r600_context_sta for (i = 0; i < rshader->ninput; i++) { tmp = S_028644_SEMANTIC(i); tmp |= S_028644_SEL_CENTROID(1); + if (rshader->input[i].name == TGSI_SEMANTIC_POSITION) + have_pos = TRUE; if (rshader->input[i].name == TGSI_SEMANTIC_COLOR || rshader->input[i].name == TGSI_SEMANTIC_BCOLOR) { tmp |= S_028644_FLAT_SHADE(rshader->flat_shade); @@ -201,6 +204,10 @@ static int r600_pipe_shader_ps(struct pipe_context *ctx, struct r600_context_sta } state->states[R600_PS_SHADER__SPI_PS_IN_CONTROL_0] = S_0286CC_NUM_INTERP(rshader->ninput) | S_0286CC_PERSP_GRADIENT_ENA(1); + if (have_pos) { + state->states[R600_PS_SHADER__SPI_PS_IN_CONTROL_0] |= S_0286CC_POSITION_ENA(1); + S_0286CC_BARYC_SAMPLE_CNTL(1); + } state->states[R600_PS_SHADER__SPI_PS_IN_CONTROL_1] = 0x00000000; state->states[R600_PS_SHADER__SQ_PGM_RESOURCES_PS] = S_028868_NUM_GPRS(rshader->bc.ngpr) | S_028868_STACK_SIZE(rshader->bc.nstack); -- cgit v1.2.3 From 580781babe99bbfd0181b911e1e53e94728faa04 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Tue, 31 Aug 2010 14:57:57 +1000 Subject: r600g: fix typo in last commit --- src/gallium/drivers/r600/r600_shader.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/r600_shader.c b/src/gallium/drivers/r600/r600_shader.c index 5675e39542..dae3781978 100644 --- a/src/gallium/drivers/r600/r600_shader.c +++ b/src/gallium/drivers/r600/r600_shader.c @@ -205,7 +205,7 @@ static int r600_pipe_shader_ps(struct pipe_context *ctx, struct r600_context_sta state->states[R600_PS_SHADER__SPI_PS_IN_CONTROL_0] = S_0286CC_NUM_INTERP(rshader->ninput) | S_0286CC_PERSP_GRADIENT_ENA(1); if (have_pos) { - state->states[R600_PS_SHADER__SPI_PS_IN_CONTROL_0] |= S_0286CC_POSITION_ENA(1); + state->states[R600_PS_SHADER__SPI_PS_IN_CONTROL_0] |= S_0286CC_POSITION_ENA(1) | S_0286CC_BARYC_SAMPLE_CNTL(1); } state->states[R600_PS_SHADER__SPI_PS_IN_CONTROL_1] = 0x00000000; -- cgit v1.2.3 From ad202678fc4859b51a9198575a886707f57ad05b Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Tue, 31 Aug 2010 15:12:24 +1000 Subject: r600g: fix fp-fragment-position test. --- src/gallium/drivers/r600/r600_shader.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/gallium/drivers/r600/r600_shader.c b/src/gallium/drivers/r600/r600_shader.c index dae3781978..d81308b211 100644 --- a/src/gallium/drivers/r600/r600_shader.c +++ b/src/gallium/drivers/r600/r600_shader.c @@ -207,6 +207,7 @@ static int r600_pipe_shader_ps(struct pipe_context *ctx, struct r600_context_sta if (have_pos) { state->states[R600_PS_SHADER__SPI_PS_IN_CONTROL_0] |= S_0286CC_POSITION_ENA(1) | S_0286CC_BARYC_SAMPLE_CNTL(1); + state->states[R600_PS_SHADER__SPI_INPUT_Z] |= 1; } state->states[R600_PS_SHADER__SPI_PS_IN_CONTROL_1] = 0x00000000; state->states[R600_PS_SHADER__SQ_PGM_RESOURCES_PS] = S_028868_NUM_GPRS(rshader->bc.ngpr) | -- cgit v1.2.3 From b87b6e5bf798fcfa486e8082a09b4425a40cf3c4 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Tue, 31 Aug 2010 16:13:03 +1000 Subject: r600g: fix up depth write swizzles. For some reason r600c, emits extra instructions in the FP to do the depth write output swizzle, I'm not sure this is required, so here I'm doing it in the exports. this fixes the mesa trivial demos tri-depthwrite and tri-depthwrite2, it doesn't fix the glsl1 gl_FragDepth writing test however. --- src/gallium/drivers/r600/r600_shader.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/r600_shader.c b/src/gallium/drivers/r600/r600_shader.c index d81308b211..bc1811129b 100644 --- a/src/gallium/drivers/r600/r600_shader.c +++ b/src/gallium/drivers/r600/r600_shader.c @@ -179,7 +179,8 @@ static int r600_pipe_shader_ps(struct pipe_context *ctx, struct r600_context_sta if (rshader->input[i].name == TGSI_SEMANTIC_POSITION) have_pos = TRUE; if (rshader->input[i].name == TGSI_SEMANTIC_COLOR || - rshader->input[i].name == TGSI_SEMANTIC_BCOLOR) { + rshader->input[i].name == TGSI_SEMANTIC_BCOLOR || + rshader->input[i].name == TGSI_SEMANTIC_POSITION) { tmp |= S_028644_FLAT_SHADE(rshader->flat_shade); } if (rasterizer->sprite_coord_enable & (1 << i)) { @@ -503,6 +504,8 @@ int r600_shader_from_tgsi(const struct tgsi_token *tokens, struct r600_shader *s output[i].type = V_SQ_CF_ALLOC_EXPORT_WORD0_SQ_EXPORT_PIXEL; } else if (shader->output[i].name == TGSI_SEMANTIC_POSITION) { output[i].array_base = 61; + output[i].swizzle_x = 2; + output[i].swizzle_y = output[i].swizzle_z = output[i].swizzle_w = 7; output[i].type = V_SQ_CF_ALLOC_EXPORT_WORD0_SQ_EXPORT_PIXEL; } else { R600_ERR("unsupported fragment output name %d\n", shader->output[i].name); -- cgit v1.2.3 From 8cdeff8444db999a02a27ecab59d9374cb076437 Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Tue, 31 Aug 2010 15:25:09 +0800 Subject: egl: Mark EGL_MESA_screen_surface as obsolete. EGL_MESA_drm_{display,image} can achieve the same functionality. --- src/egl/docs/EGL_MESA_screen_surface | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/egl/docs/EGL_MESA_screen_surface b/src/egl/docs/EGL_MESA_screen_surface index 6beb4ce88e..698a240578 100644 --- a/src/egl/docs/EGL_MESA_screen_surface +++ b/src/egl/docs/EGL_MESA_screen_surface @@ -14,7 +14,7 @@ Contact Status - Preliminary - totally subject to change. + Obsolete. Version -- cgit v1.2.3 From 3fbbd70e80033566f5d7015fa2110a9d355bcfa4 Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Tue, 31 Aug 2010 15:52:26 +0800 Subject: st/egl: Enable EGL_MESA_drm_display. --- src/gallium/state_trackers/egl/common/egl_g3d.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/state_trackers/egl/common/egl_g3d.c b/src/gallium/state_trackers/egl/common/egl_g3d.c index 2d04695f97..4e653bdf3b 100644 --- a/src/gallium/state_trackers/egl/common/egl_g3d.c +++ b/src/gallium/state_trackers/egl/common/egl_g3d.c @@ -537,8 +537,10 @@ egl_g3d_initialize(_EGLDriver *drv, _EGLDisplay *dpy, dpy->Extensions.KHR_surfaceless_gles2 = EGL_TRUE; dpy->Extensions.KHR_surfaceless_opengl = EGL_TRUE; - if (dpy->Platform == _EGL_PLATFORM_DRM) + if (dpy->Platform == _EGL_PLATFORM_DRM) { + dpy->Extensions.MESA_drm_display = EGL_TRUE; dpy->Extensions.MESA_drm_image = EGL_TRUE; + } if (egl_g3d_add_configs(drv, dpy, 1) == 1) { _eglError(EGL_NOT_INITIALIZED, "eglInitialize(unable to add configs)"); -- cgit v1.2.3 From 1eea96326fa652029e3898e104c715e5464f11e4 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Tue, 31 Aug 2010 10:56:24 -0700 Subject: ast_to_hir: Add support for bit-wise operators (but not shifts). Previously, using bit-wise operators in some larger expression would crash on a NULL pointer dereference. This code at least doesn't crash. Fixes piglit test bitwise-01.frag. --- src/glsl/ast_to_hir.cpp | 55 +++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 53 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp index e0a510cc45..148afd00e8 100644 --- a/src/glsl/ast_to_hir.cpp +++ b/src/glsl/ast_to_hir.cpp @@ -802,9 +802,60 @@ ast_expression::hir(exec_list *instructions, case ast_bit_and: case ast_bit_xor: case ast_bit_or: + op[0] = this->subexpressions[0]->hir(instructions, state); + op[1] = this->subexpressions[1]->hir(instructions, state); + + if (state->language_version < 130) { + _mesa_glsl_error(&loc, state, "bit-wise operations require GLSL 1.30"); + error_emitted = true; + } + + if (!op[0]->type->is_integer()) { + _mesa_glsl_error(&loc, state, "LHS of `%s' must be an integer", + operator_string(this->oper)); + error_emitted = true; + } + + if (!op[1]->type->is_integer()) { + _mesa_glsl_error(&loc, state, "RHS of `%s' must be an integer", + operator_string(this->oper)); + error_emitted = true; + } + + if (op[0]->type->base_type != op[1]->type->base_type) { + _mesa_glsl_error(&loc, state, "operands of `%s' must have the same " + "base type", operator_string(this->oper)); + error_emitted = true; + } + + if (op[0]->type->is_vector() && op[1]->type->is_vector() + && op[0]->type->vector_elements != op[1]->type->vector_elements) { + _mesa_glsl_error(&loc, state, "operands of `%s' cannot be vectors of " + "different sizes", operator_string(this->oper)); + error_emitted = true; + } + + type = op[0]->type->is_scalar() ? op[1]->type : op[0]->type; + result = new(ctx) ir_expression(operations[this->oper], type, + op[0], op[1]); + error_emitted = op[0]->type->is_error() || op[1]->type->is_error(); + break; + case ast_bit_not: - _mesa_glsl_error(& loc, state, "FINISHME: implement bit-wise operators"); - error_emitted = true; + op[0] = this->subexpressions[0]->hir(instructions, state); + + if (state->language_version < 130) { + _mesa_glsl_error(&loc, state, "bit-wise operations require GLSL 1.30"); + error_emitted = true; + } + + if (!op[0]->type->is_integer()) { + _mesa_glsl_error(&loc, state, "operand of `~' must be an integer"); + error_emitted = true; + } + + type = op[0]->type; + result = new(ctx) ir_expression(ir_unop_bit_not, type, op[0], NULL); break; case ast_logic_and: { -- cgit v1.2.3 From 7406898441bfec937840d575500fb6d43192310d Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 30 Aug 2010 14:42:27 -0700 Subject: ir_to_mesa: Set up our instruction nodes with zeroed data. cond_update wasn't being set by emit_op3, leading to valgrind complaints, and failures in several piglit tests when built with clang. --- src/mesa/program/ir_to_mesa.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src') diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp index 516c991855..768c11e3bf 100644 --- a/src/mesa/program/ir_to_mesa.cpp +++ b/src/mesa/program/ir_to_mesa.cpp @@ -105,6 +105,18 @@ extern ir_to_mesa_src_reg ir_to_mesa_undef; class ir_to_mesa_instruction : public exec_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_zero_size(ctx, size); + assert(node != NULL); + + return node; + } + enum prog_opcode op; ir_to_mesa_dst_reg dst_reg; ir_to_mesa_src_reg src_reg[3]; -- cgit v1.2.3 From 2a78807db7a3bc852da0cda1e933a157204c3a47 Mon Sep 17 00:00:00 2001 From: nobled Date: Sun, 22 Aug 2010 05:16:53 +0000 Subject: ir_to_mesa: Fix struct/class confusion --- src/mesa/program/ir_to_mesa.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp index 768c11e3bf..337ecbaa93 100644 --- a/src/mesa/program/ir_to_mesa.cpp +++ b/src/mesa/program/ir_to_mesa.cpp @@ -1369,7 +1369,7 @@ ir_to_mesa_visitor::visit(ir_dereference_array *ir) if (deref_var && strncmp(deref_var->var->name, "gl_TextureMatrix", strlen("gl_TextureMatrix")) == 0) { - struct variable_storage *entry; + variable_storage *entry; entry = get_builtin_matrix_ref(this->mem_ctx, this->prog, deref_var->var, ir->array_index); -- cgit v1.2.3 From 99f3c9caa39fbe9dfa7561c919202395720e9472 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 31 Aug 2010 11:16:09 -0700 Subject: ir_to_mesa: Sort the uniform list we're adding to Parameters[] order. Fixes glsl-uniform-linking-1 and failure to link a shader in Unigine. An alternative here would be to just ditch using _mesa_add_parameter and build the initial params list on our own, but that would require two walks of the list as well. Bug #29822 --- src/mesa/program/ir_to_mesa.cpp | 46 ++++++++++++++++++++++++++++++++++++----- 1 file changed, 41 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp index 337ecbaa93..8f39a225af 100644 --- a/src/mesa/program/ir_to_mesa.cpp +++ b/src/mesa/program/ir_to_mesa.cpp @@ -2264,6 +2264,25 @@ count_resources(struct gl_program *prog) _mesa_update_shader_textures_used(prog); } +struct uniform_sort { + struct gl_uniform *u; + int pos; +}; + +/* The shader_program->Uniforms list is almost sorted in increasing + * uniform->{Frag,Vert}Pos locations, but not quite when there are + * uniforms shared between targets. We need to add parameters in + * increasing order for the targets. + */ +static int +sort_uniforms(const void *a, const void *b) +{ + struct uniform_sort *u1 = (struct uniform_sort *)a; + struct uniform_sort *u2 = (struct uniform_sort *)b; + + return u1->pos - u2->pos; +} + /* Add the uniforms to the parameters. The linker chose locations * in our parameters lists (which weren't created yet), which the * uniforms code will use to poke values into our parameters list @@ -2275,12 +2294,14 @@ add_uniforms_to_parameters_list(struct gl_shader_program *shader_program, struct gl_program *prog) { unsigned int i; - unsigned int next_sampler = 0; + unsigned int next_sampler = 0, num_uniforms = 0; + struct uniform_sort *sorted_uniforms; + + sorted_uniforms = talloc_array(NULL, struct uniform_sort, + shader_program->Uniforms->NumUniforms); for (i = 0; i < shader_program->Uniforms->NumUniforms; i++) { struct gl_uniform *uniform = shader_program->Uniforms->Uniforms + i; - const glsl_type *type = uniform->Type; - unsigned int size; int parameter_index = -1; switch (shader->Type) { @@ -2296,8 +2317,21 @@ add_uniforms_to_parameters_list(struct gl_shader_program *shader_program, } /* Only add uniforms used in our target. */ - if (parameter_index == -1) - continue; + if (parameter_index != -1) { + sorted_uniforms[num_uniforms].pos = parameter_index; + sorted_uniforms[num_uniforms].u = uniform; + num_uniforms++; + } + } + + qsort(sorted_uniforms, num_uniforms, sizeof(struct uniform_sort), + sort_uniforms); + + for (i = 0; i < num_uniforms; i++) { + struct gl_uniform *uniform = sorted_uniforms[i].u; + int parameter_index = sorted_uniforms[i].pos; + const glsl_type *type = uniform->Type; + unsigned int size; if (type->is_vector() || type->is_scalar()) { @@ -2344,6 +2378,8 @@ add_uniforms_to_parameters_list(struct gl_shader_program *shader_program, } } } + + talloc_free(sorted_uniforms); } static void -- cgit v1.2.3 From a6c3cd5ca6822da2ec6e869c7bc2b8ac64c177f2 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Tue, 31 Aug 2010 14:44:13 -0700 Subject: glsl2: Write vector constructor constants in a single assignment Make two passes over the constructor parameters. Write all of the constants in a single write, then write the non-constants one at a time. This causes the fragment shader varying float g; void main() { gl_FragColor = vec4(0.0, g, 0.0, 1.0); } to generate (function main (signature void (parameters ) ( (declare (temporary ) vec4 vec_ctor@0x8580058) (assign (constant bool (1)) (xzw) (var_ref vec_ctor@0x8580058) (constant vec4 (0.000000 0.000000 0.000000 1.000000)) ) (assign (constant bool (1)) (y) (var_ref vec_ctor@0x8580058) (swiz xxxx (var_ref g@0x8580218) )) (assign (constant bool (1)) (xyzw) (var_ref gl_FragColor@0x84d32a0) (var_ref vec_ctor@0x8580058) ) )) ) instead of (function main (signature void (parameters ) ( (declare (temporary ) vec4 vec_ctor@0x8580058) (assign (constant bool (1)) (x) (var_ref vec_ctor@0x8580058) (constant vec4 (0.000000 0.000000 0.000000 1.000000)) ) (assign (constant bool (1)) (y) (var_ref vec_ctor@0x8580058) (swiz xxxx (var_ref g@0x8580218) )) (assign (constant bool (1)) (z) (var_ref vec_ctor@0x8580058) (constant vec4 (0.000000 0.000000 0.000000 1.000000)) ) (assign (constant bool (1)) (w) (var_ref vec_ctor@0x8580058) (constant vec4 (0.000000 0.000000 0.000000 1.000000)) ) (assign (constant bool (1)) (xyzw) (var_ref gl_FragColor@0x84d32a0) (var_ref vec_ctor@0x8580058) ) )) ) A similar optimization could be done for matrix constructors, but it is a little more complicate there. --- src/glsl/ast_function.cpp | 83 ++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 72 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/glsl/ast_function.cpp b/src/glsl/ast_function.cpp index c2e526cf89..d39c4b195c 100644 --- a/src/glsl/ast_function.cpp +++ b/src/glsl/ast_function.cpp @@ -621,6 +621,11 @@ emit_inline_vector_constructor(const glsl_type *type, instructions->push_tail(inst); } else { unsigned base_component = 0; + ir_constant_data data; + unsigned constant_mask = 0; + + memset(&data, 0, sizeof(data)); + foreach_list(node, parameters) { ir_rvalue *param = (ir_rvalue *) node; unsigned rhs_components = param->type->components(); @@ -631,24 +636,80 @@ emit_inline_vector_constructor(const glsl_type *type, rhs_components = lhs_components - base_component; } - /* Generate a swizzle that puts the first element of the source at - * the location of the first element of the destination. - */ - unsigned swiz[4] = { 0, 0, 0, 0 }; - for (unsigned i = 0; i < rhs_components; i++) - swiz[i + base_component] = i; + const ir_constant *const c = param->as_constant(); + if (c != NULL) { + for (unsigned i = 0; i < rhs_components; i++) { + switch (c->type->base_type) { + case GLSL_TYPE_UINT: + data.u[i + base_component] = c->get_uint_component(i); + break; + case GLSL_TYPE_INT: + data.i[i + base_component] = c->get_int_component(i); + break; + case GLSL_TYPE_FLOAT: + data.f[i + base_component] = c->get_float_component(i); + break; + case GLSL_TYPE_BOOL: + data.b[i + base_component] = c->get_bool_component(i); + break; + default: + assert(!"Should not get here."); + break; + } + } - /* Mask of fields to be written in the assignment. + /* Mask of fields to be written in the assignment. + */ + constant_mask |= ((1U << rhs_components) - 1) << base_component; + } + + /* Advance the component index by the number of components that were + * just assigned. */ - const unsigned write_mask = ((1U << rhs_components) - 1) - << base_component; + base_component += rhs_components; + } + if (constant_mask != 0) { ir_dereference *lhs = new(ctx) ir_dereference_variable(var); - ir_rvalue *rhs = new(ctx) ir_swizzle(param, swiz, lhs_components); + ir_rvalue *rhs = new(ctx) ir_constant(var->type, &data); ir_instruction *inst = - new(ctx) ir_assignment(lhs, rhs, NULL, write_mask); + new(ctx) ir_assignment(lhs, rhs, NULL, constant_mask); instructions->push_tail(inst); + } + + base_component = 0; + foreach_list(node, parameters) { + ir_rvalue *param = (ir_rvalue *) node; + unsigned rhs_components = param->type->components(); + + /* Do not try to assign more components to the vector than it has! + */ + if ((rhs_components + base_component) > lhs_components) { + rhs_components = lhs_components - base_component; + } + + const ir_constant *const c = param->as_constant(); + if (c == NULL) { + /* Generate a swizzle that puts the first element of the source at + * the location of the first element of the destination. + */ + 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_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, write_mask); + instructions->push_tail(inst); + } /* Advance the component index by the number of components that were * just assigned. -- cgit v1.2.3 From d8c92a1eea555f8b9d673a3f2a708de5faf8b3cd Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Sun, 15 Aug 2010 18:19:52 +0100 Subject: llvmpipe: intrinsics versions of build_mask functions --- src/gallium/drivers/llvmpipe/lp_rast_tri.c | 78 +++++++++++++++++++++++++++++- 1 file changed, 77 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/drivers/llvmpipe/lp_rast_tri.c b/src/gallium/drivers/llvmpipe/lp_rast_tri.c index 8d729c7481..5b3ad6e0a7 100644 --- a/src/gallium/drivers/llvmpipe/lp_rast_tri.c +++ b/src/gallium/drivers/llvmpipe/lp_rast_tri.c @@ -67,7 +67,7 @@ block_full_16(struct lp_rasterizer_task *task, block_full_4(task, tri, x + ix, y + iy); } - +#if !defined(PIPE_ARCH_SSE) static INLINE unsigned build_mask(int c, int dcdx, int dcdy) { @@ -98,6 +98,7 @@ build_mask(int c, int dcdx, int dcdy) return mask; } + static INLINE unsigned build_mask_linear(int c, int dcdx, int dcdy) { @@ -127,6 +128,81 @@ build_mask_linear(int c, int dcdx, int dcdy) return mask; } +#else +#include +#include "util/u_sse.h" + + +static INLINE unsigned +build_mask_linear(int c, int dcdx, int dcdy) +{ + __m128i cstep0 = _mm_setr_epi32(c, c+dcdx, c+dcdx*2, c+dcdx*3); + __m128i xdcdy = _mm_set1_epi32(dcdy); + + /* Get values across the quad + */ + __m128i cstep1 = _mm_add_epi32(cstep0, xdcdy); + __m128i cstep2 = _mm_add_epi32(cstep1, xdcdy); + __m128i cstep3 = _mm_add_epi32(cstep2, xdcdy); + + /* pack pairs of results into epi16 + */ + __m128i cstep01 = _mm_packs_epi32(cstep0, cstep1); + __m128i cstep23 = _mm_packs_epi32(cstep2, cstep3); + + /* pack into epi8, preserving sign bits + */ + __m128i result = _mm_packs_epi16(cstep01, cstep23); + + /* extract sign bits to create mask + */ + return _mm_movemask_epi8(result); +} + +static INLINE unsigned +build_mask(int c, int dcdx, int dcdy) +{ + __m128i step = _mm_setr_epi32(0, dcdx, dcdy, dcdx + dcdy); + __m128i c0 = _mm_set1_epi32(c); + + /* Get values across the quad + */ + __m128i cstep0 = _mm_add_epi32(c0, step); + + /* Scale up step for moving between quads. This should probably + * be an arithmetic shift left, but there doesn't seem to be + * such a thing in SSE. It's unlikely that the step value is + * going to be large enough to overflow across 4 pixels, though + * if it is that big, rendering will be incorrect anyway. + */ + __m128i step4 = _mm_slli_epi32(step, 1); + + /* Get values for the remaining quads: + */ + __m128i cstep1 = _mm_add_epi32(cstep0, + _mm_shuffle_epi32(step4, _MM_SHUFFLE(1,1,1,1))); + __m128i cstep2 = _mm_add_epi32(cstep0, + _mm_shuffle_epi32(step4, _MM_SHUFFLE(2,2,2,2))); + __m128i cstep3 = _mm_add_epi32(cstep2, + _mm_shuffle_epi32(step4, _MM_SHUFFLE(1,1,1,1))); + + /* pack pairs of results into epi16 + */ + __m128i cstep01 = _mm_packs_epi32(cstep0, cstep1); + __m128i cstep23 = _mm_packs_epi32(cstep2, cstep3); + + /* pack into epi8, preserving sign bits + */ + __m128i result = _mm_packs_epi16(cstep01, cstep23); + + /* extract sign bits to create mask + */ + return _mm_movemask_epi8(result); +} + +#endif + + #define TAG(x) x##_1 -- cgit v1.2.3 From 0aa3a09ced07e150901cd0f7a7917556a018c252 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Sun, 22 Aug 2010 22:56:54 +0100 Subject: llvmpipe: combine linear mask calculation --- src/gallium/drivers/llvmpipe/lp_rast_tri.c | 73 ++++++++++++++++++++++++-- src/gallium/drivers/llvmpipe/lp_rast_tri_tmp.h | 26 +++++---- 2 files changed, 84 insertions(+), 15 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/llvmpipe/lp_rast_tri.c b/src/gallium/drivers/llvmpipe/lp_rast_tri.c index 5b3ad6e0a7..bdb8d131cc 100644 --- a/src/gallium/drivers/llvmpipe/lp_rast_tri.c +++ b/src/gallium/drivers/llvmpipe/lp_rast_tri.c @@ -128,11 +128,71 @@ build_mask_linear(int c, int dcdx, int dcdy) return mask; } + + +static INLINE void +build_masks(int c, + int cdiff, + int dcdx, + int dcdy, + unsigned *outmask, + unsigned *partmask) +{ + *outmask |= build_mask_linear(c, dcdx, dcdy); + *partmask |= build_mask_linear(c + cdiff, dcdx, dcdy); +} + #else #include #include "util/u_sse.h" +static INLINE void +build_masks(int c, + int cdiff, + int dcdx, + int dcdy, + unsigned *outmask, + unsigned *partmask) +{ + __m128i cstep0 = _mm_setr_epi32(c, c+dcdx, c+dcdx*2, c+dcdx*3); + __m128i xdcdy = _mm_set1_epi32(dcdy); + + /* Get values across the quad + */ + __m128i cstep1 = _mm_add_epi32(cstep0, xdcdy); + __m128i cstep2 = _mm_add_epi32(cstep1, xdcdy); + __m128i cstep3 = _mm_add_epi32(cstep2, xdcdy); + + { + __m128i cstep01, cstep23, result; + + cstep01 = _mm_packs_epi32(cstep0, cstep1); + cstep23 = _mm_packs_epi32(cstep2, cstep3); + result = _mm_packs_epi16(cstep01, cstep23); + + *outmask |= _mm_movemask_epi8(result); + } + + + { + __m128i cio4 = _mm_set1_epi32(cdiff); + __m128i cstep01, cstep23, result; + + cstep0 = _mm_add_epi32(cstep0, cio4); + cstep1 = _mm_add_epi32(cstep1, cio4); + cstep2 = _mm_add_epi32(cstep2, cio4); + cstep3 = _mm_add_epi32(cstep3, cio4); + + cstep01 = _mm_packs_epi32(cstep0, cstep1); + cstep23 = _mm_packs_epi32(cstep2, cstep3); + result = _mm_packs_epi16(cstep01, cstep23); + + *partmask |= _mm_movemask_epi8(result); + } +} + + static INLINE unsigned build_mask_linear(int c, int dcdx, int dcdy) { @@ -263,11 +323,14 @@ lp_rast_triangle_3_16(struct lp_rasterizer_task *task, { const int dcdx = -plane[j].dcdx * 4; const int dcdy = plane[j].dcdy * 4; - const int cox = c[j] + plane[j].eo * 4; - const int cio = c[j] + plane[j].ei * 4 - 1; - - outmask |= build_mask_linear(cox, dcdx, dcdy); - partmask |= build_mask_linear(cio, dcdx, dcdy); + const int cox = plane[j].eo * 4; + const int cio = plane[j].ei * 4 - 1; + + build_masks(c[j] + cox, + cio - cox, + dcdx, dcdy, + &outmask, /* sign bits from c[i][0..15] + cox */ + &partmask); /* sign bits from c[i][0..15] + cio */ } } diff --git a/src/gallium/drivers/llvmpipe/lp_rast_tri_tmp.h b/src/gallium/drivers/llvmpipe/lp_rast_tri_tmp.h index 0def5f7243..99a0bae45d 100644 --- a/src/gallium/drivers/llvmpipe/lp_rast_tri_tmp.h +++ b/src/gallium/drivers/llvmpipe/lp_rast_tri_tmp.h @@ -81,11 +81,14 @@ TAG(do_block_16)(struct lp_rasterizer_task *task, for (j = 0; j < NR_PLANES; j++) { const int dcdx = -plane[j].dcdx * 4; const int dcdy = plane[j].dcdy * 4; - const int cox = c[j] + plane[j].eo * 4; - const int cio = c[j] + plane[j].ei * 4 - 1; - - outmask |= build_mask_linear(cox, dcdx, dcdy); - partmask |= build_mask_linear(cio, dcdx, dcdy); + const int cox = plane[j].eo * 4; + const int cio = plane[j].ei * 4 - 1; + + build_masks(c[j] + cox, + cio - cox, + dcdx, dcdy, + &outmask, /* sign bits from c[i][0..15] + cox */ + &partmask); /* sign bits from c[i][0..15] + cio */ } if (outmask == 0xffff) @@ -171,11 +174,14 @@ TAG(lp_rast_triangle)(struct lp_rasterizer_task *task, { const int dcdx = -plane[j].dcdx * 16; const int dcdy = plane[j].dcdy * 16; - const int cox = c[j] + plane[j].eo * 16; - const int cio = c[j] + plane[j].ei * 16 - 1; - - outmask |= build_mask_linear(cox, dcdx, dcdy); - partmask |= build_mask_linear(cio, dcdx, dcdy); + const int cox = plane[j].eo * 16; + const int cio = plane[j].ei * 16 - 1; + + build_masks(c[j] + cox, + cio - cox, + dcdx, dcdy, + &outmask, /* sign bits from c[i][0..15] + cox */ + &partmask); /* sign bits from c[i][0..15] + cio */ } j++; -- cgit v1.2.3 From e38d2f716381385e2aad219a3d125065ec0a01bd Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Tue, 24 Aug 2010 23:05:57 +0100 Subject: llvmpipe: slightly simplify build_mask --- src/gallium/drivers/llvmpipe/lp_rast_tri.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/llvmpipe/lp_rast_tri.c b/src/gallium/drivers/llvmpipe/lp_rast_tri.c index bdb8d131cc..dbaa8e023a 100644 --- a/src/gallium/drivers/llvmpipe/lp_rast_tri.c +++ b/src/gallium/drivers/llvmpipe/lp_rast_tri.c @@ -229,13 +229,9 @@ build_mask(int c, int dcdx, int dcdy) */ __m128i cstep0 = _mm_add_epi32(c0, step); - /* Scale up step for moving between quads. This should probably - * be an arithmetic shift left, but there doesn't seem to be - * such a thing in SSE. It's unlikely that the step value is - * going to be large enough to overflow across 4 pixels, though - * if it is that big, rendering will be incorrect anyway. + /* Scale up step for moving between quads. */ - __m128i step4 = _mm_slli_epi32(step, 1); + __m128i step4 = _mm_add_epi32(step, step); /* Get values for the remaining quads: */ -- cgit v1.2.3 From 9b075cb9fa9eb6a95d0816283ef01ae72dafa680 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 31 Aug 2010 13:02:59 -0700 Subject: ir_to_mesa: When emitting a pixel kill, flag that we did so. Both i965 and swrast rely on UsesKill to determine whether to do early depth writes. Fixes glsl-fs-discard-02. Bug #29835. --- src/mesa/program/ir_to_mesa.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src') diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp index 8f39a225af..57458d0281 100644 --- a/src/mesa/program/ir_to_mesa.cpp +++ b/src/mesa/program/ir_to_mesa.cpp @@ -2041,9 +2041,12 @@ ir_to_mesa_visitor::visit(ir_return *ir) void ir_to_mesa_visitor::visit(ir_discard *ir) { + struct gl_fragment_program *fp = (struct gl_fragment_program *)this->prog; + assert(ir->condition == NULL); /* FINISHME */ ir_to_mesa_emit_op0(ir, OPCODE_KIL_NV); + fp->UsesKill = GL_TRUE; } void -- cgit v1.2.3 From 16c733495d74d8c2443aa915a55df97c02b415c7 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 31 Aug 2010 19:13:09 -0600 Subject: glsl2: fix bug in atan(y, x) function When x==0, the result was wrong. Fixes piglit glsl-fs-atan-1.shader_test --- src/glsl/builtin_function.cpp | 12 ++++++------ src/glsl/builtins/ir/atan | 10 +++------- 2 files changed, 9 insertions(+), 13 deletions(-) (limited to 'src') diff --git a/src/glsl/builtin_function.cpp b/src/glsl/builtin_function.cpp index d3484cbcd3..e6feb55759 100644 --- a/src/glsl/builtin_function.cpp +++ b/src/glsl/builtin_function.cpp @@ -324,6 +324,8 @@ static const char *builtin_atan = ") \n" " (assign (constant bool (1)) (var_ref r) (var_ref atan_retval) ) \n" " (if (expression bool < (var_ref x) (constant float (0.000000)) ) (\n" + "\n" + "\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" @@ -341,12 +343,10 @@ static const char *builtin_atan = "\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" + " (declare () float sgn)\n" + " (assign (constant bool (1)) (var_ref sgn) (expression float sign (var_ref y)))\n" + " (assign (constant bool (1)) (var_ref r) (expression float * (var_ref sgn) (constant float (1.5707965))))\n" "\n" " ))\n" "\n" diff --git a/src/glsl/builtins/ir/atan b/src/glsl/builtins/ir/atan index 8404829387..04e1898f9f 100644 --- a/src/glsl/builtins/ir/atan +++ b/src/glsl/builtins/ir/atan @@ -80,13 +80,9 @@ ) ( - (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)) ) - )) - + (declare () float sgn) + (assign (constant bool (1)) (var_ref sgn) (expression float sign (var_ref y))) + (assign (constant bool (1)) (var_ref r) (expression float * (var_ref sgn) (constant float (1.5707965)))) )) (return (var_ref r) ) -- cgit v1.2.3 From 3fa3c33844b8491a204cda6ae8d67cd6ada78b3b Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 31 Aug 2010 19:14:18 -0600 Subject: gallivm: fix bug in nested conditionals This, plus the previous commit fix fd.o bug 29806. --- src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c index ca8db9ce01..0e07f7f3f3 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c @@ -200,8 +200,10 @@ static void lp_exec_mask_cond_push(struct lp_exec_mask *mask, } mask->cond_stack[mask->cond_stack_size++] = mask->cond_mask; assert(LLVMTypeOf(val) == mask->int_vec_type); - mask->cond_mask = val; - + mask->cond_mask = LLVMBuildAnd(mask->bld->builder, + mask->cond_mask, + val, + ""); lp_exec_mask_update(mask); } -- cgit v1.2.3 From bea5f559a6f52e8fb7c32ee8e9f9c5f04c05b582 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Wed, 1 Sep 2010 11:37:39 +1000 Subject: r600g: fix glean texCube and shadows. add cube and shadow support to the texture code. --- src/gallium/drivers/r600/r600_shader.c | 154 +++++++++++++++++++++++++++++++-- 1 file changed, 149 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/r600_shader.c b/src/gallium/drivers/r600/r600_shader.c index bc1811129b..a26290062a 100644 --- a/src/gallium/drivers/r600/r600_shader.c +++ b/src/gallium/drivers/r600/r600_shader.c @@ -1470,6 +1470,9 @@ static int tgsi_tex(struct r600_shader_ctx *ctx) struct r600_bc_alu alu; unsigned src_gpr; int r, i; + int opcode; + boolean src_not_temp = inst->Src[0].Register.File != TGSI_FILE_TEMPORARY; + uint32_t lit_vals[4]; src_gpr = ctx->file_offset[inst->Src[0].Register.File] + inst->Src[0].Register.Index; @@ -1477,7 +1480,10 @@ static int tgsi_tex(struct r600_shader_ctx *ctx) /* Add perspective divide */ memset(&alu, 0, sizeof(struct r600_bc_alu)); alu.inst = V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RECIP_IEEE; - alu.src[0].sel = src_gpr; + r = tgsi_src(ctx, &inst->Src[0], &alu.src[0]); + if (r) + return r; + alu.src[0].chan = tgsi_chan(&inst->Src[0], 3); alu.dst.sel = ctx->temp_reg; alu.dst.chan = 3; @@ -1492,7 +1498,9 @@ static int tgsi_tex(struct r600_shader_ctx *ctx) alu.inst = V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MUL; alu.src[0].sel = ctx->temp_reg; alu.src[0].chan = 3; - alu.src[1].sel = src_gpr; + r = tgsi_src(ctx, &inst->Src[0], &alu.src[1]); + if (r) + return r; alu.src[1].chan = tgsi_chan(&inst->Src[0], i); alu.dst.sel = ctx->temp_reg; alu.dst.chan = i; @@ -1512,8 +1520,122 @@ static int tgsi_tex(struct r600_shader_ctx *ctx) r = r600_bc_add_alu(ctx->bc, &alu); if (r) return r; + src_not_temp = false; src_gpr = ctx->temp_reg; - } else if (inst->Src[0].Register.File != TGSI_FILE_TEMPORARY) { + } + + if (inst->Texture.Texture == TGSI_TEXTURE_CUBE) { + int src_chan, src2_chan; + + /* tmp1.xyzw = CUBE(R0.zzxy, R0.yxzz) */ + for (i = 0; i < 4; i++) { + memset(&alu, 0, sizeof(struct r600_bc_alu)); + alu.inst = V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_CUBE; + switch (i) { + case 0: + src_chan = 2; + src2_chan = 1; + break; + case 1: + src_chan = 2; + src2_chan = 0; + break; + case 2: + src_chan = 0; + src2_chan = 2; + break; + case 3: + src_chan = 1; + src2_chan = 2; + break; + } + r = tgsi_src(ctx, &inst->Src[0], &alu.src[0]); + if (r) + return r; + alu.src[0].chan = tgsi_chan(&inst->Src[0], src_chan); + r = tgsi_src(ctx, &inst->Src[0], &alu.src[1]); + if (r) + return r; + alu.src[1].chan = tgsi_chan(&inst->Src[0], src2_chan); + alu.dst.sel = ctx->temp_reg; + alu.dst.chan = i; + if (i == 3) + alu.last = 1; + alu.dst.write = 1; + r = r600_bc_add_alu(ctx->bc, &alu); + if (r) + return r; + } + + /* tmp1.z = RCP_e(|tmp1.z|) */ + memset(&alu, 0, sizeof(struct r600_bc_alu)); + alu.inst = V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RECIP_IEEE; + alu.src[0].sel = ctx->temp_reg; + alu.src[0].chan = 2; + alu.src[0].abs = 1; + alu.dst.sel = ctx->temp_reg; + alu.dst.chan = 2; + alu.dst.write = 1; + alu.last = 1; + r = r600_bc_add_alu(ctx->bc, &alu); + if (r) + return r; + + /* MULADD R0.x, R0.x, PS1, (0x3FC00000, 1.5f).x + * MULADD R0.y, R0.y, PS1, (0x3FC00000, 1.5f).x + * muladd has no writemask, have to use another temp + */ + memset(&alu, 0, sizeof(struct r600_bc_alu)); + alu.inst = V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_MULADD; + alu.is_op3 = 1; + + alu.src[0].sel = ctx->temp_reg; + alu.src[0].chan = 0; + alu.src[1].sel = ctx->temp_reg; + alu.src[1].chan = 2; + + alu.src[2].sel = V_SQ_ALU_SRC_LITERAL; + alu.src[2].chan = 0; + + alu.dst.sel = ctx->temp_reg; + alu.dst.chan = 0; + alu.dst.write = 1; + + r = r600_bc_add_alu(ctx->bc, &alu); + if (r) + return r; + + memset(&alu, 0, sizeof(struct r600_bc_alu)); + alu.inst = V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_MULADD; + alu.is_op3 = 1; + + alu.src[0].sel = ctx->temp_reg; + alu.src[0].chan = 1; + alu.src[1].sel = ctx->temp_reg; + alu.src[1].chan = 2; + + alu.src[2].sel = V_SQ_ALU_SRC_LITERAL; + alu.src[2].chan = 0; + + alu.dst.sel = ctx->temp_reg; + alu.dst.chan = 1; + alu.dst.write = 1; + + alu.last = 1; + r = r600_bc_add_alu(ctx->bc, &alu); + if (r) + return r; + + lit_vals[0] = fui(1.5f); + + r = r600_bc_add_literal(ctx->bc, lit_vals); + if (r) + return r; + src_not_temp = false; + src_gpr = ctx->temp_reg; + } + + if (src_not_temp) { for (i = 0; i < 4; i++) { memset(&alu, 0, sizeof(struct r600_bc_alu)); alu.inst = V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV; @@ -1530,9 +1652,14 @@ static int tgsi_tex(struct r600_shader_ctx *ctx) } src_gpr = ctx->temp_reg; } + + opcode = ctx->inst_info->r600_opcode; + if (opcode == SQ_TEX_INST_SAMPLE && + (inst->Texture.Texture == TGSI_TEXTURE_SHADOW1D || inst->Texture.Texture == TGSI_TEXTURE_SHADOW2D)) + opcode = SQ_TEX_INST_SAMPLE_C; memset(&tex, 0, sizeof(struct r600_bc_tex)); - tex.inst = ctx->inst_info->r600_opcode; + tex.inst = opcode; tex.resource_id = ctx->file_offset[inst->Src[1].Register.File] + inst->Src[1].Register.Index; tex.sampler_id = tex.resource_id; tex.src_gpr = src_gpr; @@ -1546,13 +1673,30 @@ static int tgsi_tex(struct r600_shader_ctx *ctx) tex.src_sel_z = 2; tex.src_sel_w = 3; + if (inst->Texture.Texture == TGSI_TEXTURE_CUBE) { + tex.src_sel_x = 1; + tex.src_sel_y = 0; + tex.src_sel_z = 3; + tex.src_sel_w = 1; + } + if (inst->Texture.Texture != TGSI_TEXTURE_RECT) { tex.coord_type_x = 1; tex.coord_type_y = 1; tex.coord_type_z = 1; tex.coord_type_w = 1; } - return r600_bc_add_tex(ctx->bc, &tex); + + if (inst->Texture.Texture == TGSI_TEXTURE_SHADOW1D || inst->Texture.Texture == TGSI_TEXTURE_SHADOW2D) + tex.coord_type_w = 2; + + r = r600_bc_add_tex(ctx->bc, &tex); + if (r) + return r; + + /* add shadow ambient support - gallium doesn't do it yet */ + return 0; + } static int tgsi_lrp(struct r600_shader_ctx *ctx) -- cgit v1.2.3 From d7e2509692d3aa8afb8d2236a4f28b6ab502ec62 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Wed, 1 Sep 2010 13:54:38 +1000 Subject: r600g: fix typo causing segfault. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fixes warning that r600_blit.c: In function ‘r600_resource_copy_region’: r600_blit.c:136: warning: passing argument 1 of ‘util_resource_copy_region’ from incompatible pointer type and also 7 more piglit tests. --- src/gallium/drivers/r600/r600_blit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/r600_blit.c b/src/gallium/drivers/r600/r600_blit.c index dbcd6cdea8..a8263ccbce 100644 --- a/src/gallium/drivers/r600/r600_blit.c +++ b/src/gallium/drivers/r600/r600_blit.c @@ -132,7 +132,7 @@ static void r600_resource_copy_region(struct pipe_context *ctx, unsigned srcx, unsigned srcy, unsigned srcz, unsigned width, unsigned height) { - util_resource_copy_region(pipe, dst, subdst, dstx, dsty, dstz, + util_resource_copy_region(ctx, dst, subdst, dstx, dsty, dstz, src, subsrc, srcx, srcy, srcz, width, height); } -- cgit v1.2.3 From 1fa7245c348cb7aced81f1672140f64cb6450e2f Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Wed, 1 Sep 2010 14:56:04 +1000 Subject: Revert "r600g: precompute some of the hw state" This reverts commit de0b76cab22caa9fc7260f80acb8f151ccced6c5, its pre-computes the texture state wrong, you can't just use an array of levels, since you can have FBOs to depth texture slices inside a level as well it would get really messy quickly. Probably need to split commits like this up into pieces for each piece of state, so we can revert bits easier in case of regressions. This also break 5 piglit tests, and valgrind starts to warn about invalid read/writes after this. --- src/gallium/drivers/r600/r600_blit.c | 4 +- src/gallium/drivers/r600/r600_context.h | 2 +- src/gallium/drivers/r600/r600_resource.h | 2 +- src/gallium/drivers/r600/r600_screen.h | 2 +- src/gallium/drivers/r600/r600_state.c | 226 +++++++++++++++++++---------- src/gallium/drivers/r600/r600_texture.c | 43 ++---- src/gallium/drivers/r600/radeon.h | 47 ++---- src/gallium/winsys/r600/drm/r600_state.c | 9 +- src/gallium/winsys/r600/drm/r600_states.h | 28 +--- src/gallium/winsys/r600/drm/radeon_priv.h | 20 +-- src/gallium/winsys/r600/drm/radeon_state.c | 62 ++------ 11 files changed, 216 insertions(+), 229 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/r600_blit.c b/src/gallium/drivers/r600/r600_blit.c index a8263ccbce..1d197e92b2 100644 --- a/src/gallium/drivers/r600/r600_blit.c +++ b/src/gallium/drivers/r600/r600_blit.c @@ -670,7 +670,7 @@ int r600_blit_uncompress_depth(struct pipe_context *ctx, struct r600_resource_te if (r) { return r; } - r = r600_texture_cb(ctx, rtexture, 0, level); + r = r600_texture_cb0(ctx, rtexture, level); if (r) { return r; } @@ -772,7 +772,7 @@ int r600_blit_uncompress_depth(struct pipe_context *ctx, struct r600_resource_te if (r) { goto out; } - r = radeon_draw_set(draw, rtexture->cb[0][level]); + r = radeon_draw_set(draw, rtexture->cb0[level]); if (r) { goto out; } diff --git a/src/gallium/drivers/r600/r600_context.h b/src/gallium/drivers/r600/r600_context.h index e9495f0017..d96d5b513f 100644 --- a/src/gallium/drivers/r600/r600_context.h +++ b/src/gallium/drivers/r600/r600_context.h @@ -121,7 +121,7 @@ struct r600_context_hw_states { struct radeon_state *config; struct radeon_state *cb_cntl; struct radeon_state *db; - struct radeon_state *ucp; + struct radeon_state *ucp[6]; unsigned ps_nresource; unsigned ps_nsampler; struct radeon_state *ps_resource[160]; diff --git a/src/gallium/drivers/r600/r600_resource.h b/src/gallium/drivers/r600/r600_resource.h index 8078a83c35..b880f9369c 100644 --- a/src/gallium/drivers/r600/r600_resource.h +++ b/src/gallium/drivers/r600/r600_resource.h @@ -57,7 +57,7 @@ struct r600_resource_texture { unsigned dirty; struct radeon_bo *uncompressed; struct radeon_state *scissor[PIPE_MAX_TEXTURE_LEVELS]; - struct radeon_state *cb[8][PIPE_MAX_TEXTURE_LEVELS]; + struct radeon_state *cb0[PIPE_MAX_TEXTURE_LEVELS]; struct radeon_state *db[PIPE_MAX_TEXTURE_LEVELS]; struct radeon_state *viewport[PIPE_MAX_TEXTURE_LEVELS]; }; diff --git a/src/gallium/drivers/r600/r600_screen.h b/src/gallium/drivers/r600/r600_screen.h index b9938f117a..438976f654 100644 --- a/src/gallium/drivers/r600/r600_screen.h +++ b/src/gallium/drivers/r600/r600_screen.h @@ -84,7 +84,7 @@ void* r600_texture_transfer_map(struct pipe_context *ctx, void r600_texture_transfer_unmap(struct pipe_context *ctx, struct pipe_transfer* transfer); int r600_texture_scissor(struct pipe_context *ctx, struct r600_resource_texture *rtexture, unsigned level); -int r600_texture_cb(struct pipe_context *ctx, struct r600_resource_texture *rtexture, unsigned cb, unsigned level); +int r600_texture_cb0(struct pipe_context *ctx, struct r600_resource_texture *rtexture, unsigned level); int r600_texture_db(struct pipe_context *ctx, struct r600_resource_texture *rtexture, unsigned level); int r600_texture_from_depth(struct pipe_context *ctx, struct r600_resource_texture *rtexture, unsigned level); int r600_texture_viewport(struct pipe_context *ctx, struct r600_resource_texture *rtexture, unsigned level); diff --git a/src/gallium/drivers/r600/r600_state.c b/src/gallium/drivers/r600/r600_state.c index 6049e1328e..b5db848e35 100644 --- a/src/gallium/drivers/r600/r600_state.c +++ b/src/gallium/drivers/r600/r600_state.c @@ -34,16 +34,6 @@ #include "r600d.h" #include "r600_state_inlines.h" -static struct radeon_state *r600_blend(struct r600_context *rctx, const struct pipe_blend_state *state); -static struct radeon_state *r600_viewport(struct r600_context *rctx, const struct pipe_viewport_state *state); -static struct radeon_state *r600_ucp(struct r600_context *rctx, const struct pipe_clip_state *state); -static struct radeon_state *r600_sampler(struct r600_context *rctx, - const struct pipe_sampler_state *state, - unsigned id); -static struct radeon_state *r600_resource(struct pipe_context *ctx, - const struct pipe_sampler_view *view, - unsigned id); - static void *r600_create_blend_state(struct pipe_context *ctx, const struct pipe_blend_state *state) { @@ -96,7 +86,6 @@ static struct pipe_sampler_view *r600_create_sampler_view(struct pipe_context *c rstate->state.sampler_view.texture = texture; rstate->state.sampler_view.reference.count = 1; rstate->state.sampler_view.context = ctx; - rstate->rstate = r600_resource(ctx, &rstate->state.sampler_view, 0); return &rstate->state.sampler_view; } @@ -240,9 +229,6 @@ static void r600_bind_ps_sampler(struct pipe_context *ctx, for (i = 0; i < count; i++) { rstate = (struct r600_context_state *)states[i]; rctx->ps_sampler[i] = r600_context_state_incref(rstate); - if (rstate) { - radeon_state_convert(rstate->rstate, R600_STATE_SAMPLER, i, R600_SHADER_PS); - } } rctx->ps_nsampler = count; } @@ -260,9 +246,6 @@ static void r600_bind_vs_sampler(struct pipe_context *ctx, for (i = 0; i < count; i++) { rstate = (struct r600_context_state *)states[i]; rctx->vs_sampler[i] = r600_context_state_incref(rstate); - if (rstate) { - radeon_state_convert(rstate->rstate, R600_STATE_SAMPLER, i, R600_SHADER_VS); - } } rctx->vs_nsampler = count; } @@ -354,9 +337,6 @@ static void r600_set_ps_sampler_view(struct pipe_context *ctx, for (i = 0; i < count; i++) { rstate = (struct r600_context_state *)views[i]; rctx->ps_sampler_view[i] = r600_context_state_incref(rstate); - if (rstate) { - radeon_state_convert(rstate->rstate, R600_STATE_RESOURCE, i, R600_SHADER_PS); - } } rctx->ps_nsampler_view = count; } @@ -375,9 +355,6 @@ static void r600_set_vs_sampler_view(struct pipe_context *ctx, for (i = 0; i < count; i++) { rstate = (struct r600_context_state *)views[i]; rctx->vs_sampler_view[i] = r600_context_state_incref(rstate); - if (rstate) { - radeon_state_convert(rstate->rstate, R600_STATE_RESOURCE, i, R600_SHADER_VS); - } } rctx->vs_nsampler_view = count; } @@ -386,19 +363,10 @@ static void r600_set_framebuffer_state(struct pipe_context *ctx, const struct pipe_framebuffer_state *state) { struct r600_context *rctx = r600_context(ctx); - struct r600_resource_texture *rtexture; struct r600_context_state *rstate; rstate = r600_context_state(rctx, pipe_framebuffer_type, state); r600_bind_state(ctx, rstate); - for (int i = 0; i < state->nr_cbufs; i++) { - rtexture = (struct r600_resource_texture*)state->cbufs[i]->texture; - r600_texture_cb(ctx, rtexture, i, state->cbufs[i]->level); - } - if (state->zsbuf) { - rtexture = (struct r600_resource_texture*)state->zsbuf->texture; - r600_texture_db(ctx, rtexture, state->zsbuf->level); - } } static void r600_set_polygon_stipple(struct pipe_context *ctx, @@ -597,7 +565,6 @@ struct r600_context_state *r600_context_state(struct r600_context *rctx, unsigne break; case pipe_viewport_type: rstate->state.viewport = (*states).viewport; - rstate->rstate = r600_viewport(rctx, &rstate->state.viewport); break; case pipe_depth_type: rstate->state.depth = (*states).depth; @@ -613,7 +580,6 @@ struct r600_context_state *r600_context_state(struct r600_context *rctx, unsigne break; case pipe_clip_type: rstate->state.clip = (*states).clip; - rstate->rstate = r600_ucp(rctx, &rstate->state.clip); break; case pipe_stencil_type: rstate->state.stencil = (*states).stencil; @@ -626,7 +592,6 @@ struct r600_context_state *r600_context_state(struct r600_context *rctx, unsigne break; case pipe_blend_type: rstate->state.blend = (*states).blend; - rstate->rstate = r600_blend(rctx, &rstate->state.blend); break; case pipe_stencil_ref_type: rstate->state.stencil_ref = (*states).stencil_ref; @@ -641,7 +606,6 @@ struct r600_context_state *r600_context_state(struct r600_context *rctx, unsigne break; case pipe_sampler_type: rstate->state.sampler = (*states).sampler; - rstate->rstate = r600_sampler(rctx, &rstate->state.sampler, 0); break; default: R600_ERR("invalid type %d\n", rstate->type); @@ -651,10 +615,11 @@ struct r600_context_state *r600_context_state(struct r600_context *rctx, unsigne return rstate; } -static struct radeon_state *r600_blend(struct r600_context *rctx, const struct pipe_blend_state *state) +static struct radeon_state *r600_blend(struct r600_context *rctx) { struct r600_screen *rscreen = rctx->screen; struct radeon_state *rstate; + const struct pipe_blend_state *state = &rctx->blend->state.blend; int i; rstate = radeon_state(rscreen->rw, R600_STATE_BLEND, 0); @@ -710,28 +675,129 @@ static struct radeon_state *r600_blend(struct r600_context *rctx, const struct p return rstate; } -static struct radeon_state *r600_ucp(struct r600_context *rctx, const struct pipe_clip_state *state) +static struct radeon_state *r600_ucp(struct r600_context *rctx, int clip) { struct r600_screen *rscreen = rctx->screen; struct radeon_state *rstate; + const struct pipe_clip_state *state = &rctx->clip->state.clip; - rstate = radeon_state(rscreen->rw, R600_STATE_UCP, 0); + rstate = radeon_state(rscreen->rw, R600_STATE_CLIP, clip); if (rstate == NULL) return NULL; - for (int i = 0; i < state->nr; i++) { - rstate->states[i * 4 + 0] = fui(state->ucp[i][0]); - rstate->states[i * 4 + 1] = fui(state->ucp[i][1]); - rstate->states[i * 4 + 2] = fui(state->ucp[i][2]); - rstate->states[i * 4 + 3] = fui(state->ucp[i][3]); + rstate->states[R600_CLIP__PA_CL_UCP_X_0] = fui(state->ucp[clip][0]); + rstate->states[R600_CLIP__PA_CL_UCP_Y_0] = fui(state->ucp[clip][1]); + rstate->states[R600_CLIP__PA_CL_UCP_Z_0] = fui(state->ucp[clip][2]); + rstate->states[R600_CLIP__PA_CL_UCP_W_0] = fui(state->ucp[clip][3]); + + if (radeon_state_pm4(rstate)) { + radeon_state_decref(rstate); + return NULL; } + return rstate; +} + +static struct radeon_state *r600_cb(struct r600_context *rctx, int cb) +{ + struct r600_screen *rscreen = rctx->screen; + struct r600_resource_texture *rtex; + struct r600_resource *rbuffer; + struct radeon_state *rstate; + const struct pipe_framebuffer_state *state = &rctx->framebuffer->state.framebuffer; + unsigned level = state->cbufs[cb]->level; + unsigned pitch, slice; + unsigned color_info; + unsigned format, swap, ntype; + const struct util_format_description *desc; + + rstate = radeon_state(rscreen->rw, R600_STATE_CB0 + cb, 0); + if (rstate == NULL) + return NULL; + rtex = (struct r600_resource_texture*)state->cbufs[cb]->texture; + rbuffer = &rtex->resource; + rstate->bo[0] = radeon_bo_incref(rscreen->rw, rbuffer->bo); + rstate->bo[1] = radeon_bo_incref(rscreen->rw, rbuffer->bo); + rstate->bo[2] = radeon_bo_incref(rscreen->rw, rbuffer->bo); + rstate->placement[0] = RADEON_GEM_DOMAIN_GTT; + rstate->placement[2] = RADEON_GEM_DOMAIN_GTT; + rstate->placement[4] = RADEON_GEM_DOMAIN_GTT; + rstate->nbo = 3; + pitch = (rtex->pitch[level] / rtex->bpt) / 8 - 1; + slice = (rtex->pitch[level] / rtex->bpt) * state->cbufs[cb]->height / 64 - 1; + + ntype = 0; + desc = util_format_description(rtex->resource.base.b.format); + if (desc->colorspace == UTIL_FORMAT_COLORSPACE_SRGB) + ntype = V_0280A0_NUMBER_SRGB; + + format = r600_translate_colorformat(rtex->resource.base.b.format); + swap = r600_translate_colorswap(rtex->resource.base.b.format); + + color_info = S_0280A0_FORMAT(format) | + S_0280A0_COMP_SWAP(swap) | + S_0280A0_BLEND_CLAMP(1) | + S_0280A0_SOURCE_FORMAT(1) | + S_0280A0_NUMBER_TYPE(ntype); + + rstate->states[R600_CB0__CB_COLOR0_BASE] = rtex->offset[level] >> 8; + rstate->states[R600_CB0__CB_COLOR0_INFO] = color_info; + rstate->states[R600_CB0__CB_COLOR0_SIZE] = S_028060_PITCH_TILE_MAX(pitch) | + S_028060_SLICE_TILE_MAX(slice); + rstate->states[R600_CB0__CB_COLOR0_VIEW] = 0x00000000; + rstate->states[R600_CB0__CB_COLOR0_FRAG] = 0x00000000; + rstate->states[R600_CB0__CB_COLOR0_TILE] = 0x00000000; + rstate->states[R600_CB0__CB_COLOR0_MASK] = 0x00000000; if (radeon_state_pm4(rstate)) { radeon_state_decref(rstate); return NULL; } return rstate; +} +static struct radeon_state *r600_db(struct r600_context *rctx) +{ + struct r600_screen *rscreen = rctx->screen; + struct r600_resource_texture *rtex; + struct r600_resource *rbuffer; + struct radeon_state *rstate; + const struct pipe_framebuffer_state *state = &rctx->framebuffer->state.framebuffer; + unsigned level; + unsigned pitch, slice, format; + + if (state->zsbuf == NULL) + return NULL; + + rstate = radeon_state(rscreen->rw, R600_STATE_DB, 0); + if (rstate == NULL) + return NULL; + + rtex = (struct r600_resource_texture*)state->zsbuf->texture; + rtex->tilled = 1; + rtex->array_mode = 2; + rtex->tile_type = 1; + rtex->depth = 1; + rbuffer = &rtex->resource; + + rstate->bo[0] = radeon_bo_incref(rscreen->rw, rbuffer->bo); + rstate->nbo = 1; + rstate->placement[0] = RADEON_GEM_DOMAIN_VRAM; + level = state->zsbuf->level; + pitch = (rtex->pitch[level] / rtex->bpt) / 8 - 1; + slice = (rtex->pitch[level] / rtex->bpt) * state->zsbuf->height / 64 - 1; + format = r600_translate_dbformat(state->zsbuf->texture->format); + rstate->states[R600_DB__DB_DEPTH_BASE] = rtex->offset[level] >> 8; + rstate->states[R600_DB__DB_DEPTH_INFO] = S_028010_ARRAY_MODE(rtex->array_mode) | + S_028010_FORMAT(format); + rstate->states[R600_DB__DB_DEPTH_VIEW] = 0x00000000; + rstate->states[R600_DB__DB_PREFETCH_LIMIT] = (state->zsbuf->height / 8) -1; + rstate->states[R600_DB__DB_DEPTH_SIZE] = S_028000_PITCH_TILE_MAX(pitch) | + S_028000_SLICE_TILE_MAX(slice); + if (radeon_state_pm4(rstate)) { + radeon_state_decref(rstate); + return NULL; + } + return rstate; } static struct radeon_state *r600_rasterizer(struct r600_context *rctx) @@ -888,8 +954,9 @@ static struct radeon_state *r600_scissor(struct r600_context *rctx) return rstate; } -static struct radeon_state *r600_viewport(struct r600_context *rctx, const struct pipe_viewport_state *state) +static struct radeon_state *r600_viewport(struct r600_context *rctx) { + const struct pipe_viewport_state *state = &rctx->viewport->state.viewport; struct r600_screen *rscreen = rctx->screen; struct radeon_state *rstate; @@ -1299,7 +1366,6 @@ static struct radeon_state *r600_cb_cntl(struct r600_context *rctx) int r600_context_hw_states(struct pipe_context *ctx) { struct r600_context *rctx = r600_context(ctx); - struct r600_resource_texture *rtexture; unsigned i; int r; int nr_cbufs = rctx->framebuffer->state.framebuffer.nr_cbufs; @@ -1311,59 +1377,69 @@ int r600_context_hw_states(struct pipe_context *ctx) /* free previous TODO determine what need to be updated, what * doesn't */ + //radeon_state_decref(rctx->hw_states.config); rctx->hw_states.cb_cntl = radeon_state_decref(rctx->hw_states.cb_cntl); + rctx->hw_states.db = radeon_state_decref(rctx->hw_states.db); rctx->hw_states.rasterizer = radeon_state_decref(rctx->hw_states.rasterizer); rctx->hw_states.scissor = radeon_state_decref(rctx->hw_states.scissor); rctx->hw_states.dsa = radeon_state_decref(rctx->hw_states.dsa); + rctx->hw_states.blend = radeon_state_decref(rctx->hw_states.blend); + rctx->hw_states.viewport = radeon_state_decref(rctx->hw_states.viewport); + for (i = 0; i < 8; i++) { + rctx->hw_states.cb[i] = radeon_state_decref(rctx->hw_states.cb[i]); + } + for (i = 0; i < 6; i++) { + rctx->hw_states.ucp[i] = radeon_state_decref(rctx->hw_states.ucp[i]); + } + for (i = 0; i < rctx->hw_states.ps_nresource; i++) { + radeon_state_decref(rctx->hw_states.ps_resource[i]); + rctx->hw_states.ps_resource[i] = NULL; + } + rctx->hw_states.ps_nresource = 0; + for (i = 0; i < rctx->hw_states.ps_nsampler; i++) { + radeon_state_decref(rctx->hw_states.ps_sampler[i]); + rctx->hw_states.ps_sampler[i] = NULL; + } + rctx->hw_states.ps_nsampler = 0; /* build new states */ - rctx->hw_states.blend = NULL; - rctx->hw_states.viewport = NULL; - rctx->hw_states.ucp = NULL; rctx->hw_states.rasterizer = r600_rasterizer(rctx); rctx->hw_states.scissor = r600_scissor(rctx); rctx->hw_states.dsa = r600_dsa(rctx); - rctx->hw_states.cb_cntl = r600_cb_cntl(rctx); - if (rctx->viewport) { - rctx->hw_states.viewport = rctx->viewport->rstate; - } - if (rctx->blend) { - rctx->hw_states.blend = rctx->blend->rstate; - } - if (rctx->clip) { - rctx->hw_states.ucp = rctx->clip->rstate; - } - for (i = 0; i < rctx->framebuffer->state.framebuffer.nr_cbufs; i++) { - rtexture = (struct r600_resource_texture*)rctx->framebuffer->state.framebuffer.cbufs[i]->texture; - rctx->hw_states.cb[i] = rtexture->cb[i][rctx->framebuffer->state.framebuffer.cbufs[i]->level]; + rctx->hw_states.blend = r600_blend(rctx); + rctx->hw_states.viewport = r600_viewport(rctx); + for (i = 0; i < nr_cbufs; i++) { + rctx->hw_states.cb[i] = r600_cb(rctx, i); } - if (rctx->framebuffer->state.framebuffer.zsbuf) { - rtexture = (struct r600_resource_texture*)rctx->framebuffer->state.framebuffer.zsbuf->texture; - rctx->hw_states.db = rtexture->db[rctx->framebuffer->state.framebuffer.zsbuf->level]; + for (i = 0; i < ucp_nclip; i++) { + rctx->hw_states.ucp[i] = r600_ucp(rctx, i); } - + rctx->hw_states.db = r600_db(rctx); + rctx->hw_states.cb_cntl = r600_cb_cntl(rctx); for (i = 0; i < rctx->ps_nsampler; i++) { if (rctx->ps_sampler[i]) { - rctx->hw_states.ps_sampler[i] = rctx->ps_sampler[i]->rstate; - } else { - rctx->hw_states.ps_sampler[i] = NULL; + rctx->hw_states.ps_sampler[i] = r600_sampler(rctx, + &rctx->ps_sampler[i]->state.sampler, + i); } } rctx->hw_states.ps_nsampler = rctx->ps_nsampler; for (i = 0; i < rctx->ps_nsampler_view; i++) { if (rctx->ps_sampler_view[i]) { - rctx->hw_states.ps_resource[i] = rctx->ps_sampler_view[i]->rstate; - } else { - rctx->hw_states.ps_resource[i] = NULL; + rctx->hw_states.ps_resource[i] = r600_resource(ctx, + &rctx->ps_sampler_view[i]->state.sampler_view, + i); } } rctx->hw_states.ps_nresource = rctx->ps_nsampler_view; /* bind states */ - r = radeon_draw_set(rctx->draw, rctx->hw_states.ucp); - if (r) - return r; + for (i = 0; i < ucp_nclip; i++) { + r = radeon_draw_set(rctx->draw, rctx->hw_states.ucp[i]); + if (r) + return r; + } r = radeon_draw_set(rctx->draw, rctx->hw_states.db); if (r) return r; diff --git a/src/gallium/drivers/r600/r600_texture.c b/src/gallium/drivers/r600/r600_texture.c index ec1d50566a..77d627cdc8 100644 --- a/src/gallium/drivers/r600/r600_texture.c +++ b/src/gallium/drivers/r600/r600_texture.c @@ -128,25 +128,13 @@ struct pipe_resource *r600_texture_create(struct pipe_screen *screen, return &resource->base.b; } -static void r600_texture_destroy_state(struct pipe_resource *ptexture) -{ - struct r600_resource_texture *rtexture = (struct r600_resource_texture*)ptexture; - - for (int i = 0; i < PIPE_MAX_TEXTURE_LEVELS; i++) { - radeon_state_decref(rtexture->scissor[i]); - radeon_state_decref(rtexture->db[i]); - for (int j = 0; j < 8; j++) { - radeon_state_decref(rtexture->cb[j][i]); - } - } -} - static void r600_texture_destroy(struct pipe_screen *screen, struct pipe_resource *ptex) { struct r600_resource_texture *rtex = (struct r600_resource_texture*)ptex; struct r600_resource *resource = &rtex->resource; struct r600_screen *rscreen = r600_screen(screen); + unsigned i; if (resource->bo) { radeon_bo_decref(rscreen->rw, resource->bo); @@ -154,7 +142,11 @@ static void r600_texture_destroy(struct pipe_screen *screen, if (rtex->uncompressed) { radeon_bo_decref(rscreen->rw, rtex->uncompressed); } - r600_texture_destroy_state(ptex); + for (i = 0; i < PIPE_MAX_TEXTURE_LEVELS; i++) { + radeon_state_decref(rtex->scissor[i]); + radeon_state_decref(rtex->cb0[i]); + radeon_state_decref(rtex->db[i]); + } FREE(rtex); } @@ -219,12 +211,9 @@ struct pipe_resource *r600_texture_from_handle(struct pipe_screen *screen, pipe_reference_init(&resource->base.b.reference, 1); resource->base.b.screen = screen; resource->bo = bo; - rtex->depth = 0; rtex->pitch_override = whandle->stride; rtex->bpt = util_format_get_blocksize(templ->format); rtex->pitch[0] = whandle->stride; - rtex->width[0] = templ->width0; - rtex->height[0] = templ->height0; rtex->offset[0] = 0; rtex->size = align(rtex->pitch[0] * templ->height0, 64); @@ -707,9 +696,9 @@ static struct radeon_state *r600_texture_state_scissor(struct r600_screen *rscre return rstate; } -static struct radeon_state *r600_texture_state_cb(struct r600_screen *rscreen, +static struct radeon_state *r600_texture_state_cb0(struct r600_screen *rscreen, struct r600_resource_texture *rtexture, - unsigned cb, unsigned level) + unsigned level) { struct radeon_state *rstate; struct r600_resource *rbuffer; @@ -718,7 +707,7 @@ static struct radeon_state *r600_texture_state_cb(struct r600_screen *rscreen, unsigned format, swap, ntype; const struct util_format_description *desc; - rstate = radeon_state(rscreen->rw, R600_STATE_CB0 + cb, 0); + rstate = radeon_state(rscreen->rw, R600_STATE_CB0, 0); if (rstate == NULL) return NULL; rbuffer = &rtexture->resource; @@ -781,10 +770,6 @@ static struct radeon_state *r600_texture_state_db(struct r600_screen *rscreen, if (rstate == NULL) return NULL; rbuffer = &rtexture->resource; - rtexture->tilled = 1; - rtexture->array_mode = 2; - rtexture->tile_type = 1; - rtexture->depth = 1; /* set states (most default value are 0 and struct already * initialized to 0, thus avoid resetting them) @@ -853,14 +838,14 @@ static struct radeon_state *r600_texture_state_viewport(struct r600_screen *rscr return rstate; } -int r600_texture_cb(struct pipe_context *ctx, struct r600_resource_texture *rtexture, unsigned cb, unsigned level) +int r600_texture_cb0(struct pipe_context *ctx, struct r600_resource_texture *rtexture, unsigned level) { struct r600_screen *rscreen = r600_screen(ctx->screen); - if (rtexture->cb[cb][level] == NULL) { - rtexture->cb[cb][level] = r600_texture_state_cb(rscreen, rtexture, cb, level); - if (rtexture->cb[cb][level] == NULL) { - R600_ERR("failed to create cb%d state for texture\n", cb); + if (rtexture->cb0[level] == NULL) { + rtexture->cb0[level] = r600_texture_state_cb0(rscreen, rtexture, level); + if (rtexture->cb0[level] == NULL) { + R600_ERR("failed to create cb0 state for texture\n"); return -ENOMEM; } } diff --git a/src/gallium/drivers/r600/radeon.h b/src/gallium/drivers/r600/radeon.h index 3f1ca95f69..046c264c04 100644 --- a/src/gallium/drivers/r600/radeon.h +++ b/src/gallium/drivers/r600/radeon.h @@ -109,11 +109,13 @@ struct radeon_state { unsigned id; unsigned shader_index; unsigned nstates; - u32 states[64]; + u32 *states; unsigned npm4; unsigned cpm4; u32 pm4_crc; - u32 pm4[128]; + u32 *pm4; + u32 nimmd; + u32 *immd; unsigned nbo; struct radeon_bo *bo[4]; unsigned nreloc; @@ -128,7 +130,6 @@ struct radeon_state *radeon_state_shader(struct radeon *radeon, u32 type, u32 id struct radeon_state *radeon_state_incref(struct radeon_state *state); struct radeon_state *radeon_state_decref(struct radeon_state *state); int radeon_state_pm4(struct radeon_state *state); -int radeon_state_convert(struct radeon_state *state, u32 stype, u32 id, u32 shader_type); /* * draw functions @@ -218,7 +219,7 @@ enum r600_stype { R600_STATE_DB, R600_STATE_QUERY_BEGIN, R600_STATE_QUERY_END, - R600_STATE_UCP, + R600_STATE_CLIP, R600_STATE_VGT, R600_STATE_DRAW, }; @@ -612,37 +613,17 @@ enum { /* R600_DRAW */ #define R600_DRAW__VGT_NUM_INDICES 0 #define R600_DRAW__VGT_DMA_BASE_HI 1 -#define R600_DRAW__VGT_DMA_BASE 2 +#define R600_DRAW__VGT_DMA_BASE 2 #define R600_DRAW__VGT_DRAW_INITIATOR 3 -#define R600_DRAW_SIZE 4 -#define R600_DRAW_PM4 128 +#define R600_DRAW_SIZE 4 +#define R600_DRAW_PM4 128 /* R600_CLIP */ -#define R600_CLIP__PA_CL_UCP_X_0 0 -#define R600_CLIP__PA_CL_UCP_Y_0 1 -#define R600_CLIP__PA_CL_UCP_Z_0 2 -#define R600_CLIP__PA_CL_UCP_W_0 3 -#define R600_CLIP__PA_CL_UCP_X_1 4 -#define R600_CLIP__PA_CL_UCP_Y_1 5 -#define R600_CLIP__PA_CL_UCP_Z_1 6 -#define R600_CLIP__PA_CL_UCP_W_1 7 -#define R600_CLIP__PA_CL_UCP_X_2 8 -#define R600_CLIP__PA_CL_UCP_Y_2 9 -#define R600_CLIP__PA_CL_UCP_Z_2 10 -#define R600_CLIP__PA_CL_UCP_W_2 11 -#define R600_CLIP__PA_CL_UCP_X_3 12 -#define R600_CLIP__PA_CL_UCP_Y_3 13 -#define R600_CLIP__PA_CL_UCP_Z_3 14 -#define R600_CLIP__PA_CL_UCP_W_3 15 -#define R600_CLIP__PA_CL_UCP_X_4 16 -#define R600_CLIP__PA_CL_UCP_Y_4 17 -#define R600_CLIP__PA_CL_UCP_Z_4 18 -#define R600_CLIP__PA_CL_UCP_W_4 19 -#define R600_CLIP__PA_CL_UCP_X_5 20 -#define R600_CLIP__PA_CL_UCP_Y_5 21 -#define R600_CLIP__PA_CL_UCP_Z_5 22 -#define R600_CLIP__PA_CL_UCP_W_5 23 -#define R600_CLIP_SIZE 24 -#define R600_CLIP_PM4 128 +#define R600_CLIP__PA_CL_UCP_X_0 0 +#define R600_CLIP__PA_CL_UCP_Y_0 1 +#define R600_CLIP__PA_CL_UCP_Z_0 2 +#define R600_CLIP__PA_CL_UCP_W_0 3 +#define R600_CLIP_SIZE 4 +#define R600_CLIP_PM4 128 /* R600 QUERY BEGIN/END */ #define R600_QUERY__OFFSET 0 #define R600_QUERY_SIZE 1 diff --git a/src/gallium/winsys/r600/drm/r600_state.c b/src/gallium/winsys/r600/drm/r600_state.c index f6a428e884..e3d0116a2d 100644 --- a/src/gallium/winsys/r600/drm/r600_state.c +++ b/src/gallium/winsys/r600/drm/r600_state.c @@ -80,7 +80,7 @@ struct radeon_stype_info r600_stypes[] = { { R600_STATE_QUERY_BEGIN, 1, 0, r600_state_pm4_query_begin, SUB_NONE(VGT_EVENT) }, { R600_STATE_QUERY_END, 1, 0, r600_state_pm4_query_end, SUB_NONE(VGT_EVENT) }, { R600_STATE_DB, 1, 0, r600_state_pm4_db, SUB_NONE(DB) }, - { R600_STATE_UCP, 1, 0, r600_state_pm4_generic, SUB_NONE(UCP) }, + { R600_STATE_CLIP, 6, 0, r600_state_pm4_generic, SUB_NONE(UCP) }, { R600_STATE_VGT, 1, 0, r600_state_pm4_vgt, SUB_NONE(VGT) }, { R600_STATE_DRAW, 1, 0, r600_state_pm4_draw, SUB_NONE(DRAW) }, }; @@ -381,6 +381,13 @@ static int r600_state_pm4_draw(struct radeon_state *state) if (r) return r; state->pm4[state->cpm4++] = state->bo[0]->handle; + } else if (state->nimmd) { + state->pm4[state->cpm4++] = PKT3(PKT3_DRAW_INDEX_IMMD, state->nimmd + 1); + state->pm4[state->cpm4++] = state->states[R600_DRAW__VGT_NUM_INDICES]; + state->pm4[state->cpm4++] = state->states[R600_DRAW__VGT_DRAW_INITIATOR]; + for (i = 0; i < state->nimmd; i++) { + state->pm4[state->cpm4++] = state->immd[i]; + } } else { state->pm4[state->cpm4++] = PKT3(PKT3_DRAW_INDEX_AUTO, 1); state->pm4[state->cpm4++] = state->states[R600_DRAW__VGT_NUM_INDICES]; diff --git a/src/gallium/winsys/r600/drm/r600_states.h b/src/gallium/winsys/r600/drm/r600_states.h index 09d79d498d..51b69b9220 100644 --- a/src/gallium/winsys/r600/drm/r600_states.h +++ b/src/gallium/winsys/r600/drm/r600_states.h @@ -284,30 +284,10 @@ static const struct radeon_register R600_names_VS_CONSTANT[] = { }; static const struct radeon_register R600_names_UCP[] = { - {0x00028E20, 0, 0, "PA_CL_UCP0_X"}, - {0x00028E24, 0, 0, "PA_CL_UCP0_Y"}, - {0x00028E28, 0, 0, "PA_CL_UCP0_Z"}, - {0x00028E2C, 0, 0, "PA_CL_UCP0_W"}, - {0x00028E30, 0, 0, "PA_CL_UCP1_X"}, - {0x00028E34, 0, 0, "PA_CL_UCP1_Y"}, - {0x00028E38, 0, 0, "PA_CL_UCP1_Z"}, - {0x00028E3C, 0, 0, "PA_CL_UCP1_W"}, - {0x00028E40, 0, 0, "PA_CL_UCP2_X"}, - {0x00028E44, 0, 0, "PA_CL_UCP2_Y"}, - {0x00028E48, 0, 0, "PA_CL_UCP2_Z"}, - {0x00028E4C, 0, 0, "PA_CL_UCP2_W"}, - {0x00028E50, 0, 0, "PA_CL_UCP3_X"}, - {0x00028E54, 0, 0, "PA_CL_UCP3_Y"}, - {0x00028E58, 0, 0, "PA_CL_UCP3_Z"}, - {0x00028E5C, 0, 0, "PA_CL_UCP3_W"}, - {0x00028E60, 0, 0, "PA_CL_UCP4_X"}, - {0x00028E64, 0, 0, "PA_CL_UCP4_Y"}, - {0x00028E68, 0, 0, "PA_CL_UCP4_Z"}, - {0x00028E6C, 0, 0, "PA_CL_UCP4_W"}, - {0x00028E70, 0, 0, "PA_CL_UCP5_X"}, - {0x00028E74, 0, 0, "PA_CL_UCP5_Y"}, - {0x00028E78, 0, 0, "PA_CL_UCP5_Z"}, - {0x00028E7C, 0, 0, "PA_CL_UCP5_W"}, + {0x00028e20, 0, 0, "PA_CL_UCP0_X"}, + {0x00028e24, 0, 0, "PA_CL_UCP0_Y"}, + {0x00028e28, 0, 0, "PA_CL_UCP0_Z"}, + {0x00028e2c, 0, 0, "PA_CL_UCP0_W"}, }; static const struct radeon_register R600_names_PS_RESOURCE[] = { diff --git a/src/gallium/winsys/r600/drm/radeon_priv.h b/src/gallium/winsys/r600/drm/radeon_priv.h index af5319efd1..66ee5f2177 100644 --- a/src/gallium/winsys/r600/drm/radeon_priv.h +++ b/src/gallium/winsys/r600/drm/radeon_priv.h @@ -38,19 +38,19 @@ struct radeon_register { }; struct radeon_sub_type { - int shader_type; - const struct radeon_register *regs; - unsigned nstates; + int shader_type; + const struct radeon_register *regs; + unsigned nstates; }; struct radeon_stype_info { - unsigned stype; - unsigned num; - unsigned stride; - radeon_state_pm4_t pm4; - struct radeon_sub_type reginfo[R600_SHADER_MAX]; - unsigned base_id; - unsigned npm4; + unsigned stype; + unsigned num; + unsigned stride; + radeon_state_pm4_t pm4; + struct radeon_sub_type reginfo[R600_SHADER_MAX]; + unsigned base_id; + unsigned npm4; }; struct radeon { diff --git a/src/gallium/winsys/r600/drm/radeon_state.c b/src/gallium/winsys/r600/drm/radeon_state.c index d4e622cf7f..ef09fdfb96 100644 --- a/src/gallium/winsys/r600/drm/radeon_state.c +++ b/src/gallium/winsys/r600/drm/radeon_state.c @@ -80,57 +80,13 @@ struct radeon_state *radeon_state_shader(struct radeon *radeon, u32 stype, u32 i state->refcount = 1; state->npm4 = found->npm4; state->nstates = found->reginfo[shader_index].nstates; - return state; -} - -int radeon_state_convert(struct radeon_state *state, u32 stype, u32 id, u32 shader_type) -{ - struct radeon_stype_info *found = NULL; - int i, j, shader_index = -1; - - if (state == NULL) - return 0; - /* traverse the stype array */ - for (i = 0; i < state->radeon->nstype; i++) { - /* if the type doesn't match, if the shader doesn't match */ - if (stype != state->radeon->stype[i].stype) - continue; - if (shader_type) { - for (j = 0; j < 4; j++) { - if (state->radeon->stype[i].reginfo[j].shader_type == shader_type) { - shader_index = j; - break; - } - } - if (shader_index == -1) - continue; - } else { - if (state->radeon->stype[i].reginfo[0].shader_type) - continue; - else - shader_index = 0; - } - if (id > state->radeon->stype[i].num) - continue; - - found = &state->radeon->stype[i]; - break; - } - - if (!found) { - fprintf(stderr, "%s invalid type %d/id %d/shader class %d\n", __func__, stype, id, shader_type); - return -EINVAL; - } - - if (found->reginfo[shader_index].nstates != state->nstates) { - fprintf(stderr, "invalid type change from (%d %d %d) to (%d %d %d)\n", - state->stype->stype, state->id, state->shader_index, stype, id, shader_index); + state->states = calloc(1, state->nstates * 4); + state->pm4 = calloc(1, found->npm4 * 4); + if (state->states == NULL || state->pm4 == NULL) { + radeon_state_decref(state); + return NULL; } - - state->stype = found; - state->id = id; - state->shader_index = shader_index; - return radeon_state_pm4(state); + return state; } struct radeon_state *radeon_state(struct radeon *radeon, u32 type, u32 id) @@ -178,6 +134,9 @@ struct radeon_state *radeon_state_decref(struct radeon_state *state) for (i = 0; i < state->nbo; i++) { state->bo[i] = radeon_bo_decref(state->radeon, state->bo[i]); } + free(state->immd); + free(state->states); + free(state->pm4); memset(state, 0, sizeof(*state)); free(state); return NULL; @@ -220,9 +179,8 @@ int radeon_state_pm4(struct radeon_state *state) { int r; - if (state == NULL) + if (state == NULL || state->cpm4) return 0; - state->cpm4 = 0; r = state->stype->pm4(state); if (r) { fprintf(stderr, "%s failed to build PM4 for state(%d %d)\n", -- cgit v1.2.3 From 1d7b4af81781512b5bc5d43249529441d60ecebe Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Wed, 1 Sep 2010 14:28:55 +1000 Subject: r600g: correct cb/zb offset emits. This fixes fbo-3d and fbo-cubemap --- src/gallium/drivers/r600/r600_state.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/r600_state.c b/src/gallium/drivers/r600/r600_state.c index b5db848e35..e2265ace97 100644 --- a/src/gallium/drivers/r600/r600_state.c +++ b/src/gallium/drivers/r600/r600_state.c @@ -740,7 +740,7 @@ static struct radeon_state *r600_cb(struct r600_context *rctx, int cb) S_0280A0_SOURCE_FORMAT(1) | S_0280A0_NUMBER_TYPE(ntype); - rstate->states[R600_CB0__CB_COLOR0_BASE] = rtex->offset[level] >> 8; + rstate->states[R600_CB0__CB_COLOR0_BASE] = state->cbufs[cb]->offset >> 8; rstate->states[R600_CB0__CB_COLOR0_INFO] = color_info; rstate->states[R600_CB0__CB_COLOR0_SIZE] = S_028060_PITCH_TILE_MAX(pitch) | S_028060_SLICE_TILE_MAX(slice); @@ -786,7 +786,7 @@ static struct radeon_state *r600_db(struct r600_context *rctx) pitch = (rtex->pitch[level] / rtex->bpt) / 8 - 1; slice = (rtex->pitch[level] / rtex->bpt) * state->zsbuf->height / 64 - 1; format = r600_translate_dbformat(state->zsbuf->texture->format); - rstate->states[R600_DB__DB_DEPTH_BASE] = rtex->offset[level] >> 8; + rstate->states[R600_DB__DB_DEPTH_BASE] = state->zsbuf->offset >> 8; rstate->states[R600_DB__DB_DEPTH_INFO] = S_028010_ARRAY_MODE(rtex->array_mode) | S_028010_FORMAT(format); rstate->states[R600_DB__DB_DEPTH_VIEW] = 0x00000000; -- cgit v1.2.3 From c3c25a7ab8507c9c6b21137de03b5d94c2420369 Mon Sep 17 00:00:00 2001 From: Andre Maasikas Date: Wed, 1 Sep 2010 09:19:51 +0300 Subject: r600: cube mipmap levels are aligned to 8 faces only starting from r7xx --- src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c b/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c index c6e5f110ea..ddfde3edaf 100644 --- a/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c +++ b/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c @@ -199,10 +199,10 @@ static void calculate_miptree_layout_r300(radeonContextPtr rmesa, radeon_mipmap_ for(face = 0; face < mt->faces; face++) compute_tex_image_offset(rmesa, mt, face, level, &curOffset); - /* r600 cube levels seems to be aligned to 8 faces but - * we have separate register for 1'st level offset so add + /* from r700? cube levels seems to be aligned to 8 faces, + * as we have separate register for 1'st level offset add * 2 image alignment after 1'st mip level */ - if(rmesa->radeonScreen->chip_family >= CHIP_FAMILY_R600 && + if(rmesa->radeonScreen->chip_family >= CHIP_FAMILY_RV770 && mt->target == GL_TEXTURE_CUBE_MAP && level >= 1) curOffset += 2 * mt->levels[level].size; } -- cgit v1.2.3 From 63b80f8cc181ded154668e60ac2cf0a6a82d118f Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Wed, 1 Sep 2010 06:34:58 -0700 Subject: glsl2: Disallow function declarations within function definitions in GLSL 1.20 The GLSL 1.20 spec specifically disallows this, but it was allowed in GLSL 1.10. Fixes piglit test cases local-function-0[13].frag and bugzilla #29921. --- src/glsl/ast_to_hir.cpp | 37 ++++++++++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp index 148afd00e8..84aa6501c5 100644 --- a/src/glsl/ast_to_hir.cpp +++ b/src/glsl/ast_to_hir.cpp @@ -2193,6 +2193,25 @@ ast_function::hir(exec_list *instructions, const char *const name = identifier; + /* From page 21 (page 27 of the PDF) of the GLSL 1.20 spec, + * + * "Function declarations (prototypes) cannot occur inside of functions; + * they must be at global scope, or for the built-in functions, outside + * the global scope." + * + * From page 27 (page 33 of the PDF) of the GLSL ES 1.00.16 spec, + * + * "User defined functions may only be defined within the global scope." + * + * Note that this language does not appear in GLSL 1.10. + */ + if ((state->current_function != NULL) && (state->language_version != 110)) { + YYLTYPE loc = this->get_location(); + _mesa_glsl_error(&loc, state, + "declaration of function `%s' not allowed within " + "function body", name); + } + /* From page 15 (page 21 of the PDF) of the GLSL 1.10 spec, * * "Identifiers starting with "gl_" are reserved for use by @@ -2275,7 +2294,23 @@ ast_function::hir(exec_list *instructions, } /* Emit the new function header */ - instructions->push_tail(f); + if (state->current_function == NULL) + instructions->push_tail(f); + else { + /* IR invariants disallow function declarations or definitions nested + * within other function definitions. Insert the new ir_function + * block in the instruction sequence before the ir_function block + * containing the current ir_function_signature. + * + * This can only happen in a GLSL 1.10 shader. In all other GLSL + * versions this nesting is disallowed. There is a check for this at + * the top of this function. + */ + ir_function *const curr = + const_cast(state->current_function->function()); + + curr->insert_before(f); + } } /* Verify the return type of main() */ -- cgit v1.2.3 From 07317012369c7b2662a8357fa4ea15453c4e277b Mon Sep 17 00:00:00 2001 From: Vladimir Vukicevic Date: Wed, 1 Sep 2010 08:54:21 -0600 Subject: mesa: initialize dummy framebuffer and renderbuffer mutexes See fd.o bug 29909. Signed-off-by: Brian Paul --- src/mesa/main/fbobject.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c index 9a84e5a79c..f80dd85993 100644 --- a/src/mesa/main/fbobject.c +++ b/src/mesa/main/fbobject.c @@ -93,6 +93,8 @@ delete_dummy_framebuffer(struct gl_framebuffer *fb) void _mesa_init_fbobjects(GLcontext *ctx) { + _glthread_INIT_MUTEX(DummyFramebuffer.Mutex); + _glthread_INIT_MUTEX(DummyRenderbuffer.Mutex); DummyFramebuffer.Delete = delete_dummy_framebuffer; DummyRenderbuffer.Delete = delete_dummy_renderbuffer; } -- cgit v1.2.3 From 4a955ab6b78e3b3a4cdd54dc933715f0dafbe7f4 Mon Sep 17 00:00:00 2001 From: Patrice Mandin Date: Wed, 1 Sep 2010 18:12:11 +0200 Subject: nouveau/nvfx: Remove enforcement of bit depth being same as front buffer Signed-off-by: Patrice Mandin --- src/gallium/drivers/nvfx/nvfx_screen.c | 17 ----------------- 1 file changed, 17 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/nvfx/nvfx_screen.c b/src/gallium/drivers/nvfx/nvfx_screen.c index 99b4d8b58c..65ca265d45 100644 --- a/src/gallium/drivers/nvfx/nvfx_screen.c +++ b/src/gallium/drivers/nvfx/nvfx_screen.c @@ -14,18 +14,6 @@ #define NV34TCL_CHIPSET_3X_MASK 0x00000010 #define NV35TCL_CHIPSET_3X_MASK 0x000001e0 -/* FIXME: It seems I should not include directly ../../winsys/drm/nouveau/drm/nouveau_drm_api.h -* to get the pointer to the context front buffer, so I copied nouveau_winsys here. -* nv30_screen_surface_format_supported() can then use it to enforce creating fbo -* with same number of bits everywhere. -*/ -struct nouveau_winsys { - struct pipe_winsys base; - - struct pipe_screen *pscreen; - - struct pipe_surface *front; -}; #define NV4X_GRCLASS4097_CHIPSETS 0x00000baf #define NV4X_GRCLASS4497_CHIPSETS 0x00005450 #define NV6X_GRCLASS4497_CHIPSETS 0x00000088 @@ -170,7 +158,6 @@ nvfx_screen_is_format_supported(struct pipe_screen *pscreen, unsigned bind, unsigned geom_flags) { struct nvfx_screen *screen = nvfx_screen(pscreen); - struct pipe_surface *front = ((struct nouveau_winsys *) pscreen->winsys)->front; if (sample_count > 1) return FALSE; @@ -190,11 +177,7 @@ nvfx_screen_is_format_supported(struct pipe_screen *pscreen, switch (format) { case PIPE_FORMAT_S8_USCALED_Z24_UNORM: case PIPE_FORMAT_X8Z24_UNORM: - break; case PIPE_FORMAT_Z16_UNORM: - /* TODO: this nv30 limitation probably does not exist */ - if (!screen->is_nv4x && front && front->format != PIPE_FORMAT_B5G6R5_UNORM) - return FALSE; break; default: return FALSE; -- cgit v1.2.3 From 15ce70252c5357081a61f3494261c7e343174301 Mon Sep 17 00:00:00 2001 From: Jerome Glisse Date: Wed, 1 Sep 2010 13:04:42 -0400 Subject: Revert "Revert "r600g: precompute some of the hw state"" This reverts commit 1fa7245c348cb7aced81f1672140f64cb6450e2f. Conflicts: src/gallium/drivers/r600/r600_state.c --- src/gallium/drivers/r600/r600_blit.c | 4 +- src/gallium/drivers/r600/r600_context.h | 2 +- src/gallium/drivers/r600/r600_resource.h | 2 +- src/gallium/drivers/r600/r600_screen.h | 2 +- src/gallium/drivers/r600/r600_state.c | 130 +++++++++++++++++------------ src/gallium/drivers/r600/r600_texture.c | 43 ++++++---- src/gallium/drivers/r600/radeon.h | 47 +++++++---- src/gallium/winsys/r600/drm/r600_state.c | 9 +- src/gallium/winsys/r600/drm/r600_states.h | 28 ++++++- src/gallium/winsys/r600/drm/radeon_priv.h | 20 ++--- src/gallium/winsys/r600/drm/radeon_state.c | 62 +++++++++++--- 11 files changed, 229 insertions(+), 120 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/r600_blit.c b/src/gallium/drivers/r600/r600_blit.c index 1d197e92b2..a8263ccbce 100644 --- a/src/gallium/drivers/r600/r600_blit.c +++ b/src/gallium/drivers/r600/r600_blit.c @@ -670,7 +670,7 @@ int r600_blit_uncompress_depth(struct pipe_context *ctx, struct r600_resource_te if (r) { return r; } - r = r600_texture_cb0(ctx, rtexture, level); + r = r600_texture_cb(ctx, rtexture, 0, level); if (r) { return r; } @@ -772,7 +772,7 @@ int r600_blit_uncompress_depth(struct pipe_context *ctx, struct r600_resource_te if (r) { goto out; } - r = radeon_draw_set(draw, rtexture->cb0[level]); + r = radeon_draw_set(draw, rtexture->cb[0][level]); if (r) { goto out; } diff --git a/src/gallium/drivers/r600/r600_context.h b/src/gallium/drivers/r600/r600_context.h index d96d5b513f..e9495f0017 100644 --- a/src/gallium/drivers/r600/r600_context.h +++ b/src/gallium/drivers/r600/r600_context.h @@ -121,7 +121,7 @@ struct r600_context_hw_states { struct radeon_state *config; struct radeon_state *cb_cntl; struct radeon_state *db; - struct radeon_state *ucp[6]; + struct radeon_state *ucp; unsigned ps_nresource; unsigned ps_nsampler; struct radeon_state *ps_resource[160]; diff --git a/src/gallium/drivers/r600/r600_resource.h b/src/gallium/drivers/r600/r600_resource.h index b880f9369c..8078a83c35 100644 --- a/src/gallium/drivers/r600/r600_resource.h +++ b/src/gallium/drivers/r600/r600_resource.h @@ -57,7 +57,7 @@ struct r600_resource_texture { unsigned dirty; struct radeon_bo *uncompressed; struct radeon_state *scissor[PIPE_MAX_TEXTURE_LEVELS]; - struct radeon_state *cb0[PIPE_MAX_TEXTURE_LEVELS]; + struct radeon_state *cb[8][PIPE_MAX_TEXTURE_LEVELS]; struct radeon_state *db[PIPE_MAX_TEXTURE_LEVELS]; struct radeon_state *viewport[PIPE_MAX_TEXTURE_LEVELS]; }; diff --git a/src/gallium/drivers/r600/r600_screen.h b/src/gallium/drivers/r600/r600_screen.h index 438976f654..b9938f117a 100644 --- a/src/gallium/drivers/r600/r600_screen.h +++ b/src/gallium/drivers/r600/r600_screen.h @@ -84,7 +84,7 @@ void* r600_texture_transfer_map(struct pipe_context *ctx, void r600_texture_transfer_unmap(struct pipe_context *ctx, struct pipe_transfer* transfer); int r600_texture_scissor(struct pipe_context *ctx, struct r600_resource_texture *rtexture, unsigned level); -int r600_texture_cb0(struct pipe_context *ctx, struct r600_resource_texture *rtexture, unsigned level); +int r600_texture_cb(struct pipe_context *ctx, struct r600_resource_texture *rtexture, unsigned cb, unsigned level); int r600_texture_db(struct pipe_context *ctx, struct r600_resource_texture *rtexture, unsigned level); int r600_texture_from_depth(struct pipe_context *ctx, struct r600_resource_texture *rtexture, unsigned level); int r600_texture_viewport(struct pipe_context *ctx, struct r600_resource_texture *rtexture, unsigned level); diff --git a/src/gallium/drivers/r600/r600_state.c b/src/gallium/drivers/r600/r600_state.c index e2265ace97..d8f53f2ce8 100644 --- a/src/gallium/drivers/r600/r600_state.c +++ b/src/gallium/drivers/r600/r600_state.c @@ -34,6 +34,16 @@ #include "r600d.h" #include "r600_state_inlines.h" +static struct radeon_state *r600_blend(struct r600_context *rctx, const struct pipe_blend_state *state); +static struct radeon_state *r600_viewport(struct r600_context *rctx, const struct pipe_viewport_state *state); +static struct radeon_state *r600_ucp(struct r600_context *rctx, const struct pipe_clip_state *state); +static struct radeon_state *r600_sampler(struct r600_context *rctx, + const struct pipe_sampler_state *state, + unsigned id); +static struct radeon_state *r600_resource(struct pipe_context *ctx, + const struct pipe_sampler_view *view, + unsigned id); + static void *r600_create_blend_state(struct pipe_context *ctx, const struct pipe_blend_state *state) { @@ -86,6 +96,7 @@ static struct pipe_sampler_view *r600_create_sampler_view(struct pipe_context *c rstate->state.sampler_view.texture = texture; rstate->state.sampler_view.reference.count = 1; rstate->state.sampler_view.context = ctx; + rstate->rstate = r600_resource(ctx, &rstate->state.sampler_view, 0); return &rstate->state.sampler_view; } @@ -229,6 +240,9 @@ static void r600_bind_ps_sampler(struct pipe_context *ctx, for (i = 0; i < count; i++) { rstate = (struct r600_context_state *)states[i]; rctx->ps_sampler[i] = r600_context_state_incref(rstate); + if (rstate) { + radeon_state_convert(rstate->rstate, R600_STATE_SAMPLER, i, R600_SHADER_PS); + } } rctx->ps_nsampler = count; } @@ -246,6 +260,9 @@ static void r600_bind_vs_sampler(struct pipe_context *ctx, for (i = 0; i < count; i++) { rstate = (struct r600_context_state *)states[i]; rctx->vs_sampler[i] = r600_context_state_incref(rstate); + if (rstate) { + radeon_state_convert(rstate->rstate, R600_STATE_SAMPLER, i, R600_SHADER_VS); + } } rctx->vs_nsampler = count; } @@ -337,6 +354,9 @@ static void r600_set_ps_sampler_view(struct pipe_context *ctx, for (i = 0; i < count; i++) { rstate = (struct r600_context_state *)views[i]; rctx->ps_sampler_view[i] = r600_context_state_incref(rstate); + if (rstate) { + radeon_state_convert(rstate->rstate, R600_STATE_RESOURCE, i, R600_SHADER_PS); + } } rctx->ps_nsampler_view = count; } @@ -355,6 +375,9 @@ static void r600_set_vs_sampler_view(struct pipe_context *ctx, for (i = 0; i < count; i++) { rstate = (struct r600_context_state *)views[i]; rctx->vs_sampler_view[i] = r600_context_state_incref(rstate); + if (rstate) { + radeon_state_convert(rstate->rstate, R600_STATE_RESOURCE, i, R600_SHADER_VS); + } } rctx->vs_nsampler_view = count; } @@ -363,10 +386,19 @@ static void r600_set_framebuffer_state(struct pipe_context *ctx, const struct pipe_framebuffer_state *state) { struct r600_context *rctx = r600_context(ctx); + struct r600_resource_texture *rtexture; struct r600_context_state *rstate; rstate = r600_context_state(rctx, pipe_framebuffer_type, state); r600_bind_state(ctx, rstate); + for (int i = 0; i < state->nr_cbufs; i++) { + rtexture = (struct r600_resource_texture*)state->cbufs[i]->texture; + r600_texture_cb(ctx, rtexture, i, state->cbufs[i]->level); + } + if (state->zsbuf) { + rtexture = (struct r600_resource_texture*)state->zsbuf->texture; + r600_texture_db(ctx, rtexture, state->zsbuf->level); + } } static void r600_set_polygon_stipple(struct pipe_context *ctx, @@ -565,6 +597,7 @@ struct r600_context_state *r600_context_state(struct r600_context *rctx, unsigne break; case pipe_viewport_type: rstate->state.viewport = (*states).viewport; + rstate->rstate = r600_viewport(rctx, &rstate->state.viewport); break; case pipe_depth_type: rstate->state.depth = (*states).depth; @@ -580,6 +613,7 @@ struct r600_context_state *r600_context_state(struct r600_context *rctx, unsigne break; case pipe_clip_type: rstate->state.clip = (*states).clip; + rstate->rstate = r600_ucp(rctx, &rstate->state.clip); break; case pipe_stencil_type: rstate->state.stencil = (*states).stencil; @@ -592,6 +626,7 @@ struct r600_context_state *r600_context_state(struct r600_context *rctx, unsigne break; case pipe_blend_type: rstate->state.blend = (*states).blend; + rstate->rstate = r600_blend(rctx, &rstate->state.blend); break; case pipe_stencil_ref_type: rstate->state.stencil_ref = (*states).stencil_ref; @@ -606,6 +641,7 @@ struct r600_context_state *r600_context_state(struct r600_context *rctx, unsigne break; case pipe_sampler_type: rstate->state.sampler = (*states).sampler; + rstate->rstate = r600_sampler(rctx, &rstate->state.sampler, 0); break; default: R600_ERR("invalid type %d\n", rstate->type); @@ -615,11 +651,10 @@ struct r600_context_state *r600_context_state(struct r600_context *rctx, unsigne return rstate; } -static struct radeon_state *r600_blend(struct r600_context *rctx) +static struct radeon_state *r600_blend(struct r600_context *rctx, const struct pipe_blend_state *state) { struct r600_screen *rscreen = rctx->screen; struct radeon_state *rstate; - const struct pipe_blend_state *state = &rctx->blend->state.blend; int i; rstate = radeon_state(rscreen->rw, R600_STATE_BLEND, 0); @@ -675,27 +710,22 @@ static struct radeon_state *r600_blend(struct r600_context *rctx) return rstate; } -static struct radeon_state *r600_ucp(struct r600_context *rctx, int clip) +static struct radeon_state *r600_ucp(struct r600_context *rctx, const struct pipe_clip_state *state) { struct r600_screen *rscreen = rctx->screen; struct radeon_state *rstate; - const struct pipe_clip_state *state = &rctx->clip->state.clip; - rstate = radeon_state(rscreen->rw, R600_STATE_CLIP, clip); + rstate = radeon_state(rscreen->rw, R600_STATE_UCP, 0); if (rstate == NULL) return NULL; - rstate->states[R600_CLIP__PA_CL_UCP_X_0] = fui(state->ucp[clip][0]); - rstate->states[R600_CLIP__PA_CL_UCP_Y_0] = fui(state->ucp[clip][1]); - rstate->states[R600_CLIP__PA_CL_UCP_Z_0] = fui(state->ucp[clip][2]); - rstate->states[R600_CLIP__PA_CL_UCP_W_0] = fui(state->ucp[clip][3]); - - if (radeon_state_pm4(rstate)) { - radeon_state_decref(rstate); - return NULL; + for (int i = 0; i < state->nr; i++) { + rstate->states[i * 4 + 0] = fui(state->ucp[i][0]); + rstate->states[i * 4 + 1] = fui(state->ucp[i][1]); + rstate->states[i * 4 + 2] = fui(state->ucp[i][2]); + rstate->states[i * 4 + 3] = fui(state->ucp[i][3]); } return rstate; - } static struct radeon_state *r600_cb(struct r600_context *rctx, int cb) @@ -954,9 +984,8 @@ static struct radeon_state *r600_scissor(struct r600_context *rctx) return rstate; } -static struct radeon_state *r600_viewport(struct r600_context *rctx) +static struct radeon_state *r600_viewport(struct r600_context *rctx, const struct pipe_viewport_state *state) { - const struct pipe_viewport_state *state = &rctx->viewport->state.viewport; struct r600_screen *rscreen = rctx->screen; struct radeon_state *rstate; @@ -1366,6 +1395,7 @@ static struct radeon_state *r600_cb_cntl(struct r600_context *rctx) int r600_context_hw_states(struct pipe_context *ctx) { struct r600_context *rctx = r600_context(ctx); + struct r600_resource_texture *rtexture; unsigned i; int r; int nr_cbufs = rctx->framebuffer->state.framebuffer.nr_cbufs; @@ -1377,69 +1407,59 @@ int r600_context_hw_states(struct pipe_context *ctx) /* free previous TODO determine what need to be updated, what * doesn't */ - //radeon_state_decref(rctx->hw_states.config); rctx->hw_states.cb_cntl = radeon_state_decref(rctx->hw_states.cb_cntl); - rctx->hw_states.db = radeon_state_decref(rctx->hw_states.db); rctx->hw_states.rasterizer = radeon_state_decref(rctx->hw_states.rasterizer); rctx->hw_states.scissor = radeon_state_decref(rctx->hw_states.scissor); rctx->hw_states.dsa = radeon_state_decref(rctx->hw_states.dsa); - rctx->hw_states.blend = radeon_state_decref(rctx->hw_states.blend); - rctx->hw_states.viewport = radeon_state_decref(rctx->hw_states.viewport); - for (i = 0; i < 8; i++) { - rctx->hw_states.cb[i] = radeon_state_decref(rctx->hw_states.cb[i]); - } - for (i = 0; i < 6; i++) { - rctx->hw_states.ucp[i] = radeon_state_decref(rctx->hw_states.ucp[i]); - } - for (i = 0; i < rctx->hw_states.ps_nresource; i++) { - radeon_state_decref(rctx->hw_states.ps_resource[i]); - rctx->hw_states.ps_resource[i] = NULL; - } - rctx->hw_states.ps_nresource = 0; - for (i = 0; i < rctx->hw_states.ps_nsampler; i++) { - radeon_state_decref(rctx->hw_states.ps_sampler[i]); - rctx->hw_states.ps_sampler[i] = NULL; - } - rctx->hw_states.ps_nsampler = 0; /* build new states */ + rctx->hw_states.blend = NULL; + rctx->hw_states.viewport = NULL; + rctx->hw_states.ucp = NULL; rctx->hw_states.rasterizer = r600_rasterizer(rctx); rctx->hw_states.scissor = r600_scissor(rctx); rctx->hw_states.dsa = r600_dsa(rctx); - rctx->hw_states.blend = r600_blend(rctx); - rctx->hw_states.viewport = r600_viewport(rctx); - for (i = 0; i < nr_cbufs; i++) { - rctx->hw_states.cb[i] = r600_cb(rctx, i); + rctx->hw_states.cb_cntl = r600_cb_cntl(rctx); + if (rctx->viewport) { + rctx->hw_states.viewport = rctx->viewport->rstate; } - for (i = 0; i < ucp_nclip; i++) { - rctx->hw_states.ucp[i] = r600_ucp(rctx, i); + if (rctx->blend) { + rctx->hw_states.blend = rctx->blend->rstate; + } + if (rctx->clip) { + rctx->hw_states.ucp = rctx->clip->rstate; + } + for (i = 0; i < rctx->framebuffer->state.framebuffer.nr_cbufs; i++) { + rtexture = (struct r600_resource_texture*)rctx->framebuffer->state.framebuffer.cbufs[i]->texture; + rctx->hw_states.cb[i] = rtexture->cb[i][rctx->framebuffer->state.framebuffer.cbufs[i]->level]; + } + if (rctx->framebuffer->state.framebuffer.zsbuf) { + rtexture = (struct r600_resource_texture*)rctx->framebuffer->state.framebuffer.zsbuf->texture; + rctx->hw_states.db = rtexture->db[rctx->framebuffer->state.framebuffer.zsbuf->level]; } - rctx->hw_states.db = r600_db(rctx); - rctx->hw_states.cb_cntl = r600_cb_cntl(rctx); + for (i = 0; i < rctx->ps_nsampler; i++) { if (rctx->ps_sampler[i]) { - rctx->hw_states.ps_sampler[i] = r600_sampler(rctx, - &rctx->ps_sampler[i]->state.sampler, - i); + rctx->hw_states.ps_sampler[i] = rctx->ps_sampler[i]->rstate; + } else { + rctx->hw_states.ps_sampler[i] = NULL; } } rctx->hw_states.ps_nsampler = rctx->ps_nsampler; for (i = 0; i < rctx->ps_nsampler_view; i++) { if (rctx->ps_sampler_view[i]) { - rctx->hw_states.ps_resource[i] = r600_resource(ctx, - &rctx->ps_sampler_view[i]->state.sampler_view, - i); + rctx->hw_states.ps_resource[i] = rctx->ps_sampler_view[i]->rstate; + } else { + rctx->hw_states.ps_resource[i] = NULL; } } rctx->hw_states.ps_nresource = rctx->ps_nsampler_view; /* bind states */ - for (i = 0; i < ucp_nclip; i++) { - r = radeon_draw_set(rctx->draw, rctx->hw_states.ucp[i]); - if (r) - return r; - } + r = radeon_draw_set(rctx->draw, rctx->hw_states.ucp); + if (r) + return r; r = radeon_draw_set(rctx->draw, rctx->hw_states.db); if (r) return r; diff --git a/src/gallium/drivers/r600/r600_texture.c b/src/gallium/drivers/r600/r600_texture.c index 77d627cdc8..ec1d50566a 100644 --- a/src/gallium/drivers/r600/r600_texture.c +++ b/src/gallium/drivers/r600/r600_texture.c @@ -128,13 +128,25 @@ struct pipe_resource *r600_texture_create(struct pipe_screen *screen, return &resource->base.b; } +static void r600_texture_destroy_state(struct pipe_resource *ptexture) +{ + struct r600_resource_texture *rtexture = (struct r600_resource_texture*)ptexture; + + for (int i = 0; i < PIPE_MAX_TEXTURE_LEVELS; i++) { + radeon_state_decref(rtexture->scissor[i]); + radeon_state_decref(rtexture->db[i]); + for (int j = 0; j < 8; j++) { + radeon_state_decref(rtexture->cb[j][i]); + } + } +} + static void r600_texture_destroy(struct pipe_screen *screen, struct pipe_resource *ptex) { struct r600_resource_texture *rtex = (struct r600_resource_texture*)ptex; struct r600_resource *resource = &rtex->resource; struct r600_screen *rscreen = r600_screen(screen); - unsigned i; if (resource->bo) { radeon_bo_decref(rscreen->rw, resource->bo); @@ -142,11 +154,7 @@ static void r600_texture_destroy(struct pipe_screen *screen, if (rtex->uncompressed) { radeon_bo_decref(rscreen->rw, rtex->uncompressed); } - for (i = 0; i < PIPE_MAX_TEXTURE_LEVELS; i++) { - radeon_state_decref(rtex->scissor[i]); - radeon_state_decref(rtex->cb0[i]); - radeon_state_decref(rtex->db[i]); - } + r600_texture_destroy_state(ptex); FREE(rtex); } @@ -211,9 +219,12 @@ struct pipe_resource *r600_texture_from_handle(struct pipe_screen *screen, pipe_reference_init(&resource->base.b.reference, 1); resource->base.b.screen = screen; resource->bo = bo; + rtex->depth = 0; rtex->pitch_override = whandle->stride; rtex->bpt = util_format_get_blocksize(templ->format); rtex->pitch[0] = whandle->stride; + rtex->width[0] = templ->width0; + rtex->height[0] = templ->height0; rtex->offset[0] = 0; rtex->size = align(rtex->pitch[0] * templ->height0, 64); @@ -696,9 +707,9 @@ static struct radeon_state *r600_texture_state_scissor(struct r600_screen *rscre return rstate; } -static struct radeon_state *r600_texture_state_cb0(struct r600_screen *rscreen, +static struct radeon_state *r600_texture_state_cb(struct r600_screen *rscreen, struct r600_resource_texture *rtexture, - unsigned level) + unsigned cb, unsigned level) { struct radeon_state *rstate; struct r600_resource *rbuffer; @@ -707,7 +718,7 @@ static struct radeon_state *r600_texture_state_cb0(struct r600_screen *rscreen, unsigned format, swap, ntype; const struct util_format_description *desc; - rstate = radeon_state(rscreen->rw, R600_STATE_CB0, 0); + rstate = radeon_state(rscreen->rw, R600_STATE_CB0 + cb, 0); if (rstate == NULL) return NULL; rbuffer = &rtexture->resource; @@ -770,6 +781,10 @@ static struct radeon_state *r600_texture_state_db(struct r600_screen *rscreen, if (rstate == NULL) return NULL; rbuffer = &rtexture->resource; + rtexture->tilled = 1; + rtexture->array_mode = 2; + rtexture->tile_type = 1; + rtexture->depth = 1; /* set states (most default value are 0 and struct already * initialized to 0, thus avoid resetting them) @@ -838,14 +853,14 @@ static struct radeon_state *r600_texture_state_viewport(struct r600_screen *rscr return rstate; } -int r600_texture_cb0(struct pipe_context *ctx, struct r600_resource_texture *rtexture, unsigned level) +int r600_texture_cb(struct pipe_context *ctx, struct r600_resource_texture *rtexture, unsigned cb, unsigned level) { struct r600_screen *rscreen = r600_screen(ctx->screen); - if (rtexture->cb0[level] == NULL) { - rtexture->cb0[level] = r600_texture_state_cb0(rscreen, rtexture, level); - if (rtexture->cb0[level] == NULL) { - R600_ERR("failed to create cb0 state for texture\n"); + if (rtexture->cb[cb][level] == NULL) { + rtexture->cb[cb][level] = r600_texture_state_cb(rscreen, rtexture, cb, level); + if (rtexture->cb[cb][level] == NULL) { + R600_ERR("failed to create cb%d state for texture\n", cb); return -ENOMEM; } } diff --git a/src/gallium/drivers/r600/radeon.h b/src/gallium/drivers/r600/radeon.h index 046c264c04..3f1ca95f69 100644 --- a/src/gallium/drivers/r600/radeon.h +++ b/src/gallium/drivers/r600/radeon.h @@ -109,13 +109,11 @@ struct radeon_state { unsigned id; unsigned shader_index; unsigned nstates; - u32 *states; + u32 states[64]; unsigned npm4; unsigned cpm4; u32 pm4_crc; - u32 *pm4; - u32 nimmd; - u32 *immd; + u32 pm4[128]; unsigned nbo; struct radeon_bo *bo[4]; unsigned nreloc; @@ -130,6 +128,7 @@ struct radeon_state *radeon_state_shader(struct radeon *radeon, u32 type, u32 id struct radeon_state *radeon_state_incref(struct radeon_state *state); struct radeon_state *radeon_state_decref(struct radeon_state *state); int radeon_state_pm4(struct radeon_state *state); +int radeon_state_convert(struct radeon_state *state, u32 stype, u32 id, u32 shader_type); /* * draw functions @@ -219,7 +218,7 @@ enum r600_stype { R600_STATE_DB, R600_STATE_QUERY_BEGIN, R600_STATE_QUERY_END, - R600_STATE_CLIP, + R600_STATE_UCP, R600_STATE_VGT, R600_STATE_DRAW, }; @@ -613,17 +612,37 @@ enum { /* R600_DRAW */ #define R600_DRAW__VGT_NUM_INDICES 0 #define R600_DRAW__VGT_DMA_BASE_HI 1 -#define R600_DRAW__VGT_DMA_BASE 2 +#define R600_DRAW__VGT_DMA_BASE 2 #define R600_DRAW__VGT_DRAW_INITIATOR 3 -#define R600_DRAW_SIZE 4 -#define R600_DRAW_PM4 128 +#define R600_DRAW_SIZE 4 +#define R600_DRAW_PM4 128 /* R600_CLIP */ -#define R600_CLIP__PA_CL_UCP_X_0 0 -#define R600_CLIP__PA_CL_UCP_Y_0 1 -#define R600_CLIP__PA_CL_UCP_Z_0 2 -#define R600_CLIP__PA_CL_UCP_W_0 3 -#define R600_CLIP_SIZE 4 -#define R600_CLIP_PM4 128 +#define R600_CLIP__PA_CL_UCP_X_0 0 +#define R600_CLIP__PA_CL_UCP_Y_0 1 +#define R600_CLIP__PA_CL_UCP_Z_0 2 +#define R600_CLIP__PA_CL_UCP_W_0 3 +#define R600_CLIP__PA_CL_UCP_X_1 4 +#define R600_CLIP__PA_CL_UCP_Y_1 5 +#define R600_CLIP__PA_CL_UCP_Z_1 6 +#define R600_CLIP__PA_CL_UCP_W_1 7 +#define R600_CLIP__PA_CL_UCP_X_2 8 +#define R600_CLIP__PA_CL_UCP_Y_2 9 +#define R600_CLIP__PA_CL_UCP_Z_2 10 +#define R600_CLIP__PA_CL_UCP_W_2 11 +#define R600_CLIP__PA_CL_UCP_X_3 12 +#define R600_CLIP__PA_CL_UCP_Y_3 13 +#define R600_CLIP__PA_CL_UCP_Z_3 14 +#define R600_CLIP__PA_CL_UCP_W_3 15 +#define R600_CLIP__PA_CL_UCP_X_4 16 +#define R600_CLIP__PA_CL_UCP_Y_4 17 +#define R600_CLIP__PA_CL_UCP_Z_4 18 +#define R600_CLIP__PA_CL_UCP_W_4 19 +#define R600_CLIP__PA_CL_UCP_X_5 20 +#define R600_CLIP__PA_CL_UCP_Y_5 21 +#define R600_CLIP__PA_CL_UCP_Z_5 22 +#define R600_CLIP__PA_CL_UCP_W_5 23 +#define R600_CLIP_SIZE 24 +#define R600_CLIP_PM4 128 /* R600 QUERY BEGIN/END */ #define R600_QUERY__OFFSET 0 #define R600_QUERY_SIZE 1 diff --git a/src/gallium/winsys/r600/drm/r600_state.c b/src/gallium/winsys/r600/drm/r600_state.c index e3d0116a2d..f6a428e884 100644 --- a/src/gallium/winsys/r600/drm/r600_state.c +++ b/src/gallium/winsys/r600/drm/r600_state.c @@ -80,7 +80,7 @@ struct radeon_stype_info r600_stypes[] = { { R600_STATE_QUERY_BEGIN, 1, 0, r600_state_pm4_query_begin, SUB_NONE(VGT_EVENT) }, { R600_STATE_QUERY_END, 1, 0, r600_state_pm4_query_end, SUB_NONE(VGT_EVENT) }, { R600_STATE_DB, 1, 0, r600_state_pm4_db, SUB_NONE(DB) }, - { R600_STATE_CLIP, 6, 0, r600_state_pm4_generic, SUB_NONE(UCP) }, + { R600_STATE_UCP, 1, 0, r600_state_pm4_generic, SUB_NONE(UCP) }, { R600_STATE_VGT, 1, 0, r600_state_pm4_vgt, SUB_NONE(VGT) }, { R600_STATE_DRAW, 1, 0, r600_state_pm4_draw, SUB_NONE(DRAW) }, }; @@ -381,13 +381,6 @@ static int r600_state_pm4_draw(struct radeon_state *state) if (r) return r; state->pm4[state->cpm4++] = state->bo[0]->handle; - } else if (state->nimmd) { - state->pm4[state->cpm4++] = PKT3(PKT3_DRAW_INDEX_IMMD, state->nimmd + 1); - state->pm4[state->cpm4++] = state->states[R600_DRAW__VGT_NUM_INDICES]; - state->pm4[state->cpm4++] = state->states[R600_DRAW__VGT_DRAW_INITIATOR]; - for (i = 0; i < state->nimmd; i++) { - state->pm4[state->cpm4++] = state->immd[i]; - } } else { state->pm4[state->cpm4++] = PKT3(PKT3_DRAW_INDEX_AUTO, 1); state->pm4[state->cpm4++] = state->states[R600_DRAW__VGT_NUM_INDICES]; diff --git a/src/gallium/winsys/r600/drm/r600_states.h b/src/gallium/winsys/r600/drm/r600_states.h index 51b69b9220..09d79d498d 100644 --- a/src/gallium/winsys/r600/drm/r600_states.h +++ b/src/gallium/winsys/r600/drm/r600_states.h @@ -284,10 +284,30 @@ static const struct radeon_register R600_names_VS_CONSTANT[] = { }; static const struct radeon_register R600_names_UCP[] = { - {0x00028e20, 0, 0, "PA_CL_UCP0_X"}, - {0x00028e24, 0, 0, "PA_CL_UCP0_Y"}, - {0x00028e28, 0, 0, "PA_CL_UCP0_Z"}, - {0x00028e2c, 0, 0, "PA_CL_UCP0_W"}, + {0x00028E20, 0, 0, "PA_CL_UCP0_X"}, + {0x00028E24, 0, 0, "PA_CL_UCP0_Y"}, + {0x00028E28, 0, 0, "PA_CL_UCP0_Z"}, + {0x00028E2C, 0, 0, "PA_CL_UCP0_W"}, + {0x00028E30, 0, 0, "PA_CL_UCP1_X"}, + {0x00028E34, 0, 0, "PA_CL_UCP1_Y"}, + {0x00028E38, 0, 0, "PA_CL_UCP1_Z"}, + {0x00028E3C, 0, 0, "PA_CL_UCP1_W"}, + {0x00028E40, 0, 0, "PA_CL_UCP2_X"}, + {0x00028E44, 0, 0, "PA_CL_UCP2_Y"}, + {0x00028E48, 0, 0, "PA_CL_UCP2_Z"}, + {0x00028E4C, 0, 0, "PA_CL_UCP2_W"}, + {0x00028E50, 0, 0, "PA_CL_UCP3_X"}, + {0x00028E54, 0, 0, "PA_CL_UCP3_Y"}, + {0x00028E58, 0, 0, "PA_CL_UCP3_Z"}, + {0x00028E5C, 0, 0, "PA_CL_UCP3_W"}, + {0x00028E60, 0, 0, "PA_CL_UCP4_X"}, + {0x00028E64, 0, 0, "PA_CL_UCP4_Y"}, + {0x00028E68, 0, 0, "PA_CL_UCP4_Z"}, + {0x00028E6C, 0, 0, "PA_CL_UCP4_W"}, + {0x00028E70, 0, 0, "PA_CL_UCP5_X"}, + {0x00028E74, 0, 0, "PA_CL_UCP5_Y"}, + {0x00028E78, 0, 0, "PA_CL_UCP5_Z"}, + {0x00028E7C, 0, 0, "PA_CL_UCP5_W"}, }; static const struct radeon_register R600_names_PS_RESOURCE[] = { diff --git a/src/gallium/winsys/r600/drm/radeon_priv.h b/src/gallium/winsys/r600/drm/radeon_priv.h index 66ee5f2177..af5319efd1 100644 --- a/src/gallium/winsys/r600/drm/radeon_priv.h +++ b/src/gallium/winsys/r600/drm/radeon_priv.h @@ -38,19 +38,19 @@ struct radeon_register { }; struct radeon_sub_type { - int shader_type; - const struct radeon_register *regs; - unsigned nstates; + int shader_type; + const struct radeon_register *regs; + unsigned nstates; }; struct radeon_stype_info { - unsigned stype; - unsigned num; - unsigned stride; - radeon_state_pm4_t pm4; - struct radeon_sub_type reginfo[R600_SHADER_MAX]; - unsigned base_id; - unsigned npm4; + unsigned stype; + unsigned num; + unsigned stride; + radeon_state_pm4_t pm4; + struct radeon_sub_type reginfo[R600_SHADER_MAX]; + unsigned base_id; + unsigned npm4; }; struct radeon { diff --git a/src/gallium/winsys/r600/drm/radeon_state.c b/src/gallium/winsys/r600/drm/radeon_state.c index ef09fdfb96..d4e622cf7f 100644 --- a/src/gallium/winsys/r600/drm/radeon_state.c +++ b/src/gallium/winsys/r600/drm/radeon_state.c @@ -80,15 +80,59 @@ struct radeon_state *radeon_state_shader(struct radeon *radeon, u32 stype, u32 i state->refcount = 1; state->npm4 = found->npm4; state->nstates = found->reginfo[shader_index].nstates; - state->states = calloc(1, state->nstates * 4); - state->pm4 = calloc(1, found->npm4 * 4); - if (state->states == NULL || state->pm4 == NULL) { - radeon_state_decref(state); - return NULL; - } return state; } +int radeon_state_convert(struct radeon_state *state, u32 stype, u32 id, u32 shader_type) +{ + struct radeon_stype_info *found = NULL; + int i, j, shader_index = -1; + + if (state == NULL) + return 0; + /* traverse the stype array */ + for (i = 0; i < state->radeon->nstype; i++) { + /* if the type doesn't match, if the shader doesn't match */ + if (stype != state->radeon->stype[i].stype) + continue; + if (shader_type) { + for (j = 0; j < 4; j++) { + if (state->radeon->stype[i].reginfo[j].shader_type == shader_type) { + shader_index = j; + break; + } + } + if (shader_index == -1) + continue; + } else { + if (state->radeon->stype[i].reginfo[0].shader_type) + continue; + else + shader_index = 0; + } + if (id > state->radeon->stype[i].num) + continue; + + found = &state->radeon->stype[i]; + break; + } + + if (!found) { + fprintf(stderr, "%s invalid type %d/id %d/shader class %d\n", __func__, stype, id, shader_type); + return -EINVAL; + } + + if (found->reginfo[shader_index].nstates != state->nstates) { + fprintf(stderr, "invalid type change from (%d %d %d) to (%d %d %d)\n", + state->stype->stype, state->id, state->shader_index, stype, id, shader_index); + } + + state->stype = found; + state->id = id; + state->shader_index = shader_index; + return radeon_state_pm4(state); +} + struct radeon_state *radeon_state(struct radeon *radeon, u32 type, u32 id) { return radeon_state_shader(radeon, type, id, 0); @@ -134,9 +178,6 @@ struct radeon_state *radeon_state_decref(struct radeon_state *state) for (i = 0; i < state->nbo; i++) { state->bo[i] = radeon_bo_decref(state->radeon, state->bo[i]); } - free(state->immd); - free(state->states); - free(state->pm4); memset(state, 0, sizeof(*state)); free(state); return NULL; @@ -179,8 +220,9 @@ int radeon_state_pm4(struct radeon_state *state) { int r; - if (state == NULL || state->cpm4) + if (state == NULL) return 0; + state->cpm4 = 0; r = state->stype->pm4(state); if (r) { fprintf(stderr, "%s failed to build PM4 for state(%d %d)\n", -- cgit v1.2.3 From 66e4cb1cd5a55402606a09417349d2be8b009e89 Mon Sep 17 00:00:00 2001 From: Jerome Glisse Date: Mon, 30 Aug 2010 17:56:59 -0400 Subject: r600g: avoid dynamic allocation of states Make state statically allocated, this kills a bunch of code and avoid intensive use of malloc/free. There is still a lot of useless duplicate function wrapping that can be kill. This doesn't improve yet performance, needs to avoid memcpy states in radeon_ctx_set_draw and to avoid rebuilding vs_resources, dsa, scissor, cb_cntl, ... states at each draw command. Signed-off-by: Jerome Glisse --- src/gallium/drivers/r600/r600_blit.c | 415 +++++++---------------------- src/gallium/drivers/r600/r600_context.c | 142 +++++----- src/gallium/drivers/r600/r600_context.h | 31 +-- src/gallium/drivers/r600/r600_draw.c | 92 ++++--- src/gallium/drivers/r600/r600_query.c | 48 ++-- src/gallium/drivers/r600/r600_resource.h | 8 +- src/gallium/drivers/r600/r600_shader.c | 32 +-- src/gallium/drivers/r600/r600_state.c | 386 ++++++--------------------- src/gallium/drivers/r600/r600_texture.c | 100 ++----- src/gallium/drivers/r600/radeon.h | 72 ++--- src/gallium/targets/dri-r600/Makefile | 4 +- src/gallium/winsys/r600/drm/r600_state.c | 4 +- src/gallium/winsys/r600/drm/radeon.c | 26 +- src/gallium/winsys/r600/drm/radeon_ctx.c | 219 ++++++--------- src/gallium/winsys/r600/drm/radeon_draw.c | 113 +------- src/gallium/winsys/r600/drm/radeon_priv.h | 13 +- src/gallium/winsys/r600/drm/radeon_state.c | 55 +--- 17 files changed, 523 insertions(+), 1237 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/r600_blit.c b/src/gallium/drivers/r600/r600_blit.c index a8263ccbce..e6ded342e5 100644 --- a/src/gallium/drivers/r600/r600_blit.c +++ b/src/gallium/drivers/r600/r600_blit.c @@ -146,21 +146,20 @@ void r600_init_blit_functions(struct r600_context *rctx) struct r600_blit_states { - struct radeon_state *rasterizer; - struct radeon_state *dsa; - struct radeon_state *blend; - struct radeon_state *cb_cntl; - struct radeon_state *config; - struct radeon_state *vgt; - struct radeon_state *draw; - struct radeon_state *vs_constant0; - struct radeon_state *vs_constant1; - struct radeon_state *vs_constant2; - struct radeon_state *vs_constant3; - struct radeon_state *ps_shader; - struct radeon_state *vs_shader; - struct radeon_state *vs_resource0; - struct radeon_state *vs_resource1; + struct radeon_state rasterizer; + struct radeon_state dsa; + struct radeon_state blend; + struct radeon_state cb_cntl; + struct radeon_state vgt; + struct radeon_state draw; + struct radeon_state vs_constant0; + struct radeon_state vs_constant1; + struct radeon_state vs_constant2; + struct radeon_state vs_constant3; + struct radeon_state ps_shader; + struct radeon_state vs_shader; + struct radeon_state vs_resource0; + struct radeon_state vs_resource1; }; static int r600_blit_state_vs_resources(struct r600_screen *rscreen, struct r600_blit_states *bstates) @@ -190,11 +189,8 @@ static int r600_blit_state_vs_resources(struct r600_screen *rscreen, struct r600 memcpy(bo->data, vbo, 128); radeon_bo_unmap(rscreen->rw, bo); - rstate = radeon_state_shader(rscreen->rw, R600_STATE_RESOURCE, 0, R600_SHADER_VS); - if (rstate == NULL) { - radeon_bo_decref(rscreen->rw, bo); - return -ENOMEM; - } + rstate = &bstates->vs_resource0; + radeon_state_init(rstate, rscreen->rw, R600_STATE_RESOURCE, 0, R600_SHADER_VS); /* set states (most default value are 0 and struct already * initialized to 0, thus avoid resetting them) @@ -210,15 +206,12 @@ static int r600_blit_state_vs_resources(struct r600_screen *rscreen, struct r600 rstate->nbo = 1; rstate->placement[0] = RADEON_GEM_DOMAIN_GTT; if (radeon_state_pm4(rstate)) { - radeon_state_decref(rstate); + radeon_state_fini(rstate); return -ENOMEM; } - bstates->vs_resource0 = rstate; - rstate = radeon_state_shader(rscreen->rw, R600_STATE_RESOURCE, 1, R600_SHADER_VS); - if (rstate == NULL) { - return -ENOMEM; - } + rstate = &bstates->vs_resource1; + radeon_state_init(rstate, rscreen->rw, R600_STATE_RESOURCE, 1, R600_SHADER_VS); rstate->states[R600_VS_RESOURCE__RESOURCE160_WORD0] = 0x00000010; rstate->states[R600_VS_RESOURCE__RESOURCE160_WORD1] = 0x00000070; rstate->states[R600_VS_RESOURCE__RESOURCE160_WORD2] = 0x02302000; @@ -230,17 +223,15 @@ static int r600_blit_state_vs_resources(struct r600_screen *rscreen, struct r600 rstate->nbo = 1; rstate->placement[0] = RADEON_GEM_DOMAIN_GTT; if (radeon_state_pm4(rstate)) { - radeon_state_decref(rstate); + radeon_state_fini(rstate); return -ENOMEM; } - bstates->vs_resource1 = rstate; return 0; } -static struct radeon_state *r600_blit_state_vs_shader(struct r600_screen *rscreen) +static void r600_blit_state_vs_shader(struct r600_screen *rscreen, struct radeon_state *rstate) { - struct radeon_state *rstate; struct radeon_bo *bo; u32 shader_bc_r600[] = { 0x00000004, 0x81000400, @@ -282,11 +273,11 @@ static struct radeon_state *r600_blit_state_vs_shader(struct r600_screen *rscree /* simple shader */ bo = radeon_bo(rscreen->rw, 0, 128, 4096, NULL); if (bo == NULL) { - return NULL; + return; } if (radeon_bo_map(rscreen->rw, bo)) { radeon_bo_decref(rscreen->rw, bo); - return NULL; + return; } switch (rscreen->chip_class) { case R600: @@ -299,15 +290,11 @@ static struct radeon_state *r600_blit_state_vs_shader(struct r600_screen *rscree R600_ERR("unsupported chip family\n"); radeon_bo_unmap(rscreen->rw, bo); radeon_bo_decref(rscreen->rw, bo); - return NULL; + return; } radeon_bo_unmap(rscreen->rw, bo); - rstate = radeon_state_shader(rscreen->rw, R600_STATE_SHADER, 0, R600_SHADER_VS); - if (rstate == NULL) { - radeon_bo_decref(rscreen->rw, bo); - return NULL; - } + radeon_state_init(rstate, rscreen->rw, R600_STATE_SHADER, 0, R600_SHADER_VS); /* set states (most default value are 0 and struct already * initialized to 0, thus avoid resetting them) @@ -322,16 +309,11 @@ static struct radeon_state *r600_blit_state_vs_shader(struct r600_screen *rscree rstate->placement[0] = RADEON_GEM_DOMAIN_GTT; rstate->placement[2] = RADEON_GEM_DOMAIN_GTT; - if (radeon_state_pm4(rstate)) { - radeon_state_decref(rstate); - return NULL; - } - return rstate; + radeon_state_pm4(rstate); } -static struct radeon_state *r600_blit_state_ps_shader(struct r600_screen *rscreen) +static void r600_blit_state_ps_shader(struct r600_screen *rscreen, struct radeon_state *rstate) { - struct radeon_state *rstate; struct radeon_bo *bo; u32 shader_bc_r600[] = { 0x00000002, 0xA00C0000, @@ -354,10 +336,10 @@ static struct radeon_state *r600_blit_state_ps_shader(struct r600_screen *rscree bo = radeon_bo(rscreen->rw, 0, 128, 4096, NULL); if (bo == NULL) { radeon_bo_decref(rscreen->rw, bo); - return NULL; + return; } if (radeon_bo_map(rscreen->rw, bo)) { - return NULL; + return; } switch (rscreen->chip_class) { case R600: @@ -370,15 +352,11 @@ static struct radeon_state *r600_blit_state_ps_shader(struct r600_screen *rscree R600_ERR("unsupported chip family\n"); radeon_bo_unmap(rscreen->rw, bo); radeon_bo_decref(rscreen->rw, bo); - return NULL; + return; } radeon_bo_unmap(rscreen->rw, bo); - rstate = radeon_state_shader(rscreen->rw, R600_STATE_SHADER, 0, R600_SHADER_PS); - if (rstate == NULL) { - radeon_bo_decref(rscreen->rw, bo); - return NULL; - } + radeon_state_init(rstate, rscreen->rw, R600_STATE_SHADER, 0, R600_SHADER_PS); /* set states (most default value are 0 and struct already * initialized to 0, thus avoid resetting them) @@ -392,19 +370,12 @@ static struct radeon_state *r600_blit_state_ps_shader(struct r600_screen *rscree rstate->nbo = 1; rstate->placement[0] = RADEON_GEM_DOMAIN_GTT; - if (radeon_state_pm4(rstate)) { - radeon_state_decref(rstate); - return NULL; - } - return rstate; + radeon_state_pm4(rstate); } -static struct radeon_state *r600_blit_state_vgt(struct r600_screen *rscreen) +static void r600_blit_state_vgt(struct r600_screen *rscreen, struct radeon_state *rstate) { - struct radeon_state *rstate; - - rstate = radeon_state(rscreen->rw, R600_STATE_VGT, 0); if (rstate == NULL) - return NULL; + radeon_state_init(rstate, rscreen->rw, R600_STATE_VGT, 0, 0); /* set states (most default value are 0 and struct already * initialized to 0, thus avoid resetting them) @@ -413,20 +384,12 @@ static struct radeon_state *r600_blit_state_vgt(struct r600_screen *rscreen) rstate->states[R600_VGT__VGT_MAX_VTX_INDX] = 0x00FFFFFF; rstate->states[R600_VGT__VGT_PRIMITIVE_TYPE] = 0x00000005; - if (radeon_state_pm4(rstate)) { - radeon_state_decref(rstate); - return NULL; - } - return rstate; + radeon_state_pm4(rstate); } -static struct radeon_state *r600_blit_state_draw(struct r600_screen *rscreen) +static void r600_blit_state_draw(struct r600_screen *rscreen, struct radeon_state *rstate) { - struct radeon_state *rstate; - - rstate = radeon_state(rscreen->rw, R600_STATE_DRAW, 0); - if (rstate == NULL) - return NULL; + radeon_state_init(rstate, rscreen->rw, R600_STATE_DRAW, 0, 0); /* set states (most default value are 0 and struct already * initialized to 0, thus avoid resetting them) @@ -434,22 +397,13 @@ static struct radeon_state *r600_blit_state_draw(struct r600_screen *rscreen) rstate->states[R600_DRAW__VGT_DRAW_INITIATOR] = 0x00000002; rstate->states[R600_DRAW__VGT_NUM_INDICES] = 0x00000004; - if (radeon_state_pm4(rstate)) { - radeon_state_decref(rstate); - return NULL; - } - return rstate; + radeon_state_pm4(rstate); } -static struct radeon_state *r600_blit_state_vs_constant(struct r600_screen *rscreen, - unsigned id, float c0, float c1, - float c2, float c3) +static void r600_blit_state_vs_constant(struct r600_screen *rscreen, struct radeon_state *rstate, + unsigned id, float c0, float c1, float c2, float c3) { - struct radeon_state *rstate; - - rstate = radeon_state_shader(rscreen->rw, R600_STATE_CONSTANT, id, R600_SHADER_VS); - if (rstate == NULL) - return NULL; + radeon_state_init(rstate, rscreen->rw, R600_STATE_CONSTANT, id, R600_SHADER_VS); /* set states (most default value are 0 and struct already * initialized to 0, thus avoid resetting them) @@ -459,20 +413,12 @@ static struct radeon_state *r600_blit_state_vs_constant(struct r600_screen *rscr rstate->states[R600_VS_CONSTANT__SQ_ALU_CONSTANT2_256] = fui(c2); rstate->states[R600_VS_CONSTANT__SQ_ALU_CONSTANT3_256] = fui(c3); - if (radeon_state_pm4(rstate)) { - radeon_state_decref(rstate); - return NULL; - } - return rstate; + radeon_state_pm4(rstate); } -static struct radeon_state *r600_blit_state_rasterizer(struct r600_screen *rscreen) +static void r600_blit_state_rasterizer(struct r600_screen *rscreen, struct radeon_state *rstate) { - struct radeon_state *rstate; - - rstate = radeon_state(rscreen->rw, R600_STATE_RASTERIZER, 0); - if (rstate == NULL) - return NULL; + radeon_state_init(rstate, rscreen->rw, R600_STATE_RASTERIZER, 0, 0); /* set states (most default value are 0 and struct already * initialized to 0, thus avoid resetting them) @@ -488,20 +434,12 @@ static struct radeon_state *r600_blit_state_rasterizer(struct r600_screen *rscre rstate->states[R600_RASTERIZER__PA_SU_SC_MODE_CNTL] = 0x00080004; rstate->states[R600_RASTERIZER__SPI_INTERP_CONTROL_0] = 0x00000001; - if (radeon_state_pm4(rstate)) { - radeon_state_decref(rstate); - return NULL; - } - return rstate; + radeon_state_pm4(rstate); } -static struct radeon_state *r600_blit_state_dsa(struct r600_screen *rscreen) +static void r600_blit_state_dsa(struct r600_screen *rscreen, struct radeon_state *rstate) { - struct radeon_state *rstate; - - rstate = radeon_state(rscreen->rw, R600_STATE_DSA, 0); - if (rstate == NULL) - return NULL; + radeon_state_init(rstate, rscreen->rw, R600_STATE_DSA, 0, 0); /* set states (most default value are 0 and struct already * initialized to 0, thus avoid resetting them) @@ -512,43 +450,18 @@ static struct radeon_state *r600_blit_state_dsa(struct r600_screen *rscreen) rstate->states[R600_DSA__DB_RENDER_OVERRIDE] = 0x0000002A; rstate->states[R600_DSA__DB_SHADER_CONTROL] = 0x00000210; - if (radeon_state_pm4(rstate)) { - radeon_state_decref(rstate); - return NULL; - } - return rstate; + radeon_state_pm4(rstate); } -static struct radeon_state *r600_blit_state_blend(struct r600_screen *rscreen) +static void r600_blit_state_blend(struct r600_screen *rscreen, struct radeon_state *rstate) { - struct radeon_state *rstate; - - rstate = radeon_state(rscreen->rw, R600_STATE_BLEND, 0); - if (rstate == NULL) - return NULL; - - /* set states (most default value are 0 and struct already - * initialized to 0, thus avoid resetting them) - */ - - if (radeon_state_pm4(rstate)) { - radeon_state_decref(rstate); - return NULL; - } - return rstate; + radeon_state_init(rstate, rscreen->rw, R600_STATE_BLEND, 0, 0); + radeon_state_pm4(rstate); } -static struct radeon_state *r600_blit_state_cb_cntl(struct r600_screen *rscreen) +static void r600_blit_state_cb_cntl(struct r600_screen *rscreen, struct radeon_state *rstate) { - struct radeon_state *rstate; - - rstate = radeon_state(rscreen->rw, R600_STATE_CB_CNTL, 0); - if (rstate == NULL) - return NULL; - - /* set states (most default value are 0 and struct already - * initialized to 0, thus avoid resetting them) - */ + radeon_state_init(rstate, rscreen->rw, R600_STATE_CB_CNTL, 0, 0); rstate->states[R600_CB_CNTL__CB_CLRCMP_CONTROL] = 0x01000000; rstate->states[R600_CB_CNTL__CB_CLRCMP_DST] = 0x000000FF; rstate->states[R600_CB_CNTL__CB_CLRCMP_MSK] = 0xFFFFFFFF; @@ -556,113 +469,42 @@ static struct radeon_state *r600_blit_state_cb_cntl(struct r600_screen *rscreen) rstate->states[R600_CB_CNTL__CB_SHADER_MASK] = 0x0000000F; rstate->states[R600_CB_CNTL__CB_TARGET_MASK] = 0x0000000F; rstate->states[R600_CB_CNTL__PA_SC_AA_MASK] = 0xFFFFFFFF; - - if (radeon_state_pm4(rstate)) { - radeon_state_decref(rstate); - return NULL; - } - return rstate; + radeon_state_pm4(rstate); } static int r600_blit_states_init(struct pipe_context *ctx, struct r600_blit_states *bstates) { struct r600_screen *rscreen = r600_screen(ctx->screen); - struct r600_context *rctx = r600_context(ctx); - int r; - bstates->ps_shader = r600_blit_state_ps_shader(rscreen); - if (bstates->ps_shader == NULL) { - R600_ERR("failed creating ps_shader state\n"); - return -ENOMEM; - } - bstates->vs_shader = r600_blit_state_vs_shader(rscreen); - if (bstates->vs_shader == NULL) { - R600_ERR("failed creating vs_shader state\n"); - return -ENOMEM; - } - bstates->vgt = r600_blit_state_vgt(rscreen); - if (bstates->vgt == NULL) { - R600_ERR("failed creating vgt state\n"); - return -ENOMEM; - } - bstates->draw = r600_blit_state_draw(rscreen); - if (bstates->draw == NULL) { - R600_ERR("failed creating draw state\n"); - return -ENOMEM; - } - bstates->vs_constant0 = r600_blit_state_vs_constant(rscreen, 0, 1.0, 0.0, 0.0, 0.0); - if (bstates->vs_constant0 == NULL) { - R600_ERR("failed creating vs_constant0 state\n"); - return -ENOMEM; - } - bstates->vs_constant1 = r600_blit_state_vs_constant(rscreen, 1, 0.0, 1.0, 0.0, 0.0); - if (bstates->vs_constant1 == NULL) { - R600_ERR("failed creating vs_constant1 state\n"); - return -ENOMEM; - } - bstates->vs_constant2 = r600_blit_state_vs_constant(rscreen, 2, 0.0, 0.0, -0.00199900055, 0.0); - if (bstates->vs_constant2 == NULL) { - R600_ERR("failed creating vs_constant2 state\n"); - return -ENOMEM; - } - bstates->vs_constant3 = r600_blit_state_vs_constant(rscreen, 3, 0.0, 0.0, -0.99900049, 1.0); - if (bstates->vs_constant3 == NULL) { - R600_ERR("failed creating vs_constant3 state\n"); - return -ENOMEM; - } - bstates->rasterizer = r600_blit_state_rasterizer(rscreen); - if (bstates->rasterizer == NULL) { - R600_ERR("failed creating rasterizer state\n"); - return -ENOMEM; - } - bstates->dsa = r600_blit_state_dsa(rscreen); - if (bstates->dsa == NULL) { - R600_ERR("failed creating dsa state\n"); - return -ENOMEM; - } - bstates->blend = r600_blit_state_blend(rscreen); - if (bstates->blend == NULL) { - R600_ERR("failed creating blend state\n"); - return -ENOMEM; - } - bstates->cb_cntl = r600_blit_state_cb_cntl(rscreen); - if (bstates->cb_cntl == NULL) { - R600_ERR("failed creating cb_cntl state\n"); - return -ENOMEM; - } - r = r600_blit_state_vs_resources(rscreen, bstates); - if (r) { - R600_ERR("failed creating vs_resource state\n"); - return r; - } - bstates->config = radeon_state_incref(rctx->hw_states.config); + r600_blit_state_ps_shader(rscreen, &bstates->ps_shader); + r600_blit_state_vs_shader(rscreen, &bstates->vs_shader); + r600_blit_state_vgt(rscreen, &bstates->vgt); + r600_blit_state_draw(rscreen, &bstates->draw); + r600_blit_state_vs_constant(rscreen, &bstates->vs_constant0, 0, 1.0, 0.0, 0.0, 0.0); + r600_blit_state_vs_constant(rscreen, &bstates->vs_constant1, 1, 0.0, 1.0, 0.0, 0.0); + r600_blit_state_vs_constant(rscreen, &bstates->vs_constant2, 2, 0.0, 0.0, -0.00199900055, 0.0); + r600_blit_state_vs_constant(rscreen, &bstates->vs_constant3, 3, 0.0, 0.0, -0.99900049, 1.0); + r600_blit_state_rasterizer(rscreen, &bstates->rasterizer); + r600_blit_state_dsa(rscreen, &bstates->dsa); + r600_blit_state_blend(rscreen, &bstates->blend); + r600_blit_state_cb_cntl(rscreen, &bstates->cb_cntl); + r600_blit_state_vs_resources(rscreen, bstates); return 0; } static void r600_blit_states_destroy(struct pipe_context *ctx, struct r600_blit_states *bstates) { - radeon_state_decref(bstates->rasterizer); - radeon_state_decref(bstates->dsa); - radeon_state_decref(bstates->blend); - radeon_state_decref(bstates->cb_cntl); - radeon_state_decref(bstates->config); - radeon_state_decref(bstates->vgt); - radeon_state_decref(bstates->draw); - radeon_state_decref(bstates->vs_constant0); - radeon_state_decref(bstates->vs_constant1); - radeon_state_decref(bstates->vs_constant2); - radeon_state_decref(bstates->vs_constant3); - radeon_state_decref(bstates->ps_shader); - radeon_state_decref(bstates->vs_shader); - radeon_state_decref(bstates->vs_resource0); - radeon_state_decref(bstates->vs_resource1); + radeon_state_fini(&bstates->ps_shader); + radeon_state_fini(&bstates->vs_shader); + radeon_state_fini(&bstates->vs_resource0); + radeon_state_fini(&bstates->vs_resource1); } int r600_blit_uncompress_depth(struct pipe_context *ctx, struct r600_resource_texture *rtexture, unsigned level) { struct r600_screen *rscreen = r600_screen(ctx->screen); struct r600_context *rctx = r600_context(ctx); - struct radeon_draw *draw = NULL; + struct radeon_draw draw; struct r600_blit_states bstates; int r; @@ -687,108 +529,51 @@ int r600_blit_uncompress_depth(struct pipe_context *ctx, struct r600_resource_te if (r) { return r; } - bstates.dsa->states[R600_DSA__DB_RENDER_CONTROL] = 0x0000008C; - bstates.cb_cntl->states[R600_CB_CNTL__CB_TARGET_MASK] = 0x00000001; + bstates.dsa.states[R600_DSA__DB_RENDER_CONTROL] = 0x0000008C; + bstates.cb_cntl.states[R600_CB_CNTL__CB_TARGET_MASK] = 0x00000001; /* force rebuild */ - bstates.dsa->cpm4 = bstates.cb_cntl->cpm4 = 0; - if (radeon_state_pm4(bstates.dsa)) { + bstates.dsa.cpm4 = bstates.cb_cntl.cpm4 = 0; + if (radeon_state_pm4(&bstates.dsa)) { goto out; } - if (radeon_state_pm4(bstates.cb_cntl)) { + if (radeon_state_pm4(&bstates.cb_cntl)) { goto out; } - draw = radeon_draw(rscreen->rw); - if (draw == NULL) { + r = radeon_draw_init(&draw, rscreen->rw); + if (r) { R600_ERR("failed creating draw for uncompressing textures\n"); goto out; } - r = radeon_draw_set(draw, bstates.vs_shader); - if (r) { - goto out; - } - r = radeon_draw_set(draw, bstates.ps_shader); - if (r) { - goto out; - } - r = radeon_draw_set(draw, bstates.rasterizer); - if (r) { - goto out; - } - r = radeon_draw_set(draw, bstates.dsa); - if (r) { - goto out; - } - r = radeon_draw_set(draw, bstates.blend); - if (r) { - goto out; - } - r = radeon_draw_set(draw, bstates.cb_cntl); - if (r) { - goto out; - } - r = radeon_draw_set(draw, bstates.config); - if (r) { - goto out; - } - r = radeon_draw_set(draw, bstates.vgt); - if (r) { - goto out; - } - r = radeon_draw_set(draw, bstates.draw); - if (r) { - goto out; - } - r = radeon_draw_set(draw, bstates.vs_resource0); - if (r) { - goto out; - } - r = radeon_draw_set(draw, bstates.vs_resource1); - if (r) { - goto out; - } - r = radeon_draw_set(draw, bstates.vs_constant0); - if (r) { - goto out; - } - r = radeon_draw_set(draw, bstates.vs_constant1); - if (r) { - goto out; - } - r = radeon_draw_set(draw, bstates.vs_constant2); - if (r) { - goto out; - } - r = radeon_draw_set(draw, bstates.vs_constant3); - if (r) { - goto out; - } - r = radeon_draw_set(draw, rtexture->viewport[level]); - if (r) { - goto out; - } - r = radeon_draw_set(draw, rtexture->scissor[level]); - if (r) { - goto out; - } - r = radeon_draw_set(draw, rtexture->cb[0][level]); - if (r) { - goto out; - } - r = radeon_draw_set(draw, rtexture->db[level]); - if (r) { - goto out; - } + radeon_draw_bind(&draw, &bstates.vs_shader); + radeon_draw_bind(&draw, &bstates.ps_shader); + radeon_draw_bind(&draw, &bstates.rasterizer); + radeon_draw_bind(&draw, &bstates.dsa); + radeon_draw_bind(&draw, &bstates.blend); + radeon_draw_bind(&draw, &bstates.cb_cntl); + radeon_draw_bind(&draw, &rctx->config); + radeon_draw_bind(&draw, &bstates.vgt); + radeon_draw_bind(&draw, &bstates.draw); + radeon_draw_bind(&draw, &bstates.vs_resource0); + radeon_draw_bind(&draw, &bstates.vs_resource1); + radeon_draw_bind(&draw, &bstates.vs_constant0); + radeon_draw_bind(&draw, &bstates.vs_constant1); + radeon_draw_bind(&draw, &bstates.vs_constant2); + radeon_draw_bind(&draw, &bstates.vs_constant3); + radeon_draw_bind(&draw, &rtexture->viewport[level]); + radeon_draw_bind(&draw, &rtexture->scissor[level]); + radeon_draw_bind(&draw, &rtexture->cb[0][level]); + radeon_draw_bind(&draw, &rtexture->db[level]); /* suspend queries */ r600_queries_suspend(ctx); /* schedule draw*/ - r = radeon_ctx_set_draw_new(rctx->ctx, draw); + r = radeon_ctx_set_draw(&rctx->ctx, &draw); if (r == -EBUSY) { r600_flush(ctx, 0, NULL); - r = radeon_ctx_set_draw_new(rctx->ctx, draw); + r = radeon_ctx_set_draw(&rctx->ctx, &draw); } if (r) { goto out; diff --git a/src/gallium/drivers/r600/r600_context.c b/src/gallium/drivers/r600/r600_context.c index db170122dd..95e9b6a8ed 100644 --- a/src/gallium/drivers/r600/r600_context.c +++ b/src/gallium/drivers/r600/r600_context.c @@ -46,35 +46,31 @@ void r600_flush(struct pipe_context *ctx, unsigned flags, struct pipe_fence_handle **fence) { struct r600_context *rctx = r600_context(ctx); - struct r600_screen *rscreen = rctx->screen; struct r600_query *rquery; static int dc = 0; char dname[256]; /* suspend queries */ r600_queries_suspend(ctx); - if (radeon_ctx_pm4(rctx->ctx)) - goto out; /* FIXME dumping should be removed once shader support instructions * without throwing bad code */ - if (!rctx->ctx->cpm4) + if (!rctx->ctx.cdwords) goto out; sprintf(dname, "gallium-%08d.bof", dc); if (dc < 2) { - radeon_ctx_dump_bof(rctx->ctx, dname); + radeon_ctx_dump_bof(&rctx->ctx, dname); R600_ERR("dumped %s\n", dname); } #if 1 - radeon_ctx_submit(rctx->ctx); + radeon_ctx_submit(&rctx->ctx); #endif LIST_FOR_EACH_ENTRY(rquery, &rctx->query_list, list) { rquery->flushed = true; } dc++; out: - rctx->ctx = radeon_ctx_decref(rctx->ctx); - rctx->ctx = radeon_ctx(rscreen->rw); + radeon_ctx_clear(&rctx->ctx); /* resume queries */ r600_queries_resume(ctx); } @@ -218,9 +214,9 @@ static void r600_init_config(struct r600_context *rctx) num_es_stack_entries = 0; break; } - rctx->hw_states.config = radeon_state(rctx->rw, R600_STATE_CONFIG, 0); + radeon_state_init(&rctx->config, rctx->rw, R600_STATE_CONFIG, 0, 0); - rctx->hw_states.config->states[R600_CONFIG__SQ_CONFIG] = 0x00000000; + rctx->config.states[R600_CONFIG__SQ_CONFIG] = 0x00000000; switch (family) { case CHIP_RV610: case CHIP_RV620: @@ -229,75 +225,75 @@ static void r600_init_config(struct r600_context *rctx) case CHIP_RV710: break; default: - rctx->hw_states.config->states[R600_CONFIG__SQ_CONFIG] |= S_008C00_VC_ENABLE(1); + rctx->config.states[R600_CONFIG__SQ_CONFIG] |= S_008C00_VC_ENABLE(1); break; } - rctx->hw_states.config->states[R600_CONFIG__SQ_CONFIG] |= S_008C00_DX9_CONSTS(1); - rctx->hw_states.config->states[R600_CONFIG__SQ_CONFIG] |= S_008C00_ALU_INST_PREFER_VECTOR(1); - rctx->hw_states.config->states[R600_CONFIG__SQ_CONFIG] |= S_008C00_PS_PRIO(ps_prio); - rctx->hw_states.config->states[R600_CONFIG__SQ_CONFIG] |= S_008C00_VS_PRIO(vs_prio); - rctx->hw_states.config->states[R600_CONFIG__SQ_CONFIG] |= S_008C00_GS_PRIO(gs_prio); - rctx->hw_states.config->states[R600_CONFIG__SQ_CONFIG] |= S_008C00_ES_PRIO(es_prio); + rctx->config.states[R600_CONFIG__SQ_CONFIG] |= S_008C00_DX9_CONSTS(1); + rctx->config.states[R600_CONFIG__SQ_CONFIG] |= S_008C00_ALU_INST_PREFER_VECTOR(1); + rctx->config.states[R600_CONFIG__SQ_CONFIG] |= S_008C00_PS_PRIO(ps_prio); + rctx->config.states[R600_CONFIG__SQ_CONFIG] |= S_008C00_VS_PRIO(vs_prio); + rctx->config.states[R600_CONFIG__SQ_CONFIG] |= S_008C00_GS_PRIO(gs_prio); + rctx->config.states[R600_CONFIG__SQ_CONFIG] |= S_008C00_ES_PRIO(es_prio); - rctx->hw_states.config->states[R600_CONFIG__SQ_GPR_RESOURCE_MGMT_1] = 0; - rctx->hw_states.config->states[R600_CONFIG__SQ_GPR_RESOURCE_MGMT_1] |= S_008C04_NUM_PS_GPRS(num_ps_gprs); - rctx->hw_states.config->states[R600_CONFIG__SQ_GPR_RESOURCE_MGMT_1] |= S_008C04_NUM_VS_GPRS(num_vs_gprs); - rctx->hw_states.config->states[R600_CONFIG__SQ_GPR_RESOURCE_MGMT_1] |= S_008C04_NUM_CLAUSE_TEMP_GPRS(num_temp_gprs); + rctx->config.states[R600_CONFIG__SQ_GPR_RESOURCE_MGMT_1] = 0; + rctx->config.states[R600_CONFIG__SQ_GPR_RESOURCE_MGMT_1] |= S_008C04_NUM_PS_GPRS(num_ps_gprs); + rctx->config.states[R600_CONFIG__SQ_GPR_RESOURCE_MGMT_1] |= S_008C04_NUM_VS_GPRS(num_vs_gprs); + rctx->config.states[R600_CONFIG__SQ_GPR_RESOURCE_MGMT_1] |= S_008C04_NUM_CLAUSE_TEMP_GPRS(num_temp_gprs); - rctx->hw_states.config->states[R600_CONFIG__SQ_GPR_RESOURCE_MGMT_2] = 0; - rctx->hw_states.config->states[R600_CONFIG__SQ_GPR_RESOURCE_MGMT_2] |= S_008C08_NUM_GS_GPRS(num_gs_gprs); - rctx->hw_states.config->states[R600_CONFIG__SQ_GPR_RESOURCE_MGMT_2] |= S_008C08_NUM_GS_GPRS(num_es_gprs); + rctx->config.states[R600_CONFIG__SQ_GPR_RESOURCE_MGMT_2] = 0; + rctx->config.states[R600_CONFIG__SQ_GPR_RESOURCE_MGMT_2] |= S_008C08_NUM_GS_GPRS(num_gs_gprs); + rctx->config.states[R600_CONFIG__SQ_GPR_RESOURCE_MGMT_2] |= S_008C08_NUM_GS_GPRS(num_es_gprs); - rctx->hw_states.config->states[R600_CONFIG__SQ_THREAD_RESOURCE_MGMT] = 0; - rctx->hw_states.config->states[R600_CONFIG__SQ_THREAD_RESOURCE_MGMT] |= S_008C0C_NUM_PS_THREADS(num_ps_threads); - rctx->hw_states.config->states[R600_CONFIG__SQ_THREAD_RESOURCE_MGMT] |= S_008C0C_NUM_VS_THREADS(num_vs_threads); - rctx->hw_states.config->states[R600_CONFIG__SQ_THREAD_RESOURCE_MGMT] |= S_008C0C_NUM_GS_THREADS(num_gs_threads); - rctx->hw_states.config->states[R600_CONFIG__SQ_THREAD_RESOURCE_MGMT] |= S_008C0C_NUM_ES_THREADS(num_es_threads); + rctx->config.states[R600_CONFIG__SQ_THREAD_RESOURCE_MGMT] = 0; + rctx->config.states[R600_CONFIG__SQ_THREAD_RESOURCE_MGMT] |= S_008C0C_NUM_PS_THREADS(num_ps_threads); + rctx->config.states[R600_CONFIG__SQ_THREAD_RESOURCE_MGMT] |= S_008C0C_NUM_VS_THREADS(num_vs_threads); + rctx->config.states[R600_CONFIG__SQ_THREAD_RESOURCE_MGMT] |= S_008C0C_NUM_GS_THREADS(num_gs_threads); + rctx->config.states[R600_CONFIG__SQ_THREAD_RESOURCE_MGMT] |= S_008C0C_NUM_ES_THREADS(num_es_threads); - rctx->hw_states.config->states[R600_CONFIG__SQ_STACK_RESOURCE_MGMT_1] = 0; - rctx->hw_states.config->states[R600_CONFIG__SQ_STACK_RESOURCE_MGMT_1] |= S_008C10_NUM_PS_STACK_ENTRIES(num_ps_stack_entries); - rctx->hw_states.config->states[R600_CONFIG__SQ_STACK_RESOURCE_MGMT_1] |= S_008C10_NUM_VS_STACK_ENTRIES(num_vs_stack_entries); + rctx->config.states[R600_CONFIG__SQ_STACK_RESOURCE_MGMT_1] = 0; + rctx->config.states[R600_CONFIG__SQ_STACK_RESOURCE_MGMT_1] |= S_008C10_NUM_PS_STACK_ENTRIES(num_ps_stack_entries); + rctx->config.states[R600_CONFIG__SQ_STACK_RESOURCE_MGMT_1] |= S_008C10_NUM_VS_STACK_ENTRIES(num_vs_stack_entries); - rctx->hw_states.config->states[R600_CONFIG__SQ_STACK_RESOURCE_MGMT_2] = 0; - rctx->hw_states.config->states[R600_CONFIG__SQ_STACK_RESOURCE_MGMT_2] |= S_008C14_NUM_GS_STACK_ENTRIES(num_gs_stack_entries); - rctx->hw_states.config->states[R600_CONFIG__SQ_STACK_RESOURCE_MGMT_2] |= S_008C14_NUM_ES_STACK_ENTRIES(num_es_stack_entries); + rctx->config.states[R600_CONFIG__SQ_STACK_RESOURCE_MGMT_2] = 0; + rctx->config.states[R600_CONFIG__SQ_STACK_RESOURCE_MGMT_2] |= S_008C14_NUM_GS_STACK_ENTRIES(num_gs_stack_entries); + rctx->config.states[R600_CONFIG__SQ_STACK_RESOURCE_MGMT_2] |= S_008C14_NUM_ES_STACK_ENTRIES(num_es_stack_entries); - rctx->hw_states.config->states[R600_CONFIG__SQ_DYN_GPR_CNTL_PS_FLUSH_REQ] = 0x00004000; - rctx->hw_states.config->states[R600_CONFIG__TA_CNTL_AUX] = 0x07000002; - rctx->hw_states.config->states[R600_CONFIG__VC_ENHANCE] = 0x00000000; - rctx->hw_states.config->states[R600_CONFIG__DB_DEBUG] = 0x00000000; - rctx->hw_states.config->states[R600_CONFIG__DB_WATERMARKS] = 0x00420204; - rctx->hw_states.config->states[R600_CONFIG__SX_MISC] = 0x00000000; - rctx->hw_states.config->states[R600_CONFIG__SPI_THREAD_GROUPING] = 0x00000001; - rctx->hw_states.config->states[R600_CONFIG__CB_SHADER_CONTROL] = 0x00000003; - rctx->hw_states.config->states[R600_CONFIG__SQ_ESGS_RING_ITEMSIZE] = 0x00000000; - rctx->hw_states.config->states[R600_CONFIG__SQ_GSVS_RING_ITEMSIZE] = 0x00000000; - rctx->hw_states.config->states[R600_CONFIG__SQ_ESTMP_RING_ITEMSIZE] = 0x00000000; - rctx->hw_states.config->states[R600_CONFIG__SQ_GSTMP_RING_ITEMSIZE] = 0x00000000; - rctx->hw_states.config->states[R600_CONFIG__SQ_VSTMP_RING_ITEMSIZE] = 0x00000000; - rctx->hw_states.config->states[R600_CONFIG__SQ_PSTMP_RING_ITEMSIZE] = 0x00000000; - rctx->hw_states.config->states[R600_CONFIG__SQ_FBUF_RING_ITEMSIZE] = 0x00000000; - rctx->hw_states.config->states[R600_CONFIG__SQ_REDUC_RING_ITEMSIZE] = 0x00000000; - rctx->hw_states.config->states[R600_CONFIG__SQ_GS_VERT_ITEMSIZE] = 0x00000000; - rctx->hw_states.config->states[R600_CONFIG__VGT_OUTPUT_PATH_CNTL] = 0x00000000; - rctx->hw_states.config->states[R600_CONFIG__VGT_HOS_CNTL] = 0x00000000; - rctx->hw_states.config->states[R600_CONFIG__VGT_HOS_MAX_TESS_LEVEL] = 0x00000000; - rctx->hw_states.config->states[R600_CONFIG__VGT_HOS_MIN_TESS_LEVEL] = 0x00000000; - rctx->hw_states.config->states[R600_CONFIG__VGT_HOS_REUSE_DEPTH] = 0x00000000; - rctx->hw_states.config->states[R600_CONFIG__VGT_GROUP_PRIM_TYPE] = 0x00000000; - rctx->hw_states.config->states[R600_CONFIG__VGT_GROUP_FIRST_DECR] = 0x00000000; - rctx->hw_states.config->states[R600_CONFIG__VGT_GROUP_DECR] = 0x00000000; - rctx->hw_states.config->states[R600_CONFIG__VGT_GROUP_VECT_0_CNTL] = 0x00000000; - rctx->hw_states.config->states[R600_CONFIG__VGT_GROUP_VECT_1_CNTL] = 0x00000000; - rctx->hw_states.config->states[R600_CONFIG__VGT_GROUP_VECT_0_FMT_CNTL] = 0x00000000; - rctx->hw_states.config->states[R600_CONFIG__VGT_GROUP_VECT_1_FMT_CNTL] = 0x00000000; - rctx->hw_states.config->states[R600_CONFIG__VGT_GS_MODE] = 0x00000000; - rctx->hw_states.config->states[R600_CONFIG__PA_SC_MODE_CNTL] = 0x00514000; - rctx->hw_states.config->states[R600_CONFIG__VGT_STRMOUT_EN] = 0x00000000; - rctx->hw_states.config->states[R600_CONFIG__VGT_REUSE_OFF] = 0x00000001; - rctx->hw_states.config->states[R600_CONFIG__VGT_VTX_CNT_EN] = 0x00000000; - rctx->hw_states.config->states[R600_CONFIG__VGT_STRMOUT_BUFFER_EN] = 0x00000000; - radeon_state_pm4(rctx->hw_states.config); + rctx->config.states[R600_CONFIG__SQ_DYN_GPR_CNTL_PS_FLUSH_REQ] = 0x00004000; + rctx->config.states[R600_CONFIG__TA_CNTL_AUX] = 0x07000002; + rctx->config.states[R600_CONFIG__VC_ENHANCE] = 0x00000000; + rctx->config.states[R600_CONFIG__DB_DEBUG] = 0x00000000; + rctx->config.states[R600_CONFIG__DB_WATERMARKS] = 0x00420204; + rctx->config.states[R600_CONFIG__SX_MISC] = 0x00000000; + rctx->config.states[R600_CONFIG__SPI_THREAD_GROUPING] = 0x00000001; + rctx->config.states[R600_CONFIG__CB_SHADER_CONTROL] = 0x00000003; + rctx->config.states[R600_CONFIG__SQ_ESGS_RING_ITEMSIZE] = 0x00000000; + rctx->config.states[R600_CONFIG__SQ_GSVS_RING_ITEMSIZE] = 0x00000000; + rctx->config.states[R600_CONFIG__SQ_ESTMP_RING_ITEMSIZE] = 0x00000000; + rctx->config.states[R600_CONFIG__SQ_GSTMP_RING_ITEMSIZE] = 0x00000000; + rctx->config.states[R600_CONFIG__SQ_VSTMP_RING_ITEMSIZE] = 0x00000000; + rctx->config.states[R600_CONFIG__SQ_PSTMP_RING_ITEMSIZE] = 0x00000000; + rctx->config.states[R600_CONFIG__SQ_FBUF_RING_ITEMSIZE] = 0x00000000; + rctx->config.states[R600_CONFIG__SQ_REDUC_RING_ITEMSIZE] = 0x00000000; + rctx->config.states[R600_CONFIG__SQ_GS_VERT_ITEMSIZE] = 0x00000000; + rctx->config.states[R600_CONFIG__VGT_OUTPUT_PATH_CNTL] = 0x00000000; + rctx->config.states[R600_CONFIG__VGT_HOS_CNTL] = 0x00000000; + rctx->config.states[R600_CONFIG__VGT_HOS_MAX_TESS_LEVEL] = 0x00000000; + rctx->config.states[R600_CONFIG__VGT_HOS_MIN_TESS_LEVEL] = 0x00000000; + rctx->config.states[R600_CONFIG__VGT_HOS_REUSE_DEPTH] = 0x00000000; + rctx->config.states[R600_CONFIG__VGT_GROUP_PRIM_TYPE] = 0x00000000; + rctx->config.states[R600_CONFIG__VGT_GROUP_FIRST_DECR] = 0x00000000; + rctx->config.states[R600_CONFIG__VGT_GROUP_DECR] = 0x00000000; + rctx->config.states[R600_CONFIG__VGT_GROUP_VECT_0_CNTL] = 0x00000000; + rctx->config.states[R600_CONFIG__VGT_GROUP_VECT_1_CNTL] = 0x00000000; + rctx->config.states[R600_CONFIG__VGT_GROUP_VECT_0_FMT_CNTL] = 0x00000000; + rctx->config.states[R600_CONFIG__VGT_GROUP_VECT_1_FMT_CNTL] = 0x00000000; + rctx->config.states[R600_CONFIG__VGT_GS_MODE] = 0x00000000; + rctx->config.states[R600_CONFIG__PA_SC_MODE_CNTL] = 0x00514000; + rctx->config.states[R600_CONFIG__VGT_STRMOUT_EN] = 0x00000000; + rctx->config.states[R600_CONFIG__VGT_REUSE_OFF] = 0x00000001; + rctx->config.states[R600_CONFIG__VGT_VTX_CNT_EN] = 0x00000000; + rctx->config.states[R600_CONFIG__VGT_STRMOUT_BUFFER_EN] = 0x00000000; + radeon_state_pm4(&rctx->config); } struct pipe_context *r600_create_context(struct pipe_screen *screen, void *priv) @@ -331,7 +327,7 @@ struct pipe_context *r600_create_context(struct pipe_screen *screen, void *priv) r600_init_config(rctx); - rctx->ctx = radeon_ctx(rscreen->rw); - rctx->draw = radeon_draw(rscreen->rw); + radeon_ctx_init(&rctx->ctx, rscreen->rw); + radeon_draw_init(&rctx->draw, rscreen->rw); return &rctx->context; } diff --git a/src/gallium/drivers/r600/r600_context.h b/src/gallium/drivers/r600/r600_context.h index e9495f0017..a48dca4915 100644 --- a/src/gallium/drivers/r600/r600_context.h +++ b/src/gallium/drivers/r600/r600_context.h @@ -53,7 +53,7 @@ struct r600_query { unsigned buffer_size; /* linked list of queries */ struct list_head list; - struct radeon_state *rstate; + struct radeon_state rstate; }; /* XXX move this to a more appropriate place */ @@ -99,7 +99,7 @@ struct r600_context_state { union pipe_states state; unsigned refcount; unsigned type; - struct radeon_state *rstate; + struct radeon_state rstate; struct r600_shader shader; struct radeon_bo *bo; }; @@ -112,29 +112,24 @@ struct r600_vertex_element }; struct r600_context_hw_states { - struct radeon_state *rasterizer; - struct radeon_state *scissor; - struct radeon_state *dsa; - struct radeon_state *blend; - struct radeon_state *viewport; - struct radeon_state *cb[8]; - struct radeon_state *config; - struct radeon_state *cb_cntl; - struct radeon_state *db; - struct radeon_state *ucp; - unsigned ps_nresource; - unsigned ps_nsampler; - struct radeon_state *ps_resource[160]; - struct radeon_state *ps_sampler[16]; + struct radeon_state rasterizer; + struct radeon_state scissor; + struct radeon_state dsa; + struct radeon_state cb_cntl; }; struct r600_context { struct pipe_context context; struct r600_screen *screen; struct radeon *rw; - struct radeon_ctx *ctx; + struct radeon_ctx ctx; struct blitter_context *blitter; - struct radeon_draw *draw; + struct radeon_draw draw; + struct radeon_state config; + /* FIXME get rid of those vs_resource,vs/ps_constant */ + struct radeon_state vs_resource[160]; + struct radeon_state vs_constant[256]; + struct radeon_state ps_constant[256]; /* hw states */ struct r600_context_hw_states hw_states; /* pipe states */ diff --git a/src/gallium/drivers/r600/r600_draw.c b/src/gallium/drivers/r600/r600_draw.c index 88f93bca7b..bddc81e50a 100644 --- a/src/gallium/drivers/r600/r600_draw.c +++ b/src/gallium/drivers/r600/r600_draw.c @@ -31,6 +31,7 @@ #include #include #include +#include "radeon.h" #include "r600_screen.h" #include "r600_context.h" #include "r600_resource.h" @@ -38,8 +39,8 @@ struct r600_draw { struct pipe_context *ctx; - struct radeon_state *draw; - struct radeon_state *vgt; + struct radeon_state draw; + struct radeon_state vgt; unsigned mode; unsigned start; unsigned count; @@ -51,6 +52,7 @@ static int r600_draw_common(struct r600_draw *draw) { struct r600_context *rctx = r600_context(draw->ctx); struct r600_screen *rscreen = rctx->screen; + /* FIXME vs_resource */ struct radeon_state *vs_resource; struct r600_resource *rbuffer; unsigned i, j, offset, format, prim; @@ -81,6 +83,7 @@ static int r600_draw_common(struct r600_draw *draw) r = r600_conv_pipe_prim(draw->mode, &prim); if (r) return r; + /* rebuild vertex shader if input format changed */ r = r600_pipe_shader_update(draw->ctx, rctx->vs_shader); if (r) @@ -88,22 +91,17 @@ static int r600_draw_common(struct r600_draw *draw) r = r600_pipe_shader_update(draw->ctx, rctx->ps_shader); if (r) return r; - r = radeon_draw_set(rctx->draw, rctx->vs_shader->rstate); - if (r) - return r; - r = radeon_draw_set(rctx->draw, rctx->ps_shader->rstate); - if (r) - return r; + radeon_draw_bind(&rctx->draw, &rctx->vs_shader->rstate); + radeon_draw_bind(&rctx->draw, &rctx->ps_shader->rstate); for (i = 0 ; i < rctx->vertex_elements->count; i++) { + vs_resource = &rctx->vs_resource[i]; j = rctx->vertex_elements->elements[i].vertex_buffer_index; vertex_buffer = &rctx->vertex_buffer[j]; rbuffer = (struct r600_resource*)vertex_buffer->buffer; offset = rctx->vertex_elements->elements[i].src_offset + vertex_buffer->buffer_offset; format = r600_translate_colorformat(rctx->vertex_elements->elements[i].src_format); - vs_resource = radeon_state_shader(rscreen->rw, R600_STATE_RESOURCE, i, R600_SHADER_VS); - if (vs_resource == NULL) - return -ENOMEM; + radeon_state_init(vs_resource, rscreen->rw, R600_STATE_RESOURCE, i, R600_SHADER_VS); vs_resource->bo[0] = radeon_bo_incref(rscreen->rw, rbuffer->bo); vs_resource->nbo = 1; vs_resource->states[R600_PS_RESOURCE__RESOURCE0_WORD0] = offset; @@ -116,53 +114,53 @@ static int r600_draw_common(struct r600_draw *draw) vs_resource->states[R600_PS_RESOURCE__RESOURCE0_WORD6] = 0xC0000000; vs_resource->placement[0] = RADEON_GEM_DOMAIN_GTT; vs_resource->placement[1] = RADEON_GEM_DOMAIN_GTT; - r = radeon_draw_set_new(rctx->draw, vs_resource); - if (r) + r = radeon_state_pm4(vs_resource); + if (r) { return r; + } + radeon_draw_bind(&rctx->draw, vs_resource); } /* FIXME start need to change winsys */ - draw->draw = radeon_state(rscreen->rw, R600_STATE_DRAW, 0); - if (draw->draw == NULL) - return -ENOMEM; - draw->draw->states[R600_DRAW__VGT_NUM_INDICES] = draw->count; - draw->draw->states[R600_DRAW__VGT_DRAW_INITIATOR] = vgt_draw_initiator; + radeon_state_init(&draw->draw, rscreen->rw, R600_STATE_DRAW, 0, 0); + draw->draw.states[R600_DRAW__VGT_NUM_INDICES] = draw->count; + draw->draw.states[R600_DRAW__VGT_DRAW_INITIATOR] = vgt_draw_initiator; if (draw->index_buffer) { rbuffer = (struct r600_resource*)draw->index_buffer; - draw->draw->bo[0] = radeon_bo_incref(rscreen->rw, rbuffer->bo); - draw->draw->placement[0] = RADEON_GEM_DOMAIN_GTT; - draw->draw->placement[1] = RADEON_GEM_DOMAIN_GTT; - draw->draw->nbo = 1; + draw->draw.bo[0] = radeon_bo_incref(rscreen->rw, rbuffer->bo); + draw->draw.placement[0] = RADEON_GEM_DOMAIN_GTT; + draw->draw.placement[1] = RADEON_GEM_DOMAIN_GTT; + draw->draw.nbo = 1; } - r = radeon_draw_set_new(rctx->draw, draw->draw); - if (r) + r = radeon_state_pm4(&draw->draw); + if (r) { return r; - draw->vgt = radeon_state(rscreen->rw, R600_STATE_VGT, 0); - if (draw->vgt == NULL) - return -ENOMEM; - draw->vgt->states[R600_VGT__VGT_PRIMITIVE_TYPE] = prim; - draw->vgt->states[R600_VGT__VGT_MAX_VTX_INDX] = 0x00FFFFFF; - draw->vgt->states[R600_VGT__VGT_MIN_VTX_INDX] = 0x00000000; - draw->vgt->states[R600_VGT__VGT_INDX_OFFSET] = draw->start; - draw->vgt->states[R600_VGT__VGT_MULTI_PRIM_IB_RESET_INDX] = 0x00000000; - draw->vgt->states[R600_VGT__VGT_DMA_INDEX_TYPE] = vgt_dma_index_type; - draw->vgt->states[R600_VGT__VGT_PRIMITIVEID_EN] = 0x00000000; - draw->vgt->states[R600_VGT__VGT_DMA_NUM_INSTANCES] = 0x00000001; - draw->vgt->states[R600_VGT__VGT_MULTI_PRIM_IB_RESET_EN] = 0x00000000; - draw->vgt->states[R600_VGT__VGT_INSTANCE_STEP_RATE_0] = 0x00000000; - draw->vgt->states[R600_VGT__VGT_INSTANCE_STEP_RATE_1] = 0x00000000; - r = radeon_draw_set_new(rctx->draw, draw->vgt); - if (r) + } + radeon_draw_bind(&rctx->draw, &draw->draw); + + radeon_state_init(&draw->vgt, rscreen->rw, R600_STATE_VGT, 0, 0); + draw->vgt.states[R600_VGT__VGT_PRIMITIVE_TYPE] = prim; + draw->vgt.states[R600_VGT__VGT_MAX_VTX_INDX] = 0x00FFFFFF; + draw->vgt.states[R600_VGT__VGT_MIN_VTX_INDX] = 0x00000000; + draw->vgt.states[R600_VGT__VGT_INDX_OFFSET] = draw->start; + draw->vgt.states[R600_VGT__VGT_MULTI_PRIM_IB_RESET_INDX] = 0x00000000; + draw->vgt.states[R600_VGT__VGT_DMA_INDEX_TYPE] = vgt_dma_index_type; + draw->vgt.states[R600_VGT__VGT_PRIMITIVEID_EN] = 0x00000000; + draw->vgt.states[R600_VGT__VGT_DMA_NUM_INSTANCES] = 0x00000001; + draw->vgt.states[R600_VGT__VGT_MULTI_PRIM_IB_RESET_EN] = 0x00000000; + draw->vgt.states[R600_VGT__VGT_INSTANCE_STEP_RATE_0] = 0x00000000; + draw->vgt.states[R600_VGT__VGT_INSTANCE_STEP_RATE_1] = 0x00000000; + r = radeon_state_pm4(&draw->vgt); + if (r) { return r; - /* FIXME */ - r = radeon_ctx_set_draw_new(rctx->ctx, rctx->draw); + } + radeon_draw_bind(&rctx->draw, &draw->vgt); + + r = radeon_ctx_set_draw(&rctx->ctx, &rctx->draw); if (r == -EBUSY) { r600_flush(draw->ctx, 0, NULL); - r = radeon_ctx_set_draw_new(rctx->ctx, rctx->draw); + r = radeon_ctx_set_draw(&rctx->ctx, &rctx->draw); } - if (r) - return r; - rctx->draw = radeon_draw_duplicate(rctx->draw); - return 0; + return r; } void r600_draw_vbo(struct pipe_context *ctx, const struct pipe_draw_info *info) diff --git a/src/gallium/drivers/r600/r600_query.c b/src/gallium/drivers/r600/r600_query.c index af857101e3..530940ed84 100644 --- a/src/gallium/drivers/r600/r600_query.c +++ b/src/gallium/drivers/r600/r600_query.c @@ -31,42 +31,36 @@ #include "r600_screen.h" #include "r600_context.h" -static struct radeon_state *r600_query_begin(struct r600_context *rctx, struct r600_query *rquery) +static void r600_query_begin(struct r600_context *rctx, struct r600_query *rquery) { struct r600_screen *rscreen = rctx->screen; - struct radeon_state *rstate; + struct radeon_state *rstate = &rquery->rstate; - rstate = radeon_state(rscreen->rw, R600_STATE_QUERY_BEGIN, 0); - if (rstate == NULL) - return NULL; + radeon_state_fini(rstate); + radeon_state_init(rstate, rscreen->rw, R600_STATE_QUERY_BEGIN, 0, 0); rstate->states[R600_QUERY__OFFSET] = rquery->num_results; rstate->bo[0] = radeon_bo_incref(rscreen->rw, rquery->buffer); rstate->nbo = 1; rstate->placement[0] = RADEON_GEM_DOMAIN_GTT; if (radeon_state_pm4(rstate)) { - radeon_state_decref(rstate); - return NULL; + radeon_state_fini(rstate); } - return rstate; } -static struct radeon_state *r600_query_end(struct r600_context *rctx, struct r600_query *rquery) +static void r600_query_end(struct r600_context *rctx, struct r600_query *rquery) { struct r600_screen *rscreen = rctx->screen; - struct radeon_state *rstate; + struct radeon_state *rstate = &rquery->rstate; - rstate = radeon_state(rscreen->rw, R600_STATE_QUERY_END, 0); - if (rstate == NULL) - return NULL; + radeon_state_fini(rstate); + radeon_state_init(rstate, rscreen->rw, R600_STATE_QUERY_END, 0, 0); rstate->states[R600_QUERY__OFFSET] = rquery->num_results + 8; rstate->bo[0] = radeon_bo_incref(rscreen->rw, rquery->buffer); rstate->nbo = 1; rstate->placement[0] = RADEON_GEM_DOMAIN_GTT; if (radeon_state_pm4(rstate)) { - radeon_state_decref(rstate); - return NULL; + radeon_state_fini(rstate); } - return rstate; } static struct pipe_query *r600_create_query(struct pipe_context *ctx, unsigned query_type) @@ -137,8 +131,7 @@ static void r600_query_resume(struct pipe_context *ctx, struct r600_query *rquer } r600_query_result(ctx, rquery); } - rquery->rstate = radeon_state_decref(rquery->rstate); - rquery->rstate = r600_query_begin(rctx, rquery); + r600_query_begin(rctx, rquery); rquery->flushed = false; } @@ -146,8 +139,7 @@ static void r600_query_suspend(struct pipe_context *ctx, struct r600_query *rque { struct r600_context *rctx = r600_context(ctx); - rquery->rstate = radeon_state_decref(rquery->rstate); - rquery->rstate = r600_query_end(rctx, rquery); + r600_query_end(rctx, rquery); rquery->num_results += 16; } @@ -161,12 +153,12 @@ static void r600_begin_query(struct pipe_context *ctx, struct pipe_query *query) rquery->num_results = 0; rquery->flushed = false; r600_query_resume(ctx, rquery); - r = radeon_ctx_set_query_state(rctx->ctx, rquery->rstate); + r = radeon_ctx_set_query_state(&rctx->ctx, &rquery->rstate); if (r == -EBUSY) { /* this shouldn't happen */ R600_ERR("had to flush while emitting end query\n"); ctx->flush(ctx, 0, NULL); - r = radeon_ctx_set_query_state(rctx->ctx, rquery->rstate); + r = radeon_ctx_set_query_state(&rctx->ctx, &rquery->rstate); } } @@ -179,12 +171,12 @@ static void r600_end_query(struct pipe_context *ctx, struct pipe_query *query) rquery->state &= ~R600_QUERY_STATE_STARTED; rquery->state |= R600_QUERY_STATE_ENDED; r600_query_suspend(ctx, rquery); - r = radeon_ctx_set_query_state(rctx->ctx, rquery->rstate); + r = radeon_ctx_set_query_state(&rctx->ctx, &rquery->rstate); if (r == -EBUSY) { /* this shouldn't happen */ R600_ERR("had to flush while emitting end query\n"); ctx->flush(ctx, 0, NULL); - r = radeon_ctx_set_query_state(rctx->ctx, rquery->rstate); + r = radeon_ctx_set_query_state(&rctx->ctx, &rquery->rstate); } } @@ -197,12 +189,12 @@ void r600_queries_suspend(struct pipe_context *ctx) LIST_FOR_EACH_ENTRY(rquery, &rctx->query_list, list) { if (rquery->state & R600_QUERY_STATE_STARTED) { r600_query_suspend(ctx, rquery); - r = radeon_ctx_set_query_state(rctx->ctx, rquery->rstate); + r = radeon_ctx_set_query_state(&rctx->ctx, &rquery->rstate); if (r == -EBUSY) { /* this shouldn't happen */ R600_ERR("had to flush while emitting end query\n"); ctx->flush(ctx, 0, NULL); - r = radeon_ctx_set_query_state(rctx->ctx, rquery->rstate); + r = radeon_ctx_set_query_state(&rctx->ctx, &rquery->rstate); } } rquery->state |= R600_QUERY_STATE_SUSPENDED; @@ -218,12 +210,12 @@ void r600_queries_resume(struct pipe_context *ctx) LIST_FOR_EACH_ENTRY(rquery, &rctx->query_list, list) { if (rquery->state & R600_QUERY_STATE_STARTED) { r600_query_resume(ctx, rquery); - r = radeon_ctx_set_query_state(rctx->ctx, rquery->rstate); + r = radeon_ctx_set_query_state(&rctx->ctx, &rquery->rstate); if (r == -EBUSY) { /* this shouldn't happen */ R600_ERR("had to flush while emitting end query\n"); ctx->flush(ctx, 0, NULL); - r = radeon_ctx_set_query_state(rctx->ctx, rquery->rstate); + r = radeon_ctx_set_query_state(&rctx->ctx, &rquery->rstate); } } rquery->state &= ~R600_QUERY_STATE_SUSPENDED; diff --git a/src/gallium/drivers/r600/r600_resource.h b/src/gallium/drivers/r600/r600_resource.h index 8078a83c35..129667ad20 100644 --- a/src/gallium/drivers/r600/r600_resource.h +++ b/src/gallium/drivers/r600/r600_resource.h @@ -56,10 +56,10 @@ struct r600_resource_texture { unsigned depth; unsigned dirty; struct radeon_bo *uncompressed; - struct radeon_state *scissor[PIPE_MAX_TEXTURE_LEVELS]; - struct radeon_state *cb[8][PIPE_MAX_TEXTURE_LEVELS]; - struct radeon_state *db[PIPE_MAX_TEXTURE_LEVELS]; - struct radeon_state *viewport[PIPE_MAX_TEXTURE_LEVELS]; + struct radeon_state scissor[PIPE_MAX_TEXTURE_LEVELS]; + struct radeon_state cb[8][PIPE_MAX_TEXTURE_LEVELS]; + struct radeon_state db[PIPE_MAX_TEXTURE_LEVELS]; + struct radeon_state viewport[PIPE_MAX_TEXTURE_LEVELS]; }; void r600_init_context_resource_functions(struct r600_context *r600); diff --git a/src/gallium/drivers/r600/r600_shader.c b/src/gallium/drivers/r600/r600_shader.c index a26290062a..9af45b7793 100644 --- a/src/gallium/drivers/r600/r600_shader.c +++ b/src/gallium/drivers/r600/r600_shader.c @@ -134,10 +134,9 @@ static int r600_pipe_shader_vs(struct pipe_context *ctx, struct r600_context_sta struct radeon_state *state; unsigned i, tmp; - rpshader->rstate = radeon_state_decref(rpshader->rstate); - state = radeon_state_shader(rscreen->rw, R600_STATE_SHADER, 0, R600_SHADER_VS); - if (state == NULL) - return -ENOMEM; + state = &rpshader->rstate; + radeon_state_fini(&rpshader->rstate); + radeon_state_init(state, rscreen->rw, R600_STATE_SHADER, 0, R600_SHADER_VS); for (i = 0; i < 10; i++) { state->states[R600_VS_SHADER__SPI_VS_OUT_ID_0 + i] = 0; } @@ -149,12 +148,11 @@ static int r600_pipe_shader_vs(struct pipe_context *ctx, struct r600_context_sta state->states[R600_VS_SHADER__SPI_VS_OUT_CONFIG] = S_0286C4_VS_EXPORT_COUNT(rshader->noutput - 2); state->states[R600_VS_SHADER__SQ_PGM_RESOURCES_VS] = S_028868_NUM_GPRS(rshader->bc.ngpr) | S_028868_STACK_SIZE(rshader->bc.nstack); - rpshader->rstate = state; - rpshader->rstate->bo[0] = radeon_bo_incref(rscreen->rw, rpshader->bo); - rpshader->rstate->bo[1] = radeon_bo_incref(rscreen->rw, rpshader->bo); - rpshader->rstate->nbo = 2; - rpshader->rstate->placement[0] = RADEON_GEM_DOMAIN_GTT; - rpshader->rstate->placement[2] = RADEON_GEM_DOMAIN_GTT; + state->bo[0] = radeon_bo_incref(rscreen->rw, rpshader->bo); + state->bo[1] = radeon_bo_incref(rscreen->rw, rpshader->bo); + state->nbo = 2; + state->placement[0] = RADEON_GEM_DOMAIN_GTT; + state->placement[2] = RADEON_GEM_DOMAIN_GTT; return radeon_state_pm4(state); } @@ -168,11 +166,10 @@ static int r600_pipe_shader_ps(struct pipe_context *ctx, struct r600_context_sta unsigned i, tmp, exports_ps, num_cout; boolean have_pos = FALSE; + state = &rpshader->rstate; rasterizer = &rctx->rasterizer->state.rasterizer; - rpshader->rstate = radeon_state_decref(rpshader->rstate); - state = radeon_state_shader(rscreen->rw, R600_STATE_SHADER, 0, R600_SHADER_PS); - if (state == NULL) - return -ENOMEM; + radeon_state_fini(state); + radeon_state_init(state, rscreen->rw, R600_STATE_SHADER, 0, R600_SHADER_PS); for (i = 0; i < rshader->ninput; i++) { tmp = S_028644_SEMANTIC(i); tmp |= S_028644_SEL_CENTROID(1); @@ -214,10 +211,9 @@ static int r600_pipe_shader_ps(struct pipe_context *ctx, struct r600_context_sta state->states[R600_PS_SHADER__SQ_PGM_RESOURCES_PS] = S_028868_NUM_GPRS(rshader->bc.ngpr) | S_028868_STACK_SIZE(rshader->bc.nstack); state->states[R600_PS_SHADER__SQ_PGM_EXPORTS_PS] = exports_ps; - rpshader->rstate = state; - rpshader->rstate->bo[0] = radeon_bo_incref(rscreen->rw, rpshader->bo); - rpshader->rstate->nbo = 1; - rpshader->rstate->placement[0] = RADEON_GEM_DOMAIN_GTT; + state->bo[0] = radeon_bo_incref(rscreen->rw, rpshader->bo); + state->nbo = 1; + state->placement[0] = RADEON_GEM_DOMAIN_GTT; return radeon_state_pm4(state); } diff --git a/src/gallium/drivers/r600/r600_state.c b/src/gallium/drivers/r600/r600_state.c index d8f53f2ce8..c6810ffe36 100644 --- a/src/gallium/drivers/r600/r600_state.c +++ b/src/gallium/drivers/r600/r600_state.c @@ -34,15 +34,12 @@ #include "r600d.h" #include "r600_state_inlines.h" -static struct radeon_state *r600_blend(struct r600_context *rctx, const struct pipe_blend_state *state); -static struct radeon_state *r600_viewport(struct r600_context *rctx, const struct pipe_viewport_state *state); -static struct radeon_state *r600_ucp(struct r600_context *rctx, const struct pipe_clip_state *state); -static struct radeon_state *r600_sampler(struct r600_context *rctx, - const struct pipe_sampler_state *state, - unsigned id); -static struct radeon_state *r600_resource(struct pipe_context *ctx, - const struct pipe_sampler_view *view, - unsigned id); +static void r600_blend(struct r600_context *rctx, struct radeon_state *rstate, const struct pipe_blend_state *state); +static void r600_viewport(struct r600_context *rctx, struct radeon_state *rstate, const struct pipe_viewport_state *state); +static void r600_ucp(struct r600_context *rctx, struct radeon_state *rstate, const struct pipe_clip_state *state); +static void r600_sampler(struct r600_context *rctx, struct radeon_state *rstate, const struct pipe_sampler_state *state, unsigned id); +static void r600_resource(struct pipe_context *ctx, struct radeon_state *rstate, const struct pipe_sampler_view *view, unsigned id); + static void *r600_create_blend_state(struct pipe_context *ctx, const struct pipe_blend_state *state) @@ -96,7 +93,7 @@ static struct pipe_sampler_view *r600_create_sampler_view(struct pipe_context *c rstate->state.sampler_view.texture = texture; rstate->state.sampler_view.reference.count = 1; rstate->state.sampler_view.context = ctx; - rstate->rstate = r600_resource(ctx, &rstate->state.sampler_view, 0); + r600_resource(ctx, &rstate->rstate, &rstate->state.sampler_view, 0); return &rstate->state.sampler_view; } @@ -241,7 +238,7 @@ static void r600_bind_ps_sampler(struct pipe_context *ctx, rstate = (struct r600_context_state *)states[i]; rctx->ps_sampler[i] = r600_context_state_incref(rstate); if (rstate) { - radeon_state_convert(rstate->rstate, R600_STATE_SAMPLER, i, R600_SHADER_PS); + radeon_state_convert(&rstate->rstate, R600_STATE_SAMPLER, i, R600_SHADER_PS); } } rctx->ps_nsampler = count; @@ -261,7 +258,7 @@ static void r600_bind_vs_sampler(struct pipe_context *ctx, rstate = (struct r600_context_state *)states[i]; rctx->vs_sampler[i] = r600_context_state_incref(rstate); if (rstate) { - radeon_state_convert(rstate->rstate, R600_STATE_SAMPLER, i, R600_SHADER_VS); + radeon_state_convert(&rstate->rstate, R600_STATE_SAMPLER, i, R600_SHADER_VS); } } rctx->vs_nsampler = count; @@ -301,7 +298,7 @@ static void r600_set_constant_buffer(struct pipe_context *ctx, struct r600_screen *rscreen = r600_screen(ctx->screen); struct r600_context *rctx = r600_context(ctx); unsigned nconstant = 0, i, type, shader_class; - struct radeon_state *rstate; + struct radeon_state *rstate, *rstates; struct pipe_transfer *transfer; u32 *ptr; @@ -310,9 +307,11 @@ static void r600_set_constant_buffer(struct pipe_context *ctx, switch (shader) { case PIPE_SHADER_VERTEX: shader_class = R600_SHADER_VS; + rstates = rctx->vs_constant; break; case PIPE_SHADER_FRAGMENT: shader_class = R600_SHADER_PS; + rstates = rctx->ps_constant; break; default: R600_ERR("unsupported %d\n", shader); @@ -324,17 +323,15 @@ static void r600_set_constant_buffer(struct pipe_context *ctx, if (ptr == NULL) return; for (i = 0; i < nconstant; i++) { - rstate = radeon_state_shader(rscreen->rw, type, i, shader_class); - if (rstate == NULL) - return; + rstate = &rstates[i]; + radeon_state_init(rstate, rscreen->rw, type, i, shader_class); rstate->states[R600_PS_CONSTANT__SQ_ALU_CONSTANT0_0] = ptr[i * 4 + 0]; rstate->states[R600_PS_CONSTANT__SQ_ALU_CONSTANT1_0] = ptr[i * 4 + 1]; rstate->states[R600_PS_CONSTANT__SQ_ALU_CONSTANT2_0] = ptr[i * 4 + 2]; rstate->states[R600_PS_CONSTANT__SQ_ALU_CONSTANT3_0] = ptr[i * 4 + 3]; if (radeon_state_pm4(rstate)) return; - if (radeon_draw_set_new(rctx->draw, rstate)) - return; + radeon_draw_bind(&rctx->draw, rstate); } pipe_buffer_unmap(ctx, buffer, transfer); } @@ -355,7 +352,7 @@ static void r600_set_ps_sampler_view(struct pipe_context *ctx, rstate = (struct r600_context_state *)views[i]; rctx->ps_sampler_view[i] = r600_context_state_incref(rstate); if (rstate) { - radeon_state_convert(rstate->rstate, R600_STATE_RESOURCE, i, R600_SHADER_PS); + radeon_state_convert(&rstate->rstate, R600_STATE_RESOURCE, i, R600_SHADER_PS); } } rctx->ps_nsampler_view = count; @@ -376,7 +373,7 @@ static void r600_set_vs_sampler_view(struct pipe_context *ctx, rstate = (struct r600_context_state *)views[i]; rctx->vs_sampler_view[i] = r600_context_state_incref(rstate); if (rstate) { - radeon_state_convert(rstate->rstate, R600_STATE_RESOURCE, i, R600_SHADER_VS); + radeon_state_convert(&rstate->rstate, R600_STATE_RESOURCE, i, R600_SHADER_VS); } } rctx->vs_nsampler_view = count; @@ -564,7 +561,7 @@ struct r600_context_state *r600_context_state_decref(struct r600_context_state * R600_ERR("invalid type %d\n", rstate->type); return NULL; } - radeon_state_decref(rstate->rstate); + radeon_state_fini(&rstate->rstate); FREE(rstate); return NULL; } @@ -597,7 +594,7 @@ struct r600_context_state *r600_context_state(struct r600_context *rctx, unsigne break; case pipe_viewport_type: rstate->state.viewport = (*states).viewport; - rstate->rstate = r600_viewport(rctx, &rstate->state.viewport); + r600_viewport(rctx, &rstate->rstate, &rstate->state.viewport); break; case pipe_depth_type: rstate->state.depth = (*states).depth; @@ -613,7 +610,7 @@ struct r600_context_state *r600_context_state(struct r600_context *rctx, unsigne break; case pipe_clip_type: rstate->state.clip = (*states).clip; - rstate->rstate = r600_ucp(rctx, &rstate->state.clip); + r600_ucp(rctx, &rstate->rstate, &rstate->state.clip); break; case pipe_stencil_type: rstate->state.stencil = (*states).stencil; @@ -626,7 +623,7 @@ struct r600_context_state *r600_context_state(struct r600_context *rctx, unsigne break; case pipe_blend_type: rstate->state.blend = (*states).blend; - rstate->rstate = r600_blend(rctx, &rstate->state.blend); + r600_blend(rctx, &rstate->rstate, &rstate->state.blend); break; case pipe_stencil_ref_type: rstate->state.stencil_ref = (*states).stencil_ref; @@ -641,7 +638,7 @@ struct r600_context_state *r600_context_state(struct r600_context *rctx, unsigne break; case pipe_sampler_type: rstate->state.sampler = (*states).sampler; - rstate->rstate = r600_sampler(rctx, &rstate->state.sampler, 0); + r600_sampler(rctx, &rstate->rstate, &rstate->state.sampler, 0); break; default: R600_ERR("invalid type %d\n", rstate->type); @@ -651,15 +648,12 @@ struct r600_context_state *r600_context_state(struct r600_context *rctx, unsigne return rstate; } -static struct radeon_state *r600_blend(struct r600_context *rctx, const struct pipe_blend_state *state) +static void r600_blend(struct r600_context *rctx, struct radeon_state *rstate, const struct pipe_blend_state *state) { struct r600_screen *rscreen = rctx->screen; - struct radeon_state *rstate; int i; - rstate = radeon_state(rscreen->rw, R600_STATE_BLEND, 0); - if (rstate == NULL) - return NULL; + radeon_state_init(rstate, rscreen->rw, R600_STATE_BLEND, 0, 0); rstate->states[R600_BLEND__CB_BLEND_RED] = fui(rctx->blend_color.color[0]); rstate->states[R600_BLEND__CB_BLEND_GREEN] = fui(rctx->blend_color.color[1]); rstate->states[R600_BLEND__CB_BLEND_BLUE] = fui(rctx->blend_color.color[2]); @@ -703,21 +697,15 @@ static struct radeon_state *r600_blend(struct r600_context *rctx, const struct p rstate->states[R600_BLEND__CB_BLEND_CONTROL] = bc; } - if (radeon_state_pm4(rstate)) { - radeon_state_decref(rstate); - return NULL; - } - return rstate; + radeon_state_pm4(rstate); } -static struct radeon_state *r600_ucp(struct r600_context *rctx, const struct pipe_clip_state *state) +static void r600_ucp(struct r600_context *rctx, struct radeon_state *rstate, + const struct pipe_clip_state *state) { struct r600_screen *rscreen = rctx->screen; - struct radeon_state *rstate; - rstate = radeon_state(rscreen->rw, R600_STATE_UCP, 0); - if (rstate == NULL) - return NULL; + radeon_state_init(rstate, rscreen->rw, R600_STATE_UCP, 0, 0); for (int i = 0; i < state->nr; i++) { rstate->states[i * 4 + 0] = fui(state->ucp[i][0]); @@ -725,118 +713,15 @@ static struct radeon_state *r600_ucp(struct r600_context *rctx, const struct pip rstate->states[i * 4 + 2] = fui(state->ucp[i][2]); rstate->states[i * 4 + 3] = fui(state->ucp[i][3]); } - return rstate; -} - -static struct radeon_state *r600_cb(struct r600_context *rctx, int cb) -{ - struct r600_screen *rscreen = rctx->screen; - struct r600_resource_texture *rtex; - struct r600_resource *rbuffer; - struct radeon_state *rstate; - const struct pipe_framebuffer_state *state = &rctx->framebuffer->state.framebuffer; - unsigned level = state->cbufs[cb]->level; - unsigned pitch, slice; - unsigned color_info; - unsigned format, swap, ntype; - const struct util_format_description *desc; - - rstate = radeon_state(rscreen->rw, R600_STATE_CB0 + cb, 0); - if (rstate == NULL) - return NULL; - rtex = (struct r600_resource_texture*)state->cbufs[cb]->texture; - rbuffer = &rtex->resource; - rstate->bo[0] = radeon_bo_incref(rscreen->rw, rbuffer->bo); - rstate->bo[1] = radeon_bo_incref(rscreen->rw, rbuffer->bo); - rstate->bo[2] = radeon_bo_incref(rscreen->rw, rbuffer->bo); - rstate->placement[0] = RADEON_GEM_DOMAIN_GTT; - rstate->placement[2] = RADEON_GEM_DOMAIN_GTT; - rstate->placement[4] = RADEON_GEM_DOMAIN_GTT; - rstate->nbo = 3; - pitch = (rtex->pitch[level] / rtex->bpt) / 8 - 1; - slice = (rtex->pitch[level] / rtex->bpt) * state->cbufs[cb]->height / 64 - 1; - - ntype = 0; - desc = util_format_description(rtex->resource.base.b.format); - if (desc->colorspace == UTIL_FORMAT_COLORSPACE_SRGB) - ntype = V_0280A0_NUMBER_SRGB; - - format = r600_translate_colorformat(rtex->resource.base.b.format); - swap = r600_translate_colorswap(rtex->resource.base.b.format); - - color_info = S_0280A0_FORMAT(format) | - S_0280A0_COMP_SWAP(swap) | - S_0280A0_BLEND_CLAMP(1) | - S_0280A0_SOURCE_FORMAT(1) | - S_0280A0_NUMBER_TYPE(ntype); - - rstate->states[R600_CB0__CB_COLOR0_BASE] = state->cbufs[cb]->offset >> 8; - rstate->states[R600_CB0__CB_COLOR0_INFO] = color_info; - rstate->states[R600_CB0__CB_COLOR0_SIZE] = S_028060_PITCH_TILE_MAX(pitch) | - S_028060_SLICE_TILE_MAX(slice); - rstate->states[R600_CB0__CB_COLOR0_VIEW] = 0x00000000; - rstate->states[R600_CB0__CB_COLOR0_FRAG] = 0x00000000; - rstate->states[R600_CB0__CB_COLOR0_TILE] = 0x00000000; - rstate->states[R600_CB0__CB_COLOR0_MASK] = 0x00000000; - if (radeon_state_pm4(rstate)) { - radeon_state_decref(rstate); - return NULL; - } - return rstate; -} - -static struct radeon_state *r600_db(struct r600_context *rctx) -{ - struct r600_screen *rscreen = rctx->screen; - struct r600_resource_texture *rtex; - struct r600_resource *rbuffer; - struct radeon_state *rstate; - const struct pipe_framebuffer_state *state = &rctx->framebuffer->state.framebuffer; - unsigned level; - unsigned pitch, slice, format; - - if (state->zsbuf == NULL) - return NULL; - - rstate = radeon_state(rscreen->rw, R600_STATE_DB, 0); - if (rstate == NULL) - return NULL; - - rtex = (struct r600_resource_texture*)state->zsbuf->texture; - rtex->tilled = 1; - rtex->array_mode = 2; - rtex->tile_type = 1; - rtex->depth = 1; - rbuffer = &rtex->resource; - - rstate->bo[0] = radeon_bo_incref(rscreen->rw, rbuffer->bo); - rstate->nbo = 1; - rstate->placement[0] = RADEON_GEM_DOMAIN_VRAM; - level = state->zsbuf->level; - pitch = (rtex->pitch[level] / rtex->bpt) / 8 - 1; - slice = (rtex->pitch[level] / rtex->bpt) * state->zsbuf->height / 64 - 1; - format = r600_translate_dbformat(state->zsbuf->texture->format); - rstate->states[R600_DB__DB_DEPTH_BASE] = state->zsbuf->offset >> 8; - rstate->states[R600_DB__DB_DEPTH_INFO] = S_028010_ARRAY_MODE(rtex->array_mode) | - S_028010_FORMAT(format); - rstate->states[R600_DB__DB_DEPTH_VIEW] = 0x00000000; - rstate->states[R600_DB__DB_PREFETCH_LIMIT] = (state->zsbuf->height / 8) -1; - rstate->states[R600_DB__DB_DEPTH_SIZE] = S_028000_PITCH_TILE_MAX(pitch) | - S_028000_SLICE_TILE_MAX(slice); - if (radeon_state_pm4(rstate)) { - radeon_state_decref(rstate); - return NULL; - } - return rstate; + radeon_state_pm4(rstate); } -static struct radeon_state *r600_rasterizer(struct r600_context *rctx) +static void r600_rasterizer(struct r600_context *rctx, struct radeon_state *rstate) { const struct pipe_rasterizer_state *state = &rctx->rasterizer->state.rasterizer; const struct pipe_framebuffer_state *fb = &rctx->framebuffer->state.framebuffer; const struct pipe_clip_state *clip = NULL; struct r600_screen *rscreen = rctx->screen; - struct radeon_state *rstate; float offset_units = 0, offset_scale = 0; char depth = 0; unsigned offset_db_fmt_cntl = 0; @@ -865,7 +750,7 @@ static struct radeon_state *r600_rasterizer(struct r600_context *rctx) break; default: R600_ERR("unsupported %d\n", fb->zsbuf->texture->format); - return NULL; + return; } } offset_db_fmt_cntl |= S_028DF8_POLY_OFFSET_NEG_NUM_DB_BITS(depth); @@ -874,9 +759,7 @@ static struct radeon_state *r600_rasterizer(struct r600_context *rctx) prov_vtx = 0; rctx->flat_shade = state->flatshade; - rstate = radeon_state(rscreen->rw, R600_STATE_RASTERIZER, 0); - if (rstate == NULL) - return NULL; + radeon_state_init(rstate, rscreen->rw, R600_STATE_RASTERIZER, 0, 0); rstate->states[R600_RASTERIZER__SPI_INTERP_CONTROL_0] = 0x00000001; if (state->sprite_coord_enable) { rstate->states[R600_RASTERIZER__SPI_INTERP_CONTROL_0] |= @@ -926,19 +809,14 @@ static struct radeon_state *r600_rasterizer(struct r600_context *rctx) rstate->states[R600_RASTERIZER__PA_SU_POLY_OFFSET_FRONT_OFFSET] = fui(offset_units); rstate->states[R600_RASTERIZER__PA_SU_POLY_OFFSET_BACK_SCALE] = fui(offset_scale); rstate->states[R600_RASTERIZER__PA_SU_POLY_OFFSET_BACK_OFFSET] = fui(offset_units); - if (radeon_state_pm4(rstate)) { - radeon_state_decref(rstate); - return NULL; - } - return rstate; + radeon_state_pm4(rstate); } -static struct radeon_state *r600_scissor(struct r600_context *rctx) +static void r600_scissor(struct r600_context *rctx, struct radeon_state *rstate) { const struct pipe_scissor_state *state = &rctx->scissor->state.scissor; const struct pipe_framebuffer_state *fb = &rctx->framebuffer->state.framebuffer; struct r600_screen *rscreen = rctx->screen; - struct radeon_state *rstate; unsigned minx, maxx, miny, maxy; u32 tl, br; @@ -955,9 +833,7 @@ static struct radeon_state *r600_scissor(struct r600_context *rctx) } tl = S_028240_TL_X(minx) | S_028240_TL_Y(miny) | S_028240_WINDOW_OFFSET_DISABLE(1); br = S_028244_BR_X(maxx) | S_028244_BR_Y(maxy); - rstate = radeon_state(rscreen->rw, R600_STATE_SCISSOR, 0); - if (rstate == NULL) - return NULL; + radeon_state_init(rstate, rscreen->rw, R600_STATE_SCISSOR, 0, 0); rstate->states[R600_SCISSOR__PA_SC_SCREEN_SCISSOR_TL] = tl; rstate->states[R600_SCISSOR__PA_SC_SCREEN_SCISSOR_BR] = br; rstate->states[R600_SCISSOR__PA_SC_WINDOW_OFFSET] = 0x00000000; @@ -977,21 +853,14 @@ static struct radeon_state *r600_scissor(struct r600_context *rctx) rstate->states[R600_SCISSOR__PA_SC_GENERIC_SCISSOR_BR] = br; rstate->states[R600_SCISSOR__PA_SC_VPORT_SCISSOR_0_TL] = tl; rstate->states[R600_SCISSOR__PA_SC_VPORT_SCISSOR_0_BR] = br; - if (radeon_state_pm4(rstate)) { - radeon_state_decref(rstate); - return NULL; - } - return rstate; + radeon_state_pm4(rstate); } -static struct radeon_state *r600_viewport(struct r600_context *rctx, const struct pipe_viewport_state *state) +static void r600_viewport(struct r600_context *rctx, struct radeon_state *rstate, const struct pipe_viewport_state *state) { struct r600_screen *rscreen = rctx->screen; - struct radeon_state *rstate; - rstate = radeon_state(rscreen->rw, R600_STATE_VIEWPORT, 0); - if (rstate == NULL) - return NULL; + radeon_state_init(rstate, rscreen->rw, R600_STATE_VIEWPORT, 0, 0); rstate->states[R600_VIEWPORT__PA_SC_VPORT_ZMIN_0] = 0x00000000; rstate->states[R600_VIEWPORT__PA_SC_VPORT_ZMAX_0] = 0x3F800000; rstate->states[R600_VIEWPORT__PA_CL_VPORT_XSCALE_0] = fui(state->scale[0]); @@ -1001,14 +870,10 @@ static struct radeon_state *r600_viewport(struct r600_context *rctx, const struc rstate->states[R600_VIEWPORT__PA_CL_VPORT_YOFFSET_0] = fui(state->translate[1]); rstate->states[R600_VIEWPORT__PA_CL_VPORT_ZOFFSET_0] = fui(state->translate[2]); rstate->states[R600_VIEWPORT__PA_CL_VTE_CNTL] = 0x0000043F; - if (radeon_state_pm4(rstate)) { - radeon_state_decref(rstate); - return NULL; - } - return rstate; + radeon_state_pm4(rstate); } -static struct radeon_state *r600_dsa(struct r600_context *rctx) +static void r600_dsa(struct r600_context *rctx, struct radeon_state *rstate) { const struct pipe_depth_stencil_alpha_state *state = &rctx->dsa->state.dsa; const struct pipe_stencil_ref *stencil_ref = &rctx->stencil_ref->state.stencil_ref; @@ -1016,15 +881,12 @@ static struct radeon_state *r600_dsa(struct r600_context *rctx) unsigned db_depth_control, alpha_test_control, alpha_ref, db_shader_control; unsigned stencil_ref_mask, stencil_ref_mask_bf; struct r600_shader *rshader; - struct radeon_state *rstate; int i; if (rctx->ps_shader == NULL) { - return NULL; + return; } - rstate = radeon_state(rscreen->rw, R600_STATE_DSA, 0); - if (rstate == NULL) - return NULL; + radeon_state_init(rstate, rscreen->rw, R600_STATE_DSA, 0, 0); db_shader_control = 0x210; rshader = &rctx->ps_shader->shader; @@ -1087,11 +949,7 @@ static struct radeon_state *r600_dsa(struct r600_context *rctx) rstate->states[R600_DSA__DB_SRESULTS_COMPARE_STATE1] = 0x00000000; rstate->states[R600_DSA__DB_PRELOAD_CONTROL] = 0x00000000; rstate->states[R600_DSA__DB_ALPHA_TO_MASK] = 0x0000AA00; - if (radeon_state_pm4(rstate)) { - radeon_state_decref(rstate); - return NULL; - } - return rstate; + radeon_state_pm4(rstate); } static inline unsigned r600_tex_wrap(unsigned wrap) @@ -1169,16 +1027,12 @@ static INLINE u32 S_FIXED(float value, u32 frac_bits) return value * (1 << frac_bits); } -static struct radeon_state *r600_sampler(struct r600_context *rctx, - const struct pipe_sampler_state *state, - unsigned id) +static void r600_sampler(struct r600_context *rctx, struct radeon_state *rstate, + const struct pipe_sampler_state *state, unsigned id) { struct r600_screen *rscreen = rctx->screen; - struct radeon_state *rstate; - rstate = radeon_state_shader(rscreen->rw, R600_STATE_SAMPLER, id, R600_SHADER_PS); - if (rstate == NULL) - return NULL; + radeon_state_init(rstate, rscreen->rw, R600_STATE_SAMPLER, id, R600_SHADER_PS); rstate->states[R600_PS_SAMPLER__SQ_TEX_SAMPLER_WORD0_0] = S_03C000_CLAMP_X(r600_tex_wrap(state->wrap_s)) | S_03C000_CLAMP_Y(r600_tex_wrap(state->wrap_t)) | @@ -1193,11 +1047,7 @@ static struct radeon_state *r600_sampler(struct r600_context *rctx, S_03C004_MAX_LOD(S_FIXED(CLAMP(state->max_lod, 0, 15), 6)) | S_03C004_LOD_BIAS(S_FIXED(CLAMP(state->lod_bias, -16, 16), 6)); rstate->states[R600_PS_SAMPLER__SQ_TEX_SAMPLER_WORD2_0] = S_03C008_TYPE(1); - if (radeon_state_pm4(rstate)) { - radeon_state_decref(rstate); - return NULL; - } - return rstate; + radeon_state_pm4(rstate); } static inline unsigned r600_tex_swizzle(unsigned swizzle) @@ -1248,21 +1098,20 @@ static inline unsigned r600_tex_dim(unsigned dim) } } -static struct radeon_state *r600_resource(struct pipe_context *ctx, - const struct pipe_sampler_view *view, - unsigned id) +static void r600_resource(struct pipe_context *ctx, struct radeon_state *rstate, + const struct pipe_sampler_view *view, unsigned id) { struct r600_context *rctx = r600_context(ctx); struct r600_screen *rscreen = rctx->screen; const struct util_format_description *desc; struct r600_resource_texture *tmp; struct r600_resource *rbuffer; - struct radeon_state *rstate; unsigned format; uint32_t word4 = 0, yuv_format = 0, pitch = 0; unsigned char swizzle[4], array_mode = 0, tile_type = 0; int r; + rstate->cpm4 = 0; swizzle[0] = view->swizzle_r; swizzle[1] = view->swizzle_g; swizzle[2] = view->swizzle_b; @@ -1270,23 +1119,21 @@ static struct radeon_state *r600_resource(struct pipe_context *ctx, format = r600_translate_texformat(view->texture->format, swizzle, &word4, &yuv_format); - if (format == ~0) - return NULL; + if (format == ~0) { + return; + } desc = util_format_description(view->texture->format); if (desc == NULL) { R600_ERR("unknow format %d\n", view->texture->format); - return NULL; - } - rstate = radeon_state_shader(rscreen->rw, R600_STATE_RESOURCE, id, R600_SHADER_PS); - if (rstate == NULL) { - return NULL; + return; } + radeon_state_init(rstate, rscreen->rw, R600_STATE_RESOURCE, id, R600_SHADER_PS); tmp = (struct r600_resource_texture*)view->texture; rbuffer = &tmp->resource; if (tmp->depth) { r = r600_texture_from_depth(ctx, tmp, view->first_level); if (r) { - return NULL; + return; } rstate->bo[0] = radeon_bo_incref(rscreen->rw, tmp->uncompressed); rstate->bo[1] = radeon_bo_incref(rscreen->rw, tmp->uncompressed); @@ -1302,7 +1149,7 @@ static struct radeon_state *r600_resource(struct pipe_context *ctx, pitch = (tmp->pitch[0] / tmp->bpt); pitch = (pitch + 0x7) & ~0x7; - + /* FIXME properly handle first level != 0 */ rstate->states[R600_PS_RESOURCE__RESOURCE0_WORD0] = S_038000_DIM(r600_tex_dim(view->texture->target)) | @@ -1328,17 +1175,12 @@ static struct radeon_state *r600_resource(struct pipe_context *ctx, S_038014_LAST_ARRAY(0); rstate->states[R600_PS_RESOURCE__RESOURCE0_WORD6] = S_038018_TYPE(V_038010_SQ_TEX_VTX_VALID_TEXTURE); - if (radeon_state_pm4(rstate)) { - radeon_state_decref(rstate); - return NULL; - } - return rstate; + radeon_state_pm4(rstate); } -static struct radeon_state *r600_cb_cntl(struct r600_context *rctx) +static void r600_cb_cntl(struct r600_context *rctx, struct radeon_state *rstate) { struct r600_screen *rscreen = rctx->screen; - struct radeon_state *rstate; const struct pipe_blend_state *pbs = &rctx->blend->state.blend; int nr_cbufs = rctx->framebuffer->state.framebuffer.nr_cbufs; uint32_t color_control, target_mask, shader_mask; @@ -1373,7 +1215,7 @@ static struct radeon_state *r600_cb_cntl(struct r600_context *rctx) target_mask |= (pbs->rt[0].colormask << (4 * i)); } } - rstate = radeon_state(rscreen->rw, R600_STATE_CB_CNTL, 0); + radeon_state_init(rstate, rscreen->rw, R600_STATE_CB_CNTL, 0, 0); rstate->states[R600_CB_CNTL__CB_SHADER_MASK] = shader_mask; rstate->states[R600_CB_CNTL__CB_TARGET_MASK] = target_mask; rstate->states[R600_CB_CNTL__CB_COLOR_CONTROL] = color_control; @@ -1385,11 +1227,7 @@ static struct radeon_state *r600_cb_cntl(struct r600_context *rctx) rstate->states[R600_CB_CNTL__CB_CLRCMP_DST] = 0x000000FF; rstate->states[R600_CB_CNTL__CB_CLRCMP_MSK] = 0xFFFFFFFF; rstate->states[R600_CB_CNTL__PA_SC_AA_MASK] = 0xFFFFFFFF; - if (radeon_state_pm4(rstate)) { - radeon_state_decref(rstate); - return NULL; - } - return rstate; + radeon_state_pm4(rstate); } int r600_context_hw_states(struct pipe_context *ctx) @@ -1397,110 +1235,46 @@ int r600_context_hw_states(struct pipe_context *ctx) struct r600_context *rctx = r600_context(ctx); struct r600_resource_texture *rtexture; unsigned i; - int r; - int nr_cbufs = rctx->framebuffer->state.framebuffer.nr_cbufs; - int ucp_nclip = 0; - if (rctx->clip) - ucp_nclip = rctx->clip->state.clip.nr; + /* build new states */ + r600_rasterizer(rctx, &rctx->hw_states.rasterizer); + r600_scissor(rctx, &rctx->hw_states.scissor); + r600_dsa(rctx, &rctx->hw_states.dsa); + r600_cb_cntl(rctx, &rctx->hw_states.cb_cntl); - /* free previous TODO determine what need to be updated, what - * doesn't - */ - rctx->hw_states.cb_cntl = radeon_state_decref(rctx->hw_states.cb_cntl); - rctx->hw_states.rasterizer = radeon_state_decref(rctx->hw_states.rasterizer); - rctx->hw_states.scissor = radeon_state_decref(rctx->hw_states.scissor); - rctx->hw_states.dsa = radeon_state_decref(rctx->hw_states.dsa); + /* bind states */ + radeon_draw_bind(&rctx->draw, &rctx->hw_states.rasterizer); + radeon_draw_bind(&rctx->draw, &rctx->hw_states.scissor); + radeon_draw_bind(&rctx->draw, &rctx->hw_states.dsa); + radeon_draw_bind(&rctx->draw, &rctx->hw_states.cb_cntl); + + radeon_draw_bind(&rctx->draw, &rctx->config); - /* build new states */ - rctx->hw_states.blend = NULL; - rctx->hw_states.viewport = NULL; - rctx->hw_states.ucp = NULL; - rctx->hw_states.rasterizer = r600_rasterizer(rctx); - rctx->hw_states.scissor = r600_scissor(rctx); - rctx->hw_states.dsa = r600_dsa(rctx); - rctx->hw_states.cb_cntl = r600_cb_cntl(rctx); if (rctx->viewport) { - rctx->hw_states.viewport = rctx->viewport->rstate; + radeon_draw_bind(&rctx->draw, &rctx->viewport->rstate); } if (rctx->blend) { - rctx->hw_states.blend = rctx->blend->rstate; + radeon_draw_bind(&rctx->draw, &rctx->blend->rstate); } if (rctx->clip) { - rctx->hw_states.ucp = rctx->clip->rstate; + radeon_draw_bind(&rctx->draw, &rctx->clip->rstate); } for (i = 0; i < rctx->framebuffer->state.framebuffer.nr_cbufs; i++) { rtexture = (struct r600_resource_texture*)rctx->framebuffer->state.framebuffer.cbufs[i]->texture; - rctx->hw_states.cb[i] = rtexture->cb[i][rctx->framebuffer->state.framebuffer.cbufs[i]->level]; + radeon_draw_bind(&rctx->draw, &rtexture->cb[i][rctx->framebuffer->state.framebuffer.cbufs[i]->level]); } if (rctx->framebuffer->state.framebuffer.zsbuf) { rtexture = (struct r600_resource_texture*)rctx->framebuffer->state.framebuffer.zsbuf->texture; - rctx->hw_states.db = rtexture->db[rctx->framebuffer->state.framebuffer.zsbuf->level]; + radeon_draw_bind(&rctx->draw, &rtexture->db[rctx->framebuffer->state.framebuffer.zsbuf->level]); } - - for (i = 0; i < rctx->ps_nsampler; i++) { if (rctx->ps_sampler[i]) { - rctx->hw_states.ps_sampler[i] = rctx->ps_sampler[i]->rstate; - } else { - rctx->hw_states.ps_sampler[i] = NULL; + radeon_draw_bind(&rctx->draw, &rctx->ps_sampler[i]->rstate); } } - rctx->hw_states.ps_nsampler = rctx->ps_nsampler; for (i = 0; i < rctx->ps_nsampler_view; i++) { if (rctx->ps_sampler_view[i]) { - rctx->hw_states.ps_resource[i] = rctx->ps_sampler_view[i]->rstate; - } else { - rctx->hw_states.ps_resource[i] = NULL; - } - } - rctx->hw_states.ps_nresource = rctx->ps_nsampler_view; - - /* bind states */ - r = radeon_draw_set(rctx->draw, rctx->hw_states.ucp); - if (r) - return r; - r = radeon_draw_set(rctx->draw, rctx->hw_states.db); - if (r) - return r; - r = radeon_draw_set(rctx->draw, rctx->hw_states.rasterizer); - if (r) - return r; - r = radeon_draw_set(rctx->draw, rctx->hw_states.scissor); - if (r) - return r; - r = radeon_draw_set(rctx->draw, rctx->hw_states.dsa); - if (r) - return r; - r = radeon_draw_set(rctx->draw, rctx->hw_states.blend); - if (r) - return r; - r = radeon_draw_set(rctx->draw, rctx->hw_states.viewport); - if (r) - return r; - for (i = 0; i < nr_cbufs; i++) { - r = radeon_draw_set(rctx->draw, rctx->hw_states.cb[i]); - if (r) - return r; - } - r = radeon_draw_set(rctx->draw, rctx->hw_states.config); - if (r) - return r; - r = radeon_draw_set(rctx->draw, rctx->hw_states.cb_cntl); - if (r) - return r; - for (i = 0; i < rctx->hw_states.ps_nresource; i++) { - if (rctx->hw_states.ps_resource[i]) { - r = radeon_draw_set(rctx->draw, rctx->hw_states.ps_resource[i]); - if (r) - return r; - } - } - for (i = 0; i < rctx->hw_states.ps_nsampler; i++) { - if (rctx->hw_states.ps_sampler[i]) { - r = radeon_draw_set(rctx->draw, rctx->hw_states.ps_sampler[i]); - if (r) - return r; + radeon_draw_bind(&rctx->draw, &rctx->ps_sampler_view[i]->rstate); } } return 0; diff --git a/src/gallium/drivers/r600/r600_texture.c b/src/gallium/drivers/r600/r600_texture.c index ec1d50566a..c472d4f37b 100644 --- a/src/gallium/drivers/r600/r600_texture.c +++ b/src/gallium/drivers/r600/r600_texture.c @@ -133,10 +133,10 @@ static void r600_texture_destroy_state(struct pipe_resource *ptexture) struct r600_resource_texture *rtexture = (struct r600_resource_texture*)ptexture; for (int i = 0; i < PIPE_MAX_TEXTURE_LEVELS; i++) { - radeon_state_decref(rtexture->scissor[i]); - radeon_state_decref(rtexture->db[i]); + radeon_state_fini(&rtexture->scissor[i]); + radeon_state_fini(&rtexture->db[i]); for (int j = 0; j < 8; j++) { - radeon_state_decref(rtexture->cb[j][i]); + radeon_state_fini(&rtexture->cb[j][i]); } } } @@ -668,16 +668,13 @@ int r600_texture_from_depth(struct pipe_context *ctx, struct r600_resource_textu return 0; } -static struct radeon_state *r600_texture_state_scissor(struct r600_screen *rscreen, +static void r600_texture_state_scissor(struct r600_screen *rscreen, struct r600_resource_texture *rtexture, unsigned level) { - struct radeon_state *rstate; - - rstate = radeon_state(rscreen->rw, R600_STATE_SCISSOR, 0); - if (rstate == NULL) - return NULL; + struct radeon_state *rstate = &rtexture->scissor[level]; + radeon_state_init(rstate, rscreen->rw, R600_STATE_SCISSOR, 0, 0); /* set states (most default value are 0 and struct already * initialized to 0, thus avoid resetting them) */ @@ -700,16 +697,10 @@ static struct radeon_state *r600_texture_state_scissor(struct r600_screen *rscre rstate->states[R600_SCISSOR__PA_SC_WINDOW_SCISSOR_BR] = S_028244_BR_X(rtexture->width[level]) | S_028244_BR_Y(rtexture->height[level]); rstate->states[R600_SCISSOR__PA_SC_WINDOW_SCISSOR_TL] = 0x80000000; - if (radeon_state_pm4(rstate)) { - radeon_state_decref(rstate); - return NULL; - } - return rstate; + radeon_state_pm4(rstate); } -static struct radeon_state *r600_texture_state_cb(struct r600_screen *rscreen, - struct r600_resource_texture *rtexture, - unsigned cb, unsigned level) +static void r600_texture_state_cb(struct r600_screen *rscreen, struct r600_resource_texture *rtexture, unsigned cb, unsigned level) { struct radeon_state *rstate; struct r600_resource *rbuffer; @@ -718,9 +709,8 @@ static struct radeon_state *r600_texture_state_cb(struct r600_screen *rscreen, unsigned format, swap, ntype; const struct util_format_description *desc; - rstate = radeon_state(rscreen->rw, R600_STATE_CB0 + cb, 0); - if (rstate == NULL) - return NULL; + rstate = &rtexture->cb[cb][level]; + radeon_state_init(rstate, rscreen->rw, R600_STATE_CB0 + cb, 0, 0); rbuffer = &rtexture->resource; /* set states (most default value are 0 and struct already @@ -762,24 +752,16 @@ static struct radeon_state *r600_texture_state_cb(struct r600_screen *rscreen, rstate->states[R600_CB0__CB_COLOR0_SIZE] = S_028060_PITCH_TILE_MAX(pitch) | S_028060_SLICE_TILE_MAX(slice); - if (radeon_state_pm4(rstate)) { - radeon_state_decref(rstate); - return NULL; - } - return rstate; + radeon_state_pm4(rstate); } -static struct radeon_state *r600_texture_state_db(struct r600_screen *rscreen, - struct r600_resource_texture *rtexture, - unsigned level) +static void r600_texture_state_db(struct r600_screen *rscreen, struct r600_resource_texture *rtexture, unsigned level) { - struct radeon_state *rstate; + struct radeon_state *rstate = &rtexture->db[level]; struct r600_resource *rbuffer; unsigned pitch, slice, format; - rstate = radeon_state(rscreen->rw, R600_STATE_DB, 0); - if (rstate == NULL) - return NULL; + radeon_state_init(rstate, rscreen->rw, R600_STATE_DB, 0, 0); rbuffer = &rtexture->resource; rtexture->tilled = 1; rtexture->array_mode = 2; @@ -803,36 +785,24 @@ static struct radeon_state *r600_texture_state_db(struct r600_screen *rscreen, rstate->placement[0] = RADEON_GEM_DOMAIN_GTT; rstate->nbo = 1; - if (radeon_state_pm4(rstate)) { - radeon_state_decref(rstate); - return NULL; - } - return rstate; + radeon_state_pm4(rstate); } int r600_texture_scissor(struct pipe_context *ctx, struct r600_resource_texture *rtexture, unsigned level) { struct r600_screen *rscreen = r600_screen(ctx->screen); - if (rtexture->scissor[level] == NULL) { - rtexture->scissor[level] = r600_texture_state_scissor(rscreen, rtexture, level); - if (rtexture->scissor[level] == NULL) { - R600_ERR("failed to create scissor for uncompressing depth\n"); - return -ENOMEM; - } + if (!rtexture->scissor[level].cpm4) { + r600_texture_state_scissor(rscreen, rtexture, level); } return 0; } -static struct radeon_state *r600_texture_state_viewport(struct r600_screen *rscreen, - struct r600_resource_texture *rtexture, - unsigned level) +static void r600_texture_state_viewport(struct r600_screen *rscreen, struct r600_resource_texture *rtexture, unsigned level) { - struct radeon_state *rstate; + struct radeon_state *rstate = &rtexture->viewport[level]; - rstate = radeon_state(rscreen->rw, R600_STATE_VIEWPORT, 0); - if (rstate == NULL) - return NULL; + radeon_state_init(rstate, rscreen->rw, R600_STATE_VIEWPORT, 0, 0); /* set states (most default value are 0 and struct already * initialized to 0, thus avoid resetting them) @@ -846,23 +816,15 @@ static struct radeon_state *r600_texture_state_viewport(struct r600_screen *rscr rstate->states[R600_VIEWPORT__PA_CL_VTE_CNTL] = 0x0000043F; rstate->states[R600_VIEWPORT__PA_SC_VPORT_ZMAX_0] = 0x3F800000; - if (radeon_state_pm4(rstate)) { - radeon_state_decref(rstate); - return NULL; - } - return rstate; + radeon_state_pm4(rstate); } int r600_texture_cb(struct pipe_context *ctx, struct r600_resource_texture *rtexture, unsigned cb, unsigned level) { struct r600_screen *rscreen = r600_screen(ctx->screen); - if (rtexture->cb[cb][level] == NULL) { - rtexture->cb[cb][level] = r600_texture_state_cb(rscreen, rtexture, cb, level); - if (rtexture->cb[cb][level] == NULL) { - R600_ERR("failed to create cb%d state for texture\n", cb); - return -ENOMEM; - } + if (!rtexture->cb[cb][level].cpm4) { + r600_texture_state_cb(rscreen, rtexture, cb, level); } return 0; } @@ -871,12 +833,8 @@ int r600_texture_db(struct pipe_context *ctx, struct r600_resource_texture *rtex { struct r600_screen *rscreen = r600_screen(ctx->screen); - if (rtexture->db[level] == NULL) { - rtexture->db[level] = r600_texture_state_db(rscreen, rtexture, level); - if (rtexture->db[level] == NULL) { - R600_ERR("failed to create db state for texture\n"); - return -ENOMEM; - } + if (!rtexture->db[level].cpm4) { + r600_texture_state_db(rscreen, rtexture, level); } return 0; } @@ -885,12 +843,8 @@ int r600_texture_viewport(struct pipe_context *ctx, struct r600_resource_texture { struct r600_screen *rscreen = r600_screen(ctx->screen); - if (rtexture->viewport[level] == NULL) { - rtexture->viewport[level] = r600_texture_state_viewport(rscreen, rtexture, level); - if (rtexture->viewport[level] == NULL) { - R600_ERR("failed to create viewport state for texture\n"); - return -ENOMEM; - } + if (!rtexture->viewport[level].cpm4) { + r600_texture_state_viewport(rscreen, rtexture, level); } return 0; } diff --git a/src/gallium/drivers/r600/radeon.h b/src/gallium/drivers/r600/radeon.h index 3f1ca95f69..aaac8de528 100644 --- a/src/gallium/drivers/r600/radeon.h +++ b/src/gallium/drivers/r600/radeon.h @@ -77,6 +77,14 @@ enum radeon_family { CHIP_LAST, }; +enum { + R600_SHADER_PS = 1, + R600_SHADER_VS, + R600_SHADER_GS, + R600_SHADER_FS, + R600_SHADER_MAX = R600_SHADER_FS, +}; + enum radeon_family radeon_get_family(struct radeon *rw); /* @@ -105,9 +113,10 @@ struct radeon_stype_info; struct radeon_state { struct radeon *radeon; unsigned refcount; - struct radeon_stype_info *stype; + struct radeon_stype_info *stype; + unsigned state_id; unsigned id; - unsigned shader_index; + unsigned shader_index; unsigned nstates; u32 states[64]; unsigned npm4; @@ -123,10 +132,8 @@ struct radeon_state { unsigned bo_dirty[4]; }; -struct radeon_state *radeon_state(struct radeon *radeon, u32 type, u32 id); -struct radeon_state *radeon_state_shader(struct radeon *radeon, u32 type, u32 id, u32 shader_class); -struct radeon_state *radeon_state_incref(struct radeon_state *state); -struct radeon_state *radeon_state_decref(struct radeon_state *state); +int radeon_state_init(struct radeon_state *rstate, struct radeon *radeon, u32 type, u32 id, u32 shader_class); +void radeon_state_fini(struct radeon_state *state); int radeon_state_pm4(struct radeon_state *state); int radeon_state_convert(struct radeon_state *state, u32 stype, u32 id, u32 shader_type); @@ -134,30 +141,13 @@ int radeon_state_convert(struct radeon_state *state, u32 stype, u32 id, u32 shad * draw functions */ struct radeon_draw { - unsigned refcount; struct radeon *radeon; - unsigned nstate; struct radeon_state **state; - unsigned cpm4; }; -struct radeon_draw *radeon_draw(struct radeon *radeon); -struct radeon_draw *radeon_draw_duplicate(struct radeon_draw *draw); -struct radeon_draw *radeon_draw_incref(struct radeon_draw *draw); -struct radeon_draw *radeon_draw_decref(struct radeon_draw *draw); -int radeon_draw_set(struct radeon_draw *draw, struct radeon_state *state); -int radeon_draw_set_new(struct radeon_draw *draw, struct radeon_state *state); -int radeon_draw_check(struct radeon_draw *draw); - -struct radeon_ctx *radeon_ctx(struct radeon *radeon); -struct radeon_ctx *radeon_ctx_decref(struct radeon_ctx *ctx); -struct radeon_ctx *radeon_ctx_incref(struct radeon_ctx *ctx); -int radeon_ctx_set_draw(struct radeon_ctx *ctx, struct radeon_draw *draw); -int radeon_ctx_set_query_state(struct radeon_ctx *ctx, struct radeon_state *state); -int radeon_ctx_set_draw_new(struct radeon_ctx *ctx, struct radeon_draw *draw); -int radeon_ctx_pm4(struct radeon_ctx *ctx); -int radeon_ctx_submit(struct radeon_ctx *ctx); -void radeon_ctx_dump_bof(struct radeon_ctx *ctx, const char *file); +int radeon_draw_init(struct radeon_draw *draw, struct radeon *radeon); +void radeon_draw_bind(struct radeon_draw *draw, struct radeon_state *state); +void radeon_draw_unbind(struct radeon_draw *draw, struct radeon_state *state); /* * radeon context functions @@ -172,30 +162,30 @@ struct radeon_cs_reloc { #pragma pack() struct radeon_ctx { - int refcount; struct radeon *radeon; u32 *pm4; - u32 cpm4; - u32 draw_cpm4; - unsigned id; - unsigned next_id; + int cdwords; + int ndwords; unsigned nreloc; struct radeon_cs_reloc *reloc; unsigned nbo; struct radeon_bo **bo; - unsigned ndraw; - struct radeon_draw *cdraw; - struct radeon_draw **draw; - unsigned nstate; - struct radeon_state **state; }; +int radeon_ctx_init(struct radeon_ctx *ctx, struct radeon *radeon); +void radeon_ctx_fini(struct radeon_ctx *ctx); +void radeon_ctx_clear(struct radeon_ctx *ctx); +int radeon_ctx_set_draw(struct radeon_ctx *ctx, struct radeon_draw *draw); +int radeon_ctx_submit(struct radeon_ctx *ctx); +void radeon_ctx_dump_bof(struct radeon_ctx *ctx, const char *file); +int radeon_ctx_set_query_state(struct radeon_ctx *ctx, struct radeon_state *state); + /* * R600/R700 */ enum r600_stype { - R600_STATE_CONFIG, + R600_STATE_CONFIG, R600_STATE_CB_CNTL, R600_STATE_RASTERIZER, R600_STATE_VIEWPORT, @@ -223,14 +213,6 @@ enum r600_stype { R600_STATE_DRAW, }; -enum { - R600_SHADER_PS = 1, - R600_SHADER_VS, - R600_SHADER_GS, - R600_SHADER_FS, - R600_SHADER_MAX = R600_SHADER_FS, -}; - /* R600_CONFIG */ #define R600_CONFIG__SQ_CONFIG 0 #define R600_CONFIG__SQ_GPR_RESOURCE_MGMT_1 1 diff --git a/src/gallium/targets/dri-r600/Makefile b/src/gallium/targets/dri-r600/Makefile index ff886b37f2..661283de6a 100644 --- a/src/gallium/targets/dri-r600/Makefile +++ b/src/gallium/targets/dri-r600/Makefile @@ -4,12 +4,12 @@ include $(TOP)/configs/current LIBNAME = r600_dri.so PIPE_DRIVERS = \ + $(TOP)/src/gallium/drivers/r600/libr600.a \ $(TOP)/src/gallium/state_trackers/dri/drm/libdridrm.a \ $(TOP)/src/gallium/winsys/r600/drm/libr600winsys.a \ $(TOP)/src/gallium/drivers/softpipe/libsoftpipe.a \ $(TOP)/src/gallium/drivers/trace/libtrace.a \ - $(TOP)/src/gallium/drivers/rbug/librbug.a \ - $(TOP)/src/gallium/drivers/r600/libr600.a + $(TOP)/src/gallium/drivers/rbug/librbug.a C_SOURCES = \ target.c \ diff --git a/src/gallium/winsys/r600/drm/r600_state.c b/src/gallium/winsys/r600/drm/r600_state.c index f6a428e884..71d65f0fea 100644 --- a/src/gallium/winsys/r600/drm/r600_state.c +++ b/src/gallium/winsys/r600/drm/r600_state.c @@ -367,7 +367,6 @@ static int r600_state_pm4_vgt(struct radeon_state *state) static int r600_state_pm4_draw(struct radeon_state *state) { - unsigned i; int r; if (state->nbo) { @@ -485,11 +484,10 @@ static void r600_build_types_array(struct radeon *radeon) } else { for (j = 0; j < R600_SHADER_MAX; j++) { if (r600_stypes[i].reginfo[j].shader_type) - id += r600_stypes[i].num; + id += r600_stypes[i].num; } } } - radeon->nstate = id; radeon->stype = r600_stypes; radeon->nstype = STYPES_SIZE; diff --git a/src/gallium/winsys/r600/drm/radeon.c b/src/gallium/winsys/r600/drm/radeon.c index 2b16e3ce88..e2d813ebac 100644 --- a/src/gallium/winsys/r600/drm/radeon.c +++ b/src/gallium/winsys/r600/drm/radeon.c @@ -42,24 +42,13 @@ static int radeon_get_device(struct radeon *radeon) return r; } -/* symbol missing drove me crazy hack to get symbol exported */ -static void fake(void) -{ - struct radeon_ctx *ctx; - struct radeon_draw *draw; - - ctx = radeon_ctx(NULL); - draw = radeon_draw(NULL); -} - struct radeon *radeon_new(int fd, unsigned device) { struct radeon *radeon; - int r; + int r, i, id; radeon = calloc(1, sizeof(*radeon)); if (radeon == NULL) { - fake(); return NULL; } radeon->fd = fd; @@ -131,6 +120,19 @@ struct radeon *radeon_new(int fd, unsigned device) __func__, radeon->device); break; } + radeon->state_type_id = calloc(radeon->nstype, sizeof(unsigned)); + if (radeon->state_type_id == NULL) { + return radeon_decref(radeon); + } + for (i = 0, id = 0; i < radeon->nstype; i++) { + radeon->state_type_id[i] = id; + for (int j = 0; j < radeon->nstype; j++) { + if (radeon->stype[j].stype != i) + continue; + id += radeon->stype[j].num; + } + } + radeon->nstate_per_shader = id; return radeon; } diff --git a/src/gallium/winsys/r600/drm/radeon_ctx.c b/src/gallium/winsys/r600/drm/radeon_ctx.c index 1a12c1023e..50c5e4741e 100644 --- a/src/gallium/winsys/r600/drm/radeon_ctx.c +++ b/src/gallium/winsys/r600/drm/radeon_ctx.c @@ -30,21 +30,16 @@ #include "radeon_drm.h" #include "bof.h" -int radeon_ctx_set_bo_new(struct radeon_ctx *ctx, struct radeon_bo *bo) +static int radeon_ctx_set_bo_new(struct radeon_ctx *ctx, struct radeon_bo *bo) { - void *ptr; - - ptr = realloc(ctx->bo, sizeof(struct radeon_bo) * (ctx->nbo + 1)); - if (ptr == NULL) { - return -ENOMEM; - } - ctx->bo = ptr; + if (ctx->nbo >= RADEON_CTX_MAX_PM4) + return -EBUSY; ctx->bo[ctx->nbo] = bo; ctx->nbo++; return 0; } -struct radeon_bo *radeon_ctx_get_bo(struct radeon_ctx *ctx, unsigned reloc) +static struct radeon_bo *radeon_ctx_get_bo(struct radeon_ctx *ctx, unsigned reloc) { struct radeon_cs_reloc *greloc; unsigned i; @@ -59,7 +54,7 @@ struct radeon_bo *radeon_ctx_get_bo(struct radeon_ctx *ctx, unsigned reloc) return NULL; } -void radeon_ctx_get_placement(struct radeon_ctx *ctx, unsigned reloc, u32 *placement) +static void radeon_ctx_get_placement(struct radeon_ctx *ctx, unsigned reloc, u32 *placement) { struct radeon_cs_reloc *greloc; unsigned i; @@ -76,50 +71,58 @@ void radeon_ctx_get_placement(struct radeon_ctx *ctx, unsigned reloc, u32 *place } } -struct radeon_ctx *radeon_ctx(struct radeon *radeon) +void radeon_ctx_clear(struct radeon_ctx *ctx) { - struct radeon_ctx *ctx; - - if (radeon == NULL) - return NULL; - ctx = calloc(1, sizeof(*ctx)); - if (ctx == NULL) - return NULL; - ctx->radeon = radeon_incref(radeon); - return ctx; + for (int i = 0; i < ctx->nbo; i++) { + ctx->bo[i] = radeon_bo_decref(ctx->radeon, ctx->bo[i]); + } + ctx->ndwords = RADEON_CTX_MAX_PM4; + ctx->cdwords = 0; + ctx->nreloc = 0; + ctx->nbo = 0; } -struct radeon_ctx *radeon_ctx_incref(struct radeon_ctx *ctx) +int radeon_ctx_init(struct radeon_ctx *ctx, struct radeon *radeon) { - ctx->refcount++; - return ctx; + if (radeon == NULL) + return -EINVAL; + memset(ctx, 0, sizeof(struct radeon_ctx)); + ctx->radeon = radeon_incref(radeon); + radeon_ctx_clear(ctx); + ctx->pm4 = malloc(RADEON_CTX_MAX_PM4 * 4); + if (ctx->pm4 == NULL) { + radeon_ctx_fini(ctx); + return -ENOMEM; + } + ctx->reloc = malloc(sizeof(struct radeon_cs_reloc) * RADEON_CTX_MAX_PM4); + if (ctx->reloc == NULL) { + radeon_ctx_fini(ctx); + return -ENOMEM; + } + ctx->bo = malloc(sizeof(void *) * RADEON_CTX_MAX_PM4); + if (ctx->bo == NULL) { + radeon_ctx_fini(ctx); + return -ENOMEM; + } + return 0; } -struct radeon_ctx *radeon_ctx_decref(struct radeon_ctx *ctx) +void radeon_ctx_fini(struct radeon_ctx *ctx) { unsigned i; if (ctx == NULL) - return NULL; - if (--ctx->refcount > 0) { - return NULL; - } + return; - for (i = 0; i < ctx->ndraw; i++) { - ctx->draw[i] = radeon_draw_decref(ctx->draw[i]); - } for (i = 0; i < ctx->nbo; i++) { ctx->bo[i] = radeon_bo_decref(ctx->radeon, ctx->bo[i]); } ctx->radeon = radeon_decref(ctx->radeon); - free(ctx->state); - free(ctx->draw); free(ctx->bo); free(ctx->pm4); free(ctx->reloc); memset(ctx, 0, sizeof(*ctx)); free(ctx); - return NULL; } static int radeon_ctx_state_bo(struct radeon_ctx *ctx, struct radeon_state *state) @@ -152,17 +155,17 @@ int radeon_ctx_submit(struct radeon_ctx *ctx) uint64_t chunk_array[2]; int r = 0; - if (!ctx->cpm4) + if (!ctx->cdwords) return 0; #if 0 - for (r = 0; r < ctx->cpm4; r++) { + for (r = 0; r < ctx->cdwords; r++) { fprintf(stderr, "0x%08X\n", ctx->pm4[r]); } #endif drmib.num_chunks = 2; drmib.chunks = (uint64_t)(uintptr_t)chunk_array; chunks[0].chunk_id = RADEON_CHUNK_ID_IB; - chunks[0].length_dw = ctx->cpm4; + chunks[0].length_dw = ctx->cdwords; chunks[0].chunk_data = (uint64_t)(uintptr_t)ctx->pm4; chunks[1].chunk_id = RADEON_CHUNK_ID_RELOCS; chunks[1].length_dw = ctx->nreloc * sizeof(struct radeon_cs_reloc) / 4; @@ -180,7 +183,6 @@ static int radeon_ctx_reloc(struct radeon_ctx *ctx, struct radeon_bo *bo, unsigned id, unsigned *placement) { unsigned i; - struct radeon_cs_reloc *ptr; for (i = 0; i < ctx->nreloc; i++) { if (ctx->reloc[i].handle == bo->handle) { @@ -188,14 +190,13 @@ static int radeon_ctx_reloc(struct radeon_ctx *ctx, struct radeon_bo *bo, return 0; } } - ptr = realloc(ctx->reloc, sizeof(struct radeon_cs_reloc) * (ctx->nreloc + 1)); - if (ptr == NULL) - return -ENOMEM; - ctx->reloc = ptr; - ptr[ctx->nreloc].handle = bo->handle; - ptr[ctx->nreloc].read_domain = placement[0] | placement [1]; - ptr[ctx->nreloc].write_domain = placement[0] | placement [1]; - ptr[ctx->nreloc].flags = 0; + if (ctx->nreloc >= RADEON_CTX_MAX_PM4) { + return -EBUSY; + } + ctx->reloc[ctx->nreloc].handle = bo->handle; + ctx->reloc[ctx->nreloc].read_domain = placement[0] | placement [1]; + ctx->reloc[ctx->nreloc].write_domain = placement[0] | placement [1]; + ctx->reloc[ctx->nreloc].flags = 0; ctx->pm4[id] = ctx->nreloc * sizeof(struct radeon_cs_reloc) / 4; ctx->nreloc++; return 0; @@ -208,11 +209,14 @@ static int radeon_ctx_state_schedule(struct radeon_ctx *ctx, struct radeon_state if (state == NULL) return 0; - memcpy(&ctx->pm4[ctx->id], state->pm4, state->cpm4 * 4); + if (state->cpm4 > ctx->ndwords) { + return -EBUSY; + } + memcpy(&ctx->pm4[ctx->cdwords], state->pm4, state->cpm4 * 4); for (i = 0; i < state->nreloc; i++) { rid = state->reloc_pm4_id[i]; bid = state->reloc_bo_id[i]; - cid = ctx->id + rid; + cid = ctx->cdwords + rid; r = radeon_ctx_reloc(ctx, state->bo[bid], cid, &state->placement[bid * 2]); if (r) { @@ -220,120 +224,65 @@ static int radeon_ctx_state_schedule(struct radeon_ctx *ctx, struct radeon_state return r; } } - ctx->id += state->cpm4; + ctx->cdwords += state->cpm4; + ctx->ndwords -= state->cpm4; return 0; } int radeon_ctx_set_query_state(struct radeon_ctx *ctx, struct radeon_state *state) { - void *tmp; int r = 0; /* !!! ONLY ACCEPT QUERY STATE HERE !!! */ - if (state->stype->stype != R600_STATE_QUERY_BEGIN && state->stype->stype != R600_STATE_QUERY_END) { - return -EINVAL; - } r = radeon_state_pm4(state); if (r) return r; - if ((ctx->draw_cpm4 + state->cpm4) > RADEON_CTX_MAX_PM4) { - /* need to flush */ - return -EBUSY; - } - if (state->cpm4 >= RADEON_CTX_MAX_PM4) { - fprintf(stderr, "%s single state too big %d, max %d\n", - __func__, state->cpm4, RADEON_CTX_MAX_PM4); - return -EINVAL; - } - tmp = realloc(ctx->state, (ctx->nstate + 1) * sizeof(void*)); - if (tmp == NULL) - return -ENOMEM; - ctx->state = tmp; - ctx->state[ctx->nstate++] = radeon_state_incref(state); /* BEGIN/END query are balanced in the same cs so account for END * END query when scheduling BEGIN query */ - if (state->stype->stype == R600_STATE_QUERY_BEGIN) { - ctx->draw_cpm4 += state->cpm4 * 2; + switch (state->stype->stype) { + case R600_STATE_QUERY_BEGIN: + /* is there enough place for begin & end */ + if ((state->cpm4 * 2) > ctx->ndwords) + return -EBUSY; + ctx->ndwords -= state->cpm4; + break; + case R600_STATE_QUERY_END: + ctx->ndwords += state->cpm4; + break; + default: + return -EINVAL; } - return 0; + return radeon_ctx_state_schedule(ctx, state); } -int radeon_ctx_set_draw_new(struct radeon_ctx *ctx, struct radeon_draw *draw) +int radeon_ctx_set_draw(struct radeon_ctx *ctx, struct radeon_draw *draw) { - struct radeon_draw *pdraw = NULL; - struct radeon_draw **ndraw; - struct radeon_state *nstate, *ostate; - unsigned cpm4, i, cstate; - void *tmp; + unsigned previous_cdwords; int r = 0; - ndraw = realloc(ctx->draw, sizeof(void*) * (ctx->ndraw + 1)); - if (ndraw == NULL) - return -ENOMEM; - ctx->draw = ndraw; - for (i = 0; i < draw->nstate; i++) { + for (int i = 0; i < (ctx->radeon->nstate_per_shader * R600_SHADER_MAX); i++) { r = radeon_ctx_state_bo(ctx, draw->state[i]); if (r) return r; } - r = radeon_draw_check(draw); - if (r) - return r; - if (draw->cpm4 >= RADEON_CTX_MAX_PM4) { - fprintf(stderr, "%s single draw too big %d, max %d\n", - __func__, draw->cpm4, RADEON_CTX_MAX_PM4); - return -EINVAL; - } - tmp = realloc(ctx->state, (ctx->nstate + draw->nstate) * sizeof(void*)); - if (tmp == NULL) - return -ENOMEM; - ctx->state = tmp; - pdraw = ctx->cdraw; - for (i = 0, cpm4 = 0, cstate = ctx->nstate; i < draw->nstate - 1; i++) { - nstate = draw->state[i]; - if (nstate) { - if (pdraw && pdraw->state[i]) { - ostate = pdraw->state[i]; - if (ostate->pm4_crc != nstate->pm4_crc) { - ctx->state[cstate++] = nstate; - cpm4 += nstate->cpm4; + previous_cdwords = ctx->cdwords; + for (int i = 0, id = 0; i < ctx->radeon->nstate_per_shader; i++) { + for (int j = 0; j < R600_SHADER_MAX; j++) { + id = j * ctx->radeon->nstate_per_shader + i; + if (draw->state[id]) { + r = radeon_ctx_state_schedule(ctx, draw->state[id]); + if (r) { + ctx->cdwords = previous_cdwords; + return r; } - } else { - ctx->state[cstate++] = nstate; - cpm4 += nstate->cpm4; } } } - /* The last state is the draw state always add it */ - if (draw->state[i] == NULL) { - fprintf(stderr, "%s no draw command\n", __func__); - return -EINVAL; - } - ctx->state[cstate++] = draw->state[i]; - cpm4 += draw->state[i]->cpm4; - if ((ctx->draw_cpm4 + cpm4) > RADEON_CTX_MAX_PM4) { - /* need to flush */ - return -EBUSY; - } - ctx->draw_cpm4 += cpm4; - ctx->nstate = cstate; - ctx->draw[ctx->ndraw++] = draw; - ctx->cdraw = draw; return 0; } -int radeon_ctx_set_draw(struct radeon_ctx *ctx, struct radeon_draw *draw) -{ - int r; - - radeon_draw_incref(draw); - r = radeon_ctx_set_draw_new(ctx, draw); - if (r) - radeon_draw_decref(draw); - return r; -} - +#if 0 int radeon_ctx_pm4(struct radeon_ctx *ctx) { unsigned i; @@ -345,9 +294,6 @@ int radeon_ctx_pm4(struct radeon_ctx *ctx) if (ctx->pm4 == NULL) return -EINVAL; for (i = 0, ctx->id = 0; i < ctx->nstate; i++) { - r = radeon_ctx_state_schedule(ctx, ctx->state[i]); - if (r) - return r; } if (ctx->id != ctx->draw_cpm4) { fprintf(stderr, "%s miss predicted pm4 size %d for %d\n", @@ -357,6 +303,7 @@ int radeon_ctx_pm4(struct radeon_ctx *ctx) ctx->cpm4 = ctx->draw_cpm4; return 0; } +#endif void radeon_ctx_dump_bof(struct radeon_ctx *ctx, const char *file) { @@ -384,8 +331,8 @@ printf("%d relocs\n", ctx->nreloc); bof_decref(blob); blob = NULL; /* dump cs */ -printf("%d pm4\n", ctx->cpm4); - blob = bof_blob(ctx->cpm4 * 4, ctx->pm4); +printf("%d pm4\n", ctx->cdwords); + blob = bof_blob(ctx->cdwords * 4, ctx->pm4); if (blob == NULL) goto out_err; if (bof_object_set(root, "pm4", blob)) diff --git a/src/gallium/winsys/r600/drm/radeon_draw.c b/src/gallium/winsys/r600/drm/radeon_draw.c index 0eacdc74a0..b992c4a55d 100644 --- a/src/gallium/winsys/r600/drm/radeon_draw.c +++ b/src/gallium/winsys/r600/drm/radeon_draw.c @@ -31,116 +31,27 @@ /* * draw functions */ -struct radeon_draw *radeon_draw(struct radeon *radeon) +int radeon_draw_init(struct radeon_draw *draw, struct radeon *radeon) { - struct radeon_draw *draw; - - draw = calloc(1, sizeof(*draw)); - if (draw == NULL) - return NULL; - draw->nstate = radeon->nstate; draw->radeon = radeon; - draw->refcount = 1; - draw->state = calloc(1, sizeof(void*) * draw->nstate); - if (draw->state == NULL) { - free(draw); - return NULL; - } - return draw; -} - -struct radeon_draw *radeon_draw_incref(struct radeon_draw *draw) -{ - draw->refcount++; - return draw; -} - -struct radeon_draw *radeon_draw_decref(struct radeon_draw *draw) -{ - unsigned i; - - if (draw == NULL) - return NULL; - if (--draw->refcount > 0) - return NULL; - for (i = 0; i < draw->nstate; i++) { - draw->state[i] = radeon_state_decref(draw->state[i]); - } - free(draw->state); - memset(draw, 0, sizeof(*draw)); - free(draw); - return NULL; -} - -int radeon_draw_set_new(struct radeon_draw *draw, struct radeon_state *state) -{ - int id; - if (state == NULL) - return 0; - - id = state->stype->base_id + (state->id + (state->stype->num * state->shader_index)); - if (id > draw->radeon->nstate) - { - return -EINVAL; - } - draw->state[id] = radeon_state_decref(draw->state[id]); - draw->state[id] = state; + draw->state = calloc(radeon->nstate_per_shader * R600_SHADER_MAX, sizeof(void*)); + if (draw->state == NULL) + return -ENOMEM; return 0; } -int radeon_draw_set(struct radeon_draw *draw, struct radeon_state *state) +void radeon_draw_bind(struct radeon_draw *draw, struct radeon_state *state) { if (state == NULL) - return 0; - radeon_state_incref(state); - return radeon_draw_set_new(draw, state); + return; + draw->state[state->state_id] = state; } -int radeon_draw_check(struct radeon_draw *draw) +void radeon_draw_unbind(struct radeon_draw *draw, struct radeon_state *state) { - unsigned i; - int r; - - r = radeon_draw_pm4(draw); - if (r) - return r; - for (i = 0, draw->cpm4 = 0; i < draw->nstate; i++) { - if (draw->state[i]) { - draw->cpm4 += draw->state[i]->cpm4; - } - } - return 0; -} - -struct radeon_draw *radeon_draw_duplicate(struct radeon_draw *draw) -{ - struct radeon_draw *ndraw; - unsigned i; - - if (draw == NULL) - return NULL; - ndraw = radeon_draw(draw->radeon); - if (ndraw == NULL) { - return NULL; - } - for (i = 0; i < draw->nstate; i++) { - if (radeon_draw_set(ndraw, draw->state[i])) { - radeon_draw_decref(ndraw); - return NULL; - } - } - return ndraw; -} - -int radeon_draw_pm4(struct radeon_draw *draw) -{ - unsigned i; - int r; - - for (i = 0; i < draw->nstate; i++) { - r = radeon_state_pm4(draw->state[i]); - if (r) - return r; + if (state == NULL) + return; + if (draw->state[state->state_id] == state) { + draw->state[state->state_id] = NULL; } - return 0; } diff --git a/src/gallium/winsys/r600/drm/radeon_priv.h b/src/gallium/winsys/r600/drm/radeon_priv.h index af5319efd1..84e552ba4d 100644 --- a/src/gallium/winsys/r600/drm/radeon_priv.h +++ b/src/gallium/winsys/r600/drm/radeon_priv.h @@ -58,9 +58,10 @@ struct radeon { int refcount; unsigned device; unsigned family; - unsigned nstate; - unsigned nstype; - struct radeon_stype_info *stype; + unsigned nstype; + unsigned nstate_per_shader; + unsigned *state_type_id; + struct radeon_stype_info *stype; }; extern struct radeon *radeon_new(int fd, unsigned device); @@ -69,12 +70,6 @@ extern struct radeon *radeon_decref(struct radeon *radeon); extern unsigned radeon_family_from_device(unsigned device); extern int radeon_is_family_compatible(unsigned family1, unsigned family2); -int radeon_ctx_set_bo_new(struct radeon_ctx *ctx, struct radeon_bo *bo); -struct radeon_bo *radeon_ctx_get_bo(struct radeon_ctx *ctx, unsigned reloc); -void radeon_ctx_get_placement(struct radeon_ctx *ctx, unsigned reloc, u32 *placement); -int radeon_ctx_set_draw_new(struct radeon_ctx *ctx, struct radeon_draw *draw); -int radeon_ctx_draw(struct radeon_ctx *ctx); - /* * r600/r700 context functions */ diff --git a/src/gallium/winsys/r600/drm/radeon_state.c b/src/gallium/winsys/r600/drm/radeon_state.c index d4e622cf7f..ac60485b28 100644 --- a/src/gallium/winsys/r600/drm/radeon_state.c +++ b/src/gallium/winsys/r600/drm/radeon_state.c @@ -32,9 +32,8 @@ /* * state core functions */ -struct radeon_state *radeon_state_shader(struct radeon *radeon, u32 stype, u32 id, u32 shader_type) +int radeon_state_init(struct radeon_state *state, struct radeon *radeon, u32 stype, u32 id, u32 shader_type) { - struct radeon_state *state; struct radeon_stype_info *found = NULL; int i, j, shader_index = -1; @@ -67,12 +66,11 @@ struct radeon_state *radeon_state_shader(struct radeon *radeon, u32 stype, u32 i if (!found) { fprintf(stderr, "%s invalid type %d/id %d/shader class %d\n", __func__, stype, id, shader_type); - return NULL; + return -EINVAL; } - state = calloc(1, sizeof(*state)); - if (state == NULL) - return NULL; + memset(state, 0, sizeof(struct radeon_state)); + state->state_id = radeon->nstate_per_shader * shader_index + radeon->state_type_id[stype] + id; state->stype = found; state->radeon = radeon; state->id = id; @@ -80,7 +78,7 @@ struct radeon_state *radeon_state_shader(struct radeon *radeon, u32 stype, u32 i state->refcount = 1; state->npm4 = found->npm4; state->nstates = found->reginfo[shader_index].nstates; - return state; + return 0; } int radeon_state_convert(struct radeon_state *state, u32 stype, u32 id, u32 shader_type) @@ -130,57 +128,20 @@ int radeon_state_convert(struct radeon_state *state, u32 stype, u32 id, u32 shad state->stype = found; state->id = id; state->shader_index = shader_index; + state->state_id = state->radeon->nstate_per_shader * shader_index + state->radeon->state_type_id[stype] + id; return radeon_state_pm4(state); } -struct radeon_state *radeon_state(struct radeon *radeon, u32 type, u32 id) -{ - return radeon_state_shader(radeon, type, id, 0); -} - -struct radeon_state *radeon_state_duplicate(struct radeon_state *state) -{ - struct radeon_state *nstate = radeon_state_shader(state->radeon, state->stype->stype, state->id, (1 << state->shader_index)); - unsigned i; - - if (state == NULL) - return NULL; - nstate->cpm4 = state->cpm4; - nstate->nbo = state->nbo; - nstate->nreloc = state->nreloc; - memcpy(nstate->states, state->states, state->nstates * 4); - memcpy(nstate->pm4, state->pm4, state->npm4 * 4); - memcpy(nstate->placement, state->placement, 8 * 4); - memcpy(nstate->reloc_pm4_id, state->reloc_pm4_id, 8 * 4); - memcpy(nstate->reloc_bo_id, state->reloc_bo_id, 8 * 4); - memcpy(nstate->bo_dirty, state->bo_dirty, 4 * 4); - for (i = 0; i < state->nbo; i++) { - nstate->bo[i] = radeon_bo_incref(state->radeon, state->bo[i]); - } - return nstate; -} - -struct radeon_state *radeon_state_incref(struct radeon_state *state) -{ - state->refcount++; - return state; -} - -struct radeon_state *radeon_state_decref(struct radeon_state *state) +void radeon_state_fini(struct radeon_state *state) { unsigned i; if (state == NULL) return NULL; - if (--state->refcount > 0) { - return NULL; - } for (i = 0; i < state->nbo; i++) { state->bo[i] = radeon_bo_decref(state->radeon, state->bo[i]); } - memset(state, 0, sizeof(*state)); - free(state); - return NULL; + memset(state, 0, sizeof(struct radeon_state)); } int radeon_state_replace_always(struct radeon_state *ostate, -- cgit v1.2.3 From a4262874f84e25412cb9bc53b3f1771e4017e27c Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Wed, 1 Sep 2010 10:12:55 -0700 Subject: glsl2: Allow ir_constant::zero to create boolean constants --- src/glsl/ir.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/glsl/ir.cpp b/src/glsl/ir.cpp index 992853c046..5bd023f499 100644 --- a/src/glsl/ir.cpp +++ b/src/glsl/ir.cpp @@ -454,7 +454,7 @@ 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()); + assert(type->is_numeric() || type->is_boolean()); ir_constant *c = new(mem_ctx) ir_constant; c->type = type; -- cgit v1.2.3 From a35faa6a41eb8a240f8e6086853653e9a21e75bd Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Wed, 1 Sep 2010 10:13:21 -0700 Subject: glsl2: Perform algebraic simplifications on logical binary operators Reduces glsl-vs-all-01 from 42 Mesa IR instructions (including the END) to 17. --- src/glsl/ir_algebraic.cpp | 52 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) (limited to 'src') diff --git a/src/glsl/ir_algebraic.cpp b/src/glsl/ir_algebraic.cpp index b731ba05be..ff81563f19 100644 --- a/src/glsl/ir_algebraic.cpp +++ b/src/glsl/ir_algebraic.cpp @@ -366,6 +366,58 @@ ir_algebraic_visitor::handle_expression(ir_expression *ir) } break; + case ir_binop_logic_and: + /* FINISHME: Also simplify (a && a) to (a). */ + if (is_vec_one(op_const[0])) { + this->progress = true; + return ir->operands[1]; + } else if (is_vec_one(op_const[1])) { + this->progress = true; + return ir->operands[0]; + } else if (is_vec_zero(op_const[0]) || is_vec_zero(op_const[1])) { + this->progress = true; + return ir_constant::zero(mem_ctx, ir->type); + } + break; + + case ir_binop_logic_xor: + /* FINISHME: Also simplify (a ^^ a) to (false). */ + if (is_vec_zero(op_const[0])) { + this->progress = true; + return ir->operands[1]; + } else if (is_vec_zero(op_const[1])) { + this->progress = true; + return ir->operands[0]; + } else if (is_vec_one(op_const[0])) { + this->progress = true; + return new(mem_ctx) ir_expression(ir_unop_logic_not, ir->type, + ir->operands[1], NULL); + } else if (is_vec_one(op_const[1])) { + this->progress = true; + return new(mem_ctx) ir_expression(ir_unop_logic_not, ir->type, + ir->operands[0], NULL); + } + break; + + case ir_binop_logic_or: + /* FINISHME: Also simplify (a || a) to (a). */ + if (is_vec_zero(op_const[0])) { + this->progress = true; + return ir->operands[1]; + } else if (is_vec_zero(op_const[1])) { + this->progress = true; + return ir->operands[0]; + } else if (is_vec_one(op_const[0]) || is_vec_one(op_const[1])) { + ir_constant_data data; + + for (unsigned i = 0; i < 16; i++) + data.b[i] = true; + + this->progress = true; + return new(mem_ctx) ir_constant(ir->type, &data); + } + break; + case ir_unop_rcp: if (op_expr[0] && op_expr[0]->operation == ir_unop_rcp) { this->progress = true; -- cgit v1.2.3 From dd5ef33e3c2ac7886ca71344e41201d0be2062c0 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 1 Sep 2010 10:41:36 -0700 Subject: i965: DP2 produces a scalar result like DP3, DP4, etc. Fixes glsl-fs-dot-vec2-2. --- src/mesa/drivers/dri/i965/brw_wm.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_wm.c b/src/mesa/drivers/dri/i965/brw_wm.c index 899e9b1dfb..d70be7bda2 100644 --- a/src/mesa/drivers/dri/i965/brw_wm.c +++ b/src/mesa/drivers/dri/i965/brw_wm.c @@ -68,6 +68,7 @@ GLuint brw_wm_is_scalar_result( GLuint opcode ) case OPCODE_RCP: case OPCODE_RSQ: case OPCODE_SIN: + case OPCODE_DP2: case OPCODE_DP3: case OPCODE_DP4: case OPCODE_DPH: -- cgit v1.2.3 From 6ac66192a66b4370fd5601d876f5bdc84a4841b2 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 1 Sep 2010 12:39:04 -0600 Subject: st/glx: re-order destruction of buffers, visuals Free the buffers before the visuals. Fixes valgrind warning reported in fd.o bug 29919. --- src/gallium/state_trackers/glx/xlib/glx_api.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/state_trackers/glx/xlib/glx_api.c b/src/gallium/state_trackers/glx/xlib/glx_api.c index a90edfb055..dcd50e19d7 100644 --- a/src/gallium/state_trackers/glx/xlib/glx_api.c +++ b/src/gallium/state_trackers/glx/xlib/glx_api.c @@ -599,8 +599,8 @@ destroy_visuals_on_display(Display *dpy) static int close_display_callback(Display *dpy, XExtCodes *codes) { - destroy_visuals_on_display(dpy); xmesa_destroy_buffers_on_display(dpy); + destroy_visuals_on_display(dpy); return 0; } -- cgit v1.2.3 From c70459a1b9f718ae0748070cbf8c7c623d8840ac Mon Sep 17 00:00:00 2001 From: Alex Deucher Date: Wed, 1 Sep 2010 13:57:52 -0400 Subject: r600g: fix up default state differences between r6xx and r7xx Signed-off-by: Alex Deucher --- src/gallium/drivers/r600/r600_context.c | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/r600_context.c b/src/gallium/drivers/r600/r600_context.c index 95e9b6a8ed..f1781ce7fb 100644 --- a/src/gallium/drivers/r600/r600_context.c +++ b/src/gallium/drivers/r600/r600_context.c @@ -258,13 +258,24 @@ static void r600_init_config(struct r600_context *rctx) rctx->config.states[R600_CONFIG__SQ_STACK_RESOURCE_MGMT_2] |= S_008C14_NUM_GS_STACK_ENTRIES(num_gs_stack_entries); rctx->config.states[R600_CONFIG__SQ_STACK_RESOURCE_MGMT_2] |= S_008C14_NUM_ES_STACK_ENTRIES(num_es_stack_entries); - rctx->config.states[R600_CONFIG__SQ_DYN_GPR_CNTL_PS_FLUSH_REQ] = 0x00004000; - rctx->config.states[R600_CONFIG__TA_CNTL_AUX] = 0x07000002; rctx->config.states[R600_CONFIG__VC_ENHANCE] = 0x00000000; - rctx->config.states[R600_CONFIG__DB_DEBUG] = 0x00000000; - rctx->config.states[R600_CONFIG__DB_WATERMARKS] = 0x00420204; rctx->config.states[R600_CONFIG__SX_MISC] = 0x00000000; - rctx->config.states[R600_CONFIG__SPI_THREAD_GROUPING] = 0x00000001; + + if (family >= CHIP_RV770) { + rctx->config.states[R600_CONFIG__SQ_DYN_GPR_CNTL_PS_FLUSH_REQ] = 0x00004000; + rctx->config.states[R600_CONFIG__TA_CNTL_AUX] = 0x07000002; + rctx->config.states[R600_CONFIG__DB_DEBUG] = 0x00000000; + rctx->config.states[R600_CONFIG__DB_WATERMARKS] = 0x00420204; + rctx->config.states[R600_CONFIG__SPI_THREAD_GROUPING] = 0x00000000; + rctx->config.states[R600_CONFIG__PA_SC_MODE_CNTL] = 0x00514000; + } else { + rctx->config.states[R600_CONFIG__SQ_DYN_GPR_CNTL_PS_FLUSH_REQ] = 0x00000000; + rctx->config.states[R600_CONFIG__TA_CNTL_AUX] = 0x07000003; + rctx->config.states[R600_CONFIG__DB_DEBUG] = 0x82000000; + rctx->config.states[R600_CONFIG__DB_WATERMARKS] = 0x01020204; + rctx->config.states[R600_CONFIG__SPI_THREAD_GROUPING] = 0x00000001; + rctx->config.states[R600_CONFIG__PA_SC_MODE_CNTL] = 0x00004010; + } rctx->config.states[R600_CONFIG__CB_SHADER_CONTROL] = 0x00000003; rctx->config.states[R600_CONFIG__SQ_ESGS_RING_ITEMSIZE] = 0x00000000; rctx->config.states[R600_CONFIG__SQ_GSVS_RING_ITEMSIZE] = 0x00000000; @@ -288,7 +299,6 @@ static void r600_init_config(struct r600_context *rctx) rctx->config.states[R600_CONFIG__VGT_GROUP_VECT_0_FMT_CNTL] = 0x00000000; rctx->config.states[R600_CONFIG__VGT_GROUP_VECT_1_FMT_CNTL] = 0x00000000; rctx->config.states[R600_CONFIG__VGT_GS_MODE] = 0x00000000; - rctx->config.states[R600_CONFIG__PA_SC_MODE_CNTL] = 0x00514000; rctx->config.states[R600_CONFIG__VGT_STRMOUT_EN] = 0x00000000; rctx->config.states[R600_CONFIG__VGT_REUSE_OFF] = 0x00000001; rctx->config.states[R600_CONFIG__VGT_VTX_CNT_EN] = 0x00000000; -- cgit v1.2.3 From 0181385f36463ff03f4ed657b180acd8567c05d4 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Wed, 1 Sep 2010 11:47:52 -0700 Subject: glsl: Add forgotten implementations of equal/notEqual on bvecs. --- src/glsl/builtin_function.cpp | 60 +++++++++++++++++++++++++++++++++++++++++++ src/glsl/builtins/ir/equal | 30 ++++++++++++++++++++++ src/glsl/builtins/ir/notEqual | 30 ++++++++++++++++++++++ 3 files changed, 120 insertions(+) (limited to 'src') diff --git a/src/glsl/builtin_function.cpp b/src/glsl/builtin_function.cpp index e6feb55759..892b5aa857 100644 --- a/src/glsl/builtin_function.cpp +++ b/src/glsl/builtin_function.cpp @@ -827,6 +827,36 @@ static const char *builtin_equal = "\n" " (signature bvec2\n" " (parameters\n" + " (declare (in) bvec2 arg0)\n" + " (declare (in) bvec2 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) bvec3 arg0)\n" + " (declare (in) bvec3 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) bvec4 arg0)\n" + " (declare (in) bvec4 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" @@ -2192,6 +2222,36 @@ static const char *builtin_notEqual = "\n" " (signature bvec2\n" " (parameters\n" + " (declare (in) bvec2 arg0)\n" + " (declare (in) bvec2 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) bvec3 arg0)\n" + " (declare (in) bvec3 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) bvec4 arg0)\n" + " (declare (in) bvec4 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" diff --git a/src/glsl/builtins/ir/equal b/src/glsl/builtins/ir/equal index d7a4bc6063..c394776770 100644 --- a/src/glsl/builtins/ir/equal +++ b/src/glsl/builtins/ir/equal @@ -29,6 +29,36 @@ (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) bvec2 arg0) + (declare (in) bvec2 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) bvec3 arg0) + (declare (in) bvec3 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) bvec4 arg0) + (declare (in) bvec4 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) diff --git a/src/glsl/builtins/ir/notEqual b/src/glsl/builtins/ir/notEqual index bcc7339bb6..eeeda79042 100644 --- a/src/glsl/builtins/ir/notEqual +++ b/src/glsl/builtins/ir/notEqual @@ -29,6 +29,36 @@ (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) bvec2 arg0) + (declare (in) bvec2 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) bvec3 arg0) + (declare (in) bvec3 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) bvec4 arg0) + (declare (in) bvec4 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) -- cgit v1.2.3 From fd7f2ae085ea55649089b29515e143eed43c177e Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 1 Sep 2010 12:46:57 -0600 Subject: mesa: more prog_execute.c debug code --- src/mesa/program/prog_execute.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src') diff --git a/src/mesa/program/prog_execute.c b/src/mesa/program/prog_execute.c index ff8c20c4cf..2ae5bc572a 100644 --- a/src/mesa/program/prog_execute.c +++ b/src/mesa/program/prog_execute.c @@ -771,6 +771,13 @@ _mesa_execute_program(GLcontext * ctx, result[2] = a[2] < 0.0F ? b[2] : c[2]; result[3] = a[3] < 0.0F ? b[3] : c[3]; store_vector4(inst, machine, result); + if (DEBUG_PROG) { + printf("CMP (%g %g %g %g) = (%g %g %g %g) < 0 ? (%g %g %g %g) : (%g %g %g %g)\n", + result[0], result[1], result[2], result[3], + a[0], a[1], a[2], a[3], + b[0], b[1], b[2], b[3], + c[0], c[1], c[2], c[3]); + } } break; case OPCODE_COS: -- cgit v1.2.3 From 4ff3467daf0ac07e4295c7d2e2ad3c3c8c89dff6 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 1 Sep 2010 13:21:51 -0600 Subject: mesa: fix out of bounds memory read in mipmap gen code Out of bounds reads could happen for reducing WxH to WxH/2 or WxH to W/2xH. Fixes fd.o bug 29918. --- src/mesa/main/mipmap.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/mesa/main/mipmap.c b/src/mesa/main/mipmap.c index c0c29f7889..678d17a2a3 100644 --- a/src/mesa/main/mipmap.c +++ b/src/mesa/main/mipmap.c @@ -1005,21 +1005,28 @@ make_2d_mipmap(GLenum datatype, GLuint comps, GLint border, const GLint dstRowBytes = bpt * dstRowStride; const GLubyte *srcA, *srcB; GLubyte *dst; - GLint row; + GLint row, srcRowStep; /* Compute src and dst pointers, skipping any border */ srcA = srcPtr + border * ((srcWidth + 1) * bpt); - if (srcHeight > 1) + if (srcHeight > 1 && srcHeight > dstHeight) { + /* sample from two source rows */ srcB = srcA + srcRowBytes; - else + srcRowStep = 2; + } + else { + /* sample from one source row */ srcB = srcA; + srcRowStep = 1; + } + dst = dstPtr + border * ((dstWidth + 1) * bpt); for (row = 0; row < dstHeightNB; row++) { do_row(datatype, comps, srcWidthNB, srcA, srcB, dstWidthNB, dst); - srcA += 2 * srcRowBytes; - srcB += 2 * srcRowBytes; + srcA += srcRowStep * srcRowBytes; + srcB += srcRowStep * srcRowBytes; dst += dstRowBytes; } -- cgit v1.2.3 From 67234b4b42a8285a9b14da48dd113cbe2ee871fd Mon Sep 17 00:00:00 2001 From: Jerome Glisse Date: Wed, 1 Sep 2010 18:04:38 -0400 Subject: r600g: refix db/cb state Signed-off-by: Dave Airlie Signed-off-by: Jerome Glisse --- src/gallium/drivers/r600/r600_context.c | 2 + src/gallium/drivers/r600/r600_context.h | 2 +- src/gallium/drivers/r600/r600_draw.c | 4 +- src/gallium/drivers/r600/r600_shader.c | 6 +- src/gallium/drivers/r600/r600_state.c | 135 ++++++++++++++++++++++++++------ src/gallium/drivers/r600/r600_texture.c | 2 +- 6 files changed, 119 insertions(+), 32 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/r600_context.c b/src/gallium/drivers/r600/r600_context.c index f1781ce7fb..0e5e0632bf 100644 --- a/src/gallium/drivers/r600/r600_context.c +++ b/src/gallium/drivers/r600/r600_context.c @@ -57,11 +57,13 @@ void r600_flush(struct pipe_context *ctx, unsigned flags, */ if (!rctx->ctx.cdwords) goto out; +#if 0 sprintf(dname, "gallium-%08d.bof", dc); if (dc < 2) { radeon_ctx_dump_bof(&rctx->ctx, dname); R600_ERR("dumped %s\n", dname); } +#endif #if 1 radeon_ctx_submit(&rctx->ctx); #endif diff --git a/src/gallium/drivers/r600/r600_context.h b/src/gallium/drivers/r600/r600_context.h index a48dca4915..eb7a64bfbd 100644 --- a/src/gallium/drivers/r600/r600_context.h +++ b/src/gallium/drivers/r600/r600_context.h @@ -99,7 +99,7 @@ struct r600_context_state { union pipe_states state; unsigned refcount; unsigned type; - struct radeon_state rstate; + struct radeon_state rstate[16]; struct r600_shader shader; struct radeon_bo *bo; }; diff --git a/src/gallium/drivers/r600/r600_draw.c b/src/gallium/drivers/r600/r600_draw.c index bddc81e50a..9cc26bbada 100644 --- a/src/gallium/drivers/r600/r600_draw.c +++ b/src/gallium/drivers/r600/r600_draw.c @@ -91,8 +91,8 @@ static int r600_draw_common(struct r600_draw *draw) r = r600_pipe_shader_update(draw->ctx, rctx->ps_shader); if (r) return r; - radeon_draw_bind(&rctx->draw, &rctx->vs_shader->rstate); - radeon_draw_bind(&rctx->draw, &rctx->ps_shader->rstate); + radeon_draw_bind(&rctx->draw, &rctx->vs_shader->rstate[0]); + radeon_draw_bind(&rctx->draw, &rctx->ps_shader->rstate[0]); for (i = 0 ; i < rctx->vertex_elements->count; i++) { vs_resource = &rctx->vs_resource[i]; diff --git a/src/gallium/drivers/r600/r600_shader.c b/src/gallium/drivers/r600/r600_shader.c index 9af45b7793..3147bc7ca3 100644 --- a/src/gallium/drivers/r600/r600_shader.c +++ b/src/gallium/drivers/r600/r600_shader.c @@ -134,8 +134,8 @@ static int r600_pipe_shader_vs(struct pipe_context *ctx, struct r600_context_sta struct radeon_state *state; unsigned i, tmp; - state = &rpshader->rstate; - radeon_state_fini(&rpshader->rstate); + state = &rpshader->rstate[0]; + radeon_state_fini(&rpshader->rstate[0]); radeon_state_init(state, rscreen->rw, R600_STATE_SHADER, 0, R600_SHADER_VS); for (i = 0; i < 10; i++) { state->states[R600_VS_SHADER__SPI_VS_OUT_ID_0 + i] = 0; @@ -166,7 +166,7 @@ static int r600_pipe_shader_ps(struct pipe_context *ctx, struct r600_context_sta unsigned i, tmp, exports_ps, num_cout; boolean have_pos = FALSE; - state = &rpshader->rstate; + state = &rpshader->rstate[0]; rasterizer = &rctx->rasterizer->state.rasterizer; radeon_state_fini(state); radeon_state_init(state, rscreen->rw, R600_STATE_SHADER, 0, R600_SHADER_PS); diff --git a/src/gallium/drivers/r600/r600_state.c b/src/gallium/drivers/r600/r600_state.c index c6810ffe36..bb12b42213 100644 --- a/src/gallium/drivers/r600/r600_state.c +++ b/src/gallium/drivers/r600/r600_state.c @@ -39,6 +39,10 @@ static void r600_viewport(struct r600_context *rctx, struct radeon_state *rstate static void r600_ucp(struct r600_context *rctx, struct radeon_state *rstate, const struct pipe_clip_state *state); static void r600_sampler(struct r600_context *rctx, struct radeon_state *rstate, const struct pipe_sampler_state *state, unsigned id); static void r600_resource(struct pipe_context *ctx, struct radeon_state *rstate, const struct pipe_sampler_view *view, unsigned id); +static void r600_cb(struct r600_context *rctx, struct radeon_state *rstate, + const struct pipe_framebuffer_state *state, int cb); +static void r600_db(struct r600_context *rctx, struct radeon_state *rstate, + const struct pipe_framebuffer_state *state); static void *r600_create_blend_state(struct pipe_context *ctx, @@ -93,7 +97,7 @@ static struct pipe_sampler_view *r600_create_sampler_view(struct pipe_context *c rstate->state.sampler_view.texture = texture; rstate->state.sampler_view.reference.count = 1; rstate->state.sampler_view.context = ctx; - r600_resource(ctx, &rstate->rstate, &rstate->state.sampler_view, 0); + r600_resource(ctx, &rstate->rstate[0], &rstate->state.sampler_view, 0); return &rstate->state.sampler_view; } @@ -238,7 +242,7 @@ static void r600_bind_ps_sampler(struct pipe_context *ctx, rstate = (struct r600_context_state *)states[i]; rctx->ps_sampler[i] = r600_context_state_incref(rstate); if (rstate) { - radeon_state_convert(&rstate->rstate, R600_STATE_SAMPLER, i, R600_SHADER_PS); + radeon_state_convert(&rstate->rstate[0], R600_STATE_SAMPLER, i, R600_SHADER_PS); } } rctx->ps_nsampler = count; @@ -258,7 +262,7 @@ static void r600_bind_vs_sampler(struct pipe_context *ctx, rstate = (struct r600_context_state *)states[i]; rctx->vs_sampler[i] = r600_context_state_incref(rstate); if (rstate) { - radeon_state_convert(&rstate->rstate, R600_STATE_SAMPLER, i, R600_SHADER_VS); + radeon_state_convert(&rstate->rstate[0], R600_STATE_SAMPLER, i, R600_SHADER_VS); } } rctx->vs_nsampler = count; @@ -352,7 +356,7 @@ static void r600_set_ps_sampler_view(struct pipe_context *ctx, rstate = (struct r600_context_state *)views[i]; rctx->ps_sampler_view[i] = r600_context_state_incref(rstate); if (rstate) { - radeon_state_convert(&rstate->rstate, R600_STATE_RESOURCE, i, R600_SHADER_PS); + radeon_state_convert(&rstate->rstate[0], R600_STATE_RESOURCE, i, R600_SHADER_PS); } } rctx->ps_nsampler_view = count; @@ -373,7 +377,7 @@ static void r600_set_vs_sampler_view(struct pipe_context *ctx, rstate = (struct r600_context_state *)views[i]; rctx->vs_sampler_view[i] = r600_context_state_incref(rstate); if (rstate) { - radeon_state_convert(&rstate->rstate, R600_STATE_RESOURCE, i, R600_SHADER_VS); + radeon_state_convert(&rstate->rstate[0], R600_STATE_RESOURCE, i, R600_SHADER_VS); } } rctx->vs_nsampler_view = count; @@ -383,18 +387,15 @@ static void r600_set_framebuffer_state(struct pipe_context *ctx, const struct pipe_framebuffer_state *state) { struct r600_context *rctx = r600_context(ctx); - struct r600_resource_texture *rtexture; struct r600_context_state *rstate; rstate = r600_context_state(rctx, pipe_framebuffer_type, state); r600_bind_state(ctx, rstate); for (int i = 0; i < state->nr_cbufs; i++) { - rtexture = (struct r600_resource_texture*)state->cbufs[i]->texture; - r600_texture_cb(ctx, rtexture, i, state->cbufs[i]->level); + r600_cb(rctx, &rstate->rstate[i+1], state, i); } if (state->zsbuf) { - rtexture = (struct r600_resource_texture*)state->zsbuf->texture; - r600_texture_db(ctx, rtexture, state->zsbuf->level); + r600_db(rctx, &rstate->rstate[0], state); } } @@ -561,7 +562,7 @@ struct r600_context_state *r600_context_state_decref(struct r600_context_state * R600_ERR("invalid type %d\n", rstate->type); return NULL; } - radeon_state_fini(&rstate->rstate); + radeon_state_fini(&rstate->rstate[0]); FREE(rstate); return NULL; } @@ -594,7 +595,7 @@ struct r600_context_state *r600_context_state(struct r600_context *rctx, unsigne break; case pipe_viewport_type: rstate->state.viewport = (*states).viewport; - r600_viewport(rctx, &rstate->rstate, &rstate->state.viewport); + r600_viewport(rctx, &rstate->rstate[0], &rstate->state.viewport); break; case pipe_depth_type: rstate->state.depth = (*states).depth; @@ -610,7 +611,7 @@ struct r600_context_state *r600_context_state(struct r600_context *rctx, unsigne break; case pipe_clip_type: rstate->state.clip = (*states).clip; - r600_ucp(rctx, &rstate->rstate, &rstate->state.clip); + r600_ucp(rctx, &rstate->rstate[0], &rstate->state.clip); break; case pipe_stencil_type: rstate->state.stencil = (*states).stencil; @@ -623,7 +624,7 @@ struct r600_context_state *r600_context_state(struct r600_context *rctx, unsigne break; case pipe_blend_type: rstate->state.blend = (*states).blend; - r600_blend(rctx, &rstate->rstate, &rstate->state.blend); + r600_blend(rctx, &rstate->rstate[0], &rstate->state.blend); break; case pipe_stencil_ref_type: rstate->state.stencil_ref = (*states).stencil_ref; @@ -638,7 +639,7 @@ struct r600_context_state *r600_context_state(struct r600_context *rctx, unsigne break; case pipe_sampler_type: rstate->state.sampler = (*states).sampler; - r600_sampler(rctx, &rstate->rstate, &rstate->state.sampler, 0); + r600_sampler(rctx, &rstate->rstate[0], &rstate->state.sampler, 0); break; default: R600_ERR("invalid type %d\n", rstate->type); @@ -716,6 +717,93 @@ static void r600_ucp(struct r600_context *rctx, struct radeon_state *rstate, radeon_state_pm4(rstate); } +static void r600_cb(struct r600_context *rctx, struct radeon_state *rstate, + struct pipe_framebuffer_state *state, int cb) +{ + struct r600_screen *rscreen = rctx->screen; + struct r600_resource_texture *rtex; + struct r600_resource *rbuffer; + unsigned level = state->cbufs[cb]->level; + unsigned pitch, slice; + unsigned color_info; + unsigned format, swap, ntype; + const struct util_format_description *desc; + + radeon_state_init(rstate, rscreen->rw, R600_STATE_CB0 + cb, 0, 0); + rtex = (struct r600_resource_texture*)state->cbufs[cb]->texture; + rbuffer = &rtex->resource; + rstate->bo[0] = radeon_bo_incref(rscreen->rw, rbuffer->bo); + rstate->bo[1] = radeon_bo_incref(rscreen->rw, rbuffer->bo); + rstate->bo[2] = radeon_bo_incref(rscreen->rw, rbuffer->bo); + rstate->placement[0] = RADEON_GEM_DOMAIN_GTT; + rstate->placement[2] = RADEON_GEM_DOMAIN_GTT; + rstate->placement[4] = RADEON_GEM_DOMAIN_GTT; + rstate->nbo = 3; + pitch = (rtex->pitch[level] / rtex->bpt) / 8 - 1; + slice = (rtex->pitch[level] / rtex->bpt) * state->cbufs[cb]->height / 64 - 1; + + ntype = 0; + desc = util_format_description(rtex->resource.base.b.format); + if (desc->colorspace == UTIL_FORMAT_COLORSPACE_SRGB) + ntype = V_0280A0_NUMBER_SRGB; + + format = r600_translate_colorformat(rtex->resource.base.b.format); + swap = r600_translate_colorswap(rtex->resource.base.b.format); + + color_info = S_0280A0_FORMAT(format) | + S_0280A0_COMP_SWAP(swap) | + S_0280A0_BLEND_CLAMP(1) | + S_0280A0_SOURCE_FORMAT(1) | + S_0280A0_NUMBER_TYPE(ntype); + + rstate->states[R600_CB0__CB_COLOR0_BASE] = state->cbufs[cb]->offset >> 8; + rstate->states[R600_CB0__CB_COLOR0_INFO] = color_info; + rstate->states[R600_CB0__CB_COLOR0_SIZE] = S_028060_PITCH_TILE_MAX(pitch) | + S_028060_SLICE_TILE_MAX(slice); + rstate->states[R600_CB0__CB_COLOR0_VIEW] = 0x00000000; + rstate->states[R600_CB0__CB_COLOR0_FRAG] = 0x00000000; + rstate->states[R600_CB0__CB_COLOR0_TILE] = 0x00000000; + rstate->states[R600_CB0__CB_COLOR0_MASK] = 0x00000000; + radeon_state_pm4(rstate); +} + +static void r600_db(struct r600_context *rctx, struct radeon_state *rstate, + const struct pipe_framebuffer_state *state) +{ + struct r600_screen *rscreen = rctx->screen; + struct r600_resource_texture *rtex; + struct r600_resource *rbuffer; + unsigned level; + unsigned pitch, slice, format; + + radeon_state_init(rstate, rscreen->rw, R600_STATE_DB, 0, 0); + if (state->zsbuf == NULL) + return; + + rtex = (struct r600_resource_texture*)state->zsbuf->texture; + rtex->tilled = 1; + rtex->array_mode = 2; + rtex->tile_type = 1; + rtex->depth = 1; + rbuffer = &rtex->resource; + + rstate->bo[0] = radeon_bo_incref(rscreen->rw, rbuffer->bo); + rstate->nbo = 1; + rstate->placement[0] = RADEON_GEM_DOMAIN_VRAM; + level = state->zsbuf->level; + pitch = (rtex->pitch[level] / rtex->bpt) / 8 - 1; + slice = (rtex->pitch[level] / rtex->bpt) * state->zsbuf->height / 64 - 1; + format = r600_translate_dbformat(state->zsbuf->texture->format); + rstate->states[R600_DB__DB_DEPTH_BASE] = state->zsbuf->offset >> 8; + rstate->states[R600_DB__DB_DEPTH_INFO] = S_028010_ARRAY_MODE(rtex->array_mode) | + S_028010_FORMAT(format); + rstate->states[R600_DB__DB_DEPTH_VIEW] = 0x00000000; + rstate->states[R600_DB__DB_PREFETCH_LIMIT] = (state->zsbuf->height / 8) -1; + rstate->states[R600_DB__DB_DEPTH_SIZE] = S_028000_PITCH_TILE_MAX(pitch) | + S_028000_SLICE_TILE_MAX(slice); + radeon_state_pm4(rstate); +} + static void r600_rasterizer(struct r600_context *rctx, struct radeon_state *rstate) { const struct pipe_rasterizer_state *state = &rctx->rasterizer->state.rasterizer; @@ -1233,7 +1321,6 @@ static void r600_cb_cntl(struct r600_context *rctx, struct radeon_state *rstate) int r600_context_hw_states(struct pipe_context *ctx) { struct r600_context *rctx = r600_context(ctx); - struct r600_resource_texture *rtexture; unsigned i; /* build new states */ @@ -1251,30 +1338,28 @@ int r600_context_hw_states(struct pipe_context *ctx) radeon_draw_bind(&rctx->draw, &rctx->config); if (rctx->viewport) { - radeon_draw_bind(&rctx->draw, &rctx->viewport->rstate); + radeon_draw_bind(&rctx->draw, &rctx->viewport->rstate[0]); } if (rctx->blend) { - radeon_draw_bind(&rctx->draw, &rctx->blend->rstate); + radeon_draw_bind(&rctx->draw, &rctx->blend->rstate[0]); } if (rctx->clip) { - radeon_draw_bind(&rctx->draw, &rctx->clip->rstate); + radeon_draw_bind(&rctx->draw, &rctx->clip->rstate[0]); } for (i = 0; i < rctx->framebuffer->state.framebuffer.nr_cbufs; i++) { - rtexture = (struct r600_resource_texture*)rctx->framebuffer->state.framebuffer.cbufs[i]->texture; - radeon_draw_bind(&rctx->draw, &rtexture->cb[i][rctx->framebuffer->state.framebuffer.cbufs[i]->level]); + radeon_draw_bind(&rctx->draw, &rctx->framebuffer->rstate[i+1]); } if (rctx->framebuffer->state.framebuffer.zsbuf) { - rtexture = (struct r600_resource_texture*)rctx->framebuffer->state.framebuffer.zsbuf->texture; - radeon_draw_bind(&rctx->draw, &rtexture->db[rctx->framebuffer->state.framebuffer.zsbuf->level]); + radeon_draw_bind(&rctx->draw, &rctx->framebuffer->rstate[0]); } for (i = 0; i < rctx->ps_nsampler; i++) { if (rctx->ps_sampler[i]) { - radeon_draw_bind(&rctx->draw, &rctx->ps_sampler[i]->rstate); + radeon_draw_bind(&rctx->draw, &rctx->ps_sampler[i]->rstate[0]); } } for (i = 0; i < rctx->ps_nsampler_view; i++) { if (rctx->ps_sampler_view[i]) { - radeon_draw_bind(&rctx->draw, &rctx->ps_sampler_view[i]->rstate); + radeon_draw_bind(&rctx->draw, &rctx->ps_sampler_view[i]->rstate[0]); } } return 0; diff --git a/src/gallium/drivers/r600/r600_texture.c b/src/gallium/drivers/r600/r600_texture.c index c472d4f37b..83fd01e8a1 100644 --- a/src/gallium/drivers/r600/r600_texture.c +++ b/src/gallium/drivers/r600/r600_texture.c @@ -632,7 +632,7 @@ out_word4: *yuv_format_p = yuv_format; return result; out_unknown: - R600_ERR("Unable to handle texformat %d %s\n", format, util_format_name(format)); +// R600_ERR("Unable to handle texformat %d %s\n", format, util_format_name(format)); return ~0; } -- cgit v1.2.3 From ffcb443cd7be563071725885b87085bd5701d980 Mon Sep 17 00:00:00 2001 From: Jerome Glisse Date: Wed, 1 Sep 2010 18:09:37 -0400 Subject: r600g: silence compiler warning Signed-off-by: Jerome Glisse --- src/gallium/drivers/r600/r600_state.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/r600_state.c b/src/gallium/drivers/r600/r600_state.c index bb12b42213..4f00cfb381 100644 --- a/src/gallium/drivers/r600/r600_state.c +++ b/src/gallium/drivers/r600/r600_state.c @@ -718,7 +718,7 @@ static void r600_ucp(struct r600_context *rctx, struct radeon_state *rstate, } static void r600_cb(struct r600_context *rctx, struct radeon_state *rstate, - struct pipe_framebuffer_state *state, int cb) + const struct pipe_framebuffer_state *state, int cb) { struct r600_screen *rscreen = rctx->screen; struct r600_resource_texture *rtex; -- cgit v1.2.3 From 557a71c50631a232528f654fa8b8e4add0e565d2 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Thu, 2 Sep 2010 09:45:37 +1000 Subject: mesa/st: remove check for buffer/elements = 0 shown by the glsl-vs-point-size failing on r600g. the test passes on softpipe and I get a full piglit test run completing on r600g. --- src/mesa/state_tracker/st_draw.c | 3 --- 1 file changed, 3 deletions(-) (limited to 'src') diff --git a/src/mesa/state_tracker/st_draw.c b/src/mesa/state_tracker/st_draw.c index 5b05489270..318e08886c 100644 --- a/src/mesa/state_tracker/st_draw.c +++ b/src/mesa/state_tracker/st_draw.c @@ -691,9 +691,6 @@ st_draw_vbo(GLcontext *ctx, pipe->set_vertex_buffers(pipe, num_vbuffers, vbuffer); cso_set_vertex_elements(st->cso_context, num_velements, velements); - if (num_vbuffers == 0 || num_velements == 0) - return; - setup_index_buffer(ctx, ib, &ibuffer); pipe->set_index_buffer(pipe, &ibuffer); -- cgit v1.2.3 From 3cddc15d9dcf44a0998dd5f29ae6f6d17370584e Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 1 Sep 2010 14:39:50 -0700 Subject: mesa: Add __printf__ attribute to printf-like functions to get warnings. --- src/mesa/main/compiler.h | 5 +++++ src/mesa/main/imports.h | 10 +++++----- 2 files changed, 10 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/mesa/main/compiler.h b/src/mesa/main/compiler.h index e0507ccf86..ded69c3106 100644 --- a/src/mesa/main/compiler.h +++ b/src/mesa/main/compiler.h @@ -316,6 +316,11 @@ static INLINE GLuint CPU_TO_LE32(GLuint x) #endif #endif +#if (__GNUC__ >= 3) +#define PRINTFLIKE(f, a) __attribute__ ((format(__printf__, f, a))) +#else +#define PRINTFLIKE(f, a) +#endif #ifndef NULL #define NULL 0 diff --git a/src/mesa/main/imports.h b/src/mesa/main/imports.h index 317e2b7df0..751f206501 100644 --- a/src/mesa/main/imports.h +++ b/src/mesa/main/imports.h @@ -566,19 +566,19 @@ extern unsigned int _mesa_str_checksum(const char *str); extern int -_mesa_snprintf( char *str, size_t size, const char *fmt, ... ); +_mesa_snprintf( char *str, size_t size, const char *fmt, ... ) PRINTFLIKE(3, 4); extern void -_mesa_warning( __GLcontext *gc, const char *fmtString, ... ); +_mesa_warning( __GLcontext *gc, const char *fmtString, ... ) PRINTFLIKE(2, 3); extern void -_mesa_problem( const __GLcontext *ctx, const char *fmtString, ... ); +_mesa_problem( const __GLcontext *ctx, const char *fmtString, ... ) PRINTFLIKE(2, 3); extern void -_mesa_error( __GLcontext *ctx, GLenum error, const char *fmtString, ... ); +_mesa_error( __GLcontext *ctx, GLenum error, const char *fmtString, ... ) PRINTFLIKE(3, 4); extern void -_mesa_debug( const __GLcontext *ctx, const char *fmtString, ... ); +_mesa_debug( const __GLcontext *ctx, const char *fmtString, ... ) PRINTFLIKE(2, 3); #if defined(_MSC_VER) && !defined(snprintf) -- cgit v1.2.3 From 86af037e6a1643284f87c5e01c3fcb09dd07bf35 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 1 Sep 2010 14:46:22 -0700 Subject: mesa: Fix many printf-like warnings. Most of these are just typecasting to long to match the arg type. I don't really care too much about getting a GLsizei or whatever appropriate type in. However, there were a number of real bugs, like missing arguments or passing floats to integer format specifiers. My favorite: printflike("%s, argument") is missing an argument. --- src/mesa/main/bufferobj.c | 18 +++++++++--------- src/mesa/main/context.c | 2 +- src/mesa/main/transformfeedback.c | 3 ++- src/mesa/swrast/s_context.c | 2 +- 4 files changed, 13 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c index 4e232b5731..895ce76e4b 100644 --- a/src/mesa/main/bufferobj.c +++ b/src/mesa/main/bufferobj.c @@ -590,7 +590,7 @@ bind_buffer_object(GLcontext *ctx, GLenum target, GLuint buffer) bindTarget = get_buffer_target(ctx, target); if (!bindTarget) { - _mesa_error(ctx, GL_INVALID_ENUM, "glBindBufferARB(target 0x%x)"); + _mesa_error(ctx, GL_INVALID_ENUM, "glBindBufferARB(target 0x%x)", target); return; } @@ -1566,14 +1566,14 @@ _mesa_CopyBufferSubData(GLenum readTarget, GLenum writeTarget, if (readOffset + size > src->Size) { _mesa_error(ctx, GL_INVALID_VALUE, "glCopyBuffserSubData(readOffset + size = %d)", - readOffset, size); + readOffset + size); return; } if (writeOffset + size > dst->Size) { _mesa_error(ctx, GL_INVALID_VALUE, "glCopyBuffserSubData(writeOffset + size = %d)", - writeOffset, size); + writeOffset + size); return; } @@ -1617,13 +1617,13 @@ _mesa_MapBufferRange(GLenum target, GLintptr offset, GLsizeiptr length, if (offset < 0) { _mesa_error(ctx, GL_INVALID_VALUE, - "glMapBufferRange(offset = %ld)", offset); + "glMapBufferRange(offset = %ld)", (long)offset); return NULL; } if (length < 0) { _mesa_error(ctx, GL_INVALID_VALUE, - "glMapBufferRange(length = %ld)", length); + "glMapBufferRange(length = %ld)", (long)length); return NULL; } @@ -1708,13 +1708,13 @@ _mesa_FlushMappedBufferRange(GLenum target, GLintptr offset, GLsizeiptr length) if (offset < 0) { _mesa_error(ctx, GL_INVALID_VALUE, - "glMapBufferRange(offset = %ld)", offset); + "glMapBufferRange(offset = %ld)", (long)offset); return; } if (length < 0) { _mesa_error(ctx, GL_INVALID_VALUE, - "glMapBufferRange(length = %ld)", length); + "glMapBufferRange(length = %ld)", (long)length); return; } @@ -1746,8 +1746,8 @@ _mesa_FlushMappedBufferRange(GLenum target, GLintptr offset, GLsizeiptr length) if (offset + length > bufObj->Length) { _mesa_error(ctx, GL_INVALID_VALUE, - "glMapBufferRange(offset %ld + length %ld > mapped length %ld)", - offset, length, bufObj->Length); + "glMapBufferRange(offset %ld + length %ld > mapped length %ld)", + (long)offset, (long)length, (long)bufObj->Length); return; } diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index 4852f46646..8e34ec4124 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -1704,7 +1704,7 @@ _mesa_valid_to_render(GLcontext *ctx, const char *where) /* using shaders */ if (!ctx->Shader.CurrentProgram->LinkStatus) { _mesa_error(ctx, GL_INVALID_OPERATION, - "%s(shader not linked), where"); + "%s(shader not linked)", where); return GL_FALSE; } #if 0 /* not normally enabled */ diff --git a/src/mesa/main/transformfeedback.c b/src/mesa/main/transformfeedback.c index f86f1911d1..fe87623522 100644 --- a/src/mesa/main/transformfeedback.c +++ b/src/mesa/main/transformfeedback.c @@ -475,7 +475,8 @@ _mesa_BindBufferRange(GLenum target, GLuint index, if (offset + size >= bufObj->Size) { _mesa_error(ctx, GL_INVALID_VALUE, - "glBindBufferRange(offset + size > buffer size)", size); + "glBindBufferRange(offset + size %d > buffer size %d)", + offset + size, bufObj->Size); return; } diff --git a/src/mesa/swrast/s_context.c b/src/mesa/swrast/s_context.c index d8d8a80b7d..f76a2b68ec 100644 --- a/src/mesa/swrast/s_context.c +++ b/src/mesa/swrast/s_context.c @@ -950,7 +950,7 @@ _swrast_print_vertex( GLcontext *ctx, const SWvertex *v ) v->attrib[FRAG_ATTRIB_COL1][2], v->attrib[FRAG_ATTRIB_COL1][3]); _mesa_debug(ctx, "fog %f\n", v->attrib[FRAG_ATTRIB_FOGC][0]); - _mesa_debug(ctx, "index %d\n", v->attrib[FRAG_ATTRIB_CI][0]); + _mesa_debug(ctx, "index %f\n", v->attrib[FRAG_ATTRIB_CI][0]); _mesa_debug(ctx, "pointsize %f\n", v->pointSize); _mesa_debug(ctx, "\n"); } -- cgit v1.2.3 From 500e7b75995460537b0e682e5bde4c32eb40b85c Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 1 Sep 2010 14:56:43 -0700 Subject: ir_to_mesa: Add a little helper for emitting link failure messages. --- src/mesa/program/ir_to_mesa.cpp | 46 ++++++++++++++++++++--------------------- 1 file changed, 22 insertions(+), 24 deletions(-) (limited to 'src') diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp index 57458d0281..2b833702e9 100644 --- a/src/mesa/program/ir_to_mesa.cpp +++ b/src/mesa/program/ir_to_mesa.cpp @@ -288,6 +288,18 @@ ir_to_mesa_dst_reg ir_to_mesa_address_reg = { PROGRAM_ADDRESS, 0, WRITEMASK_X, COND_TR, NULL }; +static void fail_link(struct gl_shader_program *prog, const char *fmt, ...) PRINTFLIKE(2, 3); + +static void fail_link(struct gl_shader_program *prog, const char *fmt, ...) + { + va_list args; + va_start(args, fmt); + prog->InfoLog = talloc_vasprintf_append(prog->InfoLog, fmt, args); + va_end(args); + + prog->LinkStatus = GL_FALSE; + } + static int swizzle_for_size(int size) { int size_swizzles[4] = { @@ -1870,11 +1882,8 @@ ir_to_mesa_visitor::get_sampler_uniform_value(ir_dereference *sampler) getname.name); if (index < 0) { - this->shader_program->InfoLog = - talloc_asprintf_append(this->shader_program->InfoLog, - "failed to find sampler named %s.\n", - getname.name); - this->shader_program->LinkStatus = GL_FALSE; + fail_link(this->shader_program, + "failed to find sampler named %s.\n", getname.name); return 0; } @@ -2372,12 +2381,9 @@ add_uniforms_to_parameters_list(struct gl_shader_program *shader_program, * from _mesa_add_uniform) has to match what the linker chose. */ if (index != parameter_index) { - shader_program->InfoLog = - talloc_asprintf_append(shader_program->InfoLog, - "Allocation of uniform `%s' to target " - "failed (%d vs %d)\n", uniform->Name, - index, parameter_index); - shader_program->LinkStatus = false; + fail_link(shader_program, "Allocation of uniform `%s' to target " + "failed (%d vs %d)\n", + uniform->Name, index, parameter_index); } } } @@ -2410,12 +2416,9 @@ set_uniform_initializer(GLcontext *ctx, void *mem_ctx, int loc = _mesa_get_uniform_location(ctx, shader_program, name); if (loc == -1) { - shader_program->InfoLog = - talloc_asprintf_append(shader_program->InfoLog, - "Couldn't find uniform for " - "initializer %s\n", name); - shader_program->LinkStatus = false; - abort(); + fail_link(shader_program, + "Couldn't find uniform for initializer %s\n", name); + return; } for (unsigned int i = 0; i < (type->is_array() ? type->length : 1); i++) { @@ -2600,10 +2603,7 @@ get_mesa_program(GLcontext *ctx, struct gl_shader_program *shader_program, prog->IndirectRegisterFiles |= 1 << mesa_inst->SrcReg[src].File; if (ctx->Shader.EmitNoIfs && mesa_inst->Opcode == OPCODE_IF) { - shader_program->InfoLog = - talloc_asprintf_append(shader_program->InfoLog, - "Couldn't flatten if statement\n"); - shader_program->LinkStatus = false; + fail_link(shader_program, "Couldn't flatten if statement\n"); } switch (mesa_inst->Opcode) { @@ -2813,9 +2813,7 @@ _mesa_glsl_link_shader(GLcontext *ctx, struct gl_shader_program *prog) for (i = 0; i < prog->NumShaders; i++) { if (!prog->Shaders[i]->CompileStatus) { - prog->InfoLog = - talloc_asprintf_append(prog->InfoLog, - "linking with uncompiled shader"); + fail_link(prog, "linking with uncompiled shader"); prog->LinkStatus = GL_FALSE; } } -- cgit v1.2.3 From 5ad74779cea07cc6a19a52874cdaef8b018e2f1b Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 1 Sep 2010 16:06:32 -0700 Subject: ir_to_mesa: Load all the STATE_VAR elements of a builtin uniform to a temp. Like the constant handling and the handling of other uniforms, we add the whole thing to the Parameters, avoiding messy, incomplete logic for adding just the elements of a builting uniform that get used. This means that a driver that relies only on ParameterValues[] for its parameters will have an increased parameter load, but drivers generally don't do that (since they have other params they need to handle, too). Fixes glsl-fs-statevar-call (testcase for Ember). Bug #29687. Regresses glsl-vs-array-04 on 965. Thanks to a slight change in register allocation, this test of undefined behavior now wraps around the register space and unexpectedly reads the constant value it's trying to compare to. The test should probably not look at the resulting color, since behavior is undefined. --- src/mesa/program/ir_to_mesa.cpp | 636 ++++++++++++++++++---------------------- 1 file changed, 291 insertions(+), 345 deletions(-) (limited to 'src') diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp index 2b833702e9..b2ba9a2fbc 100644 --- a/src/mesa/program/ir_to_mesa.cpp +++ b/src/mesa/program/ir_to_mesa.cpp @@ -577,6 +577,239 @@ ir_to_mesa_visitor::find_variable_storage(ir_variable *var) return NULL; } +struct statevar_element { + const char *field; + int tokens[STATE_LENGTH]; + int swizzle; + bool array_indexed; +}; + +static struct statevar_element gl_DepthRange_elements[] = { + {"near", {STATE_DEPTH_RANGE, 0, 0}, SWIZZLE_XXXX}, + {"far", {STATE_DEPTH_RANGE, 0, 0}, SWIZZLE_YYYY}, + {"diff", {STATE_DEPTH_RANGE, 0, 0}, SWIZZLE_ZZZZ}, +}; + +static struct statevar_element gl_ClipPlane_elements[] = { + {NULL, {STATE_CLIPPLANE, 0, 0}, SWIZZLE_XYZW} +}; + +static struct statevar_element gl_Point_elements[] = { + {"size", {STATE_POINT_SIZE}, SWIZZLE_XXXX}, + {"sizeMin", {STATE_POINT_SIZE}, SWIZZLE_YYYY}, + {"sizeMax", {STATE_POINT_SIZE}, SWIZZLE_ZZZZ}, + {"fadeThresholdSize", {STATE_POINT_SIZE}, SWIZZLE_WWWW}, + {"distanceConstantAttenuation", {STATE_POINT_ATTENUATION}, SWIZZLE_XXXX}, + {"distanceLinearAttenuation", {STATE_POINT_ATTENUATION}, SWIZZLE_YYYY}, + {"distanceQuadraticAttenuation", {STATE_POINT_ATTENUATION}, SWIZZLE_ZZZZ}, +}; + +static struct statevar_element gl_FrontMaterial_elements[] = { + {"emission", {STATE_MATERIAL, 0, STATE_EMISSION}, SWIZZLE_XYZW}, + {"ambient", {STATE_MATERIAL, 0, STATE_AMBIENT}, SWIZZLE_XYZW}, + {"diffuse", {STATE_MATERIAL, 0, STATE_DIFFUSE}, SWIZZLE_XYZW}, + {"specular", {STATE_MATERIAL, 0, STATE_SPECULAR}, SWIZZLE_XYZW}, + {"shininess", {STATE_MATERIAL, 0, STATE_SHININESS}, SWIZZLE_XXXX}, +}; + +static struct statevar_element gl_BackMaterial_elements[] = { + {"emission", {STATE_MATERIAL, 1, STATE_EMISSION}, SWIZZLE_XYZW}, + {"ambient", {STATE_MATERIAL, 1, STATE_AMBIENT}, SWIZZLE_XYZW}, + {"diffuse", {STATE_MATERIAL, 1, STATE_DIFFUSE}, SWIZZLE_XYZW}, + {"specular", {STATE_MATERIAL, 1, STATE_SPECULAR}, SWIZZLE_XYZW}, + {"shininess", {STATE_MATERIAL, 1, STATE_SHININESS}, SWIZZLE_XXXX}, +}; + +static struct statevar_element gl_LightSource_elements[] = { + {"ambient", {STATE_LIGHT, 0, STATE_AMBIENT}, SWIZZLE_XYZW}, + {"diffuse", {STATE_LIGHT, 0, STATE_DIFFUSE}, SWIZZLE_XYZW}, + {"specular", {STATE_LIGHT, 0, STATE_SPECULAR}, SWIZZLE_XYZW}, + {"position", {STATE_LIGHT, 0, STATE_POSITION}, SWIZZLE_XYZW}, + {"halfVector", {STATE_LIGHT, 0, STATE_HALF_VECTOR}, SWIZZLE_XYZW}, + {"spotDirection", {STATE_LIGHT, 0, STATE_SPOT_DIRECTION}, SWIZZLE_XYZW}, + {"spotCosCutoff", {STATE_LIGHT, 0, STATE_SPOT_DIRECTION}, SWIZZLE_WWWW}, + {"spotCutoff", {STATE_LIGHT, 0, STATE_SPOT_CUTOFF}, SWIZZLE_XXXX}, + {"spotExponent", {STATE_LIGHT, 0, STATE_ATTENUATION}, SWIZZLE_WWWW}, + {"constantAttenuation", {STATE_LIGHT, 0, STATE_ATTENUATION}, SWIZZLE_XXXX}, + {"linearAttenuation", {STATE_LIGHT, 0, STATE_ATTENUATION}, SWIZZLE_YYYY}, + {"quadraticAttenuation", {STATE_LIGHT, 0, STATE_ATTENUATION}, SWIZZLE_ZZZZ}, +}; + +static struct statevar_element gl_LightModel_elements[] = { + {"ambient", {STATE_LIGHTMODEL_AMBIENT, 0}, SWIZZLE_XYZW}, +}; + +static struct statevar_element gl_FrontLightModelProduct_elements[] = { + {"sceneColor", {STATE_LIGHTMODEL_SCENECOLOR, 0}, SWIZZLE_XYZW}, +}; + +static struct statevar_element gl_BackLightModelProduct_elements[] = { + {"sceneColor", {STATE_LIGHTMODEL_SCENECOLOR, 1}, SWIZZLE_XYZW}, +}; + +static struct statevar_element gl_FrontLightProduct_elements[] = { + {"ambient", {STATE_LIGHTPROD, 0, 0, STATE_AMBIENT}, SWIZZLE_XYZW}, + {"diffuse", {STATE_LIGHTPROD, 0, 0, STATE_DIFFUSE}, SWIZZLE_XYZW}, + {"specular", {STATE_LIGHTPROD, 0, 0, STATE_SPECULAR}, SWIZZLE_XYZW}, +}; + +static struct statevar_element gl_BackLightProduct_elements[] = { + {"ambient", {STATE_LIGHTPROD, 0, 1, STATE_AMBIENT}, SWIZZLE_XYZW}, + {"diffuse", {STATE_LIGHTPROD, 0, 1, STATE_DIFFUSE}, SWIZZLE_XYZW}, + {"specular", {STATE_LIGHTPROD, 0, 1, STATE_SPECULAR}, SWIZZLE_XYZW}, +}; + +static struct statevar_element gl_TextureEnvColor_elements[] = { + {NULL, {STATE_TEXENV_COLOR, 0}, SWIZZLE_XYZW}, +}; + +static struct statevar_element gl_EyePlaneS_elements[] = { + {NULL, {STATE_TEXGEN, 0, STATE_TEXGEN_EYE_S}, SWIZZLE_XYZW}, +}; + +static struct statevar_element gl_EyePlaneT_elements[] = { + {NULL, {STATE_TEXGEN, 0, STATE_TEXGEN_EYE_T}, SWIZZLE_XYZW}, +}; + +static struct statevar_element gl_EyePlaneR_elements[] = { + {NULL, {STATE_TEXGEN, 0, STATE_TEXGEN_EYE_R}, SWIZZLE_XYZW}, +}; + +static struct statevar_element gl_EyePlaneQ_elements[] = { + {NULL, {STATE_TEXGEN, 0, STATE_TEXGEN_EYE_Q}, SWIZZLE_XYZW}, +}; + +static struct statevar_element gl_ObjectPlaneS_elements[] = { + {NULL, {STATE_TEXGEN, 0, STATE_TEXGEN_OBJECT_S}, SWIZZLE_XYZW}, +}; + +static struct statevar_element gl_ObjectPlaneT_elements[] = { + {NULL, {STATE_TEXGEN, 0, STATE_TEXGEN_OBJECT_T}, SWIZZLE_XYZW}, +}; + +static struct statevar_element gl_ObjectPlaneR_elements[] = { + {NULL, {STATE_TEXGEN, 0, STATE_TEXGEN_OBJECT_R}, SWIZZLE_XYZW}, +}; + +static struct statevar_element gl_ObjectPlaneQ_elements[] = { + {NULL, {STATE_TEXGEN, 0, STATE_TEXGEN_OBJECT_Q}, SWIZZLE_XYZW}, +}; + +static struct statevar_element gl_Fog_elements[] = { + {"color", {STATE_FOG_COLOR}, SWIZZLE_XYZW}, + {"density", {STATE_FOG_PARAMS}, SWIZZLE_XXXX}, + {"start", {STATE_FOG_PARAMS}, SWIZZLE_YYYY}, + {"end", {STATE_FOG_PARAMS}, SWIZZLE_ZZZZ}, + {"scale", {STATE_FOG_PARAMS}, SWIZZLE_WWWW}, +}; + +#define MATRIX(name, statevar, modifier) \ + static struct statevar_element name ## _elements[] = { \ + { NULL, { statevar, 0, 0, 0, modifier}, SWIZZLE_XYZW }, \ + { NULL, { statevar, 0, 1, 1, modifier}, SWIZZLE_XYZW }, \ + { NULL, { statevar, 0, 2, 2, modifier}, SWIZZLE_XYZW }, \ + { NULL, { statevar, 0, 3, 3, modifier}, SWIZZLE_XYZW }, \ + } + +MATRIX(gl_ModelViewMatrix, + STATE_MODELVIEW_MATRIX, STATE_MATRIX_TRANSPOSE); +MATRIX(gl_ModelViewMatrixInverse, + STATE_MODELVIEW_MATRIX, STATE_MATRIX_INVTRANS); +MATRIX(gl_ModelViewMatrixTranspose, + STATE_MODELVIEW_MATRIX, 0); +MATRIX(gl_ModelViewMatrixInverseTranspose, + STATE_MODELVIEW_MATRIX, STATE_MATRIX_INVERSE); + +MATRIX(gl_ProjectionMatrix, + STATE_PROJECTION_MATRIX, STATE_MATRIX_TRANSPOSE); +MATRIX(gl_ProjectionMatrixInverse, + STATE_PROJECTION_MATRIX, STATE_MATRIX_INVTRANS); +MATRIX(gl_ProjectionMatrixTranspose, + STATE_PROJECTION_MATRIX, 0); +MATRIX(gl_ProjectionMatrixInverseTranspose, + STATE_PROJECTION_MATRIX, STATE_MATRIX_INVERSE); + +MATRIX(gl_ModelViewProjectionMatrix, + STATE_MVP_MATRIX, STATE_MATRIX_TRANSPOSE); +MATRIX(gl_ModelViewProjectionMatrixInverse, + STATE_MVP_MATRIX, STATE_MATRIX_INVTRANS); +MATRIX(gl_ModelViewProjectionMatrixTranspose, + STATE_MVP_MATRIX, 0); +MATRIX(gl_ModelViewProjectionMatrixInverseTranspose, + STATE_MVP_MATRIX, STATE_MATRIX_INVERSE); + +MATRIX(gl_TextureMatrix, + STATE_TEXTURE_MATRIX, STATE_MATRIX_TRANSPOSE); +MATRIX(gl_TextureMatrixInverse, + STATE_TEXTURE_MATRIX, STATE_MATRIX_INVTRANS); +MATRIX(gl_TextureMatrixTranspose, + STATE_TEXTURE_MATRIX, 0); +MATRIX(gl_TextureMatrixInverseTranspose, + STATE_TEXTURE_MATRIX, STATE_MATRIX_INVERSE); + +static struct statevar_element gl_NormalMatrix_elements[] = { + { NULL, { STATE_MODELVIEW_MATRIX, 0, 0, 0, STATE_MATRIX_INVERSE}, + SWIZZLE_XYZW }, + { NULL, { STATE_MODELVIEW_MATRIX, 0, 1, 1, STATE_MATRIX_INVERSE}, + SWIZZLE_XYZW }, + { NULL, { STATE_MODELVIEW_MATRIX, 0, 2, 2, STATE_MATRIX_INVERSE}, + SWIZZLE_XYZW }, +}; + +#undef MATRIX + +#define STATEVAR(name) {#name, name ## _elements, Elements(name ## _elements)} + +static struct { + const char *name; + struct statevar_element *elements; + int num_elements; +} statevars[] = { + STATEVAR(gl_DepthRange), + STATEVAR(gl_ClipPlane), + STATEVAR(gl_Point), + STATEVAR(gl_FrontMaterial), + STATEVAR(gl_BackMaterial), + STATEVAR(gl_LightSource), + STATEVAR(gl_LightModel), + STATEVAR(gl_FrontLightModelProduct), + STATEVAR(gl_BackLightModelProduct), + STATEVAR(gl_FrontLightProduct), + STATEVAR(gl_BackLightProduct), + STATEVAR(gl_TextureEnvColor), + STATEVAR(gl_EyePlaneS), + STATEVAR(gl_EyePlaneT), + STATEVAR(gl_EyePlaneR), + STATEVAR(gl_EyePlaneQ), + STATEVAR(gl_ObjectPlaneS), + STATEVAR(gl_ObjectPlaneT), + STATEVAR(gl_ObjectPlaneR), + STATEVAR(gl_ObjectPlaneQ), + STATEVAR(gl_Fog), + + STATEVAR(gl_ModelViewMatrix), + STATEVAR(gl_ModelViewMatrixInverse), + STATEVAR(gl_ModelViewMatrixTranspose), + STATEVAR(gl_ModelViewMatrixInverseTranspose), + + STATEVAR(gl_ProjectionMatrix), + STATEVAR(gl_ProjectionMatrixInverse), + STATEVAR(gl_ProjectionMatrixTranspose), + STATEVAR(gl_ProjectionMatrixInverseTranspose), + + STATEVAR(gl_ModelViewProjectionMatrix), + STATEVAR(gl_ModelViewProjectionMatrixInverse), + STATEVAR(gl_ModelViewProjectionMatrixTranspose), + STATEVAR(gl_ModelViewProjectionMatrixInverseTranspose), + + STATEVAR(gl_TextureMatrix), + STATEVAR(gl_TextureMatrixInverse), + STATEVAR(gl_TextureMatrixTranspose), + STATEVAR(gl_TextureMatrixInverseTranspose), + + STATEVAR(gl_NormalMatrix), +}; + void ir_to_mesa_visitor::visit(ir_variable *ir) { @@ -586,6 +819,64 @@ ir_to_mesa_visitor::visit(ir_variable *ir) fp->OriginUpperLeft = ir->origin_upper_left; fp->PixelCenterInteger = ir->pixel_center_integer; } + + if (ir->mode == ir_var_uniform && strncmp(ir->name, "gl_", 3) == 0) { + unsigned int i; + + struct variable_storage *entry; + entry = new(mem_ctx) variable_storage(ir, PROGRAM_TEMPORARY, + this->next_temp); + this->variables.push_tail(entry); + this->next_temp += type_size(ir->type); + + for (i = 0; i < Elements(statevars); i++) { + if (strcmp(ir->name, statevars[i].name) == 0) + break; + } + + if (i == Elements(statevars)) { + fail_link(this->shader_program, + "Failed to find builtin uniform `%s'\n", ir->name); + return; + } + + ir_to_mesa_dst_reg dst = + ir_to_mesa_dst_reg_from_src(ir_to_mesa_src_reg(PROGRAM_TEMPORARY, + entry->index, NULL)); + + int array_count; + if (ir->type->is_array()) { + array_count = ir->type->length; + } else { + array_count = 1; + } + + for (int a = 0; a < array_count; a++) { + for (int j = 0; j < statevars[i].num_elements; j++) { + struct statevar_element *element = &statevars[i].elements[j]; + int tokens[STATE_LENGTH]; + + memcpy(tokens, element->tokens, sizeof(element->tokens)); + if (ir->type->is_array()) { + tokens[1] = a; + } + + int index = _mesa_add_state_reference(this->prog->Parameters, + (gl_state_index *)tokens); + ir_to_mesa_src_reg src(PROGRAM_STATE_VAR, index, NULL); + src.swizzle = element->swizzle; + ir_to_mesa_emit_op1(ir, OPCODE_MOV, dst, src); + /* even a float takes up a whole vec4 reg in a struct/array. */ + dst.index++; + } + } + if (dst.index != entry->index + type_size(ir->type)) { + fail_link(this->shader_program, + "failed to load builtin uniform `%s' (%d/%d regs loaded)\n", + ir->name, dst.index - entry->index, + type_size(ir->type)); + } + } } void @@ -1016,289 +1307,6 @@ ir_to_mesa_visitor::visit(ir_swizzle *ir) this->result = src_reg; } -static const struct { - const char *name; - const char *field; - int tokens[STATE_LENGTH]; - int swizzle; - bool array_indexed; -} statevars[] = { - {"gl_DepthRange", "near", - {STATE_DEPTH_RANGE, 0, 0}, SWIZZLE_XXXX, false}, - {"gl_DepthRange", "far", - {STATE_DEPTH_RANGE, 0, 0}, SWIZZLE_YYYY, false}, - {"gl_DepthRange", "diff", - {STATE_DEPTH_RANGE, 0, 0}, SWIZZLE_ZZZZ, false}, - - {"gl_ClipPlane", NULL, - {STATE_CLIPPLANE, 0, 0}, SWIZZLE_XYZW, true} -, - {"gl_Point", "size", - {STATE_POINT_SIZE}, SWIZZLE_XXXX, false}, - {"gl_Point", "sizeMin", - {STATE_POINT_SIZE}, SWIZZLE_YYYY, false}, - {"gl_Point", "sizeMax", - {STATE_POINT_SIZE}, SWIZZLE_ZZZZ, false}, - {"gl_Point", "fadeThresholdSize", - {STATE_POINT_SIZE}, SWIZZLE_WWWW, false}, - {"gl_Point", "distanceConstantAttenuation", - {STATE_POINT_ATTENUATION}, SWIZZLE_XXXX, false}, - {"gl_Point", "distanceLinearAttenuation", - {STATE_POINT_ATTENUATION}, SWIZZLE_YYYY, false}, - {"gl_Point", "distanceQuadraticAttenuation", - {STATE_POINT_ATTENUATION}, SWIZZLE_ZZZZ, false}, - - {"gl_FrontMaterial", "emission", - {STATE_MATERIAL, 0, STATE_EMISSION}, SWIZZLE_XYZW, false}, - {"gl_FrontMaterial", "ambient", - {STATE_MATERIAL, 0, STATE_AMBIENT}, SWIZZLE_XYZW, false}, - {"gl_FrontMaterial", "diffuse", - {STATE_MATERIAL, 0, STATE_DIFFUSE}, SWIZZLE_XYZW, false}, - {"gl_FrontMaterial", "specular", - {STATE_MATERIAL, 0, STATE_SPECULAR}, SWIZZLE_XYZW, false}, - {"gl_FrontMaterial", "shininess", - {STATE_MATERIAL, 0, STATE_SHININESS}, SWIZZLE_XXXX, false}, - - {"gl_BackMaterial", "emission", - {STATE_MATERIAL, 1, STATE_EMISSION}, SWIZZLE_XYZW, false}, - {"gl_BackMaterial", "ambient", - {STATE_MATERIAL, 1, STATE_AMBIENT}, SWIZZLE_XYZW, false}, - {"gl_BackMaterial", "diffuse", - {STATE_MATERIAL, 1, STATE_DIFFUSE}, SWIZZLE_XYZW, false}, - {"gl_BackMaterial", "specular", - {STATE_MATERIAL, 1, STATE_SPECULAR}, SWIZZLE_XYZW, false}, - {"gl_BackMaterial", "shininess", - {STATE_MATERIAL, 1, STATE_SHININESS}, SWIZZLE_XXXX, false}, - - {"gl_LightSource", "ambient", - {STATE_LIGHT, 0, STATE_AMBIENT}, SWIZZLE_XYZW, true}, - {"gl_LightSource", "diffuse", - {STATE_LIGHT, 0, STATE_DIFFUSE}, SWIZZLE_XYZW, true}, - {"gl_LightSource", "specular", - {STATE_LIGHT, 0, STATE_SPECULAR}, SWIZZLE_XYZW, true}, - {"gl_LightSource", "position", - {STATE_LIGHT, 0, STATE_POSITION}, SWIZZLE_XYZW, true}, - {"gl_LightSource", "halfVector", - {STATE_LIGHT, 0, STATE_HALF_VECTOR}, SWIZZLE_XYZW, true}, - {"gl_LightSource", "spotDirection", - {STATE_LIGHT, 0, STATE_SPOT_DIRECTION}, SWIZZLE_XYZW, true}, - {"gl_LightSource", "spotCosCutoff", - {STATE_LIGHT, 0, STATE_SPOT_DIRECTION}, SWIZZLE_WWWW, true}, - {"gl_LightSource", "spotCutoff", - {STATE_LIGHT, 0, STATE_SPOT_CUTOFF}, SWIZZLE_XXXX, true}, - {"gl_LightSource", "spotExponent", - {STATE_LIGHT, 0, STATE_ATTENUATION}, SWIZZLE_WWWW, true}, - {"gl_LightSource", "constantAttenuation", - {STATE_LIGHT, 0, STATE_ATTENUATION}, SWIZZLE_XXXX, true}, - {"gl_LightSource", "linearAttenuation", - {STATE_LIGHT, 0, STATE_ATTENUATION}, SWIZZLE_YYYY, true}, - {"gl_LightSource", "quadraticAttenuation", - {STATE_LIGHT, 0, STATE_ATTENUATION}, SWIZZLE_ZZZZ, true}, - - {"gl_LightModel", "ambient", - {STATE_LIGHTMODEL_AMBIENT, 0}, SWIZZLE_XYZW, false}, - - {"gl_FrontLightModelProduct", "sceneColor", - {STATE_LIGHTMODEL_SCENECOLOR, 0}, SWIZZLE_XYZW, false}, - {"gl_BackLightModelProduct", "sceneColor", - {STATE_LIGHTMODEL_SCENECOLOR, 1}, SWIZZLE_XYZW, false}, - - {"gl_FrontLightProduct", "ambient", - {STATE_LIGHTPROD, 0, 0, STATE_AMBIENT}, SWIZZLE_XYZW, true}, - {"gl_FrontLightProduct", "diffuse", - {STATE_LIGHTPROD, 0, 0, STATE_DIFFUSE}, SWIZZLE_XYZW, true}, - {"gl_FrontLightProduct", "specular", - {STATE_LIGHTPROD, 0, 0, STATE_SPECULAR}, SWIZZLE_XYZW, true}, - - {"gl_BackLightProduct", "ambient", - {STATE_LIGHTPROD, 0, 1, STATE_AMBIENT}, SWIZZLE_XYZW, true}, - {"gl_BackLightProduct", "diffuse", - {STATE_LIGHTPROD, 0, 1, STATE_DIFFUSE}, SWIZZLE_XYZW, true}, - {"gl_BackLightProduct", "specular", - {STATE_LIGHTPROD, 0, 1, STATE_SPECULAR}, SWIZZLE_XYZW, true}, - - {"gl_TextureEnvColor", NULL, - {STATE_TEXENV_COLOR, 0}, SWIZZLE_XYZW, true}, - - {"gl_EyePlaneS", NULL, - {STATE_TEXGEN, 0, STATE_TEXGEN_EYE_S}, SWIZZLE_XYZW, true}, - {"gl_EyePlaneT", NULL, - {STATE_TEXGEN, 0, STATE_TEXGEN_EYE_T}, SWIZZLE_XYZW, true}, - {"gl_EyePlaneR", NULL, - {STATE_TEXGEN, 0, STATE_TEXGEN_EYE_R}, SWIZZLE_XYZW, true}, - {"gl_EyePlaneQ", NULL, - {STATE_TEXGEN, 0, STATE_TEXGEN_EYE_Q}, SWIZZLE_XYZW, true}, - - {"gl_ObjectPlaneS", NULL, - {STATE_TEXGEN, 0, STATE_TEXGEN_OBJECT_S}, SWIZZLE_XYZW, true}, - {"gl_ObjectPlaneT", NULL, - {STATE_TEXGEN, 0, STATE_TEXGEN_OBJECT_T}, SWIZZLE_XYZW, true}, - {"gl_ObjectPlaneR", NULL, - {STATE_TEXGEN, 0, STATE_TEXGEN_OBJECT_R}, SWIZZLE_XYZW, true}, - {"gl_ObjectPlaneQ", NULL, - {STATE_TEXGEN, 0, STATE_TEXGEN_OBJECT_Q}, SWIZZLE_XYZW, true}, - - {"gl_Fog", "color", - {STATE_FOG_COLOR}, SWIZZLE_XYZW, false}, - {"gl_Fog", "density", - {STATE_FOG_PARAMS}, SWIZZLE_XXXX, false}, - {"gl_Fog", "start", - {STATE_FOG_PARAMS}, SWIZZLE_YYYY, false}, - {"gl_Fog", "end", - {STATE_FOG_PARAMS}, SWIZZLE_ZZZZ, false}, - {"gl_Fog", "scale", - {STATE_FOG_PARAMS}, SWIZZLE_WWWW, false}, -}; - -static ir_to_mesa_src_reg -get_builtin_uniform_reg(struct gl_program *prog, - const char *name, int array_index, const char *field) -{ - unsigned int i; - ir_to_mesa_src_reg src_reg; - int tokens[STATE_LENGTH]; - - for (i = 0; i < Elements(statevars); i++) { - if (strcmp(statevars[i].name, name) != 0) - continue; - if (!field && statevars[i].field) { - assert(!"FINISHME: whole-structure state var dereference"); - } - if (field && (!statevars[i].field || strcmp(statevars[i].field, field) != 0)) - continue; - break; - } - - if (i == Elements(statevars)) { - printf("builtin uniform %s%s%s not found\n", - name, - field ? "." : "", - field ? field : ""); - abort(); - } - - memcpy(&tokens, statevars[i].tokens, sizeof(tokens)); - if (statevars[i].array_indexed) - tokens[1] = array_index; - - src_reg.file = PROGRAM_STATE_VAR; - src_reg.index = _mesa_add_state_reference(prog->Parameters, - (gl_state_index *)tokens); - src_reg.swizzle = statevars[i].swizzle; - src_reg.negate = 0; - src_reg.reladdr = false; - - return src_reg; -} - -static int -add_matrix_ref(struct gl_program *prog, int *tokens) -{ - int base_pos = -1; - int i; - - /* Add a ref for each column. It looks like the reason we do - * it this way is that _mesa_add_state_reference doesn't work - * for things that aren't vec4s, so the tokens[2]/tokens[3] - * range has to be equal. - */ - for (i = 0; i < 4; i++) { - tokens[2] = i; - tokens[3] = i; - int pos = _mesa_add_state_reference(prog->Parameters, - (gl_state_index *)tokens); - if (base_pos == -1) - base_pos = pos; - else - assert(base_pos + i == pos); - } - - return base_pos; -} - -static variable_storage * -get_builtin_matrix_ref(void *mem_ctx, struct gl_program *prog, ir_variable *var, - ir_rvalue *array_index) -{ - /* - * NOTE: The ARB_vertex_program extension specified that matrices get - * loaded in registers in row-major order. With GLSL, we want column- - * major order. So, we need to transpose all matrices here... - */ - static const struct { - const char *name; - int matrix; - int modifier; - } matrices[] = { - { "gl_ModelViewMatrix", STATE_MODELVIEW_MATRIX, STATE_MATRIX_TRANSPOSE }, - { "gl_ModelViewMatrixInverse", STATE_MODELVIEW_MATRIX, STATE_MATRIX_INVTRANS }, - { "gl_ModelViewMatrixTranspose", STATE_MODELVIEW_MATRIX, 0 }, - { "gl_ModelViewMatrixInverseTranspose", STATE_MODELVIEW_MATRIX, STATE_MATRIX_INVERSE }, - - { "gl_ProjectionMatrix", STATE_PROJECTION_MATRIX, STATE_MATRIX_TRANSPOSE }, - { "gl_ProjectionMatrixInverse", STATE_PROJECTION_MATRIX, STATE_MATRIX_INVTRANS }, - { "gl_ProjectionMatrixTranspose", STATE_PROJECTION_MATRIX, 0 }, - { "gl_ProjectionMatrixInverseTranspose", STATE_PROJECTION_MATRIX, STATE_MATRIX_INVERSE }, - - { "gl_ModelViewProjectionMatrix", STATE_MVP_MATRIX, STATE_MATRIX_TRANSPOSE }, - { "gl_ModelViewProjectionMatrixInverse", STATE_MVP_MATRIX, STATE_MATRIX_INVTRANS }, - { "gl_ModelViewProjectionMatrixTranspose", STATE_MVP_MATRIX, 0 }, - { "gl_ModelViewProjectionMatrixInverseTranspose", STATE_MVP_MATRIX, STATE_MATRIX_INVERSE }, - - { "gl_TextureMatrix", STATE_TEXTURE_MATRIX, STATE_MATRIX_TRANSPOSE }, - { "gl_TextureMatrixInverse", STATE_TEXTURE_MATRIX, STATE_MATRIX_INVTRANS }, - { "gl_TextureMatrixTranspose", STATE_TEXTURE_MATRIX, 0 }, - { "gl_TextureMatrixInverseTranspose", STATE_TEXTURE_MATRIX, STATE_MATRIX_INVERSE }, - - { "gl_NormalMatrix", STATE_MODELVIEW_MATRIX, STATE_MATRIX_INVERSE }, - - }; - unsigned int i; - variable_storage *entry; - - /* C++ gets angry when we try to use an int as a gl_state_index, so we use - * ints for gl_state_index. Make sure they're compatible. - */ - assert(sizeof(gl_state_index) == sizeof(int)); - - for (i = 0; i < Elements(matrices); i++) { - if (strcmp(var->name, matrices[i].name) == 0) { - int tokens[STATE_LENGTH]; - int base_pos = -1; - - tokens[0] = matrices[i].matrix; - tokens[4] = matrices[i].modifier; - if (matrices[i].matrix == STATE_TEXTURE_MATRIX) { - ir_constant *index = array_index->constant_expression_value(); - if (index) { - tokens[1] = index->value.i[0]; - base_pos = add_matrix_ref(prog, tokens); - } else { - for (i = 0; i < var->type->length; i++) { - tokens[1] = i; - int pos = add_matrix_ref(prog, tokens); - if (base_pos == -1) - base_pos = pos; - else - assert(base_pos + (int)i * 4 == pos); - } - } - } else { - tokens[1] = 0; /* unused array index */ - base_pos = add_matrix_ref(prog, tokens); - } - - entry = new(mem_ctx) variable_storage(var, - PROGRAM_STATE_VAR, - base_pos); - - return entry; - } - } - - return NULL; -} - void ir_to_mesa_visitor::visit(ir_dereference_variable *ir) { @@ -1307,11 +1315,6 @@ ir_to_mesa_visitor::visit(ir_dereference_variable *ir) if (!entry) { switch (ir->var->mode) { case ir_var_uniform: - entry = get_builtin_matrix_ref(this->mem_ctx, this->prog, ir->var, - NULL); - if (entry) - break; - entry = new(mem_ctx) variable_storage(ir->var, PROGRAM_UNIFORM, ir->var->location); this->variables.push_tail(entry); @@ -1370,58 +1373,12 @@ ir_to_mesa_visitor::visit(ir_dereference_variable *ir) void ir_to_mesa_visitor::visit(ir_dereference_array *ir) { - ir_variable *var = ir->variable_referenced(); ir_constant *index; ir_to_mesa_src_reg src_reg; - ir_dereference_variable *deref_var = ir->array->as_dereference_variable(); int element_size = type_size(ir->type); index = ir->array_index->constant_expression_value(); - if (deref_var && strncmp(deref_var->var->name, - "gl_TextureMatrix", - strlen("gl_TextureMatrix")) == 0) { - variable_storage *entry; - - entry = get_builtin_matrix_ref(this->mem_ctx, this->prog, deref_var->var, - ir->array_index); - assert(entry); - - ir_to_mesa_src_reg src_reg(entry->file, entry->index, ir->type); - - if (index) { - src_reg.reladdr = NULL; - } else { - ir_to_mesa_src_reg index_reg = get_temp(glsl_type::float_type); - - ir->array_index->accept(this); - ir_to_mesa_emit_op2(ir, OPCODE_MUL, - ir_to_mesa_dst_reg_from_src(index_reg), - this->result, src_reg_for_float(element_size)); - - src_reg.reladdr = talloc(mem_ctx, ir_to_mesa_src_reg); - memcpy(src_reg.reladdr, &index_reg, sizeof(index_reg)); - } - - this->result = src_reg; - return; - } - - if (var && - strncmp(var->name, "gl_", 3) == 0 && var->mode == ir_var_uniform && - !var->type->is_matrix()) { - ir_dereference_record *record = NULL; - if (ir->array->ir_type == ir_type_dereference_record) - record = (ir_dereference_record *)ir->array; - - assert(index || !"FINISHME: variable-indexed builtin uniform access"); - - this->result = get_builtin_uniform_reg(prog, - var->name, - index->value.i[0], - record ? record->field : NULL); - } - ir->array->accept(this); src_reg = this->result; @@ -1466,17 +1423,6 @@ ir_to_mesa_visitor::visit(ir_dereference_record *ir) unsigned int i; const glsl_type *struct_type = ir->record->type; int offset = 0; - ir_variable *var = ir->record->variable_referenced(); - - if (strncmp(var->name, "gl_", 3) == 0 && var->mode == ir_var_uniform) { - assert(var); - - this->result = get_builtin_uniform_reg(prog, - var->name, - 0, - ir->field); - return; - } ir->record->accept(this); -- cgit v1.2.3 From 36192b772eda190c4d78e8a4979c4e3c6377ae61 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Thu, 2 Sep 2010 11:16:31 +1000 Subject: r600g: fix incorrect state naming in pipe_sampler vs pipe_sampler_view fixes problems in valgrind with uninitialised values. --- src/gallium/drivers/r600/r600_state.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/r600_state.c b/src/gallium/drivers/r600/r600_state.c index 4f00cfb381..888507747b 100644 --- a/src/gallium/drivers/r600/r600_state.c +++ b/src/gallium/drivers/r600/r600_state.c @@ -92,7 +92,7 @@ static struct pipe_sampler_view *r600_create_sampler_view(struct pipe_context *c struct r600_context *rctx = r600_context(ctx); struct r600_context_state *rstate; - rstate = r600_context_state(rctx, pipe_sampler_type, state); + rstate = r600_context_state(rctx, pipe_sampler_view_type, state); pipe_reference(NULL, &texture->reference); rstate->state.sampler_view.texture = texture; rstate->state.sampler_view.reference.count = 1; -- cgit v1.2.3 From ee88c4664016b11359c391cc62296bcbfcc5decd Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Wed, 1 Sep 2010 14:49:53 -0700 Subject: ast_function: Remove bogus cases from generate_constructor_matrix. There are no integer matrix types, so switching on them is silly. --- src/glsl/ast_function.cpp | 37 ++++++++----------------------------- 1 file changed, 8 insertions(+), 29 deletions(-) (limited to 'src') diff --git a/src/glsl/ast_function.cpp b/src/glsl/ast_function.cpp index d39c4b195c..d7d1b3eeb7 100644 --- a/src/glsl/ast_function.cpp +++ b/src/glsl/ast_function.cpp @@ -485,38 +485,17 @@ 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; + assert(type->base_type == GLSL_TYPE_FLOAT); + assert(initializer->type->is_scalar()); - data->u[idx] = initializer->value.u[0]; - } - break; + for (unsigned i = 0; i < type->components(); i++) + data->f[i] = 0; - 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; - 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; + data->f[idx] = initializer->value.f[0]; } } -- cgit v1.2.3 From 550237eedd772487151565f64384d35c1bf695a6 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Wed, 1 Sep 2010 15:04:57 -0700 Subject: ast_function: Fix check for "too few components". This was triggering even for matrix-from-matrix constructors. It is perfectly legal to construct a mat3 from a mat2 - the rest will be filled in by the identity matrix. Changes piglit test constructor-23.vert from FAIL to PASS, but the generated code is incorrect. --- src/glsl/ast_function.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/glsl/ast_function.cpp b/src/glsl/ast_function.cpp index d7d1b3eeb7..0c9f890038 100644 --- a/src/glsl/ast_function.cpp +++ b/src/glsl/ast_function.cpp @@ -1151,7 +1151,8 @@ ast_function_expression::hir(exec_list *instructions, * arguments to provide an initializer for every component in the * constructed value." */ - if ((components_used < type_components) && (components_used != 1)) { + if (components_used < type_components && components_used != 1 + && matrix_parameters == 0) { _mesa_glsl_error(& loc, state, "too few components to construct " "`%s'", constructor_type->name); -- cgit v1.2.3 From 1f7c7df40f830e164f96df4468a2b4fa365c4b84 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Wed, 1 Sep 2010 15:31:06 -0700 Subject: glsl: Move generate_constructor_(matrix|vector) to ir_constant ctor. --- src/glsl/ast_function.cpp | 100 +--------------------------------------------- src/glsl/ir.cpp | 35 ++++++++++++++++ 2 files changed, 36 insertions(+), 99 deletions(-) (limited to 'src') diff --git a/src/glsl/ast_function.cpp b/src/glsl/ast_function.cpp index 0c9f890038..f639b8a1ba 100644 --- a/src/glsl/ast_function.cpp +++ b/src/glsl/ast_function.cpp @@ -469,79 +469,6 @@ constant_record_constructor(const glsl_type *constructor_type, } -/** - * 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) -{ - assert(type->base_type == GLSL_TYPE_FLOAT); - assert(initializer->type->is_scalar()); - - 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]; - } -} - - -/** - * 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; - } -} - - /** * Determine if a list consists of a single scalar r-value */ @@ -1219,32 +1146,7 @@ ast_function_expression::hir(exec_list *instructions, * 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 = { { 0 } }; - 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); + return new(ctx) ir_constant(constructor_type, &actual_parameters); } else if (constructor_type->is_scalar()) { return dereference_component((ir_rvalue *) actual_parameters.head, 0); diff --git a/src/glsl/ir.cpp b/src/glsl/ir.cpp index 5bd023f499..aee44a77c9 100644 --- a/src/glsl/ir.cpp +++ b/src/glsl/ir.cpp @@ -415,6 +415,41 @@ ir_constant::ir_constant(const struct glsl_type *type, exec_list *value_list) ir_constant *value = (ir_constant *) (value_list->head); + /* Constructors with exactly one scalar argument are special for vectors + * and matrices. For vectors, the scalar value is replicated to fill all + * the components. For matrices, the scalar fills the components of the + * diagonal while the rest is filled with 0. + */ + if (value->type->is_scalar() && value->next->is_tail_sentinel()) { + if (type->is_matrix()) { + /* Matrix - fill diagonal (rest is already set to 0) */ + assert(type->base_type == GLSL_TYPE_FLOAT); + for (unsigned i = 0; i < type->matrix_columns; i++) + this->value.f[i * type->vector_elements + i] = value->value.f[0]; + } else { + /* Vector or scalar - fill all components */ + switch (type->base_type) { + case GLSL_TYPE_UINT: + case GLSL_TYPE_INT: + for (unsigned i = 0; i < type->components(); i++) + this->value.u[i] = value->value.u[0]; + break; + case GLSL_TYPE_FLOAT: + for (unsigned i = 0; i < type->components(); i++) + this->value.f[i] = value->value.f[0]; + break; + case GLSL_TYPE_BOOL: + for (unsigned i = 0; i < type->components(); i++) + this->value.b[i] = value->value.b[0]; + break; + default: + assert(!"Should not get here."); + break; + } + } + return; + } + /* Use each component from each entry in the value_list to initialize one * component of the constant being constructed. */ -- cgit v1.2.3 From 54b35e673596d767a13f06f4d7ec1089e18fd46e Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Wed, 1 Sep 2010 15:37:13 -0700 Subject: glsl: Add proper handling for constant matrix-from-matrix constructors. Fixes piglit test case constructor-21.vert and changes constructor-22.vert to give the correct output. --- src/glsl/ir.cpp | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'src') diff --git a/src/glsl/ir.cpp b/src/glsl/ir.cpp index aee44a77c9..68ad512bf5 100644 --- a/src/glsl/ir.cpp +++ b/src/glsl/ir.cpp @@ -450,6 +450,31 @@ ir_constant::ir_constant(const struct glsl_type *type, exec_list *value_list) return; } + if (type->is_matrix() && value->type->is_matrix()) { + assert(value->next->is_tail_sentinel()); + + /* From section 5.4.2 of the GLSL 1.20 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." + */ + unsigned cols = MIN2(type->matrix_columns, value->type->matrix_columns); + unsigned rows = MIN2(type->vector_elements, value->type->vector_elements); + for (unsigned i = 0; i < cols; i++) { + for (unsigned j = 0; j < rows; j++) { + const unsigned src = i * value->type->vector_elements + j; + const unsigned dst = i * type->vector_elements + j; + this->value.f[dst] = value->value.f[src]; + } + } + + /* "All other components will be initialized to the identity matrix." */ + for (unsigned i = cols; i < type->matrix_columns; i++) + this->value.f[i * type->vector_elements + i] = 1.0; + + return; + } + /* Use each component from each entry in the value_list to initialize one * component of the constant being constructed. */ -- cgit v1.2.3 From 39605587951aed546c14febcc26e5a479bf8d807 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Wed, 1 Sep 2010 16:10:01 -0700 Subject: glsl: Fix write mask in matrix-from-matrix constructors. If the matrix being constructed was larger than the source matrix, it would overwrite the lower-right part of the matrix with the wrong values, rather than leaving it as the identity matrix. For example, constructing a mat4 from a mat2 should only use a writemask of "xy" when copying from the source, but was using "xyzw". Fixes the code generated by piglit test constructor-23.vert. --- src/glsl/ast_function.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/glsl/ast_function.cpp b/src/glsl/ast_function.cpp index f639b8a1ba..1fa2fabefb 100644 --- a/src/glsl/ast_function.cpp +++ b/src/glsl/ast_function.cpp @@ -833,14 +833,16 @@ emit_inline_matrix_constructor(const glsl_type *type, new(ctx) ir_assignment(rhs_var_ref, first_param, NULL); instructions->push_tail(inst); + const unsigned last_row = MIN2(src_matrix->type->vector_elements, + var->type->vector_elements); + const unsigned last_col = MIN2(src_matrix->type->matrix_columns, + var->type->matrix_columns); unsigned swiz[4] = { 0, 0, 0, 0 }; for (unsigned i = 1; i < src_matrix->type->vector_elements; i++) swiz[i] = i; - const unsigned last_col = MIN2(src_matrix->type->matrix_columns, - var->type->matrix_columns); - const unsigned write_mask = (1U << var->type->vector_elements) - 1; + const unsigned write_mask = (1U << last_row) - 1; for (unsigned i = 0; i < last_col; i++) { ir_dereference *const lhs = -- cgit v1.2.3 From 31b84acbd2ae2dc7555844c5a2eead932b8759a7 Mon Sep 17 00:00:00 2001 From: Jerome Glisse Date: Wed, 1 Sep 2010 21:57:43 -0400 Subject: r600g: fix binding of same texture to several target slot One can bind same texture or sampler to different slot, each slot needs it own state. The solution implemented here is not exactly beautifull or optimal need to think to somethings better. Signed-off-by: Jerome Glisse --- src/gallium/drivers/r600/r600_context.h | 13 +++--- src/gallium/drivers/r600/r600_state.c | 72 ++++++++++++++++++++++++--------- 2 files changed, 62 insertions(+), 23 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/r600_context.h b/src/gallium/drivers/r600/r600_context.h index eb7a64bfbd..d4e3baa69d 100644 --- a/src/gallium/drivers/r600/r600_context.h +++ b/src/gallium/drivers/r600/r600_context.h @@ -95,13 +95,16 @@ enum pipe_state_type { pipe_type_count }; +#define R600_MAX_RSTATE 16 + struct r600_context_state { union pipe_states state; unsigned refcount; unsigned type; - struct radeon_state rstate[16]; + struct radeon_state rstate[R600_MAX_RSTATE]; struct r600_shader shader; struct radeon_bo *bo; + unsigned nrstate; }; struct r600_vertex_element @@ -153,10 +156,10 @@ struct r600_context { struct r600_context_state *stencil_ref; struct r600_context_state *viewport; struct r600_context_state *framebuffer; - struct r600_context_state *ps_sampler[PIPE_MAX_ATTRIBS]; - struct r600_context_state *vs_sampler[PIPE_MAX_ATTRIBS]; - struct r600_context_state *ps_sampler_view[PIPE_MAX_ATTRIBS]; - struct r600_context_state *vs_sampler_view[PIPE_MAX_ATTRIBS]; + struct radeon_state *ps_sampler[PIPE_MAX_ATTRIBS]; + struct radeon_state *vs_sampler[PIPE_MAX_ATTRIBS]; + struct radeon_state *ps_sampler_view[PIPE_MAX_ATTRIBS]; + struct radeon_state *vs_sampler_view[PIPE_MAX_ATTRIBS]; struct r600_vertex_element *vertex_elements; struct pipe_vertex_buffer vertex_buffer[PIPE_MAX_ATTRIBS]; struct pipe_index_buffer index_buffer; diff --git a/src/gallium/drivers/r600/r600_state.c b/src/gallium/drivers/r600/r600_state.c index 888507747b..95611d1739 100644 --- a/src/gallium/drivers/r600/r600_state.c +++ b/src/gallium/drivers/r600/r600_state.c @@ -235,14 +235,23 @@ static void r600_bind_ps_sampler(struct pipe_context *ctx, struct r600_context_state *rstate; unsigned i; - for (i = 0; i < rctx->ps_nsampler; i++) { - rctx->ps_sampler[i] = r600_context_state_decref(rctx->ps_sampler[i]); + for (i = 0; i < count; i++) { + rstate = (struct r600_context_state *)states[i]; + if (rstate) { + rstate->nrstate = 0; + } } for (i = 0; i < count; i++) { rstate = (struct r600_context_state *)states[i]; - rctx->ps_sampler[i] = r600_context_state_incref(rstate); if (rstate) { - radeon_state_convert(&rstate->rstate[0], R600_STATE_SAMPLER, i, R600_SHADER_PS); + if (rstate->nrstate >= R600_MAX_RSTATE) + continue; + if (rstate->nrstate) { + memcpy(&rstate->rstate[rstate->nrstate], &rstate->rstate[0], sizeof(struct radeon_state)); + } + radeon_state_convert(&rstate->rstate[rstate->nrstate], R600_STATE_SAMPLER, i, R600_SHADER_PS); + rctx->ps_sampler[i] = &rstate->rstate[rstate->nrstate]; + rstate->nrstate++; } } rctx->ps_nsampler = count; @@ -255,14 +264,23 @@ static void r600_bind_vs_sampler(struct pipe_context *ctx, struct r600_context_state *rstate; unsigned i; - for (i = 0; i < rctx->vs_nsampler; i++) { - rctx->vs_sampler[i] = r600_context_state_decref(rctx->vs_sampler[i]); + for (i = 0; i < count; i++) { + rstate = (struct r600_context_state *)states[i]; + if (rstate) { + rstate->nrstate = 0; + } } for (i = 0; i < count; i++) { rstate = (struct r600_context_state *)states[i]; - rctx->vs_sampler[i] = r600_context_state_incref(rstate); if (rstate) { - radeon_state_convert(&rstate->rstate[0], R600_STATE_SAMPLER, i, R600_SHADER_VS); + if (rstate->nrstate >= R600_MAX_RSTATE) + continue; + if (rstate->nrstate) { + memcpy(&rstate->rstate[rstate->nrstate], &rstate->rstate[0], sizeof(struct radeon_state)); + } + radeon_state_convert(&rstate->rstate[rstate->nrstate], R600_STATE_SAMPLER, i, R600_SHADER_VS); + rctx->vs_sampler[i] = &rstate->rstate[rstate->nrstate]; + rstate->nrstate++; } } rctx->vs_nsampler = count; @@ -349,14 +367,23 @@ static void r600_set_ps_sampler_view(struct pipe_context *ctx, struct r600_context_state *rstate; unsigned i; - for (i = 0; i < rctx->ps_nsampler_view; i++) { - rctx->ps_sampler_view[i] = r600_context_state_decref(rctx->ps_sampler_view[i]); + for (i = 0; i < count; i++) { + rstate = (struct r600_context_state *)views[i]; + if (rstate) { + rstate->nrstate = 0; + } } for (i = 0; i < count; i++) { rstate = (struct r600_context_state *)views[i]; - rctx->ps_sampler_view[i] = r600_context_state_incref(rstate); if (rstate) { - radeon_state_convert(&rstate->rstate[0], R600_STATE_RESOURCE, i, R600_SHADER_PS); + if (rstate->nrstate >= R600_MAX_RSTATE) + continue; + if (rstate->nrstate) { + memcpy(&rstate->rstate[rstate->nrstate], &rstate->rstate[0], sizeof(struct radeon_state)); + } + radeon_state_convert(&rstate->rstate[rstate->nrstate], R600_STATE_RESOURCE, i, R600_SHADER_PS); + rctx->ps_sampler_view[i] = &rstate->rstate[rstate->nrstate]; + rstate->nrstate++; } } rctx->ps_nsampler_view = count; @@ -370,14 +397,23 @@ static void r600_set_vs_sampler_view(struct pipe_context *ctx, struct r600_context_state *rstate; unsigned i; - for (i = 0; i < rctx->vs_nsampler_view; i++) { - rctx->vs_sampler_view[i] = r600_context_state_decref(rctx->vs_sampler_view[i]); + for (i = 0; i < count; i++) { + rstate = (struct r600_context_state *)views[i]; + if (rstate) { + rstate->nrstate = 0; + } } for (i = 0; i < count; i++) { rstate = (struct r600_context_state *)views[i]; - rctx->vs_sampler_view[i] = r600_context_state_incref(rstate); if (rstate) { - radeon_state_convert(&rstate->rstate[0], R600_STATE_RESOURCE, i, R600_SHADER_VS); + if (rstate->nrstate >= R600_MAX_RSTATE) + continue; + if (rstate->nrstate) { + memcpy(&rstate->rstate[rstate->nrstate], &rstate->rstate[0], sizeof(struct radeon_state)); + } + radeon_state_convert(&rstate->rstate[rstate->nrstate], R600_STATE_RESOURCE, i, R600_SHADER_VS); + rctx->vs_sampler_view[i] = &rstate->rstate[rstate->nrstate]; + rstate->nrstate++; } } rctx->vs_nsampler_view = count; @@ -1354,12 +1390,12 @@ int r600_context_hw_states(struct pipe_context *ctx) } for (i = 0; i < rctx->ps_nsampler; i++) { if (rctx->ps_sampler[i]) { - radeon_draw_bind(&rctx->draw, &rctx->ps_sampler[i]->rstate[0]); + radeon_draw_bind(&rctx->draw, rctx->ps_sampler[i]); } } for (i = 0; i < rctx->ps_nsampler_view; i++) { if (rctx->ps_sampler_view[i]) { - radeon_draw_bind(&rctx->draw, &rctx->ps_sampler_view[i]->rstate[0]); + radeon_draw_bind(&rctx->draw, rctx->ps_sampler_view[i]); } } return 0; -- cgit v1.2.3 From 7299023c2aa5378b2d54663a53cb2fa4e743fa73 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Thu, 2 Sep 2010 13:32:25 +1000 Subject: r600g: add missing vertex fetch formats to the translation table. fixes at least 2 more piglits. --- src/gallium/drivers/r600/r600_state_inlines.h | 2 ++ src/gallium/drivers/r600/r600d.h | 1 + 2 files changed, 3 insertions(+) (limited to 'src') diff --git a/src/gallium/drivers/r600/r600_state_inlines.h b/src/gallium/drivers/r600/r600_state_inlines.h index d67d4be6f8..84866825aa 100644 --- a/src/gallium/drivers/r600/r600_state_inlines.h +++ b/src/gallium/drivers/r600/r600_state_inlines.h @@ -252,6 +252,7 @@ static INLINE uint32_t r600_translate_colorformat(enum pipe_format format) case PIPE_FORMAT_R8SG8SB8UX8U_NORM: case PIPE_FORMAT_X8B8G8R8_UNORM: case PIPE_FORMAT_X8R8G8B8_UNORM: + case PIPE_FORMAT_R8G8B8_UNORM: return V_0280A0_COLOR_8_8_8_8; case PIPE_FORMAT_R10G10B10A2_UNORM: @@ -278,6 +279,7 @@ static INLINE uint32_t r600_translate_colorformat(enum pipe_format format) /* 128-bit buffers. */ case PIPE_FORMAT_R32G32B32_FLOAT: + return V_0280A0_COLOR_32_32_32_FLOAT; case PIPE_FORMAT_R32G32B32A32_FLOAT: return V_0280A0_COLOR_32_32_32_32_FLOAT; diff --git a/src/gallium/drivers/r600/r600d.h b/src/gallium/drivers/r600/r600d.h index 9bdfe4f966..7b9a983d53 100644 --- a/src/gallium/drivers/r600/r600d.h +++ b/src/gallium/drivers/r600/r600d.h @@ -199,6 +199,7 @@ #define V_0280A0_COLOR_16_16_16_16_FLOAT 0x00000020 #define V_0280A0_COLOR_32_32_32_32 0x00000022 #define V_0280A0_COLOR_32_32_32_32_FLOAT 0x00000023 +#define V_0280A0_COLOR_32_32_32_FLOAT 0x00000030 #define S_0280A0_ARRAY_MODE(x) (((x) & 0xF) << 8) #define G_0280A0_ARRAY_MODE(x) (((x) >> 8) & 0xF) #define C_0280A0_ARRAY_MODE 0xFFFFF0FF -- cgit v1.2.3 From 37200d83d3e61aa480e6dbb350e522bd0388644c Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Wed, 1 Sep 2010 13:46:04 -0700 Subject: glsl2: Emit structure constructors inline Fixes piglit test cases glsl-[fv]s-all-0[12]. --- src/glsl/ast_function.cpp | 107 ++++++++++++++++++++++++++++++---------------- 1 file changed, 70 insertions(+), 37 deletions(-) (limited to 'src') diff --git a/src/glsl/ast_function.cpp b/src/glsl/ast_function.cpp index 1fa2fabefb..1cd300c382 100644 --- a/src/glsl/ast_function.cpp +++ b/src/glsl/ast_function.cpp @@ -429,43 +429,14 @@ process_array_constructor(exec_list *instructions, */ static ir_constant * constant_record_constructor(const glsl_type *constructor_type, - YYLTYPE *loc, exec_list *parameters, - struct _mesa_glsl_parse_state *state) + exec_list *parameters, void *mem_ctx) { - void *ctx = 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_sentinel()) { - _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); + foreach_list(node, parameters) { + if (((ir_instruction *) node)->as_constant() == NULL) 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); + return new(mem_ctx) ir_constant(constructor_type, parameters); } @@ -948,6 +919,39 @@ emit_inline_matrix_constructor(const glsl_type *type, } +ir_rvalue * +emit_inline_record_constructor(const glsl_type *type, + exec_list *instructions, + exec_list *parameters, + void *mem_ctx) +{ + ir_variable *const var = + new(mem_ctx) ir_variable(type, "record_ctor", ir_var_temporary); + ir_dereference_variable *const d = new(mem_ctx) ir_dereference_variable(var); + + instructions->push_tail(var); + + exec_node *node = parameters->head; + for (unsigned i = 0; i < type->length; i++) { + assert(!node->is_tail_sentinel()); + + ir_dereference *const lhs = + new(mem_ctx) ir_dereference_record(d->clone(mem_ctx, NULL), + type->fields.structure[i].name); + + ir_rvalue *const rhs = ((ir_instruction *) node)->as_rvalue(); + assert(rhs != NULL); + + ir_instruction *const assign = new(mem_ctx) ir_assignment(lhs, rhs, NULL); + + instructions->push_tail(assign); + node = node->next; + } + + return d; +} + + ir_rvalue * ast_function_expression::hir(exec_list *instructions, struct _mesa_glsl_parse_state *state) @@ -989,6 +993,7 @@ ast_function_expression::hir(exec_list *instructions, & 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 @@ -1176,11 +1181,39 @@ ast_function_expression::hir(exec_list *instructions, 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); + exec_node *node = actual_parameters.head; + for (unsigned i = 0; i < type->length; i++) { + ir_instruction *ir = (ir_instruction *) node; + + if (node->is_tail_sentinel()) { + _mesa_glsl_error(&loc, state, + "insufficient parameters to constructor " + "for `%s'", + type->name); + return ir_call::get_error_instruction(ctx); + } - if (constant != NULL) - return constant; + if (ir->type != type->fields.structure[i].type) { + _mesa_glsl_error(&loc, state, + "parameter type mismatch in constructor " + "for `%s.%s' (%s vs %s)", + type->name, + type->fields.structure[i].name, + ir->type->name, + type->fields.structure[i].type->name); + return ir_call::get_error_instruction(ctx);; + } + + node = node->next; + } + + ir_rvalue *const constant = + constant_record_constructor(type, &actual_parameters, state); + + return (constant != NULL) + ? constant + : emit_inline_record_constructor(type, instructions, + &actual_parameters, state); } return match_function_by_name(instructions, -- cgit v1.2.3 From a789ca649cb143c0c5bf3209ff1bde398fbd777e Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Wed, 1 Sep 2010 14:08:08 -0700 Subject: glsl2: Don't generate constructor functions for structures --- src/glsl/ast_to_hir.cpp | 3 +-- src/glsl/glsl_symbol_table.cpp | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp index 84aa6501c5..970ac0818e 100644 --- a/src/glsl/ast_to_hir.cpp +++ b/src/glsl/ast_to_hir.cpp @@ -2730,8 +2730,7 @@ ast_struct_specifier::hir(exec_list *instructions, glsl_type::get_record_instance(fields, decl_count, name); YYLTYPE loc = this->get_location(); - ir_function *ctor = t->generate_constructor(); - if (!state->symbols->add_type(name, t, ctor)) { + if (!state->symbols->add_type(name, t)) { _mesa_glsl_error(& loc, state, "struct `%s' previously defined", name); } else { diff --git a/src/glsl/glsl_symbol_table.cpp b/src/glsl/glsl_symbol_table.cpp index ed71244cbf..c71f3f830c 100644 --- a/src/glsl/glsl_symbol_table.cpp +++ b/src/glsl/glsl_symbol_table.cpp @@ -127,7 +127,7 @@ bool glsl_symbol_table::add_function(const char *name, ir_function *f) if (this->language_version == 110 && name_declared_this_scope(name)) { /* In 1.10, functions and variables have separate namespaces. */ symbol_table_entry *existing = get_entry(name); - if (existing->f == NULL) { + if ((existing->f == NULL) && (existing->t == NULL)) { existing->f = f; return true; } -- cgit v1.2.3 From 16d9ebb35771af2bc27024bb4b788ef6427a4f23 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Wed, 1 Sep 2010 14:10:39 -0700 Subject: glsl2: Remove unused 'constructor' parameter from glsl_symbol_table::add_type --- src/glsl/glsl_symbol_table.cpp | 7 +++---- src/glsl/glsl_symbol_table.h | 3 +-- 2 files changed, 4 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/glsl/glsl_symbol_table.cpp b/src/glsl/glsl_symbol_table.cpp index c71f3f830c..b56b087530 100644 --- a/src/glsl/glsl_symbol_table.cpp +++ b/src/glsl/glsl_symbol_table.cpp @@ -46,7 +46,7 @@ public: symbol_table_entry(ir_variable *v) : v(v), f(0), t(0) {} symbol_table_entry(ir_function *f) : v(0), f(f), t(0) {} - symbol_table_entry(const glsl_type *t, ir_function *f) : v(0), f(f), t(t) {} + symbol_table_entry(const glsl_type *t) : v(0), f(0), t(t) {} ir_variable *v; ir_function *f; @@ -115,10 +115,9 @@ bool glsl_symbol_table::add_variable(const char *name, ir_variable *v) return _mesa_symbol_table_add_symbol(table, -1, name, entry) == 0; } -bool glsl_symbol_table::add_type(const char *name, const glsl_type *t, - ir_function *constructor) +bool glsl_symbol_table::add_type(const char *name, const glsl_type *t) { - symbol_table_entry *entry = new(mem_ctx) symbol_table_entry(t, constructor); + symbol_table_entry *entry = new(mem_ctx) symbol_table_entry(t); return _mesa_symbol_table_add_symbol(table, -1, name, entry) == 0; } diff --git a/src/glsl/glsl_symbol_table.h b/src/glsl/glsl_symbol_table.h index c90fdc3c1d..f1369b52c8 100644 --- a/src/glsl/glsl_symbol_table.h +++ b/src/glsl/glsl_symbol_table.h @@ -98,8 +98,7 @@ public: */ /*@{*/ bool add_variable(const char *name, ir_variable *v); - bool add_type(const char *name, const glsl_type *t, - ir_function *constructor = NULL); + bool add_type(const char *name, const glsl_type *t); bool add_function(const char *name, ir_function *f); /*@}*/ -- cgit v1.2.3 From 4d6221f90df9d04e5edcdddb3b6f76c0cb175421 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Wed, 1 Sep 2010 14:12:24 -0700 Subject: glsl2: Remove unused method glsl_type::generate_constructor --- src/glsl/glsl_types.cpp | 55 ------------------------------------------------- src/glsl/glsl_types.h | 4 ---- 2 files changed, 59 deletions(-) (limited to 'src') diff --git a/src/glsl/glsl_types.cpp b/src/glsl/glsl_types.cpp index a7d02e18df..92ad3efafc 100644 --- a/src/glsl/glsl_types.cpp +++ b/src/glsl/glsl_types.cpp @@ -232,61 +232,6 @@ _mesa_glsl_release_types(void) } -ir_function * -glsl_type::generate_constructor() const -{ - void *ctx = (void *) this; - - ir_function *const f = new(ctx) ir_function(name); - 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, ir_var_in) - : new(ctx) ir_variable(fields.structure[i].type, param_name, 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 _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, "_ret_val", ir_var_auto); - 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; -} - - glsl_type::glsl_type(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 3e86d2c011..b4e83c9833 100644 --- a/src/glsl/glsl_types.h +++ b/src/glsl/glsl_types.h @@ -207,10 +207,6 @@ struct glsl_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 return it - */ - class ir_function *generate_constructor() const; /** * Query the total number of scalars that make up a scalar, vector or matrix -- cgit v1.2.3 From e466b182bbf21f62fe6542091f4af3275555db80 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Wed, 1 Sep 2010 14:16:53 -0700 Subject: glsl2: Remove unnecessary glsl_symbol_table::get_function parameter return_constructors Now that constructors are not generated as functions or stored in the symbol table, there is no need to flag whether or not constructors should be returned. --- src/glsl/ast_to_hir.cpp | 2 +- src/glsl/glsl_symbol_table.cpp | 9 ++------- src/glsl/glsl_symbol_table.h | 2 +- 3 files changed, 4 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp index 970ac0818e..5bdf3da367 100644 --- a/src/glsl/ast_to_hir.cpp +++ b/src/glsl/ast_to_hir.cpp @@ -2257,7 +2257,7 @@ ast_function::hir(exec_list *instructions, * 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. */ - f = state->symbols->get_function(name, false); + f = state->symbols->get_function(name); if (f != NULL && !f->is_builtin) { sig = f->exact_matching_signature(&hir_parameters); if (sig != NULL) { diff --git a/src/glsl/glsl_symbol_table.cpp b/src/glsl/glsl_symbol_table.cpp index b56b087530..e9bf89b951 100644 --- a/src/glsl/glsl_symbol_table.cpp +++ b/src/glsl/glsl_symbol_table.cpp @@ -147,15 +147,10 @@ const glsl_type *glsl_symbol_table::get_type(const char *name) return entry != NULL ? entry->t : NULL; } -ir_function *glsl_symbol_table::get_function(const char *name, - bool return_constructors) +ir_function *glsl_symbol_table::get_function(const char *name) { symbol_table_entry *entry = get_entry(name); - // If there's a type, the function is a constructor; caller may not want it. - if (entry != NULL && (return_constructors || entry->t == NULL)) - return entry->f; - - return NULL; + return entry != NULL ? entry->f : NULL; } symbol_table_entry *glsl_symbol_table::get_entry(const char *name) diff --git a/src/glsl/glsl_symbol_table.h b/src/glsl/glsl_symbol_table.h index f1369b52c8..f26de52432 100644 --- a/src/glsl/glsl_symbol_table.h +++ b/src/glsl/glsl_symbol_table.h @@ -108,7 +108,7 @@ public: /*@{*/ ir_variable *get_variable(const char *name); const glsl_type *get_type(const char *name); - ir_function *get_function(const char *name, bool return_constructors = true); + ir_function *get_function(const char *name); /*@}*/ private: -- cgit v1.2.3 From cfe0dd5622a9b26e6df18801413ad8dc336f0c56 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Wed, 1 Sep 2010 19:44:25 -0700 Subject: glsl: Reject structure constructors that have too many arguments. Fixes piglit test constructor-27.vert. --- src/glsl/ast_function.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src') diff --git a/src/glsl/ast_function.cpp b/src/glsl/ast_function.cpp index 1cd300c382..c3b4441435 100644 --- a/src/glsl/ast_function.cpp +++ b/src/glsl/ast_function.cpp @@ -1207,6 +1207,12 @@ ast_function_expression::hir(exec_list *instructions, node = node->next; } + if (!node->is_tail_sentinel()) { + _mesa_glsl_error(&loc, state, "too many parameters in constructor " + "for `%s'", type->name); + return ir_call::get_error_instruction(ctx); + } + ir_rvalue *const constant = constant_record_constructor(type, &actual_parameters, state); -- cgit v1.2.3 From 43a6200f3c3fb29d2e9654a293b2328cd6c0f64f Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Wed, 1 Sep 2010 19:54:27 -0700 Subject: glsl: Convert constant record constructor parameters to ir_constants. I'm not sure if this is strictly necessary, but it seems wise. --- src/glsl/ast_function.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/glsl/ast_function.cpp b/src/glsl/ast_function.cpp index c3b4441435..1a5a193ad5 100644 --- a/src/glsl/ast_function.cpp +++ b/src/glsl/ast_function.cpp @@ -432,8 +432,10 @@ constant_record_constructor(const glsl_type *constructor_type, exec_list *parameters, void *mem_ctx) { foreach_list(node, parameters) { - if (((ir_instruction *) node)->as_constant() == NULL) + ir_constant *constant = ((ir_instruction *) node)->as_constant(); + if (constant == NULL) return NULL; + node->replace_with(constant); } return new(mem_ctx) ir_constant(constructor_type, parameters); -- cgit v1.2.3 From f32d3df8ab2b7c6c746f46870edc4b284cea50ca Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Wed, 1 Sep 2010 20:03:17 -0700 Subject: glsl: Apply implicit conversions to structure constructor parameters. The code for handling implicit conversions should probably get refactored, but for now, this is easy. Fixes piglit test constructor-26.vert. --- src/glsl/ast_function.cpp | 11 +++++++++-- src/glsl/ast_to_hir.cpp | 2 +- 2 files changed, 10 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/glsl/ast_function.cpp b/src/glsl/ast_function.cpp index 1a5a193ad5..61012b850a 100644 --- a/src/glsl/ast_function.cpp +++ b/src/glsl/ast_function.cpp @@ -30,6 +30,10 @@ static ir_rvalue * convert_component(ir_rvalue *src, const glsl_type *desired_type); +bool +apply_implicit_conversion(const glsl_type *to, ir_rvalue * &from, + struct _mesa_glsl_parse_state *state); + static unsigned process_parameters(exec_list *instructions, exec_list *actual_parameters, exec_list *parameters, @@ -1185,7 +1189,7 @@ ast_function_expression::hir(exec_list *instructions, if ((type != NULL) && type->is_record()) { exec_node *node = actual_parameters.head; for (unsigned i = 0; i < type->length; i++) { - ir_instruction *ir = (ir_instruction *) node; + ir_rvalue *ir = (ir_rvalue *) node; if (node->is_tail_sentinel()) { _mesa_glsl_error(&loc, state, @@ -1195,7 +1199,10 @@ ast_function_expression::hir(exec_list *instructions, return ir_call::get_error_instruction(ctx); } - if (ir->type != type->fields.structure[i].type) { + if (apply_implicit_conversion(type->fields.structure[i].type, ir, + state)) { + node->replace_with(ir); + } else { _mesa_glsl_error(&loc, state, "parameter type mismatch in constructor " "for `%s.%s' (%s vs %s)", diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp index 5bdf3da367..762f802c2b 100644 --- a/src/glsl/ast_to_hir.cpp +++ b/src/glsl/ast_to_hir.cpp @@ -97,7 +97,7 @@ _mesa_ast_to_hir(exec_list *instructions, struct _mesa_glsl_parse_state *state) * If a conversion is possible (or unnecessary), \c true is returned. * Otherwise \c false is returned. */ -static bool +bool apply_implicit_conversion(const glsl_type *to, ir_rvalue * &from, struct _mesa_glsl_parse_state *state) { -- cgit v1.2.3 From e8ff0f63b6f078b17989e42dd05c9b69729b341b Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Thu, 2 Sep 2010 15:51:23 +1000 Subject: r600g: fix depth texture tests --- src/gallium/drivers/r600/r600_texture.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/r600_texture.c b/src/gallium/drivers/r600/r600_texture.c index 83fd01e8a1..b6698e3885 100644 --- a/src/gallium/drivers/r600/r600_texture.c +++ b/src/gallium/drivers/r600/r600_texture.c @@ -455,6 +455,8 @@ uint32_t r600_translate_texformat(enum pipe_format format, }; desc = util_format_description(format); + word4 |= r600_get_swizzle_combined(desc->swizzle, swizzle_view); + /* Colorspace (return non-RGB formats directly). */ switch (desc->colorspace) { /* Depth stencil formats */ @@ -493,8 +495,6 @@ uint32_t r600_translate_texformat(enum pipe_format format, break; } - word4 |= r600_get_swizzle_combined(desc->swizzle, swizzle_view); - /* S3TC formats. TODO */ if (desc->layout == UTIL_FORMAT_LAYOUT_S3TC) { goto out_unknown; -- cgit v1.2.3 From 76d0541e79d4fe2ffcb25b17f9dd540fafc14ba2 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Thu, 2 Sep 2010 16:39:32 +1000 Subject: r600g: fix logicop, the 3d ROP is the 2D rop shifted twice. --- src/gallium/drivers/r600/r600_state.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/r600_state.c b/src/gallium/drivers/r600/r600_state.c index 95611d1739..66cab7d7a6 100644 --- a/src/gallium/drivers/r600/r600_state.c +++ b/src/gallium/drivers/r600/r600_state.c @@ -1319,7 +1319,7 @@ static void r600_cb_cntl(struct r600_context *rctx, struct radeon_state *rstate) } if (pbs->logicop_enable) { - color_control |= (pbs->logicop_func) << 16; + color_control |= (pbs->logicop_func << 16) | (pbs->logicop_func << 20); } else { color_control |= (0xcc << 16); } -- cgit v1.2.3 From 5d5f693cefe452bd8bd7e45f8b5d7ed991ae5115 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Thu, 2 Sep 2010 21:25:42 +1000 Subject: r600g: fix thinko in shadow code. spotted by taiu on irc --- src/gallium/drivers/r600/r600_shader.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/r600_shader.c b/src/gallium/drivers/r600/r600_shader.c index 3147bc7ca3..0ba26a2311 100644 --- a/src/gallium/drivers/r600/r600_shader.c +++ b/src/gallium/drivers/r600/r600_shader.c @@ -1684,7 +1684,7 @@ static int tgsi_tex(struct r600_shader_ctx *ctx) } if (inst->Texture.Texture == TGSI_TEXTURE_SHADOW1D || inst->Texture.Texture == TGSI_TEXTURE_SHADOW2D) - tex.coord_type_w = 2; + tex.src_sel_w = 2; r = r600_bc_add_tex(ctx->bc, &tex); if (r) -- cgit v1.2.3 From 9eca0e2c3e9409b5da49d9a5052d3665e7d45bb1 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 2 Sep 2010 07:57:16 -0600 Subject: mesa: fix some printf warnings with casts --- src/mesa/main/bufferobj.c | 8 ++++---- src/mesa/main/extensions.c | 2 +- src/mesa/main/transformfeedback.c | 6 +++--- src/mesa/vbo/vbo_exec_array.c | 4 ++-- 4 files changed, 10 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c index 895ce76e4b..4797f29b4d 100644 --- a/src/mesa/main/bufferobj.c +++ b/src/mesa/main/bufferobj.c @@ -1553,27 +1553,27 @@ _mesa_CopyBufferSubData(GLenum readTarget, GLenum writeTarget, if (readOffset < 0) { _mesa_error(ctx, GL_INVALID_VALUE, - "glCopyBuffserSubData(readOffset = %d)", readOffset); + "glCopyBuffserSubData(readOffset = %d)", (int) readOffset); return; } if (writeOffset < 0) { _mesa_error(ctx, GL_INVALID_VALUE, - "glCopyBuffserSubData(writeOffset = %d)", writeOffset); + "glCopyBuffserSubData(writeOffset = %d)", (int) writeOffset); return; } if (readOffset + size > src->Size) { _mesa_error(ctx, GL_INVALID_VALUE, "glCopyBuffserSubData(readOffset + size = %d)", - readOffset + size); + (int) (readOffset + size)); return; } if (writeOffset + size > dst->Size) { _mesa_error(ctx, GL_INVALID_VALUE, "glCopyBuffserSubData(writeOffset + size = %d)", - writeOffset + size); + (int) (writeOffset + size)); return; } diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c index 19a1eebe6e..c9862ca29e 100644 --- a/src/mesa/main/extensions.c +++ b/src/mesa/main/extensions.c @@ -969,7 +969,7 @@ _mesa_get_extension_count(GLcontext *ctx) if (0) _mesa_debug(ctx, "%u of %d extensions enabled\n", ctx->Extensions.Count, - Elements(default_extensions)); + (int) Elements(default_extensions)); return ctx->Extensions.Count; } diff --git a/src/mesa/main/transformfeedback.c b/src/mesa/main/transformfeedback.c index fe87623522..5c8c1fd225 100644 --- a/src/mesa/main/transformfeedback.c +++ b/src/mesa/main/transformfeedback.c @@ -455,14 +455,14 @@ _mesa_BindBufferRange(GLenum target, GLuint index, if ((size <= 0) || (size & 0x3)) { /* must be positive and multiple of four */ - _mesa_error(ctx, GL_INVALID_VALUE, "glBindBufferRange(size%d)", size); + _mesa_error(ctx, GL_INVALID_VALUE, "glBindBufferRange(size%d)", (int) size); return; } if (offset & 0x3) { /* must be multiple of four */ _mesa_error(ctx, GL_INVALID_VALUE, - "glBindBufferRange(offset=%d)", offset); + "glBindBufferRange(offset=%d)", (int) offset); return; } @@ -476,7 +476,7 @@ _mesa_BindBufferRange(GLenum target, GLuint index, if (offset + size >= bufObj->Size) { _mesa_error(ctx, GL_INVALID_VALUE, "glBindBufferRange(offset + size %d > buffer size %d)", - offset + size, bufObj->Size); + (int) (offset + size), (int) (bufObj->Size)); return; } diff --git a/src/mesa/vbo/vbo_exec_array.c b/src/mesa/vbo/vbo_exec_array.c index c32a504443..1759e57887 100644 --- a/src/mesa/vbo/vbo_exec_array.c +++ b/src/mesa/vbo/vbo_exec_array.c @@ -785,7 +785,7 @@ vbo_exec_DrawRangeElementsBaseVertex(GLenum mode, start, end, count, type, indices, ctx->Array.ArrayObj->_MaxElement - 1, ctx->Array.ElementArrayBufferObj->Name, - ctx->Array.ElementArrayBufferObj->Size); + (int) ctx->Array.ElementArrayBufferObj->Size); } if (0) @@ -811,7 +811,7 @@ vbo_exec_DrawRangeElementsBaseVertex(GLenum mode, start, end, count, type, indices, max, ctx->Array.ArrayObj->_MaxElement - 1, ctx->Array.ElementArrayBufferObj->Name, - ctx->Array.ElementArrayBufferObj->Size); + (int) ctx->Array.ElementArrayBufferObj->Size); } } /* XXX we could also find the min index and compare to 'start' -- cgit v1.2.3 From c9039fdb167865547dc9b3828d69b99209344999 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 2 Sep 2010 07:58:28 -0600 Subject: mesa: fix code generation for ir_unop_sqrt The CMP instruction needed to be flipped to properly handle operand==0. Fixes fd.o bug 29923. --- src/mesa/program/ir_to_mesa.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp index b2ba9a2fbc..f0e14b8ece 100644 --- a/src/mesa/program/ir_to_mesa.cpp +++ b/src/mesa/program/ir_to_mesa.cpp @@ -1198,9 +1198,10 @@ ir_to_mesa_visitor::visit(ir_expression *ir) /* sqrt(x) = x * rsq(x). */ ir_to_mesa_emit_scalar_op1(ir, OPCODE_RSQ, result_dst, op[0]); ir_to_mesa_emit_op2(ir, OPCODE_MUL, result_dst, result_src, op[0]); - /* For incoming channels < 0, set the result to 0. */ + /* For incoming channels <= 0, set the result to 0. */ + op[0].negate = ~op[0].negate; ir_to_mesa_emit_op3(ir, OPCODE_CMP, result_dst, - op[0], src_reg_for_float(0.0), result_src); + op[0], result_src, src_reg_for_float(0.0)); break; case ir_unop_rsq: ir_to_mesa_emit_scalar_op1(ir, OPCODE_RSQ, result_dst, op[0]); -- cgit v1.2.3 From e73c5501b2fe20290d1b691c85a5d82ac3a0431c Mon Sep 17 00:00:00 2001 From: Jerome Glisse Date: Thu, 2 Sep 2010 11:32:32 -0400 Subject: r600g: fix memory/bo leak Signed-off-by: Jerome Glisse --- src/gallium/drivers/r600/r600_context.c | 15 +++++++++++++++ src/gallium/drivers/r600/r600_context.h | 1 + src/gallium/drivers/r600/r600_draw.c | 4 ++++ src/gallium/winsys/r600/drm/radeon_ctx.c | 3 +-- 4 files changed, 21 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/r600_context.c b/src/gallium/drivers/r600/r600_context.c index 0e5e0632bf..7a0e5b4049 100644 --- a/src/gallium/drivers/r600/r600_context.c +++ b/src/gallium/drivers/r600/r600_context.c @@ -39,6 +39,21 @@ static void r600_destroy_context(struct pipe_context *context) { struct r600_context *rctx = r600_context(context); + rctx->rasterizer = r600_context_state_decref(rctx->rasterizer); + rctx->poly_stipple = r600_context_state_decref(rctx->poly_stipple); + rctx->scissor = r600_context_state_decref(rctx->scissor); + rctx->clip = r600_context_state_decref(rctx->clip); + rctx->ps_shader = r600_context_state_decref(rctx->ps_shader); + rctx->vs_shader = r600_context_state_decref(rctx->vs_shader); + rctx->depth = r600_context_state_decref(rctx->depth); + rctx->stencil = r600_context_state_decref(rctx->stencil); + rctx->alpha = r600_context_state_decref(rctx->alpha); + rctx->dsa = r600_context_state_decref(rctx->dsa); + rctx->blend = r600_context_state_decref(rctx->blend); + rctx->stencil_ref = r600_context_state_decref(rctx->stencil_ref); + rctx->viewport = r600_context_state_decref(rctx->viewport); + rctx->framebuffer = r600_context_state_decref(rctx->framebuffer); + radeon_ctx_fini(&rctx->ctx); FREE(rctx); } diff --git a/src/gallium/drivers/r600/r600_context.h b/src/gallium/drivers/r600/r600_context.h index d4e3baa69d..cea0813054 100644 --- a/src/gallium/drivers/r600/r600_context.h +++ b/src/gallium/drivers/r600/r600_context.h @@ -131,6 +131,7 @@ struct r600_context { struct radeon_state config; /* FIXME get rid of those vs_resource,vs/ps_constant */ struct radeon_state vs_resource[160]; + unsigned vs_nresource; struct radeon_state vs_constant[256]; struct radeon_state ps_constant[256]; /* hw states */ diff --git a/src/gallium/drivers/r600/r600_draw.c b/src/gallium/drivers/r600/r600_draw.c index 9cc26bbada..fabd337d23 100644 --- a/src/gallium/drivers/r600/r600_draw.c +++ b/src/gallium/drivers/r600/r600_draw.c @@ -94,6 +94,9 @@ static int r600_draw_common(struct r600_draw *draw) radeon_draw_bind(&rctx->draw, &rctx->vs_shader->rstate[0]); radeon_draw_bind(&rctx->draw, &rctx->ps_shader->rstate[0]); + for (i = 0 ; i < rctx->vs_nresource; i++) { + radeon_state_fini(&rctx->vs_resource[i]); + } for (i = 0 ; i < rctx->vertex_elements->count; i++) { vs_resource = &rctx->vs_resource[i]; j = rctx->vertex_elements->elements[i].vertex_buffer_index; @@ -120,6 +123,7 @@ static int r600_draw_common(struct r600_draw *draw) } radeon_draw_bind(&rctx->draw, vs_resource); } + rctx->vs_nresource = rctx->vertex_elements->count; /* FIXME start need to change winsys */ radeon_state_init(&draw->draw, rscreen->rw, R600_STATE_DRAW, 0, 0); draw->draw.states[R600_DRAW__VGT_NUM_INDICES] = draw->count; diff --git a/src/gallium/winsys/r600/drm/radeon_ctx.c b/src/gallium/winsys/r600/drm/radeon_ctx.c index 50c5e4741e..47fca76136 100644 --- a/src/gallium/winsys/r600/drm/radeon_ctx.c +++ b/src/gallium/winsys/r600/drm/radeon_ctx.c @@ -121,8 +121,7 @@ void radeon_ctx_fini(struct radeon_ctx *ctx) free(ctx->bo); free(ctx->pm4); free(ctx->reloc); - memset(ctx, 0, sizeof(*ctx)); - free(ctx); + memset(ctx, 0, sizeof(struct radeon_ctx)); } static int radeon_ctx_state_bo(struct radeon_ctx *ctx, struct radeon_state *state) -- cgit v1.2.3